diff --git a/.DS_Store b/.DS_Store index 686b7e9..fd15415 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/write-message/.DS_Store b/write-message/.DS_Store deleted file mode 100644 index cba6a02..0000000 Binary files a/write-message/.DS_Store and /dev/null differ diff --git a/write-message/README.md b/write-message/README.md deleted file mode 100644 index c6de614..0000000 --- a/write-message/README.md +++ /dev/null @@ -1 +0,0 @@ -python -m uvicorn main:app --reload --host 127.0.0.1 --port 8443 --ssl-keyfile=key.pem --ssl-certfile=cert.pem diff --git a/write-message/__pycache__/main.cpython-310.pyc b/write-message/__pycache__/main.cpython-310.pyc deleted file mode 100644 index 587a4e9..0000000 Binary files a/write-message/__pycache__/main.cpython-310.pyc and /dev/null differ diff --git a/write-message/main.py b/write-message/main.py deleted file mode 100644 index cb9f9ac..0000000 --- a/write-message/main.py +++ /dev/null @@ -1,101 +0,0 @@ -from fastapi import FastAPI, Body -from pydantic import BaseModel -from fastapi.middleware.cors import CORSMiddleware -from openai import OpenAI -import pyautogui -import os -import time -import pyperclip - -print("Di chuot den o nhap tin nhan trong 5 giay ...") -time.sleep(5) -input_position = pyautogui.position() - -print(f"Da lay toa do: {input_position}") - -x,y = input_position - -# Thiết lập API key cho OpenAI -client = OpenAI(api_key="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") # Hoặc gán trực tiếp: "sk-..." - -app = FastAPI() - -# Cấu hình CORS -app.add_middleware( - CORSMiddleware, - allow_origins=["*"], - allow_credentials=True, - allow_methods=["*"], - allow_headers=["*"], -) - -# Dữ liệu đầu vào cho API -class Message(BaseModel): - name: str - message: str - time: int - room_id: str - room_name: str - x: int - y: int - -# Gọi OpenAI và giả lập nhập liệu -def generate_and_type_reply(sender: str, content: str, x: int, y: int): - try: - response = client.chat.completions.create( - model="gpt-4o-mini", - messages=[ - {"role": "system", "content": "Ban la tro ly tin nhan AI tra loi ngan gon va day du y, than thien. Tra loi tieng Anh. Format xuong dong bang \n"}, - {"role": "user", "content": f"{sender} sent: {content}"} - ] - ) - reply = response.choices[0].message.content - print(f"AI tra loi: {reply}") - - time.sleep(1) - pyautogui.click(x, y) - time.sleep(1) - for line in reply.split("\n"): - pyautogui.write(line, interval=0.01) - pyautogui.hotkey("shift", "enter") - time.sleep(1) - time.sleep(0.5) - pyautogui.press("enter") - pyautogui.press("enter") - pyautogui.press("enter") - - return reply - except Exception as e: - return f"Lỗi khi gọi AI: {str(e)}" - -# API để nhận tin nhắn và phản hồi -@app.post("/reply/") -def reply_to_message(msg: Message): - print(f"[{msg.room_name}] {msg.name}: {msg.message}") - reply = generate_and_type_reply(msg.name, msg.message, msg.x, msg.y) - return { - "sender": msg.name, - "message": msg.message, - "room": msg.room_name, - "reply": reply - } - -@app.post("/type/") -def type(message: str = Body(..., embed=True)): - try: - print(f"Typing message: ") - - pyautogui.click(x, y) - time.sleep(1) - - # Copy vào clipboard và dán - pyperclip.copy(message) - pyautogui.hotkey("ctrl", "v") - time.sleep(0.5) - - # Gửi Enter để gửi - pyautogui.press("enter") - - return {"status": "success", "typed": message} - except Exception as e: - return {"status": "error", "detail": str(e)} diff --git a/write-message/requirements.txt b/write-message/requirements.txt deleted file mode 100644 index f4193a4..0000000 --- a/write-message/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -fastapi==0.111.0 -uvicorn==0.29.0 -pydantic==2.7.1 -openai==1.30.1 -pyautogui==0.9.54 -pymsgbox==1.0.9 -pytweening==1.0.7 -pygetwindow==0.0.9 -pyrect==0.2.0 -PyScreeze==0.1.30 -pyobjc-core==10.1 -pyobjc-framework-Quartz==10.1 -pyobjc-framework-Cocoa==10.1 diff --git a/write-message/ssl/cert.pem b/write-message/ssl/cert.pem deleted file mode 100644 index f06c3bf..0000000 --- a/write-message/ssl/cert.pem +++ /dev/null @@ -1,23 +0,0 @@ ------BEGIN CERTIFICATE----- -MIID1TCCAr2gAwIBAgIUOWbfSNEe+a/qZo/1Y7DOFM6WZZ8wDQYJKoZIhvcNAQEL -BQAwejELMAkGA1UEBhMCQVQxDjAMBgNVBAgMBUFkbWluMQ4wDAYDVQQHDAVBZG1p -bjEOMAwGA1UECgwFQWRtaW4xCzAJBgNVBAsMAkFUMQ4wDAYDVQQDDAVBZG1pbjEe -MBwGCSqGSIb3DQEJARYPYWRtaW5AZ21haWwuY29tMB4XDTI1MDgwNTAyMjMzOFoX -DTI2MDgwNTAyMjMzOFowejELMAkGA1UEBhMCQVQxDjAMBgNVBAgMBUFkbWluMQ4w -DAYDVQQHDAVBZG1pbjEOMAwGA1UECgwFQWRtaW4xCzAJBgNVBAsMAkFUMQ4wDAYD -VQQDDAVBZG1pbjEeMBwGCSqGSIb3DQEJARYPYWRtaW5AZ21haWwuY29tMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtK8sAFtijD7IG5UP7DIE1zaGUUch -YH9ubXOb0LX5tqb3asLVqFehveRUVolUoG3t+wM8yaxF/MBk4vkEZoEbhQiKGDfV -37FakHcw74cLEPgMuVGU91/yt3ca8+6zSSYcsIpJaWIWFNlGMnk3TIs4HRnM80rY -1R6q94SP3Yx2/DlcKoYxb/onnRs8pTJZPIw+YdRm1Yput6EO1WTjinG9JmAbeNsS -f643nN0oQ5JYf0JTQXi/8iLJExwJwbl+97aS2+l/+tSujqIkLUE1ighxGk7ZxZfO -3V9gd5kdSYbsMhQqDdEUjmmNqmAQ6F8MRkPu8+/jAfQH73+rzQBrqZMe+QIDAQAB -o1MwUTAdBgNVHQ4EFgQUSmsyedYpQW1A9z0IVbQ4wR2gDcYwHwYDVR0jBBgwFoAU -SmsyedYpQW1A9z0IVbQ4wR2gDcYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B -AQsFAAOCAQEAZd0OO2r/vs+56PhDLnB9fMiA8WSD9d2J8VNaA1IYCRkEQwEHlFUQ -CSu9ZIJtU+UXcDpnjzHc7hV1yYufhMTKUPWY9rlVypWoCoOyMw7Z9O0Tk+je4g2i -ChV2HSAYFSAhJrt1zNUofNBjXjgX08Mr65LYo3eIj9Pl8dmfun5wjDAlNv6uj9+F -eJzlsnCa2/fDn6zDGzKALXtNOPA/jNoKVP5uGbgCxaUNFA5dZvA5MBg8jXYC2r/Z -bL47zml8alx+HOgxJkkeQqx5rjBw+j2fNK7h3ot6ME7Gu9+MDgg2n1rKiJqrWCTH -oi0vQprP9ccgTHQB5cHTEQsOQhYcOjq9ug== ------END CERTIFICATE----- diff --git a/write-message/ssl/key.pem b/write-message/ssl/key.pem deleted file mode 100644 index 06edec9..0000000 --- a/write-message/ssl/key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC0rywAW2KMPsgb -lQ/sMgTXNoZRRyFgf25tc5vQtfm2pvdqwtWoV6G95FRWiVSgbe37AzzJrEX8wGTi -+QRmgRuFCIoYN9XfsVqQdzDvhwsQ+Ay5UZT3X/K3dxrz7rNJJhywiklpYhYU2UYy -eTdMizgdGczzStjVHqr3hI/djHb8OVwqhjFv+iedGzylMlk8jD5h1GbVim63oQ7V -ZOOKcb0mYBt42xJ/rjec3ShDklh/QlNBeL/yIskTHAnBuX73tpLb6X/61K6OoiQt -QTWKCHEaTtnFl87dX2B3mR1JhuwyFCoN0RSOaY2qYBDoXwxGQ+7z7+MB9Afvf6vN -AGupkx75AgMBAAECggEAAlrmqUxuCUf8gnyG+1QiRnfzcf3p+28JyANjegNtmvHl -iqN5vRxQTPbCQSlm1c6Wm6JM2AMzqDunQC/QybFZqk2EhEdYO+NQFYI4nD4/vw1Z -2Bs68USaEXlfIiPf1YTs4PTnR+hjab5OKSecK7zRHH/K6uoBHJNuFQFKGtzv95gv -r0ECwJoZo+pWswYmUiHeaBLrxdAq4LNdKVLKcZ3Pi6NU3pSQynGRLkjTC1PqSiUm -KAWHFEpt6Co5AVDkgBc5TNIex90khKZIRciFNL8VjR1su3EJZ2m71cqagvMhBVz1 -g4wHY7FR6liqiC9NuFT2FfVer56sX5+GZtw21J9lUQKBgQDm6avJ0NXplo7Lhta4 -4CI2nn1jdk+7kGVBCHyRevdtFrcXsO8rbpv8cyuZy+tNGtPg995pJYkE55uv11T1 -Ar8Qk0SbpMefexv33XcX5/wIGB34xgZ31XoUAYAkpFi7iY2hOQgpTaftOJ5D3UHj -k9OHk+zRAclv8nvvrGY6KwENqQKBgQDIUIF0sRHQWbulSGOo2PeXO5p9Gh/brEg2 -/orfftj5BmY4Rmin6ZPeShh9huVxCwId3+DPZxYulyeu0BLLXloZ5Z8ZnDkiG9Ux -okm1691BUqJTguKE3EuB5yZ6kOT8QL/9yifXYn+O8BDKN/V4s+nDop2e13GRrGoM -SHS0jSo40QKBgC0IUy1XofAdIZoFoOiLJYD7Zb64+xG8NlL5gbmpfolyzaA8LFiP -CLKyD0W+JBR0b+/Gx0RAQrmHJbCkUPg7YeGspsun1hp/GtQ7B5fM8TTu5yF2FRrX -sigmpsP+nSNtzwYrJjFP6Lj1ur/HbashUDZ3nc6hB5TieFMkjwc3DcyJAoGBAK7m -TAIdURaAIu0PpaSZvKSZcCxnEQX3CR6rZYn68WuNgNcF8v8ZXPir7XI8xDzNhc2b -2mh888s+Q3HJT3+uJDGUYjQ0SVZUwvMRZhanmIoeookUMMAcsPj9YIWH2ce+qWPo -jJzs7b9aMO6/qV74h9U/OSylpA2zYuzSnsO+tezhAoGBAIDenq6wO29gCbIdiOoU -5AAKaIfHFSqr62eLjy/1ZhJ8rsmi75Du4MMwEsCJN/btx68SHnvdk1EL+sEJaUp1 -cUgX4inKRajuQtVQ5BFtH0/r5g5gXgCtlloz+1jyQi+i+YidW8tW+88kXCjO1ZiS -JWLFknfFx8L1xUBW3R1Hadvz ------END PRIVATE KEY----- diff --git a/write-message/venv/bin/Activate.ps1 b/write-message/venv/bin/Activate.ps1 deleted file mode 100644 index b49d77b..0000000 --- a/write-message/venv/bin/Activate.ps1 +++ /dev/null @@ -1,247 +0,0 @@ -<# -.Synopsis -Activate a Python virtual environment for the current PowerShell session. - -.Description -Pushes the python executable for a virtual environment to the front of the -$Env:PATH environment variable and sets the prompt to signify that you are -in a Python virtual environment. Makes use of the command line switches as -well as the `pyvenv.cfg` file values present in the virtual environment. - -.Parameter VenvDir -Path to the directory that contains the virtual environment to activate. The -default value for this is the parent of the directory that the Activate.ps1 -script is located within. - -.Parameter Prompt -The prompt prefix to display when this virtual environment is activated. By -default, this prompt is the name of the virtual environment folder (VenvDir) -surrounded by parentheses and followed by a single space (ie. '(.venv) '). - -.Example -Activate.ps1 -Activates the Python virtual environment that contains the Activate.ps1 script. - -.Example -Activate.ps1 -Verbose -Activates the Python virtual environment that contains the Activate.ps1 script, -and shows extra information about the activation as it executes. - -.Example -Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv -Activates the Python virtual environment located in the specified location. - -.Example -Activate.ps1 -Prompt "MyPython" -Activates the Python virtual environment that contains the Activate.ps1 script, -and prefixes the current prompt with the specified string (surrounded in -parentheses) while the virtual environment is active. - -.Notes -On Windows, it may be required to enable this Activate.ps1 script by setting the -execution policy for the user. You can do this by issuing the following PowerShell -command: - -PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - -For more information on Execution Policies: -https://go.microsoft.com/fwlink/?LinkID=135170 - -#> -Param( - [Parameter(Mandatory = $false)] - [String] - $VenvDir, - [Parameter(Mandatory = $false)] - [String] - $Prompt -) - -<# Function declarations --------------------------------------------------- #> - -<# -.Synopsis -Remove all shell session elements added by the Activate script, including the -addition of the virtual environment's Python executable from the beginning of -the PATH variable. - -.Parameter NonDestructive -If present, do not remove this function from the global namespace for the -session. - -#> -function global:deactivate ([switch]$NonDestructive) { - # Revert to original values - - # The prior prompt: - if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { - Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt - Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT - } - - # The prior PYTHONHOME: - if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { - Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME - Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME - } - - # The prior PATH: - if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { - Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH - Remove-Item -Path Env:_OLD_VIRTUAL_PATH - } - - # Just remove the VIRTUAL_ENV altogether: - if (Test-Path -Path Env:VIRTUAL_ENV) { - Remove-Item -Path env:VIRTUAL_ENV - } - - # Just remove VIRTUAL_ENV_PROMPT altogether. - if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { - Remove-Item -Path env:VIRTUAL_ENV_PROMPT - } - - # 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 virtual 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 - } - $env:VIRTUAL_ENV_PROMPT = $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/write-message/venv/bin/activate b/write-message/venv/bin/activate deleted file mode 100644 index 22dd89a..0000000 --- a/write-message/venv/bin/activate +++ /dev/null @@ -1,69 +0,0 @@ -# This file must be used with "source bin/activate" *from bash* -# you cannot run it directly - -deactivate () { - # reset old environment variables - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then - PATH="${_OLD_VIRTUAL_PATH:-}" - export PATH - unset _OLD_VIRTUAL_PATH - fi - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" - export PYTHONHOME - unset _OLD_VIRTUAL_PYTHONHOME - fi - - # This should detect bash and zsh, which have a hash command that must - # be called to get it to forget past commands. Without forgetting - # past commands the $PATH changes we made may not be respected - if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then - hash -r 2> /dev/null - fi - - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then - PS1="${_OLD_VIRTUAL_PS1:-}" - export PS1 - unset _OLD_VIRTUAL_PS1 - fi - - unset VIRTUAL_ENV - unset VIRTUAL_ENV_PROMPT - if [ ! "${1:-}" = "nondestructive" ] ; then - # Self destruct! - unset -f deactivate - fi -} - -# unset irrelevant variables -deactivate nondestructive - -VIRTUAL_ENV="/Users/admin/Workspace/do-something/teams-bots/write-message/venv" -export VIRTUAL_ENV - -_OLD_VIRTUAL_PATH="$PATH" -PATH="$VIRTUAL_ENV/bin:$PATH" -export PATH - -# unset PYTHONHOME if set -# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) -# could use `if (set -u; : $PYTHONHOME) ;` in bash -if [ -n "${PYTHONHOME:-}" ] ; then - _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" - unset PYTHONHOME -fi - -if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then - _OLD_VIRTUAL_PS1="${PS1:-}" - PS1="(venv) ${PS1:-}" - export PS1 - VIRTUAL_ENV_PROMPT="(venv) " - export VIRTUAL_ENV_PROMPT -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/write-message/venv/bin/activate.csh b/write-message/venv/bin/activate.csh deleted file mode 100644 index 8e3ae55..0000000 --- a/write-message/venv/bin/activate.csh +++ /dev/null @@ -1,26 +0,0 @@ -# This file must be used with "source bin/activate.csh" *from csh*. -# You cannot run it directly. -# Created by Davide Di Blasi . -# Ported to Python 3.3 venv by Andrew Svetlov - -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' - -# Unset irrelevant variables. -deactivate nondestructive - -setenv VIRTUAL_ENV "/Users/admin/Workspace/do-something/teams-bots/write-message/venv" - -set _OLD_VIRTUAL_PATH="$PATH" -setenv PATH "$VIRTUAL_ENV/bin:$PATH" - - -set _OLD_VIRTUAL_PROMPT="$prompt" - -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - set prompt = "(venv) $prompt" - setenv VIRTUAL_ENV_PROMPT "(venv) " -endif - -alias pydoc python -m pydoc - -rehash diff --git a/write-message/venv/bin/activate.fish b/write-message/venv/bin/activate.fish deleted file mode 100644 index 478e3a9..0000000 --- a/write-message/venv/bin/activate.fish +++ /dev/null @@ -1,69 +0,0 @@ -# This file must be used with "source /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" - set -e _OLD_FISH_PROMPT_OVERRIDE - # prevents error when using nested fish instances (Issue #93858) - if functions -q _old_fish_prompt - functions -e fish_prompt - functions -c _old_fish_prompt fish_prompt - functions -e _old_fish_prompt - end - end - - set -e VIRTUAL_ENV - set -e VIRTUAL_ENV_PROMPT - if test "$argv[1]" != "nondestructive" - # Self-destruct! - functions -e deactivate - end -end - -# Unset irrelevant variables. -deactivate nondestructive - -set -gx VIRTUAL_ENV "/Users/admin/Workspace/do-something/teams-bots/write-message/venv" - -set -gx _OLD_VIRTUAL_PATH $PATH -set -gx PATH "$VIRTUAL_ENV/bin" $PATH - -# Unset PYTHONHOME if set. -if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME -end - -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" - # fish uses a function instead of an env var to generate the prompt. - - # Save the current fish_prompt function as the function _old_fish_prompt. - functions -c fish_prompt _old_fish_prompt - - # With the original prompt function renamed, we can override with our own. - function fish_prompt - # Save the return status of the last command. - set -l old_status $status - - # Output the venv prompt; color taken from the blue of the Python logo. - printf "%s%s%s" (set_color 4B8BBE) "(venv) " (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" - set -gx VIRTUAL_ENV_PROMPT "(venv) " -end diff --git a/write-message/venv/bin/distro b/write-message/venv/bin/distro deleted file mode 100755 index 6ea5e17..0000000 --- a/write-message/venv/bin/distro +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from distro.distro import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/dotenv b/write-message/venv/bin/dotenv deleted file mode 100755 index d3f823c..0000000 --- a/write-message/venv/bin/dotenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from dotenv.__main__ import cli -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli()) diff --git a/write-message/venv/bin/email_validator b/write-message/venv/bin/email_validator deleted file mode 100755 index 261f6cb..0000000 --- a/write-message/venv/bin/email_validator +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from email_validator.__main__ import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/fastapi b/write-message/venv/bin/fastapi deleted file mode 100755 index 7168613..0000000 --- a/write-message/venv/bin/fastapi +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from fastapi_cli.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/httpx b/write-message/venv/bin/httpx deleted file mode 100755 index 3fd64b7..0000000 --- a/write-message/venv/bin/httpx +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from httpx import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/markdown-it b/write-message/venv/bin/markdown-it deleted file mode 100755 index 88755b1..0000000 --- a/write-message/venv/bin/markdown-it +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from markdown_it.cli.parse import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/openai b/write-message/venv/bin/openai deleted file mode 100755 index c12a6d2..0000000 --- a/write-message/venv/bin/openai +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from openai.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/pip b/write-message/venv/bin/pip deleted file mode 100755 index e34a228..0000000 --- a/write-message/venv/bin/pip +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/pip3 b/write-message/venv/bin/pip3 deleted file mode 100755 index e34a228..0000000 --- a/write-message/venv/bin/pip3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/pip3.10 b/write-message/venv/bin/pip3.10 deleted file mode 100755 index e34a228..0000000 --- a/write-message/venv/bin/pip3.10 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/pygmentize b/write-message/venv/bin/pygmentize deleted file mode 100755 index f382728..0000000 --- a/write-message/venv/bin/pygmentize +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from pygments.cmdline import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/python b/write-message/venv/bin/python deleted file mode 120000 index b8a0adb..0000000 --- a/write-message/venv/bin/python +++ /dev/null @@ -1 +0,0 @@ -python3 \ No newline at end of file diff --git a/write-message/venv/bin/python3 b/write-message/venv/bin/python3 deleted file mode 120000 index 131e485..0000000 --- a/write-message/venv/bin/python3 +++ /dev/null @@ -1 +0,0 @@ -/Users/admin/.pyenv/versions/3.10.13/bin/python3 \ No newline at end of file diff --git a/write-message/venv/bin/python3.10 b/write-message/venv/bin/python3.10 deleted file mode 120000 index b8a0adb..0000000 --- a/write-message/venv/bin/python3.10 +++ /dev/null @@ -1 +0,0 @@ -python3 \ No newline at end of file diff --git a/write-message/venv/bin/tqdm b/write-message/venv/bin/tqdm deleted file mode 100755 index 5230d2b..0000000 --- a/write-message/venv/bin/tqdm +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from tqdm.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/typer b/write-message/venv/bin/typer deleted file mode 100755 index d735cab..0000000 --- a/write-message/venv/bin/typer +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from typer.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/uvicorn b/write-message/venv/bin/uvicorn deleted file mode 100755 index d8b722c..0000000 --- a/write-message/venv/bin/uvicorn +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from uvicorn.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/bin/watchfiles b/write-message/venv/bin/watchfiles deleted file mode 100755 index a25357f..0000000 --- a/write-message/venv/bin/watchfiles +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from watchfiles.cli import cli -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli()) diff --git a/write-message/venv/bin/websockets b/write-message/venv/bin/websockets deleted file mode 100755 index 04f9018..0000000 --- a/write-message/venv/bin/websockets +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/admin/Workspace/do-something/teams-bots/write-message/venv/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys -from websockets.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/_AppKit.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/AppKit/_AppKit.cpython-310-darwin.so deleted file mode 100755 index b24977d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/AppKit/_AppKit.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/__init__.py b/write-message/venv/lib/python3.10/site-packages/AppKit/__init__.py deleted file mode 100644 index 0c1b0ed..0000000 --- a/write-message/venv/lib/python3.10/site-packages/AppKit/__init__.py +++ /dev/null @@ -1,159 +0,0 @@ -""" -Python mapping for the AppKit framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import Foundation - import objc - from . import _metadata, _nsapp, _AppKit - from ._inlines import _inline_list_ - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="AppKit", - frameworkIdentifier="com.apple.AppKit", - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/AppKit.framework" - ), - globals_dict=globals(), - inline_list=_inline_list_, - parents=( - _nsapp, - _AppKit, - Foundation, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["AppKit._metadata"] - - def fontdescriptor_get(self, key, default=None): - value = self.objectForKey_(key) - if value is None: - return default - return value - - def fontdescriptor_getitem(self, key, default=None): - value = self.objectForKey_(key) - if value is None: - raise KeyError(key) - return value - - objc.addConvenienceForClass( - "NSFontDescriptor", - (("__getitem__", fontdescriptor_getitem), ("get", fontdescriptor_get)), - ) - - # Fix types for a number of character constants - # XXX: Move this to metadata - globals_dict = globals() - for nm in [ - "NSEnterCharacter", - "NSBackspaceCharacter", - "NSTabCharacter", - "NSNewlineCharacter", - "NSFormFeedCharacter", - "NSCarriageReturnCharacter", - "NSBackTabCharacter", - "NSDeleteCharacter", - "NSLineSeparatorCharacter", - "NSParagraphSeparatorCharacter", - "NSUpArrowFunctionKey", - "NSDownArrowFunctionKey", - "NSLeftArrowFunctionKey", - "NSRightArrowFunctionKey", - "NSF1FunctionKey", - "NSF2FunctionKey", - "NSF3FunctionKey", - "NSF4FunctionKey", - "NSF5FunctionKey", - "NSF6FunctionKey", - "NSF7FunctionKey", - "NSF8FunctionKey", - "NSF9FunctionKey", - "NSF10FunctionKey", - "NSF11FunctionKey", - "NSF12FunctionKey", - "NSF13FunctionKey", - "NSF14FunctionKey", - "NSF15FunctionKey", - "NSF16FunctionKey", - "NSF17FunctionKey", - "NSF18FunctionKey", - "NSF19FunctionKey", - "NSF20FunctionKey", - "NSF21FunctionKey", - "NSF22FunctionKey", - "NSF23FunctionKey", - "NSF24FunctionKey", - "NSF25FunctionKey", - "NSF26FunctionKey", - "NSF27FunctionKey", - "NSF28FunctionKey", - "NSF29FunctionKey", - "NSF30FunctionKey", - "NSF31FunctionKey", - "NSF32FunctionKey", - "NSF33FunctionKey", - "NSF34FunctionKey", - "NSF35FunctionKey", - "NSInsertFunctionKey", - "NSDeleteFunctionKey", - "NSHomeFunctionKey", - "NSBeginFunctionKey", - "NSEndFunctionKey", - "NSPageUpFunctionKey", - "NSPageDownFunctionKey", - "NSPrintScreenFunctionKey", - "NSScrollLockFunctionKey", - "NSPauseFunctionKey", - "NSSysReqFunctionKey", - "NSBreakFunctionKey", - "NSResetFunctionKey", - "NSStopFunctionKey", - "NSMenuFunctionKey", - "NSUserFunctionKey", - "NSSystemFunctionKey", - "NSPrintFunctionKey", - "NSClearLineFunctionKey", - "NSClearDisplayFunctionKey", - "NSInsertLineFunctionKey", - "NSDeleteLineFunctionKey", - "NSInsertCharFunctionKey", - "NSDeleteCharFunctionKey", - "NSPrevFunctionKey", - "NSNextFunctionKey", - "NSSelectFunctionKey", - "NSExecuteFunctionKey", - "NSUndoFunctionKey", - "NSRedoFunctionKey", - "NSFindFunctionKey", - "NSHelpFunctionKey", - "NSModeSwitchFunctionKey", - ]: - try: - globals_dict[nm] = chr(__getattr__(nm)) # noqa: F821 - except AttributeError: - pass - - -globals().pop("_setup")() - - -def NSDictionaryOfVariableBindings(*names): - """ - Return a dictionary with the given names and there values. - """ - import sys - - variables = sys._getframe(1).f_locals - - return {nm: variables[nm] for nm in names} diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 17d8a33..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index 7cb8197..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/_nsapp.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/_nsapp.cpython-310.pyc deleted file mode 100644 index c535512..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/AppKit/__pycache__/_nsapp.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/_inlines.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/AppKit/_inlines.cpython-310-darwin.so deleted file mode 100755 index 4329fbf..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/AppKit/_inlines.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/_metadata.py b/write-message/venv/lib/python3.10/site-packages/AppKit/_metadata.py deleted file mode 100644 index b32794d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/AppKit/_metadata.py +++ /dev/null @@ -1,20494 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Fri Nov 17 11:40:24 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -misc.update( - { - "NSDirectionalEdgeInsets": objc.createStructType( - "AppKit.NSDirectionalEdgeInsets", - b"{NSDirectionalEdgeInsets=dddd}", - ["top", "leading", "bottom", "trailing"], - ), - "NSOpenGLPixelFormatAuxiliary": objc.createStructType( - "AppKit.NSOpenGLPixelFormatAuxiliary", b"{_CGLPixelFormatObject=}", [] - ), - "NSScreenAuxiliaryOpaque": objc.createStructType( - "AppKit.NSScreenAuxiliaryOpaque", b"{NSScreenAuxiliary=}", [] - ), - "NSOpenGLContextAuxiliary": objc.createStructType( - "AppKit.NSOpenGLContextAuxiliary", b"{_CGLContextObject=}", [] - ), - } -) -constants = """$NSAbortModalException$NSAbortPrintingException$NSAboutPanelOptionApplicationIcon$NSAboutPanelOptionApplicationName$NSAboutPanelOptionApplicationVersion$NSAboutPanelOptionCredits$NSAboutPanelOptionVersion$NSAccessibilityActivationPointAttribute$NSAccessibilityAllowedValuesAttribute$NSAccessibilityAlternateUIVisibleAttribute$NSAccessibilityAnnotationElement$NSAccessibilityAnnotationLabel$NSAccessibilityAnnotationLocation$NSAccessibilityAnnotationTextAttribute$NSAccessibilityAnnouncementKey$NSAccessibilityAnnouncementRequestedNotification$NSAccessibilityApplicationActivatedNotification$NSAccessibilityApplicationDeactivatedNotification$NSAccessibilityApplicationHiddenNotification$NSAccessibilityApplicationRole$NSAccessibilityApplicationShownNotification$NSAccessibilityAscendingSortDirectionValue$NSAccessibilityAttachmentTextAttribute$NSAccessibilityAttributedStringForRangeParameterizedAttribute$NSAccessibilityAutocorrectedTextAttribute$NSAccessibilityBackgroundColorTextAttribute$NSAccessibilityBoundsForRangeParameterizedAttribute$NSAccessibilityBrowserRole$NSAccessibilityBusyIndicatorRole$NSAccessibilityButtonRole$NSAccessibilityCancelAction$NSAccessibilityCancelButtonAttribute$NSAccessibilityCellForColumnAndRowParameterizedAttribute$NSAccessibilityCellRole$NSAccessibilityCenterTabStopMarkerTypeValue$NSAccessibilityCentimetersUnitValue$NSAccessibilityCheckBoxRole$NSAccessibilityChildrenAttribute$NSAccessibilityClearButtonAttribute$NSAccessibilityCloseButtonAttribute$NSAccessibilityCloseButtonSubrole$NSAccessibilityCollectionListSubrole$NSAccessibilityColorWellRole$NSAccessibilityColumnCountAttribute$NSAccessibilityColumnHeaderUIElementsAttribute$NSAccessibilityColumnIndexRangeAttribute$NSAccessibilityColumnRole$NSAccessibilityColumnTitlesAttribute$NSAccessibilityColumnsAttribute$NSAccessibilityComboBoxRole$NSAccessibilityConfirmAction$NSAccessibilityContainsProtectedContentAttribute$NSAccessibilityContentListSubrole$NSAccessibilityContentsAttribute$NSAccessibilityCreatedNotification$NSAccessibilityCriticalValueAttribute$NSAccessibilityCustomTextAttribute$NSAccessibilityDecimalTabStopMarkerTypeValue$NSAccessibilityDecrementAction$NSAccessibilityDecrementArrowSubrole$NSAccessibilityDecrementButtonAttribute$NSAccessibilityDecrementPageSubrole$NSAccessibilityDefaultButtonAttribute$NSAccessibilityDefinitionListSubrole$NSAccessibilityDeleteAction$NSAccessibilityDescendingSortDirectionValue$NSAccessibilityDescriptionAttribute$NSAccessibilityDescriptionListSubrole$NSAccessibilityDialogSubrole$NSAccessibilityDisclosedByRowAttribute$NSAccessibilityDisclosedRowsAttribute$NSAccessibilityDisclosingAttribute$NSAccessibilityDisclosureLevelAttribute$NSAccessibilityDisclosureTriangleRole$NSAccessibilityDocumentAttribute$NSAccessibilityDrawerCreatedNotification$NSAccessibilityDrawerRole$NSAccessibilityEditedAttribute$NSAccessibilityEnabledAttribute$NSAccessibilityErrorCodeExceptionInfo$NSAccessibilityException$NSAccessibilityExpandedAttribute$NSAccessibilityExtrasMenuBarAttribute$NSAccessibilityFilenameAttribute$NSAccessibilityFirstLineIndentMarkerTypeValue$NSAccessibilityFloatingWindowSubrole$NSAccessibilityFocusedAttribute$NSAccessibilityFocusedUIElementAttribute$NSAccessibilityFocusedUIElementChangedNotification$NSAccessibilityFocusedWindowAttribute$NSAccessibilityFocusedWindowChangedNotification$NSAccessibilityFontFamilyKey$NSAccessibilityFontNameKey$NSAccessibilityFontSizeKey$NSAccessibilityFontTextAttribute$NSAccessibilityForegroundColorTextAttribute$NSAccessibilityFrontmostAttribute$NSAccessibilityFullScreenButtonAttribute$NSAccessibilityFullScreenButtonSubrole$NSAccessibilityGridRole$NSAccessibilityGroupRole$NSAccessibilityGrowAreaAttribute$NSAccessibilityGrowAreaRole$NSAccessibilityHandleRole$NSAccessibilityHandlesAttribute$NSAccessibilityHeadIndentMarkerTypeValue$NSAccessibilityHeaderAttribute$NSAccessibilityHelpAttribute$NSAccessibilityHelpTagCreatedNotification$NSAccessibilityHelpTagRole$NSAccessibilityHiddenAttribute$NSAccessibilityHorizontalOrientationValue$NSAccessibilityHorizontalScrollBarAttribute$NSAccessibilityHorizontalUnitDescriptionAttribute$NSAccessibilityHorizontalUnitsAttribute$NSAccessibilityHorizontialUnitDescriptionAttribute$NSAccessibilityHorizontialUnitsAttribute$NSAccessibilityIdentifierAttribute$NSAccessibilityImageRole$NSAccessibilityInchesUnitValue$NSAccessibilityIncrementAction$NSAccessibilityIncrementArrowSubrole$NSAccessibilityIncrementButtonAttribute$NSAccessibilityIncrementPageSubrole$NSAccessibilityIncrementorRole$NSAccessibilityIndexAttribute$NSAccessibilityInsertionPointLineNumberAttribute$NSAccessibilityLabelUIElementsAttribute$NSAccessibilityLabelValueAttribute$NSAccessibilityLanguageTextAttribute$NSAccessibilityLayoutAreaRole$NSAccessibilityLayoutChangedNotification$NSAccessibilityLayoutItemRole$NSAccessibilityLayoutPointForScreenPointParameterizedAttribute$NSAccessibilityLayoutSizeForScreenSizeParameterizedAttribute$NSAccessibilityLeftTabStopMarkerTypeValue$NSAccessibilityLevelIndicatorRole$NSAccessibilityLineForIndexParameterizedAttribute$NSAccessibilityLinkRole$NSAccessibilityLinkTextAttribute$NSAccessibilityLinkedUIElementsAttribute$NSAccessibilityListItemIndexTextAttribute$NSAccessibilityListItemLevelTextAttribute$NSAccessibilityListItemPrefixTextAttribute$NSAccessibilityListRole$NSAccessibilityMainAttribute$NSAccessibilityMainWindowAttribute$NSAccessibilityMainWindowChangedNotification$NSAccessibilityMarkedMisspelledTextAttribute$NSAccessibilityMarkerGroupUIElementAttribute$NSAccessibilityMarkerTypeAttribute$NSAccessibilityMarkerTypeDescriptionAttribute$NSAccessibilityMarkerUIElementsAttribute$NSAccessibilityMarkerValuesAttribute$NSAccessibilityMatteContentUIElementAttribute$NSAccessibilityMatteHoleAttribute$NSAccessibilityMatteRole$NSAccessibilityMaxValueAttribute$NSAccessibilityMenuBarAttribute$NSAccessibilityMenuBarItemRole$NSAccessibilityMenuBarRole$NSAccessibilityMenuButtonRole$NSAccessibilityMenuItemRole$NSAccessibilityMenuRole$NSAccessibilityMinValueAttribute$NSAccessibilityMinimizeButtonAttribute$NSAccessibilityMinimizeButtonSubrole$NSAccessibilityMinimizedAttribute$NSAccessibilityMisspelledTextAttribute$NSAccessibilityModalAttribute$NSAccessibilityMovedNotification$NSAccessibilityNextContentsAttribute$NSAccessibilityNumberOfCharactersAttribute$NSAccessibilityOrderedByRowAttribute$NSAccessibilityOrientationAttribute$NSAccessibilityOutlineRole$NSAccessibilityOutlineRowSubrole$NSAccessibilityOverflowButtonAttribute$NSAccessibilityPageRole$NSAccessibilityParentAttribute$NSAccessibilityPicasUnitValue$NSAccessibilityPickAction$NSAccessibilityPlaceholderValueAttribute$NSAccessibilityPointsUnitValue$NSAccessibilityPopUpButtonRole$NSAccessibilityPopoverRole$NSAccessibilityPositionAttribute$NSAccessibilityPressAction$NSAccessibilityPreviousContentsAttribute$NSAccessibilityPriorityKey$NSAccessibilityProgressIndicatorRole$NSAccessibilityProxyAttribute$NSAccessibilityRTFForRangeParameterizedAttribute$NSAccessibilityRadioButtonRole$NSAccessibilityRadioGroupRole$NSAccessibilityRaiseAction$NSAccessibilityRangeForIndexParameterizedAttribute$NSAccessibilityRangeForLineParameterizedAttribute$NSAccessibilityRangeForPositionParameterizedAttribute$NSAccessibilityRatingIndicatorSubrole$NSAccessibilityRelevanceIndicatorRole$NSAccessibilityRequiredAttribute$NSAccessibilityResizedNotification$NSAccessibilityRightTabStopMarkerTypeValue$NSAccessibilityRoleAttribute$NSAccessibilityRoleDescriptionAttribute$NSAccessibilityRowCollapsedNotification$NSAccessibilityRowCountAttribute$NSAccessibilityRowCountChangedNotification$NSAccessibilityRowExpandedNotification$NSAccessibilityRowHeaderUIElementsAttribute$NSAccessibilityRowIndexRangeAttribute$NSAccessibilityRowRole$NSAccessibilityRowsAttribute$NSAccessibilityRulerMarkerRole$NSAccessibilityRulerRole$NSAccessibilityScreenPointForLayoutPointParameterizedAttribute$NSAccessibilityScreenSizeForLayoutSizeParameterizedAttribute$NSAccessibilityScrollAreaRole$NSAccessibilityScrollBarRole$NSAccessibilitySearchButtonAttribute$NSAccessibilitySearchFieldSubrole$NSAccessibilitySearchMenuAttribute$NSAccessibilitySectionListSubrole$NSAccessibilitySecureTextFieldSubrole$NSAccessibilitySelectedAttribute$NSAccessibilitySelectedCellsAttribute$NSAccessibilitySelectedCellsChangedNotification$NSAccessibilitySelectedChildrenAttribute$NSAccessibilitySelectedChildrenChangedNotification$NSAccessibilitySelectedChildrenMovedNotification$NSAccessibilitySelectedColumnsAttribute$NSAccessibilitySelectedColumnsChangedNotification$NSAccessibilitySelectedRowsAttribute$NSAccessibilitySelectedRowsChangedNotification$NSAccessibilitySelectedTextAttribute$NSAccessibilitySelectedTextChangedNotification$NSAccessibilitySelectedTextRangeAttribute$NSAccessibilitySelectedTextRangesAttribute$NSAccessibilityServesAsTitleForUIElementsAttribute$NSAccessibilityShadowTextAttribute$NSAccessibilitySharedCharacterRangeAttribute$NSAccessibilitySharedFocusElementsAttribute$NSAccessibilitySharedTextUIElementsAttribute$NSAccessibilitySheetCreatedNotification$NSAccessibilitySheetRole$NSAccessibilityShowAlternateUIAction$NSAccessibilityShowDefaultUIAction$NSAccessibilityShowMenuAction$NSAccessibilityShownMenuAttribute$NSAccessibilitySizeAttribute$NSAccessibilitySliderRole$NSAccessibilitySortButtonRole$NSAccessibilitySortButtonSubrole$NSAccessibilitySortDirectionAttribute$NSAccessibilitySplitGroupRole$NSAccessibilitySplitterRole$NSAccessibilitySplittersAttribute$NSAccessibilityStandardWindowSubrole$NSAccessibilityStaticTextRole$NSAccessibilityStrikethroughColorTextAttribute$NSAccessibilityStrikethroughTextAttribute$NSAccessibilityStringForRangeParameterizedAttribute$NSAccessibilityStyleRangeForIndexParameterizedAttribute$NSAccessibilitySubroleAttribute$NSAccessibilitySuperscriptTextAttribute$NSAccessibilitySwitchSubrole$NSAccessibilitySystemDialogSubrole$NSAccessibilitySystemFloatingWindowSubrole$NSAccessibilitySystemWideRole$NSAccessibilityTabButtonSubrole$NSAccessibilityTabGroupRole$NSAccessibilityTableRole$NSAccessibilityTableRowSubrole$NSAccessibilityTabsAttribute$NSAccessibilityTailIndentMarkerTypeValue$NSAccessibilityTextAlignmentAttribute$NSAccessibilityTextAreaRole$NSAccessibilityTextAttachmentSubrole$NSAccessibilityTextFieldRole$NSAccessibilityTextLinkSubrole$NSAccessibilityTimelineSubrole$NSAccessibilityTitleAttribute$NSAccessibilityTitleChangedNotification$NSAccessibilityTitleUIElementAttribute$NSAccessibilityToggleSubrole$NSAccessibilityToolbarButtonAttribute$NSAccessibilityToolbarButtonSubrole$NSAccessibilityToolbarRole$NSAccessibilityTopLevelUIElementAttribute$NSAccessibilityUIElementDestroyedNotification$NSAccessibilityUIElementsKey$NSAccessibilityURLAttribute$NSAccessibilityUnderlineColorTextAttribute$NSAccessibilityUnderlineTextAttribute$NSAccessibilityUnitDescriptionAttribute$NSAccessibilityUnitsAttribute$NSAccessibilityUnitsChangedNotification$NSAccessibilityUnknownMarkerTypeValue$NSAccessibilityUnknownOrientationValue$NSAccessibilityUnknownRole$NSAccessibilityUnknownSortDirectionValue$NSAccessibilityUnknownSubrole$NSAccessibilityUnknownUnitValue$NSAccessibilityValueAttribute$NSAccessibilityValueChangedNotification$NSAccessibilityValueDescriptionAttribute$NSAccessibilityValueIndicatorRole$NSAccessibilityVerticalOrientationValue$NSAccessibilityVerticalScrollBarAttribute$NSAccessibilityVerticalUnitDescriptionAttribute$NSAccessibilityVerticalUnitsAttribute$NSAccessibilityVisibleCellsAttribute$NSAccessibilityVisibleCharacterRangeAttribute$NSAccessibilityVisibleChildrenAttribute$NSAccessibilityVisibleColumnsAttribute$NSAccessibilityVisibleNameKey$NSAccessibilityVisibleRowsAttribute$NSAccessibilityWarningValueAttribute$NSAccessibilityWindowAttribute$NSAccessibilityWindowCreatedNotification$NSAccessibilityWindowDeminiaturizedNotification$NSAccessibilityWindowMiniaturizedNotification$NSAccessibilityWindowMovedNotification$NSAccessibilityWindowResizedNotification$NSAccessibilityWindowRole$NSAccessibilityWindowsAttribute$NSAccessibilityZoomButtonAttribute$NSAccessibilityZoomButtonSubrole$NSAlignmentBinding$NSAllRomanInputSourcesLocaleIdentifier$NSAllowsEditingMultipleValuesSelectionBindingOption$NSAllowsNullArgumentBindingOption$NSAlternateImageBinding$NSAlternateTitleBinding$NSAlwaysPresentsApplicationModalAlertsBindingOption$NSAnimateBinding$NSAnimationDelayBinding$NSAnimationProgressMark$NSAnimationProgressMarkNotification$NSAnimationTriggerOrderIn$NSAnimationTriggerOrderOut$NSAntialiasThresholdChangedNotification$NSApp$NSAppKitIgnoredException$NSAppKitVersionNumber@d$NSAppKitVirtualMemoryException$NSAppearanceDocumentAttribute$NSAppearanceNameAccessibilityHighContrastAqua$NSAppearanceNameAccessibilityHighContrastDarkAqua$NSAppearanceNameAccessibilityHighContrastVibrantDark$NSAppearanceNameAccessibilityHighContrastVibrantLight$NSAppearanceNameAqua$NSAppearanceNameDarkAqua$NSAppearanceNameLightContent$NSAppearanceNameVibrantDark$NSAppearanceNameVibrantLight$NSApplicationDidBecomeActiveNotification$NSApplicationDidChangeOcclusionStateNotification$NSApplicationDidChangeScreenParametersNotification$NSApplicationDidFinishLaunchingNotification$NSApplicationDidFinishRestoringWindowsNotification$NSApplicationDidHideNotification$NSApplicationDidResignActiveNotification$NSApplicationDidUnhideNotification$NSApplicationDidUpdateNotification$NSApplicationFileType$NSApplicationLaunchIsDefaultLaunchKey$NSApplicationLaunchRemoteNotificationKey$NSApplicationLaunchUserNotificationKey$NSApplicationProtectedDataDidBecomeAvailableNotification$NSApplicationProtectedDataWillBecomeUnavailableNotification$NSApplicationWillBecomeActiveNotification$NSApplicationWillFinishLaunchingNotification$NSApplicationWillHideNotification$NSApplicationWillResignActiveNotification$NSApplicationWillTerminateNotification$NSApplicationWillUnhideNotification$NSApplicationWillUpdateNotification$NSArgumentBinding$NSAttachmentAttributeName$NSAttributedStringBinding$NSAuthorDocumentAttribute$NSBackgroundColorAttributeName$NSBackgroundColorDocumentAttribute$NSBackingPropertyOldColorSpaceKey$NSBackingPropertyOldScaleFactorKey$NSBadBitmapParametersException$NSBadComparisonException$NSBadRTFColorTableException$NSBadRTFDirectiveException$NSBadRTFFontTableException$NSBadRTFStyleSheetException$NSBaseURLDocumentOption$NSBaselineOffsetAttributeName$NSBlack@d$NSBottomMarginDocumentAttribute$NSBrowserColumnConfigurationDidChangeNotification$NSBrowserIllegalDelegateException$NSCalibratedBlackColorSpace$NSCalibratedRGBColorSpace$NSCalibratedWhiteColorSpace$NSCategoryDocumentAttribute$NSCharacterEncodingDocumentAttribute$NSCharacterEncodingDocumentOption$NSCharacterShapeAttributeName$NSCocoaVersionDocumentAttribute$NSCollectionElementKindInterItemGapIndicator$NSCollectionElementKindSectionFooter$NSCollectionElementKindSectionHeader$NSColorListDidChangeNotification$NSColorListIOException$NSColorListNotEditableException$NSColorPanelColorDidChangeNotification$NSColorPboardType$NSComboBoxSelectionDidChangeNotification$NSComboBoxSelectionIsChangingNotification$NSComboBoxWillDismissNotification$NSComboBoxWillPopUpNotification$NSCommentDocumentAttribute$NSCompanyDocumentAttribute$NSConditionallySetsEditableBindingOption$NSConditionallySetsEnabledBindingOption$NSConditionallySetsHiddenBindingOption$NSContentArrayBinding$NSContentArrayForMultipleSelectionBinding$NSContentBinding$NSContentDictionaryBinding$NSContentHeightBinding$NSContentObjectBinding$NSContentObjectsBinding$NSContentPlacementTagBindingOption$NSContentSetBinding$NSContentValuesBinding$NSContentWidthBinding$NSContextHelpModeDidActivateNotification$NSContextHelpModeDidDeactivateNotification$NSContinuouslyUpdatesValueBindingOption$NSControlTextDidBeginEditingNotification$NSControlTextDidChangeNotification$NSControlTextDidEndEditingNotification$NSControlTintDidChangeNotification$NSConvertedDocumentAttribute$NSCopyrightDocumentAttribute$NSCreatesSortDescriptorBindingOption$NSCreationTimeDocumentAttribute$NSCriticalValueBinding$NSCursorAttributeName$NSCustomColorSpace$NSDarkGray@d$NSDataBinding$NSDefaultAttributesDocumentAttribute$NSDefaultAttributesDocumentOption$NSDefaultFontExcludedDocumentAttribute$NSDefaultTabIntervalDocumentAttribute$NSDefinitionPresentationTypeDictionaryApplication$NSDefinitionPresentationTypeKey$NSDefinitionPresentationTypeOverlay$NSDeletesObjectsOnRemoveBindingsOption$NSDeviceBitsPerSample$NSDeviceBlackColorSpace$NSDeviceCMYKColorSpace$NSDeviceColorSpaceName$NSDeviceIsPrinter$NSDeviceIsScreen$NSDeviceRGBColorSpace$NSDeviceResolution$NSDeviceSize$NSDeviceWhiteColorSpace$NSDirectionalEdgeInsetsZero@{NSDirectionalEdgeInsets=dddd}$NSDirectoryFileType$NSDisplayNameBindingOption$NSDisplayPatternBindingOption$NSDisplayPatternTitleBinding$NSDisplayPatternValueBinding$NSDocFormatTextDocumentType$NSDocumentEditedBinding$NSDocumentTypeDocumentAttribute$NSDocumentTypeDocumentOption$NSDoubleClickArgumentBinding$NSDoubleClickTargetBinding$NSDragPboard$NSDraggingException$NSDraggingImageComponentIconKey$NSDraggingImageComponentLabelKey$NSDrawerDidCloseNotification$NSDrawerDidOpenNotification$NSDrawerWillCloseNotification$NSDrawerWillOpenNotification$NSEditableBinding$NSEditorDocumentAttribute$NSEnabledBinding$NSEventTrackingRunLoopMode$NSExcludedElementsDocumentAttribute$NSExcludedKeysBinding$NSExpansionAttributeName$NSFileContentsPboardType$NSFileTypeDocumentAttribute$NSFileTypeDocumentOption$NSFilenamesPboardType$NSFilesPromisePboardType$NSFilesystemFileType$NSFilterPredicateBinding$NSFindPanelCaseInsensitiveSearch$NSFindPanelSearchOptionsPboardType$NSFindPanelSubstringMatch$NSFindPboard$NSFontAttributeName$NSFontBinding$NSFontBoldBinding$NSFontCascadeListAttribute$NSFontCharacterSetAttribute$NSFontCollectionActionKey$NSFontCollectionAllFonts$NSFontCollectionDidChangeNotification$NSFontCollectionDisallowAutoActivationOption$NSFontCollectionFavorites$NSFontCollectionIncludeDisabledFontsOption$NSFontCollectionNameKey$NSFontCollectionOldNameKey$NSFontCollectionRecentlyUsed$NSFontCollectionRemoveDuplicatesOption$NSFontCollectionUser$NSFontCollectionVisibilityKey$NSFontCollectionWasHidden$NSFontCollectionWasRenamed$NSFontCollectionWasShown$NSFontColorAttribute$NSFontDescriptorSystemDesignDefault$NSFontDescriptorSystemDesignMonospaced$NSFontDescriptorSystemDesignRounded$NSFontDescriptorSystemDesignSerif$NSFontFaceAttribute$NSFontFamilyAttribute$NSFontFamilyNameBinding$NSFontFeatureSelectorIdentifierKey$NSFontFeatureSettingsAttribute$NSFontFeatureTypeIdentifierKey$NSFontFixedAdvanceAttribute$NSFontIdentityMatrix@^d$NSFontItalicBinding$NSFontMatrixAttribute$NSFontNameAttribute$NSFontNameBinding$NSFontPboard$NSFontPboardType$NSFontSetChangedNotification$NSFontSizeAttribute$NSFontSizeBinding$NSFontSlantTrait$NSFontSymbolicTrait$NSFontTextStyleBody$NSFontTextStyleCallout$NSFontTextStyleCaption1$NSFontTextStyleCaption2$NSFontTextStyleFootnote$NSFontTextStyleHeadline$NSFontTextStyleLargeTitle$NSFontTextStyleSubheadline$NSFontTextStyleTitle1$NSFontTextStyleTitle2$NSFontTextStyleTitle3$NSFontTraitsAttribute$NSFontUnavailableException$NSFontVariationAttribute$NSFontVariationAxisDefaultValueKey$NSFontVariationAxisIdentifierKey$NSFontVariationAxisMaximumValueKey$NSFontVariationAxisMinimumValueKey$NSFontVariationAxisNameKey$NSFontVisibleNameAttribute$NSFontWeightBlack@d$NSFontWeightBold@d$NSFontWeightHeavy@d$NSFontWeightLight@d$NSFontWeightMedium@d$NSFontWeightRegular@d$NSFontWeightSemibold@d$NSFontWeightThin@d$NSFontWeightTrait$NSFontWeightUltraLight@d$NSFontWidthCompressed@d$NSFontWidthCondensed@d$NSFontWidthExpanded@d$NSFontWidthStandard@d$NSFontWidthTrait$NSForegroundColorAttributeName$NSFullScreenModeAllScreens$NSFullScreenModeApplicationPresentationOptions$NSFullScreenModeSetting$NSFullScreenModeWindowLevel$NSGeneralPboard$NSGlyphInfoAttributeName$NSGraphicsContextDestinationAttributeName$NSGraphicsContextPDFFormat$NSGraphicsContextPSFormat$NSGraphicsContextRepresentationFormatAttributeName$NSGridViewSizeForContent@d$NSHTMLPboardType$NSHTMLTextDocumentType$NSHandlesContentAsCompoundValueBindingOption$NSHeaderTitleBinding$NSHiddenBinding$NSHyphenationFactorDocumentAttribute$NSIllegalSelectorException$NSImageBinding$NSImageCacheException$NSImageColorSyncProfileData$NSImageCompressionFactor$NSImageCompressionMethod$NSImageCurrentFrame$NSImageCurrentFrameDuration$NSImageDitherTransparency$NSImageEXIFData$NSImageFallbackBackgroundColor$NSImageFrameCount$NSImageGamma$NSImageHintCTM$NSImageHintInterpolation$NSImageHintUserInterfaceLayoutDirection$NSImageIPTCData$NSImageInterlaced$NSImageLoopCount$NSImageNameActionTemplate$NSImageNameAddTemplate$NSImageNameAdvanced$NSImageNameApplicationIcon$NSImageNameBluetoothTemplate$NSImageNameBonjour$NSImageNameBookmarksTemplate$NSImageNameCaution$NSImageNameColorPanel$NSImageNameColumnViewTemplate$NSImageNameComputer$NSImageNameDotMac$NSImageNameEnterFullScreenTemplate$NSImageNameEveryone$NSImageNameExitFullScreenTemplate$NSImageNameFlowViewTemplate$NSImageNameFolder$NSImageNameFolderBurnable$NSImageNameFolderSmart$NSImageNameFollowLinkFreestandingTemplate$NSImageNameFontPanel$NSImageNameGoBackTemplate$NSImageNameGoForwardTemplate$NSImageNameGoLeftTemplate$NSImageNameGoRightTemplate$NSImageNameHomeTemplate$NSImageNameIChatTheaterTemplate$NSImageNameIconViewTemplate$NSImageNameInfo$NSImageNameInvalidDataFreestandingTemplate$NSImageNameLeftFacingTriangleTemplate$NSImageNameListViewTemplate$NSImageNameLockLockedTemplate$NSImageNameLockUnlockedTemplate$NSImageNameMenuMixedStateTemplate$NSImageNameMenuOnStateTemplate$NSImageNameMobileMe$NSImageNameMultipleDocuments$NSImageNameNetwork$NSImageNamePathTemplate$NSImageNamePreferencesGeneral$NSImageNameQuickLookTemplate$NSImageNameRefreshFreestandingTemplate$NSImageNameRefreshTemplate$NSImageNameRemoveTemplate$NSImageNameRevealFreestandingTemplate$NSImageNameRightFacingTriangleTemplate$NSImageNameShareTemplate$NSImageNameSlideshowTemplate$NSImageNameSmartBadgeTemplate$NSImageNameStatusAvailable$NSImageNameStatusNone$NSImageNameStatusPartiallyAvailable$NSImageNameStatusUnavailable$NSImageNameStopProgressFreestandingTemplate$NSImageNameStopProgressTemplate$NSImageNameTouchBarAddDetailTemplate$NSImageNameTouchBarAddTemplate$NSImageNameTouchBarAlarmTemplate$NSImageNameTouchBarAudioInputMuteTemplate$NSImageNameTouchBarAudioInputTemplate$NSImageNameTouchBarAudioOutputMuteTemplate$NSImageNameTouchBarAudioOutputVolumeHighTemplate$NSImageNameTouchBarAudioOutputVolumeLowTemplate$NSImageNameTouchBarAudioOutputVolumeMediumTemplate$NSImageNameTouchBarAudioOutputVolumeOffTemplate$NSImageNameTouchBarBookmarksTemplate$NSImageNameTouchBarColorPickerFill$NSImageNameTouchBarColorPickerFont$NSImageNameTouchBarColorPickerStroke$NSImageNameTouchBarCommunicationAudioTemplate$NSImageNameTouchBarCommunicationVideoTemplate$NSImageNameTouchBarComposeTemplate$NSImageNameTouchBarDeleteTemplate$NSImageNameTouchBarDownloadTemplate$NSImageNameTouchBarEnterFullScreenTemplate$NSImageNameTouchBarExitFullScreenTemplate$NSImageNameTouchBarFastForwardTemplate$NSImageNameTouchBarFolderCopyToTemplate$NSImageNameTouchBarFolderMoveToTemplate$NSImageNameTouchBarFolderTemplate$NSImageNameTouchBarGetInfoTemplate$NSImageNameTouchBarGoBackTemplate$NSImageNameTouchBarGoDownTemplate$NSImageNameTouchBarGoForwardTemplate$NSImageNameTouchBarGoUpTemplate$NSImageNameTouchBarHistoryTemplate$NSImageNameTouchBarIconViewTemplate$NSImageNameTouchBarListViewTemplate$NSImageNameTouchBarMailTemplate$NSImageNameTouchBarNewFolderTemplate$NSImageNameTouchBarNewMessageTemplate$NSImageNameTouchBarOpenInBrowserTemplate$NSImageNameTouchBarPauseTemplate$NSImageNameTouchBarPlayPauseTemplate$NSImageNameTouchBarPlayTemplate$NSImageNameTouchBarPlayheadTemplate$NSImageNameTouchBarQuickLookTemplate$NSImageNameTouchBarRecordStartTemplate$NSImageNameTouchBarRecordStopTemplate$NSImageNameTouchBarRefreshTemplate$NSImageNameTouchBarRemoveTemplate$NSImageNameTouchBarRewindTemplate$NSImageNameTouchBarRotateLeftTemplate$NSImageNameTouchBarRotateRightTemplate$NSImageNameTouchBarSearchTemplate$NSImageNameTouchBarShareTemplate$NSImageNameTouchBarSidebarTemplate$NSImageNameTouchBarSkipAhead15SecondsTemplate$NSImageNameTouchBarSkipAhead30SecondsTemplate$NSImageNameTouchBarSkipAheadTemplate$NSImageNameTouchBarSkipBack15SecondsTemplate$NSImageNameTouchBarSkipBack30SecondsTemplate$NSImageNameTouchBarSkipBackTemplate$NSImageNameTouchBarSkipToEndTemplate$NSImageNameTouchBarSkipToStartTemplate$NSImageNameTouchBarSlideshowTemplate$NSImageNameTouchBarTagIconTemplate$NSImageNameTouchBarTextBoldTemplate$NSImageNameTouchBarTextBoxTemplate$NSImageNameTouchBarTextCenterAlignTemplate$NSImageNameTouchBarTextItalicTemplate$NSImageNameTouchBarTextJustifiedAlignTemplate$NSImageNameTouchBarTextLeftAlignTemplate$NSImageNameTouchBarTextListTemplate$NSImageNameTouchBarTextRightAlignTemplate$NSImageNameTouchBarTextStrikethroughTemplate$NSImageNameTouchBarTextUnderlineTemplate$NSImageNameTouchBarUserAddTemplate$NSImageNameTouchBarUserGroupTemplate$NSImageNameTouchBarUserTemplate$NSImageNameTouchBarVolumeDownTemplate$NSImageNameTouchBarVolumeUpTemplate$NSImageNameTrashEmpty$NSImageNameTrashFull$NSImageNameUser$NSImageNameUserAccounts$NSImageNameUserGroup$NSImageNameUserGuest$NSImageProgressive$NSImageRGBColorTable$NSImageRepRegistryDidChangeNotification$NSIncludedKeysBinding$NSInitialKeyBinding$NSInitialValueBinding$NSInkTextPboardType$NSInsertsNullPlaceholderBindingOption$NSInterfaceStyleDefault$NSInvokesSeparatelyWithArrayObjectsBindingOption$NSIsIndeterminateBinding$NSKernAttributeName$NSKeywordsDocumentAttribute$NSLabelBinding$NSLeftMarginDocumentAttribute$NSLigatureAttributeName$NSLightGray@d$NSLinkAttributeName$NSLocalizedKeyDictionaryBinding$NSMacSimpleTextDocumentType$NSManagedObjectContextBinding$NSManagerDocumentAttribute$NSMarkedClauseSegmentAttributeName$NSMaxValueBinding$NSMaxWidthBinding$NSMaximumRecentsBinding$NSMenuDidAddItemNotification$NSMenuDidBeginTrackingNotification$NSMenuDidChangeItemNotification$NSMenuDidEndTrackingNotification$NSMenuDidRemoveItemNotification$NSMenuDidSendActionNotification$NSMenuItemImportFromDeviceIdentifier$NSMenuWillSendActionNotification$NSMinValueBinding$NSMinWidthBinding$NSMixedStateImageBinding$NSModalPanelRunLoopMode$NSModificationTimeDocumentAttribute$NSMultipleTextSelectionPboardType$NSMultipleValuesMarker$NSMultipleValuesPlaceholderBindingOption$NSNamedColorSpace$NSNibLoadingException$NSNibOwner$NSNibTopLevelObjects$NSNoSelectionMarker$NSNoSelectionPlaceholderBindingOption$NSNotApplicableMarker$NSNotApplicablePlaceholderBindingOption$NSNullPlaceholderBindingOption$NSObliquenessAttributeName$NSObservedKeyPathKey$NSObservedObjectKey$NSOffStateImageBinding$NSOfficeOpenXMLTextDocumentType$NSOnStateImageBinding$NSOpenDocumentTextDocumentType$NSOptionsKey$NSOutlineViewColumnDidMoveNotification$NSOutlineViewColumnDidResizeNotification$NSOutlineViewDisclosureButtonKey$NSOutlineViewItemDidCollapseNotification$NSOutlineViewItemDidExpandNotification$NSOutlineViewItemWillCollapseNotification$NSOutlineViewItemWillExpandNotification$NSOutlineViewSelectionDidChangeNotification$NSOutlineViewSelectionIsChangingNotification$NSOutlineViewShowHideButtonKey$NSPDFPboardType$NSPICTPboardType$NSPPDIncludeNotFoundException$NSPPDIncludeStackOverflowException$NSPPDIncludeStackUnderflowException$NSPPDParseException$NSPaperSizeDocumentAttribute$NSParagraphStyleAttributeName$NSPasteboardCommunicationException$NSPasteboardNameDrag$NSPasteboardNameFind$NSPasteboardNameFont$NSPasteboardNameGeneral$NSPasteboardNameRuler$NSPasteboardTypeColor$NSPasteboardTypeFileURL$NSPasteboardTypeFindPanelSearchOptions$NSPasteboardTypeFont$NSPasteboardTypeHTML$NSPasteboardTypeMultipleTextSelection$NSPasteboardTypePDF$NSPasteboardTypePNG$NSPasteboardTypeRTF$NSPasteboardTypeRTFD$NSPasteboardTypeRuler$NSPasteboardTypeSound$NSPasteboardTypeString$NSPasteboardTypeTIFF$NSPasteboardTypeTabularText$NSPasteboardTypeTextFinderOptions$NSPasteboardTypeURL$NSPasteboardURLReadingContentsConformToTypesKey$NSPasteboardURLReadingFileURLsOnlyKey$NSPatternColorSpace$NSPlainFileType$NSPlainTextDocumentType$NSPopUpButtonCellWillPopUpNotification$NSPopUpButtonWillPopUpNotification$NSPopoverCloseReasonDetachToWindow$NSPopoverCloseReasonKey$NSPopoverCloseReasonStandard$NSPopoverDidCloseNotification$NSPopoverDidShowNotification$NSPopoverWillCloseNotification$NSPopoverWillShowNotification$NSPositioningRectBinding$NSPostScriptPboardType$NSPredicateBinding$NSPredicateFormatBindingOption$NSPreferredScrollerStyleDidChangeNotification$NSPrefixSpacesDocumentAttribute$NSPrintAllPages$NSPrintAllPresetsJobStyleHint$NSPrintBottomMargin$NSPrintCancelJob$NSPrintCopies$NSPrintDetailedErrorReporting$NSPrintFaxCoverSheetName$NSPrintFaxHighResolution$NSPrintFaxJob$NSPrintFaxModem$NSPrintFaxNumber$NSPrintFaxReceiverNames$NSPrintFaxReceiverNumbers$NSPrintFaxReturnReceipt$NSPrintFaxSendTime$NSPrintFaxTrimPageEnds$NSPrintFaxUseCoverSheet$NSPrintFirstPage$NSPrintFormName$NSPrintHeaderAndFooter$NSPrintHorizontalPagination$NSPrintHorizontallyCentered$NSPrintJobDisposition$NSPrintJobFeatures$NSPrintJobSavingFileNameExtensionHidden$NSPrintJobSavingURL$NSPrintLastPage$NSPrintLeftMargin$NSPrintManualFeed$NSPrintMustCollate$NSPrintNoPresetsJobStyleHint$NSPrintOperationExistsException$NSPrintOrientation$NSPrintPackageException$NSPrintPagesAcross$NSPrintPagesDown$NSPrintPagesPerSheet$NSPrintPanelAccessorySummaryItemDescriptionKey$NSPrintPanelAccessorySummaryItemNameKey$NSPrintPaperFeed$NSPrintPaperName$NSPrintPaperSize$NSPrintPhotoJobStyleHint$NSPrintPreviewJob$NSPrintPrinter$NSPrintPrinterName$NSPrintReversePageOrder$NSPrintRightMargin$NSPrintSaveJob$NSPrintSavePath$NSPrintScalingFactor$NSPrintSelectionOnly$NSPrintSpoolJob$NSPrintTime$NSPrintTopMargin$NSPrintVerticalPagination$NSPrintVerticallyCentered$NSPrintingCommunicationException$NSRTFDPboardType$NSRTFDTextDocumentType$NSRTFPboardType$NSRTFPropertyStackOverflowException$NSRTFTextDocumentType$NSRaisesForNotApplicableKeysBindingOption$NSReadOnlyDocumentAttribute$NSRecentSearchesBinding$NSRepresentedFilenameBinding$NSRightMarginDocumentAttribute$NSRowHeightBinding$NSRuleEditorPredicateComparisonModifier$NSRuleEditorPredicateCompoundType$NSRuleEditorPredicateCustomSelector$NSRuleEditorPredicateLeftExpression$NSRuleEditorPredicateOperatorType$NSRuleEditorPredicateOptions$NSRuleEditorPredicateRightExpression$NSRuleEditorRowsDidChangeNotification$NSRulerPboard$NSRulerPboardType$NSRulerViewUnitCentimeters$NSRulerViewUnitInches$NSRulerViewUnitPicas$NSRulerViewUnitPoints$NSScreenColorSpaceDidChangeNotification$NSScrollViewDidEndLiveMagnifyNotification$NSScrollViewDidEndLiveScrollNotification$NSScrollViewDidLiveScrollNotification$NSScrollViewWillStartLiveMagnifyNotification$NSScrollViewWillStartLiveScrollNotification$NSSelectedIdentifierBinding$NSSelectedIndexBinding$NSSelectedLabelBinding$NSSelectedObjectBinding$NSSelectedObjectsBinding$NSSelectedTagBinding$NSSelectedValueBinding$NSSelectedValuesBinding$NSSelectionIndexPathsBinding$NSSelectionIndexesBinding$NSSelectorNameBindingOption$NSSelectsAllWhenSettingContentBindingOption$NSShadowAttributeName$NSSharingServiceNameAddToAperture$NSSharingServiceNameAddToIPhoto$NSSharingServiceNameAddToSafariReadingList$NSSharingServiceNameCloudSharing$NSSharingServiceNameComposeEmail$NSSharingServiceNameComposeMessage$NSSharingServiceNamePostImageOnFlickr$NSSharingServiceNamePostOnFacebook$NSSharingServiceNamePostOnLinkedIn$NSSharingServiceNamePostOnSinaWeibo$NSSharingServiceNamePostOnTencentWeibo$NSSharingServiceNamePostOnTwitter$NSSharingServiceNamePostVideoOnTudou$NSSharingServiceNamePostVideoOnVimeo$NSSharingServiceNamePostVideoOnYouku$NSSharingServiceNameSendViaAirDrop$NSSharingServiceNameUseAsDesktopPicture$NSSharingServiceNameUseAsFacebookProfileImage$NSSharingServiceNameUseAsLinkedInProfileImage$NSSharingServiceNameUseAsTwitterProfileImage$NSShellCommandFileType$NSSliderAccessoryWidthDefault@d$NSSliderAccessoryWidthWide@d$NSSortDescriptorsBinding$NSSoundPboardType$NSSourceTextScalingDocumentAttribute$NSSourceTextScalingDocumentOption$NSSpeechCharacterModeProperty$NSSpeechCommandDelimiterProperty$NSSpeechCommandPrefix$NSSpeechCommandSuffix$NSSpeechCurrentVoiceProperty$NSSpeechDictionaryAbbreviations$NSSpeechDictionaryEntryPhonemes$NSSpeechDictionaryEntrySpelling$NSSpeechDictionaryLocaleIdentifier$NSSpeechDictionaryModificationDate$NSSpeechDictionaryPronunciations$NSSpeechErrorCount$NSSpeechErrorNewestCharacterOffset$NSSpeechErrorNewestCode$NSSpeechErrorOldestCharacterOffset$NSSpeechErrorOldestCode$NSSpeechErrorsProperty$NSSpeechInputModeProperty$NSSpeechModeLiteral$NSSpeechModeNormal$NSSpeechModePhoneme$NSSpeechModeText$NSSpeechNumberModeProperty$NSSpeechOutputToFileURLProperty$NSSpeechPhonemeInfoExample$NSSpeechPhonemeInfoHiliteEnd$NSSpeechPhonemeInfoHiliteStart$NSSpeechPhonemeInfoOpcode$NSSpeechPhonemeInfoSymbol$NSSpeechPhonemeSymbolsProperty$NSSpeechPitchBaseProperty$NSSpeechPitchModProperty$NSSpeechRateProperty$NSSpeechRecentSyncProperty$NSSpeechResetProperty$NSSpeechStatusNumberOfCharactersLeft$NSSpeechStatusOutputBusy$NSSpeechStatusOutputPaused$NSSpeechStatusPhonemeCode$NSSpeechStatusProperty$NSSpeechSynthesizerInfoIdentifier$NSSpeechSynthesizerInfoProperty$NSSpeechSynthesizerInfoVersion$NSSpeechVolumeProperty$NSSpellCheckerDidChangeAutomaticCapitalizationNotification$NSSpellCheckerDidChangeAutomaticDashSubstitutionNotification$NSSpellCheckerDidChangeAutomaticInlinePredictionNotification$NSSpellCheckerDidChangeAutomaticPeriodSubstitutionNotification$NSSpellCheckerDidChangeAutomaticQuoteSubstitutionNotification$NSSpellCheckerDidChangeAutomaticSpellingCorrectionNotification$NSSpellCheckerDidChangeAutomaticTextCompletionNotification$NSSpellCheckerDidChangeAutomaticTextReplacementNotification$NSSpellingStateAttributeName$NSSplitViewControllerAutomaticDimension@d$NSSplitViewDidResizeSubviewsNotification$NSSplitViewItemUnspecifiedDimension@d$NSSplitViewWillResizeSubviewsNotification$NSStrikethroughColorAttributeName$NSStrikethroughStyleAttributeName$NSStringPboardType$NSStrokeColorAttributeName$NSStrokeWidthAttributeName$NSSubjectDocumentAttribute$NSSuperscriptAttributeName$NSSystemColorsDidChangeNotification$NSTIFFException$NSTIFFPboardType$NSTabColumnTerminatorsAttributeName$NSTableViewColumnDidMoveNotification$NSTableViewColumnDidResizeNotification$NSTableViewRowViewKey$NSTableViewSelectionDidChangeNotification$NSTableViewSelectionIsChangingNotification$NSTabularTextPboardType$NSTargetBinding$NSTargetTextScalingDocumentOption$NSTextAlternativesAttributeName$NSTextAlternativesSelectedAlternativeStringNotification$NSTextCheckingDocumentAuthorKey$NSTextCheckingDocumentTitleKey$NSTextCheckingDocumentURLKey$NSTextCheckingGenerateInlinePredictionsKey$NSTextCheckingOrthographyKey$NSTextCheckingQuotesKey$NSTextCheckingReferenceDateKey$NSTextCheckingReferenceTimeZoneKey$NSTextCheckingRegularExpressionsKey$NSTextCheckingReplacementsKey$NSTextCheckingSelectedRangeKey$NSTextColorBinding$NSTextContentStorageUnsupportedAttributeAddedNotification$NSTextContentTypeAddressCity$NSTextContentTypeAddressCityAndState$NSTextContentTypeAddressState$NSTextContentTypeBirthdate$NSTextContentTypeBirthdateDay$NSTextContentTypeBirthdateMonth$NSTextContentTypeBirthdateYear$NSTextContentTypeCountryName$NSTextContentTypeCreditCardExpiration$NSTextContentTypeCreditCardExpirationMonth$NSTextContentTypeCreditCardExpirationYear$NSTextContentTypeCreditCardFamilyName$NSTextContentTypeCreditCardGivenName$NSTextContentTypeCreditCardMiddleName$NSTextContentTypeCreditCardName$NSTextContentTypeCreditCardNumber$NSTextContentTypeCreditCardSecurityCode$NSTextContentTypeCreditCardType$NSTextContentTypeDateTime$NSTextContentTypeEmailAddress$NSTextContentTypeFamilyName$NSTextContentTypeFlightNumber$NSTextContentTypeFullStreetAddress$NSTextContentTypeGivenName$NSTextContentTypeJobTitle$NSTextContentTypeLocation$NSTextContentTypeMiddleName$NSTextContentTypeName$NSTextContentTypeNamePrefix$NSTextContentTypeNameSuffix$NSTextContentTypeNewPassword$NSTextContentTypeNickname$NSTextContentTypeOneTimeCode$NSTextContentTypeOrganizationName$NSTextContentTypePassword$NSTextContentTypePostalCode$NSTextContentTypeShipmentTrackingNumber$NSTextContentTypeStreetAddressLine1$NSTextContentTypeStreetAddressLine2$NSTextContentTypeSublocality$NSTextContentTypeTelephoneNumber$NSTextContentTypeURL$NSTextContentTypeUsername$NSTextDidBeginEditingNotification$NSTextDidChangeNotification$NSTextDidEndEditingNotification$NSTextEffectAttributeName$NSTextEffectLetterpressStyle$NSTextEncodingNameDocumentAttribute$NSTextEncodingNameDocumentOption$NSTextFinderCaseInsensitiveKey$NSTextFinderMatchingTypeKey$NSTextInputContextKeyboardSelectionDidChangeNotification$NSTextLayoutSectionOrientation$NSTextLayoutSectionRange$NSTextLayoutSectionsAttribute$NSTextLineTooLongException$NSTextListMarkerBox$NSTextListMarkerCheck$NSTextListMarkerCircle$NSTextListMarkerDecimal$NSTextListMarkerDiamond$NSTextListMarkerDisc$NSTextListMarkerHyphen$NSTextListMarkerLowercaseAlpha$NSTextListMarkerLowercaseHexadecimal$NSTextListMarkerLowercaseLatin$NSTextListMarkerLowercaseRoman$NSTextListMarkerOctal$NSTextListMarkerSquare$NSTextListMarkerUppercaseAlpha$NSTextListMarkerUppercaseHexadecimal$NSTextListMarkerUppercaseLatin$NSTextListMarkerUppercaseRoman$NSTextMovementUserInfoKey$NSTextNoSelectionException$NSTextReadException$NSTextScalingDocumentAttribute$NSTextSizeMultiplierDocumentOption$NSTextStorageDidProcessEditingNotification$NSTextStorageWillProcessEditingNotification$NSTextViewDidChangeSelectionNotification$NSTextViewDidChangeTypingAttributesNotification$NSTextViewDidSwitchToNSLayoutManagerNotification$NSTextViewWillChangeNotifyingTextViewNotification$NSTextViewWillSwitchToNSLayoutManagerNotification$NSTextWriteException$NSTimeoutDocumentOption$NSTitleBinding$NSTitleDocumentAttribute$NSToolTipAttributeName$NSToolTipBinding$NSToolbarCloudSharingItemIdentifier$NSToolbarCustomizeToolbarItemIdentifier$NSToolbarDidRemoveItemNotification$NSToolbarFlexibleSpaceItemIdentifier$NSToolbarInspectorTrackingSeparatorItemIdentifier$NSToolbarItemKey$NSToolbarPrintItemIdentifier$NSToolbarSeparatorItemIdentifier$NSToolbarShowColorsItemIdentifier$NSToolbarShowFontsItemIdentifier$NSToolbarSidebarTrackingSeparatorItemIdentifier$NSToolbarSpaceItemIdentifier$NSToolbarToggleInspectorItemIdentifier$NSToolbarToggleSidebarItemIdentifier$NSToolbarWillAddItemNotification$NSTopMarginDocumentAttribute$NSTouchBarItemIdentifierCandidateList$NSTouchBarItemIdentifierCharacterPicker$NSTouchBarItemIdentifierFixedSpaceLarge$NSTouchBarItemIdentifierFixedSpaceSmall$NSTouchBarItemIdentifierFlexibleSpace$NSTouchBarItemIdentifierOtherItemsProxy$NSTouchBarItemIdentifierTextAlignment$NSTouchBarItemIdentifierTextColorPicker$NSTouchBarItemIdentifierTextFormat$NSTouchBarItemIdentifierTextList$NSTouchBarItemIdentifierTextStyle$NSTrackingAttributeName$NSTransparentBinding$NSTypeIdentifierAddressText$NSTypeIdentifierDateText$NSTypeIdentifierPhoneNumberText$NSTypeIdentifierTransitInformationText$NSTypedStreamVersionException$NSURLPboardType$NSUnderlineByWordMask@Q$NSUnderlineColorAttributeName$NSUnderlineStrikethroughMask@Q$NSUnderlineStyleAttributeName$NSUserActivityDocumentURLKey$NSUsesScreenFontsDocumentAttribute$NSVCardPboardType$NSValidatesImmediatelyBindingOption$NSValueBinding$NSValuePathBinding$NSValueTransformerBindingOption$NSValueTransformerNameBindingOption$NSValueURLBinding$NSVerticalGlyphFormAttributeName$NSViewAnimationEffectKey$NSViewAnimationEndFrameKey$NSViewAnimationFadeInEffect$NSViewAnimationFadeOutEffect$NSViewAnimationStartFrameKey$NSViewAnimationTargetKey$NSViewBoundsDidChangeNotification$NSViewDidUpdateTrackingAreasNotification$NSViewFocusDidChangeNotification$NSViewFrameDidChangeNotification$NSViewGlobalFrameDidChangeNotification$NSViewModeDocumentAttribute$NSViewNoInstrinsicMetric@d$NSViewNoIntrinsicMetric@d$NSViewSizeDocumentAttribute$NSViewZoomDocumentAttribute$NSVisibleBinding$NSVoiceAge$NSVoiceDemoText$NSVoiceGender$NSVoiceGenderFemale$NSVoiceGenderMale$NSVoiceGenderNeuter$NSVoiceGenderNeutral$NSVoiceIdentifier$NSVoiceIndividuallySpokenCharacters$NSVoiceLanguage$NSVoiceLocaleIdentifier$NSVoiceName$NSVoiceSupportedCharacters$NSWarningValueBinding$NSWebArchiveTextDocumentType$NSWebPreferencesDocumentOption$NSWebResourceLoadDelegateDocumentOption$NSWhite@d$NSWidthBinding$NSWindowDidBecomeKeyNotification$NSWindowDidBecomeMainNotification$NSWindowDidChangeBackingPropertiesNotification$NSWindowDidChangeOcclusionStateNotification$NSWindowDidChangeScreenNotification$NSWindowDidChangeScreenProfileNotification$NSWindowDidDeminiaturizeNotification$NSWindowDidEndLiveResizeNotification$NSWindowDidEndSheetNotification$NSWindowDidEnterFullScreenNotification$NSWindowDidEnterVersionBrowserNotification$NSWindowDidExitFullScreenNotification$NSWindowDidExitVersionBrowserNotification$NSWindowDidExposeNotification$NSWindowDidMiniaturizeNotification$NSWindowDidMoveNotification$NSWindowDidResignKeyNotification$NSWindowDidResignMainNotification$NSWindowDidResizeNotification$NSWindowDidUpdateNotification$NSWindowServerCommunicationException$NSWindowWillBeginSheetNotification$NSWindowWillCloseNotification$NSWindowWillEnterFullScreenNotification$NSWindowWillEnterVersionBrowserNotification$NSWindowWillExitFullScreenNotification$NSWindowWillExitVersionBrowserNotification$NSWindowWillMiniaturizeNotification$NSWindowWillMoveNotification$NSWindowWillStartLiveResizeNotification$NSWordMLTextDocumentType$NSWordTablesReadException$NSWordTablesWriteException$NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification$NSWorkspaceActiveSpaceDidChangeNotification$NSWorkspaceApplicationKey$NSWorkspaceCompressOperation$NSWorkspaceCopyOperation$NSWorkspaceDecompressOperation$NSWorkspaceDecryptOperation$NSWorkspaceDesktopImageAllowClippingKey$NSWorkspaceDesktopImageFillColorKey$NSWorkspaceDesktopImageScalingKey$NSWorkspaceDestroyOperation$NSWorkspaceDidActivateApplicationNotification$NSWorkspaceDidChangeFileLabelsNotification$NSWorkspaceDidDeactivateApplicationNotification$NSWorkspaceDidHideApplicationNotification$NSWorkspaceDidLaunchApplicationNotification$NSWorkspaceDidMountNotification$NSWorkspaceDidPerformFileOperationNotification$NSWorkspaceDidRenameVolumeNotification$NSWorkspaceDidTerminateApplicationNotification$NSWorkspaceDidUnhideApplicationNotification$NSWorkspaceDidUnmountNotification$NSWorkspaceDidWakeNotification$NSWorkspaceDuplicateOperation$NSWorkspaceEncryptOperation$NSWorkspaceLaunchConfigurationAppleEvent$NSWorkspaceLaunchConfigurationArchitecture$NSWorkspaceLaunchConfigurationArguments$NSWorkspaceLaunchConfigurationEnvironment$NSWorkspaceLinkOperation$NSWorkspaceMoveOperation$NSWorkspaceRecycleOperation$NSWorkspaceScreensDidSleepNotification$NSWorkspaceScreensDidWakeNotification$NSWorkspaceSessionDidBecomeActiveNotification$NSWorkspaceSessionDidResignActiveNotification$NSWorkspaceVolumeLocalizedNameKey$NSWorkspaceVolumeOldLocalizedNameKey$NSWorkspaceVolumeOldURLKey$NSWorkspaceVolumeURLKey$NSWorkspaceWillLaunchApplicationNotification$NSWorkspaceWillPowerOffNotification$NSWorkspaceWillSleepNotification$NSWorkspaceWillUnmountNotification$NSWritingDirectionAttributeName$""" -enums = """$NS16BitBigEndianBitmapFormat@1024$NS16BitLittleEndianBitmapFormat@256$NS32BitBigEndianBitmapFormat@2048$NS32BitLittleEndianBitmapFormat@512$NSAWTEventType@16$NSAboveBottom@4$NSAboveTop@1$NSAcceleratorButton@8$NSAccessibilityAnnotationPositionEnd@2$NSAccessibilityAnnotationPositionFullRange@0$NSAccessibilityAnnotationPositionStart@1$NSAccessibilityCustomRotorSearchDirectionNext@1$NSAccessibilityCustomRotorSearchDirectionPrevious@0$NSAccessibilityCustomRotorTypeAnnotation@2$NSAccessibilityCustomRotorTypeAny@1$NSAccessibilityCustomRotorTypeAudiograph@21$NSAccessibilityCustomRotorTypeBoldText@3$NSAccessibilityCustomRotorTypeCustom@0$NSAccessibilityCustomRotorTypeHeading@4$NSAccessibilityCustomRotorTypeHeadingLevel1@5$NSAccessibilityCustomRotorTypeHeadingLevel2@6$NSAccessibilityCustomRotorTypeHeadingLevel3@7$NSAccessibilityCustomRotorTypeHeadingLevel4@8$NSAccessibilityCustomRotorTypeHeadingLevel5@9$NSAccessibilityCustomRotorTypeHeadingLevel6@10$NSAccessibilityCustomRotorTypeImage@11$NSAccessibilityCustomRotorTypeItalicText@12$NSAccessibilityCustomRotorTypeLandmark@13$NSAccessibilityCustomRotorTypeLink@14$NSAccessibilityCustomRotorTypeList@15$NSAccessibilityCustomRotorTypeMisspelledWord@16$NSAccessibilityCustomRotorTypeTable@17$NSAccessibilityCustomRotorTypeTextField@18$NSAccessibilityCustomRotorTypeUnderlinedText@19$NSAccessibilityCustomRotorTypeVisitedLink@20$NSAccessibilityOrientationHorizontal@2$NSAccessibilityOrientationUnknown@0$NSAccessibilityOrientationVertical@1$NSAccessibilityPriorityHigh@90$NSAccessibilityPriorityLow@10$NSAccessibilityPriorityMedium@50$NSAccessibilityRulerMarkerTypeIndentFirstLine@7$NSAccessibilityRulerMarkerTypeIndentHead@5$NSAccessibilityRulerMarkerTypeIndentTail@6$NSAccessibilityRulerMarkerTypeTabStopCenter@3$NSAccessibilityRulerMarkerTypeTabStopDecimal@4$NSAccessibilityRulerMarkerTypeTabStopLeft@1$NSAccessibilityRulerMarkerTypeTabStopRight@2$NSAccessibilityRulerMarkerTypeUnknown@0$NSAccessibilitySortDirectionAscending@1$NSAccessibilitySortDirectionDescending@2$NSAccessibilitySortDirectionUnknown@0$NSAccessibilityUnitsCentimeters@2$NSAccessibilityUnitsInches@1$NSAccessibilityUnitsPicas@4$NSAccessibilityUnitsPoints@3$NSAccessibilityUnitsUnknown@0$NSAddTraitFontAction@2$NSAdobeCNS1CharacterCollection@1$NSAdobeGB1CharacterCollection@2$NSAdobeJapan1CharacterCollection@3$NSAdobeJapan2CharacterCollection@4$NSAdobeKorea1CharacterCollection@5$NSAlertAlternateReturn@0$NSAlertDefaultReturn@1$NSAlertErrorReturn@-2$NSAlertFirstButtonReturn@1000$NSAlertOtherReturn@-1$NSAlertSecondButtonReturn@1001$NSAlertStyleCritical@2$NSAlertStyleInformational@1$NSAlertStyleWarning@0$NSAlertThirdButtonReturn@1002$NSAllScrollerParts@2$NSAlphaFirstBitmapFormat@1$NSAlphaNonpremultipliedBitmapFormat@2$NSAlphaShiftKeyMask@65536$NSAlternateKeyMask@524288$NSAnimationBlocking@0$NSAnimationEaseIn@1$NSAnimationEaseInOut@0$NSAnimationEaseOut@2$NSAnimationEffectDisappearingItemDefault@0$NSAnimationEffectPoof@10$NSAnimationLinear@3$NSAnimationNonblocking@1$NSAnimationNonblockingThreaded@2$NSAnyEventMask@18446744073709551615$NSAnyType@0$NSAppKitDefined@13$NSAppKitDefinedMask@8192$NSAppKitVersionNumber10_0@577$NSAppKitVersionNumber10_1@620$NSAppKitVersionNumber10_10@1343$NSAppKitVersionNumber10_10_2@1344$NSAppKitVersionNumber10_10_3@1347$NSAppKitVersionNumber10_10_4@1348$NSAppKitVersionNumber10_10_5@1348$NSAppKitVersionNumber10_10_Max@1349$NSAppKitVersionNumber10_11@1404.0$NSAppKitVersionNumber10_11_1@1404.13$NSAppKitVersionNumber10_11_2@1404.34$NSAppKitVersionNumber10_11_3@1404.34$NSAppKitVersionNumber10_12@1504$NSAppKitVersionNumber10_12_1@1504.6$NSAppKitVersionNumber10_12_2@1504.76$NSAppKitVersionNumber10_13@1561$NSAppKitVersionNumber10_13_1@1561.1$NSAppKitVersionNumber10_13_2@1561.2$NSAppKitVersionNumber10_13_4@1561.4$NSAppKitVersionNumber10_14@1671.0$NSAppKitVersionNumber10_14_1@1671.1$NSAppKitVersionNumber10_14_2@1671.2$NSAppKitVersionNumber10_14_3@1671.3$NSAppKitVersionNumber10_14_4@1671.4$NSAppKitVersionNumber10_14_5@1671.5$NSAppKitVersionNumber10_15@1894.0$NSAppKitVersionNumber10_15_1@1894.1$NSAppKitVersionNumber10_15_2@1894.2$NSAppKitVersionNumber10_15_3@1894.3$NSAppKitVersionNumber10_15_4@1894.4$NSAppKitVersionNumber10_15_5@1894.5$NSAppKitVersionNumber10_15_6@1894.6$NSAppKitVersionNumber10_2@663$NSAppKitVersionNumber10_3@743$NSAppKitVersionNumber10_4@824$NSAppKitVersionNumber10_5@949$NSAppKitVersionNumber10_6@1038$NSAppKitVersionNumber10_7@1138$NSAppKitVersionNumber10_8@1187$NSAppKitVersionNumber10_9@1265$NSAppKitVersionNumber11_0@2022.0$NSAppKitVersionNumber11_1@2022.2$NSAppKitVersionNumber11_2@2022.3$NSAppKitVersionNumber11_3@2022.4$NSAppKitVersionNumber11_4@2022.5$NSAppKitVersionNumber11_5@2022.6$NSAppKitVersionNumber12_0@2113.0$NSAppKitVersionNumber12_1@2113.2$NSAppKitVersionNumber12_2@2113.3$NSAppKitVersionNumber12_3@2113.4$NSAppKitVersionNumber12_4@2113.5$NSAppKitVersionNumber12_5@2113.6$NSAppKitVersionNumber13_0@2299.0$NSAppKitVersionNumber13_1@2299.3$NSAppKitVersionNumber13_2@2299.3$NSAppKitVersionNumber13_3@2299.4$NSAppKitVersionNumber13_5@2299.6$NSAppKitVersionNumber13_4@2299.5$NSAppKitVersionNumber13_6@2299.7$NSAppKitVersionNumber14_0@2487.0$NSAppKitVersionNumber14_1@2487.2$NSApplicationActivateAllWindows@1$NSApplicationActivateIgnoringOtherApps@2$NSApplicationActivatedEventType@1$NSApplicationActivationPolicyAccessory@1$NSApplicationActivationPolicyProhibited@2$NSApplicationActivationPolicyRegular@0$NSApplicationDeactivatedEventType@2$NSApplicationDefined@15$NSApplicationDefinedMask@32768$NSApplicationDelegateReplyCancel@1$NSApplicationDelegateReplyFailure@2$NSApplicationDelegateReplySuccess@0$NSApplicationOcclusionStateVisible@2$NSApplicationPresentationAutoHideDock@1$NSApplicationPresentationAutoHideMenuBar@4$NSApplicationPresentationAutoHideToolbar@2048$NSApplicationPresentationDefault@0$NSApplicationPresentationDisableAppleMenu@16$NSApplicationPresentationDisableCursorLocationAssistance@4096$NSApplicationPresentationDisableForceQuit@64$NSApplicationPresentationDisableHideApplication@256$NSApplicationPresentationDisableMenuBarTransparency@512$NSApplicationPresentationDisableProcessSwitching@32$NSApplicationPresentationDisableSessionTermination@128$NSApplicationPresentationFullScreen@1024$NSApplicationPresentationHideDock@2$NSApplicationPresentationHideMenuBar@8$NSAscendingPageOrder@1$NSAtBottom@5$NSAtTop@2$NSAutoPagination@0$NSAutosaveAsOperation@5$NSAutosaveElsewhereOperation@3$NSAutosaveInPlaceOperation@4$NSAutosaveOperation@3$NSBMPFileType@1$NSBackTabCharacter@25$NSBackgroundStyleDark@1$NSBackgroundStyleEmphasized@1$NSBackgroundStyleLight@0$NSBackgroundStyleLowered@3$NSBackgroundStyleNormal@0$NSBackgroundStyleRaised@2$NSBackgroundTab@1$NSBackingStoreBuffered@2$NSBackingStoreNonretained@1$NSBackingStoreRetained@0$NSBackspaceCharacter@8$NSBacktabTextMovement@18$NSBeginFunctionKey@63274$NSBelowBottom@6$NSBelowTop@3$NSBevelLineJoinStyle@2$NSBezelBorder@2$NSBezelStyleAccessoryBar@13$NSBezelStyleAccessoryBarAction@12$NSBezelStyleAutomatic@0$NSBezelStyleBadge@15$NSBezelStyleCircular@7$NSBezelStyleDisclosure@5$NSBezelStyleFlexiblePush@2$NSBezelStyleHelpButton@9$NSBezelStyleInline@15$NSBezelStylePush@1$NSBezelStylePushDisclosure@14$NSBezelStyleRecessed@13$NSBezelStyleRegularSquare@2$NSBezelStyleRoundRect@12$NSBezelStyleRounded@1$NSBezelStyleRoundedDisclosure@14$NSBezelStyleShadowlessSquare@6$NSBezelStyleSmallSquare@10$NSBezelStyleTexturedRounded@11$NSBezelStyleTexturedSquare@8$NSBezelStyleToolbar@11$NSBezierPathElementClosePath@3$NSBezierPathElementCubicCurveTo@2$NSBezierPathElementCurveTo@2$NSBezierPathElementLineTo@1$NSBezierPathElementMoveTo@0$NSBezierPathElementQuadraticCurveTo@4$NSBitmapFormatAlphaFirst@1$NSBitmapFormatAlphaNonpremultiplied@2$NSBitmapFormatFloatingPointSamples@4$NSBitmapFormatSixteenBitBigEndian@1024$NSBitmapFormatSixteenBitLittleEndian@256$NSBitmapFormatThirtyTwoBitBigEndian@2048$NSBitmapFormatThirtyTwoBitLittleEndian@512$NSBitmapImageFileTypeBMP@1$NSBitmapImageFileTypeGIF@2$NSBitmapImageFileTypeJPEG@3$NSBitmapImageFileTypeJPEG2000@5$NSBitmapImageFileTypePNG@4$NSBitmapImageFileTypeTIFF@0$NSBlueControlTint@1$NSBoldFontMask@2$NSBorderlessWindowMask@0$NSBottomTabsBezelBorder@2$NSBoxCustom@4$NSBoxOldStyle@3$NSBoxPrimary@0$NSBoxSecondary@1$NSBoxSeparator@2$NSBreakFunctionKey@63282$NSBrowserAutoColumnResizing@1$NSBrowserDropAbove@1$NSBrowserDropOn@0$NSBrowserNoColumnResizing@0$NSBrowserUserColumnResizing@2$NSButtLineCapStyle@0$NSButtonTypeAccelerator@8$NSButtonTypeMomentaryChange@5$NSButtonTypeMomentaryLight@0$NSButtonTypeMomentaryPushIn@7$NSButtonTypeMultiLevelAccelerator@9$NSButtonTypeOnOff@6$NSButtonTypePushOnPushOff@1$NSButtonTypeRadio@4$NSButtonTypeSwitch@3$NSButtonTypeToggle@2$NSCMYKColorSpaceModel@2$NSCMYKModeColorPanel@2$NSCancelButton@0$NSCancelTextMovement@23$NSCarriageReturnCharacter@13$NSCellAllowsMixedState@16$NSCellChangesContents@14$NSCellDisabled@0$NSCellEditable@3$NSCellHasImageHorizontal@12$NSCellHasImageOnLeftOrBottom@13$NSCellHasOverlappingImage@11$NSCellHighlighted@5$NSCellHitContentArea@1$NSCellHitEditableTextArea@2$NSCellHitNone@0$NSCellHitTrackableArea@4$NSCellIsBordered@10$NSCellIsInsetButton@15$NSCellLightsByBackground@9$NSCellLightsByContents@6$NSCellLightsByGray@7$NSCellState@1$NSCenterTabStopType@2$NSChangeAutosaved@4$NSChangeBackgroundCell@8$NSChangeBackgroundCellMask@8$NSChangeCleared@2$NSChangeDiscardable@256$NSChangeDone@0$NSChangeGrayCell@4$NSChangeGrayCellMask@4$NSChangeReadOtherContents@3$NSChangeRedone@5$NSChangeUndone@1$NSCircularBezelStyle@7$NSCircularSlider@1$NSClearControlTint@7$NSClearDisplayFunctionKey@63290$NSClearLineFunctionKey@63289$NSClipPagination@2$NSClockAndCalendarDatePickerStyle@1$NSClosableWindowMask@2$NSClosePathBezierPathElement@3$NSCloudKitSharingServiceAllowPrivate@2$NSCloudKitSharingServiceAllowPublic@1$NSCloudKitSharingServiceAllowReadOnly@16$NSCloudKitSharingServiceAllowReadWrite@32$NSCloudKitSharingServiceStandard@0$NSCollectionElementCategoryDecorationView@2$NSCollectionElementCategoryInterItemGap@3$NSCollectionElementCategoryItem@0$NSCollectionElementCategorySupplementaryView@1$NSCollectionLayoutSectionOrthogonalScrollingBehaviorContinuous@1$NSCollectionLayoutSectionOrthogonalScrollingBehaviorContinuousGroupLeadingBoundary@2$NSCollectionLayoutSectionOrthogonalScrollingBehaviorGroupPaging@4$NSCollectionLayoutSectionOrthogonalScrollingBehaviorGroupPagingCentered@5$NSCollectionLayoutSectionOrthogonalScrollingBehaviorNone@0$NSCollectionLayoutSectionOrthogonalScrollingBehaviorPaging@3$NSCollectionUpdateActionDelete@1$NSCollectionUpdateActionInsert@0$NSCollectionUpdateActionMove@3$NSCollectionUpdateActionNone@4$NSCollectionUpdateActionReload@2$NSCollectionViewDropBefore@1$NSCollectionViewDropOn@0$NSCollectionViewItemHighlightAsDropTarget@3$NSCollectionViewItemHighlightForDeselection@2$NSCollectionViewItemHighlightForSelection@1$NSCollectionViewItemHighlightNone@0$NSCollectionViewScrollDirectionHorizontal@1$NSCollectionViewScrollDirectionVertical@0$NSCollectionViewScrollPositionBottom@4$NSCollectionViewScrollPositionCenteredHorizontally@16$NSCollectionViewScrollPositionCenteredVertically@2$NSCollectionViewScrollPositionLeadingEdge@64$NSCollectionViewScrollPositionLeft@8$NSCollectionViewScrollPositionNearestHorizontalEdge@512$NSCollectionViewScrollPositionNearestVerticalEdge@256$NSCollectionViewScrollPositionNone@0$NSCollectionViewScrollPositionRight@32$NSCollectionViewScrollPositionTop@1$NSCollectionViewScrollPositionTrailingEdge@128$NSColorListModeColorPanel@5$NSColorPanelAllModesMask@65535$NSColorPanelCMYKModeMask@4$NSColorPanelColorListModeMask@32$NSColorPanelCrayonModeMask@128$NSColorPanelCustomPaletteModeMask@16$NSColorPanelGrayModeMask@1$NSColorPanelHSBModeMask@8$NSColorPanelModeCMYK@2$NSColorPanelModeColorList@5$NSColorPanelModeCrayon@7$NSColorPanelModeCustomPalette@4$NSColorPanelModeGray@0$NSColorPanelModeHSB@3$NSColorPanelModeNone@-1$NSColorPanelModeRGB@1$NSColorPanelModeWheel@6$NSColorPanelRGBModeMask@2$NSColorPanelWheelModeMask@64$NSColorRenderingIntentAbsoluteColorimetric@1$NSColorRenderingIntentDefault@0$NSColorRenderingIntentPerceptual@3$NSColorRenderingIntentRelativeColorimetric@2$NSColorRenderingIntentSaturation@4$NSColorSpaceModelCMYK@2$NSColorSpaceModelDeviceN@4$NSColorSpaceModelGray@0$NSColorSpaceModelIndexed@5$NSColorSpaceModelLAB@3$NSColorSpaceModelPatterned@6$NSColorSpaceModelRGB@1$NSColorSpaceModelUnknown@-1$NSColorSystemEffectDeepPressed@2$NSColorSystemEffectDisabled@3$NSColorSystemEffectNone@0$NSColorSystemEffectPressed@1$NSColorSystemEffectRollover@4$NSColorTypeCatalog@2$NSColorTypeComponentBased@0$NSColorTypePattern@1$NSColorWellStyleDefault@0$NSColorWellStyleExpanded@2$NSColorWellStyleMinimal@1$NSComboButtonStyleSplit@0$NSComboButtonStyleUnified@1$NSCommandKeyMask@1048576$NSCompositeClear@0$NSCompositeColor@27$NSCompositeColorBurn@20$NSCompositeColorDodge@19$NSCompositeCopy@1$NSCompositeDarken@17$NSCompositeDestinationAtop@9$NSCompositeDestinationIn@7$NSCompositeDestinationOut@8$NSCompositeDestinationOver@6$NSCompositeDifference@23$NSCompositeExclusion@24$NSCompositeHardLight@22$NSCompositeHighlight@12$NSCompositeHue@25$NSCompositeLighten@18$NSCompositeLuminosity@28$NSCompositeMultiply@14$NSCompositeOverlay@16$NSCompositePlusDarker@11$NSCompositePlusLighter@13$NSCompositeSaturation@26$NSCompositeScreen@15$NSCompositeSoftLight@21$NSCompositeSourceAtop@5$NSCompositeSourceIn@3$NSCompositeSourceOut@4$NSCompositeSourceOver@2$NSCompositeXOR@10$NSCompositingOperationClear@0$NSCompositingOperationColor@27$NSCompositingOperationColorBurn@20$NSCompositingOperationColorDodge@19$NSCompositingOperationCopy@1$NSCompositingOperationDarken@17$NSCompositingOperationDestinationAtop@9$NSCompositingOperationDestinationIn@7$NSCompositingOperationDestinationOut@8$NSCompositingOperationDestinationOver@6$NSCompositingOperationDifference@23$NSCompositingOperationExclusion@24$NSCompositingOperationHardLight@22$NSCompositingOperationHighlight@12$NSCompositingOperationHue@25$NSCompositingOperationLighten@18$NSCompositingOperationLuminosity@28$NSCompositingOperationMultiply@14$NSCompositingOperationOverlay@16$NSCompositingOperationPlusDarker@11$NSCompositingOperationPlusLighter@13$NSCompositingOperationSaturation@26$NSCompositingOperationScreen@15$NSCompositingOperationSoftLight@21$NSCompositingOperationSourceAtop@5$NSCompositingOperationSourceIn@3$NSCompositingOperationSourceOut@4$NSCompositingOperationSourceOver@2$NSCompositingOperationXOR@10$NSCompressedFontMask@512$NSCondensedFontMask@64$NSContentsCellMask@1$NSContinuousCapacityLevelIndicatorStyle@1$NSControlCharacterActionContainerBreak@32$NSControlCharacterActionHorizontalTab@4$NSControlCharacterActionLineBreak@8$NSControlCharacterActionParagraphBreak@16$NSControlCharacterActionWhitespace@2$NSControlCharacterActionZeroAdvancement@1$NSControlGlyph@16777215$NSControlKeyMask@262144$NSControlSizeLarge@3$NSControlSizeMini@2$NSControlSizeRegular@0$NSControlSizeSmall@1$NSControlStateMixed@-1$NSControlStateOff@0$NSControlStateOn@1$NSControlStateValueMixed@-1$NSControlStateValueOff@0$NSControlStateValueOn@1$NSCorrectionIndicatorTypeDefault@0$NSCorrectionIndicatorTypeGuesses@2$NSCorrectionIndicatorTypeReversion@1$NSCorrectionResponseAccepted@1$NSCorrectionResponseEdited@4$NSCorrectionResponseIgnored@3$NSCorrectionResponseNone@0$NSCorrectionResponseRejected@2$NSCorrectionResponseReverted@5$NSCrayonModeColorPanel@7$NSCriticalAlertStyle@2$NSCriticalRequest@0$NSCursorPointingDevice@2$NSCursorUpdate@17$NSCursorUpdateMask@131072$NSCurveToBezierPathElement@2$NSCustomPaletteModeColorPanel@4$NSDatePickerElementFlagEra@256$NSDatePickerElementFlagHourMinute@12$NSDatePickerElementFlagHourMinuteSecond@14$NSDatePickerElementFlagTimeZone@16$NSDatePickerElementFlagYearMonth@192$NSDatePickerElementFlagYearMonthDay@224$NSDatePickerModeRange@1$NSDatePickerModeSingle@0$NSDatePickerStyleClockAndCalendar@1$NSDatePickerStyleTextField@2$NSDatePickerStyleTextFieldAndStepper@0$NSDecimalTabStopType@3$NSDefaultControlTint@0$NSDefaultTokenStyle@0$NSDeleteCharFunctionKey@63294$NSDeleteCharacter@127$NSDeleteFunctionKey@63272$NSDeleteLineFunctionKey@63292$NSDescendingPageOrder@-1$NSDeviceIndependentModifierFlagsMask@4294901760$NSDeviceNColorSpaceModel@4$NSDirectSelection@0$NSDirectionalRectEdgeAll@15$NSDirectionalRectEdgeBottom@4$NSDirectionalRectEdgeLeading@2$NSDirectionalRectEdgeNone@0$NSDirectionalRectEdgeTop@1$NSDirectionalRectEdgeTrailing@8$NSDisclosureBezelStyle@5$NSDiscreteCapacityLevelIndicatorStyle@2$NSDisplayGamutP3@2$NSDisplayGamutSRGB@1$NSDisplayWindowRunLoopOrdering@600000$NSDocModalWindowMask@64$NSDockWindowLevel@20$NSDoubleType@6$NSDownArrowFunctionKey@63233$NSDownTextMovement@22$NSDragOperationAll@15$NSDragOperationAll_Obsolete@15$NSDragOperationCopy@1$NSDragOperationDelete@32$NSDragOperationEvery@18446744073709551615$NSDragOperationGeneric@4$NSDragOperationLink@2$NSDragOperationMove@16$NSDragOperationNone@0$NSDragOperationPrivate@8$NSDraggingContextOutsideApplication@0$NSDraggingContextWithinApplication@1$NSDraggingFormationDefault@0$NSDraggingFormationList@3$NSDraggingFormationNone@1$NSDraggingFormationPile@2$NSDraggingFormationStack@4$NSDraggingItemEnumerationClearNonenumeratedImages@65536$NSDraggingItemEnumerationConcurrent@1$NSDrawerClosedState@0$NSDrawerClosingState@3$NSDrawerOpenState@2$NSDrawerOpeningState@1$NSEndFunctionKey@63275$NSEnterCharacter@3$NSEraDatePickerElementFlag@256$NSEraserPointingDevice@3$NSEvenOddWindingRule@1$NSEventButtonMaskPenLowerSide@2$NSEventButtonMaskPenTip@1$NSEventButtonMaskPenUpperSide@4$NSEventGestureAxisHorizontal@1$NSEventGestureAxisNone@0$NSEventGestureAxisVertical@2$NSEventMaskAny@18446744073709551615$NSEventMaskAppKitDefined@8192$NSEventMaskApplicationDefined@32768$NSEventMaskBeginGesture@524288$NSEventMaskChangeMode@274877906944$NSEventMaskCursorUpdate@131072$NSEventMaskDirectTouch@137438953472$NSEventMaskEndGesture@1048576$NSEventMaskFlagsChanged@4096$NSEventMaskGesture@536870912$NSEventMaskKeyDown@1024$NSEventMaskKeyUp@2048$NSEventMaskLeftMouseDown@2$NSEventMaskLeftMouseDragged@64$NSEventMaskLeftMouseUp@4$NSEventMaskMagnify@1073741824$NSEventMaskMouseEntered@256$NSEventMaskMouseExited@512$NSEventMaskMouseMoved@32$NSEventMaskOtherMouseDown@33554432$NSEventMaskOtherMouseDragged@134217728$NSEventMaskOtherMouseUp@67108864$NSEventMaskPeriodic@65536$NSEventMaskPressure@17179869184$NSEventMaskRightMouseDown@8$NSEventMaskRightMouseDragged@128$NSEventMaskRightMouseUp@16$NSEventMaskRotate@262144$NSEventMaskScrollWheel@4194304$NSEventMaskSmartMagnify@4294967296$NSEventMaskSwipe@2147483648$NSEventMaskSystemDefined@16384$NSEventMaskTabletPoint@8388608$NSEventMaskTabletProximity@16777216$NSEventModifierFlagCapsLock@65536$NSEventModifierFlagCommand@1048576$NSEventModifierFlagControl@262144$NSEventModifierFlagDeviceIndependentFlagsMask@4294901760$NSEventModifierFlagFunction@8388608$NSEventModifierFlagHelp@4194304$NSEventModifierFlagNumericPad@2097152$NSEventModifierFlagOption@524288$NSEventModifierFlagShift@131072$NSEventPhaseBegan@1$NSEventPhaseCancelled@16$NSEventPhaseChanged@4$NSEventPhaseEnded@8$NSEventPhaseMayBegin@32$NSEventPhaseNone@0$NSEventPhaseStationary@2$NSEventSubtypeApplicationActivated@1$NSEventSubtypeApplicationDeactivated@2$NSEventSubtypeMouseEvent@0$NSEventSubtypePowerOff@1$NSEventSubtypeScreenChanged@8$NSEventSubtypeTabletPoint@1$NSEventSubtypeTabletProximity@2$NSEventSubtypeTouch@3$NSEventSubtypeWindowExposed@0$NSEventSubtypeWindowMoved@4$NSEventSwipeTrackingClampGestureAmount@2$NSEventSwipeTrackingLockDirection@1$NSEventTypeAppKitDefined@13$NSEventTypeApplicationDefined@15$NSEventTypeBeginGesture@19$NSEventTypeChangeMode@38$NSEventTypeCursorUpdate@17$NSEventTypeDirectTouch@37$NSEventTypeEndGesture@20$NSEventTypeFlagsChanged@12$NSEventTypeGesture@29$NSEventTypeKeyDown@10$NSEventTypeKeyUp@11$NSEventTypeLeftMouseDown@1$NSEventTypeLeftMouseDragged@6$NSEventTypeLeftMouseUp@2$NSEventTypeMagnify@30$NSEventTypeMouseEntered@8$NSEventTypeMouseExited@9$NSEventTypeMouseMoved@5$NSEventTypeOtherMouseDown@25$NSEventTypeOtherMouseDragged@27$NSEventTypeOtherMouseUp@26$NSEventTypePeriodic@16$NSEventTypePressure@34$NSEventTypeQuickLook@33$NSEventTypeRightMouseDown@3$NSEventTypeRightMouseDragged@7$NSEventTypeRightMouseUp@4$NSEventTypeRotate@18$NSEventTypeScrollWheel@22$NSEventTypeSmartMagnify@32$NSEventTypeSwipe@31$NSEventTypeSystemDefined@14$NSEventTypeTabletPoint@23$NSEventTypeTabletProximity@24$NSExclude10_4ElementsIconCreationOption@4$NSExcludeQuickDrawElementsIconCreationOption@2$NSExecuteFunctionKey@63298$NSExpandedFontMask@32$NSF10FunctionKey@63245$NSF11FunctionKey@63246$NSF12FunctionKey@63247$NSF13FunctionKey@63248$NSF14FunctionKey@63249$NSF15FunctionKey@63250$NSF16FunctionKey@63251$NSF17FunctionKey@63252$NSF18FunctionKey@63253$NSF19FunctionKey@63254$NSF1FunctionKey@63236$NSF20FunctionKey@63255$NSF21FunctionKey@63256$NSF22FunctionKey@63257$NSF23FunctionKey@63258$NSF24FunctionKey@63259$NSF25FunctionKey@63260$NSF26FunctionKey@63261$NSF27FunctionKey@63262$NSF28FunctionKey@63263$NSF29FunctionKey@63264$NSF2FunctionKey@63237$NSF30FunctionKey@63265$NSF31FunctionKey@63266$NSF32FunctionKey@63267$NSF33FunctionKey@63268$NSF34FunctionKey@63269$NSF35FunctionKey@63270$NSF3FunctionKey@63238$NSF4FunctionKey@63239$NSF5FunctionKey@63240$NSF6FunctionKey@63241$NSF7FunctionKey@63242$NSF8FunctionKey@63243$NSF9FunctionKey@63244$NSFPCurrentField@134$NSFPPreviewButton@131$NSFPPreviewField@128$NSFPRevertButton@130$NSFPSetButton@132$NSFPSizeField@129$NSFPSizeTitle@133$NSFileHandlingPanelCancelButton@0$NSFileHandlingPanelOKButton@1$NSFileWrapperReadingImmediate@1$NSFileWrapperReadingWithoutMapping@2$NSFileWrapperWritingAtomic@1$NSFileWrapperWritingWithNameUpdating@2$NSFindFunctionKey@63301$NSFindPanelActionNext@2$NSFindPanelActionPrevious@3$NSFindPanelActionReplace@5$NSFindPanelActionReplaceAll@4$NSFindPanelActionReplaceAllInSelection@8$NSFindPanelActionReplaceAndFind@6$NSFindPanelActionSelectAll@9$NSFindPanelActionSelectAllInSelection@10$NSFindPanelActionSetFindString@7$NSFindPanelActionShowFindPanel@1$NSFindPanelSubstringMatchTypeContains@0$NSFindPanelSubstringMatchTypeEndsWith@3$NSFindPanelSubstringMatchTypeFullWord@2$NSFindPanelSubstringMatchTypeStartsWith@1$NSFitPagination@1$NSFixedPitchFontMask@1024$NSFlagsChanged@12$NSFlagsChangedMask@4096$NSFloatType@3$NSFloatingPointSamplesBitmapFormat@4$NSFloatingWindowLevel@3$NSFocusRingAbove@2$NSFocusRingBelow@1$NSFocusRingOnly@0$NSFocusRingTypeDefault@0$NSFocusRingTypeExterior@2$NSFocusRingTypeNone@1$NSFontAntialiasedIntegerAdvancementsRenderingMode@3$NSFontAntialiasedRenderingMode@1$NSFontAssetDownloadError@66304$NSFontAssetRequestOptionUsesStandardUI@1$NSFontBoldTrait@2$NSFontClarendonSerifsClass@1073741824$NSFontCollectionApplicationOnlyMask@1$NSFontCollectionVisibilityComputer@4$NSFontCollectionVisibilityProcess@1$NSFontCollectionVisibilityUser@2$NSFontCondensedTrait@64$NSFontDefaultRenderingMode@0$NSFontDescriptorClassClarendonSerifs@1073741824$NSFontDescriptorClassFreeformSerifs@1879048192$NSFontDescriptorClassMask@4026531840$NSFontDescriptorClassModernSerifs@805306368$NSFontDescriptorClassOldStyleSerifs@268435456$NSFontDescriptorClassOrnamentals@2415919104$NSFontDescriptorClassSansSerif@2147483648$NSFontDescriptorClassScripts@2684354560$NSFontDescriptorClassSlabSerifs@1342177280$NSFontDescriptorClassSymbolic@3221225472$NSFontDescriptorClassTransitionalSerifs@536870912$NSFontDescriptorClassUnknown@0$NSFontDescriptorTraitBold@2$NSFontDescriptorTraitCondensed@64$NSFontDescriptorTraitEmphasized@2$NSFontDescriptorTraitExpanded@32$NSFontDescriptorTraitItalic@1$NSFontDescriptorTraitLooseLeading@65536$NSFontDescriptorTraitMonoSpace@1024$NSFontDescriptorTraitTightLeading@32768$NSFontDescriptorTraitUIOptimized@4096$NSFontDescriptorTraitVertical@2048$NSFontErrorMaximum@66335$NSFontErrorMinimum@66304$NSFontExpandedTrait@32$NSFontFamilyClassMask@4026531840$NSFontFreeformSerifsClass@1879048192$NSFontIntegerAdvancementsRenderingMode@2$NSFontItalicTrait@1$NSFontModernSerifsClass@805306368$NSFontMonoSpaceTrait@1024$NSFontOldStyleSerifsClass@268435456$NSFontOrnamentalsClass@2415919104$NSFontPanelAllEffectsModeMask@1048320$NSFontPanelAllModesMask@4294967295$NSFontPanelCollectionModeMask@4$NSFontPanelDocumentColorEffectModeMask@2048$NSFontPanelFaceModeMask@1$NSFontPanelModeMaskAllEffects@1048320$NSFontPanelModeMaskCollection@4$NSFontPanelModeMaskDocumentColorEffect@2048$NSFontPanelModeMaskFace@1$NSFontPanelModeMaskShadowEffect@4096$NSFontPanelModeMaskSize@2$NSFontPanelModeMaskStrikethroughEffect@512$NSFontPanelModeMaskTextColorEffect@1024$NSFontPanelModeMaskUnderlineEffect@256$NSFontPanelModesMaskAllModes@4294967295$NSFontPanelModesMaskStandardModes@65535$NSFontPanelShadowEffectModeMask@4096$NSFontPanelSizeModeMask@2$NSFontPanelStandardModesMask@65535$NSFontPanelStrikethroughEffectModeMask@512$NSFontPanelTextColorEffectModeMask@1024$NSFontPanelUnderlineEffectModeMask@256$NSFontSansSerifClass@2147483648$NSFontScriptsClass@2684354560$NSFontSlabSerifsClass@1342177280$NSFontSymbolicClass@3221225472$NSFontTransitionalSerifsClass@536870912$NSFontUIOptimizedTrait@4096$NSFontUnknownClass@0$NSFontVerticalTrait@2048$NSFormFeedCharacter@12$NSFullScreenWindowMask@16384$NSFullSizeContentViewWindowMask@32768$NSFunctionKeyMask@8388608$NSGIFFileType@2$NSGestureRecognizerStateBegan@1$NSGestureRecognizerStateCancelled@4$NSGestureRecognizerStateChanged@2$NSGestureRecognizerStateEnded@3$NSGestureRecognizerStateFailed@5$NSGestureRecognizerStatePossible@0$NSGestureRecognizerStateRecognized@3$NSGlyphAttributeBidiLevel@2$NSGlyphAttributeElastic@1$NSGlyphAttributeInscribe@5$NSGlyphAttributeSoft@0$NSGlyphInscribeAbove@2$NSGlyphInscribeBase@0$NSGlyphInscribeBelow@1$NSGlyphInscribeOverBelow@4$NSGlyphInscribeOverstrike@3$NSGlyphPropertyControlCharacter@2$NSGlyphPropertyElastic@4$NSGlyphPropertyNonBaseCharacter@8$NSGlyphPropertyNull@1$NSGradientConcaveStrong@2$NSGradientConcaveWeak@1$NSGradientConvexStrong@4$NSGradientConvexWeak@3$NSGradientDrawsAfterEndingLocation@2$NSGradientDrawsBeforeStartingLocation@1$NSGradientNone@0$NSGraphiteControlTint@6$NSGrayColorSpaceModel@0$NSGrayModeColorPanel@0$NSGridCellPlacementBottom@3$NSGridCellPlacementCenter@4$NSGridCellPlacementFill@5$NSGridCellPlacementInherited@0$NSGridCellPlacementLeading@2$NSGridCellPlacementNone@1$NSGridCellPlacementTop@2$NSGridCellPlacementTrailing@3$NSGridRowAlignmentFirstBaseline@2$NSGridRowAlignmentInherited@0$NSGridRowAlignmentLastBaseline@3$NSGridRowAlignmentNone@1$NSGrooveBorder@3$NSHSBModeColorPanel@3$NSHUDWindowMask@8192$NSHapticFeedbackPatternAlignment@1$NSHapticFeedbackPatternGeneric@0$NSHapticFeedbackPatternLevelChange@2$NSHapticFeedbackPerformanceTimeDefault@0$NSHapticFeedbackPerformanceTimeDrawCompleted@2$NSHapticFeedbackPerformanceTimeNow@1$NSHeavierFontAction@5$NSHelpButtonBezelStyle@9$NSHelpFunctionKey@63302$NSHelpKeyMask@4194304$NSHighlightModeMatrix@1$NSHomeFunctionKey@63273$NSHorizontalRuler@0$NSHourMinuteDatePickerElementFlag@12$NSHourMinuteSecondDatePickerElementFlag@14$NSIdentityMappingCharacterCollection@0$NSIllegalTextMovement@0$NSImageAbove@5$NSImageAlignBottom@5$NSImageAlignBottomLeft@6$NSImageAlignBottomRight@7$NSImageAlignCenter@0$NSImageAlignLeft@4$NSImageAlignRight@8$NSImageAlignTop@1$NSImageAlignTopLeft@2$NSImageAlignTopRight@3$NSImageBelow@4$NSImageCacheAlways@1$NSImageCacheBySize@2$NSImageCacheDefault@0$NSImageCacheNever@3$NSImageCellType@2$NSImageDynamicRangeConstrainedHigh@1$NSImageDynamicRangeHigh@2$NSImageDynamicRangeStandard@0$NSImageDynamicRangeUnspecified@-1$NSImageFrameButton@4$NSImageFrameGrayBezel@2$NSImageFrameGroove@3$NSImageFrameNone@0$NSImageFramePhoto@1$NSImageInterpolationDefault@0$NSImageInterpolationHigh@3$NSImageInterpolationLow@2$NSImageInterpolationMedium@4$NSImageInterpolationNone@1$NSImageLayoutDirectionLeftToRight@2$NSImageLayoutDirectionRightToLeft@3$NSImageLayoutDirectionUnspecified@-1$NSImageLeading@7$NSImageLeft@2$NSImageLoadStatusCancelled@1$NSImageLoadStatusCompleted@0$NSImageLoadStatusInvalidData@2$NSImageLoadStatusReadError@4$NSImageLoadStatusUnexpectedEOF@3$NSImageOnly@1$NSImageOverlaps@6$NSImageRepLoadStatusCompleted@-6$NSImageRepLoadStatusInvalidData@-4$NSImageRepLoadStatusReadingHeader@-2$NSImageRepLoadStatusUnexpectedEOF@-5$NSImageRepLoadStatusUnknownType@-1$NSImageRepLoadStatusWillNeedAllData@-3$NSImageRepMatchesDevice@0$NSImageRight@3$NSImageScaleAxesIndependently@1$NSImageScaleNone@2$NSImageScaleProportionallyDown@0$NSImageScaleProportionallyUpOrDown@3$NSImageSymbolScaleLarge@3$NSImageSymbolScaleMedium@2$NSImageSymbolScaleSmall@1$NSImageTrailing@8$NSIndexedColorSpaceModel@5$NSInformationalAlertStyle@1$NSInformationalRequest@10$NSInlineBezelStyle@15$NSInsertCharFunctionKey@63293$NSInsertFunctionKey@63271$NSInsertLineFunctionKey@63291$NSIntType@1$NSItalicFontMask@1$NSJPEG2000FileType@5$NSJPEGFileType@3$NSJustifiedTextAlignment@3$NSKeyDown@10$NSKeyDownMask@1024$NSKeyUp@11$NSKeyUpMask@2048$NSLABColorSpaceModel@3$NSLAYOUTANCHOR_H@1$NSLAYOUTCONSTRAINT_H@1$NSLandscapeOrientation@1$NSLayoutAttributeBaseline@11$NSLayoutAttributeBottom@4$NSLayoutAttributeCenterX@9$NSLayoutAttributeCenterY@10$NSLayoutAttributeFirstBaseline@12$NSLayoutAttributeHeight@8$NSLayoutAttributeLastBaseline@11$NSLayoutAttributeLeading@5$NSLayoutAttributeLeft@1$NSLayoutAttributeNotAnAttribute@0$NSLayoutAttributeRight@2$NSLayoutAttributeTop@3$NSLayoutAttributeTrailing@6$NSLayoutAttributeWidth@7$NSLayoutConstraintOrientationHorizontal@0$NSLayoutConstraintOrientationVertical@1$NSLayoutFormatAlignAllBaseline@2048$NSLayoutFormatAlignAllBottom@16$NSLayoutFormatAlignAllCenterX@512$NSLayoutFormatAlignAllCenterY@1024$NSLayoutFormatAlignAllFirstBaseline@4096$NSLayoutFormatAlignAllLastBaseline@2048$NSLayoutFormatAlignAllLeading@32$NSLayoutFormatAlignAllLeft@2$NSLayoutFormatAlignAllRight@4$NSLayoutFormatAlignAllTop@8$NSLayoutFormatAlignAllTrailing@64$NSLayoutFormatAlignmentMask@65535$NSLayoutFormatDirectionLeadingToTrailing@0$NSLayoutFormatDirectionLeftToRight@65536$NSLayoutFormatDirectionMask@196608$NSLayoutFormatDirectionRightToLeft@131072$NSLayoutPriorityDefaultHigh@750$NSLayoutPriorityDefaultLow@250$NSLayoutPriorityDragThatCanResizeWindow@510$NSLayoutPriorityDragThatCannotResizeWindow@490$NSLayoutPriorityFittingSizeCompression@50$NSLayoutPriorityRequired@1000$NSLayoutPriorityWindowSizeStayPut@500$NSLayoutRelationEqual@0$NSLayoutRelationGreaterThanOrEqual@1$NSLayoutRelationLessThanOrEqual@-1$NSLeftArrowFunctionKey@63234$NSLeftMouseDown@1$NSLeftMouseDownMask@2$NSLeftMouseDragged@6$NSLeftMouseDraggedMask@64$NSLeftMouseUp@2$NSLeftMouseUpMask@4$NSLeftTabStopType@0$NSLeftTabsBezelBorder@1$NSLeftTextAlignment@0$NSLeftTextMovement@19$NSLevelIndicatorPlaceholderVisibilityAlways@1$NSLevelIndicatorPlaceholderVisibilityAutomatic@0$NSLevelIndicatorPlaceholderVisibilityWhileEditing@2$NSLevelIndicatorStyleContinuousCapacity@1$NSLevelIndicatorStyleDiscreteCapacity@2$NSLevelIndicatorStyleRating@3$NSLevelIndicatorStyleRelevancy@0$NSLighterFontAction@6$NSLineBorder@1$NSLineBreakByCharWrapping@1$NSLineBreakByClipping@2$NSLineBreakByTruncatingHead@3$NSLineBreakByTruncatingMiddle@5$NSLineBreakByTruncatingTail@4$NSLineBreakByWordWrapping@0$NSLineBreakStrategyHangulWordPriority@2$NSLineBreakStrategyNone@0$NSLineBreakStrategyPushOut@1$NSLineBreakStrategyStandard@65535$NSLineCapStyleButt@0$NSLineCapStyleRound@1$NSLineCapStyleSquare@2$NSLineDoesntMove@0$NSLineJoinStyleBevel@2$NSLineJoinStyleMiter@0$NSLineJoinStyleRound@1$NSLineMovesDown@3$NSLineMovesLeft@1$NSLineMovesRight@2$NSLineMovesUp@4$NSLineSeparatorCharacter@8232$NSLineSweepDown@2$NSLineSweepLeft@0$NSLineSweepRight@1$NSLineSweepUp@3$NSLineToBezierPathElement@1$NSLinearSlider@0$NSListModeMatrix@2$NSMacintoshInterfaceStyle@3$NSMainMenuWindowLevel@24$NSMediaLibraryAudio@1$NSMediaLibraryImage@2$NSMediaLibraryMovie@4$NSMenuFunctionKey@63285$NSMenuItemBadgeTypeAlerts@3$NSMenuItemBadgeTypeNewItems@2$NSMenuItemBadgeTypeNone@0$NSMenuItemBadgeTypeUpdates@1$NSMenuPresentationStylePalette@1$NSMenuPresentationStyleRegular@0$NSMenuPropertyItemAccessibilityDescription@32$NSMenuPropertyItemAttributedTitle@2$NSMenuPropertyItemEnabled@16$NSMenuPropertyItemImage@8$NSMenuPropertyItemKeyEquivalent@4$NSMenuPropertyItemTitle@1$NSMenuSelectionModeAutomatic@0$NSMenuSelectionModeSelectAny@2$NSMenuSelectionModeSelectOne@1$NSMiniControlSize@2$NSMiniaturizableWindowMask@4$NSMiterLineJoinStyle@0$NSMixedState@-1$NSModalPanelWindowLevel@8$NSModalResponseAbort@-1001$NSModalResponseCancel@0$NSModalResponseContinue@-1002$NSModalResponseOK@1$NSModalResponseStop@-1000$NSModeSwitchFunctionKey@63303$NSMomentaryChangeButton@5$NSMomentaryLight@7$NSMomentaryLightButton@0$NSMomentaryPushButton@0$NSMomentaryPushInButton@7$NSMouseEntered@8$NSMouseEnteredMask@256$NSMouseEventSubtype@0$NSMouseExited@9$NSMouseExitedMask@512$NSMouseMoved@5$NSMouseMovedMask@32$NSMoveToBezierPathElement@0$NSMultiLevelAcceleratorButton@9$NSNarrowFontMask@16$NSNativeShortGlyphPacking@5$NSNaturalTextAlignment@4$NSNewlineCharacter@10$NSNextFunctionKey@63296$NSNextStepInterfaceStyle@1$NSNoBorder@0$NSNoCellMask@0$NSNoFontChangeAction@0$NSNoImage@0$NSNoInterfaceStyle@0$NSNoModeColorPanel@-1$NSNoScrollerParts@0$NSNoTabsBezelBorder@4$NSNoTabsLineBorder@5$NSNoTabsNoBorder@6$NSNoTitle@0$NSNoUnderlineStyle@0$NSNonStandardCharacterSetFontMask@8$NSNonZeroWindingRule@0$NSNonactivatingPanelMask@128$NSNormalWindowLevel@0$NSNullCellType@0$NSNullGlyph@0$NSNumericPadKeyMask@2097152$NSOKButton@1$NSOPENGL_CURRENT_VERSION@1$NSOffState@0$NSOnOffButton@6$NSOnState@1$NSOnlyScrollerArrows@1$NSOpenGLCPCurrentRendererID@309$NSOpenGLCPGPUFragmentProcessing@311$NSOpenGLCPGPUVertexProcessing@310$NSOpenGLCPHasDrawable@314$NSOpenGLCPMPSwapsInFlight@315$NSOpenGLCPRasterizationEnable@221$NSOpenGLCPReclaimResources@308$NSOpenGLCPStateValidation@301$NSOpenGLCPSurfaceBackingSize@304$NSOpenGLCPSurfaceOpacity@236$NSOpenGLCPSurfaceOrder@235$NSOpenGLCPSurfaceSurfaceVolatile@306$NSOpenGLCPSwapInterval@222$NSOpenGLCPSwapRectangle@200$NSOpenGLCPSwapRectangleEnable@201$NSOpenGLContextParameterCurrentRendererID@309$NSOpenGLContextParameterGPUFragmentProcessing@311$NSOpenGLContextParameterGPUVertexProcessing@310$NSOpenGLContextParameterHasDrawable@314$NSOpenGLContextParameterMPSwapsInFlight@315$NSOpenGLContextParameterRasterizationEnable@221$NSOpenGLContextParameterReclaimResources@308$NSOpenGLContextParameterStateValidation@301$NSOpenGLContextParameterSurfaceBackingSize@304$NSOpenGLContextParameterSurfaceOpacity@236$NSOpenGLContextParameterSurfaceOrder@235$NSOpenGLContextParameterSurfaceSurfaceVolatile@306$NSOpenGLContextParameterSwapInterval@222$NSOpenGLContextParameterSwapRectangle@200$NSOpenGLContextParameterSwapRectangleEnable@201$NSOpenGLGOClearFormatCache@502$NSOpenGLGOFormatCacheSize@501$NSOpenGLGOResetLibrary@504$NSOpenGLGORetainRenderers@503$NSOpenGLGOUseBuildCache@506$NSOpenGLPFAAccelerated@73$NSOpenGLPFAAcceleratedCompute@97$NSOpenGLPFAAccumSize@14$NSOpenGLPFAAllRenderers@1$NSOpenGLPFAAllowOfflineRenderers@96$NSOpenGLPFAAlphaSize@11$NSOpenGLPFAAuxBuffers@7$NSOpenGLPFAAuxDepthStencil@57$NSOpenGLPFABackingStore@76$NSOpenGLPFAClosestPolicy@74$NSOpenGLPFAColorFloat@58$NSOpenGLPFAColorSize@8$NSOpenGLPFACompliant@83$NSOpenGLPFADepthSize@12$NSOpenGLPFADoubleBuffer@5$NSOpenGLPFAFullScreen@54$NSOpenGLPFAMPSafe@78$NSOpenGLPFAMaximumPolicy@52$NSOpenGLPFAMinimumPolicy@51$NSOpenGLPFAMultiScreen@81$NSOpenGLPFAMultisample@59$NSOpenGLPFANoRecovery@72$NSOpenGLPFAOffScreen@53$NSOpenGLPFAOpenGLProfile@99$NSOpenGLPFAPixelBuffer@90$NSOpenGLPFARemotePixelBuffer@91$NSOpenGLPFARendererID@70$NSOpenGLPFARobust@75$NSOpenGLPFASampleAlpha@61$NSOpenGLPFASampleBuffers@55$NSOpenGLPFASamples@56$NSOpenGLPFAScreenMask@84$NSOpenGLPFASingleRenderer@71$NSOpenGLPFAStencilSize@13$NSOpenGLPFAStereo@6$NSOpenGLPFASupersample@60$NSOpenGLPFATripleBuffer@3$NSOpenGLPFAVirtualScreenCount@128$NSOpenGLPFAWindow@80$NSOpenGLProfileVersion3_2Core@12800$NSOpenGLProfileVersion4_1Core@16640$NSOpenGLProfileVersionLegacy@4096$NSOtherMouseDown@25$NSOtherMouseDownMask@33554432$NSOtherMouseDragged@27$NSOtherMouseDraggedMask@134217728$NSOtherMouseUp@26$NSOtherMouseUpMask@67108864$NSOtherTextMovement@0$NSOutlineViewDropOnItemIndex@-1$NSPDFPanelRequestsParentDirectory@16777216$NSPDFPanelShowsOrientation@8$NSPDFPanelShowsPaperSize@4$NSPNGFileType@4$NSPageControllerTransitionStyleHorizontalStrip@2$NSPageControllerTransitionStyleStackBook@1$NSPageControllerTransitionStyleStackHistory@0$NSPageDownFunctionKey@63277$NSPageLayoutResultCancelled@0$NSPageLayoutResultChanged@1$NSPageUpFunctionKey@63276$NSPaperOrientationLandscape@1$NSPaperOrientationPortrait@0$NSParagraphSeparatorCharacter@8233$NSPasteboardContentsCurrentHostOnly@1$NSPasteboardReadingAsData@0$NSPasteboardReadingAsKeyedArchive@4$NSPasteboardReadingAsPropertyList@2$NSPasteboardReadingAsString@1$NSPasteboardWritingPromised@512$NSPathStyleNavigationBar@1$NSPathStylePopUp@2$NSPathStyleStandard@0$NSPatternColorSpaceModel@6$NSPauseFunctionKey@63280$NSPenLowerSideMask@2$NSPenPointingDevice@1$NSPenTipMask@1$NSPenUpperSideMask@4$NSPeriodic@16$NSPeriodicMask@65536$NSPickerTouchBarItemControlRepresentationAutomatic@0$NSPickerTouchBarItemControlRepresentationCollapsed@2$NSPickerTouchBarItemControlRepresentationExpanded@1$NSPickerTouchBarItemSelectionModeMomentary@2$NSPickerTouchBarItemSelectionModeSelectAny@1$NSPickerTouchBarItemSelectionModeSelectOne@0$NSPlainTextTokenStyle@1$NSPointingDeviceTypeCursor@2$NSPointingDeviceTypeEraser@3$NSPointingDeviceTypePen@1$NSPointingDeviceTypeUnknown@0$NSPopUpArrowAtBottom@2$NSPopUpArrowAtCenter@1$NSPopUpMenuWindowLevel@101$NSPopUpNoArrow@0$NSPopoverAppearanceHUD@1$NSPopoverAppearanceMinimal@0$NSPopoverBehaviorApplicationDefined@0$NSPopoverBehaviorSemitransient@2$NSPopoverBehaviorTransient@1$NSPortraitOrientation@0$NSPositiveDoubleType@7$NSPositiveFloatType@4$NSPositiveIntType@2$NSPosterFontMask@256$NSPowerOffEventType@1$NSPressedTab@2$NSPressureBehaviorPrimaryAccelerator@3$NSPressureBehaviorPrimaryClick@1$NSPressureBehaviorPrimaryDeepClick@5$NSPressureBehaviorPrimaryDeepDrag@6$NSPressureBehaviorPrimaryDefault@0$NSPressureBehaviorPrimaryGeneric@2$NSPressureBehaviorUnknown@-1$NSPrevFunctionKey@63295$NSPrintFunctionKey@63288$NSPrintPanelResultCancelled@0$NSPrintPanelResultPrinted@1$NSPrintPanelShowsCopies@1$NSPrintPanelShowsOrientation@8$NSPrintPanelShowsPageRange@2$NSPrintPanelShowsPageSetupAccessory@256$NSPrintPanelShowsPaperSize@4$NSPrintPanelShowsPreview@131072$NSPrintPanelShowsPrintSelection@32$NSPrintPanelShowsScaling@16$NSPrintRenderingQualityBest@0$NSPrintRenderingQualityResponsive@1$NSPrintScreenFunctionKey@63278$NSPrinterTableError@2$NSPrinterTableNotFound@1$NSPrinterTableOK@0$NSPrintingCancelled@0$NSPrintingFailure@3$NSPrintingPaginationModeAutomatic@0$NSPrintingPaginationModeClip@2$NSPrintingPaginationModeFit@1$NSPrintingReplyLater@2$NSPrintingSuccess@1$NSProgressIndicatorBarStyle@0$NSProgressIndicatorPreferredAquaThickness@12$NSProgressIndicatorPreferredLargeThickness@18$NSProgressIndicatorPreferredSmallThickness@10$NSProgressIndicatorPreferredThickness@14$NSProgressIndicatorSpinningStyle@1$NSProgressIndicatorStyleBar@0$NSProgressIndicatorStyleSpinning@1$NSPushInCell@2$NSPushInCellMask@2$NSPushOnPushOffButton@1$NSRGBColorSpaceModel@1$NSRGBModeColorPanel@1$NSRadioButton@4$NSRadioModeMatrix@0$NSRangeDateMode@1$NSRatingLevelIndicatorStyle@3$NSRecessedBezelStyle@13$NSRectAlignmentBottom@5$NSRectAlignmentBottomLeading@4$NSRectAlignmentBottomTrailing@6$NSRectAlignmentLeading@3$NSRectAlignmentNone@0$NSRectAlignmentTop@1$NSRectAlignmentTopLeading@2$NSRectAlignmentTopTrailing@8$NSRectAlignmentTrailing@7$NSRedoFunctionKey@63300$NSRegularControlSize@0$NSRegularSquareBezelStyle@2$NSRelevancyLevelIndicatorStyle@0$NSRemoteNotificationTypeAlert@4$NSRemoteNotificationTypeBadge@1$NSRemoteNotificationTypeNone@0$NSRemoteNotificationTypeSound@2$NSRemoveTraitFontAction@7$NSResetCursorRectsRunLoopOrdering@700000$NSResetFunctionKey@63283$NSResizableWindowMask@8$NSReturnTextMovement@16$NSRightArrowFunctionKey@63235$NSRightMouseDown@3$NSRightMouseDownMask@8$NSRightMouseDragged@7$NSRightMouseDraggedMask@128$NSRightMouseUp@4$NSRightMouseUpMask@16$NSRightTabStopType@1$NSRightTabsBezelBorder@3$NSRightTextMovement@20$NSRoundLineCapStyle@1$NSRoundLineJoinStyle@1$NSRoundRectBezelStyle@12$NSRoundedBezelStyle@1$NSRoundedDisclosureBezelStyle@14$NSRoundedTokenStyle@2$NSRuleEditorNestingModeCompound@2$NSRuleEditorNestingModeList@1$NSRuleEditorNestingModeSimple@3$NSRuleEditorNestingModeSingle@0$NSRuleEditorRowTypeCompound@1$NSRuleEditorRowTypeSimple@0$NSRunAbortedResponse@-1001$NSRunContinuesResponse@-1002$NSRunStoppedResponse@-1000$NSSaveAsOperation@1$NSSaveOperation@0$NSSaveToOperation@2$NSScaleNone@2$NSScaleProportionally@0$NSScaleToFit@1$NSScreenChangedEventType@8$NSScreenSaverWindowLevel@1000$NSScrollElasticityAllowed@2$NSScrollElasticityAutomatic@0$NSScrollElasticityNone@1$NSScrollLockFunctionKey@63279$NSScrollViewFindBarPositionAboveContent@1$NSScrollViewFindBarPositionAboveHorizontalRuler@0$NSScrollViewFindBarPositionBelowContent@2$NSScrollWheel@22$NSScrollWheelMask@4194304$NSScrollerArrowsDefaultSetting@0$NSScrollerArrowsMaxEnd@0$NSScrollerArrowsMinEnd@1$NSScrollerArrowsNone@2$NSScrollerDecrementArrow@1$NSScrollerDecrementLine@4$NSScrollerDecrementPage@1$NSScrollerIncrementArrow@0$NSScrollerIncrementLine@5$NSScrollerIncrementPage@3$NSScrollerKnob@2$NSScrollerKnobSlot@6$NSScrollerKnobStyleDark@1$NSScrollerKnobStyleDefault@0$NSScrollerKnobStyleLight@2$NSScrollerNoPart@0$NSScrollerStyleLegacy@0$NSScrollerStyleOverlay@1$NSScrubberAlignmentCenter@3$NSScrubberAlignmentLeading@1$NSScrubberAlignmentNone@0$NSScrubberAlignmentTrailing@2$NSScrubberModeFixed@0$NSScrubberModeFree@1$NSSearchFieldClearRecentsMenuItemTag@1002$NSSearchFieldNoRecentsMenuItemTag@1003$NSSearchFieldRecentsMenuItemTag@1001$NSSearchFieldRecentsTitleMenuItemTag@1000$NSSegmentDistributionFill@1$NSSegmentDistributionFillEqually@2$NSSegmentDistributionFillProportionally@3$NSSegmentDistributionFit@0$NSSegmentStyleAutomatic@0$NSSegmentStyleCapsule@5$NSSegmentStyleRoundRect@3$NSSegmentStyleRounded@1$NSSegmentStyleSeparated@8$NSSegmentStyleSmallSquare@6$NSSegmentStyleTexturedRounded@2$NSSegmentStyleTexturedSquare@4$NSSegmentSwitchTrackingMomentary@2$NSSegmentSwitchTrackingMomentaryAccelerator@3$NSSegmentSwitchTrackingSelectAny@1$NSSegmentSwitchTrackingSelectOne@0$NSSelectByCharacter@0$NSSelectByParagraph@2$NSSelectByWord@1$NSSelectFunctionKey@63297$NSSelectedTab@0$NSSelectingNext@1$NSSelectingPrevious@2$NSSelectionAffinityDownstream@1$NSSelectionAffinityUpstream@0$NSServiceApplicationLaunchFailedError@66561$NSServiceApplicationNotFoundError@66560$NSServiceErrorMaximum@66817$NSServiceErrorMinimum@66560$NSServiceInvalidPasteboardDataError@66563$NSServiceMalformedServiceDictionaryError@66564$NSServiceMiscellaneousError@66800$NSServiceRequestTimedOutError@66562$NSShadowlessSquareBezelStyle@6$NSSharingContentScopeFull@2$NSSharingContentScopeItem@0$NSSharingContentScopePartial@1$NSSharingServiceErrorMaximum@67327$NSSharingServiceErrorMinimum@67072$NSSharingServiceNotConfiguredError@67072$NSShiftKeyMask@131072$NSShowControlGlyphs@1$NSShowInvisibleGlyphs@2$NSSingleDateMode@0$NSSingleUnderlineStyle@1$NSSizeDownFontAction@4$NSSizeUpFontAction@3$NSSliderTypeCircular@1$NSSliderTypeLinear@0$NSSmallCapsFontMask@128$NSSmallControlSize@1$NSSmallIconButtonBezelStyle@2$NSSmallSquareBezelStyle@10$NSSpecialPageOrder@0$NSSpeechImmediateBoundary@0$NSSpeechSentenceBoundary@2$NSSpeechWordBoundary@1$NSSpellingStateGrammarFlag@2$NSSpellingStateSpellingFlag@1$NSSplitViewDividerStylePaneSplitter@3$NSSplitViewDividerStyleThick@1$NSSplitViewDividerStyleThin@2$NSSplitViewItemBehaviorContentList@2$NSSplitViewItemBehaviorDefault@0$NSSplitViewItemBehaviorInspector@3$NSSplitViewItemBehaviorSidebar@1$NSSplitViewItemCollapseBehaviorDefault@0$NSSplitViewItemCollapseBehaviorPreferResizingSiblingsWithFixedSplitView@2$NSSplitViewItemCollapseBehaviorPreferResizingSplitViewWithFixedSiblings@1$NSSplitViewItemCollapseBehaviorUseConstraints@3$NSSpringLoadingContinuousActivation@2$NSSpringLoadingDisabled@0$NSSpringLoadingEnabled@1$NSSpringLoadingHighlightEmphasized@2$NSSpringLoadingHighlightNone@0$NSSpringLoadingHighlightStandard@1$NSSpringLoadingNoHover@4$NSSquareLineCapStyle@2$NSSquareStatusItemLength@-2$NSStackViewDistributionEqualCentering@4$NSStackViewDistributionEqualSpacing@3$NSStackViewDistributionFill@0$NSStackViewDistributionFillEqually@1$NSStackViewDistributionFillProportionally@2$NSStackViewDistributionGravityAreas@-1$NSStackViewGravityBottom@3$NSStackViewGravityCenter@2$NSStackViewGravityLeading@1$NSStackViewGravityTop@1$NSStackViewGravityTrailing@3$NSStackViewVisibilityPriorityDetachOnlyIfNecessary@900$NSStackViewVisibilityPriorityMustHold@1000$NSStackViewVisibilityPriorityNotVisible@0$NSStatusItemBehaviorRemovalAllowed@2$NSStatusItemBehaviorTerminationOnRemoval@4$NSStatusWindowLevel@25$NSStopFunctionKey@63284$NSStringDrawingDisableScreenFontSubstitution@4$NSStringDrawingOneShot@16$NSStringDrawingTruncatesLastVisibleLine@32$NSStringDrawingUsesDeviceMetrics@8$NSStringDrawingUsesFontLeading@2$NSStringDrawingUsesLineFragmentOrigin@1$NSSubmenuWindowLevel@3$NSSwitchButton@3$NSSysReqFunctionKey@63281$NSSystemDefined@14$NSSystemDefinedMask@16384$NSSystemFunctionKey@63287$NSTIFFCompressionCCITTFAX3@3$NSTIFFCompressionCCITTFAX4@4$NSTIFFCompressionJPEG@6$NSTIFFCompressionLZW@5$NSTIFFCompressionNEXT@32766$NSTIFFCompressionNone@1$NSTIFFCompressionOldJPEG@32865$NSTIFFCompressionPackBits@32773$NSTIFFFileType@0$NSTabCharacter@9$NSTabPositionBottom@3$NSTabPositionLeft@2$NSTabPositionNone@0$NSTabPositionRight@4$NSTabPositionTop@1$NSTabTextMovement@17$NSTabViewBorderTypeBezel@2$NSTabViewBorderTypeLine@1$NSTabViewBorderTypeNone@0$NSTabViewControllerTabStyleSegmentedControlOnBottom@1$NSTabViewControllerTabStyleSegmentedControlOnTop@0$NSTabViewControllerTabStyleToolbar@2$NSTabViewControllerTabStyleUnspecified@-1$NSTableColumnAutoresizingMask@1$NSTableColumnNoResizing@0$NSTableColumnUserResizingMask@2$NSTableRowActionEdgeLeading@0$NSTableRowActionEdgeTrailing@1$NSTableViewAnimationEffectFade@1$NSTableViewAnimationEffectGap@2$NSTableViewAnimationEffectNone@0$NSTableViewAnimationSlideDown@32$NSTableViewAnimationSlideLeft@48$NSTableViewAnimationSlideRight@64$NSTableViewAnimationSlideUp@16$NSTableViewDashedHorizontalGridLineMask@8$NSTableViewDraggingDestinationFeedbackStyleGap@2$NSTableViewDraggingDestinationFeedbackStyleNone@-1$NSTableViewDraggingDestinationFeedbackStyleRegular@0$NSTableViewDraggingDestinationFeedbackStyleSourceList@1$NSTableViewDropAbove@1$NSTableViewDropOn@0$NSTableViewFirstColumnOnlyAutoresizingStyle@5$NSTableViewGridNone@0$NSTableViewLastColumnOnlyAutoresizingStyle@4$NSTableViewNoColumnAutoresizing@0$NSTableViewReverseSequentialColumnAutoresizingStyle@3$NSTableViewRowActionStyleDestructive@1$NSTableViewRowActionStyleRegular@0$NSTableViewRowSizeStyleCustom@0$NSTableViewRowSizeStyleDefault@-1$NSTableViewRowSizeStyleLarge@3$NSTableViewRowSizeStyleMedium@2$NSTableViewRowSizeStyleSmall@1$NSTableViewSelectionHighlightStyleNone@-1$NSTableViewSelectionHighlightStyleRegular@0$NSTableViewSelectionHighlightStyleSourceList@1$NSTableViewSequentialColumnAutoresizingStyle@2$NSTableViewSolidHorizontalGridLineMask@2$NSTableViewSolidVerticalGridLineMask@1$NSTableViewStyleAutomatic@0$NSTableViewStyleFullWidth@1$NSTableViewStyleInset@2$NSTableViewStylePlain@4$NSTableViewStyleSourceList@3$NSTableViewUniformColumnAutoresizingStyle@1$NSTabletPoint@23$NSTabletPointEventSubtype@1$NSTabletPointMask@8388608$NSTabletProximity@24$NSTabletProximityEventSubtype@2$NSTabletProximityMask@16777216$NSTerminateCancel@0$NSTerminateLater@2$NSTerminateNow@1$NSTextAlignmentJustified@3$NSTextAlignmentLeft@0$NSTextAlignmentNatural@4$NSTextBlockAbsoluteValueType@0$NSTextBlockBaselineAlignment@3$NSTextBlockBorder@0$NSTextBlockBottomAlignment@2$NSTextBlockHeight@4$NSTextBlockMargin@1$NSTextBlockMaximumHeight@6$NSTextBlockMaximumWidth@2$NSTextBlockMiddleAlignment@1$NSTextBlockMinimumHeight@5$NSTextBlockMinimumWidth@1$NSTextBlockPadding@-1$NSTextBlockPercentageValueType@1$NSTextBlockTopAlignment@0$NSTextBlockWidth@0$NSTextCellType@1$NSTextContentManagerEnumerationOptionsNone@0$NSTextContentManagerEnumerationOptionsReverse@1$NSTextCursorAccessoryPlacementBackward@1$NSTextCursorAccessoryPlacementCenter@4$NSTextCursorAccessoryPlacementForward@2$NSTextCursorAccessoryPlacementInvisible@3$NSTextCursorAccessoryPlacementOffscreenBottom@8$NSTextCursorAccessoryPlacementOffscreenLeft@5$NSTextCursorAccessoryPlacementOffscreenRight@7$NSTextCursorAccessoryPlacementOffscreenTop@6$NSTextCursorAccessoryPlacementUnspecified@0$NSTextElementProviderEnumerationOptionsNone@0$NSTextElementProviderEnumerationOptionsReverse@1$NSTextFieldAndStepperDatePickerStyle@0$NSTextFieldDatePickerStyle@2$NSTextFieldRoundedBezel@1$NSTextFieldSquareBezel@0$NSTextFinderActionHideFindInterface@11$NSTextFinderActionHideReplaceInterface@13$NSTextFinderActionNextMatch@2$NSTextFinderActionPreviousMatch@3$NSTextFinderActionReplace@5$NSTextFinderActionReplaceAll@4$NSTextFinderActionReplaceAllInSelection@8$NSTextFinderActionReplaceAndFind@6$NSTextFinderActionSelectAll@9$NSTextFinderActionSelectAllInSelection@10$NSTextFinderActionSetSearchString@7$NSTextFinderActionShowFindInterface@1$NSTextFinderActionShowReplaceInterface@12$NSTextFinderMatchingTypeContains@0$NSTextFinderMatchingTypeEndsWith@3$NSTextFinderMatchingTypeFullWord@2$NSTextFinderMatchingTypeStartsWith@1$NSTextInputTraitTypeDefault@0$NSTextInputTraitTypeNo@1$NSTextInputTraitTypeYes@2$NSTextInsertionIndicatorAutomaticModeOptionsShowEffectsView@1$NSTextInsertionIndicatorAutomaticModeOptionsShowWhileTracking@2$NSTextInsertionIndicatorDisplayModeAutomatic@0$NSTextInsertionIndicatorDisplayModeHidden@1$NSTextInsertionIndicatorDisplayModeVisible@2$NSTextLayoutFragmentEnumerationOptionsEnsuresExtraLineFragment@8$NSTextLayoutFragmentEnumerationOptionsEnsuresLayout@4$NSTextLayoutFragmentEnumerationOptionsEstimatesSize@2$NSTextLayoutFragmentEnumerationOptionsNone@0$NSTextLayoutFragmentEnumerationOptionsReverse@1$NSTextLayoutFragmentStateCalculatedUsageBounds@2$NSTextLayoutFragmentStateEstimatedUsageBounds@1$NSTextLayoutFragmentStateLayoutAvailable@3$NSTextLayoutFragmentStateNone@0$NSTextLayoutManagerSegmentOptionsHeadSegmentExtended@4$NSTextLayoutManagerSegmentOptionsMiddleFragmentsExcluded@2$NSTextLayoutManagerSegmentOptionsNone@0$NSTextLayoutManagerSegmentOptionsRangeNotRequired@1$NSTextLayoutManagerSegmentOptionsTailSegmentExtended@8$NSTextLayoutManagerSegmentOptionsUpstreamAffinity@16$NSTextLayoutManagerSegmentTypeHighlight@2$NSTextLayoutManagerSegmentTypeSelection@1$NSTextLayoutManagerSegmentTypeStandard@0$NSTextLayoutOrientationHorizontal@0$NSTextLayoutOrientationVertical@1$NSTextListPrependEnclosingMarker@1$NSTextMovementBacktab@18$NSTextMovementCancel@23$NSTextMovementDown@22$NSTextMovementLeft@19$NSTextMovementOther@0$NSTextMovementReturn@16$NSTextMovementRight@20$NSTextMovementTab@17$NSTextMovementUp@21$NSTextReadInapplicableDocumentTypeError@65806$NSTextReadWriteErrorMaximum@66303$NSTextReadWriteErrorMinimum@65792$NSTextScalingStandard@0$NSTextScalingiOS@1$NSTextSelectionAffinityDownstream@1$NSTextSelectionAffinityUpstream@0$NSTextSelectionGranularityCharacter@0$NSTextSelectionGranularityLine@3$NSTextSelectionGranularityParagraph@2$NSTextSelectionGranularitySentence@4$NSTextSelectionGranularityWord@1$NSTextSelectionNavigationDestinationCharacter@0$NSTextSelectionNavigationDestinationContainer@5$NSTextSelectionNavigationDestinationDocument@6$NSTextSelectionNavigationDestinationLine@2$NSTextSelectionNavigationDestinationParagraph@4$NSTextSelectionNavigationDestinationSentence@3$NSTextSelectionNavigationDestinationWord@1$NSTextSelectionNavigationDirectionBackward@1$NSTextSelectionNavigationDirectionDown@5$NSTextSelectionNavigationDirectionForward@0$NSTextSelectionNavigationDirectionLeft@3$NSTextSelectionNavigationDirectionRight@2$NSTextSelectionNavigationDirectionUp@4$NSTextSelectionNavigationLayoutOrientationHorizontal@0$NSTextSelectionNavigationLayoutOrientationVertical@1$NSTextSelectionNavigationModifierExtend@1$NSTextSelectionNavigationModifierMultiple@4$NSTextSelectionNavigationModifierVisual@2$NSTextSelectionNavigationWritingDirectionLeftToRight@0$NSTextSelectionNavigationWritingDirectionRightToLeft@1$NSTextStorageEditedAttributes@1$NSTextStorageEditedCharacters@2$NSTextTableAutomaticLayoutAlgorithm@0$NSTextTableFixedLayoutAlgorithm@1$NSTextWriteInapplicableDocumentTypeError@66062$NSTextWritingDirectionEmbedding@0$NSTextWritingDirectionOverride@2$NSTexturedBackgroundWindowMask@256$NSTexturedRoundedBezelStyle@11$NSTexturedSquareBezelStyle@8$NSThickSquareBezelStyle@3$NSThickerSquareBezelStyle@4$NSTickMarkAbove@1$NSTickMarkBelow@0$NSTickMarkLeft@1$NSTickMarkPositionAbove@1$NSTickMarkPositionBelow@0$NSTickMarkPositionLeading@1$NSTickMarkPositionTrailing@0$NSTickMarkRight@0$NSTimeZoneDatePickerElementFlag@16$NSTitlebarSeparatorStyleAutomatic@0$NSTitlebarSeparatorStyleLine@2$NSTitlebarSeparatorStyleNone@1$NSTitlebarSeparatorStyleShadow@3$NSTitledWindowMask@1$NSToggleButton@2$NSTokenStyleDefault@0$NSTokenStyleNone@1$NSTokenStylePlainSquared@4$NSTokenStyleRounded@2$NSTokenStyleSquared@3$NSToolbarDisplayModeDefault@0$NSToolbarDisplayModeIconAndLabel@1$NSToolbarDisplayModeIconOnly@2$NSToolbarDisplayModeLabelOnly@3$NSToolbarItemGroupControlRepresentationAutomatic@0$NSToolbarItemGroupControlRepresentationCollapsed@2$NSToolbarItemGroupControlRepresentationExpanded@1$NSToolbarItemGroupSelectionModeMomentary@2$NSToolbarItemGroupSelectionModeSelectAny@1$NSToolbarItemGroupSelectionModeSelectOne@0$NSToolbarItemVisibilityPriorityHigh@1000$NSToolbarItemVisibilityPriorityLow@-1000$NSToolbarItemVisibilityPriorityStandard@0$NSToolbarItemVisibilityPriorityUser@2000$NSToolbarSizeModeDefault@0$NSToolbarSizeModeRegular@1$NSToolbarSizeModeSmall@2$NSTopTabsBezelBorder@0$NSTornOffMenuWindowLevel@3$NSTouchBarItemPriorityHigh@1000.0$NSTouchBarItemPriorityLow@-1000.0$NSTouchBarItemPriorityNormal@0.0$NSTouchEventSubtype@3$NSTouchPhaseAny@18446744073709551615$NSTouchPhaseBegan@1$NSTouchPhaseCancelled@16$NSTouchPhaseEnded@8$NSTouchPhaseMoved@2$NSTouchPhaseStationary@4$NSTouchPhaseTouching@7$NSTouchTypeDirect@0$NSTouchTypeIndirect@1$NSTouchTypeMaskDirect@1$NSTouchTypeMaskIndirect@2$NSTrackModeMatrix@3$NSTrackingActiveAlways@128$NSTrackingActiveInActiveApp@64$NSTrackingActiveInKeyWindow@32$NSTrackingActiveWhenFirstResponder@16$NSTrackingAssumeInside@256$NSTrackingCursorUpdate@4$NSTrackingEnabledDuringMouseDrag@1024$NSTrackingInVisibleRect@512$NSTrackingMouseEnteredAndExited@1$NSTrackingMouseMoved@2$NSTypesetterBehavior_10_2@2$NSTypesetterBehavior_10_2_WithCompatibility@1$NSTypesetterBehavior_10_3@3$NSTypesetterBehavior_10_4@4$NSTypesetterContainerBreakAction@32$NSTypesetterHorizontalTabAction@4$NSTypesetterLatestBehavior@-1$NSTypesetterLineBreakAction@8$NSTypesetterOriginalBehavior@0$NSTypesetterParagraphBreakAction@16$NSTypesetterWhitespaceAction@2$NSTypesetterZeroAdvancementAction@1$NSUnboldFontMask@4$NSUnderlinePatternDash@512$NSUnderlinePatternDashDot@768$NSUnderlinePatternDashDotDot@1024$NSUnderlinePatternDot@256$NSUnderlinePatternSolid@0$NSUnderlineStyleByWord@32768$NSUnderlineStyleDouble@9$NSUnderlineStyleNone@0$NSUnderlineStylePatternDash@512$NSUnderlineStylePatternDashDot@768$NSUnderlineStylePatternDashDotDot@1024$NSUnderlineStylePatternDot@256$NSUnderlineStylePatternSolid@0$NSUnderlineStyleSingle@1$NSUnderlineStyleThick@2$NSUndoFunctionKey@63299$NSUnifiedTitleAndToolbarWindowMask@4096$NSUnitalicFontMask@16777216$NSUnknownColorSpaceModel@-1$NSUnknownPageOrder@2$NSUnknownPointingDevice@0$NSUnscaledWindowMask@2048$NSUpArrowFunctionKey@63232$NSUpTextMovement@21$NSUpdateWindowsRunLoopOrdering@500000$NSUserFunctionKey@63286$NSUserInterfaceLayoutDirectionLeftToRight@0$NSUserInterfaceLayoutDirectionRightToLeft@1$NSUserInterfaceLayoutOrientationHorizontal@0$NSUserInterfaceLayoutOrientationVertical@1$NSUtilityWindowMask@16$NSVariableStatusItemLength@-1$NSVerticalRuler@1$NSViaPanelFontAction@1$NSViewControllerTransitionAllowUserInteraction@4096$NSViewControllerTransitionCrossfade@1$NSViewControllerTransitionNone@0$NSViewControllerTransitionSlideBackward@384$NSViewControllerTransitionSlideDown@32$NSViewControllerTransitionSlideForward@320$NSViewControllerTransitionSlideLeft@64$NSViewControllerTransitionSlideRight@128$NSViewControllerTransitionSlideUp@16$NSViewHeightSizable@16$NSViewLayerContentsPlacementBottom@8$NSViewLayerContentsPlacementBottomLeft@9$NSViewLayerContentsPlacementBottomRight@7$NSViewLayerContentsPlacementCenter@3$NSViewLayerContentsPlacementLeft@10$NSViewLayerContentsPlacementRight@6$NSViewLayerContentsPlacementScaleAxesIndependently@0$NSViewLayerContentsPlacementScaleProportionallyToFill@2$NSViewLayerContentsPlacementScaleProportionallyToFit@1$NSViewLayerContentsPlacementTop@4$NSViewLayerContentsPlacementTopLeft@11$NSViewLayerContentsPlacementTopRight@5$NSViewLayerContentsRedrawBeforeViewResize@3$NSViewLayerContentsRedrawCrossfade@4$NSViewLayerContentsRedrawDuringViewResize@2$NSViewLayerContentsRedrawNever@0$NSViewLayerContentsRedrawOnSetNeedsDisplay@1$NSViewMaxXMargin@4$NSViewMaxYMargin@32$NSViewMinXMargin@1$NSViewMinYMargin@8$NSViewNotSizable@0$NSViewWidthSizable@2$NSVisualEffectBlendingModeBehindWindow@0$NSVisualEffectBlendingModeWithinWindow@1$NSVisualEffectMaterialAppearanceBased@0$NSVisualEffectMaterialContentBackground@18$NSVisualEffectMaterialDark@2$NSVisualEffectMaterialFullScreenUI@15$NSVisualEffectMaterialHUDWindow@13$NSVisualEffectMaterialHeaderView@10$NSVisualEffectMaterialLight@1$NSVisualEffectMaterialMediumLight@8$NSVisualEffectMaterialMenu@5$NSVisualEffectMaterialPopover@6$NSVisualEffectMaterialSelection@4$NSVisualEffectMaterialSheet@11$NSVisualEffectMaterialSidebar@7$NSVisualEffectMaterialTitlebar@3$NSVisualEffectMaterialToolTip@17$NSVisualEffectMaterialUltraDark@9$NSVisualEffectMaterialUnderPageBackground@22$NSVisualEffectMaterialUnderWindowBackground@21$NSVisualEffectMaterialWindowBackground@12$NSVisualEffectStateActive@1$NSVisualEffectStateFollowsWindowActiveState@0$NSVisualEffectStateInactive@2$NSWantsBidiLevels@4$NSWarningAlertStyle@0$NSWheelModeColorPanel@6$NSWindingRuleEvenOdd@1$NSWindingRuleNonZero@0$NSWindowAbove@1$NSWindowAnimationBehaviorAlertPanel@5$NSWindowAnimationBehaviorDefault@0$NSWindowAnimationBehaviorDocumentWindow@3$NSWindowAnimationBehaviorNone@2$NSWindowAnimationBehaviorUtilityWindow@4$NSWindowBackingLocationDefault@0$NSWindowBackingLocationMainMemory@2$NSWindowBackingLocationVideoMemory@1$NSWindowBelow@-1$NSWindowCloseButton@0$NSWindowCollectionBehaviorAuxiliary@131072$NSWindowCollectionBehaviorCanJoinAllApplications@262144$NSWindowCollectionBehaviorCanJoinAllSpaces@1$NSWindowCollectionBehaviorDefault@0$NSWindowCollectionBehaviorFullScreenAllowsTiling@2048$NSWindowCollectionBehaviorFullScreenAuxiliary@256$NSWindowCollectionBehaviorFullScreenDisallowsTiling@4096$NSWindowCollectionBehaviorFullScreenNone@512$NSWindowCollectionBehaviorFullScreenPrimary@128$NSWindowCollectionBehaviorIgnoresCycle@64$NSWindowCollectionBehaviorManaged@4$NSWindowCollectionBehaviorMoveToActiveSpace@2$NSWindowCollectionBehaviorParticipatesInCycle@32$NSWindowCollectionBehaviorPrimary@65536$NSWindowCollectionBehaviorStationary@16$NSWindowCollectionBehaviorTransient@8$NSWindowDepthOnehundredtwentyeightBitRGB@544$NSWindowDepthSixtyfourBitRGB@528$NSWindowDepthTwentyfourBitRGB@520$NSWindowDocumentIconButton@4$NSWindowDocumentVersionsButton@6$NSWindowExposedEventType@0$NSWindowFullScreenButton@7$NSWindowListOrderedFrontToBack@1$NSWindowMiniaturizeButton@1$NSWindowMovedEventType@4$NSWindowNumberListAllApplications@1$NSWindowNumberListAllSpaces@16$NSWindowOcclusionStateVisible@2$NSWindowOut@0$NSWindowSharingErrorMaximum@67466$NSWindowSharingErrorMinimum@67456$NSWindowSharingNone@0$NSWindowSharingReadOnly@1$NSWindowSharingReadWrite@2$NSWindowSharingRequestAlreadyRequested@67456$NSWindowSharingRequestNoEligibleSession@67457$NSWindowSharingRequestUnspecifiedError@67458$NSWindowStyleMaskBorderless@0$NSWindowStyleMaskClosable@2$NSWindowStyleMaskDocModalWindow@64$NSWindowStyleMaskFullScreen@16384$NSWindowStyleMaskFullSizeContentView@32768$NSWindowStyleMaskHUDWindow@8192$NSWindowStyleMaskMiniaturizable@4$NSWindowStyleMaskNonactivatingPanel@128$NSWindowStyleMaskResizable@8$NSWindowStyleMaskTexturedBackground@256$NSWindowStyleMaskTitled@1$NSWindowStyleMaskUnifiedTitleAndToolbar@4096$NSWindowStyleMaskUtilityWindow@16$NSWindowTabbingModeAutomatic@0$NSWindowTabbingModeDisallowed@2$NSWindowTabbingModePreferred@1$NSWindowTitleHidden@1$NSWindowTitleVisible@0$NSWindowToolbarButton@3$NSWindowToolbarStyleAutomatic@0$NSWindowToolbarStyleExpanded@1$NSWindowToolbarStylePreference@2$NSWindowToolbarStyleUnified@3$NSWindowToolbarStyleUnifiedCompact@4$NSWindowUserTabbingPreferenceAlways@1$NSWindowUserTabbingPreferenceInFullScreen@2$NSWindowUserTabbingPreferenceManual@0$NSWindowZoomButton@2$NSWindows95InterfaceStyle@2$NSWorkspaceAuthorizationInvalidError@67328$NSWorkspaceAuthorizationTypeCreateSymbolicLink@0$NSWorkspaceAuthorizationTypeReplaceFile@2$NSWorkspaceAuthorizationTypeSetAttributes@1$NSWorkspaceErrorMaximum@67455$NSWorkspaceErrorMinimum@67328$NSWorkspaceLaunchAllowingClassicStartup@131072$NSWorkspaceLaunchAndHide@1048576$NSWorkspaceLaunchAndHideOthers@2097152$NSWorkspaceLaunchAndPrint@2$NSWorkspaceLaunchAsync@65536$NSWorkspaceLaunchDefault@65536$NSWorkspaceLaunchInhibitingBackgroundOnly@128$NSWorkspaceLaunchNewInstance@524288$NSWorkspaceLaunchPreferringClassic@262144$NSWorkspaceLaunchWithErrorPresentation@64$NSWorkspaceLaunchWithoutActivation@512$NSWorkspaceLaunchWithoutAddingToRecents@256$NSWritingDirectionEmbedding@0$NSWritingDirectionLeftToRight@0$NSWritingDirectionNatural@-1$NSWritingDirectionOverride@2$NSWritingDirectionRightToLeft@1$NSYearMonthDatePickerElementFlag@192$NSYearMonthDayDatePickerElementFlag@224$NS_USER_ACTIVITY_SUPPORTED@1$""" -misc.update( - { - "NSImageResizingModeStretch": selAorI(1, 0), - "NSTextAlignmentRight": selAorI(2, 1), - "NSTextAlignmentCenter": selAorI(1, 2), - "NSAttachmentCharacter": "\ufffc", - "NSImageResizingModeTile": selAorI(0, 1), - } -) -misc.update( - { - "NSLineBreakStrategy": NewType("NSLineBreakStrategy", int), - "NSTokenStyle": NewType("NSTokenStyle", int), - "NSTableViewDraggingDestinationFeedbackStyle": NewType( - "NSTableViewDraggingDestinationFeedbackStyle", int - ), - "NSWindowAnimationBehavior": NewType("NSWindowAnimationBehavior", int), - "NSWritingDirection": NewType("NSWritingDirection", int), - "NSPopoverAppearance": NewType("NSPopoverAppearance", int), - "NSWindowTitleVisibility": NewType("NSWindowTitleVisibility", int), - "NSGradientType": NewType("NSGradientType", int), - "NSMenuSelectionMode": NewType("NSMenuSelectionMode", int), - "NSBackingStoreType": NewType("NSBackingStoreType", int), - "NSCellAttribute": NewType("NSCellAttribute", int), - "NSTextFinderMatchingType": NewType("NSTextFinderMatchingType", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:164:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:164:1)", - int, - ), - "NSViewControllerTransitionOptions": NewType( - "NSViewControllerTransitionOptions", int - ), - "NSLayoutRelation": NewType("NSLayoutRelation", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFont.h:147:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFont.h:147:1)", - int, - ), - "NSImageFrameStyle": NewType("NSImageFrameStyle", int), - "NSFontAction": NewType("NSFontAction", int), - "NSScrollerKnobStyle": NewType("NSScrollerKnobStyle", int), - "NSGridRowAlignment": NewType("NSGridRowAlignment", int), - "NSLevelIndicatorStyle": NewType("NSLevelIndicatorStyle", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:206:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:206:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:553:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:553:1)", - int, - ), - "NSToolbarDisplayMode": NewType("NSToolbarDisplayMode", int), - "NSFocusRingType": NewType("NSFocusRingType", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:224:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:224:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:127:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:127:1)", - int, - ), - "NSSpeechBoundary": NewType("NSSpeechBoundary", int), - "NSFontRenderingMode": NewType("NSFontRenderingMode", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:50:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:50:1)", - int, - ), - "NSVisualEffectState": NewType("NSVisualEffectState", int), - "NSTableColumnResizingOptions": NewType("NSTableColumnResizingOptions", int), - "NSSpellingState": NewType("NSSpellingState", int), - "NSAccessibilityUnits": NewType("NSAccessibilityUnits", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:220:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:220:1)", - int, - ), - "NSTextLayoutFragmentEnumerationOptions": NewType( - "NSTextLayoutFragmentEnumerationOptions", int - ), - "NSEventSwipeTrackingOptions": NewType("NSEventSwipeTrackingOptions", int), - "NSFontPanelModeMask": NewType("NSFontPanelModeMask", int), - "NSCollectionViewScrollDirection": NewType( - "NSCollectionViewScrollDirection", int - ), - "NSLineMovementDirection": NewType("NSLineMovementDirection", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:82:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:82:1)", - int, - ), - "NSDisplayGamut": NewType("NSDisplayGamut", int), - "NSFindPanelAction": NewType("NSFindPanelAction", int), - "NSComboButtonStyle": NewType("NSComboButtonStyle", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:104:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:104:1)", - int, - ), - "NSPageControllerTransitionStyle": NewType( - "NSPageControllerTransitionStyle", int - ), - "NSTextSelectionNavigationDestination": NewType( - "NSTextSelectionNavigationDestination", int - ), - "NSPointingDeviceType": NewType("NSPointingDeviceType", int), - "NSScrubberMode": NewType("NSScrubberMode", int), - "NSCellType": NewType("NSCellType", int), - "NSTableViewRowActionStyle": NewType("NSTableViewRowActionStyle", int), - "NSEventGestureAxis": NewType("NSEventGestureAxis", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:104:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:104:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:553:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:553:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOutlineView.h:27:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOutlineView.h:27:1)", - int, - ), - "NSTableViewGridLineStyle": NewType("NSTableViewGridLineStyle", int), - "NSTabViewBorderType": NewType("NSTabViewBorderType", int), - "NSTextBlockVerticalAlignment": NewType("NSTextBlockVerticalAlignment", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSGlyphGenerator.h:18:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSGlyphGenerator.h:18:1)", - int, - ), - "NSTabPosition": NewType("NSTabPosition", int), - "NSImageLoadStatus": NewType("NSImageLoadStatus", int), - "NSTouchTypeMask": NewType("NSTouchTypeMask", int), - "NSWindowToolbarStyle": NewType("NSWindowToolbarStyle", int), - "NSEventButtonMask": NewType("NSEventButtonMask", int), - "NSGestureRecognizerState": NewType("NSGestureRecognizerState", int), - "NSAlertStyle": NewType("NSAlertStyle", int), - "NSLevelIndicatorPlaceholderVisibility": NewType( - "NSLevelIndicatorPlaceholderVisibility", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSGlyphGenerator.h:18:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSGlyphGenerator.h:18:1)", - int, - ), - "NSCellStyleMask": NewType("NSCellStyleMask", int), - "NSPathStyle": NewType("NSPathStyle", int), - "NSLineBreakMode": NewType("NSLineBreakMode", int), - "NSUsableScrollerParts": NewType("NSUsableScrollerParts", int), - "NSDraggingItemEnumerationOptions": NewType( - "NSDraggingItemEnumerationOptions", int - ), - "NSPageLayoutResult": NewType("NSPageLayoutResult", int), - "NSSplitViewItemCollapseBehavior": NewType( - "NSSplitViewItemCollapseBehavior", int - ), - "NSTitlebarSeparatorStyle": NewType("NSTitlebarSeparatorStyle", int), - "NSFontAssetRequestOptions": NewType("NSFontAssetRequestOptions", int), - "NSCollectionViewItemHighlightState": NewType( - "NSCollectionViewItemHighlightState", int - ), - "NSBitmapFormat": NewType("NSBitmapFormat", int), - "NSRuleEditorNestingMode": NewType("NSRuleEditorNestingMode", int), - "NSTextBlockLayer": NewType("NSTextBlockLayer", int), - "NSBoxType": NewType("NSBoxType", int), - "NSAnimationCurve": NewType("NSAnimationCurve", int), - "NSPickerTouchBarItemControlRepresentation": NewType( - "NSPickerTouchBarItemControlRepresentation", int - ), - "NSWindowNumberListOptions": NewType("NSWindowNumberListOptions", int), - "NSDraggingContext": NewType("NSDraggingContext", int), - "NSMatrixMode": NewType("NSMatrixMode", int), - "NSSelectionDirection": NewType("NSSelectionDirection", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOutlineView.h:27:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOutlineView.h:27:1)", - int, - ), - "NSColorRenderingIntent": NewType("NSColorRenderingIntent", int), - "NSImageLayoutDirection": NewType("NSImageLayoutDirection", int), - "NSApplicationOcclusionState": NewType("NSApplicationOcclusionState", int), - "NSWindowCollectionBehavior": NewType("NSWindowCollectionBehavior", int), - "NSControlCharacterAction": NewType("NSControlCharacterAction", int), - "NSSplitViewDividerStyle": NewType("NSSplitViewDividerStyle", int), - "NSTableViewStyle": NewType("NSTableViewStyle", int), - "NSTextLayoutManagerSegmentType": NewType( - "NSTextLayoutManagerSegmentType", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:361:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:361:1)", - int, - ), - "NSTextLayoutOrientation": NewType("NSTextLayoutOrientation", int), - "NSTextTabType": NewType("NSTextTabType", int), - "NSTableViewRowSizeStyle": NewType("NSTableViewRowSizeStyle", int), - "NSBrowserColumnResizingType": NewType("NSBrowserColumnResizingType", int), - "NSDatePickerStyle": NewType("NSDatePickerStyle", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSInterfaceStyle.h:13:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSInterfaceStyle.h:13:1)", - int, - ), - "NSFontTraitMask": NewType("NSFontTraitMask", int), - "NSSelectionAffinity": NewType("NSSelectionAffinity", int), - "NSWindowStyleMask": NewType("NSWindowStyleMask", int), - "NSSegmentSwitchTracking": NewType("NSSegmentSwitchTracking", int), - "NSOpenGLContextParameter": NewType("NSOpenGLContextParameter", int), - "NSTextContentManagerEnumerationOptions": NewType( - "NSTextContentManagerEnumerationOptions", int - ), - "NSRuleEditorRowType": NewType("NSRuleEditorRowType", int), - "NSColorSystemEffect": NewType("NSColorSystemEffect", int), - "NSAnimationBlockingMode": NewType("NSAnimationBlockingMode", int), - "NSTextTableLayoutAlgorithm": NewType("NSTextTableLayoutAlgorithm", int), - "NSEventSubtype": NewType("NSEventSubtype", int), - "NSSharingContentScope": NewType("NSSharingContentScope", int), - "NSTextAlignment": NewType("NSTextAlignment", int), - "NSTextSelectionNavigationModifier": NewType( - "NSTextSelectionNavigationModifier", int - ), - "NSPaperOrientation": NewType("NSPaperOrientation", int), - "NSPDFPanelOptions": NewType("NSPDFPanelOptions", int), - "NSApplicationTerminateReply": NewType("NSApplicationTerminateReply", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:127:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:127:1)", - int, - ), - "NSWindowOcclusionState": NewType("NSWindowOcclusionState", int), - "NSCollectionElementCategory": NewType("NSCollectionElementCategory", int), - "NSColorPanelOptions": NewType("NSColorPanelOptions", int), - "NSApplicationDelegateReply": NewType("NSApplicationDelegateReply", int), - "NSScrubberAlignment": NewType("NSScrubberAlignment", int), - "NSCellHitResult": NewType("NSCellHitResult", int), - "NSAccessibilitySortDirection": NewType("NSAccessibilitySortDirection", int), - "NSPasteboardReadingOptions": NewType("NSPasteboardReadingOptions", int), - "NSSegmentDistribution": NewType("NSSegmentDistribution", int), - "NSImageScaling": NewType("NSImageScaling", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:82:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:82:1)", - int, - ), - "NSStringDrawingOptions": NewType("NSStringDrawingOptions", int), - "NSBrowserDropOperation": NewType("NSBrowserDropOperation", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKitErrors.h:15:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKitErrors.h:15:1)", - int, - ), - "NSDrawerState": NewType("NSDrawerState", int), - "NSDragOperation": NewType("NSDragOperation", int), - "NSViewLayerContentsPlacement": NewType("NSViewLayerContentsPlacement", int), - "NSApplicationPrintReply": NewType("NSApplicationPrintReply", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:59:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:59:1)", - int, - ), - "NSTextFieldBezelStyle": NewType("NSTextFieldBezelStyle", int), - "NSCharacterCollection": NewType("NSCharacterCollection", int), - "NSEventMask": NewType("NSEventMask", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFont.h:147:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFont.h:147:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:206:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:206:1)", - int, - ), - "NSToolbarItemGroupSelectionMode": NewType( - "NSToolbarItemGroupSelectionMode", int - ), - "NSImageSymbolScale": NewType("NSImageSymbolScale", int), - "NSScrollerPart": NewType("NSScrollerPart", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKitErrors.h:15:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKitErrors.h:15:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:44:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:44:1)", - int, - ), - "NSWindowUserTabbingPreference": NewType("NSWindowUserTabbingPreference", int), - "NSMediaLibrary": NewType("NSMediaLibrary", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:120:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:120:1)", - int, - ), - "NSLayoutFormatOptions": NewType("NSLayoutFormatOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:65:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:65:1)", - int, - ), - "NSBorderType": NewType("NSBorderType", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAttributedString.h:311:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAttributedString.h:311:1)", - int, - ), - "NSWindingRule": NewType("NSWindingRule", int), - "NSControlTint": NewType("NSControlTint", int), - "NSTouchPhase": NewType("NSTouchPhase", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:187:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:187:1)", - int, - ), - "NSTextLayoutManagerSegmentOptions": NewType( - "NSTextLayoutManagerSegmentOptions", int - ), - "NSWindowListOptions": NewType("NSWindowListOptions", int), - "NSWindowDepth": NewType("NSWindowDepth", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSLayoutManager.h:438:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSLayoutManager.h:438:1)", - int, - ), - "NSUnderlineStyle": NewType("NSUnderlineStyle", int), - "NSTextCursorAccessoryPlacement": NewType( - "NSTextCursorAccessoryPlacement", int - ), - "NSFontDescriptorSymbolicTraits": NewType( - "NSFontDescriptorSymbolicTraits", int - ), - "NSFindPanelSubstringMatchType": NewType("NSFindPanelSubstringMatchType", int), - "NSAccessibilityAnnotationPosition": NewType( - "NSAccessibilityAnnotationPosition", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:361:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:361:1)", - int, - ), - "NSTextLayoutFragmentState": NewType("NSTextLayoutFragmentState", int), - "NSMenuItemBadgeType": NewType("NSMenuItemBadgeType", int), - "NSEventPhase": NewType("NSEventPhase", int), - "NSPrintPanelResult": NewType("NSPrintPanelResult", int), - "NSDocumentChangeType": NewType("NSDocumentChangeType", int), - "NSWindowButton": NewType("NSWindowButton", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:683:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:683:1)", - int, - ), - "NSDatePickerElementFlags": NewType("NSDatePickerElementFlags", int), - "NSRequestUserAttentionType": NewType("NSRequestUserAttentionType", int), - "NSDatePickerMode": NewType("NSDatePickerMode", int), - "NSImageResizingMode": NewType("NSImageResizingMode", int), - "NSStackViewGravity": NewType("NSStackViewGravity", int), - "NSBackgroundStyle": NewType("NSBackgroundStyle", int), - "NSTextBlockValueType": NewType("NSTextBlockValueType", int), - "NSTrackingAreaOptions": NewType("NSTrackingAreaOptions", int), - "NSPopUpArrowPosition": NewType("NSPopUpArrowPosition", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:164:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:164:1)", - int, - ), - "NSTextSelectionNavigationDirection": NewType( - "NSTextSelectionNavigationDirection", int - ), - "NSPrintRenderingQuality": NewType("NSPrintRenderingQuality", int), - "NSApplicationActivationOptions": NewType( - "NSApplicationActivationOptions", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:44:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:44:1)", - int, - ), - "NSCollectionViewDropOperation": NewType("NSCollectionViewDropOperation", int), - "NSCellImagePosition": NewType("NSCellImagePosition", int), - "NSPrintPanelOptions": NewType("NSPrintPanelOptions", int), - "NSLayoutAttribute": NewType("NSLayoutAttribute", int), - "NSTypesetterBehavior": NewType("NSTypesetterBehavior", int), - "NSTickMarkPosition": NewType("NSTickMarkPosition", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:59:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:59:1)", - int, - ), - "NSWindowBackingLocation": NewType("NSWindowBackingLocation", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSImageRep.h:29:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSImageRep.h:29:1)", - int, - ), - "NSTableViewDropOperation": NewType("NSTableViewDropOperation", int), - "NSProgressIndicatorThickness": NewType("NSProgressIndicatorThickness", int), - "NSMenuPresentationStyle": NewType("NSMenuPresentationStyle", int), - "NSApplicationPresentationOptions": NewType( - "NSApplicationPresentationOptions", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:65:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontPanel.h:65:1)", - int, - ), - "NSMenuProperties": NewType("NSMenuProperties", int), - "NSTextSelectionGranularity": NewType("NSTextSelectionGranularity", int), - "NSPrintingPaginationMode": NewType("NSPrintingPaginationMode", int), - "NSTextInsertionIndicatorAutomaticModeOptions": NewType( - "NSTextInsertionIndicatorAutomaticModeOptions", int - ), - "NSTextInputTraitType": NewType("NSTextInputTraitType", int), - "NSAnimationEffect": NewType("NSAnimationEffect", int), - "NSVisualEffectMaterial": NewType("NSVisualEffectMaterial", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAttributedString.h:311:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAttributedString.h:311:1)", - int, - ), - "NSCollectionLayoutSectionOrthogonalScrollingBehavior": NewType( - "NSCollectionLayoutSectionOrthogonalScrollingBehavior", int - ), - "NSTabState": NewType("NSTabState", int), - "NSDraggingFormation": NewType("NSDraggingFormation", int), - "NSLayoutConstraintOrientation": NewType("NSLayoutConstraintOrientation", int), - "NSSpringLoadingOptions": NewType("NSSpringLoadingOptions", int), - "NSGradientDrawingOptions": NewType("NSGradientDrawingOptions", int), - "NSSliderType": NewType("NSSliderType", int), - "NSAccessibilityCustomRotorType": NewType( - "NSAccessibilityCustomRotorType", int - ), - "NSTextMovement": NewType("NSTextMovement", int), - "NSAutoresizingMaskOptions": NewType("NSAutoresizingMaskOptions", int), - "NSTabViewControllerTabStyle": NewType("NSTabViewControllerTabStyle", int), - "NSToolbarItemGroupControlRepresentation": NewType( - "NSToolbarItemGroupControlRepresentation", int - ), - "NSPickerTouchBarItemSelectionMode": NewType( - "NSPickerTouchBarItemSelectionMode", int - ), - "NSScrollViewFindBarPosition": NewType("NSScrollViewFindBarPosition", int), - "NSRemoteNotificationType": NewType("NSRemoteNotificationType", int), - "NSTextBlockDimension": NewType("NSTextBlockDimension", int), - "NSEventType": NewType("NSEventType", int), - "NSSaveOperationType": NewType("NSSaveOperationType", int), - "NSPopoverBehavior": NewType("NSPopoverBehavior", int), - "NSFontCollectionVisibility": NewType("NSFontCollectionVisibility", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSImageRep.h:29:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSImageRep.h:29:1)", - int, - ), - "NSPrintingPageOrder": NewType("NSPrintingPageOrder", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextAttachment.h:18:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextAttachment.h:18:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextAttachment.h:18:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextAttachment.h:18:1)", - int, - ), - "NSTIFFCompression": NewType("NSTIFFCompression", int), - "NSTouchType": NewType("NSTouchType", int), - "NSViewLayerContentsRedrawPolicy": NewType( - "NSViewLayerContentsRedrawPolicy", int - ), - "NSBitmapImageFileType": NewType("NSBitmapImageFileType", int), - "NSMultibyteGlyphPacking": NewType("NSMultibyteGlyphPacking", int), - "NSSpringLoadingHighlight": NewType("NSSpringLoadingHighlight", int), - "NSScrollElasticity": NewType("NSScrollElasticity", int), - "NSCompositingOperation": NewType("NSCompositingOperation", int), - "NSColorWellStyle": NewType("NSColorWellStyle", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:22:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:22:1)", - int, - ), - "NSTableViewColumnAutoresizingStyle": NewType( - "NSTableViewColumnAutoresizingStyle", int - ), - "NSTabViewType": NewType("NSTabViewType", int), - "NSScrollerStyle": NewType("NSScrollerStyle", int), - "NSLineCapStyle": NewType("NSLineCapStyle", int), - "NSAccessibilityPriorityLevel": NewType("NSAccessibilityPriorityLevel", int), - "NSStatusItemBehavior": NewType("NSStatusItemBehavior", int), - "NSImageRepLoadStatus": NewType("NSImageRepLoadStatus", int), - "NSColorSpaceModel": NewType("NSColorSpaceModel", int), - "NSPasteboardWritingOptions": NewType("NSPasteboardWritingOptions", int), - "NSTitlePosition": NewType("NSTitlePosition", int), - "NSAccessibilityOrientation": NewType("NSAccessibilityOrientation", int), - "NSTextScalingType": NewType("NSTextScalingType", int), - "NSGlyphInscription": NewType("NSGlyphInscription", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:22:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:22:1)", - int, - ), - "NSTypesetterControlCharacterAction": NewType( - "NSTypesetterControlCharacterAction", int - ), - "NSTextInsertionIndicatorDisplayMode": NewType( - "NSTextInsertionIndicatorDisplayMode", int - ), - "NSWindowOrderingMode": NewType("NSWindowOrderingMode", int), - "NSPasteboardContentsOptions": NewType("NSPasteboardContentsOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:690:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:690:1)", - int, - ), - "NSImageAlignment": NewType("NSImageAlignment", int), - "NSRulerOrientation": NewType("NSRulerOrientation", int), - "NSFocusRingPlacement": NewType("NSFocusRingPlacement", int), - "NSTableViewSelectionHighlightStyle": NewType( - "NSTableViewSelectionHighlightStyle", int - ), - "NSSegmentStyle": NewType("NSSegmentStyle", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:75:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:75:1)", - int, - ), - "NSUserInterfaceLayoutOrientation": NewType( - "NSUserInterfaceLayoutOrientation", int - ), - "NSGlyphProperty": NewType("NSGlyphProperty", int), - "NSWritingDirectionFormatType": NewType("NSWritingDirectionFormatType", int), - "NSAccessibilityRulerMarkerType": NewType( - "NSAccessibilityRulerMarkerType", int - ), - "NSTextStorageEditActions": NewType("NSTextStorageEditActions", int), - "NSColorPanelMode": NewType("NSColorPanelMode", int), - "NSControlSize": NewType("NSControlSize", int), - "NSPressureBehavior": NewType("NSPressureBehavior", int), - "NSTextSelectionNavigationWritingDirection": NewType( - "NSTextSelectionNavigationWritingDirection", int - ), - "NSTextFinderAction": NewType("NSTextFinderAction", int), - "NSCollectionViewScrollPosition": NewType( - "NSCollectionViewScrollPosition", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSLayoutManager.h:438:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSLayoutManager.h:438:1)", - int, - ), - "NSWorkspaceAuthorizationType": NewType("NSWorkspaceAuthorizationType", int), - "NSCollectionUpdateAction": NewType("NSCollectionUpdateAction", int), - "NSWindowSharingType": NewType("NSWindowSharingType", int), - "NSCloudKitSharingServiceOptions": NewType( - "NSCloudKitSharingServiceOptions", int - ), - "NSPrinterTableStatus": NewType("NSPrinterTableStatus", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSInterfaceStyle.h:13:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSInterfaceStyle.h:13:1)", - int, - ), - "NSScrollerArrow": NewType("NSScrollerArrow", int), - "NSHapticFeedbackPattern": NewType("NSHapticFeedbackPattern", int), - "NSTextListOptions": NewType("NSTextListOptions", int), - "NSStackViewDistribution": NewType("NSStackViewDistribution", int), - "NSWindowTabbingMode": NewType("NSWindowTabbingMode", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:224:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:224:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:75:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:75:1)", - int, - ), - "NSColorType": NewType("NSColorType", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:187:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:187:1)", - int, - ), - "NSAccessibilityCustomRotorSearchDirection": NewType( - "NSAccessibilityCustomRotorSearchDirection", int - ), - "NSUserInterfaceLayoutDirection": NewType( - "NSUserInterfaceLayoutDirection", int - ), - "NSVisualEffectBlendingMode": NewType("NSVisualEffectBlendingMode", int), - "NSLineSweepDirection": NewType("NSLineSweepDirection", int), - "NSRectAlignment": NewType("NSRectAlignment", int), - "NSLineJoinStyle": NewType("NSLineJoinStyle", int), - "NSEventModifierFlags": NewType("NSEventModifierFlags", int), - "NSProgressIndicatorStyle": NewType("NSProgressIndicatorStyle", int), - "NSWorkspaceIconCreationOptions": NewType( - "NSWorkspaceIconCreationOptions", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:50:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h:50:1)", - int, - ), - "NSImageInterpolation": NewType("NSImageInterpolation", int), - "NSDirectionalRectEdge": NewType("NSDirectionalRectEdge", int), - "NSTextSelectionNavigationLayoutOrientation": NewType( - "NSTextSelectionNavigationLayoutOrientation", int - ), - "NSImageCacheMode": NewType("NSImageCacheMode", int), - "NSTableRowActionEdge": NewType("NSTableRowActionEdge", int), - "NSHapticFeedbackPerformanceTime": NewType( - "NSHapticFeedbackPerformanceTime", int - ), - "NSSplitViewItemBehavior": NewType("NSSplitViewItemBehavior", int), - "NSTextSelectionAffinity": NewType("NSTextSelectionAffinity", int), - "NSFontCollectionOptions": NewType("NSFontCollectionOptions", int), - "NSButtonType": NewType("NSButtonType", int), - "NSScrollArrowPosition": NewType("NSScrollArrowPosition", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:220:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h:220:1)", - int, - ), - "NSSelectionGranularity": NewType("NSSelectionGranularity", int), - "NSPrintingOrientation": NewType("NSPrintingOrientation", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:127:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:127:1)", - int, - ), - "NSBezelStyle": NewType("NSBezelStyle", int), - "NSCorrectionResponse": NewType("NSCorrectionResponse", int), - "NSWorkspaceLaunchOptions": NewType("NSWorkspaceLaunchOptions", int), - "NSOpenGLGlobalOption": NewType("NSOpenGLGlobalOption", int), - "NSCorrectionIndicatorType": NewType("NSCorrectionIndicatorType", int), - "NSBezierPathElement": NewType("NSBezierPathElement", int), - "NSImageDynamicRange": NewType("NSImageDynamicRange", int), - "NSApplicationActivationPolicy": NewType("NSApplicationActivationPolicy", int), - "NSTableViewAnimationOptions": NewType("NSTableViewAnimationOptions", int), - "NSGridCellPlacement": NewType("NSGridCellPlacement", int), - "NSToolbarSizeMode": NewType("NSToolbarSizeMode", int), - } -) -misc.update( - { - "NSAccessibilitySortDirectionValue": NewType( - "NSAccessibilitySortDirectionValue", str - ), - "NSSpeechPropertyKey": NewType("NSSpeechPropertyKey", str), - "NSToolbarItemVisibilityPriority": NewType( - "NSToolbarItemVisibilityPriority", int - ), - "NSDefinitionOptionKey": NewType("NSDefinitionOptionKey", str), - "NSFontCollectionName": NewType("NSFontCollectionName", str), - "NSAccessibilityAttributeName": NewType("NSAccessibilityAttributeName", str), - "NSDraggingImageComponentKey": NewType("NSDraggingImageComponentKey", str), - "NSAppearanceName": NewType("NSAppearanceName", str), - "NSWorkspaceFileOperationName": NewType("NSWorkspaceFileOperationName", str), - "NSFontDescriptorVariationKey": NewType("NSFontDescriptorVariationKey", str), - "NSPasteboardName": NewType("NSPasteboardName", str), - "NSStackViewVisibilityPriority": NewType( - "NSStackViewVisibilityPriority", float - ), - "NSFontDescriptorTraitKey": NewType("NSFontDescriptorTraitKey", str), - "NSBindingInfoKey": NewType("NSBindingInfoKey", str), - "NSTextLayoutSectionKey": NewType("NSTextLayoutSectionKey", str), - "NSPrintPanelJobStyleHint": NewType("NSPrintPanelJobStyleHint", str), - "NSAboutPanelOptionKey": NewType("NSAboutPanelOptionKey", str), - "NSAccessibilityParameterizedAttributeName": NewType( - "NSAccessibilityParameterizedAttributeName", str - ), - "NSWorkspaceLaunchConfigurationKey": NewType( - "NSWorkspaceLaunchConfigurationKey", str - ), - "NSFontCollectionActionTypeKey": NewType("NSFontCollectionActionTypeKey", str), - "NSPasteboardTypeTextFinderOptionKey": NewType( - "NSPasteboardTypeTextFinderOptionKey", str - ), - "NSTouchBarItemIdentifier": NewType("NSTouchBarItemIdentifier", str), - "NSAccessibilityRole": NewType("NSAccessibilityRole", str), - "NSTextListMarkerFormat": NewType("NSTextListMarkerFormat", str), - "NSAttributedStringDocumentAttributeKey": NewType( - "NSAttributedStringDocumentAttributeKey", str - ), - "NSFontCollectionMatchingOptionKey": NewType( - "NSFontCollectionMatchingOptionKey", str - ), - "NSRulerViewUnitName": NewType("NSRulerViewUnitName", str), - "NSGraphicsContextRepresentationFormatName": NewType( - "NSGraphicsContextRepresentationFormatName", str - ), - "NSPopoverCloseReasonValue": NewType("NSPopoverCloseReasonValue", str), - "NSPasteboardTypeFindPanelSearchOptionKey": NewType( - "NSPasteboardTypeFindPanelSearchOptionKey", str - ), - "NSSpeechMode": NewType("NSSpeechMode", str), - "NSViewAnimationEffectName": NewType("NSViewAnimationEffectName", str), - "NSAttributedStringDocumentReadingOptionKey": NewType( - "NSAttributedStringDocumentReadingOptionKey", str - ), - "NSModalResponse": NewType("NSModalResponse", int), - "NSAccessibilityRulerUnitValue": NewType("NSAccessibilityRulerUnitValue", str), - "NSToolbarUserInfoKey": NewType("NSToolbarUserInfoKey", str), - "NSTextContentType": NewType("NSTextContentType", str), - "NSFontDescriptorSystemDesign": NewType("NSFontDescriptorSystemDesign", str), - "NSSpeechCommandDelimiterKey": NewType("NSSpeechCommandDelimiterKey", str), - "NSBindingOption": NewType("NSBindingOption", str), - "NSTextTabOptionKey": NewType("NSTextTabOptionKey", str), - "NSAccessibilityAnnotationAttributeKey": NewType( - "NSAccessibilityAnnotationAttributeKey", str - ), - "NSFontDescriptorFeatureKey": NewType("NSFontDescriptorFeatureKey", str), - "NSPrinterTypeName": NewType("NSPrinterTypeName", str), - "NSImageHintKey": NewType("NSImageHintKey", str), - "NSWindowLevel": NewType("NSWindowLevel", int), - "NSSpeechDictionaryKey": NewType("NSSpeechDictionaryKey", str), - "NSUserInterfaceItemIdentifier": NewType("NSUserInterfaceItemIdentifier", str), - "NSAccessibilitySubrole": NewType("NSAccessibilitySubrole", str), - "NSAccessibilityFontAttributeKey": NewType( - "NSAccessibilityFontAttributeKey", str - ), - "NSSliderAccessoryWidth": NewType("NSSliderAccessoryWidth", float), - "NSWorkspaceDesktopImageOptionKey": NewType( - "NSWorkspaceDesktopImageOptionKey", str - ), - "NSLayoutPriority": NewType("NSLayoutPriority", float), - "NSSpeechSynthesizerVoiceName": NewType("NSSpeechSynthesizerVoiceName", str), - "NSTextEffectStyle": NewType("NSTextEffectStyle", str), - "NSDefinitionPresentationType": NewType("NSDefinitionPresentationType", str), - "NSAttributedStringFormattingContextKey": NewType( - "NSAttributedStringFormattingContextKey", str - ), - "NSAccessibilityActionName": NewType("NSAccessibilityActionName", str), - "NSToolbarItemIdentifier": NewType("NSToolbarItemIdentifier", str), - "NSFontTextStyleOptionKey": NewType("NSFontTextStyleOptionKey", str), - "NSTextCheckingOptionKey": NewType("NSTextCheckingOptionKey", str), - "NSFontTextStyle": NewType("NSFontTextStyle", str), - "NSAccessibilityRulerMarkerTypeValue": NewType( - "NSAccessibilityRulerMarkerTypeValue", str - ), - "NSFontCollectionUserInfoKey": NewType("NSFontCollectionUserInfoKey", str), - "NSViewFullScreenModeOptionKey": NewType("NSViewFullScreenModeOptionKey", str), - "NSFontDescriptorAttributeName": NewType("NSFontDescriptorAttributeName", str), - "NSPrintInfoAttributeKey": NewType("NSPrintInfoAttributeKey", str), - "NSPrintJobDispositionValue": NewType("NSPrintJobDispositionValue", str), - "NSSpeechStatusKey": NewType("NSSpeechStatusKey", str), - "NSVoiceAttributeKey": NewType("NSVoiceAttributeKey", str), - "NSPasteboardType": NewType("NSPasteboardType", str), - "NSViewAnimationKey": NewType("NSViewAnimationKey", str), - "NSSpeechPhonemeInfoKey": NewType("NSSpeechPhonemeInfoKey", str), - "NSFontWeight": NewType("NSFontWeight", float), - "NSSpeechSynthesizerInfoKey": NewType("NSSpeechSynthesizerInfoKey", str), - "NSBindingName": NewType("NSBindingName", str), - "NSGraphicsContextAttributeKey": NewType("NSGraphicsContextAttributeKey", str), - "NSAccessibilityNotificationUserInfoKey": NewType( - "NSAccessibilityNotificationUserInfoKey", str - ), - "NSAttributedStringDocumentType": NewType( - "NSAttributedStringDocumentType", str - ), - "NSAppKitVersion": NewType("NSAppKitVersion", float), - "NSAccessibilityNotificationName": NewType( - "NSAccessibilityNotificationName", str - ), - "NSTouchBarItemPriority": NewType("NSTouchBarItemPriority", float), - "NSVoiceGenderName": NewType("NSVoiceGenderName", str), - "NSPrintPanelAccessorySummaryKey": NewType( - "NSPrintPanelAccessorySummaryKey", str - ), - "NSFontWidth": NewType("NSFontWidth", float), - "NSControlStateValue": NewType("NSControlStateValue", int), - "NSAccessibilityOrientationValue": NewType( - "NSAccessibilityOrientationValue", str - ), - "NSDeviceDescriptionKey": NewType("NSDeviceDescriptionKey", str), - "NSBitmapImageRepPropertyKey": NewType("NSBitmapImageRepPropertyKey", str), - "NSPrinterPaperName": NewType("NSPrinterPaperName", str), - "NSSharingServiceName": NewType("NSSharingServiceName", str), - "NSColorSpaceName": NewType("NSColorSpaceName", str), - "NSSpeechErrorKey": NewType("NSSpeechErrorKey", str), - "NSRuleEditorPredicatePartKey": NewType("NSRuleEditorPredicatePartKey", str), - "NSPasteboardReadingOptionKey": NewType("NSPasteboardReadingOptionKey", str), - } -) -misc.update( - { - "NSAppKitVersionNumber10_4_1": 824.1, - "NSAppKitVersionNumber10_4_3": 824.23, - "NSAppKitVersionNumber10_3_9": 743.36, - "NSAppKitVersionNumber10_4_4": 824.33, - "NSAppKitVersionNumber10_4_7": 824.41, - "NSAppKitVersionNumber10_3_2": 743.14, - "NSAppKitVersionNumber10_3_3": 743.2, - "NSAppKitVersionNumber10_3_7": 743.33, - "NSAppKitVersionNumber10_3_5": 743.24, - "NSAppKitVersionNumberWithDockTilePlugInSupport": 1001.0, - "NSAppKitVersionNumberWithCursorSizeSupport": 682.0, - "NSAppKitVersionNumber10_5_2": 949.27, - "NSAppKitVersionNumber10_5_3": 949.33, - "NSAppKitVersionNumberWithCustomSheetPosition": 686.0, - "NSAppKitVersionNumber10_2_3": 663.6, - "NSAppKitVersionNumberWithDirectionalTabs": 631.0, - "NSAppKitVersionNumberWithColumnResizingBrowser": 685.0, - "NSAppKitVersionNumberWithDeferredWindowDisplaySupport": 1019.0, - "NSAppKitVersionNumberWithContinuousScrollingBrowser": 680.0, - "NSAppKitVersionNumberWithPatternColorLeakFix": 641.0, - "NSAppKitVersionNumber10_7_4": 1138.47, - "NSAppKitVersionNumber10_7_2": 1138.23, - "NSAppKitVersionNumber10_7_3": 1138.32, - } -) -functions = { - "NSRectClipList": ( - b"v^{CGRect={CGPoint=dd}{CGSize=dd}}q", - "", - {"arguments": {0: {"c_array_length_in_arg": 1, "type_modifier": "n"}}}, - ), - "NSApplicationLoad": (b"Z",), - "NSCountWindows": (b"v^q", "", {"arguments": {0: {"type_modifier": "o"}}}), - "NSGetAlertPanel": ( - b"@@@@@@", - "", - {"arguments": {1: {"printf_format": True}}, "variadic": True}, - ), - "NSApplicationMain": (b"ii^^c",), - "NSOpenGLGetVersion": ( - b"v^i^i", - "", - {"arguments": {0: {"type_modifier": "o"}, 1: {"type_modifier": "o"}}}, - ), - "NSAccessibilityActionDescription": (b"@@",), - "NSRunAlertPanelRelativeToWindow": ( - b"q@@@@@@", - "", - {"arguments": {1: {"printf_format": 1}}, "variadic": True}, - ), - "NSTouchTypeMaskFromType": (b"Qq", "", {"inline": True}), - "NSDrawLightBezel": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSDrawNinePartImage": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}@@@@@@@@@QdZ",), - "NSOpenGLSetOption": (b"vIi",), - "NSRectClip": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSDottedFrameRect": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSDrawBitmap": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}qqqqqqZZ@^C", - "", - {"arguments": {10: {"c_array_of_fixed_length": 5, "type_modifier": "n"}}}, - ), - "NSConvertGlyphsToPackedGlyphs": (b"q^IqQ^c",), - "NSGetFileType": (b"@@",), - "NSDirectionalEdgeInsetsMake": (b"{NSDirectionalEdgeInsets=dddd}dddd",), - "NSWindowList": ( - b"vq^q", - "", - {"arguments": {1: {"c_array_length_in_arg": 0, "type_modifier": "o"}}}, - ), - "NSAccessibilityRaiseBadArgumentException": (b"v@@@",), - "NSAccessibilityUnignoredDescendant": (b"@@",), - "NSRectFill": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSGetCriticalAlertPanel": ( - b"@@@@@@", - "", - {"arguments": {1: {"printf_format": True}}, "variadic": True}, - ), - "NSAccessibilityFrameInView": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}@{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSDrawThreePartImage": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}@@@ZQdZ",), - "NSAccessibilityRoleDescription": (b"@@@",), - "NSRunCriticalAlertPanel": ( - b"q@@@@@", - "", - {"arguments": {1: {"printf_format": 1}}, "variadic": True}, - ), - "NSFrameRect": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSDrawColorTiledRects": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}^Q^@q", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": 4, "type_modifier": "n"}, - 3: {"c_array_length_in_arg": 4, "type_modifier": "n"}, - } - }, - ), - "NSBeginCriticalAlertSheet": ( - b"v@@@@@@::^v@", - "", - { - "arguments": { - 9: {"printf_format": True}, - 6: {"sel_of_type": b"v@:@q^v"}, - 7: {"sel_of_type": b"v@:@q^v"}, - }, - "variadic": True, - }, - ), - "NSBeginAlertSheet": ( - b"v@@@@@@::^v@", - "", - { - "arguments": { - 9: {"printf_format": True}, - 6: {"sel_of_type": b"v@:@q^v"}, - 7: {"sel_of_type": b"v@:@q^v"}, - }, - "variadic": True, - }, - ), - "NSCountWindowsForContext": ( - b"vq^q", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "NSGetWindowServerMemory": ( - b"qq^q^q^@", - "", - { - "arguments": { - 1: {"type_modifier": "o"}, - 2: {"type_modifier": "o"}, - 3: {"type_modifier": "o"}, - } - }, - ), - "NSShowAnimationEffect": ( - b"vQ{CGPoint=dd}{CGSize=dd}@:^v", - "", - {"arguments": {4: {"sel_of_type": b"v@:^v"}}}, - ), - "NSRunCriticalAlertPanelRelativeToWindow": ( - b"q@@@@@@", - "", - {"arguments": {1: {"printf_format": 1}}, "variadic": True}, - ), - "NSAccessibilityUnignoredChildren": (b"@@",), - "NSRectFillListUsingOperation": ( - b"v^{CGRect={CGPoint=dd}{CGSize=dd}}qQ", - "", - {"arguments": {0: {"c_array_length_in_arg": 1, "type_modifier": "n"}}}, - ), - "NSCreateFilenamePboardType": (b"@@", "", {"retval": {"already_cfretained": True}}), - "NSInterfaceStyleForKey": (b"Q@@",), - "NSAvailableWindowDepths": ( - b"^i", - "", - {"retval": {"c_array_delimited_by_null": True}}, - ), - "NSBeginInformationalAlertSheet": ( - b"v@@@@@@::^v@", - "", - { - "arguments": { - 9: {"printf_format": True}, - 6: {"sel_of_type": b"v@:@q^v"}, - 7: {"sel_of_type": b"v@:@q^v"}, - }, - "variadic": True, - }, - ), - "NSUnregisterServicesProvider": (b"v@",), - "NSEventMaskFromType": (b"QQ",), - "NSRectFillUsingOperation": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}Q",), - "NSBitsPerSampleFromDepth": (b"qi",), - "NSEnableScreenUpdates": (b"v",), - "NSDrawDarkBezel": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSRunInformationalAlertPanelRelativeToWindow": ( - b"q@@@@@@", - "", - {"arguments": {1: {"printf_format": 1}}, "variadic": True}, - ), - "NSPerformService": (b"Z@@",), - "NSGetFileTypes": (b"@@",), - "NSDrawWhiteBezel": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSReleaseAlertPanel": (b"v@",), - "NSAccessibilityUnignoredAncestor": (b"@@",), - "NSAccessibilityPostNotificationWithUserInfo": (b"v@@@",), - "NSSetFocusRingStyle": (b"vQ",), - "NSAccessibilityPostNotification": (b"v@@",), - "NSDrawTiledRects": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}^Q^dq", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": 4, "type_modifier": "n"}, - 3: {"c_array_length_in_arg": 4, "type_modifier": "n"}, - } - }, - ), - "NSAccessibilityPointInView": (b"{CGPoint=dd}@{CGPoint=dd}",), - "NSUpdateDynamicServices": (b"v",), - "NSIsControllerMarker": (b"Z@",), - "NSDrawButton": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSSetShowsServicesMenuItem": (b"q@Z",), - "NSOpenGLGetOption": (b"vI^i", "", {"arguments": {1: {"type_modifier": "o"}}}), - "NSCreateFileContentsPboardType": ( - b"@@", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSCopyBits": ( - b"vq{CGRect={CGPoint=dd}{CGSize=dd}}{CGPoint=dd}", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSDisableScreenUpdates": (b"v",), - "NSEdgeInsetsMake": (b"{NSEdgeInsets=dddd}dddd",), - "NSReadPixel": (b"@{CGPoint=dd}",), - "NSWindowListForContext": ( - b"vqq^q", - "", - {"arguments": {2: {"c_array_length_in_arg": 1, "type_modifier": "o"}}}, - ), - "NSAccessibilityRoleDescriptionForUIElement": (b"@@",), - "NSDrawWindowBackground": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSShowsServicesMenuItem": (b"Z@",), - "NSPlanarFromDepth": (b"Zi",), - "NSHighlightRect": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSFrameRectWithWidthUsingOperation": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}dQ",), - "NSRectFillListWithColorsUsingOperation": ( - b"v^{CGRect={CGPoint=dd}{CGSize=dd}}^@qQ", - "", - { - "arguments": { - 0: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - 1: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - } - }, - ), - "NSDrawGroove": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSNumberOfColorComponents": (b"q@",), - "NSFrameRectWithWidth": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}d",), - "NSEraseRect": (b"v{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSRectFillListWithColors": ( - b"v^{CGRect={CGPoint=dd}{CGSize=dd}}^@q", - "", - { - "arguments": { - 0: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - 1: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - } - }, - ), - "NSBestDepth": (b"i@qqZ^Z", "", {"arguments": {4: {"type_modifier": "o"}}}), - "NSColorSpaceFromDepth": (b"@i",), - "NSBeep": (b"v",), - "NSAccessibilitySetMayContainProtectedContent": (b"ZZ",), - "NSBitsPerPixelFromDepth": (b"qi",), - "NSAccessibilityUnignoredChildrenForOnlyChild": (b"@@",), - "NSDrawGrayBezel": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSRectFillList": ( - b"v^{CGRect={CGPoint=dd}{CGSize=dd}}q", - "", - {"arguments": {0: {"c_array_length_in_arg": 1, "type_modifier": "n"}}}, - ), - "NSRunAlertPanel": ( - b"q@@@@@", - "", - {"arguments": {1: {"printf_format": 1}}, "variadic": True}, - ), - "NSGetInformationalAlertPanel": ( - b"@@@@@@", - "", - {"arguments": {1: {"printf_format": True}}, "variadic": True}, - ), - "NSRectFillListWithGrays": ( - b"v^{CGRect={CGPoint=dd}{CGSize=dd}}^dq", - "", - { - "arguments": { - 0: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - 1: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - } - }, - ), - "NSRunInformationalAlertPanel": ( - b"q@@@@@", - "", - {"arguments": {1: {"printf_format": 1}}, "variadic": True}, - ), - "NSRegisterServicesProvider": (b"v@@",), -} -aliases = { - "NSLayoutFormatAlignAllLastBaseline": "NSLayoutFormatAlignAllBaseline", - "NSBezelStyleRoundedDisclosure": "NSBezelStylePushDisclosure", - "NSBezelStyleRegularSquare": "NSBezelStyleFlexiblePush", - "NSImageRepRegistryChangedNotification": "NSImageRepRegistryDidChangeNotification", - "NSBezierPathElementCurveTo": "NSBezierPathElementCubicCurveTo", - "NSTickMarkRight": "NSTickMarkBelow", - "NSModalPanelWindowLevel": "kCGModalPanelWindowLevel", - "NSSubmenuWindowLevel": "kCGTornOffMenuWindowLevel", - "NSTickMarkPositionTrailing": "NSTickMarkPositionBelow", - "NSLayoutFormatAlignAllBaseline": "NSLayoutFormatAlignAllLastBaseline", - "NSGestureRecognizerStateRecognized": "NSGestureRecognizerStateEnded", - "NSGridCellPlacementBottom": "NSGridCellPlacementTrailing", - "NSBezelStyleInline": "NSBezelStyleBadge", - "NSTornOffMenuWindowLevel": "kCGTornOffMenuWindowLevel", - "NSRightTextAlignment": "NSTextAlignmentRight", - "NSPopUpMenuWindowLevel": "kCGPopUpMenuWindowLevel", - "NSLayoutAttributeBaseline": "NSLayoutAttributeLastBaseline", - "NSBezelStyleRoundRect": "NSBezelStyleAccessoryBarAction", - "NSDragOperationAll": "NSDragOperationAll_Obsolete", - "NSGridCellPlacementTop": "NSGridCellPlacementLeading", - "NSMainMenuWindowLevel": "kCGMainMenuWindowLevel", - "NSDraggingItemEnumerationConcurrent": "NSEnumerationConcurrent", - "NSScreenSaverWindowLevel": "kCGScreenSaverWindowLevel", - "NSEventDurationForever": "DBL_MAX", - "NSBezelStyleTexturedRounded": "NSBezelStyleToolbar", - "APPKIT_PRIVATE_EXTERN": "__private_extern__", - "NSLayoutAttributeLastBaseline": "NSLayoutAttributeBaseline", - "NSBezelStyleRounded": "NSBezelStylePush", - "IBAction": "void", - "NSBezelStyleRecessed": "NSBezelStyleAccessoryBar", - "NSFileHandlingPanelCancelButton": "NSModalResponseCancel", - "NSWorkspaceLaunchDefault": "NSWorkspaceLaunchAsync", - "NSNormalWindowLevel": "kCGNormalWindowLevel", - "NSFileHandlingPanelOKButton": "NSModalResponseOK", - "NSIMAGE_UNAVAILABLE_MACCATALYST": "TARGET_OS_IPHONE", - "NSFloatingWindowLevel": "kCGFloatingWindowLevel", - "NSTickMarkPositionLeading": "NSTickMarkPositionAbove", - "NSDockWindowLevel": "kCGDockWindowLevel", - "NSCenterTextAlignment": "NSTextAlignmentCenter", - "NSTickMarkLeft": "NSTickMarkAbove", - "NSStackViewSpacingUseDefault": "FLT_MAX", - "NSStatusWindowLevel": "kCGStatusWindowLevel", - "NSFontDescriptorTraitEmphasized": "NSFontDescriptorTraitBold", -} -misc.update( - { - "NSModalSession": objc.createOpaquePointerType( - "NSModalSession", b"^{_NSModalSession}" - ) - } -) -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r( - b"CIImage", - b"drawAtPoint:fromRect:operation:fraction:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"CIImage", - b"drawInRect:fromRect:operation:fraction:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r(b"NSATSTypesetter", b"bidiProcessingEnabled", {"retval": {"type": "Z"}}) - r( - b"NSATSTypesetter", - b"boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "{CGPoint=dd}"}, - 6: {"type": "Q"}, - }, - }, - ) - r( - b"NSATSTypesetter", - b"characterRangeForGlyphRange:actualGlyphRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSATSTypesetter", - b"deleteGlyphsInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSATSTypesetter", - b"getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type": "^I", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 4: {"type": "^Q", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 5: {"type": "^Q", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 6: {"type": "^Z", "type_modifier": b"o", "c_array_length_in_arg": 2}, - } - }, - ) - r( - b"NSATSTypesetter", - b"getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "{CGPoint=dd}"}, - }, - }, - ) - r( - b"NSATSTypesetter", - b"glyphRangeForCharacterRange:actualCharacterRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSATSTypesetter", - b"layoutParagraphAtPoint:", - {"arguments": {2: {"type_modifier": b"N"}}}, - ) - r( - b"NSATSTypesetter", - b"lineFragmentRectForProposedRect:remainingRect:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSATSTypesetter", - b"lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSATSTypesetter", b"paragraphGlyphRange", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSATSTypesetter", - b"paragraphSeparatorGlyphRange", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSATSTypesetter", - b"paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSATSTypesetter", - b"paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSATSTypesetter", - b"setAttachmentSize:forGlyphRange:", - {"arguments": {2: {"type": "{CGSize=dd}"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSATSTypesetter", - b"setBidiLevels:forGlyphRange:", - { - "arguments": { - 2: {"type": "^z", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 3: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSATSTypesetter", - b"setBidiProcessingEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSATSTypesetter", - b"setDrawsOutsideLineFragment:forGlyphRange:", - {"arguments": {2: {"type": "Z"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSATSTypesetter", - b"setHardInvalidation:forGlyphRange:", - {"arguments": {2: {"type": "Z"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSATSTypesetter", - b"setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "d"}, - } - }, - ) - r( - b"NSATSTypesetter", - b"setLocation:withAdvancements:forStartOfGlyphRange:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 4: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSATSTypesetter", - b"setNotShownAttribute:forGlyphRange:", - {"arguments": {2: {"type": "Z"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSATSTypesetter", - b"setParagraphGlyphRange:separatorGlyphRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSATSTypesetter", b"setUsesFontLeading:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSATSTypesetter", - b"shouldBreakLineByHyphenatingBeforeCharacterAtIndex:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "Q"}}}, - ) - r( - b"NSATSTypesetter", - b"shouldBreakLineByWordBeforeCharacterAtIndex:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "Q"}}}, - ) - r( - b"NSATSTypesetter", - b"substituteGlyphsInRange:withGlyphs:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 2}, - } - }, - ) - r(b"NSATSTypesetter", b"usesFontLeading", {"retval": {"type": "Z"}}) - r( - b"NSATSTypesetter", - b"willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", - { - "arguments": { - 2: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 5: {"type": "^d", "type_modifier": b"N"}, - } - }, - ) - r( - b"NSAccessibilityCustomAction", - b"handler", - { - "retval": { - "callable": { - "retval": {"type": b"Z"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r( - b"NSAccessibilityCustomAction", - b"initWithName:handler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSAccessibilityCustomAction", - b"initWithName:target:selector:", - {"arguments": {4: {"sel_of_type": b"Z@:"}}}, - ) - r( - b"NSAccessibilityCustomAction", - b"setHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSActionCell", - b"setAction:", - {"retval": {"type": "v"}, "arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSActionCell", b"setBezeled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSActionCell", b"setBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSActionCell", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSActionCell", - b"setFloatingPointFormat:left:right:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSAlert", - b"alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:", - {"arguments": {6: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSAlert", - b"beginSheetModalForWindow:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSAlert", - b"beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": b"v@:@q^v"}, 5: {"type": "^v"}}}, - ) - r(b"NSAlert", b"setShowsHelp:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSAlert", b"setShowsSuppressionButton:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSAlert", b"showsHelp", {"retval": {"type": "Z"}}) - r(b"NSAlert", b"showsSuppressionButton", {"retval": {"type": "Z"}}) - r(b"NSAnimation", b"isAnimating", {"retval": {"type": "Z"}}) - r(b"NSAnimationContext", b"allowsImplicitAnimation", {"retval": {"type": b"Z"}}) - r( - b"NSAnimationContext", - b"completionHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r( - b"NSAnimationContext", - b"runAnimationGroup:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSAnimationContext", - b"runAnimationGroup:completionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - }, - } - }, - ) - r( - b"NSAnimationContext", - b"setAllowsImplicitAnimation:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSAnimationContext", - b"setCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSAppearance", b"allowsVibrancy", {"retval": {"type": b"Z"}}) - r( - b"NSAppearance", - b"performAsCurrentDrawingAppearance:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSApplication", - b"activateIgnoringOtherApps:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSApplication", - b"addWindowsItem:title:filename:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSApplication", - b"beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": b"v@:@q^v"}, 6: {"type": "^v"}}}, - ) - r( - b"NSApplication", - b"changeWindowsItem:title:filename:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSApplication", - b"detachDrawingThread:toTarget:withObject:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSApplication", - b"enumerateWindowsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r(b"NSApplication", b"isActive", {"retval": {"type": "Z"}}) - r( - b"NSApplication", - b"isAutomaticCustomizeTouchBarMenuItemEnabled", - {"retval": {"type": "Z"}}, - ) - r(b"NSApplication", b"isFullKeyboardAccessEnabled", {"retval": {"type": "Z"}}) - r(b"NSApplication", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSApplication", b"isProtectedDataAvailable", {"retval": {"type": "Z"}}) - r( - b"NSApplication", - b"isRegisteredForRemoteNotifications", - {"retval": {"type": b"Z"}}, - ) - r(b"NSApplication", b"isRunning", {"retval": {"type": "Z"}}) - r( - b"NSApplication", - b"makeWindowsPerform:inOrder:", - {"arguments": {2: {"sel_of_type": b"v@:"}, 3: {"type": "Z"}}}, - ) - r( - b"NSApplication", - b"nextEventMatchingMask:untilDate:inMode:dequeue:", - {"arguments": {5: {"type": "Z"}}}, - ) - r(b"NSApplication", b"postEvent:atStart:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSApplication", - b"replyToApplicationShouldTerminate:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSApplication", - b"restoreWindowWithIdentifier:state:completionHandler:", - { - "retval": {"type": b"Z"}, - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "type": "@?", - } - }, - }, - ) - r( - b"NSApplication", - b"searchString:inUserInterfaceItemString:searchRange:foundRange:", - { - "retval": {"type": "Z"}, - "arguments": { - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSApplication", - b"sendAction:to:from:", - {"retval": {"type": "Z"}, "arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSApplication", b"setActivationPolicy:", {"retval": {"type": "Z"}}) - r( - b"NSApplication", - b"setAutomaticCustomizeTouchBarMenuItemEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSApplication", b"setWindowsNeedUpdate:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSApplication", - b"targetForAction:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSApplication", - b"targetForAction:to:from:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSApplication", - b"tryToPerform:with:", - {"retval": {"type": "Z"}, "arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSArrayController", b"addSelectedObjects:", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"addSelectionIndexes:", {"retval": {"type": "Z"}}) - r( - b"NSArrayController", - b"alwaysUsesMultipleValuesMarker", - {"retval": {"type": "Z"}}, - ) - r( - b"NSArrayController", - b"automaticallyRearrangesObjects", - {"retval": {"type": "Z"}}, - ) - r(b"NSArrayController", b"avoidsEmptySelection", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"canInsert", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"canSelectNext", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"canSelectPrevious", {"retval": {"type": "Z"}}) - r( - b"NSArrayController", - b"clearsFilterPredicateOnInsertion", - {"retval": {"type": "Z"}}, - ) - r(b"NSArrayController", b"preservesSelection", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"removeSelectedObjects:", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"removeSelectionIndexes:", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"selectsInsertedObjects", {"retval": {"type": "Z"}}) - r( - b"NSArrayController", - b"setAlwaysUsesMultipleValuesMarker:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSArrayController", - b"setAutomaticallyRearrangesObjects:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSArrayController", - b"setAvoidsEmptySelection:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSArrayController", - b"setClearsFilterPredicateOnInsertion:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSArrayController", - b"setPreservesSelection:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSArrayController", b"setSelectedObjects:", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"setSelectionIndex:", {"retval": {"type": "Z"}}) - r(b"NSArrayController", b"setSelectionIndexes:", {"retval": {"type": "Z"}}) - r( - b"NSArrayController", - b"setSelectsInsertedObjects:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSAttributedString", - b"RTFDFileWrapperFromRange:documentAttributes:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"RTFDFromRange:documentAttributes:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"RTFFromRange:documentAttributes:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"URLAtIndex:effectiveRange:", - {"arguments": {3: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"boundingRectWithSize:options:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGSize=dd}"}}, - }, - ) - r(b"NSAttributedString", b"containsAttachments", {"retval": {"type": "Z"}}) - r(b"NSAttributedString", b"containsAttachmentsInRange:", {"retval": {"type": "Z"}}) - r( - b"NSAttributedString", - b"dataFromRange:documentAttributes:error:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"docFormatFromRange:documentAttributes:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"doubleClickAtIndex:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSAttributedString", - b"drawAtPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSAttributedString", - b"drawInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSAttributedString", - b"drawWithRect:options:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSAttributedString", - b"fileWrapperFromRange:documentAttributes:error:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"fontAttributesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"initWithData:options:documentAttributes:error:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithDocFormat:documentAttributes:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithHTML:baseURL:documentAttributes:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithHTML:documentAttributes:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithHTML:options:documentAttributes:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithPath:documentAttributes:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithRTF:documentAttributes:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithRTFD:documentAttributes:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithRTFDFileWrapper:documentAttributes:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithURL:documentAttributes:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithURL:options:documentAttributes:error:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"lineBreakBeforeIndex:withinRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"lineBreakByHyphenatingBeforeIndex:withinRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"nextWordFromIndex:forward:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSAttributedString", - b"rangeOfTextBlock:atIndex:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSAttributedString", - b"rangeOfTextList:atIndex:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSAttributedString", - b"rangeOfTextTable:atIndex:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSAttributedString", - b"rulerAttributesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSAttributedString", b"size", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSBezierPath", - b"appendBezierPathWithArcFromPoint:toPoint:radius:", - {"arguments": {2: {"type": "{CGPoint=dd}"}, 3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:clockwise:", - {"arguments": {2: {"type": "{CGPoint=dd}"}, 6: {"type": "Z"}}}, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithGlyphs:count:inFont:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithOvalInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithPackedGlyphs:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^v", - "type_modifier": b"n", - "c_array_length_in_arg": 3, - } - } - }, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithPoints:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"appendBezierPathWithRoundedRect:xRadius:yRadius:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"bezierPathWithOvalInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"bezierPathWithRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"bezierPathWithRoundedRect:xRadius:yRadius:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"bounds", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSBezierPath", b"cachesBezierPath", {"retval": {"type": "Z"}}) - r( - b"NSBezierPath", - b"clipRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"containsPoint:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSBezierPath", - b"controlPointBounds", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSBezierPath", b"currentPoint", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSBezierPath", - b"curveToPoint:controlPoint1:controlPoint2:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSBezierPath", - b"drawPackedGlyphs:atPoint:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^v", - "type_modifier": b"n", - }, - 3: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSBezierPath", - b"elementAtIndex:associatedPoints:", - {"arguments": {3: {"type_modifier": b"o", "c_array_of_variable_length": True}}}, - ) - r( - b"NSBezierPath", - b"fillRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBezierPath", - b"getLineDash:count:phase:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 3}, - 3: {"type_modifier": b"N"}, - 4: {"type_modifier": b"o"}, - } - }, - ) - r(b"NSBezierPath", b"isEmpty", {"retval": {"type": "Z"}}) - r(b"NSBezierPath", b"lineToPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSBezierPath", b"moveToPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSBezierPath", - b"relativeCurveToPoint:controlPoint1:controlPoint2:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSBezierPath", - b"relativeLineToPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSBezierPath", - b"relativeMoveToPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSBezierPath", - b"setAssociatedPoints:atIndex:", - {"arguments": {2: {"c_array_of_variable_length": True}, 3: {"type": "q"}}}, - ) - r(b"NSBezierPath", b"setCachesBezierPath:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSBezierPath", - b"setLineDash:count:phase:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSBezierPath", - b"strokeLineFromPoint:toPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}, 3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSBezierPath", - b"strokeRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSBitmapImageRep", b"CGImage", {"retval": {"type": "^{CGImage=}"}}) - r( - b"NSBitmapImageRep", - b"bitmapData", - {"retval": {"type": "^v", "c_array_of_variable_length": True}}, - ) - r(b"NSBitmapImageRep", b"canBeCompressedUsing:", {"retval": {"type": "Z"}}) - r( - b"NSBitmapImageRep", - b"getBitmapDataPlanes:", - {"arguments": {2: {"type": "^*", "c_array_of_variable_length": True}}}, - ) - r( - b"NSBitmapImageRep", - b"getCompression:factor:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r( - b"NSBitmapImageRep", - b"getPixel:atX:y:", - {"arguments": {2: {"type_modifier": b"o", "c_array_of_variable_length": True}}}, - ) - r( - b"NSBitmapImageRep", - b"getTIFFCompressionTypes:count:", - { - "arguments": { - 2: {"type": "^^Q", "type_modifier": b"o", "c_array_length_in_arg": 3}, - 3: {"type": "^q", "type_modifier": b"o", "c_array_length_in_arg": 3}, - } - }, - ) - r( - b"NSBitmapImageRep", - b"incrementalLoadFromData:complete:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSBitmapImageRep", - b"initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:", - {"arguments": {2: {"type": "^*"}, 7: {"type": b"Z"}, 8: {"type": b"Z"}}}, - ) - r( - b"NSBitmapImageRep", - b"initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:", - {"arguments": {2: {"type": "^*"}, 7: {"type": b"Z"}, 8: {"type": b"Z"}}}, - ) - r( - b"NSBitmapImageRep", - b"initWithCGImage:", - {"arguments": {2: {"type": "^{CGImage=}"}}}, - ) - r( - b"NSBitmapImageRep", - b"initWithFocusedViewRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSBitmapImageRep", b"isPlanar", {"retval": {"type": "Z"}}) - r( - b"NSBitmapImageRep", - b"setPixel:atX:y:", - { - "arguments": { - 2: { - "type": "^Q", - "type_modifier": b"n", - "c_array_of_variable_length": True, - } - } - }, - ) - r(b"NSBox", b"borderRect", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r(b"NSBox", b"contentViewMargins", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSBox", b"isTransparent", {"retval": {"type": "Z"}}) - r(b"NSBox", b"setContentViewMargins:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r( - b"NSBox", - b"setFrameFromContentFrame:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSBox", b"setTransparent:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBox", b"titleRect", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r(b"NSBrowser", b"acceptsArrowKeys", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"allowsBranchSelection", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"allowsEmptySelection", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"allowsMultipleSelection", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"allowsTypeSelect", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"autohidesScroller", {"retval": {"type": "Z"}}) - r( - b"NSBrowser", - b"canDragRowsWithIndexes:inColumn:withEvent:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSBrowser", - b"draggingImageForRowsWithIndexes:inColumn:withEvent:offset:", - {"arguments": {5: {"type_modifier": b"N"}}}, - ) - r( - b"NSBrowser", - b"drawTitleOfColumn:inRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSBrowser", - b"editItemAtIndexPath:withEvent:select:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSBrowser", - b"frameOfColumn:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSBrowser", - b"frameOfInsideOfColumn:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSBrowser", - b"getRow:column:forPoint:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}, - }, - ) - r(b"NSBrowser", b"hasHorizontalScroller", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"isLeafItem:", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"isLoaded", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"isTitled", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"prefersAllColumnUserResizing", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"reusesColumns", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"sendAction", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"sendsActionOnArrowKeys", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"separatesColumns", {"retval": {"type": "Z"}}) - r(b"NSBrowser", b"setAcceptsArrowKeys:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBrowser", b"setAllowsBranchSelection:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBrowser", b"setAllowsEmptySelection:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSBrowser", - b"setAllowsMultipleSelection:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSBrowser", - b"setAllowsTypeSelect:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Z"}}}, - ) - r(b"NSBrowser", b"setAutohidesScroller:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBrowser", b"setDoubleAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r( - b"NSBrowser", - b"setDraggingSourceOperationMask:forLocal:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSBrowser", b"setHasHorizontalScroller:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBrowser", b"setPath:", {"retval": {"type": "Z"}}) - r( - b"NSBrowser", - b"setPrefersAllColumnUserResizing:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSBrowser", b"setReusesColumns:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBrowser", b"setSendsActionOnArrowKeys:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBrowser", b"setSeparatesColumns:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSBrowser", - b"setTakesTitleFromPreviousColumn:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSBrowser", b"setTitled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBrowser", b"takesTitleFromPreviousColumn", {"retval": {"type": "Z"}}) - r( - b"NSBrowser", - b"titleFrameOfColumn:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSBrowserCell", b"isLeaf", {"retval": {"type": "Z"}}) - r(b"NSBrowserCell", b"isLoaded", {"retval": {"type": "Z"}}) - r( - b"NSBrowserCell", - b"setLeaf:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSBrowserCell", - b"setLoaded:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSBundle", - b"loadNibFile:externalNameTable:withZone:", - {"retval": {"type": "Z"}, "arguments": {4: {"type": "^{_NSZone=}"}}}, - ) - r(b"NSBundle", b"loadNibNamed:owner:", {"retval": {"type": "Z"}}) - r( - b"NSBundle", - b"loadNibNamed:owner:topLevelObjects:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSButton", b"allowsMixedState", {"retval": {"type": "Z"}}) - r( - b"NSButton", - b"buttonWithImage:target:action:", - {"arguments": {4: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSButton", - b"buttonWithTitle:image:target:action:", - {"arguments": {5: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSButton", - b"buttonWithTitle:target:action:", - {"arguments": {4: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSButton", - b"checkboxWithTitle:target:action:", - {"arguments": {4: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSButton", - b"getPeriodicDelay:interval:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r(b"NSButton", b"hasDestructiveAction", {"retval": {"type": b"Z"}}) - r(b"NSButton", b"highlight:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSButton", b"imageHugsTitle", {"retval": {"type": "Z"}}) - r(b"NSButton", b"isBordered", {"retval": {"type": "Z"}}) - r(b"NSButton", b"isSpringLoaded", {"retval": {"type": b"Z"}}) - r(b"NSButton", b"isTransparent", {"retval": {"type": "Z"}}) - r(b"NSButton", b"performKeyEquivalent:", {"retval": {"type": "Z"}}) - r( - b"NSButton", - b"radioButtonWithTitle:target:action:", - {"arguments": {4: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSButton", b"setAllowsMixedState:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSButton", b"setBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSButton", b"setHasDestructiveAction:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSButton", b"setImageHugsTitle:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSButton", - b"setShowsBorderOnlyWhileMouseInside:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSButton", b"setSpringLoaded:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSButton", b"setTransparent:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSButton", b"showsBorderOnlyWhileMouseInside", {"retval": {"type": "Z"}}) - r( - b"NSButtonCell", - b"drawBezelWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSButtonCell", - b"drawImage:withFrame:inView:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSButtonCell", - b"drawTitle:withFrame:inView:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSButtonCell", - b"getPeriodicDelay:interval:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r(b"NSButtonCell", b"imageDimsWhenDisabled", {"retval": {"type": "Z"}}) - r(b"NSButtonCell", b"isOpaque", {"retval": {"type": "Z"}}) - r(b"NSButtonCell", b"isTransparent", {"retval": {"type": "Z"}}) - r(b"NSButtonCell", b"setImageDimsWhenDisabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSButtonCell", - b"setShowsBorderOnlyWhileMouseInside:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSButtonCell", b"setTransparent:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSButtonCell", b"showsBorderOnlyWhileMouseInside", {"retval": {"type": "Z"}}) - r( - b"NSButtonTouchBarItem", - b"buttonTouchBarItemWithIdentifier:image:target:action:", - {"arguments": {5: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSButtonTouchBarItem", - b"buttonTouchBarItemWithIdentifier:title:image:target:action:", - {"arguments": {6: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSButtonTouchBarItem", - b"buttonTouchBarItemWithIdentifier:title:target:action:", - {"arguments": {5: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSButtonTouchBarItem", b"isEnabled", {"retval": {"type": b"Z"}}) - r(b"NSButtonTouchBarItem", b"setEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSCachedImageRep", - b"initWithSize:depth:separate:alpha:", - {"arguments": {2: {"type": "{CGSize=dd}"}, 4: {"type": "Z"}, 5: {"type": "Z"}}}, - ) - r( - b"NSCachedImageRep", - b"initWithWindow:rect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCachedImageRep", - b"rect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSCandidateListTouchBarItem", b"allowsCollapsing", {"retval": {"type": "Z"}}) - r( - b"NSCandidateListTouchBarItem", - b"allowsTextInputContextCandidates", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCandidateListTouchBarItem", - b"attributedStringForCandidate", - { - "retval": { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - }, - } - } - }, - ) - r( - b"NSCandidateListTouchBarItem", - b"isCandidateListVisible", - {"retval": {"type": "Z"}}, - ) - r(b"NSCandidateListTouchBarItem", b"isCollapsed", {"retval": {"type": "Z"}}) - r( - b"NSCandidateListTouchBarItem", - b"setAllowsCollapsing:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCandidateListTouchBarItem", - b"setAllowsTextInputContextCandidates:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCandidateListTouchBarItem", - b"setAttributedStringForCandidate:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - }, - } - } - } - }, - ) - r( - b"NSCandidateListTouchBarItem", - b"setCandidateListVisible:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCandidateListTouchBarItem", - b"setCollapsed:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCandidateListTouchBarItem", - b"updateWithInsertionPointVisibility:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSCell", b"acceptsFirstResponder", {"retval": {"type": "Z"}}) - r(b"NSCell", b"action", {"retval": {"type": ":", "sel_of_type": b"v@:@"}}) - r(b"NSCell", b"allowsEditingTextAttributes", {"retval": {"type": "Z"}}) - r(b"NSCell", b"allowsMixedState", {"retval": {"type": "Z"}}) - r(b"NSCell", b"allowsUndo", {"retval": {"type": "Z"}}) - r( - b"NSCell", - b"calcDrawInfo:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSCell", b"cellSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSCell", - b"cellSizeForBounds:", - { - "retval": {"type": "{CGSize=dd}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSCell", - b"continueTracking:at:inView:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type": "{CGPoint=dd}"}, 3: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSCell", - b"drawInteriorWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCell", - b"drawWithExpansionFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCell", - b"drawWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCell", - b"drawingRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSCell", - b"editWithFrame:inView:editor:delegate:event:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCell", - b"expansionFrameWithFrame:inView:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSCell", - b"getPeriodicDelay:interval:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r(b"NSCell", b"hasValidObjectValue", {"retval": {"type": "Z"}}) - r( - b"NSCell", - b"highlight:withFrame:inView:", - { - "arguments": { - 2: {"type": "Z"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSCell", - b"highlightColorWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCell", - b"hitTestForEvent:inRect:ofView:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCell", - b"imageRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSCell", b"importsGraphics", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isBezeled", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isBordered", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isContinuous", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isEditable", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isEnabled", {"retval": {"type": "Z"}}) - r( - b"NSCell", - b"isEntryAcceptable:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "@"}}}, - ) - r(b"NSCell", b"isHighlighted", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isOpaque", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isScrollable", {"retval": {"type": "Z"}}) - r(b"NSCell", b"isSelectable", {"retval": {"type": "Z"}}) - r( - b"NSCell", - b"menuForEvent:inRect:ofView:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSCell", b"prefersTrackingUntilMouseUp", {"retval": {"type": b"Z"}}) - r(b"NSCell", b"refusesFirstResponder", {"retval": {"type": "Z"}}) - r( - b"NSCell", - b"resetCursorRect:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCell", - b"selectWithFrame:inView:editor:delegate:start:length:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSCell", b"sendsActionOnEndEditing", {"retval": {"type": "Z"}}) - r(b"NSCell", b"setAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r(b"NSCell", b"setAllowsEditingTextAttributes:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setAllowsMixedState:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setAllowsUndo:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSCell", - b"setAttributedStringValue:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "@"}}}, - ) - r(b"NSCell", b"setBezeled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setContinuous:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSCell", - b"setFloatingPointFormat:left:right:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSCell", b"setHighlighted:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setImportsGraphics:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setRefusesFirstResponder:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setScrollable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setSelectable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setSendsActionOnEndEditing:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setShowsFirstResponder:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setTruncatesLastVisibleLine:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setUsesSingleLineMode:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"setWraps:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCell", b"showsFirstResponder", {"retval": {"type": "Z"}}) - r( - b"NSCell", - b"startTrackingAt:inView:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSCell", - b"stopTracking:at:inView:mouseIsUp:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGPoint=dd}"}, - 5: {"type": "Z"}, - } - }, - ) - r( - b"NSCell", - b"titleRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSCell", - b"trackMouse:inRect:ofView:untilMouseUp:", - { - "retval": {"type": "Z"}, - "arguments": { - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "Z"}, - }, - }, - ) - r(b"NSCell", b"truncatesLastVisibleLine", {"retval": {"type": "Z"}}) - r(b"NSCell", b"usesSingleLineMode", {"retval": {"type": "Z"}}) - r(b"NSCell", b"wantsNotificationForMarkedText", {"retval": {"type": "Z"}}) - r(b"NSCell", b"wraps", {"retval": {"type": "Z"}}) - r(b"NSClipView", b"automaticallyAdjustsContentInsets", {"retval": {"type": b"Z"}}) - r(b"NSClipView", b"autoscroll:", {"retval": {"type": "Z"}}) - r(b"NSClipView", b"copiesOnScroll", {"retval": {"type": "Z"}}) - r( - b"NSClipView", - b"documentRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSClipView", - b"documentVisibleRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSClipView", b"drawsBackground", {"retval": {"type": "Z"}}) - r( - b"NSClipView", - b"onstrainScrollPoint:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r(b"NSClipView", b"scrollToPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSClipView", - b"setAutomaticallyAdjustsContentInsets:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSClipView", b"setCopiesOnScroll:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSClipView", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCollectionLayoutAnchor", b"isAbsoluteOffset", {"retval": {"type": b"Z"}}) - r(b"NSCollectionLayoutAnchor", b"isFractionalOffset", {"retval": {"type": b"Z"}}) - r( - b"NSCollectionLayoutBoundarySupplementaryItem", - b"extendsBoundary", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSCollectionLayoutBoundarySupplementaryItem", - b"pinToVisibleBounds", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSCollectionLayoutBoundarySupplementaryItem", - b"setExtendsBoundary:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSCollectionLayoutBoundarySupplementaryItem", - b"setPinToVisibleBounds:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSCollectionLayoutDimension", b"isAbsolute", {"retval": {"type": b"Z"}}) - r(b"NSCollectionLayoutDimension", b"isEstimated", {"retval": {"type": b"Z"}}) - r(b"NSCollectionLayoutDimension", b"isFractionalHeight", {"retval": {"type": b"Z"}}) - r(b"NSCollectionLayoutDimension", b"isFractionalWidth", {"retval": {"type": b"Z"}}) - r( - b"NSCollectionLayoutGroup", - b"customGroupWithLayoutSize:itemProvider:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSCollectionLayoutSection", - b"initWithSectionProvider:configuration:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"q"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSCollectionLayoutSection", - b"setSupplementariesFollowContentInsets:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSCollectionLayoutSection", - b"setVisibleItemsInvalidationHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{CGPoint=dd}"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSCollectionLayoutSection", - b"supplementariesFollowContentInsets", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSCollectionLayoutSection", - b"visibleItemsInvalidationHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{CGPoint=dd}"}, - 3: {"type": b"@"}, - }, - } - } - }, - ) - r(b"NSCollectionLayoutSpacing", b"isFixedSpacing", {"retval": {"type": b"Z"}}) - r(b"NSCollectionLayoutSpacing", b"isFlexibleSpacing", {"retval": {"type": b"Z"}}) - r(b"NSCollectionView", b"allowsEmptySelection", {"retval": {"type": "Z"}}) - r(b"NSCollectionView", b"allowsMultipleSelection", {"retval": {"type": "Z"}}) - r( - b"NSCollectionView", - b"backgroundViewScrollsWithContent", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionView", - b"draggingImageForItemsAtIndexPaths:withEvent:offset:", - {"arguments": {4: {"type_modifier": b"N"}}}, - ) - r( - b"NSCollectionView", - b"draggingImageForItemsAtIndexes:withEvent:offset:", - {"arguments": {4: {"type_modifier": b"N"}}}, - ) - r( - b"NSCollectionView", - b"frameForItemAtIndex:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSCollectionView", b"isFirstResponder", {"retval": {"type": "Z"}}) - r(b"NSCollectionView", b"isSelectable", {"retval": {"type": "Z"}}) - r(b"NSCollectionView", b"maxItemSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSCollectionView", b"minItemSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSCollectionView", - b"performBatchUpdates:completionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - }, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - }, - } - }, - ) - r( - b"NSCollectionView", - b"setAllowsEmptySelection:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCollectionView", - b"setAllowsMultipleSelection:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCollectionView", - b"setBackgroundViewScrollsWithContent:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCollectionView", - b"setDraggingSourceOperationMask:forLocal:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSCollectionView", - b"setMaxItemSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSCollectionView", - b"setMinItemSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSCollectionView", b"setSelectable:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSCollectionViewCompositionalLayout", - b"initWithSectionProvider:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"q"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSCollectionViewCompositionalLayout", - b"initWithSectionProvider:configuration:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"q"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSCollectionViewDiffableDataSource", - b"applySnapshot:animatingDifferences:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSCollectionViewDiffableDataSource", - b"initWithCollectionView:itemProvider:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"q"}, - }, - } - } - } - }, - ) - r( - b"NSCollectionViewDiffableDataSource", - b"setSupplementaryViewProvider:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSCollectionViewDiffableDataSource", - b"supplementaryViewProvider", - { - "retval": { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - }, - ) - r( - b"NSCollectionViewFlowLayout", - b"invalidateFlowLayoutDelegateMetrics", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewFlowLayout", - b"sectionAtIndexIsCollapsed:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewFlowLayout", - b"sectionFootersPinToVisibleBounds", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewFlowLayout", - b"sectionHeadersPinToVisibleBounds", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewFlowLayout", - b"setSectionFootersPinToVisibleBounds:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCollectionViewFlowLayout", - b"setSectionHeadersPinToVisibleBounds:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCollectionViewFlowLayout", - b"shouldInvalidateLayoutForBoundsChange:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewFlowLayoutInvalidationContext", - b"invalidateFlowLayoutAttributes", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewFlowLayoutInvalidationContext", - b"invalidateFlowLayoutDelegateMetrics", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewFlowLayoutInvalidationContext", - b"setInvalidateFlowLayoutAttributes:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCollectionViewFlowLayoutInvalidationContext", - b"setInvalidateFlowLayoutDelegateMetrics:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSCollectionViewItem", b"isSelected", {"retval": {"type": "Z"}}) - r(b"NSCollectionViewItem", b"setSelected:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSCollectionViewLayout", - b"shouldInvalidateLayoutForBoundsChange:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewLayout", - b"shouldInvalidateLayoutForPreferredLayoutAttributes:withOriginalAttributes:", - {"retval": {"type": "Z"}}, - ) - r(b"NSCollectionViewLayoutAttributes", b"isHidden", {"retval": {"type": "Z"}}) - r( - b"NSCollectionViewLayoutAttributes", - b"setHidden:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSCollectionViewLayoutInvalidationContext", - b"invalidateDataSourceCounts", - {"retval": {"type": "Z"}}, - ) - r( - b"NSCollectionViewLayoutInvalidationContext", - b"invalidateEverything", - {"retval": {"type": "Z"}}, - ) - r( - b"NSColor", - b"colorWithColorSpace:components:count:", - {"arguments": {3: {"type_modifier": b"n", "c_array_length_in_arg": 4}}}, - ) - r( - b"NSColor", - b"colorWithName:dynamicProvider:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSColor", - b"drawSwatchInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSColor", - b"getComponents:", - { - "arguments": { - 2: { - "type": "^d", - "type_modifier": b"o", - "c_array_of_variable_length": True, - } - } - }, - ) - r( - b"NSColor", - b"getCyan:magenta:yellow:black:alpha:", - { - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - 5: {"type_modifier": b"o"}, - 6: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSColor", - b"getHue:saturation:brightness:alpha:", - { - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - 5: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSColor", - b"getRed:green:blue:alpha:", - { - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - 5: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSColor", - b"getWhite:alpha:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r(b"NSColor", b"ignoresAlpha", {"retval": {"type": b"Z"}}) - r(b"NSColor", b"setIgnoresAlpha:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSColorList", b"isEditable", {"retval": {"type": "Z"}}) - r(b"NSColorList", b"writeToFile:", {"retval": {"type": "Z"}}) - r( - b"NSColorList", - b"writeToURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSColorPanel", b"dragColor:withEvent:fromView:", {"retval": {"type": "Z"}}) - r(b"NSColorPanel", b"isContinuous", {"retval": {"type": "Z"}}) - r(b"NSColorPanel", b"setAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r(b"NSColorPanel", b"setContinuous:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSColorPanel", b"setShowsAlpha:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSColorPanel", b"sharedColorPanelExists", {"retval": {"type": b"Z"}}) - r(b"NSColorPanel", b"showsAlpha", {"retval": {"type": "Z"}}) - r(b"NSColorPicker", b"minContentSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSColorPickerTouchBarItem", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSColorPickerTouchBarItem", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSColorPickerTouchBarItem", - b"setShowsAlpha:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSColorPickerTouchBarItem", b"showsAlpha", {"retval": {"type": "Z"}}) - r( - b"NSColorSampler", - b"showSamplerWithSelectionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSColorSpace", b"CGColorSpace", {"retval": {"type": "^{CGColorSpace=}"}}) - r( - b"NSColorSpace", - b"colorSyncProfile", - {"retval": {"type": "^{OpaqueCMProfileRef=}"}}, - ) - r( - b"NSColorSpace", - b"initWithCGColorSpace:", - {"arguments": {2: {"type": "^{CGColorSpace=}"}}}, - ) - r( - b"NSColorSpace", - b"initWithColorSyncProfile:", - {"arguments": {2: {"type": "^{OpaqueCMProfileRef=}"}}}, - ) - r(b"NSColorWell", b"activate:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSColorWell", - b"drawWellInside:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSColorWell", b"isActive", {"retval": {"type": "Z"}}) - r(b"NSColorWell", b"isBordered", {"retval": {"type": "Z"}}) - r(b"NSColorWell", b"setBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSColorWell", b"setSupportsAlpha:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSColorWell", b"supportsAlpha", {"retval": {"type": b"Z"}}) - r(b"NSComboBox", b"completes", {"retval": {"type": "Z"}}) - r(b"NSComboBox", b"hasVerticalScroller", {"retval": {"type": "Z"}}) - r(b"NSComboBox", b"intercellSpacing", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSComboBox", b"isButtonBordered", {"retval": {"type": "Z"}}) - r(b"NSComboBox", b"setButtonBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSComboBox", b"setCompletes:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSComboBox", b"setHasVerticalScroller:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSComboBox", - b"setIntercellSpacing:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSComboBox", b"setUsesDataSource:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSComboBox", b"usesDataSource", {"retval": {"type": "Z"}}) - r(b"NSComboBoxCell", b"completes", {"retval": {"type": "Z"}}) - r(b"NSComboBoxCell", b"hasVerticalScroller", {"retval": {"type": "Z"}}) - r(b"NSComboBoxCell", b"intercellSpacing", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSComboBoxCell", b"isButtonBordered", {"retval": {"type": "Z"}}) - r(b"NSComboBoxCell", b"setButtonBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSComboBoxCell", b"setCompletes:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSComboBoxCell", b"setHasVerticalScroller:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSComboBoxCell", - b"setIntercellSpacing:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSComboBoxCell", b"setUsesDataSource:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSComboBoxCell", b"usesDataSource", {"retval": {"type": "Z"}}) - r( - b"NSComboButton", - b"comboButtonWithImage:menu:target:action:", - {"arguments": {5: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSComboButton", - b"comboButtonWithTitle:image:menu:target:action:", - {"arguments": {6: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSComboButton", - b"comboButtonWithTitle:menu:target:action:", - {"arguments": {5: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSControl", b"abortEditing", {"retval": {"type": "Z"}}) - r(b"NSControl", b"action", {"retval": {"type": ":", "sel_of_type": b"v@:@"}}) - r(b"NSControl", b"allowsExpansionToolTips", {"retval": {"type": b"Z"}}) - r(b"NSControl", b"ignoresMultiClick", {"retval": {"type": "Z"}}) - r( - b"NSControl", - b"initWithFrame:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSControl", b"isContinuous", {"retval": {"type": "Z"}}) - r(b"NSControl", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSControl", b"isHighlighted", {"retval": {"type": b"Z"}}) - r(b"NSControl", b"refusesFirstResponder", {"retval": {"type": "Z"}}) - r( - b"NSControl", - b"sendAction:to:", - {"retval": {"type": "Z"}, "arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSControl", b"setAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r(b"NSControl", b"setAllowsExpansionToolTips:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSControl", b"setContinuous:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSControl", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSControl", - b"setFloatingPointFormat:left:right:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSControl", b"setHighlighted:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSControl", b"setIgnoresMultiClick:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSControl", b"setRefusesFirstResponder:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSControl", b"setUsesSingleLineMode:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSControl", b"usesSingleLineMode", {"retval": {"type": b"Z"}}) - r(b"NSController", b"commitEditing", {"retval": {"type": "Z"}}) - r( - b"NSController", - b"commitEditingWithDelegate:didCommitSelector:contextInfo:", - {"arguments": {3: {"type": ":", "sel_of_type": b"v@:@Z^v"}, 4: {"type": "^v"}}}, - ) - r(b"NSController", b"isEditing", {"retval": {"type": "Z"}}) - r(b"NSCursor", b"hotSpot", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSCursor", - b"initWithImage:foregroundColorHint:backgroundColorHint:hotSpot:", - {"arguments": {5: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSCursor", - b"initWithImage:hotSpot:", - {"arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSCursor", b"isSetOnMouseEntered", {"retval": {"type": "Z"}}) - r(b"NSCursor", b"isSetOnMouseExited", {"retval": {"type": "Z"}}) - r(b"NSCursor", b"setHiddenUntilMouseMoves:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCursor", b"setOnMouseEntered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSCursor", b"setOnMouseExited:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSCustomImageRep", - b"drawingHandler", - { - "retval": { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - } - } - }, - ) - r( - b"NSCustomImageRep", - b"initWithDrawSelector:delegate:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSCustomImageRep", - b"initWithSize:flipped:drawingHandler:", - { - "arguments": { - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - } - }, - } - }, - ) - r(b"NSDatePicker", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSDatePicker", b"isBezeled", {"retval": {"type": "Z"}}) - r(b"NSDatePicker", b"isBordered", {"retval": {"type": "Z"}}) - r(b"NSDatePicker", b"presentsCalendarOverlay", {"retval": {"type": "Z"}}) - r(b"NSDatePicker", b"setBezeled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSDatePicker", b"setBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSDatePicker", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSDatePicker", - b"setPresentsCalendarOverlay:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSDatePickerCell", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSDatePickerCell", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSDictionaryControllerKeyValuePair", - b"isExplicitlyIncluded", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSDockTile", - b"performActivityWithSynchronousWaiting:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSDockTile", b"setShowsApplicationBadge:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSDockTile", b"showsApplicationBadge", {"retval": {"type": "Z"}}) - r(b"NSDockTile", b"size", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSDocument", - b"accommodatePresentedItemDeletionWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSDocument", b"allowsDocumentSharing", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:", - {"arguments": {3: {"sel_of_type": b"v@:@Z^v"}, 4: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"autosaveWithImplicitCancellability:completionHandler:", - { - "arguments": { - 2: {"type": b"Z"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r(b"NSDocument", b"autosavesDrafts", {"retval": {"type": b"Z"}}) - r(b"NSDocument", b"autosavesInPlace", {"retval": {"type": b"Z"}}) - r(b"NSDocument", b"autosavingIsImplicitlyCancellable", {"retval": {"type": b"Z"}}) - r( - b"NSDocument", - b"canAsynchronouslyWriteToURL:ofType:forSaveOperation:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSDocument", - b"canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:", - {"arguments": {3: {"sel_of_type": b"v@:@Z^v"}, 4: {"type": "^v"}}}, - ) - r(b"NSDocument", b"canConcurrentlyReadDocumentsOfType:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"checkAutosavingSafetyAndReturnError:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"continueActivityUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"continueAsynchronousWorkOnMainThreadUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSDocument", b"dataOfType:error:", {"arguments": {3: {"type_modifier": b"o"}}}) - r( - b"NSDocument", - b"duplicateAndReturnError:", - {"arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:", - {"arguments": {3: {"sel_of_type": b"v@Z^v"}, 4: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"fileNameExtensionWasHiddenInLastRunSavePanel", - {"retval": {"type": "Z"}}, - ) - r( - b"NSDocument", - b"fileWrapperOfType:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"hasUnautosavedChanges", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"hasUndoManager", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"initForURL:withContentsOfURL:ofType:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"initWithContentsOfURL:ofType:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"initWithType:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"isBrowsingVersions", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"isDocumentEdited", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"isDraft", {"retval": {"type": b"Z"}}) - r(b"NSDocument", b"isEntireFileLoaded", {"retval": {"type": b"Z"}}) - r(b"NSDocument", b"isInViewingMode", {"retval": {"type": b"Z"}}) - r(b"NSDocument", b"isLocked", {"retval": {"type": b"Z"}}) - r(b"NSDocument", b"isNativeType:", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"keepBackupFile", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"loadDataRepresentation:ofType:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"loadFileWrapperRepresentation:ofType:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSDocument", - b"lockDocumentWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"lockWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"moveDocumentWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"moveToURL:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"performActivityWithSynchronousWaiting:usingBlock:", - { - "arguments": { - 2: {"type": b"Z"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - }, - } - }, - ) - r( - b"NSDocument", - b"performAsynchronousFileAccessUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": {0: {"type": "^v"}}, - }, - "type": b"@?", - }, - }, - } - } - } - }, - ) - r( - b"NSDocument", - b"performSynchronousFileAccessUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSDocument", b"preparePageLayout:", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"prepareSavePanel:", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"presentError:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": b"v@:Z^v"}, 6: {"type": "^v"}}}, - ) - r(b"NSDocument", b"preservesVersions", {"retval": {"type": b"Z"}}) - r( - b"NSDocument", - b"printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:", - { - "arguments": { - 3: {"type": "Z"}, - 5: {"sel_of_type": b"v@:@Z^v"}, - 6: {"type": "^v"}, - } - }, - ) - r( - b"NSDocument", - b"printOperationWithSettings:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"printShowingPrintPanel:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSDocument", - b"readFromData:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"readFromFile:ofType:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"readFromFileWrapper:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"readFromURL:ofType:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"readFromURL:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"relinquishPresentedItemToReader:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": {0: {"type": "^v"}}, - }, - "type": b"@?", - }, - }, - } - } - } - }, - ) - r( - b"NSDocument", - b"relinquishPresentedItemToWriter:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": {0: {"type": "^v"}}, - }, - "type": b"@?", - }, - }, - } - } - } - }, - ) - r( - b"NSDocument", - b"restoreDocumentWindowWithIdentifier:state:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSDocument", - b"revertToContentsOfURL:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"revertToSavedFromFile:ofType:", {"retval": {"type": "Z"}}) - r(b"NSDocument", b"revertToSavedFromURL:ofType:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": b"v@:@Z^v"}, 5: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"runModalPrintOperation:delegate:didRunSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": b"v@:@Z^v"}, 5: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": b"v@:@Z^v"}, 5: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"saveDocumentWithDelegate:didSaveSelector:contextInfo:", - {"arguments": {3: {"sel_of_type": b"v@:@Z^v"}, 4: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"savePresentedItemChangesWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": b"v@:@Z^v"}, 6: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"saveToURL:ofType:forSaveOperation:completionHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:", - {"arguments": {6: {"sel_of_type": b"v@:@Z^v"}, 7: {"type": "^v"}}}, - ) - r( - b"NSDocument", - b"saveToURL:ofType:forSaveOperation:error:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"setDraft:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSDocument", b"setHasUndoManager:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSDocument", - b"shareDocumentWithSharingService:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r(b"NSDocument", b"shouldChangePrintInfo:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": b"v@:@Z^v"}, 5: {"type": "^v"}}}, - ) - r(b"NSDocument", b"shouldRunSavePanelWithAccessoryView", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"stopBrowsingVersionsWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"unlockDocumentWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSDocument", - b"unlockWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSDocument", b"usesUbiquitousStorage", {"retval": {"type": b"Z"}}) - r(b"NSDocument", b"validateUserInterfaceItem:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"writeSafelyToURL:ofType:forSaveOperation:error:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSDocument", b"writeToFile:ofType:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"writeToFile:ofType:originalFile:saveOperation:", - {"retval": {"type": "Z"}}, - ) - r(b"NSDocument", b"writeToURL:ofType:", {"retval": {"type": "Z"}}) - r( - b"NSDocument", - b"writeToURL:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"writeToURL:ofType:forSaveOperation:originalContentsURL:error:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocument", - b"writeWithBackupToFile:ofType:saveOperation:", - {"retval": {"type": "Z"}}, - ) - r(b"NSDocumentController", b"allowsAutomaticShareMenu", {"retval": {"type": "Z"}}) - r( - b"NSDocumentController", - b"beginOpenPanel:forTypes:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSDocumentController", - b"beginOpenPanelWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSDocumentController", - b"closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo:", - {"arguments": {3: {"sel_of_type": b"v@:@Z^v"}, 4: {"type": "^v"}}}, - ) - r( - b"NSDocumentController", - b"duplicateDocumentWithContentsOfURL:copying:displayName:error:", - {"arguments": {3: {"type": b"Z"}, 5: {"type_modifier": b"o"}}}, - ) - r(b"NSDocumentController", b"hasEditedDocuments", {"retval": {"type": "Z"}}) - r( - b"NSDocumentController", - b"makeDocumentForURL:withContentsOfURL:ofType:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocumentController", - b"makeDocumentWithContentsOfURL:ofType:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocumentController", - b"makeUntitledDocumentOfType:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocumentController", - b"openDocumentWithContentsOfFile:display:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSDocumentController", - b"openDocumentWithContentsOfURL:display:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSDocumentController", - b"openDocumentWithContentsOfURL:display:completionHandler:", - { - "arguments": { - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r( - b"NSDocumentController", - b"openDocumentWithContentsOfURL:display:error:", - {"arguments": {3: {"type": "Z"}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocumentController", - b"openUntitledDocumentAndDisplay:error:", - {"arguments": {2: {"type": "Z"}, 3: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocumentController", - b"openUntitledDocumentOfType:display:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSDocumentController", b"presentError:", {"retval": {"type": "Z"}}) - r( - b"NSDocumentController", - b"presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": b"v@:Z^v"}, 6: {"type": "^v"}}}, - ) - r( - b"NSDocumentController", - b"reopenDocumentForURL:withContentsOfURL:display:completionHandler:", - { - "arguments": { - 4: {"type": b"Z"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Z"}, - 3: {"type": b"@"}, - }, - } - }, - } - }, - ) - r( - b"NSDocumentController", - b"reopenDocumentForURL:withContentsOfURL:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDocumentController", - b"reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSelector:contextInfo:", - { - "arguments": { - 3: {"type": "Z"}, - 5: {"sel_of_type": b"v@:@Z^v"}, - 6: {"type": "^v"}, - } - }, - ) - r( - b"NSDocumentController", - b"setAllowsAutomaticShareMenu:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSDocumentController", b"setShouldCreateUI:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSDocumentController", b"shouldCreateUI", {"retval": {"type": "Z"}}) - r( - b"NSDocumentController", - b"typeForContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSDocumentController", b"validateUserInterfaceItem:", {"retval": {"type": "Z"}}) - r( - b"NSDraggingItem", - b"imageComponentsProvider", - { - "retval": { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r( - b"NSDraggingItem", - b"setImageComponentsProvider:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSDraggingSession", - b"animatesToStartingPositionsOnCancelOrFail", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSDraggingSession", - b"enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:", - { - "arguments": { - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - 3: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"NSDraggingSession", - b"setAnimatesToStartingPositionsOnCancelOrFail:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSDrawer", b"contentSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSDrawer", - b"initWithContentSize:preferredEdge:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSDrawer", b"maxContentSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSDrawer", b"minContentSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSDrawer", b"setContentSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSDrawer", b"setMaxContentSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSDrawer", b"setMinContentSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r( - b"NSEPSImageRep", - b"boundingBox", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSEvent", b"CGEvent", {"retval": {"type": "^{__CGEvent=}"}}) - r( - b"NSEvent", - b"addGlobalMonitorForEventsMatchingMask:handler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSEvent", - b"addLocalMonitorForEventsMatchingMask:handler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSEvent", - b"enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:", - {"arguments": {3: {"type": "{CGPoint=dd}"}, 10: {"type": "^v"}}}, - ) - r(b"NSEvent", b"eventRef", {"retval": {"type": "r^{OpaqueEventRef=}"}}) - r(b"NSEvent", b"eventWithCGEvent:", {"arguments": {2: {"type": "^{__CGEvent=}"}}}) - r( - b"NSEvent", - b"eventWithEventRef:", - {"arguments": {2: {"type": "^{OpaqueEventRef=}"}}}, - ) - r(b"NSEvent", b"hasPreciseScrollingDeltas", {"retval": {"type": b"Z"}}) - r(b"NSEvent", b"isARepeat", {"retval": {"type": "Z"}}) - r(b"NSEvent", b"isDirectionInvertedFromDevice", {"retval": {"type": b"Z"}}) - r(b"NSEvent", b"isEnteringProximity", {"retval": {"type": "Z"}}) - r(b"NSEvent", b"isMouseCoalescingEnabled", {"retval": {"type": "Z"}}) - r(b"NSEvent", b"isSwipeTrackingFromScrollEventsEnabled", {"retval": {"type": b"Z"}}) - r( - b"NSEvent", - b"keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:", - {"arguments": {3: {"type": "{CGPoint=dd}"}, 10: {"type": "Z"}}}, - ) - r(b"NSEvent", b"locationInWindow", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSEvent", - b"mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:", - {"arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSEvent", b"mouseLocation", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSEvent", - b"otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:", - {"arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSEvent", b"setMouseCoalescingEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSEvent", b"tilt", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSEvent", - b"trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"d"}, - 2: {"type": b"Q"}, - 3: {"type": b"Z"}, - 4: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r(b"NSEvent", b"userData", {"retval": {"type": "^v"}}) - r( - b"NSFilePromiseReceiver", - b"receivePromisedFilesAtDestination:options:operationQueue:reader:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSFileWrapper", - b"initWithURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSFileWrapper", b"isDirectory", {"retval": {"type": "Z"}}) - r(b"NSFileWrapper", b"isRegularFile", {"retval": {"type": "Z"}}) - r(b"NSFileWrapper", b"isSymbolicLink", {"retval": {"type": "Z"}}) - r(b"NSFileWrapper", b"matchesContentsOfURL:", {"retval": {"type": "Z"}}) - r(b"NSFileWrapper", b"needsToBeUpdatedFromPath:", {"retval": {"type": "Z"}}) - r( - b"NSFileWrapper", - b"readFromURL:options:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSFileWrapper", b"updateFromPath:", {"retval": {"type": "Z"}}) - r( - b"NSFileWrapper", - b"writeToFile:atomically:updateFilenames:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}, 4: {"type": "Z"}}}, - ) - r( - b"NSFileWrapper", - b"writeToURL:options:originalContentsURL:error:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSFont", b"advancementForGlyph:", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSFont", - b"boundingRectForFont", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSFont", - b"boundingRectForGlyph:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSFont", - b"fontWithName:matrix:", - {"arguments": {3: {"c_array_of_fixed_length": 6, "type_modifier": b"n"}}}, - ) - r( - b"NSFont", - b"getAdvancements:forCGGlyphs:count:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSFont", - b"getAdvancements:forGlyphs:count:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSFont", - b"getAdvancements:forPackedGlyphs:length:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 4}, - 3: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - "c_array_length_in_arg": 4, - }, - } - }, - ) - r( - b"NSFont", - b"getBoundingRects:forCGGlyphs:count:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSFont", - b"getBoundingRects:forGlyphs:count:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r(b"NSFont", b"glyphIsEncoded:", {"retval": {"type": "Z"}}) - r(b"NSFont", b"isBaseFont", {"retval": {"type": "Z"}}) - r(b"NSFont", b"isFixedPitch", {"retval": {"type": "Z"}}) - r(b"NSFont", b"isVertical", {"retval": {"type": b"Z"}}) - r(b"NSFont", b"matrix", {"retval": {"c_array_of_fixed_length": 6}}) - r(b"NSFont", b"maximumAdvancement", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSFont", - b"positionOfGlyph:forCharacter:struckOverRect:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": { - 3: {"type": "S"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSFont", - b"positionOfGlyph:precededByGlyph:isNominal:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {4: {"type": "^Z", "type_modifier": b"o"}}, - }, - ) - r( - b"NSFont", - b"positionOfGlyph:struckOverGlyph:metricsExist:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {4: {"type": "^Z", "type_modifier": b"o"}}, - }, - ) - r( - b"NSFont", - b"positionOfGlyph:struckOverRect:metricsExist:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": { - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "^Z", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSFont", - b"positionOfGlyph:withRelation:toBaseGlyph:totalAdvancement:metricsExist:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": { - 5: {"type_modifier": b"o"}, - 6: {"type": "^Z", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSFont", - b"positionsForCompositeSequence:numberOfGlyphs:pointArray:", - { - "arguments": { - 2: {"type_modifier": b"n", "c_array_length_in_arg": 3}, - 4: {"type_modifier": b"o", "c_array_length_in_arg": 3}, - } - }, - ) - r( - b"NSFontAssetRequest", - b"downloadFontAssetsWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSFontCollection", - b"hideFontCollectionWithName:visibility:error:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFontCollection", - b"renameFontCollectionWithName:visibility:toName:error:", - {"retval": {"type": b"Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSFontCollection", - b"showFontCollection:withName:visibility:error:", - {"retval": {"type": b"Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSFontDescriptor", b"requiresFontAssetRequest", {"retval": {"type": "Z"}}) - r( - b"NSFontDescriptor", - b"setRequiresFontAssetRequest:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSFontManager", b"addCollection:options:", {"retval": {"type": "Z"}}) - r(b"NSFontManager", b"convertWeight:ofFont:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSFontManager", b"fontMenu:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSFontManager", b"fontNamed:hasTraits:", {"retval": {"type": "Z"}}) - r(b"NSFontManager", b"fontPanel:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSFontManager", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSFontManager", b"isMultiple", {"retval": {"type": "Z"}}) - r(b"NSFontManager", b"removeCollection:", {"retval": {"type": "Z"}}) - r(b"NSFontManager", b"sendAction", {"retval": {"type": "Z"}}) - r(b"NSFontManager", b"setAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r(b"NSFontManager", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSFontManager", - b"setSelectedAttributes:isMultiple:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSFontManager", - b"setSelectedFont:isMultiple:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSFontPanel", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSFontPanel", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSFontPanel", b"setPanelFont:isMultiple:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSFontPanel", b"setWorksWhenModal:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSFontPanel", b"sharedFontPanelExists", {"retval": {"type": "Z"}}) - r(b"NSFontPanel", b"worksWhenModal", {"retval": {"type": "Z"}}) - r(b"NSForm", b"setBezeled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSForm", b"setBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSForm", b"setFrameSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSFormCell", b"isOpaque", {"retval": {"type": "Z"}}) - r(b"NSFormCell", b"titleWidth:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r( - b"NSGestureRecognizer", - b"canBePreventedByGestureRecognizer:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSGestureRecognizer", - b"canPreventGestureRecognizer:", - {"retval": {"type": b"Z"}}, - ) - r(b"NSGestureRecognizer", b"delaysKeyEvents", {"retval": {"type": b"Z"}}) - r(b"NSGestureRecognizer", b"delaysMagnificationEvents", {"retval": {"type": b"Z"}}) - r( - b"NSGestureRecognizer", - b"delaysOtherMouseButtonEvents", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSGestureRecognizer", - b"delaysPrimaryMouseButtonEvents", - {"retval": {"type": b"Z"}}, - ) - r(b"NSGestureRecognizer", b"delaysRotationEvents", {"retval": {"type": b"Z"}}) - r( - b"NSGestureRecognizer", - b"delaysSecondaryMouseButtonEvents", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSGestureRecognizer", - b"initWithTarget:action:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSGestureRecognizer", b"isEnabled", {"retval": {"type": b"Z"}}) - r( - b"NSGestureRecognizer", - b"setAction:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSGestureRecognizer", - b"setDelaysKeyEvents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSGestureRecognizer", - b"setDelaysMagnificationEvents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSGestureRecognizer", - b"setDelaysOtherMouseButtonEvents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSGestureRecognizer", - b"setDelaysPrimaryMouseButtonEvents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSGestureRecognizer", - b"setDelaysRotationEvents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSGestureRecognizer", - b"setDelaysSecondaryMouseButtonEvents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSGestureRecognizer", b"setEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSGestureRecognizer", - b"shouldBeRequiredToFailByGestureRecognizer:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSGestureRecognizer", - b"shouldRequireFailureOfGestureRecognizer:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSGlyphGenerator", - b"generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}}, - ) - r( - b"NSGradient", - b"drawFromCenter:radius:toCenter:radius:options:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "d"}, - 4: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSGradient", - b"drawFromPoint:toPoint:options:", - {"arguments": {2: {"type": "{CGPoint=dd}"}, 3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSGradient", - b"drawInBezierPath:relativeCenterPosition:", - {"arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSGradient", - b"drawInRect:angle:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSGradient", - b"drawInRect:relativeCenterPosition:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSGradient", - b"getColor:location:atIndex:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r( - b"NSGradient", - b"initWithColors:atLocations:colorSpace:", - {"arguments": {3: {"type_modifier": b"n", "c_array_length_in_arg": 2}}}, - ) - r( - b"NSGradient", - b"initWithColorsAndLocations:", - {"suggestion": "use initWithColors:atLocation:colorSpace:", "variadic": True}, - ) - r(b"NSGraphicsContext", b"currentContextDrawingToScreen", {"retval": {"type": "Z"}}) - r(b"NSGraphicsContext", b"focusStack", {"retval": {"type": "^v"}}) - r( - b"NSGraphicsContext", - b"graphicsContextWithCGContext:flipped:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSGraphicsContext", - b"graphicsContextWithGraphicsPort:flipped:", - {"arguments": {2: {"type": "^{CGContext=}"}, 3: {"type": "Z"}}}, - ) - r(b"NSGraphicsContext", b"graphicsPort", {"retval": {"type": "^{CGContext=}"}}) - r(b"NSGraphicsContext", b"isDrawingToScreen", {"retval": {"type": "Z"}}) - r(b"NSGraphicsContext", b"isFlipped", {"retval": {"type": "Z"}}) - r(b"NSGraphicsContext", b"patternPhase", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSGraphicsContext", b"setFocusStack:", {"arguments": {2: {"type": "^v"}}}) - r( - b"NSGraphicsContext", - b"setPatternPhase:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSGraphicsContext", b"setShouldAntialias:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSGraphicsContext", b"shouldAntialias", {"retval": {"type": "Z"}}) - r(b"NSGridColumn", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSGridColumn", b"setHidden:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSGridRow", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSGridRow", b"setHidden:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSGridView", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSGridView", b"setHidden:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSGroupTouchBarItem", b"prefersEqualWidths", {"retval": {"type": "Z"}}) - r( - b"NSGroupTouchBarItem", - b"setPrefersEqualWidths:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSHelpManager", b"isContextHelpModeActive", {"retval": {"type": "Z"}}) - r(b"NSHelpManager", b"registerBooksInBundle:", {"retval": {"type": b"Z"}}) - r(b"NSHelpManager", b"setContextHelpModeActive:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSHelpManager", - b"showContextHelpForObject:locationHint:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSImage", - b"CGImageForProposedRect:context:hints:", - { - "arguments": { - 2: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"o"} - } - }, - ) - r( - b"NSImage", - b"alignmentRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSImage", - b"bestRepresentationForRect:context:hints:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSImage", b"cacheDepthMatchesImageDepth", {"retval": {"type": "Z"}}) - r(b"NSImage", b"canInitWithPasteboard:", {"retval": {"type": "Z"}}) - r( - b"NSImage", - b"compositeToPoint:fromRect:operation:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSImage", - b"compositeToPoint:fromRect:operation:fraction:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSImage", - b"compositeToPoint:operation:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSImage", - b"compositeToPoint:operation:fraction:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSImage", - b"dissolveToPoint:fraction:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSImage", - b"dissolveToPoint:fromRect:fraction:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSImage", - b"drawAtPoint:fromRect:operation:fraction:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSImage", - b"drawInRect:fromRect:operation:fraction:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSImage", - b"drawInRect:fromRect:operation:fraction:respectFlipped:hints:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "Z"}, - }, - }, - ) - r( - b"NSImage", - b"drawRepresentation:inRect:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSImage", - b"hitTestRect:withImageDestinationRect:context:hints:flipped:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "Z"}, - }, - }, - ) - r( - b"NSImage", - b"hitTestRect:withImageDestinationRect:context_hints:flipped:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSImage", - b"imageWithSize:flipped:drawingHandler:", - { - "arguments": { - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - } - }, - } - }, - ) - r(b"NSImage", b"initWithCGImage:size:", {"arguments": {3: {"type": "{CGSize=dd}"}}}) - r( - b"NSImage", - b"initWithIconRef:", - {"arguments": {2: {"type": "^{OpaqueIconRef=}"}}}, - ) - r(b"NSImage", b"initWithSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSImage", b"isCachedSeparately", {"retval": {"type": "Z"}}) - r(b"NSImage", b"isDataRetained", {"retval": {"type": "Z"}}) - r(b"NSImage", b"isFlipped", {"retval": {"type": "Z"}}) - r(b"NSImage", b"isTemplate", {"retval": {"type": "Z"}}) - r(b"NSImage", b"isValid", {"retval": {"type": "Z"}}) - r(b"NSImage", b"lockFocusFlipped:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"matchesOnMultipleResolution", {"retval": {"type": "Z"}}) - r(b"NSImage", b"matchesOnlyOnBestFittingAxis", {"retval": {"type": b"Z"}}) - r(b"NSImage", b"prefersColorMatch", {"retval": {"type": "Z"}}) - r(b"NSImage", b"scalesWhenResized", {"retval": {"type": "Z"}}) - r( - b"NSImage", - b"setAlignmentRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSImage", b"setCacheDepthMatchesImageDepth:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"setCachedSeparately:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"setDataRetained:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"setFlipped:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"setMatchesOnMultipleResolution:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSImage", - b"setMatchesOnlyOnBestFittingAxis:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSImage", b"setName:", {"retval": {"type": "Z"}}) - r(b"NSImage", b"setPrefersColorMatch:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"setScalesWhenResized:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"setSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSImage", b"setTemplate:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"setUsesEPSOnResolutionMismatch:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImage", b"size", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSImage", b"usesEPSOnResolutionMismatch", {"retval": {"type": "Z"}}) - r( - b"NSImageRep", - b"CGImageForProposedRect:context:hints:", - { - "arguments": { - 2: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"} - } - }, - ) - r(b"NSImageRep", b"canInitWithData:", {"retval": {"type": "Z"}}) - r(b"NSImageRep", b"canInitWithPasteboard:", {"retval": {"type": "Z"}}) - r(b"NSImageRep", b"draw", {"retval": {"type": "Z"}}) - r( - b"NSImageRep", - b"drawAtPoint:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSImageRep", - b"drawInRect:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSImageRep", - b"drawInRect:fromRect:operation:fraction:respectFlipped:hints:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "Z"}, - }, - }, - ) - r(b"NSImageRep", b"hasAlpha", {"retval": {"type": "Z"}}) - r(b"NSImageRep", b"isOpaque", {"retval": {"type": "Z"}}) - r(b"NSImageRep", b"setAlpha:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImageRep", b"setOpaque:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImageRep", b"setSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSImageRep", b"size", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSImageView", - b"addSymbolEffect:options:animated:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r(b"NSImageView", b"allowsCutCopyPaste", {"retval": {"type": "Z"}}) - r(b"NSImageView", b"animates", {"retval": {"type": "Z"}}) - r(b"NSImageView", b"isEditable", {"retval": {"type": "Z"}}) - r( - b"NSImageView", - b"removeAllSymbolEffectsWithOptions:animated:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSImageView", - b"removeSymbolEffectOfType:options:animated:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r(b"NSImageView", b"setAllowsCutCopyPaste:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImageView", b"setAnimates:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSImageView", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSInputManager", b"handleMouseEvent:", {"retval": {"type": "Z"}}) - r( - b"NSInputManager", - b"markedTextSelectionChanged:client:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSInputManager", - b"wantsToDelayTextChangeNotifications", - {"retval": {"type": "Z"}}, - ) - r(b"NSInputManager", b"wantsToHandleMouseEvents", {"retval": {"type": "Z"}}) - r(b"NSInputManager", b"wantsToInterpretAllKeystrokes", {"retval": {"type": "Z"}}) - r( - b"NSItemProvider", - b"loadItemForTypeIdentifier:options:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"loadObjectOfClass:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"registerCloudKitShareWithPreparationHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - 3: {"type": "@"}, - }, - }, - "type": b"@?", - }, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"registerItemForTypeIdentifier:loadHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "args": { - 0: {"type": "^@"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - }, - "retval": {"type": "v"}, - }, - "type": b"@?", - }, - 2: {"type": b"#"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"NSLayoutAnchor", b"hasAmbiguousLayout", {"retval": {"type": b"Z"}}) - r(b"NSLayoutConstraint", b"isActive", {"retval": {"type": b"Z"}}) - r(b"NSLayoutConstraint", b"setActive:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSLayoutConstraint", - b"setShouldBeArchived:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSLayoutConstraint", b"shouldBeArchived", {"retval": {"type": b"Z"}}) - r(b"NSLayoutGuide", b"hasAmbiguousLayout", {"retval": {"type": "Z"}}) - r( - b"NSLayoutManager", - b"CGGlyphAtIndex:isValidIndex:", - {"arguments": {3: {"type": "^Z", "type_modifier": b"o"}}}, - ) - r( - b"NSLayoutManager", - b"addTemporaryAttribute:value:forCharacterRange:", - {"arguments": {4: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"addTemporaryAttributes:forCharacterRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSLayoutManager", b"allowsNonContiguousLayout", {"retval": {"type": "Z"}}) - r( - b"NSLayoutManager", - b"attachmentSizeForGlyphAtIndex:", - {"retval": {"type": "{CGSize=dd}"}}, - ) - r(b"NSLayoutManager", b"backgroundLayoutEnabled", {"retval": {"type": "Z"}}) - r( - b"NSLayoutManager", - b"boundingRectForGlyphRange:inTextContainer:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSLayoutManager", - b"boundsRectForTextBlock:atIndex:effectiveRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {4: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSLayoutManager", - b"boundsRectForTextBlock:glyphRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSLayoutManager", - b"characterIndexForPoint:inTextContainer:fractionOfDistanceBetweenInsertionPoints:", - {"arguments": {2: {"type": "{CGPoint=dd}"}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSLayoutManager", - b"characterRangeForGlyphRange:actualGlyphRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSLayoutManager", - b"deleteGlyphsInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"drawBackgroundForGlyphRange:atPoint:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSLayoutManager", - b"drawGlyphsForGlyphRange:atPoint:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSLayoutManager", - b"drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 5: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "{_NSRange=QQ}"}, - 7: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 5: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "{_NSRange=QQ}"}, - 7: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"drawsOutsideLineFragmentForGlyphAtIndex:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSLayoutManager", - b"ensureGlyphsForCharacterRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"ensureGlyphsForGlyphRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"ensureLayoutForBoundingRect:inTextContainer:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSLayoutManager", - b"ensureLayoutForCharacterRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"ensureLayoutForGlyphRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"enumerateEnclosingRectsForGlyphRange:withinSelectedGlyphRange:inTextContainer:usingBlock:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 2: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"NSLayoutManager", - b"enumerateLineFragmentsForGlyphRange:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 2: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"@"}, - 4: {"type": b"{_NSRange=QQ}"}, - 5: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"NSLayoutManager", - b"extraLineFragmentRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSLayoutManager", - b"extraLineFragmentUsedRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSLayoutManager", - b"fillBackgroundRectArray:count:forCharacterRange:color:", - { - "arguments": { - 2: { - "type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", - "type_modifier": b"N", - "c_array_length_in_arg": 3, - }, - 4: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"fractionOfDistanceThroughGlyphForPoint:inTextContainer:", - {"retval": {"type": "d"}, "arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSLayoutManager", - b"getFirstUnlaidCharacterIndex:glyphIndex:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r( - b"NSLayoutManager", - b"getGlyphs:range:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 3}, - 3: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 4: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 5: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 6: {"type": "^Z", "type_modifier": b"o", "c_array_length_in_arg": 2}, - } - }, - ) - r( - b"NSLayoutManager", - b"getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 4: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 5: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 6: {"type": "^Z", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 7: {"type": "^C", "type_modifier": b"o", "c_array_length_in_arg": 2}, - } - }, - ) - r( - b"NSLayoutManager", - b"getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels:", - { - "arguments": { - 3: {"type": "^I", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 4: {"type": "^I", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 5: {"type": "^I", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 6: {"type": "^I", "type_modifier": b"o", "c_array_length_in_arg": 2}, - } - }, - ) - r( - b"NSLayoutManager", - b"getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes:", - { - "arguments": { - 3: {"type": "Z"}, - 4: {"type": "Z"}, - 5: {"type": "r^d", "type_modifier": b"o"}, - 6: {"type": "^Q", "type_modifier": b"o"}, - } - }, - ) - r( - b"NSLayoutManager", - b"glyphAtIndex:isValidIndex:", - {"arguments": {3: {"type": "^Z", "type_modifier": b"o"}}}, - ) - r( - b"NSLayoutManager", - b"glyphIndexForPoint:inTextContainer:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSLayoutManager", - b"glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 4: {"null_accepted": False, "type_modifier": b"o"}, - } - }, - ) - r( - b"NSLayoutManager", - b"glyphRangeForBoundingRect:inTextContainer:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSLayoutManager", - b"glyphRangeForBoundingRectWithoutAdditionalLayout:inTextContainer:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSLayoutManager", - b"glyphRangeForCharacterRange:actualCharacterRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSLayoutManager", - b"glyphRangeForTextContainer:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r(b"NSLayoutManager", b"hasNonContiguousLayout", {"retval": {"type": "Z"}}) - r( - b"NSLayoutManager", - b"insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:", - { - "arguments": { - 2: {"type": "^I", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSLayoutManager", - b"invalidateDisplayForCharacterRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"invalidateDisplayForGlyphRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - } - }, - ) - r( - b"NSLayoutManager", - b"invalidateGlyphsOnLayoutInvalidationForGlyphRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"invalidateLayoutForCharacterRange:actualCharacterRange:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - } - }, - ) - r( - b"NSLayoutManager", - b"invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type": "Z"}, - 4: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - } - }, - ) - r(b"NSLayoutManager", b"isValidGlyphIndex:", {"retval": {"type": "Z"}}) - r( - b"NSLayoutManager", - b"layoutManagerOwnsFirstResponderInWindow:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSLayoutManager", - b"layoutRectForTextBlock:atIndex:effectiveRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {4: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}}, - }, - ) - r( - b"NSLayoutManager", - b"layoutRectForTextBlock:glyphRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSLayoutManager", - b"limitsLayoutForSuspiciousContents", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSLayoutManager", - b"lineFragmentRectForGlyphAtIndex:effectiveRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}}, - }, - ) - r( - b"NSLayoutManager", - b"lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type_modifier": b"o"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSLayoutManager", - b"lineFragmentUsedRectForGlyphAtIndex:effectiveRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSLayoutManager", - b"lineFragmentUsedRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type_modifier": b"o"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSLayoutManager", - b"locationForGlyphAtIndex:", - {"retval": {"type": "{CGPoint=dd}"}}, - ) - r( - b"NSLayoutManager", - b"notShownAttributeForGlyphAtIndex:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSLayoutManager", - b"rangeOfNominallySpacedGlyphsContainingIndex:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSLayoutManager", - b"rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount:", - { - "retval": {"c_array_length_in_arg": 5}, - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type": "{_NSRange=QQ}"}, - 5: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSLayoutManager", - b"rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:", - { - "retval": {"c_array_length_in_arg": 5}, - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type": "{_NSRange=QQ}"}, - 5: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSLayoutManager", - b"removeTemporaryAttribute:forCharacterRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:", - {"arguments": {5: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"setAllowsNonContiguousLayout:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"setAttachmentSize:forGlyphRange:", - {"arguments": {2: {"type": "{CGSize=dd}"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"setBackgroundLayoutEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"setBoundsRect:forTextBlock:glyphRange:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"setDrawsOutsideLineFragment:forGlyphAtIndex:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"setExtraLineFragmentRect:usedRect:textContainer:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"setGlyphs:properties:characterIndexes:font:forGlyphRange:", - { - "arguments": { - 2: {"type_modifier": b"n", "c_array_length_in_arg": 6}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 6}, - 4: {"type_modifier": b"n", "c_array_length_in_arg": 6}, - } - }, - ) - r( - b"NSLayoutManager", - b"setLayoutRect:forTextBlock:glyphRange:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"setLimitsLayoutForSuspiciousContents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSLayoutManager", - b"setLineFragmentRect:forGlyphRange:usedRect:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"setLocation:forStartOfGlyphRange:", - {"arguments": {2: {"type": "{CGPoint=dd}"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"setLocations:startingGlyphIndexes:count:forGlyphRange:", - { - "arguments": { - 2: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 5: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"setNotShownAttribute:forGlyphAtIndex:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"setShowsControlCharacters:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"setShowsInvisibleCharacters:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"setTemporaryAttributes:forCharacterRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"setTextContainer:forGlyphRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"setUsesDefaultHyphenation:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSLayoutManager", b"setUsesFontLeading:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSLayoutManager", b"setUsesScreenFonts:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSLayoutManager", - b"showAttachmentCell:inRect:characterIndex:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSLayoutManager", - b"showCGGlyphs:positions:count:font:matrix:attributes:inContext:", - { - "arguments": { - 2: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSLayoutManager", - b"showCGGlyphs:positions:count:font:textMatrix:attributes:inContext:", - { - "arguments": { - 2: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSLayoutManager", - b"showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^v", - "type_modifier": b"n", - "c_array_length_in_arg": 3, - }, - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "{CGPoint=dd}"}, - 8: {"type": "{CGSize=dd}"}, - } - }, - ) - r(b"NSLayoutManager", b"showsControlCharacters", {"retval": {"type": "Z"}}) - r(b"NSLayoutManager", b"showsInvisibleCharacters", {"retval": {"type": "Z"}}) - r( - b"NSLayoutManager", - b"strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "{_NSRange=QQ}"}, - 6: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"temporaryAttribute:atCharacterIndex:effectiveRange:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSLayoutManager", - b"temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"temporaryAttributesAtCharacterIndex:effectiveRange:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSLayoutManager", - b"temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:", - {"arguments": {3: {"type_modifier": b"o"}, 4: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSLayoutManager", - b"textContainerForGlyphAtIndex:effectiveRange:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSLayoutManager", - b"textContainerForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", - {"arguments": {3: {"type_modifier": b"o"}, 4: {"type": "Z"}}}, - ) - r( - b"NSLayoutManager", - b"textStorage:edited:range:changeInLength:invalidatedRange:", - { - "arguments": { - 3: {"type": "Q"}, - 4: {"type": "{_NSRange=QQ}"}, - 6: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "{_NSRange=QQ}"}, - 6: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSLayoutManager", - b"usedRectForTextContainer:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSLayoutManager", b"usesDefaultHyphenation", {"retval": {"type": b"Z"}}) - r(b"NSLayoutManager", b"usesFontLeading", {"retval": {"type": "Z"}}) - r(b"NSLayoutManager", b"usesScreenFonts", {"retval": {"type": "Z"}}) - r(b"NSLevelIndicator", b"drawsTieredCapacityLevels", {"retval": {"type": "Z"}}) - r(b"NSLevelIndicator", b"isEditable", {"retval": {"type": "Z"}}) - r( - b"NSLevelIndicator", - b"rectOfTickMarkAtIndex:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSLevelIndicator", - b"setDrawsTieredCapacityLevels:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSLevelIndicator", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSLevelIndicatorCell", - b"rectOfTickMarkAtIndex:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSMatrix", b"acceptsFirstMouse:", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"allowsEmptySelection", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"autorecalculatesCellSize", {"retval": {"type": b"Z"}}) - r(b"NSMatrix", b"autosizesCells", {"retval": {"type": "Z"}}) - r( - b"NSMatrix", - b"cellFrameAtRow:column:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSMatrix", b"cellSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSMatrix", b"context:", {"arguments": {2: {"type": "^v"}}}) - r(b"NSMatrix", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"drawsCellBackground", {"retval": {"type": "Z"}}) - r( - b"NSMatrix", - b"getNumberOfRows:columns:", - {"arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}}, - ) - r( - b"NSMatrix", - b"getRow:column:forPoint:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type": "{CGPoint=dd}"}, - }, - }, - ) - r( - b"NSMatrix", - b"getRow:column:ofCell:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type_modifier": b"o"}, 3: {"type_modifier": b"o"}}, - }, - ) - r(b"NSMatrix", b"highlightCell:atRow:column:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSMatrix", - b"initWithFrame:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMatrix", - b"initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMatrix", - b"initWithFrame:mode:prototype:numberOfRows:numberOfColumns:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSMatrix", b"intercellSpacing", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSMatrix", b"isAutoscroll", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"isSelectionByRect", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"performKeyEquivalent:", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"selectCellWithTag:", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"sendAction", {"retval": {"type": "Z"}}) - r( - b"NSMatrix", - b"sendAction:to:forAllCells:", - {"arguments": {2: {"sel_of_type": b"Z@:@"}, 4: {"type": "Z"}}}, - ) - r(b"NSMatrix", b"setAllowsEmptySelection:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMatrix", b"setAutorecalculatesCellSize:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSMatrix", b"setAutoscroll:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMatrix", b"setAutosizesCells:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMatrix", b"setCellSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSMatrix", b"setDoubleAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r(b"NSMatrix", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMatrix", b"setDrawsCellBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMatrix", b"setIntercellSpacing:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSMatrix", b"setScrollable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMatrix", b"setSelectionByRect:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSMatrix", - b"setSelectionFrom:to:anchor:highlight:", - {"arguments": {5: {"type": "Z"}}}, - ) - r(b"NSMatrix", b"setTabKeyTraversesCells:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMatrix", b"setValidateSize:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSMatrix", - b"sortUsingFunction:context:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - }, - 3: {"type": "@"}, - } - }, - ) - r(b"NSMatrix", b"sortUsingSelector:", {"arguments": {2: {"sel_of_type": b"q@:@"}}}) - r(b"NSMatrix", b"tabKeyTraversesCells", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"textShouldBeginEditing:", {"retval": {"type": "Z"}}) - r(b"NSMatrix", b"textShouldEndEditing:", {"retval": {"type": "Z"}}) - r(b"NSMediaLibraryBrowserController", b"isVisible", {"retval": {"type": b"Z"}}) - r( - b"NSMediaLibraryBrowserController", - b"setVisible:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSMenu", - b"addItemWithTitle:action:keyEquivalent:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSMenu", b"allowsContextMenuPlugIns", {"retval": {"type": "Z"}}) - r(b"NSMenu", b"autoenablesItems", {"retval": {"type": "Z"}}) - r( - b"NSMenu", - b"indexOfItemWithTarget:andAction:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSMenu", - b"insertItemWithTitle:action:keyEquivalent:atIndex:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSMenu", b"isAttached", {"retval": {"type": "Z"}}) - r(b"NSMenu", b"isTornOff", {"retval": {"type": "Z"}}) - r(b"NSMenu", b"locationForSubmenu:", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSMenu", b"menuBarVisible", {"retval": {"type": "Z"}}) - r(b"NSMenu", b"menuChangedMessagesEnabled", {"retval": {"type": "Z"}}) - r(b"NSMenu", b"menuZone", {"retval": {"type": "^{_NSZone=}"}}) - r( - b"NSMenu", - b"paletteMenuWithColors:titles:selectionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSMenu", - b"paletteMenuWithColors:titles:templateImage:selectionHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSMenu", b"performKeyEquivalent:", {"retval": {"type": "Z"}}) - r( - b"NSMenu", - b"popUpMenuPositioningItem:atLocation:inView:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSMenu", b"setAllowsContextMenuPlugIns:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenu", b"setAutoenablesItems:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenu", b"setMenuBarVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenu", b"setMenuChangedMessagesEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenu", b"setMenuZone:", {"arguments": {2: {"type": "^{_NSZone=}"}}}) - r(b"NSMenu", b"setShowsStateColumn:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenu", b"showsStateColumn", {"retval": {"type": "Z"}}) - r( - b"NSMenuItem", - b"allowsAutomaticKeyEquivalentLocalization", - {"retval": {"type": "Z"}}, - ) - r( - b"NSMenuItem", - b"allowsAutomaticKeyEquivalentMirroring", - {"retval": {"type": "Z"}}, - ) - r(b"NSMenuItem", b"allowsKeyEquivalentWhenHidden", {"retval": {"type": "Z"}}) - r(b"NSMenuItem", b"hasSubmenu", {"retval": {"type": "Z"}}) - r( - b"NSMenuItem", - b"initWithTitle:action:keyEquivalent:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSMenuItem", b"isAlternate", {"retval": {"type": "Z"}}) - r(b"NSMenuItem", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSMenuItem", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSMenuItem", b"isHiddenOrHasHiddenAncestor", {"retval": {"type": "Z"}}) - r(b"NSMenuItem", b"isHighlighted", {"retval": {"type": "Z"}}) - r(b"NSMenuItem", b"isSectionHeader", {"retval": {"type": b"Z"}}) - r(b"NSMenuItem", b"isSeparatorItem", {"retval": {"type": "Z"}}) - r(b"NSMenuItem", b"setAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r( - b"NSMenuItem", - b"setAllowsAutomaticKeyEquivalentLocalization:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSMenuItem", - b"setAllowsAutomaticKeyEquivalentMirroring:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSMenuItem", - b"setAllowsKeyEquivalentWhenHidden:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSMenuItem", b"setAlternate:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenuItem", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenuItem", b"setHidden:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenuItem", b"setUsesUserKeyEquivalents:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSMenuItem", b"usesUserKeyEquivalents", {"retval": {"type": b"Z"}}) - r( - b"NSMenuItemCell", - b"drawBorderAndBackgroundWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMenuItemCell", - b"drawImageWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMenuItemCell", - b"drawKeyEquivalentWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMenuItemCell", - b"drawSeparatorItemWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMenuItemCell", - b"drawStateImageWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMenuItemCell", - b"drawTitleWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMenuItemCell", - b"keyEquivalentRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSMenuItemCell", b"keyEquivalentWidth", {"retval": {"type": "d"}}) - r(b"NSMenuItemCell", b"needsDisplay", {"retval": {"type": "Z"}}) - r(b"NSMenuItemCell", b"needsSizing", {"retval": {"type": "Z"}}) - r(b"NSMenuItemCell", b"setNeedsDisplay:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenuItemCell", b"setNeedsSizing:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSMenuItemCell", - b"stateImageRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSMenuItemCell", - b"titleRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSMenuToolbarItem", b"setShowsIndicator:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSMenuToolbarItem", b"showsIndicator", {"retval": {"type": b"Z"}}) - r( - b"NSMenuView", - b"indexOfItemAtPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSMenuView", - b"initWithFrame:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSMenuView", - b"innerRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSMenuView", b"isAttached", {"retval": {"type": "Z"}}) - r(b"NSMenuView", b"isHorizontal", {"retval": {"type": "Z"}}) - r(b"NSMenuView", b"isTornOff", {"retval": {"type": "Z"}}) - r(b"NSMenuView", b"locationForSubmenu:", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSMenuView", b"needsSizing", {"retval": {"type": "Z"}}) - r( - b"NSMenuView", - b"rectOfItemAtIndex:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSMenuView", b"setHorizontal:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMenuView", b"setNeedsSizing:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSMenuView", - b"setWindowFrameForAttachingToRect:onScreen:preferredEdge:popUpSelectedItem:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSMenuView", b"trackWithEvent:", {"retval": {"type": "Z"}}) - r(b"NSMovie", b"QTMovie", {"retval": {"type": "^^{MovieType}"}}) - r(b"NSMovie", b"canInitWithPasteboard:", {"retval": {"type": "Z"}}) - r(b"NSMovie", b"initWithMovie:", {"arguments": {2: {"type": "^^{MovieType}"}}}) - r(b"NSMovie", b"initWithURL:byReference:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSMovieView", b"isControllerVisible", {"retval": {"type": "Z"}}) - r(b"NSMovieView", b"isEditable", {"retval": {"type": "Z"}}) - r(b"NSMovieView", b"isMuted", {"retval": {"type": "Z"}}) - r(b"NSMovieView", b"isPlaying", {"retval": {"type": "Z"}}) - r( - b"NSMovieView", - b"movieController", - {"retval": {"type": "^{ComponentInstanceRecord=[1l]}"}}, - ) - r( - b"NSMovieView", - b"movieRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSMovieView", b"playsEveryFrame", {"retval": {"type": "Z"}}) - r(b"NSMovieView", b"playsSelectionOnly", {"retval": {"type": "Z"}}) - r(b"NSMovieView", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMovieView", b"setMuted:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMovieView", b"setPlaysEveryFrame:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSMovieView", b"setPlaysSelectionOnly:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSMovieView", - b"showController:adjustingSize:", - {"arguments": {2: {"type": "Z"}, 3: {"type": "Z"}}}, - ) - r(b"NSMovieView", b"sizeForMagnification:", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSMutableAttributedString", - b"applyFontTraits:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"fixAttachmentAttributeInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"fixAttributesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"fixFontAttributeInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"fixParagraphStyleAttributeInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"readFromData:options:documentAttributes:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSMutableAttributedString", - b"readFromData:options:documentAttributes:error:", - { - "retval": {"type": "Z"}, - "arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSMutableAttributedString", - b"readFromURL:options:documentAttributes:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSMutableAttributedString", - b"readFromURL:options:documentAttributes:error:", - { - "retval": {"type": "Z"}, - "arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSMutableAttributedString", - b"setAlignment:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"setBaseWritingDirection:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"subscriptRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"superscriptRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"unscriptRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableParagraphStyle", - b"allowsDefaultTighteningForTruncation", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSMutableParagraphStyle", - b"setAllowsDefaultTighteningForTruncation:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSMutableParagraphStyle", - b"setUsesDefaultHyphenation:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSMutableParagraphStyle", b"usesDefaultHyphenation", {"retval": {"type": b"Z"}}) - r(b"NSNib", b"instantiateNibWithExternalNameTable:", {"retval": {"type": "Z"}}) - r( - b"NSNib", - b"instantiateNibWithOwner:topLevelObjects:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSNib", - b"instantiateWithOwner:topLevelObjects:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSObject", - b"accessibilityActionDescription:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"accessibilityActionNames", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityActivationPoint", - {"required": True, "retval": {"type": b"{CGPoint=dd}"}}, - ) - r( - b"NSObject", - b"accessibilityAllowedValues", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityApplicationFocusedUIElement", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityArrayAttributeCount:", - {"retval": {"type": b"Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilityArrayAttributeValues:index:maxCount:", - { - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"Q"}, 4: {"type": b"Q"}}, - }, - ) - r(b"NSObject", b"accessibilityAttributeNames", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityAttributeValue:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilityAttributeValue:forParameter:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilityAttributedStringForRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityAttributedUserInputLabels", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityCancelButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityCellForColumn:row:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"q"}, 3: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"accessibilityChildren", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityChildrenInNavigationOrder", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityClearButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityCloseButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityColumnCount", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityColumnHeaderUIElements", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityColumnIndexRange", - {"required": True, "retval": {"type": b"{_NSRange=QQ}"}}, - ) - r( - b"NSObject", - b"accessibilityColumnTitles", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityColumns", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityContents", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityCriticalValue", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityCustomActions", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityCustomRotors", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityDecrementButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityDefaultButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityDisclosedByRow", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityDisclosedRows", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityDisclosureLevel", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityDocument", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityElementWithToken:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilityExtrasMenuBar", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityFilename", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityFocusedUIElement", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityFocusedWindow", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityFrame", - {"required": True, "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSObject", - b"accessibilityFrameForRange:", - { - "required": True, - "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityFullScreenButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityGrowArea", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityHandles", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityHeader", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityHeaderGroup", - {"required": False, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityHelp", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityHitTest:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSObject", - b"accessibilityHorizontalScrollBar", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityHorizontalUnitDescription", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityHorizontalUnits", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityIdentifier", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityIncrementButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityIndex", {"required": True, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"accessibilityIndexOfChild:", - {"retval": {"type": b"Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilityInsertionPointLineNumber", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityIsAttributeSettable:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"accessibilityIsIgnored", {"retval": {"type": "Z"}}) - r(b"NSObject", b"accessibilityLabel", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityLabelUIElements", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityLabelValue", - {"required": True, "retval": {"type": b"f"}}, - ) - r( - b"NSObject", - b"accessibilityLayoutPointForScreenPoint:", - { - "required": True, - "retval": {"type": b"{CGPoint=dd}"}, - "arguments": {2: {"type": b"{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityLayoutSizeForScreenSize:", - { - "required": True, - "retval": {"type": b"{CGSize=dd}"}, - "arguments": {2: {"type": b"{CGSize=dd}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityLineForIndex:", - {"required": True, "retval": {"type": b"q"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"accessibilityLinkedUIElements", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMainWindow", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMarkerGroupUIElement", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMarkerTypeDescription", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMarkerUIElements", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMarkerValues", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMaxValue", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMenuBar", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMinValue", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityMinimizeButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityName", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityNextContents", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityNotifiesWhenDestroyed", {"retval": {"type": b"Z"}}) - r( - b"NSObject", - b"accessibilityNumberOfCharacters", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityOrientation", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityOverflowButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityParameterizedAttributeNames", - {"retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityParent", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityPerformAction:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilityPerformCancel", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformConfirm", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformDecrement", - {"required": False, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformDelete", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformIncrement", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformPick", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformPress", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformRaise", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformShowAlternateUI", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformShowDefaultUI", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPerformShowMenu", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"accessibilityPlaceholderValue", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityPreviousContents", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityProxy", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityRTFForRange:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityRangeForIndex:", - { - "required": True, - "retval": {"type": b"{_NSRange=QQ}"}, - "arguments": {2: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"accessibilityRangeForLine:", - { - "required": True, - "retval": {"type": b"{_NSRange=QQ}"}, - "arguments": {2: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"accessibilityRangeForPosition:", - { - "required": True, - "retval": {"type": b"{_NSRange=QQ}"}, - "arguments": {2: {"type": b"{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityRangeInTargetElementWithToken:", - { - "required": False, - "retval": {"type": b"{_NSRange=QQ}"}, - "arguments": {2: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"accessibilityRole", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityRoleDescription", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityRowCount", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityRowHeaderUIElements", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityRowIndexRange", - {"required": True, "retval": {"type": b"{_NSRange=QQ}"}}, - ) - r(b"NSObject", b"accessibilityRows", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityRulerMarkerType", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityScreenPointForLayoutPoint:", - { - "required": True, - "retval": {"type": b"{CGPoint=dd}"}, - "arguments": {2: {"type": b"{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityScreenSizeForLayoutSize:", - { - "required": True, - "retval": {"type": b"{CGSize=dd}"}, - "arguments": {2: {"type": b"{CGSize=dd}"}}, - }, - ) - r( - b"NSObject", - b"accessibilitySearchButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySearchMenu", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySelectedCells", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySelectedChildren", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySelectedColumns", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySelectedRows", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySelectedText", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySelectedTextRange", - {"required": True, "retval": {"type": b"{_NSRange=QQ}"}}, - ) - r( - b"NSObject", - b"accessibilitySelectedTextRanges", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityServesAsTitleForUIElements", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySetOverrideValue:forAttribute:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilitySetValue:forAttribute:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"accessibilitySharedCharacterRange", - {"required": True, "retval": {"type": b"{_NSRange=QQ}"}}, - ) - r( - b"NSObject", - b"accessibilitySharedFocusElements", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySharedTextUIElements", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityShownMenu", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilitySortDirection", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilitySplitters", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityStringForRange:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"accessibilityStyleRangeForIndex:", - { - "required": True, - "retval": {"type": b"{_NSRange=QQ}"}, - "arguments": {2: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"accessibilitySubrole", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityTabs", {"required": True, "retval": {"type": b"@"}}) - r(b"NSObject", b"accessibilityTitle", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityTitleUIElement", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityToolbarButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityTopLevelUIElement", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityURL", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityUnitDescription", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityUnits", {"required": True, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"accessibilityUserInputLabels", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityValue", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityValueDescription", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityVerticalScrollBar", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityVerticalUnitDescription", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityVerticalUnits", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"accessibilityVisibleCells", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityVisibleCharacterRange", - {"required": False, "retval": {"type": b"{_NSRange=QQ}"}}, - ) - r( - b"NSObject", - b"accessibilityVisibleChildren", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityVisibleColumns", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityVisibleRows", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityWarningValue", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"accessibilityWindow", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"accessibilityWindows", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"accessibilityZoomButton", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"action", {"required": True, "retval": {"type": ":"}}) - r( - b"NSObject", - b"activeCompressionOptions", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"activeConversationChanged:toNewConversation:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"activeConversationWillChange:fromOldConversation:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"addAnnotations:range:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"adjustedRangeFromRange:forEditingTextSelection:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"Z"}}, - }, - ) - r( - b"NSObject", - b"alertShowHelp:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"allowsMultipleSelection", - {"required": False, "retval": {"type": b"Z"}}, - ) - r(b"NSObject", b"alpha", {"required": True, "retval": {"type": b"d"}}) - r( - b"NSObject", - b"alphaControlAddedOrRemoved:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"anchoringViewForSharingService:showRelativeToRect:preferredEdge:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": b"^Q"}, - }, - }, - ) - r( - b"NSObject", - b"animateDismissalOfViewController:fromViewController:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"animatePresentationOfViewController:fromViewController:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"animatesToDestination", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"animation:didReachProgressMark:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "f"}}, - }, - ) - r( - b"NSObject", - b"animation:valueForProgress:", - { - "required": False, - "retval": {"type": "f"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "f"}}, - }, - ) - r( - b"NSObject", - b"animationDidEnd:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"animationDidStop:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"animationForKey:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"animationShouldStart:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"animations", {"required": True, "retval": {"type": b"@"}}) - r(b"NSObject", b"animator", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"annotatedSubstringForProposedRange:actualRange:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - }, - ) - r(b"NSObject", b"appearance", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"application:continueUserActivity:restorationHandler:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"application:delegateHandlesKey:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:didDecodeRestorableState:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:didFailToContinueUserActivityWithType:error:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:didFailToRegisterForRemoteNotificationsWithError:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:didReceiveRemoteNotification:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:didRegisterForRemoteNotificationsWithDeviceToken:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:didUpdateUserActivity:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:handlerForIntent:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:openFile:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:openFileWithoutUI:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:openFiles:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:openTempFile:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:openURLs:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:printFile:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"application:printFiles:", {"retval": {"type": "v"}}) - r( - b"NSObject", - b"application:printFiles:withSettings:showPrintPanels:", - { - "required": False, - "retval": {"type": "I"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"application:userDidAcceptCloudKitShareWithMetadata:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:willContinueUserActivityWithType:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:willEncodeRestorableState:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"application:willPresentError:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"applicationDidBecomeActive:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDidChangeOcclusionState:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDidChangeScreenParameters:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDidFinishLaunching:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDidHide:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDidResignActive:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDidUnhide:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDidUpdate:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationDockMenu:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationOpenUntitledFile:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationProtectedDataDidBecomeAvailable:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationProtectedDataWillBecomeUnavailable:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationShouldAutomaticallyLocalizeKeyEquivalents:", - {"required": False, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationShouldHandleReopen:hasVisibleWindows:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"applicationShouldOpenUntitledFile:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationShouldTerminate:", - {"required": False, "retval": {"type": "I"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationShouldTerminateAfterLastWindowClosed:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationSupportsSecureRestorableState:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationWillBecomeActive:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationWillFinishLaunching:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationWillHide:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationWillResignActive:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationWillTerminate:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationWillUnhide:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applicationWillUpdate:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"applyLayoutAttributes:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"attachColorList:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"attachment", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"attachmentBoundsForAttributes:location:textContainer:proposedLineFragment:position:", - { - "required": True, - "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": b"{CGPoint=dd}"}, - }, - }, - ) - r( - b"NSObject", - b"attachmentBoundsForTextContainer:proposedLineFragment:glyphPosition:characterIndex:", - { - "required": True, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "{CGPoint=dd}"}, - 5: {"type": "Q"}, - }, - }, - ) - r(b"NSObject", b"attributedString", {"required": False, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"attributedSubstringForProposedRange:actualRange:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"attributedSubstringFromRange:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r(b"NSObject", b"autocorrectionType", {"required": False, "retval": {"type": b"q"}}) - r(b"NSObject", b"awakeFromNib", {"retval": {"type": b"v"}}) - r( - b"NSObject", - b"baseWritingDirectionAtLocation:", - {"required": True, "retval": {"type": b"q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"baselineDeltaForCharacterAtIndex:", - {"required": False, "retval": {"type": "d"}, "arguments": {2: {"type": "Q"}}}, - ) - r( - b"NSObject", - b"bind:toObject:withKeyPath:options:", - { - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"bounds", - {"required": True, "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSObject", - b"browser:acceptDrop:atRow:column:dropOperation:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "q"}, - 6: {"type": "I"}, - }, - }, - ) - r( - b"NSObject", - b"browser:canDragRowsWithIndexes:inColumn:withEvent:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"browser:child:ofItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"q"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:createRowsForColumn:inMatrix:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:didChangeLastColumn:toColumn:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"q"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"q"}, - 5: {"type": b"@"}, - 6: {"type": "N^{CGPoint=dd}"}, - }, - }, - ) - r( - b"NSObject", - b"browser:headerViewControllerForItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:heightOfRow:inColumn:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:isColumnValid:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:isLeafItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"browser:nextTypeSelectMatchFromRow:toRow:inColumn:forString:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "q"}, - 4: {"type": "q"}, - 5: {"type": "q"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"browser:numberOfChildrenOfItem:", - { - "required": False, - "retval": {"type": b"q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:numberOfRowsInColumn:", - { - "required": False, - "retval": {"type": "q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:objectValueForItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:previewViewControllerForLeafItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:selectCellWithString:inColumn:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:selectRow:inColumn:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:selectionIndexesForProposedSelection:inColumn:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"browser:setObjectValue:forItem:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:shouldEditItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:shouldShowCellExpansionForRow:column:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:shouldSizeColumn:forUserResize:toWidth:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "q"}, - 4: {"type": "Z"}, - 5: {"type": "d"}, - }, - }, - ) - r( - b"NSObject", - b"browser:shouldTypeSelectForEvent:withCurrentSearchString:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"browser:sizeToFitWidthOfColumn:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:titleOfColumn:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:typeSelectStringForRow:inColumn:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"browser:validateDrop:proposedRow:column:dropOperation:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"^q", "type_modifier": b"N"}, - 5: {"type": b"^q", "type_modifier": b"N"}, - 6: {"type": b"^Q", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"browser:willDisplayCell:atRow:column:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"browser:writeRowsWithIndexes:inColumn:toPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"browserColumnConfigurationDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"browserDidScroll:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"browserWillScroll:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"buttonToolTip", {"required": True, "retval": {"type": b"@"}}) - r(b"NSObject", b"canBeDisabled", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"cancelOperation:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"candidateListTouchBarItem", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"candidateListTouchBarItem:beginSelectingCandidateAtIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"candidateListTouchBarItem:changeSelectionFromCandidateAtIndex:toIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"candidateListTouchBarItem:changedCandidateListVisibility:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"candidateListTouchBarItem:endSelectingCandidateAtIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"capitalizeWord:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"cellBaselineOffset", - {"required": True, "retval": {"type": "{CGPoint=dd}"}}, - ) - r( - b"NSObject", - b"cellFrameForTextContainer:proposedLineFragment:glyphPosition:characterIndex:", - { - "required": True, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "{CGPoint=dd}"}, - 5: {"type": "Q"}, - }, - }, - ) - r(b"NSObject", b"cellSize", {"required": True, "retval": {"type": "{CGSize=dd}"}}) - r(b"NSObject", b"center", {"required": True, "retval": {"type": b"{CGPoint=dd}"}}) - r( - b"NSObject", - b"centerSelectionInVisibleArea:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"changeCaseOfLetter:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"changeColor:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"changeFont:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"changeSpelling:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"characterIndexForPoint:", - { - "required": True, - "retval": {"type": "Q"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"cloudShareForUserInterfaceItem:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"collectionView:acceptDrop:index:dropOperation:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:acceptDrop:indexPath:dropOperation:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:canDragItemsAtIndexPaths:withEvent:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:canDragItemsAtIndexes:withEvent:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:cancelPrefetchingForItemsAtIndexPaths:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:didChangeItemsAtIndexPaths:toHighlightState:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:didDeselectItemsAtIndexPaths:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:didEndDisplayingItem:forRepresentedObjectAtIndexPath:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:didSelectItemsAtIndexPaths:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:draggingImageForItemsAtIndexPaths:withEvent:offset:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "^{CGPoint=dd}", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:draggingImageForItemsAtIndexes:withEvent:offset:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "^{CGPoint=dd}", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:draggingSession:endedAtPoint:dragOperation:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"{CGPoint=dd}"}, - 5: {"type": b"Q"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:draggingSession:endedAtPoint:draggingOperation:", - {"arguments": {4: {"type": "{CGPoint=dd}"}, 5: {"type": "q"}}}, - ) - r( - b"NSObject", - b"collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexPaths:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGPoint=dd}"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexes:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGPoint=dd}"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:itemForRepresentedObjectAtIndexPath:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:layout:insetForSectionAtIndex:", - { - "required": False, - "retval": {"type": "{NSEdgeInsets=dddd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:layout:minimumInteritemSpacingForSectionAtIndex:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:layout:minimumLineSpacingForSectionAtIndex:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:layout:referenceSizeForFooterInSection:", - { - "required": False, - "retval": {"type": "{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:layout:referenceSizeForHeaderInSection:", - { - "required": False, - "retval": {"type": "{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:layout:sizeForItemAtIndexPath:", - { - "required": False, - "retval": {"type": "{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexPaths:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:numberOfItemsInSection:", - { - "required": True, - "retval": {"type": "q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:pasteboardWriterForItemAtIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:pasteboardWriterForItemAtIndexPath:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:prefetchItemsAtIndexPaths:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:shouldChangeItemsAtIndexPaths:toHighlightState:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"collectionView:shouldDeselectItemsAtIndexPaths:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:shouldSelectItemsAtIndexPaths:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:transitionLayoutForOldLayout:newLayout:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:updateDraggingItemsForDrag:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:validateDrop:proposedIndex:dropOperation:", - { - "required": False, - "retval": {"type": "q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "^q", "type_modifier": b"N"}, - 5: {"type": "^q", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:validateDrop:proposedIndexPath:dropOperation:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "^@", "type_modifier": b"N"}, - 5: {"type": b"^q"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:viewForSupplementaryElementOfKind:atIndexPath:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:willDisplayItem:forRepresentedObjectAtIndexPath:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"collectionView:writeItemsAtIndexPaths:toPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"collectionView:writeItemsAtIndexes:toPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"comboBox:completedString:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"comboBox:indexOfItemWithStringValue:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"comboBox:objectValueForItemAtIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"comboBoxCell:completedString:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"comboBoxCell:indexOfItemWithStringValue:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"comboBoxCell:objectValueForItemAtIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"comboBoxSelectionDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"comboBoxSelectionIsChanging:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"comboBoxWillDismiss:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"comboBoxWillPopUp:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"commitEditing", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"commitEditingAndReturnError:", - { - "required": True, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"^@", "type_modifier": b"o"}}, - }, - ) - r( - b"NSObject", - b"commitEditingWithDelegate:didCommitSelector:contextInfo:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": ":", "sel_of_type": b"v@:@Z^v"}, - 4: {"type": "^v"}, - }, - }, - ) - r( - b"NSObject", - b"compare:", - {"required": True, "retval": {"type": b"q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"complete:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"compressWithPrioritizedCompressionOptions:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"concludeDragOperation:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"confinementRectForMenu:onScreen:", - { - "required": False, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"container", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"contentInsets", - {"required": True, "retval": {"type": b"{NSDirectionalEdgeInsets=dddd}"}}, - ) - r( - b"NSObject", - b"contentSize", - {"required": True, "retval": {"type": b"{CGSize=dd}"}}, - ) - r(b"NSObject", b"contentType", {"required": True, "retval": {"type": b"@"}}) - r(b"NSObject", b"contentView", {"required": False, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"contentViewAtIndex:effectiveCharacterRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": "Q"}, 3: {"type": "o^{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"control:didFailToFormatString:errorDescription:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"control:didFailToValidatePartialString:errorDescription:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"control:isValidObject:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"control:textShouldBeginEditing:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"control:textShouldEndEditing:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"control:textView:completions:forPartialWordRange:indexOfSelectedItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "{_NSRange=QQ}"}, - 6: {"null_accepted": False, "type": "^q", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"control:textView:doCommandBySelector:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": ":", "sel_of_type": b"v@:@"}, - }, - }, - ) - r( - b"NSObject", - b"controlTextDidBeginEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"controlTextDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"controlTextDidEndEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"conversationIdentifier", - {"required": True, "retval": {"type": "q"}}, - ) - r(b"NSObject", b"currentMode", {"required": True, "retval": {"type": "i"}}) - r( - b"NSObject", - b"customWindowsToEnterFullScreenForWindow:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"customWindowsToEnterFullScreenForWindow:onScreen:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"customWindowsToExitFullScreenForWindow:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"dataDetectionType", {"required": False, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"datePickerCell:validateProposedDateValue:timeInterval:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "^@", "type_modifier": b"N"}, - 4: {"type": "^d", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"defaultAnimationForKey:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"defaultPlaceholderForMarker:withBinding:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteBackward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteBackwardByDecomposingPreviousCharacter:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteForward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteToBeginningOfLine:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteToBeginningOfParagraph:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteToEndOfLine:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteToEndOfParagraph:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteToMark:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteWordBackward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"deleteWordForward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"detachColorList:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"detachableWindowForPopover:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"didBeginInteractingWithScrubber:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"didCancelInteractingWithScrubber:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"didFinishInteractingWithScrubber:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"didReplaceCharacters", - {"required": False, "retval": {"type": b"v"}}, - ) - r( - b"NSObject", - b"didTransitionFromLayout:toLayout:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"discardEditing", {"required": True, "retval": {"type": b"v"}}) - r( - b"NSObject", - b"doCommandBySelector:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": ":", "sel_of_type": b"v@:@"}}, - }, - ) - r( - b"NSObject", - b"doCommandBySelector:client:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": ":", "sel_of_type": b"v@:@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"dockMenu", {"required": False, "retval": {"type": b"@"}}) - r(b"NSObject", b"documentRange", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"documentVisibleRect", - {"required": False, "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSObject", b"draggedImage", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"draggedImage:beganAt:", - { - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"draggedImage:endedAt:deposited:", - { - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"draggedImage:endedAt:operation:", - { - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"draggedImage:movedTo:", - { - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"draggedImageLocation", - {"required": True, "retval": {"type": "{CGPoint=dd}"}}, - ) - r( - b"NSObject", - b"draggingDestinationWindow", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"draggingEnded:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"draggingEntered:", - {"required": False, "retval": {"type": "Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"draggingExited:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"draggingFormation", {"required": True, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"draggingLocation", - {"required": True, "retval": {"type": "{CGPoint=dd}"}}, - ) - r(b"NSObject", b"draggingPasteboard", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"draggingSequenceNumber", - {"required": True, "retval": {"type": "q"}}, - ) - r( - b"NSObject", - b"draggingSession:endedAtPoint:operation:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"{CGPoint=dd}"}, - 4: {"type": b"Q"}, - }, - }, - ) - r( - b"NSObject", - b"draggingSession:movedToPoint:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"draggingSession:sourceOperationMaskForDraggingContext", - {"retval": {"type": "Q"}, "arguments": {3: {"type": "q"}}}, - ) - r( - b"NSObject", - b"draggingSession:sourceOperationMaskForDraggingContext:", - { - "required": True, - "retval": {"type": b"Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"draggingSession:willBeginAtPoint:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"{CGPoint=dd}"}}, - }, - ) - r(b"NSObject", b"draggingSource", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"draggingSourceOperationMask", - {"required": True, "retval": {"type": "Q"}}, - ) - r( - b"NSObject", - b"draggingSourceOperationMaskForLocal:", - {"retval": {"type": "Q"}, "arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSObject", - b"draggingUpdated:", - {"required": False, "retval": {"type": "Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"drawCharactersInRange:forContentView:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"drawWithFrame:inView:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"drawWithFrame:inView:characterIndex:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"@"}, - 4: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"drawWithFrame:inView:characterIndex:layoutManager:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"@"}, - 4: {"type": "Q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"drawerDidClose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"drawerDidOpen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"drawerShouldClose:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"drawerShouldOpen:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"drawerWillClose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"drawerWillOpen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"drawerWillResizeContents:toSize:", - { - "required": False, - "retval": {"type": "{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{CGSize=dd}"}}, - }, - ) - r( - b"NSObject", - b"drawsVerticallyForCharacterAtIndex:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": "q"}}}, - ) - r(b"NSObject", b"editable", {"retval": {"type": b"Z"}}) - r(b"NSObject", b"effectiveAppearance", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"effectiveContentInsets", - {"required": True, "retval": {"type": b"{NSDirectionalEdgeInsets=dddd}"}}, - ) - r( - b"NSObject", - b"effectiveContentSize", - {"required": True, "retval": {"type": b"{CGSize=dd}"}}, - ) - r( - b"NSObject", - b"enumerateCaretOffsetsInLineFragmentAtLocation:usingBlock:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"d"}, - 2: {"type": b"@"}, - 3: {"type": b"Z"}, - 4: {"type": b"o^Z"}, - }, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"enumerateContainerBoundariesFromLocation:reverse:usingBlock:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^Z"}, - }, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"Q"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - 3: {"type": b"o^Z"}, - }, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"enumerateSubstringsFromLocation:options:usingBlock:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"Q"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"o^Z"}, - }, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"enumerateTextElementsFromLocation:options:usingBlock:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"Q"}, - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"exposeBinding:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"exposedBindings", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"filePromiseProvider:fileNameForType:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"filePromiseProvider:writePromiseToURL:completionHandler:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - }, - }, - }, - ) - r(b"NSObject", b"findBarView", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"findBarViewDidChangeHeight", - {"required": True, "retval": {"type": b"v"}}, - ) - r(b"NSObject", b"findBarVisible", {"retval": {"type": b"Z"}}) - r( - b"NSObject", - b"firstRectForCharacterRange:", - { - "required": True, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"firstRectForCharacterRange:actualRange:", - { - "required": True, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"firstSelectedRange", - {"required": False, "retval": {"type": b"{_NSRange=QQ}"}}, - ) - r( - b"NSObject", - b"fontManager:willIncludeFont:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"fractionOfDistanceThroughGlyphForPoint:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"frame", - {"required": True, "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSObject", - b"gestureRecognizer:shouldAttemptToRecognizeWithEvent:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"gestureRecognizer:shouldReceiveTouch:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"gestureRecognizer:shouldRequireFailureOfGestureRecognizer:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"gestureRecognizerShouldBegin:", - {"required": False, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"grammarCheckingType", - {"required": False, "retval": {"type": b"q"}}, - ) - r(b"NSObject", b"hasMarkedText", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"highlight:withFrame:inView:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": "Z"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"hyphenCharacterForGlyphAtIndex:", - {"retval": {"type": "i"}, "arguments": {2: {"type": "Q"}}}, - ) - r( - b"NSObject", - b"hyphenationFactorForGlyphAtIndex:", - {"retval": {"type": "f"}, "arguments": {2: {"type": "Q"}}}, - ) - r(b"NSObject", b"iconProvider", {"required": False, "retval": {"type": b"@"}}) - r(b"NSObject", b"identifier", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"ignoreModifierKeysForDraggingSession:", - {"required": False, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"ignoreModifierKeysWhileDragging", {"retval": {"type": "Z"}}) - r( - b"NSObject", - b"ignoreSpelling:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"image:didLoadPartOfRepresentation:withValidRows:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"image:didLoadRepresentation:withStatus:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"image:didLoadRepresentationHeader:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"image:willLoadRepresentation:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"imageDidNotDraw:inRect:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"imageForBounds:attributes:location:textContainer:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"imageForBounds:textContainer:characterIndex:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"@"}, - 4: {"type": "Q"}, - }, - }, - ) - r(b"NSObject", b"imageProvider", {"required": False, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"indent:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"indexPath", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"infoForBinding:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"initWithPasteboardPropertyList:ofType:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"initWithPickerMask:colorPanel:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": "Q"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"inlinePredictionType", - {"required": False, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"inputClientBecomeActive:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"inputClientDisabled:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"inputClientEnabled:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"inputClientResignActive:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertBacktab:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertContainerBreak:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertDoubleQuoteIgnoringSubstitution:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": "^I", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 3: {"type": "Q"}, - 4: {"type": "Q"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"insertLineBreak:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertNewButtonImage:in:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": "@"}, 3: {"type": "@"}}, - }, - ) - r( - b"NSObject", - b"insertNewline:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertNewlineIgnoringFieldEditor:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertParagraphSeparator:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertSingleQuoteIgnoringSubstitution:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertTab:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertTabIgnoringFieldEditor:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"insertText:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": "@"}}}, - ) - r( - b"NSObject", - b"insertText:client:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": "@"}, 3: {"type": "@"}}, - }, - ) - r( - b"NSObject", - b"insertText:replacementRange:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": "@"}, 3: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"ioCommandBySelector:", - {"arguments": {2: {"type": ":", "sel_of_type": b"v@:@"}}}, - ) - r( - b"NSObject", - b"isAccessibilityAlternateUIVisible", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityDisclosed", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityEdited", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityElement", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityEnabled", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityExpanded", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityFocused", - {"required": False, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityFrontmost", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityHidden", - {"required": True, "retval": {"type": b"Z"}}, - ) - r(b"NSObject", b"isAccessibilityMain", {"required": True, "retval": {"type": b"Z"}}) - r( - b"NSObject", - b"isAccessibilityMinimized", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityModal", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityOrderedByRow", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityProtectedContent", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilityRequired", - {"required": True, "retval": {"type": "Z"}}, - ) - r( - b"NSObject", - b"isAccessibilitySelected", - {"required": True, "retval": {"type": b"Z"}}, - ) - r( - b"NSObject", - b"isAccessibilitySelectorAllowed:", - {"required": True, "retval": {"type": b"Z"}, "arguments": {2: {"type": b":"}}}, - ) - r(b"NSObject", b"isContentDiscarded", {"retval": {"type": "Z"}}) - r(b"NSObject", b"isEditable", {"required": False, "retval": {"type": "Z"}}) - r(b"NSObject", b"isExplicitlyIncluded", {"retval": {"type": "Z"}}) - r(b"NSObject", b"isFindBarVisible", {"required": True, "retval": {"type": "Z"}}) - r(b"NSObject", b"isHidden", {"required": True, "retval": {"type": b"Z"}}) - r(b"NSObject", b"isSelectable", {"required": False, "retval": {"type": "Z"}}) - r(b"NSObject", b"item", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"itemsForSharingServicePickerToolbarItem:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"itemsForSharingServicePickerTouchBarItem:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"key", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"keyPathsForValuesAffectingPreview", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"layer:shouldInheritContentsScale:fromWindow:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"layoutManager:boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:", - { - "required": False, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": b"@"}, - 5: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "{CGPoint=dd}"}, - 7: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManager:didCompleteLayoutForTextContainer:atEnd:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"layoutManager:lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManager:paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManager:paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManager:shouldBreakLineByHyphenatingBeforeCharacterAtIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"layoutManager:shouldBreakLineByWordBeforeCharacterAtIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"layoutManager:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:", - { - "required": False, - "retval": {"type": b"Q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"^S"}, - 4: {"type": b"^q"}, - 5: {"type": b"^Q"}, - 6: {"type": b"@"}, - 7: {"type": b"{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManager:shouldGenerateGlyphs:properties:characterIndexes:forGlyphRange:", - { - "arguments": { - 3: {"type": "n^S", "c_array_length_in_arg": 6}, - 4: {"type": "n^Q", "c_array_length_in_arg": 6}, - 5: {"type": "n^Q", "c_array_length_in_arg": 6}, - 6: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSObject", - b"layoutManager:shouldSetLineFragmentRect:lineFragmentUsedRect:baselineOffset:inTextContainer:forGlyphRange:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "N^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "N^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "N^d"}, - 6: {"type": b"@"}, - 7: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManager:shouldUseAction:forControlCharacterAtIndex:", - { - "required": False, - "retval": {"type": "q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "Z"}, - 5: {"type": "Q"}, - 6: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManager:textContainer:didChangeGeometryFromSize:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGSize=dd}"}, - }, - }, - ) - r( - b"NSObject", - b"layoutManagerDidInvalidateLayout:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"layoutOptions", {"required": True, "retval": {"type": b"Q"}}) - r(b"NSObject", b"layoutOrientation", {"required": True, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"lineFragmentRangeForPoint:inContainerAtLocation:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"{CGPoint=dd}"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"linkDetectionType", {"required": False, "retval": {"type": b"q"}}) - r(b"NSObject", b"listener:shouldAcceptNewConnection:", {"retval": {"type": "Z"}}) - r(b"NSObject", b"localizedKey", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"localizedSummaryItems", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"localizedTitlesForItem:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"locationFromLocation:withOffset:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"lowercaseWord:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"makeBaseWritingDirectionLeftToRight:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"makeBaseWritingDirectionNatural:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"makeBaseWritingDirectionRightToLeft:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"makeTextWritingDirectionLeftToRight:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"makeTextWritingDirectionNatural:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"makeTextWritingDirectionRightToLeft:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"markedRange", - {"required": True, "retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSObject", - b"markedTextAbandoned:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"markedTextSelectionChanged:client:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"menu:updateItem:atIndex:shouldCancel:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"menu:willHighlightItem:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"menuDidClose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"menuHasKeyEquivalent:forEvent:target:action:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "^@", "type_modifier": b"o"}, - 5: {"type": "^:", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"menuNeedsUpdate:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"menuWillOpen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"minContentSize", - {"required": True, "retval": {"type": "{CGSize=dd}"}}, - ) - r( - b"NSObject", - b"minimumSizeWithPrioritizedCompressionOptions:", - { - "required": True, - "retval": {"type": b"{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"mouseDownOnCharacterIndex:atCoordinate:withModifier:client:", - { - "required": True, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "Q"}, - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "Q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"mouseDraggedOnCharacterIndex:atCoordinate:withModifier:client:", - { - "required": True, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "Q"}, - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "Q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"mouseUpOnCharacterIndex:atCoordinate:withModifier:client:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": "Q"}, - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "Q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"moveBackward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveBackwardAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveDown:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveDownAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveForward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveForwardAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveLeft:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveLeftAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveParagraphBackwardAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveParagraphForwardAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveRight:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveRightAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToBeginningOfDocument:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToBeginningOfDocumentAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToBeginningOfLine:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToBeginningOfLineAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToBeginningOfParagraph:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToBeginningOfParagraphAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToEndOfDocument:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToEndOfDocumentAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToEndOfLine:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToEndOfLineAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToEndOfParagraph:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToEndOfParagraphAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToLeftEndOfLine:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToLeftEndOfLineAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToRightEndOfLine:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveToRightEndOfLineAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveUp:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveUpAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordBackward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordBackwardAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordForward:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordForwardAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordLeft:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordLeftAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordRight:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"moveWordRightAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"name", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"namesOfPromisedFilesDroppedAtDestination:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfItemsForScrubber:", - {"required": True, "retval": {"type": "q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfItemsInComboBox:", - {"required": False, "retval": {"type": "q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfItemsInComboBoxCell:", - {"required": False, "retval": {"type": "q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfItemsInMenu:", - {"required": False, "retval": {"type": "q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfRowsInTableView:", - {"required": False, "retval": {"type": "q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfSectionsInCollectionView:", - {"required": False, "retval": {"type": "q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfValidItemsForDrop", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"objectDidBeginEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"objectDidEndEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"offsetFromLocation:toLocation:", - { - "required": False, - "retval": {"type": b"q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"operationQueueForFilePromiseProvider:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"optionDescriptionsForBinding:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"optionsForSharingService:shareProvider:", - { - "required": False, - "retval": {"type": b"Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:acceptDrop:item:childIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:child:ofItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:dataCellForTableColumn:item:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:didAddRowView:forRow:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"outlineView:didClickTableColumn:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:didDragTableColumn:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:didRemoveRowView:forRow:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"outlineView:draggingSession:endedAtPoint:", - {"arguments": {4: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSObject", - b"outlineView:draggingSession:endedAtPoint:operation:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"{CGPoint=dd}"}, - 5: {"type": b"Q"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:draggingSession:willBeginAtPoint:", - {"arguments": {4: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSObject", - b"outlineView:draggingSession:willBeginAtPoint:forItems:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"{CGPoint=dd}"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:heightOfRowByItem:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:isGroupItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:isItemExpandable:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:itemForPersistentObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:mouseDownInHeaderOfTableColumn:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedItems:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:nextTypeSelectMatchFromItem:toItem:forString:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:numberOfChildrenOfItem:", - { - "required": False, - "retval": {"type": "q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:objectValueForTableColumn:byItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:pasteboardWriterForItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:persistentObjectForItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:rowViewForItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:selectionIndexesForProposedSelection:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:setObjectValue:forTableColumn:byItem:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:shouldCollapseItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldEditTableColumn:item:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldExpandItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldReorderColumn:toColumn:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldSelectItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldSelectTableColumn:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldShowCellExpansionForTableColumn:item:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldShowOutlineCellForItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:shouldTrackCell:forTableColumn:item:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:shouldTypeSelectForEvent:withCurrentSearchString:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:sizeToFitWidthOfColumn:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"outlineView:sortDescriptorsDidChange:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:tintConfigurationForItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:toolTipForCell:rect:tableColumn:item:mouseLocation:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - 7: {"type": "{CGPoint=dd}"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:typeSelectStringForTableColumn:item:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:updateDraggingItemsForDrag:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:userCanChangeVisibilityOfTableColumn:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:userDidChangeVisibilityOfTableColumns:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:validateDrop:proposedItem:proposedChildIndex:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:viewForTableColumn:item:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineView:willDisplayCell:forTableColumn:item:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:willDisplayOutlineCell:forTableColumn:item:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"outlineView:writeItems:toPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"outlineViewColumnDidMove:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"outlineViewColumnDidResize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"outlineViewItemDidCollapse:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"outlineViewItemDidExpand:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"outlineViewItemWillCollapse:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"outlineViewItemWillExpand:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"outlineViewSelectionDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"outlineViewSelectionIsChanging:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pageController:didTransitionToObject:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pageController:frameForObject:", - { - "required": False, - "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pageController:identifierForObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pageController:prepareViewController:withObject:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pageController:viewControllerForIdentifier:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pageControllerDidEndLiveTransition:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pageControllerWillStartLiveTransition:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pageDown:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pageDownAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pageUp:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pageUpAndModifySelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"panel:compareFilename:with:caseSensitive:", - { - "retval": {"type": "q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"panel:didChangeToDirectoryURL:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"panel:directoryDidChange:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"panel:isValidFilename:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"panel:shouldEnableURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"panel:shouldShowFilename:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"panel:userEnteredFilename:confirmed:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"panel:validateURL:error:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "^@", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"panel:willExpand:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"panelSelectionDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pasteboard:item:provideDataForType:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pasteboard:provideDataForType:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pasteboardChangedOwner:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pasteboardFinishedWithDataProvider:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pasteboardPropertyListForType:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pathCell:willDisplayOpenPanel:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pathCell:willPopUpMenu:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pathControl:acceptDrop:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pathControl:shouldDragItem:withPasteboard:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pathControl:shouldDragPathComponentCell:withPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pathControl:validateDrop:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pathControl:willDisplayOpenPanel:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pathControl:willPopUpMenu:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"performActionForItem:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"performDragOperation:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"performEditingTransactionForTextStorage:usingBlock:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"performFeedbackPattern:performanceTime:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"q"}, 3: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"performSegueWithIdentifier:sender:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"popoverDidClose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"popoverDidDetach:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"popoverDidShow:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"popoverShouldClose:", - {"required": False, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"popoverShouldDetach:", - {"required": False, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"popoverWillClose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"popoverWillShow:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"preferredLayoutAttributesFittingAttributes:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"preferredTextAccessoryPlacement", - {"required": False, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"prepareForDragOperation:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"prepareForInterfaceBuilder", {"retval": {"type": b"v"}}) - r(b"NSObject", b"prepareForReuse", {"required": False, "retval": {"type": b"v"}}) - r( - b"NSObject", - b"prepareForSegue:sender:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"previewRepresentableActivityItemsForWindow:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"processEditingForTextStorage:edited:range:changeInLength:invalidateRange:", - { - "arguments": { - 3: {"type": "q"}, - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "q"}, - 6: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSObject", - b"processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"Q"}, - 4: {"type": b"{_NSRange=QQ}"}, - 5: {"type": b"q"}, - 6: {"type": b"{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"provideNewButtonImage", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"provideNewView:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSObject", - b"quickLookPreviewItems:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"readSelectionFromPasteboard:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"readableTypesForPasteboard:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"readingOptionsForType:pasteboard:", - { - "required": False, - "retval": {"type": b"Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"rectsForCharacterInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSObject", - b"rectsForCharacterRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"remoteObjectProxyWithErrorHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - } - } - }, - ) - r( - b"NSObject", - b"removeAnnotation:range:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"replaceCharactersInRange:withAnnotatedString:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"replaceCharactersInRange:withString:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"replaceContentsInRange:withTextElements:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"representedElementCategory", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"representedElementKind", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"resetSpringLoading", {"required": True, "retval": {"type": b"v"}}) - r( - b"NSObject", - b"restoreUserActivityState:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"restoreWindowWithIdentifier:state:completionHandler:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "type": "@?", - }, - }, - }, - ) - r( - b"NSObject", - b"rootItemForBrowser:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rotor:resultForSearchParameters:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"ruleEditor:child:forCriterion:withRowType:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "q"}, - 4: {"type": b"@"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"ruleEditor:displayValueForCriterion:inRow:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"ruleEditor:numberOfChildrenForCriterion:withRowType:", - { - "required": True, - "retval": {"type": "q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"ruleEditorRowsDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:didAddMarker:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:didMoveMarker:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:didRemoveMarker:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:handleMouseDown:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:locationForPoint:", - { - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"rulerView:pointForLocation:", - { - "retval": {"type": b"{CGPoint=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}}, - }, - ) - r( - b"NSObject", - b"rulerView:pointForlocation:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type": "d"}}, - }, - ) - r( - b"NSObject", - b"rulerView:shouldAddMarker:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:shouldMoveMarker:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:shouldRemoveMarker:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"rulerView:willAddMarker:atLocation:", - { - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "d"}}, - }, - ) - r( - b"NSObject", - b"rulerView:willMoveMarker:toLocation:", - { - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "d"}}, - }, - ) - r( - b"NSObject", - b"rulerView:willSetClientView:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scrollLineDown:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scrollLineUp:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scrollPageDown:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scrollPageUp:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scrollRangeToVisible:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"scrollToBeginningOfDocument:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scrollToEndOfDocument:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scrubber:didChangeVisibleRange:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"scrubber:didHighlightItemAtIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"scrubber:didSelectItemAtIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"scrubber:layout:sizeForItemAtIndex:", - { - "required": False, - "retval": {"type": "{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"scrubber:viewForItemAtIndex:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"searchFieldDidEndSearching:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"searchFieldDidStartSearching:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"searchForItemsWithSearchString:resultLimit:matchedItemHandler:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "q"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - }, - }, - }, - ) - r( - b"NSObject", - b"sectionCollapseButton", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"selectAll:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"selectAndShowRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"selectLine:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"selectParagraph:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"selectToMark:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"selectWord:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"selectable", {"retval": {"type": b"Z"}}) - r( - b"NSObject", - b"selectedRange", - {"required": True, "retval": {"type": "{_NSRange=QQ}"}}, - ) - r(b"NSObject", b"selectedRanges", {"required": False, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"selectionRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSObject", - b"selectionShouldChangeInOutlineView:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"selectionShouldChangeInTableView:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityActivationPoint:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"setAccessibilityAllowedValues:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityAlternateUIVisible:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityApplicationFocusedUIElement:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityAttributedUserInputLabels:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityCancelButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityChildren:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityChildrenInNavigationOrder:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityClearButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityCloseButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityColumnCount:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityColumnHeaderUIElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityColumnIndexRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"setAccessibilityColumnTitles:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityColumns:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityContents:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityCriticalValue:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityCustomActions:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityCustomRotors:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityDecrementButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityDefaultButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityDisclosed:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityDisclosedByRow:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityDisclosedRows:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityDisclosureLevel:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityDocument:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityEdited:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityElement:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityEnabled:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityExpanded:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityExtrasMenuBar:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityFilename:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityFocused:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityFocusedWindow:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityFrame:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSObject", - b"setAccessibilityFrontmost:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityFullScreenButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityGrowArea:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityHandles:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityHeader:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityHelp:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityHidden:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityHorizontalScrollBar:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityHorizontalUnitDescription:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityHorizontalUnits:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityIdentifier:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityIncrementButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityIndex:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityInsertionPointLineNumber:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityLabel:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityLabelUIElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityLabelValue:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"f"}}}, - ) - r( - b"NSObject", - b"setAccessibilityLinkedUIElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMain:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMainWindow:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMarkerGroupUIElement:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMarkerTypeDescription:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMarkerUIElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMarkerValues:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMaxValue:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMenuBar:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMinValue:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMinimizeButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityMinimized:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityModal:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityNextContents:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityNumberOfCharacters:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityOrderedByRow:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityOrientation:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityOverflowButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityParent:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityPlaceholderValue:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityPreviousContents:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityProtectedContent:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityProxy:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityRequired:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilityRole:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityRoleDescription:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityRowCount:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityRowHeaderUIElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityRowIndexRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"setAccessibilityRows:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityRulerMarkerType:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySearchButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySearchMenu:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySelected:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySelectedCells:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySelectedChildren:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySelectedColumns:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySelectedRows:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySelectedText:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySelectedTextRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"setAccessibilitySelectedTextRanges:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityServesAsTitleForUIElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySharedCharacterRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"setAccessibilitySharedFocusElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySharedTextUIElements:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityShownMenu:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySortDirection:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySplitters:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilitySubrole:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityTabs:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityTitle:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityTitleUIElement:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityToolbarButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityTopLevelUIElement:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityURL:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityUnitDescription:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityUnits:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityUserInputLabels:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityValue:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityValueDescription:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityVerticalScrollBar:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityVerticalUnitDescription:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityVerticalUnits:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setAccessibilityVisibleCells:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityVisibleCharacterRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"setAccessibilityVisibleChildren:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityVisibleColumns:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityVisibleRows:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityWarningValue:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityWindow:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityWindows:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAccessibilityZoomButton:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAllowsMultipleSelection:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAlpha:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"d"}}}, - ) - r( - b"NSObject", - b"setAnimatesToDestination:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setAnimations:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAnnotations:range:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"setAppearance:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAttachment:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setAutocorrectionType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setCenter:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"{CGPoint=dd}"}}, - }, - ) - r( - b"NSObject", - b"setColor:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setContentType:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setDataDetectionType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setDefaultPlaceholder:forMarker:withBinding:", - { - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"setDockTile:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setDraggingFormation:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setEditable:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setFindBarView:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setFindBarVisible:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSObject", - b"setFirstSelectedRange:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"{_NSRange=QQ}"}}}, - ) - r( - b"NSObject", - b"setGrammarCheckingType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setHidden:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setIdentifier:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setInlinePredictionType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setIntAttribute:value:forGlyphAtIndex:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": "q"}, 3: {"type": "q"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"setKey:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setLinkDetectionType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setLocalizedKey:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setMark:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setMarkedText:selectedRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"setMarkedText:selectedRange:replacementRange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"setMode:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": "i"}}}, - ) - r( - b"NSObject", - b"setNumberOfValidItemsForDrop:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setSectionCollapseButton:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setSelectable:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSObject", - b"setSelectedRanges:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setSmartDashesType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setSmartInsertDeleteType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setSmartQuotesType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setSpellCheckingType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setString:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setTextCompletionType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setTextReplacementType:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"setTextStorage:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setValue:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setVisibleCharacterRanges:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setZIndex:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"q"}}}, - ) - r( - b"NSObject", - b"sharingService:didCompleteForItems:error:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingService:didFailToShareItems:error:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingService:didSaveShare:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingService:didShareItems:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingService:didStopSharing:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingService:sourceFrameOnScreenForShareItem:", - { - "required": False, - "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingService:sourceWindowForShareItems:sharingContentScope:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"^q"}}, - }, - ) - r( - b"NSObject", - b"sharingService:transitionImageForShareItem:contentRect:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"sharingService:willShareItems:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingServicePicker:delegateForSharingService:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingServicePicker:didChooseSharingService:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"sharingServicePicker:sharingServicesForItems:proposedSharingServices:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"shouldPerformSegueWithIdentifier:sender:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"shouldReplaceCharactersInRanges:withStrings:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"showAllHelpTopicsForSearchString:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"showRelativeToRect:ofView:preferredEdge:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "Q"}, - } - }, - ) - r( - b"NSObject", - b"slideDraggedImageTo:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r(b"NSObject", b"smartDashesType", {"required": False, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"smartInsertDeleteType", - {"required": False, "retval": {"type": b"q"}}, - ) - r(b"NSObject", b"smartQuotesType", {"required": False, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"sound:didFinishPlaying:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"speechRecognizer:didRecognizeCommand:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"speechSynthesizer:didEncounterErrorAtIndex:ofString:message:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"speechSynthesizer:didEncounterSyncMessage:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"speechSynthesizer:didFinishSpeaking:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"speechSynthesizer:willSpeakPhoneme:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "s"}}, - }, - ) - r( - b"NSObject", - b"speechSynthesizer:willSpeakWord:ofString:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": b"@"}, - }, - }, - ) - r(b"NSObject", b"spellCheckingType", {"required": False, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"splitView:additionalEffectiveRectOfDividerAtIndex:", - { - "required": False, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"splitView:canCollapseSubview:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"splitView:constrainMaxCoordinate:ofSubviewAt:", - { - "required": False, - "retval": {"type": b"d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"splitView:constrainMinCoordinate:ofSubviewAt:", - { - "required": False, - "retval": {"type": b"d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"splitView:constrainSplitPosition:ofSubviewAt:", - { - "required": False, - "retval": {"type": b"d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:", - { - "required": False, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"splitView:onstrainMaxCoordinate:ofSubviewAt:", - {"retval": {"type": "d"}, "arguments": {3: {"type": "d"}, 4: {"type": "q"}}}, - ) - r( - b"NSObject", - b"splitView:onstrainMinCoordinate:ofSubviewAt:", - {"retval": {"type": "d"}, "arguments": {3: {"type": "d"}, 4: {"type": "q"}}}, - ) - r( - b"NSObject", - b"splitView:onstrainSplitPosition:ofSubviewAt:", - {"retval": {"type": "d"}, "arguments": {3: {"type": "d"}, 4: {"type": "q"}}}, - ) - r( - b"NSObject", - b"splitView:resizeSubviewsWithOldSize:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{CGSize=dd}"}}, - }, - ) - r( - b"NSObject", - b"splitView:shouldAdjustSizeOfSubview:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"splitView:shouldHideDividerAtIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"splitViewDidResizeSubviews:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"splitViewWillResizeSubviews:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"springLoadingActivated:draggingInfo:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": "Z"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"springLoadingEntered:", - {"required": False, "retval": {"type": "Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"springLoadingExited:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"springLoadingHighlight", - {"required": True, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"springLoadingHighlightChanged:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"springLoadingUpdated:", - {"required": False, "retval": {"type": "Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"stackView:didReattachViews:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"stackView:willDetachViews:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"string", {"required": False, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"stringAtIndex:effectiveRange:endsWithSearchBoundary:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"Q"}, - 3: {"type": b"^{_NSRange=QQ}"}, - 4: {"type": b"^Z"}, - }, - }, - ) - r( - b"NSObject", - b"stringAtIndex:effectiveRange:endswithSearchBoundary:", - { - "arguments": { - 2: {"type": "Q"}, - 3: {"type": "o^{_NSRange=QQ}"}, - 4: {"type": "o^Z"}, - } - }, - ) - r(b"NSObject", b"stringLength", {"required": False, "retval": {"type": b"Q"}}) - r( - b"NSObject", - b"supportsMode:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": "i"}}}, - ) - r( - b"NSObject", - b"swapWithMark:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"synchronizeToBackingStore:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - } - }, - }, - ) - r( - b"NSObject", - b"tabView:didSelectTabViewItem:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tabView:shouldSelectTabViewItem:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tabView:willSelectTabViewItem:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tabViewDidChangeNumberOfTabViewItems:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"tableView:acceptDrop:row:dropOperation:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:dataCellForTableColumn:row:", - { - "required": False, - "retval": {"type": "@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:didAddRowView:forRow:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"tableView:didClickTableColumn:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:didDragTableColumn:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:didRemoveRowView:forRow:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"tableView:draggingSession:endedAtPoint:operation:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"{CGPoint=dd}"}, - 5: {"type": b"Q"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:draggingSession:willBeginAtPoint:forRowIndexes:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"{CGPoint=dd}"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:heightOfRow:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:isGroupRow:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:mouseDownInHeaderOfTableColumn:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:nextTypeSelectMatchFromRow:toRow:forString:", - { - "required": False, - "retval": {"type": "q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "q"}, - 4: {"type": "q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:objectValueForTableColumn:row:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:pasteboardWriterForRow:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:rowActionsForRow:edge:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:rowViewForRow:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"tableView:selectionIndexesForProposedSelection:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:setObjectValue:forTableColumn:row:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:shouldEditTableColumn:row:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:shouldReorderColumn:toColumn:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:shouldSelectRow:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:shouldSelectTableColumn:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:shouldShowCellExpansionForTableColumn:row:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:shouldTrackCell:forTableColumn:row:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:shouldTypeSelectForEvent:withCurrentSearchString:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:sizeToFitWidthOfColumn:", - { - "required": False, - "retval": {"type": "d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:sortDescriptorsDidChange:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 5: {"type": b"@"}, - 6: {"type": "q"}, - 7: {"type": "{CGPoint=dd}"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:typeSelectStringForTableColumn:row:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"tableView:updateDraggingItemsForDrag:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:userCanChangeVisibilityOfTableColumn:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:userDidChangeVisibilityOfTableColumns:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:validateDrop:proposedRow:proposedDropOperation:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:viewForTableColumn:row:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"tableView:willDisplayCell:forTableColumn:row:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"tableView:writeRows:toPasteboard:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableView:writeRowsWithIndexes:toPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tableViewColumnDidMove:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"tableViewColumnDidResize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"tableViewSelectionDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"tableViewSelectionIsChanging:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"tag", {"required": True, "retval": {"type": "q"}}) - r( - b"NSObject", - b"terminate:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"textCompletionType", {"required": False, "retval": {"type": b"q"}}) - r( - b"NSObject", - b"textContentManager:shouldEnumerateTextElement:options:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"Q"}}, - }, - ) - r( - b"NSObject", - b"textContentManager:textElementAtLocation:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textContentStorage:textParagraphWithRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"textDidBeginEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textDidEndEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textField:textView:candidates:forSelectedRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"textField:textView:candidatesForSelectedRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"textField:textView:shouldSelectCandidateAtIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"textLayoutManager:renderingAttributesForLink:atLocation:defaultAttributes:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"textLayoutManager:shouldBreakLineBeforeLocation:hyphenating:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"Z"}}, - }, - ) - r( - b"NSObject", - b"textLayoutManager:textLayoutFragmentForLocation:inTextElement:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textLayoutOrientationAtLocation:", - {"required": False, "retval": {"type": b"q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textRangeForSelectionGranularity:enclosingLocation:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"q"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textReplacementType", - {"required": False, "retval": {"type": b"q"}}, - ) - r( - b"NSObject", - b"textShouldBeginEditing:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textShouldEndEditing:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"textStorage", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"textStorage:didProcessEditing:range:changeInLength:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"textStorage:willProcessEditing:range:changeInLength:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"textStorageDidProcessEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textStorageWillProcessEditing:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textView:URLForContentsOfTextAttachment:atIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"Q"}}, - }, - ) - r( - b"NSObject", - b"textView:candidates:forSelectedRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"textView:candidatesForSelectedRange:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSObject", - b"textView:clickedOnCell:inRect:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"textView:clickedOnCell:inRect:atIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"textView:clickedOnLink:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textView:clickedOnLink:atIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"textView:completions:forPartialWordRange:indexOfSelectedItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "^q", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"textView:didCheckTextInRange:types:options:results:orthography:wordCount:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "q"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - 7: {"type": b"@"}, - 8: {"type": "q"}, - }, - }, - ) - r( - b"NSObject", - b"textView:doCommandBySelector:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": ":", "sel_of_type": b"v@:@"}}, - }, - ) - r( - b"NSObject", - b"textView:doubleClickedOnCell:inRect:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"textView:doubleClickedOnCell:inRect:atIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"textView:draggedCell:inRect:event:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"textView:draggedCell:inRect:event:atIndex:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": b"@"}, - 6: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"textView:menu:forEvent:atIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"textView:shouldChangeTextInRange:replacementString:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"textView:shouldChangeTextInRanges:replacementStrings:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textView:shouldChangeTypingAttributes:toAttributes:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textView:shouldSelectCandidateAtIndex:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"textView:shouldSetSpellingState:range:", - { - "required": False, - "retval": {"type": "q"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "q"}, - 4: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"textView:shouldUpdateTouchBarItemIdentifiers:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textView:willChangeSelectionFromCharacterRange:toCharacterRange:", - { - "required": False, - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSObject", - b"textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textView:willCheckTextInRange:options:types:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": b"@"}, - 5: {"type": "^q", "type_modifier": b"N"}, - }, - }, - ) - r( - b"NSObject", - b"textView:willDisplayToolTip:forCharacterAtIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"textView:willShowSharingServicePicker:forItems:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textView:writablePasteboardTypesForCell:atIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"textView:writeCell:atIndex:toPasteboard:type:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "Q"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"textViewDidChangeSelection:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textViewDidChangeTypingAttributes:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textViewportLayoutController:configureRenderingSurfaceForTextLayoutFragment:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"textViewportLayoutControllerDidLayout:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"textViewportLayoutControllerWillLayout:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"title", {"required": False, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "^q", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"tokenField:displayStringForRepresentedObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenField:editingStringForRepresentedObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenField:hasMenuForRepresentedObject:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenField:menuForRepresentedObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenField:readFromPasteboard:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenField:representedObjectForEditingString:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenField:shouldAddObjects:atIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"tokenField:styleForRepresentedObject:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenField:writeRepresentedObjects:toPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "q"}, - 5: {"type": "^q", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:displayStringForRepresentedObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:editingStringForRepresentedObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:hasMenuForRepresentedObject:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:menuForRepresentedObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:readFromPasteboard:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:representedObjectForEditingString:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:shouldAddObjects:atIndex:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:styleForRepresentedObject:", - { - "required": False, - "retval": {"type": "Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"tokenFieldCell:writeRepresentedObjects:toPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"toolbar:itemIdentifier:canBeInsertedAtIndex:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"toolbarAllowedItemIdentifiers:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"toolbarDefaultItemIdentifiers:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"toolbarDidRemoveItem:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"toolbarImmovableItemIdentifiers:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"toolbarSelectableItemIdentifiers:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"toolbarWillAddItem:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"touchBar", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"touchBar:makeItemForIdentifier:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"trackMouse:inRect:ofView:atCharacterIndex:untilMouseUp:", - { - "required": True, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": b"@"}, - 5: {"type": "Q"}, - 6: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"trackMouse:inRect:ofView:untilMouseUp:", - { - "required": True, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": b"@"}, - 5: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"transpose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"transposeWords:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"unbind:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"undoManagerForTextView:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"unionRectInVisibleSelectedRange", - {"required": False, "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSObject", b"unmarkText", {"required": True, "retval": {"type": b"v"}}) - r( - b"NSObject", - b"updateDraggingItemsForDrag:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"uppercaseWord:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"validAttributesForMarkedText", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"validModesForFontPanel:", - {"required": False, "retval": {"type": "Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"validateMenuItem:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"validateToolbarItem:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"validateUserInterfaceItem:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"value", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"valueClassForBinding:", - {"retval": {"type": "#"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"view:stringForToolTip:point:userData:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "i"}, - 4: {"type": "{CGPoint=dd}"}, - 5: {"type": "^v"}, - }, - }, - ) - r( - b"NSObject", - b"viewForRange:firstRect:actualRange:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"{_NSRange=QQ}"}, - 3: { - "type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}", - "type_modifier": b"o", - }, - 4: {"type": b"^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"viewProviderForParentView:location:textContainer:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"viewSizeChanged:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"viewportBoundsForTextViewportLayoutController:", - { - "required": True, - "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"visibleCharacterRanges", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"wantsPeriodicDraggingUpdates", - {"required": False, "retval": {"type": "Z"}}, - ) - r( - b"NSObject", - b"wantsToDelayTextChangeNotifications", - {"required": True, "retval": {"type": "Z"}}, - ) - r( - b"NSObject", - b"wantsToHandleMouseEvents", - {"required": True, "retval": {"type": "Z"}}, - ) - r( - b"NSObject", - b"wantsToInterpretAllKeystrokes", - {"required": True, "retval": {"type": "Z"}}, - ) - r(b"NSObject", b"wantsToTrackMouse", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"wantsToTrackMouseForEvent:inRect:ofView:atCharacterIndex:", - { - "required": True, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": b"@"}, - 5: {"type": "Q"}, - }, - }, - ) - r( - b"NSObject", - b"willTransitionFromLayout:toLayout:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"window:didDecodeRestorableState:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"window:shouldDragDocumentWithEvent:from:withPasteboard:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGPoint=dd}"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"window:shouldPopUpDocumentPathMenu:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"window:startCustomAnimationToEnterFullScreenOnScreen:withDuration:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"d"}}, - }, - ) - r( - b"NSObject", - b"window:startCustomAnimationToEnterFullScreenWithDuration:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}}, - }, - ) - r( - b"NSObject", - b"window:startCustomAnimationToExitFullScreenWithDuration:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}}, - }, - ) - r( - b"NSObject", - b"window:willEncodeRestorableState:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"window:willPositionSheet:usingRect:", - { - "required": False, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"window:willResizeForVersionBrowserWithMaxPreferredSize:maxAllowedSize:", - { - "required": False, - "retval": {"type": b"{CGSize=dd}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"{CGSize=dd}"}, - 4: {"type": b"{CGSize=dd}"}, - }, - }, - ) - r( - b"NSObject", - b"window:willUseFullScreenContentSize:", - { - "required": False, - "retval": {"type": b"{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"{CGSize=dd}"}}, - }, - ) - r( - b"NSObject", - b"window:willUseFullScreenPresentationOptions:", - { - "required": False, - "retval": {"type": b"Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"Q"}}, - }, - ) - r( - b"NSObject", - b"windowDidBecomeKey:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidBecomeMain:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidChangeBackingProperties:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidChangeOcclusionState:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidChangeScreen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidChangeScreenProfile:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidDeminiaturize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidEndLiveResize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidEndSheet:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidEnterFullScreen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidEnterVersionBrowser:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidExitFullScreen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidExitVersionBrowser:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidExpose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidFailToEnterFullScreen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidFailToExitFullScreen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidMiniaturize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidMove:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidResignKey:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidResignMain:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidResize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowDidUpdate:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"windowLevel", {"required": False, "retval": {"type": "q"}}) - r( - b"NSObject", - b"windowShouldClose:", - {"required": False, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowShouldZoom:toFrame:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"windowWillBeginSheet:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillClose:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillEnterFullScreen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillEnterVersionBrowser:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillExitFullScreen:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillExitVersionBrowser:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillMiniaturize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillMove:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillResize:toSize:", - { - "required": False, - "retval": {"type": "{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "{CGSize=dd}"}}, - }, - ) - r( - b"NSObject", - b"windowWillReturnFieldEditor:toObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"windowWillReturnUndoManager:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillStartLiveResize:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"windowWillUseStandardFrame:defaultFrame:", - { - "required": False, - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"writableTypesForPasteboard:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"writeSelectionToPasteboard:types:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"writingOptionsForType:pasteboard:", - { - "required": False, - "retval": {"type": b"Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"yank:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"zIndex", {"required": True, "retval": {"type": b"q"}}) - r(b"NSObjectController", b"automaticallyPreparesContent", {"retval": {"type": "Z"}}) - r(b"NSObjectController", b"canAdd", {"retval": {"type": "Z"}}) - r(b"NSObjectController", b"canRemove", {"retval": {"type": "Z"}}) - r( - b"NSObjectController", - b"fetchWithRequest:merge:error:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "Z"}, 4: {"type_modifier": b"o"}}, - }, - ) - r(b"NSObjectController", b"isEditable", {"retval": {"type": "Z"}}) - r( - b"NSObjectController", - b"setAutomaticallyPreparesContent:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSObjectController", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSObjectController", - b"setUsesLazyFetching:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Z"}}}, - ) - r(b"NSObjectController", b"usesLazyFetching", {"retval": {"type": "Z"}}) - r(b"NSObjectController", b"validateUserInterfaceItem:", {"retval": {"type": "Z"}}) - r(b"NSOpenGLContext", b"CGLContextObj", {"retval": {"type": "^{_CGLContextObj}"}}) - r( - b"NSOpenGLContext", - b"getValues:forParameter:", - {"arguments": {2: {"type": "^i"}}}, - ) - r( - b"NSOpenGLContext", - b"setOffScreen:width:height:rowbytes:", - {"arguments": {2: {"type_modifier": b"n", "c_array_of_variable_length": True}}}, - ) - r( - b"NSOpenGLContext", - b"setValues:forParameter:", - {"arguments": {2: {"type_modifier": b"n", "c_array_of_variable_length": True}}}, - ) - r( - b"NSOpenGLLayer", - b"canDrawInOpenGLContext:pixelFormat:forLayerTime:displayTime:", - { - "retval": {"type": "Z"}, - "arguments": { - 5: { - "type": b"^{_CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": b"n", - } - }, - }, - ) - r( - b"NSOpenGLLayer", - b"drawInOpenGLContext:pixelFormat:forLayerTime:displayTime:", - { - "arguments": { - 5: { - "type": b"^{_CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSOpenGLPixelFormat", - b"CGLPixelFormatObj", - {"retval": {"type": "^{_CGLPixelFormatObject}"}}, - ) - r( - b"NSOpenGLPixelFormat", - b"getValues:forAttribute:forVirtualScreen:", - {"arguments": {2: {"type": "^i", "type_modifier": b"o"}}}, - ) - r( - b"NSOpenGLPixelFormat", - b"initWithAttributes:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "r^I", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSOpenGLView", - b"initWithFrame:pixelFormat:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSOpenGLView", - b"setWantsBestResolutionOpenGLSurface:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSOpenGLView", - b"setWantsExtendedDynamicRangeOpenGLSurface:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSOpenGLView", b"wantsBestResolutionOpenGLSurface", {"retval": {"type": b"Z"}}) - r( - b"NSOpenGLView", - b"wantsExtendedDynamicRangeOpenGLSurface", - {"retval": {"type": b"Z"}}, - ) - r(b"NSOpenPanel", b"allowsMultipleSelection", {"retval": {"type": "Z"}}) - r( - b"NSOpenPanel", - b"beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:", - {"arguments": {6: {"type": ":", "sel_of_type": b"v@:@q^v"}, 7: {"type": "^v"}}}, - ) - r( - b"NSOpenPanel", - b"beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", - {"arguments": {7: {"sel_of_type": b"v@:@q^v"}, 8: {"type": "^v"}}}, - ) - r(b"NSOpenPanel", b"canChooseDirectories", {"retval": {"type": "Z"}}) - r(b"NSOpenPanel", b"canChooseFiles", {"retval": {"type": "Z"}}) - r(b"NSOpenPanel", b"canDownloadUbiquitousContents", {"retval": {"type": b"Z"}}) - r(b"NSOpenPanel", b"canResolveUbiquitousConflicts", {"retval": {"type": b"Z"}}) - r(b"NSOpenPanel", b"isAccessoryViewDisclosed", {"retval": {"type": "Z"}}) - r(b"NSOpenPanel", b"resolvesAliases", {"retval": {"type": "Z"}}) - r(b"NSOpenPanel", b"setAccessoryViewDisclosed:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSOpenPanel", b"setAllowsMultipleSelection:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSOpenPanel", b"setCanChooseDirectories:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSOpenPanel", b"setCanChooseFiles:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSOpenPanel", - b"setCanDownloadUbiquitousContents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSOpenPanel", - b"setCanResolveUbiquitousConflicts:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSOpenPanel", b"setResolvesAliases:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSOutlineView", b"autoresizesOutlineColumn", {"retval": {"type": "Z"}}) - r(b"NSOutlineView", b"autosaveExpandedItems", {"retval": {"type": "Z"}}) - r( - b"NSOutlineView", - b"collapseItem:collapseChildren:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOutlineView", - b"expandItem:expandChildren:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOutlineView", - b"frameOfOutlineCellAtRow:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSOutlineView", b"indentationMarkerFollowsCell", {"retval": {"type": "Z"}}) - r(b"NSOutlineView", b"isExpandable:", {"retval": {"type": "Z"}}) - r(b"NSOutlineView", b"isItemExpanded:", {"retval": {"type": "Z"}}) - r( - b"NSOutlineView", - b"reloadItem:reloadChildren:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOutlineView", - b"setAutoresizesOutlineColumn:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSOutlineView", b"setAutosaveExpandedItems:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSOutlineView", - b"setIndentationMarkerFollowsCell:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSOutlineView", - b"setStronglyReferencesItems:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSOutlineView", - b"shouldCollapseAutoExpandedItemsForDeposited:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "Z"}}}, - ) - r(b"NSOutlineView", b"stronglyReferencesItems", {"retval": {"type": "Z"}}) - r( - b"NSPDFImageRep", - b"bounds", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSPDFInfo", b"isFileExtensionHidden", {"retval": {"type": b"Z"}}) - r(b"NSPDFInfo", b"setFileExtensionHidden:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSPDFPanel", - b"beginSheetWithPDFInfo:modalForWindow:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSPICTImageRep", - b"boundingBox", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSPageLayout", - b"beginSheetUsingPrintInfo:onWindow:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSPageLayout", - b"beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": b"v@:@q^v"}, 6: {"type": "^v"}}}, - ) - r(b"NSPanel", b"becomesKeyOnlyIfNeeded", {"retval": {"type": "Z"}}) - r(b"NSPanel", b"isFloatingPanel", {"retval": {"type": "Z"}}) - r(b"NSPanel", b"setBecomesKeyOnlyIfNeeded:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPanel", b"setFloatingPanel:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPanel", b"setWorksWhenModal:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPanel", b"worksWhenModal", {"retval": {"type": "Z"}}) - r( - b"NSParagraphStyle", - b"allowsDefaultTighteningForTruncation", - {"retval": {"type": "Z"}}, - ) - r(b"NSParagraphStyle", b"usesDefaultHyphenation", {"retval": {"type": "Z"}}) - r( - b"NSPasteboard", - b"canReadItemWithDataConformingToTypes:", - {"retval": {"type": "Z"}}, - ) - r(b"NSPasteboard", b"canReadObjectForClasses:options:", {"retval": {"type": "Z"}}) - r(b"NSPasteboard", b"setData:forType:", {"retval": {"type": "Z"}}) - r(b"NSPasteboard", b"setPropertyList:forType:", {"retval": {"type": "Z"}}) - r(b"NSPasteboard", b"setString:forType:", {"retval": {"type": "Z"}}) - r(b"NSPasteboard", b"writeFileContents:", {"retval": {"type": "Z"}}) - r(b"NSPasteboard", b"writeFileWrapper:", {"retval": {"type": "Z"}}) - r(b"NSPasteboard", b"writeObjects:", {"retval": {"type": "Z"}}) - r(b"NSPasteboardItem", b"setData:forType:", {"retval": {"type": "Z"}}) - r(b"NSPasteboardItem", b"setDataProvider:forTypes:", {"retval": {"type": "Z"}}) - r(b"NSPasteboardItem", b"setPropertyList:forType:", {"retval": {"type": "Z"}}) - r(b"NSPasteboardItem", b"setString:forType:", {"retval": {"type": "Z"}}) - r( - b"NSPathCell", - b"mouseEntered:withFrame:inView:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSPathCell", - b"mouseExited:withFrame:inView:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSPathCell", - b"pathComponentCellAtPoint:withFrame:inView:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSPathCell", - b"rectOfPathComponentCell:withFrame:inView:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSPathCell", - b"setDoubleAction:", - {"retval": {"type": "v"}, "arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSPathControl", b"isEditable", {"retval": {"type": b"Z"}}) - r( - b"NSPathControl", - b"setDoubleAction:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSPathControl", - b"setDraggingSourceOperationMask:forLocal:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSPathControl", b"setEditable:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSPersistentDocument", - b"configurePersistentStoreCoordinatorForURL:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSPersistentDocument", - b"configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSPersistentDocument", - b"readFromURL:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSPersistentDocument", - b"revertToContentsOfURL:ofType:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSPersistentDocument", - b"writeToURL:ofType:forSaveOperation:originalContentsURL:error:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r(b"NSPickerTouchBarItem", b"isEnabled", {"retval": {"type": b"Z"}}) - r(b"NSPickerTouchBarItem", b"isEnabledAtIndex:", {"retval": {"type": b"Z"}}) - r( - b"NSPickerTouchBarItem", - b"pickerTouchBarItemWithIdentifier:images:selectionMode:target:action:", - {"arguments": {6: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSPickerTouchBarItem", - b"pickerTouchBarItemWithIdentifier:labels:selectionMode:target:action:", - {"arguments": {6: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSPickerTouchBarItem", - b"setAction:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSPickerTouchBarItem", b"setEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSPickerTouchBarItem", - b"setEnabled:atIndex:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSPopUpButton", b"autoenablesItems", {"retval": {"type": "Z"}}) - r( - b"NSPopUpButton", - b"indexOfItemWithTarget:andAction:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSPopUpButton", - b"initWithFrame:pullsDown:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Z"}, - } - }, - ) - r(b"NSPopUpButton", b"pullsDown", {"retval": {"type": "Z"}}) - r(b"NSPopUpButton", b"selectItemWithTag:", {"retval": {"type": "Z"}}) - r(b"NSPopUpButton", b"setAutoenablesItems:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPopUpButton", b"setPullsDown:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPopUpButtonCell", b"altersStateOfSelectedItem", {"retval": {"type": "Z"}}) - r( - b"NSPopUpButtonCell", - b"attachPopUpWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSPopUpButtonCell", b"autoenablesItems", {"retval": {"type": "Z"}}) - r( - b"NSPopUpButtonCell", - b"indexOfItemWithTarget:andAction:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSPopUpButtonCell", - b"initTextCell:pullsDown:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSPopUpButtonCell", - b"performClickWithFrame:inView:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSPopUpButtonCell", b"pullsDown", {"retval": {"type": "Z"}}) - r(b"NSPopUpButtonCell", b"selectItemWithTag:", {"retval": {"type": "Z"}}) - r( - b"NSPopUpButtonCell", - b"setAltersStateOfSelectedItem:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSPopUpButtonCell", b"setAutoenablesItems:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPopUpButtonCell", b"setPullsDown:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPopUpButtonCell", b"setUsesItemFromMenu:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPopUpButtonCell", b"usesItemFromMenu", {"retval": {"type": "Z"}}) - r(b"NSPopover", b"animates", {"retval": {"type": b"Z"}}) - r(b"NSPopover", b"hasFullSizeContent", {"retval": {"type": b"Z"}}) - r(b"NSPopover", b"isDetached", {"retval": {"type": "Z"}}) - r(b"NSPopover", b"isShown", {"retval": {"type": b"Z"}}) - r(b"NSPopover", b"setAnimates:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSPopover", b"setDetached:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPopover", b"setHasFullSizeContent:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSPopover", b"setShown:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSPopoverTouchBarItem", - b"setShowsCloseButton:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSPopoverTouchBarItem", b"showsCloseButton", {"retval": {"type": "Z"}}) - r(b"NSPrintInfo", b"PMPageFormat", {"retval": {"type": "^{OpaquePMPageFormat=}"}}) - r( - b"NSPrintInfo", - b"PMPrintSession", - {"retval": {"type": "^{OpaquePMPrintSession=}"}}, - ) - r( - b"NSPrintInfo", - b"PMPrintSettings", - {"retval": {"type": "^{OpaquePMPrintSettings=}"}}, - ) - r( - b"NSPrintInfo", - b"imageablePageBounds", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSPrintInfo", b"isHorizontallyCentered", {"retval": {"type": "Z"}}) - r(b"NSPrintInfo", b"isSelectionOnly", {"retval": {"type": "Z"}}) - r(b"NSPrintInfo", b"isVerticallyCentered", {"retval": {"type": "Z"}}) - r(b"NSPrintInfo", b"paperSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSPrintInfo", b"setHorizontallyCentered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPrintInfo", b"setPaperSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSPrintInfo", b"setSelectionOnly:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPrintInfo", b"setVerticallyCentered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPrintInfo", b"sizeForPaperName:", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSPrintOperation", - b"EPSOperationWithView:insideRect:toData:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSPrintOperation", - b"EPSOperationWithView:insideRect:toData:printInfo:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSPrintOperation", - b"EPSOperationWithView:insideRect:toPath:printInfo:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSPrintOperation", - b"PDFOperationWithView:insideRect:toData:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSPrintOperation", - b"PDFOperationWithView:insideRect:toData:printInfo:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSPrintOperation", - b"PDFOperationWithView:insideRect:toPath:printInfo:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSPrintOperation", b"canSpawnSeparateThread", {"retval": {"type": "Z"}}) - r(b"NSPrintOperation", b"deliverResult", {"retval": {"type": "Z"}}) - r(b"NSPrintOperation", b"isCopyingOperation", {"retval": {"type": "Z"}}) - r(b"NSPrintOperation", b"pageRange", {"retval": {"type": "{_NSRange=QQ}"}}) - r(b"NSPrintOperation", b"runOperation", {"retval": {"type": "Z"}}) - r( - b"NSPrintOperation", - b"runOperationModalForWindow:delegate:didRunSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": b"v@:@Z^v"}, 5: {"type": "^v"}}}, - ) - r( - b"NSPrintOperation", - b"setCanSpawnSeparateThread:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSPrintOperation", b"setShowPanels:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPrintOperation", b"setShowsPrintPanel:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPrintOperation", b"setShowsProgressPanel:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSPrintOperation", b"showPanels", {"retval": {"type": "Z"}}) - r(b"NSPrintOperation", b"showsPrintPanel", {"retval": {"type": "Z"}}) - r(b"NSPrintOperation", b"showsProgressPanel", {"retval": {"type": "Z"}}) - r( - b"NSPrintPanel", - b"beginSheetUsingPrintInfo:onWindow:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSPrintPanel", - b"beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": b"v@:@q^v"}, 6: {"type": "^v"}}}, - ) - r(b"NSPrinter", b"acceptsBinary", {"retval": {"type": "Z"}}) - r(b"NSPrinter", b"booleanForKey:inTable:", {"retval": {"type": "Z"}}) - r( - b"NSPrinter", - b"imageRectForPaper:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSPrinter", b"isColor", {"retval": {"type": "Z"}}) - r(b"NSPrinter", b"isFontAvailable:", {"retval": {"type": "Z"}}) - r(b"NSPrinter", b"isKey:inTable:", {"retval": {"type": "Z"}}) - r(b"NSPrinter", b"isOutputStackInReverseOrder", {"retval": {"type": "Z"}}) - r(b"NSPrinter", b"pageSizeForPaper:", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSPrinter", - b"printerWithName:domain:includeUnavailable:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSPrinter", - b"rectForKey:inTable:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSPrinter", b"sizeForKey:inTable:", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSProgressIndicator", b"isBezeled", {"retval": {"type": "Z"}}) - r(b"NSProgressIndicator", b"isDisplayedWhenStopped", {"retval": {"type": "Z"}}) - r(b"NSProgressIndicator", b"isIndeterminate", {"retval": {"type": "Z"}}) - r(b"NSProgressIndicator", b"setBezeled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSProgressIndicator", - b"setDisplayedWhenStopped:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSProgressIndicator", b"setIndeterminate:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSProgressIndicator", - b"setUsesThreadedAnimation:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSProgressIndicator", b"usesThreadedAnimation", {"retval": {"type": "Z"}}) - r(b"NSQuickDrawView", b"qdPort", {"retval": {"type": "^v"}}) - r(b"NSResponder", b"acceptsFirstResponder", {"retval": {"type": "Z"}}) - r(b"NSResponder", b"becomeFirstResponder", {"retval": {"type": "Z"}}) - r( - b"NSResponder", - b"doCommandBySelector:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSResponder", b"noResponderFor:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r(b"NSResponder", b"performKeyEquivalent:", {"retval": {"type": "Z"}}) - r(b"NSResponder", b"performMnemonic:", {"retval": {"type": "Z"}}) - r(b"NSResponder", b"presentError:", {"retval": {"type": "Z"}}) - r( - b"NSResponder", - b"presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": b"v@:Z^v"}, 6: {"type": "^v"}}}, - ) - r(b"NSResponder", b"resignFirstResponder", {"retval": {"type": "Z"}}) - r(b"NSResponder", b"shouldBeTreatedAsInkEvent:", {"retval": {"type": "Z"}}) - r( - b"NSResponder", - b"supplementalTargetForAction:sender:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSResponder", - b"tryToPerform:with:", - {"retval": {"type": "Z"}, "arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSResponder", - b"validateProposedFirstResponder:forEvent:", - {"retval": {"type": b"Z"}}, - ) - r(b"NSResponder", b"wantsForwardedScrollEventsForAxis:", {"retval": {"type": b"Z"}}) - r( - b"NSResponder", - b"wantsScrollEventsForSwipeTrackingOnAxis:", - {"retval": {"type": b"Z"}}, - ) - r(b"NSRuleEditor", b"canRemoveAllRows", {"retval": {"type": "Z"}}) - r( - b"NSRuleEditor", - b"insertRowAtIndex:withType:asSubrowOfRow:animate:", - {"arguments": {5: {"type": "Z"}}}, - ) - r(b"NSRuleEditor", b"isEditable", {"retval": {"type": "Z"}}) - r( - b"NSRuleEditor", - b"removeRowsAtIndexes:includeSubrows:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSRuleEditor", - b"selectRowIndexes:byExtendingSelection:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSRuleEditor", b"setCanRemoveAllRows:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSRuleEditor", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSRulerMarker", - b"drawRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSRulerMarker", b"imageOrigin", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSRulerMarker", - b"imageRectInRuler", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSRulerMarker", - b"initWithRulerView:markerLocation:image:imageOrigin:", - {"arguments": {5: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSRulerMarker", b"isDragging", {"retval": {"type": "Z"}}) - r(b"NSRulerMarker", b"isMovable", {"retval": {"type": "Z"}}) - r(b"NSRulerMarker", b"isRemovable", {"retval": {"type": "Z"}}) - r( - b"NSRulerMarker", - b"setImageOrigin:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSRulerMarker", b"setMovable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSRulerMarker", b"setRemovable:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSRulerMarker", - b"trackMouse:adding:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSRulerView", - b"drawHashMarksAndLabelsInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSRulerView", - b"drawMarkersInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSRulerView", b"isFlipped", {"retval": {"type": "Z"}}) - r(b"NSRulerView", b"trackMarker:withMouseEvent:", {"retval": {"type": "Z"}}) - r( - b"NSRunningApplication", - b"activateFromApplication:options:", - {"retval": {"type": b"Z"}}, - ) - r(b"NSRunningApplication", b"activateWithOptions:", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"forceTerminate", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"hide", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"isActive", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"isFinishedLaunching", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"isTerminated", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"ownsMenuBar", {"retval": {"type": b"Z"}}) - r(b"NSRunningApplication", b"terminate", {"retval": {"type": "Z"}}) - r(b"NSRunningApplication", b"unhide", {"retval": {"type": "Z"}}) - r(b"NSSavePanel", b"allowsOtherFileTypes", {"retval": {"type": "Z"}}) - r( - b"NSSavePanel", - b"beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:", - {"arguments": {6: {"type": ":", "sel_of_type": b"v@:@q^v"}, 7: {"type": "^v"}}}, - ) - r( - b"NSSavePanel", - b"beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:", - {"arguments": {6: {"sel_of_type": b"v@:@q^v"}, 7: {"type": "^v"}}}, - ) - r( - b"NSSavePanel", - b"beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", - {"arguments": {7: {"sel_of_type": b"v@:@q^v"}, 8: {"type": "^v"}}}, - ) - r( - b"NSSavePanel", - b"beginSheetModalForWindow:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSSavePanel", - b"beginWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r(b"NSSavePanel", b"canCreateDirectories", {"retval": {"type": "Z"}}) - r(b"NSSavePanel", b"canSelectHiddenExtension", {"retval": {"type": "Z"}}) - r(b"NSSavePanel", b"isExpanded", {"retval": {"type": "Z"}}) - r(b"NSSavePanel", b"isExtensionHidden", {"retval": {"type": "Z"}}) - r(b"NSSavePanel", b"setAllowsOtherFileTypes:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSavePanel", b"setCanCreateDirectories:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSSavePanel", - b"setCanSelectHiddenExtension:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSavePanel", b"setExtensionHidden:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSavePanel", b"setShowsHiddenFiles:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSavePanel", b"setShowsTagField:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSSavePanel", - b"setTreatsFilePackagesAsDirectories:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSavePanel", b"showsHiddenFiles", {"retval": {"type": "Z"}}) - r(b"NSSavePanel", b"showsTagField", {"retval": {"type": b"Z"}}) - r(b"NSSavePanel", b"treatsFilePackagesAsDirectories", {"retval": {"type": "Z"}}) - r(b"NSScreen", b"canRepresentDisplayGamut:", {"retval": {"type": "Z"}}) - r( - b"NSScreen", - b"displayLinkWithTarget:selector:", - {"arguments": {3: {"type": ":", "sel_of_type": b"v@:@"}}}, - ) - r(b"NSScreen", b"frame", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r(b"NSScreen", b"screensHaveSeparateSpaces", {"retval": {"type": b"Z"}}) - r( - b"NSScreen", - b"supportedWindowDepths", - {"retval": {"c_array_delimited_by_null": True}}, - ) - r( - b"NSScreen", - b"visibleFrame", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSScrollView", b"allowsMagnification", {"retval": {"type": b"Z"}}) - r(b"NSScrollView", b"autohidesScrollers", {"retval": {"type": "Z"}}) - r(b"NSScrollView", b"automaticallyAdjustsContentInsets", {"retval": {"type": b"Z"}}) - r(b"NSScrollView", b"contentSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSScrollView", - b"contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType:", - { - "retval": {"type": "{CGSize=dd}"}, - "arguments": { - 2: {"type": "{CGSize=dd}"}, - 3: {"type": "Z"}, - 4: {"type": "Z"}, - }, - }, - ) - r( - b"NSScrollView", - b"documentVisibleRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSScrollView", b"drawsBackground", {"retval": {"type": "Z"}}) - r( - b"NSScrollView", - b"frameSizeForContentSize:hasHorizontalScroller:hasVerticalScroller:borderType:", - { - "retval": {"type": "{CGSize=dd}"}, - "arguments": { - 2: {"type": "{CGSize=dd}"}, - 3: {"type": "Z"}, - 4: {"type": "Z"}, - }, - }, - ) - r(b"NSScrollView", b"hasHorizontalRuler", {"retval": {"type": "Z"}}) - r(b"NSScrollView", b"hasHorizontalScroller", {"retval": {"type": "Z"}}) - r(b"NSScrollView", b"hasVerticalRuler", {"retval": {"type": "Z"}}) - r(b"NSScrollView", b"hasVerticalScroller", {"retval": {"type": "Z"}}) - r(b"NSScrollView", b"rulersVisible", {"retval": {"type": "Z"}}) - r(b"NSScrollView", b"scrollsDynamically", {"retval": {"type": "Z"}}) - r(b"NSScrollView", b"setAllowsMagnification:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSScrollView", b"setAutohidesScrollers:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSScrollView", - b"setAutomaticallyAdjustsContentInsets:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSScrollView", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrollView", b"setHasHorizontalRuler:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrollView", b"setHasHorizontalScroller:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrollView", b"setHasVerticalRuler:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrollView", b"setHasVerticalScroller:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrollView", b"setRulersVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrollView", b"setScrollsDynamically:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSScrollView", - b"setUsesPredominantAxisScrolling:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSScrollView", b"usesPredominantAxisScrolling", {"retval": {"type": b"Z"}}) - r(b"NSScroller", b"drawArrow:highlight:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSScroller", - b"drawKnobSlotInRect:highlight:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Z"}, - } - }, - ) - r(b"NSScroller", b"highlight:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScroller", b"isCompatibleWithOverlayScrollers", {"retval": {"type": b"Z"}}) - r( - b"NSScroller", - b"rectForPart:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSScroller", b"testPart:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSScrubber", b"floatsSelectionViews", {"retval": {"type": "Z"}}) - r(b"NSScrubber", b"isContinuous", {"retval": {"type": "Z"}}) - r( - b"NSScrubber", - b"performSequentialBatchUpdates:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSScrubber", b"setContinuous:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrubber", b"setFloatsSelectionViews:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSScrubber", - b"setShowsAdditionalContentIndicators:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSScrubber", b"setShowsArrowButtons:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrubber", b"showsAdditionalContentIndicators", {"retval": {"type": "Z"}}) - r(b"NSScrubber", b"showsArrowButtons", {"retval": {"type": "Z"}}) - r(b"NSScrubberArrangedView", b"isHighlighted", {"retval": {"type": "Z"}}) - r(b"NSScrubberArrangedView", b"isSelected", {"retval": {"type": "Z"}}) - r(b"NSScrubberArrangedView", b"setHighlighted:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSScrubberArrangedView", b"setSelected:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSScrubberLayout", - b"automaticallyMirrorsInRightToLeftLayout", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScrubberLayout", - b"shouldInvalidateLayoutForChangeFromVisibleRect:toVisibleRect:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScrubberLayout", - b"shouldInvalidateLayoutForHighlightChange", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScrubberLayout", - b"shouldInvalidateLayoutForSelectionChange", - {"retval": {"type": "Z"}}, - ) - r(b"NSSearchField", b"centersPlaceholder", {"retval": {"type": "Z"}}) - r( - b"NSSearchField", - b"rectForCancelButtonWhenCentered:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSearchField", - b"rectForSearchButtonWhenCentered:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSearchField", - b"rectForSearchTextWhenCentered:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSearchField", b"sendsSearchStringImmediately", {"retval": {"type": b"Z"}}) - r(b"NSSearchField", b"sendsWholeSearchString", {"retval": {"type": b"Z"}}) - r(b"NSSearchField", b"setCentersPlaceholder:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSSearchField", - b"setSendsSearchStringImmediately:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSSearchField", - b"setSendsWholeSearchString:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSSearchFieldCell", - b"cancelButtonRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSSearchFieldCell", - b"searchButtonRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSSearchFieldCell", - b"searchTextRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSSearchFieldCell", b"sendsSearchStringImmediately", {"retval": {"type": "Z"}}) - r(b"NSSearchFieldCell", b"sendsWholeSearchString", {"retval": {"type": "Z"}}) - r( - b"NSSearchFieldCell", - b"setSendsSearchStringImmediately:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSearchFieldCell", - b"setSendsWholeSearchString:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSearchToolbarItem", - b"resignsFirstResponderWithCancel", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSearchToolbarItem", - b"setResignsFirstResponderWithCancel:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSSecureTextFieldCell", b"echosBullets", {"retval": {"type": "Z"}}) - r(b"NSSecureTextFieldCell", b"setEchosBullets:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSSegmentedCell", - b"drawSegment:inFrame:withView:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSSegmentedCell", b"isEnabledForSegment:", {"retval": {"type": "Z"}}) - r(b"NSSegmentedCell", b"isSelectedForSegment:", {"retval": {"type": "Z"}}) - r(b"NSSegmentedCell", b"selectSegmentWithTag:", {"retval": {"type": "Z"}}) - r(b"NSSegmentedCell", b"setEnabled:forSegment:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSegmentedCell", b"setSelected:forSegment:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSegmentedControl", b"isEnabledForSegment:", {"retval": {"type": "Z"}}) - r(b"NSSegmentedControl", b"isSelectedForSegment:", {"retval": {"type": "Z"}}) - r(b"NSSegmentedControl", b"isSpringLoaded", {"retval": {"type": b"Z"}}) - r( - b"NSSegmentedControl", - b"segmentedControlWithImages:trackingMode:target:action:", - {"arguments": {5: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSSegmentedControl", - b"segmentedControlWithLabels:trackingMode:target:action:", - {"arguments": {5: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSSegmentedControl", b"selectSegmentWithTag:", {"retval": {"type": "Z"}}) - r( - b"NSSegmentedControl", - b"setEnabled:forSegment:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSegmentedControl", - b"setSelected:forSegment:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSegmentedControl", - b"setShowsMenuIndicator:forSegment:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSegmentedControl", b"setSpringLoaded:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSSegmentedControl", - b"showsMenuIndicatorForSegment:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSSet", - b"enumerateIndexPathsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r(b"NSShadow", b"setShadowOffset:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSShadow", b"shadowOffset", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSSharingService", b"canPerformWithItems:", {"retval": {"type": b"Z"}}) - r( - b"NSSharingService", - b"initWithTitle:image:alternateImage:handler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSSharingServicePickerTouchBarItem", b"isEnabled", {"retval": {"type": "Z"}}) - r( - b"NSSharingServicePickerTouchBarItem", - b"setEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSimpleHorizontalTypesetter", - b"growGlyphCaches:fillGlyphInfo:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSSimpleHorizontalTypesetter", - b"layoutControlGlyphForLineFragment:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSSimpleHorizontalTypesetter", - b"layoutGlyphsInHorizontalLineFragment:baseline:", - {"arguments": {2: {"type_modifier": b"N"}, 3: {"type_modifier": b"N"}}}, - ) - r( - b"NSSimpleHorizontalTypesetter", - b"layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSSimpleHorizontalTypesetter", - b"typesetterLaidOneGlyph:", - {"arguments": {2: {"type_modifier": b"N"}}}, - ) - r( - b"NSSimpleHorizontalTypesetter", - b"willSetLineFragmentRect:forGlyphRange:usedRect:", - { - "arguments": { - 2: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - } - }, - ) - r(b"NSSlider", b"acceptsFirstMouse:", {"retval": {"type": "Z"}}) - r(b"NSSlider", b"allowsTickMarkValuesOnly", {"retval": {"type": "Z"}}) - r( - b"NSSlider", - b"indexOfTickMarkAtPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSSlider", b"isVertical", {"retval": {"type": "Z"}}) - r( - b"NSSlider", - b"rectOfTickMarkAtIndex:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSSlider", b"setAllowsTickMarkValuesOnly:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSlider", b"setVertical:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSSlider", - b"sliderWithValue:minValue:maxValue:target:action:", - {"arguments": {6: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSSliderAccessory", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSSliderAccessory", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSSliderAccessoryBehavior", - b"behaviorWithHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSSliderCell", b"allowsTickMarkValuesOnly", {"retval": {"type": "Z"}}) - r(b"NSSliderCell", b"barRectFlipped:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSSliderCell", - b"drawBarInside:flipped:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Z"}, - } - }, - ) - r( - b"NSSliderCell", - b"drawKnob:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSSliderCell", - b"indexOfTickMarkAtPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSSliderCell", b"isVertical", {"retval": {"type": "Z"}}) - r( - b"NSSliderCell", - b"knobRectFlipped:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "Z"}}, - }, - ) - r(b"NSSliderCell", b"prefersTrackingUntilMouseUp", {"retval": {"type": "Z"}}) - r( - b"NSSliderCell", - b"rectOfTickMarkAtIndex:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "q"}}, - }, - ) - r( - b"NSSliderCell", - b"setAllowsTickMarkValuesOnly:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSliderCell", b"setVertical:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSSliderCell", - b"trackRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSSound", - b"canInitWithPasteboard:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "@"}}}, - ) - r( - b"NSSound", - b"initWithContentsOfFile:byReference:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSSound", - b"initWithContentsOfURL:byReference:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSSound", b"isPlaying", {"retval": {"type": "Z"}}) - r(b"NSSound", b"loops", {"retval": {"type": "Z"}}) - r(b"NSSound", b"name", {"retval": {"type": "@"}}) - r(b"NSSound", b"pause", {"retval": {"type": "Z"}}) - r(b"NSSound", b"play", {"retval": {"type": "Z"}}) - r(b"NSSound", b"resume", {"retval": {"type": "Z"}}) - r(b"NSSound", b"setLoops:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSound", b"setName:", {"retval": {"type": "Z"}}) - r(b"NSSound", b"stop", {"retval": {"type": "Z"}}) - r(b"NSSpeechRecognizer", b"blocksOtherRecognizers", {"retval": {"type": "Z"}}) - r(b"NSSpeechRecognizer", b"listensInForegroundOnly", {"retval": {"type": "Z"}}) - r( - b"NSSpeechRecognizer", - b"setBlocksOtherRecognizers:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSSpeechRecognizer", - b"setListensInForegroundOnly:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSpeechSynthesizer", b"isAnyApplicationSpeaking", {"retval": {"type": b"Z"}}) - r(b"NSSpeechSynthesizer", b"isSpeaking", {"retval": {"type": "Z"}}) - r( - b"NSSpeechSynthesizer", - b"objectForProperty:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSSpeechSynthesizer", - b"setObject:forProperty:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSSpeechSynthesizer", - b"setUsesFeedbackWindow:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSpeechSynthesizer", b"setVoice:", {"retval": {"type": "Z"}}) - r(b"NSSpeechSynthesizer", b"startSpeakingString:", {"retval": {"type": "Z"}}) - r(b"NSSpeechSynthesizer", b"startSpeakingString:toURL:", {"retval": {"type": "Z"}}) - r(b"NSSpeechSynthesizer", b"usesFeedbackWindow", {"retval": {"type": "Z"}}) - r(b"NSSpeechSynthesizer", b"voice", {"retval": {"type": "@"}}) - r(b"NSSpellChecker", b"automaticallyIdentifiesLanguages", {"retval": {"type": "Z"}}) - r( - b"NSSpellChecker", - b"checkGrammarOfString:startingAt:language:wrap:inSpellDocumentWithTag:details:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {5: {"type": "Z"}, 7: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSSpellChecker", - b"checkSpellingOfString:startingAt:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSSpellChecker", - b"checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {5: {"type": "Z"}, 7: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSSpellChecker", - b"checkString:range:types:options:inSpellDocumentWithTag:orthography:wordCount:", - { - "arguments": { - 3: {"type": "{_NSRange=QQ}"}, - 7: {"type_modifier": b"o"}, - 8: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSSpellChecker", - b"completionsForPartialWordRange:inString:language:inSpellDocumentWithTag:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSSpellChecker", - b"deletesAutospaceBetweenString:andString:language:", - {"retval": {"type": "Z"}}, - ) - r(b"NSSpellChecker", b"hasLearnedWord:", {"retval": {"type": "Z"}}) - r(b"NSSpellChecker", b"isAutomaticCapitalizationEnabled", {"retval": {"type": "Z"}}) - r( - b"NSSpellChecker", - b"isAutomaticDashSubstitutionEnabled", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSpellChecker", - b"isAutomaticInlinePredictionEnabled", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSpellChecker", - b"isAutomaticPeriodSubstitutionEnabled", - {"retval": {"type": "Z"}}, - ) - r( - b"NSSpellChecker", - b"isAutomaticQuoteSubstitutionEnabled", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSpellChecker", - b"isAutomaticSpellingCorrectionEnabled", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSpellChecker", - b"isAutomaticTextCompletionEnabled", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSpellChecker", - b"isAutomaticTextReplacementEnabled", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSpellChecker", - b"preventsAutocorrectionBeforeString:language:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSSpellChecker", - b"requestCandidatesForSelectedRange:inString:types:options:inSpellDocumentWithTag:completionHandler:", - { - "arguments": { - 7: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"q"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSSpellChecker", - b"requestCheckingOfString:range:types:options:inSpellDocumentWithTag:completionHandler:", - { - "arguments": { - 3: {"type": "{_NSRange=QQ}"}, - 7: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"q"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"q"}, - }, - } - }, - } - }, - ) - r( - b"NSSpellChecker", - b"setAutomaticallyIdentifiesLanguages:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSSpellChecker", b"setLanguage:", {"retval": {"type": "Z"}}) - r(b"NSSpellChecker", b"sharedSpellCheckerExists", {"retval": {"type": b"Z"}}) - r( - b"NSSpellChecker", - b"showCorrectionIndicatorOfType:primaryString:alternativeStrings:forStringInRect:view:completionHandler:", - { - "arguments": { - 7: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSSpellChecker", b"unlearnWord:", {"arguments": {2: {"type": "@"}}}) - r(b"NSSplitView", b"arrangesAllSubviews", {"retval": {"type": "Z"}}) - r( - b"NSSplitView", - b"drawDividerInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSSplitView", b"isPaneSplitter", {"retval": {"type": "Z"}}) - r(b"NSSplitView", b"isSpringLoaded", {"retval": {"type": "Z"}}) - r(b"NSSplitView", b"isSubviewCollapsed:", {"retval": {"type": "Z"}}) - r(b"NSSplitView", b"isVertical", {"retval": {"type": "Z"}}) - r(b"NSSplitView", b"setArrangesAllSubviews:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSplitView", b"setIsPaneSplitter:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSSplitView", b"setVertical:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSSplitViewController", - b"splitView:canCollapseSubview:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSplitViewController", - b"splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSplitViewController", - b"splitView:shouldHideDividerAtIndex:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSSplitViewController", - b"validateUserInterfaceItem:", - {"retval": {"type": "Z"}}, - ) - r(b"NSSplitViewItem", b"allowsFullHeightLayout", {"retval": {"type": b"Z"}}) - r(b"NSSplitViewItem", b"canCollapse", {"retval": {"type": b"Z"}}) - r(b"NSSplitViewItem", b"canCollapseFromWindowResize", {"retval": {"type": b"Z"}}) - r(b"NSSplitViewItem", b"isCollapsed", {"retval": {"type": b"Z"}}) - r(b"NSSplitViewItem", b"isSpringLoaded", {"retval": {"type": "Z"}}) - r( - b"NSSplitViewItem", - b"setAllowsFullHeightLayout:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSSplitViewItem", b"setCanCollapse:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSSplitViewItem", - b"setCanCollapseFromWindowResize:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSSplitViewItem", b"setCollapsed:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSSplitViewItem", b"setSpringLoaded:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStackView", b"detachesHiddenViews", {"retval": {"type": "Z"}}) - r(b"NSStackView", b"hasEqualSpacing", {"retval": {"type": b"Z"}}) - r(b"NSStackView", b"setDetachesHiddenViews:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStackView", b"setHasEqualSpacing:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSStatusBar", b"isVertical", {"retval": {"type": "Z"}}) - r(b"NSStatusBarButton", b"appearsDisabled", {"retval": {"type": b"Z"}}) - r(b"NSStatusBarButton", b"setAppearsDisabled:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSStatusItem", - b"drawStatusBarBackgroundInRect:withHighlight:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Z"}, - } - }, - ) - r(b"NSStatusItem", b"highlightMode", {"retval": {"type": "Z"}}) - r(b"NSStatusItem", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSStatusItem", b"isVisible", {"retval": {"type": "Z"}}) - r(b"NSStatusItem", b"setAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r( - b"NSStatusItem", - b"setDoubleAction:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSStatusItem", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStatusItem", b"setHighlightMode:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStatusItem", b"setVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStepper", b"autorepeat", {"retval": {"type": "Z"}}) - r(b"NSStepper", b"setAutorepeat:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStepper", b"setValueWraps:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStepper", b"valueWraps", {"retval": {"type": "Z"}}) - r(b"NSStepperCell", b"autorepeat", {"retval": {"type": "Z"}}) - r(b"NSStepperCell", b"setAutorepeat:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStepperCell", b"setValueWraps:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSStepperCell", b"valueWraps", {"retval": {"type": "Z"}}) - r( - b"NSStepperTouchBarItem", - b"stepperTouchBarItemWithIdentifier:drawingHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 2: {"type": b"d"}, - }, - } - } - } - }, - ) - r( - b"NSStoryboard", - b"instantiateControllerWithIdentifier:creator:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSStoryboard", - b"instantiateInitialControllerWithCreator:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSStoryboardSegue", - b"initWithIdentifier:source:destination:performHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSStoryboardSegue", - b"performHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r( - b"NSStoryboardSegue", - b"segueWithIdentifier:source:destination:performHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSStoryboardSegue", - b"setPerformHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSString", - b"boundingRectWithSize:options:attributes:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGSize=dd}"}}, - }, - ) - r( - b"NSString", - b"drawAtPoint:withAttributes:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSString", - b"drawInRect:withAttributes:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSString", - b"drawWithRect:options:attributes:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSString", b"sizeWithAttributes:", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSTabView", b"allowsTruncatedLabels", {"retval": {"type": "Z"}}) - r( - b"NSTabView", - b"contentRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSTabView", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSTabView", b"minimumSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSTabView", b"setAllowsTruncatedLabels:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTabView", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTabView", - b"tabViewItemAtPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSTabViewController", - b"canPropagateSelectedChildViewControllerTitle", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTabViewController", - b"setCanPropagateSelectedChildViewControllerTitle:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTabViewController", - b"tabView:shouldSelectTabViewItem:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTabViewController", - b"toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"NSTabViewItem", - b"drawLabel:inRect:", - { - "arguments": { - 2: {"type": "Z"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSTabViewItem", - b"sizeOfLabel:", - {"retval": {"type": "{CGSize=dd}"}, "arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTableColumn", b"isEditable", {"retval": {"type": "Z"}}) - r(b"NSTableColumn", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSTableColumn", b"isResizable", {"retval": {"type": "Z"}}) - r(b"NSTableColumn", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableColumn", b"setHidden:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableColumn", b"setResizable:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTableHeaderCell", - b"drawSortIndicatorWithFrame:inView:ascending:priority:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "Z"}, - } - }, - ) - r( - b"NSTableHeaderCell", - b"sortIndicatorRectForBounds:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSTableHeaderView", - b"columnAtPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSTableHeaderView", - b"headerRectOfColumn:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSTableRowView", b"isEmphasized", {"retval": {"type": b"Z"}}) - r(b"NSTableRowView", b"isFloating", {"retval": {"type": b"Z"}}) - r(b"NSTableRowView", b"isGroupRowStyle", {"retval": {"type": b"Z"}}) - r(b"NSTableRowView", b"isNextRowSelected", {"retval": {"type": b"Z"}}) - r(b"NSTableRowView", b"isPreviousRowSelected", {"retval": {"type": b"Z"}}) - r(b"NSTableRowView", b"isSelected", {"retval": {"type": b"Z"}}) - r(b"NSTableRowView", b"isTargetForDropOperation", {"retval": {"type": b"Z"}}) - r(b"NSTableRowView", b"setEmphasized:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSTableRowView", b"setFloating:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSTableRowView", b"setGroupRowStyle:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSTableRowView", b"setNextRowSelected:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSTableRowView", b"setPreviousRowSelected:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSTableRowView", b"setSelected:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSTableRowView", - b"setTargetForDropOperation:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTableView", b"allowsColumnReordering", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"allowsColumnResizing", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"allowsColumnSelection", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"allowsEmptySelection", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"allowsMultipleSelection", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"allowsTypeSelect", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"autoresizesAllColumnsToFit", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"autosaveTableColumns", {"retval": {"type": "Z"}}) - r( - b"NSTableView", - b"canDragRowsWithIndexes:atPoint:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSTableView", b"columnAtPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSTableView", - b"columnIndexesInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTableView", - b"columnsInRect:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSTableView", - b"dragImageForRows:event:dragImageOffset:", - {"arguments": {4: {"type_modifier": b"N"}}}, - ) - r( - b"NSTableView", - b"dragImageForRowsWithIndexes:tableColumns:event:offset:", - {"arguments": {5: {"type_modifier": b"N"}}}, - ) - r( - b"NSTableView", - b"drawBackgroundInClipRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTableView", - b"drawGridInClipRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTableView", - b"drawRow:clipRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSTableView", b"drawsGrid", {"retval": {"type": "Z"}}) - r( - b"NSTableView", - b"editColumn:row:withEvent:select:", - {"arguments": {5: {"type": "Z"}}}, - ) - r( - b"NSTableView", - b"enumerateAvailableRowViewsUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - }, - } - } - } - }, - ) - r(b"NSTableView", b"floatsGroupRows", {"retval": {"type": b"Z"}}) - r( - b"NSTableView", - b"frameOfCellAtColumn:row:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSTableView", - b"highlightSelectionInClipRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSTableView", b"intercellSpacing", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSTableView", b"isColumnSelected:", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"isRowSelected:", {"retval": {"type": "Z"}}) - r( - b"NSTableView", - b"rectOfColumn:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSTableView", - b"rectOfRow:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSTableView", b"rowActionsVisible", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"rowAtPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSTableView", - b"rowViewAtRow:makeIfNecessary:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSTableView", - b"rowsInRect:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSTableView", - b"selectColumn:byExtendingSelection:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSTableView", - b"selectColumnIndexes:byExtendingSelection:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSTableView", - b"selectRow:byExtendingSelection:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSTableView", - b"selectRowIndexes:byExtendingSelection:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSTableView", b"setAllowsColumnReordering:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setAllowsColumnResizing:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setAllowsColumnSelection:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setAllowsEmptySelection:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setAllowsMultipleSelection:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setAllowsTypeSelect:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTableView", - b"setAutoresizesAllColumnsToFit:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTableView", b"setAutosaveTableColumns:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setDoubleAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r( - b"NSTableView", - b"setDraggingSourceOperationMask:forLocal:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSTableView", b"setDrawsGrid:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setFloatsGroupRows:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSTableView", - b"setIntercellSpacing:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSTableView", b"setRowActionsVisible:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTableView", - b"setUsesAlternatingRowBackgroundColors:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTableView", b"setUsesAutomaticRowHeights:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTableView", b"setUsesStaticContents:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSTableView", - b"setVerticalMotionCanBeginDrag:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTableView", b"shouldFocusCell:atColumn:row:", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"textShouldBeginEditing:", {"retval": {"type": b"Z"}}) - r(b"NSTableView", b"textShouldEndEditing:", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"usesAlternatingRowBackgroundColors", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"usesAutomaticRowHeights", {"retval": {"type": "Z"}}) - r(b"NSTableView", b"usesStaticContents", {"retval": {"type": b"Z"}}) - r(b"NSTableView", b"verticalMotionCanBeginDrag", {"retval": {"type": "Z"}}) - r( - b"NSTableView", - b"viewAtColumn:row:makeIfNecessary:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"NSTableViewDiffableDataSource", - b"applySnapshot:animatingDifferences:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSTableViewDiffableDataSource", - b"applySnapshot:animatingDifferences:completion:", - { - "arguments": { - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - }, - } - }, - ) - r( - b"NSTableViewDiffableDataSource", - b"initWithTableView:cellProvider:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"q"}, - 4: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSTableViewDiffableDataSource", - b"rowViewProvider", - { - "retval": { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - 3: {"type": b"@"}, - }, - } - } - }, - ) - r( - b"NSTableViewDiffableDataSource", - b"setRowViewProvider:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSTableViewDiffableDataSource", - b"setSectionHeaderViewProvider:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSTableViewRowAction", - b"rowActionWithStyle:title:handler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"q"}, - }, - } - } - } - }, - ) - r(b"NSText", b"RTFDFromRange:", {"arguments": {2: {"type": "{_NSRange=QQ}"}}}) - r(b"NSText", b"RTFFromRange:", {"arguments": {2: {"type": "{_NSRange=QQ}"}}}) - r(b"NSText", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSText", b"importsGraphics", {"retval": {"type": "Z"}}) - r(b"NSText", b"isEditable", {"retval": {"type": "Z"}}) - r(b"NSText", b"isFieldEditor", {"retval": {"type": "Z"}}) - r(b"NSText", b"isHorizontallyResizable", {"retval": {"type": "Z"}}) - r(b"NSText", b"isRichText", {"retval": {"type": "Z"}}) - r(b"NSText", b"isRulerVisible", {"retval": {"type": "Z"}}) - r(b"NSText", b"isSelectable", {"retval": {"type": "Z"}}) - r(b"NSText", b"isVerticallyResizable", {"retval": {"type": "Z"}}) - r(b"NSText", b"maxSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSText", b"minSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSText", b"readRTFDFromFile:", {"retval": {"type": "Z"}}) - r( - b"NSText", - b"replaceCharactersInRange:withRTF:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSText", - b"replaceCharactersInRange:withRTFD:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSText", - b"replaceCharactersInRange:withString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSText", - b"scrollRangeToVisible:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSText", b"selectedRange", {"retval": {"type": "{_NSRange=QQ}"}}) - r(b"NSText", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setFieldEditor:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setFont:range:", {"arguments": {3: {"type": "{_NSRange=QQ}"}}}) - r(b"NSText", b"setHorizontallyResizable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setImportsGraphics:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setMaxSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSText", b"setMinSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSText", b"setRichText:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setSelectable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setSelectedRange:", {"arguments": {2: {"type": "{_NSRange=QQ}"}}}) - r(b"NSText", b"setTextColor:range:", {"arguments": {3: {"type": "{_NSRange=QQ}"}}}) - r(b"NSText", b"setUsesFontPanel:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"setVerticallyResizable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSText", b"usesFontPanel", {"retval": {"type": "Z"}}) - r( - b"NSText", - b"writeRTFDToFile:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r(b"NSTextAttachment", b"allowsTextAttachmentView", {"retval": {"type": b"Z"}}) - r( - b"NSTextAttachment", - b"setAllowsTextAttachmentView:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTextAttachment", b"usesTextAttachmentView", {"retval": {"type": b"Z"}}) - r( - b"NSTextAttachmentCell", - b"setWantsToTrackMouse:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTextAttachmentCell", b"wantsToTrackMouse", {"retval": {"type": "Z"}}) - r( - b"NSTextAttachmentViewProvider", - b"setTracksTextAttachmentViewBounds:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextAttachmentViewProvider", - b"tracksTextAttachmentViewBounds", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTextBlock", - b"boundsRectForContentRect:inRect:textContainer:characterRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSTextBlock", - b"drawBackgroundWithFrame:inView:characterRange:layoutManager:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSTextBlock", - b"rectForLayoutAtPoint:inRect:textContainer:characterRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSTextCheckingController", - b"menuAtIndex:clickedOnSelection:effectiveRange:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"NSTextContainer", b"containerSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSTextContainer", - b"containsPoint:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSTextContainer", b"heightTracksTextView", {"retval": {"type": "Z"}}) - r( - b"NSTextContainer", - b"initWithContainerSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSTextContainer", - b"isSimpleRectangularTextContainer", - {"retval": {"type": "Z"}}, - ) - r( - b"NSTextContainer", - b"lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSTextContainer", - b"lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSTextContainer", - b"lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSTextContainer", - b"setContainerSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSTextContainer", - b"setHeightTracksTextView:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTextContainer", b"setWidthTracksTextView:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextContainer", b"widthTracksTextView", {"retval": {"type": "Z"}}) - r( - b"NSTextContentManager", - b"automaticallySynchronizesTextLayoutManagers", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTextContentManager", - b"automaticallySynchronizesToBackingStore", - {"retval": {"type": b"Z"}}, - ) - r(b"NSTextContentManager", b"hasEditingTransaction", {"retval": {"type": b"Z"}}) - r( - b"NSTextContentManager", - b"performEditingTransactionUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSTextContentManager", - b"setAutomaticallySynchronizesTextLayoutManagers:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextContentManager", - b"setAutomaticallySynchronizesToBackingStore:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextContentManager", - b"synchronizeTextLayoutManagers:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSTextContentStorage", - b"adjustedRangeFromRange:forEditingTextSelection:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"NSTextElement", b"isRepresentedElement", {"retval": {"type": b"Z"}}) - r(b"NSTextField", b"acceptsFirstResponder", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"allowsCharacterPickerTouchBarItem", {"retval": {"type": "Z"}}) - r( - b"NSTextField", - b"allowsDefaultTighteningForTruncation", - {"retval": {"type": "Z"}}, - ) - r(b"NSTextField", b"allowsEditingTextAttributes", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"importsGraphics", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"isAutomaticTextCompletionEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"isBezeled", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"isBordered", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"isEditable", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"isSelectable", {"retval": {"type": "Z"}}) - r( - b"NSTextField", - b"setAllowsCharacterPickerTouchBarItem:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextField", - b"setAllowsDefaultTighteningForTruncation:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextField", - b"setAllowsEditingTextAttributes:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextField", - b"setAutomaticTextCompletionEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTextField", b"setBezeled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextField", b"setBordered:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextField", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextField", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextField", b"setImportsGraphics:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextField", b"setSelectable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextField", b"setTextColor:", {"arguments": {2: {"type": "@"}}}) - r(b"NSTextField", b"textShouldBeginEditing:", {"retval": {"type": "Z"}}) - r(b"NSTextField", b"textShouldEndEditing:", {"retval": {"type": "Z"}}) - r(b"NSTextFieldCell", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSTextFieldCell", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextFieldCell", - b"setWantsNotificationForMarkedText:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTextFinder", b"findIndicatorNeedsUpdate", {"retval": {"type": b"Z"}}) - r( - b"NSTextFinder", - b"incrementalSearchingShouldDimContentView", - {"retval": {"type": b"Z"}}, - ) - r(b"NSTextFinder", b"isIncrementalSearchingEnabled", {"retval": {"type": b"Z"}}) - r( - b"NSTextFinder", - b"setFindIndicatorNeedsUpdate:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextFinder", - b"setIncrementalSearchingEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextFinder", - b"setIncrementalSearchingShouldDimContentView:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTextFinder", b"validateAction:", {"retval": {"type": b"Z"}}) - r(b"NSTextInputContext", b"acceptsGlyphInfo", {"retval": {"type": "Z"}}) - r(b"NSTextInputContext", b"handleEvent:", {"retval": {"type": "Z"}}) - r(b"NSTextInputContext", b"setAcceptsGlyphInfo:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextInsertionIndicator", - b"effectsViewInserter", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - }, - ) - r( - b"NSTextInsertionIndicator", - b"setEffectsViewInserter:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSTextLayoutFragment", - b"textLineFragmentForTextLocation:isUpstreamAffinity:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSTextLayoutFragment", - b"textLineFragmentForVerticalOffset:requiresExactMatch:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSTextLayoutManager", - b"enumerateRenderingAttributesFromLocation:reverse:usingBlock:", - { - "arguments": { - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - }, - } - }, - ) - r( - b"NSTextLayoutManager", - b"enumerateTextLayoutFragmentsFromLocation:options:usingBlock:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSTextLayoutManager", - b"enumerateTextSegmentsInRange:type:options:usingBlock:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"d"}, - 4: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSTextLayoutManager", - b"limitsLayoutForSuspiciousContents", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTextLayoutManager", - b"setLimitsLayoutForSuspiciousContents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextLayoutManager", - b"setRenderingAttributesValidator:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSTextLayoutManager", - b"setUsesFontLeading:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextLayoutManager", - b"setUsesHyphenation:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTextLayoutManager", b"usesFontLeading", {"retval": {"type": b"Z"}}) - r(b"NSTextLayoutManager", b"usesHyphenation", {"retval": {"type": b"Z"}}) - r(b"NSTextList", b"isOrdered", {"retval": {"type": b"Z"}}) - r(b"NSTextRange", b"containsLocation:", {"retval": {"type": b"Z"}}) - r(b"NSTextRange", b"containsRange:", {"retval": {"type": b"Z"}}) - r(b"NSTextRange", b"intersectsWithTextRange:", {"retval": {"type": b"Z"}}) - r(b"NSTextRange", b"isEmpty", {"retval": {"type": b"Z"}}) - r(b"NSTextRange", b"isEqualToTextRange:", {"retval": {"type": b"Z"}}) - r(b"NSTextSelection", b"isLogical", {"retval": {"type": b"Z"}}) - r(b"NSTextSelection", b"isTransient", {"retval": {"type": b"Z"}}) - r(b"NSTextSelection", b"setLogical:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSTextSelectionNavigation", - b"allowsNonContiguousRanges", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTextSelectionNavigation", - b"deletionRangesForTextSelection:direction:destination:allowsDecomposition:", - {"arguments": {5: {"type": b"Z"}}}, - ) - r( - b"NSTextSelectionNavigation", - b"destinationSelectionForTextSelection:direction:destination:extending:confined:", - {"arguments": {5: {"type": b"Z"}, 6: {"type": b"Z"}}}, - ) - r( - b"NSTextSelectionNavigation", - b"rotatesCoordinateSystemForLayoutOrientation", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTextSelectionNavigation", - b"setAllowsNonContiguousRanges:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextSelectionNavigation", - b"setRotatesCoordinateSystemForLayoutOrientation:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextSelectionNavigation", - b"textSelectionsInteractingAtPoint:inContainerAtLocation:anchors:modifiers:selecting:bounds:", - {"arguments": {6: {"type": b"Z"}}}, - ) - r( - b"NSTextStorage", - b"edited:range:changeInLength:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSTextStorage", b"editedRange", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSTextStorage", - b"ensureAttributesAreFixedInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSTextStorage", b"fixesAttributesLazily", {"retval": {"type": "Z"}}) - r( - b"NSTextStorage", - b"invalidateAttributesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextTable", - b"boundsRectForBlock:contentRect:inRect:textContainer:characterRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r(b"NSTextTable", b"collapsesBorders", {"retval": {"type": "Z"}}) - r( - b"NSTextTable", - b"drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:", - { - "retval": {"type": "v"}, - "arguments": { - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r(b"NSTextTable", b"hidesEmptyCells", {"retval": {"type": "Z"}}) - r( - b"NSTextTable", - b"rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 6: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r(b"NSTextTable", b"setCollapsesBorders:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextTable", b"setHidesEmptyCells:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"acceptsGlyphInfo", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"allowsCharacterPickerTouchBarItem", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"allowsDocumentBackgroundColorChange", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"allowsImageEditing", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"allowsUndo", {"retval": {"type": "Z"}}) - r( - b"NSTextView", - b"characterIndexForInsertionAtPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSTextView", - b"completionsForPartialWordRange:indexOfSelectedItem:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type_modifier": b"o"}}}, - ) - r(b"NSTextView", b"displaysLinkToolTips", {"retval": {"type": "Z"}}) - r( - b"NSTextView", - b"dragImageForSelectionWithEvent:origin:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSTextView", - b"dragSelectionWithEvent:offset:slideBack:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "{CGSize=dd}"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSTextView", - b"drawInsertionPointInRect:color:turnedOn:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "Z"}, - } - }, - ) - r( - b"NSTextView", - b"drawViewBackgroundInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSTextView", b"drawsBackground", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"importsGraphics", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"initUsingTextLayoutManager:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSTextView", - b"initWithFrame:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTextView", - b"initWithFrame:textContainer:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTextView", - b"insertCompletion:forPartialWordRange:movement:isFinal:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}, 5: {"type": "Z"}}}, - ) - r(b"NSTextView", b"isAutomaticDashSubstitutionEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isAutomaticDataDetectionEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isAutomaticLinkDetectionEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isAutomaticQuoteSubstitutionEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isAutomaticSpellingCorrectionEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isAutomaticTextCompletionEnabled", {"retval": {"type": b"Z"}}) - r(b"NSTextView", b"isAutomaticTextReplacementEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isCoalescingUndo", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isContinuousSpellCheckingEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isEditable", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isFieldEditor", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isGrammarCheckingEnabled", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isIncrementalSearchingEnabled", {"retval": {"type": b"Z"}}) - r(b"NSTextView", b"isRichText", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isRulerVisible", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"isSelectable", {"retval": {"type": "Z"}}) - r( - b"NSTextView", - b"performValidatedReplacementInRange:withAttributedString:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSTextView", - b"rangeForUserCharacterAttributeChange", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r(b"NSTextView", b"rangeForUserCompletion", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSTextView", - b"rangeForUserParagraphAttributeChange", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r(b"NSTextView", b"rangeForUserTextChange", {"retval": {"type": "{_NSRange=QQ}"}}) - r(b"NSTextView", b"readSelectionFromPasteboard:", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"readSelectionFromPasteboard:type:", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"rulerView:shouldAddMarker:", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"rulerView:shouldMoveMarker:", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"rulerView:shouldRemoveMarker:", {"retval": {"type": "Z"}}) - r( - b"NSTextView", - b"rulerView:willMoveMarker:toLocation:", - {"retval": {"type": "d"}, "arguments": {4: {"type": "d"}}}, - ) - r( - b"NSTextView", - b"selectionRangeForProposedRange:granularity:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r(b"NSTextView", b"setAcceptsGlyphInfo:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextView", - b"setAlignment:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextView", - b"setAllowsCharacterPickerTouchBarItem:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setAllowsDocumentBackgroundColorChange:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTextView", b"setAllowsImageEditing:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setAllowsUndo:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextView", - b"setAutomaticDashSubstitutionEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setAutomaticDataDetectionEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setAutomaticLinkDetectionEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setAutomaticQuoteSubstitutionEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setAutomaticSpellingCorrectionEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setAutomaticTextCompletionEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextView", - b"setAutomaticTextReplacementEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setBaseWritingDirection:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextView", - b"setConstrainedFrameSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSTextView", - b"setContinuousSpellCheckingEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTextView", b"setDisplaysLinkToolTips:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setDrawsBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setEditable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setFieldEditor:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setGrammarCheckingEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setImportsGraphics:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextView", - b"setIncrementalSearchingEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextView", - b"setNeedsDisplayInRect:avoidAdditionalLayout:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Z"}, - } - }, - ) - r(b"NSTextView", b"setRichText:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setRulerVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setSelectable:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextView", - b"setSelectedRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextView", - b"setSelectedRange:affinity:stillSelecting:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 4: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"setSelectedRanges:affinity:stillSelecting:", - {"arguments": {4: {"type": "Z"}}}, - ) - r(b"NSTextView", b"setSmartInsertDeleteEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextView", - b"setSpellingState:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextView", - b"setTextContainerInset:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSTextView", - b"setUsesAdaptiveColorMappingForDarkAppearance:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTextView", b"setUsesFindBar:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSTextView", b"setUsesFindPanel:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setUsesFontPanel:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTextView", b"setUsesInspectorBar:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSTextView", - b"setUsesRolloverButtonForSelection:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTextView", b"setUsesRuler:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTextView", - b"shouldChangeTextInRange:replacementString:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextView", - b"shouldChangeTextInRanges:replacementStrings:", - {"retval": {"type": "Z"}}, - ) - r(b"NSTextView", b"shouldDrawInsertionPoint", {"retval": {"type": "Z"}}) - r( - b"NSTextView", - b"showFindIndicatorForRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextView", - b"smartDeleteRangeForProposedRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSTextView", - b"smartInsertAfterStringForString:replacingRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextView", - b"smartInsertBeforeStringForString:replacingRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSTextView", b"smartInsertDeleteEnabled", {"retval": {"type": "Z"}}) - r( - b"NSTextView", - b"smartInsertForString:replacingRange:beforeString:afterString:", - { - "arguments": { - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type_modifier": b"o"}, - 5: {"type_modifier": b"o"}, - } - }, - ) - r(b"NSTextView", b"stronglyReferencesTextStorage", {"retval": {"type": b"Z"}}) - r(b"NSTextView", b"textContainerInset", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSTextView", b"textContainerOrigin", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSTextView", - b"textViewUsingTextLayoutManager:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSTextView", - b"updateInsertionPointStateAndRestartTimer:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTextView", - b"usesAdaptiveColorMappingForDarkAppearance", - {"retval": {"type": b"Z"}}, - ) - r(b"NSTextView", b"usesFindBar", {"retval": {"type": b"Z"}}) - r(b"NSTextView", b"usesFindPanel", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"usesFontPanel", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"usesInspectorBar", {"retval": {"type": b"Z"}}) - r(b"NSTextView", b"usesRolloverButtonForSelection", {"retval": {"type": b"Z"}}) - r(b"NSTextView", b"usesRuler", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"writeSelectionToPasteboard:type:", {"retval": {"type": "Z"}}) - r(b"NSTextView", b"writeSelectionToPasteboard:types:", {"retval": {"type": "Z"}}) - r(b"NSTintConfiguration", b"adaptsToUserAccentColor", {"retval": {"type": b"Z"}}) - r( - b"NSTitlebarAccessoryViewController", - b"automaticallyAdjustsSize", - {"retval": {"type": "Z"}}, - ) - r(b"NSTitlebarAccessoryViewController", b"isHidden", {"retval": {"type": "Z"}}) - r( - b"NSTitlebarAccessoryViewController", - b"setAutomaticallyAdjustsSize:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTitlebarAccessoryViewController", - b"setHidden:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSToolbar", b"allowsExtensionItems", {"retval": {"type": b"Z"}}) - r(b"NSToolbar", b"allowsUserCustomization", {"retval": {"type": "Z"}}) - r(b"NSToolbar", b"autosavesConfiguration", {"retval": {"type": "Z"}}) - r(b"NSToolbar", b"customizationPaletteIsRunning", {"retval": {"type": "Z"}}) - r(b"NSToolbar", b"isVisible", {"retval": {"type": "Z"}}) - r(b"NSToolbar", b"setAllowsExtensionItems:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSToolbar", b"setAllowsUserCustomization:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSToolbar", b"setAutosavesConfiguration:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSToolbar", b"setShowsBaselineSeparator:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSToolbar", b"setVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSToolbar", b"showsBaselineSeparator", {"retval": {"type": "Z"}}) - r(b"NSToolbarItem", b"allowsDuplicatesInToolbar", {"retval": {"type": "Z"}}) - r(b"NSToolbarItem", b"autovalidates", {"retval": {"type": "Z"}}) - r(b"NSToolbarItem", b"isBordered", {"retval": {"type": b"Z"}}) - r(b"NSToolbarItem", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSToolbarItem", b"isNavigational", {"retval": {"type": b"Z"}}) - r(b"NSToolbarItem", b"isVisible", {"retval": {"type": b"Z"}}) - r(b"NSToolbarItem", b"maxSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSToolbarItem", b"minSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSToolbarItem", b"setAction:", {"arguments": {2: {"sel_of_type": b"v@:@"}}}) - r(b"NSToolbarItem", b"setAutovalidates:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSToolbarItem", b"setBordered:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSToolbarItem", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSToolbarItem", b"setMaxSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSToolbarItem", b"setMinSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSToolbarItem", b"setNavigational:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSToolbarItemGroup", - b"groupWithItemIdentifier:images:selectionMode:labels:target:action:", - {"arguments": {7: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSToolbarItemGroup", - b"groupWithItemIdentifier:titles:selectionMode:labels:target:action:", - {"arguments": {7: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSToolbarItemGroup", b"isSelectedAtIndex:", {"retval": {"type": b"Z"}}) - r( - b"NSToolbarItemGroup", - b"setSelected:atIndex:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTouch", b"deviceSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSTouch", b"isResting", {"retval": {"type": "Z"}}) - r( - b"NSTouchBar", - b"isAutomaticCustomizeTouchBarMenuItemEnabled", - {"retval": {"type": b"Z"}}, - ) - r(b"NSTouchBar", b"isVisible", {"retval": {"type": "Z"}}) - r( - b"NSTouchBar", - b"setAutomaticCustomizeTouchBarMenuItemEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSTouchBar", b"setVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTouchBarItem", b"isVisible", {"retval": {"type": "Z"}}) - r(b"NSTouchBarItem", b"setVisible:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTrackingArea", - b"initWithRect:options:owner:userInfo:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTrackingArea", - b"rect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSTreeController", b"addSelectionIndexPaths:", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"alwaysUsesMultipleValuesMarker", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"avoidsEmptySelection", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"canAddChild", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"canInsert", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"canInsertChild", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"preservesSelection", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"removeSelectionIndexPaths:", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"selectsInsertedObjects", {"retval": {"type": "Z"}}) - r( - b"NSTreeController", - b"setAlwaysUsesMultipleValuesMarker:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSTreeController", - b"setAvoidsEmptySelection:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTreeController", b"setPreservesSelection:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSTreeController", b"setSelectionIndexPath:", {"retval": {"type": "Z"}}) - r(b"NSTreeController", b"setSelectionIndexPaths:", {"retval": {"type": "Z"}}) - r( - b"NSTreeController", - b"setSelectsInsertedObjects:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSTreeNode", b"isLeaf", {"retval": {"type": "Z"}}) - r( - b"NSTreeNode", - b"sortWithSortDescriptors:recursively:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSTypesetter", b"bidiProcessingEnabled", {"retval": {"type": "Z"}}) - r( - b"NSTypesetter", - b"boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "Q"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "{CGPoint=dd}"}, - 6: {"type": "Q"}, - }, - }, - ) - r( - b"NSTypesetter", - b"characterRangeForGlyphRange:actualGlyphRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSTypesetter", - b"deleteGlyphsInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTypesetter", - b"endLineWithGlyphRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTypesetter", - b"getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", - { - "retval": {"type": "Q"}, - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 4: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 5: {"type_modifier": b"o", "c_array_length_in_arg": 2}, - 6: {"type": "^Z", "type_modifier": b"o", "c_array_length_in_arg": 2}, - 7: {"type": "^C", "type_modifier": b"o", "c_array_length_in_arg": 2}, - }, - }, - ) - r( - b"NSTypesetter", - b"getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:", - { - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type": "{_NSRange=QQ}"}, - 5: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSTypesetter", - b"getLineFragmentRect:usedRect:remainingRect:forStartingGlyphAtIndex:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:", - { - "arguments": { - 2: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 3: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 4: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 6: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSTypesetter", - b"glyphRangeForCharacterRange:actualCharacterRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSTypesetter", - b"layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSTypesetter", - b"layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSTypesetter", - b"layoutParagraphAtPoint:", - {"arguments": {2: {"type_modifier": b"N"}}}, - ) - r( - b"NSTypesetter", - b"lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTypesetter", - b"paragraphCharacterRange", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r(b"NSTypesetter", b"paragraphGlyphRange", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSTypesetter", - b"paragraphSeparatorCharacterRange", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSTypesetter", - b"paragraphSeparatorGlyphRange", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSTypesetter", - b"paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTypesetter", - b"paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:", - {"arguments": {3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSTypesetter", - b"printingAdjustmentInLayoutManager:forNominallySpacedGlyphRange:packedGlyphs:count:", - { - "retval": {"type": "{CGSize=dd}"}, - "arguments": { - 3: {"type": "{_NSRange=QQ}"}, - 4: { - "c_array_delimited_by_null": True, - "type": "^v", - "type_modifier": b"n", - "c_array_length_in_arg": 5, - }, - }, - }, - ) - r( - b"NSTypesetter", - b"setAttachmentSize:forGlyphRange:", - {"arguments": {2: {"type": "{CGSize=dd}"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTypesetter", - b"setBidiLevels:forGlyphRange:", - { - "arguments": { - 2: {"type": "^z", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 3: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r(b"NSTypesetter", b"setBidiProcessingEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTypesetter", - b"setDrawsOutsideLineFragment:forGlyphRange:", - {"arguments": {2: {"type": "Z"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTypesetter", - b"setHardInvalidation:forGlyphRange:", - {"arguments": {2: {"type": "Z"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTypesetter", - b"setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - } - }, - ) - r( - b"NSTypesetter", - b"setLocation:withAdvancements:forStartOfGlyphRange:", - { - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 4: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSTypesetter", - b"setNotShownAttribute:forGlyphRange:", - {"arguments": {2: {"type": "Z"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTypesetter", - b"setParagraphGlyphRange:separatorGlyphRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 3: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSTypesetter", b"setUsesFontLeading:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSTypesetter", - b"shouldBreakLineByHyphenatingBeforeCharacterAtIndex:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "Q"}}}, - ) - r( - b"NSTypesetter", - b"shouldBreakLineByWordBeforeCharacterAtIndex:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "Q"}}}, - ) - r( - b"NSTypesetter", - b"substituteGlyphsInRange:withGlyphs:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 2}, - } - }, - ) - r(b"NSTypesetter", b"usesFontLeading", {"retval": {"type": "Z"}}) - r( - b"NSTypesetter", - b"willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", - { - "arguments": { - 2: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", "type_modifier": b"N"}, - 5: {"type": "^d", "type_modifier": b"N"}, - } - }, - ) - r(b"NSUndoManager", b"groupsByEvent", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"setGroupsByEvent:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSUserDefaultsController", b"appliesImmediately", {"retval": {"type": "Z"}}) - r(b"NSUserDefaultsController", b"hasUnappliedChanges", {"retval": {"type": "Z"}}) - r( - b"NSUserDefaultsController", - b"setAppliesImmediately:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSUserInterfaceCompressionOptions", - b"containsOptions:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSUserInterfaceCompressionOptions", - b"intersectsOptions:", - {"retval": {"type": "Z"}}, - ) - r(b"NSUserInterfaceCompressionOptions", b"isEmpty", {"retval": {"type": "Z"}}) - r( - b"NSUserInterfaceCompressionOptions", - b"setEmpty:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSView", b"acceptsFirstMouse:", {"retval": {"type": "Z"}}) - r(b"NSView", b"acceptsTouchEvents", {"retval": {"type": "Z"}}) - r( - b"NSView", - b"addCursorRect:cursor:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"addToolTipRect:owner:userData:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "^v"}, - } - }, - ) - r( - b"NSView", - b"addTrackingRect:owner:userData:assumeInside:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "^v"}, - 5: {"type": "Z"}, - } - }, - ) - r( - b"NSView", - b"adjustPageHeightNew:top:bottom:limit:", - {"arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSView", - b"adjustPageWidthNew:left:right:limit:", - {"arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSView", - b"adjustScroll:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSView", b"alignmentRectInsets", {"retval": {"type": b"{NSEdgeInsets=dddd}"}}) - r(b"NSView", b"allowsVibrancy", {"retval": {"type": b"Z"}}) - r(b"NSView", b"autoresizesSubviews", {"retval": {"type": "Z"}}) - r(b"NSView", b"autoscroll:", {"retval": {"type": "Z"}}) - r( - b"NSView", - b"beginPageInRect:atPlacement:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGPoint=dd}"}, - } - }, - ) - r( - b"NSView", - b"bitmapImageRepForCachingDisplayInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSView", b"bounds", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r( - b"NSView", - b"cacheDisplayInRect:toBitmapImageRep:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSView", b"canBecomeKeyView", {"retval": {"type": "Z"}}) - r(b"NSView", b"canDraw", {"retval": {"type": "Z"}}) - r(b"NSView", b"canDrawConcurrently", {"retval": {"type": "Z"}}) - r(b"NSView", b"canDrawSubviewsIntoLayer", {"retval": {"type": b"Z"}}) - r( - b"NSView", - b"centerScanRect:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSView", b"clipsToBounds", {"retval": {"type": b"Z"}}) - r(b"NSView", b"context:", {"arguments": {2: {"type": "^v"}}}) - r( - b"NSView", - b"convertPoint:fromView:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSView", - b"convertPoint:toView:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSView", - b"convertPointFromBase:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSView", - b"convertPointToBase:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSView", - b"convertRect:fromView:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSView", - b"convertRect:toView:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSView", - b"convertRectFromBase:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSView", - b"convertRectToBase:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSView", - b"convertSize:fromView:", - {"retval": {"type": "{CGSize=dd}"}, "arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSView", - b"convertSize:toView:", - {"retval": {"type": "{CGSize=dd}"}, "arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSView", - b"convertSizeFromBase:", - {"retval": {"type": "{CGSize=dd}"}, "arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSView", - b"convertSizeToBase:", - {"retval": {"type": "{CGSize=dd}"}, "arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSView", - b"dataWithEPSInsideRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"dataWithPDFInsideRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"displayIfNeededInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"displayIfNeededInRectIgnoringOpacity:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"displayLinkWithTarget:selector:", - {"arguments": {3: {"type": ":", "sel_of_type": b"v@:@"}}}, - ) - r( - b"NSView", - b"displayRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"displayRectIgnoringOpacity:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"displayRectIgnoringOpacity:inContext:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"dragFile:fromRect:slideBack:event:", - { - "retval": {"type": "Z"}, - "arguments": { - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 4: {"type": "Z"}, - }, - }, - ) - r( - b"NSView", - b"dragImage:at:offset:event:pasteboard:source:slideBack:", - { - "arguments": { - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "{CGSize=dd}"}, - 8: {"type": "Z"}, - } - }, - ) - r( - b"NSView", - b"dragPromisedFilesOfTypes:fromRect:source:slideBack:event:", - { - "retval": {"type": "Z"}, - "arguments": { - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "Z"}, - }, - }, - ) - r( - b"NSView", - b"drawPageBorderWithSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSView", - b"drawRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"drawSheetBorderWithSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSView", b"enterFullScreenMode:withOptions:", {"retval": {"type": "Z"}}) - r(b"NSView", b"frame", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r( - b"NSView", - b"getRectsBeingDrawn:count:", - { - "arguments": { - 2: {"type": "^^{CGRect}"}, - 3: {"type": "^q", "type_modifier": b"o"}, - } - }, - ) - r( - b"NSView", - b"getRectsExposedDuringLiveResize:count:", - { - "arguments": { - 2: { - "c_array_of_fixed_length": 4, - "type": "^{CGRect={CGPoint=dd}{CGSize=dd}}", - "type_modifier": b"o", - }, - 3: {"type": "^q", "type_modifier": b"o"}, - } - }, - ) - r(b"NSView", b"hasAmbiguousLayout", {"retval": {"type": b"Z"}}) - r(b"NSView", b"hitTest:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSView", b"inLiveResize", {"retval": {"type": "Z"}}) - r(b"NSView", b"isCompatibleWithResponsiveScrolling", {"retval": {"type": b"Z"}}) - r(b"NSView", b"isDescendantOf:", {"retval": {"type": "Z"}}) - r(b"NSView", b"isDrawingFindIndicator", {"retval": {"type": b"Z"}}) - r(b"NSView", b"isFlipped", {"retval": {"type": "Z"}}) - r(b"NSView", b"isHidden", {"retval": {"type": "Z"}}) - r(b"NSView", b"isHiddenOrHasHiddenAncestor", {"retval": {"type": "Z"}}) - r(b"NSView", b"isHorizontalContentSizeConstraintActive", {"retval": {"type": b"Z"}}) - r(b"NSView", b"isInFullScreenMode", {"retval": {"type": "Z"}}) - r(b"NSView", b"isOpaque", {"retval": {"type": "Z"}}) - r(b"NSView", b"isRotatedFromBase", {"retval": {"type": "Z"}}) - r(b"NSView", b"isRotatedOrScaledFromBase", {"retval": {"type": "Z"}}) - r(b"NSView", b"isVerticalContentSizeConstraintActive", {"retval": {"type": b"Z"}}) - r( - b"NSView", - b"knowsPageRange:", - {"retval": {"type": "Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r(b"NSView", b"layerUsesCoreImageFilters", {"retval": {"type": b"Z"}}) - r( - b"NSView", - b"locationOfPrintRect:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSView", b"lockFocusIfCanDraw", {"retval": {"type": "Z"}}) - r(b"NSView", b"lockFocusIfCanDrawInContext:", {"retval": {"type": "Z"}}) - r( - b"NSView", - b"mouse:inRect:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "{CGPoint=dd}"}, - 3: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r(b"NSView", b"mouseDownCanMoveWindow", {"retval": {"type": "Z"}}) - r(b"NSView", b"needsDisplay", {"retval": {"type": "Z"}}) - r(b"NSView", b"needsLayout", {"retval": {"type": b"Z"}}) - r(b"NSView", b"needsPanelToBecomeKey", {"retval": {"type": "Z"}}) - r( - b"NSView", - b"needsToDrawRect:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSView", b"needsUpdateConstraints", {"retval": {"type": b"Z"}}) - r(b"NSView", b"performKeyEquivalent:", {"retval": {"type": "Z"}}) - r(b"NSView", b"performMnemonic:", {"retval": {"type": "Z"}}) - r(b"NSView", b"postsBoundsChangedNotifications", {"retval": {"type": "Z"}}) - r(b"NSView", b"postsFrameChangedNotifications", {"retval": {"type": "Z"}}) - r(b"NSView", b"preservesContentDuringLiveResize", {"retval": {"type": "Z"}}) - r( - b"NSView", - b"rectForPage:", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSView", - b"rectPreservedDuringLiveResize", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSView", - b"removeCursorRect:cursor:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSView", b"requiresConstraintBasedLayout", {"retval": {"type": b"Z"}}) - r( - b"NSView", - b"resizeSubviewsWithOldSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSView", - b"resizeWithOldSuperviewSize:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSView", b"rulerView:shouldAddMarker:", {"retval": {"type": "Z"}}) - r(b"NSView", b"rulerView:shouldMoveMarker:", {"retval": {"type": "Z"}}) - r(b"NSView", b"rulerView:shouldRemoveMarker:", {"retval": {"type": "Z"}}) - r(b"NSView", b"scaleUnitSquareToSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r( - b"NSView", - b"scrollClipView:toPoint:", - {"arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSView", b"scrollPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSView", - b"scrollRect:by:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGSize=dd}"}, - } - }, - ) - r( - b"NSView", - b"scrollRectToVisible:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSView", b"setAcceptsTouchEvents:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSView", b"setAutoresizesSubviews:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSView", - b"setBounds:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSView", b"setBoundsOrigin:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSView", b"setBoundsSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSView", b"setCanDrawConcurrently:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSView", b"setCanDrawSubviewsIntoLayer:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSView", b"setClipsToBounds:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSView", - b"setFrame:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSView", b"setFrameOrigin:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSView", b"setFrameSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSView", b"setHidden:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSView", - b"setHorizontalContentSizeConstraintActive:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSView", - b"setKeyboardFocusRingNeedsDisplayInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSView", b"setLayerUsesCoreImageFilters:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSView", b"setNeedsDisplay:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSView", - b"setNeedsDisplayInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSView", b"setNeedsLayout:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSView", b"setNeedsUpdateConstraints:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSView", - b"setPostsBoundsChangedNotifications:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSView", - b"setPostsFrameChangedNotifications:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSView", - b"setTranslatesAutoresizingMaskIntoConstraints:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSView", - b"setVerticalContentSizeConstraintActive:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSView", - b"setWantsBestResolutionOpenGLSurface:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSView", - b"setWantsExtendedDynamicRangeOpenGLSurface:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSView", b"setWantsLayer:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSView", b"setWantsRestingTouches:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSView", b"shouldDelayWindowOrderingForEvent:", {"retval": {"type": "Z"}}) - r(b"NSView", b"shouldDrawColor", {"retval": {"type": "Z"}}) - r( - b"NSView", - b"showDefinitionForAttributedString:atPoint:", - {"arguments": {3: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSView", - b"showDefinitionForAttributedString:range:options:baselineOriginProvider:", - { - "arguments": { - 3: {"type": "{_NSRange=QQ}"}, - 5: { - "callable": { - "retval": {"type": b"{CGPoint=dd}"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{_NSRange=QQ}"}, - }, - } - }, - } - }, - ) - r( - b"NSView", - b"sortSubviewsUsingFunction:context:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"i"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "type": "^?", - "callable_retained": False, - }, - 3: {"type": "@"}, - } - }, - ) - r( - b"NSView", - b"translateOriginToPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r( - b"NSView", - b"translateRectsNeedingDisplayInRect:by:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "{CGSize=dd}"}, - } - }, - ) - r( - b"NSView", - b"translatesAutoresizingMaskIntoConstraints", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSView", - b"visibleRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSView", b"wantsBestResolutionOpenGLSurface", {"retval": {"type": b"Z"}}) - r(b"NSView", b"wantsDefaultClipping", {"retval": {"type": "Z"}}) - r(b"NSView", b"wantsExtendedDynamicRangeOpenGLSurface", {"retval": {"type": "Z"}}) - r(b"NSView", b"wantsLayer", {"retval": {"type": "Z"}}) - r(b"NSView", b"wantsRestingTouches", {"retval": {"type": "Z"}}) - r(b"NSView", b"wantsUpdateLayer", {"retval": {"type": b"Z"}}) - r( - b"NSView", - b"writeEPSInsideRect:toPasteboard:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSView", - b"writePDFInsideRect:toPasteboard:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSViewController", b"commitEditing", {"retval": {"type": "Z"}}) - r( - b"NSViewController", - b"commitEditingWithDelegate:didCommitSelector:contextInfo:", - {"arguments": {3: {"type": ":", "sel_of_type": b"v@:@Z^v"}, 4: {"type": "^v"}}}, - ) - r(b"NSViewController", b"isViewLoaded", {"retval": {"type": b"Z"}}) - r( - b"NSViewController", - b"presentViewController:asPopoverRelativeToRect:ofView:preferredEdge:behavior:hasFullSizeContent:", - {"arguments": {7: {"type": b"Z"}}}, - ) - r( - b"NSViewController", - b"transitionFromViewController:toViewController:options:completionHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSVisualEffectView", b"isEmphasized", {"retval": {"type": "Z"}}) - r(b"NSVisualEffectView", b"setEmphasized:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"acceptsMouseMovedEvents", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"allowsAutomaticWindowTabbing", {"retval": {"type": b"Z"}}) - r(b"NSWindow", b"allowsConcurrentViewDrawing", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"allowsToolTipsWhenApplicationIsInactive", - {"retval": {"type": "Z"}}, - ) - r( - b"NSWindow", - b"animationResizeTime:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSWindow", b"areCursorRectsEnabled", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"aspectRatio", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSWindow", - b"autorecalculatesContentBorderThicknessForEdge:", - {"retval": {"type": "Z"}}, - ) - r(b"NSWindow", b"autorecalculatesKeyViewLoop", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"beginCriticalSheet:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSWindow", - b"beginSheet:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSWindow", - b"cacheImageInRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSWindow", b"canBeVisibleOnAllSpaces", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"canBecomeKeyWindow", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"canBecomeMainWindow", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"canBecomeVisibleWithoutLogin", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"canHide", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"canRepresentDisplayGamut:", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"canStoreColor", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"cascadeTopLeftFromPoint:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r(b"NSWindow", b"contentAspectRatio", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSWindow", b"contentMaxSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSWindow", b"contentMinSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSWindow", - b"contentRectForFrameRect:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSWindow", - b"contentRectForFrameRect:styleMask:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Q"}, - }, - }, - ) - r(b"NSWindow", b"contentResizeIncrements", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSWindow", - b"convertBaseToScreen:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSWindow", - b"convertScreenToBase:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSWindow", - b"dataWithEPSInsideRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSWindow", - b"dataWithPDFInsideRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSWindow", - b"displayLinkWithTarget:selector:", - {"arguments": {3: {"type": ":", "sel_of_type": b"v@:@"}}}, - ) - r(b"NSWindow", b"displaysWhenScreenProfileChanges", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"dragImage:at:offset:event:pasteboard:source:slideBack:", - { - "arguments": { - 3: {"type": "{CGPoint=dd}"}, - 4: {"type": "{CGSize=dd}"}, - 8: {"type": "Z"}, - } - }, - ) - r(b"NSWindow", b"fieldEditor:forObject:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"frame", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r( - b"NSWindow", - b"frameRectForContentRect:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r( - b"NSWindow", - b"frameRectForContentRect:styleMask:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Q"}, - }, - }, - ) - r(b"NSWindow", b"hasActiveWindowSharingSession", {"retval": {"type": b"Z"}}) - r(b"NSWindow", b"hasCloseBox", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"hasDynamicDepthLimit", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"hasShadow", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"hasTitleBar", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"hidesOnDeactivate", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"ignoresMouseEvents", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"inLiveResize", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"initWithContentRect:styleMask:backing:defer:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "Z"}, - } - }, - ) - r( - b"NSWindow", - b"initWithContentRect:styleMask:backing:defer:screen:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": "Z"}, - } - }, - ) - r( - b"NSWindow", - b"initWithWindowRef:", - {"arguments": {2: {"type": "^{OpaqueWindowPtr=}"}}}, - ) - r(b"NSWindow", b"isAutodisplay", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isDocumentEdited", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isExcludedFromWindowsMenu", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isFloatingPanel", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isFlushWindowDisabled", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isKeyWindow", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isMainWindow", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isMiniaturizable", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isMiniaturized", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isModalPanel", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isMovable", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isMovableByWindowBackground", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isOnActiveSpace", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isOneShot", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isOpaque", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isReleasedWhenClosed", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isResizable", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isRestorable", {"retval": {"type": b"Z"}}) - r(b"NSWindow", b"isSheet", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isVisible", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isZoomable", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"isZoomed", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"makeFirstResponder:", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"maxSize", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSWindow", b"minSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSWindow", - b"mouseLocationOutsideOfEventStream", - {"retval": {"type": "{CGPoint=dd}"}}, - ) - r( - b"NSWindow", - b"nextEventMatchingMask:untilDate:inMode:dequeue:", - {"arguments": {5: {"type": "Z"}}}, - ) - r( - b"NSWindow", - b"onstrainFrameRect:toScreen:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - }, - ) - r(b"NSWindow", b"postEvent:atStart:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSWindow", b"preservesContentDuringLiveResize", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"preventsApplicationTerminationWhenModal", - {"retval": {"type": "Z"}}, - ) - r(b"NSWindow", b"resizeIncrements", {"retval": {"type": "{CGSize=dd}"}}) - r(b"NSWindow", b"setAcceptsMouseMovedEvents:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindow", - b"setAllowsAutomaticWindowTabbing:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSWindow", - b"setAllowsConcurrentViewDrawing:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSWindow", - b"setAllowsToolTipsWhenApplicationIsInactive:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSWindow", b"setAspectRatio:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSWindow", b"setAutodisplay:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindow", - b"setAutorecalculatesContentBorderThickness:forEdge:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSWindow", - b"setAutorecalculatesKeyViewLoop:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSWindow", b"setCanBeVisibleOnAllSpaces:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindow", - b"setCanBecomeVisibleWithoutLogin:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSWindow", b"setCanHide:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindow", - b"setContentAspectRatio:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSWindow", b"setContentMaxSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSWindow", b"setContentMinSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r( - b"NSWindow", - b"setContentResizeIncrements:", - {"arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r(b"NSWindow", b"setContentSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r( - b"NSWindow", - b"setDisplaysWhenScreenProfileChanges:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSWindow", b"setDocumentEdited:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setDynamicDepthLimit:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setExcludedFromWindowsMenu:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindow", - b"setFrame:display:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Z"}, - } - }, - ) - r( - b"NSWindow", - b"setFrame:display:animate:", - { - "arguments": { - 2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": "Z"}, - 4: {"type": "Z"}, - } - }, - ) - r(b"NSWindow", b"setFrameAutosaveName:", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"setFrameOrigin:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSWindow", - b"setFrameTopLeftPoint:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSWindow", b"setFrameUsingName:", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"setFrameUsingName:force:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r(b"NSWindow", b"setHasShadow:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setHidesOnDeactivate:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setIgnoresMouseEvents:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setIsMiniaturized:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setIsVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setIsZoomed:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setMaxSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSWindow", b"setMinSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSWindow", b"setMovable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setMovableByWindowBackground:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setOneShot:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setOpaque:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindow", - b"setPreservesContentDuringLiveResize:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSWindow", - b"setPreventsApplicationTerminationWhenModal:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSWindow", b"setReleasedWhenClosed:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setResizeIncrements:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSWindow", b"setRestorable:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSWindow", b"setShowsResizeIndicator:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"setShowsToolbarButton:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindow", - b"setTitlebarAppearsTransparent:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSWindow", b"setViewsNeedDisplay:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"showsResizeIndicator", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"showsToolbarButton", {"retval": {"type": "Z"}}) - r(b"NSWindow", b"titlebarAppearsTransparent", {"retval": {"type": b"Z"}}) - r( - b"NSWindow", - b"trackEventsMatchingMask:timeout:mode:handler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"NSWindow", - b"transferWindowSharingToWindow:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSWindow", - b"tryToPerform:with:", - {"retval": {"type": "Z"}, "arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSWindow", b"useOptimizedDrawing:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindow", b"viewsNeedDisplay", {"retval": {"type": "Z"}}) - r( - b"NSWindow", - b"windowNumberAtPoint:belowWindowWithNumber:", - {"arguments": {2: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSWindow", b"windowRef", {"retval": {"type": "^{OpaqueWindowPtr=}"}}) - r(b"NSWindow", b"worksWhenModal", {"retval": {"type": "Z"}}) - r(b"NSWindowController", b"isWindowLoaded", {"retval": {"type": "Z"}}) - r(b"NSWindowController", b"setDocumentEdited:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWindowController", - b"setShouldCascadeWindows:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSWindowController", - b"setShouldCloseDocument:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSWindowController", b"shouldCascadeWindows", {"retval": {"type": "Z"}}) - r(b"NSWindowController", b"shouldCloseDocument", {"retval": {"type": "Z"}}) - r(b"NSWindowTabGroup", b"isOverviewVisible", {"retval": {"type": "Z"}}) - r(b"NSWindowTabGroup", b"isTabBarVisible", {"retval": {"type": "Z"}}) - r(b"NSWindowTabGroup", b"setOverviewVisible:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSWindowTabGroup", b"setTabBarVisible:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSWorkspace", - b"accessibilityDisplayShouldDifferentiateWithoutColor", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSWorkspace", - b"accessibilityDisplayShouldIncreaseContrast", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSWorkspace", - b"accessibilityDisplayShouldInvertColors", - {"retval": {"type": "Z"}}, - ) - r( - b"NSWorkspace", - b"accessibilityDisplayShouldReduceMotion", - {"retval": {"type": "Z"}}, - ) - r( - b"NSWorkspace", - b"accessibilityDisplayShouldReduceTransparency", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSWorkspace", - b"duplicateURLs:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"NSWorkspace", b"fileSystemChanged", {"retval": {"type": "Z"}}) - r(b"NSWorkspace", b"filenameExtension:isValidForType:", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:", - { - "retval": {"type": "Z"}, - "arguments": { - 3: {"type": "^Z", "type_modifier": b"o"}, - 4: {"type": "^Z", "type_modifier": b"o"}, - 5: {"type": "^Z", "type_modifier": b"o"}, - 6: {"type_modifier": b"o"}, - 7: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSWorkspace", - b"getInfoForFile:application:type:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type_modifier": b"o"}, 4: {"type_modifier": b"o"}}, - }, - ) - r(b"NSWorkspace", b"isFilePackageAtPath:", {"retval": {"type": "Z"}}) - r(b"NSWorkspace", b"isSwitchControlEnabled", {"retval": {"type": "Z"}}) - r(b"NSWorkspace", b"isVoiceOverEnabled", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSWorkspace", b"launchApplication:", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"launchApplication:showIcon:autolaunch:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}, 4: {"type": "Z"}}}, - ) - r( - b"NSWorkspace", - b"launchApplicationAtURL:options:configuration:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSWorkspace", - b"openApplicationAtURL:configuration:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"NSWorkspace", b"openFile:", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"openFile:fromImage:at:inView:", - {"retval": {"type": "Z"}, "arguments": {4: {"type": "{CGPoint=dd}"}}}, - ) - r(b"NSWorkspace", b"openFile:withApplication:", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"openFile:withApplication:andDeactivate:", - {"retval": {"type": "Z"}, "arguments": {4: {"type": "Z"}}}, - ) - r(b"NSWorkspace", b"openTempFile:", {"retval": {"type": "Z"}}) - r(b"NSWorkspace", b"openURL:", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"openURL:configuration:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"openURL:options:configuration:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSWorkspace", - b"openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSWorkspace", - b"openURLs:withApplicationAtURL:configuration:completionHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"openURLs:withApplicationAtURL:options:configuration:error:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSWorkspace", - b"performFileOperation:source:destination:files:tag:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSWorkspace", - b"recycleURLs:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"requestAuthorizationOfType:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"selectFile:inFileViewerRootedAtPath:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSWorkspace", - b"setDefaultApplicationAtURL:toOpenContentType:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"setDefaultApplicationAtURL:toOpenContentTypeOfFileAtURL:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"setDefaultApplicationAtURL:toOpenFileAtURL:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"setDefaultApplicationAtURL:toOpenURLsWithScheme:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSWorkspace", - b"setDesktopImageURL:forScreen:options:error:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSWorkspace", b"setIcon:forFile:options:", {"retval": {"type": "Z"}}) - r(b"NSWorkspace", b"showSearchResultsForQueryString:", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"slideImage:from:to:", - { - "retval": {"type": "v"}, - "arguments": {3: {"type": "{CGPoint=dd}"}, 4: {"type": "{CGPoint=dd}"}}, - }, - ) - r(b"NSWorkspace", b"type:conformsToType:", {"retval": {"type": "Z"}}) - r(b"NSWorkspace", b"typeOfFile:error:", {"arguments": {3: {"type_modifier": b"o"}}}) - r(b"NSWorkspace", b"unmountAndEjectDeviceAtPath:", {"retval": {"type": "Z"}}) - r( - b"NSWorkspace", - b"unmountAndEjectDeviceAtURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSWorkspace", b"userDefaultsChanged", {"retval": {"type": "Z"}}) - r(b"NSWorkspaceOpenConfiguration", b"activates", {"retval": {"type": b"Z"}}) - r(b"NSWorkspaceOpenConfiguration", b"addsToRecentItems", {"retval": {"type": b"Z"}}) - r( - b"NSWorkspaceOpenConfiguration", - b"allowsRunningApplicationSubstitution", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"createsNewApplicationInstance", - {"retval": {"type": b"Z"}}, - ) - r(b"NSWorkspaceOpenConfiguration", b"hides", {"retval": {"type": b"Z"}}) - r(b"NSWorkspaceOpenConfiguration", b"hidesOthers", {"retval": {"type": b"Z"}}) - r(b"NSWorkspaceOpenConfiguration", b"isForPrinting", {"retval": {"type": b"Z"}}) - r( - b"NSWorkspaceOpenConfiguration", - b"promptsUserIfNeeded", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"requiresUniversalLinks", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"setActivates:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"setAddsToRecentItems:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"setAllowsRunningApplicationSubstitution:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"setCreatesNewApplicationInstance:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"setForPrinting:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSWorkspaceOpenConfiguration", b"setHides:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSWorkspaceOpenConfiguration", - b"setHidesOthers:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"setPromptsUserIfNeeded:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSWorkspaceOpenConfiguration", - b"setRequiresUniversalLinks:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"abortEditing", {"retval": {"type": b"Z"}}) - r(b"null", b"acceptsArrowKeys", {"retval": {"type": b"Z"}}) - r(b"null", b"acceptsBinary", {"retval": {"type": b"Z"}}) - r(b"null", b"acceptsFirstResponder", {"retval": {"type": b"Z"}}) - r(b"null", b"acceptsGlyphInfo", {"retval": {"type": b"Z"}}) - r(b"null", b"acceptsMouseMovedEvents", {"retval": {"type": b"Z"}}) - r( - b"null", - b"accessibilityDisplayShouldDifferentiateWithoutColor", - {"retval": {"type": b"Z"}}, - ) - r( - b"null", - b"accessibilityDisplayShouldIncreaseContrast", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"accessibilityDisplayShouldInvertColors", {"retval": {"type": b"Z"}}) - r(b"null", b"accessibilityDisplayShouldReduceMotion", {"retval": {"type": b"Z"}}) - r( - b"null", - b"accessibilityDisplayShouldReduceTransparency", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"accessibilityIsAttributeSettable:", {"retval": {"type": b"Z"}}) - r(b"null", b"accessibilityIsIgnored", {"retval": {"type": b"Z"}}) - r(b"null", b"accessibilityNotifiesWhenDestroyed", {"retval": {"type": b"Z"}}) - r( - b"null", - b"accessibilitySetOverrideValue:forAttribute:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"addWindowsItem:title:filename:", {"arguments": {4: {"type": b"Z"}}}) - r( - b"null", - b"alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:", - {"variadic": True}, - ) - r(b"null", b"allowsCharacterPickerTouchBarItem", {"retval": {"type": b"Z"}}) - r(b"null", b"allowsDocumentBackgroundColorChange", {"retval": {"type": b"Z"}}) - r(b"null", b"allowsEditingTextAttributes", {"retval": {"type": b"Z"}}) - r(b"null", b"allowsExpansionToolTips", {"retval": {"type": b"Z"}}) - r(b"null", b"allowsImageEditing", {"retval": {"type": b"Z"}}) - r(b"null", b"allowsMixedState", {"retval": {"type": b"Z"}}) - r(b"null", b"allowsTickMarkValuesOnly", {"retval": {"type": b"Z"}}) - r(b"null", b"allowsUndo", {"retval": {"type": b"Z"}}) - r(b"null", b"application:delegateHandlesKey:", {"retval": {"type": b"Z"}}) - r(b"null", b"areCursorRectsEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"arrangesAllSubviews", {"retval": {"type": b"Z"}}) - r(b"null", b"autoresizesAllColumnsToFit", {"retval": {"type": b"Z"}}) - r(b"null", b"booleanForKey:inTable:", {"retval": {"type": b"Z"}}) - r(b"null", b"cacheDepthMatchesImageDepth", {"retval": {"type": b"Z"}}) - r(b"null", b"cachesBezierPath", {"retval": {"type": b"Z"}}) - r(b"null", b"canBePreventedByGestureRecognizer:", {"retval": {"type": b"Z"}}) - r(b"null", b"canBecomeKeyView", {"retval": {"type": b"Z"}}) - r(b"null", b"canPreventGestureRecognizer:", {"retval": {"type": b"Z"}}) - r(b"null", b"canStoreColor", {"retval": {"type": b"Z"}}) - r(b"null", b"centersPlaceholder", {"retval": {"type": b"Z"}}) - r(b"null", b"changeWindowsItem:title:filename:", {"arguments": {4: {"type": b"Z"}}}) - r(b"null", b"commitEditing", {"retval": {"type": b"Z"}}) - r( - b"null", - b"commitEditingAndReturnError:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"null", - b"configurePersistentStoreCoordinatorForURL:ofType:error:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"null", b"copiesOnScroll", {"retval": {"type": b"Z"}}) - r(b"null", b"displaysLinkToolTips", {"retval": {"type": b"Z"}}) - r( - b"null", - b"dragFile:fromRect:slideBack:event:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type": b"Z"}}}, - ) - r( - b"null", - b"dragImage:at:offset:event:pasteboard:source:slideBack:", - {"arguments": {8: {"type": b"Z"}}}, - ) - r( - b"null", - b"dragPromisedFilesOfTypes:fromRect:source:slideBack:event:", - {"retval": {"type": b"Z"}, "arguments": {5: {"type": b"Z"}}}, - ) - r( - b"null", - b"dragSelectionWithEvent:offset:slideBack:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type": b"Z"}}}, - ) - r(b"null", b"draggedImage:endedAt:deposited:", {"arguments": {4: {"type": b"Z"}}}) - r( - b"null", - b"draggingSourceOperationMaskForLocal:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"drawArrow:highlight:", {"arguments": {3: {"type": b"Z"}}}) - r( - b"null", - b"drawStatusBarBackgroundInRect:withHighlight:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"null", b"drawsBackground", {"retval": {"type": b"Z"}}) - r(b"null", b"drawsGrid", {"retval": {"type": b"Z"}}) - r(b"null", b"enterFullScreenMode:withOptions:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"enumerateIndexPathsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"null", - b"fetchWithRequest:merge:error:", - { - "retval": {"type": b"Z"}, - "arguments": {3: {"type": b"Z"}, 4: {"type_modifier": b"o"}}, - }, - ) - r(b"null", b"fileSystemChanged", {"retval": {"type": b"Z"}}) - r(b"null", b"filenameExtension:isValidForType:", {"retval": {"type": b"Z"}}) - r(b"null", b"fontManager:willIncludeFont:", {"retval": {"type": b"Z"}}) - r(b"null", b"fontNamed:hasTraits:", {"retval": {"type": b"Z"}}) - r(b"null", b"getInfoForFile:application:type:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"graphicsContextWithGraphicsPort:flipped:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"null", b"hasAmbiguousLayout", {"retval": {"type": b"Z"}}) - r(b"null", b"hasCloseBox", {"retval": {"type": b"Z"}}) - r(b"null", b"hasEqualSpacing", {"retval": {"type": b"Z"}}) - r(b"null", b"hasHorizontalRuler", {"retval": {"type": b"Z"}}) - r(b"null", b"hasTitleBar", {"retval": {"type": b"Z"}}) - r(b"null", b"hasVerticalRuler", {"retval": {"type": b"Z"}}) - r(b"null", b"highlight:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"highlightMode", {"retval": {"type": b"Z"}}) - r(b"null", b"ignoreModifierKeysWhileDragging", {"retval": {"type": b"Z"}}) - r(b"null", b"ignoresMouseEvents", {"retval": {"type": b"Z"}}) - r(b"null", b"importsGraphics", {"retval": {"type": b"Z"}}) - r( - b"null", - b"insertCompletion:forPartialWordRange:movement:isFinal:", - {"arguments": {5: {"type": b"Z"}}}, - ) - r(b"null", b"instantiateNibWithExternalNameTable:", {"retval": {"type": b"Z"}}) - r(b"null", b"instantiateNibWithOwner:topLevelObjects:", {"retval": {"type": b"Z"}}) - r(b"null", b"isAttached", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutodisplay", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutomaticDashSubstitutionEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutomaticDataDetectionEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutomaticLinkDetectionEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutomaticQuoteSubstitutionEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutomaticSpellingCorrectionEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutomaticTextCompletionEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isAutomaticTextReplacementEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isCachedSeparately", {"retval": {"type": b"Z"}}) - r(b"null", b"isCoalescingUndo", {"retval": {"type": b"Z"}}) - r(b"null", b"isColor", {"retval": {"type": b"Z"}}) - r(b"null", b"isContinuousSpellCheckingEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isDataRetained", {"retval": {"type": b"Z"}}) - r(b"null", b"isDrawingFindIndicator", {"retval": {"type": b"Z"}}) - r(b"null", b"isEditable", {"retval": {"type": b"Z"}}) - r(b"null", b"isEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isEntryAcceptable:", {"retval": {"type": b"Z"}}) - r(b"null", b"isFieldEditor", {"retval": {"type": b"Z"}}) - r(b"null", b"isFlipped", {"retval": {"type": b"Z"}}) - r(b"null", b"isFloatingPanel", {"retval": {"type": b"Z"}}) - r(b"null", b"isFlushWindowDisabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isFontAvailable:", {"retval": {"type": b"Z"}}) - r(b"null", b"isFullKeyboardAccessEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isGrammarCheckingEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isHorizontalContentSizeConstraintActive", {"retval": {"type": b"Z"}}) - r(b"null", b"isInFullScreenMode", {"retval": {"type": b"Z"}}) - r(b"null", b"isIncrementalSearchingEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isKey:inTable:", {"retval": {"type": b"Z"}}) - r(b"null", b"isMiniaturizable", {"retval": {"type": b"Z"}}) - r(b"null", b"isModalPanel", {"retval": {"type": b"Z"}}) - r(b"null", b"isOneShot", {"retval": {"type": b"Z"}}) - r(b"null", b"isOutputStackInReverseOrder", {"retval": {"type": b"Z"}}) - r(b"null", b"isPaneSplitter", {"retval": {"type": b"Z"}}) - r(b"null", b"isRegisteredForRemoteNotifications", {"retval": {"type": b"Z"}}) - r(b"null", b"isResizable", {"retval": {"type": b"Z"}}) - r(b"null", b"isRestorable", {"retval": {"type": b"Z"}}) - r(b"null", b"isRichText", {"retval": {"type": b"Z"}}) - r(b"null", b"isRulerVisible", {"retval": {"type": b"Z"}}) - r(b"null", b"isSelectable", {"retval": {"type": b"Z"}}) - r(b"null", b"isSetOnMouseEntered", {"retval": {"type": b"Z"}}) - r(b"null", b"isSetOnMouseExited", {"retval": {"type": b"Z"}}) - r(b"null", b"isSwitchControlEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isTornOff", {"retval": {"type": b"Z"}}) - r(b"null", b"isVertical", {"retval": {"type": b"Z"}}) - r(b"null", b"isVerticalContentSizeConstraintActive", {"retval": {"type": b"Z"}}) - r(b"null", b"isVoiceOverEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"isZoomable", {"retval": {"type": b"Z"}}) - r(b"null", b"knowsPageRange:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"launchApplication:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"launchApplication:showIcon:autolaunch:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type": b"Z"}, 4: {"type": b"Z"}}}, - ) - r( - b"null", - b"launchApplicationAtURL:options:configuration:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"null", - b"layer:shouldInheritContentsScale:fromWindow:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"loadDataRepresentation:ofType:", {"retval": {"type": b"Z"}}) - r(b"null", b"loadFileWrapperRepresentation:ofType:", {"retval": {"type": b"Z"}}) - r(b"null", b"loadNibFile:externalNameTable:withZone:", {"retval": {"type": b"Z"}}) - r(b"null", b"loadNibNamed:owner:", {"retval": {"type": b"Z"}}) - r(b"null", b"loadNibNamed:owner:topLevelObjects:", {"retval": {"type": b"Z"}}) - r(b"null", b"makeWindowsPerform:inOrder:", {"arguments": {3: {"type": b"Z"}}}) - r(b"null", b"menuChangedMessagesEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"needsUpdateConstraints", {"retval": {"type": b"Z"}}) - r( - b"null", - b"nextEventMatchingMask:untilDate:inMode:dequeue:", - {"arguments": {5: {"type": b"Z"}}}, - ) - r( - b"null", - b"openDocumentWithContentsOfFile:display:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"null", - b"openDocumentWithContentsOfURL:display:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"null", - b"openDocumentWithContentsOfURL:display:error:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"null", b"openFile:", {"retval": {"type": b"Z"}}) - r(b"null", b"openFile:fromImage:at:inView:", {"retval": {"type": b"Z"}}) - r(b"null", b"openFile:withApplication:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"openFile:withApplication:andDeactivate:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type": b"Z"}}}, - ) - r(b"null", b"openTempFile:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"openURL:options:configuration:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"null", - b"openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:", - {"retval": {"type": b"Z"}}, - ) - r( - b"null", - b"openURLs:withApplicationAtURL:options:configuration:error:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"null", - b"openUntitledDocumentOfType:display:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"null", - b"panel:compareFilename:with:caseSensitive:", - {"arguments": {5: {"type": b"Z"}}}, - ) - r(b"null", b"panel:isValidFilename:", {"retval": {"type": b"Z"}}) - r(b"null", b"panel:shouldShowFilename:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"performFileOperation:source:destination:files:tag:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"performMnemonic:", {"retval": {"type": b"Z"}}) - r(b"null", b"postEvent:atStart:", {"arguments": {3: {"type": b"Z"}}}) - r(b"null", b"presentError:", {"retval": {"type": b"Z"}}) - r(b"null", b"printShowingPrintPanel:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"printerWithName:domain:includeUnavailable:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r(b"null", b"readFromFile:ofType:", {"retval": {"type": b"Z"}}) - r(b"null", b"readFromURL:ofType:", {"retval": {"type": b"Z"}}) - r(b"null", b"readSelectionFromPasteboard:", {"retval": {"type": b"Z"}}) - r(b"null", b"readSelectionFromPasteboard:type:", {"retval": {"type": b"Z"}}) - r(b"null", b"rectForCancelButtonWhenCentered:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"rectForSearchButtonWhenCentered:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"rectForSearchTextWhenCentered:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"refusesFirstResponder", {"retval": {"type": b"Z"}}) - r( - b"null", - b"registerCloudKitShareWithPreparationHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@?"}}, - } - } - } - }, - ) - r( - b"null", - b"reopenDocumentForURL:withContentsOfURL:error:", - {"retval": {"type": b"Z"}}, - ) - r( - b"null", - b"requestAuthorizationOfType:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"null", b"requiresConstraintBasedLayout", {"retval": {"type": b"Z"}}) - r( - b"null", - b"restoreDocumentWindowWithIdentifier:state:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"null", - b"restoreWindowWithIdentifier:state:completionHandler:", - { - "retval": {"type": b"Z"}, - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - }, - }, - ) - r(b"null", b"revertToSavedFromFile:ofType:", {"retval": {"type": b"Z"}}) - r(b"null", b"revertToSavedFromURL:ofType:", {"retval": {"type": b"Z"}}) - r(b"null", b"rulerView:shouldAddMarker:", {"retval": {"type": b"Z"}}) - r(b"null", b"rulerView:shouldMoveMarker:", {"retval": {"type": b"Z"}}) - r(b"null", b"rulerView:shouldRemoveMarker:", {"retval": {"type": b"Z"}}) - r(b"null", b"rulersVisible", {"retval": {"type": b"Z"}}) - r(b"null", b"saveToURL:ofType:forSaveOperation:error:", {"retval": {"type": b"Z"}}) - r(b"null", b"scalesWhenResized", {"retval": {"type": b"Z"}}) - r( - b"null", - b"searchString:inUserInterfaceItemString:searchRange:foundRange:", - {"retval": {"type": b"Z"}}, - ) - r( - b"null", - b"selectColumn:byExtendingSelection:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"null", b"selectRow:byExtendingSelection:", {"arguments": {3: {"type": b"Z"}}}) - r(b"null", b"sendAction:to:from:", {"retval": {"type": b"Z"}}) - r(b"null", b"setAcceptsArrowKeys:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAcceptsGlyphInfo:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAcceptsMouseMovedEvents:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setAllowsCharacterPickerTouchBarItem:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"null", - b"setAllowsDocumentBackgroundColorChange:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setAllowsEditingTextAttributes:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAllowsExpansionToolTips:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAllowsImageEditing:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAllowsMixedState:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAllowsTickMarkValuesOnly:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAllowsUndo:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setArrangesAllSubviews:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAutodisplay:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setAutomaticDashSubstitutionEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setAutomaticDataDetectionEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setAutomaticLinkDetectionEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setAutomaticQuoteSubstitutionEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"null", - b"setAutomaticSpellingCorrectionEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"null", - b"setAutomaticTextCompletionEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"null", - b"setAutomaticTextReplacementEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setAutoresizesAllColumnsToFit:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setCacheDepthMatchesImageDepth:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setCachedSeparately:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setCachesBezierPath:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setCentersPlaceholder:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setContinuousSpellCheckingEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setCopiesOnScroll:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setDataRetained:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setDesktopImageURL:forScreen:options:error:", - {"retval": {"type": b"Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"null", b"setDisplaysLinkToolTips:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setDrawsBackground:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setDrawsGrid:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setEditable:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setFieldEditor:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setFlipped:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setFloatingPointFormat:left:right:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setGrammarCheckingEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setHasEqualSpacing:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setHasHorizontalRuler:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setHasVerticalRuler:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setHighlightMode:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setHorizontalContentSizeConstraintActive:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setIgnoresMouseEvents:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setImportsGraphics:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setIncrementalSearchingEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setIsMiniaturized:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setIsPaneSplitter:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setIsVisible:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setIsZoomed:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setMenuChangedMessagesEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setNeedsUpdateConstraints:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setOnMouseEntered:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setOnMouseExited:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setOneShot:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setRefusesFirstResponder:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setResizable:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setRestorable:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setRichText:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setRulerVisible:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setRulersVisible:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setScalesWhenResized:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setSelectable:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setSelectedRange:affinity:stillSelecting:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"null", - b"setSelectedRanges:affinity:stillSelecting:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r(b"null", b"setShouldAntialias:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setShouldCreateUI:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setShowPanels:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setShowsFirstResponder:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setShowsResizeIndicator:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setSmartInsertDeleteEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setTabKeyTraversesCells:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setTranslatesAutoresizingMaskIntoConstraints:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setUsesFindBar:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setUsesFindPanel:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setUsesFontPanel:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setUsesInspectorBar:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setUsesLazyFetching:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setUsesRolloverButtonForSelection:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"setUsesRuler:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"setUsesSingleLineMode:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"null", - b"setVerticalContentSizeConstraintActive:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"null", - b"setWantsBestResolutionOpenGLSurface:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"null", - b"setWantsExtendedDynamicRangeOpenGLSurface:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"shouldAntialias", {"retval": {"type": b"Z"}}) - r( - b"null", - b"shouldBeRequiredToFailByGestureRecognizer:", - {"retval": {"type": b"Z"}}, - ) - r( - b"null", - b"shouldChangeTextInRange:replacementString:", - {"retval": {"type": b"Z"}}, - ) - r( - b"null", - b"shouldChangeTextInRanges:replacementStrings:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"shouldCreateUI", {"retval": {"type": b"Z"}}) - r(b"null", b"shouldDrawColor", {"retval": {"type": b"Z"}}) - r(b"null", b"shouldFocusCell:atColumn:row:", {"retval": {"type": b"Z"}}) - r(b"null", b"shouldInvalidateLayoutForBoundsChange:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"shouldInvalidateLayoutForPreferredLayoutAttributes:withOriginalAttributes:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"shouldRequireFailureOfGestureRecognizer:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"showDefinitionForAttributedString:range:options:baselineOriginProvider:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"{CGPoint=dd}"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{_NSRange=QQ}"}, - }, - } - } - } - }, - ) - r(b"null", b"showPanels", {"retval": {"type": b"Z"}}) - r(b"null", b"showsFirstResponder", {"retval": {"type": b"Z"}}) - r(b"null", b"showsResizeIndicator", {"retval": {"type": b"Z"}}) - r(b"null", b"smartInsertDeleteEnabled", {"retval": {"type": b"Z"}}) - r(b"null", b"tabKeyTraversesCells", {"retval": {"type": b"Z"}}) - r(b"null", b"tableView:writeRows:toPasteboard:", {"retval": {"type": b"Z"}}) - r(b"null", b"textShouldBeginEditing:", {"retval": {"type": b"Z"}}) - r(b"null", b"textShouldEndEditing:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"trackEventsMatchingMask:timeout:mode:handler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"null", - b"transitionFromViewController:toViewController:options:completionHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"null", b"translatesAutoresizingMaskIntoConstraints", {"retval": {"type": b"Z"}}) - r(b"null", b"tryToPerform:with:", {"retval": {"type": b"Z"}}) - r(b"null", b"type:conformsToType:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"updateInsertionPointStateAndRestartTimer:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"null", b"useOptimizedDrawing:", {"arguments": {2: {"type": b"Z"}}}) - r(b"null", b"userDefaultsChanged", {"retval": {"type": b"Z"}}) - r(b"null", b"usesFindBar", {"retval": {"type": b"Z"}}) - r(b"null", b"usesFindPanel", {"retval": {"type": b"Z"}}) - r(b"null", b"usesFontPanel", {"retval": {"type": b"Z"}}) - r(b"null", b"usesInspectorBar", {"retval": {"type": b"Z"}}) - r(b"null", b"usesLazyFetching", {"retval": {"type": b"Z"}}) - r(b"null", b"usesRolloverButtonForSelection", {"retval": {"type": b"Z"}}) - r(b"null", b"usesRuler", {"retval": {"type": b"Z"}}) - r(b"null", b"usesSingleLineMode", {"retval": {"type": b"Z"}}) - r(b"null", b"validateMenuItem:", {"retval": {"type": b"Z"}}) - r(b"null", b"validateProposedFirstResponder:forEvent:", {"retval": {"type": b"Z"}}) - r(b"null", b"wantsBestResolutionOpenGLSurface", {"retval": {"type": b"Z"}}) - r(b"null", b"wantsExtendedDynamicRangeOpenGLSurface", {"retval": {"type": b"Z"}}) - r(b"null", b"wantsNotificationForMarkedText", {"retval": {"type": b"Z"}}) - r(b"null", b"writeFileContents:", {"retval": {"type": b"Z"}}) - r(b"null", b"writeFileWrapper:", {"retval": {"type": b"Z"}}) - r(b"null", b"writeSelectionToPasteboard:type:", {"retval": {"type": b"Z"}}) - r(b"null", b"writeSelectionToPasteboard:types:", {"retval": {"type": b"Z"}}) - r(b"null", b"writeToFile:ofType:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"writeToFile:ofType:originalFile:saveOperation:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"writeToURL:ofType:", {"retval": {"type": b"Z"}}) - r( - b"null", - b"writeWithBackupToFile:ofType:saveOperation:", - {"retval": {"type": b"Z"}}, - ) -finally: - objc._updatingMetadata(False) -protocols = { - "NSSavePanelDelegateDeprecated": objc.informal_protocol( - "NSSavePanelDelegateDeprecated", - [ - objc.selector( - None, - b"panel:compareFilename:with:caseSensitive:", - b"q@:@@@Z", - isRequired=False, - ), - objc.selector( - None, b"panel:directoryDidChange:", b"v@:@@", isRequired=False - ), - objc.selector( - None, b"panel:shouldShowFilename:", b"Z@:@@", isRequired=False - ), - objc.selector(None, b"panel:isValidFilename:", b"Z@:@@", isRequired=False), - ], - ), - "NSAccessibilityAdditions": objc.informal_protocol( - "NSAccessibilityAdditions", - [ - objc.selector( - None, - b"accessibilitySetOverrideValue:forAttribute:", - b"Z@:@@", - isRequired=False, - ) - ], - ), - "NSApplicationScriptingDelegation": objc.informal_protocol( - "NSApplicationScriptingDelegation", - [ - objc.selector( - None, b"application:delegateHandlesKey:", b"Z@:@@", isRequired=False - ) - ], - ), - "NSNibAwaking": objc.informal_protocol( - "NSNibAwaking", - [ - objc.selector(None, b"awakeFromNib", b"v@:", isRequired=False), - objc.selector( - None, b"prepareForInterfaceBuilder", b"v@:", isRequired=False - ), - ], - ), - "NSToolTipOwner": objc.informal_protocol( - "NSToolTipOwner", - [ - objc.selector( - None, - b"view:stringForToolTip:point:userData:", - b"@@:@q{CGPoint=dd}^v", - isRequired=False, - ) - ], - ), - "NSDraggingDestination": objc.informal_protocol( - "NSDraggingDestination", - [ - objc.selector(None, b"draggingEntered:", b"Q@:@", isRequired=False), - objc.selector(None, b"draggingUpdated:", b"Q@:@", isRequired=False), - objc.selector(None, b"draggingExited:", b"v@:@", isRequired=False), - objc.selector(None, b"prepareForDragOperation:", b"Z@:@", isRequired=False), - objc.selector(None, b"performDragOperation:", b"Z@:@", isRequired=False), - objc.selector(None, b"concludeDragOperation:", b"v@:@", isRequired=False), - objc.selector(None, b"draggingEnded:", b"v@:@", isRequired=False), - objc.selector( - None, b"wantsPeriodicDraggingUpdates", b"Z@:", isRequired=False - ), - ], - ), - "NSOutlineViewNotifications": objc.informal_protocol( - "NSOutlineViewNotifications", - [ - objc.selector( - None, b"outlineViewSelectionDidChange:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"outlineViewColumnDidMove:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"outlineViewColumnDidResize:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"outlineViewSelectionIsChanging:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"outlineViewItemWillExpand:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"outlineViewItemDidExpand:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"outlineViewItemWillCollapse:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"outlineViewItemDidCollapse:", b"v@:@", isRequired=False - ), - ], - ), - "NSDraggingSource": objc.informal_protocol( - "NSDraggingSource", - [ - objc.selector( - None, b"draggingSourceOperationMaskForLocal:", b"Q@:Z", isRequired=False - ), - objc.selector( - None, - b"namesOfPromisedFilesDroppedAtDestination:", - b"@@:@", - isRequired=False, - ), - objc.selector( - None, b"draggedImage:beganAt:", b"v@:@{CGPoint=dd}", isRequired=False - ), - objc.selector( - None, - b"draggedImage:endedAt:operation:", - b"v@:@{CGPoint=dd}Q", - isRequired=False, - ), - objc.selector( - None, b"draggedImage:movedTo:", b"v@:@{CGPoint=dd}", isRequired=False - ), - objc.selector( - None, b"ignoreModifierKeysWhileDragging", b"Z@:", isRequired=False - ), - ], - ), - "NSPasteboardOwner": objc.informal_protocol( - "NSPasteboardOwner", - [ - objc.selector( - None, b"pasteboard:provideDataForType:", b"v@:@@", isRequired=False - ), - objc.selector(None, b"pasteboardChangedOwner:", b"v@:@", isRequired=False), - ], - ), - "NSAccessibility": objc.informal_protocol( - "NSAccessibility", - [ - objc.selector( - None, b"accessibilityAttributeValue:", b"@@:@", isRequired=False - ), - objc.selector( - None, - b"accessibilityParameterizedAttributeNames", - b"@@:", - isRequired=False, - ), - objc.selector( - None, b"accessibilityArrayAttributeCount:", b"Q@:@", isRequired=False - ), - objc.selector( - None, b"accessibilityIsAttributeSettable:", b"Z@:@", isRequired=False - ), - objc.selector( - None, - b"accessibilityAttributeValue:forParameter:", - b"@@:@@", - isRequired=False, - ), - objc.selector( - None, - b"accessibilityArrayAttributeValues:index:maxCount:", - b"@@:@QQ", - isRequired=False, - ), - objc.selector(None, b"accessibilityActionNames", b"@@:", isRequired=False), - objc.selector( - None, b"accessibilityAttributeNames", b"@@:", isRequired=False - ), - objc.selector( - None, b"accessibilityNotifiesWhenDestroyed", b"Z@:", isRequired=False - ), - objc.selector( - None, b"accessibilityIndexOfChild:", b"Q@:@", isRequired=False - ), - objc.selector( - None, b"accessibilityPerformAction:", b"v@:@", isRequired=False - ), - objc.selector(None, b"accessibilityIsIgnored", b"Z@:", isRequired=False), - objc.selector( - None, b"accessibilityActionDescription:", b"@@:@", isRequired=False - ), - objc.selector( - None, b"accessibilityHitTest:", b"@@:{CGPoint=dd}", isRequired=False - ), - objc.selector( - None, b"accessibilitySetValue:forAttribute:", b"v@:@@", isRequired=False - ), - objc.selector( - None, b"accessibilityFocusedUIElement", b"@@:", isRequired=False - ), - ], - ), - "NSRulerMarkerClientViewDelegation": objc.informal_protocol( - "NSRulerMarkerClientViewDelegation", - [ - objc.selector( - None, b"rulerView:didRemoveMarker:", b"v@:@@", isRequired=False - ), - objc.selector( - None, b"rulerView:shouldRemoveMarker:", b"Z@:@@", isRequired=False - ), - objc.selector( - None, b"rulerView:shouldMoveMarker:", b"Z@:@@", isRequired=False - ), - objc.selector( - None, - b"rulerView:locationForPoint:", - b"d@:@{CGPoint=dd}", - isRequired=False, - ), - objc.selector( - None, - b"rulerView:willAddMarker:atLocation:", - b"d@:@@d", - isRequired=False, - ), - objc.selector( - None, b"rulerView:didMoveMarker:", b"v@:@@", isRequired=False - ), - objc.selector( - None, - b"rulerView:pointForLocation:", - b"{CGPoint=dd}@:@d", - isRequired=False, - ), - objc.selector( - None, b"rulerView:handleMouseDown:", b"v@:@@", isRequired=False - ), - objc.selector( - None, - b"rulerView:willMoveMarker:toLocation:", - b"d@:@@d", - isRequired=False, - ), - objc.selector(None, b"rulerView:didAddMarker:", b"v@:@@", isRequired=False), - objc.selector( - None, b"rulerView:shouldAddMarker:", b"Z@:@@", isRequired=False - ), - objc.selector( - None, b"rulerView:willSetClientView:", b"v@:@@", isRequired=False - ), - ], - ), - "NSFontPanelValidationAdditions": objc.informal_protocol( - "NSFontPanelValidationAdditions", - [objc.selector(None, b"validModesForFontPanel:", b"Q@:@", isRequired=False)], - ), - "NSToolbarItemValidation": objc.informal_protocol( - "NSToolbarItemValidation", - [objc.selector(None, b"validateToolbarItem:", b"Z@:@", isRequired=False)], - ), - "NSKeyValueBindingCreation": objc.informal_protocol( - "NSKeyValueBindingCreation", - [ - objc.selector( - None, - b"bind:toObject:withKeyPath:options:", - b"v@:@@@@", - isRequired=False, - ), - objc.selector(None, b"exposeBinding:", b"v@:@", isRequired=False), - objc.selector(None, b"valueClassForBinding:", b"#@:@", isRequired=False), - objc.selector(None, b"unbind:", b"v@:@", isRequired=False), - objc.selector(None, b"infoForBinding:", b"@@:@", isRequired=False), - objc.selector(None, b"exposedBindings", b"@@:", isRequired=False), - objc.selector( - None, b"optionDescriptionsForBinding:", b"@@:@", isRequired=False - ), - ], - ), - "NSDictionaryControllerKeyValuePair": objc.informal_protocol( - "NSDictionaryControllerKeyValuePair", - [ - objc.selector(None, b"setKey:", b"v@:@", isRequired=False), - objc.selector(None, b"setLocalizedKey:", b"v@:@", isRequired=False), - objc.selector(None, b"value", b"@@:", isRequired=False), - objc.selector(None, b"isExplicitlyIncluded", b"Z@:", isRequired=False), - objc.selector(None, b"setValue:", b"v@:@", isRequired=False), - objc.selector(None, b"key", b"@@:", isRequired=False), - objc.selector(None, b"localizedKey", b"@@:", isRequired=False), - ], - ), - "NSEditor": objc.informal_protocol( - "NSEditor", - [ - objc.selector(None, b"discardEditing", b"v@:", isRequired=False), - objc.selector(None, b"commitEditing", b"Z@:", isRequired=False), - objc.selector( - None, - b"commitEditingWithDelegate:didCommitSelector:contextInfo:", - b"v@:@:^v", - isRequired=False, - ), - objc.selector( - None, b"commitEditingAndReturnError:", b"Z@:^@", isRequired=False - ), - ], - ), - "NSFontManagerDelegate": objc.informal_protocol( - "NSFontManagerDelegate", - [ - objc.selector( - None, b"fontManager:willIncludeFont:", b"Z@:@@", isRequired=False - ) - ], - ), - "NSControlSubclassNotifications": objc.informal_protocol( - "NSControlSubclassNotifications", - [ - objc.selector(None, b"controlTextDidChange:", b"v@:@", isRequired=False), - objc.selector( - None, b"controlTextDidBeginEditing:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"controlTextDidEndEditing:", b"v@:@", isRequired=False - ), - ], - ), - "NSServicesRequests": objc.informal_protocol( - "NSServicesRequests", - [ - objc.selector( - None, b"readSelectionFromPasteboard:", b"Z@:@", isRequired=False - ), - objc.selector( - None, b"writeSelectionToPasteboard:types:", b"Z@:@@", isRequired=False - ), - ], - ), - "NSTableViewDataSourceDeprecated": objc.informal_protocol( - "NSTableViewDataSourceDeprecated", - [ - objc.selector( - None, b"tableView:writeRows:toPasteboard:", b"Z@:@@@", isRequired=False - ) - ], - ), - "NSPlaceholders": objc.informal_protocol( - "NSPlaceholders", - [ - objc.selector( - None, - b"setDefaultPlaceholder:forMarker:withBinding:", - b"v@:@@@", - isRequired=False, - ), - objc.selector( - None, - b"defaultPlaceholderForMarker:withBinding:", - b"@@:@@", - isRequired=False, - ), - ], - ), - "NSDeprecatedTextStorageDelegateInterface": objc.informal_protocol( - "NSDeprecatedTextStorageDelegateInterface", - [ - objc.selector( - None, b"textStorageWillProcessEditing:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"textStorageDidProcessEditing:", b"v@:@", isRequired=False - ), - ], - ), - "NSDraggingSourceDeprecated": objc.informal_protocol( - "NSDraggingSourceDeprecated", - [ - objc.selector( - None, - b"namesOfPromisedFilesDroppedAtDestination:", - b"@@:@", - isRequired=False, - ), - objc.selector( - None, - b"draggedImage:endedAt:operation:", - b"v@:@{CGPoint=dd}Q", - isRequired=False, - ), - objc.selector( - None, b"draggedImage:beganAt:", b"v@:@{CGPoint=dd}", isRequired=False - ), - objc.selector( - None, - b"draggedImage:endedAt:deposited:", - b"v@:@{CGPoint=dd}Z", - isRequired=False, - ), - objc.selector( - None, b"draggingSourceOperationMaskForLocal:", b"Q@:Z", isRequired=False - ), - objc.selector( - None, b"draggedImage:movedTo:", b"v@:@{CGPoint=dd}", isRequired=False - ), - objc.selector( - None, b"ignoreModifierKeysWhileDragging", b"Z@:", isRequired=False - ), - ], - ), - "NSColorPanelResponderMethod": objc.informal_protocol( - "NSColorPanelResponderMethod", - [objc.selector(None, b"changeColor:", b"v@:@", isRequired=False)], - ), - "NSMenuValidation": objc.informal_protocol( - "NSMenuValidation", - [objc.selector(None, b"validateMenuItem:", b"Z@:@", isRequired=False)], - ), - "NSEditorRegistration": objc.informal_protocol( - "NSEditorRegistration", - [ - objc.selector(None, b"objectDidEndEditing:", b"v@:@", isRequired=False), - objc.selector(None, b"objectDidBeginEditing:", b"v@:@", isRequired=False), - ], - ), - "NSFontManagerResponderMethod": objc.informal_protocol( - "NSFontManagerResponderMethod", - [objc.selector(None, b"changeFont:", b"v@:@", isRequired=False)], - ), - "NSLayerDelegateContentsScaleUpdating": objc.informal_protocol( - "NSLayerDelegateContentsScaleUpdating", - [ - objc.selector( - None, - b"layer:shouldInheritContentsScale:fromWindow:", - b"Z@:@d@", - isRequired=False, - ) - ], - ), -} -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/AppKit/_nsapp.py b/write-message/venv/lib/python3.10/site-packages/AppKit/_nsapp.py deleted file mode 100644 index 52dd48e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/AppKit/_nsapp.py +++ /dev/null @@ -1,29 +0,0 @@ -import objc as _objc -import AppKit as _AppKit - - -class _NSApp: - """ - Helper class to emulate NSApp in Python. - """ - - def __getrealapp(self): - d = {} - _objc.loadBundleVariables(_AppKit.__bundle__, d, [("NSApp", b"@")]) - return d.get("NSApp") - - __class__ = property(lambda self: self.__getrealapp().__class__) - - def __getattr__(self, name): - return getattr(self.__getrealapp(), name) - - def __setattr__(self, name, value): - return setattr(self.__getrealapp(), name, value) - - def __call__(self): - # Compatibility with previous versions. - return self.__getrealapp() - - -NSApp = _NSApp() -del _NSApp diff --git a/write-message/venv/lib/python3.10/site-packages/Cocoa/__init__.py b/write-message/venv/lib/python3.10/site-packages/Cocoa/__init__.py deleted file mode 100644 index c8b2190..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Cocoa/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Python mapping for the Cocoa framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import AppKit - import objc - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Cocoa", - frameworkIdentifier=None, - frameworkPath=None, - globals_dict=globals(), - inline_list=None, - parents=(AppKit,), - metadict={}, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Cocoa/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Cocoa/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 39ca02e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Cocoa/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_CoreFoundation.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_CoreFoundation.cpython-310-darwin.so deleted file mode 100755 index 9d62919..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_CoreFoundation.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__init__.py b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__init__.py deleted file mode 100644 index bc0c3e3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__init__.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Python mapping for the CoreFoundation framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import objc - from . import _metadata, _CoreFoundation, _static - from ._inlines import _inline_list_ - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="CoreFoundation", - frameworkIdentifier="com.apple.CoreFoundation", - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/CoreFoundation.framework" - ), - globals_dict=globals(), - inline_list=_inline_list_, - parents=( - _CoreFoundation, - _static, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["CoreFoundation._metadata"] - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 7362355..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index a162dfd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/_static.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/_static.cpython-310.pyc deleted file mode 100644 index f861122..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/__pycache__/_static.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_inlines.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_inlines.cpython-310-darwin.so deleted file mode 100755 index 12f61ec..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_inlines.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_metadata.py b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_metadata.py deleted file mode 100644 index c8fe810..0000000 --- a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_metadata.py +++ /dev/null @@ -1,3499 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sun Jul 30 12:13:42 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -misc.update( - { - "CGPoint": objc.createStructType( - "CoreFoundation.CGPoint", b"{CGPoint=dd}", ["x", "y"] - ), - "CFXMLExternalID": objc.createStructType( - "CoreFoundation.CFXMLExternalID", - b"{CFXMLExternalID=^{__CFURL=}^{__CFString=}}", - ["systemID", "publicID"], - ), - "CFXMLAttributeDeclarationInfo": objc.createStructType( - "CoreFoundation.CFXMLAttributeDeclarationInfo", - b"{CFXMLAttributeDeclarationInfo=^{__CFString=}^{__CFString=}^{__CFString=}}", - ["attributeName", "typeString", "defaultString"], - ), - "CFGregorianDate": objc.createStructType( - "CoreFoundation.CFGregorianDate", - b"{CFGregorianDate=iccccd}", - ["year", "month", "day", "hour", "minute", "second"], - ), - "CFXMLDocumentTypeInfo": objc.createStructType( - "CoreFoundation.CFXMLDocumentTypeInfo", - b"{CFXMLDocumentTypeInfo={CFXMLExternalID=^{__CFURL=}^{__CFString=}}}", - ["externalID"], - ), - "CGVector": objc.createStructType( - "CoreFoundation.CGVector", b"{CGVector=dd}", ["dx", "dy"] - ), - "CGSize": objc.createStructType( - "CoreFoundation.CGSize", b"{CGSize=dd}", ["width", "height"] - ), - "CFSocketSignature": objc.createStructType( - "CoreFoundation.CFSocketSignature", - b"{CFSocketSignature=iii^{__CFData=}}", - ["protocolFamily", "socketType", "protocol", "address"], - ), - "CFXMLDocumentInfo": objc.createStructType( - "CoreFoundation.CFXMLDocumentInfo", - b"{CFXMLDocumentInfo=^{__CFURL=}I}", - ["sourceURL", "encoding"], - ), - "CFXMLElementInfo": objc.createStructType( - "CoreFoundation.CFXMLElementInfo", - b"{CFXMLElementInfo=^{__CFDictionary=}^{__CFArray=}Z[3c]}", - ["attributes", "attributeOrder", "isEmpty", "_reserved"], - ), - "CFUUIDBytes": objc.createStructType( - "CoreFoundation.CFUUIDBytes", - b"{CFUUIDBytes=CCCCCCCCCCCCCCCC}", - [ - "byte0", - "byte1", - "byte2", - "byte3", - "byte4", - "byte5", - "byte6", - "byte7", - "byte8", - "byte9", - "byte10", - "byte11", - "byte12", - "byte13", - "byte14", - "byte15", - ], - ), - "CFSwappedFloat32": objc.createStructType( - "CoreFoundation.CFSwappedFloat32", b"{CFSwappedFloat32=I}", ["v"] - ), - "CFXMLEntityReferenceInfo": objc.createStructType( - "CoreFoundation.CFXMLEntityReferenceInfo", - b"{CFXMLEntityReferenceInfo=q}", - ["entityType"], - ), - "CFXMLProcessingInstructionInfo": objc.createStructType( - "CoreFoundation.CFXMLProcessingInstructionInfo", - b"{CFXMLProcessingInstructionInfo=^{__CFString=}}", - ["dataString"], - ), - "CFRange": objc.createStructType( - "CoreFoundation.CFRange", b"{CFRange=qq}", ["location", "length"] - ), - "CGRect": objc.createStructType( - "CoreFoundation.CGRect", - b"{CGRect={CGPoint=dd}{CGSize=dd}}", - ["origin", "size"], - ), - "CFStreamError": objc.createStructType( - "CoreFoundation.CFStreamError", b"{CFStreamError=qi}", ["domain", "error"] - ), - "CFXMLAttributeListDeclarationInfo": objc.createStructType( - "CoreFoundation.CFXMLAttributeListDeclarationInfo", - b"{CFXMLAttributeListDeclarationInfo=q^{CFXMLAttributeDeclarationInfo=^{__CFString=}^{__CFString=}^{__CFString=}}}", - ["numberOfAttributes", "attributes"], - ), - "CFGregorianUnits": objc.createStructType( - "CoreFoundation.CFGregorianUnits", - b"{CFGregorianUnits=iiiiid}", - ["years", "months", "days", "hours", "minutes", "seconds"], - ), - "CFXMLElementTypeDeclarationInfo": objc.createStructType( - "CoreFoundation.CFXMLElementTypeDeclarationInfo", - b"{CFXMLElementTypeDeclarationInfo=^{__CFString=}}", - ["contentDescription"], - ), - "CFXMLEntityInfo": objc.createStructType( - "CoreFoundation.CFXMLEntityInfo", - b"{CFXMLEntityInfo=q^{__CFString=}{CFXMLExternalID=^{__CFURL=}^{__CFString=}}^{__CFString=}}", - ["entityType", "replacementText", "entityID", "notationName"], - ), - "CFXMLNotationInfo": objc.createStructType( - "CoreFoundation.CFXMLNotationInfo", - b"{CFXMLNotationInfo={CFXMLExternalID=^{__CFURL=}^{__CFString=}}}", - ["externalID"], - ), - "CGAffineTransformComponents": objc.createStructType( - "CoreFoundation.CGAffineTransformComponents", - b"{CGAffineTransformComponents={CGSize=dd}dd{CGVector=dd}}", - ["scale", "horizontalShear", "rotation", "translation"], - ), - "CFSwappedFloat64": objc.createStructType( - "CoreFoundation.CFSwappedFloat64", b"{CFSwappedFloat64=Q}", ["v"] - ), - "CGAffineTransform": objc.createStructType( - "CoreFoundation.CGAffineTransform", - b"{CGAffineTransform=dddddd}", - ["a", "b", "c", "d", "tx", "ty"], - ), - } -) -constants = """$kCFAbsoluteTimeIntervalSince1904@d$kCFAbsoluteTimeIntervalSince1970@d$kCFAllocatorDefault@^{__CFAllocator=}$kCFAllocatorMalloc@^{__CFAllocator=}$kCFAllocatorMallocZone@^{__CFAllocator=}$kCFAllocatorNull@^{__CFAllocator=}$kCFAllocatorSystemDefault@^{__CFAllocator=}$kCFAllocatorUseContext@^{__CFAllocator=}$kCFBooleanFalse@^{__CFBoolean=}$kCFBooleanTrue@^{__CFBoolean=}$kCFBuddhistCalendar$kCFBundleDevelopmentRegionKey$kCFBundleExecutableKey$kCFBundleIdentifierKey$kCFBundleInfoDictionaryVersionKey$kCFBundleLocalizationsKey$kCFBundleNameKey$kCFBundleVersionKey$kCFChineseCalendar$kCFCoreFoundationVersionNumber@d$kCFDateFormatterAMSymbol$kCFDateFormatterCalendar$kCFDateFormatterCalendarName$kCFDateFormatterDefaultDate$kCFDateFormatterDefaultFormat$kCFDateFormatterDoesRelativeDateFormattingKey$kCFDateFormatterEraSymbols$kCFDateFormatterGregorianStartDate$kCFDateFormatterIsLenient$kCFDateFormatterLongEraSymbols$kCFDateFormatterMonthSymbols$kCFDateFormatterPMSymbol$kCFDateFormatterQuarterSymbols$kCFDateFormatterShortMonthSymbols$kCFDateFormatterShortQuarterSymbols$kCFDateFormatterShortStandaloneMonthSymbols$kCFDateFormatterShortStandaloneQuarterSymbols$kCFDateFormatterShortStandaloneWeekdaySymbols$kCFDateFormatterShortWeekdaySymbols$kCFDateFormatterStandaloneMonthSymbols$kCFDateFormatterStandaloneQuarterSymbols$kCFDateFormatterStandaloneWeekdaySymbols$kCFDateFormatterTimeZone$kCFDateFormatterTwoDigitStartDate$kCFDateFormatterVeryShortMonthSymbols$kCFDateFormatterVeryShortStandaloneMonthSymbols$kCFDateFormatterVeryShortStandaloneWeekdaySymbols$kCFDateFormatterVeryShortWeekdaySymbols$kCFDateFormatterWeekdaySymbols$kCFErrorDescriptionKey$kCFErrorDomainCocoa$kCFErrorDomainMach$kCFErrorDomainOSStatus$kCFErrorDomainPOSIX$kCFErrorFilePathKey$kCFErrorLocalizedDescriptionKey$kCFErrorLocalizedFailureKey$kCFErrorLocalizedFailureReasonKey$kCFErrorLocalizedRecoverySuggestionKey$kCFErrorURLKey$kCFErrorUnderlyingErrorKey$kCFGregorianCalendar$kCFHebrewCalendar$kCFISO8601Calendar$kCFIndianCalendar$kCFIslamicCalendar$kCFIslamicCivilCalendar$kCFIslamicTabularCalendar$kCFIslamicUmmAlQuraCalendar$kCFJapaneseCalendar$kCFLocaleAlternateQuotationBeginDelimiterKey$kCFLocaleAlternateQuotationEndDelimiterKey$kCFLocaleCalendar$kCFLocaleCalendarIdentifier$kCFLocaleCollationIdentifier$kCFLocaleCollatorIdentifier$kCFLocaleCountryCode$kCFLocaleCountryCodeKey$kCFLocaleCurrencyCode$kCFLocaleCurrencySymbol$kCFLocaleCurrentLocaleDidChangeNotification$kCFLocaleDecimalSeparator$kCFLocaleExemplarCharacterSet$kCFLocaleGroupingSeparator$kCFLocaleIdentifier$kCFLocaleLanguageCode$kCFLocaleLanguageCodeKey$kCFLocaleMeasurementSystem$kCFLocaleQuotationBeginDelimiterKey$kCFLocaleQuotationEndDelimiterKey$kCFLocaleScriptCode$kCFLocaleUsesMetricSystem$kCFLocaleVariantCode$kCFNull@^{__CFNull=}$kCFNumberFormatterAlwaysShowDecimalSeparator$kCFNumberFormatterCurrencyCode$kCFNumberFormatterCurrencyDecimalSeparator$kCFNumberFormatterCurrencyGroupingSeparator$kCFNumberFormatterCurrencySymbol$kCFNumberFormatterDecimalSeparator$kCFNumberFormatterDefaultFormat$kCFNumberFormatterExponentSymbol$kCFNumberFormatterFormatWidth$kCFNumberFormatterGroupingSeparator$kCFNumberFormatterGroupingSize$kCFNumberFormatterInfinitySymbol$kCFNumberFormatterInternationalCurrencySymbol$kCFNumberFormatterIsLenient$kCFNumberFormatterMaxFractionDigits$kCFNumberFormatterMaxIntegerDigits$kCFNumberFormatterMaxSignificantDigits$kCFNumberFormatterMinFractionDigits$kCFNumberFormatterMinIntegerDigits$kCFNumberFormatterMinSignificantDigits$kCFNumberFormatterMinusSign$kCFNumberFormatterMultiplier$kCFNumberFormatterNaNSymbol$kCFNumberFormatterNegativePrefix$kCFNumberFormatterNegativeSuffix$kCFNumberFormatterPaddingCharacter$kCFNumberFormatterPaddingPosition$kCFNumberFormatterPerMillSymbol$kCFNumberFormatterPercentSymbol$kCFNumberFormatterPlusSign$kCFNumberFormatterPositivePrefix$kCFNumberFormatterPositiveSuffix$kCFNumberFormatterRoundingIncrement$kCFNumberFormatterRoundingMode$kCFNumberFormatterSecondaryGroupingSize$kCFNumberFormatterUseGroupingSeparator$kCFNumberFormatterUseSignificantDigits$kCFNumberFormatterZeroSymbol$kCFNumberNaN@^{__CFNumber=}$kCFNumberNegativeInfinity@^{__CFNumber=}$kCFNumberPositiveInfinity@^{__CFNumber=}$kCFPersianCalendar$kCFPreferencesAnyApplication$kCFPreferencesAnyHost$kCFPreferencesAnyUser$kCFPreferencesCurrentApplication$kCFPreferencesCurrentHost$kCFPreferencesCurrentUser$kCFRepublicOfChinaCalendar$kCFRunLoopCommonModes$kCFRunLoopDefaultMode$kCFSocketCommandKey$kCFSocketErrorKey$kCFSocketNameKey$kCFSocketRegisterCommand$kCFSocketResultKey$kCFSocketRetrieveCommand$kCFSocketValueKey$kCFStreamErrorDomainSOCKS@i$kCFStreamErrorDomainSSL@i$kCFStreamPropertyAppendToFile$kCFStreamPropertyDataWritten$kCFStreamPropertyFileCurrentOffset$kCFStreamPropertySOCKSPassword$kCFStreamPropertySOCKSProxy$kCFStreamPropertySOCKSProxyHost$kCFStreamPropertySOCKSProxyPort$kCFStreamPropertySOCKSUser$kCFStreamPropertySOCKSVersion$kCFStreamPropertyShouldCloseNativeSocket$kCFStreamPropertySocketNativeHandle$kCFStreamPropertySocketRemoteHostName$kCFStreamPropertySocketRemotePortNumber$kCFStreamPropertySocketSecurityLevel$kCFStreamSocketSOCKSVersion4$kCFStreamSocketSOCKSVersion5$kCFStreamSocketSecurityLevelNegotiatedSSL$kCFStreamSocketSecurityLevelNone$kCFStreamSocketSecurityLevelSSLv2$kCFStreamSocketSecurityLevelSSLv3$kCFStreamSocketSecurityLevelTLSv1$kCFStringTransformFullwidthHalfwidth$kCFStringTransformHiraganaKatakana$kCFStringTransformLatinArabic$kCFStringTransformLatinCyrillic$kCFStringTransformLatinGreek$kCFStringTransformLatinHangul$kCFStringTransformLatinHebrew$kCFStringTransformLatinHiragana$kCFStringTransformLatinKatakana$kCFStringTransformLatinThai$kCFStringTransformMandarinLatin$kCFStringTransformStripCombiningMarks$kCFStringTransformStripDiacritics$kCFStringTransformToLatin$kCFStringTransformToUnicodeName$kCFStringTransformToXMLHex$kCFTimeZoneSystemTimeZoneDidChangeNotification$kCFURLAddedToDirectoryDateKey$kCFURLApplicationIsScriptableKey$kCFURLAttributeModificationDateKey$kCFURLCanonicalPathKey$kCFURLContentAccessDateKey$kCFURLContentModificationDateKey$kCFURLCreationDateKey$kCFURLCustomIconKey$kCFURLDirectoryEntryCountKey$kCFURLDocumentIdentifierKey$kCFURLEffectiveIconKey$kCFURLFileAllocatedSizeKey$kCFURLFileContentIdentifierKey$kCFURLFileDirectoryContents$kCFURLFileExists$kCFURLFileIdentifierKey$kCFURLFileLastModificationTime$kCFURLFileLength$kCFURLFileOwnerID$kCFURLFilePOSIXMode$kCFURLFileProtectionComplete$kCFURLFileProtectionCompleteUnlessOpen$kCFURLFileProtectionCompleteUntilFirstUserAuthentication$kCFURLFileProtectionCompleteWhenUserInactive$kCFURLFileProtectionKey$kCFURLFileProtectionNone$kCFURLFileResourceIdentifierKey$kCFURLFileResourceTypeBlockSpecial$kCFURLFileResourceTypeCharacterSpecial$kCFURLFileResourceTypeDirectory$kCFURLFileResourceTypeKey$kCFURLFileResourceTypeNamedPipe$kCFURLFileResourceTypeRegular$kCFURLFileResourceTypeSocket$kCFURLFileResourceTypeSymbolicLink$kCFURLFileResourceTypeUnknown$kCFURLFileSecurityKey$kCFURLFileSizeKey$kCFURLGenerationIdentifierKey$kCFURLHTTPStatusCode$kCFURLHTTPStatusLine$kCFURLHasHiddenExtensionKey$kCFURLIsAliasFileKey$kCFURLIsApplicationKey$kCFURLIsDirectoryKey$kCFURLIsExcludedFromBackupKey$kCFURLIsExecutableKey$kCFURLIsHiddenKey$kCFURLIsMountTriggerKey$kCFURLIsPackageKey$kCFURLIsPurgeableKey$kCFURLIsReadableKey$kCFURLIsRegularFileKey$kCFURLIsSparseKey$kCFURLIsSymbolicLinkKey$kCFURLIsSystemImmutableKey$kCFURLIsUbiquitousItemKey$kCFURLIsUserImmutableKey$kCFURLIsVolumeKey$kCFURLIsWritableKey$kCFURLKeysOfUnsetValuesKey$kCFURLLabelColorKey$kCFURLLabelNumberKey$kCFURLLinkCountKey$kCFURLLocalizedLabelKey$kCFURLLocalizedNameKey$kCFURLLocalizedTypeDescriptionKey$kCFURLMayHaveExtendedAttributesKey$kCFURLMayShareFileContentKey$kCFURLNameKey$kCFURLParentDirectoryURLKey$kCFURLPathKey$kCFURLPreferredIOBlockSizeKey$kCFURLQuarantinePropertiesKey$kCFURLTagNamesKey$kCFURLTotalFileAllocatedSizeKey$kCFURLTotalFileSizeKey$kCFURLTypeIdentifierKey$kCFURLUbiquitousItemDownloadingErrorKey$kCFURLUbiquitousItemDownloadingStatusCurrent$kCFURLUbiquitousItemDownloadingStatusDownloaded$kCFURLUbiquitousItemDownloadingStatusKey$kCFURLUbiquitousItemDownloadingStatusNotDownloaded$kCFURLUbiquitousItemHasUnresolvedConflictsKey$kCFURLUbiquitousItemIsDownloadedKey$kCFURLUbiquitousItemIsDownloadingKey$kCFURLUbiquitousItemIsExcludedFromSyncKey$kCFURLUbiquitousItemIsUploadedKey$kCFURLUbiquitousItemIsUploadingKey$kCFURLUbiquitousItemPercentDownloadedKey$kCFURLUbiquitousItemPercentUploadedKey$kCFURLUbiquitousItemUploadingErrorKey$kCFURLVolumeAvailableCapacityForImportantUsageKey$kCFURLVolumeAvailableCapacityForOpportunisticUsageKey$kCFURLVolumeAvailableCapacityKey$kCFURLVolumeCreationDateKey$kCFURLVolumeIdentifierKey$kCFURLVolumeIsAutomountedKey$kCFURLVolumeIsBrowsableKey$kCFURLVolumeIsEjectableKey$kCFURLVolumeIsEncryptedKey$kCFURLVolumeIsInternalKey$kCFURLVolumeIsJournalingKey$kCFURLVolumeIsLocalKey$kCFURLVolumeIsReadOnlyKey$kCFURLVolumeIsRemovableKey$kCFURLVolumeIsRootFileSystemKey$kCFURLVolumeLocalizedFormatDescriptionKey$kCFURLVolumeLocalizedNameKey$kCFURLVolumeMaximumFileSizeKey$kCFURLVolumeMountFromLocationKey$kCFURLVolumeNameKey$kCFURLVolumeResourceCountKey$kCFURLVolumeSubtypeKey$kCFURLVolumeSupportsAccessPermissionsKey$kCFURLVolumeSupportsAdvisoryFileLockingKey$kCFURLVolumeSupportsCasePreservedNamesKey$kCFURLVolumeSupportsCaseSensitiveNamesKey$kCFURLVolumeSupportsCompressionKey$kCFURLVolumeSupportsExclusiveRenamingKey$kCFURLVolumeSupportsExtendedSecurityKey$kCFURLVolumeSupportsFileCloningKey$kCFURLVolumeSupportsFileProtectionKey$kCFURLVolumeSupportsHardLinksKey$kCFURLVolumeSupportsImmutableFilesKey$kCFURLVolumeSupportsJournalingKey$kCFURLVolumeSupportsPersistentIDsKey$kCFURLVolumeSupportsRenamingKey$kCFURLVolumeSupportsRootDirectoryDatesKey$kCFURLVolumeSupportsSparseFilesKey$kCFURLVolumeSupportsSwapRenamingKey$kCFURLVolumeSupportsSymbolicLinksKey$kCFURLVolumeSupportsVolumeSizesKey$kCFURLVolumeSupportsZeroRunsKey$kCFURLVolumeTotalCapacityKey$kCFURLVolumeTypeNameKey$kCFURLVolumeURLForRemountingKey$kCFURLVolumeURLKey$kCFURLVolumeUUIDStringKey$kCFUserNotificationAlertHeaderKey$kCFUserNotificationAlertMessageKey$kCFUserNotificationAlertTopMostKey$kCFUserNotificationAlternateButtonTitleKey$kCFUserNotificationCheckBoxTitlesKey$kCFUserNotificationDefaultButtonTitleKey$kCFUserNotificationIconURLKey$kCFUserNotificationKeyboardTypesKey$kCFUserNotificationLocalizationURLKey$kCFUserNotificationOtherButtonTitleKey$kCFUserNotificationPopUpSelectionKey$kCFUserNotificationPopUpTitlesKey$kCFUserNotificationProgressIndicatorValueKey$kCFUserNotificationSoundURLKey$kCFUserNotificationTextFieldTitlesKey$kCFUserNotificationTextFieldValuesKey$kCFXMLTreeErrorDescription$kCFXMLTreeErrorLineNumber$kCFXMLTreeErrorLocation$kCFXMLTreeErrorStatusCode$""" -enums = """$CFByteOrderBigEndian@2$CFByteOrderLittleEndian@1$CFByteOrderUnknown@0$CFNotificationSuspensionBehaviorCoalesce@2$CFNotificationSuspensionBehaviorDeliverImmediately@4$CFNotificationSuspensionBehaviorDrop@1$CFNotificationSuspensionBehaviorHold@3$CF_USE_OSBYTEORDER_H@1$CGFLOAT_DEFINED@1$CGFLOAT_IS_DOUBLE@1$CGRectMaxXEdge@2$CGRectMaxYEdge@3$CGRectMinXEdge@0$CGRectMinYEdge@1$CGVECTOR_DEFINED@1$COREFOUNDATION_CFPLUGINCOM_SEPARATE@1$FALSE@0$ISA_PTRAUTH_DISCRIMINATOR@27361$TRUE@1$kCFBookmarkResolutionWithoutMountingMask@512$kCFBookmarkResolutionWithoutUIMask@256$kCFBundleExecutableArchitectureARM64@16777228$kCFBundleExecutableArchitectureI386@7$kCFBundleExecutableArchitecturePPC@18$kCFBundleExecutableArchitecturePPC64@16777234$kCFBundleExecutableArchitectureX86_64@16777223$kCFCalendarComponentsWrap@1$kCFCalendarUnitDay@16$kCFCalendarUnitEra@2$kCFCalendarUnitHour@32$kCFCalendarUnitMinute@64$kCFCalendarUnitMonth@8$kCFCalendarUnitQuarter@2048$kCFCalendarUnitSecond@128$kCFCalendarUnitWeek@256$kCFCalendarUnitWeekOfMonth@4096$kCFCalendarUnitWeekOfYear@8192$kCFCalendarUnitWeekday@512$kCFCalendarUnitWeekdayOrdinal@1024$kCFCalendarUnitYear@4$kCFCalendarUnitYearForWeekOfYear@16384$kCFCharacterSetAlphaNumeric@10$kCFCharacterSetCapitalizedLetter@13$kCFCharacterSetControl@1$kCFCharacterSetDecimalDigit@4$kCFCharacterSetDecomposable@9$kCFCharacterSetIllegal@12$kCFCharacterSetLetter@5$kCFCharacterSetLowercaseLetter@6$kCFCharacterSetNewline@15$kCFCharacterSetNonBase@8$kCFCharacterSetPunctuation@11$kCFCharacterSetSymbol@14$kCFCharacterSetUppercaseLetter@7$kCFCharacterSetWhitespace@2$kCFCharacterSetWhitespaceAndNewline@3$kCFCompareAnchored@8$kCFCompareBackwards@4$kCFCompareCaseInsensitive@1$kCFCompareDiacriticInsensitive@128$kCFCompareEqualTo@0$kCFCompareForcedOrdering@512$kCFCompareGreaterThan@1$kCFCompareLessThan@-1$kCFCompareLocalized@32$kCFCompareNonliteral@16$kCFCompareNumerically@64$kCFCompareWidthInsensitive@256$kCFCoreFoundationVersionNumber10_10@1151.16$kCFCoreFoundationVersionNumber10_10_1@1151.16$kCFCoreFoundationVersionNumber10_10_2@1152$kCFCoreFoundationVersionNumber10_10_3@1153.18$kCFCoreFoundationVersionNumber10_10_4@1153.18$kCFCoreFoundationVersionNumber10_10_5@1153.18$kCFCoreFoundationVersionNumber10_10_Max@1199$kCFCoreFoundationVersionNumber10_11@1253$kCFCoreFoundationVersionNumber10_11_1@1255.1$kCFCoreFoundationVersionNumber10_11_2@1256.14$kCFCoreFoundationVersionNumber10_11_3@1256.14$kCFCoreFoundationVersionNumber10_11_4@1258.1$kCFCoreFoundationVersionNumber10_11_Max@1299$kCFDataSearchAnchored@2$kCFDataSearchBackwards@1$kCFDateFormatterFullStyle@4$kCFDateFormatterLongStyle@3$kCFDateFormatterMediumStyle@2$kCFDateFormatterNoStyle@0$kCFDateFormatterShortStyle@1$kCFFileDescriptorReadCallBack@1$kCFFileDescriptorWriteCallBack@2$kCFFileSecurityClearAccessControlList@32$kCFFileSecurityClearGroup@2$kCFFileSecurityClearGroupUUID@16$kCFFileSecurityClearMode@4$kCFFileSecurityClearOwner@1$kCFFileSecurityClearOwnerUUID@8$kCFGregorianAllUnits@16777215$kCFGregorianUnitsDays@4$kCFGregorianUnitsHours@8$kCFGregorianUnitsMinutes@16$kCFGregorianUnitsMonths@2$kCFGregorianUnitsSeconds@32$kCFGregorianUnitsYears@1$kCFISO8601DateFormatWithColonSeparatorInTime@512$kCFISO8601DateFormatWithColonSeparatorInTimeZone@1024$kCFISO8601DateFormatWithDashSeparatorInDate@256$kCFISO8601DateFormatWithDay@16$kCFISO8601DateFormatWithFractionalSeconds@2048$kCFISO8601DateFormatWithFullDate@275$kCFISO8601DateFormatWithFullTime@1632$kCFISO8601DateFormatWithInternetDateTime@1907$kCFISO8601DateFormatWithMonth@2$kCFISO8601DateFormatWithSpaceBetweenDateAndTime@128$kCFISO8601DateFormatWithTime@32$kCFISO8601DateFormatWithTimeZone@64$kCFISO8601DateFormatWithWeekOfYear@4$kCFISO8601DateFormatWithYear@1$kCFLocaleLanguageDirectionBottomToTop@4$kCFLocaleLanguageDirectionLeftToRight@1$kCFLocaleLanguageDirectionRightToLeft@2$kCFLocaleLanguageDirectionTopToBottom@3$kCFLocaleLanguageDirectionUnknown@0$kCFMessagePortBecameInvalidError@-5$kCFMessagePortIsInvalid@-3$kCFMessagePortReceiveTimeout@-2$kCFMessagePortSendTimeout@-1$kCFMessagePortSuccess@0$kCFMessagePortTransportError@-4$kCFNotFound@-1$kCFNotificationDeliverImmediately@1$kCFNotificationPostToAllSessions@2$kCFNumberCFIndexType@14$kCFNumberCGFloatType@16$kCFNumberCharType@7$kCFNumberDoubleType@13$kCFNumberFloat32Type@5$kCFNumberFloat64Type@6$kCFNumberFloatType@12$kCFNumberFormatterCurrencyAccountingStyle@10$kCFNumberFormatterCurrencyISOCodeStyle@8$kCFNumberFormatterCurrencyPluralStyle@9$kCFNumberFormatterCurrencyStyle@2$kCFNumberFormatterDecimalStyle@1$kCFNumberFormatterNoStyle@0$kCFNumberFormatterOrdinalStyle@6$kCFNumberFormatterPadAfterPrefix@1$kCFNumberFormatterPadAfterSuffix@3$kCFNumberFormatterPadBeforePrefix@0$kCFNumberFormatterPadBeforeSuffix@2$kCFNumberFormatterParseIntegersOnly@1$kCFNumberFormatterPercentStyle@3$kCFNumberFormatterRoundCeiling@0$kCFNumberFormatterRoundDown@2$kCFNumberFormatterRoundFloor@1$kCFNumberFormatterRoundHalfDown@5$kCFNumberFormatterRoundHalfEven@4$kCFNumberFormatterRoundHalfUp@6$kCFNumberFormatterRoundUp@3$kCFNumberFormatterScientificStyle@4$kCFNumberFormatterSpellOutStyle@5$kCFNumberIntType@9$kCFNumberLongLongType@11$kCFNumberLongType@10$kCFNumberMaxType@16$kCFNumberNSIntegerType@15$kCFNumberSInt16Type@2$kCFNumberSInt32Type@3$kCFNumberSInt64Type@4$kCFNumberSInt8Type@1$kCFNumberShortType@8$kCFPropertyListBinaryFormat_v1_0@200$kCFPropertyListImmutable@0$kCFPropertyListMutableContainers@1$kCFPropertyListMutableContainersAndLeaves@2$kCFPropertyListOpenStepFormat@1$kCFPropertyListReadCorruptError@3840$kCFPropertyListReadStreamError@3842$kCFPropertyListReadUnknownVersionError@3841$kCFPropertyListWriteStreamError@3851$kCFPropertyListXMLFormat_v1_0@100$kCFRunLoopAfterWaiting@64$kCFRunLoopAllActivities@268435455$kCFRunLoopBeforeSources@4$kCFRunLoopBeforeTimers@2$kCFRunLoopBeforeWaiting@32$kCFRunLoopEntry@1$kCFRunLoopExit@128$kCFRunLoopRunFinished@1$kCFRunLoopRunHandledSource@4$kCFRunLoopRunStopped@2$kCFRunLoopRunTimedOut@3$kCFSocketAcceptCallBack@2$kCFSocketAutomaticallyReenableAcceptCallBack@2$kCFSocketAutomaticallyReenableDataCallBack@3$kCFSocketAutomaticallyReenableReadCallBack@1$kCFSocketAutomaticallyReenableWriteCallBack@8$kCFSocketCloseOnInvalidate@128$kCFSocketConnectCallBack@4$kCFSocketDataCallBack@3$kCFSocketError@-1$kCFSocketLeaveErrors@64$kCFSocketNoCallBack@0$kCFSocketReadCallBack@1$kCFSocketSuccess@0$kCFSocketTimeout@-2$kCFSocketWriteCallBack@8$kCFStreamErrorDomainCustom@-1$kCFStreamErrorDomainMacOSStatus@2$kCFStreamErrorDomainPOSIX@1$kCFStreamEventCanAcceptBytes@4$kCFStreamEventEndEncountered@16$kCFStreamEventErrorOccurred@8$kCFStreamEventHasBytesAvailable@2$kCFStreamEventNone@0$kCFStreamEventOpenCompleted@1$kCFStreamStatusAtEnd@5$kCFStreamStatusClosed@6$kCFStreamStatusError@7$kCFStreamStatusNotOpen@0$kCFStreamStatusOpen@2$kCFStreamStatusOpening@1$kCFStreamStatusReading@3$kCFStreamStatusWriting@4$kCFStringEncodingANSEL@1537$kCFStringEncodingASCII@1536$kCFStringEncodingBig5@2563$kCFStringEncodingBig5_E@2569$kCFStringEncodingBig5_HKSCS_1999@2566$kCFStringEncodingCNS_11643_92_P1@1617$kCFStringEncodingCNS_11643_92_P2@1618$kCFStringEncodingCNS_11643_92_P3@1619$kCFStringEncodingDOSArabic@1049$kCFStringEncodingDOSBalticRim@1030$kCFStringEncodingDOSCanadianFrench@1048$kCFStringEncodingDOSChineseSimplif@1057$kCFStringEncodingDOSChineseTrad@1059$kCFStringEncodingDOSCyrillic@1043$kCFStringEncodingDOSGreek@1029$kCFStringEncodingDOSGreek1@1041$kCFStringEncodingDOSGreek2@1052$kCFStringEncodingDOSHebrew@1047$kCFStringEncodingDOSIcelandic@1046$kCFStringEncodingDOSJapanese@1056$kCFStringEncodingDOSKorean@1058$kCFStringEncodingDOSLatin1@1040$kCFStringEncodingDOSLatin2@1042$kCFStringEncodingDOSLatinUS@1024$kCFStringEncodingDOSNordic@1050$kCFStringEncodingDOSPortuguese@1045$kCFStringEncodingDOSRussian@1051$kCFStringEncodingDOSThai@1053$kCFStringEncodingDOSTurkish@1044$kCFStringEncodingEBCDIC_CP037@3074$kCFStringEncodingEBCDIC_US@3073$kCFStringEncodingEUC_CN@2352$kCFStringEncodingEUC_JP@2336$kCFStringEncodingEUC_KR@2368$kCFStringEncodingEUC_TW@2353$kCFStringEncodingGBK_95@1585$kCFStringEncodingGB_18030_2000@1586$kCFStringEncodingGB_2312_80@1584$kCFStringEncodingHZ_GB_2312@2565$kCFStringEncodingISOLatin1@513$kCFStringEncodingISOLatin10@528$kCFStringEncodingISOLatin2@514$kCFStringEncodingISOLatin3@515$kCFStringEncodingISOLatin4@516$kCFStringEncodingISOLatin5@521$kCFStringEncodingISOLatin6@522$kCFStringEncodingISOLatin7@525$kCFStringEncodingISOLatin8@526$kCFStringEncodingISOLatin9@527$kCFStringEncodingISOLatinArabic@518$kCFStringEncodingISOLatinCyrillic@517$kCFStringEncodingISOLatinGreek@519$kCFStringEncodingISOLatinHebrew@520$kCFStringEncodingISOLatinThai@523$kCFStringEncodingISO_2022_CN@2096$kCFStringEncodingISO_2022_CN_EXT@2097$kCFStringEncodingISO_2022_JP@2080$kCFStringEncodingISO_2022_JP_1@2082$kCFStringEncodingISO_2022_JP_2@2081$kCFStringEncodingISO_2022_JP_3@2083$kCFStringEncodingISO_2022_KR@2112$kCFStringEncodingInvalidId@4294967295$kCFStringEncodingJIS_C6226_78@1572$kCFStringEncodingJIS_X0201_76@1568$kCFStringEncodingJIS_X0208_83@1569$kCFStringEncodingJIS_X0208_90@1570$kCFStringEncodingJIS_X0212_90@1571$kCFStringEncodingKOI8_R@2562$kCFStringEncodingKOI8_U@2568$kCFStringEncodingKSC_5601_87@1600$kCFStringEncodingKSC_5601_92_Johab@1601$kCFStringEncodingMacArabic@4$kCFStringEncodingMacArmenian@24$kCFStringEncodingMacBengali@13$kCFStringEncodingMacBurmese@19$kCFStringEncodingMacCeltic@39$kCFStringEncodingMacCentralEurRoman@29$kCFStringEncodingMacChineseSimp@25$kCFStringEncodingMacChineseTrad@2$kCFStringEncodingMacCroatian@36$kCFStringEncodingMacCyrillic@7$kCFStringEncodingMacDevanagari@9$kCFStringEncodingMacDingbats@34$kCFStringEncodingMacEthiopic@28$kCFStringEncodingMacExtArabic@31$kCFStringEncodingMacFarsi@140$kCFStringEncodingMacGaelic@40$kCFStringEncodingMacGeorgian@23$kCFStringEncodingMacGreek@6$kCFStringEncodingMacGujarati@11$kCFStringEncodingMacGurmukhi@10$kCFStringEncodingMacHFS@255$kCFStringEncodingMacHebrew@5$kCFStringEncodingMacIcelandic@37$kCFStringEncodingMacInuit@236$kCFStringEncodingMacJapanese@1$kCFStringEncodingMacKannada@16$kCFStringEncodingMacKhmer@20$kCFStringEncodingMacKorean@3$kCFStringEncodingMacLaotian@22$kCFStringEncodingMacMalayalam@17$kCFStringEncodingMacMongolian@27$kCFStringEncodingMacOriya@12$kCFStringEncodingMacRoman@0$kCFStringEncodingMacRomanLatin1@2564$kCFStringEncodingMacRomanian@38$kCFStringEncodingMacSinhalese@18$kCFStringEncodingMacSymbol@33$kCFStringEncodingMacTamil@14$kCFStringEncodingMacTelugu@15$kCFStringEncodingMacThai@21$kCFStringEncodingMacTibetan@26$kCFStringEncodingMacTurkish@35$kCFStringEncodingMacUkrainian@152$kCFStringEncodingMacVT100@252$kCFStringEncodingMacVietnamese@30$kCFStringEncodingNextStepJapanese@2818$kCFStringEncodingNextStepLatin@2817$kCFStringEncodingNonLossyASCII@3071$kCFStringEncodingShiftJIS@2561$kCFStringEncodingShiftJIS_X0213@1576$kCFStringEncodingShiftJIS_X0213_00@1576$kCFStringEncodingShiftJIS_X0213_MenKuTen@1577$kCFStringEncodingUTF16@256$kCFStringEncodingUTF16BE@268435712$kCFStringEncodingUTF16LE@335544576$kCFStringEncodingUTF32@201326848$kCFStringEncodingUTF32BE@402653440$kCFStringEncodingUTF32LE@469762304$kCFStringEncodingUTF7@67109120$kCFStringEncodingUTF7_IMAP@2576$kCFStringEncodingUTF8@134217984$kCFStringEncodingUnicode@256$kCFStringEncodingVISCII@2567$kCFStringEncodingWindowsArabic@1286$kCFStringEncodingWindowsBalticRim@1287$kCFStringEncodingWindowsCyrillic@1282$kCFStringEncodingWindowsGreek@1283$kCFStringEncodingWindowsHebrew@1285$kCFStringEncodingWindowsKoreanJohab@1296$kCFStringEncodingWindowsLatin1@1280$kCFStringEncodingWindowsLatin2@1281$kCFStringEncodingWindowsLatin5@1284$kCFStringEncodingWindowsVietnamese@1288$kCFStringNormalizationFormC@2$kCFStringNormalizationFormD@0$kCFStringNormalizationFormKC@3$kCFStringNormalizationFormKD@1$kCFStringTokenizerAttributeLanguage@131072$kCFStringTokenizerAttributeLatinTranscription@65536$kCFStringTokenizerTokenHasDerivedSubTokensMask@4$kCFStringTokenizerTokenHasHasNumbersMask@8$kCFStringTokenizerTokenHasNonLettersMask@16$kCFStringTokenizerTokenHasSubTokensMask@2$kCFStringTokenizerTokenIsCJWordMask@32$kCFStringTokenizerTokenNone@0$kCFStringTokenizerTokenNormal@1$kCFStringTokenizerUnitLineBreak@3$kCFStringTokenizerUnitParagraph@2$kCFStringTokenizerUnitSentence@1$kCFStringTokenizerUnitWord@0$kCFStringTokenizerUnitWordBoundary@4$kCFTimeZoneNameStyleDaylightSaving@2$kCFTimeZoneNameStyleGeneric@4$kCFTimeZoneNameStyleShortDaylightSaving@3$kCFTimeZoneNameStyleShortGeneric@5$kCFTimeZoneNameStyleShortStandard@1$kCFTimeZoneNameStyleStandard@0$kCFURLBookmarkCreationMinimalBookmarkMask@512$kCFURLBookmarkCreationPreferFileIDResolutionMask@256$kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess@4096$kCFURLBookmarkCreationSuitableForBookmarkFile@1024$kCFURLBookmarkCreationWithSecurityScope@2048$kCFURLBookmarkCreationWithoutImplicitSecurityScope@536870912$kCFURLBookmarkResolutionWithSecurityScope@1024$kCFURLBookmarkResolutionWithoutImplicitStartAccessing@32768$kCFURLBookmarkResolutionWithoutMountingMask@512$kCFURLBookmarkResolutionWithoutUIMask@256$kCFURLComponentFragment@12$kCFURLComponentHost@8$kCFURLComponentNetLocation@2$kCFURLComponentParameterString@10$kCFURLComponentPassword@6$kCFURLComponentPath@3$kCFURLComponentPort@9$kCFURLComponentQuery@11$kCFURLComponentResourceSpecifier@4$kCFURLComponentScheme@1$kCFURLComponentUser@5$kCFURLComponentUserInfo@7$kCFURLEnumeratorDefaultBehavior@0$kCFURLEnumeratorDescendRecursively@1$kCFURLEnumeratorDirectoryPostOrderSuccess@4$kCFURLEnumeratorEnd@2$kCFURLEnumeratorError@3$kCFURLEnumeratorGenerateFileReferenceURLs@4$kCFURLEnumeratorGenerateRelativePathURLs@64$kCFURLEnumeratorIncludeDirectoriesPostOrder@32$kCFURLEnumeratorIncludeDirectoriesPreOrder@16$kCFURLEnumeratorSkipInvisibles@2$kCFURLEnumeratorSkipPackageContents@8$kCFURLEnumeratorSuccess@1$kCFURLHFSPathStyle@1$kCFURLImproperArgumentsError@-15$kCFURLPOSIXPathStyle@0$kCFURLPropertyKeyUnavailableError@-17$kCFURLRemoteHostUnavailableError@-14$kCFURLResourceAccessViolationError@-13$kCFURLResourceNotFoundError@-12$kCFURLTimeoutError@-18$kCFURLUnknownError@-10$kCFURLUnknownPropertyKeyError@-16$kCFURLUnknownSchemeError@-11$kCFURLWindowsPathStyle@2$kCFUserNotificationAlternateResponse@1$kCFUserNotificationCancelResponse@3$kCFUserNotificationCautionAlertLevel@2$kCFUserNotificationDefaultResponse@0$kCFUserNotificationNoDefaultButtonFlag@32$kCFUserNotificationNoteAlertLevel@1$kCFUserNotificationOtherResponse@2$kCFUserNotificationPlainAlertLevel@3$kCFUserNotificationStopAlertLevel@0$kCFUserNotificationUseRadioButtonsFlag@64$kCFXMLEntityTypeCharacter@4$kCFXMLEntityTypeParameter@0$kCFXMLEntityTypeParsedExternal@2$kCFXMLEntityTypeParsedInternal@1$kCFXMLEntityTypeUnparsed@3$kCFXMLErrorElementlessDocument@11$kCFXMLErrorEncodingConversionFailure@3$kCFXMLErrorMalformedCDSect@7$kCFXMLErrorMalformedCharacterReference@13$kCFXMLErrorMalformedCloseTag@8$kCFXMLErrorMalformedComment@12$kCFXMLErrorMalformedDTD@5$kCFXMLErrorMalformedDocument@10$kCFXMLErrorMalformedName@6$kCFXMLErrorMalformedParsedCharacterData@14$kCFXMLErrorMalformedProcessingInstruction@4$kCFXMLErrorMalformedStartTag@9$kCFXMLErrorNoData@15$kCFXMLErrorUnexpectedEOF@1$kCFXMLErrorUnknownEncoding@2$kCFXMLNodeCurrentVersion@1$kCFXMLNodeTypeAttribute@3$kCFXMLNodeTypeAttributeListDeclaration@15$kCFXMLNodeTypeCDATASection@7$kCFXMLNodeTypeComment@5$kCFXMLNodeTypeDocument@1$kCFXMLNodeTypeDocumentFragment@8$kCFXMLNodeTypeDocumentType@11$kCFXMLNodeTypeElement@2$kCFXMLNodeTypeElementTypeDeclaration@14$kCFXMLNodeTypeEntity@9$kCFXMLNodeTypeEntityReference@10$kCFXMLNodeTypeNotation@13$kCFXMLNodeTypeProcessingInstruction@4$kCFXMLNodeTypeText@6$kCFXMLNodeTypeWhitespace@12$kCFXMLParserAddImpliedAttributes@32$kCFXMLParserAllOptions@16777215$kCFXMLParserNoOptions@0$kCFXMLParserReplacePhysicalEntities@4$kCFXMLParserResolveExternalEntities@16$kCFXMLParserSkipMetaData@2$kCFXMLParserSkipWhitespace@8$kCFXMLParserValidateDocument@1$kCFXMLStatusParseInProgress@-1$kCFXMLStatusParseNotBegun@-2$kCFXMLStatusParseSuccessful@0$""" -misc.update( - { - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:121:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:121:1)", - int, - ), - "CFCharacterSetPredefinedSet": NewType("CFCharacterSetPredefinedSet", int), - "CFStringTokenizerTokenType": NewType("CFStringTokenizerTokenType", int), - "CFComparisonResult": NewType("CFComparisonResult", int), - "CFStringCompareFlags": NewType("CFStringCompareFlags", int), - "CFPropertyListMutabilityOptions": NewType( - "CFPropertyListMutabilityOptions", int - ), - "CFNotificationSuspensionBehavior": NewType( - "CFNotificationSuspensionBehavior", int - ), - "CFURLComponentType": NewType("CFURLComponentType", int), - "CFStreamStatus": NewType("CFStreamStatus", int), - "CFFileSecurityClearOptions": NewType("CFFileSecurityClearOptions", int), - "CFNumberFormatterStyle": NewType("CFNumberFormatterStyle", int), - "CFStringNormalizationForm": NewType("CFStringNormalizationForm", int), - "CFXMLParserOptions": NewType("CFXMLParserOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:121:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:121:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:114:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:114:1)", - int, - ), - "CFRunLoopRunResult": NewType("CFRunLoopRunResult", int), - "CFURLBookmarkCreationOptions": NewType("CFURLBookmarkCreationOptions", int), - "__CFByteOrder": NewType("__CFByteOrder", int), - "CFStreamEventType": NewType("CFStreamEventType", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:107:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:107:1)", - int, - ), - "CFDateFormatterStyle": NewType("CFDateFormatterStyle", int), - "CFSocketError": NewType("CFSocketError", int), - "CFXMLNodeTypeCode": NewType("CFXMLNodeTypeCode", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSocket.h:123:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSocket.h:123:1)", - int, - ), - "CFXMLParserStatusCode": NewType("CFXMLParserStatusCode", int), - "CFRunLoopActivity": NewType("CFRunLoopActivity", int), - "CFNumberFormatterRoundingMode": NewType("CFNumberFormatterRoundingMode", int), - "CFURLBookmarkResolutionOptions": NewType( - "CFURLBookmarkResolutionOptions", int - ), - "CFDataSearchFlags": NewType("CFDataSearchFlags", int), - "CFISO8601DateFormatOptions": NewType("CFISO8601DateFormatOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFFileDescriptor.h:18:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFFileDescriptor.h:18:1)", - int, - ), - "CFNumberFormatterOptionFlags": NewType("CFNumberFormatterOptionFlags", int), - "CFStreamErrorDomain": NewType("CFStreamErrorDomain", int), - "CFTimeZoneNameStyle": NewType("CFTimeZoneNameStyle", int), - "CFSocketCallBackType": NewType("CFSocketCallBackType", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFXMLNode.h:30:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFXMLNode.h:30:1)", - int, - ), - "CFURLEnumeratorOptions": NewType("CFURLEnumeratorOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h:70:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h:70:1)", - int, - ), - "CFXMLEntityTypeCode": NewType("CFXMLEntityTypeCode", int), - "CFStringBuiltInEncodings": NewType("CFStringBuiltInEncodings", int), - "CFCalendarUnit": NewType("CFCalendarUnit", int), - "CFLocaleLanguageDirection": NewType("CFLocaleLanguageDirection", int), - "CFNumberType": NewType("CFNumberType", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBundle.h:244:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBundle.h:244:1)", - int, - ), - "CFURLPathStyle": NewType("CFURLPathStyle", int), - "CFURLEnumeratorResult": NewType("CFURLEnumeratorResult", int), - "CFGregorianUnitFlags": NewType("CFGregorianUnitFlags", int), - "CFURLError": NewType("CFURLError", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFMessagePort.h:23:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFMessagePort.h:23:1)", - int, - ), - "CFStringEncodings": NewType("CFStringEncodings", int), - "CFNumberFormatterPadPosition": NewType("CFNumberFormatterPadPosition", int), - "CGRectEdge": NewType("CGRectEdge", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h:102:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h:102:1)", - int, - ), - "CFPropertyListFormat": NewType("CFPropertyListFormat", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStringTokenizer.h:65:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStringTokenizer.h:65:1)", - int, - ), - } -) -misc.update({}) -misc.update( - { - "kCFCoreFoundationVersionNumber10_7_1": 635.0, - "kCFCoreFoundationVersionNumber10_4_4_Intel": 368.26, - "kCFCoreFoundationVersionNumber10_11_4": 1258.1, - "kCFCoreFoundationVersionNumber10_11_3": 1256.14, - "kCFCoreFoundationVersionNumber10_11_2": 1256.14, - "kCFCoreFoundationVersionNumber10_11_1": 1255.1, - "kCFCoreFoundationVersionNumber10_10_4": 1153.18, - "kCFCoreFoundationVersionNumber10_10_5": 1153.18, - "kCFCoreFoundationVersionNumber10_10_3": 1153.18, - "kCFCoreFoundationVersionNumber10_10_1": 1151.16, - "kCFCoreFoundationVersionNumber10_8_2": 744.12, - "kCFCoreFoundationVersionNumber10_8_3": 744.18, - "kCFCoreFoundationVersionNumber10_8_1": 744.0, - "kCFCoreFoundationVersionNumber10_5_1": 476.0, - "kCFCoreFoundationVersionNumber10_8_4": 744.19, - "kCFCoreFoundationVersionNumber10_9_2": 855.14, - "kCFCoreFoundationVersionNumber10_9_1": 855.11, - "kCFCoreFoundationVersionNumber10_4_7": 368.27, - "kCFCoreFoundationVersionNumber10_4_2": 368.11, - "kCFCoreFoundationVersionNumber10_4_3": 368.18, - "kCFCoreFoundationVersionNumber10_4_1": 368.1, - "kCFCoreFoundationVersionNumber10_5_7": 476.18, - "kCFCoreFoundationVersionNumber10_5_6": 476.17, - "kCFCoreFoundationVersionNumber10_5_5": 476.15, - "kCFCoreFoundationVersionNumber10_5_4": 476.14, - "kCFCoreFoundationVersionNumber10_5_3": 476.13, - "kCFCoreFoundationVersionNumber10_5_2": 476.1, - "kCFCoreFoundationVersionNumber10_4_8": 368.27, - "kCFCoreFoundationVersionNumber10_4_9": 368.28, - "kCFCoreFoundationVersionNumber10_2_4": 263.3, - "kCFCoreFoundationVersionNumber10_2_5": 263.5, - "kCFCoreFoundationVersionNumber10_2_6": 263.5, - "kCFCoreFoundationVersionNumber10_2_7": 263.5, - "kCFCoreFoundationVersionNumber10_3_9": 299.35, - "kCFCoreFoundationVersionNumber10_2_1": 263.1, - "kCFCoreFoundationVersionNumber10_2_2": 263.1, - "kCFCoreFoundationVersionNumber10_2_3": 263.3, - "kCFCoreFoundationVersionNumber10_3_5": 299.31, - "kCFCoreFoundationVersionNumber10_3_4": 299.31, - "kCFCoreFoundationVersionNumber10_3_7": 299.33, - "kCFCoreFoundationVersionNumber10_3_6": 299.32, - "kCFCoreFoundationVersionNumber10_3_1": 299.0, - "kCFCoreFoundationVersionNumber10_3_3": 299.3, - "kCFCoreFoundationVersionNumber10_3_2": 299.0, - "kCFCoreFoundationVersionNumber10_1_3": 227.2, - "kCFCoreFoundationVersionNumber10_1_2": 227.2, - "kCFCoreFoundationVersionNumber10_1_1": 226.0, - "kCFCoreFoundationVersionNumber10_1_4": 227.3, - "kCFCoreFoundationVersionNumber10_4_6_PowerPC": 368.25, - "kCFCoreFoundationVersionNumber10_6_2": 550.13, - "kCFCoreFoundationVersionNumber10_6_3": 550.19, - "kCFCoreFoundationVersionNumber10_6_4": 550.29, - "kCFCoreFoundationVersionNumber10_6_5": 550.42, - "kCFCoreFoundationVersionNumber10_6_6": 550.42, - "kCFCoreFoundationVersionNumber10_4_4_PowerPC": 368.25, - "kCFCoreFoundationVersionNumber10_6_8": 550.43, - "kCFCoreFoundationVersionNumber10_0_3": 196.5, - "kCFCoreFoundationVersionNumber10_7_3": 635.19, - "kCFCoreFoundationVersionNumber10_7_2": 635.15, - "kCFCoreFoundationVersionNumber10_4_10": 368.28, - "kCFCoreFoundationVersionNumber10_7_4": 635.21, - "kCFCoreFoundationVersionNumber10_4_5_PowerPC": 368.25, - "kCFCoreFoundationVersionNumber10_3_8": 299.33, - "kCFCoreFoundationVersionNumber10_10": 1151.16, - "kCFCoreFoundationVersionNumber10_4_5_Intel": 368.26, - "kCFCoreFoundationVersionNumber10_2_8": 263.5, - "kCFCoreFoundationVersionNumber10_5_8": 476.19, - "kCFCoreFoundationVersionNumber10_4_11": 368.31, - "kCFCoreFoundationVersionNumber10_6_1": 550.0, - "kCFCoreFoundationVersionNumber10_6_7": 550.42, - "kCFCoreFoundationVersionNumber10_8": 744.0, - "kCFCoreFoundationVersionNumber10_5": 476.0, - "kCFCoreFoundationVersionNumber10_4": 368.0, - "kCFCoreFoundationVersionNumber10_7": 635.0, - "kCFCoreFoundationVersionNumber10_6": 550.0, - "kCFCoreFoundationVersionNumber10_1": 226.0, - "kCFCoreFoundationVersionNumber10_0": 196.4, - "kCFCoreFoundationVersionNumber10_3": 299.0, - "kCFCoreFoundationVersionNumber10_2": 263.0, - "kCFCoreFoundationVersionNumber10_7_5": 635.21, - "kCFCoreFoundationVersionNumber10_9": 855.11, - "kCFCoreFoundationVersionNumber10_4_6_Intel": 368.26, - } -) -functions = { - "CFURLCreateByResolvingBookmarkData": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFData=}Q^{__CFURL=}^{__CFArray=}^Z^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 5: {"type_modifier": "o"}, - 6: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - }, - }, - }, - ), - "CFConvertDoubleSwappedToHost": (b"d{CFSwappedFloat64=Q}",), - "CFURLCreateCopyAppendingPathComponent": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFURL=}^{__CFString=}Z", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRangeMake": (b"{CFRange=qq}qq",), - "CFBitVectorGetCount": (b"q^{__CFBitVector=}",), - "CFDictionaryContainsKey": (b"Z^{__CFDictionary=}@",), - "CFPreferencesCopyValue": ( - b"@^{__CFString=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFGetAllocator": (b"^{__CFAllocator=}@",), - "CFSetCreateMutable": ( - b"^{__CFSet=}^{__CFAllocator=}q^{CFSetCallBacks=q^?^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFErrorGetCode": (b"q^{__CFError=}",), - "CFStringGetFileSystemRepresentation": ( - b"Z^{__CFString=}^tq", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "o"}}}, - ), - "CFLocaleGetTypeID": (b"Q",), - "CFUUIDGetUUIDBytes": (b"{CFUUIDBytes=CCCCCCCCCCCCCCCC}^{__CFUUID=}",), - "CFDateFormatterCreateDateFormatFromTemplate": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}Q^{__CFLocale=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFTreeInsertSibling": (b"v^{__CFTree=}^{__CFTree=}",), - "CFSocketConnectToAddress": (b"q^{__CFSocket=}^{__CFData=}d",), - "CFWriteStreamScheduleWithRunLoop": ( - b"v^{__CFWriteStream=}^{__CFRunLoop=}^{__CFString=}", - ), - "CFDateFormatterCreateStringWithAbsoluteTime": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFDateFormatter=}d", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFReadStreamScheduleWithRunLoop": ( - b"v^{__CFReadStream=}^{__CFRunLoop=}^{__CFString=}", - ), - "CFArrayAppendValue": (b"v^{__CFArray=}@",), - "CFSetRemoveValue": (b"v^{__CFSet=}@",), - "CFBundleCopyPrivateFrameworksURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorCreateMutable": ( - b"^{__CFBitVector=}^{__CFAllocator=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFLocaleCreateCanonicalLocaleIdentifierFromString": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringTokenizerCopyBestStringLanguage": ( - b"^{__CFString=}^{__CFString=}{CFRange=qq}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFUUIDCreate": ( - b"^{__CFUUID=}^{__CFAllocator=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCalendarGetRangeOfUnit": (b"{CFRange=qq}^{__CFCalendar=}QQd",), - "CFStringFindWithOptionsAndLocale": ( - b"Z^{__CFString=}^{__CFString=}{CFRange=qq}Q^{__CFLocale=}^{CFRange=qq}", - "", - {"arguments": {5: {"type_modifier": "o"}}}, - ), - "CFURLSetResourcePropertyForKey": ( - b"Z^{__CFURL=}^{__CFString=}@^^{__CFError=}", - "", - { - "arguments": { - 3: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CFFileSecurityCopyOwnerUUID": ( - b"Z^{__CFFileSecurity=}^^{__CFUUID=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "o"}}, - }, - ), - "CFCalendarAddComponents": (b"Z^{__CFCalendar=}^dQ^c", "", {"variadic": True}), - "CFLocaleCopyCommonISOCurrencyCodes": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCalendarGetOrdinalityOfUnit": (b"q^{__CFCalendar=}QQd",), - "CFPreferencesRemoveSuitePreferencesFromApp": (b"v^{__CFString=}^{__CFString=}",), - "CFCalendarGetMinimumDaysInFirstWeek": (b"q^{__CFCalendar=}",), - "CFURLCreateWithFileSystemPathRelativeToBase": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFString=}qZ^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBinaryHeapGetCountOfValue": (b"q^{__CFBinaryHeap=}@",), - "CFStringIsSurrogateLowCharacter": (b"ZT",), - "CFStringTrim": (b"v^{__CFString=}^{__CFString=}",), - "CFXMLNodeGetTypeID": (b"Q",), - "CFStringSetExternalCharactersNoCopy": ( - b"v^{__CFString=}^Tqq", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 3, "type_modifier": "n"}}, - }, - ), - "CFLocaleGetSystem": (b"^{__CFLocale=}",), - "CFDataGetLength": (b"q^{__CFData=}",), - "CFWriteStreamWrite": ( - b"q^{__CFWriteStream=}^vq", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CFBundleGetVersionNumber": (b"I^{__CFBundle=}",), - "CFGetRetainCount": (b"q@",), - "CFRunLoopObserverGetContext": ( - b"v^{__CFRunLoopObserver=}^{CFRunLoopObserverContext=q^v^?^?^?}", - ), - "CFDataCreateWithBytesNoCopy": ( - b"^{__CFData=}^{__CFAllocator=}^vq^{__CFAllocator=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFURLEnumeratorGetNextURL": ( - b"q^{__CFURLEnumerator=}^^{__CFURL=}^^{__CFError=}", - "", - { - "arguments": { - 1: {"type_modifier": "o"}, - 2: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - }, - } - }, - ), - "CFRunLoopTimerGetTypeID": (b"Q",), - "CFStringConvertNSStringEncodingToEncoding": (b"IQ",), - "CFURLCreateBookmarkDataFromFile": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFURL=}^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - }, - }, - ), - "CFBundleCopyResourceURLForLocalization": ( - b"^{__CFURL=}^{__CFBundle=}^{__CFString=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetMaximumSizeForEncoding": (b"qqI",), - "CFStringTransform": ( - b"Z^{__CFString=}^{CFRange=qq}^{__CFString=}Z", - "", - {"arguments": {1: {"type_modifier": "N"}}}, - ), - "CFURLStopAccessingSecurityScopedResource": (b"v^{__CFURL=}",), - "CFDataCreateMutableCopy": ( - b"^{__CFData=}^{__CFAllocator=}q^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFMachPortGetContext": (b"v^{__CFMachPort=}^{CFMachPortContext=q^v^?^?^?}",), - "CFDateFormatterGetDateStyle": (b"q^{__CFDateFormatter=}",), - "CFStringGetHyphenationLocationBeforeIndex": ( - b"q^{__CFString=}q{CFRange=qq}Q^{__CFLocale=}^I", - "", - {"arguments": {5: {"type_modifier": "o"}}}, - ), - "CFRunLoopIsWaiting": (b"Z^{__CFRunLoop=}",), - "CFAttributedStringReplaceString": ( - b"v^{__CFAttributedString=}{CFRange=qq}^{__CFString=}", - ), - "CFSocketCreateWithNative": ( - b"^{__CFSocket=}^{__CFAllocator=}iQ^?^{CFSocketContext=q^v^?^?^?}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFSocket=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^{__CFData=}"}, - 3: {"type": b"^v"}, - 4: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFMessagePortCreateLocal": ( - b"^{__CFMessagePort=}^{__CFAllocator=}^{__CFString=}^?^{CFMessagePortContext=q^v^?^?^?}^Z", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"^{__CFData=}", "already_cfretained": True}, - "arguments": { - 0: {"type": b"^{__CFMessagePort=}"}, - 1: {"type": b"i"}, - 2: {"type": b"^{__CFData=}"}, - 3: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFTimeZoneCopyDefault": ( - b"^{__CFTimeZone=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFArrayGetValueAtIndex": (b"@^{__CFArray=}q",), - "CFErrorCopyFailureReason": ( - b"^{__CFString=}^{__CFError=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBinaryHeapContainsValue": (b"Z^{__CFBinaryHeap=}@",), - "CFNumberFormatterGetStyle": (b"q^{__CFNumberFormatter=}",), - "CFLocaleCopyPreferredLanguages": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBagCreateCopy": ( - b"^{__CFBag=}^{__CFAllocator=}^{__CFBag=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFNotificationCenterGetDistributedCenter": (b"^{__CFNotificationCenter=}",), - "CFXMLTreeGetNode": (b"^{__CFXMLNode=}^{__CFTree=}",), - "CFDateCreate": ( - b"^{__CFDate=}^{__CFAllocator=}d", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFErrorCopyDescription": ( - b"^{__CFString=}^{__CFError=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetGetTypeID": (b"Q",), - "CFWriteStreamCopyProperty": ( - b"@^{__CFWriteStream=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAttributedStringGetLength": (b"q^{__CFAttributedString=}",), - "CFStringGetCStringPtr": ( - b"^t@I", - "", - {"retval": {"c_array_delimited_by_null": True}}, - ), - "CFFileDescriptorEnableCallBacks": (b"v^{__CFFileDescriptor=}Q",), - "CFURLGetString": (b"^{__CFString=}^{__CFURL=}",), - "CFReadStreamSetProperty": (b"Z^{__CFReadStream=}^{__CFString=}@",), - "CFFileDescriptorInvalidate": (b"v^{__CFFileDescriptor=}",), - "CFBagGetCountOfValue": (b"q^{__CFBag=}@",), - "CFAbsoluteTimeGetCurrent": (b"d",), - "CFLocaleCopyISOCurrencyCodes": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCalendarGetTypeID": (b"Q",), - "CFBundleCopySharedFrameworksURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAttributedStringCreateWithSubstring": ( - b"^{__CFAttributedString=}^{__CFAllocator=}^{__CFAttributedString=}{CFRange=qq}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringAppend": (b"v^{__CFString=}^{__CFString=}",), - "CFRelease": (b"v@",), - "CFAllocatorGetDefault": (b"^{__CFAllocator=}",), - "CFStringTokenizerAdvanceToNextToken": (b"Q^{__CFStringTokenizer=}",), - "CFAttributedStringGetAttributeAndLongestEffectiveRange": ( - b"@^{__CFAttributedString=}q^{__CFString=}{CFRange=qq}^{CFRange=qq}", - "", - {"arguments": {4: {"type_modifier": "o"}}}, - ), - "CFFileDescriptorGetContext": ( - b"v^{__CFFileDescriptor=}^{CFFileDescriptorContext=q^v^?^?^?}", - ), - "CFUserNotificationPopUpSelection": (b"Qq",), - "CFStringConvertIANACharSetNameToEncoding": (b"I^{__CFString=}",), - "CFDateFormatterGetTimeStyle": (b"q^{__CFDateFormatter=}",), - "CFSocketSetSocketFlags": (b"v^{__CFSocket=}Q",), - "CFXMLCreateStringByUnescapingEntities": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateWithSubstring": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}{CFRange=qq}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFWriteStreamSetDispatchQueue": (b"v^{__CFWriteStream=}@",), - "CFStringCreateMutableCopy": ( - b"^{__CFString=}^{__CFAllocator=}q^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleCopyExecutableArchitectures": ( - b"^{__CFArray=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDictionaryCreateCopy": ( - b"^{__CFDictionary=}^{__CFAllocator=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopPerformBlock": ( - b"v^{__CFRunLoop=}@@?", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - }, - "block": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"v"}}, - }, - } - } - }, - ), - "CFStringPad": (b"v^{__CFString=}^{__CFString=}qq",), - "CFLocaleGetValue": (b"@^{__CFLocale=}^{__CFString=}",), - "CFLocaleCopyISOLanguageCodes": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFSocketSendData": (b"q^{__CFSocket=}^{__CFData=}^{__CFData=}d",), - "CFDataIncreaseLength": (b"v^{__CFData=}q",), - "CFBagGetValueIfPresent": ( - b"Z^{__CFBag=}@^@", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFBooleanGetTypeID": (b"Q",), - "CFBundleCopyAuxiliaryExecutableURL": ( - b"^{__CFURL=}^{__CFBundle=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLEnumeratorCreateForMountedVolumes": ( - b"^{__CFURLEnumerator=}^{__CFAllocator=}Q^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFFileSecurityGetMode": ( - b"Z^{__CFFileSecurity=}^S", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CFReadStreamSetClient": ( - b"Z^{__CFReadStream=}Q^?^{CFStreamClientContext=q^v^?^?^?}", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFReadStream=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CFStringConvertEncodingToWindowsCodepage": (b"II",), - "CFMachPortGetInvalidationCallBack": (b"^?^{__CFMachPort=}",), - "CFURLCopyFileSystemPath": ( - b"^{__CFString=}^{__CFURL=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopSourceSignal": (b"v^{__CFRunLoopSource=}",), - "CFBundleCopyInfoDictionaryInDirectory": ( - b"^{__CFDictionary=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFUserNotificationDisplayAlert": ( - b"idQ^{__CFURL=}^{__CFURL=}^{__CFURL=}^{__CFString=}^{__CFString=}^{__CFString=}^{__CFString=}^{__CFString=}^Q", - "", - {"arguments": {10: {"type_modifier": "o"}}}, - ), - "CFURLClearResourcePropertyCacheForKey": (b"v^{__CFURL=}^{__CFString=}",), - "CFBinaryHeapGetMinimum": (b"@^{__CFBinaryHeap=}",), - "CFNotificationCenterAddObserver": ( - b"v^{__CFNotificationCenter=}@^?@@q", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - }, - } - } - } - }, - ), - "CFCalendarCopyTimeZone": ( - b"^{__CFTimeZone=}^{__CFCalendar=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAttributedStringGetTypeID": (b"Q",), - "CFPropertyListWriteToStream": ( - b"q@^{__CFWriteStream=}q^^{__CFString=}", - "", - {"arguments": {3: {"type_modifier": "o"}}}, - ), - "CFBagAddValue": (b"v^{__CFBag=}@",), - "CFCharacterSetCreateMutable": ( - b"^{__CFCharacterSet=}^{__CFAllocator=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFTreeGetParent": (b"^{__CFTree=}^{__CFTree=}",), - "CFCalendarGetComponentDifference": ( - b"Z^{__CFCalendar=}ddQ^c", - "", - {"variadic": True}, - ), - "CFURLGetByteRangeForComponent": ( - b"{CFRange=qq}^{__CFURL=}q^{CFRange=qq}", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFRunLoopRunInMode": (b"i^{__CFString=}dZ",), - "CFBundleCopyExecutableURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringReplace": (b"v^{__CFString=}{CFRange=qq}^{__CFString=}",), - "CFSocketGetNative": (b"i^{__CFSocket=}",), - "CFConvertFloatSwappedToHost": (b"f{CFSwappedFloat32=I}",), - "CFBundleOpenBundleResourceMap": (b"i^{__CFBundle=}",), - "CFDataFind": (b"{CFRange=qq}^{__CFData=}^{__CFData=}{CFRange=qq}Q",), - "CFMachPortCreate": ( - b"^{__CFMachPort=}^{__CFAllocator=}^?^{CFMachPortContext=q^v^?^?^?}^Z", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFMachPort=}"}, - 1: {"type": b"^v"}, - 2: {"type": b"q"}, - 3: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFAttributedStringReplaceAttributedString": ( - b"v^{__CFAttributedString=}{CFRange=qq}^{__CFAttributedString=}", - ), - "CFTimeZoneCreateWithName": ( - b"^{__CFTimeZone=}^{__CFAllocator=}^{__CFString=}Z", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleGetPackageInfoInDirectory": ( - b"Z^{__CFURL=}^I^I", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "CFURLCreateData": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFURL=}IZ", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFNumberFormatterCreateStringWithNumber": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFNumberFormatter=}^{__CFNumber=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCalendarGetMaximumRangeOfUnit": (b"{CFRange=qq}^{__CFCalendar=}Q",), - "CFRunLoopRemoveSource": (b"v^{__CFRunLoop=}^{__CFRunLoopSource=}^{__CFString=}",), - "CFSwapInt32": (b"II",), - "CFRunLoopTimerGetNextFireDate": (b"d^{__CFRunLoopTimer=}",), - "CFBitVectorGetCountOfBit": (b"q^{__CFBitVector=}{CFRange=qq}I",), - "CFNotificationCenterGetDarwinNotifyCenter": (b"^{__CFNotificationCenter=}",), - "CFPropertyListWrite": ( - b"q@^{__CFWriteStream=}qQ^^{__CFError=}", - "", - { - "arguments": { - 4: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CFDataAppendBytes": ( - b"v^{__CFData=}^vq", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CFDictionaryGetCount": (b"q^{__CFDictionary=}",), - "CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode": ( - b"^{__CFString=}^{__CFAllocator=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFUserNotificationUpdate": (b"i^{__CFUserNotification=}dQ^{__CFDictionary=}",), - "CFMessagePortInvalidate": (b"v^{__CFMessagePort=}",), - "CFSwapInt64": (b"QQ",), - "CFURLCreateWithFileSystemPath": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFString=}qZ", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAttributedStringGetAttributes": ( - b"^{__CFDictionary=}^{__CFAttributedString=}q^{CFRange=qq}", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFSocketSetDefaultNameRegistryPortNumber": (b"vS",), - "CFFileSecurityGetTypeID": (b"Q",), - "CFBundleCopyResourceURLsOfType": ( - b"^{__CFArray=}^{__CFBundle=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFConvertFloat32SwappedToHost": (b"f{CFSwappedFloat32=I}",), - "CFDictionaryReplaceValue": (b"v^{__CFDictionary=}@@",), - "CFXMLTreeCreateFromDataWithError": ( - b"^{__CFTree=}^{__CFAllocator=}^{__CFData=}^{__CFURL=}Qq^^{__CFDictionary=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {5: {"type_modifier": "o"}}, - }, - ), - "CFTimeZoneSetDefault": (b"v^{__CFTimeZone=}",), - "CFArrayApplyFunction": ( - b"v^{__CFArray=}{CFRange=qq}^?@", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"@"}, 1: {"type": b"@"}}, - }, - "callable_retained": False, - } - } - }, - ), - "CFMessagePortGetInvalidationCallBack": ( - b"^?^{__CFMessagePort=}", - "", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"@"}, 1: {"type": b"^v"}}, - } - } - }, - ), - "CFUserNotificationGetResponseDictionary": ( - b"^{__CFDictionary=}^{__CFUserNotification=}", - ), - "CFSwapInt32HostToLittle": (b"II",), - "CFSocketInvalidate": (b"v^{__CFSocket=}",), - "CFStringGetMostCompatibleMacStringEncoding": (b"II",), - "CFRunLoopObserverIsValid": (b"Z^{__CFRunLoopObserver=}",), - "CFStringInsert": (b"v^{__CFString=}q^{__CFString=}",), - "CFXMLParserGetTypeID": (b"Q",), - "CFMessagePortGetContext": ( - b"v^{__CFMessagePort=}^{CFMessagePortContext=q^v^?^?^?}", - ), - "CFStringIsEncodingAvailable": (b"ZI",), - "CFStringGetLength": (b"q^{__CFString=}",), - "CFURLCanBeDecomposed": (b"Z^{__CFURL=}",), - "CFStringCreateWithCStringNoCopy": ( - b"^{__CFString=}^{__CFAllocator=}^tI^{__CFAllocator=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CFReadStreamClose": (b"v^{__CFReadStream=}",), - "CFBagCreate": ( - b"^{__CFBag=}^{__CFAllocator=}^^vq^{CFBagCallBacks=q^?^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopAddTimer": (b"v^{__CFRunLoop=}^{__CFRunLoopTimer=}^{__CFString=}",), - "CFDictionaryGetValueIfPresent": ( - b"Z^{__CFDictionary=}@^@", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFArrayCreateCopy": ( - b"^{__CFArray=}^{__CFAllocator=}^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorGetLastIndexOfBit": (b"q^{__CFBitVector=}{CFRange=qq}I",), - "CFDataCreateMutable": ( - b"^{__CFData=}^{__CFAllocator=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringAppendCString": ( - b"v^{__CFString=}^tI", - "", - {"arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}}, - ), - "CFLocaleGetIdentifier": (b"^{__CFString=}^{__CFLocale=}",), - "CFStringConvertWindowsCodepageToEncoding": (b"II",), - "CFTreeRemove": (b"v^{__CFTree=}",), - "CFBundleCloseBundleResourceMap": (b"v^{__CFBundle=}i",), - "CFStreamCreateBoundPair": ( - b"v^{__CFAllocator=}^^{__CFReadStream=}^^{__CFWriteStream=}q", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}, - }, - ), - "CFRunLoopTimerSetNextFireDate": (b"v^{__CFRunLoopTimer=}d",), - "CFAllocatorSetDefault": (b"v^{__CFAllocator=}",), - "CFPreferencesSetAppValue": (b"v^{__CFString=}@^{__CFString=}",), - "CFTimeZoneGetNextDaylightSavingTimeTransition": (b"d^{__CFTimeZone=}d",), - "CFDateFormatterGetFormat": (b"^{__CFString=}^{__CFDateFormatter=}",), - "CFLocaleCreateLocaleIdentifierFromComponents": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFPreferencesSynchronize": (b"Z^{__CFString=}^{__CFString=}^{__CFString=}",), - "CFReadStreamCopyDispatchQueue": ( - b"@^{__CFReadStream=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetMaximumSizeOfFileSystemRepresentation": (b"q^{__CFString=}",), - "CFBundleCreate": ( - b"^{__CFBundle=}^{__CFAllocator=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLGetPortNumber": (b"i^{__CFURL=}",), - "CFStringAppendCharacters": ( - b"v^{__CFString=}^Tq", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CFArrayGetLastIndexOfValue": (b"q^{__CFArray=}{CFRange=qq}@",), - "CFRunLoopTimerCreate": ( - b"^{__CFRunLoopTimer=}^{__CFAllocator=}ddQq^?^{CFRunLoopTimerContext=q^v^?^?^?}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFRunLoopTimer=}"}, - 1: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFFileDescriptorCreateRunLoopSource": ( - b"^{__CFRunLoopSource=}^{__CFAllocator=}^{__CFFileDescriptor=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringHasSuffix": (b"Z^{__CFString=}^{__CFString=}",), - "CFEqual": (b"Z@@",), - "CFRunLoopGetNextTimerFireDate": (b"d^{__CFRunLoop=}^{__CFString=}",), - "CFErrorCreate": ( - b"^{__CFError=}^{__CFAllocator=}^{__CFString=}q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateByCombiningStrings": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFArray=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateWithFileSystemRepresentation": ( - b"^{__CFString=}^{__CFAllocator=}^t", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CFBundleGetPlugIn": (b"^{__CFBundle=}^{__CFBundle=}",), - "CFAllocatorGetPreferredSizeForSize": (b"q^{__CFAllocator=}qQ",), - "CFDateFormatterSetFormat": (b"v^{__CFDateFormatter=}^{__CFString=}",), - "CFBinaryHeapApplyFunction": ( - b"v^{__CFBinaryHeap=}^?@", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"@"}, 1: {"type": b"@"}}, - }, - "callable_retained": False, - } - } - }, - ), - "CFRunLoopTimerSetTolerance": (b"v^{__CFRunLoopTimer=}d",), - "CFStringGetBytes": ( - b"q^{__CFString=}{CFRange=qq}ICZ^tq^q", - "", - { - "arguments": { - 5: {"c_array_length_in_arg": (6, 7), "type_modifier": "o"}, - 7: {"type_modifier": "o"}, - } - }, - ), - "CFLocaleCopyAvailableLocaleIdentifiers": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateArrayBySeparatingStrings": ( - b"^{__CFArray=}^{__CFAllocator=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetDoubleValue": (b"d^{__CFString=}",), - "CFBundleIsExecutableLoadable": (b"Z^{__CFBundle=}",), - "CFSetGetCount": (b"q^{__CFSet=}",), - "CFURLCreateWithBytes": ( - b"^{__CFURL=}^{__CFAllocator=}^vqI^{__CFURL=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFStringCompareWithOptionsAndLocale": ( - b"q^{__CFString=}^{__CFString=}{CFRange=qq}Q^{__CFLocale=}", - ), - "CFPropertyListCreateFromStream": ( - b"@^{__CFAllocator=}^{__CFReadStream=}qQ^q^^{__CFString=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {4: {"type_modifier": "o"}, 5: {"type_modifier": "o"}}, - }, - ), - "CFAbsoluteTimeAddGregorianUnits": ( - b"dd^{__CFTimeZone=}{CFGregorianUnits=iiiiid}", - ), - "CFLocaleCopyCurrent": ( - b"^{__CFLocale=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDateFormatterGetLocale": (b"^{__CFLocale=}^{__CFDateFormatter=}",), - "CFURLEnumeratorGetSourceDidChange": (b"Z^{__CFURLEnumerator=}",), - "CFNullGetTypeID": (b"Q",), - "CFStringUppercase": (b"v^{__CFString=}^{__CFLocale=}",), - "CFTreeGetFirstChild": (b"^{__CFTree=}^{__CFTree=}",), - "CFAbsoluteTimeGetDayOfYear": (b"id^{__CFTimeZone=}",), - "CFURLCreateFromFileSystemRepresentation": ( - b"^{__CFURL=}^{__CFAllocator=}^tqZ", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CFBundleGetInfoDictionary": (b"^{__CFDictionary=}^{__CFBundle=}",), - "CFByteOrderGetCurrent": (b"q",), - "CFAttributedStringEndEditing": (b"v^{__CFAttributedString=}",), - "CFUserNotificationCancel": (b"i^{__CFUserNotification=}",), - "CFUserNotificationSecureTextField": (b"Qq",), - "CFBitVectorCreate": ( - b"^{__CFBitVector=}^{__CFAllocator=}^Cq", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CFCharacterSetRemoveCharactersInRange": (b"v^{__CFCharacterSet=}{CFRange=qq}",), - "CFMachPortSetInvalidationCallBack": ( - b"v^{__CFMachPort=}^?", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFMachPort=}"}, - 1: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CFCharacterSetAddCharactersInString": (b"v^{__CFCharacterSet=}^{__CFString=}",), - "CFBitVectorGetBitAtIndex": (b"I^{__CFBitVector=}q",), - "CFURLIsFileReferenceURL": (b"Z^{__CFURL=}",), - "CFURLCopyPath": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFArrayGetFirstIndexOfValue": (b"q^{__CFArray=}{CFRange=qq}@",), - "CFCharacterSetCreateWithCharactersInRange": ( - b"^{__CFCharacterSet=}^{__CFAllocator=}{CFRange=qq}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetIsLongCharacterMember": (b"Z^{__CFCharacterSet=}I",), - "CFUUIDCreateFromUUIDBytes": ( - b"^{__CFUUID=}^{__CFAllocator=}{CFUUIDBytes=CCCCCCCCCCCCCCCC}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopAddSource": (b"v^{__CFRunLoop=}^{__CFRunLoopSource=}^{__CFString=}",), - "CFDictionaryContainsValue": (b"Z^{__CFDictionary=}@",), - "CFTimeZoneCopyKnownNames": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleCopyPreferredLocalizationsFromArray": ( - b"^{__CFArray=}^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorFlipBitAtIndex": (b"v^{__CFBitVector=}q",), - "CFPropertyListCreateXMLData": ( - b"^{__CFData=}^{__CFAllocator=}@", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCreateResourcePropertyForKeyFromBookmarkData": ( - b"@^{__CFAllocator=}^{__CFString=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDateGetAbsoluteTime": (b"d^{__CFDate=}",), - "CFNumberIsFloatType": (b"Z^{__CFNumber=}",), - "CFTreePrependChild": (b"v^{__CFTree=}^{__CFTree=}",), - "CFRunLoopWakeUp": (b"v^{__CFRunLoop=}",), - "CFDateFormatterCreateStringWithDate": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFDateFormatter=}^{__CFDate=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetHasMemberInPlane": (b"Z^{__CFCharacterSet=}q",), - "CFURLCopyResourceSpecifier": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringFold": (b"v^{__CFString=}Q^{__CFLocale=}",), - "CFStringTokenizerCopyCurrentTokenAttribute": ( - b"@^{__CFStringTokenizer=}Q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFNotificationCenterRemoveEveryObserver": (b"v^{__CFNotificationCenter=}@",), - "CFMessagePortGetName": (b"^{__CFString=}^{__CFMessagePort=}",), - "CFURLCopyPassword": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFWriteStreamClose": (b"v^{__CFWriteStream=}",), - "CFMessagePortCreateRunLoopSource": ( - b"^{__CFRunLoopSource=}^{__CFAllocator=}^{__CFMessagePort=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetCString": ( - b"Z^{__CFString=}^tqI", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "o"}}}, - ), - "_CFAutoreleasePoolPrintPools": (b"v",), - "CFPropertyListCreateData": ( - b"^{__CFData=}^{__CFAllocator=}@qQ^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 4: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - }, - }, - ), - "CFURLCopyQueryString": ( - b"^{__CFString=}^{__CFURL=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopTimerCreateWithHandler": ( - b"^{__CFRunLoopTimer=}^{__CFAllocator=}ddQq@?", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"^{__CFRunLoopTimer=}"}, - }, - }, - "block": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^{__CFRunLoopTimer=}"}}, - }, - } - }, - }, - ), - "CFTimeZoneCopyAbbreviationDictionary": ( - b"^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringConvertEncodingToIANACharSetName": (b"^{__CFString=}I",), - "CFSwapInt16LittleToHost": (b"SS",), - "CFNumberFormatterSetProperty": (b"v^{__CFNumberFormatter=}^{__CFString=}@",), - "CFSocketCopyPeerAddress": ( - b"^{__CFData=}^{__CFSocket=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCreateFromFileSystemRepresentationRelativeToBase": ( - b"^{__CFURL=}^{__CFAllocator=}^tqZ^{__CFURL=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CFAttributedStringSetAttributes": ( - b"v^{__CFAttributedString=}{CFRange=qq}^{__CFDictionary=}Z", - ), - "CFNumberFormatterCopyProperty": ( - b"@^{__CFNumberFormatter=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFSocketGetTypeID": (b"Q",), - "CFURLGetBaseURL": (b"^{__CFURL=}^{__CFURL=}",), - "CFSetGetCountOfValue": (b"q^{__CFSet=}@",), - "CFWriteStreamSetProperty": (b"Z^{__CFWriteStream=}^{__CFString=}@",), - "CFDictionarySetValue": (b"v^{__CFDictionary=}@@",), - "CFRunLoopSourceGetTypeID": (b"Q",), - "CFWriteStreamCopyError": ( - b"^{__CFError=}^{__CFWriteStream=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorSetBits": (b"v^{__CFBitVector=}{CFRange=qq}I",), - "CFURLCreateBookmarkDataFromAliasRecord": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAttributedStringRemoveAttribute": ( - b"v^{__CFAttributedString=}{CFRange=qq}^{__CFString=}", - ), - "CFURLCreateFromFSRef": ( - b"^{__CFURL=}^{__CFAllocator=}^{FSRef=[80C]}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CFBitVectorFlipBits": (b"v^{__CFBitVector=}{CFRange=qq}",), - "CFCalendarCopyCurrent": ( - b"^{__CFCalendar=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopAddObserver": (b"v^{__CFRunLoop=}^{__CFRunLoopObserver=}^{__CFString=}",), - "CFURLCreateCopyDeletingPathExtension": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFMessagePortIsValid": (b"Z^{__CFMessagePort=}",), - "CFBundleCopySupportFilesDirectoryURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFNumberGetType": (b"q^{__CFNumber=}",), - "CFDataCreateCopy": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDictionaryCreateMutableCopy": ( - b"^{__CFDictionary=}^{__CFAllocator=}q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringConvertEncodingToNSStringEncoding": (b"QI",), - "CFXMLParserGetSourceURL": (b"^{__CFURL=}^{__CFXMLParser=}",), - "CFSetContainsValue": (b"Z^{__CFSet=}@",), - "CFBundleCopyInfoDictionaryForURL": ( - b"^{__CFDictionary=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFMessagePortSetInvalidationCallBack": ( - b"v^{__CFMessagePort=}^?", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFMessagePort=}"}, - 1: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CFTreeRemoveAllChildren": (b"v^{__CFTree=}",), - "CFFileDescriptorIsValid": (b"Z^{__CFFileDescriptor=}",), - "CFSetGetValueIfPresent": ( - b"Z^{__CFSet=}@^@", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFBinaryHeapGetCount": (b"q^{__CFBinaryHeap=}",), - "CFRunLoopContainsObserver": ( - b"Z^{__CFRunLoop=}^{__CFRunLoopObserver=}^{__CFString=}", - ), - "CFRunLoopObserverGetOrder": (b"q^{__CFRunLoopObserver=}",), - "CFBagReplaceValue": (b"v^{__CFBag=}@",), - "CFTreeSetContext": (b"v^{__CFTree=}^{CFTreeContext=q^v^?^?^?}",), - "CFReadStreamCopyProperty": ( - b"@^{__CFReadStream=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringIsHyphenationAvailableForLocale": (b"Z^{__CFLocale=}",), - "CFWriteStreamCopyDispatchQueue": ( - b"@^{__CFWriteStream=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopSourceCreate": ( - b"^{__CFRunLoopSource=}^{__CFAllocator=}q^{CFRunLoopSourceContext=q^v^?^?^?^?^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetInvert": (b"v^{__CFCharacterSet=}",), - "CFBundleIsExecutableLoadableForURL": (b"Z^{__CFURL=}",), - "CFMachPortInvalidate": (b"v^{__CFMachPort=}",), - "CFSwapInt32BigToHost": (b"II",), - "CFDataReplaceBytes": ( - b"v^{__CFData=}{CFRange=qq}^vq", - "", - {"arguments": {2: {"c_array_length_in_arg": 3, "type_modifier": "n"}}}, - ), - "CFDataGetBytePtr": ( - b"^v^{__CFData=}", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CFSocketDisableCallBacks": (b"v^{__CFSocket=}Q",), - "CFBundleCopyLocalizationsForURL": ( - b"^{__CFArray=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFReadStreamGetBuffer": ( - b"^v^{__CFReadStream=}q^q", - "", - { - "retval": {"c_array_length_in_arg": 2}, - "arguments": {2: {"type_modifier": "o"}}, - }, - ), - "CFErrorGetDomain": (b"^{__CFString=}^{__CFError=}",), - "CFStringHasPrefix": (b"Z^{__CFString=}^{__CFString=}",), - "CFTimeZoneIsDaylightSavingTime": (b"Z^{__CFTimeZone=}d",), - "CFWriteStreamCanAcceptBytes": (b"Z^{__CFWriteStream=}",), - "CFWriteStreamOpen": (b"Z^{__CFWriteStream=}",), - "CFBitVectorSetCount": (b"v^{__CFBitVector=}q",), - "CFErrorCreateWithUserInfoKeysAndValues": ( - b"^{__CFError=}^{__CFAllocator=}^{__CFString=}q^@^@q", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: {"c_array_length_in_arg": 5, "type_modifier": "n"}, - 4: {"c_array_length_in_arg": 5, "type_modifier": "n"}, - }, - }, - ), - "CFUserNotificationCreate": ( - b"^{__CFUserNotification=}^{__CFAllocator=}dQ^i^{__CFDictionary=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"type_modifier": "o"}}, - }, - ), - "CFURLResourceIsReachable": ( - b"Z^{__CFURL=}^^{__CFError=}", - "", - { - "arguments": { - 1: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CFStringIsSurrogateHighCharacter": (b"ZT",), - "CFPropertyListCreateWithData": ( - b"@^{__CFAllocator=}^{__CFData=}Q^q^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: {"type_modifier": "o"}, - 4: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - }, - }, - }, - ), - "CFSocketGetDefaultNameRegistryPortNumber": (b"S",), - "CFBundleCopyLocalizationsForPreferences": ( - b"^{__CFArray=}^{__CFArray=}^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopObserverInvalidate": (b"v^{__CFRunLoopObserver=}",), - "CFURLGetFSRef": ( - b"Z^{__CFURL=}^{FSRef=[80C]}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CFURLCreateCopyDeletingLastPathComponent": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleCreateBundlesFromDirectory": ( - b"^{__CFArray=}^{__CFAllocator=}^{__CFURL=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringFindCharacterFromSet": ( - b"Z^{__CFString=}^{__CFCharacterSet=}{CFRange=qq}Q^{CFRange=qq}", - "", - {"arguments": {4: {"type_modifier": "o"}}}, - ), - "CFAttributedStringCreateMutable": ( - b"^{__CFAttributedString=}^{__CFAllocator=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFTreeGetContext": (b"v^{__CFTree=}^{CFTreeContext=q^v^?^?^?}",), - "CFArrayCreateMutable": ( - b"^{__CFArray=}^{__CFAllocator=}q^{CFArrayCallBacks=q^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFShow": (b"v@",), - "CFFileSecuritySetOwner": (b"Z^{__CFFileSecurity=}I",), - "CFSocketCopyAddress": ( - b"^{__CFData=}^{__CFSocket=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBagGetValues": ( - b"v^{__CFBag=}^@", - "", - {"arguments": {1: {"c_array_of_variable_length": True, "type_modifier": "o"}}}, - ), - "CFFileSecuritySetOwnerUUID": (b"Z^{__CFFileSecurity=}^{__CFUUID=}",), - "CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes": ( - b"^{__CFString=}^{__CFAllocator=}ss", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDictionaryRemoveValue": (b"v^{__CFDictionary=}@",), - "CFWriteStreamSetClient": ( - b"Z^{__CFWriteStream=}Q^?^{CFStreamClientContext=q^v^?^?^?}", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFWriteStream=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CFRunLoopSourceIsValid": (b"Z^{__CFRunLoopSource=}",), - "CFCharacterSetIsCharacterMember": (b"Z^{__CFCharacterSet=}T",), - "CFTreeGetChildCount": (b"q^{__CFTree=}",), - "CFURLSetTemporaryResourcePropertyForKey": (b"v^{__CFURL=}^{__CFString=}@",), - "CFConvertDoubleHostToSwapped": (b"{CFSwappedFloat64=Q}d",), - "CFSetGetValue": (b"@^{__CFSet=}@",), - "CFMessagePortSendRequest": ( - b"i^{__CFMessagePort=}i^{__CFData=}dd^{__CFString=}^^{__CFData=}", - "", - {"arguments": {6: {"type_modifier": "o"}}}, - ), - "CFUUIDGetConstantUUIDWithBytes": ( - b"^{__CFUUID=}^{__CFAllocator=}CCCCCCCCCCCCCCCC", - ), - "CFSocketCreateRunLoopSource": ( - b"^{__CFRunLoopSource=}^{__CFAllocator=}^{__CFSocket=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFWriteStreamCreateWithBuffer": ( - b"^{__CFWriteStream=}^{__CFAllocator=}^vq", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFXMLTreeCreateXMLData": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFTree=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCopyUserName": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCopyAbsoluteURL": ( - b"^{__CFURL=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFNumberGetTypeID": (b"Q",), - "CFStringCompareWithOptions": (b"q^{__CFString=}^{__CFString=}{CFRange=qq}Q",), - "CFWriteStreamGetTypeID": (b"Q",), - "CFSwapInt16": (b"SS",), - "CFDateGetTimeIntervalSinceDate": (b"d^{__CFDate=}^{__CFDate=}",), - "CFAttributedStringGetString": (b"^{__CFString=}^{__CFAttributedString=}",), - "CFURLCopyNetLocation": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringFind": (b"{CFRange=qq}^{__CFString=}^{__CFString=}Q",), - "CFConvertFloat64HostToSwapped": (b"{CFSwappedFloat64=Q}d",), - "CFSetReplaceValue": (b"v^{__CFSet=}@",), - "CFURLCreateCopyAppendingPathExtension": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFURL=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFTimeZoneCreate": ( - b"^{__CFTimeZone=}^{__CFAllocator=}^{__CFString=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCopyScheme": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFXMLParserParse": (b"Z^{__CFXMLParser=}",), - "CFRunLoopRemoveTimer": (b"v^{__CFRunLoop=}^{__CFRunLoopTimer=}^{__CFString=}",), - "CFPreferencesAppValueIsForced": (b"Z^{__CFString=}^{__CFString=}",), - "CFSocketCreate": ( - b"^{__CFSocket=}^{__CFAllocator=}iiiQ^?^{CFSocketContext=q^v^?^?^?}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFSocket=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^{__CFData=}"}, - 3: {"type": b"^v"}, - 4: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFNotificationCenterGetTypeID": (b"Q",), - "CFURLCreateStringByReplacingPercentEscapes": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorContainsBit": (b"Z^{__CFBitVector=}{CFRange=qq}I",), - "CFMachPortCreateWithPort": ( - b"^{__CFMachPort=}^{__CFAllocator=}I^?^{CFMachPortContext=q^v^?^?^?}^Z", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFMachPort=}"}, - 1: {"type": b"^v"}, - 2: {"type": b"q"}, - 3: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFPreferencesAppSynchronize": (b"Z^{__CFString=}",), - "CFFileDescriptorGetTypeID": (b"Q",), - "CFBundleCopyBundleLocalizations": ( - b"^{__CFArray=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFFileSecurityCreate": ( - b"^{__CFFileSecurity=}^{__CFAllocator=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFHash": (b"Q@",), - "CFCharacterSetIntersect": (b"v^{__CFCharacterSet=}^{__CFCharacterSet=}",), - "CFXMLNodeCreateCopy": ( - b"^{__CFXMLNode=}^{__CFAllocator=}^{__CFXMLNode=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFArrayCreate": ( - b"^{__CFArray=}^{__CFAllocator=}^^vq^{CFArrayCallBacks=q^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBooleanGetValue": (b"Z^{__CFBoolean=}",), - "CFArrayContainsValue": (b"Z^{__CFArray=}{CFRange=qq}@",), - "CFSwapInt32HostToBig": (b"II",), - "CFURLWriteDataAndPropertiesToResource": ( - b"Z^{__CFURL=}^{__CFData=}^{__CFDictionary=}^i", - "", - {"arguments": {3: {"type_modifier": "o"}}}, - ), - "CFArrayInsertValueAtIndex": (b"v^{__CFArray=}q@",), - "CFDictionaryCreateMutable": ( - b"^{__CFDictionary=}^{__CFAllocator=}q^{CFDictionaryKeyCallBacks=q^?^?^?^?^?}^{CFDictionaryValueCallBacks=q^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAllocatorGetTypeID": (b"Q",), - "CFReadStreamRead": ( - b"q^{__CFReadStream=}^vq", - "", - { - "arguments": { - 1: { - "c_array_length_in_result": True, - "type_modifier": "o", - "c_array_length_in_arg": 2, - } - } - }, - ), - "CFDataGetBytes": ( - b"v^{__CFData=}{CFRange=qq}^v", - "", - {"arguments": {2: {"c_array_length_in_arg": 1, "type_modifier": "o"}}}, - ), - "CFStringCreateWithCharactersNoCopy": ( - b"^{__CFString=}^{__CFAllocator=}^Tq^{__CFAllocator=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CFStringGetLongCharacterForSurrogatePair": (b"ITT",), - "CFSetAddValue": (b"v^{__CFSet=}@",), - "CFFileSecuritySetMode": (b"Z^{__CFFileSecurity=}S",), - "CFURLCreateStringByAddingPercentEscapes": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}^{__CFString=}^{__CFString=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetIntValue": (b"i^{__CFString=}",), - "CFDictionaryGetCountOfValue": (b"q^{__CFDictionary=}@",), - "CFDataGetMutableBytePtr": ( - b"^v^{__CFData=}", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CFURLCreateAbsoluteURLWithBytes": ( - b"^{__CFURL=}^{__CFAllocator=}^vqI^{__CFURL=}Z", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFBundleOpenBundleResourceFiles": ( - b"i^{__CFBundle=}^i^i", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "CFStringCreateStringWithValidatedFormat": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFDictionary=}^{__CFString=}^{__CFString=}^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"printf_format": True}, - 3: {"printf_format": True}, - 4: { - "null_accepted": True, - "already_cfretained": True, - "type_modifier": "o", - }, - }, - "variadic": True, - }, - ), - "CFRunLoopTimerGetInterval": (b"d^{__CFRunLoopTimer=}",), - "CFFileSecurityGetOwner": ( - b"Z^{__CFFileSecurity=}^I", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CFCalendarGetIdentifier": (b"^{__CFString=}^{__CFCalendar=}",), - "CFStringCompare": (b"q^{__CFString=}^{__CFString=}Q",), - "CFURLClearResourcePropertyCache": (b"v^{__CFURL=}",), - "CFRunLoopSourceInvalidate": (b"v^{__CFRunLoopSource=}",), - "CFCalendarCreateWithIdentifier": ( - b"^{__CFCalendar=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFMachPortGetPort": (b"I^{__CFMachPort=}",), - "CFBinaryHeapRemoveMinimumValue": (b"v^{__CFBinaryHeap=}",), - "CFBagRemoveValue": (b"v^{__CFBag=}@",), - "CFStringReplaceAll": (b"v^{__CFString=}^{__CFString=}",), - "CFArraySetValueAtIndex": (b"v^{__CFArray=}q@",), - "CFBundleCopyExecutableArchitecturesForURL": ( - b"^{__CFArray=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopObserverDoesRepeat": (b"Z^{__CFRunLoopObserver=}",), - "CFDateCompare": (b"q^{__CFDate=}^{__CFDate=}^v",), - "CFGregorianDateIsValid": (b"Z{CFGregorianDate=iccccd}Q",), - "CFAutorelease": (b"@@",), - "CFRunLoopTimerInvalidate": (b"v^{__CFRunLoopTimer=}",), - "CFDictionaryGetCountOfKey": (b"q^{__CFDictionary=}@",), - "CFStringGetCharacterAtIndex": (b"T^{__CFString=}q",), - "CFStringCreateWithCString": ( - b"^{__CFString=}^{__CFAllocator=}^tI", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CFReadStreamCopyError": ( - b"^{__CFError=}^{__CFReadStream=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFUserNotificationCheckBoxChecked": (b"Qq",), - "CFAttributedStringCreate": ( - b"^{__CFAttributedString=}^{__CFAllocator=}^{__CFString=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringFindWithOptions": ( - b"Z^{__CFString=}^{__CFString=}{CFRange=qq}Q^{CFRange=qq}", - "", - {"arguments": {4: {"type_modifier": "o"}}}, - ), - "CFSetRemoveAllValues": (b"v^{__CFSet=}",), - "CFArraySortValues": ( - b"v^{__CFArray=}{CFRange=qq}^?@", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - } - } - }, - ), - "CFCalendarGetFirstWeekday": (b"q^{__CFCalendar=}",), - "CFStreamCreatePairWithPeerSocketSignature": ( - b"v^{__CFAllocator=}^{CFSocketSignature=iii^{__CFData=}}^^{__CFReadStream=}^^{__CFWriteStream=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"type_modifier": "n"}, - 2: {"type_modifier": "o"}, - 3: {"type_modifier": "o"}, - }, - }, - ), - "CFURLSetResourcePropertiesForKeys": ( - b"Z^{__CFURL=}^{__CFDictionary=}^^{__CFError=}", - "", - { - "arguments": { - 2: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CFXMLParserGetLocation": (b"q^{__CFXMLParser=}",), - "CFStringTokenizerGetCurrentTokenRange": (b"{CFRange=qq}^{__CFStringTokenizer=}",), - "CFBagContainsValue": (b"Z^{__CFBag=}@",), - "CFUUIDCreateWithBytes": ( - b"^{__CFUUID=}^{__CFAllocator=}CCCCCCCCCCCCCCCC", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFArrayGetCount": (b"q^{__CFArray=}",), - "CFArrayCreateMutableCopy": ( - b"^{__CFArray=}^{__CFAllocator=}q^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFSetSetValue": (b"v^{__CFSet=}@",), - "CFSwapInt64HostToBig": (b"QQ",), - "CFCharacterSetUnion": (b"v^{__CFCharacterSet=}^{__CFCharacterSet=}",), - "CFFileSecurityCopyGroupUUID": ( - b"Z^{__CFFileSecurity=}^^{__CFUUID=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "o"}}, - }, - ), - "CFAttributedStringSetAttribute": ( - b"v^{__CFAttributedString=}{CFRange=qq}^{__CFString=}@", - ), - "CFReadStreamOpen": (b"Z^{__CFReadStream=}",), - "CFXMLNodeGetVersion": (b"q^{__CFXMLNode=}",), - "CFStringCreateWithBytesNoCopy": ( - b"^{__CFString=}^{__CFAllocator=}^tqIZ^{__CFAllocator=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFBundleGetTypeID": (b"Q",), - "CFURLDestroyResource": ( - b"Z^{__CFURL=}^i", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CFBagSetValue": (b"v^{__CFBag=}@",), - "CFURLWriteBookmarkDataToFile": ( - b"Z^{__CFData=}^{__CFURL=}Q^^{__CFError=}", - "", - { - "arguments": { - 3: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CFLocaleCreate": ( - b"^{__CFLocale=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFGetTypeID": (b"Q@",), - "CFURLCopyFragment": ( - b"^{__CFString=}^{__CFURL=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFWriteStreamCreateWithFile": ( - b"^{__CFWriteStream=}^{__CFAllocator=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAbsoluteTimeGetDifferenceAsGregorianUnits": ( - b"{CFGregorianUnits=iiiiid}dd^{__CFTimeZone=}Q", - ), - "CFReadStreamCreateWithFile": ( - b"^{__CFReadStream=}^{__CFAllocator=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleCopyLocalizedString": ( - b"^{__CFString=}^{__CFBundle=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFErrorCopyRecoverySuggestion": ( - b"^{__CFString=}^{__CFError=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCreateBookmarkData": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFURL=}Q^{__CFArray=}^{__CFURL=}^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 5: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - }, - }, - ), - "CFStringCreateWithBytes": ( - b"^{__CFString=}^{__CFAllocator=}^tqIZ", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFRunLoopSourceGetOrder": (b"q^{__CFRunLoopSource=}",), - "CFBundleLoadExecutable": (b"Z^{__CFBundle=}",), - "CFStringCreateCopy": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCreateFilePathURL": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFURL=}^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - }, - }, - ), - "CFUserNotificationDisplayNotice": ( - b"idQ^{__CFURL=}^{__CFURL=}^{__CFURL=}^{__CFString=}^{__CFString=}^{__CFString=}", - ), - "CFUserNotificationGetResponseValue": ( - b"^{__CFString=}^{__CFUserNotification=}^{__CFString=}q", - ), - "CFRunLoopContainsTimer": (b"Z^{__CFRunLoop=}^{__CFRunLoopTimer=}^{__CFString=}",), - "CFPreferencesSetValue": ( - b"v^{__CFString=}@^{__CFString=}^{__CFString=}^{__CFString=}", - ), - "CFReadStreamGetStatus": (b"q^{__CFReadStream=}",), - "CFCopyTypeIDDescription": ( - b"^{__CFString=}Q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFConvertFloatHostToSwapped": (b"{CFSwappedFloat32=I}f",), - "CFCalendarDecomposeAbsoluteTime": ( - b"Z^{__CFCalendar=}d^c", - "", - {"variadic": True}, - ), - "CFBinaryHeapCreate": ( - b"^{__CFBinaryHeap=}^{__CFAllocator=}q^{CFBinaryHeapCallBacks=q^?^?^?^?}^{CFBinaryHeapCompareContext=q^v^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateExternalRepresentation": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFString=}IC", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDateFormatterCreateISO8601Formatter": ( - b"^{__CFDateFormatter=}^{__CFAllocator=}Q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateWithFormat": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFDictionary=}^{__CFString=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {2: {"printf_format": True}}, - "variadic": True, - }, - ), - "CFBundleCopyResourceURLsOfTypeForLocalization": ( - b"^{__CFArray=}^{__CFBundle=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFConvertFloat32HostToSwapped": (b"{CFSwappedFloat32=I}f",), - "CFRunLoopObserverCreateWithHandler": ( - b"^{__CFRunLoopObserver=}^{__CFAllocator=}QZq@?", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"^{__CFRunLoopObserver=}"}, - 2: {"type": b"Q"}, - }, - }, - "block": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFRunLoopObserver=}"}, - 1: {"type": b"Q"}, - }, - }, - } - }, - }, - ), - "CFDataCreate": ( - b"^{__CFData=}^{__CFAllocator=}^vq", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFSwapInt16HostToLittle": (b"SS",), - "CFSetCreate": ( - b"^{__CFSet=}^{__CFAllocator=}^^vq^{CFSetCallBacks=q^?^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFGregorianDateGetAbsoluteTime": (b"d{CFGregorianDate=iccccd}^{__CFTimeZone=}",), - "CFStringGetListOfAvailableEncodings": ( - b"^I", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CFRunLoopTimerGetContext": ( - b"v^{__CFRunLoopTimer=}^{CFRunLoopTimerContext=q^v^?^?^?}", - ), - "CFXMLParserAbort": (b"v^{__CFXMLParser=}q^{__CFString=}",), - "CFPropertyListCreateFromXMLData": ( - b"@^{__CFAllocator=}^{__CFData=}Q^^{__CFString=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"type_modifier": "o"}}, - }, - ), - "CFStringFindAndReplace": ( - b"q^{__CFString=}^{__CFString=}^{__CFString=}{CFRange=qq}Q", - ), - "CFDictionaryGetTypeID": (b"Q",), - "CFBundleGetDevelopmentRegion": (b"^{__CFString=}^{__CFBundle=}",), - "CFBundleGetMainBundle": (b"^{__CFBundle=}",), - "CFXMLNodeCreate": ( - b"^{__CFXMLNode=}^{__CFAllocator=}q^{__CFString=}^vq", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleUnloadExecutable": (b"v^{__CFBundle=}",), - "CFArrayGetCountOfValue": (b"q^{__CFArray=}{CFRange=qq}@",), - "CFRunLoopTimerIsValid": (b"Z^{__CFRunLoopTimer=}",), - "CFConvertFloat64SwappedToHost": (b"d{CFSwappedFloat64=Q}",), - "CFReadStreamHasBytesAvailable": (b"Z^{__CFReadStream=}",), - "CFDataSetLength": (b"v^{__CFData=}q",), - "CFStringTokenizerCreate": ( - b"^{__CFStringTokenizer=}^{__CFAllocator=}^{__CFString=}{CFRange=qq}Q^{__CFLocale=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFMachPortGetTypeID": (b"Q",), - "CFTreeGetChildAtIndex": (b"^{__CFTree=}^{__CFTree=}q",), - "CFSwapInt16BigToHost": (b"SS",), - "CFStringCreateWithCharacters": ( - b"^{__CFString=}^{__CFAllocator=}^Tq", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CFUserNotificationCreateRunLoopSource": ( - b"^{__CFRunLoopSource=}^{__CFAllocator=}^{__CFUserNotification=}^?q", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFUserNotification=}"}, - 1: {"type": b"q"}, - }, - }, - "function_pointer_retained": True, - } - }, - }, - ), - "CFStringTrimWhitespace": (b"v^{__CFString=}",), - "CFMessagePortCreateRemote": ( - b"^{__CFMessagePort=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringDelete": (b"v^{__CFString=}{CFRange=qq}",), - "CFBundleCopyResourceURLInDirectory": ( - b"^{__CFURL=}^{__CFURL=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFTreeFindRoot": (b"^{__CFTree=}^{__CFTree=}",), - "CFLocaleCopyDisplayNameForPropertyValue": ( - b"^{__CFString=}^{__CFLocale=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringTokenizerGetTypeID": (b"Q",), - "CFSocketGetSocketFlags": (b"Q^{__CFSocket=}",), - "CFLocaleGetLanguageLineDirection": (b"q^{__CFString=}",), - "CFCopyHomeDirectoryURL": ( - b"^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFUUIDCreateFromString": ( - b"^{__CFUUID=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFPreferencesCopyApplicationList": ( - b"^{__CFArray=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFErrorCopyUserInfo": ( - b"^{__CFDictionary=}^{__CFError=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFMachPortIsValid": (b"Z^{__CFMachPort=}",), - "CFCalendarComposeAbsoluteTime": (b"Z^{__CFCalendar=}^d^c", "", {"variadic": True}), - "CFReadStreamUnscheduleFromRunLoop": ( - b"v^{__CFReadStream=}^{__CFRunLoop=}^{__CFString=}", - ), - "CFDictionaryGetValue": (b"@^{__CFDictionary=}@",), - "CFReadStreamCreateWithBytesNoCopy": ( - b"^{__CFReadStream=}^{__CFAllocator=}^vq^{__CFAllocator=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFSwapInt32LittleToHost": (b"II",), - "CFBinaryHeapRemoveAllValues": (b"v^{__CFBinaryHeap=}",), - "CFWriteStreamGetStatus": (b"q^{__CFWriteStream=}",), - "CFURLCreateFileReferenceURL": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFURL=}^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - }, - }, - ), - "CFRunLoopObserverGetActivities": (b"Q^{__CFRunLoopObserver=}",), - "CFTimeZoneCreateWithTimeIntervalFromGMT": ( - b"^{__CFTimeZone=}^{__CFAllocator=}d", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFPropertyListCreateWithStream": ( - b"@^{__CFAllocator=}^{__CFReadStream=}qQ^q^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 4: {"type_modifier": "o"}, - 5: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - }, - }, - }, - ), - "CFFileSecurityClearProperties": (b"Z^{__CFFileSecurity=}Q",), - "CFURLCopyResourcePropertyForKey": ( - b"Z^{__CFURL=}^{__CFString=}^@^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: {"already_cfretained": True, "type_modifier": "o"}, - 3: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - }, - }, - }, - ), - "CFDateFormatterCopyProperty": ( - b"@^{__CFDateFormatter=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFSwapInt64LittleToHost": (b"QQ",), - "CFUserNotificationReceiveResponse": ( - b"i^{__CFUserNotification=}d^Q", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFNumberFormatterGetLocale": (b"^{__CFLocale=}^{__CFNumberFormatter=}",), - "CFURLStartAccessingSecurityScopedResource": (b"Z^{__CFURL=}",), - "CFMachPortCreateRunLoopSource": ( - b"^{__CFRunLoopSource=}^{__CFAllocator=}^{__CFMachPort=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLGetBytes": ( - b"q^{__CFURL=}^Cq", - "", - { - "arguments": { - 1: { - "c_array_length_in_arg": 2, - "c_array_length_in_result": True, - "type_modifier": "o", - } - } - }, - ), - "CFFileDescriptorGetNativeDescriptor": (b"i^{__CFFileDescriptor=}",), - "CFTimeZoneSetAbbreviationDictionary": (b"v^{__CFDictionary=}",), - "CFUserNotificationGetTypeID": (b"Q",), - "CFTimeZoneCopySystem": ( - b"^{__CFTimeZone=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFShowStr": (b"v^{__CFString=}",), - "CFURLEnumeratorGetTypeID": (b"Q",), - "CFBundleCopyResourceURL": ( - b"^{__CFURL=}^{__CFBundle=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorGetBits": ( - b"v^{__CFBitVector=}{CFRange=qq}^C", - "", - {"arguments": {2: {"c_array_of_variable_length": True, "type_modifier": "o"}}}, - ), - "CFFileSecuritySetGroup": (b"Z^{__CFFileSecurity=}I",), - "CFNotificationCenterGetLocalCenter": (b"^{__CFNotificationCenter=}",), - "CFTimeZoneGetData": (b"^{__CFData=}^{__CFTimeZone=}",), - "CFArrayReplaceValues": ( - b"v^{__CFArray=}{CFRange=qq}^@q", - "", - {"arguments": {2: {"c_array_length_in_arg": 3, "type_modifier": "n"}}}, - ), - "CFStringGetCharactersPtr": ( - b"^T^{__CFString=}", - "", - {"retval": {"c_array_delimited_by_null": True}}, - ), - "CFStringTokenizerGoToTokenAtIndex": (b"Q^{__CFStringTokenizer=}q",), - "CFBundleGetIdentifier": (b"^{__CFString=}^{__CFBundle=}",), - "CFTreeApplyFunctionToChildren": ( - b"v^{__CFTree=}^?@", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"@"}, 1: {"type": b"@"}}, - }, - "callable_retained": False, - } - } - }, - ), - "CFDataGetTypeID": (b"Q",), - "CFRunLoopAddCommonMode": (b"v^{__CFRunLoop=}^{__CFString=}",), - "CFCalendarSetLocale": (b"v^{__CFCalendar=}^{__CFLocale=}",), - "CFStreamCreatePairWithSocketToHost": ( - b"v^{__CFAllocator=}^{__CFString=}I^^{__CFReadStream=}^^{__CFWriteStream=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"type_modifier": "o"}, 4: {"type_modifier": "o"}}, - }, - ), - "CFNumberCreate": ( - b"^{__CFNumber=}^{__CFAllocator=}q^v", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateMutable": ( - b"^{__CFString=}^{__CFAllocator=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetAddCharactersInRange": (b"v^{__CFCharacterSet=}{CFRange=qq}",), - "CFMessagePortIsRemote": (b"Z^{__CFMessagePort=}",), - "CFURLGetTypeID": (b"Q",), - "CFReadStreamGetError": (b"{CFStreamError=qi}^{__CFReadStream=}",), - "CFBagCreateMutableCopy": ( - b"^{__CFBag=}^{__CFAllocator=}q^{__CFBag=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFWriteStreamCreateWithAllocatedBuffers": ( - b"^{__CFWriteStream=}^{__CFAllocator=}^{__CFAllocator=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBagGetTypeID": (b"Q",), - "CFCalendarGetTimeRangeOfUnit": ( - b"Z^{__CFCalendar=}Qd^d^d", - "", - {"arguments": {3: {"type_modifier": "o"}, 4: {"type_modifier": "o"}}}, - ), - "CFBundlePreflightExecutable": ( - b"Z^{__CFBundle=}^^{__CFError=}", - "", - { - "arguments": { - 1: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CFArrayRemoveAllValues": (b"v^{__CFArray=}",), - "CFStringGetLineBounds": ( - b"v^{__CFString=}{CFRange=qq}^q^q^q", - "", - { - "arguments": { - 2: {"type_modifier": "o"}, - 3: {"type_modifier": "o"}, - 4: {"type_modifier": "o"}, - } - }, - ), - "CFTimeZoneCopyAbbreviation": ( - b"^{__CFString=}^{__CFTimeZone=}d", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFFileSecurityGetGroup": ( - b"Z^{__CFFileSecurity=}^I", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CFCharacterSetGetPredefined": (b"^{__CFCharacterSet=}q",), - "CFArrayRemoveValueAtIndex": (b"v^{__CFArray=}q",), - "CFStringGetSmallestEncoding": (b"I^{__CFString=}",), - "CFTreeAppendChild": (b"v^{__CFTree=}^{__CFTree=}",), - "CFURLCreatePropertyFromResource": ( - b"@^{__CFAllocator=}^{__CFURL=}^{__CFString=}^i", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"type_modifier": "o"}}, - }, - ), - "CFURLCopyHostName": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAbsoluteTimeGetDayOfWeek": (b"id^{__CFTimeZone=}",), - "CFSwapInt64HostToLittle": (b"QQ",), - "CFArrayExchangeValuesAtIndices": (b"v^{__CFArray=}qq",), - "CFTimeZoneGetTypeID": (b"Q",), - "CFRunLoopObserverCreate": ( - b"^{__CFRunLoopObserver=}^{__CFAllocator=}QZq^?^{CFRunLoopObserverContext=q^v^?^?^?}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFRunLoopObserver=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFRunLoopTimerGetTolerance": (b"d^{__CFRunLoopTimer=}",), - "CFBinaryHeapCreateCopy": ( - b"^{__CFBinaryHeap=}^{__CFAllocator=}q^{__CFBinaryHeap=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateFromExternalRepresentation": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFData=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFTimeZoneResetSystem": (b"v",), - "CFStringNormalize": (b"v^{__CFString=}q",), - "CFRunLoopContainsSource": ( - b"Z^{__CFRunLoop=}^{__CFRunLoopSource=}^{__CFString=}", - ), - "CFLocaleCreateCanonicalLanguageIdentifierFromString": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopGetTypeID": (b"Q",), - "CFDictionaryApplyFunction": ( - b"v^{__CFDictionary=}^?@", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - } - } - }, - ), - "CFLocaleGetLanguageCharacterDirection": (b"q^{__CFString=}",), - "CFStringCreateArrayWithFindResults": ( - b"^{__CFArray=}^{__CFAllocator=}^{__CFString=}^{__CFString=}{CFRange=qq}Q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFArrayGetTypeID": (b"Q",), - "CFNumberFormatterSetFormat": (b"v^{__CFNumberFormatter=}^{__CFString=}",), - "CFStreamCreatePairWithSocket": ( - b"v^{__CFAllocator=}i^^{__CFReadStream=}^^{__CFWriteStream=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {2: {"type_modifier": "o"}, 3: {"type_modifier": "o"}}, - }, - ), - "CFBitVectorCreateMutableCopy": ( - b"^{__CFBitVector=}^{__CFAllocator=}q^{__CFBitVector=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFPreferencesGetAppBooleanValue": ( - b"Z^{__CFString=}^{__CFString=}^Z", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFSocketSetAddress": (b"q^{__CFSocket=}^{__CFData=}",), - "CFRunLoopCopyAllModes": ( - b"^{__CFArray=}^{__CFRunLoop=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCreateStringByReplacingPercentEscapesUsingEncoding": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}^{__CFString=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopRun": (b"v",), - "CFPreferencesGetAppIntegerValue": ( - b"q^{__CFString=}^{__CFString=}^Z", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CFMessagePortSetName": (b"Z^{__CFMessagePort=}^{__CFString=}",), - "CFDateFormatterCreate": ( - b"^{__CFDateFormatter=}^{__CFAllocator=}^{__CFLocale=}qq", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFUUIDCreateString": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFUUID=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFNumberFormatterCreate": ( - b"^{__CFNumberFormatter=}^{__CFAllocator=}^{__CFLocale=}q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFXMLParserGetStatusCode": (b"q^{__CFXMLParser=}",), - "CFCalendarGetMinimumRangeOfUnit": (b"{CFRange=qq}^{__CFCalendar=}Q",), - "CFBitVectorCreateCopy": ( - b"^{__CFBitVector=}^{__CFAllocator=}^{__CFBitVector=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFTimeZoneGetSecondsFromGMT": (b"d^{__CFTimeZone=}d",), - "CFRunLoopTimerDoesRepeat": (b"Z^{__CFRunLoopTimer=}",), - "CFCharacterSetCreateInvertedSet": ( - b"^{__CFCharacterSet=}^{__CFAllocator=}^{__CFCharacterSet=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetParagraphBounds": ( - b"v^{__CFString=}{CFRange=qq}^q^q^q", - "", - { - "arguments": { - 2: {"type_modifier": "o"}, - 3: {"type_modifier": "o"}, - 4: {"type_modifier": "o"}, - } - }, - ), - "CFStringGetSystemEncoding": (b"I",), - "CFBundleCopyResourceURLsOfTypeInDirectory": ( - b"^{__CFArray=}^{__CFURL=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAttributedStringCreateMutableCopy": ( - b"^{__CFAttributedString=}^{__CFAllocator=}q^{__CFAttributedString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringTokenizerGetCurrentSubTokens": ( - b"q^{__CFStringTokenizer=}^{CFRange=qq}q^{__CFArray=}", - "", - { - "arguments": { - 1: { - "c_array_length_in_result": True, - "c_array_length_in_arg": 2, - "type_modifier": "o", - } - } - }, - ), - "CFBundleCopyBundleURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFXMLNodeGetInfoPtr": (b"^v^{__CFXMLNode=}",), - "CFSocketCreateConnectedToSocketSignature": ( - b"^{__CFSocket=}^{__CFAllocator=}^{CFSocketSignature=iii^{__CFData=}}Q^?^{CFSocketContext=q^v^?^?^?}d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFSocket=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^{__CFData=}"}, - 3: {"type": b"^v"}, - 4: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFURLCreateDataAndPropertiesFromResource": ( - b"Z^{__CFAllocator=}^{__CFURL=}^^{__CFData=}^^{__CFDictionary=}^{__CFArray=}^i", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: {"type_modifier": "o"}, - 3: {"type_modifier": "o"}, - 5: {"type_modifier": "o"}, - }, - }, - ), - "CFAbsoluteTimeGetWeekOfYear": (b"id^{__CFTimeZone=}",), - "CFDateFormatterSetProperty": (b"v^{__CFDateFormatter=}^{__CFString=}@",), - "CFTreeGetTypeID": (b"Q",), - "CFRunLoopStop": (b"v^{__CFRunLoop=}",), - "CFNotificationCenterPostNotification": ( - b"v^{__CFNotificationCenter=}^{__CFString=}@^{__CFDictionary=}Z", - ), - "CFXMLTreeCreateFromData": ( - b"^{__CFTree=}^{__CFAllocator=}^{__CFData=}^{__CFURL=}Qq", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleCopyBuiltInPlugInsURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFXMLTreeCreateWithDataFromURL": ( - b"^{__CFTree=}^{__CFAllocator=}^{__CFURL=}Qq", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFLocaleCreateComponentsFromLocaleIdentifier": ( - b"^{__CFDictionary=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFPropertyListIsValid": (b"Z@q",), - "CFNumberFormatterGetDecimalInfoForCurrencyCode": ( - b"Z^{__CFString=}^i^d", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "CFSocketEnableCallBacks": (b"v^{__CFSocket=}Q",), - "CFSetCreateCopy": ( - b"^{__CFSet=}^{__CFAllocator=}^{__CFSet=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFSwapInt64BigToHost": (b"QQ",), - "CFReadStreamGetTypeID": (b"Q",), - "CFFileDescriptorCreate": ( - b"^{__CFFileDescriptor=}^{__CFAllocator=}iZ^?^{CFFileDescriptorContext=q^v^?^?^?}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFFileDescriptor=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFBagCreateMutable": ( - b"^{__CFBag=}^{__CFAllocator=}q^{CFBagCallBacks=q^?^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLCreateWithString": ( - b"^{__CFURL=}^{__CFAllocator=}^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDictionaryAddValue": (b"v^{__CFDictionary=}@@",), - "CFFileSecurityCreateCopy": ( - b"^{__CFFileSecurity=}^{__CFAllocator=}^{__CFFileSecurity=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetRemoveCharactersInString": (b"v^{__CFCharacterSet=}^{__CFString=}",), - "CFRunLoopRemoveObserver": ( - b"v^{__CFRunLoop=}^{__CFRunLoopObserver=}^{__CFString=}", - ), - "CFAttributedStringGetMutableString": (b"^{__CFString=}^{__CFAttributedString=}",), - "CFDictionaryCreate": ( - b"^{__CFDictionary=}^{__CFAllocator=}^^v^^vq^{CFDictionaryKeyCallBacks=q^?^?^?^?^?}^{CFDictionaryValueCallBacks=q^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFNumberGetByteSize": (b"q^{__CFNumber=}",), - "CFXMLParserCopyErrorDescription": ( - b"^{__CFString=}^{__CFXMLParser=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetCreateWithBitmapRepresentation": ( - b"^{__CFCharacterSet=}^{__CFAllocator=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleGetValueForInfoDictionaryKey": (b"@^{__CFBundle=}^{__CFString=}",), - "CFWriteStreamUnscheduleFromRunLoop": ( - b"v^{__CFWriteStream=}^{__CFRunLoop=}^{__CFString=}", - ), - "CFAttributedStringCreateCopy": ( - b"^{__CFAttributedString=}^{__CFAllocator=}^{__CFAttributedString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorSetBitAtIndex": (b"v^{__CFBitVector=}qI",), - "CFReadStreamSetDispatchQueue": (b"v^{__CFReadStream=}@",), - "CFMessagePortSetDispatchQueue": (b"v^{__CFMessagePort=}@",), - "CFStringGetNameOfEncoding": (b"^{__CFString=}I",), - "CFBitVectorSetAllBits": (b"v^{__CFBitVector=}I",), - "CFSocketGetContext": (b"v^{__CFSocket=}^{CFSocketContext=q^v^?^?^?}",), - "CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier": (b"I^{__CFString=}",), - "CFXMLParserGetLineNumber": (b"q^{__CFXMLParser=}",), - "CFTimeZoneGetDaylightSavingTimeOffset": (b"d^{__CFTimeZone=}d",), - "CFPreferencesAddSuitePreferencesToApp": (b"v^{__CFString=}^{__CFString=}",), - "CFURLGetFileSystemRepresentation": ( - b"Z^{__CFURL=}Z^tq", - "", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type_modifier": "o", - "c_array_length_in_arg": 3, - } - } - }, - ), - "CFSetApplyFunction": ( - b"v^{__CFSet=}^?@", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"@"}, 1: {"type": b"@"}}, - }, - "callable_retained": False, - } - } - }, - ), - "CFStringCapitalize": (b"v^{__CFString=}^{__CFLocale=}",), - "CFBinaryHeapGetMinimumIfPresent": ( - b"Z^{__CFBinaryHeap=}^@", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CFURLCopyPathExtension": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFLocaleCopyISOCountryCodes": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFLocaleCreateCopy": ( - b"^{__CFLocale=}^{__CFAllocator=}^{__CFLocale=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFURLEnumeratorSkipDescendents": (b"v^{__CFURLEnumerator=}",), - "CFBinaryHeapAddValue": (b"v^{__CFBinaryHeap=}@",), - "CFBinaryHeapGetValues": (b"v^{__CFBinaryHeap=}^^v",), - "CFDateFormatterGetAbsoluteTimeFromString": ( - b"Z^{__CFDateFormatter=}^{__CFString=}^{CFRange=qq}^d", - "", - {"arguments": {2: {"type_modifier": "N"}, 3: {"type_modifier": "o"}}}, - ), - "CFBundleIsArchitectureLoadable": (b"Zi",), - "CFTreeSortChildren": ( - b"v^{__CFTree=}^?@", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - } - } - }, - ), - "CFURLCopyResourcePropertiesForKeys": ( - b"^{__CFDictionary=}^{__CFURL=}^{__CFArray=}^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - }, - }, - ), - "CFNumberCompare": (b"q^{__CFNumber=}^{__CFNumber=}^v",), - "CFURLHasDirectoryPath": (b"Z^{__CFURL=}",), - "CFSwapInt16HostToBig": (b"SS",), - "CFXMLCreateStringByEscapingEntities": ( - b"^{__CFString=}^{__CFAllocator=}^{__CFString=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFPreferencesSetMultiple": ( - b"v^{__CFDictionary=}^{__CFArray=}^{__CFString=}^{__CFString=}^{__CFString=}", - ), - "CFBagGetValue": (b"@^{__CFBag=}@",), - "CFBundleGetBundleWithIdentifier": (b"^{__CFBundle=}^{__CFString=}",), - "CFMakeCollectable": (b"@@",), - "CFSetGetTypeID": (b"Q",), - "CFStringAppendFormat": ( - b"v^{__CFString=}^{__CFDictionary=}^{__CFString=}", - "", - {"arguments": {2: {"printf_format": True}}, "variadic": True}, - ), - "CFNumberGetValue": (b"Z^{__CFNumber=}q^v",), - "CFStringTokenizerSetString": ( - b"v^{__CFStringTokenizer=}^{__CFString=}{CFRange=qq}", - ), - "CFRunLoopGetMain": (b"^{__CFRunLoop=}",), - "CFDictionaryRemoveAllValues": (b"v^{__CFDictionary=}",), - "CFPropertyListCreateDeepCopy": ( - b"@^{__CFAllocator=}@Q", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFUUIDGetTypeID": (b"Q",), - "CFNotificationCenterPostNotificationWithOptions": ( - b"v^{__CFNotificationCenter=}^{__CFString=}@^{__CFDictionary=}Q", - ), - "CFStringLowercase": (b"v^{__CFString=}^{__CFLocale=}",), - "CFCalendarSetMinimumDaysInFirstWeek": (b"v^{__CFCalendar=}q",), - "CFRetain": (b"@@",), - "CFStringGetCharacters": ( - b"v^{__CFString=}{CFRange=qq}^T", - "", - {"arguments": {2: {"c_array_length_in_arg": 1, "type_modifier": "o"}}}, - ), - "CFTimeZoneGetName": (b"^{__CFString=}^{__CFTimeZone=}",), - "CFURLCopyStrictPath": ( - b"^{__CFString=}^{__CFURL=}^Z", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "o"}}, - }, - ), - "CFBundleIsExecutableLoaded": (b"Z^{__CFBundle=}",), - "CFArrayAppendArray": (b"v^{__CFArray=}^{__CFArray=}{CFRange=qq}",), - "CFNumberFormatterGetTypeID": (b"Q",), - "CFDateGetTypeID": (b"Q",), - "CFPreferencesCopyMultiple": ( - b"^{__CFDictionary=}^{__CFArray=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetTypeID": (b"Q",), - "CFBinaryHeapGetTypeID": (b"Q",), - "CFTimeZoneCopyLocalizedName": ( - b"^{__CFString=}^{__CFTimeZone=}q^{__CFLocale=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCalendarCopyLocale": ( - b"^{__CFLocale=}^{__CFCalendar=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFFileDescriptorDisableCallBacks": (b"v^{__CFFileDescriptor=}Q",), - "CFBundleLoadExecutableAndReturnError": ( - b"Z^{__CFBundle=}^^{__CFError=}", - "", - { - "arguments": { - 1: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CFNumberFormatterCreateNumberFromString": ( - b"^{__CFNumber=}^{__CFAllocator=}^{__CFNumberFormatter=}^{__CFString=}^{CFRange=qq}Q", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"type_modifier": "N"}}, - }, - ), - "CFAttributedStringGetAttribute": ( - b"@^{__CFAttributedString=}q^{__CFString=}^{CFRange=qq}", - "", - {"arguments": {3: {"type_modifier": "o"}}}, - ), - "CFURLCopyLastPathComponent": ( - b"^{__CFString=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleCopyResourcesDirectoryURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopGetCurrent": (b"^{__CFRunLoop=}",), - "CFDateFormatterCreateDateFromString": ( - b"^{__CFDate=}^{__CFAllocator=}^{__CFDateFormatter=}^{__CFString=}^{CFRange=qq}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"type_modifier": "N"}}, - }, - ), - "CFURLEnumeratorGetDescendentLevel": (b"q^{__CFURLEnumerator=}",), - "CFStringGetSurrogatePairForLongCharacter": ( - b"ZI^T", - "", - {"arguments": {1: {"c_array_of_fixed_length": 2, "type_modifier": "o"}}}, - ), - "CFBagApplyFunction": ( - b"v^{__CFBag=}^?@", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"@"}, 1: {"type": b"@"}}, - }, - "callable_retained": False, - } - } - }, - ), - "CFBundleCopySharedSupportURL": ( - b"^{__CFURL=}^{__CFBundle=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFCharacterSetCreateWithCharactersInString": ( - b"^{__CFCharacterSet=}^{__CFAllocator=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorGetTypeID": (b"Q",), - "CFPreferencesCopyKeyList": ( - b"^{__CFArray=}^{__CFString=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDateFormatterGetTypeID": (b"Q",), - "CFRunLoopSourceGetContext": ( - b"v^{__CFRunLoopSource=}^{CFRunLoopSourceContext=q^v^?^?^?^?^?^?^?^?}", - ), - "CFBundleGetAllBundles": (b"^{__CFArray=}",), - "CFFileSecuritySetGroupUUID": (b"Z^{__CFFileSecurity=}^{__CFUUID=}",), - "CFCharacterSetCreateMutableCopy": ( - b"^{__CFCharacterSet=}^{__CFAllocator=}^{__CFCharacterSet=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringGetRangeOfComposedCharactersAtIndex": (b"{CFRange=qq}^{__CFString=}q",), - "CFAttributedStringBeginEditing": (b"v^{__CFAttributedString=}",), - "CFNumberFormatterGetFormat": (b"^{__CFString=}^{__CFNumberFormatter=}",), - "CFErrorGetTypeID": (b"Q",), - "CFURLCopyParameterString": ( - b"^{__CFString=}^{__CFURL=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFAttributedStringGetAttributesAndLongestEffectiveRange": ( - b"^{__CFDictionary=}^{__CFAttributedString=}q{CFRange=qq}^{CFRange=qq}", - "", - {"arguments": {3: {"type_modifier": "o"}}}, - ), - "CFCopyDescription": ( - b"^{__CFString=}@", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFDataDeleteBytes": (b"v^{__CFData=}{CFRange=qq}",), - "CFWriteStreamGetError": (b"{CFStreamError=qi}^{__CFWriteStream=}",), - "CFURLCreateResourcePropertiesForKeysFromBookmarkData": ( - b"^{__CFDictionary=}^{__CFAllocator=}^{__CFArray=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBitVectorGetFirstIndexOfBit": (b"q^{__CFBitVector=}{CFRange=qq}I",), - "CFCharacterSetCreateCopy": ( - b"^{__CFCharacterSet=}^{__CFAllocator=}^{__CFCharacterSet=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFStringCreateMutableWithExternalCharactersNoCopy": ( - b"^{__CFString=}^{__CFAllocator=}^Tqq^{__CFAllocator=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}, - }, - ), - "CFRunLoopCopyCurrentMode": ( - b"^{__CFString=}^{__CFRunLoop=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFBundleGetPackageInfo": ( - b"v^{__CFBundle=}^I^I", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "CFCalendarSetFirstWeekday": (b"v^{__CFCalendar=}q",), - "CFStringGetFastestEncoding": (b"I^{__CFString=}",), - "CFSocketIsValid": (b"Z^{__CFSocket=}",), - "CFTreeGetChildren": ( - b"v^{__CFTree=}^^{__CFTree=}", - "", - {"arguments": {1: {"c_array_of_variable_length": True, "type_modifier": "o"}}}, - ), - "CFBundleGetLocalInfoDictionary": (b"^{__CFDictionary=}^{__CFBundle=}",), - "CFArrayBSearchValues": ( - b"q^{__CFArray=}{CFRange=qq}@^?@", - "", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - } - } - }, - ), - "CFTreeGetNextSibling": (b"^{__CFTree=}^{__CFTree=}",), - "CFMessagePortGetTypeID": (b"Q",), - "CFBagGetCount": (b"q^{__CFBag=}",), - "CFBagRemoveAllValues": (b"v^{__CFBag=}",), - "CFCharacterSetCreateBitmapRepresentation": ( - b"^{__CFData=}^{__CFAllocator=}^{__CFCharacterSet=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFXMLParserGetDocument": (b"^v^{__CFXMLParser=}",), - "CFXMLNodeGetTypeCode": (b"q^{__CFXMLNode=}",), - "CFArrayGetValues": ( - b"v^{__CFArray=}{CFRange=qq}^@", - "", - {"arguments": {2: {"c_array_length_in_arg": 1, "type_modifier": "o"}}}, - ), - "CFCharacterSetIsSupersetOfSet": (b"Z^{__CFCharacterSet=}^{__CFCharacterSet=}",), - "CFRunLoopObserverGetTypeID": (b"Q",), - "CFAbsoluteTimeGetGregorianDate": (b"{CFGregorianDate=iccccd}d^{__CFTimeZone=}",), - "CFNotificationCenterRemoveObserver": ( - b"v^{__CFNotificationCenter=}@^{__CFString=}@", - ), - "CFCalendarSetTimeZone": (b"v^{__CFCalendar=}^{__CFTimeZone=}",), - "CFSetCreateMutableCopy": ( - b"^{__CFSet=}^{__CFAllocator=}q^{__CFSet=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFXMLTreeCreateWithNode": ( - b"^{__CFTree=}^{__CFAllocator=}^{__CFXMLNode=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFRunLoopTimerGetOrder": (b"q^{__CFRunLoopTimer=}",), - "CFTreeCreate": ( - b"^{__CFTree=}^{__CFAllocator=}^{CFTreeContext=q^v^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFPreferencesCopyAppValue": ( - b"@^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CFXMLNodeGetString": (b"^{__CFString=}^{__CFXMLNode=}",), - "CFSocketCreateWithSocketSignature": ( - b"^{__CFSocket=}^{__CFAllocator=}^{CFSocketSignature=iii^{__CFData=}}Q^?^{CFSocketContext=q^v^?^?^?}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{__CFSocket=}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^{__CFData=}"}, - 3: {"type": b"^v"}, - 4: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CFURLEnumeratorCreateForDirectoryURL": ( - b"^{__CFURLEnumerator=}^{__CFAllocator=}^{__CFURL=}Q^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), -} -aliases = { - "CGFLOAT_EPSILON": "DBL_EPSILON", - "CFDateFormatterKey": "CFStringRef", - "CFNumberFormatterKey": "CFStringRef", - "CGFLOAT_MIN": "DBL_MIN", - "CF_TYPED_EXTENSIBLE_ENUM": "_CF_TYPED_EXTENSIBLE_ENUM", - "CF_EXTENSIBLE_STRING_ENUM": "_CF_TYPED_EXTENSIBLE_ENUM", - "CF_STRING_ENUM": "_CF_TYPED_ENUM", - "CFErrorDomain": "CFStringRef", - "CF_TYPED_ENUM": "_CF_TYPED_ENUM", - "CFRunLoopMode": "CFStringRef", - "kCFBookmarkResolutionWithoutMountingMask": "kCFURLBookmarkResolutionWithoutMountingMask", - "kCFBookmarkResolutionWithoutUIMask": "kCFURLBookmarkResolutionWithoutUIMask", - "CFCalendarIdentifier": "CFStringRef", - "CGFLOAT_TYPE": "double", - "kCFFileSecurityRemoveACL": "_FILESEC_REMOVE_ACL", - "CFXMLTreeRef": "CFTreeRef", - "CFStreamPropertyKey": "CFStringRef", - "CGFLOAT_MAX": "DBL_MAX", - "CFLocaleKey": "CFStringRef", - "CFNotificationName": "CFStringRef", - "CFLocaleIdentifier": "CFStringRef", -} -cftypes = [ - ("CFAllocatorRef", b"^{__CFAllocator=}", "CFAllocatorGetTypeID", None), - ("CFArrayRef", b"^{__CFArray=}", "CFArrayGetTypeID", "NSArray"), - ( - "CFAttributedStringRef", - b"^{__CFAttributedString=}", - "CFAttributedStringGetTypeID", - "__NSCFAttributedString,NSCFAttributedString", - ), - ("CFBagRef", b"^{__CFBag=}", "CFBagGetTypeID", None), - ("CFBinaryHeapRef", b"^{__CFBinaryHeap=}", "CFBinaryHeapGetTypeID", None), - ("CFBitVectorRef", b"^{__CFBitVector=}", "CFBitVectorGetTypeID", None), - ( - "CFBooleanRef", - b"^{__CFBoolean=}", - "CFBooleanGetTypeID", - "__NSCFBoolean,NSCFBoolean", - ), - ("CFBundleRef", b"^{__CFBundle=}", "CFBundleGetTypeID", None), - ( - "CFCalendarRef", - b"^{__CFCalendar=}", - "CFCalendarGetTypeID", - "__NSCFCalendar,NSCFCalendar", - ), - ( - "CFCharacterSetRef", - b"^{__CFCharacterSet=}", - "CFCharacterSetGetTypeID", - "__NSCFCharacterSet,NSCFCharacterSet", - ), - ("CFDataRef", b"^{__CFData=}", "CFDataGetTypeID", "__NSCFData,NSCFData"), - ("CFDateFormatterRef", b"^{__CFDateFormatter=}", "CFDateFormatterGetTypeID", None), - ("CFDateRef", b"^{__CFDate=}", "CFDateGetTypeID", "__NSCFDate,NSCFDate,__NSDate"), - ("CFDictionaryRef", b"^{__CFDictionary=}", "CFDictionaryGetTypeID", "NSDictionary"), - ("CFErrorRef", b"^{__CFError=}", "CFErrorGetTypeID", "__NSCFError,NSCFError"), - ( - "CFFileDescriptorRef", - b"^{__CFFileDescriptor=}", - "CFFileDescriptorGetTypeID", - None, - ), - ( - "CFFileSecurityRef", - b"^{__CFFileSecurity=}", - "CFFileSecurityGetTypeID", - "__NSFileSecurity", - ), - ("CFLocaleRef", b"^{__CFLocale=}", "CFLocaleGetTypeID", "__NSCFLocale,NSCFLocale"), - ("CFMachPortRef", b"^{__CFMachPort=}", "CFMachPortGetTypeID", "NSMachPort"), - ("CFMessagePortRef", b"^{__CFMessagePort=}", "CFMessagePortGetTypeID", None), - ("CFMutableArrayRef", b"^{__CFArray=}", "CFArrayGetTypeID", "NSMutableArray"), - ( - "CFMutableAttributedStringRef", - b"^{__CFAttributedString=}", - "CFAttributedStringGetTypeID", - "__NSCFAttributedString,NSCFAttributedString", - ), - ("CFMutableBagRef", b"^{__CFBag=}", "CFBagGetTypeID", None), - ("CFMutableBitVectorRef", b"^{__CFBitVector=}", "CFBitVectorGetTypeID", None), - ( - "CFMutableCharacterSetRef", - b"^{__CFCharacterSet=}", - "CFCharacterSetGetTypeID", - None, - ), - ("CFMutableDataRef", b"^{__CFData=}", "CFDataGetTypeID", "NSMutableData"), - ( - "CFMutableDictionaryRef", - b"^{__CFDictionary=}", - "CFDictionaryGetTypeID", - "NSMutableDictionary", - ), - ("CFMutableSetRef", b"^{__CFSet=}", "CFSetGetTypeID", "NSMutableSet"), - ("CFMutableStringRef", b"@", "CFStringGetTypeID", "NSMutableString"), - ( - "CFNotificationCenterRef", - b"^{__CFNotificationCenter=}", - "CFNotificationCenterGetTypeID", - None, - ), - ("CFNullRef", b"^{__CFNull=}", "CFNullGetTypeID", "NSNull"), - ( - "CFNumberFormatterRef", - b"^{__CFNumberFormatter=}", - "CFNumberFormatterGetTypeID", - None, - ), - ("CFNumberRef", b"^{__CFNumber=}", "CFNumberGetTypeID", "__NSCFNumber,NSCFNumber"), - ( - "CFPlugInInstanceRef", - b"^{__CFPlugInInstance=}", - "CFPlugInInstanceGetTypeID", - None, - ), - ( - "CFReadStreamRef", - b"^{__CFReadStream=}", - "CFReadStreamGetTypeID", - "__NSCFInputStream,NSCFInputStream", - ), - ( - "CFRunLoopObserverRef", - b"^{__CFRunLoopObserver=}", - "CFRunLoopObserverGetTypeID", - None, - ), - ("CFRunLoopRef", b"^{__CFRunLoop=}", "CFRunLoopGetTypeID", None), - ("CFRunLoopSourceRef", b"^{__CFRunLoopSource=}", "CFRunLoopSourceGetTypeID", None), - ( - "CFRunLoopTimerRef", - b"^{__CFRunLoopTimer=}", - "CFRunLoopTimerGetTypeID", - "__NSCFTimer,NSCFTimer", - ), - ("CFSetRef", b"^{__CFSet=}", "CFSetGetTypeID", "NSSet"), - ("CFSocketRef", b"^{__CFSocket=}", "CFSocketGetTypeID", None), - ("CFStringRef", b"^{__CFString=}", "CFStringGetTypeID", "NSString"), - ( - "CFStringTokenizerRef", - b"^{__CFStringTokenizer=}", - "CFStringTokenizerGetTypeID", - None, - ), - ("CFTimeZoneRef", b"^{__CFTimeZone=}", "CFTimeZoneGetTypeID", "NSTimeZone"), - ("CFTreeRef", b"^{__CFTree=}", "CFTreeGetTypeID", None), - ("CFURLEnumeratorRef", b"^{__CFURLEnumerator=}", "CFURLEnumeratorGetTypeID", None), - ("CFURLRef", b"^{__CFURL=}", "CFURLGetTypeID", "NSURL"), - ("CFUUIDRef", b"^{__CFUUID=}", "CFUUIDGetTypeID", None), - ( - "CFUserNotificationRef", - b"^{__CFUserNotification=}", - "CFUserNotificationGetTypeID", - None, - ), - ( - "CFWriteStreamRef", - b"^{__CFWriteStream=}", - "CFWriteStreamGetTypeID", - "__NSCFOutputStream,NSCFOutputStream", - ), - ("CFXMLNodeRef", b"^{__CFXMLNode=}", "CFXMLNodeGetTypeID", None), - ("CFXMLParserRef", b"^{__CFXMLParser=}", "CFXMLParserGetTypeID", None), -] -expressions = { - "kCFISO8601DateFormatWithFullTime": "kCFISO8601DateFormatWithTime | kCFISO8601DateFormatWithColonSeparatorInTime | kCFISO8601DateFormatWithTimeZone | kCFISO8601DateFormatWithColonSeparatorInTimeZone", - "kCFISO8601DateFormatWithFullDate": "kCFISO8601DateFormatWithYear | kCFISO8601DateFormatWithMonth | kCFISO8601DateFormatWithDay | kCFISO8601DateFormatWithDashSeparatorInDate", - "kCFISO8601DateFormatWithInternetDateTime": "kCFISO8601DateFormatWithFullDate | kCFISO8601DateFormatWithFullTime", -} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_static.py b/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_static.py deleted file mode 100644 index b600526..0000000 --- a/write-message/venv/lib/python3.10/site-packages/CoreFoundation/_static.py +++ /dev/null @@ -1,107 +0,0 @@ -import CoreFoundation as _CF -import objc as _objc - - -# -# 'Emulation' for CFArray constructors -# -def _setup(): - NSArray = _objc.lookUpClass("NSArray") - NSMutableArray = _objc.lookUpClass("NSMutableArray") - - def CFArrayCreate(allocator, values, numvalues, callbacks): - assert callbacks is None - return NSArray.alloc().initWithArray_(values[:numvalues]) - - def CFArrayCreateMutable(allocator, capacity, callbacks): - assert callbacks is None - return NSMutableArray.alloc().init() - - return CFArrayCreate, CFArrayCreateMutable - - -CFArrayCreate, CFArrayCreateMutable = _setup() - -# CFDictionary emulation functions - - -def _setup(): - NSDictionary = _objc.lookUpClass("NSDictionary") - NSMutableDictionary = _objc.lookUpClass("NSMutableDictionary") - - def CFDictionaryCreate( - allocator, keys, values, numValues, keyCallbacks, valueCallbacks - ): - assert keyCallbacks is None - assert valueCallbacks is None - - keys = list(keys)[:numValues] - values = list(values)[:numValues] - - return NSDictionary.dictionaryWithDictionary_(dict(zip(keys, values))) - - def CFDictionaryCreateMutable(allocator, capacity, keyCallbacks, valueCallbacks): - assert keyCallbacks is None - assert valueCallbacks is None - - return NSMutableDictionary.dictionary() - - return CFDictionaryCreate, CFDictionaryCreateMutable - - -CFDictionaryCreate, CFDictionaryCreateMutable = _setup() - - -# CFSet emulation functions - - -def _setup(): - NSSet = _objc.lookUpClass("NSSet") - NSMutableSet = _objc.lookUpClass("NSMutableSet") - - def CFSetCreate(allocator, values, numvalues, callbacks): - assert callbacks is None - return NSSet.alloc().initWithArray_(values[:numvalues]) - - def CFSetCreateMutable(allocator, capacity, callbacks): - assert callbacks is None - return NSMutableSet.alloc().init() - - return CFSetCreate, CFSetCreateMutable - - -CFSetCreate, CFSetCreateMutable = _setup() - -kCFTypeArrayCallBacks = None -kCFTypeDictionaryKeyCallBacks = None -kCFTypeDictionaryValueCallBacks = None -kCFTypeSetCallBacks = None - - -# -# Implementation of a number of macro's in the CFBundle API -# - - -def CFCopyLocalizedString(key, comment): - return _CF.CFBundleCopyLocalizedString( - _CF.CFBundleGetMainBundle(), (key), (key), None - ) - - -def CFCopyLocalizedStringFromTable(key, tbl, comment): - return _CF.CFBundleCopyLocalizedString( - _CF.CFBundleGetMainBundle(), (key), (key), (tbl) - ) - - -def CFCopyLocalizedStringFromTableInBundle(key, tbl, bundle, comment): - return _CF.CFBundleCopyLocalizedString((bundle), (key), (key), (tbl)) - - -def CFCopyLocalizedStringWithDefaultValue(key, tbl, bundle, value, comment): - return _CF.CFBundleCopyLocalizedString((bundle), (key), (value), (tbl)) - - -def CFSTR(strval): - return _objc.lookUpClass("NSString").stringWithString_(strval) diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_Foundation.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/Foundation/_Foundation.cpython-310-darwin.so deleted file mode 100755 index be45c48..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/_Foundation.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__init__.py b/write-message/venv/lib/python3.10/site-packages/Foundation/__init__.py deleted file mode 100644 index a08b729..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Foundation/__init__.py +++ /dev/null @@ -1,196 +0,0 @@ -""" -Python mapping for the Foundation framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import CoreFoundation - import objc - from . import _Foundation, _metadata, _functiondefines, _context - from ._inlines import _inline_list_ - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Foundation", - frameworkIdentifier="com.apple.Foundation", - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/Foundation.framework" - ), - globals_dict=globals(), - inline_list=_inline_list_, - parents=( - _Foundation, - _functiondefines, - _context, - CoreFoundation, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Foundation._metadata"] - - objc.addConvenienceForClass( - "NSAttributedString", (("__len__", lambda self: self.length()),) - ) - - objc.addConvenienceForBasicMapping("NSMergeConflict", True) - objc.addConvenienceForBasicMapping("NSUbiquitousKeyValueStore", False) - objc.addConvenienceForBasicMapping("NSUserDefaults", False) - - NSNull = objc.lookUpClass("NSNull") - - def nscache_getitem(self, key): - value = self.objectForKey_(key) - if value is None: - raise KeyError(key) - - elif value is NSNull.null(): - return None - - else: - return value - - def nscache_get(self, key, default=None): - value = self.objectForKey_(key) - if value is None: - return default - elif value is NSNull.null(): - return None - return value - - def nscache_setitem(self, key, value): - if value is None: - value = NSNull.null() - self.setObject_forKey_(value, key) - - objc.addConvenienceForClass( - "NSCache", - ( - ("__getitem__", nscache_getitem), - ("get", nscache_get), - ("__setitem__", nscache_setitem), - ("__delitem__", lambda self, key: self.removeObjectForKey_(key)), - ("clear", lambda self: self.removeAllObjects()), - ), - ) - - def hash_add(self, value): - if value is None: - value = NSNull.null() - self.addObject_(value) - - def hash_contains(self, value): - if value is None: - value = NSNull.null() - return self.containsObject_(value) - - def hash_remove(self, value): - if value is None: - value = NSNull.null() - self.removeObject_(value) - - def hash_pop(self): - value = self.anyObject() - self.removeObject_(value) - if value is NSNull.null(): - return None - else: - return value - - objc.addConvenienceForClass( - "NSHashTable", - ( - ("__len__", lambda self: self.count()), - ("clear", lambda self: self.removeAllObjects()), - ("__iter__", lambda self: iter(self.objectEnumerator())), - ("add", hash_add), - ("remove", hash_remove), - ("__contains__", hash_contains), - ("pop", hash_pop), - ), - ) - - objc.addConvenienceForClass( - "NSIndexPath", (("__len__", lambda self: self.count()),) - ) - - if sys.maxsize > 2**32: - NSNotFound = 0x7FFFFFFFFFFFFFFF - else: - NSNotFound = 0x7FFFFFFF - - def indexset_iter(self): - value = self.firstIndex() - while value != NSNotFound: - yield value - value = self.indexGreaterThanIndex_(value) - - def indexset_reversed(self): - value = self.lastIndex() - while value != NSNotFound: - yield value - value = self.indexLessThanIndex_(value) - - NSIndexSet = objc.lookUpClass("NSIndexSet") - - def indexset_eq(self, other): - if not isinstance(other, NSIndexSet): - return False - - return self.isEqualToIndexSet_(other) - - def indexset_ne(self, other): - if not isinstance(other, NSIndexSet): - return True - - return not self.isEqualToIndexSet_(other) - - def indexset_contains(self, value): - try: - return self.containsIndex_(value) - except ValueError: - return False - - objc.addConvenienceForClass( - "NSIndexSet", - ( - ("__len__", lambda self: self.count()), - ("__iter__", indexset_iter), - ("__reversed__", indexset_reversed), - ("__eq__", indexset_eq), - ("__ne__", indexset_ne), - ("__contains__", indexset_contains), - ), - ) - - # Add 'update', '-=', '+=' - objc.addConvenienceForClass( - "NSMutableIndexSet", - ( - ("clear", lambda self: self.removeAllIndexes()), - ("add", lambda self, value: self.addIndex_(value)), - ("remove", lambda self, value: self.removeIndex_(value)), - ), - ) - - objc.addConvenienceForClass( - "NSLocale", (("__getitem__", lambda self, key: self.objectForKey_(key)),) - ) - - -globals().pop("_setup")() - -from objc import NSDecimal, YES, NO # isort:skip # noqa: E402, F401 - -import Foundation._context # isort:skip # noqa: E402 -import Foundation._functiondefines # isort:skip # noqa: E402 -import Foundation._nsindexset # isort:skip # noqa: E402 -import Foundation._nsobject # isort:skip # noqa: E402, F401 -import Foundation._nsurl # isort:skip # noqa: E402, F401 diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 898e854..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_context.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_context.cpython-310.pyc deleted file mode 100644 index 3b1674b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_context.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_functiondefines.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_functiondefines.cpython-310.pyc deleted file mode 100644 index 68b1281..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_functiondefines.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index 3a11dea..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsindexset.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsindexset.cpython-310.pyc deleted file mode 100644 index 710e9d4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsindexset.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsobject.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsobject.cpython-310.pyc deleted file mode 100644 index 59f22fc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsobject.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsurl.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsurl.cpython-310.pyc deleted file mode 100644 index 44eb728..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/__pycache__/_nsurl.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_context.py b/write-message/venv/lib/python3.10/site-packages/Foundation/_context.py deleted file mode 100644 index 49bd337..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Foundation/_context.py +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation - - -class NSDisabledAutomaticTermination: - def __init__(self, reason): - self._reason = reason - self._info = Foundation.NSProcessInfo.processInfo() - - def __enter__(self): - self._info.disableAutomaticTermination_(self._reason) - - def __exit__(self, exc_type, exc_val, exc_tb): - self._info.enableAutomaticTermination_(self._reason) - return False - - -class NSDisabledSuddenTermination: - def __init__(self): - self._info = Foundation.NSProcessInfo.processInfo() - - def __enter__(self): - self._info.disableSuddenTermination() - - def __exit__(self, exc_type, exc_val, exc_tb): - self._info.enableSuddenTermination() - return False diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_functiondefines.py b/write-message/venv/lib/python3.10/site-packages/Foundation/_functiondefines.py deleted file mode 100644 index 89a18c1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Foundation/_functiondefines.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Port of "function defines". -""" -import Foundation as _Foundation - - -def NSLocalizedString(key, comment): - return _Foundation.NSBundle.mainBundle().localizedStringForKey_value_table_( - key, "", None - ) - - -def NSLocalizedStringFromTable(key, tbl, comment): - return _Foundation.NSBundle.mainBundle().localizedStringForKey_value_table_( - key, "", tbl - ) - - -def NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment): - return bundle.localizedStringForKey_value_table_(key, "", tbl) - - -def NSLocalizedStringWithDefaultValue(key, tbl, bundle, val, comment): - return bundle.localizedStringForKey_value_table_(key, val, tbl) - - -def NSLocalizedAttributedString(key, comment): - return ( - _Foundation.NSBundle.mainBundle().localizedAttributedStringForKey_value_table_( - key, "", None - ) - ) - - -def NSLocalizedAttributedStringFromTable(key, tbl, comment): - return _Foundation.NSBundle.mainBundle.localizedAttributedStringForKey_value_table_( - key, "", tbl - ) - - -def NSLocalizedAttributedStringFromTableInBundle(key, tbl, bundle, comment): - return bundle.localizedAttributedStringForKey_value_table_(key, "", tbl) - - -def NSLocalizedAttributedStringWithDefaultValue(key, tbl, bundle, val, comment): - return bundle.localizedAttributedStringForKey_value_table_(key, val, tbl) - - -def MIN(a, b): - if a < b: - return a - else: - return b - - -def MAX(a, b): - if a < b: - return b - else: - return a - - -ABS = abs diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_inlines.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/Foundation/_inlines.cpython-310-darwin.so deleted file mode 100755 index 422f6b1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Foundation/_inlines.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Foundation/_metadata.py deleted file mode 100644 index 08985d1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Foundation/_metadata.py +++ /dev/null @@ -1,11650 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sun Jul 30 12:22:13 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -misc.update( - { - "NSEdgeInsets": objc.createStructType( - "Foundation.NSEdgeInsets", - b"{NSEdgeInsets=dddd}", - ["top", "left", "bottom", "right"], - ), - "NSHashEnumerator": objc.createStructType( - "Foundation.NSHashEnumerator", - b"{NSHashEnumerator=QQ^v}", - ["_pi", "_si", "_bs"], - ), - "NSAffineTransformStruct": objc.createStructType( - "Foundation.NSAffineTransformStruct", - b"{NSAffineTransformStruct=dddddd}", - ["m11", "m12", "m21", "m22", "tX", "tY"], - ), - "NSOperatingSystemVersion": objc.createStructType( - "Foundation.NSOperatingSystemVersion", - b"{NSOperatingSystemVersion=qqq}", - ["majorVersion", "minorVersion", "patchVersion"], - ), - "NSZone": objc.createStructType("Foundation.NSZone", b"{_NSZone=}", []), - "NSDecimal": objc.createStructType( - "Foundation.NSDecimal", - b"{NSDecimal=b8b4b1b1b18[8S]}", - [ - "_exponent", - "_length", - "_isNegative", - "_isCompact", - "_reserved", - "_mantissa", - ], - ), - "NSSwappedDouble": objc.createStructType( - "Foundation.NSSwappedDouble", b"{NSSwappedDouble=Q}", ["v"] - ), - "NSMapEnumerator": objc.createStructType( - "Foundation.NSMapEnumerator", - b"{NSMapEnumerator=QQ^v}", - ["_pi", "_si", "_bs"], - ), - "NSSwappedFloat": objc.createStructType( - "Foundation.NSSwappedFloat", b"{NSSwappedFloat=I}", ["v"] - ), - "NSRange": objc.createStructType( - "Foundation.NSRange", b"{_NSRange=QQ}", ["location", "length"] - ), - } -) -constants = """$NSAMPMDesignation$NSAlternateDescriptionAttributeName$NSAppleEventManagerWillProcessFirstEventNotification$NSAppleEventTimeOutDefault@d$NSAppleEventTimeOutNone@d$NSAppleScriptErrorAppName$NSAppleScriptErrorBriefMessage$NSAppleScriptErrorMessage$NSAppleScriptErrorNumber$NSAppleScriptErrorRange$NSArgumentDomain$NSAssertionHandlerKey$NSAverageKeyValueOperator$NSBuddhistCalendar$NSBundleDidLoadNotification$NSBundleResourceRequestLoadingPriorityUrgent@d$NSBundleResourceRequestLowDiskSpaceNotification$NSCalendarDayChangedNotification$NSCalendarIdentifierBuddhist$NSCalendarIdentifierChinese$NSCalendarIdentifierCoptic$NSCalendarIdentifierEthiopicAmeteAlem$NSCalendarIdentifierEthiopicAmeteMihret$NSCalendarIdentifierGregorian$NSCalendarIdentifierHebrew$NSCalendarIdentifierISO8601$NSCalendarIdentifierIndian$NSCalendarIdentifierIslamic$NSCalendarIdentifierIslamicCivil$NSCalendarIdentifierIslamicTabular$NSCalendarIdentifierIslamicUmmAlQura$NSCalendarIdentifierJapanese$NSCalendarIdentifierPersian$NSCalendarIdentifierRepublicOfChina$NSCharacterConversionException$NSChineseCalendar$NSClassDescriptionNeededForClassNotification$NSCocoaErrorDomain$NSConnectionDidDieNotification$NSConnectionDidInitializeNotification$NSConnectionReplyMode$NSCountKeyValueOperator$NSCurrencySymbol$NSCurrentLocaleDidChangeNotification$NSDateFormatString$NSDateTimeOrdering$NSDeallocateZombies@Z$NSDebugDescriptionErrorKey$NSDebugEnabled@Z$NSDecimalDigits$NSDecimalNumberDivideByZeroException$NSDecimalNumberExactnessException$NSDecimalNumberOverflowException$NSDecimalNumberUnderflowException$NSDecimalSeparator$NSDefaultRunLoopMode$NSDestinationInvalidException$NSDidBecomeSingleThreadedNotification$NSDistinctUnionOfArraysKeyValueOperator$NSDistinctUnionOfObjectsKeyValueOperator$NSDistinctUnionOfSetsKeyValueOperator$NSEarlierTimeDesignations$NSEdgeInsetsZero@{NSEdgeInsets=dddd}$NSErrorFailingURLStringKey$NSExtensionHostDidBecomeActiveNotification$NSExtensionHostDidEnterBackgroundNotification$NSExtensionHostWillEnterForegroundNotification$NSExtensionHostWillResignActiveNotification$NSExtensionItemAttachmentsKey$NSExtensionItemAttributedContentTextKey$NSExtensionItemAttributedTitleKey$NSExtensionItemsAndErrorsKey$NSExtensionJavaScriptFinalizeArgumentKey$NSExtensionJavaScriptPreprocessingResultsKey$NSFTPPropertyActiveTransferModeKey$NSFTPPropertyFTPProxy$NSFTPPropertyFileOffsetKey$NSFTPPropertyUserLoginKey$NSFTPPropertyUserPasswordKey$NSFailedAuthenticationException$NSFileAppendOnly$NSFileBusy$NSFileCreationDate$NSFileDeviceIdentifier$NSFileExtensionHidden$NSFileGroupOwnerAccountID$NSFileGroupOwnerAccountName$NSFileHFSCreatorCode$NSFileHFSTypeCode$NSFileHandleConnectionAcceptedNotification$NSFileHandleDataAvailableNotification$NSFileHandleNotificationDataItem$NSFileHandleNotificationFileHandleItem$NSFileHandleNotificationMonitorModes$NSFileHandleOperationException$NSFileHandleReadCompletionNotification$NSFileHandleReadToEndOfFileCompletionNotification$NSFileImmutable$NSFileManagerUnmountDissentingProcessIdentifierErrorKey$NSFileModificationDate$NSFileOwnerAccountID$NSFileOwnerAccountName$NSFilePathErrorKey$NSFilePosixPermissions$NSFileProtectionComplete$NSFileProtectionCompleteUnlessOpen$NSFileProtectionCompleteUntilFirstUserAuthentication$NSFileProtectionCompleteWhenUserInactive$NSFileProtectionKey$NSFileProtectionNone$NSFileReferenceCount$NSFileSize$NSFileSystemFileNumber$NSFileSystemFreeNodes$NSFileSystemFreeSize$NSFileSystemNodes$NSFileSystemNumber$NSFileSystemSize$NSFileType$NSFileTypeBlockSpecial$NSFileTypeCharacterSpecial$NSFileTypeDirectory$NSFileTypeRegular$NSFileTypeSocket$NSFileTypeSymbolicLink$NSFileTypeUnknown$NSFoundationVersionNumber@d$NSGenericException$NSGlobalDomain$NSGrammarCorrections$NSGrammarRange$NSGrammarUserDescription$NSGregorianCalendar$NSHTTPCookieComment$NSHTTPCookieCommentURL$NSHTTPCookieDiscard$NSHTTPCookieDomain$NSHTTPCookieExpires$NSHTTPCookieManagerAcceptPolicyChangedNotification$NSHTTPCookieManagerCookiesChangedNotification$NSHTTPCookieMaximumAge$NSHTTPCookieName$NSHTTPCookieOriginURL$NSHTTPCookiePath$NSHTTPCookiePort$NSHTTPCookieSameSiteLax$NSHTTPCookieSameSitePolicy$NSHTTPCookieSameSiteStrict$NSHTTPCookieSecure$NSHTTPCookieValue$NSHTTPCookieVersion$NSHTTPPropertyErrorPageDataKey$NSHTTPPropertyHTTPProxy$NSHTTPPropertyRedirectionHeadersKey$NSHTTPPropertyServerHTTPVersionKey$NSHTTPPropertyStatusCodeKey$NSHTTPPropertyStatusReasonKey$NSHangOnUncaughtException@Z$NSHebrewCalendar$NSHelpAnchorErrorKey$NSHourNameDesignations$NSISO8601Calendar$NSImageURLAttributeName$NSInconsistentArchiveException$NSIndianCalendar$NSInflectionAgreementArgumentAttributeName$NSInflectionAgreementConceptAttributeName$NSInflectionAlternativeAttributeName$NSInflectionConceptsKey$NSInflectionReferentConceptAttributeName$NSInflectionRuleAttributeName$NSInlinePresentationIntentAttributeName$NSInternalInconsistencyException$NSInternationalCurrencyString$NSInvalidArchiveOperationException$NSInvalidArgumentException$NSInvalidReceivePortException$NSInvalidSendPortException$NSInvalidUnarchiveOperationException$NSInvocationOperationCancelledException$NSInvocationOperationVoidResultException$NSIsNilTransformerName$NSIsNotNilTransformerName$NSIslamicCalendar$NSIslamicCivilCalendar$NSItemProviderErrorDomain$NSItemProviderPreferredImageSizeKey$NSJapaneseCalendar$NSKeepAllocationStatistics@Z$NSKeyValueChangeIndexesKey$NSKeyValueChangeKindKey$NSKeyValueChangeNewKey$NSKeyValueChangeNotificationIsPriorKey$NSKeyValueChangeOldKey$NSKeyedArchiveRootObjectKey$NSKeyedUnarchiveFromDataTransformerName$NSLanguageIdentifierAttributeName$NSLaterTimeDesignations$NSLinguisticTagAdjective$NSLinguisticTagAdverb$NSLinguisticTagClassifier$NSLinguisticTagCloseParenthesis$NSLinguisticTagCloseQuote$NSLinguisticTagConjunction$NSLinguisticTagDash$NSLinguisticTagDeterminer$NSLinguisticTagIdiom$NSLinguisticTagInterjection$NSLinguisticTagNoun$NSLinguisticTagNumber$NSLinguisticTagOpenParenthesis$NSLinguisticTagOpenQuote$NSLinguisticTagOrganizationName$NSLinguisticTagOther$NSLinguisticTagOtherPunctuation$NSLinguisticTagOtherWhitespace$NSLinguisticTagOtherWord$NSLinguisticTagParagraphBreak$NSLinguisticTagParticle$NSLinguisticTagPersonalName$NSLinguisticTagPlaceName$NSLinguisticTagPreposition$NSLinguisticTagPronoun$NSLinguisticTagPunctuation$NSLinguisticTagSchemeLanguage$NSLinguisticTagSchemeLemma$NSLinguisticTagSchemeLexicalClass$NSLinguisticTagSchemeNameType$NSLinguisticTagSchemeNameTypeOrLexicalClass$NSLinguisticTagSchemeScript$NSLinguisticTagSchemeTokenType$NSLinguisticTagSentenceTerminator$NSLinguisticTagVerb$NSLinguisticTagWhitespace$NSLinguisticTagWord$NSLinguisticTagWordJoiner$NSLoadedClasses$NSLocalNotificationCenterType$NSLocaleAlternateQuotationBeginDelimiterKey$NSLocaleAlternateQuotationEndDelimiterKey$NSLocaleCalendar$NSLocaleCollationIdentifier$NSLocaleCollatorIdentifier$NSLocaleCountryCode$NSLocaleCurrencyCode$NSLocaleCurrencySymbol$NSLocaleDecimalSeparator$NSLocaleExemplarCharacterSet$NSLocaleGroupingSeparator$NSLocaleIdentifier$NSLocaleLanguageCode$NSLocaleMeasurementSystem$NSLocaleQuotationBeginDelimiterKey$NSLocaleQuotationEndDelimiterKey$NSLocaleScriptCode$NSLocaleUsesMetricSystem$NSLocaleVariantCode$NSLocalizedDescriptionKey$NSLocalizedFailureErrorKey$NSLocalizedFailureReasonErrorKey$NSLocalizedRecoveryOptionsErrorKey$NSLocalizedRecoverySuggestionErrorKey$NSMachErrorDomain$NSMallocException$NSMarkdownSourcePositionAttributeName$NSMaximumKeyValueOperator$NSMetadataItemAcquisitionMakeKey$NSMetadataItemAcquisitionModelKey$NSMetadataItemAlbumKey$NSMetadataItemAltitudeKey$NSMetadataItemApertureKey$NSMetadataItemAppleLoopDescriptorsKey$NSMetadataItemAppleLoopsKeyFilterTypeKey$NSMetadataItemAppleLoopsLoopModeKey$NSMetadataItemAppleLoopsRootKeyKey$NSMetadataItemApplicationCategoriesKey$NSMetadataItemAttributeChangeDateKey$NSMetadataItemAudiencesKey$NSMetadataItemAudioBitRateKey$NSMetadataItemAudioChannelCountKey$NSMetadataItemAudioEncodingApplicationKey$NSMetadataItemAudioSampleRateKey$NSMetadataItemAudioTrackNumberKey$NSMetadataItemAuthorAddressesKey$NSMetadataItemAuthorEmailAddressesKey$NSMetadataItemAuthorsKey$NSMetadataItemBitsPerSampleKey$NSMetadataItemCFBundleIdentifierKey$NSMetadataItemCameraOwnerKey$NSMetadataItemCityKey$NSMetadataItemCodecsKey$NSMetadataItemColorSpaceKey$NSMetadataItemCommentKey$NSMetadataItemComposerKey$NSMetadataItemContactKeywordsKey$NSMetadataItemContentCreationDateKey$NSMetadataItemContentModificationDateKey$NSMetadataItemContentTypeKey$NSMetadataItemContentTypeTreeKey$NSMetadataItemContributorsKey$NSMetadataItemCopyrightKey$NSMetadataItemCountryKey$NSMetadataItemCoverageKey$NSMetadataItemCreatorKey$NSMetadataItemDateAddedKey$NSMetadataItemDeliveryTypeKey$NSMetadataItemDescriptionKey$NSMetadataItemDirectorKey$NSMetadataItemDisplayNameKey$NSMetadataItemDownloadedDateKey$NSMetadataItemDueDateKey$NSMetadataItemDurationSecondsKey$NSMetadataItemEXIFGPSVersionKey$NSMetadataItemEXIFVersionKey$NSMetadataItemEditorsKey$NSMetadataItemEmailAddressesKey$NSMetadataItemEncodingApplicationsKey$NSMetadataItemExecutableArchitecturesKey$NSMetadataItemExecutablePlatformKey$NSMetadataItemExposureModeKey$NSMetadataItemExposureProgramKey$NSMetadataItemExposureTimeSecondsKey$NSMetadataItemExposureTimeStringKey$NSMetadataItemFNumberKey$NSMetadataItemFSContentChangeDateKey$NSMetadataItemFSCreationDateKey$NSMetadataItemFSNameKey$NSMetadataItemFSSizeKey$NSMetadataItemFinderCommentKey$NSMetadataItemFlashOnOffKey$NSMetadataItemFocalLength35mmKey$NSMetadataItemFocalLengthKey$NSMetadataItemFontsKey$NSMetadataItemGPSAreaInformationKey$NSMetadataItemGPSDOPKey$NSMetadataItemGPSDateStampKey$NSMetadataItemGPSDestBearingKey$NSMetadataItemGPSDestDistanceKey$NSMetadataItemGPSDestLatitudeKey$NSMetadataItemGPSDestLongitudeKey$NSMetadataItemGPSDifferentalKey$NSMetadataItemGPSMapDatumKey$NSMetadataItemGPSMeasureModeKey$NSMetadataItemGPSProcessingMethodKey$NSMetadataItemGPSStatusKey$NSMetadataItemGPSTrackKey$NSMetadataItemGenreKey$NSMetadataItemHasAlphaChannelKey$NSMetadataItemHeadlineKey$NSMetadataItemISOSpeedKey$NSMetadataItemIdentifierKey$NSMetadataItemImageDirectionKey$NSMetadataItemInformationKey$NSMetadataItemInstantMessageAddressesKey$NSMetadataItemInstructionsKey$NSMetadataItemIsApplicationManagedKey$NSMetadataItemIsGeneralMIDISequenceKey$NSMetadataItemIsLikelyJunkKey$NSMetadataItemIsUbiquitousKey$NSMetadataItemKeySignatureKey$NSMetadataItemKeywordsKey$NSMetadataItemKindKey$NSMetadataItemLanguagesKey$NSMetadataItemLastUsedDateKey$NSMetadataItemLatitudeKey$NSMetadataItemLayerNamesKey$NSMetadataItemLensModelKey$NSMetadataItemLongitudeKey$NSMetadataItemLyricistKey$NSMetadataItemMaxApertureKey$NSMetadataItemMediaTypesKey$NSMetadataItemMeteringModeKey$NSMetadataItemMusicalGenreKey$NSMetadataItemMusicalInstrumentCategoryKey$NSMetadataItemMusicalInstrumentNameKey$NSMetadataItemNamedLocationKey$NSMetadataItemNumberOfPagesKey$NSMetadataItemOrganizationsKey$NSMetadataItemOrientationKey$NSMetadataItemOriginalFormatKey$NSMetadataItemOriginalSourceKey$NSMetadataItemPageHeightKey$NSMetadataItemPageWidthKey$NSMetadataItemParticipantsKey$NSMetadataItemPathKey$NSMetadataItemPerformersKey$NSMetadataItemPhoneNumbersKey$NSMetadataItemPixelCountKey$NSMetadataItemPixelHeightKey$NSMetadataItemPixelWidthKey$NSMetadataItemProducerKey$NSMetadataItemProfileNameKey$NSMetadataItemProjectsKey$NSMetadataItemPublishersKey$NSMetadataItemRecipientAddressesKey$NSMetadataItemRecipientEmailAddressesKey$NSMetadataItemRecipientsKey$NSMetadataItemRecordingDateKey$NSMetadataItemRecordingYearKey$NSMetadataItemRedEyeOnOffKey$NSMetadataItemResolutionHeightDPIKey$NSMetadataItemResolutionWidthDPIKey$NSMetadataItemRightsKey$NSMetadataItemSecurityMethodKey$NSMetadataItemSpeedKey$NSMetadataItemStarRatingKey$NSMetadataItemStateOrProvinceKey$NSMetadataItemStreamableKey$NSMetadataItemSubjectKey$NSMetadataItemTempoKey$NSMetadataItemTextContentKey$NSMetadataItemThemeKey$NSMetadataItemTimeSignatureKey$NSMetadataItemTimestampKey$NSMetadataItemTitleKey$NSMetadataItemTotalBitRateKey$NSMetadataItemURLKey$NSMetadataItemVersionKey$NSMetadataItemVideoBitRateKey$NSMetadataItemWhereFromsKey$NSMetadataItemWhiteBalanceKey$NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope$NSMetadataQueryDidFinishGatheringNotification$NSMetadataQueryDidStartGatheringNotification$NSMetadataQueryDidUpdateNotification$NSMetadataQueryGatheringProgressNotification$NSMetadataQueryIndexedLocalComputerScope$NSMetadataQueryIndexedNetworkScope$NSMetadataQueryLocalComputerScope$NSMetadataQueryLocalDocumentsScope$NSMetadataQueryNetworkScope$NSMetadataQueryResultContentRelevanceAttribute$NSMetadataQueryUbiquitousDataScope$NSMetadataQueryUbiquitousDocumentsScope$NSMetadataQueryUpdateAddedItemsKey$NSMetadataQueryUpdateChangedItemsKey$NSMetadataQueryUpdateRemovedItemsKey$NSMetadataQueryUserHomeScope$NSMetadataUbiquitousItemContainerDisplayNameKey$NSMetadataUbiquitousItemDownloadRequestedKey$NSMetadataUbiquitousItemDownloadingErrorKey$NSMetadataUbiquitousItemDownloadingStatusCurrent$NSMetadataUbiquitousItemDownloadingStatusDownloaded$NSMetadataUbiquitousItemDownloadingStatusKey$NSMetadataUbiquitousItemDownloadingStatusNotDownloaded$NSMetadataUbiquitousItemHasUnresolvedConflictsKey$NSMetadataUbiquitousItemIsDownloadedKey$NSMetadataUbiquitousItemIsDownloadingKey$NSMetadataUbiquitousItemIsExternalDocumentKey$NSMetadataUbiquitousItemIsSharedKey$NSMetadataUbiquitousItemIsUploadedKey$NSMetadataUbiquitousItemIsUploadingKey$NSMetadataUbiquitousItemPercentDownloadedKey$NSMetadataUbiquitousItemPercentUploadedKey$NSMetadataUbiquitousItemURLInLocalContainerKey$NSMetadataUbiquitousItemUploadingErrorKey$NSMetadataUbiquitousSharedItemCurrentUserPermissionsKey$NSMetadataUbiquitousSharedItemCurrentUserRoleKey$NSMetadataUbiquitousSharedItemMostRecentEditorNameComponentsKey$NSMetadataUbiquitousSharedItemOwnerNameComponentsKey$NSMetadataUbiquitousSharedItemPermissionsReadOnly$NSMetadataUbiquitousSharedItemPermissionsReadWrite$NSMetadataUbiquitousSharedItemRoleOwner$NSMetadataUbiquitousSharedItemRoleParticipant$NSMinimumKeyValueOperator$NSMonthNameArray$NSMorphologyAttributeName$NSMultipleUnderlyingErrorsKey$NSNegateBooleanTransformerName$NSNegativeCurrencyFormatString$NSNetServicesErrorCode$NSNetServicesErrorDomain$NSNextDayDesignations$NSNextNextDayDesignations$NSOSStatusErrorDomain$NSObjectInaccessibleException$NSObjectNotAvailableException$NSOldStyleException$NSOperationNotSupportedForKeyException$NSPOSIXErrorDomain$NSParseErrorException$NSPersianCalendar$NSPersonNameComponentDelimiter$NSPersonNameComponentFamilyName$NSPersonNameComponentGivenName$NSPersonNameComponentKey$NSPersonNameComponentMiddleName$NSPersonNameComponentNickname$NSPersonNameComponentPrefix$NSPersonNameComponentSuffix$NSPortDidBecomeInvalidNotification$NSPortReceiveException$NSPortSendException$NSPortTimeoutException$NSPositiveCurrencyFormatString$NSPresentationIntentAttributeName$NSPriorDayDesignations$NSProcessInfoPowerStateDidChangeNotification$NSProcessInfoThermalStateDidChangeNotification$NSProgressEstimatedTimeRemainingKey$NSProgressFileAnimationImageKey$NSProgressFileAnimationImageOriginalRectKey$NSProgressFileCompletedCountKey$NSProgressFileIconKey$NSProgressFileOperationKindCopying$NSProgressFileOperationKindDecompressingAfterDownloading$NSProgressFileOperationKindDownloading$NSProgressFileOperationKindDuplicating$NSProgressFileOperationKindKey$NSProgressFileOperationKindReceiving$NSProgressFileOperationKindUploading$NSProgressFileTotalCountKey$NSProgressFileURLKey$NSProgressKindFile$NSProgressThroughputKey$NSRangeException$NSRecoveryAttempterErrorKey$NSRegistrationDomain$NSReplacementIndexAttributeName$NSRepublicOfChinaCalendar$NSRunLoopCommonModes$NSSecureUnarchiveFromDataTransformerName$NSShortDateFormatString$NSShortMonthNameArray$NSShortTimeDateFormatString$NSShortWeekDayNameArray$NSStreamDataWrittenToMemoryStreamKey$NSStreamFileCurrentOffsetKey$NSStreamNetworkServiceType$NSStreamNetworkServiceTypeBackground$NSStreamNetworkServiceTypeCallSignaling$NSStreamNetworkServiceTypeVideo$NSStreamNetworkServiceTypeVoIP$NSStreamNetworkServiceTypeVoice$NSStreamSOCKSErrorDomain$NSStreamSOCKSProxyConfigurationKey$NSStreamSOCKSProxyHostKey$NSStreamSOCKSProxyPasswordKey$NSStreamSOCKSProxyPortKey$NSStreamSOCKSProxyUserKey$NSStreamSOCKSProxyVersion4$NSStreamSOCKSProxyVersion5$NSStreamSOCKSProxyVersionKey$NSStreamSocketSSLErrorDomain$NSStreamSocketSecurityLevelKey$NSStreamSocketSecurityLevelNegotiatedSSL$NSStreamSocketSecurityLevelNone$NSStreamSocketSecurityLevelSSLv2$NSStreamSocketSecurityLevelSSLv3$NSStreamSocketSecurityLevelTLSv1$NSStringEncodingDetectionAllowLossyKey$NSStringEncodingDetectionDisallowedEncodingsKey$NSStringEncodingDetectionFromWindowsKey$NSStringEncodingDetectionLikelyLanguageKey$NSStringEncodingDetectionLossySubstitutionKey$NSStringEncodingDetectionSuggestedEncodingsKey$NSStringEncodingDetectionUseOnlySuggestedEncodingsKey$NSStringEncodingErrorKey$NSStringTransformFullwidthToHalfwidth$NSStringTransformHiraganaToKatakana$NSStringTransformLatinToArabic$NSStringTransformLatinToCyrillic$NSStringTransformLatinToGreek$NSStringTransformLatinToHangul$NSStringTransformLatinToHebrew$NSStringTransformLatinToHiragana$NSStringTransformLatinToKatakana$NSStringTransformLatinToThai$NSStringTransformMandarinToLatin$NSStringTransformStripCombiningMarks$NSStringTransformStripDiacritics$NSStringTransformToLatin$NSStringTransformToUnicodeName$NSStringTransformToXMLHex$NSSumKeyValueOperator$NSSystemClockDidChangeNotification$NSSystemTimeZoneDidChangeNotification$NSTaskDidTerminateNotification$NSTextCheckingAirlineKey$NSTextCheckingCityKey$NSTextCheckingCountryKey$NSTextCheckingFlightKey$NSTextCheckingJobTitleKey$NSTextCheckingNameKey$NSTextCheckingOrganizationKey$NSTextCheckingPhoneKey$NSTextCheckingStateKey$NSTextCheckingStreetKey$NSTextCheckingZIPKey$NSThisDayDesignations$NSThousandsSeparator$NSThreadWillExitNotification$NSThumbnail1024x1024SizeKey$NSTimeDateFormatString$NSTimeFormatString$NSURLAddedToDirectoryDateKey$NSURLApplicationIsScriptableKey$NSURLAttributeModificationDateKey$NSURLAuthenticationMethodClientCertificate$NSURLAuthenticationMethodDefault$NSURLAuthenticationMethodHTMLForm$NSURLAuthenticationMethodHTTPBasic$NSURLAuthenticationMethodHTTPDigest$NSURLAuthenticationMethodNTLM$NSURLAuthenticationMethodNegotiate$NSURLAuthenticationMethodServerTrust$NSURLCanonicalPathKey$NSURLContentAccessDateKey$NSURLContentModificationDateKey$NSURLContentTypeKey$NSURLCreationDateKey$NSURLCredentialStorageChangedNotification$NSURLCredentialStorageRemoveSynchronizableCredentials$NSURLCustomIconKey$NSURLDirectoryEntryCountKey$NSURLDocumentIdentifierKey$NSURLEffectiveIconKey$NSURLErrorBackgroundTaskCancelledReasonKey$NSURLErrorDomain$NSURLErrorFailingURLErrorKey$NSURLErrorFailingURLPeerTrustErrorKey$NSURLErrorFailingURLStringErrorKey$NSURLErrorKey$NSURLErrorNetworkUnavailableReasonKey$NSURLFileAllocatedSizeKey$NSURLFileContentIdentifierKey$NSURLFileIdentifierKey$NSURLFileProtectionComplete$NSURLFileProtectionCompleteUnlessOpen$NSURLFileProtectionCompleteUntilFirstUserAuthentication$NSURLFileProtectionCompleteWhenUserInactive$NSURLFileProtectionKey$NSURLFileProtectionNone$NSURLFileResourceIdentifierKey$NSURLFileResourceTypeBlockSpecial$NSURLFileResourceTypeCharacterSpecial$NSURLFileResourceTypeDirectory$NSURLFileResourceTypeKey$NSURLFileResourceTypeNamedPipe$NSURLFileResourceTypeRegular$NSURLFileResourceTypeSocket$NSURLFileResourceTypeSymbolicLink$NSURLFileResourceTypeUnknown$NSURLFileScheme$NSURLFileSecurityKey$NSURLFileSizeKey$NSURLGenerationIdentifierKey$NSURLHasHiddenExtensionKey$NSURLIsAliasFileKey$NSURLIsApplicationKey$NSURLIsDirectoryKey$NSURLIsExcludedFromBackupKey$NSURLIsExecutableKey$NSURLIsHiddenKey$NSURLIsMountTriggerKey$NSURLIsPackageKey$NSURLIsPurgeableKey$NSURLIsReadableKey$NSURLIsRegularFileKey$NSURLIsSparseKey$NSURLIsSymbolicLinkKey$NSURLIsSystemImmutableKey$NSURLIsUbiquitousItemKey$NSURLIsUserImmutableKey$NSURLIsVolumeKey$NSURLIsWritableKey$NSURLKeysOfUnsetValuesKey$NSURLLabelColorKey$NSURLLabelNumberKey$NSURLLinkCountKey$NSURLLocalizedLabelKey$NSURLLocalizedNameKey$NSURLLocalizedTypeDescriptionKey$NSURLMayHaveExtendedAttributesKey$NSURLMayShareFileContentKey$NSURLNameKey$NSURLParentDirectoryURLKey$NSURLPathKey$NSURLPreferredIOBlockSizeKey$NSURLProtectionSpaceFTP$NSURLProtectionSpaceFTPProxy$NSURLProtectionSpaceHTTP$NSURLProtectionSpaceHTTPProxy$NSURLProtectionSpaceHTTPS$NSURLProtectionSpaceHTTPSProxy$NSURLProtectionSpaceSOCKSProxy$NSURLQuarantinePropertiesKey$NSURLSessionDownloadTaskResumeData$NSURLSessionTaskPriorityDefault@f$NSURLSessionTaskPriorityHigh@f$NSURLSessionTaskPriorityLow@f$NSURLSessionTransferSizeUnknown@q$NSURLSessionUploadTaskResumeData$NSURLTagNamesKey$NSURLThumbnailDictionaryKey$NSURLThumbnailKey$NSURLTotalFileAllocatedSizeKey$NSURLTotalFileSizeKey$NSURLTypeIdentifierKey$NSURLUbiquitousItemContainerDisplayNameKey$NSURLUbiquitousItemDownloadRequestedKey$NSURLUbiquitousItemDownloadingErrorKey$NSURLUbiquitousItemDownloadingStatusCurrent$NSURLUbiquitousItemDownloadingStatusDownloaded$NSURLUbiquitousItemDownloadingStatusKey$NSURLUbiquitousItemDownloadingStatusNotDownloaded$NSURLUbiquitousItemHasUnresolvedConflictsKey$NSURLUbiquitousItemIsDownloadedKey$NSURLUbiquitousItemIsDownloadingKey$NSURLUbiquitousItemIsExcludedFromSyncKey$NSURLUbiquitousItemIsSharedKey$NSURLUbiquitousItemIsUploadedKey$NSURLUbiquitousItemIsUploadingKey$NSURLUbiquitousItemPercentDownloadedKey$NSURLUbiquitousItemPercentUploadedKey$NSURLUbiquitousItemUploadingErrorKey$NSURLUbiquitousSharedItemCurrentUserPermissionsKey$NSURLUbiquitousSharedItemCurrentUserRoleKey$NSURLUbiquitousSharedItemMostRecentEditorNameComponentsKey$NSURLUbiquitousSharedItemOwnerNameComponentsKey$NSURLUbiquitousSharedItemPermissionsReadOnly$NSURLUbiquitousSharedItemPermissionsReadWrite$NSURLUbiquitousSharedItemRoleOwner$NSURLUbiquitousSharedItemRoleParticipant$NSURLVolumeAvailableCapacityForImportantUsageKey$NSURLVolumeAvailableCapacityForOpportunisticUsageKey$NSURLVolumeAvailableCapacityKey$NSURLVolumeCreationDateKey$NSURLVolumeIdentifierKey$NSURLVolumeIsAutomountedKey$NSURLVolumeIsBrowsableKey$NSURLVolumeIsEjectableKey$NSURLVolumeIsEncryptedKey$NSURLVolumeIsInternalKey$NSURLVolumeIsJournalingKey$NSURLVolumeIsLocalKey$NSURLVolumeIsReadOnlyKey$NSURLVolumeIsRemovableKey$NSURLVolumeIsRootFileSystemKey$NSURLVolumeLocalizedFormatDescriptionKey$NSURLVolumeLocalizedNameKey$NSURLVolumeMaximumFileSizeKey$NSURLVolumeMountFromLocationKey$NSURLVolumeNameKey$NSURLVolumeResourceCountKey$NSURLVolumeSubtypeKey$NSURLVolumeSupportsAccessPermissionsKey$NSURLVolumeSupportsAdvisoryFileLockingKey$NSURLVolumeSupportsCasePreservedNamesKey$NSURLVolumeSupportsCaseSensitiveNamesKey$NSURLVolumeSupportsCompressionKey$NSURLVolumeSupportsExclusiveRenamingKey$NSURLVolumeSupportsExtendedSecurityKey$NSURLVolumeSupportsFileCloningKey$NSURLVolumeSupportsFileProtectionKey$NSURLVolumeSupportsHardLinksKey$NSURLVolumeSupportsImmutableFilesKey$NSURLVolumeSupportsJournalingKey$NSURLVolumeSupportsPersistentIDsKey$NSURLVolumeSupportsRenamingKey$NSURLVolumeSupportsRootDirectoryDatesKey$NSURLVolumeSupportsSparseFilesKey$NSURLVolumeSupportsSwapRenamingKey$NSURLVolumeSupportsSymbolicLinksKey$NSURLVolumeSupportsVolumeSizesKey$NSURLVolumeSupportsZeroRunsKey$NSURLVolumeTotalCapacityKey$NSURLVolumeTypeNameKey$NSURLVolumeURLForRemountingKey$NSURLVolumeURLKey$NSURLVolumeUUIDStringKey$NSUbiquitousKeyValueStoreChangeReasonKey$NSUbiquitousKeyValueStoreChangedKeysKey$NSUbiquitousKeyValueStoreDidChangeExternallyNotification$NSUbiquitousUserDefaultsCompletedInitialSyncNotification$NSUbiquitousUserDefaultsDidChangeAccountsNotification$NSUbiquitousUserDefaultsNoCloudAccountNotification$NSUbiquityIdentityDidChangeNotification$NSUnarchiveFromDataTransformerName$NSUndefinedKeyException$NSUnderlyingErrorKey$NSUndoManagerCheckpointNotification$NSUndoManagerDidCloseUndoGroupNotification$NSUndoManagerDidOpenUndoGroupNotification$NSUndoManagerDidRedoChangeNotification$NSUndoManagerDidUndoChangeNotification$NSUndoManagerGroupIsDiscardableKey$NSUndoManagerWillCloseUndoGroupNotification$NSUndoManagerWillRedoChangeNotification$NSUndoManagerWillUndoChangeNotification$NSUnionOfArraysKeyValueOperator$NSUnionOfObjectsKeyValueOperator$NSUnionOfSetsKeyValueOperator$NSUserActivityTypeBrowsingWeb$NSUserDefaultsDidChangeNotification$NSUserDefaultsSizeLimitExceededNotification$NSUserNotificationDefaultSoundName$NSWeekDayNameArray$NSWillBecomeMultiThreadedNotification$NSXMLParserErrorDomain$NSYearMonthWeekDesignations$NSZeroPoint@{CGPoint=dd}$NSZeroRect@{CGRect={CGPoint=dd}{CGSize=dd}}$NSZeroSize@{CGSize=dd}$NSZombieEnabled@Z$""" -enums = """$NSASCIIStringEncoding@1$NSActivityAnimationTrackingEnabled@35184372088832$NSActivityAutomaticTerminationDisabled@32768$NSActivityBackground@255$NSActivityIdleDisplaySleepDisabled@1099511627776$NSActivityIdleSystemSleepDisabled@1048576$NSActivityLatencyCritical@1095216660480$NSActivitySuddenTerminationDisabled@16384$NSActivityTrackingEnabled@70368744177664$NSActivityUserInitiated@16777215$NSActivityUserInitiatedAllowingIdleSystemSleep@15728639$NSActivityUserInteractive@1095233437695$NSAdminApplicationDirectory@4$NSAggregateExpressionType@14$NSAlignAllEdgesInward@15$NSAlignAllEdgesNearest@983040$NSAlignAllEdgesOutward@3840$NSAlignHeightInward@32$NSAlignHeightNearest@2097152$NSAlignHeightOutward@8192$NSAlignMaxXInward@4$NSAlignMaxXNearest@262144$NSAlignMaxXOutward@1024$NSAlignMaxYInward@8$NSAlignMaxYNearest@524288$NSAlignMaxYOutward@2048$NSAlignMinXInward@1$NSAlignMinXNearest@65536$NSAlignMinXOutward@256$NSAlignMinYInward@2$NSAlignMinYNearest@131072$NSAlignMinYOutward@512$NSAlignRectFlipped@9223372036854775808$NSAlignWidthInward@16$NSAlignWidthNearest@1048576$NSAlignWidthOutward@4096$NSAllApplicationsDirectory@100$NSAllDomainsMask@65535$NSAllLibrariesDirectory@101$NSAllPredicateModifier@1$NSAnchoredSearch@8$NSAndPredicateType@1$NSAnyKeyExpressionType@15$NSAnyPredicateModifier@2$NSAppleEventSendAlwaysInteract@48$NSAppleEventSendCanInteract@32$NSAppleEventSendCanSwitchLayer@64$NSAppleEventSendDefaultOptions@35$NSAppleEventSendDontAnnotate@65536$NSAppleEventSendDontExecute@8192$NSAppleEventSendDontRecord@4096$NSAppleEventSendNeverInteract@16$NSAppleEventSendNoReply@1$NSAppleEventSendQueueReply@2$NSAppleEventSendWaitForReply@3$NSApplicationDirectory@1$NSApplicationScriptsDirectory@23$NSApplicationSupportDirectory@14$NSArgumentEvaluationScriptError@3$NSArgumentsWrongScriptError@6$NSAtomicWrite@1$NSAttributedStringEnumerationLongestEffectiveRangeNotRequired@1048576$NSAttributedStringEnumerationReverse@2$NSAttributedStringFormattingApplyReplacementIndexAttribute@2$NSAttributedStringFormattingInsertArgumentAttributesWithoutMerging@1$NSAttributedStringMarkdownInterpretedSyntaxFull@0$NSAttributedStringMarkdownInterpretedSyntaxInlineOnly@1$NSAttributedStringMarkdownInterpretedSyntaxInlineOnlyPreservingWhitespace@2$NSAttributedStringMarkdownParsingFailureReturnError@0$NSAttributedStringMarkdownParsingFailureReturnPartiallyParsedIfPossible@1$NSAutosavedInformationDirectory@11$NSBackgroundActivityResultDeferred@2$NSBackgroundActivityResultFinished@1$NSBackwardsSearch@4$NSBeginsWithComparison@5$NSBeginsWithPredicateOperatorType@8$NSBetweenPredicateOperatorType@100$NSBinarySearchingFirstEqual@256$NSBinarySearchingInsertionIndex@1024$NSBinarySearchingLastEqual@512$NSBlockExpressionType@19$NSBundleErrorMaximum@5119$NSBundleErrorMinimum@4992$NSBundleExecutableArchitectureARM64@16777228$NSBundleExecutableArchitectureI386@7$NSBundleExecutableArchitecturePPC@18$NSBundleExecutableArchitecturePPC64@16777234$NSBundleExecutableArchitectureX86_64@16777223$NSBundleOnDemandResourceExceededMaximumSizeError@4993$NSBundleOnDemandResourceInvalidTagError@4994$NSBundleOnDemandResourceOutOfSpaceError@4992$NSByteCountFormatterCountStyleBinary@3$NSByteCountFormatterCountStyleDecimal@2$NSByteCountFormatterCountStyleFile@0$NSByteCountFormatterCountStyleMemory@1$NSByteCountFormatterUseAll@65535$NSByteCountFormatterUseBytes@1$NSByteCountFormatterUseDefault@0$NSByteCountFormatterUseEB@64$NSByteCountFormatterUseGB@8$NSByteCountFormatterUseKB@2$NSByteCountFormatterUseMB@4$NSByteCountFormatterUsePB@32$NSByteCountFormatterUseTB@16$NSByteCountFormatterUseYBOrHigher@65280$NSByteCountFormatterUseZB@128$NSCachesDirectory@13$NSCalculationDivideByZero@4$NSCalculationLossOfPrecision@1$NSCalculationNoError@0$NSCalculationOverflow@3$NSCalculationUnderflow@2$NSCalendarCalendarUnit@1048576$NSCalendarMatchFirst@4096$NSCalendarMatchLast@8192$NSCalendarMatchNextTime@1024$NSCalendarMatchNextTimePreservingSmallerUnits@512$NSCalendarMatchPreviousTimePreservingSmallerUnits@256$NSCalendarMatchStrictly@2$NSCalendarSearchBackwards@4$NSCalendarUnitCalendar@1048576$NSCalendarUnitDay@16$NSCalendarUnitEra@2$NSCalendarUnitHour@32$NSCalendarUnitMinute@64$NSCalendarUnitMonth@8$NSCalendarUnitNanosecond@32768$NSCalendarUnitQuarter@2048$NSCalendarUnitSecond@128$NSCalendarUnitTimeZone@2097152$NSCalendarUnitWeekOfMonth@4096$NSCalendarUnitWeekOfYear@8192$NSCalendarUnitWeekday@512$NSCalendarUnitWeekdayOrdinal@1024$NSCalendarUnitYear@4$NSCalendarUnitYearForWeekOfYear@16384$NSCalendarWrapComponents@1$NSCannotCreateScriptCommandError@10$NSCaseInsensitivePredicateOption@1$NSCaseInsensitiveSearch@1$NSCloudSharingConflictError@5123$NSCloudSharingErrorMaximum@5375$NSCloudSharingErrorMinimum@5120$NSCloudSharingNetworkFailureError@5120$NSCloudSharingNoPermissionError@5124$NSCloudSharingOtherError@5375$NSCloudSharingQuotaExceededError@5121$NSCloudSharingTooManyParticipantsError@5122$NSCoderErrorMaximum@4991$NSCoderErrorMinimum@4864$NSCoderInvalidValueError@4866$NSCoderReadCorruptError@4864$NSCoderValueNotFoundError@4865$NSCollectionChangeInsert@0$NSCollectionChangeRemove@1$NSCollectorDisabledOption@2$NSCompressionErrorMaximum@5503$NSCompressionErrorMinimum@5376$NSCompressionFailedError@5376$NSConditionalExpressionType@20$NSConstantValueExpressionType@0$NSContainerSpecifierError@2$NSContainsComparison@7$NSContainsPredicateOperatorType@99$NSCoreServiceDirectory@10$NSCustomSelectorPredicateOperatorType@11$NSDataBase64DecodingIgnoreUnknownCharacters@1$NSDataBase64Encoding64CharacterLineLength@1$NSDataBase64Encoding76CharacterLineLength@2$NSDataBase64EncodingEndLineWithCarriageReturn@16$NSDataBase64EncodingEndLineWithLineFeed@32$NSDataCompressionAlgorithmLZ4@1$NSDataCompressionAlgorithmLZFSE@0$NSDataCompressionAlgorithmLZMA@2$NSDataCompressionAlgorithmZlib@3$NSDataReadingMapped@1$NSDataReadingMappedAlways@8$NSDataReadingMappedIfSafe@1$NSDataReadingUncached@2$NSDataSearchAnchored@2$NSDataSearchBackwards@1$NSDataWritingAtomic@1$NSDataWritingFileProtectionComplete@536870912$NSDataWritingFileProtectionCompleteUnlessOpen@805306368$NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication@1073741824$NSDataWritingFileProtectionCompleteWhenUserInactive@1342177280$NSDataWritingFileProtectionMask@4026531840$NSDataWritingFileProtectionNone@268435456$NSDataWritingWithoutOverwriting@2$NSDateComponentUndefined@9223372036854775807$NSDateComponentsFormatterUnitsStyleAbbreviated@1$NSDateComponentsFormatterUnitsStyleBrief@5$NSDateComponentsFormatterUnitsStyleFull@3$NSDateComponentsFormatterUnitsStylePositional@0$NSDateComponentsFormatterUnitsStyleShort@2$NSDateComponentsFormatterUnitsStyleSpellOut@4$NSDateComponentsFormatterZeroFormattingBehaviorDefault@1$NSDateComponentsFormatterZeroFormattingBehaviorDropAll@14$NSDateComponentsFormatterZeroFormattingBehaviorDropLeading@2$NSDateComponentsFormatterZeroFormattingBehaviorDropMiddle@4$NSDateComponentsFormatterZeroFormattingBehaviorDropTrailing@8$NSDateComponentsFormatterZeroFormattingBehaviorNone@0$NSDateComponentsFormatterZeroFormattingBehaviorPad@65536$NSDateFormatterBehavior10_0@1000$NSDateFormatterBehavior10_4@1040$NSDateFormatterBehaviorDefault@0$NSDateFormatterFullStyle@4$NSDateFormatterLongStyle@3$NSDateFormatterMediumStyle@2$NSDateFormatterNoStyle@0$NSDateFormatterShortStyle@1$NSDateIntervalFormatterFullStyle@4$NSDateIntervalFormatterLongStyle@3$NSDateIntervalFormatterMediumStyle@2$NSDateIntervalFormatterNoStyle@0$NSDateIntervalFormatterShortStyle@1$NSDayCalendarUnit@16$NSDecimalMaxSize@8$NSDecodingFailurePolicyRaiseException@0$NSDecodingFailurePolicySetErrorAndReturn@1$NSDecompressionFailedError@5377$NSDemoApplicationDirectory@2$NSDesktopDirectory@12$NSDeveloperApplicationDirectory@3$NSDeveloperDirectory@6$NSDiacriticInsensitivePredicateOption@2$NSDiacriticInsensitiveSearch@128$NSDirectPredicateModifier@0$NSDirectoryEnumerationIncludesDirectoriesPostOrder@8$NSDirectoryEnumerationProducesRelativePathURLs@16$NSDirectoryEnumerationSkipsHiddenFiles@4$NSDirectoryEnumerationSkipsPackageDescendants@2$NSDirectoryEnumerationSkipsSubdirectoryDescendants@1$NSDistributedNotificationDeliverImmediately@1$NSDistributedNotificationPostToAllSessions@2$NSDocumentDirectory@9$NSDocumentationDirectory@8$NSDownloadsDirectory@15$NSEDGEINSETS_DEFINED@1$NSEndsWithComparison@6$NSEndsWithPredicateOperatorType@9$NSEnergyFormatterUnitCalorie@1793$NSEnergyFormatterUnitJoule@11$NSEnergyFormatterUnitKilocalorie@1794$NSEnergyFormatterUnitKilojoule@14$NSEnumerationConcurrent@1$NSEnumerationReverse@2$NSEqualToComparison@0$NSEqualToPredicateOperatorType@4$NSEraCalendarUnit@2$NSEvaluatedObjectExpressionType@1$NSEverySubelement@1$NSExecutableArchitectureMismatchError@3585$NSExecutableErrorMaximum@3839$NSExecutableErrorMinimum@3584$NSExecutableLinkError@3588$NSExecutableLoadError@3587$NSExecutableNotLoadableError@3584$NSExecutableRuntimeMismatchError@3586$NSFeatureUnsupportedError@3328$NSFileCoordinatorReadingForUploading@8$NSFileCoordinatorReadingImmediatelyAvailableMetadataOnly@4$NSFileCoordinatorReadingResolvesSymbolicLink@2$NSFileCoordinatorReadingWithoutChanges@1$NSFileCoordinatorWritingContentIndependentMetadataOnly@16$NSFileCoordinatorWritingForDeleting@1$NSFileCoordinatorWritingForMerging@4$NSFileCoordinatorWritingForMoving@2$NSFileCoordinatorWritingForReplacing@8$NSFileErrorMaximum@1023$NSFileErrorMinimum@0$NSFileLockingError@255$NSFileManagerItemReplacementUsingNewMetadataOnly@1$NSFileManagerItemReplacementWithoutDeletingBackupItem@2$NSFileManagerUnmountAllPartitionsAndEjectDisk@1$NSFileManagerUnmountBusyError@769$NSFileManagerUnmountUnknownError@768$NSFileManagerUnmountWithoutUI@2$NSFileNoSuchFileError@4$NSFileReadCorruptFileError@259$NSFileReadInapplicableStringEncodingError@261$NSFileReadInvalidFileNameError@258$NSFileReadNoPermissionError@257$NSFileReadNoSuchFileError@260$NSFileReadTooLargeError@263$NSFileReadUnknownError@256$NSFileReadUnknownStringEncodingError@264$NSFileReadUnsupportedSchemeError@262$NSFileVersionAddingByMoving@1$NSFileVersionReplacingByMoving@1$NSFileWrapperReadingImmediate@1$NSFileWrapperReadingWithoutMapping@2$NSFileWrapperWritingAtomic@1$NSFileWrapperWritingWithNameUpdating@2$NSFileWriteFileExistsError@516$NSFileWriteInapplicableStringEncodingError@517$NSFileWriteInvalidFileNameError@514$NSFileWriteNoPermissionError@513$NSFileWriteOutOfSpaceError@640$NSFileWriteUnknownError@512$NSFileWriteUnsupportedSchemeError@518$NSFileWriteVolumeReadOnlyError@642$NSForcedOrderingSearch@512$NSFormattingContextBeginningOfSentence@4$NSFormattingContextDynamic@1$NSFormattingContextListItem@3$NSFormattingContextMiddleOfSentence@5$NSFormattingContextStandalone@2$NSFormattingContextUnknown@0$NSFormattingError@2048$NSFormattingErrorMaximum@2559$NSFormattingErrorMinimum@2048$NSFormattingUnitStyleLong@3$NSFormattingUnitStyleMedium@2$NSFormattingUnitStyleShort@1$NSFoundationVersionNumber10_10@1151.16$NSFoundationVersionNumber10_10_1@1151.16$NSFoundationVersionNumber10_10_2@1152.14$NSFoundationVersionNumber10_10_3@1153.2$NSFoundationVersionNumber10_10_4@1153.2$NSFoundationVersionNumber10_10_5@1154.0$NSFoundationVersionNumber10_10_Max@1199.0$NSFoundationVersionNumber10_11@1252.0$NSFoundationVersionNumber10_11_1@1255.1$NSFoundationVersionNumber10_11_2@1256.1$NSFoundationVersionNumber10_11_3@1256.1$NSFoundationVersionNumber10_11_4@1258.0$NSFoundationVersionNumber10_11_Max@1299.0$NSFoundationVersionNumber10_8@945.0$NSFoundationVersionNumber10_8_1@945.0$NSFoundationVersionNumber10_8_2@945.11$NSFoundationVersionNumber10_8_3@945.16$NSFoundationVersionNumber10_8_4@945.18$NSFoundationVersionNumber10_9@1056$NSFoundationVersionNumber10_9_1@1056$NSFoundationVersionNumber10_9_2@1056.13$NSFoundationVersionWithFileManagerResourceForkSupport@412$NSFunctionExpressionType@4$NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES@1$NSGrammaticalCaseAblative@6$NSGrammaticalCaseAccusative@2$NSGrammaticalCaseAdessive@7$NSGrammaticalCaseAllative@8$NSGrammaticalCaseDative@3$NSGrammaticalCaseElative@9$NSGrammaticalCaseEssive@11$NSGrammaticalCaseGenitive@4$NSGrammaticalCaseIllative@10$NSGrammaticalCaseInessive@12$NSGrammaticalCaseLocative@13$NSGrammaticalCaseNominative@1$NSGrammaticalCaseNotSet@0$NSGrammaticalCasePrepositional@5$NSGrammaticalCaseTranslative@14$NSGrammaticalDefinitenessDefinite@2$NSGrammaticalDefinitenessIndefinite@1$NSGrammaticalDefinitenessNotSet@0$NSGrammaticalDeterminationDependent@2$NSGrammaticalDeterminationIndependent@1$NSGrammaticalDeterminationNotSet@0$NSGrammaticalGenderFeminine@1$NSGrammaticalGenderMasculine@2$NSGrammaticalGenderNeuter@3$NSGrammaticalGenderNotSet@0$NSGrammaticalNumberNotSet@0$NSGrammaticalNumberPlural@3$NSGrammaticalNumberPluralFew@5$NSGrammaticalNumberPluralMany@6$NSGrammaticalNumberPluralTwo@4$NSGrammaticalNumberSingular@1$NSGrammaticalNumberZero@2$NSGrammaticalPartOfSpeechAbbreviation@14$NSGrammaticalPartOfSpeechAdjective@6$NSGrammaticalPartOfSpeechAdposition@7$NSGrammaticalPartOfSpeechAdverb@4$NSGrammaticalPartOfSpeechConjunction@10$NSGrammaticalPartOfSpeechDeterminer@1$NSGrammaticalPartOfSpeechInterjection@12$NSGrammaticalPartOfSpeechLetter@3$NSGrammaticalPartOfSpeechNotSet@0$NSGrammaticalPartOfSpeechNoun@9$NSGrammaticalPartOfSpeechNumeral@11$NSGrammaticalPartOfSpeechParticle@5$NSGrammaticalPartOfSpeechPreposition@13$NSGrammaticalPartOfSpeechPronoun@2$NSGrammaticalPartOfSpeechVerb@8$NSGrammaticalPersonFirst@1$NSGrammaticalPersonNotSet@0$NSGrammaticalPersonSecond@2$NSGrammaticalPersonThird@3$NSGrammaticalPronounTypeNotSet@0$NSGrammaticalPronounTypePersonal@1$NSGrammaticalPronounTypePossessive@3$NSGrammaticalPronounTypeReflexive@2$NSGreaterThanComparison@4$NSGreaterThanOrEqualToComparison@3$NSGreaterThanOrEqualToPredicateOperatorType@3$NSGreaterThanPredicateOperatorType@2$NSHPUXOperatingSystem@4$NSHTTPCookieAcceptPolicyAlways@0$NSHTTPCookieAcceptPolicyNever@1$NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain@2$NSHashTableCopyIn@65536$NSHashTableObjectPointerPersonality@512$NSHashTableStrongMemory@0$NSHashTableWeakMemory@5$NSHashTableZeroingWeakMemory@1$NSHourCalendarUnit@32$NSINTEGER_DEFINED@1$NSISO2022JPStringEncoding@21$NSISO8601DateFormatWithColonSeparatorInTime@512$NSISO8601DateFormatWithColonSeparatorInTimeZone@1024$NSISO8601DateFormatWithDashSeparatorInDate@256$NSISO8601DateFormatWithDay@16$NSISO8601DateFormatWithFractionalSeconds@2048$NSISO8601DateFormatWithFullDate@275$NSISO8601DateFormatWithFullTime@1632$NSISO8601DateFormatWithInternetDateTime@1907$NSISO8601DateFormatWithMonth@2$NSISO8601DateFormatWithSpaceBetweenDateAndTime@128$NSISO8601DateFormatWithTime@32$NSISO8601DateFormatWithTimeZone@64$NSISO8601DateFormatWithWeekOfYear@4$NSISO8601DateFormatWithYear@1$NSISOLatin1StringEncoding@5$NSISOLatin2StringEncoding@9$NSInPredicateOperatorType@10$NSIndexSubelement@0$NSInlinePresentationIntentBlockHTML@512$NSInlinePresentationIntentCode@4$NSInlinePresentationIntentEmphasized@1$NSInlinePresentationIntentInlineHTML@256$NSInlinePresentationIntentLineBreak@128$NSInlinePresentationIntentSoftBreak@64$NSInlinePresentationIntentStrikethrough@32$NSInlinePresentationIntentStronglyEmphasized@2$NSInputMethodsDirectory@16$NSInternalScriptError@8$NSInternalSpecifierError@5$NSIntersectSetExpressionType@6$NSInvalidIndexSpecifierError@4$NSItemProviderFileOptionOpenInPlace@1$NSItemProviderItemUnavailableError@-1000$NSItemProviderRepresentationVisibilityAll@0$NSItemProviderRepresentationVisibilityGroup@2$NSItemProviderRepresentationVisibilityOwnProcess@3$NSItemProviderRepresentationVisibilityTeam@1$NSItemProviderUnavailableCoercionError@-1200$NSItemProviderUnexpectedValueClassError@-1100$NSItemProviderUnknownError@-1$NSItemReplacementDirectory@99$NSJSONReadingAllowFragments@4$NSJSONReadingFragmentsAllowed@4$NSJSONReadingJSON5Allowed@8$NSJSONReadingMutableContainers@1$NSJSONReadingMutableLeaves@2$NSJSONReadingTopLevelDictionaryAssumed@16$NSJSONWritingFragmentsAllowed@4$NSJSONWritingPrettyPrinted@1$NSJSONWritingSortedKeys@2$NSJSONWritingWithoutEscapingSlashes@8$NSJapaneseEUCStringEncoding@3$NSKeyPathExpressionType@3$NSKeySpecifierEvaluationScriptError@2$NSKeyValueChangeInsertion@2$NSKeyValueChangeRemoval@3$NSKeyValueChangeReplacement@4$NSKeyValueChangeSetting@1$NSKeyValueIntersectSetMutation@3$NSKeyValueMinusSetMutation@2$NSKeyValueObservingOptionInitial@4$NSKeyValueObservingOptionNew@1$NSKeyValueObservingOptionOld@2$NSKeyValueObservingOptionPrior@8$NSKeyValueSetSetMutation@4$NSKeyValueUnionSetMutation@1$NSKeyValueValidationError@1024$NSLengthFormatterUnitCentimeter@9$NSLengthFormatterUnitFoot@1282$NSLengthFormatterUnitInch@1281$NSLengthFormatterUnitKilometer@14$NSLengthFormatterUnitMeter@11$NSLengthFormatterUnitMile@1284$NSLengthFormatterUnitMillimeter@8$NSLengthFormatterUnitYard@1283$NSLessThanComparison@2$NSLessThanOrEqualToComparison@1$NSLessThanOrEqualToPredicateOperatorType@1$NSLessThanPredicateOperatorType@0$NSLibraryDirectory@5$NSLikePredicateOperatorType@7$NSLinguisticTaggerJoinNames@16$NSLinguisticTaggerOmitOther@8$NSLinguisticTaggerOmitPunctuation@2$NSLinguisticTaggerOmitWhitespace@4$NSLinguisticTaggerOmitWords@1$NSLinguisticTaggerUnitDocument@3$NSLinguisticTaggerUnitParagraph@2$NSLinguisticTaggerUnitSentence@1$NSLinguisticTaggerUnitWord@0$NSLiteralSearch@2$NSLocalDomainMask@2$NSLocaleLanguageDirectionBottomToTop@4$NSLocaleLanguageDirectionLeftToRight@1$NSLocaleLanguageDirectionRightToLeft@2$NSLocaleLanguageDirectionTopToBottom@3$NSLocaleLanguageDirectionUnknown@0$NSMACHOperatingSystem@5$NSMacOSRomanStringEncoding@30$NSMachPortDeallocateNone@0$NSMachPortDeallocateReceiveRight@2$NSMachPortDeallocateSendRight@1$NSMapTableCopyIn@65536$NSMapTableObjectPointerPersonality@512$NSMapTableStrongMemory@0$NSMapTableWeakMemory@5$NSMapTableZeroingWeakMemory@1$NSMappedRead@1$NSMassFormatterUnitGram@11$NSMassFormatterUnitKilogram@14$NSMassFormatterUnitOunce@1537$NSMassFormatterUnitPound@1538$NSMassFormatterUnitStone@1539$NSMatchesPredicateOperatorType@6$NSMatchingAnchored@4$NSMatchingCompleted@2$NSMatchingHitEnd@4$NSMatchingInternalError@16$NSMatchingProgress@1$NSMatchingReportCompletion@2$NSMatchingReportProgress@1$NSMatchingRequiredEnd@8$NSMatchingWithTransparentBounds@8$NSMatchingWithoutAnchoringBounds@16$NSMaxXEdge@2$NSMaxYEdge@3$NSMaximumStringLength@9223372036854775807$NSMeasurementFormatterUnitOptionsNaturalScale@2$NSMeasurementFormatterUnitOptionsProvidedUnit@1$NSMeasurementFormatterUnitOptionsTemperatureWithoutUnit@4$NSMiddleSubelement@2$NSMinXEdge@0$NSMinYEdge@1$NSMinusSetExpressionType@7$NSMinuteCalendarUnit@64$NSMonthCalendarUnit@8$NSMoviesDirectory@17$NSMusicDirectory@18$NSNEXTSTEPStringEncoding@2$NSNetServiceListenForConnections@2$NSNetServiceNoAutoRename@1$NSNetServicesActivityInProgress@-72003$NSNetServicesBadArgumentError@-72004$NSNetServicesCancelledError@-72005$NSNetServicesCollisionError@-72001$NSNetServicesInvalidError@-72006$NSNetServicesMissingRequiredConfigurationError@-72008$NSNetServicesNotFoundError@-72002$NSNetServicesTimeoutError@-72007$NSNetServicesUnknownError@-72000$NSNetworkDomainMask@4$NSNoScriptError@0$NSNoSpecifierError@0$NSNoSubelement@4$NSNoTopLevelContainersSpecifierError@1$NSNonLossyASCIIStringEncoding@7$NSNormalizedPredicateOption@4$NSNotEqualToPredicateOperatorType@5$NSNotFound@9223372036854775807$NSNotPredicateType@0$NSNotificationCoalescingOnName@1$NSNotificationCoalescingOnSender@2$NSNotificationDeliverImmediately@1$NSNotificationNoCoalescing@0$NSNotificationPostToAllSessions@2$NSNotificationSuspensionBehaviorCoalesce@2$NSNotificationSuspensionBehaviorDeliverImmediately@4$NSNotificationSuspensionBehaviorDrop@1$NSNotificationSuspensionBehaviorHold@3$NSNumberFormatterBehavior10_0@1000$NSNumberFormatterBehavior10_4@1040$NSNumberFormatterBehaviorDefault@0$NSNumberFormatterCurrencyAccountingStyle@10$NSNumberFormatterCurrencyISOCodeStyle@8$NSNumberFormatterCurrencyPluralStyle@9$NSNumberFormatterCurrencyStyle@2$NSNumberFormatterDecimalStyle@1$NSNumberFormatterNoStyle@0$NSNumberFormatterOrdinalStyle@6$NSNumberFormatterPadAfterPrefix@1$NSNumberFormatterPadAfterSuffix@3$NSNumberFormatterPadBeforePrefix@0$NSNumberFormatterPadBeforeSuffix@2$NSNumberFormatterPercentStyle@3$NSNumberFormatterRoundCeiling@0$NSNumberFormatterRoundDown@2$NSNumberFormatterRoundFloor@1$NSNumberFormatterRoundHalfDown@5$NSNumberFormatterRoundHalfEven@4$NSNumberFormatterRoundHalfUp@6$NSNumberFormatterRoundUp@3$NSNumberFormatterScientificStyle@4$NSNumberFormatterSpellOutStyle@5$NSNumericSearch@64$NSOSF1OperatingSystem@7$NSObjectAutoreleasedEvent@3$NSObjectExtraRefDecrementedEvent@5$NSObjectExtraRefIncrementedEvent@4$NSObjectInternalRefDecrementedEvent@7$NSObjectInternalRefIncrementedEvent@6$NSOpenStepUnicodeReservedBase@62464$NSOperationNotSupportedForKeyScriptError@9$NSOperationNotSupportedForKeySpecifierError@6$NSOperationQueueDefaultMaxConcurrentOperationCount@-1$NSOperationQueuePriorityHigh@4$NSOperationQueuePriorityLow@-4$NSOperationQueuePriorityNormal@0$NSOperationQueuePriorityVeryHigh@8$NSOperationQueuePriorityVeryLow@-8$NSOrPredicateType@2$NSOrderedAscending@-1$NSOrderedCollectionDifferenceCalculationInferMoves@4$NSOrderedCollectionDifferenceCalculationOmitInsertedObjects@1$NSOrderedCollectionDifferenceCalculationOmitRemovedObjects@2$NSOrderedDescending@1$NSOrderedSame@0$NSPersonNameComponentsFormatterPhonetic@2$NSPersonNameComponentsFormatterStyleAbbreviated@4$NSPersonNameComponentsFormatterStyleDefault@0$NSPersonNameComponentsFormatterStyleLong@3$NSPersonNameComponentsFormatterStyleMedium@2$NSPersonNameComponentsFormatterStyleShort@1$NSPicturesDirectory@19$NSPointerFunctionsCStringPersonality@768$NSPointerFunctionsCopyIn@65536$NSPointerFunctionsIntegerPersonality@1280$NSPointerFunctionsMachVirtualMemory@4$NSPointerFunctionsMallocMemory@3$NSPointerFunctionsObjectPersonality@0$NSPointerFunctionsObjectPointerPersonality@512$NSPointerFunctionsOpaqueMemory@2$NSPointerFunctionsOpaquePersonality@256$NSPointerFunctionsStrongMemory@0$NSPointerFunctionsStructPersonality@1024$NSPointerFunctionsWeakMemory@5$NSPointerFunctionsZeroingWeakMemory@1$NSPositionAfter@0$NSPositionBefore@1$NSPositionBeginning@2$NSPositionEnd@3$NSPositionReplace@4$NSPostASAP@2$NSPostNow@3$NSPostWhenIdle@1$NSPreferencePanesDirectory@22$NSPresentationIntentKindBlockQuote@6$NSPresentationIntentKindCodeBlock@5$NSPresentationIntentKindHeader@1$NSPresentationIntentKindListItem@4$NSPresentationIntentKindOrderedList@2$NSPresentationIntentKindParagraph@0$NSPresentationIntentKindTable@8$NSPresentationIntentKindTableCell@11$NSPresentationIntentKindTableHeaderRow@9$NSPresentationIntentKindTableRow@10$NSPresentationIntentKindThematicBreak@7$NSPresentationIntentKindUnorderedList@3$NSPresentationIntentTableColumnAlignmentCenter@1$NSPresentationIntentTableColumnAlignmentLeft@0$NSPresentationIntentTableColumnAlignmentRight@2$NSPrinterDescriptionDirectory@20$NSProcessInfoThermalStateCritical@3$NSProcessInfoThermalStateFair@1$NSProcessInfoThermalStateNominal@0$NSProcessInfoThermalStateSerious@2$NSPropertyListBinaryFormat_v1_0@200$NSPropertyListErrorMaximum@4095$NSPropertyListErrorMinimum@3840$NSPropertyListImmutable@0$NSPropertyListMutableContainers@1$NSPropertyListMutableContainersAndLeaves@2$NSPropertyListOpenStepFormat@1$NSPropertyListReadCorruptError@3840$NSPropertyListReadStreamError@3842$NSPropertyListReadUnknownVersionError@3841$NSPropertyListWriteInvalidError@3852$NSPropertyListWriteStreamError@3851$NSPropertyListXMLFormat_v1_0@100$NSProprietaryStringEncoding@65536$NSQualityOfServiceBackground@9$NSQualityOfServiceDefault@-1$NSQualityOfServiceUserInitiated@25$NSQualityOfServiceUserInteractive@33$NSQualityOfServiceUtility@17$NSQuarterCalendarUnit@2048$NSRandomSubelement@3$NSReceiverEvaluationScriptError@1$NSReceiversCantHandleCommandScriptError@4$NSRectEdgeMaxX@2$NSRectEdgeMaxY@3$NSRectEdgeMinX@0$NSRectEdgeMinY@1$NSRegularExpressionAllowCommentsAndWhitespace@2$NSRegularExpressionAnchorsMatchLines@16$NSRegularExpressionCaseInsensitive@1$NSRegularExpressionDotMatchesLineSeparators@8$NSRegularExpressionIgnoreMetacharacters@4$NSRegularExpressionSearch@1024$NSRegularExpressionUseUnicodeWordBoundaries@64$NSRegularExpressionUseUnixLineSeparators@32$NSRelativeAfter@0$NSRelativeBefore@1$NSRelativeDateTimeFormatterStyleNamed@1$NSRelativeDateTimeFormatterStyleNumeric@0$NSRelativeDateTimeFormatterUnitsStyleAbbreviated@3$NSRelativeDateTimeFormatterUnitsStyleFull@0$NSRelativeDateTimeFormatterUnitsStyleShort@2$NSRelativeDateTimeFormatterUnitsStyleSpellOut@1$NSRequiredArgumentsMissingScriptError@5$NSRoundBankers@3$NSRoundDown@1$NSRoundPlain@0$NSRoundUp@2$NSSaveOptionsAsk@2$NSSaveOptionsNo@1$NSSaveOptionsYes@0$NSScannedOption@1$NSSecondCalendarUnit@128$NSSharedPublicDirectory@21$NSShiftJISStringEncoding@8$NSSolarisOperatingSystem@3$NSSortConcurrent@1$NSSortStable@16$NSStreamEventEndEncountered@16$NSStreamEventErrorOccurred@8$NSStreamEventHasBytesAvailable@2$NSStreamEventHasSpaceAvailable@4$NSStreamEventNone@0$NSStreamEventOpenCompleted@1$NSStreamStatusAtEnd@5$NSStreamStatusClosed@6$NSStreamStatusError@7$NSStreamStatusNotOpen@0$NSStreamStatusOpen@2$NSStreamStatusOpening@1$NSStreamStatusReading@3$NSStreamStatusWriting@4$NSStringEncodingConversionAllowLossy@1$NSStringEncodingConversionExternalRepresentation@2$NSStringEnumerationByCaretPositions@5$NSStringEnumerationByComposedCharacterSequences@2$NSStringEnumerationByDeletionClusters@6$NSStringEnumerationByLines@0$NSStringEnumerationByParagraphs@1$NSStringEnumerationBySentences@4$NSStringEnumerationByWords@3$NSStringEnumerationLocalized@1024$NSStringEnumerationReverse@256$NSStringEnumerationSubstringNotRequired@512$NSSubqueryExpressionType@13$NSSunOSOperatingSystem@6$NSSymbolStringEncoding@6$NSSystemDomainMask@8$NSTaskTerminationReasonExit@1$NSTaskTerminationReasonUncaughtSignal@2$NSTextCheckingAllCustomTypes@18446744069414584320$NSTextCheckingAllSystemTypes@4294967295$NSTextCheckingAllTypes@18446744073709551615$NSTextCheckingTypeAddress@16$NSTextCheckingTypeCorrection@512$NSTextCheckingTypeDash@128$NSTextCheckingTypeDate@8$NSTextCheckingTypeGrammar@4$NSTextCheckingTypeLink@32$NSTextCheckingTypeOrthography@1$NSTextCheckingTypePhoneNumber@2048$NSTextCheckingTypeQuote@64$NSTextCheckingTypeRegularExpression@1024$NSTextCheckingTypeReplacement@256$NSTextCheckingTypeSpelling@2$NSTextCheckingTypeTransitInformation@4096$NSTimeZoneCalendarUnit@2097152$NSTimeZoneNameStyleDaylightSaving@2$NSTimeZoneNameStyleGeneric@4$NSTimeZoneNameStyleShortDaylightSaving@3$NSTimeZoneNameStyleShortGeneric@5$NSTimeZoneNameStyleShortStandard@1$NSTimeZoneNameStyleStandard@0$NSTrashDirectory@102$NSURLBookmarkCreationMinimalBookmark@512$NSURLBookmarkCreationPreferFileIDResolution@256$NSURLBookmarkCreationSecurityScopeAllowOnlyReadAccess@4096$NSURLBookmarkCreationSuitableForBookmarkFile@1024$NSURLBookmarkCreationWithSecurityScope@2048$NSURLBookmarkCreationWithoutImplicitSecurityScope@536870912$NSURLBookmarkResolutionWithSecurityScope@1024$NSURLBookmarkResolutionWithoutImplicitStartAccessing@32768$NSURLBookmarkResolutionWithoutMounting@512$NSURLBookmarkResolutionWithoutUI@256$NSURLCacheStorageAllowed@0$NSURLCacheStorageAllowedInMemoryOnly@1$NSURLCacheStorageNotAllowed@2$NSURLCredentialPersistenceForSession@1$NSURLCredentialPersistenceNone@0$NSURLCredentialPersistencePermanent@2$NSURLCredentialPersistenceSynchronizable@3$NSURLErrorAppTransportSecurityRequiresSecureConnection@-1022$NSURLErrorBackgroundSessionInUseByAnotherProcess@-996$NSURLErrorBackgroundSessionRequiresSharedContainer@-995$NSURLErrorBackgroundSessionWasDisconnected@-997$NSURLErrorBadServerResponse@-1011$NSURLErrorBadURL@-1000$NSURLErrorCallIsActive@-1019$NSURLErrorCancelled@-999$NSURLErrorCancelledReasonBackgroundUpdatesDisabled@1$NSURLErrorCancelledReasonInsufficientSystemResources@2$NSURLErrorCancelledReasonUserForceQuitApplication@0$NSURLErrorCannotCloseFile@-3002$NSURLErrorCannotConnectToHost@-1004$NSURLErrorCannotCreateFile@-3000$NSURLErrorCannotDecodeContentData@-1016$NSURLErrorCannotDecodeRawData@-1015$NSURLErrorCannotFindHost@-1003$NSURLErrorCannotLoadFromNetwork@-2000$NSURLErrorCannotMoveFile@-3005$NSURLErrorCannotOpenFile@-3001$NSURLErrorCannotParseResponse@-1017$NSURLErrorCannotRemoveFile@-3004$NSURLErrorCannotWriteToFile@-3003$NSURLErrorClientCertificateRejected@-1205$NSURLErrorClientCertificateRequired@-1206$NSURLErrorDNSLookupFailed@-1006$NSURLErrorDataLengthExceedsMaximum@-1103$NSURLErrorDataNotAllowed@-1020$NSURLErrorDownloadDecodingFailedMidStream@-3006$NSURLErrorDownloadDecodingFailedToComplete@-3007$NSURLErrorFileDoesNotExist@-1100$NSURLErrorFileIsDirectory@-1101$NSURLErrorFileOutsideSafeArea@-1104$NSURLErrorHTTPTooManyRedirects@-1007$NSURLErrorInternationalRoamingOff@-1018$NSURLErrorNetworkConnectionLost@-1005$NSURLErrorNetworkUnavailableReasonCellular@0$NSURLErrorNetworkUnavailableReasonConstrained@2$NSURLErrorNetworkUnavailableReasonExpensive@1$NSURLErrorNoPermissionsToReadFile@-1102$NSURLErrorNotConnectedToInternet@-1009$NSURLErrorRedirectToNonExistentLocation@-1010$NSURLErrorRequestBodyStreamExhausted@-1021$NSURLErrorResourceUnavailable@-1008$NSURLErrorSecureConnectionFailed@-1200$NSURLErrorServerCertificateHasBadDate@-1201$NSURLErrorServerCertificateHasUnknownRoot@-1203$NSURLErrorServerCertificateNotYetValid@-1204$NSURLErrorServerCertificateUntrusted@-1202$NSURLErrorTimedOut@-1001$NSURLErrorUnknown@-1$NSURLErrorUnsupportedURL@-1002$NSURLErrorUserAuthenticationRequired@-1013$NSURLErrorUserCancelledAuthentication@-1012$NSURLErrorZeroByteResource@-1014$NSURLHandleLoadFailed@3$NSURLHandleLoadInProgress@2$NSURLHandleLoadSucceeded@1$NSURLHandleNotLoaded@0$NSURLNetworkServiceTypeAVStreaming@8$NSURLNetworkServiceTypeBackground@3$NSURLNetworkServiceTypeCallSignaling@11$NSURLNetworkServiceTypeDefault@0$NSURLNetworkServiceTypeResponsiveAV@9$NSURLNetworkServiceTypeResponsiveData@6$NSURLNetworkServiceTypeVideo@2$NSURLNetworkServiceTypeVoIP@1$NSURLNetworkServiceTypeVoice@4$NSURLRelationshipContains@0$NSURLRelationshipOther@2$NSURLRelationshipSame@1$NSURLRequestAttributionDeveloper@0$NSURLRequestAttributionUser@1$NSURLRequestReloadIgnoringCacheData@1$NSURLRequestReloadIgnoringLocalAndRemoteCacheData@4$NSURLRequestReloadIgnoringLocalCacheData@1$NSURLRequestReloadRevalidatingCacheData@5$NSURLRequestReturnCacheDataDontLoad@3$NSURLRequestReturnCacheDataElseLoad@2$NSURLRequestUseProtocolCachePolicy@0$NSURLResponseUnknownLength@-1$NSURLSessionAuthChallengeCancelAuthenticationChallenge@2$NSURLSessionAuthChallengePerformDefaultHandling@1$NSURLSessionAuthChallengeRejectProtectionSpace@3$NSURLSessionAuthChallengeUseCredential@0$NSURLSessionDelayedRequestCancel@2$NSURLSessionDelayedRequestContinueLoading@0$NSURLSessionDelayedRequestUseNewRequest@1$NSURLSessionMultipathServiceTypeAggregate@3$NSURLSessionMultipathServiceTypeHandover@1$NSURLSessionMultipathServiceTypeInteractive@2$NSURLSessionMultipathServiceTypeNone@0$NSURLSessionResponseAllow@1$NSURLSessionResponseBecomeDownload@2$NSURLSessionResponseBecomeStream@3$NSURLSessionResponseCancel@0$NSURLSessionTaskMetricsDomainResolutionProtocolHTTPS@4$NSURLSessionTaskMetricsDomainResolutionProtocolTCP@2$NSURLSessionTaskMetricsDomainResolutionProtocolTLS@3$NSURLSessionTaskMetricsDomainResolutionProtocolUDP@1$NSURLSessionTaskMetricsDomainResolutionProtocolUnknown@0$NSURLSessionTaskMetricsResourceFetchTypeLocalCache@3$NSURLSessionTaskMetricsResourceFetchTypeNetworkLoad@1$NSURLSessionTaskMetricsResourceFetchTypeServerPush@2$NSURLSessionTaskMetricsResourceFetchTypeUnknown@0$NSURLSessionTaskStateCanceling@2$NSURLSessionTaskStateCompleted@3$NSURLSessionTaskStateRunning@0$NSURLSessionTaskStateSuspended@1$NSURLSessionWebSocketCloseCodeAbnormalClosure@1006$NSURLSessionWebSocketCloseCodeGoingAway@1001$NSURLSessionWebSocketCloseCodeInternalServerError@1011$NSURLSessionWebSocketCloseCodeInvalid@0$NSURLSessionWebSocketCloseCodeInvalidFramePayloadData@1007$NSURLSessionWebSocketCloseCodeMandatoryExtensionMissing@1010$NSURLSessionWebSocketCloseCodeMessageTooBig@1009$NSURLSessionWebSocketCloseCodeNoStatusReceived@1005$NSURLSessionWebSocketCloseCodeNormalClosure@1000$NSURLSessionWebSocketCloseCodePolicyViolation@1008$NSURLSessionWebSocketCloseCodeProtocolError@1002$NSURLSessionWebSocketCloseCodeTLSHandshakeFailure@1015$NSURLSessionWebSocketCloseCodeUnsupportedData@1003$NSURLSessionWebSocketMessageTypeData@0$NSURLSessionWebSocketMessageTypeString@1$NSUTF16BigEndianStringEncoding@2415919360$NSUTF16LittleEndianStringEncoding@2483028224$NSUTF16StringEncoding@10$NSUTF32BigEndianStringEncoding@2550137088$NSUTF32LittleEndianStringEncoding@2617245952$NSUTF32StringEncoding@2348810496$NSUTF8StringEncoding@4$NSUbiquitousFileErrorMaximum@4607$NSUbiquitousFileErrorMinimum@4352$NSUbiquitousFileNotUploadedDueToQuotaError@4354$NSUbiquitousFileUbiquityServerNotAvailable@4355$NSUbiquitousFileUnavailableError@4353$NSUbiquitousKeyValueStoreAccountChange@3$NSUbiquitousKeyValueStoreInitialSyncChange@1$NSUbiquitousKeyValueStoreQuotaViolationChange@2$NSUbiquitousKeyValueStoreServerChange@0$NSUncachedRead@2$NSUndefinedDateComponent@9223372036854775807$NSUndoCloseGroupingRunLoopOrdering@350000$NSUnicodeStringEncoding@10$NSUnionSetExpressionType@5$NSUnknownKeyScriptError@7$NSUnknownKeySpecifierError@3$NSUserActivityConnectionUnavailableError@4609$NSUserActivityErrorMaximum@4863$NSUserActivityErrorMinimum@4608$NSUserActivityHandoffFailedError@4608$NSUserActivityHandoffUserInfoTooLargeError@4611$NSUserActivityRemoteApplicationTimedOutError@4610$NSUserCancelledError@3072$NSUserDirectory@7$NSUserDomainMask@1$NSUserNotificationActivationTypeActionButtonClicked@2$NSUserNotificationActivationTypeAdditionalActionClicked@4$NSUserNotificationActivationTypeContentsClicked@1$NSUserNotificationActivationTypeNone@0$NSUserNotificationActivationTypeReplied@3$NSValidationErrorMaximum@2047$NSValidationErrorMinimum@1024$NSVariableExpressionType@2$NSVolumeEnumerationProduceFileReferenceURLs@4$NSVolumeEnumerationSkipHiddenVolumes@2$NSWeekCalendarUnit@256$NSWeekOfMonthCalendarUnit@4096$NSWeekOfYearCalendarUnit@8192$NSWeekdayCalendarUnit@512$NSWeekdayOrdinalCalendarUnit@1024$NSWidthInsensitiveSearch@256$NSWindows95OperatingSystem@2$NSWindowsCP1250StringEncoding@15$NSWindowsCP1251StringEncoding@11$NSWindowsCP1252StringEncoding@12$NSWindowsCP1253StringEncoding@13$NSWindowsCP1254StringEncoding@14$NSWindowsNTOperatingSystem@1$NSWrapCalendarComponents@1$NSXMLAttributeCDATAKind@6$NSXMLAttributeDeclarationKind@10$NSXMLAttributeEntitiesKind@11$NSXMLAttributeEntityKind@10$NSXMLAttributeEnumerationKind@14$NSXMLAttributeIDKind@7$NSXMLAttributeIDRefKind@8$NSXMLAttributeIDRefsKind@9$NSXMLAttributeKind@3$NSXMLAttributeNMTokenKind@12$NSXMLAttributeNMTokensKind@13$NSXMLAttributeNotationKind@15$NSXMLCommentKind@6$NSXMLDTDKind@8$NSXMLDocumentHTMLKind@2$NSXMLDocumentIncludeContentTypeDeclaration@262144$NSXMLDocumentKind@1$NSXMLDocumentTextKind@3$NSXMLDocumentTidyHTML@512$NSXMLDocumentTidyXML@1024$NSXMLDocumentValidate@8192$NSXMLDocumentXHTMLKind@1$NSXMLDocumentXInclude@65536$NSXMLDocumentXMLKind@0$NSXMLElementDeclarationAnyKind@18$NSXMLElementDeclarationElementKind@20$NSXMLElementDeclarationEmptyKind@17$NSXMLElementDeclarationKind@11$NSXMLElementDeclarationMixedKind@19$NSXMLElementDeclarationUndefinedKind@16$NSXMLElementKind@2$NSXMLEntityDeclarationKind@9$NSXMLEntityGeneralKind@1$NSXMLEntityParameterKind@4$NSXMLEntityParsedKind@2$NSXMLEntityPredefined@5$NSXMLEntityUnparsedKind@3$NSXMLInvalidKind@0$NSXMLNamespaceKind@4$NSXMLNodeCompactEmptyElement@4$NSXMLNodeExpandEmptyElement@2$NSXMLNodeIsCDATA@1$NSXMLNodeLoadExternalEntitiesAlways@16384$NSXMLNodeLoadExternalEntitiesNever@524288$NSXMLNodeLoadExternalEntitiesSameOriginOnly@32768$NSXMLNodeNeverEscapeContents@32$NSXMLNodeOptionsNone@0$NSXMLNodePreserveAll@4293918750$NSXMLNodePreserveAttributeOrder@2097152$NSXMLNodePreserveCDATA@16777216$NSXMLNodePreserveCharacterReferences@134217728$NSXMLNodePreserveDTD@67108864$NSXMLNodePreserveEmptyElements@6$NSXMLNodePreserveEntities@4194304$NSXMLNodePreserveNamespaceOrder@1048576$NSXMLNodePreservePrefixes@8388608$NSXMLNodePreserveQuotes@24$NSXMLNodePreserveWhitespace@33554432$NSXMLNodePrettyPrint@131072$NSXMLNodePromoteSignificantWhitespace@268435456$NSXMLNodeUseDoubleQuotes@16$NSXMLNodeUseSingleQuotes@8$NSXMLNotationDeclarationKind@12$NSXMLParserAttributeHasNoValueError@41$NSXMLParserAttributeListNotFinishedError@51$NSXMLParserAttributeListNotStartedError@50$NSXMLParserAttributeNotFinishedError@40$NSXMLParserAttributeNotStartedError@39$NSXMLParserAttributeRedefinedError@42$NSXMLParserCDATANotFinishedError@63$NSXMLParserCharacterRefAtEOFError@10$NSXMLParserCharacterRefInDTDError@13$NSXMLParserCharacterRefInEpilogError@12$NSXMLParserCharacterRefInPrologError@11$NSXMLParserCommentContainsDoubleHyphenError@80$NSXMLParserCommentNotFinishedError@45$NSXMLParserConditionalSectionNotFinishedError@59$NSXMLParserConditionalSectionNotStartedError@58$NSXMLParserDOCTYPEDeclNotFinishedError@61$NSXMLParserDelegateAbortedParseError@512$NSXMLParserDocumentStartError@3$NSXMLParserElementContentDeclNotFinishedError@55$NSXMLParserElementContentDeclNotStartedError@54$NSXMLParserEmptyDocumentError@4$NSXMLParserEncodingNotSupportedError@32$NSXMLParserEntityBoundaryError@90$NSXMLParserEntityIsExternalError@29$NSXMLParserEntityIsParameterError@30$NSXMLParserEntityNotFinishedError@37$NSXMLParserEntityNotStartedError@36$NSXMLParserEntityRefAtEOFError@14$NSXMLParserEntityRefInDTDError@17$NSXMLParserEntityRefInEpilogError@16$NSXMLParserEntityRefInPrologError@15$NSXMLParserEntityRefLoopError@89$NSXMLParserEntityReferenceMissingSemiError@23$NSXMLParserEntityReferenceWithoutNameError@22$NSXMLParserEntityValueRequiredError@84$NSXMLParserEqualExpectedError@75$NSXMLParserExternalStandaloneEntityError@82$NSXMLParserExternalSubsetNotFinishedError@60$NSXMLParserExtraContentError@86$NSXMLParserGTRequiredError@73$NSXMLParserInternalError@1$NSXMLParserInvalidCharacterError@9$NSXMLParserInvalidCharacterInEntityError@87$NSXMLParserInvalidCharacterRefError@8$NSXMLParserInvalidConditionalSectionError@83$NSXMLParserInvalidDecimalCharacterRefError@7$NSXMLParserInvalidEncodingError@81$NSXMLParserInvalidEncodingNameError@79$NSXMLParserInvalidHexCharacterRefError@6$NSXMLParserInvalidURIError@91$NSXMLParserLTRequiredError@72$NSXMLParserLTSlashRequiredError@74$NSXMLParserLessThanSymbolInAttributeError@38$NSXMLParserLiteralNotFinishedError@44$NSXMLParserLiteralNotStartedError@43$NSXMLParserMisplacedCDATAEndStringError@62$NSXMLParserMisplacedXMLDeclarationError@64$NSXMLParserMixedContentDeclNotFinishedError@53$NSXMLParserMixedContentDeclNotStartedError@52$NSXMLParserNAMERequiredError@68$NSXMLParserNMTOKENRequiredError@67$NSXMLParserNamespaceDeclarationError@35$NSXMLParserNoDTDError@94$NSXMLParserNotWellBalancedError@85$NSXMLParserNotationNotFinishedError@49$NSXMLParserNotationNotStartedError@48$NSXMLParserOutOfMemoryError@2$NSXMLParserPCDATARequiredError@69$NSXMLParserParsedEntityRefAtEOFError@18$NSXMLParserParsedEntityRefInEpilogError@20$NSXMLParserParsedEntityRefInInternalError@88$NSXMLParserParsedEntityRefInInternalSubsetError@21$NSXMLParserParsedEntityRefInPrologError@19$NSXMLParserParsedEntityRefMissingSemiError@25$NSXMLParserParsedEntityRefNoNameError@24$NSXMLParserPrematureDocumentEndError@5$NSXMLParserProcessingInstructionNotFinishedError@47$NSXMLParserProcessingInstructionNotStartedError@46$NSXMLParserPublicIdentifierRequiredError@71$NSXMLParserResolveExternalEntitiesAlways@3$NSXMLParserResolveExternalEntitiesNever@0$NSXMLParserResolveExternalEntitiesNoNetwork@1$NSXMLParserResolveExternalEntitiesSameOriginOnly@2$NSXMLParserSeparatorRequiredError@66$NSXMLParserSpaceRequiredError@65$NSXMLParserStandaloneValueError@78$NSXMLParserStringNotClosedError@34$NSXMLParserStringNotStartedError@33$NSXMLParserTagNameMismatchError@76$NSXMLParserURIFragmentError@92$NSXMLParserURIRequiredError@70$NSXMLParserUndeclaredEntityError@26$NSXMLParserUnfinishedTagError@77$NSXMLParserUnknownEncodingError@31$NSXMLParserUnparsedEntityError@28$NSXMLParserXMLDeclNotFinishedError@57$NSXMLParserXMLDeclNotStartedError@56$NSXMLProcessingInstructionKind@5$NSXMLTextKind@7$NSXPCConnectionCodeSigningRequirementFailure@4102$NSXPCConnectionErrorMaximum@4224$NSXPCConnectionErrorMinimum@4096$NSXPCConnectionInterrupted@4097$NSXPCConnectionInvalid@4099$NSXPCConnectionPrivileged@4096$NSXPCConnectionReplyInvalid@4101$NSYearCalendarUnit@4$NSYearForWeekOfYearCalendarUnit@16384$NS_BLOCKS_AVAILABLE@1$NS_BigEndian@2$NS_LittleEndian@1$NS_UNICHAR_IS_EIGHT_BIT@0$NS_UnknownByteOrder@0$""" -misc.update( - { - "NSOrderedCollectionDifferenceCalculationOptions": NewType( - "NSOrderedCollectionDifferenceCalculationOptions", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSTextCheckingResult.h:32:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSTextCheckingResult.h:32:1)", - int, - ), - "NSURLRequestNetworkServiceType": NewType( - "NSURLRequestNetworkServiceType", int - ), - "NSDataBase64DecodingOptions": NewType("NSDataBase64DecodingOptions", int), - "NSURLSessionResponseDisposition": NewType( - "NSURLSessionResponseDisposition", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:114:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:114:1)", - int, - ), - "NSCalculationError": NewType("NSCalculationError", int), - "NSKeyValueObservingOptions": NewType("NSKeyValueObservingOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSUbiquitousKeyValueStore.h:47:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSUbiquitousKeyValueStore.h:47:1)", - int, - ), - "NSJSONReadingOptions": NewType("NSJSONReadingOptions", int), - "NSDataWritingOptions": NewType("NSDataWritingOptions", int), - "NSGrammaticalPerson": NewType("NSGrammaticalPerson", int), - "NSMachPortOptions": NewType("NSMachPortOptions", int), - "NSFileCoordinatorWritingOptions": NewType( - "NSFileCoordinatorWritingOptions", int - ), - "NSNumberFormatterBehavior": NewType("NSNumberFormatterBehavior", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCalendar.h:409:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCalendar.h:409:1)", - int, - ), - "NSDecodingFailurePolicy": NewType("NSDecodingFailurePolicy", int), - "NSXMLNodeOptions": NewType("NSXMLNodeOptions", int), - "NSExpressionType": NewType("NSExpressionType", int), - "NSGrammaticalCase": NewType("NSGrammaticalCase", int), - "NSByteCountFormatterCountStyle": NewType( - "NSByteCountFormatterCountStyle", int - ), - "NSNumberFormatterStyle": NewType("NSNumberFormatterStyle", int), - "NSCompoundPredicateType": NewType("NSCompoundPredicateType", int), - "NSSaveOptions": NewType("NSSaveOptions", int), - "NSRegularExpressionOptions": NewType("NSRegularExpressionOptions", int), - "NSDateFormatterStyle": NewType("NSDateFormatterStyle", int), - "NSRectEdge": NewType("NSRectEdge", int), - "NSGrammaticalPartOfSpeech": NewType("NSGrammaticalPartOfSpeech", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:69:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:69:1)", - int, - ), - "NSURLSessionDelayedRequestDisposition": NewType( - "NSURLSessionDelayedRequestDisposition", int - ), - "NSProcessInfoThermalState": NewType("NSProcessInfoThermalState", int), - "NSStreamEvent": NewType("NSStreamEvent", int), - "NSTestComparisonOperation": NewType("NSTestComparisonOperation", int), - "NSFileManagerUnmountOptions": NewType("NSFileManagerUnmountOptions", int), - "NSCalendarOptions": NewType("NSCalendarOptions", int), - "NSPropertyListFormat": NewType("NSPropertyListFormat", int), - "NSJSONWritingOptions": NewType("NSJSONWritingOptions", int), - "NSURLBookmarkCreationOptions": NewType("NSURLBookmarkCreationOptions", int), - "NSXMLParserExternalEntityResolvingPolicy": NewType( - "NSXMLParserExternalEntityResolvingPolicy", int - ), - "NSURLBookmarkResolutionOptions": NewType( - "NSURLBookmarkResolutionOptions", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCalendar.h:99:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCalendar.h:99:1)", - int, - ), - "NSDataCompressionAlgorithm": NewType("NSDataCompressionAlgorithm", int), - "NSTaskTerminationReason": NewType("NSTaskTerminationReason", int), - "NSLengthFormatterUnit": NewType("NSLengthFormatterUnit", int), - "NSURLSessionMultipathServiceType": NewType( - "NSURLSessionMultipathServiceType", int - ), - "NSNotificationCoalescing": NewType("NSNotificationCoalescing", int), - "NSNetServiceOptions": NewType("NSNetServiceOptions", int), - "NSISO8601DateFormatOptions": NewType("NSISO8601DateFormatOptions", int), - "NSFormattingUnitStyle": NewType("NSFormattingUnitStyle", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSByteOrder.h:10:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSByteOrder.h:10:1)", - int, - ), - "NSCalendarUnit": NewType("NSCalendarUnit", int), - "NSQualityOfService": NewType("NSQualityOfService", int), - "NSPredicateOperatorType": NewType("NSPredicateOperatorType", int), - "NSByteCountFormatterUnits": NewType("NSByteCountFormatterUnits", int), - "NSXMLParserError": NewType("NSXMLParserError", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:100:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:100:1)", - int, - ), - "NSLinguisticTaggerUnit": NewType("NSLinguisticTaggerUnit", int), - "NSGrammaticalGender": NewType("NSGrammaticalGender", int), - "NSTimeZoneNameStyle": NewType("NSTimeZoneNameStyle", int), - "NSItemProviderRepresentationVisibility": NewType( - "NSItemProviderRepresentationVisibility", int - ), - "NSURLRequestCachePolicy": NewType("NSURLRequestCachePolicy", int), - "NSAttributedStringMarkdownInterpretedSyntax": NewType( - "NSAttributedStringMarkdownInterpretedSyntax", int - ), - "NSTextCheckingType": NewType("NSTextCheckingType", int), - "NSMatchingFlags": NewType("NSMatchingFlags", int), - "NSDateComponentsFormatterZeroFormattingBehavior": NewType( - "NSDateComponentsFormatterZeroFormattingBehavior", int - ), - "NSVolumeEnumerationOptions": NewType("NSVolumeEnumerationOptions", int), - "NSGrammaticalDefiniteness": NewType("NSGrammaticalDefiniteness", int), - "NSURLRequestAttribution": NewType("NSURLRequestAttribution", int), - "NSRelativePosition": NewType("NSRelativePosition", int), - "NSMatchingOptions": NewType("NSMatchingOptions", int), - "NSRelativeDateTimeFormatterStyle": NewType( - "NSRelativeDateTimeFormatterStyle", int - ), - "NSBinarySearchingOptions": NewType("NSBinarySearchingOptions", int), - "NSKeyValueChange": NewType("NSKeyValueChange", int), - "NSXPCConnectionOptions": NewType("NSXPCConnectionOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:552:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:552:1)", - int, - ), - "NSPresentationIntentKind": NewType("NSPresentationIntentKind", int), - "NSItemProviderFileOptions": NewType("NSItemProviderFileOptions", int), - "NSURLRelationship": NewType("NSURLRelationship", int), - "NSRelativeDateTimeFormatterUnitsStyle": NewType( - "NSRelativeDateTimeFormatterUnitsStyle", int - ), - "NSURLSessionTaskState": NewType("NSURLSessionTaskState", int), - "NSSearchPathDirectory": NewType("NSSearchPathDirectory", int), - "NSURLSessionTaskMetricsResourceFetchType": NewType( - "NSURLSessionTaskMetricsResourceFetchType", int - ), - "NSXMLNodeKind": NewType("NSXMLNodeKind", int), - "NSStreamStatus": NewType("NSStreamStatus", int), - "NSURLSessionWebSocketCloseCode": NewType( - "NSURLSessionWebSocketCloseCode", int - ), - "NSNumberFormatterPadPosition": NewType("NSNumberFormatterPadPosition", int), - "NSMeasurementFormatterUnitOptions": NewType( - "NSMeasurementFormatterUnitOptions", int - ), - "NSFileWrapperWritingOptions": NewType("NSFileWrapperWritingOptions", int), - "NSInlinePresentationIntent": NewType("NSInlinePresentationIntent", int), - "NSComparisonPredicateModifier": NewType("NSComparisonPredicateModifier", int), - "NSFileVersionAddingOptions": NewType("NSFileVersionAddingOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:68:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:68:1)", - int, - ), - "NSOperationQueuePriority": NewType("NSOperationQueuePriority", int), - "NSKeyValueSetMutationKind": NewType("NSKeyValueSetMutationKind", int), - "NSFileVersionReplacingOptions": NewType("NSFileVersionReplacingOptions", int), - "NSPostingStyle": NewType("NSPostingStyle", int), - "NSInsertionPosition": NewType("NSInsertionPosition", int), - "NSURLSessionAuthChallengeDisposition": NewType( - "NSURLSessionAuthChallengeDisposition", int - ), - "NSFileWrapperReadingOptions": NewType("NSFileWrapperReadingOptions", int), - "NSActivityOptions": NewType("NSActivityOptions", int), - "NSFileCoordinatorReadingOptions": NewType( - "NSFileCoordinatorReadingOptions", int - ), - "NSNumberFormatterRoundingMode": NewType("NSNumberFormatterRoundingMode", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSProcessInfo.h:11:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSProcessInfo.h:11:1)", - int, - ), - "NSUserNotificationActivationType": NewType( - "NSUserNotificationActivationType", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:14:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:14:1)", - int, - ), - "NSDataBase64EncodingOptions": NewType("NSDataBase64EncodingOptions", int), - "NSPropertyListMutabilityOptions": NewType( - "NSPropertyListMutabilityOptions", int - ), - "NSNetServicesError": NewType("NSNetServicesError", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSScriptCommand.h:13:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSScriptCommand.h:13:1)", - int, - ), - "NSPersonNameComponentsFormatterStyle": NewType( - "NSPersonNameComponentsFormatterStyle", int - ), - "NSAttributedStringEnumerationOptions": NewType( - "NSAttributedStringEnumerationOptions", int - ), - "NSEnumerationOptions": NewType("NSEnumerationOptions", int), - "NSDistributedNotificationOptions": NewType( - "NSDistributedNotificationOptions", int - ), - "NSHTTPCookieAcceptPolicy": NewType("NSHTTPCookieAcceptPolicy", int), - "NSURLCacheStoragePolicy": NewType("NSURLCacheStoragePolicy", int), - "NSCollectionChangeType": NewType("NSCollectionChangeType", int), - "NSDateComponentsFormatterUnitsStyle": NewType( - "NSDateComponentsFormatterUnitsStyle", int - ), - "NSStringCompareOptions": NewType("NSStringCompareOptions", int), - "NSItemProviderErrorCode": NewType("NSItemProviderErrorCode", int), - "NSGrammaticalDetermination": NewType("NSGrammaticalDetermination", int), - "NSDataReadingOptions": NewType("NSDataReadingOptions", int), - "NSURLSessionWebSocketMessageType": NewType( - "NSURLSessionWebSocketMessageType", int - ), - "NSNotificationSuspensionBehavior": NewType( - "NSNotificationSuspensionBehavior", int - ), - "NSSearchPathDomainMask": NewType("NSSearchPathDomainMask", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:32:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:32:1)", - int, - ), - "NSDataSearchOptions": NewType("NSDataSearchOptions", int), - "NSMassFormatterUnit": NewType("NSMassFormatterUnit", int), - "NSAppleEventSendOptions": NewType("NSAppleEventSendOptions", int), - "NSURLHandleStatus": NewType("NSURLHandleStatus", int), - "NSRoundingMode": NewType("NSRoundingMode", int), - "NSStringEnumerationOptions": NewType("NSStringEnumerationOptions", int), - "NSDirectoryEnumerationOptions": NewType("NSDirectoryEnumerationOptions", int), - "NSAlignmentOptions": NewType("NSAlignmentOptions", int), - "NSFormattingContext": NewType("NSFormattingContext", int), - "NSDateIntervalFormatterStyle": NewType("NSDateIntervalFormatterStyle", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSScriptObjectSpecifiers.h:13:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSScriptObjectSpecifiers.h:13:1)", - int, - ), - "NSGrammaticalPronounType": NewType("NSGrammaticalPronounType", int), - "NSBackgroundActivityResult": NewType("NSBackgroundActivityResult", int), - "NSSortOptions": NewType("NSSortOptions", int), - "NSComparisonResult": NewType("NSComparisonResult", int), - "NSPersonNameComponentsFormatterOptions": NewType( - "NSPersonNameComponentsFormatterOptions", int - ), - "NSPresentationIntentTableColumnAlignment": NewType( - "NSPresentationIntentTableColumnAlignment", int - ), - "NSLinguisticTaggerOptions": NewType("NSLinguisticTaggerOptions", int), - "NSURLErrorNetworkUnavailableReason": NewType( - "NSURLErrorNetworkUnavailableReason", int - ), - "NSXMLDTDNodeKind": NewType("NSXMLDTDNodeKind", int), - "NSWhoseSubelementIdentifier": NewType("NSWhoseSubelementIdentifier", int), - "NSComparisonPredicateOptions": NewType("NSComparisonPredicateOptions", int), - "NSEnergyFormatterUnit": NewType("NSEnergyFormatterUnit", int), - "NSAttributedStringFormattingOptions": NewType( - "NSAttributedStringFormattingOptions", int - ), - "NSAttributedStringMarkdownParsingFailurePolicy": NewType( - "NSAttributedStringMarkdownParsingFailurePolicy", int - ), - "NSStringEncodingConversionOptions": NewType( - "NSStringEncodingConversionOptions", int - ), - "NSURLSessionTaskMetricsDomainResolutionProtocol": NewType( - "NSURLSessionTaskMetricsDomainResolutionProtocol", int - ), - "NSPointerFunctionsOptions": NewType("NSPointerFunctionsOptions", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/FoundationErrors.h:11:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/FoundationErrors.h:11:1)", - int, - ), - "NSDateFormatterBehavior": NewType("NSDateFormatterBehavior", int), - "NSGrammaticalNumber": NewType("NSGrammaticalNumber", int), - "NSURLCredentialPersistence": NewType("NSURLCredentialPersistence", int), - "NSFileManagerItemReplacementOptions": NewType( - "NSFileManagerItemReplacementOptions", int - ), - "NSXMLDocumentContentKind": NewType("NSXMLDocumentContentKind", int), - "NSLocaleLanguageDirection": NewType("NSLocaleLanguageDirection", int), - } -) -misc.update( - { - "NSURLFileResourceType": NewType("NSURLFileResourceType", str), - "NSURLUbiquitousSharedItemRole": NewType("NSURLUbiquitousSharedItemRole", str), - "NSHTTPCookiePropertyKey": NewType("NSHTTPCookiePropertyKey", str), - "NSValueTransformerName": NewType("NSValueTransformerName", str), - "NSStringTransform": NewType("NSStringTransform", str), - "NSProgressUserInfoKey": NewType("NSProgressUserInfoKey", str), - "NSURLFileProtectionType": NewType("NSURLFileProtectionType", str), - "NSURLThumbnailDictionaryItem": NewType("NSURLThumbnailDictionaryItem", str), - "NSRunLoopMode": NewType("NSRunLoopMode", str), - "NSLocaleKey": NewType("NSLocaleKey", str), - "NSURLUbiquitousSharedItemPermissions": NewType( - "NSURLUbiquitousSharedItemPermissions", str - ), - "NSFileProviderServiceName": NewType("NSFileProviderServiceName", str), - "NSTextCheckingKey": NewType("NSTextCheckingKey", str), - "NSCalendarIdentifier": NewType("NSCalendarIdentifier", str), - "NSProgressFileOperationKind": NewType("NSProgressFileOperationKind", str), - "NSFileAttributeType": NewType("NSFileAttributeType", str), - "NSStreamSOCKSProxyConfiguration": NewType( - "NSStreamSOCKSProxyConfiguration", str - ), - "NSKeyValueOperator": NewType("NSKeyValueOperator", str), - "NSLinguisticTagScheme": NewType("NSLinguisticTagScheme", str), - "NSStreamPropertyKey": NewType("NSStreamPropertyKey", str), - "NSFileProtectionType": NewType("NSFileProtectionType", str), - "NSProgressKind": NewType("NSProgressKind", str), - "NSHTTPCookieStringPolicy": NewType("NSHTTPCookieStringPolicy", str), - "NSKeyValueChangeKey": NewType("NSKeyValueChangeKey", str), - "NSURLUbiquitousItemDownloadingStatus": NewType( - "NSURLUbiquitousItemDownloadingStatus", str - ), - "NSStreamNetworkServiceTypeValue": NewType( - "NSStreamNetworkServiceTypeValue", str - ), - "NSStreamSOCKSProxyVersion": NewType("NSStreamSOCKSProxyVersion", str), - "NSFileAttributeKey": NewType("NSFileAttributeKey", str), - "NSLinguisticTag": NewType("NSLinguisticTag", str), - "NSDistributedNotificationCenterType": NewType( - "NSDistributedNotificationCenterType", str - ), - "NSExceptionName": NewType("NSExceptionName", str), - "NSNotificationName": NewType("NSNotificationName", str), - "NSAttributedStringKey": NewType("NSAttributedStringKey", str), - "NSURLResourceKey": NewType("NSURLResourceKey", str), - "NSStringEncodingDetectionOptionsKey": NewType( - "NSStringEncodingDetectionOptionsKey", str - ), - "NSStreamSocketSecurityLevel": NewType("NSStreamSocketSecurityLevel", str), - } -) -misc.update( - { - "NSFoundationVersionNumber10_2_3": 462.0, - "NSFoundationVersionNumber10_2_2": 462.0, - "NSFoundationVersionNumber10_2_1": 462.0, - "NSFoundationVersionNumber10_2_7": 462.7, - "NSFoundationVersionNumber10_2_6": 462.0, - "NSFoundationVersionNumber10_2_5": 462.0, - "NSFoundationVersionNumber10_2_4": 462.0, - "NSFoundationVersionNumber10_1_4": 425.0, - "NSFoundationVersionNumber10_4_4_Intel": 567.23, - "NSFoundationVersionNumber10_2_8": 462.7, - "NSFoundationVersionNumber10_1_1": 425.0, - "NSFoundationVersionNumber10_1_2": 425.0, - "NSFoundationVersionNumber10_1_3": 425.0, - "NSFoundationVersionNumber10_4_9": 567.29, - "NSFoundationVersionNumber10_3_2": 500.3, - "NSFoundationVersionNumber10_3_8": 500.56, - "NSFoundationVersionNumber10_3_9": 500.58, - "NSFoundationVersionNumber10_5_4": 677.19, - "NSFoundationVersionNumber10_5_5": 677.21, - "NSFoundationVersionNumber10_5_6": 677.22, - "NSFoundationVersionNumber10_5_7": 677.24, - "NSFoundationVersionNumber10_4_1": 567.0, - "NSFoundationVersionNumber10_3_3": 500.54, - "NSFoundationVersionNumber10_4_3": 567.21, - "NSFoundationVersionNumber10_3_1": 500.0, - "NSFoundationVersionNumber10_3_6": 500.56, - "NSFoundationVersionNumber10_3_7": 500.56, - "NSFoundationVersionNumber10_3_4": 500.56, - "NSFoundationVersionNumber10_3_5": 500.56, - "NSFoundationVersionNumber10_4_2": 567.12, - "NSFoundationVersionNumber10_11_3": 1256.1, - "NSFoundationVersionNumber10_5_1": 677.1, - "NSFoundationVersionNumber10_4_5": 567.25, - "NSFoundationVersionNumber10_6": 751.0, - "NSFoundationVersionNumber10_7": 833.1, - "NSFoundationVersionNumber10_4": 567.0, - "NSFoundationVersionNumber10_5": 677.0, - "NSFoundationVersionNumber10_2": 462.0, - "NSFoundationVersionNumber10_4_7": 567.27, - "NSFoundationVersionNumber10_0": 397.4, - "NSFoundationVersionNumber10_1": 425.0, - "NSFoundationVersionNumber10_4_6": 567.26, - "NSFoundationVersionNumber10_8": 945.0, - "NSFoundationVersionNumber10_3": 500.0, - "NSFoundationVersionNumber10_4_4_PowerPC": 567.21, - "NSFoundationVersionNumber10_4_11": 567.36, - "NSFoundationVersionNumber10_4_10": 567.29, - "NSFoundationVersionNumber10_9_2": 1056.13, - "NSFoundationVersionNumber10_11_1": 1255.1, - "NSFoundationVersionNumber10_8_4": 945.18, - "NSFoundationVersionNumber10_10_4": 1153.2, - "NSFoundationVersionNumber10_8_1": 945.0, - "NSFoundationVersionNumber10_10_2": 1152.14, - "NSFoundationVersionNumber10_10_1": 1151.16, - "NSFoundationVersionNumber10_8_2": 945.11, - "NSFoundationVersionNumber10_10": 1151.16, - "NSFoundationVersionNumber10_8_3": 945.16, - "NSTimeIntervalSince1970": 978307200.0, - "NSFoundationVersionNumber10_6_7": 751.53, - "NSFoundationVersionNumber10_11_2": 1256.1, - "NSFoundationVersionNumber10_6_5": 751.42, - "NSFoundationVersionNumber10_6_4": 751.29, - "NSFoundationVersionNumber10_6_3": 751.21, - "NSFoundationVersionNumber10_6_2": 751.14, - "NSFoundationVersionNumber10_6_1": 751.0, - "NSFoundationVersionNumber10_4_8": 567.28, - "NSFoundationVersionNumber10_10_3": 1153.2, - "NSFoundationVersionNumber10_5_2": 677.15, - "NSFoundationVersionNumber10_6_8": 751.62, - "NSFoundationVersionNumber10_6_6": 751.53, - "NSFoundationVersionNumber10_5_3": 677.19, - "NSFoundationVersionNumber10_7_4": 833.25, - "NSFoundationVersionNumber10_5_8": 677.26, - "NSFoundationVersionNumber10_7_2": 833.2, - "NSFoundationVersionNumber10_7_3": 833.24, - "NSFoundationVersionNumber10_7_1": 833.1, - } -) -functions = { - "NSSwapShort": (b"SS",), - "NSDecimalIsNotANumber": ( - b"Z^{NSDecimal=b8b4b1b1b18[8S]}", - "", - {"arguments": {0: {"type_modifier": "n"}}}, - ), - "NSSwapHostIntToBig": (b"II",), - "NSDecimalDivide": ( - b"Q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}Q", - "", - { - "arguments": { - 0: {"type_modifier": "o"}, - 1: {"type_modifier": "n"}, - 2: {"type_modifier": "n"}, - } - }, - ), - "NSEndMapTableEnumeration": ( - b"v^{NSMapEnumerator=QQ^v}", - "", - {"arguments": {0: {"type_modifier": "N"}}}, - ), - "NSEqualRects": ( - b"Z{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSIntegralRect": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSEqualSizes": (b"Z{CGSize=dd}{CGSize=dd}",), - "NSSwapHostLongToLittle": (b"QQ",), - "NSSwapLittleDoubleToHost": (b"d{NSSwappedDouble=Q}",), - "NSSizeFromCGSize": (b"{CGSize=dd}{CGSize=dd}",), - "NSDecimalCompact": ( - b"v^{NSDecimal=b8b4b1b1b18[8S]}", - "", - {"arguments": {0: {"type_modifier": "N"}}}, - ), - "NSCreateHashTable": ( - b"@{NSHashTableCallBacks=^?^?^?^?^?}Q", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSOpenStepRootDirectory": (b"@",), - "NSRoundDownToMultipleOfPageSize": (b"QQ",), - "NSMapInsertIfAbsent": (b"^v@^v^v",), - "NSLocationInRange": (b"ZQ{_NSRange=QQ}",), - "NSOffsetRect": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}dd", - ), - "NSEqualRanges": (b"Z{_NSRange=QQ}{_NSRange=QQ}",), - "NSDecimalNormalize": ( - b"Q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}Q", - "", - {"arguments": {0: {"type_modifier": "o"}, 1: {"type_modifier": "n"}}}, - ), - "NSFreeHashTable": (b"v@",), - "NSHostByteOrder": (b"q",), - "NSGetUncaughtExceptionHandler": ( - b"^?", - "", - { - "retval": { - "callable": {"retval": {"type": "v"}, "arguments": {0: {"type": "@"}}} - } - }, - ), - "NSStringFromMapTable": (b"@@",), - "NSPointFromString": (b"{CGPoint=dd}@",), - "NSEnumerateMapTable": (b"{NSMapEnumerator=QQ^v}@",), - "NSIsEmptyRect": (b"Z{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSHeight": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSHomeDirectory": (b"@",), - "NSResetMapTable": (b"v@",), - "NSMinY": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSPageSize": (b"Q",), - "NSUserName": (b"@",), - "NSMapInsert": (b"v@^v^v",), - "NSDeallocateObject": (b"v@",), - "NSDefaultMallocZone": (b"^{_NSZone=}",), - "NSRecordAllocationEvent": (b"vi@",), - "NSDecimalPower": ( - b"Q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}QQ", - "", - {"arguments": {0: {"type_modifier": "o"}, 1: {"type_modifier": "n"}}}, - ), - "NSMaxRange": (b"Q{_NSRange=QQ}",), - "NSMinX": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSLogPageSize": (b"Q",), - "NSMouseInRect": (b"Z{CGPoint=dd}{CGRect={CGPoint=dd}{CGSize=dd}}Z",), - "NSDecimalCompare": ( - b"q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}", - "", - {"arguments": {0: {"type_modifier": "n"}, 1: {"type_modifier": "n"}}}, - ), - "NSAllMapTableValues": (b"@@",), - "NSProtocolFromString": (b"@@",), - "NSPointInRect": (b"Z{CGPoint=dd}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSSetZoneName": (b"v^{_NSZone=}@",), - "CFBridgingRetain": (b"@@",), - "NSCopyObject": (b"@@Q^{_NSZone=}", "", {"retval": {"already_cfretained": True}}), - "NSMidY": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSSwapLongLong": (b"QQ",), - "NSDecrementExtraRefCountWasZero": (b"Z@",), - "NSDecimalMultiply": ( - b"Q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}Q", - "", - { - "arguments": { - 0: {"type_modifier": "o"}, - 1: {"type_modifier": "n"}, - 2: {"type_modifier": "n"}, - } - }, - ), - "NSSwapBigLongLongToHost": (b"QQ",), - "NSShouldRetainWithZone": (b"Z@^{_NSZone=}",), - "NSStringFromRange": (b"@{_NSRange=QQ}",), - "NSHashGet": (b"^v@^v",), - "NSStringFromClass": (b"@#",), - "NSPointToCGPoint": (b"{CGPoint=dd}{CGPoint=dd}",), - "NSUnionRect": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSRectToCGRect": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSCopyHashTableWithZone": ( - b"@@^{_NSZone=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSSwapBigShortToHost": (b"SS",), - "NSSwapHostShortToBig": (b"SS",), - "NSStringFromPoint": (b"@{CGPoint=dd}",), - "NSWidth": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSRealMemoryAvailable": (b"Q",), - "NSNextMapEnumeratorPair": ( - b"Z^{NSMapEnumerator=QQ^v}^^v^^v", - "", - { - "arguments": { - 0: {"type_modifier": "N"}, - 1: {"type_modifier": "o"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "NSAllHashTableObjects": (b"@@",), - "NSPointFromCGPoint": (b"{CGPoint=dd}{CGPoint=dd}",), - "NSSizeToCGSize": (b"{CGSize=dd}{CGSize=dd}",), - "NSHashInsertKnownAbsent": (b"v@^v",), - "NSNextHashEnumeratorItem": ( - b"^v^{NSHashEnumerator=QQ^v}", - "", - {"arguments": {0: {"type_modifier": "N"}}}, - ), - "NSSwapHostLongLongToLittle": (b"QQ",), - "NSClassFromString": (b"#@",), - "NSSwapLittleLongToHost": (b"QQ",), - "NSMakePoint": (b"{CGPoint=dd}dd",), - "NSSizeFromString": (b"{CGSize=dd}@",), - "NSConvertHostFloatToSwapped": (b"{NSSwappedFloat=I}f",), - "NSIntersectsRect": ( - b"Z{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSEdgeInsetsMake": (b"{NSEdgeInsets=dddd}dddd",), - "NSIntersectionRect": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSDecimalAdd": ( - b"Q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}Q", - "", - { - "arguments": { - 0: {"type_modifier": "o"}, - 1: {"type_modifier": "n"}, - 2: {"type_modifier": "n"}, - } - }, - ), - "NSCreateHashTableWithZone": ( - b"@{NSHashTableCallBacks=^?^?^?^?^?}Q^{_NSZone=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSSwapFloat": (b"{NSSwappedFloat=I}{NSSwappedFloat=I}",), - "NSDecimalSubtract": ( - b"Q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}Q", - "", - { - "arguments": { - 0: {"type_modifier": "o"}, - 1: {"type_modifier": "n"}, - 2: {"type_modifier": "n"}, - } - }, - ), - "NSSetUncaughtExceptionHandler": ( - b"v^?", - "", - { - "arguments": { - 0: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"@"}}, - }, - "callable_retained": True, - } - } - }, - ), - "NSFreeMapTable": (b"v@",), - "NSMapRemove": (b"v@^v",), - "NSFullUserName": (b"@",), - "NSSwapLittleShortToHost": (b"SS",), - "NSSwapLong": (b"QQ",), - "NSSwapHostLongLongToBig": (b"QQ",), - "NSResetHashTable": (b"v@",), - "NSStringFromRect": (b"@{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSSwapLittleLongLongToHost": (b"QQ",), - "NSSwapLittleFloatToHost": (b"f{NSSwappedFloat=I}",), - "NSSwapBigLongToHost": (b"QQ",), - "NSCountMapTable": (b"Q@",), - "NSHFSTypeOfFile": (b"@@",), - "NSHashInsertIfAbsent": (b"^v@^v",), - "NSSwapBigIntToHost": (b"II",), - "NSRecycleZone": (b"v^{_NSZone=}",), - "NSStringFromProtocol": (b"@@",), - "NSFrameAddress": (b"^vQ",), - "NSCountFrames": (b"Q",), - "CFBridgingRelease": (b"@@",), - "NSMapMember": ( - b"Z@^v^^v^^v", - "", - {"arguments": {2: {"type_modifier": "o"}, 3: {"type_modifier": "o"}}}, - ), - "NSDivideRect": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}^{CGRect={CGPoint=dd}{CGSize=dd}}^{CGRect={CGPoint=dd}{CGSize=dd}}dQ", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "NSRangeFromString": (b"{_NSRange=QQ}@",), - "NSMapGet": (b"^v@^v",), - "NSHashInsert": (b"v@^v",), - "NSSwapHostIntToLittle": (b"II",), - "NSEndHashTableEnumeration": ( - b"v^{NSHashEnumerator=QQ^v}", - "", - {"arguments": {0: {"type_modifier": "N"}}}, - ), - "NSZoneName": (b"@^{_NSZone=}",), - "NSSwapHostFloatToBig": (b"{NSSwappedFloat=I}f",), - "NSTemporaryDirectory": (b"@",), - "NSDecimalMultiplyByPowerOf10": ( - b"Q^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}sQ", - "", - {"arguments": {0: {"type_modifier": "o"}, 1: {"type_modifier": "n"}}}, - ), - "NSCompareHashTables": (b"Z@@",), - "NSMakeRect": (b"{CGRect={CGPoint=dd}{CGSize=dd}}dddd",), - "NSMakeCollectable": (b"@@",), - "NSGetSizeAndAlignment": ( - b"^t^t^Q^Q", - "", - { - "retval": {"c_array_delimited_by_null": True}, - "arguments": { - 0: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 1: {"type_modifier": "o"}, - 2: {"type_modifier": "o"}, - }, - }, - ), - "NSDecimalRound": ( - b"v^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}qQ", - "", - {"arguments": {0: {"type_modifier": "o"}, 1: {"type_modifier": "n"}}}, - ), - "NSInsetRect": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}dd", - ), - "NSAllocateObject": (b"@#Q^{_NSZone=}",), - "NSSwapInt": (b"II",), - "NSUnionRange": (b"{_NSRange=QQ}{_NSRange=QQ}{_NSRange=QQ}",), - "NSSelectorFromString": (b":@",), - "NSStringFromHashTable": (b"@@",), - "NSHFSTypeCodeFromFileType": (b"I@",), - "NSSwapDouble": (b"{NSSwappedDouble=Q}{NSSwappedDouble=Q}",), - "NSLog": (b"v@", "", {"arguments": {0: {"printf_format": True}}, "variadic": True}), - "NSMakeSize": (b"{CGSize=dd}dd",), - "NSSwapHostDoubleToLittle": (b"{NSSwappedDouble=Q}d",), - "NSRectFromString": (b"{CGRect={CGPoint=dd}{CGSize=dd}}@",), - "NSDecimalString": ( - b"@^{NSDecimal=b8b4b1b1b18[8S]}@", - "", - {"arguments": {0: {"type_modifier": "n"}}}, - ), - "NSCreateZone": (b"^{_NSZone=}QQZ", "", {"retval": {"already_cfretained": True}}), - "NSAllMapTableKeys": (b"@@",), - "NSIncrementExtraRefCount": (b"v@",), - "NSDecimalCopy": ( - b"v^{NSDecimal=b8b4b1b1b18[8S]}^{NSDecimal=b8b4b1b1b18[8S]}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {0: {"type_modifier": "o"}, 1: {"type_modifier": "n"}}, - }, - ), - "NSStringFromSelector": (b"@:",), - "NSMakeRange": (b"{_NSRange=QQ}QQ",), - "NSConvertSwappedFloatToHost": (b"f{NSSwappedFloat=I}",), - "NSContainsRect": ( - b"Z{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSSwapBigDoubleToHost": (b"d{NSSwappedDouble=Q}",), - "NSIntersectionRange": (b"{_NSRange=QQ}{_NSRange=QQ}{_NSRange=QQ}",), - "NSSwapHostDoubleToBig": (b"{NSSwappedDouble=Q}d",), - "NSRoundUpToMultipleOfPageSize": (b"QQ",), - "NSConvertHostDoubleToSwapped": (b"{NSSwappedDouble=Q}d",), - "NSSwapHostLongToBig": (b"QQ",), - "NSMaxY": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSMaxX": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSCreateMapTableWithZone": ( - b"@{NSMapTableKeyCallBacks=^?^?^?^?^?^v}{NSMapTableValueCallBacks=^?^?^?}Q^{_NSZone=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSExtraRefCount": (b"Q@",), - "NSRectFromCGRect": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "NSIntegralRectWithOptions": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}Q", - ), - "NSStringFromSize": (b"@{CGSize=dd}",), - "NSHomeDirectoryForUser": (b"@@",), - "NSIsFreedObject": (b"Z@",), - "NSSwapBigFloatToHost": (b"f{NSSwappedFloat=I}",), - "NSConvertSwappedDoubleToHost": (b"d{NSSwappedDouble=Q}",), - "NSMidX": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "NSReturnAddress": (b"^vQ",), - "NSEqualPoints": (b"Z{CGPoint=dd}{CGPoint=dd}",), - "NSCompareMapTables": (b"Z@@",), - "NSHashRemove": (b"v@^v",), - "NSSwapLittleIntToHost": (b"II",), - "NSCountHashTable": (b"Q@",), - "NSMapInsertKnownAbsent": (b"v@^v^v",), - "NSCreateMapTable": ( - b"@{NSMapTableKeyCallBacks=^?^?^?^?^?^v}{NSMapTableValueCallBacks=^?^?^?}Q", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSSwapHostFloatToLittle": (b"{NSSwappedFloat=I}f",), - "NSEdgeInsetsEqual": (b"Z{NSEdgeInsets=dddd}{NSEdgeInsets=dddd}",), - "NSEnumerateHashTable": (b"{NSHashEnumerator=QQ^v}@",), - "NXReadNSObjectFromCoder": (b"@@",), - "NSCopyMapTableWithZone": ( - b"@@^{_NSZone=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "NSSwapHostShortToLittle": (b"SS",), - "NSSearchPathForDirectoriesInDomains": (b"@QQZ",), -} -aliases = { - "NSCalendarUnitYear": "kCFCalendarUnitYear", - "NSURLErrorBadURL": "kCFURLErrorBadURL", - "NSWeekCalendarUnit": "kCFCalendarUnitWeek", - "NSAppleEventSendNoReply": "kAENoReply", - "NSURLErrorCannotCreateFile": "kCFURLErrorCannotCreateFile", - "NSWeekdayCalendarUnit": "NSCalendarUnitWeekday", - "NSURLErrorFileIsDirectory": "kCFURLErrorFileIsDirectory", - "NSPropertyListXMLFormat_v1_0": "kCFPropertyListXMLFormat_v1_0", - "NSHashTableZeroingWeakMemory": "NSPointerFunctionsZeroingWeakMemory", - "NSNumberFormatterPadBeforeSuffix": "kCFNumberFormatterPadBeforeSuffix", - "NSCalendarUnitWeekdayOrdinal": "kCFCalendarUnitWeekdayOrdinal", - "NSNumberFormatterDecimalStyle": "kCFNumberFormatterDecimalStyle", - "NSMinuteCalendarUnit": "NSCalendarUnitMinute", - "NSURLErrorRequestBodyStreamExhausted": "kCFURLErrorRequestBodyStreamExhausted", - "NSHashTableCopyIn": "NSPointerFunctionsCopyIn", - "NSISO8601DateFormatWithYear": "kCFISO8601DateFormatWithYear", - "NSWeekOfMonthCalendarUnit": "NSCalendarUnitWeekOfMonth", - "NSDateFormatterNoStyle": "kCFDateFormatterNoStyle", - "NSTimeZoneCalendarUnit": "NSCalendarUnitTimeZone", - "NSNumberFormatterSpellOutStyle": "kCFNumberFormatterSpellOutStyle", - "NSNumberFormatterCurrencyPluralStyle": "kCFNumberFormatterCurrencyPluralStyle", - "NSISO8601DateFormatWithDay": "kCFISO8601DateFormatWithDay", - "NSURLErrorDataNotAllowed": "kCFURLErrorDataNotAllowed", - "NSPropertyListOpenStepFormat": "kCFPropertyListOpenStepFormat", - "NS_UnknownByteOrder": "CFByteOrderUnknown", - "NS_FALLTHROUGH": "CF_FALLTHROUGH", - "NSCalendarUnitWeekOfMonth": "kCFCalendarUnitWeekOfMonth", - "NSURLErrorCallIsActive": "kCFURLErrorCallIsActive", - "NSISO8601DateFormatWithDashSeparatorInDate": "kCFISO8601DateFormatWithDashSeparatorInDate", - "NSCalendarUnitHour": "kCFCalendarUnitHour", - "NSURLErrorSecureConnectionFailed": "kCFURLErrorSecureConnectionFailed", - "NSAppleEventSendAlwaysInteract": "kAEAlwaysInteract", - "NSRectEdgeMaxX": "NSMaxXEdge", - "NSRectEdgeMaxY": "NSMaxYEdge", - "NSNumberFormatterRoundCeiling": "kCFNumberFormatterRoundCeiling", - "NSURLErrorServerCertificateUntrusted": "kCFURLErrorServerCertificateUntrusted", - "NSAppleEventSendCanSwitchLayer": "kAECanSwitchLayer", - "NS_STRING_ENUM": "_NS_TYPED_ENUM", - "NSLocaleLanguageDirectionTopToBottom": "kCFLocaleLanguageDirectionTopToBottom", - "NSNumberFormatterPadAfterPrefix": "kCFNumberFormatterPadAfterPrefix", - "NSURLErrorNoPermissionsToReadFile": "kCFURLErrorNoPermissionsToReadFile", - "NSQuarterCalendarUnit": "NSCalendarUnitQuarter", - "NSNumberFormatterPercentStyle": "kCFNumberFormatterPercentStyle", - "NSISO8601DateFormatWithFullTime": "kCFISO8601DateFormatWithFullTime", - "NSIntegerMin": "LONG_MIN", - "NS_TYPED_ENUM": "_NS_TYPED_ENUM", - "NSLocaleLanguageDirectionLeftToRight": "kCFLocaleLanguageDirectionLeftToRight", - "NSNumberFormatterPadAfterSuffix": "kCFNumberFormatterPadAfterSuffix", - "NSURLErrorClientCertificateRequired": "kCFURLErrorClientCertificateRequired", - "NSSecondCalendarUnit": "NSCalendarUnitSecond", - "NSURLErrorCannotConnectToHost": "kCFURLErrorCannotConnectToHost", - "NSNumberFormatterOrdinalStyle": "kCFNumberFormatterOrdinalStyle", - "NSURLErrorZeroByteResource": "kCFURLErrorZeroByteResource", - "NSMonthCalendarUnit": "NSCalendarUnitMonth", - "NSNumberFormatterNoStyle": "kCFNumberFormatterNoStyle", - "NSHashTableWeakMemory": "NSPointerFunctionsWeakMemory", - "NSAppleEventSendDontExecute": "kAEDontExecute", - "NS_NONATOMIC_IOSONLY": "atomic", - "NSURLErrorClientCertificateRejected": "kCFURLErrorClientCertificateRejected", - "NSURLErrorUserCancelledAuthentication": "kCFURLErrorUserCancelledAuthentication", - "NSCalendarUnitWeekOfYear": "kCFCalendarUnitWeekOfYear", - "NSDateFormatterLongStyle": "kCFDateFormatterLongStyle", - "NSURLErrorCannotLoadFromNetwork": "kCFURLErrorCannotLoadFromNetwork", - "NSWeekdayOrdinalCalendarUnit": "NSCalendarUnitWeekdayOrdinal", - "NSURLErrorResourceUnavailable": "kCFURLErrorResourceUnavailable", - "NSURLErrorNetworkConnectionLost": "kCFURLErrorNetworkConnectionLost", - "NS_LittleEndian": "CFByteOrderLittleEndian", - "NSEraCalendarUnit": "NSCalendarUnitEra", - "NSISO8601DateFormatWithColonSeparatorInTime": "kCFISO8601DateFormatWithColonSeparatorInTime", - "NSPropertyListMutableContainers": "kCFPropertyListMutableContainers", - "NSHashTableObjectPointerPersonality": "NSPointerFunctionsObjectPointerPersonality", - "NS_VOIDRETURN": "return", - "NS_REFINED_FOR_SWIFT": "CF_REFINED_FOR_SWIFT", - "NS_EXTENSIBLE_STRING_ENUM": "_NS_TYPED_EXTENSIBLE_ENUM", - "NSOperationQualityOfServiceUtility": "NSQualityOfServiceUtility", - "NSNumberFormatterCurrencyAccountingStyle": "kCFNumberFormatterCurrencyAccountingStyle", - "NSPropertyListBinaryFormat_v1_0": "kCFPropertyListBinaryFormat_v1_0", - "NSURLErrorDNSLookupFailed": "kCFURLErrorDNSLookupFailed", - "NSYearCalendarUnit": "NSCalendarUnitYear", - "NS_NONATOMIC_IPHONEONLY": "NS_NONATOMIC_IOSONLY", - "NSURLErrorRedirectToNonExistentLocation": "kCFURLErrorRedirectToNonExistentLocation", - "NSURLErrorNotConnectedToInternet": "kCFURLErrorNotConnectedToInternet", - "NSDataReadingMapped": "NSDataReadingMappedIfSafe", - "_NS_TYPED_EXTENSIBLE_ENUM": "_CF_TYPED_EXTENSIBLE_ENUM", - "NSURLErrorCannotDecodeRawData": "kCFURLErrorCannotDecodeRawData", - "NSMapTableObjectPointerPersonality": "NSPointerFunctionsObjectPointerPersonality", - "NSURLErrorCannotMoveFile": "kCFURLErrorCannotMoveFile", - "NSPropertyListMutableContainersAndLeaves": "kCFPropertyListMutableContainersAndLeaves", - "NSURLErrorCancelled": "kCFURLErrorCancelled", - "NSRectEdgeMinX": "NSMinXEdge", - "NSRectEdgeMinY": "NSMinYEdge", - "NSPropertyListImmutable": "kCFPropertyListImmutable", - "NSCalendarUnitYearForWeekOfYear": "kCFCalendarUnitYearForWeekOfYear", - "NSCalendarCalendarUnit": "NSCalendarUnitCalendar", - "NSURLErrorDownloadDecodingFailedMidStream": "kCFURLErrorDownloadDecodingFailedMidStream", - "NSURLErrorTimedOut": "kCFURLErrorTimedOut", - "NSISO8601DateFormatWithFullDate": "kCFISO8601DateFormatWithFullDate", - "NSNumberFormatterRoundFloor": "kCFNumberFormatterRoundFloor", - "NSRect": "CGRect", - "NSOperationQualityOfServiceUserInitiated": "NSQualityOfServiceUserInitiated", - "NSCalendarUnitWeekday": "kCFCalendarUnitWeekday", - "NS_BigEndian": "CFByteOrderBigEndian", - "NSMapTableZeroingWeakMemory": "NSPointerFunctionsZeroingWeakMemory", - "NS_UNAVAILABLE": "UNAVAILABLE_ATTRIBUTE", - "NSOperationQualityOfServiceUserInteractive": "NSQualityOfServiceUserInteractive", - "NSURLErrorCannotDecodeContentData": "kCFURLErrorCannotDecodeContentData", - "NSUTF16StringEncoding": "NSUnicodeStringEncoding", - "NSNumberFormatterRoundDown": "kCFNumberFormatterRoundDown", - "NSURLErrorHTTPTooManyRedirects": "kCFURLErrorHTTPTooManyRedirects", - "NSISO8601DateFormatWithSpaceBetweenDateAndTime": "kCFISO8601DateFormatWithSpaceBetweenDateAndTime", - "NSNumberFormatterRoundHalfUp": "kCFNumberFormatterRoundHalfUp", - "NSISO8601DateFormatWithInternetDateTime": "kCFISO8601DateFormatWithInternetDateTime", - "NSCalendarUnitMinute": "kCFCalendarUnitMinute", - "NSPoint": "CGPoint", - "NSISO8601DateFormatWithMonth": "kCFISO8601DateFormatWithMonth", - "NSNumberFormatterScientificStyle": "kCFNumberFormatterScientificStyle", - "NSURLErrorInternationalRoamingOff": "kCFURLErrorInternationalRoamingOff", - "NSLocaleLanguageDirectionUnknown": "kCFLocaleLanguageDirectionUnknown", - "NSCalendarUnitSecond": "kCFCalendarUnitSecond", - "NSURLErrorCannotParseResponse": "kCFURLErrorCannotParseResponse", - "NSAppleEventSendDontRecord": "kAEDontRecord", - "NSOperationQualityOfServiceBackground": "NSQualityOfServiceBackground", - "NSAppleEventSendWaitForReply": "kAEWaitReply", - "NSMapTableCopyIn": "NSPointerFunctionsCopyIn", - "NSCalendarUnitMonth": "kCFCalendarUnitMonth", - "NSURLErrorCannotWriteToFile": "kCFURLErrorCannotWriteToFile", - "NSURLErrorServerCertificateHasBadDate": "kCFURLErrorServerCertificateHasBadDate", - "NSURLErrorUserAuthenticationRequired": "kCFURLErrorUserAuthenticationRequired", - "NSURLErrorDataLengthExceedsMaximum": "kCFURLErrorDataLengthExceedsMaximum", - "NSCalendarUnitEra": "kCFCalendarUnitEra", - "NSDateFormatterFullStyle": "kCFDateFormatterFullStyle", - "NSAppleEventSendNeverInteract": "kAENeverInteract", - "NSISO8601DateFormatWithColonSeparatorInTimeZone": "kCFISO8601DateFormatWithColonSeparatorInTimeZone", - "NSURLErrorCannotOpenFile": "kCFURLErrorCannotOpenFile", - "_NS_TYPED_ENUM": "_CF_TYPED_ENUM", - "NSDateFormatterShortStyle": "kCFDateFormatterShortStyle", - "NSDecimalNoScale": "SHRT_MAX", - "NSLocaleLanguageDirectionRightToLeft": "kCFLocaleLanguageDirectionRightToLeft", - "NSAppleEventSendCanInteract": "kAECanInteract", - "NSISO8601DateFormatWithTime": "kCFISO8601DateFormatWithTime", - "NSNumberFormatterCurrencyISOCodeStyle": "kCFNumberFormatterCurrencyISOCodeStyle", - "NSCalendarUnitQuarter": "kCFCalendarUnitQuarter", - "NSJSONReadingAllowFragments": "NSJSONReadingFragmentsAllowed", - "NSNumberFormatterCurrencyStyle": "kCFNumberFormatterCurrencyStyle", - "NSWeekOfYearCalendarUnit": "NSCalendarUnitWeekOfYear", - "NS_WARN_UNUSED_RESULT": "CF_WARN_UNUSED_RESULT", - "NSURLErrorServerCertificateNotYetValid": "kCFURLErrorServerCertificateNotYetValid", - "NSMapTableWeakMemory": "NSPointerFunctionsWeakMemory", - "NSURLErrorCannotRemoveFile": "kCFURLErrorCannotRemoveFile", - "NSWrapCalendarComponents": "NSCalendarWrapComponents", - "NSURLErrorFileDoesNotExist": "kCFURLErrorFileDoesNotExist", - "NSLocaleLanguageDirectionBottomToTop": "kCFLocaleLanguageDirectionBottomToTop", - "NSUncachedRead": "NSDataReadingUncached", - "NSIntegerMax": "LONG_MAX", - "NSDateFormatterMediumStyle": "kCFDateFormatterMediumStyle", - "NSURLErrorUnsupportedURL": "kCFURLErrorUnsupportedURL", - "NSNumberFormatterRoundHalfEven": "kCFNumberFormatterRoundHalfEven", - "NSISO8601DateFormatWithWeekOfYear": "kCFISO8601DateFormatWithWeekOfYear", - "NSDayCalendarUnit": "NSCalendarUnitDay", - "NSISO8601DateFormatWithFractionalSeconds": "kCFISO8601DateFormatWithFractionalSeconds", - "NSYearForWeekOfYearCalendarUnit": "NSCalendarUnitYearForWeekOfYear", - "NSSize": "CGSize", - "NS_TYPED_EXTENSIBLE_ENUM": "_NS_TYPED_EXTENSIBLE_ENUM", - "NSNumberFormatterPadBeforePrefix": "kCFNumberFormatterPadBeforePrefix", - "NSUndefinedDateComponent": "NSDateComponentUndefined", - "NSAppleEventSendDontAnnotate": "kAEDoNotAutomaticallyAddAnnotationsToEvent", - "NSURLErrorServerCertificateHasUnknownRoot": "kCFURLErrorServerCertificateHasUnknownRoot", - "NSURLErrorBadServerResponse": "kCFURLErrorBadServerResponse", - "NSMappedRead": "NSDataReadingMapped", - "NSUIntegerMax": "ULONG_MAX", - "NSHourCalendarUnit": "NSCalendarUnitHour", - "NSAppleEventSendQueueReply": "kAEQueueReply", - "NS_NOESCAPE": "CF_NOESCAPE", - "NSURLRequestReloadIgnoringCacheData": "NSURLRequestReloadIgnoringLocalCacheData", - "NSURLErrorCannotFindHost": "kCFURLErrorCannotFindHost", - "NSNumberFormatterRoundUp": "kCFNumberFormatterRoundUp", - "NSISO8601DateFormatWithTimeZone": "kCFISO8601DateFormatWithTimeZone", - "NS_SWIFT_BRIDGED_TYPEDEF": "CF_SWIFT_BRIDGED_TYPEDEF", - "NSURLErrorCannotCloseFile": "kCFURLErrorCannotCloseFile", - "NSCalendarUnitDay": "kCFCalendarUnitDay", - "NSOperationQualityOfService": "NSQualityOfService", - "NSURLErrorDownloadDecodingFailedToComplete": "kCFURLErrorDownloadDecodingFailedToComplete", - "NSNumberFormatterRoundHalfDown": "kCFNumberFormatterRoundHalfDown", - "NSAtomicWrite": "NSDataWritingAtomic", -} -misc.update( - { - "NSAppleEventManagerSuspensionID": objc.createOpaquePointerType( - "NSAppleEventManagerSuspensionID", b"^{__NSAppleEventManagerSuspension=}" - ), - "NSZonePtr": objc.createOpaquePointerType("NSZonePtr", b"^{_NSZone=}"), - } -) -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r( - b"NSAffineTransform", - b"setTransformStruct:", - {"arguments": {2: {"type": "{NSAffineTransformStruct=dddddd}"}}}, - ) - r( - b"NSAffineTransform", - b"transformPoint:", - { - "retval": {"type": "{CGPoint=dd}"}, - "arguments": {2: {"type": "{CGPoint=dd}"}}, - }, - ) - r( - b"NSAffineTransform", - b"transformSize:", - {"retval": {"type": "{CGSize=dd}"}, "arguments": {2: {"type": "{CGSize=dd}"}}}, - ) - r( - b"NSAffineTransform", - b"transformStruct", - {"retval": {"type": "{NSAffineTransformStruct=dddddd}"}}, - ) - r( - b"NSAppleEventDescriptor", - b"aeDesc", - {"retval": {"type": "r^{AEDesc=I^^{OpaqueAEDataStorageType}}"}}, - ) - r(b"NSAppleEventDescriptor", b"booleanValue", {"retval": {"type": "Z"}}) - r( - b"NSAppleEventDescriptor", - b"descriptorWithBoolean:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSAppleEventDescriptor", - b"descriptorWithDescriptorType:bytes:length:", - {"arguments": {3: {"type_modifier": b"n", "c_array_length_in_arg": 4}}}, - ) - r( - b"NSAppleEventDescriptor", - b"dispatchRawAppleEvent:withRawReply:handlerRefCon:", - {"retval": {"type": "s"}, "arguments": {4: {"type": "l"}}}, - ) - r( - b"NSAppleEventDescriptor", - b"initWithAEDescNoCopy:", - { - "arguments": { - 2: { - "type": "r^{AEDesc=I^^{OpaqueAEDataStorageType}}", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSAppleEventDescriptor", - b"initWithDescriptorType:bytes:length:", - {"arguments": {3: {"type_modifier": b"n", "c_array_length_in_arg": 4}}}, - ) - r(b"NSAppleEventDescriptor", b"isRecordDescriptor", {"retval": {"type": "Z"}}) - r( - b"NSAppleEventDescriptor", - b"sendEventWithOptions:timeout:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSAppleEventDescriptor", - b"setEventHandler:andSelector:forEventClass:andEventID:", - {"arguments": {3: {"sel_of_type": b"v@:@@"}}}, - ) - r( - b"NSAppleEventManager", - b"dispatchRawAppleEvent:withRawReply:handlerRefCon:", - { - "arguments": { - 2: { - "type": "r^{AEDesc=I^^{OpaqueAEDataStorageType}}", - "type_modifier": b"n", - }, - 3: { - "type": "r^{AEDesc=I^^{OpaqueAEDataStorageType}}", - "type_modifier": b"o", - }, - } - }, - ) - r( - b"NSAppleEventManager", - b"setEventHandler:andSelector:forEventClass:andEventID:", - {"arguments": {3: {"sel_of_type": b"v@:@@"}}}, - ) - r( - b"NSAppleScript", - b"compileAndReturnError:", - {"retval": {"type": "Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSAppleScript", - b"executeAndReturnError:", - {"arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSAppleScript", - b"executeAppleEvent:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAppleScript", - b"initWithContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSAppleScript", b"isCompiled", {"retval": {"type": "Z"}}) - r(b"NSArchiver", b"archiveRootObject:toFile:", {"retval": {"type": "Z"}}) - r( - b"NSArray", - b"addObserver:forKeyPath:options:context:", - {"arguments": {5: {"type": "^v"}}}, - ) - r( - b"NSArray", - b"addObserver:toObjectsAtIndexes:forKeyPath:options:context:", - {"arguments": {6: {"type": "^v"}}}, - ) - r( - b"NSArray", - b"arrayWithContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSArray", - b"arrayWithObjects:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"NSArray", - b"arrayWithObjects:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r(b"NSArray", b"containsObject:", {"retval": {"type": "Z"}}) - r(b"NSArray", b"context:", {"arguments": {2: {"type": "^v"}}}) - r(b"NSArray", b"context:hint:", {"arguments": {2: {"type": "^v"}}}) - r( - b"NSArray", - b"differenceFromArray:withOptions:usingEquivalenceTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"b"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"enumerateObjectsAtIndexes:options:usingBlock:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"enumerateObjectsUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"enumerateObjectsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"getObjects:", - { - "arguments": {2: {"type": "^@"}}, - "suggestion": "convert to Python list instead", - }, - ) - r( - b"NSArray", - b"getObjects:range:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 3}, - 3: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSArray", - b"indexOfObject:inRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSArray", - b"indexOfObject:inSortedRange:options:usingComparator:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"indexOfObjectAtIndexes:options:passingTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"indexOfObjectIdenticalTo:inRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSArray", - b"indexOfObjectPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"indexOfObjectWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"indexesOfObjectsAtIndexes:options:passingTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"indexesOfObjectsPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"indexesOfObjectsWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r(b"NSArray", b"initWithArray:copyItems:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSArray", - b"initWithContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSArray", - b"initWithObjects:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"NSArray", - b"initWithObjects:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r(b"NSArray", b"isEqualToArray:", {"retval": {"type": "Z"}}) - r( - b"NSArray", - b"makeObjectsPerformSelector:", - {"arguments": {2: {"sel_of_type": b"v@:"}}}, - ) - r( - b"NSArray", - b"makeObjectsPerformSelector:withObject:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSArray", - b"sortedArrayUsingComparator:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSArray", - b"sortedArrayUsingFunction:context:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - }, - 3: {"type": "@"}, - } - }, - ) - r( - b"NSArray", - b"sortedArrayUsingFunction:context:hint:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - }, - 3: {"type": "@"}, - } - }, - ) - r( - b"NSArray", - b"sortedArrayUsingSelector:", - {"arguments": {2: {"sel_of_type": b"i@:@"}}}, - ) - r( - b"NSArray", - b"sortedArrayWithOptions:usingComparator:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"NSArray", b"subarrayWithRange:", {"arguments": {2: {"type": "{_NSRange=QQ}"}}}) - r( - b"NSArray", - b"writeToFile:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSArray", - b"writeToURL:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSArray", - b"writeToURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAssertionHandler", - b"handleFailureInFunction:file:lineNumber:description:", - {"arguments": {5: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSAssertionHandler", - b"handleFailureInMethod:object:file:lineNumber:description:", - { - "arguments": {2: {"type": ":"}, 6: {"printf_format": True, "type": "@"}}, - "variadic": True, - }, - ) - r( - b"NSAttributedString", - b"attribute:atIndex:effectiveRange:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"attribute:atIndex:longestEffectiveRange:inRange:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"attributedSubstringFromRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"attributesAtIndex:effectiveRange:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"attributesAtIndex:longestEffectiveRange:inRange:", - {"arguments": {3: {"type_modifier": b"o"}, 4: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSAttributedString", - b"enumerateAttribute:inRange:options:usingBlock:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSAttributedString", - b"enumerateAttributesInRange:options:usingBlock:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSAttributedString", - b"initWithContentsOfMarkdownFileAtURL:options:baseURL:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithFormat:options:locale:", - {"arguments": {2: {"printf_format": True}}, "variadic": True}, - ) - r( - b"NSAttributedString", - b"initWithFormat:options:locale:context:", - {"variadic": True}, - ) - r( - b"NSAttributedString", - b"initWithFormat:options:locale:context:arguments:", - {"suggestion": "Use -initWithFormat:options:locale:context: instead"}, - ) - r( - b"NSAttributedString", - b"initWithMarkdown:options:baseURL:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSAttributedString", - b"initWithMarkdownString:options:baseURL:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSAttributedString", b"isEqualToAttributedString:", {"retval": {"type": "Z"}}) - r( - b"NSAttributedString", - b"localizedAttributedStringWithFormat:", - {"arguments": {2: {"printf_format": True}}, "variadic": True}, - ) - r( - b"NSAttributedString", - b"localizedAttributedStringWithFormat:context:", - {"variadic": True}, - ) - r( - b"NSAttributedString", - b"localizedAttributedStringWithFormat:options:", - {"arguments": {2: {"printf_format": True}}, "variadic": True}, - ) - r( - b"NSAttributedString", - b"localizedAttributedStringWithFormat:options:context:", - {"variadic": True}, - ) - r( - b"NSAttributedStringMarkdownParsingOptions", - b"allowsExtendedAttributes", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSAttributedStringMarkdownParsingOptions", - b"appliesSourcePositionAttributes", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSAttributedStringMarkdownParsingOptions", - b"setAllowsExtendedAttributes:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSAttributedStringMarkdownParsingOptions", - b"setAppliesSourcePositionAttributes:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSAutoreleasePool", - b"enableFreedObjectCheck:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSAutoreleasePool", b"enableRelease:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSBackgroundActivityScheduler", b"repeats", {"retval": {"type": b"Z"}}) - r( - b"NSBackgroundActivityScheduler", - b"scheduleWithBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"q"}}, - } - } - } - }, - ) - r( - b"NSBackgroundActivityScheduler", - b"setRepeats:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSBackgroundActivityScheduler", b"shouldDefer", {"retval": {"type": b"Z"}}) - r( - b"NSBlockOperation", - b"addExecutionBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSBlockOperation", - b"blockOperationWithBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSBundle", b"isLoaded", {"retval": {"type": "Z"}}) - r(b"NSBundle", b"load", {"retval": {"type": "Z"}}) - r( - b"NSBundle", - b"loadAndReturnError:", - {"retval": {"type": "Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSBundle", - b"preflightAndReturnError:", - {"retval": {"type": "Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r(b"NSBundle", b"unload", {"retval": {"type": "Z"}}) - r( - b"NSBundleResourceRequest", - b"beginAccessingResourcesWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSBundleResourceRequest", - b"conditionallyBeginAccessingResourcesWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSByteCountFormatter", - b"allowsNonnumericFormatting", - {"retval": {"type": b"Z"}}, - ) - r(b"NSByteCountFormatter", b"includesActualByteCount", {"retval": {"type": b"Z"}}) - r(b"NSByteCountFormatter", b"includesCount", {"retval": {"type": b"Z"}}) - r(b"NSByteCountFormatter", b"includesUnit", {"retval": {"type": b"Z"}}) - r(b"NSByteCountFormatter", b"isAdaptive", {"retval": {"type": b"Z"}}) - r(b"NSByteCountFormatter", b"setAdaptive:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSByteCountFormatter", - b"setAllowsNonnumericFormatting:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSByteCountFormatter", - b"setIncludesActualByteCount:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSByteCountFormatter", b"setIncludesCount:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSByteCountFormatter", b"setIncludesUnit:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSByteCountFormatter", - b"setZeroPadsFractionDigits:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSByteCountFormatter", b"zeroPadsFractionDigits", {"retval": {"type": b"Z"}}) - r(b"NSCache", b"evictsObjectsWithDiscardedContent", {"retval": {"type": "Z"}}) - r( - b"NSCache", - b"setEvictsObjectsWithDiscardedContent:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSCalendar", b"date:matchesComponents:", {"retval": {"type": b"Z"}}) - r( - b"NSCalendar", - b"enumerateDatesStartingAfterDate:matchingComponents:options:usingBlock:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Z"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSCalendar", - b"isDate:equalToDate:toUnitGranularity:", - {"retval": {"type": b"Z"}}, - ) - r(b"NSCalendar", b"isDate:inSameDayAsDate:", {"retval": {"type": b"Z"}}) - r(b"NSCalendar", b"isDateInToday:", {"retval": {"type": b"Z"}}) - r(b"NSCalendar", b"isDateInTomorrow:", {"retval": {"type": b"Z"}}) - r(b"NSCalendar", b"isDateInWeekend:", {"retval": {"type": b"Z"}}) - r(b"NSCalendar", b"isDateInYesterday:", {"retval": {"type": b"Z"}}) - r(b"NSCalendar", b"maximumRangeOfUnit:", {"retval": {"type": "{_NSRange=QQ}"}}) - r(b"NSCalendar", b"minimumRangeOfUnit:", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSCalendar", - b"nextWeekendStartDate:interval:options:afterDate:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSCalendar", - b"rangeOfUnit:inUnit:forDate:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSCalendar", - b"rangeOfUnit:startDate:interval:forDate:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type_modifier": b"o"}, 4: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSCalendar", - b"rangeOfWeekendStartDate:interval:containingDate:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSCalendarDate", - b"years:months:days:hours:minutes:seconds:sinceDate:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - 5: {"type_modifier": b"o"}, - 6: {"type_modifier": b"o"}, - 7: {"type_modifier": b"o"}, - 8: {"type": "@"}, - }, - }, - ) - r( - b"NSCharacterSet", - b"characterIsMember:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "S"}}}, - ) - r( - b"NSCharacterSet", - b"characterSetWithRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSCharacterSet", b"hasMemberInPlane:", {"retval": {"type": "Z"}}) - r(b"NSCharacterSet", b"isSupersetOfSet:", {"retval": {"type": "Z"}}) - r(b"NSCharacterSet", b"longCharacterIsMember:", {"retval": {"type": "Z"}}) - r(b"NSCoder", b"allowsKeyedCoding", {"retval": {"type": "Z"}}) - r(b"NSCoder", b"containsValueForKey:", {"retval": {"type": "Z"}}) - r( - b"NSCoder", - b"decodeArrayOfObjCType:count:at:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - 4: {"type_modifier": b"o", "c_array_of_variable_length": True}, - } - }, - ) - r(b"NSCoder", b"decodeBoolForKey:", {"retval": {"type": "Z"}}) - r( - b"NSCoder", - b"decodeBytesForKey:returnedLength:", - { - "retval": { - "c_array_delimited_by_null": True, - "type": "^v", - "c_array_length_in_arg": 3, - }, - "arguments": {3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSCoder", - b"decodeBytesWithReturnedLength:", - { - "retval": {"c_array_length_in_arg": 2}, - "arguments": {2: {"type_modifier": b"o"}}, - }, - ) - r(b"NSCoder", b"decodePoint", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSCoder", - b"decodePointForKey:", - {"retval": {"type": "{CGPoint=dd}"}, "arguments": {2: {"type": "@"}}}, - ) - r( - b"NSCoder", - b"decodeRect", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSCoder", - b"decodeRectForKey:", - { - "retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": "@"}}, - }, - ) - r(b"NSCoder", b"decodeSize", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSCoder", - b"decodeSizeForKey:", - {"retval": {"type": "{CGSize=dd}"}, "arguments": {2: {"type": "@"}}}, - ) - r( - b"NSCoder", - b"decodeTopLevelObjectAndReturnError:", - {"arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSCoder", - b"decodeTopLevelObjectForKey:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSCoder", - b"decodeTopLevelObjectOfClass:forKey:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSCoder", - b"decodeTopLevelObjectOfClasses:forKey:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSCoder", - b"decodeValueOfObjCType:at:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - 3: {"type": "^v", "c_array_of_variable_length": True}, - } - }, - ) - r( - b"NSCoder", - b"decodeValuesOfObjCTypes:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - } - }, - "variadic": True, - }, - ) - r( - b"NSCoder", - b"encodeArrayOfObjCType:count:at:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - 4: { - "type": "^v", - "type_modifier": b"n", - "c_array_of_variable_length": True, - }, - } - }, - ) - r(b"NSCoder", b"encodeBool:forKey:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSCoder", - b"encodeBytes:length:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSCoder", - b"encodeBytes:length:forKey:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^v", - "type_modifier": b"n", - "c_array_length_in_arg": 3, - } - } - }, - ) - r(b"NSCoder", b"encodePoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSCoder", b"encodePoint:forKey:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSCoder", - b"encodeRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r( - b"NSCoder", - b"encodeRect:forKey:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSCoder", b"encodeSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSCoder", b"encodeSize:forKey:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r( - b"NSCoder", - b"encodeValueOfObjCType:at:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - 3: { - "type": "^v", - "type_modifier": b"n", - "c_array_of_variable_length": True, - }, - } - }, - ) - r( - b"NSCoder", - b"encodeValuesOfObjCTypes:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - } - }, - "variadic": True, - }, - ) - r(b"NSCoder", b"requiresSecureCoding", {"retval": {"type": b"Z"}}) - r(b"NSComparisonPredicate", b"customSelector", {"retval": {"sel_of_type": b"Z@:@"}}) - r( - b"NSComparisonPredicate", - b"initWithLeftExpression:rightExpression:customSelector:", - {"arguments": {4: {"sel_of_type": b"Z@:@"}}}, - ) - r( - b"NSComparisonPredicate", - b"predicateWithLeftExpression:rightExpression:customSelector:", - {"arguments": {4: {"sel_of_type": b"Z@:@"}}}, - ) - r(b"NSCondition", b"waitUntilDate:", {"retval": {"type": "Z"}}) - r(b"NSConditionLock", b"lockBeforeDate:", {"retval": {"type": "Z"}}) - r(b"NSConditionLock", b"lockWhenCondition:beforeDate:", {"retval": {"type": "Z"}}) - r(b"NSConditionLock", b"tryLock", {"retval": {"type": "Z"}}) - r(b"NSConditionLock", b"tryLockWhenCondition:", {"retval": {"type": "Z"}}) - r(b"NSConnection", b"independentConversationQueueing", {"retval": {"type": "Z"}}) - r(b"NSConnection", b"isValid", {"retval": {"type": "Z"}}) - r(b"NSConnection", b"multipleThreadsEnabled", {"retval": {"type": "Z"}}) - r(b"NSConnection", b"registerName:", {"retval": {"type": "Z"}}) - r(b"NSConnection", b"registerName:withNameServer:", {"retval": {"type": "Z"}}) - r( - b"NSConnection", - b"setIndependentConversationQueueing:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSData", b"bytes", {"retval": {"c_array_of_variable_length": True}}) - r( - b"NSData", - b"compressedDataUsingAlgorithm:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSData", - b"dataWithBytes:length:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSData", - b"dataWithBytesNoCopy:length:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSData", - b"dataWithBytesNoCopy:length:freeWhenDone:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 4: {"type": "Z"}, - } - }, - ) - r( - b"NSData", - b"dataWithContentsOfFile:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSData", - b"dataWithContentsOfURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSData", - b"decompressedDataUsingAlgorithm:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSData", - b"enumerateByteRangesUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "type": b"^v", - "type_modifier": "n", - "c_array_length_in_arg": 2, - }, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSData", - b"getBytes:", - {"arguments": {2: {"type": "^v"}}, "suggestion": "use -bytes instead"}, - ) - r( - b"NSData", - b"getBytes:length:", - {"arguments": {2: {"type_modifier": b"o", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSData", - b"getBytes:range:", - { - "arguments": { - 2: {"type_modifier": b"o", "c_array_length_in_arg": 3}, - 3: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSData", - b"initWithBytes:length:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSData", - b"initWithBytesNoCopy:length:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSData", - b"initWithBytesNoCopy:length:deallocator:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "type": b"^v", - "type_modifier": "n", - "c_array_length_in_arg": 2, - }, - 2: {"type": b"Q"}, - }, - } - } - } - }, - ) - r( - b"NSData", - b"initWithBytesNoCopy:length:freeWhenDone:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 4: {"type": "Z"}, - } - }, - ) - r( - b"NSData", - b"initWithContentsOfFile:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSData", - b"initWithContentsOfURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSData", b"isEqualToData:", {"retval": {"type": "Z"}}) - r(b"NSData", b"rangeOfData:options:range:", {"retval": {"type": "{_NSRange=QQ}"}}) - r(b"NSData", b"subdataWithRange:", {"arguments": {2: {"type": "{_NSRange=QQ}"}}}) - r( - b"NSData", - b"writeToFile:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSData", - b"writeToFile:options:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSData", - b"writeToURL:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSData", - b"writeToURL:options:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDataDetector", - b"dataDetectorWithTypes:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSDataDetector", - b"initWithTypes:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSDate", b"isEqualToDate:", {"retval": {"type": "Z"}}) - r(b"NSDateComponents", b"isLeapMonth", {"retval": {"type": b"Z"}}) - r(b"NSDateComponents", b"isValidDate", {"retval": {"type": b"Z"}}) - r(b"NSDateComponents", b"isValidDateInCalendar:", {"retval": {"type": b"Z"}}) - r(b"NSDateComponents", b"setLeapMonth:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSDateComponentsFormatter", - b"allowsFractionalUnits", - {"retval": {"type": b"Z"}}, - ) - r(b"NSDateComponentsFormatter", b"collapsesLargestUnit", {"retval": {"type": b"Z"}}) - r( - b"NSDateComponentsFormatter", - b"getObjectValue:forString:errorDescription:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSDateComponentsFormatter", - b"includesApproximationPhrase", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSDateComponentsFormatter", - b"includesTimeRemainingPhrase", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSDateComponentsFormatter", - b"setAllowsFractionalUnits:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSDateComponentsFormatter", - b"setCollapsesLargestUnit:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSDateComponentsFormatter", - b"setIncludesApproximationPhrase:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSDateComponentsFormatter", - b"setIncludesTimeRemainingPhrase:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSDateFormatter", b"allowsNaturalLanguage", {"retval": {"type": "Z"}}) - r(b"NSDateFormatter", b"doesRelativeDateFormatting", {"retval": {"type": "Z"}}) - r(b"NSDateFormatter", b"generatesCalendarDates", {"retval": {"type": "Z"}}) - r( - b"NSDateFormatter", - b"getObjectValue:forString:range:error:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type_modifier": b"o"}, - 4: {"type": "^{_NSRange=QQ}", "type_modifier": b"N"}, - 5: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSDateFormatter", - b"initWithDateFormat:allowNaturalLanguage:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSDateFormatter", b"isLenient", {"retval": {"type": "Z"}}) - r( - b"NSDateFormatter", - b"setDoesRelativeDateFormatting:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSDateFormatter", - b"setGeneratesCalendarDates:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSDateFormatter", b"setLenient:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSDateInterval", b"containsDate:", {"retval": {"type": "Z"}}) - r(b"NSDateInterval", b"intersectsDateInterval:", {"retval": {"type": "Z"}}) - r(b"NSDateInterval", b"isEqualToDateInterval:", {"retval": {"type": "Z"}}) - r( - b"NSDecimalNumber", - b"decimalNumberWithDecimal:", - {"arguments": {2: {"type": "{NSDecimal=b8b4b1b1b18[8S]}"}}}, - ) - r( - b"NSDecimalNumber", - b"decimalNumberWithMantissa:exponent:isNegative:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSDecimalNumber", - b"decimalValue", - {"retval": {"type": b"{NSDecimal=b8b4b1b1b18[8S]}"}}, - ) - r( - b"NSDecimalNumber", - b"initWithDecimal:", - {"arguments": {2: {"type": "{NSDecimal=b8b4b1b1b18[8S]}"}}}, - ) - r( - b"NSDecimalNumber", - b"initWithMantissa:exponent:isNegative:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSDecimalNumber", - b"objCType", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r( - b"NSDecimalNumberHandler", - b"decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", - { - "arguments": { - 4: {"type": "Z"}, - 5: {"type": "Z"}, - 6: {"type": "Z"}, - 7: {"type": "Z"}, - } - }, - ) - r( - b"NSDecimalNumberHandler", - b"initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", - { - "arguments": { - 4: {"type": "Z"}, - 5: {"type": "Z"}, - 6: {"type": "Z"}, - 7: {"type": "Z"}, - } - }, - ) - r( - b"NSDictionary", - b"countByEnumeratingWithState:objects:count:", - {"arguments": {2: {"type": b"^{_NSFastEnumerationState=Q^@^Q[5Q]}"}}}, - ) - r( - b"NSDictionary", - b"dictionaryWithContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSDictionary", - b"dictionaryWithObjects:forKeys:count:", - { - "arguments": { - 2: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSDictionary", - b"dictionaryWithObjectsAndKeys:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"NSDictionary", - b"enumerateKeysAndObjectsUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSDictionary", - b"enumerateKeysAndObjectsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r(b"NSDictionary", b"fileExtensionHidden", {"retval": {"type": "Z"}}) - r(b"NSDictionary", b"fileIsAppendOnly", {"retval": {"type": "Z"}}) - r(b"NSDictionary", b"fileIsImmutable", {"retval": {"type": "Z"}}) - r( - b"NSDictionary", - b"getObjects:andKeys:", - { - "arguments": {2: {"type": "^@"}, 3: {"type": "^@"}}, - "suggestion": "convert to a python dict instead", - }, - ) - r( - b"NSDictionary", - b"initWithContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSDictionary", - b"initWithDictionary:copyItems:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSDictionary", - b"initWithObjects:forKeys:count:", - { - "arguments": { - 2: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSDictionary", - b"initWithObjectsAndKeys:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r(b"NSDictionary", b"isEqualToDictionary:", {"retval": {"type": "Z"}}) - r( - b"NSDictionary", - b"keysOfEntriesPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSDictionary", - b"keysOfEntriesWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSDictionary", - b"keysSortedByValueUsingComparator:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"i"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSDictionary", - b"keysSortedByValueUsingSelector:", - {"arguments": {2: {"sel_of_type": b"i@:@"}}}, - ) - r( - b"NSDictionary", - b"keysSortedByValueWithOptions:usingComparator:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSDictionary", - b"writeToFile:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSDictionary", - b"writeToURL:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSDictionary", - b"writeToURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSDirectoryEnumerator", - b"isEnumeratingDirectoryPostOrder", - {"retval": {"type": b"Z"}}, - ) - r(b"NSDistributedLock", b"tryLock", {"retval": {"type": "Z"}}) - r( - b"NSDistributedNotificationCenter", - b"addObserver:selector:name:object:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSDistributedNotificationCenter", - b"addObserver:selector:name:object:suspensionBehavior:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSDistributedNotificationCenter", - b"postNotificationName:object:userInfo:deliverImmediately:", - {"arguments": {5: {"type": "Z"}}}, - ) - r( - b"NSDistributedNotificationCenter", - b"setSuspended:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSDistributedNotificationCenter", b"suspended", {"retval": {"type": "Z"}}) - r( - b"NSEnergyFormatter", - b"getObjectValue:forString:errorDescription:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSEnergyFormatter", b"isForFoodEnergyUse", {"retval": {"type": b"Z"}}) - r(b"NSEnergyFormatter", b"setForFoodEnergyUse:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSError", - b"setUserInfoValueProviderForDomain:provider:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSError", - b"userInfoValueProviderForDomain:", - { - "retval": { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - }, - ) - r( - b"NSException", - b"raise:format:", - {"arguments": {3: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSException", - b"raise:format:arguments:", - { - "arguments": {4: {"type": "[1{?=II^v^v}]"}}, - "suggestion": "use raise:format:", - }, - ) - r( - b"NSExpression", - b"expressionBlock", - { - "retval": { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - }, - ) - r( - b"NSExpression", - b"expressionForBlock:arguments:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSExpression", - b"expressionWithFormat:", - {"arguments": {2: {"printf_format": True}}, "variadic": True}, - ) - r( - b"NSExtensionContext", - b"completeRequestReturningItems:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSExtensionContext", - b"openURL:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSFileCoordinator", - b"coordinateAccessWithIntents:queue:byAccessor:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSFileCoordinator", - b"coordinateReadingItemAtURL:options:error:byAccessor:", - { - "arguments": { - 4: {"type_modifier": b"o"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r( - b"NSFileCoordinator", - b"coordinateReadingItemAtURL:options:writingItemAtURL:options:error:byAccessor:", - { - "arguments": { - 6: {"type_modifier": b"o"}, - 7: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - }, - } - }, - ) - r( - b"NSFileCoordinator", - b"coordinateWritingItemAtURL:options:error:byAccessor:", - { - "arguments": { - 4: {"type_modifier": b"o"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r( - b"NSFileCoordinator", - b"coordinateWritingItemAtURL:options:writingItemAtURL:options:error:byAccessor:", - { - "arguments": { - 6: {"type_modifier": b"o"}, - 7: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - }, - } - }, - ) - r( - b"NSFileCoordinator", - b"prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:", - { - "arguments": { - 6: {"type_modifier": b"o"}, - 7: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": {0: {"type": "^v"}}, - }, - "type": b"@?", - }, - }, - } - }, - } - }, - ) - r( - b"NSFileHandle", - b"closeAndReturnError:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"fileHandleForReadingFromURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"fileHandleForUpdatingURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"fileHandleForWritingToURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"getOffset:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"initWithFileDescriptor:closeOnDealloc:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSFileHandle", - b"readDataToEndOfFileAndReturnError:", - {"arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"readDataUpToLength:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"readabilityHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - }, - ) - r( - b"NSFileHandle", - b"seekToEndReturningOffset:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"seekToOffset:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"setReadabilityHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSFileHandle", - b"setWriteabilityHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSFileHandle", - b"synchronizeAndReturnError:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"truncateAtOffset:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"writeData:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileHandle", - b"writeabilityHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - }, - ) - r( - b"NSFileManager", - b"URLForDirectory:inDomain:appropriateForURL:create:error:", - {"arguments": {5: {"type": "Z"}, 6: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"URLForPublishingUbiquitousItemAtURL:expirationDate:error:", - {"arguments": {3: {"type_modifier": b"o"}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"attributesOfFileSystemForPath:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"attributesOfItemAtPath:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSFileManager", b"changeCurrentDirectoryPath:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"changeFileAttributes:atPath:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"contentsEqualAtPath:andPath:", {"retval": {"type": "Z"}}) - r( - b"NSFileManager", - b"contentsOfDirectoryAtPath:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"copyItemAtPath:toPath:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"copyItemAtURL:toURL:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSFileManager", b"copyPath:toPath:handler:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"createDirectoryAtPath:attributes:", {"retval": {"type": "Z"}}) - r( - b"NSFileManager", - b"createDirectoryAtPath:withIntermediateDirectories:attributes:error:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "Z"}, 5: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSFileManager", - b"createDirectoryAtURL:withIntermediateDirectories:attributes:error:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "Z"}, 5: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSFileManager", - b"createFileAtPath:contents:attributes:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSFileManager", - b"createSymbolicLinkAtPath:pathContent:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSFileManager", - b"createSymbolicLinkAtPath:withDestinationPath:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"createSymbolicLinkAtURL:withDestinationURL:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"destinationOfSymbolicLinkAtPath:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSFileManager", - b"evictUbiquitousItemAtURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"fileAttributesAtPath:traverseLink:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSFileManager", b"fileExistsAtPath:", {"retval": {"type": "Z"}}) - r( - b"NSFileManager", - b"fileExistsAtPath:isDirectory:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "^Z", "type_modifier": b"o"}}, - }, - ) - r( - b"NSFileManager", - b"fileSystemRepresentationWithPath:", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r( - b"NSFileManager", - b"getFileProviderMessageInterfacesForItemAtURL:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSFileManager", - b"getFileProviderServicesForItemAtURL:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSFileManager", - b"getRelationship:ofDirectory:inDomain:toItemAtURL:error:", - { - "retval": {"type": b"Z"}, - "arguments": {2: {"type_modifier": b"o"}, 6: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSFileManager", - b"getRelationship:ofDirectoryAtURL:toItemAtURL:error:", - { - "retval": {"type": b"Z"}, - "arguments": {2: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}, - }, - ) - r(b"NSFileManager", b"isDeletableFileAtPath:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"isExecutableFileAtPath:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"isReadableFileAtPath:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"isUbiquitousItemAtURL:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"isWritableFileAtPath:", {"retval": {"type": "Z"}}) - r( - b"NSFileManager", - b"linkItemAtPath:toPath:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"linkItemAtURL:toURL:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSFileManager", b"linkPath:toPath:handler:", {"retval": {"type": "Z"}}) - r( - b"NSFileManager", - b"moveItemAtPath:toPath:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"moveItemAtURL:toURL:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSFileManager", b"movePath:toPath:handler:", {"retval": {"type": "Z"}}) - r(b"NSFileManager", b"removeFileAtPath:handler:", {"retval": {"type": "Z"}}) - r( - b"NSFileManager", - b"removeItemAtPath:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"removeItemAtURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error:", - { - "retval": {"type": "Z"}, - "arguments": {6: {"type_modifier": b"o"}, 7: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSFileManager", - b"setAttributes:ofItemAtPath:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"setUbiquitous:itemAtURL:destinationURL:error:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type": "Z"}, 5: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSFileManager", - b"startDownloadingUbiquitousItemAtURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"stringWithFileSystemRepresentation:length:", - { - "arguments": { - 2: {"type": "^t", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSFileManager", - b"subpathsOfDirectoryAtPath:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileManager", - b"trashItemAtURL:resultingItemURL:error:", - { - "retval": {"type": b"Z"}, - "arguments": {3: {"type_modifier": b"o"}, 4: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSFileManager", - b"unmountVolumeAtURL:options:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSFileProviderService", - b"getFileProviderConnectionWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSFileVersion", - b"addVersionOfItemAtURL:withContentsOfURL:options:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileVersion", - b"getNonlocalVersionsOfItemAtURL:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"NSFileVersion", b"hasLocalContents", {"retval": {"type": b"Z"}}) - r(b"NSFileVersion", b"hasThumbnail", {"retval": {"type": b"Z"}}) - r(b"NSFileVersion", b"isConflict", {"retval": {"type": b"Z"}}) - r(b"NSFileVersion", b"isDiscardable", {"retval": {"type": b"Z"}}) - r(b"NSFileVersion", b"isResolved", {"retval": {"type": b"Z"}}) - r( - b"NSFileVersion", - b"removeAndReturnError:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileVersion", - b"removeOtherVersionsOfItemAtURL:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileVersion", - b"replaceItemAtURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSFileVersion", b"setDiscardable:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSFileVersion", b"setResolved:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSFileVersions", - b"addVersionOfItemAtURL:withContentsOfURL:options:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSFileVersions", b"isConflict", {"retval": {"type": "Z"}}) - r(b"NSFileVersions", b"isDiscardable", {"retval": {"type": "Z"}}) - r(b"NSFileVersions", b"isResolved", {"retval": {"type": "Z"}}) - r( - b"NSFileVersions", - b"removeAndReturnError:", - {"retval": {"type": "Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileVersions", - b"removeOtherVersionsOfItemAtURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSFileVersions", - b"replaceItemAtURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSFileVersions", b"setConflict:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSFileVersions", b"setDiscardable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSFileVersions", b"setResolved:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSFileWrapper", b"isDirectory", {"retval": {"type": b"Z"}}) - r(b"NSFileWrapper", b"isRegularFile", {"retval": {"type": b"Z"}}) - r(b"NSFileWrapper", b"isSymbolicLink", {"retval": {"type": b"Z"}}) - r(b"NSFileWrapper", b"matchesContentsOfURL:", {"retval": {"type": b"Z"}}) - r(b"NSFileWrapper", b"needsToBeUpdatedFromPath:", {"retval": {"type": b"Z"}}) - r(b"NSFileWrapper", b"readFromURL:options:error:", {"retval": {"type": b"Z"}}) - r(b"NSFileWrapper", b"updateFromPath:", {"retval": {"type": b"Z"}}) - r( - b"NSFileWrapper", - b"writeToFile:atomically:updateFilenames:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type": b"Z"}, 4: {"type": b"Z"}}}, - ) - r( - b"NSFileWrapper", - b"writeToURL:options:originalContentsURL:error:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSFormatter", - b"getObjectValue:forString:errorDescription:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"null_accepted": False, "type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSFormatter", - b"isPartialStringValid:newEditingString:errorDescription:", - { - "retval": {"type": "Z"}, - "arguments": { - 3: {"null_accepted": False, "type_modifier": b"N"}, - 4: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSFormatter", - b"isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"null_accepted": False, "type_modifier": b"N"}, - 3: {"null_accepted": False, "type_modifier": b"N"}, - 5: {"type": "{_NSRange=QQ}"}, - 6: {"type_modifier": b"o"}, - }, - }, - ) - r( - b"NSGarbageCollector", - b"disableCollectorForPointer:", - {"arguments": {2: {"type": "^v"}}, "suggestion": "Not supported right now"}, - ) - r( - b"NSGarbageCollector", - b"enableCollectorForPointer:", - {"arguments": {2: {"type": "^v"}}, "suggestion": "Not supported right now"}, - ) - r(b"NSGarbageCollector", b"isCollecting", {"retval": {"type": "Z"}}) - r(b"NSGarbageCollector", b"isEnabled", {"retval": {"type": "Z"}}) - r(b"NSHTTPCookie", b"isHTTPOnly", {"retval": {"type": "Z"}}) - r(b"NSHTTPCookie", b"isSecure", {"retval": {"type": "Z"}}) - r(b"NSHTTPCookie", b"isSessionOnly", {"retval": {"type": "Z"}}) - r( - b"NSHTTPCookieStorage", - b"getCookiesForTask:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSHashTable", b"containsObject:", {"retval": {"type": "Z"}}) - r(b"NSHashTable", b"intersectsHashTable:", {"retval": {"type": "Z"}}) - r(b"NSHashTable", b"isEqualToHashTable:", {"retval": {"type": "Z"}}) - r(b"NSHashTable", b"isSubsetOfHashTable:", {"retval": {"type": "Z"}}) - r(b"NSHost", b"isEqualToHost:", {"retval": {"type": "Z"}}) - r(b"NSHost", b"isHostCacheEnabled", {"retval": {"type": "Z"}}) - r(b"NSHost", b"setHostCacheEnabled:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSIndexPath", - b"getIndexes:", - { - "arguments": { - 2: { - "type": "^Q", - "type_modifier": b"o", - "c_array_of_variable_length": True, - } - }, - "suggestion": "Use -getIndexes:range: or -indexAtPosition: instead", - }, - ) - r( - b"NSIndexPath", - b"getIndexes:range:", - { - "arguments": { - 2: {"type": "^Q", "type_modifier": b"o", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSIndexPath", - b"indexPathWithIndexes:length:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSIndexPath", - b"initWithIndexes:length:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r(b"NSIndexSet", b"containsIndex:", {"retval": {"type": "Z"}}) - r(b"NSIndexSet", b"containsIndexes:", {"retval": {"type": "Z"}}) - r( - b"NSIndexSet", - b"containsIndexesInRange:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSIndexSet", - b"countOfIndexesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSIndexSet", - b"enumerateIndexesInRange:options:usingBlock:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - }, - } - }, - ) - r( - b"NSIndexSet", - b"enumerateIndexesUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"enumerateIndexesWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"enumerateRangesInRange:options:usingBlock:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{_NSRange=QQ}"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - }, - } - }, - ) - r( - b"NSIndexSet", - b"enumerateRangesUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{_NSRange=QQ}"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"enumerateRangesWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"{_NSRange=QQ}"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"getIndexes:maxCount:inIndexRange:", - { - "arguments": { - 2: { - "null_accepted": False, - "c_array_length_in_arg": 3, - "c_array_length_in_result": True, - "type_modifier": b"o", - }, - 4: {"null_accepted": False, "type_modifier": b"N"}, - } - }, - ) - r( - b"NSIndexSet", - b"indexInRange:options:passingTest:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - }, - } - }, - ) - r( - b"NSIndexSet", - b"indexPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"indexSetWithIndexesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSIndexSet", - b"indexWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"indexesInRange:options:passingTest:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - }, - } - }, - ) - r( - b"NSIndexSet", - b"indexesPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"indexesWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSIndexSet", - b"initWithIndexesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSIndexSet", - b"intersectsIndexesInRange:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSIndexSet", b"isEqualToIndexSet:", {"retval": {"type": "Z"}}) - r(b"NSInflectionRule", b"canInflectLanguage:", {"retval": {"type": b"Z"}}) - r( - b"NSInflectionRule", - b"canInflectPreferredLocalization", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSInputStream", - b"getBuffer:length:", - { - "retval": {"type": b"Z"}, - "arguments": { - 2: {"type": "^*", "type_modifier": b"o", "c_array_length_in_arg": 3}, - 3: {"type": "^Q", "type_modifier": b"o"}, - }, - "suggestion": "Not supported at the moment", - }, - ) - r(b"NSInputStream", b"hasBytesAvailable", {"retval": {"type": "Z"}}) - r( - b"NSInputStream", - b"read:maxLength:", - { - "arguments": { - 2: { - "type": "^v", - "c_array_length_in_arg": 3, - "c_array_length_in_result": True, - "type_modifier": b"o", - } - } - }, - ) - r(b"NSInvocation", b"argumentsRetained", {"retval": {"type": "Z"}}) - r(b"NSInvocation", b"getArgument:atIndex:", {"arguments": {2: {"type": "^v"}}}) - r(b"NSInvocation", b"getReturnValue:", {"arguments": {2: {"type": "^v"}}}) - r(b"NSInvocation", b"setArgument:atIndex:", {"arguments": {2: {"type": "^v"}}}) - r(b"NSInvocation", b"setReturnValue:", {"arguments": {2: {"type": "^v"}}}) - r(b"NSInvocation", b"setSelector:", {"arguments": {2: {"type": ":"}}}) - r( - b"NSInvocationOperation", - b"initWithTarget:selector:object:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSItemProvider", b"canLoadObjectOfClass:", {"retval": {"type": "Z"}}) - r( - b"NSItemProvider", - b"hasItemConformingToTypeIdentifier:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSItemProvider", - b"hasRepresentationConformingToTypeIdentifier:fileOptions:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSItemProvider", - b"loadDataRepresentationForTypeIdentifier:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"loadFileRepresentationForTypeIdentifier:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"loadInPlaceFileRepresentationForTypeIdentifier:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Z"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"loadItemForTypeIdentifier:options:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"loadObjectOfClass:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"loadPreviewImageWithOptions:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"previewImageHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - }, - }, - "type": b"@?", - }, - 2: {"type": b"#"}, - 3: {"type": b"@"}, - }, - }, - "type": "@?", - } - }, - ) - r( - b"NSItemProvider", - b"registerDataRepresentationForTypeIdentifier:visibility:loadHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - }, - }, - "type": b"@?", - }, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"registerFileRepresentationForTypeIdentifier:fileOptions:visibility:loadHandler:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "Z"}, - 3: {"type": "@"}, - }, - }, - "type": b"@?", - }, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"registerItemForTypeIdentifier:loadHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - }, - }, - "type": b"@?", - }, - 2: {"type": b"#"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"registerObjectOfClass:visibility:loadHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - }, - }, - "type": b"@?", - }, - }, - } - } - } - }, - ) - r( - b"NSItemProvider", - b"setPreviewImageHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - }, - }, - "type": b"@?", - }, - 2: {"type": b"#"}, - 3: {"type": b"@"}, - }, - }, - "type": "@?", - } - } - }, - ) - r( - b"NSJSONSerialization", - b"JSONObjectWithData:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSJSONSerialization", - b"JSONObjectWithStream:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSJSONSerialization", - b"dataWithJSONObject:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSJSONSerialization", b"isValidJSONObject:", {"retval": {"type": b"Z"}}) - r( - b"NSJSONSerialization", - b"writeJSONObject:toStream:options:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r(b"NSKeyedArchiver", b"archiveRootObject:toFile:", {"retval": {"type": "Z"}}) - r( - b"NSKeyedArchiver", - b"archivedDataWithRootObject:requiringSecureCoding:error:", - {"arguments": {3: {"type": "Z"}, 4: {"type_modifier": b"o"}}}, - ) - r(b"NSKeyedArchiver", b"encodeBool:forKey:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSKeyedArchiver", - b"encodeBytes:length:forKey:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSKeyedArchiver", - b"initRequiringSecureCoding:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSKeyedArchiver", b"requiresSecureCoding", {"retval": {"type": b"Z"}}) - r( - b"NSKeyedArchiver", - b"setRequiresSecureCoding:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSKeyedUnarchiver", b"containsValueForKey:", {"retval": {"type": "Z"}}) - r(b"NSKeyedUnarchiver", b"decodeBoolForKey:", {"retval": {"type": "Z"}}) - r( - b"NSKeyedUnarchiver", - b"decodeBytesForKey:returnedLength:", - { - "retval": {"type": "^v", "c_array_length_in_arg": 3}, - "arguments": {3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSKeyedUnarchiver", - b"initForReadingFromData:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSKeyedUnarchiver", b"requiresSecureCoding", {"retval": {"type": b"Z"}}) - r( - b"NSKeyedUnarchiver", - b"setRequiresSecureCoding:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSKeyedUnarchiver", - b"unarchiveTopLevelObjectWithData:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSKeyedUnarchiver", - b"unarchivedArrayOfObjectsOfClass:fromData:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSKeyedUnarchiver", - b"unarchivedArrayOfObjectsOfClasses:fromData:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSKeyedUnarchiver", - b"unarchivedDictionaryWithKeysOfClass:objectsOfClass:fromData:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSKeyedUnarchiver", - b"unarchivedDictionaryWithKeysOfClasses:objectsOfClasses:fromData:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSKeyedUnarchiver", - b"unarchivedObjectOfClass:fromData:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSKeyedUnarchiver", - b"unarchivedObjectOfClasses:fromData:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSLengthFormatter", - b"getObjectValue:forString:errorDescription:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSLengthFormatter", b"isForPersonHeightUse", {"retval": {"type": b"Z"}}) - r( - b"NSLengthFormatter", - b"setForPersonHeightUse:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSLinguisticTagger", - b"enumerateTagsForString:range:unit:scheme:options:orthography:usingBlock:", - { - "arguments": { - 8: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"NSLinguisticTagger", - b"enumerateTagsInRange:scheme:options:usingBlock:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"{_NSRange=QQ}"}, - 4: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSLinguisticTagger", - b"enumerateTagsInRange:unit:scheme:options:usingBlock:", - { - "arguments": { - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"NSLinguisticTagger", - b"orthographyAtIndex:effectiveRange:", - {"arguments": {3: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}}}, - ) - r( - b"NSLinguisticTagger", - b"possibleTagsAtIndex:scheme:tokenRange:sentenceRange:scores:", - { - "arguments": { - 4: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - 5: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - 6: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSLinguisticTagger", - b"tagAtIndex:scheme:tokenRange:sentenceRange:", - { - "arguments": { - 4: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - 5: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - } - }, - ) - r( - b"NSLinguisticTagger", - b"tagAtIndex:unit:scheme:tokenRange:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSLinguisticTagger", - b"tagForString:atIndex:unit:scheme:orthography:tokenRange:", - {"arguments": {7: {"type_modifier": b"o"}}}, - ) - r( - b"NSLinguisticTagger", - b"tagsForString:range:unit:scheme:options:orthography:tokenRanges:", - {"arguments": {8: {"type_modifier": b"o"}}}, - ) - r( - b"NSLinguisticTagger", - b"tagsInRange:scheme:options:tokenRanges:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSLinguisticTagger", - b"tagsInRange:unit:scheme:options:tokenRanges:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r(b"NSLocale", b"usesMetricSystem", {"retval": {"type": b"Z"}}) - r(b"NSLock", b"lockBeforeDate:", {"retval": {"type": "Z"}}) - r(b"NSLock", b"tryLock", {"retval": {"type": "Z"}}) - r(b"NSMachBootstrapServer", b"registerPort:name:", {"retval": {"type": "Z"}}) - r( - b"NSMassFormatter", - b"getObjectValue:forString:errorDescription:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSMassFormatter", b"isForPersonMassUse", {"retval": {"type": b"Z"}}) - r(b"NSMassFormatter", b"setForPersonMassUse:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSMeasurement", b"canBeConvertedToUnit:", {"retval": {"type": "Z"}}) - r( - b"NSMetadataQuery", - b"enumerateResultsUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r( - b"NSMetadataQuery", - b"enumerateResultsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"o^Z"}, - }, - } - } - } - }, - ) - r(b"NSMetadataQuery", b"isGathering", {"retval": {"type": "Z"}}) - r(b"NSMetadataQuery", b"isStarted", {"retval": {"type": "Z"}}) - r(b"NSMetadataQuery", b"isStopped", {"retval": {"type": "Z"}}) - r(b"NSMetadataQuery", b"startQuery", {"retval": {"type": "Z"}}) - r( - b"NSMethodSignature", - b"getArgumentTypeAtIndex:", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r(b"NSMethodSignature", b"isOneway", {"retval": {"type": "Z"}}) - r( - b"NSMethodSignature", - b"methodReturnType", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r( - b"NSMethodSignature", - b"signatureWithObjCTypes:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - } - } - }, - ) - r(b"NSMorphology", b"isUnspecified", {"retval": {"type": b"Z"}}) - r( - b"NSMorphology", - b"setCustomPronoun:forLanguage:error:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSMorphologyCustomPronoun", - b"isSupportedForLanguage:", - {"retval": {"type": b"Z"}}, - ) - r(b"NSMutableArray", b"context:", {"arguments": {2: {"type": "^v"}}}) - r( - b"NSMutableArray", - b"removeObject:inRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableArray", - b"removeObjectIdenticalTo:inRange:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableArray", - b"removeObjectsFromIndices:numIndices:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSMutableArray", - b"removeObjectsInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableArray", - b"replaceObjectsInRange:withObjects:count:", - {"arguments": {3: {"type_modifier": b"n", "c_array_length_in_arg": 4}}}, - ) - r( - b"NSMutableArray", - b"replaceObjectsInRange:withObjectsFromArray:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableArray", - b"replaceObjectsInRange:withObjectsFromArray:range:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}, 4: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableArray", - b"sortUsingComparator:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSMutableArray", - b"sortUsingFunction:context:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - }, - 3: {"type": "@"}, - } - }, - ) - r( - b"NSMutableArray", - b"sortUsingFunction:context:range:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"l"}, - "arguments": { - 0: {"type": b"@"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "callable_retained": False, - }, - 3: {"type": "@"}, - 4: {"type": "{_NSRange=QQ}"}, - } - }, - ) - r( - b"NSMutableArray", - b"sortUsingSelector:", - {"arguments": {2: {"sel_of_type": b"i@:@"}}}, - ) - r( - b"NSMutableArray", - b"sortWithOptions:usingComparator:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSMutableAttributedString", - b"addAttribute:value:range:", - {"arguments": {4: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"addAttributes:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"appendLocalizedFormat:", - {"arguments": {2: {"printf_format": True}}, "variadic": True}, - ) - r( - b"NSMutableAttributedString", - b"deleteCharactersInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"removeAttribute:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"replaceCharactersInRange:withAttributedString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"replaceCharactersInRange:withString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableAttributedString", - b"setAttributes:range:", - {"arguments": {3: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableCharacterSet", - b"addCharactersInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableCharacterSet", - b"removeCharactersInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableData", - b"appendBytes:length:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSMutableData", - b"compressUsingAlgorithm:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSMutableData", - b"decompressUsingAlgorithm:error:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSMutableData", - b"mutableBytes", - { - "retval": {"type": "^v"}, - "suggestion": "use your language native array access on this object", - }, - ) - r( - b"NSMutableData", - b"replaceBytesInRange:withBytes:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 2}, - } - }, - ) - r( - b"NSMutableData", - b"replaceBytesInRange:withBytes:length:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 3: {"type_modifier": b"n", "c_array_length_in_arg": 4}, - } - }, - ) - r( - b"NSMutableData", - b"resetBytesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableIndexSet", - b"addIndexesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableIndexSet", - b"removeIndexesInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableOrderedSet", - b"addObjects:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSMutableOrderedSet", - b"replaceObjectsInRange:withObjects:count:", - {"arguments": {3: {"type_modifier": b"n", "c_array_length_in_arg": 4}}}, - ) - r( - b"NSMutableOrderedSet", - b"sortRange:options:usingComparator:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSMutableOrderedSet", - b"sortUsingComparator:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSMutableOrderedSet", - b"sortWithOptions:usingComparator:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSMutableString", - b"appendFormat:", - {"arguments": {2: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSMutableString", - b"applyTransform:reverse:range:updatedRange:", - { - "retval": {"type": b"Z"}, - "arguments": {3: {"type": "Z"}, 5: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSMutableString", - b"deleteCharactersInRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableString", - b"replaceCharactersInRange:withString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSMutableString", - b"replaceOccurrencesOfString:withString:options:range:", - {"arguments": {5: {"type": "{_NSRange=QQ}"}}}, - ) - r(b"NSMutableURLRequest", b"HTTPShouldHandleCookies", {"retval": {"type": b"Z"}}) - r(b"NSMutableURLRequest", b"HTTPShouldUsePipelining", {"retval": {"type": b"Z"}}) - r(b"NSMutableURLRequest", b"allowsCellularAccess", {"retval": {"type": b"Z"}}) - r( - b"NSMutableURLRequest", - b"allowsConstrainedNetworkAccess", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSMutableURLRequest", - b"allowsExpensiveNetworkAccess", - {"retval": {"type": b"Z"}}, - ) - r(b"NSMutableURLRequest", b"assumesHTTP3Capable", {"retval": {"type": b"Z"}}) - r(b"NSMutableURLRequest", b"requiresDNSSECValidation", {"retval": {"type": b"Z"}}) - r( - b"NSMutableURLRequest", - b"setAllowsCellularAccess:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSMutableURLRequest", - b"setAllowsConstrainedNetworkAccess:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSMutableURLRequest", - b"setAllowsExpensiveNetworkAccess:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSMutableURLRequest", - b"setAssumesHTTP3Capable:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSMutableURLRequest", - b"setHTTPShouldHandleCookies:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSMutableURLRequest", - b"setHTTPShouldUsePipelining:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSMutableURLRequest", - b"setRequiresDNSSECValidation:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSNetService", - b"getInputStream:outputStream:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"null_accepted": False, "type_modifier": b"o"}, - 3: {"null_accepted": False, "type_modifier": b"o"}, - }, - }, - ) - r(b"NSNetService", b"includesPeerToPeer", {"retval": {"type": "Z"}}) - r( - b"NSNetService", - b"setIncludesPeerToPeer:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSNetService", b"setTXTRecordData:", {"retval": {"type": "Z"}}) - r(b"NSNetServiceBrowser", b"includesPeerToPeer", {"retval": {"type": "Z"}}) - r( - b"NSNetServiceBrowser", - b"setIncludesPeerToPeer:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSNotificationCenter", - b"addObserver:selector:name:object:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSNotificationCenter", - b"addObserverForName:object:queue:usingBlock:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSNotificationCenter", - b"addObserverForName:object:usingBlock:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSNumber", b"boolValue", {"retval": {"type": "Z"}}) - r(b"NSNumber", b"charValue", {"retval": {"type": "z"}}) - r(b"NSNumber", b"decimalValue", {"retval": {"type": "{NSDecimal=b8b4b1b1b18[8S]}"}}) - r(b"NSNumber", b"initWithBool:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSNumber", b"initWithChar:", {"arguments": {2: {"type": "z"}}}) - r(b"NSNumber", b"isEqualToNumber:", {"retval": {"type": "Z"}}) - r(b"NSNumber", b"numberWithBool:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSNumber", b"numberWithChar:", {"arguments": {2: {"type": "z"}}}) - r(b"NSNumberFormatter", b"allowsFloats", {"retval": {"type": "Z"}}) - r(b"NSNumberFormatter", b"alwaysShowsDecimalSeparator", {"retval": {"type": "Z"}}) - r(b"NSNumberFormatter", b"generatesDecimalNumbers", {"retval": {"type": "Z"}}) - r( - b"NSNumberFormatter", - b"getObjectValue:forString:range:error:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type_modifier": b"o"}, - 4: {"type_modifier": b"N"}, - 5: {"type_modifier": b"o"}, - }, - }, - ) - r(b"NSNumberFormatter", b"hasThousandSeparators", {"retval": {"type": "Z"}}) - r(b"NSNumberFormatter", b"isLenient", {"retval": {"type": "Z"}}) - r( - b"NSNumberFormatter", - b"isPartialStringValidationEnabled", - {"retval": {"type": "Z"}}, - ) - r(b"NSNumberFormatter", b"localizesFormat", {"retval": {"type": "Z"}}) - r(b"NSNumberFormatter", b"setAllowsFloats:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSNumberFormatter", - b"setAlwaysShowsDecimalSeparator:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSNumberFormatter", - b"setGeneratesDecimalNumbers:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSNumberFormatter", - b"setHasThousandSeparators:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSNumberFormatter", b"setLenient:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSNumberFormatter", b"setLocalizesFormat:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSNumberFormatter", - b"setPartialStringValidationEnabled:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSNumberFormatter", - b"setUsesGroupingSeparator:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSNumberFormatter", - b"setUsesSignificantDigits:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Z"}}}, - ) - r(b"NSNumberFormatter", b"usesGroupingSeparator", {"retval": {"type": "Z"}}) - r(b"NSNumberFormatter", b"usesSignificantDigits", {"retval": {"type": "Z"}}) - r( - b"NSObject", - b"URL:resourceDataDidBecomeAvailable:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URL:resourceDidFailLoadingWithReason:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URLHandle:resourceDataDidBecomeAvailable:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLHandle:resourceDidFailLoadingWithReason:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLHandleResourceDidBeginLoading:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URLHandleResourceDidCancelLoading:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URLHandleResourceDidFinishLoading:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URLProtocol:cachedResponseIsValid:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLProtocol:didCancelAuthenticationChallenge:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLProtocol:didFailWithError:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLProtocol:didLoadData:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLProtocol:didReceiveAuthenticationChallenge:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLProtocol:didReceiveResponse:cacheStoragePolicy:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"URLProtocol:wasRedirectedToRequest:redirectResponse:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLProtocolDidFinishLoading:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URLResourceDidCancelLoading:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URLResourceDidFinishLoading:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"URLSession:betterRouteDiscoveredForStreamTask:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:dataTask:didBecomeDownloadTask:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:dataTask:didBecomeStreamTask:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:dataTask:didReceiveData:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:dataTask:didReceiveResponse:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Q"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:dataTask:willCacheResponse:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:didBecomeInvalidWithError:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:didCreateTask:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:didReceiveChallenge:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"@"}, - }, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:downloadTask:didFinishDownloadingToURL:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"q"}, - 5: {"type": b"q"}, - }, - }, - ) - r( - b"NSObject", - b"URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"q"}, - 5: {"type": b"q"}, - 6: {"type": b"q"}, - }, - }, - ) - r( - b"NSObject", - b"URLSession:needNewBodyStreamFromOffset:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - } - } - }, - ) - r( - b"NSObject", - b"URLSession:readClosedForStreamTask:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:streamTask:didBecomeInputStream:outputStream:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"URLSession:task:didCompleteWithError:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:task:didFinishCollectingMetrics:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:task:didReceiveChallenge:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"Q"}, - 2: {"type": b"@"}, - }, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:task:didReceiveInformationalResponse:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"q"}, - 5: {"type": b"q"}, - 6: {"type": b"q"}, - }, - }, - ) - r( - b"NSObject", - b"URLSession:task:needNewBodyStream:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:task:needNewBodyStreamFromOffset:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"q"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:task:willBeginDelayedRequest:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"q"}, - 2: {"type": b"@"}, - }, - }, - "type": "@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"URLSession:taskIsWaitingForConnectivity:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:webSocketTask:didCloseWithCode:reason:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"q"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"URLSession:webSocketTask:didOpenWithProtocol:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSession:writeClosedForStreamTask:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"URLSessionDidFinishEventsForBackgroundURLSession:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"accessInstanceVariablesDirectly", {"retval": {"type": b"Z"}}) - r( - b"NSObject", - b"accommodatePresentedItemDeletionWithCompletionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - } - }, - }, - ) - r( - b"NSObject", - b"accommodatePresentedSubitemDeletionAtURL:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - }, - }, - }, - ) - r( - b"NSObject", - b"addObserver:forKeyPath:options:context:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "I"}, - 5: {"type": "^v"}, - }, - }, - ) - r(b"NSObject", b"allowsWeakReference", {"retval": {"type": "Z"}}) - r( - b"NSObject", - b"archiver:didEncodeObject:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"archiver:willEncodeObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"archiver:willReplaceObject:withObject:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"archiverDidFinish:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"archiverWillFinish:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"attemptRecoveryFromError:optionIndex:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}}}, - ) - r( - b"NSObject", - b"attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "Q"}, - 4: {"type": b"@"}, - 5: {"type": b":", "sel_of_type": b"v@:Z^v"}, - 6: {"type": "^v"}, - }, - }, - ) - r(b"NSObject", b"attributeKeys", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"authenticateComponents:withData:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"authenticationDataForComponents:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"autoContentAccessingProxy", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"automaticallyNotifiesObserversForKey:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"autorelease", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"awakeAfterUsingCoder:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"beginContentAccess", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"beginRequestWithExtensionContext:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"cache:willEvictObject:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"cancelAuthenticationChallenge:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"cancelPreviousPerformRequestsWithTarget:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"cancelPreviousPerformRequestsWithTarget:selector:object:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": ":", "sel_of_type": b"v@:@"}, - 4: {"type": b"@"}, - }, - }, - ) - r(b"NSObject", b"class", {"required": True, "retval": {"type": b"#"}}) - r(b"NSObject", b"classCode", {"retval": {"type": "Q"}}) - r(b"NSObject", b"classDescription", {"retval": {"type": b"@"}}) - r(b"NSObject", b"classFallbacksForKeyedArchiver", {"retval": {"type": b"@"}}) - r(b"NSObject", b"classForArchiver", {"retval": {"type": "#"}}) - r(b"NSObject", b"classForCoder", {"retval": {"type": "#"}}) - r(b"NSObject", b"classForKeyedArchiver", {"retval": {"type": "#"}}) - r(b"NSObject", b"classForKeyedUnarchiver", {"retval": {"type": "#"}}) - r(b"NSObject", b"classForPortCoder", {"retval": {"type": "#"}}) - r(b"NSObject", b"className", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"coerceValue:forKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r(b"NSObject", b"commitEditingAndReturnError:", {"arguments": {2: {"type": "o"}}}) - r( - b"NSObject", - b"conformsToProtocol:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"connection:canAuthenticateAgainstProtectionSpace:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:didCancelAuthenticationChallenge:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:didFailWithError:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:didReceiveAuthenticationChallenge:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:didReceiveData:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:didReceiveResponse:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"q"}, - 4: {"type": b"q"}, - 5: {"type": b"q"}, - }, - }, - ) - r( - b"NSObject", - b"connection:didWriteData:totalBytesWritten:expectedTotalBytes:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"q"}, - 4: {"type": b"q"}, - 5: {"type": b"q"}, - }, - }, - ) - r( - b"NSObject", - b"connection:handleRequest:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:needNewBodyStream:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:shouldMakeNewConnection:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:willCacheResponse:", - { - "required": False, - "retval": {"type": "@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:willSendRequest:redirectResponse:", - { - "required": False, - "retval": {"type": "@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connection:willSendRequestForAuthenticationChallenge:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connectionDidFinishDownloading:destinationURL:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"connectionDidFinishLoading:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytes:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"q"}, 4: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"connectionShouldUseCredentialStorage:", - {"required": False, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"continueWithoutCredentialForAuthenticationChallenge:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"copy", {"retval": {"already_retained": True}}) - r( - b"NSObject", - b"copyScriptingValue:forKey:withProperties:", - { - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"copyWithZone:", - { - "required": True, - "retval": {"already_retained": True, "type": b"@"}, - "arguments": {2: {"type": "^{_NSZone=}"}}, - }, - ) - r( - b"NSObject", - b"countByEnumeratingWithState:objects:count:", - { - "required": True, - "retval": {"type": b"Q"}, - "arguments": { - 2: {"type": "^{?=Q^@^Q[5Q]}"}, - 3: {"type": "^@"}, - 4: {"type": b"Q"}, - }, - "suggestion": "use python iteration", - }, - ) - r( - b"NSObject", - b"createConversationForConnection:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"debugDescription", {"required": False, "retval": {"type": b"@"}}) - r(b"NSObject", b"description", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"dictionaryWithValuesForKeys:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"didChange:valuesAtIndexes:forKey:", - { - "retval": {"type": "v"}, - "arguments": {2: {"type": "I"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"didChangeValueForKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"didChangeValueForKey:withSetMutation:usingObjects:", - { - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "I"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"discardContentIfPossible", - {"required": True, "retval": {"type": b"v"}}, - ) - r( - b"NSObject", - b"doesContain:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"doesNotRecognizeSelector:", - {"retval": {"type": "v"}, "arguments": {2: {"type": ":"}}}, - ) - r( - b"NSObject", - b"download:canAuthenticateAgainstProtectionSpace:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:decideDestinationWithSuggestedFilename:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:didCancelAuthenticationChallenge:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:didCreateDestination:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:didFailWithError:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:didReceiveAuthenticationChallenge:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:didReceiveDataOfLength:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}}, - }, - ) - r( - b"NSObject", - b"download:didReceiveResponse:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:shouldDecodeSourceDataOfMIMEType:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"download:willResumeWithResponse:fromByte:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "q"}}, - }, - ) - r( - b"NSObject", - b"download:willSendRequest:redirectResponse:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"downloadDidBegin:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"downloadDidFinish:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"downloadShouldUseCredentialStorage:", - {"required": False, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"encodeWithCoder:", - {"required": True, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"endContentAccess", {"required": True, "retval": {"type": b"v"}}) - r( - b"NSObject", - b"exceptionDuringOperation:error:leftOperand:rightOperand:", - { - "required": True, - "retval": {"type": "@"}, - "arguments": { - 2: {"type": ":"}, - 3: {"type": "Q"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"fileManager:shouldCopyItemAtPath:toPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldCopyItemAtURL:toURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldLinkItemAtPath:toPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldLinkItemAtURL:toURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldMoveItemAtPath:toPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldMoveItemAtURL:toURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:copyingItemAtURL:toURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:linkingItemAtPath:toPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:linkingItemAtURL:toURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:movingItemAtPath:toPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:movingItemAtURL:toURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:removingItemAtPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldProceedAfterError:removingItemAtURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldRemoveItemAtPath:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:shouldRemoveItemAtURL:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"fileManager:willProcessPath:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r(b"NSObject", b"forwardInvocation:", {"retval": {"type": "v"}}) - r( - b"NSObject", - b"handleMachMessage:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": "^v"}}}, - ) - r( - b"NSObject", - b"handlePortMessage:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"handleQueryWithUnboundKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"handleTakeValue:forUnboundKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r(b"NSObject", b"hash", {"required": True, "retval": {"type": "Q"}}) - r( - b"NSObject", - b"indicesOfObjectsByEvaluatingObjectSpecifier:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"initWithCoder:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"initWithItemProviderData:typeIdentifier:error:", - {"arguments": {4: {"type": "^@", "type_modifier": b"o"}}}, - ) - r(b"NSObject", b"initialize", {"retval": {"type": "v"}}) - r( - b"NSObject", - b"insertValue:atIndex:inPropertyWithKey:", - { - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"insertValue:inPropertyWithKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"instanceMethodForSelector:", - {"retval": {"type": "^?"}, "arguments": {2: {"type": ":"}}}, - ) - r( - b"NSObject", - b"instanceMethodSignatureForSelector:", - {"arguments": {2: {"type": ":"}}}, - ) - r( - b"NSObject", - b"instancesRespondToSelector:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": ":"}}}, - ) - r( - b"NSObject", - b"inverseForRelationshipKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isCaseInsensitiveLike:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"isContentDiscarded", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"isEqual:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isEqualTo:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isGreaterThan:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isGreaterThanOrEqualTo:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isKindOfClass:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": "#"}}}, - ) - r( - b"NSObject", - b"isLessThan:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isLessThanOrEqualTo:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isLike:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"isMemberOfClass:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": "#"}}}, - ) - r( - b"NSObject", - b"isNotEqualTo:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"isProxy", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"isSubclassOfClass:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "#"}}}, - ) - r( - b"NSObject", - b"itemProviderVisibilityForRepresentationWithTypeIdentifier:", - {"required": False, "retval": {"type": "q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"keyPathsForValuesAffectingValueForKey:", - {"retval": {"type": "@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"listener:shouldAcceptNewConnection:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"load", {"retval": {"type": "v"}}) - r( - b"NSObject", - b"loadDataWithTypeIdentifier:forItemProviderCompletionHandler:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "type": "@?", - }, - }, - }, - ) - r(b"NSObject", b"lock", {"required": True, "retval": {"type": "v"}}) - r( - b"NSObject", - b"makeNewConnection:sender:", - { - "required": False, - "retval": {"type": "Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"metadataQuery:replacementObjectForResultObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"metadataQuery:replacementValueForAttribute:value:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"methodForSelector:", - {"retval": {"type": "^?"}, "arguments": {2: {"type": ":"}}}, - ) - r(b"NSObject", b"methodSignatureForSelector:", {"arguments": {2: {"type": ":"}}}) - r( - b"NSObject", - b"mutableArrayValueForKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"mutableArrayValueForKeyPath:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"mutableCopy", {"retval": {"already_retained": True, "type": "@"}}) - r( - b"NSObject", - b"mutableCopyWithZone:", - { - "required": True, - "retval": {"already_retained": True, "type": "@"}, - "arguments": {2: {"type": "^{_NSZone=}"}}, - }, - ) - r( - b"NSObject", - b"mutableOrderedSetValueForKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"mutableOrderedSetValueForKeyPath:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"mutableSetValueForKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"mutableSetValueForKeyPath:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"netService:didAcceptConnectionWithInputStream:outputStream:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"netService:didNotPublish:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"netService:didNotResolve:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"netService:didUpdateTXTRecordData:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"netServiceBrowser:didFindDomain:moreComing:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"netServiceBrowser:didFindService:moreComing:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"netServiceBrowser:didNotSearch:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"netServiceBrowser:didRemoveDomain:moreComing:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"netServiceBrowser:didRemoveService:moreComing:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": "Z"}}, - }, - ) - r( - b"NSObject", - b"netServiceBrowserDidStopSearch:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"netServiceBrowserWillSearch:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"netServiceDidPublish:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"netServiceDidResolveAddress:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"netServiceDidStop:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"netServiceWillPublish:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"netServiceWillResolve:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"newScriptingObjectOfClass:forValueForKey:withContentsValue:properties:", - { - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": "#"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r(b"NSObject", b"objectSpecifier", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"objectWithItemProviderData:typeIdentifier:error:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "^@", "type_modifier": b"o"}, - }, - }, - ) - r(b"NSObject", b"observationInfo", {"retval": {"type": "^v"}}) - r( - b"NSObject", - b"observeValueForKeyPath:ofObject:change:context:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "^v"}, - }, - }, - ) - r( - b"NSObject", - b"observedPresentedItemUbiquityAttributes", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"parser:didEndElement:namespaceURI:qualifiedName:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"parser:didEndMappingPrefix:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:didStartElement:namespaceURI:qualifiedName:attributes:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"parser:didStartMappingPrefix:toURI:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundAttributeDeclarationWithName:forElement:type:defaultValue:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"parser:foundCDATA:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundCharacters:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundComment:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundElementDeclarationWithName:model:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundExternalEntityDeclarationWithName:publicID:systemID:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"parser:foundIgnorableWhitespace:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundInternalEntityDeclarationWithName:value:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundNotationDeclarationWithName:publicID:systemID:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"parser:foundProcessingInstructionWithTarget:data:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:foundUnparsedEntityDeclarationWithName:publicID:systemID:notationName:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"parser:parseErrorOccurred:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:resolveExternalEntityName:systemID:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parser:validationErrorOccurred:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"parserDidEndDocument:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"parserDidStartDocument:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"performDefaultHandlingForAuthenticationChallenge:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"performSelector:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": ":"}}}, - ) - r( - b"NSObject", - b"performSelector:onThread:withObject:waitUntilDone:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b":", "sel_of_type": b"v@:@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"performSelector:onThread:withObject:waitUntilDone:modes:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b":", "sel_of_type": b"v@:@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "Z"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"performSelector:withObject:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": ":"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"performSelector:withObject:afterDelay:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b":", "sel_of_type": b"v@:@"}, - 3: {"type": b"@"}, - 4: {"type": "d"}, - }, - }, - ) - r( - b"NSObject", - b"performSelector:withObject:afterDelay:inModes:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b":", "sel_of_type": b"v@:@"}, - 3: {"type": b"@"}, - 4: {"type": "d"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"performSelector:withObject:withObject:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": ":"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"performSelectorInBackground:withObject:", - { - "retval": {"type": "v"}, - "arguments": {2: {"type": b":", "sel_of_type": b"v@:@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"performSelectorOnMainThread:withObject:waitUntilDone:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b":", "sel_of_type": b"v@:@"}, - 3: {"type": b"@"}, - 4: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"performSelectorOnMainThread:withObject:waitUntilDone:modes:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": b":", "sel_of_type": b"v@:@"}, - 3: {"type": b"@"}, - 4: {"type": "Z"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"poseAsClass:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "#"}}}, - ) - r( - b"NSObject", - b"presentedItemDidChange", - {"required": False, "retval": {"type": b"v"}}, - ) - r( - b"NSObject", - b"presentedItemDidChangeUbiquityAttributes:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"presentedItemDidGainVersion:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"presentedItemDidLoseVersion:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"presentedItemDidMoveToURL:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"presentedItemDidResolveConflictVersion:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"presentedItemOperationQueue", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"presentedItemURL", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"presentedSubitemAtURL:didGainVersion:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"presentedSubitemAtURL:didLoseVersion:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"presentedSubitemAtURL:didMoveToURL:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"presentedSubitemAtURL:didResolveConflictVersion:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"presentedSubitemDidAppearAtURL:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"presentedSubitemDidChangeAtURL:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"primaryPresentedItemURL", - {"required": False, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"progress", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"readableTypeIdentifiersForItemProvider", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"rejectProtectionSpaceAndContinueWithChallenge:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"release", {"required": True, "retval": {"type": "Vv"}}) - r( - b"NSObject", - b"relinquishPresentedItemToReader:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": {0: {"type": "^v"}}, - }, - "type": b"@?", - }, - }, - }, - "type": "@?", - } - }, - }, - ) - r( - b"NSObject", - b"relinquishPresentedItemToWriter:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "callable": { - "retval": {"type": "v"}, - "arguments": {0: {"type": "^v"}}, - }, - "type": b"@?", - }, - }, - }, - "type": "@?", - } - }, - }, - ) - r(b"NSObject", b"remoteObjectProxy", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"remoteObjectProxyWithErrorHandler:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - } - }, - }, - ) - r( - b"NSObject", - b"removeObserver:forKeyPath:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"removeObserver:forKeyPath:context:", - { - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"^v"}}, - }, - ) - r( - b"NSObject", - b"removeValueAtIndex:fromPropertyWithKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "Q"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"replaceValueAtIndex:inPropertyWithKey:withValue:", - { - "retval": {"type": "v"}, - "arguments": {2: {"type": "Q"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"replacementObjectForArchiver:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"replacementObjectForCoder:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"replacementObjectForKeyedArchiver:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"replacementObjectForPortCoder:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"resolveClassMethod:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": ":"}}}, - ) - r( - b"NSObject", - b"resolveInstanceMethod:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": ":"}}}, - ) - r( - b"NSObject", - b"respondsToSelector:", - {"required": True, "retval": {"type": "Z"}, "arguments": {2: {"type": ":"}}}, - ) - r(b"NSObject", b"retain", {"required": True, "retval": {"type": b"@"}}) - r(b"NSObject", b"retainCount", {"required": True, "retval": {"type": "Q"}}) - r(b"NSObject", b"retainWeakReference", {"retval": {"type": "Z"}}) - r(b"NSObject", b"roundingMode", {"required": True, "retval": {"type": "Q"}}) - r( - b"NSObject", - b"savePresentedItemChangesWithCompletionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - } - }, - }, - ) - r(b"NSObject", b"scale", {"required": True, "retval": {"type": "s"}}) - r( - b"NSObject", - b"scriptingBeginsWith:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scriptingContains:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scriptingEndsWith:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scriptingIsEqualTo:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scriptingIsGreaterThan:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scriptingIsGreaterThanOrEqualTo:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scriptingIsLessThan:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scriptingIsLessThanOrEqualTo:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"scriptingProperties", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"scriptingValueForSpecifier:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"self", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"setKeys:triggerChangeNotificationsForDependentKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setNilValueForKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setObservationInfo:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "^v"}}}, - ) - r( - b"NSObject", - b"setPresentedItemOperationQueue:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setPresentedItemURL:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setPrimaryPresentedItemURL:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setScriptingProperties:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setValue:forKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setValue:forKeyPath:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setValue:forUndefinedKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setValuesForKeysWithDictionary:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setVersion:", - {"retval": {"type": "v"}, "arguments": {2: {"type": "q"}}}, - ) - r( - b"NSObject", - b"spellServer:checkGrammarInString:language:details:", - { - "required": False, - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "^@", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"spellServer:checkString:offset:types:options:orthography:wordCount:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": "Q"}, - 5: {"type": "q"}, - 6: {"type": b"@"}, - 7: {"type": b"@"}, - 8: {"type": "^q", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"spellServer:didForgetWord:inLanguage:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"spellServer:didLearnWord:inLanguage:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"spellServer:findMisspelledWordInString:language:wordCount:countOnly:", - { - "required": False, - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": "^q", "type_modifier": b"o"}, - 6: {"type": "Z"}, - }, - }, - ) - r( - b"NSObject", - b"spellServer:recordResponse:toCorrection:forWord:language:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"Q"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"spellServer:suggestCompletionsForPartialWordRange:inString:language:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": "{_NSRange=QQ}"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"spellServer:suggestGuessesForWord:inLanguage:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"storedValueForKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"stream:handleEvent:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "Q"}}, - }, - ) - r(b"NSObject", b"superclass", {"required": True, "retval": {"type": "#"}}) - r(b"NSObject", b"supportsSecureCoding", {"required": True, "retval": {"type": "Z"}}) - r( - b"NSObject", - b"synchronousRemoteObjectProxyWithErrorHandler:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": b"@?", - } - }, - }, - ) - r( - b"NSObject", - b"takeStoredValue:forKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"takeValue:forKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"takeValue:forKeyPath:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"takeValuesFromDictionary:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"toManyRelationshipKeys", {"retval": {"type": b"@"}}) - r(b"NSObject", b"toOneRelationshipKeys", {"retval": {"type": b"@"}}) - r( - b"NSObject", - b"unableToSetNilForKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"unarchiver:cannotDecodeObjectOfClassName:originalClasses:", - { - "required": False, - "retval": {"type": "#"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"unarchiver:didDecodeObject:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"unarchiver:willReplaceObject:withObject:", - { - "required": False, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"unarchiverDidFinish:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"unarchiverWillFinish:", - {"required": False, "retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"unlock", {"required": True, "retval": {"type": "v"}}) - r( - b"NSObject", - b"useCredential:forAuthenticationChallenge:", - { - "required": True, - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"useStoredAccessor", {"retval": {"type": "Z"}}) - r( - b"NSObject", - b"userActivity:didReceiveInputStream:outputStream:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"userActivityWasContinued:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"userActivityWillSave:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"userNotificationCenter:didActivateNotification:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"userNotificationCenter:didDeliverNotification:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"userNotificationCenter:shouldPresentNotification:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"validateValue:forKey:error:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "^@", "type_modifier": b"N"}, - 3: {"type": b"@"}, - 4: {"type": "^@", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"validateValue:forKeyPath:error:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "^@", "type_modifier": b"N"}, - 3: {"type": "@"}, - 4: {"type": "^@", "type_modifier": b"o"}, - }, - }, - ) - r( - b"NSObject", - b"valueAtIndex:inPropertyWithKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": "Q"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valueForKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valueForKeyPath:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valueForUndefinedKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valueWithName:inPropertyWithKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valueWithUniqueID:inPropertyWithKey:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valuesForKeys:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"version", {"retval": {"type": "q"}}) - r( - b"NSObject", - b"willChange:valuesAtIndexes:forKey:", - { - "retval": {"type": "v"}, - "arguments": {2: {"type": "I"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"willChangeValueForKey:", - {"retval": {"type": "v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"willChangeValueForKey:withSetMutation:usingObjects:", - { - "retval": {"type": "v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": "I"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"writableTypeIdentifiersForItemProvider", - {"required": True, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"zone", {"required": True, "retval": {"type": b"^{_NSZone=}"}}) - r( - b"NSOperation", - b"completionBlock", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r(b"NSOperation", b"isAsynchronous", {"retval": {"type": b"Z"}}) - r(b"NSOperation", b"isCancelled", {"retval": {"type": "Z"}}) - r(b"NSOperation", b"isConcurrent", {"retval": {"type": "Z"}}) - r(b"NSOperation", b"isExecuting", {"retval": {"type": "Z"}}) - r(b"NSOperation", b"isFinished", {"retval": {"type": "Z"}}) - r(b"NSOperation", b"isReady", {"retval": {"type": "Z"}}) - r( - b"NSOperation", - b"setCompletionBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSOperationQueue", - b"addBarrierBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSOperationQueue", - b"addOperationWithBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSOperationQueue", - b"addOperations:waitUntilFinished:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSOperationQueue", b"isSuspended", {"retval": {"type": "Z"}}) - r(b"NSOperationQueue", b"setSuspended:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSOrderedCollectionDifference", - b"differenceByTransformingChangesWithBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSOrderedCollectionDifference", b"hasChanges", {"retval": {"type": b"Z"}}) - r(b"NSOrderedSet", b"containsObject:", {"retval": {"type": "Z"}}) - r( - b"NSOrderedSet", - b"differenceFromOrderedSet:withOptions:usingEquivalenceTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"enumerateObjectsAtIndexes:options:usingBlock:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"enumerateObjectsUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"enumerateObjectsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexOfObject:inSortedRange:options:usingComparator:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexOfObjectAtIndexes:options:passingTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexOfObjectPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexOfObjectWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexesOfObjecstWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexesOfObjectsAtIndexes:options:passingTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexesOfObjectsPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"indexesOfObjectsWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r(b"NSOrderedSet", b"initWithArray:copyItems:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSOrderedSet", - b"initWithArray:range:copyItems:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSOrderedSet", - b"initWithObjects:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"NSOrderedSet", - b"initWithObjects:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSOrderedSet", - b"initWithOrderedSet:copyItems:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOrderedSet", - b"initWithOrderedSet:range:copyItems:", - {"arguments": {4: {"type": "Z"}}}, - ) - r(b"NSOrderedSet", b"initWithSet:copyItems:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSOrderedSet", b"insersectsSet:", {"retval": {"type": "Z"}}) - r(b"NSOrderedSet", b"intersectsOrderedSet:", {"retval": {"type": "Z"}}) - r(b"NSOrderedSet", b"intersectsSet:", {"retval": {"type": b"Z"}}) - r(b"NSOrderedSet", b"isEqualToOrderedSet:", {"retval": {"type": "Z"}}) - r(b"NSOrderedSet", b"isSubsetOfOrderedSet:", {"retval": {"type": "Z"}}) - r(b"NSOrderedSet", b"isSubsetOfSet:", {"retval": {"type": "Z"}}) - r( - b"NSOrderedSet", - b"orderedSetWithArray:copyItems:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOrderedSet", - b"orderedSetWithArray:range:copyItems:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSOrderedSet", - b"orderedSetWithObjects:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"NSOrderedSet", - b"orderedSetWithObjects:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSOrderedSet", - b"orderedSetWithOrderedSet:copyItems:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOrderedSet", - b"orderedSetWithOrderedSet:range:copyItems:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSOrderedSet", - b"orderedSetWithSet:copyItems:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOrderedSet", - b"sortedArrayUsingComparator:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSOrderedSet", - b"sortedArrayWithOptions:usingComparator:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"q"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"NSOutputStream", b"hasSpaceAvailable", {"retval": {"type": "Z"}}) - r( - b"NSOutputStream", - b"initToBuffer:capacity:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"o", "c_array_length_in_arg": 3} - } - }, - ) - r(b"NSOutputStream", b"initToFileAtPath:append:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSOutputStream", b"initWithURL:append:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSOutputStream", - b"outputStreamToBuffer:capacity:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"o", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSOutputStream", - b"outputStreamToFileAtPath:append:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOutputStream", - b"outputStreamWithURL:append:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSOutputStream", - b"write:maxLength:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSPersonNameComponentsFormatter", - b"getObjectValue:forString:errorDescription:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"null_accepted": False, "type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - }, - }, - ) - r(b"NSPersonNameComponentsFormatter", b"isPhonetic", {"retval": {"type": "Z"}}) - r( - b"NSPersonNameComponentsFormatter", - b"setPhonetic:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSPointerArray", - b"addPointer:", - {"arguments": {2: {"type": "@"}}, "suggestion": "use NSMutableArray"}, - ) - r( - b"NSPointerArray", - b"insertPointer:atIndex:", - {"arguments": {2: {"type": "@"}}, "suggestion": "use NSMutableArray"}, - ) - r( - b"NSPointerArray", - b"pointerAtIndex:", - {"retval": {"type": "@"}, "suggestion": "use NSMutableArray"}, - ) - r( - b"NSPointerArray", - b"replacePointerAtIndex:withPointer:", - {"arguments": {3: {"type": "@"}}, "suggestion": "use NSMutableArray"}, - ) - r(b"NSPointerFunctions", b"acquireFunction", {"retval": {"type": "^v"}}) - r(b"NSPointerFunctions", b"setAcquireFunction:", {"arguments": {2: {"type": "^v"}}}) - r( - b"NSPointerFunctions", - b"setUsesStrongWriteBarrier:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSPointerFunctions", - b"setUsesWeakReadAndWriteBarriers:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSPointerFunctions", b"usesStrongWriteBarrier", {"retval": {"type": "Z"}}) - r(b"NSPointerFunctions", b"usesWeakReadAndWriteBarriers", {"retval": {"type": "Z"}}) - r(b"NSPort", b"isValid", {"retval": {"type": "Z"}}) - r(b"NSPort", b"sendBeforeDate:components:from:reserved:", {"retval": {"type": "Z"}}) - r( - b"NSPort", - b"sendBeforeDate:msgid:components:from:reserved:", - {"retval": {"type": "Z"}}, - ) - r(b"NSPortCoder", b"isBycopy", {"retval": {"type": "Z"}}) - r(b"NSPortCoder", b"isByref", {"retval": {"type": "Z"}}) - r(b"NSPortMessage", b"sendBeforeDate:", {"retval": {"type": "Z"}}) - r(b"NSPortNameServer", b"registerPort:name:", {"retval": {"type": "Z"}}) - r(b"NSPortNameServer", b"removePortForName:", {"retval": {"type": "Z"}}) - r(b"NSPositionalSpecifier", b"insertionReplaces", {"retval": {"type": "Z"}}) - r(b"NSPredicate", b"evaluateWithObject:", {"retval": {"type": "Z"}}) - r( - b"NSPredicate", - b"evaluateWithObject:substitutionVariables:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSPredicate", - b"predicateWithBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSPredicate", - b"predicateWithFormat:", - {"arguments": {2: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSPredicate", - b"predicateWithFormat:arguments:", - {"suggestion": "use +predicateWithFormat:"}, - ) - r(b"NSPredicate", b"predicateWithValue:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSPresentationIntent", - b"isEquivalentToPresentationIntent:", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSProcessInfo", - b"automaticTerminationSupportEnabled", - {"retval": {"type": b"Z"}}, - ) - r(b"NSProcessInfo", b"isLowPowerModeEnabled", {"retval": {"type": b"Z"}}) - r(b"NSProcessInfo", b"isMacCatalystApp", {"retval": {"type": b"Z"}}) - r( - b"NSProcessInfo", - b"isOperatingSystemAtLeastVersion:", - { - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"{NSOperatingSystemVersion=qqq}"}}, - }, - ) - r(b"NSProcessInfo", b"isiOSAppOnMac", {"retval": {"type": "Z"}}) - r( - b"NSProcessInfo", - b"operatingSystemVersion", - {"retval": {"type": b"{NSOperatingSystemVersion=qqq}"}}, - ) - r( - b"NSProcessInfo", - b"performActivityWithOptions:reason:usingBlock:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSProcessInfo", - b"performExpiringActivityWithReason:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"Z"}}, - } - } - } - }, - ) - r( - b"NSProcessInfo", - b"setAutomaticTerminationSupportEnabled:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSProgress", - b"addSubscriberForFileURL:withPublishingHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": { - "callable": { - "retval": {"type": "v"}, - "arguments": {0: {"type": "^v"}}, - }, - "type": b"@?", - }, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - } - } - }, - ) - r( - b"NSProgress", - b"cancellationHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r(b"NSProgress", b"isCancellable", {"retval": {"type": b"Z"}}) - r(b"NSProgress", b"isCancelled", {"retval": {"type": b"Z"}}) - r(b"NSProgress", b"isFinished", {"retval": {"type": b"Z"}}) - r(b"NSProgress", b"isIndeterminate", {"retval": {"type": b"Z"}}) - r(b"NSProgress", b"isOld", {"retval": {"type": b"Z"}}) - r(b"NSProgress", b"isPausable", {"retval": {"type": b"Z"}}) - r(b"NSProgress", b"isPaused", {"retval": {"type": b"Z"}}) - r( - b"NSProgress", - b"pausingHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r( - b"NSProgress", - b"performAsCurrentWithPendingUnitCount:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSProgress", - b"resumingHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r(b"NSProgress", b"setCancellable:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSProgress", - b"setCancellationHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"NSProgress", b"setPausable:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSProgress", - b"setPausingHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSProgress", - b"setResumingHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSPropertyListSerialization", - b"dataFromPropertyList:format:errorDescription:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSPropertyListSerialization", - b"dataWithPropertyList:format:options:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSPropertyListSerialization", - b"propertyList:isValidForFormat:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSPropertyListSerialization", - b"propertyListFromData:mutabilityOption:format:errorDescription:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}}, - ) - r( - b"NSPropertyListSerialization", - b"propertyListWithData:options:format:error:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}}, - ) - r( - b"NSPropertyListSerialization", - b"propertyListWithStream:options:format:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSPropertyListSerialization", - b"writePropertyList:toStream:format:options:error:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r(b"NSProxy", b"allowsWeakReference", {"retval": {"type": "Z"}}) - r(b"NSProxy", b"methodSignatureForSelector:", {"arguments": {2: {"type": ":"}}}) - r( - b"NSProxy", - b"respondsToSelector:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": ":"}}}, - ) - r(b"NSProxy", b"retainWeakReference", {"retval": {"type": "Z"}}) - r(b"NSRecursiveLock", b"lockBeforeDate:", {"retval": {"type": "Z"}}) - r(b"NSRecursiveLock", b"tryLock", {"retval": {"type": "Z"}}) - r( - b"NSRegularExpression", - b"enumerateMatchesInString:options:range:usingBlock:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Q"}, - 3: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSRegularExpression", - b"initWithPattern:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSRegularExpression", - b"regularExpressionWithPattern:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSRunLoop", - b"cancelPerformSelector:target:argument:", - {"arguments": {2: {"type": ":", "sel_of_type": b"v@:@"}}}, - ) - r( - b"NSRunLoop", - b"performBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSRunLoop", - b"performInModes:block:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSRunLoop", - b"performSelector:target:argument:order:modes:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSRunLoop", b"runMode:beforeDate:", {"retval": {"type": "Z"}}) - r(b"NSScanner", b"caseSensitive", {"retval": {"type": "Z"}}) - r(b"NSScanner", b"isAtEnd", {"retval": {"type": "Z"}}) - r( - b"NSScanner", - b"scanCharactersFromSet:intoString:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanDecimal:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: { - "null_accepted": False, - "type": b"^{NSDecimal=b8b4b1b1b18[8S]}", - "type_modifier": b"o", - } - }, - }, - ) - r( - b"NSScanner", - b"scanDouble:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanFloat:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanHexDouble:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"null_accepted": False, "type": "^d", "type_modifier": b"o"} - }, - }, - ) - r( - b"NSScanner", - b"scanHexFloat:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"null_accepted": False, "type": "^f", "type_modifier": b"o"} - }, - }, - ) - r( - b"NSScanner", - b"scanHexInt:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanHexLongLong:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"null_accepted": False, "type": "^Q", "type_modifier": b"o"} - }, - }, - ) - r( - b"NSScanner", - b"scanInt:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanInteger:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanLongLong:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanString:intoString:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanUnsignedLongLong:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanUpToCharactersFromSet:intoString:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r( - b"NSScanner", - b"scanUpToString:intoString:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"null_accepted": False, "type_modifier": b"o"}}, - }, - ) - r(b"NSScanner", b"setCaseSensitive:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSScriptClassDescription", - b"hasOrderedToManyRelationshipForKey:", - {"retval": {"type": "Z"}}, - ) - r(b"NSScriptClassDescription", b"hasPropertyForKey:", {"retval": {"type": "Z"}}) - r( - b"NSScriptClassDescription", - b"hasReadablePropertyForKey:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScriptClassDescription", - b"hasWritablePropertyForKey:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScriptClassDescription", - b"isLocationRequiredToCreateForKey:", - {"retval": {"type": "Z"}}, - ) - r(b"NSScriptClassDescription", b"isReadOnlyKey:", {"retval": {"type": "Z"}}) - r(b"NSScriptClassDescription", b"matchesAppleEventCode:", {"retval": {"type": "Z"}}) - r(b"NSScriptClassDescription", b"supportsCommand:", {"retval": {"type": "Z"}}) - r( - b"NSScriptCoercionHandler", - b"registerCoercer:selector:toConvertFromClass:toClass:", - {"arguments": {3: {"sel_of_type": b"@@:@#"}}}, - ) - r(b"NSScriptCommand", b"isWellFormed", {"retval": {"type": "Z"}}) - r( - b"NSScriptCommandDescription", - b"isOptionalArgumentWithName:", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScriptObjectSpecifier", - b"containerIsObjectBeingTested", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScriptObjectSpecifier", - b"containerIsRangeContainerObject", - {"retval": {"type": "Z"}}, - ) - r( - b"NSScriptObjectSpecifier", - b"indicesOfObjectsByEvaluatingWithContainer:count:", - { - "retval": {"c_array_length_in_arg": 3}, - "arguments": {3: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSScriptObjectSpecifier", - b"setContainerIsObjectBeingTested:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSScriptObjectSpecifier", - b"setContainerIsRangeContainerObject:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSScriptWhoseTest", b"isTrue", {"retval": {"type": "Z"}}) - r( - b"NSSet", - b"addObserver:forKeyPath:options:context:", - {"arguments": {5: {"type": "^v"}}}, - ) - r(b"NSSet", b"containsObject:", {"retval": {"type": "Z"}}) - r( - b"NSSet", - b"enumerateObjectsUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSSet", - b"enumerateObjectsWithOptions:usingBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSSet", - b"initWithObjects:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"NSSet", - b"initWithObjects:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r(b"NSSet", b"initWithSet:copyItems:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSSet", b"intersectsSet:", {"retval": {"type": "Z"}}) - r(b"NSSet", b"isEqualToSet:", {"retval": {"type": "Z"}}) - r(b"NSSet", b"isSubsetOfSet:", {"retval": {"type": "Z"}}) - r( - b"NSSet", - b"makeObjectsPerformSelector:", - {"arguments": {2: {"sel_of_type": b"v@:"}}}, - ) - r( - b"NSSet", - b"makeObjectsPerformSelector:withObject:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSSet", - b"objectsPassingTest:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSSet", - b"objectsWithOptions:passingTest:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSSet", - b"setWithObjects:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"NSSet", - b"setWithObjects:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r(b"NSSocketPortNameServer", b"registerPort:name:", {"retval": {"type": "Z"}}) - r( - b"NSSocketPortNameServer", - b"registerPort:name:nameServerPortNumber:", - {"retval": {"type": "Z"}}, - ) - r(b"NSSocketPortNameServer", b"removePortForName:", {"retval": {"type": "Z"}}) - r(b"NSSortDescriptor", b"ascending", {"retval": {"type": "Z"}}) - r( - b"NSSortDescriptor", - b"comparator", - { - "retval": { - "callable": { - "retval": {"type": b"i"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - }, - ) - r(b"NSSortDescriptor", b"initWithKey:ascending:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSSortDescriptor", - b"initWithKey:ascending:comparator:", - { - "arguments": { - 3: {"type": "Z"}, - 4: { - "callable": { - "retval": {"type": b"i"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - }, - } - }, - ) - r( - b"NSSortDescriptor", - b"initWithKey:ascending:selector:", - {"arguments": {3: {"type": "Z"}, 4: {"sel_of_type": b"i@:@"}}}, - ) - r( - b"NSSortDescriptor", - b"sortDescriptorWithKey:ascending:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSSortDescriptor", - b"sortDescriptorWithKey:ascending:comparator:", - { - "arguments": { - 3: {"type": "Z"}, - 4: { - "callable": { - "retval": {"type": b"i"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - }, - } - }, - ) - r( - b"NSSortDescriptor", - b"sortDescriptorWithKey:ascending:selector:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSSpellServer", - b"isWordInUserDictionaries:caseSensitive:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r(b"NSSpellServer", b"registerLanguage:byVendor:", {"retval": {"type": "Z"}}) - r( - b"NSStream", - b"getBoundStreamsWithBufferSize:inputStream:outputStream:", - {"arguments": {3: {"type_modifier": b"o"}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSStream", - b"getStreamsToHost:port:inputStream:outputStream:", - { - "arguments": { - 4: {"null_accepted": False, "type_modifier": b"o"}, - 5: {"null_accepted": False, "type_modifier": b"o"}, - } - }, - ) - r( - b"NSStream", - b"getStreamsToHostWithName:port:inputStream:outputStream:", - {"arguments": {4: {"type_modifier": b"o"}, 5: {"type_modifier": b"o"}}}, - ) - r(b"NSStream", b"setProperty:forKey:", {"retval": {"type": "Z"}}) - r(b"NSString", b"", {"retval": {"type": "*"}}) - r( - b"NSString", - b"UTF8String", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r( - b"NSString", - b"availableStringEncodings", - {"retval": {"c_array_delimited_by_null": True, "type": "r^Q"}}, - ) - r(b"NSString", b"boolValue", {"retval": {"type": "Z"}}) - r( - b"NSString", - b"cString", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r( - b"NSString", - b"cStringUsingEncoding:", - {"retval": {"c_array_delimited_by_null": True, "type": "^v"}}, - ) - r(b"NSString", b"canBeConvertedToEncoding:", {"retval": {"type": "Z"}}) - r(b"NSString", b"characterAtIndex:", {"retval": {"type": "T"}}) - r( - b"NSString", - b"compare:options:range:", - {"arguments": {4: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSString", - b"compare:options:range:locale:", - {"arguments": {4: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSString", - b"completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:", - { - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type": "Z"}, - 4: {"type_modifier": b"o"}, - } - }, - ) - r(b"NSString", b"containsString:", {"retval": {"type": b"Z"}}) - r( - b"NSString", - b"dataUsingEncoding:allowLossyConversion:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSString", - b"enumerateLinesUsingBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSString", - b"enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:", - { - "arguments": { - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"{_NSRange=QQ}"}, - 4: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSString", - b"enumerateSubstringsInRange:options:usingBlock:", - { - "arguments": { - 2: {"type": "{_NSRange=QQ}"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"{_NSRange=QQ}"}, - 4: {"type": b"^Z", "type_modifier": "o"}, - }, - } - }, - } - }, - ) - r( - b"NSString", - b"enumeratorLinguisticTagsInRange:scheme:options:orthography:usingBlock:", - { - "arguments": { - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"{_NSRange=QQ}"}, - 3: {"type": b"{_NSRange=QQ}"}, - 4: {"type": b"^Z", "type_modifier": "o"}, - }, - } - } - } - }, - ) - r( - b"NSString", - b"fileSystemRepresentation", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r( - b"NSString", - b"getBytes:maxLength:usedLength:encoding:options:range:remainingRange:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: { - "type": "^v", - "type_modifier": b"o", - "c_array_length_in_arg": (3, 4), - }, - 4: {"type": "^Q", "type_modifier": b"o"}, - 7: {"type": "{_NSRange=QQ}"}, - 8: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - "suggestion": "do not use", - }, - ) - r( - b"NSString", - b"getCString:", - {"arguments": {2: {"type": "*"}}, "suggestion": "use -cString"}, - ) - r( - b"NSString", - b"getCString:maxLength:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "^v", "type_modifier": b"o", "c_array_length_in_arg": 3} - }, - "suggestion": "use -cString instead", - }, - ) - r( - b"NSString", - b"getCString:maxLength:encoding:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "^v", "type_modifier": b"o", "c_array_length_in_arg": 3} - }, - "suggestion": "use -cString instead", - }, - ) - r( - b"NSString", - b"getCString:maxLength:range:remainingRange:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "^v", "type_modifier": b"o", "c_array_length_in_arg": 3}, - 5: {"type": "^{_NSRange=QQ}", "type_modifier": b"o"}, - }, - "suggestion": "use -cString instead", - }, - ) - r( - b"NSString", - b"getCharacters:", - { - "retval": {"type": "v"}, - "arguments": { - 2: { - "type": "^T", - "type_modifier": b"o", - "c_array_of_variable_length": True, - } - }, - }, - ) - r( - b"NSString", - b"getCharacters:range:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type": "^T", "type_modifier": b"o", "c_array_length_in_arg": 3}, - 3: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSString", - b"getFileSystemRepresentation:maxLength:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "^t", "type_modifier": b"o", "c_array_length_in_arg": 3} - }, - }, - ) - r( - b"NSString", - b"getLineStart:end:contentsEnd:forRange:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - 5: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r( - b"NSString", - b"getParagraphStart:end:contentsEnd:forRange:", - { - "retval": {"type": "v"}, - "arguments": { - 2: {"type_modifier": b"o"}, - 3: {"type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - 5: {"type": "{_NSRange=QQ}"}, - }, - }, - ) - r(b"NSString", b"hasPrefix:", {"retval": {"type": "Z"}}) - r(b"NSString", b"hasSuffix:", {"retval": {"type": "Z"}}) - r( - b"NSString", - b"initWithBytes:length:encoding:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"NSString", - b"initWithBytesNoCopy:length:encoding:deallocator:", - { - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"^v"}, - 2: {"type": b"Q"}, - }, - } - } - } - }, - ) - r( - b"NSString", - b"initWithBytesNoCopy:length:encoding:freeWhenDone:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 5: {"type": "Z"}, - }, - "suggestion": "use -initWithBytes:length:encoding instead", - }, - ) - r( - b"NSString", - b"initWithCString:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^v", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSString", - b"initWithCString:encoding:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSString", - b"initWithCString:length:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSString", - b"initWithCStringNoCopy:length:freeWhenDone:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 4: {"type": "Z"}, - }, - "suggestion": "use -initWithCString:length: instead", - }, - ) - r( - b"NSString", - b"initWithCharacters:length:", - { - "arguments": { - 2: {"type": "^T", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSString", - b"initWithCharactersNoCopy:length:deallocator:", - { - "retval": {"type": "@"}, - "arguments": { - 2: {"type": "^T", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: { - "type": b"^T", - "type_modifier": "n", - "c_array_length_in_arg": 2, - }, - 2: {"type": b"Q"}, - }, - } - }, - }, - "suggestion": "use -initWithCharacters:length: instead", - }, - ) - r( - b"NSString", - b"initWithCharactersNoCopy:length:freeWhenDone:", - { - "retval": {"type": "@"}, - "arguments": { - 2: {"type": "^T", "type_modifier": b"n", "c_array_length_in_arg": 3}, - 4: {"type": "Z"}, - }, - "suggestion": "use -initWithCharacters:length: instead", - }, - ) - r( - b"NSString", - b"initWithContentsOfFile:encoding:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"initWithContentsOfFile:usedEncoding:error:", - { - "arguments": { - 3: {"type": "r^Q", "type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - } - }, - ) - r(b"NSString", b"initWithContentsOfURL:", {"arguments": {2: {"type": "@"}}}) - r( - b"NSString", - b"initWithContentsOfURL:encoding:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"initWithContentsOfURL:usedEncoding:error:", - { - "arguments": { - 3: {"type": "r^Q", "type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSString", - b"initWithFormat:", - {"arguments": {2: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSString", - b"initWithFormat:arguments:", - { - "arguments": {3: {"type": "[1{?=II^v^v}]"}}, - "suggestion": "use -initWithFormat:", - }, - ) - r( - b"NSString", - b"initWithFormat:locale:", - {"arguments": {2: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSString", - b"initWithFormat:locale:arguments:", - { - "arguments": {4: {"type": "[1{?=II^v^v}]"}}, - "suggestion": "use -initWithFormat:locale:", - }, - ) - r( - b"NSString", - b"initWithUTF8String:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSString", - b"initWithValidatedFormat:validFormatSpecifiers:arguments:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"initWithValidatedFormat:validFormatSpecifiers:error:", - { - "arguments": {2: {"printf_format": True}, 4: {"type_modifier": b"o"}}, - "variadic": True, - }, - ) - r( - b"NSString", - b"initWithValidatedFormat:validFormatSpecifiers:locale:arguments:error:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"initWithValidatedFormat:validFormatSpecifiers:locale:error:", - { - "arguments": {2: {"printf_format": True}, 5: {"type_modifier": b"o"}}, - "variadic": True, - }, - ) - r( - b"NSString", - b"initWithValidatedFormat:validatedFormatSpecifiers:arguments:error:", - { - "arguments": {5: {"type_modifier": b"o"}}, - "suggestion": "use -initWithValidatedFormat:validatedFormatSpecifiers:error:", - }, - ) - r( - b"NSString", - b"initWithValidatedFormat:validatedFormatSpecifiers:error:", - {"arguments": {2: {"printf_format": True}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"initWithValidatedFormat:validatedFormatSpecifiers:locale:arguments:error:", - { - "arguments": {6: {"type_modifier": b"o"}}, - "suggestion": "use -initWithValidatedFormat:validatedFormatSpecifiers:locale:error:", - }, - ) - r( - b"NSString", - b"initWithValidatedFormat:validatedFormatSpecifiers:locale:error:", - {"arguments": {2: {"printf_format": True}, 5: {"type_modifier": b"o"}}}, - ) - r(b"NSString", b"isAbsolutePath", {"retval": {"type": "Z"}}) - r(b"NSString", b"isEqualToString:", {"retval": {"type": "Z"}}) - r( - b"NSString", - b"lineRangeForRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSString", - b"linguisticTagsInRange:scheme:options:orthography:tokenRanges:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"localizedCaseInsensitiveContainsString:", - {"retval": {"type": b"Z"}}, - ) - r(b"NSString", b"localizedStandardContainsString:", {"retval": {"type": "Z"}}) - r( - b"NSString", - b"localizedStringWithFormat:", - {"arguments": {2: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSString", - b"localizedStringWithValidatedFormat:validFormatSpecifiers:error:", - {"arguments": {4: {"type_modifier": b"o"}}, "variadic": True}, - ) - r( - b"NSString", - b"lossyCString", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r( - b"NSString", - b"paragraphRangeForRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r(b"NSString", b"rangeOfCharacterFromSet:", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSString", - b"rangeOfCharacterFromSet:options:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSString", - b"rangeOfCharacterFromSet:options:range:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {4: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSString", - b"rangeOfComposedCharacterSequenceAtIndex:", - {"retval": {"type": "{_NSRange=QQ}"}}, - ) - r( - b"NSString", - b"rangeOfComposedCharacterSequencesForRange:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {2: {"type": "{_NSRange=QQ}"}}, - }, - ) - r(b"NSString", b"rangeOfString:", {"retval": {"type": "{_NSRange=QQ}"}}) - r(b"NSString", b"rangeOfString:options:", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSString", - b"rangeOfString:options:range:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {4: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSString", - b"rangeOfString:options:range:locale:", - { - "retval": {"type": "{_NSRange=QQ}"}, - "arguments": {4: {"type": "{_NSRange=QQ}"}}, - }, - ) - r( - b"NSString", - b"stringByAppendingFormat:", - {"arguments": {2: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSString", - b"stringByApplyingTransform:reverse:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSString", - b"stringByReplacingCharactersInRange:withString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSString", - b"stringByReplacingOccurrencesOfString:withString:options:range:", - {"arguments": {5: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSString", - b"stringEncodingForData:encodingOptions:convertedString:usedLossyConversion:", - { - "arguments": { - 4: {"type_modifier": b"o"}, - 5: {"type": b"^Z", "type_modifier": b"o"}, - } - }, - ) - r( - b"NSString", - b"stringWithCString:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^v", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSString", - b"stringWithCString:encoding:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSString", - b"stringWithCString:length:", - { - "arguments": { - 2: {"type": "^v", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSString", - b"stringWithCharacters:length:", - { - "arguments": { - 2: {"type": "r^T", "type_modifier": b"n", "c_array_length_in_arg": 3} - } - }, - ) - r( - b"NSString", - b"stringWithContentsOfFile:encoding:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"stringWithContentsOfFile:usedEncoding:error:", - { - "arguments": { - 3: {"type": "r^Q", "type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSString", - b"stringWithContentsOfURL:encoding:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"stringWithContentsOfURL:usedEncoding:error:", - { - "arguments": { - 3: {"type": "r^Q", "type_modifier": b"o"}, - 4: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSString", - b"stringWithFormat:", - {"arguments": {2: {"printf_format": True, "type": "@"}}, "variadic": True}, - ) - r( - b"NSString", - b"stringWithUTF8String:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - } - } - }, - ) - r( - b"NSString", - b"stringWithValidatedFormat:validFormatSpecifiers:error:", - { - "arguments": {2: {"printf_format": True}, 4: {"type_modifier": b"o"}}, - "variadic": True, - }, - ) - r( - b"NSString", - b"stringWithValidatedFormat:validFormatSpecifiers:locale:error:", - {"arguments": {2: {"printf_format": True}, 5: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"stringWithValidatedFormat:validatedFormatSpecifiers:error:", - {"arguments": {2: {"printf_format": True}, 4: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"stringWithValidatedFormat:validatedFormatSpecifiers:locale:error:", - {"arguments": {2: {"printf_format": True}, 5: {"type_modifier": b"o"}}}, - ) - r( - b"NSString", - b"substringWithRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSString", - b"writeToFile:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSString", - b"writeToFile:atomically:encoding:error:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "Z"}, 5: {"type_modifier": b"o"}}, - }, - ) - r( - b"NSString", - b"writeToURL:atomically:", - {"retval": {"type": "Z"}, "arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSString", - b"writeToURL:atomically:encoding:error:", - { - "retval": {"type": "Z"}, - "arguments": {3: {"type": "Z"}, 5: {"type_modifier": b"o"}}, - }, - ) - r(b"NSTask", b"isRunning", {"retval": {"type": "Z"}}) - r( - b"NSTask", - b"launchAndReturnError:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSTask", - b"launchedTaskWithExecutableURL:arguments:error:terminationHandler:", - { - "arguments": { - 4: {"type_modifier": b"o"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r(b"NSTask", b"resume", {"retval": {"type": "Z"}}) - r( - b"NSTask", - b"setTerminationHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSTask", b"suspend", {"retval": {"type": "Z"}}) - r( - b"NSTask", - b"terminationHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - }, - ) - r( - b"NSTextCheckingResult", - b"addressCheckingResultWithRange:components:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"correctionCheckingResultWithRange:replacementString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"dashCheckingResultWithRange:replacementString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"dateCheckingResultWithRange:date:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"dateCheckingResultWithRange:date:timeZone:duration:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"grammarCheckingResultWithRange:details:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"linkCheckingResultWithRange:URL:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"orthographyCheckingResultWithRange:orthography:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"phoneNumberCheckingResultWithRange:phoneNumber:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"quoteCheckingResultWithRange:replacementString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"regularExpressionCheckingResultWithRanges:count:regularExpression:", - { - "arguments": { - 2: { - "type": "^{_NSRange=QQ}", - "type_modifier": b"n", - "c_array_length_in_arg": 3, - } - } - }, - ) - r( - b"NSTextCheckingResult", - b"replacementCheckingResultWithRange:replacementString:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"spellCheckingResultWithRange:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSTextCheckingResult", - b"transitInformationCheckingResultWithRange:components:", - {"arguments": {2: {"type": "{_NSRange=QQ}"}}}, - ) - r( - b"NSThread", - b"detachNewThreadSelector:toTarget:withObject:", - {"arguments": {2: {"sel_of_type": b"v@:@"}}}, - ) - r( - b"NSThread", - b"detachNewThreadWithBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSThread", - b"initWithBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSThread", - b"initWithTarget:selector:object:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSThread", b"isCancelled", {"retval": {"type": "Z"}}) - r(b"NSThread", b"isExecuting", {"retval": {"type": "Z"}}) - r(b"NSThread", b"isFinished", {"retval": {"type": "Z"}}) - r(b"NSThread", b"isMainThread", {"retval": {"type": "Z"}}) - r(b"NSThread", b"isMultiThreaded", {"retval": {"type": "Z"}}) - r(b"NSThread", b"setThreadPriority:", {"retval": {"type": "Z"}}) - r(b"NSTimeZone", b"isDaylightSavingTime", {"retval": {"type": "Z"}}) - r(b"NSTimeZone", b"isDaylightSavingTimeForDate:", {"retval": {"type": "Z"}}) - r(b"NSTimeZone", b"isEqualToTimeZone:", {"retval": {"type": "Z"}}) - r( - b"NSTimer", - b"initWithFireDate:interval:repeats:block:", - { - "arguments": { - 4: {"type": "Z"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r( - b"NSTimer", - b"initWithFireDate:interval:target:selector:userInfo:repeats:", - {"arguments": {5: {"sel_of_type": b"v@:@"}, 7: {"type": "Z"}}}, - ) - r(b"NSTimer", b"isValid", {"retval": {"type": "Z"}}) - r( - b"NSTimer", - b"scheduledTimerWithTimeInterval:invocation:repeats:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSTimer", - b"scheduledTimerWithTimeInterval:repeats:block:", - { - "arguments": { - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r( - b"NSTimer", - b"scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", - {"arguments": {4: {"sel_of_type": b"v@:@"}, 6: {"type": "Z"}}}, - ) - r( - b"NSTimer", - b"timerWithTimeInterval:invocation:repeats:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSTimer", - b"timerWithTimeInterval:repeats:block:", - { - "arguments": { - 3: {"type": "Z"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - }, - } - }, - ) - r( - b"NSTimer", - b"timerWithTimeInterval:target:selector:userInfo:repeats:", - {"arguments": {4: {"sel_of_type": b"v@:@"}, 6: {"type": "Z"}}}, - ) - r( - b"NSURL", - b"URLByAppendingPathComponent:isDirectory:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSURL", - b"URLByResolvingAliasFileAtURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:", - { - "arguments": { - 5: {"type": "^Z", "type_modifier": b"o"}, - 6: {"type_modifier": b"o"}, - } - }, - ) - r(b"NSURL", b"URLHandleUsingCache:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSURL", - b"URLWithString:encodingInvalidCharacters:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSURL", - b"bookmarkDataWithContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"checkPromisedItemIsReachableAndReturnError:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"checkResourceIsReachableAndReturnError:", - {"retval": {"type": "Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"fileURLWithFileSystemRepresentation:isDirectory:relativeToURL:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - 3: {"type": "Z"}, - } - }, - ) - r(b"NSURL", b"fileURLWithPath:isDirectory:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSURL", - b"fileURLWithPath:isDirectory:relativeToURL:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSURL", - b"getFileSystemRepresentation:maxLength:", - { - "retval": {"type": "Z"}, - "arguments": { - 2: {"type": "^t", "type_modifier": b"o", "c_array_length_in_arg": 3} - }, - }, - ) - r( - b"NSURL", - b"getPromisedItemResourceValue:forKey:error:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"getResourceValue:forKey:error:", - { - "retval": {"type": "Z"}, - "arguments": {2: {"type_modifier": b"o"}, 4: {"type_modifier": b"o"}}, - }, - ) - r(b"NSURL", b"hasDirectoryPath", {"retval": {"type": "Z"}}) - r( - b"NSURL", - b"initByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:", - { - "arguments": { - 5: {"type": "^Z", "type_modifier": b"o"}, - 6: {"type_modifier": b"o"}, - } - }, - ) - r( - b"NSURL", - b"initFileURLWithFileSystemRepresentation:isDirectory:relativeToURL:", - { - "arguments": { - 2: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - 3: {"type": "Z"}, - } - }, - ) - r(b"NSURL", b"initFileURLWithPath:isDirectory:", {"arguments": {3: {"type": "Z"}}}) - r( - b"NSURL", - b"initFileURLWithPath:isDirectory:relativeToURL:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSURL", - b"initWithContentsOfURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"initWithString:encodingInvalidCharacters:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"NSURL", b"isFileReferenceURL", {"retval": {"type": "Z"}}) - r(b"NSURL", b"isFileURL", {"retval": {"type": "Z"}}) - r( - b"NSURL", - b"loadResourceDataNotifyingClient:usingCache:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"NSURL", - b"promisedItemResourceValuesForKeys:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSURL", b"resourceDataUsingCache:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSURL", - b"resourceValuesForKeys:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSURL", b"setProperty:forKey:", {"retval": {"type": "Z"}}) - r(b"NSURL", b"setResourceData:", {"retval": {"type": "Z"}}) - r( - b"NSURL", - b"setResourceValue:forKey:error:", - {"retval": {"type": "Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"setResourceValues:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r(b"NSURL", b"startAccessingSecurityScopedResource", {"retval": {"type": b"Z"}}) - r( - b"NSURL", - b"writeBookmarkData:toURL:options:error:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"NSURL", - b"writeToURL:error:", - {"retval": {"type": "Z"}, "arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSURLCache", - b"getCachedResponseForDataTask:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSURLComponents", - b"componentsWithString:encodingInvalidCharacters:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSURLComponents", - b"componentsWithURL:resolvingAgainstBaseURL:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSURLComponents", - b"initWithString:encodingInvalidCharacters:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"NSURLComponents", - b"initWithURL:resolvingAgainstBaseURL:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"NSURLConnection", b"canHandleRequest:", {"retval": {"type": "Z"}}) - r( - b"NSURLConnection", - b"initWithRequest:delegate:startImmediately:", - {"arguments": {4: {"type": "Z"}}}, - ) - r( - b"NSURLConnection", - b"sendAsynchronousRequest:queue:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLConnection", - b"sendSynchronousRequest:returningResponse:error:", - {"arguments": {3: {"type_modifier": b"o"}, 4: {"type_modifier": b"o"}}}, - ) - r(b"NSURLCredential", b"hasPassword", {"retval": {"type": "Z"}}) - r( - b"NSURLCredentialStorage", - b"getCredentialsForProtectionSpace:task:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSURLCredentialStorage", - b"getDefaultCredentialForProtectionSpace:task:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSURLDownload", - b"canResumeDownloadDecodedWithEncodingMIMEType:", - {"retval": {"type": "Z"}}, - ) - r(b"NSURLDownload", b"deletesFileUponFailure", {"retval": {"type": "Z"}}) - r( - b"NSURLDownload", - b"setDeletesFileUponFailure:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSURLDownload", - b"setDestination:allowOverwrite:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSURLHandle", b"canInitWithURL:", {"retval": {"type": "Z"}}) - r(b"NSURLHandle", b"didLoadBytes:loadComplete:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSURLHandle", b"initWithURL:cached:", {"arguments": {3: {"type": "Z"}}}) - r(b"NSURLHandle", b"writeData:", {"retval": {"type": "Z"}}) - r(b"NSURLHandle", b"writeProperty:forKey:", {"retval": {"type": "Z"}}) - r(b"NSURLProtectionSpace", b"isProxy", {"retval": {"type": "Z"}}) - r(b"NSURLProtectionSpace", b"receivesCredentialSecurely", {"retval": {"type": "Z"}}) - r(b"NSURLProtocol", b"canInitWithRequest:", {"retval": {"type": "Z"}}) - r(b"NSURLProtocol", b"canInitWithTask:", {"retval": {"type": b"Z"}}) - r(b"NSURLProtocol", b"registerClass:", {"retval": {"type": "Z"}}) - r( - b"NSURLProtocol", - b"requestIsCacheEquivalent:toRequest:", - {"retval": {"type": "Z"}}, - ) - r(b"NSURLRequest", b"HTTPShouldHandleCookies", {"retval": {"type": "Z"}}) - r(b"NSURLRequest", b"HTTPShouldUsePipelining", {"retval": {"type": "Z"}}) - r(b"NSURLRequest", b"allowsCellularAccess", {"retval": {"type": b"Z"}}) - r(b"NSURLRequest", b"allowsConstrainedNetworkAccess", {"retval": {"type": b"Z"}}) - r(b"NSURLRequest", b"allowsExpensiveNetworkAccess", {"retval": {"type": b"Z"}}) - r(b"NSURLRequest", b"assumesHTTP3Capable", {"retval": {"type": "Z"}}) - r(b"NSURLRequest", b"requiresDNSSECValidation", {"retval": {"type": b"Z"}}) - r(b"NSURLRequest", b"supportsSecureCoding", {"retval": {"type": b"Z"}}) - r( - b"NSURLSession", - b"dataTaskWithRequest:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"dataTaskWithURL:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"downloadTaskWithRequest:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"downloadTaskWithResumeData:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"downloadTaskWithURL:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"flushWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSURLSession", - b"getAllTasksWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSURLSession", - b"getTasksWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"resetWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSURLSession", - b"uploadTaskWithRequest:fromData:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"uploadTaskWithRequest:fromFile:completionHandler:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSession", - b"uploadTaskWithResumeData:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - } - } - } - }, - ) - r(b"NSURLSessionConfiguration", b"HTTPShouldSetCookies", {"retval": {"type": b"Z"}}) - r( - b"NSURLSessionConfiguration", - b"HTTPShouldUsePipelining", - {"retval": {"type": b"Z"}}, - ) - r(b"NSURLSessionConfiguration", b"allowsCellularAccess", {"retval": {"type": b"Z"}}) - r( - b"NSURLSessionConfiguration", - b"allowsConstrainedNetworkAccess", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSURLSessionConfiguration", - b"allowsExpensiveNetworkAccess", - {"retval": {"type": b"Z"}}, - ) - r(b"NSURLSessionConfiguration", b"isDiscretionary", {"retval": {"type": "Z"}}) - r( - b"NSURLSessionConfiguration", - b"requiresDNSSECValidation", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSURLSessionConfiguration", - b"sessionSendsLaunchEvents", - {"retval": {"type": b"Z"}}, - ) - r( - b"NSURLSessionConfiguration", - b"setAllowsCellularAccess:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setAllowsConstrainedNetworkAccess:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setAllowsExpensiveNetworkAccess:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setDiscretionary:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setHTTPShouldSetCookies:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setHTTPShouldUsePipelining:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setRequiresDNSSECValidation:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setSessionSendsLaunchEvents:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setShouldUseExtendedBackgroundIdleMode:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"setWaitsForConnectivity:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSURLSessionConfiguration", - b"shouldUseExtendedBackgroundIdleMode", - {"retval": {"type": "Z"}}, - ) - r(b"NSURLSessionConfiguration", b"waitsForConnectivity", {"retval": {"type": "Z"}}) - r( - b"NSURLSessionDownloadTask", - b"cancelByProducingResumeData:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSURLSessionStreamTask", - b"readDataOfMinLength:maxLength:timeout:completionHandler:", - { - "arguments": { - 2: {"type": "Q"}, - 3: {"type": "Q"}, - 4: {"type": "d"}, - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"Z"}, - 3: {"type": b"@"}, - }, - }, - "type": "@?", - }, - } - }, - ) - r( - b"NSURLSessionStreamTask", - b"writeData:timeout:completionHandler:", - { - "arguments": { - 3: {"type": "d"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - }, - } - }, - ) - r(b"NSURLSessionTask", b"prefersIncrementalDelivery", {"retval": {"type": b"Z"}}) - r( - b"NSURLSessionTask", - b"setPrefersIncrementalDelivery:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSURLSessionTaskTransactionMetrics", b"isCellular", {"retval": {"type": b"Z"}}) - r( - b"NSURLSessionTaskTransactionMetrics", - b"isConstrained", - {"retval": {"type": b"Z"}}, - ) - r(b"NSURLSessionTaskTransactionMetrics", b"isExpensive", {"retval": {"type": b"Z"}}) - r(b"NSURLSessionTaskTransactionMetrics", b"isMultipath", {"retval": {"type": b"Z"}}) - r( - b"NSURLSessionTaskTransactionMetrics", - b"isProxyConnection", - {"retval": {"type": "Z"}}, - ) - r( - b"NSURLSessionTaskTransactionMetrics", - b"isReusedConnection", - {"retval": {"type": "Z"}}, - ) - r( - b"NSURLSessionUploadTask", - b"cancelByProducingResumeData:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSURLSessionWebSocketTask", - b"receiveMessageWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSURLSessionWebSocketTask", - b"sendMessage:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSURLSessionWebSocketTask", - b"sendPingWithPongReceiveHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSUUID", - b"getUUIDBytes:", - { - "arguments": { - 2: {"c_array_of_fixed_length": 16, "type": "^t", "type_modifier": b"o"} - } - }, - ) - r( - b"NSUUID", - b"initWithUUIDBytes:", - { - "arguments": { - 2: {"c_array_of_fixed_length": 16, "type": "^t", "type_modifier": b"n"} - } - }, - ) - r(b"NSUbiquitousKeyValueStore", b"boolForKey:", {"retval": {"type": "Z"}}) - r( - b"NSUbiquitousKeyValueStore", - b"setBool:forKey:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSUbiquitousKeyValueStore", b"synchronize", {"retval": {"type": b"Z"}}) - r(b"NSUbiquitousKeyValueStore", b"synchronize:", {"retval": {"type": "Z"}}) - r(b"NSUnarchiver", b"isAtEnd", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"canRedo", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"canUndo", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"groupsByEvent", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"isRedoing", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"isUndoRegistrationEnabled", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"isUndoing", {"retval": {"type": "Z"}}) - r(b"NSUndoManager", b"redoActionIsDiscardable", {"retval": {"type": "Z"}}) - r( - b"NSUndoManager", - b"redoMenuTitleForUndoActionName:", - {"arguments": {2: {"type": "@"}}}, - ) - r( - b"NSUndoManager", - b"registerUndoWithTarget:handler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSUndoManager", - b"registerUndoWithTarget:selector:object:", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"NSUndoManager", b"setActionIsDiscardable:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSUndoManager", b"setGroupsByEvent:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSUndoManager", b"undoActionIsDiscardable", {"retval": {"type": "Z"}}) - r( - b"NSUserActivity", - b"deleteAllSavedUserActivitiesWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSUserActivity", - b"deleteSavedUserActivitiesWithPersistentIdentifiers:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSUserActivity", - b"getContinuationStreamsWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - 3: {"type": b"@"}, - }, - }, - "type": "@?", - } - } - }, - ) - r(b"NSUserActivity", b"isEligibleForHandoff", {"retval": {"type": "Z"}}) - r(b"NSUserActivity", b"isEligibleForPrediction", {"retval": {"type": b"Z"}}) - r(b"NSUserActivity", b"isEligibleForPublicIndexing", {"retval": {"type": "Z"}}) - r(b"NSUserActivity", b"isEligibleForSearch", {"retval": {"type": "Z"}}) - r(b"NSUserActivity", b"needsSave", {"retval": {"type": b"Z"}}) - r(b"NSUserActivity", b"setEligibleForHandoff:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSUserActivity", - b"setEligibleForPrediction:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"NSUserActivity", - b"setEligibleForPublicIndexing:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSUserActivity", b"setEligibleForSearch:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSUserActivity", b"setNeedsSave:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSUserActivity", - b"setSupportsContinuationStreams:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSUserActivity", b"supportsContinuationStreams", {"retval": {"type": b"Z"}}) - r( - b"NSUserAppleScriptTask", - b"executeWithAppleEvent:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"NSUserAutomatorTask", - b"executeWithInput:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r(b"NSUserDefaults", b"boolForKey:", {"retval": {"type": "Z"}}) - r(b"NSUserDefaults", b"objectIsForcedForKey:", {"retval": {"type": "Z"}}) - r(b"NSUserDefaults", b"objectIsForcedForKey:inDomain:", {"retval": {"type": "Z"}}) - r(b"NSUserDefaults", b"setBool:forKey:", {"arguments": {2: {"type": "Z"}}}) - r(b"NSUserDefaults", b"synchronize", {"retval": {"type": "Z"}}) - r(b"NSUserNotification", b"hasActionButton", {"retval": {"type": b"Z"}}) - r(b"NSUserNotification", b"hasReplyButton", {"retval": {"type": b"Z"}}) - r(b"NSUserNotification", b"isPresented", {"retval": {"type": b"Z"}}) - r(b"NSUserNotification", b"isRemote", {"retval": {"type": b"Z"}}) - r(b"NSUserNotification", b"setHasActionButton:", {"arguments": {2: {"type": b"Z"}}}) - r(b"NSUserNotification", b"setHasReplyButton:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"NSUserScriptTask", - b"executeWithCompletionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSUserScriptTask", - b"initWithURL:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSUserUnixTask", - b"executeWithArguments:completionHandler:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSValue", - b"getValue:", - {"arguments": {2: {"type": "^v"}}, "suggestion": "use another method"}, - ) - r( - b"NSValue", - b"initWithBytes:objCType:", - { - "arguments": { - 2: { - "type": "^v", - "type_modifier": b"n", - "c_array_of_variable_length": True, - }, - 3: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - }, - "suggestion": "use something else", - }, - ) - r(b"NSValue", b"isEqualToValue:", {"retval": {"type": "Z"}}) - r( - b"NSValue", - b"objCType", - {"retval": {"c_array_delimited_by_null": True, "type": "^t"}}, - ) - r(b"NSValue", b"pointValue", {"retval": {"type": "{CGPoint=dd}"}}) - r( - b"NSValue", - b"pointerValue", - {"retval": {"type": "^v"}, "suggestion": "use something else"}, - ) - r(b"NSValue", b"rangeValue", {"retval": {"type": "{_NSRange=QQ}"}}) - r( - b"NSValue", - b"rectValue", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSValue", b"sizeValue", {"retval": {"type": "{CGSize=dd}"}}) - r( - b"NSValue", - b"value:withObjCType:", - { - "arguments": { - 2: { - "type": "^v", - "type_modifier": b"n", - "c_array_of_variable_length": True, - }, - 3: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - }, - "suggestion": "use something else", - }, - ) - r( - b"NSValue", - b"valueWithBytes:objCType:", - { - "arguments": { - 2: { - "type": "^v", - "type_modifier": b"n", - "c_array_of_variable_length": True, - }, - 3: { - "c_array_delimited_by_null": True, - "type": "^t", - "type_modifier": b"n", - }, - }, - "suggestion": "use something else", - }, - ) - r(b"NSValue", b"valueWithPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSValue", - b"valueWithPointer:", - {"arguments": {2: {"type": "^v"}}, "suggestion": "use some other method"}, - ) - r(b"NSValue", b"valueWithRange:", {"arguments": {2: {"type": "{_NSRange=QQ}"}}}) - r( - b"NSValue", - b"valueWithRect:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSValue", b"valueWithSize:", {"arguments": {2: {"type": "{CGSize=dd}"}}}) - r(b"NSValueTransformer", b"allowsReverseTransformation", {"retval": {"type": "Z"}}) - r( - b"NSXMLDTD", - b"initWithContentsOfURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLDTD", - b"initWithData:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSXMLDTDNode", b"isExternal", {"retval": {"type": "Z"}}) - r( - b"NSXMLDocument", - b"initWithContentsOfURL:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLDocument", - b"initWithData:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLDocument", - b"initWithXMLString:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSXMLDocument", b"isStandalone", {"retval": {"type": "Z"}}) - r( - b"NSXMLDocument", - b"objectByApplyingXSLT:arguments:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLDocument", - b"objectByApplyingXSLTAtURL:arguments:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLDocument", - b"objectByApplyingXSLTString:arguments:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r(b"NSXMLDocument", b"setStandalone:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSXMLDocument", - b"validateAndReturnError:", - {"retval": {"type": "Z"}, "arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLElement", - b"initWithXMLString:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLElement", - b"normalizeAdjacentTextNodesPreservingCDATA:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSXMLNode", - b"canonicalXMLStringPreservingComments:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSXMLNode", - b"nodesForXPath:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLNode", - b"objectsForXQuery:constants:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLNode", - b"objectsForXQuery:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"NSXMLNode", - b"setStringValue:resolvingEntities:", - {"arguments": {3: {"type": "Z"}}}, - ) - r(b"NSXMLParser", b"parse", {"retval": {"type": "Z"}}) - r(b"NSXMLParser", b"setShouldProcessNamespaces:", {"arguments": {2: {"type": "Z"}}}) - r( - b"NSXMLParser", - b"setShouldReportNamespacePrefixes:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"NSXMLParser", - b"setShouldResolveExternalEntities:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"NSXMLParser", b"shouldProcessNamespaces", {"retval": {"type": "Z"}}) - r(b"NSXMLParser", b"shouldReportNamespacePrefixes", {"retval": {"type": "Z"}}) - r(b"NSXMLParser", b"shouldResolveExternalEntities", {"retval": {"type": "Z"}}) - r( - b"NSXPCConnection", - b"interruptionHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r( - b"NSXPCConnection", - b"invalidationHandler", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r( - b"NSXPCConnection", - b"remoteObjectProxyWithErrorHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSXPCConnection", - b"scheduleSendBarrierBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSXPCConnection", - b"setInterruptionHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSXPCConnection", - b"setInvalidationHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r( - b"NSXPCConnection", - b"synchronousRemoteObjectProxyWithErrorHandler:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - } - } - } - }, - ) - r( - b"NSXPCInterface", - b"XPCTypeForSelector:argumentIndex:ofReply:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"NSXPCInterface", - b"classesForSelector:argumentIndex:ofReply:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"NSXPCInterface", - b"interfaceForSelector:argumentIndex:ofReply:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"NSXPCInterface", - b"setClasses:forSelector:argumentIndex:ofReply:", - {"arguments": {5: {"type": b"Z"}}}, - ) - r( - b"NSXPCInterface", - b"setInterface:forSelector:argumentIndex:ofReply:", - {"arguments": {5: {"type": b"Z"}}}, - ) - r( - b"NSXPCInterface", - b"setXPCType:forSelector:argumentIndex:ofReply:", - {"arguments": {5: {"type": b"Z"}}}, - ) - r( - b"null", - b"differenceFromArray:withOptions:usingEquivalenceTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"null", - b"differenceFromOrderedSet:withOptions:usingEquivalenceTest:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - } - } - } - }, - ) - r( - b"null", - b"setCustomPronoun:forLanguage:error:", - {"retval": {"type": b"Z"}, "arguments": {4: {"type_modifier": b"o"}}}, - ) -finally: - objc._updatingMetadata(False) -protocols = { - "NSCoderMethods": objc.informal_protocol( - "NSCoderMethods", - [ - objc.selector(None, b"classForCoder", b"#@:", isRequired=False), - objc.selector(None, b"version", b"q@:", isRequired=False), - objc.selector(None, b"setVersion:", b"v@:q", isRequired=False), - objc.selector( - None, b"replacementObjectForCoder:", b"@@:@", isRequired=False - ), - objc.selector(None, b"awakeAfterUsingCoder:", b"@@:@", isRequired=False), - ], - ), - "NSCopyLinkMoveHandler": objc.informal_protocol( - "NSCopyLinkMoveHandler", - [ - objc.selector( - None, - b"fileManager:shouldProceedAfterError:", - b"Z@:@@", - isRequired=False, - ), - objc.selector( - None, b"fileManager:willProcessPath:", b"v@:@@", isRequired=False - ), - ], - ), - "NSScriptClassDescription": objc.informal_protocol( - "NSScriptClassDescription", - [ - objc.selector(None, b"className", b"@@:", isRequired=False), - objc.selector(None, b"classCode", b"I@:", isRequired=False), - ], - ), - "NSKeyValueObserverNotification": objc.informal_protocol( - "NSKeyValueObserverNotification", - [ - objc.selector( - None, b"didChange:valuesAtIndexes:forKey:", b"v@:Q@@", isRequired=False - ), - objc.selector(None, b"didChangeValueForKey:", b"v@:@", isRequired=False), - objc.selector( - None, b"willChange:valuesAtIndexes:forKey:", b"v@:Q@@", isRequired=False - ), - objc.selector(None, b"willChangeValueForKey:", b"v@:@", isRequired=False), - objc.selector( - None, - b"didChangeValueForKey:withSetMutation:usingObjects:", - b"v@:@Q@", - isRequired=False, - ), - objc.selector( - None, - b"willChangeValueForKey:withSetMutation:usingObjects:", - b"v@:@Q@", - isRequired=False, - ), - ], - ), - "NSKeyValueCoding": objc.informal_protocol( - "NSKeyValueCoding", - [ - objc.selector( - None, b"mutableOrderedSetValueForKeyPath:", b"@@:@", isRequired=False - ), - objc.selector(None, b"mutableSetValueForKey:", b"@@:@", isRequired=False), - objc.selector( - None, b"validateValue:forKeyPath:error:", b"Z@:^@@^@", isRequired=False - ), - objc.selector(None, b"valueForKey:", b"@@:@", isRequired=False), - objc.selector(None, b"mutableArrayValueForKey:", b"@@:@", isRequired=False), - objc.selector( - None, b"dictionaryWithValuesForKeys:", b"@@:@", isRequired=False - ), - objc.selector(None, b"setValue:forKey:", b"v@:@@", isRequired=False), - objc.selector( - None, b"mutableOrderedSetValueForKey:", b"@@:@", isRequired=False - ), - objc.selector( - None, b"validateValue:forKey:error:", b"Z@:^@@^@", isRequired=False - ), - objc.selector(None, b"valueForKeyPath:", b"@@:@", isRequired=False), - objc.selector(None, b"valueForUndefinedKey:", b"@@:@", isRequired=False), - objc.selector( - None, b"mutableArrayValueForKeyPath:", b"@@:@", isRequired=False - ), - objc.selector(None, b"setNilValueForKey:", b"v@:@", isRequired=False), - objc.selector( - None, b"accessInstanceVariablesDirectly", b"Z@:", isRequired=False - ), - objc.selector(None, b"setValue:forKeyPath:", b"v@:@@", isRequired=False), - objc.selector( - None, b"setValuesForKeysWithDictionary:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"setValue:forUndefinedKey:", b"v@:@@", isRequired=False - ), - objc.selector( - None, b"mutableSetValueForKeyPath:", b"@@:@", isRequired=False - ), - ], - ), - "NSDeprecatedMethods": objc.informal_protocol( - "NSDeprecatedMethods", - [objc.selector(None, b"poseAsClass:", b"v@:#", isRequired=False)], - ), - "NSScriptKeyValueCoding": objc.informal_protocol( - "NSScriptKeyValueCoding", - [ - objc.selector( - None, - b"removeValueAtIndex:fromPropertyWithKey:", - b"v@:Q@", - isRequired=False, - ), - objc.selector( - None, b"insertValue:inPropertyWithKey:", b"v@:@@", isRequired=False - ), - objc.selector( - None, - b"valueWithUniqueID:inPropertyWithKey:", - b"@@:@@", - isRequired=False, - ), - objc.selector( - None, - b"insertValue:atIndex:inPropertyWithKey:", - b"v@:@Q@", - isRequired=False, - ), - objc.selector(None, b"coerceValue:forKey:", b"@@:@@", isRequired=False), - objc.selector( - None, - b"replaceValueAtIndex:inPropertyWithKey:withValue:", - b"v@:Q@@", - isRequired=False, - ), - objc.selector( - None, b"valueAtIndex:inPropertyWithKey:", b"@@:Q@", isRequired=False - ), - objc.selector( - None, b"valueWithName:inPropertyWithKey:", b"@@:@@", isRequired=False - ), - ], - ), - "NSDiscardableContentProxy": objc.informal_protocol( - "NSDiscardableContentProxy", - [objc.selector(None, b"autoContentAccessingProxy", b"@@:", isRequired=False)], - ), - "NSDeprecatedKeyValueObservingCustomization": objc.informal_protocol( - "NSDeprecatedKeyValueObservingCustomization", - [ - objc.selector( - None, - b"setKeys:triggerChangeNotificationsForDependentKey:", - b"v@:@@", - isRequired=False, - ) - ], - ), - "NSComparisonMethods": objc.informal_protocol( - "NSComparisonMethods", - [ - objc.selector(None, b"isCaseInsensitiveLike:", b"Z@:@", isRequired=False), - objc.selector(None, b"isLessThan:", b"Z@:@", isRequired=False), - objc.selector(None, b"isGreaterThanOrEqualTo:", b"Z@:@", isRequired=False), - objc.selector(None, b"isNotEqualTo:", b"Z@:@", isRequired=False), - objc.selector(None, b"isGreaterThan:", b"Z@:@", isRequired=False), - objc.selector(None, b"isLike:", b"Z@:@", isRequired=False), - objc.selector(None, b"isEqualTo:", b"Z@:@", isRequired=False), - objc.selector(None, b"doesContain:", b"Z@:@", isRequired=False), - objc.selector(None, b"isLessThanOrEqualTo:", b"Z@:@", isRequired=False), - ], - ), - "NSDeprecatedKeyValueCoding": objc.informal_protocol( - "NSDeprecatedKeyValueCoding", - [ - objc.selector(None, b"valuesForKeys:", b"@@:@", isRequired=False), - objc.selector(None, b"takeStoredValue:forKey:", b"v@:@@", isRequired=False), - objc.selector(None, b"takeValue:forKey:", b"v@:@@", isRequired=False), - objc.selector(None, b"storedValueForKey:", b"@@:@", isRequired=False), - objc.selector( - None, b"handleTakeValue:forUnboundKey:", b"v@:@@", isRequired=False - ), - objc.selector(None, b"useStoredAccessor", b"Z@:", isRequired=False), - objc.selector( - None, b"takeValuesFromDictionary:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"handleQueryWithUnboundKey:", b"@@:@", isRequired=False - ), - objc.selector(None, b"takeValue:forKeyPath:", b"v@:@@", isRequired=False), - objc.selector(None, b"unableToSetNilForKey:", b"v@:@", isRequired=False), - ], - ), - "NSScripting": objc.informal_protocol( - "NSScripting", - [ - objc.selector(None, b"setScriptingProperties:", b"v@:@", isRequired=False), - objc.selector( - None, b"scriptingValueForSpecifier:", b"@@:@", isRequired=False - ), - objc.selector( - None, - b"newScriptingObjectOfClass:forValueForKey:withContentsValue:properties:", - b"@@:#@@@", - isRequired=False, - ), - objc.selector(None, b"scriptingProperties", b"@@:", isRequired=False), - objc.selector( - None, - b"copyScriptingValue:forKey:withProperties:", - b"@@:@@@", - isRequired=False, - ), - ], - ), - "NSKeyValueObserving": objc.informal_protocol( - "NSKeyValueObserving", - [ - objc.selector( - None, - b"observeValueForKeyPath:ofObject:change:context:", - b"v@:@@@^v", - isRequired=False, - ) - ], - ), - "NSArchiverCallback": objc.informal_protocol( - "NSArchiverCallback", - [ - objc.selector( - None, b"replacementObjectForArchiver:", b"@@:@", isRequired=False - ), - objc.selector(None, b"classForArchiver", b"#@:", isRequired=False), - ], - ), - "NSThreadPerformAdditions": objc.informal_protocol( - "NSThreadPerformAdditions", - [ - objc.selector( - None, - b"performSelector:onThread:withObject:waitUntilDone:", - b"v@::@@Z", - isRequired=False, - ), - objc.selector( - None, - b"performSelectorOnMainThread:withObject:waitUntilDone:", - b"v@::@Z", - isRequired=False, - ), - objc.selector( - None, - b"performSelectorInBackground:withObject:", - b"v@::@", - isRequired=False, - ), - objc.selector( - None, - b"performSelector:onThread:withObject:waitUntilDone:modes:", - b"v@::@@Z@", - isRequired=False, - ), - objc.selector( - None, - b"performSelectorOnMainThread:withObject:waitUntilDone:modes:", - b"v@::@Z@", - isRequired=False, - ), - ], - ), - "NSKeyedUnarchiverObjectSubstitution": objc.informal_protocol( - "NSKeyedUnarchiverObjectSubstitution", - [objc.selector(None, b"classForKeyedUnarchiver", b"#@:", isRequired=False)], - ), - "NSScriptingComparisonMethods": objc.informal_protocol( - "NSScriptingComparisonMethods", - [ - objc.selector(None, b"scriptingContains:", b"Z@:@", isRequired=False), - objc.selector(None, b"scriptingIsGreaterThan:", b"Z@:@", isRequired=False), - objc.selector(None, b"scriptingEndsWith:", b"Z@:@", isRequired=False), - objc.selector(None, b"scriptingIsLessThan:", b"Z@:@", isRequired=False), - objc.selector(None, b"scriptingBeginsWith:", b"Z@:@", isRequired=False), - objc.selector( - None, b"scriptingIsGreaterThanOrEqualTo:", b"Z@:@", isRequired=False - ), - objc.selector(None, b"scriptingIsEqualTo:", b"Z@:@", isRequired=False), - objc.selector( - None, b"scriptingIsLessThanOrEqualTo:", b"Z@:@", isRequired=False - ), - ], - ), - "NSDistributedObjects": objc.informal_protocol( - "NSDistributedObjects", - [ - objc.selector( - None, b"replacementObjectForPortCoder:", b"@@:@", isRequired=False - ), - objc.selector(None, b"classForPortCoder", b"#@:", isRequired=False), - ], - ), - "NSKeyValueObserverRegistration": objc.informal_protocol( - "NSKeyValueObserverRegistration", - [ - objc.selector( - None, - b"removeObserver:forKeyPath:context:", - b"v@:@@^v", - isRequired=False, - ), - objc.selector( - None, - b"addObserver:forKeyPath:options:context:", - b"v@:@@Q^v", - isRequired=False, - ), - objc.selector( - None, b"removeObserver:forKeyPath:", b"v@:@@", isRequired=False - ), - ], - ), - "NSScriptObjectSpecifiers": objc.informal_protocol( - "NSScriptObjectSpecifiers", - [ - objc.selector(None, b"objectSpecifier", b"@@:", isRequired=False), - objc.selector( - None, - b"indicesOfObjectsByEvaluatingObjectSpecifier:", - b"@@:@", - isRequired=False, - ), - ], - ), - "NSErrorRecoveryAttempting": objc.informal_protocol( - "NSErrorRecoveryAttempting", - [ - objc.selector( - None, - b"attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:", - b"v@:@Q@:^v", - isRequired=False, - ), - objc.selector( - None, - b"attemptRecoveryFromError:optionIndex:", - b"Z@:@Q", - isRequired=False, - ), - ], - ), - "NSClassDescriptionPrimitives": objc.informal_protocol( - "NSClassDescriptionPrimitives", - [ - objc.selector( - None, b"inverseForRelationshipKey:", b"@@:@", isRequired=False - ), - objc.selector(None, b"attributeKeys", b"@@:", isRequired=False), - objc.selector(None, b"toOneRelationshipKeys", b"@@:", isRequired=False), - objc.selector(None, b"classDescription", b"@@:", isRequired=False), - objc.selector(None, b"toManyRelationshipKeys", b"@@:", isRequired=False), - ], - ), - "NSURLClient": objc.informal_protocol( - "NSURLClient", - [ - objc.selector( - None, b"URLResourceDidFinishLoading:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"URLResourceDidCancelLoading:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"URL:resourceDataDidBecomeAvailable:", b"v@:@@", isRequired=False - ), - objc.selector( - None, - b"URL:resourceDidFailLoadingWithReason:", - b"v@:@@", - isRequired=False, - ), - ], - ), - "NSKeyValueObservingCustomization": objc.informal_protocol( - "NSKeyValueObservingCustomization", - [ - objc.selector(None, b"observationInfo", b"^v@:", isRequired=False), - objc.selector(None, b"setObservationInfo:", b"v@:^v", isRequired=False), - objc.selector( - None, - b"keyPathsForValuesAffectingValueForKey:", - b"@@:@", - isRequired=False, - ), - objc.selector( - None, - b"automaticallyNotifiesObserversForKey:", - b"Z@:@", - isRequired=False, - ), - ], - ), - "NSDelayedPerforming": objc.informal_protocol( - "NSDelayedPerforming", - [ - objc.selector( - None, - b"performSelector:withObject:afterDelay:", - b"v@::@d", - isRequired=False, - ), - objc.selector( - None, - b"cancelPreviousPerformRequestsWithTarget:", - b"v@:@", - isRequired=False, - ), - objc.selector( - None, - b"cancelPreviousPerformRequestsWithTarget:selector:object:", - b"v@:@:@", - isRequired=False, - ), - objc.selector( - None, - b"performSelector:withObject:afterDelay:inModes:", - b"v@::@d@", - isRequired=False, - ), - ], - ), - "NSKeyedArchiverObjectSubstitution": objc.informal_protocol( - "NSKeyedArchiverObjectSubstitution", - [ - objc.selector( - None, b"replacementObjectForKeyedArchiver:", b"@@:@", isRequired=False - ), - objc.selector(None, b"classForKeyedArchiver", b"#@:", isRequired=False), - objc.selector( - None, b"classFallbacksForKeyedArchiver", b"@@:", isRequired=False - ), - ], - ), -} -expressions = { - "NSAppleEventSendDefaultOptions": "NSAppleEventSendWaitForReply | NSAppleEventSendCanInteract" -} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_nsindexset.py b/write-message/venv/lib/python3.10/site-packages/Foundation/_nsindexset.py deleted file mode 100644 index 0d961c6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Foundation/_nsindexset.py +++ /dev/null @@ -1,21 +0,0 @@ -import objc - - -def __len__(self): - return self.length() - - -def __getitem__(self, idx): - if isinstance(idx, slice): - raise ValueError(idx) - return self.indexAtPosition_(idx) - - -def __add__(self, value): - return self.indexPathByAddingIndex_(value) - - -objc.addConvenienceForClass( - "NSIndexPath", - (("__len__", __len__), ("__getitem__", __getitem__), ("__add__", __add__)), -) diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_nsobject.py b/write-message/venv/lib/python3.10/site-packages/Foundation/_nsobject.py deleted file mode 100644 index 5ed7e60..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Foundation/_nsobject.py +++ /dev/null @@ -1,235 +0,0 @@ -""" -Define a category on NSObject with some useful methods. -""" -import sys - -import objc - -if sys.version_info[0] == 2: - - def _str(v): - return v - - exec( - """\ -def _raise(exc_type, exc_value, exc_trace): - raise exc_type, exc_value, exc_trace -""" - ) -else: - - def _str(v): - if isinstance(v, str): - return v - return v.decode("ascii") - - def _raise(exc_type, exc_value, exc_trace): - raise exc_type(exc_value).with_traceback(exc_trace) - - -NSObject = objc.lookUpClass("NSObject") - - -class NSObject(objc.Category(NSObject)): - @objc.namedSelector(b"_pyobjc_performOnThread:") - def _pyobjc_performOnThread_(self, callinfo): - try: - sel, arg = callinfo - m = getattr(self, _str(sel)) - m(arg) - except: # noqa: E722, B001 - import traceback - - traceback.print_exc(file=sys.stderr) - - @objc.namedSelector(b"_pyobjc_performOnThreadWithResult:") - def _pyobjc_performOnThreadWithResult_(self, callinfo): - try: - sel, arg, result = callinfo - m = getattr(self, _str(sel)) - r = m(arg) - result.append((True, r)) - except: # noqa: E722, B001 - result.append((False, sys.exc_info())) - - if hasattr(NSObject, "performSelector_onThread_withObject_waitUntilDone_"): - - @objc.namedSelector( - b"pyobjc_performSelector:onThread:withObject:waitUntilDone:" - ) - def pyobjc_performSelector_onThread_withObject_waitUntilDone_( - self, aSelector, thread, arg, wait - ): - """ - A version of performSelector:onThread:withObject:waitUntilDone: that - will log exceptions in the called method (instead of aborting the - NSRunLoop on the other thread). - """ - self.performSelector_onThread_withObject_waitUntilDone_( - b"_pyobjc_performOnThread:", thread, (aSelector, arg), wait - ) - - @objc.namedSelector( - b"pyobjc_performSelector:onThread:withObject:waitUntilDone:modes:" - ) - def pyobjc_performSelector_onThread_withObject_waitUntilDone_modes_( - self, aSelector, thread, arg, wait, modes - ): - """ - A version of performSelector:onThread:withObject:waitUntilDone:modes: - that will log exceptions in the called method (instead of aborting the - NSRunLoop on the other thread). - """ - self.performSelector_onThread_withObject_waitUntilDone_modes_( - b"_pyobjc_performOnThread:", thread, (aSelector, arg), wait, modes - ) - - @objc.namedSelector(b"pyobjc_performSelector:withObject:afterDelay:") - def pyobjc_performSelector_withObject_afterDelay_(self, aSelector, arg, delay): - """ - A version of performSelector:withObject:afterDelay: - that will log exceptions in the called method (instead of aborting the - NSRunLoop). - """ - self.performSelector_withObject_afterDelay_( - b"_pyobjc_performOnThread:", (aSelector, arg), delay - ) - - @objc.namedSelector(b"pyobjc_performSelector:withObject:afterDelay:inModes:") - def pyobjc_performSelector_withObject_afterDelay_inModes_( - self, aSelector, arg, delay, modes - ): - """ - A version of performSelector:withObject:afterDelay:inModes: - that will log exceptions in the called method (instead of aborting the - NSRunLoop). - """ - self.performSelector_withObject_afterDelay_inModes_( - b"_pyobjc_performOnThread:", (aSelector, arg), delay, modes - ) - - if hasattr(NSObject, "performSelectorInBackground_withObject_"): - - @objc.namedSelector(b"pyobjc_performSelectorInBackground:withObject:") - def pyobjc_performSelectorInBackground_withObject_(self, aSelector, arg): - """ - A version of performSelectorInBackground:withObject: - that will log exceptions in the called method (instead of aborting the - NSRunLoop). - """ - self.performSelectorInBackground_withObject_( - b"_pyobjc_performOnThread:", (aSelector, arg) - ) - - @objc.namedSelector(b"pyobjc_performSelectorOnMainThread:withObject:waitUntilDone:") - def pyobjc_performSelectorOnMainThread_withObject_waitUntilDone_( - self, aSelector, arg, wait - ): - """ - A version of performSelectorOnMainThread:withObject:waitUntilDone: - that will log exceptions in the called method (instead of aborting the - NSRunLoop in the main thread). - """ - self.performSelectorOnMainThread_withObject_waitUntilDone_( - b"_pyobjc_performOnThread:", (aSelector, arg), wait - ) - - @objc.namedSelector( - b"pyobjc_performSelectorOnMainThread:withObject:waitUntilDone:modes:" - ) - def pyobjc_performSelectorOnMainThread_withObject_waitUntilDone_modes_( - self, aSelector, arg, wait, modes - ): - """ - A version of performSelectorOnMainThread:withObject:waitUntilDone:modes: - that will log exceptions in the called method (instead of aborting the - NSRunLoop in the main thread). - """ - self.performSelectorOnMainThread_withObject_waitUntilDone_modes_( - b"_pyobjc_performOnThread:", (aSelector, arg), wait, modes - ) - - # And some a some versions that return results - - @objc.namedSelector(b"pyobjc_performSelectorOnMainThread:withObject:modes:") - def pyobjc_performSelectorOnMainThread_withObject_modes_( - self, aSelector, arg, modes - ): - """ - Simular to performSelectorOnMainThread:withObject:waitUntilDone:modes:, - but: - - - always waits until done - - returns the return value of the called method - - if the called method raises an exception, this will raise the same - exception - """ - result = [] - self.performSelectorOnMainThread_withObject_waitUntilDone_modes_( - b"_pyobjc_performOnThreadWithResult:", (aSelector, arg, result), True, modes - ) - isOK, result = result[0] - - if isOK: - return result - else: - exc_type, exc_value, exc_trace = result - _raise(exc_type, exc_value, exc_trace) - - @objc.namedSelector(b"pyobjc_performSelectorOnMainThread:withObject:") - def pyobjc_performSelectorOnMainThread_withObject_(self, aSelector, arg): - result = [] - self.performSelectorOnMainThread_withObject_waitUntilDone_( - b"_pyobjc_performOnThreadWithResult:", (aSelector, arg, result), True - ) - isOK, result = result[0] - - if isOK: - return result - else: - exc_type, exc_value, exc_trace = result - _raise(exc_type, exc_value, exc_trace) - - if hasattr(NSObject, "performSelector_onThread_withObject_waitUntilDone_"): - # These methods require Leopard, don't define them if the - # platform functionality isn't present. - - @objc.namedSelector(b"pyobjc_performSelector:onThread:withObject:modes:") - def pyobjc_performSelector_onThread_withObject_modes_( - self, aSelector, thread, arg, modes - ): - result = [] - self.performSelector_onThread_withObject_waitUntilDone_modes_( - b"_pyobjc_performOnThreadWithResult:", - thread, - (aSelector, arg, result), - True, - modes, - ) - isOK, result = result[0] - - if isOK: - return result - else: - exc_type, exc_value, exc_trace = result - _raise(exc_type, exc_value, exc_trace) - - @objc.namedSelector(b"pyobjc_performSelector:onThread:withObject:") - def pyobjc_performSelector_onThread_withObject_(self, aSelector, thread, arg): - result = [] - self.performSelector_onThread_withObject_waitUntilDone_( - b"_pyobjc_performOnThreadWithResult:", - thread, - (aSelector, arg, result), - True, - ) - isOK, result = result[0] - - if isOK: - return result - else: - exc_type, exc_value, exc_trace = result - _raise(exc_type, exc_value, exc_trace) - - -del NSObject diff --git a/write-message/venv/lib/python3.10/site-packages/Foundation/_nsurl.py b/write-message/venv/lib/python3.10/site-packages/Foundation/_nsurl.py deleted file mode 100644 index 1068d43..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Foundation/_nsurl.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -Helpers for NSURL -""" -import sys -import objc - - -def __fspath__(self): - if self.scheme() == "file": - # self.fileSystemRepresentation returns a byte string, - # whereas most user code expects regular strings. Decode - # in the same way as extension functions in the ``os`` module. - return self.fileSystemRepresentation().decode( - sys.getfilesystemencoding(), sys.getfilesystemencodeerrors() - ) - - raise TypeError(f"NSURL with scheme {self.scheme()!r} instead of 'file'") - - -objc.addConvenienceForClass( - "NSURL", - (("__fspath__", __fspath__),), -) diff --git a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/LICENSE.txt b/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/LICENSE.txt deleted file mode 100644 index 9d227a0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/LICENSE.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2010 Pallets - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/METADATA deleted file mode 100644 index 82261f2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/METADATA +++ /dev/null @@ -1,92 +0,0 @@ -Metadata-Version: 2.1 -Name: MarkupSafe -Version: 3.0.2 -Summary: Safely add untrusted strings to HTML/XML markup. -Maintainer-email: Pallets -License: Copyright 2010 Pallets - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Project-URL: Donate, https://palletsprojects.com/donate -Project-URL: Documentation, https://markupsafe.palletsprojects.com/ -Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/ -Project-URL: Source, https://github.com/pallets/markupsafe/ -Project-URL: Chat, https://discord.gg/pallets -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Web Environment -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content -Classifier: Topic :: Text Processing :: Markup :: HTML -Classifier: Typing :: Typed -Requires-Python: >=3.9 -Description-Content-Type: text/markdown -License-File: LICENSE.txt - -# MarkupSafe - -MarkupSafe implements a text object that escapes characters so it is -safe to use in HTML and XML. Characters that have special meanings are -replaced so that they display as the actual characters. This mitigates -injection attacks, meaning untrusted user input can safely be displayed -on a page. - - -## Examples - -```pycon ->>> from markupsafe import Markup, escape - ->>> # escape replaces special characters and wraps in Markup ->>> escape("") -Markup('<script>alert(document.cookie);</script>') - ->>> # wrap in Markup to mark text "safe" and prevent escaping ->>> Markup("Hello") -Markup('hello') - ->>> escape(Markup("Hello")) -Markup('hello') - ->>> # Markup is a str subclass ->>> # methods and operators escape their arguments ->>> template = Markup("Hello {name}") ->>> template.format(name='"World"') -Markup('Hello "World"') -``` - -## Donate - -The Pallets organization develops and supports MarkupSafe and other -popular packages. In order to grow the community of contributors and -users, and allow the maintainers to devote more time to the projects, -[please donate today][]. - -[please donate today]: https://palletsprojects.com/donate diff --git a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/RECORD deleted file mode 100644 index a1e3f56..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/RECORD +++ /dev/null @@ -1,14 +0,0 @@ -MarkupSafe-3.0.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -MarkupSafe-3.0.2.dist-info/LICENSE.txt,sha256=SJqOEQhQntmKN7uYPhHg9-HTHwvY-Zp5yESOf_N9B-o,1475 -MarkupSafe-3.0.2.dist-info/METADATA,sha256=aAwbZhSmXdfFuMM-rEHpeiHRkBOGESyVLJIuwzHP-nw,3975 -MarkupSafe-3.0.2.dist-info/RECORD,, -MarkupSafe-3.0.2.dist-info/WHEEL,sha256=lXrF9eVJm7UF3ZOBaBu2Y-RekBGubHbC1Bvbd4BEjAQ,109 -MarkupSafe-3.0.2.dist-info/top_level.txt,sha256=qy0Plje5IJuvsCBjejJyhDCjEAdcDLK_2agVcex8Z6U,11 -markupsafe/__init__.py,sha256=sr-U6_27DfaSrj5jnHYxWN-pvhM27sjlDplMDPZKm7k,13214 -markupsafe/__pycache__/__init__.cpython-310.pyc,, -markupsafe/__pycache__/_native.cpython-310.pyc,, -markupsafe/_native.py,sha256=hSLs8Jmz5aqayuengJJ3kdT5PwNpBWpKrmQSdipndC8,210 -markupsafe/_speedups.c,sha256=O7XulmTo-epI6n2FtMVOrJXl8EAaIwD2iNYmBI5SEoQ,4149 -markupsafe/_speedups.cpython-310-darwin.so,sha256=3f9Fj2FHr4Ue7g2ODjkMpKlhPZCbjE0h7ZPvY4L8aUs,50688 -markupsafe/_speedups.pyi,sha256=ENd1bYe7gbBUf2ywyYWOGUpnXOHNJ-cgTNqetlW8h5k,41 -markupsafe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL deleted file mode 100644 index 15be5eb..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (75.2.0) -Root-Is-Purelib: false -Tag: cp310-cp310-macosx_11_0_arm64 - diff --git a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/top_level.txt deleted file mode 100644 index 75bf729..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MarkupSafe-3.0.2.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -markupsafe diff --git a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/PKG-INFO b/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/PKG-INFO deleted file mode 100644 index 32beb98..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/PKG-INFO +++ /dev/null @@ -1,63 +0,0 @@ -Metadata-Version: 2.1 -Name: MouseInfo -Version: 0.1.3 -Summary: An application to display XY position and RGB color information for the pixel currently under the mouse. Works on Python 2 and 3. -Home-page: https://github.com/asweigart/mouseinfo -Author: Al Sweigart -Author-email: al@inventwithpython.com -License: GPLv3+ -Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) -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.2 -Classifier: Programming Language :: Python :: 3.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 -Description-Content-Type: text/markdown - -MouseInfo -====== - -An application to display XY position and RGB color information for the pixel currently under the mouse. Works on Python 2 and 3. This is useful for GUI automation planning. - -The full documentation is at https://mouseinfo.readthedocs.io/en/latest/ - -Installation ------------- - -To install with pip, run: - - pip install mouseinfo - -Quickstart Guide ----------------- - -To run this application, enter the following into the terminal: - - python3 -m mouseinfo - -Or for Python 2, run: - - python -m mouseinfo - -Alternatively, to run it from the interactive shell or a Python program: - - >>> import mouseinfo - >>> mouseinfo.mouseInfo() - -The Mouse Info application displays the current XY coordinates of the mouse cursor, as well as the RGB color information of the pixel directly under the cursor. This can be useful for planning out GUI automation tests where the mouse is controlled by a script (such as a Python script with PyAutoGUI) to click on the screen at specific coordinates. - -The "Copy" buttons will copy this mouse information to the clipboard, while the "Log" buttons will add this mouse information to the text field in the application. The RGB color information is given as a comman-delimited, three-integer red, green, and blue values as decimals from 0 to 255. The hex values of the RGB value is also given. - -For practical use, you should set the keyboard focus on these buttons by tabbing over them. This leaves you free to move the mouse into position and then press space or Enter to log the current mouse coordinates/RGB value. - -The contents of the log text field can be saved by clicking "Save Log". This will automatically overwrite any file with the provided name. A screenshot can also be saved by clicking "Save Screenshot" - -Contribute ----------- - -If you'd like to contribute to MouseInfo, check out https://github.com/asweigart/mouseinfo diff --git a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/SOURCES.txt b/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/SOURCES.txt deleted file mode 100644 index c9cb87e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/SOURCES.txt +++ /dev/null @@ -1,11 +0,0 @@ -MANIFEST.in -README.md -setup.cfg -setup.py -src/MouseInfo.egg-info/PKG-INFO -src/MouseInfo.egg-info/SOURCES.txt -src/MouseInfo.egg-info/dependency_links.txt -src/MouseInfo.egg-info/requires.txt -src/MouseInfo.egg-info/top_level.txt -src/mouseinfo/__init__.py -src/mouseinfo/__main__.py \ No newline at end of file diff --git a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/dependency_links.txt b/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/installed-files.txt b/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/installed-files.txt deleted file mode 100644 index 36abbd6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/installed-files.txt +++ /dev/null @@ -1,9 +0,0 @@ -../mouseinfo/__init__.py -../mouseinfo/__main__.py -../mouseinfo/__pycache__/__init__.cpython-310.pyc -../mouseinfo/__pycache__/__main__.cpython-310.pyc -PKG-INFO -SOURCES.txt -dependency_links.txt -requires.txt -top_level.txt diff --git a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/requires.txt b/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/requires.txt deleted file mode 100644 index 592efed..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/requires.txt +++ /dev/null @@ -1,31 +0,0 @@ -pyperclip - -[:platform_system == "Darwin"] -rubicon-objc - -[:platform_system == "Linux" and python_version < "3.0"] -Xlib - -[:platform_system == "Linux" and python_version >= "3.0"] -python3-Xlib - -[:python_version == "2.7"] -Pillow>=2.0.0 - -[:python_version == "3.2"] -Pillow<=3.4.2,>=2.0.0 - -[:python_version == "3.3"] -Pillow<=4.3.0,>=2.0.0 - -[:python_version == "3.4"] -Pillow<=5.4.1,>=2.5.0 - -[:python_version == "3.5"] -Pillow>=3.2.0 - -[:python_version == "3.6"] -Pillow>=4.0.0 - -[:python_version == "3.7"] -Pillow>=5.2.0 diff --git a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/top_level.txt deleted file mode 100644 index a04104b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/MouseInfo-0.1.3-py3.10.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -mouseinfo diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libXau.6.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libXau.6.dylib deleted file mode 100755 index e9e85c9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libXau.6.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libavif.16.3.0.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libavif.16.3.0.dylib deleted file mode 100755 index b099f29..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libavif.16.3.0.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libbrotlicommon.1.1.0.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libbrotlicommon.1.1.0.dylib deleted file mode 100755 index 3244552..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libbrotlicommon.1.1.0.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libbrotlidec.1.1.0.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libbrotlidec.1.1.0.dylib deleted file mode 100755 index 6ad3668..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libbrotlidec.1.1.0.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libfreetype.6.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libfreetype.6.dylib deleted file mode 100755 index 5024882..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libfreetype.6.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libharfbuzz.0.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libharfbuzz.0.dylib deleted file mode 100755 index cd259a8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libharfbuzz.0.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libjpeg.62.4.0.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libjpeg.62.4.0.dylib deleted file mode 100755 index 45b08c1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libjpeg.62.4.0.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/liblcms2.2.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/liblcms2.2.dylib deleted file mode 100755 index 7e964e6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/liblcms2.2.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/liblzma.5.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/liblzma.5.dylib deleted file mode 100755 index 51ece2c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/liblzma.5.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libopenjp2.2.5.3.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libopenjp2.2.5.3.dylib deleted file mode 100755 index d2e758c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libopenjp2.2.5.3.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libpng16.16.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libpng16.16.dylib deleted file mode 100755 index cee8e37..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libpng16.16.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libsharpyuv.0.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libsharpyuv.0.dylib deleted file mode 100755 index 1cd1482..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libsharpyuv.0.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libtiff.6.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libtiff.6.dylib deleted file mode 100755 index 36f2107..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libtiff.6.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebp.7.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebp.7.dylib deleted file mode 100755 index 492ce9d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebp.7.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebpdemux.2.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebpdemux.2.dylib deleted file mode 100755 index 0fc5bfd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebpdemux.2.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebpmux.3.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebpmux.3.dylib deleted file mode 100755 index 2dda2d9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libwebpmux.3.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib deleted file mode 100755 index e8eb687..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libz.1.3.1.zlib-ng.dylib b/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libz.1.3.1.zlib-ng.dylib deleted file mode 100755 index e9bb943..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/.dylibs/libz.1.3.1.zlib-ng.dylib and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/AvifImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/AvifImagePlugin.py deleted file mode 100644 index 366e0c8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/AvifImagePlugin.py +++ /dev/null @@ -1,291 +0,0 @@ -from __future__ import annotations - -import os -from io import BytesIO -from typing import IO - -from . import ExifTags, Image, ImageFile - -try: - from . import _avif - - SUPPORTED = True -except ImportError: - SUPPORTED = False - -# Decoder options as module globals, until there is a way to pass parameters -# to Image.open (see https://github.com/python-pillow/Pillow/issues/569) -DECODE_CODEC_CHOICE = "auto" -DEFAULT_MAX_THREADS = 0 - - -def get_codec_version(codec_name: str) -> str | None: - versions = _avif.codec_versions() - for version in versions.split(", "): - if version.split(" [")[0] == codec_name: - return version.split(":")[-1].split(" ")[0] - return None - - -def _accept(prefix: bytes) -> bool | str: - if prefix[4:8] != b"ftyp": - return False - major_brand = prefix[8:12] - if major_brand in ( - # coding brands - b"avif", - b"avis", - # We accept files with AVIF container brands; we can't yet know if - # the ftyp box has the correct compatible brands, but if it doesn't - # then the plugin will raise a SyntaxError which Pillow will catch - # before moving on to the next plugin that accepts the file. - # - # Also, because this file might not actually be an AVIF file, we - # don't raise an error if AVIF support isn't properly compiled. - b"mif1", - b"msf1", - ): - if not SUPPORTED: - return ( - "image file could not be identified because AVIF support not installed" - ) - return True - return False - - -def _get_default_max_threads() -> int: - if DEFAULT_MAX_THREADS: - return DEFAULT_MAX_THREADS - if hasattr(os, "sched_getaffinity"): - return len(os.sched_getaffinity(0)) - else: - return os.cpu_count() or 1 - - -class AvifImageFile(ImageFile.ImageFile): - format = "AVIF" - format_description = "AVIF image" - __frame = -1 - - def _open(self) -> None: - if not SUPPORTED: - msg = "image file could not be opened because AVIF support not installed" - raise SyntaxError(msg) - - if DECODE_CODEC_CHOICE != "auto" and not _avif.decoder_codec_available( - DECODE_CODEC_CHOICE - ): - msg = "Invalid opening codec" - raise ValueError(msg) - self._decoder = _avif.AvifDecoder( - self.fp.read(), - DECODE_CODEC_CHOICE, - _get_default_max_threads(), - ) - - # Get info from decoder - self._size, self.n_frames, self._mode, icc, exif, exif_orientation, xmp = ( - self._decoder.get_info() - ) - self.is_animated = self.n_frames > 1 - - if icc: - self.info["icc_profile"] = icc - if xmp: - self.info["xmp"] = xmp - - if exif_orientation != 1 or exif: - exif_data = Image.Exif() - if exif: - exif_data.load(exif) - original_orientation = exif_data.get(ExifTags.Base.Orientation, 1) - else: - original_orientation = 1 - if exif_orientation != original_orientation: - exif_data[ExifTags.Base.Orientation] = exif_orientation - exif = exif_data.tobytes() - if exif: - self.info["exif"] = exif - self.seek(0) - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - - # Set tile - self.__frame = frame - self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.mode)] - - def load(self) -> Image.core.PixelAccess | None: - if self.tile: - # We need to load the image data for this frame - data, timescale, pts_in_timescales, duration_in_timescales = ( - self._decoder.get_frame(self.__frame) - ) - self.info["timestamp"] = round(1000 * (pts_in_timescales / timescale)) - self.info["duration"] = round(1000 * (duration_in_timescales / timescale)) - - if self.fp and self._exclusive_fp: - self.fp.close() - self.fp = BytesIO(data) - - return super().load() - - def load_seek(self, pos: int) -> None: - pass - - def tell(self) -> int: - return self.__frame - - -def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - _save(im, fp, filename, save_all=True) - - -def _save( - im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False -) -> None: - info = im.encoderinfo.copy() - if save_all: - append_images = list(info.get("append_images", [])) - else: - append_images = [] - - total = 0 - for ims in [im] + append_images: - total += getattr(ims, "n_frames", 1) - - quality = info.get("quality", 75) - if not isinstance(quality, int) or quality < 0 or quality > 100: - msg = "Invalid quality setting" - raise ValueError(msg) - - duration = info.get("duration", 0) - subsampling = info.get("subsampling", "4:2:0") - speed = info.get("speed", 6) - max_threads = info.get("max_threads", _get_default_max_threads()) - codec = info.get("codec", "auto") - if codec != "auto" and not _avif.encoder_codec_available(codec): - msg = "Invalid saving codec" - raise ValueError(msg) - range_ = info.get("range", "full") - tile_rows_log2 = info.get("tile_rows", 0) - tile_cols_log2 = info.get("tile_cols", 0) - alpha_premultiplied = bool(info.get("alpha_premultiplied", False)) - autotiling = bool(info.get("autotiling", tile_rows_log2 == tile_cols_log2 == 0)) - - icc_profile = info.get("icc_profile", im.info.get("icc_profile")) - exif_orientation = 1 - if exif := info.get("exif"): - if isinstance(exif, Image.Exif): - exif_data = exif - else: - exif_data = Image.Exif() - exif_data.load(exif) - if ExifTags.Base.Orientation in exif_data: - exif_orientation = exif_data.pop(ExifTags.Base.Orientation) - exif = exif_data.tobytes() if exif_data else b"" - elif isinstance(exif, Image.Exif): - exif = exif_data.tobytes() - - xmp = info.get("xmp") - - if isinstance(xmp, str): - xmp = xmp.encode("utf-8") - - advanced = info.get("advanced") - if advanced is not None: - if isinstance(advanced, dict): - advanced = advanced.items() - try: - advanced = tuple(advanced) - except TypeError: - invalid = True - else: - invalid = any(not isinstance(v, tuple) or len(v) != 2 for v in advanced) - if invalid: - msg = ( - "advanced codec options must be a dict of key-value string " - "pairs or a series of key-value two-tuples" - ) - raise ValueError(msg) - - # Setup the AVIF encoder - enc = _avif.AvifEncoder( - im.size, - subsampling, - quality, - speed, - max_threads, - codec, - range_, - tile_rows_log2, - tile_cols_log2, - alpha_premultiplied, - autotiling, - icc_profile or b"", - exif or b"", - exif_orientation, - xmp or b"", - advanced, - ) - - # Add each frame - frame_idx = 0 - frame_duration = 0 - cur_idx = im.tell() - is_single_frame = total == 1 - try: - for ims in [im] + append_images: - # Get number of frames in this image - nfr = getattr(ims, "n_frames", 1) - - for idx in range(nfr): - ims.seek(idx) - - # Make sure image mode is supported - frame = ims - rawmode = ims.mode - if ims.mode not in {"RGB", "RGBA"}: - rawmode = "RGBA" if ims.has_transparency_data else "RGB" - frame = ims.convert(rawmode) - - # Update frame duration - if isinstance(duration, (list, tuple)): - frame_duration = duration[frame_idx] - else: - frame_duration = duration - - # Append the frame to the animation encoder - enc.add( - frame.tobytes("raw", rawmode), - frame_duration, - frame.size, - rawmode, - is_single_frame, - ) - - # Update frame index - frame_idx += 1 - - if not save_all: - break - - finally: - im.seek(cur_idx) - - # Get the final output from the encoder - data = enc.finish() - if data is None: - msg = "cannot write file as AVIF (encoder returned None)" - raise OSError(msg) - - fp.write(data) - - -Image.register_open(AvifImageFile.format, AvifImageFile, _accept) -if SUPPORTED: - Image.register_save(AvifImageFile.format, _save) - Image.register_save_all(AvifImageFile.format, _save_all) - Image.register_extensions(AvifImageFile.format, [".avif", ".avifs"]) - Image.register_mime(AvifImageFile.format, "image/avif") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/BdfFontFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/BdfFontFile.py deleted file mode 100644 index f175e2f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/BdfFontFile.py +++ /dev/null @@ -1,122 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# bitmap distribution font (bdf) file parser -# -# history: -# 1996-05-16 fl created (as bdf2pil) -# 1997-08-25 fl converted to FontFile driver -# 2001-05-25 fl removed bogus __init__ call -# 2002-11-20 fl robustification (from Kevin Cazabon, Dmitry Vasiliev) -# 2003-04-22 fl more robustification (from Graham Dumpleton) -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1997-2003 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# - -""" -Parse X Bitmap Distribution Format (BDF) -""" -from __future__ import annotations - -from typing import BinaryIO - -from . import FontFile, Image - - -def bdf_char( - f: BinaryIO, -) -> ( - tuple[ - str, - int, - tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]], - Image.Image, - ] - | None -): - # skip to STARTCHAR - while True: - s = f.readline() - if not s: - return None - if s.startswith(b"STARTCHAR"): - break - id = s[9:].strip().decode("ascii") - - # load symbol properties - props = {} - while True: - s = f.readline() - if not s or s.startswith(b"BITMAP"): - break - i = s.find(b" ") - props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii") - - # load bitmap - bitmap = bytearray() - while True: - s = f.readline() - if not s or s.startswith(b"ENDCHAR"): - break - bitmap += s[:-1] - - # The word BBX - # followed by the width in x (BBw), height in y (BBh), - # and x and y displacement (BBxoff0, BByoff0) - # of the lower left corner from the origin of the character. - width, height, x_disp, y_disp = (int(p) for p in props["BBX"].split()) - - # The word DWIDTH - # followed by the width in x and y of the character in device pixels. - dwx, dwy = (int(p) for p in props["DWIDTH"].split()) - - bbox = ( - (dwx, dwy), - (x_disp, -y_disp - height, width + x_disp, -y_disp), - (0, 0, width, height), - ) - - try: - im = Image.frombytes("1", (width, height), bitmap, "hex", "1") - except ValueError: - # deal with zero-width characters - im = Image.new("1", (width, height)) - - return id, int(props["ENCODING"]), bbox, im - - -class BdfFontFile(FontFile.FontFile): - """Font file plugin for the X11 BDF format.""" - - def __init__(self, fp: BinaryIO) -> None: - super().__init__() - - s = fp.readline() - if not s.startswith(b"STARTFONT 2.1"): - msg = "not a valid BDF file" - raise SyntaxError(msg) - - props = {} - comments = [] - - while True: - s = fp.readline() - if not s or s.startswith(b"ENDPROPERTIES"): - break - i = s.find(b" ") - props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii") - if s[:i] in [b"COMMENT", b"COPYRIGHT"]: - if s.find(b"LogicalFontDescription") < 0: - comments.append(s[i + 1 : -1].decode("ascii")) - - while True: - c = bdf_char(fp) - if not c: - break - id, ch, (xy, dst, src), im = c - if 0 <= ch < len(self.glyph): - self.glyph[ch] = xy, dst, src, im diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/BlpImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/BlpImagePlugin.py deleted file mode 100644 index f7be774..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/BlpImagePlugin.py +++ /dev/null @@ -1,497 +0,0 @@ -""" -Blizzard Mipmap Format (.blp) -Jerome Leclanche - -The contents of this file are hereby released in the public domain (CC0) -Full text of the CC0 license: - https://creativecommons.org/publicdomain/zero/1.0/ - -BLP1 files, used mostly in Warcraft III, are not fully supported. -All types of BLP2 files used in World of Warcraft are supported. - -The BLP file structure consists of a header, up to 16 mipmaps of the -texture - -Texture sizes must be powers of two, though the two dimensions do -not have to be equal; 512x256 is valid, but 512x200 is not. -The first mipmap (mipmap #0) is the full size image; each subsequent -mipmap halves both dimensions. The final mipmap should be 1x1. - -BLP files come in many different flavours: -* JPEG-compressed (type == 0) - only supported for BLP1. -* RAW images (type == 1, encoding == 1). Each mipmap is stored as an - array of 8-bit values, one per pixel, left to right, top to bottom. - Each value is an index to the palette. -* DXT-compressed (type == 1, encoding == 2): -- DXT1 compression is used if alpha_encoding == 0. - - An additional alpha bit is used if alpha_depth == 1. - - DXT3 compression is used if alpha_encoding == 1. - - DXT5 compression is used if alpha_encoding == 7. -""" - -from __future__ import annotations - -import abc -import os -import struct -from enum import IntEnum -from io import BytesIO -from typing import IO - -from . import Image, ImageFile - - -class Format(IntEnum): - JPEG = 0 - - -class Encoding(IntEnum): - UNCOMPRESSED = 1 - DXT = 2 - UNCOMPRESSED_RAW_BGRA = 3 - - -class AlphaEncoding(IntEnum): - DXT1 = 0 - DXT3 = 1 - DXT5 = 7 - - -def unpack_565(i: int) -> tuple[int, int, int]: - return ((i >> 11) & 0x1F) << 3, ((i >> 5) & 0x3F) << 2, (i & 0x1F) << 3 - - -def decode_dxt1( - data: bytes, alpha: bool = False -) -> tuple[bytearray, bytearray, bytearray, bytearray]: - """ - input: one "row" of data (i.e. will produce 4*width pixels) - """ - - blocks = len(data) // 8 # number of blocks in row - ret = (bytearray(), bytearray(), bytearray(), bytearray()) - - for block_index in range(blocks): - # Decode next 8-byte block. - idx = block_index * 8 - color0, color1, bits = struct.unpack_from("> 2 - - a = 0xFF - if control == 0: - r, g, b = r0, g0, b0 - elif control == 1: - r, g, b = r1, g1, b1 - elif control == 2: - if color0 > color1: - r = (2 * r0 + r1) // 3 - g = (2 * g0 + g1) // 3 - b = (2 * b0 + b1) // 3 - else: - r = (r0 + r1) // 2 - g = (g0 + g1) // 2 - b = (b0 + b1) // 2 - elif control == 3: - if color0 > color1: - r = (2 * r1 + r0) // 3 - g = (2 * g1 + g0) // 3 - b = (2 * b1 + b0) // 3 - else: - r, g, b, a = 0, 0, 0, 0 - - if alpha: - ret[j].extend([r, g, b, a]) - else: - ret[j].extend([r, g, b]) - - return ret - - -def decode_dxt3(data: bytes) -> tuple[bytearray, bytearray, bytearray, bytearray]: - """ - input: one "row" of data (i.e. will produce 4*width pixels) - """ - - blocks = len(data) // 16 # number of blocks in row - ret = (bytearray(), bytearray(), bytearray(), bytearray()) - - for block_index in range(blocks): - idx = block_index * 16 - block = data[idx : idx + 16] - # Decode next 16-byte block. - bits = struct.unpack_from("<8B", block) - color0, color1 = struct.unpack_from(">= 4 - else: - high = True - a &= 0xF - a *= 17 # We get a value between 0 and 15 - - color_code = (code >> 2 * (4 * j + i)) & 0x03 - - if color_code == 0: - r, g, b = r0, g0, b0 - elif color_code == 1: - r, g, b = r1, g1, b1 - elif color_code == 2: - r = (2 * r0 + r1) // 3 - g = (2 * g0 + g1) // 3 - b = (2 * b0 + b1) // 3 - elif color_code == 3: - r = (2 * r1 + r0) // 3 - g = (2 * g1 + g0) // 3 - b = (2 * b1 + b0) // 3 - - ret[j].extend([r, g, b, a]) - - return ret - - -def decode_dxt5(data: bytes) -> tuple[bytearray, bytearray, bytearray, bytearray]: - """ - input: one "row" of data (i.e. will produce 4 * width pixels) - """ - - blocks = len(data) // 16 # number of blocks in row - ret = (bytearray(), bytearray(), bytearray(), bytearray()) - - for block_index in range(blocks): - idx = block_index * 16 - block = data[idx : idx + 16] - # Decode next 16-byte block. - a0, a1 = struct.unpack_from("> alphacode_index) & 0x07 - elif alphacode_index == 15: - alphacode = (alphacode2 >> 15) | ((alphacode1 << 1) & 0x06) - else: # alphacode_index >= 18 and alphacode_index <= 45 - alphacode = (alphacode1 >> (alphacode_index - 16)) & 0x07 - - if alphacode == 0: - a = a0 - elif alphacode == 1: - a = a1 - elif a0 > a1: - a = ((8 - alphacode) * a0 + (alphacode - 1) * a1) // 7 - elif alphacode == 6: - a = 0 - elif alphacode == 7: - a = 255 - else: - a = ((6 - alphacode) * a0 + (alphacode - 1) * a1) // 5 - - color_code = (code >> 2 * (4 * j + i)) & 0x03 - - if color_code == 0: - r, g, b = r0, g0, b0 - elif color_code == 1: - r, g, b = r1, g1, b1 - elif color_code == 2: - r = (2 * r0 + r1) // 3 - g = (2 * g0 + g1) // 3 - b = (2 * b0 + b1) // 3 - elif color_code == 3: - r = (2 * r1 + r0) // 3 - g = (2 * g1 + g0) // 3 - b = (2 * b1 + b0) // 3 - - ret[j].extend([r, g, b, a]) - - return ret - - -class BLPFormatError(NotImplementedError): - pass - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith((b"BLP1", b"BLP2")) - - -class BlpImageFile(ImageFile.ImageFile): - """ - Blizzard Mipmap Format - """ - - format = "BLP" - format_description = "Blizzard Mipmap Format" - - def _open(self) -> None: - self.magic = self.fp.read(4) - if not _accept(self.magic): - msg = f"Bad BLP magic {repr(self.magic)}" - raise BLPFormatError(msg) - - compression = struct.unpack(" tuple[int, int]: - try: - self._read_header() - self._load() - except struct.error as e: - msg = "Truncated BLP file" - raise OSError(msg) from e - return -1, 0 - - @abc.abstractmethod - def _load(self) -> None: - pass - - def _read_header(self) -> None: - self._offsets = struct.unpack("<16I", self._safe_read(16 * 4)) - self._lengths = struct.unpack("<16I", self._safe_read(16 * 4)) - - def _safe_read(self, length: int) -> bytes: - assert self.fd is not None - return ImageFile._safe_read(self.fd, length) - - def _read_palette(self) -> list[tuple[int, int, int, int]]: - ret = [] - for i in range(256): - try: - b, g, r, a = struct.unpack("<4B", self._safe_read(4)) - except struct.error: - break - ret.append((b, g, r, a)) - return ret - - def _read_bgra( - self, palette: list[tuple[int, int, int, int]], alpha: bool - ) -> bytearray: - data = bytearray() - _data = BytesIO(self._safe_read(self._lengths[0])) - while True: - try: - (offset,) = struct.unpack(" None: - self._compression, self._encoding, alpha = self.args - - if self._compression == Format.JPEG: - self._decode_jpeg_stream() - - elif self._compression == 1: - if self._encoding in (4, 5): - palette = self._read_palette() - data = self._read_bgra(palette, alpha) - self.set_as_raw(data) - else: - msg = f"Unsupported BLP encoding {repr(self._encoding)}" - raise BLPFormatError(msg) - else: - msg = f"Unsupported BLP compression {repr(self._encoding)}" - raise BLPFormatError(msg) - - def _decode_jpeg_stream(self) -> None: - from .JpegImagePlugin import JpegImageFile - - (jpeg_header_size,) = struct.unpack(" None: - self._compression, self._encoding, alpha, self._alpha_encoding = self.args - - palette = self._read_palette() - - assert self.fd is not None - self.fd.seek(self._offsets[0]) - - if self._compression == 1: - # Uncompressed or DirectX compression - - if self._encoding == Encoding.UNCOMPRESSED: - data = self._read_bgra(palette, alpha) - - elif self._encoding == Encoding.DXT: - data = bytearray() - if self._alpha_encoding == AlphaEncoding.DXT1: - linesize = (self.state.xsize + 3) // 4 * 8 - for yb in range((self.state.ysize + 3) // 4): - for d in decode_dxt1(self._safe_read(linesize), alpha): - data += d - - elif self._alpha_encoding == AlphaEncoding.DXT3: - linesize = (self.state.xsize + 3) // 4 * 16 - for yb in range((self.state.ysize + 3) // 4): - for d in decode_dxt3(self._safe_read(linesize)): - data += d - - elif self._alpha_encoding == AlphaEncoding.DXT5: - linesize = (self.state.xsize + 3) // 4 * 16 - for yb in range((self.state.ysize + 3) // 4): - for d in decode_dxt5(self._safe_read(linesize)): - data += d - else: - msg = f"Unsupported alpha encoding {repr(self._alpha_encoding)}" - raise BLPFormatError(msg) - else: - msg = f"Unknown BLP encoding {repr(self._encoding)}" - raise BLPFormatError(msg) - - else: - msg = f"Unknown BLP compression {repr(self._compression)}" - raise BLPFormatError(msg) - - self.set_as_raw(data) - - -class BLPEncoder(ImageFile.PyEncoder): - _pushes_fd = True - - def _write_palette(self) -> bytes: - data = b"" - assert self.im is not None - palette = self.im.getpalette("RGBA", "RGBA") - for i in range(len(palette) // 4): - r, g, b, a = palette[i * 4 : (i + 1) * 4] - data += struct.pack("<4B", b, g, r, a) - while len(data) < 256 * 4: - data += b"\x00" * 4 - return data - - def encode(self, bufsize: int) -> tuple[int, int, bytes]: - palette_data = self._write_palette() - - offset = 20 + 16 * 4 * 2 + len(palette_data) - data = struct.pack("<16I", offset, *((0,) * 15)) - - assert self.im is not None - w, h = self.im.size - data += struct.pack("<16I", w * h, *((0,) * 15)) - - data += palette_data - - for y in range(h): - for x in range(w): - data += struct.pack(" None: - if im.mode != "P": - msg = "Unsupported BLP image mode" - raise ValueError(msg) - - magic = b"BLP1" if im.encoderinfo.get("blp_version") == "BLP1" else b"BLP2" - fp.write(magic) - - assert im.palette is not None - fp.write(struct.pack(" mode, rawmode - 1: ("P", "P;1"), - 4: ("P", "P;4"), - 8: ("P", "P"), - 16: ("RGB", "BGR;15"), - 24: ("RGB", "BGR"), - 32: ("RGB", "BGRX"), -} - -USE_RAW_ALPHA = False - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"BM") - - -def _dib_accept(prefix: bytes) -> bool: - return i32(prefix) in [12, 40, 52, 56, 64, 108, 124] - - -# ============================================================================= -# Image plugin for the Windows BMP format. -# ============================================================================= -class BmpImageFile(ImageFile.ImageFile): - """Image plugin for the Windows Bitmap format (BMP)""" - - # ------------------------------------------------------------- Description - format_description = "Windows Bitmap" - format = "BMP" - - # -------------------------------------------------- BMP Compression values - COMPRESSIONS = {"RAW": 0, "RLE8": 1, "RLE4": 2, "BITFIELDS": 3, "JPEG": 4, "PNG": 5} - for k, v in COMPRESSIONS.items(): - vars()[k] = v - - def _bitmap(self, header: int = 0, offset: int = 0) -> None: - """Read relevant info about the BMP""" - read, seek = self.fp.read, self.fp.seek - if header: - seek(header) - # read bmp header size @offset 14 (this is part of the header size) - file_info: dict[str, bool | int | tuple[int, ...]] = { - "header_size": i32(read(4)), - "direction": -1, - } - - # -------------------- If requested, read header at a specific position - # read the rest of the bmp header, without its size - assert isinstance(file_info["header_size"], int) - header_data = ImageFile._safe_read(self.fp, file_info["header_size"] - 4) - - # ------------------------------- Windows Bitmap v2, IBM OS/2 Bitmap v1 - # ----- This format has different offsets because of width/height types - # 12: BITMAPCOREHEADER/OS21XBITMAPHEADER - if file_info["header_size"] == 12: - file_info["width"] = i16(header_data, 0) - file_info["height"] = i16(header_data, 2) - file_info["planes"] = i16(header_data, 4) - file_info["bits"] = i16(header_data, 6) - file_info["compression"] = self.COMPRESSIONS["RAW"] - file_info["palette_padding"] = 3 - - # --------------------------------------------- Windows Bitmap v3 to v5 - # 40: BITMAPINFOHEADER - # 52: BITMAPV2HEADER - # 56: BITMAPV3HEADER - # 64: BITMAPCOREHEADER2/OS22XBITMAPHEADER - # 108: BITMAPV4HEADER - # 124: BITMAPV5HEADER - elif file_info["header_size"] in (40, 52, 56, 64, 108, 124): - file_info["y_flip"] = header_data[7] == 0xFF - file_info["direction"] = 1 if file_info["y_flip"] else -1 - file_info["width"] = i32(header_data, 0) - file_info["height"] = ( - i32(header_data, 4) - if not file_info["y_flip"] - else 2**32 - i32(header_data, 4) - ) - file_info["planes"] = i16(header_data, 8) - file_info["bits"] = i16(header_data, 10) - file_info["compression"] = i32(header_data, 12) - # byte size of pixel data - file_info["data_size"] = i32(header_data, 16) - file_info["pixels_per_meter"] = ( - i32(header_data, 20), - i32(header_data, 24), - ) - file_info["colors"] = i32(header_data, 28) - file_info["palette_padding"] = 4 - assert isinstance(file_info["pixels_per_meter"], tuple) - self.info["dpi"] = tuple(x / 39.3701 for x in file_info["pixels_per_meter"]) - if file_info["compression"] == self.COMPRESSIONS["BITFIELDS"]: - masks = ["r_mask", "g_mask", "b_mask"] - if len(header_data) >= 48: - if len(header_data) >= 52: - masks.append("a_mask") - else: - file_info["a_mask"] = 0x0 - for idx, mask in enumerate(masks): - file_info[mask] = i32(header_data, 36 + idx * 4) - else: - # 40 byte headers only have the three components in the - # bitfields masks, ref: - # https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx - # See also - # https://github.com/python-pillow/Pillow/issues/1293 - # There is a 4th component in the RGBQuad, in the alpha - # location, but it is listed as a reserved component, - # and it is not generally an alpha channel - file_info["a_mask"] = 0x0 - for mask in masks: - file_info[mask] = i32(read(4)) - assert isinstance(file_info["r_mask"], int) - assert isinstance(file_info["g_mask"], int) - assert isinstance(file_info["b_mask"], int) - assert isinstance(file_info["a_mask"], int) - file_info["rgb_mask"] = ( - file_info["r_mask"], - file_info["g_mask"], - file_info["b_mask"], - ) - file_info["rgba_mask"] = ( - file_info["r_mask"], - file_info["g_mask"], - file_info["b_mask"], - file_info["a_mask"], - ) - else: - msg = f"Unsupported BMP header type ({file_info['header_size']})" - raise OSError(msg) - - # ------------------ Special case : header is reported 40, which - # ---------------------- is shorter than real size for bpp >= 16 - assert isinstance(file_info["width"], int) - assert isinstance(file_info["height"], int) - self._size = file_info["width"], file_info["height"] - - # ------- If color count was not found in the header, compute from bits - assert isinstance(file_info["bits"], int) - file_info["colors"] = ( - file_info["colors"] - if file_info.get("colors", 0) - else (1 << file_info["bits"]) - ) - assert isinstance(file_info["colors"], int) - if offset == 14 + file_info["header_size"] and file_info["bits"] <= 8: - offset += 4 * file_info["colors"] - - # ---------------------- Check bit depth for unusual unsupported values - self._mode, raw_mode = BIT2MODE.get(file_info["bits"], ("", "")) - if not self.mode: - msg = f"Unsupported BMP pixel depth ({file_info['bits']})" - raise OSError(msg) - - # ---------------- Process BMP with Bitfields compression (not palette) - decoder_name = "raw" - if file_info["compression"] == self.COMPRESSIONS["BITFIELDS"]: - SUPPORTED: dict[int, list[tuple[int, ...]]] = { - 32: [ - (0xFF0000, 0xFF00, 0xFF, 0x0), - (0xFF000000, 0xFF0000, 0xFF00, 0x0), - (0xFF000000, 0xFF00, 0xFF, 0x0), - (0xFF000000, 0xFF0000, 0xFF00, 0xFF), - (0xFF, 0xFF00, 0xFF0000, 0xFF000000), - (0xFF0000, 0xFF00, 0xFF, 0xFF000000), - (0xFF000000, 0xFF00, 0xFF, 0xFF0000), - (0x0, 0x0, 0x0, 0x0), - ], - 24: [(0xFF0000, 0xFF00, 0xFF)], - 16: [(0xF800, 0x7E0, 0x1F), (0x7C00, 0x3E0, 0x1F)], - } - MASK_MODES = { - (32, (0xFF0000, 0xFF00, 0xFF, 0x0)): "BGRX", - (32, (0xFF000000, 0xFF0000, 0xFF00, 0x0)): "XBGR", - (32, (0xFF000000, 0xFF00, 0xFF, 0x0)): "BGXR", - (32, (0xFF000000, 0xFF0000, 0xFF00, 0xFF)): "ABGR", - (32, (0xFF, 0xFF00, 0xFF0000, 0xFF000000)): "RGBA", - (32, (0xFF0000, 0xFF00, 0xFF, 0xFF000000)): "BGRA", - (32, (0xFF000000, 0xFF00, 0xFF, 0xFF0000)): "BGAR", - (32, (0x0, 0x0, 0x0, 0x0)): "BGRA", - (24, (0xFF0000, 0xFF00, 0xFF)): "BGR", - (16, (0xF800, 0x7E0, 0x1F)): "BGR;16", - (16, (0x7C00, 0x3E0, 0x1F)): "BGR;15", - } - if file_info["bits"] in SUPPORTED: - if ( - file_info["bits"] == 32 - and file_info["rgba_mask"] in SUPPORTED[file_info["bits"]] - ): - assert isinstance(file_info["rgba_mask"], tuple) - raw_mode = MASK_MODES[(file_info["bits"], file_info["rgba_mask"])] - self._mode = "RGBA" if "A" in raw_mode else self.mode - elif ( - file_info["bits"] in (24, 16) - and file_info["rgb_mask"] in SUPPORTED[file_info["bits"]] - ): - assert isinstance(file_info["rgb_mask"], tuple) - raw_mode = MASK_MODES[(file_info["bits"], file_info["rgb_mask"])] - else: - msg = "Unsupported BMP bitfields layout" - raise OSError(msg) - else: - msg = "Unsupported BMP bitfields layout" - raise OSError(msg) - elif file_info["compression"] == self.COMPRESSIONS["RAW"]: - if file_info["bits"] == 32 and ( - header == 22 or USE_RAW_ALPHA # 32-bit .cur offset - ): - raw_mode, self._mode = "BGRA", "RGBA" - elif file_info["compression"] in ( - self.COMPRESSIONS["RLE8"], - self.COMPRESSIONS["RLE4"], - ): - decoder_name = "bmp_rle" - else: - msg = f"Unsupported BMP compression ({file_info['compression']})" - raise OSError(msg) - - # --------------- Once the header is processed, process the palette/LUT - if self.mode == "P": # Paletted for 1, 4 and 8 bit images - # ---------------------------------------------------- 1-bit images - if not (0 < file_info["colors"] <= 65536): - msg = f"Unsupported BMP Palette size ({file_info['colors']})" - raise OSError(msg) - else: - assert isinstance(file_info["palette_padding"], int) - padding = file_info["palette_padding"] - palette = read(padding * file_info["colors"]) - grayscale = True - indices = ( - (0, 255) - if file_info["colors"] == 2 - else list(range(file_info["colors"])) - ) - - # ----------------- Check if grayscale and ignore palette if so - for ind, val in enumerate(indices): - rgb = palette[ind * padding : ind * padding + 3] - if rgb != o8(val) * 3: - grayscale = False - - # ------- If all colors are gray, white or black, ditch palette - if grayscale: - self._mode = "1" if file_info["colors"] == 2 else "L" - raw_mode = self.mode - else: - self._mode = "P" - self.palette = ImagePalette.raw( - "BGRX" if padding == 4 else "BGR", palette - ) - - # ---------------------------- Finally set the tile data for the plugin - self.info["compression"] = file_info["compression"] - args: list[Any] = [raw_mode] - if decoder_name == "bmp_rle": - args.append(file_info["compression"] == self.COMPRESSIONS["RLE4"]) - else: - assert isinstance(file_info["width"], int) - args.append(((file_info["width"] * file_info["bits"] + 31) >> 3) & (~3)) - args.append(file_info["direction"]) - self.tile = [ - ImageFile._Tile( - decoder_name, - (0, 0, file_info["width"], file_info["height"]), - offset or self.fp.tell(), - tuple(args), - ) - ] - - def _open(self) -> None: - """Open file, check magic number and read header""" - # read 14 bytes: magic number, filesize, reserved, header final offset - head_data = self.fp.read(14) - # choke if the file does not have the required magic bytes - if not _accept(head_data): - msg = "Not a BMP file" - raise SyntaxError(msg) - # read the start position of the BMP image data (u32) - offset = i32(head_data, 10) - # load bitmap information (offset=raster info) - self._bitmap(offset=offset) - - -class BmpRleDecoder(ImageFile.PyDecoder): - _pulls_fd = True - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - rle4 = self.args[1] - data = bytearray() - x = 0 - dest_length = self.state.xsize * self.state.ysize - while len(data) < dest_length: - pixels = self.fd.read(1) - byte = self.fd.read(1) - if not pixels or not byte: - break - num_pixels = pixels[0] - if num_pixels: - # encoded mode - if x + num_pixels > self.state.xsize: - # Too much data for row - num_pixels = max(0, self.state.xsize - x) - if rle4: - first_pixel = o8(byte[0] >> 4) - second_pixel = o8(byte[0] & 0x0F) - for index in range(num_pixels): - if index % 2 == 0: - data += first_pixel - else: - data += second_pixel - else: - data += byte * num_pixels - x += num_pixels - else: - if byte[0] == 0: - # end of line - while len(data) % self.state.xsize != 0: - data += b"\x00" - x = 0 - elif byte[0] == 1: - # end of bitmap - break - elif byte[0] == 2: - # delta - bytes_read = self.fd.read(2) - if len(bytes_read) < 2: - break - right, up = self.fd.read(2) - data += b"\x00" * (right + up * self.state.xsize) - x = len(data) % self.state.xsize - else: - # absolute mode - if rle4: - # 2 pixels per byte - byte_count = byte[0] // 2 - bytes_read = self.fd.read(byte_count) - for byte_read in bytes_read: - data += o8(byte_read >> 4) - data += o8(byte_read & 0x0F) - else: - byte_count = byte[0] - bytes_read = self.fd.read(byte_count) - data += bytes_read - if len(bytes_read) < byte_count: - break - x += byte[0] - - # align to 16-bit word boundary - if self.fd.tell() % 2 != 0: - self.fd.seek(1, os.SEEK_CUR) - rawmode = "L" if self.mode == "L" else "P" - self.set_as_raw(bytes(data), rawmode, (0, self.args[-1])) - return -1, 0 - - -# ============================================================================= -# Image plugin for the DIB format (BMP alias) -# ============================================================================= -class DibImageFile(BmpImageFile): - format = "DIB" - format_description = "Windows Bitmap" - - def _open(self) -> None: - self._bitmap() - - -# -# -------------------------------------------------------------------- -# Write BMP file - - -SAVE = { - "1": ("1", 1, 2), - "L": ("L", 8, 256), - "P": ("P", 8, 256), - "RGB": ("BGR", 24, 0), - "RGBA": ("BGRA", 32, 0), -} - - -def _dib_save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - _save(im, fp, filename, False) - - -def _save( - im: Image.Image, fp: IO[bytes], filename: str | bytes, bitmap_header: bool = True -) -> None: - try: - rawmode, bits, colors = SAVE[im.mode] - except KeyError as e: - msg = f"cannot write mode {im.mode} as BMP" - raise OSError(msg) from e - - info = im.encoderinfo - - dpi = info.get("dpi", (96, 96)) - - # 1 meter == 39.3701 inches - ppm = tuple(int(x * 39.3701 + 0.5) for x in dpi) - - stride = ((im.size[0] * bits + 7) // 8 + 3) & (~3) - header = 40 # or 64 for OS/2 version 2 - image = stride * im.size[1] - - if im.mode == "1": - palette = b"".join(o8(i) * 3 + b"\x00" for i in (0, 255)) - elif im.mode == "L": - palette = b"".join(o8(i) * 3 + b"\x00" for i in range(256)) - elif im.mode == "P": - palette = im.im.getpalette("RGB", "BGRX") - colors = len(palette) // 4 - else: - palette = None - - # bitmap header - if bitmap_header: - offset = 14 + header + colors * 4 - file_size = offset + image - if file_size > 2**32 - 1: - msg = "File size is too large for the BMP format" - raise ValueError(msg) - fp.write( - b"BM" # file type (magic) - + o32(file_size) # file size - + o32(0) # reserved - + o32(offset) # image data offset - ) - - # bitmap info header - fp.write( - o32(header) # info header size - + o32(im.size[0]) # width - + o32(im.size[1]) # height - + o16(1) # planes - + o16(bits) # depth - + o32(0) # compression (0=uncompressed) - + o32(image) # size of bitmap - + o32(ppm[0]) # resolution - + o32(ppm[1]) # resolution - + o32(colors) # colors used - + o32(colors) # colors important - ) - - fp.write(b"\0" * (header - 40)) # padding (for OS/2 format) - - if palette: - fp.write(palette) - - ImageFile._save( - im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, stride, -1))] - ) - - -# -# -------------------------------------------------------------------- -# Registry - - -Image.register_open(BmpImageFile.format, BmpImageFile, _accept) -Image.register_save(BmpImageFile.format, _save) - -Image.register_extension(BmpImageFile.format, ".bmp") - -Image.register_mime(BmpImageFile.format, "image/bmp") - -Image.register_decoder("bmp_rle", BmpRleDecoder) - -Image.register_open(DibImageFile.format, DibImageFile, _dib_accept) -Image.register_save(DibImageFile.format, _dib_save) - -Image.register_extension(DibImageFile.format, ".dib") - -Image.register_mime(DibImageFile.format, "image/bmp") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py deleted file mode 100644 index 8c5da14..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/BufrStubImagePlugin.py +++ /dev/null @@ -1,75 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# BUFR stub adapter -# -# Copyright (c) 1996-2003 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -from typing import IO - -from . import Image, ImageFile - -_handler = None - - -def register_handler(handler: ImageFile.StubHandler | None) -> None: - """ - Install application-specific BUFR image handler. - - :param handler: Handler object. - """ - global _handler - _handler = handler - - -# -------------------------------------------------------------------- -# Image adapter - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith((b"BUFR", b"ZCZC")) - - -class BufrStubImageFile(ImageFile.StubImageFile): - format = "BUFR" - format_description = "BUFR" - - def _open(self) -> None: - if not _accept(self.fp.read(4)): - msg = "Not a BUFR file" - raise SyntaxError(msg) - - self.fp.seek(-4, os.SEEK_CUR) - - # make something up - self._mode = "F" - self._size = 1, 1 - - loader = self._load() - if loader: - loader.open(self) - - def _load(self) -> ImageFile.StubHandler | None: - return _handler - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if _handler is None or not hasattr(_handler, "save"): - msg = "BUFR save handler not installed" - raise OSError(msg) - _handler.save(im, fp, filename) - - -# -------------------------------------------------------------------- -# Registry - -Image.register_open(BufrStubImageFile.format, BufrStubImageFile, _accept) -Image.register_save(BufrStubImageFile.format, _save) - -Image.register_extension(BufrStubImageFile.format, ".bufr") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ContainerIO.py b/write-message/venv/lib/python3.10/site-packages/PIL/ContainerIO.py deleted file mode 100644 index ec9e66c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ContainerIO.py +++ /dev/null @@ -1,173 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# a class to read from a container file -# -# History: -# 1995-06-18 fl Created -# 1995-09-07 fl Added readline(), readlines() -# -# Copyright (c) 1997-2001 by Secret Labs AB -# Copyright (c) 1995 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -from collections.abc import Iterable -from typing import IO, AnyStr, NoReturn - - -class ContainerIO(IO[AnyStr]): - """ - A file object that provides read access to a part of an existing - file (for example a TAR file). - """ - - def __init__(self, file: IO[AnyStr], offset: int, length: int) -> None: - """ - Create file object. - - :param file: Existing file. - :param offset: Start of region, in bytes. - :param length: Size of region, in bytes. - """ - self.fh: IO[AnyStr] = file - self.pos = 0 - self.offset = offset - self.length = length - self.fh.seek(offset) - - ## - # Always false. - - def isatty(self) -> bool: - return False - - def seekable(self) -> bool: - return True - - def seek(self, offset: int, mode: int = io.SEEK_SET) -> int: - """ - Move file pointer. - - :param offset: Offset in bytes. - :param mode: Starting position. Use 0 for beginning of region, 1 - for current offset, and 2 for end of region. You cannot move - the pointer outside the defined region. - :returns: Offset from start of region, in bytes. - """ - if mode == 1: - self.pos = self.pos + offset - elif mode == 2: - self.pos = self.length + offset - else: - self.pos = offset - # clamp - self.pos = max(0, min(self.pos, self.length)) - self.fh.seek(self.offset + self.pos) - return self.pos - - def tell(self) -> int: - """ - Get current file pointer. - - :returns: Offset from start of region, in bytes. - """ - return self.pos - - def readable(self) -> bool: - return True - - def read(self, n: int = -1) -> AnyStr: - """ - Read data. - - :param n: Number of bytes to read. If omitted, zero or negative, - read until end of region. - :returns: An 8-bit string. - """ - if n > 0: - n = min(n, self.length - self.pos) - else: - n = self.length - self.pos - if n <= 0: # EOF - return b"" if "b" in self.fh.mode else "" # type: ignore[return-value] - self.pos = self.pos + n - return self.fh.read(n) - - def readline(self, n: int = -1) -> AnyStr: - """ - Read a line of text. - - :param n: Number of bytes to read. If omitted, zero or negative, - read until end of line. - :returns: An 8-bit string. - """ - s: AnyStr = b"" if "b" in self.fh.mode else "" # type: ignore[assignment] - newline_character = b"\n" if "b" in self.fh.mode else "\n" - while True: - c = self.read(1) - if not c: - break - s = s + c - if c == newline_character or len(s) == n: - break - return s - - def readlines(self, n: int | None = -1) -> list[AnyStr]: - """ - Read multiple lines of text. - - :param n: Number of lines to read. If omitted, zero, negative or None, - read until end of region. - :returns: A list of 8-bit strings. - """ - lines = [] - while True: - s = self.readline() - if not s: - break - lines.append(s) - if len(lines) == n: - break - return lines - - def writable(self) -> bool: - return False - - def write(self, b: AnyStr) -> NoReturn: - raise NotImplementedError() - - def writelines(self, lines: Iterable[AnyStr]) -> NoReturn: - raise NotImplementedError() - - def truncate(self, size: int | None = None) -> int: - raise NotImplementedError() - - def __enter__(self) -> ContainerIO[AnyStr]: - return self - - def __exit__(self, *args: object) -> None: - self.close() - - def __iter__(self) -> ContainerIO[AnyStr]: - return self - - def __next__(self) -> AnyStr: - line = self.readline() - if not line: - msg = "end of region" - raise StopIteration(msg) - return line - - def fileno(self) -> int: - return self.fh.fileno() - - def flush(self) -> None: - self.fh.flush() - - def close(self) -> None: - self.fh.close() diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/CurImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/CurImagePlugin.py deleted file mode 100644 index b817dbc..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/CurImagePlugin.py +++ /dev/null @@ -1,75 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# Windows Cursor support for PIL -# -# notes: -# uses BmpImagePlugin.py to read the bitmap data. -# -# history: -# 96-05-27 fl Created -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import BmpImagePlugin, Image, ImageFile -from ._binary import i16le as i16 -from ._binary import i32le as i32 - -# -# -------------------------------------------------------------------- - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"\0\0\2\0") - - -## -# Image plugin for Windows Cursor files. - - -class CurImageFile(BmpImagePlugin.BmpImageFile): - format = "CUR" - format_description = "Windows Cursor" - - def _open(self) -> None: - offset = self.fp.tell() - - # check magic - s = self.fp.read(6) - if not _accept(s): - msg = "not a CUR file" - raise SyntaxError(msg) - - # pick the largest cursor in the file - m = b"" - for i in range(i16(s, 4)): - s = self.fp.read(16) - if not m: - m = s - elif s[0] > m[0] and s[1] > m[1]: - m = s - if not m: - msg = "No cursors were found" - raise TypeError(msg) - - # load as bitmap - self._bitmap(i32(m, 12) + offset) - - # patch up the bitmap height - self._size = self.size[0], self.size[1] // 2 - d, e, o, a = self.tile[0] - self.tile[0] = ImageFile._Tile(d, (0, 0) + self.size, o, a) - - -# -# -------------------------------------------------------------------- - -Image.register_open(CurImageFile.format, CurImageFile, _accept) - -Image.register_extension(CurImageFile.format, ".cur") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/DcxImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/DcxImagePlugin.py deleted file mode 100644 index aea661b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/DcxImagePlugin.py +++ /dev/null @@ -1,83 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# DCX file handling -# -# DCX is a container file format defined by Intel, commonly used -# for fax applications. Each DCX file consists of a directory -# (a list of file offsets) followed by a set of (usually 1-bit) -# PCX files. -# -# History: -# 1995-09-09 fl Created -# 1996-03-20 fl Properly derived from PcxImageFile. -# 1998-07-15 fl Renamed offset attribute to avoid name clash -# 2002-07-30 fl Fixed file handling -# -# Copyright (c) 1997-98 by Secret Labs AB. -# Copyright (c) 1995-96 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image -from ._binary import i32le as i32 -from ._util import DeferredError -from .PcxImagePlugin import PcxImageFile - -MAGIC = 0x3ADE68B1 # QUIZ: what's this value, then? - - -def _accept(prefix: bytes) -> bool: - return len(prefix) >= 4 and i32(prefix) == MAGIC - - -## -# Image plugin for the Intel DCX format. - - -class DcxImageFile(PcxImageFile): - format = "DCX" - format_description = "Intel DCX" - _close_exclusive_fp_after_loading = False - - def _open(self) -> None: - # Header - s = self.fp.read(4) - if not _accept(s): - msg = "not a DCX file" - raise SyntaxError(msg) - - # Component directory - self._offset = [] - for i in range(1024): - offset = i32(self.fp.read(4)) - if not offset: - break - self._offset.append(offset) - - self._fp = self.fp - self.frame = -1 - self.n_frames = len(self._offset) - self.is_animated = self.n_frames > 1 - self.seek(0) - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - if isinstance(self._fp, DeferredError): - raise self._fp.ex - self.frame = frame - self.fp = self._fp - self.fp.seek(self._offset[frame]) - PcxImageFile._open(self) - - def tell(self) -> int: - return self.frame - - -Image.register_open(DcxImageFile.format, DcxImageFile, _accept) - -Image.register_extension(DcxImageFile.format, ".dcx") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/DdsImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/DdsImagePlugin.py deleted file mode 100644 index f9ade18..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/DdsImagePlugin.py +++ /dev/null @@ -1,624 +0,0 @@ -""" -A Pillow plugin for .dds files (S3TC-compressed aka DXTC) -Jerome Leclanche - -Documentation: -https://web.archive.org/web/20170802060935/http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt - -The contents of this file are hereby released in the public domain (CC0) -Full text of the CC0 license: -https://creativecommons.org/publicdomain/zero/1.0/ -""" - -from __future__ import annotations - -import io -import struct -import sys -from enum import IntEnum, IntFlag -from typing import IO - -from . import Image, ImageFile, ImagePalette -from ._binary import i32le as i32 -from ._binary import o8 -from ._binary import o32le as o32 - -# Magic ("DDS ") -DDS_MAGIC = 0x20534444 - - -# DDS flags -class DDSD(IntFlag): - CAPS = 0x1 - HEIGHT = 0x2 - WIDTH = 0x4 - PITCH = 0x8 - PIXELFORMAT = 0x1000 - MIPMAPCOUNT = 0x20000 - LINEARSIZE = 0x80000 - DEPTH = 0x800000 - - -# DDS caps -class DDSCAPS(IntFlag): - COMPLEX = 0x8 - TEXTURE = 0x1000 - MIPMAP = 0x400000 - - -class DDSCAPS2(IntFlag): - CUBEMAP = 0x200 - CUBEMAP_POSITIVEX = 0x400 - CUBEMAP_NEGATIVEX = 0x800 - CUBEMAP_POSITIVEY = 0x1000 - CUBEMAP_NEGATIVEY = 0x2000 - CUBEMAP_POSITIVEZ = 0x4000 - CUBEMAP_NEGATIVEZ = 0x8000 - VOLUME = 0x200000 - - -# Pixel Format -class DDPF(IntFlag): - ALPHAPIXELS = 0x1 - ALPHA = 0x2 - FOURCC = 0x4 - PALETTEINDEXED8 = 0x20 - RGB = 0x40 - LUMINANCE = 0x20000 - - -# dxgiformat.h -class DXGI_FORMAT(IntEnum): - UNKNOWN = 0 - R32G32B32A32_TYPELESS = 1 - R32G32B32A32_FLOAT = 2 - R32G32B32A32_UINT = 3 - R32G32B32A32_SINT = 4 - R32G32B32_TYPELESS = 5 - R32G32B32_FLOAT = 6 - R32G32B32_UINT = 7 - R32G32B32_SINT = 8 - R16G16B16A16_TYPELESS = 9 - R16G16B16A16_FLOAT = 10 - R16G16B16A16_UNORM = 11 - R16G16B16A16_UINT = 12 - R16G16B16A16_SNORM = 13 - R16G16B16A16_SINT = 14 - R32G32_TYPELESS = 15 - R32G32_FLOAT = 16 - R32G32_UINT = 17 - R32G32_SINT = 18 - R32G8X24_TYPELESS = 19 - D32_FLOAT_S8X24_UINT = 20 - R32_FLOAT_X8X24_TYPELESS = 21 - X32_TYPELESS_G8X24_UINT = 22 - R10G10B10A2_TYPELESS = 23 - R10G10B10A2_UNORM = 24 - R10G10B10A2_UINT = 25 - R11G11B10_FLOAT = 26 - R8G8B8A8_TYPELESS = 27 - R8G8B8A8_UNORM = 28 - R8G8B8A8_UNORM_SRGB = 29 - R8G8B8A8_UINT = 30 - R8G8B8A8_SNORM = 31 - R8G8B8A8_SINT = 32 - R16G16_TYPELESS = 33 - R16G16_FLOAT = 34 - R16G16_UNORM = 35 - R16G16_UINT = 36 - R16G16_SNORM = 37 - R16G16_SINT = 38 - R32_TYPELESS = 39 - D32_FLOAT = 40 - R32_FLOAT = 41 - R32_UINT = 42 - R32_SINT = 43 - R24G8_TYPELESS = 44 - D24_UNORM_S8_UINT = 45 - R24_UNORM_X8_TYPELESS = 46 - X24_TYPELESS_G8_UINT = 47 - R8G8_TYPELESS = 48 - R8G8_UNORM = 49 - R8G8_UINT = 50 - R8G8_SNORM = 51 - R8G8_SINT = 52 - R16_TYPELESS = 53 - R16_FLOAT = 54 - D16_UNORM = 55 - R16_UNORM = 56 - R16_UINT = 57 - R16_SNORM = 58 - R16_SINT = 59 - R8_TYPELESS = 60 - R8_UNORM = 61 - R8_UINT = 62 - R8_SNORM = 63 - R8_SINT = 64 - A8_UNORM = 65 - R1_UNORM = 66 - R9G9B9E5_SHAREDEXP = 67 - R8G8_B8G8_UNORM = 68 - G8R8_G8B8_UNORM = 69 - BC1_TYPELESS = 70 - BC1_UNORM = 71 - BC1_UNORM_SRGB = 72 - BC2_TYPELESS = 73 - BC2_UNORM = 74 - BC2_UNORM_SRGB = 75 - BC3_TYPELESS = 76 - BC3_UNORM = 77 - BC3_UNORM_SRGB = 78 - BC4_TYPELESS = 79 - BC4_UNORM = 80 - BC4_SNORM = 81 - BC5_TYPELESS = 82 - BC5_UNORM = 83 - BC5_SNORM = 84 - B5G6R5_UNORM = 85 - B5G5R5A1_UNORM = 86 - B8G8R8A8_UNORM = 87 - B8G8R8X8_UNORM = 88 - R10G10B10_XR_BIAS_A2_UNORM = 89 - B8G8R8A8_TYPELESS = 90 - B8G8R8A8_UNORM_SRGB = 91 - B8G8R8X8_TYPELESS = 92 - B8G8R8X8_UNORM_SRGB = 93 - BC6H_TYPELESS = 94 - BC6H_UF16 = 95 - BC6H_SF16 = 96 - BC7_TYPELESS = 97 - BC7_UNORM = 98 - BC7_UNORM_SRGB = 99 - AYUV = 100 - Y410 = 101 - Y416 = 102 - NV12 = 103 - P010 = 104 - P016 = 105 - OPAQUE_420 = 106 - YUY2 = 107 - Y210 = 108 - Y216 = 109 - NV11 = 110 - AI44 = 111 - IA44 = 112 - P8 = 113 - A8P8 = 114 - B4G4R4A4_UNORM = 115 - P208 = 130 - V208 = 131 - V408 = 132 - SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189 - SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190 - - -class D3DFMT(IntEnum): - UNKNOWN = 0 - R8G8B8 = 20 - A8R8G8B8 = 21 - X8R8G8B8 = 22 - R5G6B5 = 23 - X1R5G5B5 = 24 - A1R5G5B5 = 25 - A4R4G4B4 = 26 - R3G3B2 = 27 - A8 = 28 - A8R3G3B2 = 29 - X4R4G4B4 = 30 - A2B10G10R10 = 31 - A8B8G8R8 = 32 - X8B8G8R8 = 33 - G16R16 = 34 - A2R10G10B10 = 35 - A16B16G16R16 = 36 - A8P8 = 40 - P8 = 41 - L8 = 50 - A8L8 = 51 - A4L4 = 52 - V8U8 = 60 - L6V5U5 = 61 - X8L8V8U8 = 62 - Q8W8V8U8 = 63 - V16U16 = 64 - A2W10V10U10 = 67 - D16_LOCKABLE = 70 - D32 = 71 - D15S1 = 73 - D24S8 = 75 - D24X8 = 77 - D24X4S4 = 79 - D16 = 80 - D32F_LOCKABLE = 82 - D24FS8 = 83 - D32_LOCKABLE = 84 - S8_LOCKABLE = 85 - L16 = 81 - VERTEXDATA = 100 - INDEX16 = 101 - INDEX32 = 102 - Q16W16V16U16 = 110 - R16F = 111 - G16R16F = 112 - A16B16G16R16F = 113 - R32F = 114 - G32R32F = 115 - A32B32G32R32F = 116 - CxV8U8 = 117 - A1 = 118 - A2B10G10R10_XR_BIAS = 119 - BINARYBUFFER = 199 - - UYVY = i32(b"UYVY") - R8G8_B8G8 = i32(b"RGBG") - YUY2 = i32(b"YUY2") - G8R8_G8B8 = i32(b"GRGB") - DXT1 = i32(b"DXT1") - DXT2 = i32(b"DXT2") - DXT3 = i32(b"DXT3") - DXT4 = i32(b"DXT4") - DXT5 = i32(b"DXT5") - DX10 = i32(b"DX10") - BC4S = i32(b"BC4S") - BC4U = i32(b"BC4U") - BC5S = i32(b"BC5S") - BC5U = i32(b"BC5U") - ATI1 = i32(b"ATI1") - ATI2 = i32(b"ATI2") - MULTI2_ARGB8 = i32(b"MET1") - - -# Backward compatibility layer -module = sys.modules[__name__] -for item in DDSD: - assert item.name is not None - setattr(module, f"DDSD_{item.name}", item.value) -for item1 in DDSCAPS: - assert item1.name is not None - setattr(module, f"DDSCAPS_{item1.name}", item1.value) -for item2 in DDSCAPS2: - assert item2.name is not None - setattr(module, f"DDSCAPS2_{item2.name}", item2.value) -for item3 in DDPF: - assert item3.name is not None - setattr(module, f"DDPF_{item3.name}", item3.value) - -DDS_FOURCC = DDPF.FOURCC -DDS_RGB = DDPF.RGB -DDS_RGBA = DDPF.RGB | DDPF.ALPHAPIXELS -DDS_LUMINANCE = DDPF.LUMINANCE -DDS_LUMINANCEA = DDPF.LUMINANCE | DDPF.ALPHAPIXELS -DDS_ALPHA = DDPF.ALPHA -DDS_PAL8 = DDPF.PALETTEINDEXED8 - -DDS_HEADER_FLAGS_TEXTURE = DDSD.CAPS | DDSD.HEIGHT | DDSD.WIDTH | DDSD.PIXELFORMAT -DDS_HEADER_FLAGS_MIPMAP = DDSD.MIPMAPCOUNT -DDS_HEADER_FLAGS_VOLUME = DDSD.DEPTH -DDS_HEADER_FLAGS_PITCH = DDSD.PITCH -DDS_HEADER_FLAGS_LINEARSIZE = DDSD.LINEARSIZE - -DDS_HEIGHT = DDSD.HEIGHT -DDS_WIDTH = DDSD.WIDTH - -DDS_SURFACE_FLAGS_TEXTURE = DDSCAPS.TEXTURE -DDS_SURFACE_FLAGS_MIPMAP = DDSCAPS.COMPLEX | DDSCAPS.MIPMAP -DDS_SURFACE_FLAGS_CUBEMAP = DDSCAPS.COMPLEX - -DDS_CUBEMAP_POSITIVEX = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_POSITIVEX -DDS_CUBEMAP_NEGATIVEX = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_NEGATIVEX -DDS_CUBEMAP_POSITIVEY = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_POSITIVEY -DDS_CUBEMAP_NEGATIVEY = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_NEGATIVEY -DDS_CUBEMAP_POSITIVEZ = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_POSITIVEZ -DDS_CUBEMAP_NEGATIVEZ = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_NEGATIVEZ - -DXT1_FOURCC = D3DFMT.DXT1 -DXT3_FOURCC = D3DFMT.DXT3 -DXT5_FOURCC = D3DFMT.DXT5 - -DXGI_FORMAT_R8G8B8A8_TYPELESS = DXGI_FORMAT.R8G8B8A8_TYPELESS -DXGI_FORMAT_R8G8B8A8_UNORM = DXGI_FORMAT.R8G8B8A8_UNORM -DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = DXGI_FORMAT.R8G8B8A8_UNORM_SRGB -DXGI_FORMAT_BC5_TYPELESS = DXGI_FORMAT.BC5_TYPELESS -DXGI_FORMAT_BC5_UNORM = DXGI_FORMAT.BC5_UNORM -DXGI_FORMAT_BC5_SNORM = DXGI_FORMAT.BC5_SNORM -DXGI_FORMAT_BC6H_UF16 = DXGI_FORMAT.BC6H_UF16 -DXGI_FORMAT_BC6H_SF16 = DXGI_FORMAT.BC6H_SF16 -DXGI_FORMAT_BC7_TYPELESS = DXGI_FORMAT.BC7_TYPELESS -DXGI_FORMAT_BC7_UNORM = DXGI_FORMAT.BC7_UNORM -DXGI_FORMAT_BC7_UNORM_SRGB = DXGI_FORMAT.BC7_UNORM_SRGB - - -class DdsImageFile(ImageFile.ImageFile): - format = "DDS" - format_description = "DirectDraw Surface" - - def _open(self) -> None: - if not _accept(self.fp.read(4)): - msg = "not a DDS file" - raise SyntaxError(msg) - (header_size,) = struct.unpack(" None: - pass - - -class DdsRgbDecoder(ImageFile.PyDecoder): - _pulls_fd = True - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - bitcount, masks = self.args - - # Some masks will be padded with zeros, e.g. R 0b11 G 0b1100 - # Calculate how many zeros each mask is padded with - mask_offsets = [] - # And the maximum value of each channel without the padding - mask_totals = [] - for mask in masks: - offset = 0 - if mask != 0: - while mask >> (offset + 1) << (offset + 1) == mask: - offset += 1 - mask_offsets.append(offset) - mask_totals.append(mask >> offset) - - data = bytearray() - bytecount = bitcount // 8 - dest_length = self.state.xsize * self.state.ysize * len(masks) - while len(data) < dest_length: - value = int.from_bytes(self.fd.read(bytecount), "little") - for i, mask in enumerate(masks): - masked_value = value & mask - # Remove the zero padding, and scale it to 8 bits - data += o8( - int(((masked_value >> mask_offsets[i]) / mask_totals[i]) * 255) - ) - self.set_as_raw(data) - return -1, 0 - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode not in ("RGB", "RGBA", "L", "LA"): - msg = f"cannot write mode {im.mode} as DDS" - raise OSError(msg) - - flags = DDSD.CAPS | DDSD.HEIGHT | DDSD.WIDTH | DDSD.PIXELFORMAT - bitcount = len(im.getbands()) * 8 - pixel_format = im.encoderinfo.get("pixel_format") - args: tuple[int] | str - if pixel_format: - codec_name = "bcn" - flags |= DDSD.LINEARSIZE - pitch = (im.width + 3) * 4 - rgba_mask = [0, 0, 0, 0] - pixel_flags = DDPF.FOURCC - if pixel_format == "DXT1": - fourcc = D3DFMT.DXT1 - args = (1,) - elif pixel_format == "DXT3": - fourcc = D3DFMT.DXT3 - args = (2,) - elif pixel_format == "DXT5": - fourcc = D3DFMT.DXT5 - args = (3,) - else: - fourcc = D3DFMT.DX10 - if pixel_format == "BC2": - args = (2,) - dxgi_format = DXGI_FORMAT.BC2_TYPELESS - elif pixel_format == "BC3": - args = (3,) - dxgi_format = DXGI_FORMAT.BC3_TYPELESS - elif pixel_format == "BC5": - args = (5,) - dxgi_format = DXGI_FORMAT.BC5_TYPELESS - if im.mode != "RGB": - msg = "only RGB mode can be written as BC5" - raise OSError(msg) - else: - msg = f"cannot write pixel format {pixel_format}" - raise OSError(msg) - else: - codec_name = "raw" - flags |= DDSD.PITCH - pitch = (im.width * bitcount + 7) // 8 - - alpha = im.mode[-1] == "A" - if im.mode[0] == "L": - pixel_flags = DDPF.LUMINANCE - args = im.mode - if alpha: - rgba_mask = [0x000000FF, 0x000000FF, 0x000000FF] - else: - rgba_mask = [0xFF000000, 0xFF000000, 0xFF000000] - else: - pixel_flags = DDPF.RGB - args = im.mode[::-1] - rgba_mask = [0x00FF0000, 0x0000FF00, 0x000000FF] - - if alpha: - r, g, b, a = im.split() - im = Image.merge("RGBA", (a, r, g, b)) - if alpha: - pixel_flags |= DDPF.ALPHAPIXELS - rgba_mask.append(0xFF000000 if alpha else 0) - - fourcc = D3DFMT.UNKNOWN - fp.write( - o32(DDS_MAGIC) - + struct.pack( - "<7I", - 124, # header size - flags, # flags - im.height, - im.width, - pitch, - 0, # depth - 0, # mipmaps - ) - + struct.pack("11I", *((0,) * 11)) # reserved - # pfsize, pfflags, fourcc, bitcount - + struct.pack("<4I", 32, pixel_flags, fourcc, bitcount) - + struct.pack("<4I", *rgba_mask) # dwRGBABitMask - + struct.pack("<5I", DDSCAPS.TEXTURE, 0, 0, 0, 0) - ) - if fourcc == D3DFMT.DX10: - fp.write( - # dxgi_format, 2D resource, misc, array size, straight alpha - struct.pack("<5I", dxgi_format, 3, 0, 0, 1) - ) - ImageFile._save(im, fp, [ImageFile._Tile(codec_name, (0, 0) + im.size, 0, args)]) - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"DDS ") - - -Image.register_open(DdsImageFile.format, DdsImageFile, _accept) -Image.register_decoder("dds_rgb", DdsRgbDecoder) -Image.register_save(DdsImageFile.format, _save) -Image.register_extension(DdsImageFile.format, ".dds") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/EpsImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/EpsImagePlugin.py deleted file mode 100644 index 5e2ddad..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/EpsImagePlugin.py +++ /dev/null @@ -1,476 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# EPS file handling -# -# History: -# 1995-09-01 fl Created (0.1) -# 1996-05-18 fl Don't choke on "atend" fields, Ghostscript interface (0.2) -# 1996-08-22 fl Don't choke on floating point BoundingBox values -# 1996-08-23 fl Handle files from Macintosh (0.3) -# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4) -# 2003-09-07 fl Check gs.close status (from Federico Di Gregorio) (0.5) -# 2014-05-07 e Handling of EPS with binary preview and fixed resolution -# resizing -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1995-2003 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -import os -import re -import subprocess -import sys -import tempfile -from typing import IO - -from . import Image, ImageFile -from ._binary import i32le as i32 - -# -------------------------------------------------------------------- - - -split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$") -field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$") - -gs_binary: str | bool | None = None -gs_windows_binary = None - - -def has_ghostscript() -> bool: - global gs_binary, gs_windows_binary - if gs_binary is None: - if sys.platform.startswith("win"): - if gs_windows_binary is None: - import shutil - - for binary in ("gswin32c", "gswin64c", "gs"): - if shutil.which(binary) is not None: - gs_windows_binary = binary - break - else: - gs_windows_binary = False - gs_binary = gs_windows_binary - else: - try: - subprocess.check_call(["gs", "--version"], stdout=subprocess.DEVNULL) - gs_binary = "gs" - except OSError: - gs_binary = False - return gs_binary is not False - - -def Ghostscript( - tile: list[ImageFile._Tile], - size: tuple[int, int], - fp: IO[bytes], - scale: int = 1, - transparency: bool = False, -) -> Image.core.ImagingCore: - """Render an image using Ghostscript""" - global gs_binary - if not has_ghostscript(): - msg = "Unable to locate Ghostscript on paths" - raise OSError(msg) - assert isinstance(gs_binary, str) - - # Unpack decoder tile - args = tile[0].args - assert isinstance(args, tuple) - length, bbox = args - - # Hack to support hi-res rendering - scale = int(scale) or 1 - width = size[0] * scale - height = size[1] * scale - # resolution is dependent on bbox and size - res_x = 72.0 * width / (bbox[2] - bbox[0]) - res_y = 72.0 * height / (bbox[3] - bbox[1]) - - out_fd, outfile = tempfile.mkstemp() - os.close(out_fd) - - infile_temp = None - if hasattr(fp, "name") and os.path.exists(fp.name): - infile = fp.name - else: - in_fd, infile_temp = tempfile.mkstemp() - os.close(in_fd) - infile = infile_temp - - # Ignore length and offset! - # Ghostscript can read it - # Copy whole file to read in Ghostscript - with open(infile_temp, "wb") as f: - # fetch length of fp - fp.seek(0, io.SEEK_END) - fsize = fp.tell() - # ensure start position - # go back - fp.seek(0) - lengthfile = fsize - while lengthfile > 0: - s = fp.read(min(lengthfile, 100 * 1024)) - if not s: - break - lengthfile -= len(s) - f.write(s) - - if transparency: - # "RGBA" - device = "pngalpha" - else: - # "pnmraw" automatically chooses between - # PBM ("1"), PGM ("L"), and PPM ("RGB"). - device = "pnmraw" - - # Build Ghostscript command - command = [ - gs_binary, - "-q", # quiet mode - f"-g{width:d}x{height:d}", # set output geometry (pixels) - f"-r{res_x:f}x{res_y:f}", # set input DPI (dots per inch) - "-dBATCH", # exit after processing - "-dNOPAUSE", # don't pause between pages - "-dSAFER", # safe mode - f"-sDEVICE={device}", - f"-sOutputFile={outfile}", # output file - # adjust for image origin - "-c", - f"{-bbox[0]} {-bbox[1]} translate", - "-f", - infile, # input file - # showpage (see https://bugs.ghostscript.com/show_bug.cgi?id=698272) - "-c", - "showpage", - ] - - # push data through Ghostscript - try: - startupinfo = None - if sys.platform.startswith("win"): - startupinfo = subprocess.STARTUPINFO() - startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - subprocess.check_call(command, startupinfo=startupinfo) - with Image.open(outfile) as out_im: - out_im.load() - return out_im.im.copy() - finally: - try: - os.unlink(outfile) - if infile_temp: - os.unlink(infile_temp) - except OSError: - pass - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"%!PS") or ( - len(prefix) >= 4 and i32(prefix) == 0xC6D3D0C5 - ) - - -## -# Image plugin for Encapsulated PostScript. This plugin supports only -# a few variants of this format. - - -class EpsImageFile(ImageFile.ImageFile): - """EPS File Parser for the Python Imaging Library""" - - format = "EPS" - format_description = "Encapsulated Postscript" - - mode_map = {1: "L", 2: "LAB", 3: "RGB", 4: "CMYK"} - - def _open(self) -> None: - (length, offset) = self._find_offset(self.fp) - - # go to offset - start of "%!PS" - self.fp.seek(offset) - - self._mode = "RGB" - - # When reading header comments, the first comment is used. - # When reading trailer comments, the last comment is used. - bounding_box: list[int] | None = None - imagedata_size: tuple[int, int] | None = None - - byte_arr = bytearray(255) - bytes_mv = memoryview(byte_arr) - bytes_read = 0 - reading_header_comments = True - reading_trailer_comments = False - trailer_reached = False - - def check_required_header_comments() -> None: - """ - The EPS specification requires that some headers exist. - This should be checked when the header comments formally end, - when image data starts, or when the file ends, whichever comes first. - """ - if "PS-Adobe" not in self.info: - msg = 'EPS header missing "%!PS-Adobe" comment' - raise SyntaxError(msg) - if "BoundingBox" not in self.info: - msg = 'EPS header missing "%%BoundingBox" comment' - raise SyntaxError(msg) - - def read_comment(s: str) -> bool: - nonlocal bounding_box, reading_trailer_comments - try: - m = split.match(s) - except re.error as e: - msg = "not an EPS file" - raise SyntaxError(msg) from e - - if not m: - return False - - k, v = m.group(1, 2) - self.info[k] = v - if k == "BoundingBox": - if v == "(atend)": - reading_trailer_comments = True - elif not bounding_box or (trailer_reached and reading_trailer_comments): - try: - # Note: The DSC spec says that BoundingBox - # fields should be integers, but some drivers - # put floating point values there anyway. - bounding_box = [int(float(i)) for i in v.split()] - except Exception: - pass - return True - - while True: - byte = self.fp.read(1) - if byte == b"": - # if we didn't read a byte we must be at the end of the file - if bytes_read == 0: - if reading_header_comments: - check_required_header_comments() - break - elif byte in b"\r\n": - # if we read a line ending character, ignore it and parse what - # we have already read. if we haven't read any other characters, - # continue reading - if bytes_read == 0: - continue - else: - # ASCII/hexadecimal lines in an EPS file must not exceed - # 255 characters, not including line ending characters - if bytes_read >= 255: - # only enforce this for lines starting with a "%", - # otherwise assume it's binary data - if byte_arr[0] == ord("%"): - msg = "not an EPS file" - raise SyntaxError(msg) - else: - if reading_header_comments: - check_required_header_comments() - reading_header_comments = False - # reset bytes_read so we can keep reading - # data until the end of the line - bytes_read = 0 - byte_arr[bytes_read] = byte[0] - bytes_read += 1 - continue - - if reading_header_comments: - # Load EPS header - - # if this line doesn't start with a "%", - # or does start with "%%EndComments", - # then we've reached the end of the header/comments - if byte_arr[0] != ord("%") or bytes_mv[:13] == b"%%EndComments": - check_required_header_comments() - reading_header_comments = False - continue - - s = str(bytes_mv[:bytes_read], "latin-1") - if not read_comment(s): - m = field.match(s) - if m: - k = m.group(1) - if k.startswith("PS-Adobe"): - self.info["PS-Adobe"] = k[9:] - else: - self.info[k] = "" - elif s[0] == "%": - # handle non-DSC PostScript comments that some - # tools mistakenly put in the Comments section - pass - else: - msg = "bad EPS header" - raise OSError(msg) - elif bytes_mv[:11] == b"%ImageData:": - # Check for an "ImageData" descriptor - # https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1035096 - - # If we've already read an "ImageData" descriptor, - # don't read another one. - if imagedata_size: - bytes_read = 0 - continue - - # Values: - # columns - # rows - # bit depth (1 or 8) - # mode (1: L, 2: LAB, 3: RGB, 4: CMYK) - # number of padding channels - # block size (number of bytes per row per channel) - # binary/ascii (1: binary, 2: ascii) - # data start identifier (the image data follows after a single line - # consisting only of this quoted value) - image_data_values = byte_arr[11:bytes_read].split(None, 7) - columns, rows, bit_depth, mode_id = ( - int(value) for value in image_data_values[:4] - ) - - if bit_depth == 1: - self._mode = "1" - elif bit_depth == 8: - try: - self._mode = self.mode_map[mode_id] - except ValueError: - break - else: - break - - # Parse the columns and rows after checking the bit depth and mode - # in case the bit depth and/or mode are invalid. - imagedata_size = columns, rows - elif bytes_mv[:5] == b"%%EOF": - break - elif trailer_reached and reading_trailer_comments: - # Load EPS trailer - s = str(bytes_mv[:bytes_read], "latin-1") - read_comment(s) - elif bytes_mv[:9] == b"%%Trailer": - trailer_reached = True - bytes_read = 0 - - # A "BoundingBox" is always required, - # even if an "ImageData" descriptor size exists. - if not bounding_box: - msg = "cannot determine EPS bounding box" - raise OSError(msg) - - # An "ImageData" size takes precedence over the "BoundingBox". - self._size = imagedata_size or ( - bounding_box[2] - bounding_box[0], - bounding_box[3] - bounding_box[1], - ) - - self.tile = [ - ImageFile._Tile("eps", (0, 0) + self.size, offset, (length, bounding_box)) - ] - - def _find_offset(self, fp: IO[bytes]) -> tuple[int, int]: - s = fp.read(4) - - if s == b"%!PS": - # for HEAD without binary preview - fp.seek(0, io.SEEK_END) - length = fp.tell() - offset = 0 - elif i32(s) == 0xC6D3D0C5: - # FIX for: Some EPS file not handled correctly / issue #302 - # EPS can contain binary data - # or start directly with latin coding - # more info see: - # https://web.archive.org/web/20160528181353/http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf - s = fp.read(8) - offset = i32(s) - length = i32(s, 4) - else: - msg = "not an EPS file" - raise SyntaxError(msg) - - return length, offset - - def load( - self, scale: int = 1, transparency: bool = False - ) -> Image.core.PixelAccess | None: - # Load EPS via Ghostscript - if self.tile: - self.im = Ghostscript(self.tile, self.size, self.fp, scale, transparency) - self._mode = self.im.mode - self._size = self.im.size - self.tile = [] - return Image.Image.load(self) - - def load_seek(self, pos: int) -> None: - # we can't incrementally load, so force ImageFile.parser to - # use our custom load method by defining this method. - pass - - -# -------------------------------------------------------------------- - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes, eps: int = 1) -> None: - """EPS Writer for the Python Imaging Library.""" - - # make sure image data is available - im.load() - - # determine PostScript image mode - if im.mode == "L": - operator = (8, 1, b"image") - elif im.mode == "RGB": - operator = (8, 3, b"false 3 colorimage") - elif im.mode == "CMYK": - operator = (8, 4, b"false 4 colorimage") - else: - msg = "image mode is not supported" - raise ValueError(msg) - - if eps: - # write EPS header - fp.write(b"%!PS-Adobe-3.0 EPSF-3.0\n") - fp.write(b"%%Creator: PIL 0.1 EpsEncode\n") - # fp.write("%%CreationDate: %s"...) - fp.write(b"%%%%BoundingBox: 0 0 %d %d\n" % im.size) - fp.write(b"%%Pages: 1\n") - fp.write(b"%%EndComments\n") - fp.write(b"%%Page: 1 1\n") - fp.write(b"%%ImageData: %d %d " % im.size) - fp.write(b'%d %d 0 1 1 "%s"\n' % operator) - - # image header - fp.write(b"gsave\n") - fp.write(b"10 dict begin\n") - fp.write(b"/buf %d string def\n" % (im.size[0] * operator[1])) - fp.write(b"%d %d scale\n" % im.size) - fp.write(b"%d %d 8\n" % im.size) # <= bits - fp.write(b"[%d 0 0 -%d 0 %d]\n" % (im.size[0], im.size[1], im.size[1])) - fp.write(b"{ currentfile buf readhexstring pop } bind\n") - fp.write(operator[2] + b"\n") - if hasattr(fp, "flush"): - fp.flush() - - ImageFile._save(im, fp, [ImageFile._Tile("eps", (0, 0) + im.size)]) - - fp.write(b"\n%%%%EndBinary\n") - fp.write(b"grestore end\n") - if hasattr(fp, "flush"): - fp.flush() - - -# -------------------------------------------------------------------- - - -Image.register_open(EpsImageFile.format, EpsImageFile, _accept) - -Image.register_save(EpsImageFile.format, _save) - -Image.register_extensions(EpsImageFile.format, [".ps", ".eps"]) - -Image.register_mime(EpsImageFile.format, "application/postscript") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ExifTags.py b/write-message/venv/lib/python3.10/site-packages/PIL/ExifTags.py deleted file mode 100644 index 2280d5c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ExifTags.py +++ /dev/null @@ -1,382 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# EXIF tags -# -# Copyright (c) 2003 by Secret Labs AB -# -# See the README file for information on usage and redistribution. -# - -""" -This module provides constants and clear-text names for various -well-known EXIF tags. -""" -from __future__ import annotations - -from enum import IntEnum - - -class Base(IntEnum): - # possibly incomplete - InteropIndex = 0x0001 - ProcessingSoftware = 0x000B - NewSubfileType = 0x00FE - SubfileType = 0x00FF - ImageWidth = 0x0100 - ImageLength = 0x0101 - BitsPerSample = 0x0102 - Compression = 0x0103 - PhotometricInterpretation = 0x0106 - Thresholding = 0x0107 - CellWidth = 0x0108 - CellLength = 0x0109 - FillOrder = 0x010A - DocumentName = 0x010D - ImageDescription = 0x010E - Make = 0x010F - Model = 0x0110 - StripOffsets = 0x0111 - Orientation = 0x0112 - SamplesPerPixel = 0x0115 - RowsPerStrip = 0x0116 - StripByteCounts = 0x0117 - MinSampleValue = 0x0118 - MaxSampleValue = 0x0119 - XResolution = 0x011A - YResolution = 0x011B - PlanarConfiguration = 0x011C - PageName = 0x011D - FreeOffsets = 0x0120 - FreeByteCounts = 0x0121 - GrayResponseUnit = 0x0122 - GrayResponseCurve = 0x0123 - T4Options = 0x0124 - T6Options = 0x0125 - ResolutionUnit = 0x0128 - PageNumber = 0x0129 - TransferFunction = 0x012D - Software = 0x0131 - DateTime = 0x0132 - Artist = 0x013B - HostComputer = 0x013C - Predictor = 0x013D - WhitePoint = 0x013E - PrimaryChromaticities = 0x013F - ColorMap = 0x0140 - HalftoneHints = 0x0141 - TileWidth = 0x0142 - TileLength = 0x0143 - TileOffsets = 0x0144 - TileByteCounts = 0x0145 - SubIFDs = 0x014A - InkSet = 0x014C - InkNames = 0x014D - NumberOfInks = 0x014E - DotRange = 0x0150 - TargetPrinter = 0x0151 - ExtraSamples = 0x0152 - SampleFormat = 0x0153 - SMinSampleValue = 0x0154 - SMaxSampleValue = 0x0155 - TransferRange = 0x0156 - ClipPath = 0x0157 - XClipPathUnits = 0x0158 - YClipPathUnits = 0x0159 - Indexed = 0x015A - JPEGTables = 0x015B - OPIProxy = 0x015F - JPEGProc = 0x0200 - JpegIFOffset = 0x0201 - JpegIFByteCount = 0x0202 - JpegRestartInterval = 0x0203 - JpegLosslessPredictors = 0x0205 - JpegPointTransforms = 0x0206 - JpegQTables = 0x0207 - JpegDCTables = 0x0208 - JpegACTables = 0x0209 - YCbCrCoefficients = 0x0211 - YCbCrSubSampling = 0x0212 - YCbCrPositioning = 0x0213 - ReferenceBlackWhite = 0x0214 - XMLPacket = 0x02BC - RelatedImageFileFormat = 0x1000 - RelatedImageWidth = 0x1001 - RelatedImageLength = 0x1002 - Rating = 0x4746 - RatingPercent = 0x4749 - ImageID = 0x800D - CFARepeatPatternDim = 0x828D - BatteryLevel = 0x828F - Copyright = 0x8298 - ExposureTime = 0x829A - FNumber = 0x829D - IPTCNAA = 0x83BB - ImageResources = 0x8649 - ExifOffset = 0x8769 - InterColorProfile = 0x8773 - ExposureProgram = 0x8822 - SpectralSensitivity = 0x8824 - GPSInfo = 0x8825 - ISOSpeedRatings = 0x8827 - OECF = 0x8828 - Interlace = 0x8829 - TimeZoneOffset = 0x882A - SelfTimerMode = 0x882B - SensitivityType = 0x8830 - StandardOutputSensitivity = 0x8831 - RecommendedExposureIndex = 0x8832 - ISOSpeed = 0x8833 - ISOSpeedLatitudeyyy = 0x8834 - ISOSpeedLatitudezzz = 0x8835 - ExifVersion = 0x9000 - DateTimeOriginal = 0x9003 - DateTimeDigitized = 0x9004 - OffsetTime = 0x9010 - OffsetTimeOriginal = 0x9011 - OffsetTimeDigitized = 0x9012 - ComponentsConfiguration = 0x9101 - CompressedBitsPerPixel = 0x9102 - ShutterSpeedValue = 0x9201 - ApertureValue = 0x9202 - BrightnessValue = 0x9203 - ExposureBiasValue = 0x9204 - MaxApertureValue = 0x9205 - SubjectDistance = 0x9206 - MeteringMode = 0x9207 - LightSource = 0x9208 - Flash = 0x9209 - FocalLength = 0x920A - Noise = 0x920D - ImageNumber = 0x9211 - SecurityClassification = 0x9212 - ImageHistory = 0x9213 - TIFFEPStandardID = 0x9216 - MakerNote = 0x927C - UserComment = 0x9286 - SubsecTime = 0x9290 - SubsecTimeOriginal = 0x9291 - SubsecTimeDigitized = 0x9292 - AmbientTemperature = 0x9400 - Humidity = 0x9401 - Pressure = 0x9402 - WaterDepth = 0x9403 - Acceleration = 0x9404 - CameraElevationAngle = 0x9405 - XPTitle = 0x9C9B - XPComment = 0x9C9C - XPAuthor = 0x9C9D - XPKeywords = 0x9C9E - XPSubject = 0x9C9F - FlashPixVersion = 0xA000 - ColorSpace = 0xA001 - ExifImageWidth = 0xA002 - ExifImageHeight = 0xA003 - RelatedSoundFile = 0xA004 - ExifInteroperabilityOffset = 0xA005 - FlashEnergy = 0xA20B - SpatialFrequencyResponse = 0xA20C - FocalPlaneXResolution = 0xA20E - FocalPlaneYResolution = 0xA20F - FocalPlaneResolutionUnit = 0xA210 - SubjectLocation = 0xA214 - ExposureIndex = 0xA215 - SensingMethod = 0xA217 - FileSource = 0xA300 - SceneType = 0xA301 - CFAPattern = 0xA302 - CustomRendered = 0xA401 - ExposureMode = 0xA402 - WhiteBalance = 0xA403 - DigitalZoomRatio = 0xA404 - FocalLengthIn35mmFilm = 0xA405 - SceneCaptureType = 0xA406 - GainControl = 0xA407 - Contrast = 0xA408 - Saturation = 0xA409 - Sharpness = 0xA40A - DeviceSettingDescription = 0xA40B - SubjectDistanceRange = 0xA40C - ImageUniqueID = 0xA420 - CameraOwnerName = 0xA430 - BodySerialNumber = 0xA431 - LensSpecification = 0xA432 - LensMake = 0xA433 - LensModel = 0xA434 - LensSerialNumber = 0xA435 - CompositeImage = 0xA460 - CompositeImageCount = 0xA461 - CompositeImageExposureTimes = 0xA462 - Gamma = 0xA500 - PrintImageMatching = 0xC4A5 - DNGVersion = 0xC612 - DNGBackwardVersion = 0xC613 - UniqueCameraModel = 0xC614 - LocalizedCameraModel = 0xC615 - CFAPlaneColor = 0xC616 - CFALayout = 0xC617 - LinearizationTable = 0xC618 - BlackLevelRepeatDim = 0xC619 - BlackLevel = 0xC61A - BlackLevelDeltaH = 0xC61B - BlackLevelDeltaV = 0xC61C - WhiteLevel = 0xC61D - DefaultScale = 0xC61E - DefaultCropOrigin = 0xC61F - DefaultCropSize = 0xC620 - ColorMatrix1 = 0xC621 - ColorMatrix2 = 0xC622 - CameraCalibration1 = 0xC623 - CameraCalibration2 = 0xC624 - ReductionMatrix1 = 0xC625 - ReductionMatrix2 = 0xC626 - AnalogBalance = 0xC627 - AsShotNeutral = 0xC628 - AsShotWhiteXY = 0xC629 - BaselineExposure = 0xC62A - BaselineNoise = 0xC62B - BaselineSharpness = 0xC62C - BayerGreenSplit = 0xC62D - LinearResponseLimit = 0xC62E - CameraSerialNumber = 0xC62F - LensInfo = 0xC630 - ChromaBlurRadius = 0xC631 - AntiAliasStrength = 0xC632 - ShadowScale = 0xC633 - DNGPrivateData = 0xC634 - MakerNoteSafety = 0xC635 - CalibrationIlluminant1 = 0xC65A - CalibrationIlluminant2 = 0xC65B - BestQualityScale = 0xC65C - RawDataUniqueID = 0xC65D - OriginalRawFileName = 0xC68B - OriginalRawFileData = 0xC68C - ActiveArea = 0xC68D - MaskedAreas = 0xC68E - AsShotICCProfile = 0xC68F - AsShotPreProfileMatrix = 0xC690 - CurrentICCProfile = 0xC691 - CurrentPreProfileMatrix = 0xC692 - ColorimetricReference = 0xC6BF - CameraCalibrationSignature = 0xC6F3 - ProfileCalibrationSignature = 0xC6F4 - AsShotProfileName = 0xC6F6 - NoiseReductionApplied = 0xC6F7 - ProfileName = 0xC6F8 - ProfileHueSatMapDims = 0xC6F9 - ProfileHueSatMapData1 = 0xC6FA - ProfileHueSatMapData2 = 0xC6FB - ProfileToneCurve = 0xC6FC - ProfileEmbedPolicy = 0xC6FD - ProfileCopyright = 0xC6FE - ForwardMatrix1 = 0xC714 - ForwardMatrix2 = 0xC715 - PreviewApplicationName = 0xC716 - PreviewApplicationVersion = 0xC717 - PreviewSettingsName = 0xC718 - PreviewSettingsDigest = 0xC719 - PreviewColorSpace = 0xC71A - PreviewDateTime = 0xC71B - RawImageDigest = 0xC71C - OriginalRawFileDigest = 0xC71D - SubTileBlockSize = 0xC71E - RowInterleaveFactor = 0xC71F - ProfileLookTableDims = 0xC725 - ProfileLookTableData = 0xC726 - OpcodeList1 = 0xC740 - OpcodeList2 = 0xC741 - OpcodeList3 = 0xC74E - NoiseProfile = 0xC761 - - -"""Maps EXIF tags to tag names.""" -TAGS = { - **{i.value: i.name for i in Base}, - 0x920C: "SpatialFrequencyResponse", - 0x9214: "SubjectLocation", - 0x9215: "ExposureIndex", - 0x828E: "CFAPattern", - 0x920B: "FlashEnergy", - 0x9216: "TIFF/EPStandardID", -} - - -class GPS(IntEnum): - GPSVersionID = 0x00 - GPSLatitudeRef = 0x01 - GPSLatitude = 0x02 - GPSLongitudeRef = 0x03 - GPSLongitude = 0x04 - GPSAltitudeRef = 0x05 - GPSAltitude = 0x06 - GPSTimeStamp = 0x07 - GPSSatellites = 0x08 - GPSStatus = 0x09 - GPSMeasureMode = 0x0A - GPSDOP = 0x0B - GPSSpeedRef = 0x0C - GPSSpeed = 0x0D - GPSTrackRef = 0x0E - GPSTrack = 0x0F - GPSImgDirectionRef = 0x10 - GPSImgDirection = 0x11 - GPSMapDatum = 0x12 - GPSDestLatitudeRef = 0x13 - GPSDestLatitude = 0x14 - GPSDestLongitudeRef = 0x15 - GPSDestLongitude = 0x16 - GPSDestBearingRef = 0x17 - GPSDestBearing = 0x18 - GPSDestDistanceRef = 0x19 - GPSDestDistance = 0x1A - GPSProcessingMethod = 0x1B - GPSAreaInformation = 0x1C - GPSDateStamp = 0x1D - GPSDifferential = 0x1E - GPSHPositioningError = 0x1F - - -"""Maps EXIF GPS tags to tag names.""" -GPSTAGS = {i.value: i.name for i in GPS} - - -class Interop(IntEnum): - InteropIndex = 0x0001 - InteropVersion = 0x0002 - RelatedImageFileFormat = 0x1000 - RelatedImageWidth = 0x1001 - RelatedImageHeight = 0x1002 - - -class IFD(IntEnum): - Exif = 0x8769 - GPSInfo = 0x8825 - MakerNote = 0x927C - Makernote = 0x927C # Deprecated - Interop = 0xA005 - IFD1 = -1 - - -class LightSource(IntEnum): - Unknown = 0x00 - Daylight = 0x01 - Fluorescent = 0x02 - Tungsten = 0x03 - Flash = 0x04 - Fine = 0x09 - Cloudy = 0x0A - Shade = 0x0B - DaylightFluorescent = 0x0C - DayWhiteFluorescent = 0x0D - CoolWhiteFluorescent = 0x0E - WhiteFluorescent = 0x0F - StandardLightA = 0x11 - StandardLightB = 0x12 - StandardLightC = 0x13 - D55 = 0x14 - D65 = 0x15 - D75 = 0x16 - D50 = 0x17 - ISO = 0x18 - Other = 0xFF diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/FitsImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/FitsImagePlugin.py deleted file mode 100644 index a3fdc0e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/FitsImagePlugin.py +++ /dev/null @@ -1,152 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# FITS file handling -# -# Copyright (c) 1998-2003 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import gzip -import math - -from . import Image, ImageFile - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"SIMPLE") - - -class FitsImageFile(ImageFile.ImageFile): - format = "FITS" - format_description = "FITS" - - def _open(self) -> None: - assert self.fp is not None - - headers: dict[bytes, bytes] = {} - header_in_progress = False - decoder_name = "" - while True: - header = self.fp.read(80) - if not header: - msg = "Truncated FITS file" - raise OSError(msg) - keyword = header[:8].strip() - if keyword in (b"SIMPLE", b"XTENSION"): - header_in_progress = True - elif headers and not header_in_progress: - # This is now a data unit - break - elif keyword == b"END": - # Seek to the end of the header unit - self.fp.seek(math.ceil(self.fp.tell() / 2880) * 2880) - if not decoder_name: - decoder_name, offset, args = self._parse_headers(headers) - - header_in_progress = False - continue - - if decoder_name: - # Keep going to read past the headers - continue - - value = header[8:].split(b"/")[0].strip() - if value.startswith(b"="): - value = value[1:].strip() - if not headers and (not _accept(keyword) or value != b"T"): - msg = "Not a FITS file" - raise SyntaxError(msg) - headers[keyword] = value - - if not decoder_name: - msg = "No image data" - raise ValueError(msg) - - offset += self.fp.tell() - 80 - self.tile = [ImageFile._Tile(decoder_name, (0, 0) + self.size, offset, args)] - - def _get_size( - self, headers: dict[bytes, bytes], prefix: bytes - ) -> tuple[int, int] | None: - naxis = int(headers[prefix + b"NAXIS"]) - if naxis == 0: - return None - - if naxis == 1: - return 1, int(headers[prefix + b"NAXIS1"]) - else: - return int(headers[prefix + b"NAXIS1"]), int(headers[prefix + b"NAXIS2"]) - - def _parse_headers( - self, headers: dict[bytes, bytes] - ) -> tuple[str, int, tuple[str | int, ...]]: - prefix = b"" - decoder_name = "raw" - offset = 0 - if ( - headers.get(b"XTENSION") == b"'BINTABLE'" - and headers.get(b"ZIMAGE") == b"T" - and headers[b"ZCMPTYPE"] == b"'GZIP_1 '" - ): - no_prefix_size = self._get_size(headers, prefix) or (0, 0) - number_of_bits = int(headers[b"BITPIX"]) - offset = no_prefix_size[0] * no_prefix_size[1] * (number_of_bits // 8) - - prefix = b"Z" - decoder_name = "fits_gzip" - - size = self._get_size(headers, prefix) - if not size: - return "", 0, () - - self._size = size - - number_of_bits = int(headers[prefix + b"BITPIX"]) - if number_of_bits == 8: - self._mode = "L" - elif number_of_bits == 16: - self._mode = "I;16" - elif number_of_bits == 32: - self._mode = "I" - elif number_of_bits in (-32, -64): - self._mode = "F" - - args: tuple[str | int, ...] - if decoder_name == "raw": - args = (self.mode, 0, -1) - else: - args = (number_of_bits,) - return decoder_name, offset, args - - -class FitsGzipDecoder(ImageFile.PyDecoder): - _pulls_fd = True - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - value = gzip.decompress(self.fd.read()) - - rows = [] - offset = 0 - number_of_bits = min(self.args[0] // 8, 4) - for y in range(self.state.ysize): - row = bytearray() - for x in range(self.state.xsize): - row += value[offset + (4 - number_of_bits) : offset + 4] - offset += 4 - rows.append(row) - self.set_as_raw(bytes([pixel for row in rows[::-1] for pixel in row])) - return -1, 0 - - -# -------------------------------------------------------------------- -# Registry - -Image.register_open(FitsImageFile.format, FitsImageFile, _accept) -Image.register_decoder("fits_gzip", FitsGzipDecoder) - -Image.register_extensions(FitsImageFile.format, [".fit", ".fits"]) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/FliImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/FliImagePlugin.py deleted file mode 100644 index 7c5bfee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/FliImagePlugin.py +++ /dev/null @@ -1,178 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# FLI/FLC file handling. -# -# History: -# 95-09-01 fl Created -# 97-01-03 fl Fixed parser, setup decoder tile -# 98-07-15 fl Renamed offset attribute to avoid name clash -# -# Copyright (c) Secret Labs AB 1997-98. -# Copyright (c) Fredrik Lundh 1995-97. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os - -from . import Image, ImageFile, ImagePalette -from ._binary import i16le as i16 -from ._binary import i32le as i32 -from ._binary import o8 -from ._util import DeferredError - -# -# decoder - - -def _accept(prefix: bytes) -> bool: - return ( - len(prefix) >= 6 - and i16(prefix, 4) in [0xAF11, 0xAF12] - and i16(prefix, 14) in [0, 3] # flags - ) - - -## -# Image plugin for the FLI/FLC animation format. Use the seek -# method to load individual frames. - - -class FliImageFile(ImageFile.ImageFile): - format = "FLI" - format_description = "Autodesk FLI/FLC Animation" - _close_exclusive_fp_after_loading = False - - def _open(self) -> None: - # HEAD - s = self.fp.read(128) - if not (_accept(s) and s[20:22] == b"\x00\x00"): - msg = "not an FLI/FLC file" - raise SyntaxError(msg) - - # frames - self.n_frames = i16(s, 6) - self.is_animated = self.n_frames > 1 - - # image characteristics - self._mode = "P" - self._size = i16(s, 8), i16(s, 10) - - # animation speed - duration = i32(s, 16) - magic = i16(s, 4) - if magic == 0xAF11: - duration = (duration * 1000) // 70 - self.info["duration"] = duration - - # look for palette - palette = [(a, a, a) for a in range(256)] - - s = self.fp.read(16) - - self.__offset = 128 - - if i16(s, 4) == 0xF100: - # prefix chunk; ignore it - self.__offset = self.__offset + i32(s) - self.fp.seek(self.__offset) - s = self.fp.read(16) - - if i16(s, 4) == 0xF1FA: - # look for palette chunk - number_of_subchunks = i16(s, 6) - chunk_size: int | None = None - for _ in range(number_of_subchunks): - if chunk_size is not None: - self.fp.seek(chunk_size - 6, os.SEEK_CUR) - s = self.fp.read(6) - chunk_type = i16(s, 4) - if chunk_type in (4, 11): - self._palette(palette, 2 if chunk_type == 11 else 0) - break - chunk_size = i32(s) - if not chunk_size: - break - - self.palette = ImagePalette.raw( - "RGB", b"".join(o8(r) + o8(g) + o8(b) for (r, g, b) in palette) - ) - - # set things up to decode first frame - self.__frame = -1 - self._fp = self.fp - self.__rewind = self.fp.tell() - self.seek(0) - - def _palette(self, palette: list[tuple[int, int, int]], shift: int) -> None: - # load palette - - i = 0 - for e in range(i16(self.fp.read(2))): - s = self.fp.read(2) - i = i + s[0] - n = s[1] - if n == 0: - n = 256 - s = self.fp.read(n * 3) - for n in range(0, len(s), 3): - r = s[n] << shift - g = s[n + 1] << shift - b = s[n + 2] << shift - palette[i] = (r, g, b) - i += 1 - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - if frame < self.__frame: - self._seek(0) - - for f in range(self.__frame + 1, frame + 1): - self._seek(f) - - def _seek(self, frame: int) -> None: - if isinstance(self._fp, DeferredError): - raise self._fp.ex - if frame == 0: - self.__frame = -1 - self._fp.seek(self.__rewind) - self.__offset = 128 - else: - # ensure that the previous frame was loaded - self.load() - - if frame != self.__frame + 1: - msg = f"cannot seek to frame {frame}" - raise ValueError(msg) - self.__frame = frame - - # move to next frame - self.fp = self._fp - self.fp.seek(self.__offset) - - s = self.fp.read(4) - if not s: - msg = "missing frame size" - raise EOFError(msg) - - framesize = i32(s) - - self.decodermaxblock = framesize - self.tile = [ImageFile._Tile("fli", (0, 0) + self.size, self.__offset)] - - self.__offset += framesize - - def tell(self) -> int: - return self.__frame - - -# -# registry - -Image.register_open(FliImageFile.format, FliImageFile, _accept) - -Image.register_extensions(FliImageFile.format, [".fli", ".flc"]) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/FontFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/FontFile.py deleted file mode 100644 index 1e0c1c1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/FontFile.py +++ /dev/null @@ -1,134 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# base class for raster font file parsers -# -# history: -# 1997-06-05 fl created -# 1997-08-19 fl restrict image width -# -# Copyright (c) 1997-1998 by Secret Labs AB -# Copyright (c) 1997-1998 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -from typing import BinaryIO - -from . import Image, _binary - -WIDTH = 800 - - -def puti16( - fp: BinaryIO, values: tuple[int, int, int, int, int, int, int, int, int, int] -) -> None: - """Write network order (big-endian) 16-bit sequence""" - for v in values: - if v < 0: - v += 65536 - fp.write(_binary.o16be(v)) - - -class FontFile: - """Base class for raster font file handlers.""" - - bitmap: Image.Image | None = None - - def __init__(self) -> None: - self.info: dict[bytes, bytes | int] = {} - self.glyph: list[ - tuple[ - tuple[int, int], - tuple[int, int, int, int], - tuple[int, int, int, int], - Image.Image, - ] - | None - ] = [None] * 256 - - def __getitem__(self, ix: int) -> ( - tuple[ - tuple[int, int], - tuple[int, int, int, int], - tuple[int, int, int, int], - Image.Image, - ] - | None - ): - return self.glyph[ix] - - def compile(self) -> None: - """Create metrics and bitmap""" - - if self.bitmap: - return - - # create bitmap large enough to hold all data - h = w = maxwidth = 0 - lines = 1 - for glyph in self.glyph: - if glyph: - d, dst, src, im = glyph - h = max(h, src[3] - src[1]) - w = w + (src[2] - src[0]) - if w > WIDTH: - lines += 1 - w = src[2] - src[0] - maxwidth = max(maxwidth, w) - - xsize = maxwidth - ysize = lines * h - - if xsize == 0 and ysize == 0: - return - - self.ysize = h - - # paste glyphs into bitmap - self.bitmap = Image.new("1", (xsize, ysize)) - self.metrics: list[ - tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]] - | None - ] = [None] * 256 - x = y = 0 - for i in range(256): - glyph = self[i] - if glyph: - d, dst, src, im = glyph - xx = src[2] - src[0] - x0, y0 = x, y - x = x + xx - if x > WIDTH: - x, y = 0, y + h - x0, y0 = x, y - x = xx - s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0 - self.bitmap.paste(im.crop(src), s) - self.metrics[i] = d, dst, s - - def save(self, filename: str) -> None: - """Save font""" - - self.compile() - - # font data - if not self.bitmap: - msg = "No bitmap created" - raise ValueError(msg) - self.bitmap.save(os.path.splitext(filename)[0] + ".pbm", "PNG") - - # font metrics - with open(os.path.splitext(filename)[0] + ".pil", "wb") as fp: - fp.write(b"PILfont\n") - fp.write(f";;;;;;{self.ysize};\n".encode("ascii")) # HACK!!! - fp.write(b"DATA\n") - for id in range(256): - m = self.metrics[id] - if not m: - puti16(fp, (0,) * 10) - else: - puti16(fp, m[0] + m[1] + m[2]) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/FpxImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/FpxImagePlugin.py deleted file mode 100644 index fd992cd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/FpxImagePlugin.py +++ /dev/null @@ -1,257 +0,0 @@ -# -# THIS IS WORK IN PROGRESS -# -# The Python Imaging Library. -# $Id$ -# -# FlashPix support for PIL -# -# History: -# 97-01-25 fl Created (reads uncompressed RGB images only) -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1997. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import olefile - -from . import Image, ImageFile -from ._binary import i32le as i32 - -# we map from colour field tuples to (mode, rawmode) descriptors -MODES = { - # opacity - (0x00007FFE,): ("A", "L"), - # monochrome - (0x00010000,): ("L", "L"), - (0x00018000, 0x00017FFE): ("RGBA", "LA"), - # photo YCC - (0x00020000, 0x00020001, 0x00020002): ("RGB", "YCC;P"), - (0x00028000, 0x00028001, 0x00028002, 0x00027FFE): ("RGBA", "YCCA;P"), - # standard RGB (NIFRGB) - (0x00030000, 0x00030001, 0x00030002): ("RGB", "RGB"), - (0x00038000, 0x00038001, 0x00038002, 0x00037FFE): ("RGBA", "RGBA"), -} - - -# -# -------------------------------------------------------------------- - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(olefile.MAGIC) - - -## -# Image plugin for the FlashPix images. - - -class FpxImageFile(ImageFile.ImageFile): - format = "FPX" - format_description = "FlashPix" - - def _open(self) -> None: - # - # read the OLE directory and see if this is a likely - # to be a FlashPix file - - try: - self.ole = olefile.OleFileIO(self.fp) - except OSError as e: - msg = "not an FPX file; invalid OLE file" - raise SyntaxError(msg) from e - - root = self.ole.root - if not root or root.clsid != "56616700-C154-11CE-8553-00AA00A1F95B": - msg = "not an FPX file; bad root CLSID" - raise SyntaxError(msg) - - self._open_index(1) - - def _open_index(self, index: int = 1) -> None: - # - # get the Image Contents Property Set - - prop = self.ole.getproperties( - [f"Data Object Store {index:06d}", "\005Image Contents"] - ) - - # size (highest resolution) - - assert isinstance(prop[0x1000002], int) - assert isinstance(prop[0x1000003], int) - self._size = prop[0x1000002], prop[0x1000003] - - size = max(self.size) - i = 1 - while size > 64: - size = size // 2 - i += 1 - self.maxid = i - 1 - - # mode. instead of using a single field for this, flashpix - # requires you to specify the mode for each channel in each - # resolution subimage, and leaves it to the decoder to make - # sure that they all match. for now, we'll cheat and assume - # that this is always the case. - - id = self.maxid << 16 - - s = prop[0x2000002 | id] - - if not isinstance(s, bytes) or (bands := i32(s, 4)) > 4: - msg = "Invalid number of bands" - raise OSError(msg) - - # note: for now, we ignore the "uncalibrated" flag - colors = tuple(i32(s, 8 + i * 4) & 0x7FFFFFFF for i in range(bands)) - - self._mode, self.rawmode = MODES[colors] - - # load JPEG tables, if any - self.jpeg = {} - for i in range(256): - id = 0x3000001 | (i << 16) - if id in prop: - self.jpeg[i] = prop[id] - - self._open_subimage(1, self.maxid) - - def _open_subimage(self, index: int = 1, subimage: int = 0) -> None: - # - # setup tile descriptors for a given subimage - - stream = [ - f"Data Object Store {index:06d}", - f"Resolution {subimage:04d}", - "Subimage 0000 Header", - ] - - fp = self.ole.openstream(stream) - - # skip prefix - fp.read(28) - - # header stream - s = fp.read(36) - - size = i32(s, 4), i32(s, 8) - # tilecount = i32(s, 12) - tilesize = i32(s, 16), i32(s, 20) - # channels = i32(s, 24) - offset = i32(s, 28) - length = i32(s, 32) - - if size != self.size: - msg = "subimage mismatch" - raise OSError(msg) - - # get tile descriptors - fp.seek(28 + offset) - s = fp.read(i32(s, 12) * length) - - x = y = 0 - xsize, ysize = size - xtile, ytile = tilesize - self.tile = [] - - for i in range(0, len(s), length): - x1 = min(xsize, x + xtile) - y1 = min(ysize, y + ytile) - - compression = i32(s, i + 8) - - if compression == 0: - self.tile.append( - ImageFile._Tile( - "raw", - (x, y, x1, y1), - i32(s, i) + 28, - self.rawmode, - ) - ) - - elif compression == 1: - # FIXME: the fill decoder is not implemented - self.tile.append( - ImageFile._Tile( - "fill", - (x, y, x1, y1), - i32(s, i) + 28, - (self.rawmode, s[12:16]), - ) - ) - - elif compression == 2: - internal_color_conversion = s[14] - jpeg_tables = s[15] - rawmode = self.rawmode - - if internal_color_conversion: - # The image is stored as usual (usually YCbCr). - if rawmode == "RGBA": - # For "RGBA", data is stored as YCbCrA based on - # negative RGB. The following trick works around - # this problem : - jpegmode, rawmode = "YCbCrK", "CMYK" - else: - jpegmode = None # let the decoder decide - - else: - # The image is stored as defined by rawmode - jpegmode = rawmode - - self.tile.append( - ImageFile._Tile( - "jpeg", - (x, y, x1, y1), - i32(s, i) + 28, - (rawmode, jpegmode), - ) - ) - - # FIXME: jpeg tables are tile dependent; the prefix - # data must be placed in the tile descriptor itself! - - if jpeg_tables: - self.tile_prefix = self.jpeg[jpeg_tables] - - else: - msg = "unknown/invalid compression" - raise OSError(msg) - - x = x + xtile - if x >= xsize: - x, y = 0, y + ytile - if y >= ysize: - break # isn't really required - - self.stream = stream - self._fp = self.fp - self.fp = None - - def load(self) -> Image.core.PixelAccess | None: - if not self.fp: - self.fp = self.ole.openstream(self.stream[:2] + ["Subimage 0000 Data"]) - - return ImageFile.ImageFile.load(self) - - def close(self) -> None: - self.ole.close() - super().close() - - def __exit__(self, *args: object) -> None: - self.ole.close() - super().__exit__() - - -# -# -------------------------------------------------------------------- - - -Image.register_open(FpxImageFile.format, FpxImageFile, _accept) - -Image.register_extension(FpxImageFile.format, ".fpx") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/FtexImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/FtexImagePlugin.py deleted file mode 100644 index d60e75b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/FtexImagePlugin.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -A Pillow loader for .ftc and .ftu files (FTEX) -Jerome Leclanche - -The contents of this file are hereby released in the public domain (CC0) -Full text of the CC0 license: - https://creativecommons.org/publicdomain/zero/1.0/ - -Independence War 2: Edge Of Chaos - Texture File Format - 16 October 2001 - -The textures used for 3D objects in Independence War 2: Edge Of Chaos are in a -packed custom format called FTEX. This file format uses file extensions FTC -and FTU. -* FTC files are compressed textures (using standard texture compression). -* FTU files are not compressed. -Texture File Format -The FTC and FTU texture files both use the same format. This -has the following structure: -{header} -{format_directory} -{data} -Where: -{header} = { - u32:magic, - u32:version, - u32:width, - u32:height, - u32:mipmap_count, - u32:format_count -} - -* The "magic" number is "FTEX". -* "width" and "height" are the dimensions of the texture. -* "mipmap_count" is the number of mipmaps in the texture. -* "format_count" is the number of texture formats (different versions of the -same texture) in this file. - -{format_directory} = format_count * { u32:format, u32:where } - -The format value is 0 for DXT1 compressed textures and 1 for 24-bit RGB -uncompressed textures. -The texture data for a format starts at the position "where" in the file. - -Each set of texture data in the file has the following structure: -{data} = format_count * { u32:mipmap_size, mipmap_size * { u8 } } -* "mipmap_size" is the number of bytes in that mip level. For compressed -textures this is the size of the texture data compressed with DXT1. For 24 bit -uncompressed textures, this is 3 * width * height. Following this are the image -bytes for that mipmap level. - -Note: All data is stored in little-Endian (Intel) byte order. -""" - -from __future__ import annotations - -import struct -from enum import IntEnum -from io import BytesIO - -from . import Image, ImageFile - -MAGIC = b"FTEX" - - -class Format(IntEnum): - DXT1 = 0 - UNCOMPRESSED = 1 - - -class FtexImageFile(ImageFile.ImageFile): - format = "FTEX" - format_description = "Texture File Format (IW2:EOC)" - - def _open(self) -> None: - if not _accept(self.fp.read(4)): - msg = "not an FTEX file" - raise SyntaxError(msg) - struct.unpack(" None: - pass - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(MAGIC) - - -Image.register_open(FtexImageFile.format, FtexImageFile, _accept) -Image.register_extensions(FtexImageFile.format, [".ftc", ".ftu"]) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/GbrImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/GbrImagePlugin.py deleted file mode 100644 index f319d7e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/GbrImagePlugin.py +++ /dev/null @@ -1,103 +0,0 @@ -# -# The Python Imaging Library -# -# load a GIMP brush file -# -# History: -# 96-03-14 fl Created -# 16-01-08 es Version 2 -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996. -# Copyright (c) Eric Soroos 2016. -# -# See the README file for information on usage and redistribution. -# -# -# See https://github.com/GNOME/gimp/blob/mainline/devel-docs/gbr.txt for -# format documentation. -# -# This code Interprets version 1 and 2 .gbr files. -# Version 1 files are obsolete, and should not be used for new -# brushes. -# Version 2 files are saved by GIMP v2.8 (at least) -# Version 3 files have a format specifier of 18 for 16bit floats in -# the color depth field. This is currently unsupported by Pillow. -from __future__ import annotations - -from . import Image, ImageFile -from ._binary import i32be as i32 - - -def _accept(prefix: bytes) -> bool: - return len(prefix) >= 8 and i32(prefix, 0) >= 20 and i32(prefix, 4) in (1, 2) - - -## -# Image plugin for the GIMP brush format. - - -class GbrImageFile(ImageFile.ImageFile): - format = "GBR" - format_description = "GIMP brush file" - - def _open(self) -> None: - header_size = i32(self.fp.read(4)) - if header_size < 20: - msg = "not a GIMP brush" - raise SyntaxError(msg) - version = i32(self.fp.read(4)) - if version not in (1, 2): - msg = f"Unsupported GIMP brush version: {version}" - raise SyntaxError(msg) - - width = i32(self.fp.read(4)) - height = i32(self.fp.read(4)) - color_depth = i32(self.fp.read(4)) - if width <= 0 or height <= 0: - msg = "not a GIMP brush" - raise SyntaxError(msg) - if color_depth not in (1, 4): - msg = f"Unsupported GIMP brush color depth: {color_depth}" - raise SyntaxError(msg) - - if version == 1: - comment_length = header_size - 20 - else: - comment_length = header_size - 28 - magic_number = self.fp.read(4) - if magic_number != b"GIMP": - msg = "not a GIMP brush, bad magic number" - raise SyntaxError(msg) - self.info["spacing"] = i32(self.fp.read(4)) - - comment = self.fp.read(comment_length)[:-1] - - if color_depth == 1: - self._mode = "L" - else: - self._mode = "RGBA" - - self._size = width, height - - self.info["comment"] = comment - - # Image might not be small - Image._decompression_bomb_check(self.size) - - # Data is an uncompressed block of w * h * bytes/pixel - self._data_size = width * height * color_depth - - def load(self) -> Image.core.PixelAccess | None: - if self._im is None: - self.im = Image.core.new(self.mode, self.size) - self.frombytes(self.fp.read(self._data_size)) - return Image.Image.load(self) - - -# -# registry - - -Image.register_open(GbrImageFile.format, GbrImageFile, _accept) -Image.register_extension(GbrImageFile.format, ".gbr") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/GdImageFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/GdImageFile.py deleted file mode 100644 index 891225c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/GdImageFile.py +++ /dev/null @@ -1,102 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# GD file handling -# -# History: -# 1996-04-12 fl Created -# -# Copyright (c) 1997 by Secret Labs AB. -# Copyright (c) 1996 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# - - -""" -.. note:: - This format cannot be automatically recognized, so the - class is not registered for use with :py:func:`PIL.Image.open()`. To open a - gd file, use the :py:func:`PIL.GdImageFile.open()` function instead. - -.. warning:: - THE GD FORMAT IS NOT DESIGNED FOR DATA INTERCHANGE. This - implementation is provided for convenience and demonstrational - purposes only. -""" -from __future__ import annotations - -from typing import IO - -from . import ImageFile, ImagePalette, UnidentifiedImageError -from ._binary import i16be as i16 -from ._binary import i32be as i32 -from ._typing import StrOrBytesPath - - -class GdImageFile(ImageFile.ImageFile): - """ - Image plugin for the GD uncompressed format. Note that this format - is not supported by the standard :py:func:`PIL.Image.open()` function. To use - this plugin, you have to import the :py:mod:`PIL.GdImageFile` module and - use the :py:func:`PIL.GdImageFile.open()` function. - """ - - format = "GD" - format_description = "GD uncompressed images" - - def _open(self) -> None: - # Header - assert self.fp is not None - - s = self.fp.read(1037) - - if i16(s) not in [65534, 65535]: - msg = "Not a valid GD 2.x .gd file" - raise SyntaxError(msg) - - self._mode = "P" - self._size = i16(s, 2), i16(s, 4) - - true_color = s[6] - true_color_offset = 2 if true_color else 0 - - # transparency index - tindex = i32(s, 7 + true_color_offset) - if tindex < 256: - self.info["transparency"] = tindex - - self.palette = ImagePalette.raw( - "RGBX", s[7 + true_color_offset + 6 : 7 + true_color_offset + 6 + 256 * 4] - ) - - self.tile = [ - ImageFile._Tile( - "raw", - (0, 0) + self.size, - 7 + true_color_offset + 6 + 256 * 4, - "L", - ) - ] - - -def open(fp: StrOrBytesPath | IO[bytes], mode: str = "r") -> GdImageFile: - """ - Load texture from a GD image file. - - :param fp: GD file name, or an opened file handle. - :param mode: Optional mode. In this version, if the mode argument - is given, it must be "r". - :returns: An image instance. - :raises OSError: If the image could not be read. - """ - if mode != "r": - msg = "bad mode" - raise ValueError(msg) - - try: - return GdImageFile(fp) - except SyntaxError as e: - msg = "cannot identify this image file" - raise UnidentifiedImageError(msg) from e diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/GifImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/GifImagePlugin.py deleted file mode 100644 index b03aa7f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/GifImagePlugin.py +++ /dev/null @@ -1,1213 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# GIF file handling -# -# History: -# 1995-09-01 fl Created -# 1996-12-14 fl Added interlace support -# 1996-12-30 fl Added animation support -# 1997-01-05 fl Added write support, fixed local colour map bug -# 1997-02-23 fl Make sure to load raster data in getdata() -# 1997-07-05 fl Support external decoder (0.4) -# 1998-07-09 fl Handle all modes when saving (0.5) -# 1998-07-15 fl Renamed offset attribute to avoid name clash -# 2001-04-16 fl Added rewind support (seek to frame 0) (0.6) -# 2001-04-17 fl Added palette optimization (0.7) -# 2002-06-06 fl Added transparency support for save (0.8) -# 2004-02-24 fl Disable interlacing for small images -# -# Copyright (c) 1997-2004 by Secret Labs AB -# Copyright (c) 1995-2004 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import itertools -import math -import os -import subprocess -from enum import IntEnum -from functools import cached_property -from typing import IO, Any, Literal, NamedTuple, Union, cast - -from . import ( - Image, - ImageChops, - ImageFile, - ImageMath, - ImageOps, - ImagePalette, - ImageSequence, -) -from ._binary import i16le as i16 -from ._binary import o8 -from ._binary import o16le as o16 -from ._util import DeferredError - -TYPE_CHECKING = False -if TYPE_CHECKING: - from . import _imaging - from ._typing import Buffer - - -class LoadingStrategy(IntEnum): - """.. versionadded:: 9.1.0""" - - RGB_AFTER_FIRST = 0 - RGB_AFTER_DIFFERENT_PALETTE_ONLY = 1 - RGB_ALWAYS = 2 - - -#: .. versionadded:: 9.1.0 -LOADING_STRATEGY = LoadingStrategy.RGB_AFTER_FIRST - -# -------------------------------------------------------------------- -# Identify/read GIF files - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith((b"GIF87a", b"GIF89a")) - - -## -# Image plugin for GIF images. This plugin supports both GIF87 and -# GIF89 images. - - -class GifImageFile(ImageFile.ImageFile): - format = "GIF" - format_description = "Compuserve GIF" - _close_exclusive_fp_after_loading = False - - global_palette = None - - def data(self) -> bytes | None: - s = self.fp.read(1) - if s and s[0]: - return self.fp.read(s[0]) - return None - - def _is_palette_needed(self, p: bytes) -> bool: - for i in range(0, len(p), 3): - if not (i // 3 == p[i] == p[i + 1] == p[i + 2]): - return True - return False - - def _open(self) -> None: - # Screen - s = self.fp.read(13) - if not _accept(s): - msg = "not a GIF file" - raise SyntaxError(msg) - - self.info["version"] = s[:6] - self._size = i16(s, 6), i16(s, 8) - flags = s[10] - bits = (flags & 7) + 1 - - if flags & 128: - # get global palette - self.info["background"] = s[11] - # check if palette contains colour indices - p = self.fp.read(3 << bits) - if self._is_palette_needed(p): - p = ImagePalette.raw("RGB", p) - self.global_palette = self.palette = p - - self._fp = self.fp # FIXME: hack - self.__rewind = self.fp.tell() - self._n_frames: int | None = None - self._seek(0) # get ready to read first frame - - @property - def n_frames(self) -> int: - if self._n_frames is None: - current = self.tell() - try: - while True: - self._seek(self.tell() + 1, False) - except EOFError: - self._n_frames = self.tell() + 1 - self.seek(current) - return self._n_frames - - @cached_property - def is_animated(self) -> bool: - if self._n_frames is not None: - return self._n_frames != 1 - - current = self.tell() - if current: - return True - - try: - self._seek(1, False) - is_animated = True - except EOFError: - is_animated = False - - self.seek(current) - return is_animated - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - if frame < self.__frame: - self._im = None - self._seek(0) - - last_frame = self.__frame - for f in range(self.__frame + 1, frame + 1): - try: - self._seek(f) - except EOFError as e: - self.seek(last_frame) - msg = "no more images in GIF file" - raise EOFError(msg) from e - - def _seek(self, frame: int, update_image: bool = True) -> None: - if isinstance(self._fp, DeferredError): - raise self._fp.ex - if frame == 0: - # rewind - self.__offset = 0 - self.dispose: _imaging.ImagingCore | None = None - self.__frame = -1 - self._fp.seek(self.__rewind) - self.disposal_method = 0 - if "comment" in self.info: - del self.info["comment"] - else: - # ensure that the previous frame was loaded - if self.tile and update_image: - self.load() - - if frame != self.__frame + 1: - msg = f"cannot seek to frame {frame}" - raise ValueError(msg) - - self.fp = self._fp - if self.__offset: - # backup to last frame - self.fp.seek(self.__offset) - while self.data(): - pass - self.__offset = 0 - - s = self.fp.read(1) - if not s or s == b";": - msg = "no more images in GIF file" - raise EOFError(msg) - - palette: ImagePalette.ImagePalette | Literal[False] | None = None - - info: dict[str, Any] = {} - frame_transparency = None - interlace = None - frame_dispose_extent = None - while True: - if not s: - s = self.fp.read(1) - if not s or s == b";": - break - - elif s == b"!": - # - # extensions - # - s = self.fp.read(1) - block = self.data() - if s[0] == 249 and block is not None: - # - # graphic control extension - # - flags = block[0] - if flags & 1: - frame_transparency = block[3] - info["duration"] = i16(block, 1) * 10 - - # disposal method - find the value of bits 4 - 6 - dispose_bits = 0b00011100 & flags - dispose_bits = dispose_bits >> 2 - if dispose_bits: - # only set the dispose if it is not - # unspecified. I'm not sure if this is - # correct, but it seems to prevent the last - # frame from looking odd for some animations - self.disposal_method = dispose_bits - elif s[0] == 254: - # - # comment extension - # - comment = b"" - - # Read this comment block - while block: - comment += block - block = self.data() - - if "comment" in info: - # If multiple comment blocks in frame, separate with \n - info["comment"] += b"\n" + comment - else: - info["comment"] = comment - s = None - continue - elif s[0] == 255 and frame == 0 and block is not None: - # - # application extension - # - info["extension"] = block, self.fp.tell() - if block.startswith(b"NETSCAPE2.0"): - block = self.data() - if block and len(block) >= 3 and block[0] == 1: - self.info["loop"] = i16(block, 1) - while self.data(): - pass - - elif s == b",": - # - # local image - # - s = self.fp.read(9) - - # extent - x0, y0 = i16(s, 0), i16(s, 2) - x1, y1 = x0 + i16(s, 4), y0 + i16(s, 6) - if (x1 > self.size[0] or y1 > self.size[1]) and update_image: - self._size = max(x1, self.size[0]), max(y1, self.size[1]) - Image._decompression_bomb_check(self._size) - frame_dispose_extent = x0, y0, x1, y1 - flags = s[8] - - interlace = (flags & 64) != 0 - - if flags & 128: - bits = (flags & 7) + 1 - p = self.fp.read(3 << bits) - if self._is_palette_needed(p): - palette = ImagePalette.raw("RGB", p) - else: - palette = False - - # image data - bits = self.fp.read(1)[0] - self.__offset = self.fp.tell() - break - s = None - - if interlace is None: - msg = "image not found in GIF frame" - raise EOFError(msg) - - self.__frame = frame - if not update_image: - return - - self.tile = [] - - if self.dispose: - self.im.paste(self.dispose, self.dispose_extent) - - self._frame_palette = palette if palette is not None else self.global_palette - self._frame_transparency = frame_transparency - if frame == 0: - if self._frame_palette: - if LOADING_STRATEGY == LoadingStrategy.RGB_ALWAYS: - self._mode = "RGBA" if frame_transparency is not None else "RGB" - else: - self._mode = "P" - else: - self._mode = "L" - - if palette: - self.palette = palette - elif self.global_palette: - from copy import copy - - self.palette = copy(self.global_palette) - else: - self.palette = None - else: - if self.mode == "P": - if ( - LOADING_STRATEGY != LoadingStrategy.RGB_AFTER_DIFFERENT_PALETTE_ONLY - or palette - ): - if "transparency" in self.info: - self.im.putpalettealpha(self.info["transparency"], 0) - self.im = self.im.convert("RGBA", Image.Dither.FLOYDSTEINBERG) - self._mode = "RGBA" - del self.info["transparency"] - else: - self._mode = "RGB" - self.im = self.im.convert("RGB", Image.Dither.FLOYDSTEINBERG) - - def _rgb(color: int) -> tuple[int, int, int]: - if self._frame_palette: - if color * 3 + 3 > len(self._frame_palette.palette): - color = 0 - return cast( - tuple[int, int, int], - tuple(self._frame_palette.palette[color * 3 : color * 3 + 3]), - ) - else: - return (color, color, color) - - self.dispose = None - self.dispose_extent: tuple[int, int, int, int] | None = frame_dispose_extent - if self.dispose_extent and self.disposal_method >= 2: - try: - if self.disposal_method == 2: - # replace with background colour - - # only dispose the extent in this frame - x0, y0, x1, y1 = self.dispose_extent - dispose_size = (x1 - x0, y1 - y0) - - Image._decompression_bomb_check(dispose_size) - - # by convention, attempt to use transparency first - dispose_mode = "P" - color = self.info.get("transparency", frame_transparency) - if color is not None: - if self.mode in ("RGB", "RGBA"): - dispose_mode = "RGBA" - color = _rgb(color) + (0,) - else: - color = self.info.get("background", 0) - if self.mode in ("RGB", "RGBA"): - dispose_mode = "RGB" - color = _rgb(color) - self.dispose = Image.core.fill(dispose_mode, dispose_size, color) - else: - # replace with previous contents - if self._im is not None: - # only dispose the extent in this frame - self.dispose = self._crop(self.im, self.dispose_extent) - elif frame_transparency is not None: - x0, y0, x1, y1 = self.dispose_extent - dispose_size = (x1 - x0, y1 - y0) - - Image._decompression_bomb_check(dispose_size) - dispose_mode = "P" - color = frame_transparency - if self.mode in ("RGB", "RGBA"): - dispose_mode = "RGBA" - color = _rgb(frame_transparency) + (0,) - self.dispose = Image.core.fill( - dispose_mode, dispose_size, color - ) - except AttributeError: - pass - - if interlace is not None: - transparency = -1 - if frame_transparency is not None: - if frame == 0: - if LOADING_STRATEGY != LoadingStrategy.RGB_ALWAYS: - self.info["transparency"] = frame_transparency - elif self.mode not in ("RGB", "RGBA"): - transparency = frame_transparency - self.tile = [ - ImageFile._Tile( - "gif", - (x0, y0, x1, y1), - self.__offset, - (bits, interlace, transparency), - ) - ] - - if info.get("comment"): - self.info["comment"] = info["comment"] - for k in ["duration", "extension"]: - if k in info: - self.info[k] = info[k] - elif k in self.info: - del self.info[k] - - def load_prepare(self) -> None: - temp_mode = "P" if self._frame_palette else "L" - self._prev_im = None - if self.__frame == 0: - if self._frame_transparency is not None: - self.im = Image.core.fill( - temp_mode, self.size, self._frame_transparency - ) - elif self.mode in ("RGB", "RGBA"): - self._prev_im = self.im - if self._frame_palette: - self.im = Image.core.fill("P", self.size, self._frame_transparency or 0) - self.im.putpalette("RGB", *self._frame_palette.getdata()) - else: - self._im = None - if not self._prev_im and self._im is not None and self.size != self.im.size: - expanded_im = Image.core.fill(self.im.mode, self.size) - if self._frame_palette: - expanded_im.putpalette("RGB", *self._frame_palette.getdata()) - expanded_im.paste(self.im, (0, 0) + self.im.size) - - self.im = expanded_im - self._mode = temp_mode - self._frame_palette = None - - super().load_prepare() - - def load_end(self) -> None: - if self.__frame == 0: - if self.mode == "P" and LOADING_STRATEGY == LoadingStrategy.RGB_ALWAYS: - if self._frame_transparency is not None: - self.im.putpalettealpha(self._frame_transparency, 0) - self._mode = "RGBA" - else: - self._mode = "RGB" - self.im = self.im.convert(self.mode, Image.Dither.FLOYDSTEINBERG) - return - if not self._prev_im: - return - if self.size != self._prev_im.size: - if self._frame_transparency is not None: - expanded_im = Image.core.fill("RGBA", self.size) - else: - expanded_im = Image.core.fill("P", self.size) - expanded_im.putpalette("RGB", "RGB", self.im.getpalette()) - expanded_im = expanded_im.convert("RGB") - expanded_im.paste(self._prev_im, (0, 0) + self._prev_im.size) - - self._prev_im = expanded_im - assert self._prev_im is not None - if self._frame_transparency is not None: - if self.mode == "L": - frame_im = self.im.convert_transparent("LA", self._frame_transparency) - else: - self.im.putpalettealpha(self._frame_transparency, 0) - frame_im = self.im.convert("RGBA") - else: - frame_im = self.im.convert("RGB") - - assert self.dispose_extent is not None - frame_im = self._crop(frame_im, self.dispose_extent) - - self.im = self._prev_im - self._mode = self.im.mode - if frame_im.mode in ("LA", "RGBA"): - self.im.paste(frame_im, self.dispose_extent, frame_im) - else: - self.im.paste(frame_im, self.dispose_extent) - - def tell(self) -> int: - return self.__frame - - -# -------------------------------------------------------------------- -# Write GIF files - - -RAWMODE = {"1": "L", "L": "L", "P": "P"} - - -def _normalize_mode(im: Image.Image) -> Image.Image: - """ - Takes an image (or frame), returns an image in a mode that is appropriate - for saving in a Gif. - - It may return the original image, or it may return an image converted to - palette or 'L' mode. - - :param im: Image object - :returns: Image object - """ - if im.mode in RAWMODE: - im.load() - return im - if Image.getmodebase(im.mode) == "RGB": - im = im.convert("P", palette=Image.Palette.ADAPTIVE) - assert im.palette is not None - if im.palette.mode == "RGBA": - for rgba in im.palette.colors: - if rgba[3] == 0: - im.info["transparency"] = im.palette.colors[rgba] - break - return im - return im.convert("L") - - -_Palette = Union[bytes, bytearray, list[int], ImagePalette.ImagePalette] - - -def _normalize_palette( - im: Image.Image, palette: _Palette | None, info: dict[str, Any] -) -> Image.Image: - """ - Normalizes the palette for image. - - Sets the palette to the incoming palette, if provided. - - Ensures that there's a palette for L mode images - - Optimizes the palette if necessary/desired. - - :param im: Image object - :param palette: bytes object containing the source palette, or .... - :param info: encoderinfo - :returns: Image object - """ - source_palette = None - if palette: - # a bytes palette - if isinstance(palette, (bytes, bytearray, list)): - source_palette = bytearray(palette[:768]) - if isinstance(palette, ImagePalette.ImagePalette): - source_palette = bytearray(palette.palette) - - if im.mode == "P": - if not source_palette: - im_palette = im.getpalette(None) - assert im_palette is not None - source_palette = bytearray(im_palette) - else: # L-mode - if not source_palette: - source_palette = bytearray(i // 3 for i in range(768)) - im.palette = ImagePalette.ImagePalette("RGB", palette=source_palette) - assert source_palette is not None - - if palette: - used_palette_colors: list[int | None] = [] - assert im.palette is not None - for i in range(0, len(source_palette), 3): - source_color = tuple(source_palette[i : i + 3]) - index = im.palette.colors.get(source_color) - if index in used_palette_colors: - index = None - used_palette_colors.append(index) - for i, index in enumerate(used_palette_colors): - if index is None: - for j in range(len(used_palette_colors)): - if j not in used_palette_colors: - used_palette_colors[i] = j - break - dest_map: list[int] = [] - for index in used_palette_colors: - assert index is not None - dest_map.append(index) - im = im.remap_palette(dest_map) - else: - optimized_palette_colors = _get_optimize(im, info) - if optimized_palette_colors is not None: - im = im.remap_palette(optimized_palette_colors, source_palette) - if "transparency" in info: - try: - info["transparency"] = optimized_palette_colors.index( - info["transparency"] - ) - except ValueError: - del info["transparency"] - return im - - assert im.palette is not None - im.palette.palette = source_palette - return im - - -def _write_single_frame( - im: Image.Image, - fp: IO[bytes], - palette: _Palette | None, -) -> None: - im_out = _normalize_mode(im) - for k, v in im_out.info.items(): - if isinstance(k, str): - im.encoderinfo.setdefault(k, v) - im_out = _normalize_palette(im_out, palette, im.encoderinfo) - - for s in _get_global_header(im_out, im.encoderinfo): - fp.write(s) - - # local image header - flags = 0 - if get_interlace(im): - flags = flags | 64 - _write_local_header(fp, im, (0, 0), flags) - - im_out.encoderconfig = (8, get_interlace(im)) - ImageFile._save( - im_out, fp, [ImageFile._Tile("gif", (0, 0) + im.size, 0, RAWMODE[im_out.mode])] - ) - - fp.write(b"\0") # end of image data - - -def _getbbox( - base_im: Image.Image, im_frame: Image.Image -) -> tuple[Image.Image, tuple[int, int, int, int] | None]: - palette_bytes = [ - bytes(im.palette.palette) if im.palette else b"" for im in (base_im, im_frame) - ] - if palette_bytes[0] != palette_bytes[1]: - im_frame = im_frame.convert("RGBA") - base_im = base_im.convert("RGBA") - delta = ImageChops.subtract_modulo(im_frame, base_im) - return delta, delta.getbbox(alpha_only=False) - - -class _Frame(NamedTuple): - im: Image.Image - bbox: tuple[int, int, int, int] | None - encoderinfo: dict[str, Any] - - -def _write_multiple_frames( - im: Image.Image, fp: IO[bytes], palette: _Palette | None -) -> bool: - duration = im.encoderinfo.get("duration") - disposal = im.encoderinfo.get("disposal", im.info.get("disposal")) - - im_frames: list[_Frame] = [] - previous_im: Image.Image | None = None - frame_count = 0 - background_im = None - for imSequence in itertools.chain([im], im.encoderinfo.get("append_images", [])): - for im_frame in ImageSequence.Iterator(imSequence): - # a copy is required here since seek can still mutate the image - im_frame = _normalize_mode(im_frame.copy()) - if frame_count == 0: - for k, v in im_frame.info.items(): - if k == "transparency": - continue - if isinstance(k, str): - im.encoderinfo.setdefault(k, v) - - encoderinfo = im.encoderinfo.copy() - if "transparency" in im_frame.info: - encoderinfo.setdefault("transparency", im_frame.info["transparency"]) - im_frame = _normalize_palette(im_frame, palette, encoderinfo) - if isinstance(duration, (list, tuple)): - encoderinfo["duration"] = duration[frame_count] - elif duration is None and "duration" in im_frame.info: - encoderinfo["duration"] = im_frame.info["duration"] - if isinstance(disposal, (list, tuple)): - encoderinfo["disposal"] = disposal[frame_count] - frame_count += 1 - - diff_frame = None - if im_frames and previous_im: - # delta frame - delta, bbox = _getbbox(previous_im, im_frame) - if not bbox: - # This frame is identical to the previous frame - if encoderinfo.get("duration"): - im_frames[-1].encoderinfo["duration"] += encoderinfo["duration"] - continue - if im_frames[-1].encoderinfo.get("disposal") == 2: - # To appear correctly in viewers using a convention, - # only consider transparency, and not background color - color = im.encoderinfo.get( - "transparency", im.info.get("transparency") - ) - if color is not None: - if background_im is None: - background = _get_background(im_frame, color) - background_im = Image.new("P", im_frame.size, background) - first_palette = im_frames[0].im.palette - assert first_palette is not None - background_im.putpalette(first_palette, first_palette.mode) - bbox = _getbbox(background_im, im_frame)[1] - else: - bbox = (0, 0) + im_frame.size - elif encoderinfo.get("optimize") and im_frame.mode != "1": - if "transparency" not in encoderinfo: - assert im_frame.palette is not None - try: - encoderinfo["transparency"] = ( - im_frame.palette._new_color_index(im_frame) - ) - except ValueError: - pass - if "transparency" in encoderinfo: - # When the delta is zero, fill the image with transparency - diff_frame = im_frame.copy() - fill = Image.new("P", delta.size, encoderinfo["transparency"]) - if delta.mode == "RGBA": - r, g, b, a = delta.split() - mask = ImageMath.lambda_eval( - lambda args: args["convert"]( - args["max"]( - args["max"]( - args["max"](args["r"], args["g"]), args["b"] - ), - args["a"], - ) - * 255, - "1", - ), - r=r, - g=g, - b=b, - a=a, - ) - else: - if delta.mode == "P": - # Convert to L without considering palette - delta_l = Image.new("L", delta.size) - delta_l.putdata(delta.getdata()) - delta = delta_l - mask = ImageMath.lambda_eval( - lambda args: args["convert"](args["im"] * 255, "1"), - im=delta, - ) - diff_frame.paste(fill, mask=ImageOps.invert(mask)) - else: - bbox = None - previous_im = im_frame - im_frames.append(_Frame(diff_frame or im_frame, bbox, encoderinfo)) - - if len(im_frames) == 1: - if "duration" in im.encoderinfo: - # Since multiple frames will not be written, use the combined duration - im.encoderinfo["duration"] = im_frames[0].encoderinfo["duration"] - return False - - for frame_data in im_frames: - im_frame = frame_data.im - if not frame_data.bbox: - # global header - for s in _get_global_header(im_frame, frame_data.encoderinfo): - fp.write(s) - offset = (0, 0) - else: - # compress difference - if not palette: - frame_data.encoderinfo["include_color_table"] = True - - if frame_data.bbox != (0, 0) + im_frame.size: - im_frame = im_frame.crop(frame_data.bbox) - offset = frame_data.bbox[:2] - _write_frame_data(fp, im_frame, offset, frame_data.encoderinfo) - return True - - -def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - _save(im, fp, filename, save_all=True) - - -def _save( - im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False -) -> None: - # header - if "palette" in im.encoderinfo or "palette" in im.info: - palette = im.encoderinfo.get("palette", im.info.get("palette")) - else: - palette = None - im.encoderinfo.setdefault("optimize", True) - - if not save_all or not _write_multiple_frames(im, fp, palette): - _write_single_frame(im, fp, palette) - - fp.write(b";") # end of file - - if hasattr(fp, "flush"): - fp.flush() - - -def get_interlace(im: Image.Image) -> int: - interlace = im.encoderinfo.get("interlace", 1) - - # workaround for @PIL153 - if min(im.size) < 16: - interlace = 0 - - return interlace - - -def _write_local_header( - fp: IO[bytes], im: Image.Image, offset: tuple[int, int], flags: int -) -> None: - try: - transparency = im.encoderinfo["transparency"] - except KeyError: - transparency = None - - if "duration" in im.encoderinfo: - duration = int(im.encoderinfo["duration"] / 10) - else: - duration = 0 - - disposal = int(im.encoderinfo.get("disposal", 0)) - - if transparency is not None or duration != 0 or disposal: - packed_flag = 1 if transparency is not None else 0 - packed_flag |= disposal << 2 - - fp.write( - b"!" - + o8(249) # extension intro - + o8(4) # length - + o8(packed_flag) # packed fields - + o16(duration) # duration - + o8(transparency or 0) # transparency index - + o8(0) - ) - - include_color_table = im.encoderinfo.get("include_color_table") - if include_color_table: - palette_bytes = _get_palette_bytes(im) - color_table_size = _get_color_table_size(palette_bytes) - if color_table_size: - flags = flags | 128 # local color table flag - flags = flags | color_table_size - - fp.write( - b"," - + o16(offset[0]) # offset - + o16(offset[1]) - + o16(im.size[0]) # size - + o16(im.size[1]) - + o8(flags) # flags - ) - if include_color_table and color_table_size: - fp.write(_get_header_palette(palette_bytes)) - fp.write(o8(8)) # bits - - -def _save_netpbm(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - # Unused by default. - # To use, uncomment the register_save call at the end of the file. - # - # If you need real GIF compression and/or RGB quantization, you - # can use the external NETPBM/PBMPLUS utilities. See comments - # below for information on how to enable this. - tempfile = im._dump() - - try: - with open(filename, "wb") as f: - if im.mode != "RGB": - subprocess.check_call( - ["ppmtogif", tempfile], stdout=f, stderr=subprocess.DEVNULL - ) - else: - # Pipe ppmquant output into ppmtogif - # "ppmquant 256 %s | ppmtogif > %s" % (tempfile, filename) - quant_cmd = ["ppmquant", "256", tempfile] - togif_cmd = ["ppmtogif"] - quant_proc = subprocess.Popen( - quant_cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL - ) - togif_proc = subprocess.Popen( - togif_cmd, - stdin=quant_proc.stdout, - stdout=f, - stderr=subprocess.DEVNULL, - ) - - # Allow ppmquant to receive SIGPIPE if ppmtogif exits - assert quant_proc.stdout is not None - quant_proc.stdout.close() - - retcode = quant_proc.wait() - if retcode: - raise subprocess.CalledProcessError(retcode, quant_cmd) - - retcode = togif_proc.wait() - if retcode: - raise subprocess.CalledProcessError(retcode, togif_cmd) - finally: - try: - os.unlink(tempfile) - except OSError: - pass - - -# Force optimization so that we can test performance against -# cases where it took lots of memory and time previously. -_FORCE_OPTIMIZE = False - - -def _get_optimize(im: Image.Image, info: dict[str, Any]) -> list[int] | None: - """ - Palette optimization is a potentially expensive operation. - - This function determines if the palette should be optimized using - some heuristics, then returns the list of palette entries in use. - - :param im: Image object - :param info: encoderinfo - :returns: list of indexes of palette entries in use, or None - """ - if im.mode in ("P", "L") and info and info.get("optimize"): - # Potentially expensive operation. - - # The palette saves 3 bytes per color not used, but palette - # lengths are restricted to 3*(2**N) bytes. Max saving would - # be 768 -> 6 bytes if we went all the way down to 2 colors. - # * If we're over 128 colors, we can't save any space. - # * If there aren't any holes, it's not worth collapsing. - # * If we have a 'large' image, the palette is in the noise. - - # create the new palette if not every color is used - optimise = _FORCE_OPTIMIZE or im.mode == "L" - if optimise or im.width * im.height < 512 * 512: - # check which colors are used - used_palette_colors = [] - for i, count in enumerate(im.histogram()): - if count: - used_palette_colors.append(i) - - if optimise or max(used_palette_colors) >= len(used_palette_colors): - return used_palette_colors - - assert im.palette is not None - num_palette_colors = len(im.palette.palette) // Image.getmodebands( - im.palette.mode - ) - current_palette_size = 1 << (num_palette_colors - 1).bit_length() - if ( - # check that the palette would become smaller when saved - len(used_palette_colors) <= current_palette_size // 2 - # check that the palette is not already the smallest possible size - and current_palette_size > 2 - ): - return used_palette_colors - return None - - -def _get_color_table_size(palette_bytes: bytes) -> int: - # calculate the palette size for the header - if not palette_bytes: - return 0 - elif len(palette_bytes) < 9: - return 1 - else: - return math.ceil(math.log(len(palette_bytes) // 3, 2)) - 1 - - -def _get_header_palette(palette_bytes: bytes) -> bytes: - """ - Returns the palette, null padded to the next power of 2 (*3) bytes - suitable for direct inclusion in the GIF header - - :param palette_bytes: Unpadded palette bytes, in RGBRGB form - :returns: Null padded palette - """ - color_table_size = _get_color_table_size(palette_bytes) - - # add the missing amount of bytes - # the palette has to be 2< 0: - palette_bytes += o8(0) * 3 * actual_target_size_diff - return palette_bytes - - -def _get_palette_bytes(im: Image.Image) -> bytes: - """ - Gets the palette for inclusion in the gif header - - :param im: Image object - :returns: Bytes, len<=768 suitable for inclusion in gif header - """ - if not im.palette: - return b"" - - palette = bytes(im.palette.palette) - if im.palette.mode == "RGBA": - palette = b"".join(palette[i * 4 : i * 4 + 3] for i in range(len(palette) // 3)) - return palette - - -def _get_background( - im: Image.Image, - info_background: int | tuple[int, int, int] | tuple[int, int, int, int] | None, -) -> int: - background = 0 - if info_background: - if isinstance(info_background, tuple): - # WebPImagePlugin stores an RGBA value in info["background"] - # So it must be converted to the same format as GifImagePlugin's - # info["background"] - a global color table index - assert im.palette is not None - try: - background = im.palette.getcolor(info_background, im) - except ValueError as e: - if str(e) not in ( - # If all 256 colors are in use, - # then there is no need for the background color - "cannot allocate more than 256 colors", - # Ignore non-opaque WebP background - "cannot add non-opaque RGBA color to RGB palette", - ): - raise - else: - background = info_background - return background - - -def _get_global_header(im: Image.Image, info: dict[str, Any]) -> list[bytes]: - """Return a list of strings representing a GIF header""" - - # Header Block - # https://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp - - version = b"87a" - if im.info.get("version") == b"89a" or ( - info - and ( - "transparency" in info - or info.get("loop") is not None - or info.get("duration") - or info.get("comment") - ) - ): - version = b"89a" - - background = _get_background(im, info.get("background")) - - palette_bytes = _get_palette_bytes(im) - color_table_size = _get_color_table_size(palette_bytes) - - header = [ - b"GIF" # signature - + version # version - + o16(im.size[0]) # canvas width - + o16(im.size[1]), # canvas height - # Logical Screen Descriptor - # size of global color table + global color table flag - o8(color_table_size + 128), # packed fields - # background + reserved/aspect - o8(background) + o8(0), - # Global Color Table - _get_header_palette(palette_bytes), - ] - if info.get("loop") is not None: - header.append( - b"!" - + o8(255) # extension intro - + o8(11) - + b"NETSCAPE2.0" - + o8(3) - + o8(1) - + o16(info["loop"]) # number of loops - + o8(0) - ) - if info.get("comment"): - comment_block = b"!" + o8(254) # extension intro - - comment = info["comment"] - if isinstance(comment, str): - comment = comment.encode() - for i in range(0, len(comment), 255): - subblock = comment[i : i + 255] - comment_block += o8(len(subblock)) + subblock - - comment_block += o8(0) - header.append(comment_block) - return header - - -def _write_frame_data( - fp: IO[bytes], - im_frame: Image.Image, - offset: tuple[int, int], - params: dict[str, Any], -) -> None: - try: - im_frame.encoderinfo = params - - # local image header - _write_local_header(fp, im_frame, offset, 0) - - ImageFile._save( - im_frame, - fp, - [ImageFile._Tile("gif", (0, 0) + im_frame.size, 0, RAWMODE[im_frame.mode])], - ) - - fp.write(b"\0") # end of image data - finally: - del im_frame.encoderinfo - - -# -------------------------------------------------------------------- -# Legacy GIF utilities - - -def getheader( - im: Image.Image, palette: _Palette | None = None, info: dict[str, Any] | None = None -) -> tuple[list[bytes], list[int] | None]: - """ - Legacy Method to get Gif data from image. - - Warning:: May modify image data. - - :param im: Image object - :param palette: bytes object containing the source palette, or .... - :param info: encoderinfo - :returns: tuple of(list of header items, optimized palette) - - """ - if info is None: - info = {} - - used_palette_colors = _get_optimize(im, info) - - if "background" not in info and "background" in im.info: - info["background"] = im.info["background"] - - im_mod = _normalize_palette(im, palette, info) - im.palette = im_mod.palette - im.im = im_mod.im - header = _get_global_header(im, info) - - return header, used_palette_colors - - -def getdata( - im: Image.Image, offset: tuple[int, int] = (0, 0), **params: Any -) -> list[bytes]: - """ - Legacy Method - - Return a list of strings representing this image. - The first string is a local image header, the rest contains - encoded image data. - - To specify duration, add the time in milliseconds, - e.g. ``getdata(im_frame, duration=1000)`` - - :param im: Image object - :param offset: Tuple of (x, y) pixels. Defaults to (0, 0) - :param \\**params: e.g. duration or other encoder info parameters - :returns: List of bytes containing GIF encoded frame data - - """ - from io import BytesIO - - class Collector(BytesIO): - data = [] - - def write(self, data: Buffer) -> int: - self.data.append(data) - return len(data) - - im.load() # make sure raster data is available - - fp = Collector() - - _write_frame_data(fp, im, offset, params) - - return fp.data - - -# -------------------------------------------------------------------- -# Registry - -Image.register_open(GifImageFile.format, GifImageFile, _accept) -Image.register_save(GifImageFile.format, _save) -Image.register_save_all(GifImageFile.format, _save_all) -Image.register_extension(GifImageFile.format, ".gif") -Image.register_mime(GifImageFile.format, "image/gif") - -# -# Uncomment the following line if you wish to use NETPBM/PBMPLUS -# instead of the built-in "uncompressed" GIF encoder - -# Image.register_save(GifImageFile.format, _save_netpbm) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/GimpGradientFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/GimpGradientFile.py deleted file mode 100644 index ec62f8e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/GimpGradientFile.py +++ /dev/null @@ -1,149 +0,0 @@ -# -# Python Imaging Library -# $Id$ -# -# stuff to read (and render) GIMP gradient files -# -# History: -# 97-08-23 fl Created -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1997. -# -# See the README file for information on usage and redistribution. -# - -""" -Stuff to translate curve segments to palette values (derived from -the corresponding code in GIMP, written by Federico Mena Quintero. -See the GIMP distribution for more information.) -""" -from __future__ import annotations - -from math import log, pi, sin, sqrt -from typing import IO, Callable - -from ._binary import o8 - -EPSILON = 1e-10 -"""""" # Enable auto-doc for data member - - -def linear(middle: float, pos: float) -> float: - if pos <= middle: - if middle < EPSILON: - return 0.0 - else: - return 0.5 * pos / middle - else: - pos = pos - middle - middle = 1.0 - middle - if middle < EPSILON: - return 1.0 - else: - return 0.5 + 0.5 * pos / middle - - -def curved(middle: float, pos: float) -> float: - return pos ** (log(0.5) / log(max(middle, EPSILON))) - - -def sine(middle: float, pos: float) -> float: - return (sin((-pi / 2.0) + pi * linear(middle, pos)) + 1.0) / 2.0 - - -def sphere_increasing(middle: float, pos: float) -> float: - return sqrt(1.0 - (linear(middle, pos) - 1.0) ** 2) - - -def sphere_decreasing(middle: float, pos: float) -> float: - return 1.0 - sqrt(1.0 - linear(middle, pos) ** 2) - - -SEGMENTS = [linear, curved, sine, sphere_increasing, sphere_decreasing] -"""""" # Enable auto-doc for data member - - -class GradientFile: - gradient: ( - list[ - tuple[ - float, - float, - float, - list[float], - list[float], - Callable[[float, float], float], - ] - ] - | None - ) = None - - def getpalette(self, entries: int = 256) -> tuple[bytes, str]: - assert self.gradient is not None - palette = [] - - ix = 0 - x0, x1, xm, rgb0, rgb1, segment = self.gradient[ix] - - for i in range(entries): - x = i / (entries - 1) - - while x1 < x: - ix += 1 - x0, x1, xm, rgb0, rgb1, segment = self.gradient[ix] - - w = x1 - x0 - - if w < EPSILON: - scale = segment(0.5, 0.5) - else: - scale = segment((xm - x0) / w, (x - x0) / w) - - # expand to RGBA - r = o8(int(255 * ((rgb1[0] - rgb0[0]) * scale + rgb0[0]) + 0.5)) - g = o8(int(255 * ((rgb1[1] - rgb0[1]) * scale + rgb0[1]) + 0.5)) - b = o8(int(255 * ((rgb1[2] - rgb0[2]) * scale + rgb0[2]) + 0.5)) - a = o8(int(255 * ((rgb1[3] - rgb0[3]) * scale + rgb0[3]) + 0.5)) - - # add to palette - palette.append(r + g + b + a) - - return b"".join(palette), "RGBA" - - -class GimpGradientFile(GradientFile): - """File handler for GIMP's gradient format.""" - - def __init__(self, fp: IO[bytes]) -> None: - if not fp.readline().startswith(b"GIMP Gradient"): - msg = "not a GIMP gradient file" - raise SyntaxError(msg) - - line = fp.readline() - - # GIMP 1.2 gradient files don't contain a name, but GIMP 1.3 files do - if line.startswith(b"Name: "): - line = fp.readline().strip() - - count = int(line) - - self.gradient = [] - - for i in range(count): - s = fp.readline().split() - w = [float(x) for x in s[:11]] - - x0, x1 = w[0], w[2] - xm = w[1] - rgb0 = w[3:7] - rgb1 = w[7:11] - - segment = SEGMENTS[int(s[11])] - cspace = int(s[12]) - - if cspace != 0: - msg = "cannot handle HSV colour space" - raise OSError(msg) - - self.gradient.append((x0, x1, xm, rgb0, rgb1, segment)) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/GimpPaletteFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/GimpPaletteFile.py deleted file mode 100644 index 379ffd7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/GimpPaletteFile.py +++ /dev/null @@ -1,72 +0,0 @@ -# -# Python Imaging Library -# $Id$ -# -# stuff to read GIMP palette files -# -# History: -# 1997-08-23 fl Created -# 2004-09-07 fl Support GIMP 2.0 palette files. -# -# Copyright (c) Secret Labs AB 1997-2004. All rights reserved. -# Copyright (c) Fredrik Lundh 1997-2004. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import re -from io import BytesIO -from typing import IO - - -class GimpPaletteFile: - """File handler for GIMP's palette format.""" - - rawmode = "RGB" - - def _read(self, fp: IO[bytes], limit: bool = True) -> None: - if not fp.readline().startswith(b"GIMP Palette"): - msg = "not a GIMP palette file" - raise SyntaxError(msg) - - palette: list[int] = [] - i = 0 - while True: - if limit and i == 256 + 3: - break - - i += 1 - s = fp.readline() - if not s: - break - - # skip fields and comment lines - if re.match(rb"\w+:|#", s): - continue - if limit and len(s) > 100: - msg = "bad palette file" - raise SyntaxError(msg) - - v = s.split(maxsplit=3) - if len(v) < 3: - msg = "bad palette entry" - raise ValueError(msg) - - palette += (int(v[i]) for i in range(3)) - if limit and len(palette) == 768: - break - - self.palette = bytes(palette) - - def __init__(self, fp: IO[bytes]) -> None: - self._read(fp) - - @classmethod - def frombytes(cls, data: bytes) -> GimpPaletteFile: - self = cls.__new__(cls) - self._read(BytesIO(data), False) - return self - - def getpalette(self) -> tuple[bytes, str]: - return self.palette, self.rawmode diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/GribStubImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/GribStubImagePlugin.py deleted file mode 100644 index 439fc5a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/GribStubImagePlugin.py +++ /dev/null @@ -1,75 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# GRIB stub adapter -# -# Copyright (c) 1996-2003 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -from typing import IO - -from . import Image, ImageFile - -_handler = None - - -def register_handler(handler: ImageFile.StubHandler | None) -> None: - """ - Install application-specific GRIB image handler. - - :param handler: Handler object. - """ - global _handler - _handler = handler - - -# -------------------------------------------------------------------- -# Image adapter - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"GRIB") and prefix[7] == 1 - - -class GribStubImageFile(ImageFile.StubImageFile): - format = "GRIB" - format_description = "GRIB" - - def _open(self) -> None: - if not _accept(self.fp.read(8)): - msg = "Not a GRIB file" - raise SyntaxError(msg) - - self.fp.seek(-8, os.SEEK_CUR) - - # make something up - self._mode = "F" - self._size = 1, 1 - - loader = self._load() - if loader: - loader.open(self) - - def _load(self) -> ImageFile.StubHandler | None: - return _handler - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if _handler is None or not hasattr(_handler, "save"): - msg = "GRIB save handler not installed" - raise OSError(msg) - _handler.save(im, fp, filename) - - -# -------------------------------------------------------------------- -# Registry - -Image.register_open(GribStubImageFile.format, GribStubImageFile, _accept) -Image.register_save(GribStubImageFile.format, _save) - -Image.register_extension(GribStubImageFile.format, ".grib") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/Hdf5StubImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/Hdf5StubImagePlugin.py deleted file mode 100644 index 76e640f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/Hdf5StubImagePlugin.py +++ /dev/null @@ -1,75 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# HDF5 stub adapter -# -# Copyright (c) 2000-2003 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -from typing import IO - -from . import Image, ImageFile - -_handler = None - - -def register_handler(handler: ImageFile.StubHandler | None) -> None: - """ - Install application-specific HDF5 image handler. - - :param handler: Handler object. - """ - global _handler - _handler = handler - - -# -------------------------------------------------------------------- -# Image adapter - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"\x89HDF\r\n\x1a\n") - - -class HDF5StubImageFile(ImageFile.StubImageFile): - format = "HDF5" - format_description = "HDF5" - - def _open(self) -> None: - if not _accept(self.fp.read(8)): - msg = "Not an HDF file" - raise SyntaxError(msg) - - self.fp.seek(-8, os.SEEK_CUR) - - # make something up - self._mode = "F" - self._size = 1, 1 - - loader = self._load() - if loader: - loader.open(self) - - def _load(self) -> ImageFile.StubHandler | None: - return _handler - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if _handler is None or not hasattr(_handler, "save"): - msg = "HDF5 save handler not installed" - raise OSError(msg) - _handler.save(im, fp, filename) - - -# -------------------------------------------------------------------- -# Registry - -Image.register_open(HDF5StubImageFile.format, HDF5StubImageFile, _accept) -Image.register_save(HDF5StubImageFile.format, _save) - -Image.register_extensions(HDF5StubImageFile.format, [".h5", ".hdf"]) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/IcnsImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/IcnsImagePlugin.py deleted file mode 100644 index 5a88429..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/IcnsImagePlugin.py +++ /dev/null @@ -1,411 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# macOS icns file decoder, based on icns.py by Bob Ippolito. -# -# history: -# 2004-10-09 fl Turned into a PIL plugin; removed 2.3 dependencies. -# 2020-04-04 Allow saving on all operating systems. -# -# Copyright (c) 2004 by Bob Ippolito. -# Copyright (c) 2004 by Secret Labs. -# Copyright (c) 2004 by Fredrik Lundh. -# Copyright (c) 2014 by Alastair Houghton. -# Copyright (c) 2020 by Pan Jing. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -import os -import struct -import sys -from typing import IO - -from . import Image, ImageFile, PngImagePlugin, features -from ._deprecate import deprecate - -enable_jpeg2k = features.check_codec("jpg_2000") -if enable_jpeg2k: - from . import Jpeg2KImagePlugin - -MAGIC = b"icns" -HEADERSIZE = 8 - - -def nextheader(fobj: IO[bytes]) -> tuple[bytes, int]: - return struct.unpack(">4sI", fobj.read(HEADERSIZE)) - - -def read_32t( - fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] -) -> dict[str, Image.Image]: - # The 128x128 icon seems to have an extra header for some reason. - (start, length) = start_length - fobj.seek(start) - sig = fobj.read(4) - if sig != b"\x00\x00\x00\x00": - msg = "Unknown signature, expecting 0x00000000" - raise SyntaxError(msg) - return read_32(fobj, (start + 4, length - 4), size) - - -def read_32( - fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] -) -> dict[str, Image.Image]: - """ - Read a 32bit RGB icon resource. Seems to be either uncompressed or - an RLE packbits-like scheme. - """ - (start, length) = start_length - fobj.seek(start) - pixel_size = (size[0] * size[2], size[1] * size[2]) - sizesq = pixel_size[0] * pixel_size[1] - if length == sizesq * 3: - # uncompressed ("RGBRGBGB") - indata = fobj.read(length) - im = Image.frombuffer("RGB", pixel_size, indata, "raw", "RGB", 0, 1) - else: - # decode image - im = Image.new("RGB", pixel_size, None) - for band_ix in range(3): - data = [] - bytesleft = sizesq - while bytesleft > 0: - byte = fobj.read(1) - if not byte: - break - byte_int = byte[0] - if byte_int & 0x80: - blocksize = byte_int - 125 - byte = fobj.read(1) - for i in range(blocksize): - data.append(byte) - else: - blocksize = byte_int + 1 - data.append(fobj.read(blocksize)) - bytesleft -= blocksize - if bytesleft <= 0: - break - if bytesleft != 0: - msg = f"Error reading channel [{repr(bytesleft)} left]" - raise SyntaxError(msg) - band = Image.frombuffer("L", pixel_size, b"".join(data), "raw", "L", 0, 1) - im.im.putband(band.im, band_ix) - return {"RGB": im} - - -def read_mk( - fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] -) -> dict[str, Image.Image]: - # Alpha masks seem to be uncompressed - start = start_length[0] - fobj.seek(start) - pixel_size = (size[0] * size[2], size[1] * size[2]) - sizesq = pixel_size[0] * pixel_size[1] - band = Image.frombuffer("L", pixel_size, fobj.read(sizesq), "raw", "L", 0, 1) - return {"A": band} - - -def read_png_or_jpeg2000( - fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] -) -> dict[str, Image.Image]: - (start, length) = start_length - fobj.seek(start) - sig = fobj.read(12) - - im: Image.Image - if sig.startswith(b"\x89PNG\x0d\x0a\x1a\x0a"): - fobj.seek(start) - im = PngImagePlugin.PngImageFile(fobj) - Image._decompression_bomb_check(im.size) - return {"RGBA": im} - elif ( - sig.startswith((b"\xff\x4f\xff\x51", b"\x0d\x0a\x87\x0a")) - or sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a" - ): - if not enable_jpeg2k: - msg = ( - "Unsupported icon subimage format (rebuild PIL " - "with JPEG 2000 support to fix this)" - ) - raise ValueError(msg) - # j2k, jpc or j2c - fobj.seek(start) - jp2kstream = fobj.read(length) - f = io.BytesIO(jp2kstream) - im = Jpeg2KImagePlugin.Jpeg2KImageFile(f) - Image._decompression_bomb_check(im.size) - if im.mode != "RGBA": - im = im.convert("RGBA") - return {"RGBA": im} - else: - msg = "Unsupported icon subimage format" - raise ValueError(msg) - - -class IcnsFile: - SIZES = { - (512, 512, 2): [(b"ic10", read_png_or_jpeg2000)], - (512, 512, 1): [(b"ic09", read_png_or_jpeg2000)], - (256, 256, 2): [(b"ic14", read_png_or_jpeg2000)], - (256, 256, 1): [(b"ic08", read_png_or_jpeg2000)], - (128, 128, 2): [(b"ic13", read_png_or_jpeg2000)], - (128, 128, 1): [ - (b"ic07", read_png_or_jpeg2000), - (b"it32", read_32t), - (b"t8mk", read_mk), - ], - (64, 64, 1): [(b"icp6", read_png_or_jpeg2000)], - (32, 32, 2): [(b"ic12", read_png_or_jpeg2000)], - (48, 48, 1): [(b"ih32", read_32), (b"h8mk", read_mk)], - (32, 32, 1): [ - (b"icp5", read_png_or_jpeg2000), - (b"il32", read_32), - (b"l8mk", read_mk), - ], - (16, 16, 2): [(b"ic11", read_png_or_jpeg2000)], - (16, 16, 1): [ - (b"icp4", read_png_or_jpeg2000), - (b"is32", read_32), - (b"s8mk", read_mk), - ], - } - - def __init__(self, fobj: IO[bytes]) -> None: - """ - fobj is a file-like object as an icns resource - """ - # signature : (start, length) - self.dct = {} - self.fobj = fobj - sig, filesize = nextheader(fobj) - if not _accept(sig): - msg = "not an icns file" - raise SyntaxError(msg) - i = HEADERSIZE - while i < filesize: - sig, blocksize = nextheader(fobj) - if blocksize <= 0: - msg = "invalid block header" - raise SyntaxError(msg) - i += HEADERSIZE - blocksize -= HEADERSIZE - self.dct[sig] = (i, blocksize) - fobj.seek(blocksize, io.SEEK_CUR) - i += blocksize - - def itersizes(self) -> list[tuple[int, int, int]]: - sizes = [] - for size, fmts in self.SIZES.items(): - for fmt, reader in fmts: - if fmt in self.dct: - sizes.append(size) - break - return sizes - - def bestsize(self) -> tuple[int, int, int]: - sizes = self.itersizes() - if not sizes: - msg = "No 32bit icon resources found" - raise SyntaxError(msg) - return max(sizes) - - def dataforsize(self, size: tuple[int, int, int]) -> dict[str, Image.Image]: - """ - Get an icon resource as {channel: array}. Note that - the arrays are bottom-up like windows bitmaps and will likely - need to be flipped or transposed in some way. - """ - dct = {} - for code, reader in self.SIZES[size]: - desc = self.dct.get(code) - if desc is not None: - dct.update(reader(self.fobj, desc, size)) - return dct - - def getimage( - self, size: tuple[int, int] | tuple[int, int, int] | None = None - ) -> Image.Image: - if size is None: - size = self.bestsize() - elif len(size) == 2: - size = (size[0], size[1], 1) - channels = self.dataforsize(size) - - im = channels.get("RGBA") - if im: - return im - - im = channels["RGB"].copy() - try: - im.putalpha(channels["A"]) - except KeyError: - pass - return im - - -## -# Image plugin for Mac OS icons. - - -class IcnsImageFile(ImageFile.ImageFile): - """ - PIL image support for Mac OS .icns files. - Chooses the best resolution, but will possibly load - a different size image if you mutate the size attribute - before calling 'load'. - - The info dictionary has a key 'sizes' that is a list - of sizes that the icns file has. - """ - - format = "ICNS" - format_description = "Mac OS icns resource" - - def _open(self) -> None: - self.icns = IcnsFile(self.fp) - self._mode = "RGBA" - self.info["sizes"] = self.icns.itersizes() - self.best_size = self.icns.bestsize() - self.size = ( - self.best_size[0] * self.best_size[2], - self.best_size[1] * self.best_size[2], - ) - - @property # type: ignore[override] - def size(self) -> tuple[int, int] | tuple[int, int, int]: - return self._size - - @size.setter - def size(self, value: tuple[int, int] | tuple[int, int, int]) -> None: - if len(value) == 3: - deprecate("Setting size to (width, height, scale)", 12, "load(scale)") - if value in self.info["sizes"]: - self._size = value # type: ignore[assignment] - return - else: - # Check that a matching size exists, - # or that there is a scale that would create a size that matches - for size in self.info["sizes"]: - simple_size = size[0] * size[2], size[1] * size[2] - scale = simple_size[0] // value[0] - if simple_size[1] / value[1] == scale: - self._size = value - return - msg = "This is not one of the allowed sizes of this image" - raise ValueError(msg) - - def load(self, scale: int | None = None) -> Image.core.PixelAccess | None: - if scale is not None or len(self.size) == 3: - if scale is None and len(self.size) == 3: - scale = self.size[2] - assert scale is not None - width, height = self.size[:2] - self.size = width * scale, height * scale - self.best_size = width, height, scale - - px = Image.Image.load(self) - if self._im is not None and self.im.size == self.size: - # Already loaded - return px - self.load_prepare() - # This is likely NOT the best way to do it, but whatever. - im = self.icns.getimage(self.best_size) - - # If this is a PNG or JPEG 2000, it won't be loaded yet - px = im.load() - - self.im = im.im - self._mode = im.mode - self.size = im.size - - return px - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - """ - Saves the image as a series of PNG files, - that are then combined into a .icns file. - """ - if hasattr(fp, "flush"): - fp.flush() - - sizes = { - b"ic07": 128, - b"ic08": 256, - b"ic09": 512, - b"ic10": 1024, - b"ic11": 32, - b"ic12": 64, - b"ic13": 256, - b"ic14": 512, - } - provided_images = {im.width: im for im in im.encoderinfo.get("append_images", [])} - size_streams = {} - for size in set(sizes.values()): - image = ( - provided_images[size] - if size in provided_images - else im.resize((size, size)) - ) - - temp = io.BytesIO() - image.save(temp, "png") - size_streams[size] = temp.getvalue() - - entries = [] - for type, size in sizes.items(): - stream = size_streams[size] - entries.append((type, HEADERSIZE + len(stream), stream)) - - # Header - fp.write(MAGIC) - file_length = HEADERSIZE # Header - file_length += HEADERSIZE + 8 * len(entries) # TOC - file_length += sum(entry[1] for entry in entries) - fp.write(struct.pack(">i", file_length)) - - # TOC - fp.write(b"TOC ") - fp.write(struct.pack(">i", HEADERSIZE + len(entries) * HEADERSIZE)) - for entry in entries: - fp.write(entry[0]) - fp.write(struct.pack(">i", entry[1])) - - # Data - for entry in entries: - fp.write(entry[0]) - fp.write(struct.pack(">i", entry[1])) - fp.write(entry[2]) - - if hasattr(fp, "flush"): - fp.flush() - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(MAGIC) - - -Image.register_open(IcnsImageFile.format, IcnsImageFile, _accept) -Image.register_extension(IcnsImageFile.format, ".icns") - -Image.register_save(IcnsImageFile.format, _save) -Image.register_mime(IcnsImageFile.format, "image/icns") - -if __name__ == "__main__": - if len(sys.argv) < 2: - print("Syntax: python3 IcnsImagePlugin.py [file]") - sys.exit() - - with open(sys.argv[1], "rb") as fp: - imf = IcnsImageFile(fp) - for size in imf.info["sizes"]: - width, height, scale = imf.size = size - imf.save(f"out-{width}-{height}-{scale}.png") - with Image.open(sys.argv[1]) as im: - im.save("out.png") - if sys.platform == "windows": - os.startfile("out.png") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/IcoImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/IcoImagePlugin.py deleted file mode 100644 index bd35ac8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/IcoImagePlugin.py +++ /dev/null @@ -1,381 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# Windows Icon support for PIL -# -# History: -# 96-05-27 fl Created -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# - -# This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis -# . -# https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki -# -# Icon format references: -# * https://en.wikipedia.org/wiki/ICO_(file_format) -# * https://msdn.microsoft.com/en-us/library/ms997538.aspx -from __future__ import annotations - -import warnings -from io import BytesIO -from math import ceil, log -from typing import IO, NamedTuple - -from . import BmpImagePlugin, Image, ImageFile, PngImagePlugin -from ._binary import i16le as i16 -from ._binary import i32le as i32 -from ._binary import o8 -from ._binary import o16le as o16 -from ._binary import o32le as o32 - -# -# -------------------------------------------------------------------- - -_MAGIC = b"\0\0\1\0" - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - fp.write(_MAGIC) # (2+2) - bmp = im.encoderinfo.get("bitmap_format") == "bmp" - sizes = im.encoderinfo.get( - "sizes", - [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)], - ) - frames = [] - provided_ims = [im] + im.encoderinfo.get("append_images", []) - width, height = im.size - for size in sorted(set(sizes)): - if size[0] > width or size[1] > height or size[0] > 256 or size[1] > 256: - continue - - for provided_im in provided_ims: - if provided_im.size != size: - continue - frames.append(provided_im) - if bmp: - bits = BmpImagePlugin.SAVE[provided_im.mode][1] - bits_used = [bits] - for other_im in provided_ims: - if other_im.size != size: - continue - bits = BmpImagePlugin.SAVE[other_im.mode][1] - if bits not in bits_used: - # Another image has been supplied for this size - # with a different bit depth - frames.append(other_im) - bits_used.append(bits) - break - else: - # TODO: invent a more convenient method for proportional scalings - frame = provided_im.copy() - frame.thumbnail(size, Image.Resampling.LANCZOS, reducing_gap=None) - frames.append(frame) - fp.write(o16(len(frames))) # idCount(2) - offset = fp.tell() + len(frames) * 16 - for frame in frames: - width, height = frame.size - # 0 means 256 - fp.write(o8(width if width < 256 else 0)) # bWidth(1) - fp.write(o8(height if height < 256 else 0)) # bHeight(1) - - bits, colors = BmpImagePlugin.SAVE[frame.mode][1:] if bmp else (32, 0) - fp.write(o8(colors)) # bColorCount(1) - fp.write(b"\0") # bReserved(1) - fp.write(b"\0\0") # wPlanes(2) - fp.write(o16(bits)) # wBitCount(2) - - image_io = BytesIO() - if bmp: - frame.save(image_io, "dib") - - if bits != 32: - and_mask = Image.new("1", size) - ImageFile._save( - and_mask, - image_io, - [ImageFile._Tile("raw", (0, 0) + size, 0, ("1", 0, -1))], - ) - else: - frame.save(image_io, "png") - image_io.seek(0) - image_bytes = image_io.read() - if bmp: - image_bytes = image_bytes[:8] + o32(height * 2) + image_bytes[12:] - bytes_len = len(image_bytes) - fp.write(o32(bytes_len)) # dwBytesInRes(4) - fp.write(o32(offset)) # dwImageOffset(4) - current = fp.tell() - fp.seek(offset) - fp.write(image_bytes) - offset = offset + bytes_len - fp.seek(current) - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(_MAGIC) - - -class IconHeader(NamedTuple): - width: int - height: int - nb_color: int - reserved: int - planes: int - bpp: int - size: int - offset: int - dim: tuple[int, int] - square: int - color_depth: int - - -class IcoFile: - def __init__(self, buf: IO[bytes]) -> None: - """ - Parse image from file-like object containing ico file data - """ - - # check magic - s = buf.read(6) - if not _accept(s): - msg = "not an ICO file" - raise SyntaxError(msg) - - self.buf = buf - self.entry = [] - - # Number of items in file - self.nb_items = i16(s, 4) - - # Get headers for each item - for i in range(self.nb_items): - s = buf.read(16) - - # See Wikipedia - width = s[0] or 256 - height = s[1] or 256 - - # No. of colors in image (0 if >=8bpp) - nb_color = s[2] - bpp = i16(s, 6) - icon_header = IconHeader( - width=width, - height=height, - nb_color=nb_color, - reserved=s[3], - planes=i16(s, 4), - bpp=i16(s, 6), - size=i32(s, 8), - offset=i32(s, 12), - dim=(width, height), - square=width * height, - # See Wikipedia notes about color depth. - # We need this just to differ images with equal sizes - color_depth=bpp or (nb_color != 0 and ceil(log(nb_color, 2))) or 256, - ) - - self.entry.append(icon_header) - - self.entry = sorted(self.entry, key=lambda x: x.color_depth) - # ICO images are usually squares - self.entry = sorted(self.entry, key=lambda x: x.square, reverse=True) - - def sizes(self) -> set[tuple[int, int]]: - """ - Get a set of all available icon sizes and color depths. - """ - return {(h.width, h.height) for h in self.entry} - - def getentryindex(self, size: tuple[int, int], bpp: int | bool = False) -> int: - for i, h in enumerate(self.entry): - if size == h.dim and (bpp is False or bpp == h.color_depth): - return i - return 0 - - def getimage(self, size: tuple[int, int], bpp: int | bool = False) -> Image.Image: - """ - Get an image from the icon - """ - return self.frame(self.getentryindex(size, bpp)) - - def frame(self, idx: int) -> Image.Image: - """ - Get an image from frame idx - """ - - header = self.entry[idx] - - self.buf.seek(header.offset) - data = self.buf.read(8) - self.buf.seek(header.offset) - - im: Image.Image - if data[:8] == PngImagePlugin._MAGIC: - # png frame - im = PngImagePlugin.PngImageFile(self.buf) - Image._decompression_bomb_check(im.size) - else: - # XOR + AND mask bmp frame - im = BmpImagePlugin.DibImageFile(self.buf) - Image._decompression_bomb_check(im.size) - - # change tile dimension to only encompass XOR image - im._size = (im.size[0], int(im.size[1] / 2)) - d, e, o, a = im.tile[0] - im.tile[0] = ImageFile._Tile(d, (0, 0) + im.size, o, a) - - # figure out where AND mask image starts - if header.bpp == 32: - # 32-bit color depth icon image allows semitransparent areas - # PIL's DIB format ignores transparency bits, recover them. - # The DIB is packed in BGRX byte order where X is the alpha - # channel. - - # Back up to start of bmp data - self.buf.seek(o) - # extract every 4th byte (eg. 3,7,11,15,...) - alpha_bytes = self.buf.read(im.size[0] * im.size[1] * 4)[3::4] - - # convert to an 8bpp grayscale image - try: - mask = Image.frombuffer( - "L", # 8bpp - im.size, # (w, h) - alpha_bytes, # source chars - "raw", # raw decoder - ("L", 0, -1), # 8bpp inverted, unpadded, reversed - ) - except ValueError: - if ImageFile.LOAD_TRUNCATED_IMAGES: - mask = None - else: - raise - else: - # get AND image from end of bitmap - w = im.size[0] - if (w % 32) > 0: - # bitmap row data is aligned to word boundaries - w += 32 - (im.size[0] % 32) - - # the total mask data is - # padded row size * height / bits per char - - total_bytes = int((w * im.size[1]) / 8) - and_mask_offset = header.offset + header.size - total_bytes - - self.buf.seek(and_mask_offset) - mask_data = self.buf.read(total_bytes) - - # convert raw data to image - try: - mask = Image.frombuffer( - "1", # 1 bpp - im.size, # (w, h) - mask_data, # source chars - "raw", # raw decoder - ("1;I", int(w / 8), -1), # 1bpp inverted, padded, reversed - ) - except ValueError: - if ImageFile.LOAD_TRUNCATED_IMAGES: - mask = None - else: - raise - - # now we have two images, im is XOR image and mask is AND image - - # apply mask image as alpha channel - if mask: - im = im.convert("RGBA") - im.putalpha(mask) - - return im - - -## -# Image plugin for Windows Icon files. - - -class IcoImageFile(ImageFile.ImageFile): - """ - PIL read-only image support for Microsoft Windows .ico files. - - By default the largest resolution image in the file will be loaded. This - can be changed by altering the 'size' attribute before calling 'load'. - - The info dictionary has a key 'sizes' that is a list of the sizes available - in the icon file. - - Handles classic, XP and Vista icon formats. - - When saving, PNG compression is used. Support for this was only added in - Windows Vista. If you are unable to view the icon in Windows, convert the - image to "RGBA" mode before saving. - - This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis - . - https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki - """ - - format = "ICO" - format_description = "Windows Icon" - - def _open(self) -> None: - self.ico = IcoFile(self.fp) - self.info["sizes"] = self.ico.sizes() - self.size = self.ico.entry[0].dim - self.load() - - @property - def size(self) -> tuple[int, int]: - return self._size - - @size.setter - def size(self, value: tuple[int, int]) -> None: - if value not in self.info["sizes"]: - msg = "This is not one of the allowed sizes of this image" - raise ValueError(msg) - self._size = value - - def load(self) -> Image.core.PixelAccess | None: - if self._im is not None and self.im.size == self.size: - # Already loaded - return Image.Image.load(self) - im = self.ico.getimage(self.size) - # if tile is PNG, it won't really be loaded yet - im.load() - self.im = im.im - self._mode = im.mode - if im.palette: - self.palette = im.palette - if im.size != self.size: - warnings.warn("Image was not the expected size") - - index = self.ico.getentryindex(self.size) - sizes = list(self.info["sizes"]) - sizes[index] = im.size - self.info["sizes"] = set(sizes) - - self.size = im.size - return Image.Image.load(self) - - def load_seek(self, pos: int) -> None: - # Flag the ImageFile.Parser so that it - # just does all the decode at the end. - pass - - -# -# -------------------------------------------------------------------- - - -Image.register_open(IcoImageFile.format, IcoImageFile, _accept) -Image.register_save(IcoImageFile.format, _save) -Image.register_extension(IcoImageFile.format, ".ico") - -Image.register_mime(IcoImageFile.format, "image/x-icon") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImImagePlugin.py deleted file mode 100644 index 71b9996..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImImagePlugin.py +++ /dev/null @@ -1,389 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# IFUNC IM file handling for PIL -# -# history: -# 1995-09-01 fl Created. -# 1997-01-03 fl Save palette images -# 1997-01-08 fl Added sequence support -# 1997-01-23 fl Added P and RGB save support -# 1997-05-31 fl Read floating point images -# 1997-06-22 fl Save floating point images -# 1997-08-27 fl Read and save 1-bit images -# 1998-06-25 fl Added support for RGB+LUT images -# 1998-07-02 fl Added support for YCC images -# 1998-07-15 fl Renamed offset attribute to avoid name clash -# 1998-12-29 fl Added I;16 support -# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7) -# 2003-09-26 fl Added LA/PA support -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1995-2001 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -import re -from typing import IO, Any - -from . import Image, ImageFile, ImagePalette -from ._util import DeferredError - -# -------------------------------------------------------------------- -# Standard tags - -COMMENT = "Comment" -DATE = "Date" -EQUIPMENT = "Digitalization equipment" -FRAMES = "File size (no of images)" -LUT = "Lut" -NAME = "Name" -SCALE = "Scale (x,y)" -SIZE = "Image size (x*y)" -MODE = "Image type" - -TAGS = { - COMMENT: 0, - DATE: 0, - EQUIPMENT: 0, - FRAMES: 0, - LUT: 0, - NAME: 0, - SCALE: 0, - SIZE: 0, - MODE: 0, -} - -OPEN = { - # ifunc93/p3cfunc formats - "0 1 image": ("1", "1"), - "L 1 image": ("1", "1"), - "Greyscale image": ("L", "L"), - "Grayscale image": ("L", "L"), - "RGB image": ("RGB", "RGB;L"), - "RLB image": ("RGB", "RLB"), - "RYB image": ("RGB", "RLB"), - "B1 image": ("1", "1"), - "B2 image": ("P", "P;2"), - "B4 image": ("P", "P;4"), - "X 24 image": ("RGB", "RGB"), - "L 32 S image": ("I", "I;32"), - "L 32 F image": ("F", "F;32"), - # old p3cfunc formats - "RGB3 image": ("RGB", "RGB;T"), - "RYB3 image": ("RGB", "RYB;T"), - # extensions - "LA image": ("LA", "LA;L"), - "PA image": ("LA", "PA;L"), - "RGBA image": ("RGBA", "RGBA;L"), - "RGBX image": ("RGB", "RGBX;L"), - "CMYK image": ("CMYK", "CMYK;L"), - "YCC image": ("YCbCr", "YCbCr;L"), -} - -# ifunc95 extensions -for i in ["8", "8S", "16", "16S", "32", "32F"]: - OPEN[f"L {i} image"] = ("F", f"F;{i}") - OPEN[f"L*{i} image"] = ("F", f"F;{i}") -for i in ["16", "16L", "16B"]: - OPEN[f"L {i} image"] = (f"I;{i}", f"I;{i}") - OPEN[f"L*{i} image"] = (f"I;{i}", f"I;{i}") -for i in ["32S"]: - OPEN[f"L {i} image"] = ("I", f"I;{i}") - OPEN[f"L*{i} image"] = ("I", f"I;{i}") -for j in range(2, 33): - OPEN[f"L*{j} image"] = ("F", f"F;{j}") - - -# -------------------------------------------------------------------- -# Read IM directory - -split = re.compile(rb"^([A-Za-z][^:]*):[ \t]*(.*)[ \t]*$") - - -def number(s: Any) -> float: - try: - return int(s) - except ValueError: - return float(s) - - -## -# Image plugin for the IFUNC IM file format. - - -class ImImageFile(ImageFile.ImageFile): - format = "IM" - format_description = "IFUNC Image Memory" - _close_exclusive_fp_after_loading = False - - def _open(self) -> None: - # Quick rejection: if there's not an LF among the first - # 100 bytes, this is (probably) not a text header. - - if b"\n" not in self.fp.read(100): - msg = "not an IM file" - raise SyntaxError(msg) - self.fp.seek(0) - - n = 0 - - # Default values - self.info[MODE] = "L" - self.info[SIZE] = (512, 512) - self.info[FRAMES] = 1 - - self.rawmode = "L" - - while True: - s = self.fp.read(1) - - # Some versions of IFUNC uses \n\r instead of \r\n... - if s == b"\r": - continue - - if not s or s == b"\0" or s == b"\x1a": - break - - # FIXME: this may read whole file if not a text file - s = s + self.fp.readline() - - if len(s) > 100: - msg = "not an IM file" - raise SyntaxError(msg) - - if s.endswith(b"\r\n"): - s = s[:-2] - elif s.endswith(b"\n"): - s = s[:-1] - - try: - m = split.match(s) - except re.error as e: - msg = "not an IM file" - raise SyntaxError(msg) from e - - if m: - k, v = m.group(1, 2) - - # Don't know if this is the correct encoding, - # but a decent guess (I guess) - k = k.decode("latin-1", "replace") - v = v.decode("latin-1", "replace") - - # Convert value as appropriate - if k in [FRAMES, SCALE, SIZE]: - v = v.replace("*", ",") - v = tuple(map(number, v.split(","))) - if len(v) == 1: - v = v[0] - elif k == MODE and v in OPEN: - v, self.rawmode = OPEN[v] - - # Add to dictionary. Note that COMMENT tags are - # combined into a list of strings. - if k == COMMENT: - if k in self.info: - self.info[k].append(v) - else: - self.info[k] = [v] - else: - self.info[k] = v - - if k in TAGS: - n += 1 - - else: - msg = f"Syntax error in IM header: {s.decode('ascii', 'replace')}" - raise SyntaxError(msg) - - if not n: - msg = "Not an IM file" - raise SyntaxError(msg) - - # Basic attributes - self._size = self.info[SIZE] - self._mode = self.info[MODE] - - # Skip forward to start of image data - while s and not s.startswith(b"\x1a"): - s = self.fp.read(1) - if not s: - msg = "File truncated" - raise SyntaxError(msg) - - if LUT in self.info: - # convert lookup table to palette or lut attribute - palette = self.fp.read(768) - greyscale = 1 # greyscale palette - linear = 1 # linear greyscale palette - for i in range(256): - if palette[i] == palette[i + 256] == palette[i + 512]: - if palette[i] != i: - linear = 0 - else: - greyscale = 0 - if self.mode in ["L", "LA", "P", "PA"]: - if greyscale: - if not linear: - self.lut = list(palette[:256]) - else: - if self.mode in ["L", "P"]: - self._mode = self.rawmode = "P" - elif self.mode in ["LA", "PA"]: - self._mode = "PA" - self.rawmode = "PA;L" - self.palette = ImagePalette.raw("RGB;L", palette) - elif self.mode == "RGB": - if not greyscale or not linear: - self.lut = list(palette) - - self.frame = 0 - - self.__offset = offs = self.fp.tell() - - self._fp = self.fp # FIXME: hack - - if self.rawmode.startswith("F;"): - # ifunc95 formats - try: - # use bit decoder (if necessary) - bits = int(self.rawmode[2:]) - if bits not in [8, 16, 32]: - self.tile = [ - ImageFile._Tile( - "bit", (0, 0) + self.size, offs, (bits, 8, 3, 0, -1) - ) - ] - return - except ValueError: - pass - - if self.rawmode in ["RGB;T", "RYB;T"]: - # Old LabEye/3PC files. Would be very surprised if anyone - # ever stumbled upon such a file ;-) - size = self.size[0] * self.size[1] - self.tile = [ - ImageFile._Tile("raw", (0, 0) + self.size, offs, ("G", 0, -1)), - ImageFile._Tile("raw", (0, 0) + self.size, offs + size, ("R", 0, -1)), - ImageFile._Tile( - "raw", (0, 0) + self.size, offs + 2 * size, ("B", 0, -1) - ), - ] - else: - # LabEye/IFUNC files - self.tile = [ - ImageFile._Tile("raw", (0, 0) + self.size, offs, (self.rawmode, 0, -1)) - ] - - @property - def n_frames(self) -> int: - return self.info[FRAMES] - - @property - def is_animated(self) -> bool: - return self.info[FRAMES] > 1 - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - if isinstance(self._fp, DeferredError): - raise self._fp.ex - - self.frame = frame - - if self.mode == "1": - bits = 1 - else: - bits = 8 * len(self.mode) - - size = ((self.size[0] * bits + 7) // 8) * self.size[1] - offs = self.__offset + frame * size - - self.fp = self._fp - - self.tile = [ - ImageFile._Tile("raw", (0, 0) + self.size, offs, (self.rawmode, 0, -1)) - ] - - def tell(self) -> int: - return self.frame - - -# -# -------------------------------------------------------------------- -# Save IM files - - -SAVE = { - # mode: (im type, raw mode) - "1": ("0 1", "1"), - "L": ("Greyscale", "L"), - "LA": ("LA", "LA;L"), - "P": ("Greyscale", "P"), - "PA": ("LA", "PA;L"), - "I": ("L 32S", "I;32S"), - "I;16": ("L 16", "I;16"), - "I;16L": ("L 16L", "I;16L"), - "I;16B": ("L 16B", "I;16B"), - "F": ("L 32F", "F;32F"), - "RGB": ("RGB", "RGB;L"), - "RGBA": ("RGBA", "RGBA;L"), - "RGBX": ("RGBX", "RGBX;L"), - "CMYK": ("CMYK", "CMYK;L"), - "YCbCr": ("YCC", "YCbCr;L"), -} - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - try: - image_type, rawmode = SAVE[im.mode] - except KeyError as e: - msg = f"Cannot save {im.mode} images as IM" - raise ValueError(msg) from e - - frames = im.encoderinfo.get("frames", 1) - - fp.write(f"Image type: {image_type} image\r\n".encode("ascii")) - if filename: - # Each line must be 100 characters or less, - # or: SyntaxError("not an IM file") - # 8 characters are used for "Name: " and "\r\n" - # Keep just the filename, ditch the potentially overlong path - if isinstance(filename, bytes): - filename = filename.decode("ascii") - name, ext = os.path.splitext(os.path.basename(filename)) - name = "".join([name[: 92 - len(ext)], ext]) - - fp.write(f"Name: {name}\r\n".encode("ascii")) - fp.write(f"Image size (x*y): {im.size[0]}*{im.size[1]}\r\n".encode("ascii")) - fp.write(f"File size (no of images): {frames}\r\n".encode("ascii")) - if im.mode in ["P", "PA"]: - fp.write(b"Lut: 1\r\n") - fp.write(b"\000" * (511 - fp.tell()) + b"\032") - if im.mode in ["P", "PA"]: - im_palette = im.im.getpalette("RGB", "RGB;L") - colors = len(im_palette) // 3 - palette = b"" - for i in range(3): - palette += im_palette[colors * i : colors * (i + 1)] - palette += b"\x00" * (256 - colors) - fp.write(palette) # 768 bytes - ImageFile._save( - im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, 0, -1))] - ) - - -# -# -------------------------------------------------------------------- -# Registry - - -Image.register_open(ImImageFile.format, ImImageFile) -Image.register_save(ImImageFile.format, _save) - -Image.register_extension(ImImageFile.format, ".im") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/Image.py b/write-message/venv/lib/python3.10/site-packages/PIL/Image.py deleted file mode 100644 index d209405..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/Image.py +++ /dev/null @@ -1,4245 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# the Image class wrapper -# -# partial release history: -# 1995-09-09 fl Created -# 1996-03-11 fl PIL release 0.0 (proof of concept) -# 1996-04-30 fl PIL release 0.1b1 -# 1999-07-28 fl PIL release 1.0 final -# 2000-06-07 fl PIL release 1.1 -# 2000-10-20 fl PIL release 1.1.1 -# 2001-05-07 fl PIL release 1.1.2 -# 2002-03-15 fl PIL release 1.1.3 -# 2003-05-10 fl PIL release 1.1.4 -# 2005-03-28 fl PIL release 1.1.5 -# 2006-12-02 fl PIL release 1.1.6 -# 2009-11-15 fl PIL release 1.1.7 -# -# Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved. -# Copyright (c) 1995-2009 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# - -from __future__ import annotations - -import abc -import atexit -import builtins -import io -import logging -import math -import os -import re -import struct -import sys -import tempfile -import warnings -from collections.abc import Callable, Iterator, MutableMapping, Sequence -from enum import IntEnum -from types import ModuleType -from typing import IO, Any, Literal, Protocol, cast - -# VERSION was removed in Pillow 6.0.0. -# PILLOW_VERSION was removed in Pillow 9.0.0. -# Use __version__ instead. -from . import ( - ExifTags, - ImageMode, - TiffTags, - UnidentifiedImageError, - __version__, - _plugins, -) -from ._binary import i32le, o32be, o32le -from ._deprecate import deprecate -from ._util import DeferredError, is_path - -ElementTree: ModuleType | None -try: - from defusedxml import ElementTree -except ImportError: - ElementTree = None - -logger = logging.getLogger(__name__) - - -class DecompressionBombWarning(RuntimeWarning): - pass - - -class DecompressionBombError(Exception): - pass - - -WARN_POSSIBLE_FORMATS: bool = False - -# Limit to around a quarter gigabyte for a 24-bit (3 bpp) image -MAX_IMAGE_PIXELS: int | None = int(1024 * 1024 * 1024 // 4 // 3) - - -try: - # If the _imaging C module is not present, Pillow will not load. - # Note that other modules should not refer to _imaging directly; - # import Image and use the Image.core variable instead. - # Also note that Image.core is not a publicly documented interface, - # and should be considered private and subject to change. - from . import _imaging as core - - if __version__ != getattr(core, "PILLOW_VERSION", None): - msg = ( - "The _imaging extension was built for another version of Pillow or PIL:\n" - f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n" - f"Pillow version: {__version__}" - ) - raise ImportError(msg) - -except ImportError as v: - core = DeferredError.new(ImportError("The _imaging C module is not installed.")) - # Explanations for ways that we know we might have an import error - if str(v).startswith("Module use of python"): - # The _imaging C module is present, but not compiled for - # the right version (windows only). Print a warning, if - # possible. - warnings.warn( - "The _imaging extension was built for another version of Python.", - RuntimeWarning, - ) - elif str(v).startswith("The _imaging extension"): - warnings.warn(str(v), RuntimeWarning) - # Fail here anyway. Don't let people run with a mostly broken Pillow. - # see docs/porting.rst - raise - - -def isImageType(t: Any) -> TypeGuard[Image]: - """ - Checks if an object is an image object. - - .. warning:: - - This function is for internal use only. - - :param t: object to check if it's an image - :returns: True if the object is an image - """ - deprecate("Image.isImageType(im)", 12, "isinstance(im, Image.Image)") - return hasattr(t, "im") - - -# -# Constants - - -# transpose -class Transpose(IntEnum): - FLIP_LEFT_RIGHT = 0 - FLIP_TOP_BOTTOM = 1 - ROTATE_90 = 2 - ROTATE_180 = 3 - ROTATE_270 = 4 - TRANSPOSE = 5 - TRANSVERSE = 6 - - -# transforms (also defined in Imaging.h) -class Transform(IntEnum): - AFFINE = 0 - EXTENT = 1 - PERSPECTIVE = 2 - QUAD = 3 - MESH = 4 - - -# resampling filters (also defined in Imaging.h) -class Resampling(IntEnum): - NEAREST = 0 - BOX = 4 - BILINEAR = 2 - HAMMING = 5 - BICUBIC = 3 - LANCZOS = 1 - - -_filters_support = { - Resampling.BOX: 0.5, - Resampling.BILINEAR: 1.0, - Resampling.HAMMING: 1.0, - Resampling.BICUBIC: 2.0, - Resampling.LANCZOS: 3.0, -} - - -# dithers -class Dither(IntEnum): - NONE = 0 - ORDERED = 1 # Not yet implemented - RASTERIZE = 2 # Not yet implemented - FLOYDSTEINBERG = 3 # default - - -# palettes/quantizers -class Palette(IntEnum): - WEB = 0 - ADAPTIVE = 1 - - -class Quantize(IntEnum): - MEDIANCUT = 0 - MAXCOVERAGE = 1 - FASTOCTREE = 2 - LIBIMAGEQUANT = 3 - - -module = sys.modules[__name__] -for enum in (Transpose, Transform, Resampling, Dither, Palette, Quantize): - for item in enum: - setattr(module, item.name, item.value) - - -if hasattr(core, "DEFAULT_STRATEGY"): - DEFAULT_STRATEGY = core.DEFAULT_STRATEGY - FILTERED = core.FILTERED - HUFFMAN_ONLY = core.HUFFMAN_ONLY - RLE = core.RLE - FIXED = core.FIXED - - -# -------------------------------------------------------------------- -# Registries - -TYPE_CHECKING = False -if TYPE_CHECKING: - import mmap - from xml.etree.ElementTree import Element - - from IPython.lib.pretty import PrettyPrinter - - from . import ImageFile, ImageFilter, ImagePalette, ImageQt, TiffImagePlugin - from ._typing import CapsuleType, NumpyArray, StrOrBytesPath, TypeGuard -ID: list[str] = [] -OPEN: dict[ - str, - tuple[ - Callable[[IO[bytes], str | bytes], ImageFile.ImageFile], - Callable[[bytes], bool | str] | None, - ], -] = {} -MIME: dict[str, str] = {} -SAVE: dict[str, Callable[[Image, IO[bytes], str | bytes], None]] = {} -SAVE_ALL: dict[str, Callable[[Image, IO[bytes], str | bytes], None]] = {} -EXTENSION: dict[str, str] = {} -DECODERS: dict[str, type[ImageFile.PyDecoder]] = {} -ENCODERS: dict[str, type[ImageFile.PyEncoder]] = {} - -# -------------------------------------------------------------------- -# Modes - -_ENDIAN = "<" if sys.byteorder == "little" else ">" - - -def _conv_type_shape(im: Image) -> tuple[tuple[int, ...], str]: - m = ImageMode.getmode(im.mode) - shape: tuple[int, ...] = (im.height, im.width) - extra = len(m.bands) - if extra != 1: - shape += (extra,) - return shape, m.typestr - - -MODES = [ - "1", - "CMYK", - "F", - "HSV", - "I", - "I;16", - "I;16B", - "I;16L", - "I;16N", - "L", - "LA", - "La", - "LAB", - "P", - "PA", - "RGB", - "RGBA", - "RGBa", - "RGBX", - "YCbCr", -] - -# raw modes that may be memory mapped. NOTE: if you change this, you -# may have to modify the stride calculation in map.c too! -_MAPMODES = ("L", "P", "RGBX", "RGBA", "CMYK", "I;16", "I;16L", "I;16B") - - -def getmodebase(mode: str) -> str: - """ - Gets the "base" mode for given mode. This function returns "L" for - images that contain grayscale data, and "RGB" for images that - contain color data. - - :param mode: Input mode. - :returns: "L" or "RGB". - :exception KeyError: If the input mode was not a standard mode. - """ - return ImageMode.getmode(mode).basemode - - -def getmodetype(mode: str) -> str: - """ - Gets the storage type mode. Given a mode, this function returns a - single-layer mode suitable for storing individual bands. - - :param mode: Input mode. - :returns: "L", "I", or "F". - :exception KeyError: If the input mode was not a standard mode. - """ - return ImageMode.getmode(mode).basetype - - -def getmodebandnames(mode: str) -> tuple[str, ...]: - """ - Gets a list of individual band names. Given a mode, this function returns - a tuple containing the names of individual bands (use - :py:method:`~PIL.Image.getmodetype` to get the mode used to store each - individual band. - - :param mode: Input mode. - :returns: A tuple containing band names. The length of the tuple - gives the number of bands in an image of the given mode. - :exception KeyError: If the input mode was not a standard mode. - """ - return ImageMode.getmode(mode).bands - - -def getmodebands(mode: str) -> int: - """ - Gets the number of individual bands for this mode. - - :param mode: Input mode. - :returns: The number of bands in this mode. - :exception KeyError: If the input mode was not a standard mode. - """ - return len(ImageMode.getmode(mode).bands) - - -# -------------------------------------------------------------------- -# Helpers - -_initialized = 0 - - -def preinit() -> None: - """ - Explicitly loads BMP, GIF, JPEG, PPM and PPM file format drivers. - - It is called when opening or saving images. - """ - - global _initialized - if _initialized >= 1: - return - - try: - from . import BmpImagePlugin - - assert BmpImagePlugin - except ImportError: - pass - try: - from . import GifImagePlugin - - assert GifImagePlugin - except ImportError: - pass - try: - from . import JpegImagePlugin - - assert JpegImagePlugin - except ImportError: - pass - try: - from . import PpmImagePlugin - - assert PpmImagePlugin - except ImportError: - pass - try: - from . import PngImagePlugin - - assert PngImagePlugin - except ImportError: - pass - - _initialized = 1 - - -def init() -> bool: - """ - Explicitly initializes the Python Imaging Library. This function - loads all available file format drivers. - - It is called when opening or saving images if :py:meth:`~preinit()` is - insufficient, and by :py:meth:`~PIL.features.pilinfo`. - """ - - global _initialized - if _initialized >= 2: - return False - - parent_name = __name__.rpartition(".")[0] - for plugin in _plugins: - try: - logger.debug("Importing %s", plugin) - __import__(f"{parent_name}.{plugin}", globals(), locals(), []) - except ImportError as e: - logger.debug("Image: failed to import %s: %s", plugin, e) - - if OPEN or SAVE: - _initialized = 2 - return True - return False - - -# -------------------------------------------------------------------- -# Codec factories (used by tobytes/frombytes and ImageFile.load) - - -def _getdecoder( - mode: str, decoder_name: str, args: Any, extra: tuple[Any, ...] = () -) -> core.ImagingDecoder | ImageFile.PyDecoder: - # tweak arguments - if args is None: - args = () - elif not isinstance(args, tuple): - args = (args,) - - try: - decoder = DECODERS[decoder_name] - except KeyError: - pass - else: - return decoder(mode, *args + extra) - - try: - # get decoder - decoder = getattr(core, f"{decoder_name}_decoder") - except AttributeError as e: - msg = f"decoder {decoder_name} not available" - raise OSError(msg) from e - return decoder(mode, *args + extra) - - -def _getencoder( - mode: str, encoder_name: str, args: Any, extra: tuple[Any, ...] = () -) -> core.ImagingEncoder | ImageFile.PyEncoder: - # tweak arguments - if args is None: - args = () - elif not isinstance(args, tuple): - args = (args,) - - try: - encoder = ENCODERS[encoder_name] - except KeyError: - pass - else: - return encoder(mode, *args + extra) - - try: - # get encoder - encoder = getattr(core, f"{encoder_name}_encoder") - except AttributeError as e: - msg = f"encoder {encoder_name} not available" - raise OSError(msg) from e - return encoder(mode, *args + extra) - - -# -------------------------------------------------------------------- -# Simple expression analyzer - - -class ImagePointTransform: - """ - Used with :py:meth:`~PIL.Image.Image.point` for single band images with more than - 8 bits, this represents an affine transformation, where the value is multiplied by - ``scale`` and ``offset`` is added. - """ - - def __init__(self, scale: float, offset: float) -> None: - self.scale = scale - self.offset = offset - - def __neg__(self) -> ImagePointTransform: - return ImagePointTransform(-self.scale, -self.offset) - - def __add__(self, other: ImagePointTransform | float) -> ImagePointTransform: - if isinstance(other, ImagePointTransform): - return ImagePointTransform( - self.scale + other.scale, self.offset + other.offset - ) - return ImagePointTransform(self.scale, self.offset + other) - - __radd__ = __add__ - - def __sub__(self, other: ImagePointTransform | float) -> ImagePointTransform: - return self + -other - - def __rsub__(self, other: ImagePointTransform | float) -> ImagePointTransform: - return other + -self - - def __mul__(self, other: ImagePointTransform | float) -> ImagePointTransform: - if isinstance(other, ImagePointTransform): - return NotImplemented - return ImagePointTransform(self.scale * other, self.offset * other) - - __rmul__ = __mul__ - - def __truediv__(self, other: ImagePointTransform | float) -> ImagePointTransform: - if isinstance(other, ImagePointTransform): - return NotImplemented - return ImagePointTransform(self.scale / other, self.offset / other) - - -def _getscaleoffset( - expr: Callable[[ImagePointTransform], ImagePointTransform | float], -) -> tuple[float, float]: - a = expr(ImagePointTransform(1, 0)) - return (a.scale, a.offset) if isinstance(a, ImagePointTransform) else (0, a) - - -# -------------------------------------------------------------------- -# Implementation wrapper - - -class SupportsGetData(Protocol): - def getdata( - self, - ) -> tuple[Transform, Sequence[int]]: ... - - -class Image: - """ - This class represents an image object. To create - :py:class:`~PIL.Image.Image` objects, use the appropriate factory - functions. There's hardly ever any reason to call the Image constructor - directly. - - * :py:func:`~PIL.Image.open` - * :py:func:`~PIL.Image.new` - * :py:func:`~PIL.Image.frombytes` - """ - - format: str | None = None - format_description: str | None = None - _close_exclusive_fp_after_loading = True - - def __init__(self) -> None: - # FIXME: take "new" parameters / other image? - self._im: core.ImagingCore | DeferredError | None = None - self._mode = "" - self._size = (0, 0) - self.palette: ImagePalette.ImagePalette | None = None - self.info: dict[str | tuple[int, int], Any] = {} - self.readonly = 0 - self._exif: Exif | None = None - - @property - def im(self) -> core.ImagingCore: - if isinstance(self._im, DeferredError): - raise self._im.ex - assert self._im is not None - return self._im - - @im.setter - def im(self, im: core.ImagingCore) -> None: - self._im = im - - @property - def width(self) -> int: - return self.size[0] - - @property - def height(self) -> int: - return self.size[1] - - @property - def size(self) -> tuple[int, int]: - return self._size - - @property - def mode(self) -> str: - return self._mode - - @property - def readonly(self) -> int: - return (self._im and self._im.readonly) or self._readonly - - @readonly.setter - def readonly(self, readonly: int) -> None: - self._readonly = readonly - - def _new(self, im: core.ImagingCore) -> Image: - new = Image() - new.im = im - new._mode = im.mode - new._size = im.size - if im.mode in ("P", "PA"): - if self.palette: - new.palette = self.palette.copy() - else: - from . import ImagePalette - - new.palette = ImagePalette.ImagePalette() - new.info = self.info.copy() - return new - - # Context manager support - def __enter__(self): - return self - - def __exit__(self, *args): - from . import ImageFile - - if isinstance(self, ImageFile.ImageFile): - if getattr(self, "_exclusive_fp", False): - self._close_fp() - self.fp = None - - def close(self) -> None: - """ - This operation will destroy the image core and release its memory. - The image data will be unusable afterward. - - This function is required to close images that have multiple frames or - have not had their file read and closed by the - :py:meth:`~PIL.Image.Image.load` method. See :ref:`file-handling` for - more information. - """ - if getattr(self, "map", None): - if sys.platform == "win32" and hasattr(sys, "pypy_version_info"): - self.map.close() - self.map: mmap.mmap | None = None - - # Instead of simply setting to None, we're setting up a - # deferred error that will better explain that the core image - # object is gone. - self._im = DeferredError(ValueError("Operation on closed image")) - - def _copy(self) -> None: - self.load() - self.im = self.im.copy() - self.readonly = 0 - - def _ensure_mutable(self) -> None: - if self.readonly: - self._copy() - else: - self.load() - - def _dump( - self, file: str | None = None, format: str | None = None, **options: Any - ) -> str: - suffix = "" - if format: - suffix = f".{format}" - - if not file: - f, filename = tempfile.mkstemp(suffix) - os.close(f) - else: - filename = file - if not filename.endswith(suffix): - filename = filename + suffix - - self.load() - - if not format or format == "PPM": - self.im.save_ppm(filename) - else: - self.save(filename, format, **options) - - return filename - - def __eq__(self, other: object) -> bool: - if self.__class__ is not other.__class__: - return False - assert isinstance(other, Image) - return ( - self.mode == other.mode - and self.size == other.size - and self.info == other.info - and self.getpalette() == other.getpalette() - and self.tobytes() == other.tobytes() - ) - - def __repr__(self) -> str: - return ( - f"<{self.__class__.__module__}.{self.__class__.__name__} " - f"image mode={self.mode} size={self.size[0]}x{self.size[1]} " - f"at 0x{id(self):X}>" - ) - - def _repr_pretty_(self, p: PrettyPrinter, cycle: bool) -> None: - """IPython plain text display support""" - - # Same as __repr__ but without unpredictable id(self), - # to keep Jupyter notebook `text/plain` output stable. - p.text( - f"<{self.__class__.__module__}.{self.__class__.__name__} " - f"image mode={self.mode} size={self.size[0]}x{self.size[1]}>" - ) - - def _repr_image(self, image_format: str, **kwargs: Any) -> bytes | None: - """Helper function for iPython display hook. - - :param image_format: Image format. - :returns: image as bytes, saved into the given format. - """ - b = io.BytesIO() - try: - self.save(b, image_format, **kwargs) - except Exception: - return None - return b.getvalue() - - def _repr_png_(self) -> bytes | None: - """iPython display hook support for PNG format. - - :returns: PNG version of the image as bytes - """ - return self._repr_image("PNG", compress_level=1) - - def _repr_jpeg_(self) -> bytes | None: - """iPython display hook support for JPEG format. - - :returns: JPEG version of the image as bytes - """ - return self._repr_image("JPEG") - - @property - def __array_interface__(self) -> dict[str, str | bytes | int | tuple[int, ...]]: - # numpy array interface support - new: dict[str, str | bytes | int | tuple[int, ...]] = {"version": 3} - if self.mode == "1": - # Binary images need to be extended from bits to bytes - # See: https://github.com/python-pillow/Pillow/issues/350 - new["data"] = self.tobytes("raw", "L") - else: - new["data"] = self.tobytes() - new["shape"], new["typestr"] = _conv_type_shape(self) - return new - - def __arrow_c_schema__(self) -> object: - self.load() - return self.im.__arrow_c_schema__() - - def __arrow_c_array__( - self, requested_schema: object | None = None - ) -> tuple[object, object]: - self.load() - return (self.im.__arrow_c_schema__(), self.im.__arrow_c_array__()) - - def __getstate__(self) -> list[Any]: - im_data = self.tobytes() # load image first - return [self.info, self.mode, self.size, self.getpalette(), im_data] - - def __setstate__(self, state: list[Any]) -> None: - Image.__init__(self) - info, mode, size, palette, data = state[:5] - self.info = info - self._mode = mode - self._size = size - self.im = core.new(mode, size) - if mode in ("L", "LA", "P", "PA") and palette: - self.putpalette(palette) - self.frombytes(data) - - def tobytes(self, encoder_name: str = "raw", *args: Any) -> bytes: - """ - Return image as a bytes object. - - .. warning:: - - This method returns raw image data derived from Pillow's internal - storage. For compressed image data (e.g. PNG, JPEG) use - :meth:`~.save`, with a BytesIO parameter for in-memory data. - - :param encoder_name: What encoder to use. - - The default is to use the standard "raw" encoder. - To see how this packs pixel data into the returned - bytes, see :file:`libImaging/Pack.c`. - - A list of C encoders can be seen under codecs - section of the function array in - :file:`_imaging.c`. Python encoders are registered - within the relevant plugins. - :param args: Extra arguments to the encoder. - :returns: A :py:class:`bytes` object. - """ - - encoder_args: Any = args - if len(encoder_args) == 1 and isinstance(encoder_args[0], tuple): - # may pass tuple instead of argument list - encoder_args = encoder_args[0] - - if encoder_name == "raw" and encoder_args == (): - encoder_args = self.mode - - self.load() - - if self.width == 0 or self.height == 0: - return b"" - - # unpack data - e = _getencoder(self.mode, encoder_name, encoder_args) - e.setimage(self.im) - - from . import ImageFile - - bufsize = max(ImageFile.MAXBLOCK, self.size[0] * 4) # see RawEncode.c - - output = [] - while True: - bytes_consumed, errcode, data = e.encode(bufsize) - output.append(data) - if errcode: - break - if errcode < 0: - msg = f"encoder error {errcode} in tobytes" - raise RuntimeError(msg) - - return b"".join(output) - - def tobitmap(self, name: str = "image") -> bytes: - """ - Returns the image converted to an X11 bitmap. - - .. note:: This method only works for mode "1" images. - - :param name: The name prefix to use for the bitmap variables. - :returns: A string containing an X11 bitmap. - :raises ValueError: If the mode is not "1" - """ - - self.load() - if self.mode != "1": - msg = "not a bitmap" - raise ValueError(msg) - data = self.tobytes("xbm") - return b"".join( - [ - f"#define {name}_width {self.size[0]}\n".encode("ascii"), - f"#define {name}_height {self.size[1]}\n".encode("ascii"), - f"static char {name}_bits[] = {{\n".encode("ascii"), - data, - b"};", - ] - ) - - def frombytes( - self, - data: bytes | bytearray | SupportsArrayInterface, - decoder_name: str = "raw", - *args: Any, - ) -> None: - """ - Loads this image with pixel data from a bytes object. - - This method is similar to the :py:func:`~PIL.Image.frombytes` function, - but loads data into this image instead of creating a new image object. - """ - - if self.width == 0 or self.height == 0: - return - - decoder_args: Any = args - if len(decoder_args) == 1 and isinstance(decoder_args[0], tuple): - # may pass tuple instead of argument list - decoder_args = decoder_args[0] - - # default format - if decoder_name == "raw" and decoder_args == (): - decoder_args = self.mode - - # unpack data - d = _getdecoder(self.mode, decoder_name, decoder_args) - d.setimage(self.im) - s = d.decode(data) - - if s[0] >= 0: - msg = "not enough image data" - raise ValueError(msg) - if s[1] != 0: - msg = "cannot decode image data" - raise ValueError(msg) - - def load(self) -> core.PixelAccess | None: - """ - Allocates storage for the image and loads the pixel data. In - normal cases, you don't need to call this method, since the - Image class automatically loads an opened image when it is - accessed for the first time. - - If the file associated with the image was opened by Pillow, then this - method will close it. The exception to this is if the image has - multiple frames, in which case the file will be left open for seek - operations. See :ref:`file-handling` for more information. - - :returns: An image access object. - :rtype: :py:class:`.PixelAccess` - """ - if self._im is not None and self.palette and self.palette.dirty: - # realize palette - mode, arr = self.palette.getdata() - self.im.putpalette(self.palette.mode, mode, arr) - self.palette.dirty = 0 - self.palette.rawmode = None - if "transparency" in self.info and mode in ("LA", "PA"): - if isinstance(self.info["transparency"], int): - self.im.putpalettealpha(self.info["transparency"], 0) - else: - self.im.putpalettealphas(self.info["transparency"]) - self.palette.mode = "RGBA" - else: - self.palette.palette = self.im.getpalette( - self.palette.mode, self.palette.mode - ) - - if self._im is not None: - return self.im.pixel_access(self.readonly) - return None - - def verify(self) -> None: - """ - Verifies the contents of a file. For data read from a file, this - method attempts to determine if the file is broken, without - actually decoding the image data. If this method finds any - problems, it raises suitable exceptions. If you need to load - the image after using this method, you must reopen the image - file. - """ - pass - - def convert( - self, - mode: str | None = None, - matrix: tuple[float, ...] | None = None, - dither: Dither | None = None, - palette: Palette = Palette.WEB, - colors: int = 256, - ) -> Image: - """ - Returns a converted copy of this image. For the "P" mode, this - method translates pixels through the palette. If mode is - omitted, a mode is chosen so that all information in the image - and the palette can be represented without a palette. - - This supports all possible conversions between "L", "RGB" and "CMYK". The - ``matrix`` argument only supports "L" and "RGB". - - When translating a color image to grayscale (mode "L"), - the library uses the ITU-R 601-2 luma transform:: - - L = R * 299/1000 + G * 587/1000 + B * 114/1000 - - The default method of converting a grayscale ("L") or "RGB" - image into a bilevel (mode "1") image uses Floyd-Steinberg - dither to approximate the original image luminosity levels. If - dither is ``None``, all values larger than 127 are set to 255 (white), - all other values to 0 (black). To use other thresholds, use the - :py:meth:`~PIL.Image.Image.point` method. - - When converting from "RGBA" to "P" without a ``matrix`` argument, - this passes the operation to :py:meth:`~PIL.Image.Image.quantize`, - and ``dither`` and ``palette`` are ignored. - - When converting from "PA", if an "RGBA" palette is present, the alpha - channel from the image will be used instead of the values from the palette. - - :param mode: The requested mode. See: :ref:`concept-modes`. - :param matrix: An optional conversion matrix. If given, this - should be 4- or 12-tuple containing floating point values. - :param dither: Dithering method, used when converting from - mode "RGB" to "P" or from "RGB" or "L" to "1". - Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG` - (default). Note that this is not used when ``matrix`` is supplied. - :param palette: Palette to use when converting from mode "RGB" - to "P". Available palettes are :data:`Palette.WEB` or - :data:`Palette.ADAPTIVE`. - :param colors: Number of colors to use for the :data:`Palette.ADAPTIVE` - palette. Defaults to 256. - :rtype: :py:class:`~PIL.Image.Image` - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - if mode in ("BGR;15", "BGR;16", "BGR;24"): - deprecate(mode, 12) - - self.load() - - has_transparency = "transparency" in self.info - if not mode and self.mode == "P": - # determine default mode - if self.palette: - mode = self.palette.mode - else: - mode = "RGB" - if mode == "RGB" and has_transparency: - mode = "RGBA" - if not mode or (mode == self.mode and not matrix): - return self.copy() - - if matrix: - # matrix conversion - if mode not in ("L", "RGB"): - msg = "illegal conversion" - raise ValueError(msg) - im = self.im.convert_matrix(mode, matrix) - new_im = self._new(im) - if has_transparency and self.im.bands == 3: - transparency = new_im.info["transparency"] - - def convert_transparency( - m: tuple[float, ...], v: tuple[int, int, int] - ) -> int: - value = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * 0.5 - return max(0, min(255, int(value))) - - if mode == "L": - transparency = convert_transparency(matrix, transparency) - elif len(mode) == 3: - transparency = tuple( - convert_transparency(matrix[i * 4 : i * 4 + 4], transparency) - for i in range(len(transparency)) - ) - new_im.info["transparency"] = transparency - return new_im - - if mode == "P" and self.mode == "RGBA": - return self.quantize(colors) - - trns = None - delete_trns = False - # transparency handling - if has_transparency: - if (self.mode in ("1", "L", "I", "I;16") and mode in ("LA", "RGBA")) or ( - self.mode == "RGB" and mode in ("La", "LA", "RGBa", "RGBA") - ): - # Use transparent conversion to promote from transparent - # color to an alpha channel. - new_im = self._new( - self.im.convert_transparent(mode, self.info["transparency"]) - ) - del new_im.info["transparency"] - return new_im - elif self.mode in ("L", "RGB", "P") and mode in ("L", "RGB", "P"): - t = self.info["transparency"] - if isinstance(t, bytes): - # Dragons. This can't be represented by a single color - warnings.warn( - "Palette images with Transparency expressed in bytes should be " - "converted to RGBA images" - ) - delete_trns = True - else: - # get the new transparency color. - # use existing conversions - trns_im = new(self.mode, (1, 1)) - if self.mode == "P": - assert self.palette is not None - trns_im.putpalette(self.palette, self.palette.mode) - if isinstance(t, tuple): - err = "Couldn't allocate a palette color for transparency" - assert trns_im.palette is not None - try: - t = trns_im.palette.getcolor(t, self) - except ValueError as e: - if str(e) == "cannot allocate more than 256 colors": - # If all 256 colors are in use, - # then there is no need for transparency - t = None - else: - raise ValueError(err) from e - if t is None: - trns = None - else: - trns_im.putpixel((0, 0), t) - - if mode in ("L", "RGB"): - trns_im = trns_im.convert(mode) - else: - # can't just retrieve the palette number, got to do it - # after quantization. - trns_im = trns_im.convert("RGB") - trns = trns_im.getpixel((0, 0)) - - elif self.mode == "P" and mode in ("LA", "PA", "RGBA"): - t = self.info["transparency"] - delete_trns = True - - if isinstance(t, bytes): - self.im.putpalettealphas(t) - elif isinstance(t, int): - self.im.putpalettealpha(t, 0) - else: - msg = "Transparency for P mode should be bytes or int" - raise ValueError(msg) - - if mode == "P" and palette == Palette.ADAPTIVE: - im = self.im.quantize(colors) - new_im = self._new(im) - from . import ImagePalette - - new_im.palette = ImagePalette.ImagePalette( - "RGB", new_im.im.getpalette("RGB") - ) - if delete_trns: - # This could possibly happen if we requantize to fewer colors. - # The transparency would be totally off in that case. - del new_im.info["transparency"] - if trns is not None: - try: - new_im.info["transparency"] = new_im.palette.getcolor( - cast(tuple[int, ...], trns), # trns was converted to RGB - new_im, - ) - except Exception: - # if we can't make a transparent color, don't leave the old - # transparency hanging around to mess us up. - del new_im.info["transparency"] - warnings.warn("Couldn't allocate palette entry for transparency") - return new_im - - if "LAB" in (self.mode, mode): - im = self - if mode == "LAB": - if im.mode not in ("RGB", "RGBA", "RGBX"): - im = im.convert("RGBA") - other_mode = im.mode - else: - other_mode = mode - if other_mode in ("RGB", "RGBA", "RGBX"): - from . import ImageCms - - srgb = ImageCms.createProfile("sRGB") - lab = ImageCms.createProfile("LAB") - profiles = [lab, srgb] if im.mode == "LAB" else [srgb, lab] - transform = ImageCms.buildTransform( - profiles[0], profiles[1], im.mode, mode - ) - return transform.apply(im) - - # colorspace conversion - if dither is None: - dither = Dither.FLOYDSTEINBERG - - try: - im = self.im.convert(mode, dither) - except ValueError: - try: - # normalize source image and try again - modebase = getmodebase(self.mode) - if modebase == self.mode: - raise - im = self.im.convert(modebase) - im = im.convert(mode, dither) - except KeyError as e: - msg = "illegal conversion" - raise ValueError(msg) from e - - new_im = self._new(im) - if mode == "P" and palette != Palette.ADAPTIVE: - from . import ImagePalette - - new_im.palette = ImagePalette.ImagePalette("RGB", im.getpalette("RGB")) - if delete_trns: - # crash fail if we leave a bytes transparency in an rgb/l mode. - del new_im.info["transparency"] - if trns is not None: - if new_im.mode == "P" and new_im.palette: - try: - new_im.info["transparency"] = new_im.palette.getcolor( - cast(tuple[int, ...], trns), new_im # trns was converted to RGB - ) - except ValueError as e: - del new_im.info["transparency"] - if str(e) != "cannot allocate more than 256 colors": - # If all 256 colors are in use, - # then there is no need for transparency - warnings.warn( - "Couldn't allocate palette entry for transparency" - ) - else: - new_im.info["transparency"] = trns - return new_im - - def quantize( - self, - colors: int = 256, - method: int | None = None, - kmeans: int = 0, - palette: Image | None = None, - dither: Dither = Dither.FLOYDSTEINBERG, - ) -> Image: - """ - Convert the image to 'P' mode with the specified number - of colors. - - :param colors: The desired number of colors, <= 256 - :param method: :data:`Quantize.MEDIANCUT` (median cut), - :data:`Quantize.MAXCOVERAGE` (maximum coverage), - :data:`Quantize.FASTOCTREE` (fast octree), - :data:`Quantize.LIBIMAGEQUANT` (libimagequant; check support - using :py:func:`PIL.features.check_feature` with - ``feature="libimagequant"``). - - By default, :data:`Quantize.MEDIANCUT` will be used. - - The exception to this is RGBA images. :data:`Quantize.MEDIANCUT` - and :data:`Quantize.MAXCOVERAGE` do not support RGBA images, so - :data:`Quantize.FASTOCTREE` is used by default instead. - :param kmeans: Integer greater than or equal to zero. - :param palette: Quantize to the palette of given - :py:class:`PIL.Image.Image`. - :param dither: Dithering method, used when converting from - mode "RGB" to "P" or from "RGB" or "L" to "1". - Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG` - (default). - :returns: A new image - """ - - self.load() - - if method is None: - # defaults: - method = Quantize.MEDIANCUT - if self.mode == "RGBA": - method = Quantize.FASTOCTREE - - if self.mode == "RGBA" and method not in ( - Quantize.FASTOCTREE, - Quantize.LIBIMAGEQUANT, - ): - # Caller specified an invalid mode. - msg = ( - "Fast Octree (method == 2) and libimagequant (method == 3) " - "are the only valid methods for quantizing RGBA images" - ) - raise ValueError(msg) - - if palette: - # use palette from reference image - palette.load() - if palette.mode != "P": - msg = "bad mode for palette image" - raise ValueError(msg) - if self.mode not in {"RGB", "L"}: - msg = "only RGB or L mode images can be quantized to a palette" - raise ValueError(msg) - im = self.im.convert("P", dither, palette.im) - new_im = self._new(im) - assert palette.palette is not None - new_im.palette = palette.palette.copy() - return new_im - - if kmeans < 0: - msg = "kmeans must not be negative" - raise ValueError(msg) - - im = self._new(self.im.quantize(colors, method, kmeans)) - - from . import ImagePalette - - mode = im.im.getpalettemode() - palette_data = im.im.getpalette(mode, mode)[: colors * len(mode)] - im.palette = ImagePalette.ImagePalette(mode, palette_data) - - return im - - def copy(self) -> Image: - """ - Copies this image. Use this method if you wish to paste things - into an image, but still retain the original. - - :rtype: :py:class:`~PIL.Image.Image` - :returns: An :py:class:`~PIL.Image.Image` object. - """ - self.load() - return self._new(self.im.copy()) - - __copy__ = copy - - def crop(self, box: tuple[float, float, float, float] | None = None) -> Image: - """ - Returns a rectangular region from this image. The box is a - 4-tuple defining the left, upper, right, and lower pixel - coordinate. See :ref:`coordinate-system`. - - Note: Prior to Pillow 3.4.0, this was a lazy operation. - - :param box: The crop rectangle, as a (left, upper, right, lower)-tuple. - :rtype: :py:class:`~PIL.Image.Image` - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - if box is None: - return self.copy() - - if box[2] < box[0]: - msg = "Coordinate 'right' is less than 'left'" - raise ValueError(msg) - elif box[3] < box[1]: - msg = "Coordinate 'lower' is less than 'upper'" - raise ValueError(msg) - - self.load() - return self._new(self._crop(self.im, box)) - - def _crop( - self, im: core.ImagingCore, box: tuple[float, float, float, float] - ) -> core.ImagingCore: - """ - Returns a rectangular region from the core image object im. - - This is equivalent to calling im.crop((x0, y0, x1, y1)), but - includes additional sanity checks. - - :param im: a core image object - :param box: The crop rectangle, as a (left, upper, right, lower)-tuple. - :returns: A core image object. - """ - - x0, y0, x1, y1 = map(int, map(round, box)) - - absolute_values = (abs(x1 - x0), abs(y1 - y0)) - - _decompression_bomb_check(absolute_values) - - return im.crop((x0, y0, x1, y1)) - - def draft( - self, mode: str | None, size: tuple[int, int] | None - ) -> tuple[str, tuple[int, int, float, float]] | None: - """ - Configures the image file loader so it returns a version of the - image that as closely as possible matches the given mode and - size. For example, you can use this method to convert a color - JPEG to grayscale while loading it. - - If any changes are made, returns a tuple with the chosen ``mode`` and - ``box`` with coordinates of the original image within the altered one. - - Note that this method modifies the :py:class:`~PIL.Image.Image` object - in place. If the image has already been loaded, this method has no - effect. - - Note: This method is not implemented for most images. It is - currently implemented only for JPEG and MPO images. - - :param mode: The requested mode. - :param size: The requested size in pixels, as a 2-tuple: - (width, height). - """ - pass - - def _expand(self, xmargin: int, ymargin: int | None = None) -> Image: - if ymargin is None: - ymargin = xmargin - self.load() - return self._new(self.im.expand(xmargin, ymargin)) - - def filter(self, filter: ImageFilter.Filter | type[ImageFilter.Filter]) -> Image: - """ - Filters this image using the given filter. For a list of - available filters, see the :py:mod:`~PIL.ImageFilter` module. - - :param filter: Filter kernel. - :returns: An :py:class:`~PIL.Image.Image` object.""" - - from . import ImageFilter - - self.load() - - if callable(filter): - filter = filter() - if not hasattr(filter, "filter"): - msg = "filter argument should be ImageFilter.Filter instance or class" - raise TypeError(msg) - - multiband = isinstance(filter, ImageFilter.MultibandFilter) - if self.im.bands == 1 or multiband: - return self._new(filter.filter(self.im)) - - ims = [ - self._new(filter.filter(self.im.getband(c))) for c in range(self.im.bands) - ] - return merge(self.mode, ims) - - def getbands(self) -> tuple[str, ...]: - """ - Returns a tuple containing the name of each band in this image. - For example, ``getbands`` on an RGB image returns ("R", "G", "B"). - - :returns: A tuple containing band names. - :rtype: tuple - """ - return ImageMode.getmode(self.mode).bands - - def getbbox(self, *, alpha_only: bool = True) -> tuple[int, int, int, int] | None: - """ - Calculates the bounding box of the non-zero regions in the - image. - - :param alpha_only: Optional flag, defaulting to ``True``. - If ``True`` and the image has an alpha channel, trim transparent pixels. - Otherwise, trim pixels when all channels are zero. - Keyword-only argument. - :returns: The bounding box is returned as a 4-tuple defining the - left, upper, right, and lower pixel coordinate. See - :ref:`coordinate-system`. If the image is completely empty, this - method returns None. - - """ - - self.load() - return self.im.getbbox(alpha_only) - - def getcolors( - self, maxcolors: int = 256 - ) -> list[tuple[int, tuple[int, ...]]] | list[tuple[int, float]] | None: - """ - Returns a list of colors used in this image. - - The colors will be in the image's mode. For example, an RGB image will - return a tuple of (red, green, blue) color values, and a P image will - return the index of the color in the palette. - - :param maxcolors: Maximum number of colors. If this number is - exceeded, this method returns None. The default limit is - 256 colors. - :returns: An unsorted list of (count, pixel) values. - """ - - self.load() - if self.mode in ("1", "L", "P"): - h = self.im.histogram() - out: list[tuple[int, float]] = [(h[i], i) for i in range(256) if h[i]] - if len(out) > maxcolors: - return None - return out - return self.im.getcolors(maxcolors) - - def getdata(self, band: int | None = None) -> core.ImagingCore: - """ - Returns the contents of this image as a sequence object - containing pixel values. The sequence object is flattened, so - that values for line one follow directly after the values of - line zero, and so on. - - Note that the sequence object returned by this method is an - internal PIL data type, which only supports certain sequence - operations. To convert it to an ordinary sequence (e.g. for - printing), use ``list(im.getdata())``. - - :param band: What band to return. The default is to return - all bands. To return a single band, pass in the index - value (e.g. 0 to get the "R" band from an "RGB" image). - :returns: A sequence-like object. - """ - - self.load() - if band is not None: - return self.im.getband(band) - return self.im # could be abused - - def getextrema(self) -> tuple[float, float] | tuple[tuple[int, int], ...]: - """ - Gets the minimum and maximum pixel values for each band in - the image. - - :returns: For a single-band image, a 2-tuple containing the - minimum and maximum pixel value. For a multi-band image, - a tuple containing one 2-tuple for each band. - """ - - self.load() - if self.im.bands > 1: - return tuple(self.im.getband(i).getextrema() for i in range(self.im.bands)) - return self.im.getextrema() - - def getxmp(self) -> dict[str, Any]: - """ - Returns a dictionary containing the XMP tags. - Requires defusedxml to be installed. - - :returns: XMP tags in a dictionary. - """ - - def get_name(tag: str) -> str: - return re.sub("^{[^}]+}", "", tag) - - def get_value(element: Element) -> str | dict[str, Any] | None: - value: dict[str, Any] = {get_name(k): v for k, v in element.attrib.items()} - children = list(element) - if children: - for child in children: - name = get_name(child.tag) - child_value = get_value(child) - if name in value: - if not isinstance(value[name], list): - value[name] = [value[name]] - value[name].append(child_value) - else: - value[name] = child_value - elif value: - if element.text: - value["text"] = element.text - else: - return element.text - return value - - if ElementTree is None: - warnings.warn("XMP data cannot be read without defusedxml dependency") - return {} - if "xmp" not in self.info: - return {} - root = ElementTree.fromstring(self.info["xmp"].rstrip(b"\x00 ")) - return {get_name(root.tag): get_value(root)} - - def getexif(self) -> Exif: - """ - Gets EXIF data from the image. - - :returns: an :py:class:`~PIL.Image.Exif` object. - """ - if self._exif is None: - self._exif = Exif() - elif self._exif._loaded: - return self._exif - self._exif._loaded = True - - exif_info = self.info.get("exif") - if exif_info is None: - if "Raw profile type exif" in self.info: - exif_info = bytes.fromhex( - "".join(self.info["Raw profile type exif"].split("\n")[3:]) - ) - elif hasattr(self, "tag_v2"): - self._exif.bigtiff = self.tag_v2._bigtiff - self._exif.endian = self.tag_v2._endian - self._exif.load_from_fp(self.fp, self.tag_v2._offset) - if exif_info is not None: - self._exif.load(exif_info) - - # XMP tags - if ExifTags.Base.Orientation not in self._exif: - xmp_tags = self.info.get("XML:com.adobe.xmp") - pattern: str | bytes = r'tiff:Orientation(="|>)([0-9])' - if not xmp_tags and (xmp_tags := self.info.get("xmp")): - pattern = rb'tiff:Orientation(="|>)([0-9])' - if xmp_tags: - match = re.search(pattern, xmp_tags) - if match: - self._exif[ExifTags.Base.Orientation] = int(match[2]) - - return self._exif - - def _reload_exif(self) -> None: - if self._exif is None or not self._exif._loaded: - return - self._exif._loaded = False - self.getexif() - - def get_child_images(self) -> list[ImageFile.ImageFile]: - from . import ImageFile - - deprecate("Image.Image.get_child_images", 13) - return ImageFile.ImageFile.get_child_images(self) # type: ignore[arg-type] - - def getim(self) -> CapsuleType: - """ - Returns a capsule that points to the internal image memory. - - :returns: A capsule object. - """ - - self.load() - return self.im.ptr - - def getpalette(self, rawmode: str | None = "RGB") -> list[int] | None: - """ - Returns the image palette as a list. - - :param rawmode: The mode in which to return the palette. ``None`` will - return the palette in its current mode. - - .. versionadded:: 9.1.0 - - :returns: A list of color values [r, g, b, ...], or None if the - image has no palette. - """ - - self.load() - try: - mode = self.im.getpalettemode() - except ValueError: - return None # no palette - if rawmode is None: - rawmode = mode - return list(self.im.getpalette(mode, rawmode)) - - @property - def has_transparency_data(self) -> bool: - """ - Determine if an image has transparency data, whether in the form of an - alpha channel, a palette with an alpha channel, or a "transparency" key - in the info dictionary. - - Note the image might still appear solid, if all of the values shown - within are opaque. - - :returns: A boolean. - """ - if ( - self.mode in ("LA", "La", "PA", "RGBA", "RGBa") - or "transparency" in self.info - ): - return True - if self.mode == "P": - assert self.palette is not None - return self.palette.mode.endswith("A") - return False - - def apply_transparency(self) -> None: - """ - If a P mode image has a "transparency" key in the info dictionary, - remove the key and instead apply the transparency to the palette. - Otherwise, the image is unchanged. - """ - if self.mode != "P" or "transparency" not in self.info: - return - - from . import ImagePalette - - palette = self.getpalette("RGBA") - assert palette is not None - transparency = self.info["transparency"] - if isinstance(transparency, bytes): - for i, alpha in enumerate(transparency): - palette[i * 4 + 3] = alpha - else: - palette[transparency * 4 + 3] = 0 - self.palette = ImagePalette.ImagePalette("RGBA", bytes(palette)) - self.palette.dirty = 1 - - del self.info["transparency"] - - def getpixel( - self, xy: tuple[int, int] | list[int] - ) -> float | tuple[int, ...] | None: - """ - Returns the pixel value at a given position. - - :param xy: The coordinate, given as (x, y). See - :ref:`coordinate-system`. - :returns: The pixel value. If the image is a multi-layer image, - this method returns a tuple. - """ - - self.load() - return self.im.getpixel(tuple(xy)) - - def getprojection(self) -> tuple[list[int], list[int]]: - """ - Get projection to x and y axes - - :returns: Two sequences, indicating where there are non-zero - pixels along the X-axis and the Y-axis, respectively. - """ - - self.load() - x, y = self.im.getprojection() - return list(x), list(y) - - def histogram( - self, mask: Image | None = None, extrema: tuple[float, float] | None = None - ) -> list[int]: - """ - Returns a histogram for the image. The histogram is returned as a - list of pixel counts, one for each pixel value in the source - image. Counts are grouped into 256 bins for each band, even if - the image has more than 8 bits per band. If the image has more - than one band, the histograms for all bands are concatenated (for - example, the histogram for an "RGB" image contains 768 values). - - A bilevel image (mode "1") is treated as a grayscale ("L") image - by this method. - - If a mask is provided, the method returns a histogram for those - parts of the image where the mask image is non-zero. The mask - image must have the same size as the image, and be either a - bi-level image (mode "1") or a grayscale image ("L"). - - :param mask: An optional mask. - :param extrema: An optional tuple of manually-specified extrema. - :returns: A list containing pixel counts. - """ - self.load() - if mask: - mask.load() - return self.im.histogram((0, 0), mask.im) - if self.mode in ("I", "F"): - return self.im.histogram( - extrema if extrema is not None else self.getextrema() - ) - return self.im.histogram() - - def entropy( - self, mask: Image | None = None, extrema: tuple[float, float] | None = None - ) -> float: - """ - Calculates and returns the entropy for the image. - - A bilevel image (mode "1") is treated as a grayscale ("L") - image by this method. - - If a mask is provided, the method employs the histogram for - those parts of the image where the mask image is non-zero. - The mask image must have the same size as the image, and be - either a bi-level image (mode "1") or a grayscale image ("L"). - - :param mask: An optional mask. - :param extrema: An optional tuple of manually-specified extrema. - :returns: A float value representing the image entropy - """ - self.load() - if mask: - mask.load() - return self.im.entropy((0, 0), mask.im) - if self.mode in ("I", "F"): - return self.im.entropy( - extrema if extrema is not None else self.getextrema() - ) - return self.im.entropy() - - def paste( - self, - im: Image | str | float | tuple[float, ...], - box: Image | tuple[int, int, int, int] | tuple[int, int] | None = None, - mask: Image | None = None, - ) -> None: - """ - Pastes another image into this image. The box argument is either - a 2-tuple giving the upper left corner, a 4-tuple defining the - left, upper, right, and lower pixel coordinate, or None (same as - (0, 0)). See :ref:`coordinate-system`. If a 4-tuple is given, the size - of the pasted image must match the size of the region. - - If the modes don't match, the pasted image is converted to the mode of - this image (see the :py:meth:`~PIL.Image.Image.convert` method for - details). - - Instead of an image, the source can be a integer or tuple - containing pixel values. The method then fills the region - with the given color. When creating RGB images, you can - also use color strings as supported by the ImageColor module. - - If a mask is given, this method updates only the regions - indicated by the mask. You can use either "1", "L", "LA", "RGBA" - or "RGBa" images (if present, the alpha band is used as mask). - Where the mask is 255, the given image is copied as is. Where - the mask is 0, the current value is preserved. Intermediate - values will mix the two images together, including their alpha - channels if they have them. - - See :py:meth:`~PIL.Image.Image.alpha_composite` if you want to - combine images with respect to their alpha channels. - - :param im: Source image or pixel value (integer, float or tuple). - :param box: An optional 4-tuple giving the region to paste into. - If a 2-tuple is used instead, it's treated as the upper left - corner. If omitted or None, the source is pasted into the - upper left corner. - - If an image is given as the second argument and there is no - third, the box defaults to (0, 0), and the second argument - is interpreted as a mask image. - :param mask: An optional mask image. - """ - - if isinstance(box, Image): - if mask is not None: - msg = "If using second argument as mask, third argument must be None" - raise ValueError(msg) - # abbreviated paste(im, mask) syntax - mask = box - box = None - - if box is None: - box = (0, 0) - - if len(box) == 2: - # upper left corner given; get size from image or mask - if isinstance(im, Image): - size = im.size - elif isinstance(mask, Image): - size = mask.size - else: - # FIXME: use self.size here? - msg = "cannot determine region size; use 4-item box" - raise ValueError(msg) - box += (box[0] + size[0], box[1] + size[1]) - - source: core.ImagingCore | str | float | tuple[float, ...] - if isinstance(im, str): - from . import ImageColor - - source = ImageColor.getcolor(im, self.mode) - elif isinstance(im, Image): - im.load() - if self.mode != im.mode: - if self.mode != "RGB" or im.mode not in ("LA", "RGBA", "RGBa"): - # should use an adapter for this! - im = im.convert(self.mode) - source = im.im - else: - source = im - - self._ensure_mutable() - - if mask: - mask.load() - self.im.paste(source, box, mask.im) - else: - self.im.paste(source, box) - - def alpha_composite( - self, im: Image, dest: Sequence[int] = (0, 0), source: Sequence[int] = (0, 0) - ) -> None: - """'In-place' analog of Image.alpha_composite. Composites an image - onto this image. - - :param im: image to composite over this one - :param dest: Optional 2 tuple (left, top) specifying the upper - left corner in this (destination) image. - :param source: Optional 2 (left, top) tuple for the upper left - corner in the overlay source image, or 4 tuple (left, top, right, - bottom) for the bounds of the source rectangle - - Performance Note: Not currently implemented in-place in the core layer. - """ - - if not isinstance(source, (list, tuple)): - msg = "Source must be a list or tuple" - raise ValueError(msg) - if not isinstance(dest, (list, tuple)): - msg = "Destination must be a list or tuple" - raise ValueError(msg) - - if len(source) == 4: - overlay_crop_box = tuple(source) - elif len(source) == 2: - overlay_crop_box = tuple(source) + im.size - else: - msg = "Source must be a sequence of length 2 or 4" - raise ValueError(msg) - - if not len(dest) == 2: - msg = "Destination must be a sequence of length 2" - raise ValueError(msg) - if min(source) < 0: - msg = "Source must be non-negative" - raise ValueError(msg) - - # over image, crop if it's not the whole image. - if overlay_crop_box == (0, 0) + im.size: - overlay = im - else: - overlay = im.crop(overlay_crop_box) - - # target for the paste - box = tuple(dest) + (dest[0] + overlay.width, dest[1] + overlay.height) - - # destination image. don't copy if we're using the whole image. - if box == (0, 0) + self.size: - background = self - else: - background = self.crop(box) - - result = alpha_composite(background, overlay) - self.paste(result, box) - - def point( - self, - lut: ( - Sequence[float] - | NumpyArray - | Callable[[int], float] - | Callable[[ImagePointTransform], ImagePointTransform | float] - | ImagePointHandler - ), - mode: str | None = None, - ) -> Image: - """ - Maps this image through a lookup table or function. - - :param lut: A lookup table, containing 256 (or 65536 if - self.mode=="I" and mode == "L") values per band in the - image. A function can be used instead, it should take a - single argument. The function is called once for each - possible pixel value, and the resulting table is applied to - all bands of the image. - - It may also be an :py:class:`~PIL.Image.ImagePointHandler` - object:: - - class Example(Image.ImagePointHandler): - def point(self, im: Image) -> Image: - # Return result - :param mode: Output mode (default is same as input). This can only be used if - the source image has mode "L" or "P", and the output has mode "1" or the - source image mode is "I" and the output mode is "L". - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - self.load() - - if isinstance(lut, ImagePointHandler): - return lut.point(self) - - if callable(lut): - # if it isn't a list, it should be a function - if self.mode in ("I", "I;16", "F"): - # check if the function can be used with point_transform - # UNDONE wiredfool -- I think this prevents us from ever doing - # a gamma function point transform on > 8bit images. - scale, offset = _getscaleoffset(lut) # type: ignore[arg-type] - return self._new(self.im.point_transform(scale, offset)) - # for other modes, convert the function to a table - flatLut = [lut(i) for i in range(256)] * self.im.bands # type: ignore[arg-type] - else: - flatLut = lut - - if self.mode == "F": - # FIXME: _imaging returns a confusing error message for this case - msg = "point operation not supported for this mode" - raise ValueError(msg) - - if mode != "F": - flatLut = [round(i) for i in flatLut] - return self._new(self.im.point(flatLut, mode)) - - def putalpha(self, alpha: Image | int) -> None: - """ - Adds or replaces the alpha layer in this image. If the image - does not have an alpha layer, it's converted to "LA" or "RGBA". - The new layer must be either "L" or "1". - - :param alpha: The new alpha layer. This can either be an "L" or "1" - image having the same size as this image, or an integer. - """ - - self._ensure_mutable() - - if self.mode not in ("LA", "PA", "RGBA"): - # attempt to promote self to a matching alpha mode - try: - mode = getmodebase(self.mode) + "A" - try: - self.im.setmode(mode) - except (AttributeError, ValueError) as e: - # do things the hard way - im = self.im.convert(mode) - if im.mode not in ("LA", "PA", "RGBA"): - msg = "alpha channel could not be added" - raise ValueError(msg) from e # sanity check - self.im = im - self._mode = self.im.mode - except KeyError as e: - msg = "illegal image mode" - raise ValueError(msg) from e - - if self.mode in ("LA", "PA"): - band = 1 - else: - band = 3 - - if isinstance(alpha, Image): - # alpha layer - if alpha.mode not in ("1", "L"): - msg = "illegal image mode" - raise ValueError(msg) - alpha.load() - if alpha.mode == "1": - alpha = alpha.convert("L") - else: - # constant alpha - try: - self.im.fillband(band, alpha) - except (AttributeError, ValueError): - # do things the hard way - alpha = new("L", self.size, alpha) - else: - return - - self.im.putband(alpha.im, band) - - def putdata( - self, - data: Sequence[float] | Sequence[Sequence[int]] | core.ImagingCore | NumpyArray, - scale: float = 1.0, - offset: float = 0.0, - ) -> None: - """ - Copies pixel data from a flattened sequence object into the image. The - values should start at the upper left corner (0, 0), continue to the - end of the line, followed directly by the first value of the second - line, and so on. Data will be read until either the image or the - sequence ends. The scale and offset values are used to adjust the - sequence values: **pixel = value*scale + offset**. - - :param data: A flattened sequence object. - :param scale: An optional scale value. The default is 1.0. - :param offset: An optional offset value. The default is 0.0. - """ - - self._ensure_mutable() - - self.im.putdata(data, scale, offset) - - def putpalette( - self, - data: ImagePalette.ImagePalette | bytes | Sequence[int], - rawmode: str = "RGB", - ) -> None: - """ - Attaches a palette to this image. The image must be a "P", "PA", "L" - or "LA" image. - - The palette sequence must contain at most 256 colors, made up of one - integer value for each channel in the raw mode. - For example, if the raw mode is "RGB", then it can contain at most 768 - values, made up of red, green and blue values for the corresponding pixel - index in the 256 colors. - If the raw mode is "RGBA", then it can contain at most 1024 values, - containing red, green, blue and alpha values. - - Alternatively, an 8-bit string may be used instead of an integer sequence. - - :param data: A palette sequence (either a list or a string). - :param rawmode: The raw mode of the palette. Either "RGB", "RGBA", or a mode - that can be transformed to "RGB" or "RGBA" (e.g. "R", "BGR;15", "RGBA;L"). - """ - from . import ImagePalette - - if self.mode not in ("L", "LA", "P", "PA"): - msg = "illegal image mode" - raise ValueError(msg) - if isinstance(data, ImagePalette.ImagePalette): - if data.rawmode is not None: - palette = ImagePalette.raw(data.rawmode, data.palette) - else: - palette = ImagePalette.ImagePalette(palette=data.palette) - palette.dirty = 1 - else: - if not isinstance(data, bytes): - data = bytes(data) - palette = ImagePalette.raw(rawmode, data) - self._mode = "PA" if "A" in self.mode else "P" - self.palette = palette - self.palette.mode = "RGBA" if "A" in rawmode else "RGB" - self.load() # install new palette - - def putpixel( - self, xy: tuple[int, int], value: float | tuple[int, ...] | list[int] - ) -> None: - """ - Modifies the pixel at the given position. The color is given as - a single numerical value for single-band images, and a tuple for - multi-band images. In addition to this, RGB and RGBA tuples are - accepted for P and PA images. - - Note that this method is relatively slow. For more extensive changes, - use :py:meth:`~PIL.Image.Image.paste` or the :py:mod:`~PIL.ImageDraw` - module instead. - - See: - - * :py:meth:`~PIL.Image.Image.paste` - * :py:meth:`~PIL.Image.Image.putdata` - * :py:mod:`~PIL.ImageDraw` - - :param xy: The pixel coordinate, given as (x, y). See - :ref:`coordinate-system`. - :param value: The pixel value. - """ - - if self.readonly: - self._copy() - self.load() - - if ( - self.mode in ("P", "PA") - and isinstance(value, (list, tuple)) - and len(value) in [3, 4] - ): - # RGB or RGBA value for a P or PA image - if self.mode == "PA": - alpha = value[3] if len(value) == 4 else 255 - value = value[:3] - assert self.palette is not None - palette_index = self.palette.getcolor(tuple(value), self) - value = (palette_index, alpha) if self.mode == "PA" else palette_index - return self.im.putpixel(xy, value) - - def remap_palette( - self, dest_map: list[int], source_palette: bytes | bytearray | None = None - ) -> Image: - """ - Rewrites the image to reorder the palette. - - :param dest_map: A list of indexes into the original palette. - e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))`` - is the identity transform. - :param source_palette: Bytes or None. - :returns: An :py:class:`~PIL.Image.Image` object. - - """ - from . import ImagePalette - - if self.mode not in ("L", "P"): - msg = "illegal image mode" - raise ValueError(msg) - - bands = 3 - palette_mode = "RGB" - if source_palette is None: - if self.mode == "P": - self.load() - palette_mode = self.im.getpalettemode() - if palette_mode == "RGBA": - bands = 4 - source_palette = self.im.getpalette(palette_mode, palette_mode) - else: # L-mode - source_palette = bytearray(i // 3 for i in range(768)) - elif len(source_palette) > 768: - bands = 4 - palette_mode = "RGBA" - - palette_bytes = b"" - new_positions = [0] * 256 - - # pick only the used colors from the palette - for i, oldPosition in enumerate(dest_map): - palette_bytes += source_palette[ - oldPosition * bands : oldPosition * bands + bands - ] - new_positions[oldPosition] = i - - # replace the palette color id of all pixel with the new id - - # Palette images are [0..255], mapped through a 1 or 3 - # byte/color map. We need to remap the whole image - # from palette 1 to palette 2. New_positions is - # an array of indexes into palette 1. Palette 2 is - # palette 1 with any holes removed. - - # We're going to leverage the convert mechanism to use the - # C code to remap the image from palette 1 to palette 2, - # by forcing the source image into 'L' mode and adding a - # mapping 'L' mode palette, then converting back to 'L' - # sans palette thus converting the image bytes, then - # assigning the optimized RGB palette. - - # perf reference, 9500x4000 gif, w/~135 colors - # 14 sec prepatch, 1 sec postpatch with optimization forced. - - mapping_palette = bytearray(new_positions) - - m_im = self.copy() - m_im._mode = "P" - - m_im.palette = ImagePalette.ImagePalette( - palette_mode, palette=mapping_palette * bands - ) - # possibly set palette dirty, then - # m_im.putpalette(mapping_palette, 'L') # converts to 'P' - # or just force it. - # UNDONE -- this is part of the general issue with palettes - m_im.im.putpalette(palette_mode, palette_mode + ";L", m_im.palette.tobytes()) - - m_im = m_im.convert("L") - - m_im.putpalette(palette_bytes, palette_mode) - m_im.palette = ImagePalette.ImagePalette(palette_mode, palette=palette_bytes) - - if "transparency" in self.info: - try: - m_im.info["transparency"] = dest_map.index(self.info["transparency"]) - except ValueError: - if "transparency" in m_im.info: - del m_im.info["transparency"] - - return m_im - - def _get_safe_box( - self, - size: tuple[int, int], - resample: Resampling, - box: tuple[float, float, float, float], - ) -> tuple[int, int, int, int]: - """Expands the box so it includes adjacent pixels - that may be used by resampling with the given resampling filter. - """ - filter_support = _filters_support[resample] - 0.5 - scale_x = (box[2] - box[0]) / size[0] - scale_y = (box[3] - box[1]) / size[1] - support_x = filter_support * scale_x - support_y = filter_support * scale_y - - return ( - max(0, int(box[0] - support_x)), - max(0, int(box[1] - support_y)), - min(self.size[0], math.ceil(box[2] + support_x)), - min(self.size[1], math.ceil(box[3] + support_y)), - ) - - def resize( - self, - size: tuple[int, int] | list[int] | NumpyArray, - resample: int | None = None, - box: tuple[float, float, float, float] | None = None, - reducing_gap: float | None = None, - ) -> Image: - """ - Returns a resized copy of this image. - - :param size: The requested size in pixels, as a tuple or array: - (width, height). - :param resample: An optional resampling filter. This can be - one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`, - :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`, - :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`. - If the image has mode "1" or "P", it is always set to - :py:data:`Resampling.NEAREST`. If the image mode is "BGR;15", - "BGR;16" or "BGR;24", then the default filter is - :py:data:`Resampling.NEAREST`. Otherwise, the default filter is - :py:data:`Resampling.BICUBIC`. See: :ref:`concept-filters`. - :param box: An optional 4-tuple of floats providing - the source image region to be scaled. - The values must be within (0, 0, width, height) rectangle. - If omitted or None, the entire source is used. - :param reducing_gap: Apply optimization by resizing the image - in two steps. First, reducing the image by integer times - using :py:meth:`~PIL.Image.Image.reduce`. - Second, resizing using regular resampling. The last step - changes size no less than by ``reducing_gap`` times. - ``reducing_gap`` may be None (no first step is performed) - or should be greater than 1.0. The bigger ``reducing_gap``, - the closer the result to the fair resampling. - The smaller ``reducing_gap``, the faster resizing. - With ``reducing_gap`` greater or equal to 3.0, the result is - indistinguishable from fair resampling in most cases. - The default value is None (no optimization). - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - if resample is None: - bgr = self.mode.startswith("BGR;") - resample = Resampling.NEAREST if bgr else Resampling.BICUBIC - elif resample not in ( - Resampling.NEAREST, - Resampling.BILINEAR, - Resampling.BICUBIC, - Resampling.LANCZOS, - Resampling.BOX, - Resampling.HAMMING, - ): - msg = f"Unknown resampling filter ({resample})." - - filters = [ - f"{filter[1]} ({filter[0]})" - for filter in ( - (Resampling.NEAREST, "Image.Resampling.NEAREST"), - (Resampling.LANCZOS, "Image.Resampling.LANCZOS"), - (Resampling.BILINEAR, "Image.Resampling.BILINEAR"), - (Resampling.BICUBIC, "Image.Resampling.BICUBIC"), - (Resampling.BOX, "Image.Resampling.BOX"), - (Resampling.HAMMING, "Image.Resampling.HAMMING"), - ) - ] - msg += f" Use {', '.join(filters[:-1])} or {filters[-1]}" - raise ValueError(msg) - - if reducing_gap is not None and reducing_gap < 1.0: - msg = "reducing_gap must be 1.0 or greater" - raise ValueError(msg) - - if box is None: - box = (0, 0) + self.size - - size = tuple(size) - if self.size == size and box == (0, 0) + self.size: - return self.copy() - - if self.mode in ("1", "P"): - resample = Resampling.NEAREST - - if self.mode in ["LA", "RGBA"] and resample != Resampling.NEAREST: - im = self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode]) - im = im.resize(size, resample, box) - return im.convert(self.mode) - - self.load() - - if reducing_gap is not None and resample != Resampling.NEAREST: - factor_x = int((box[2] - box[0]) / size[0] / reducing_gap) or 1 - factor_y = int((box[3] - box[1]) / size[1] / reducing_gap) or 1 - if factor_x > 1 or factor_y > 1: - reduce_box = self._get_safe_box(size, cast(Resampling, resample), box) - factor = (factor_x, factor_y) - self = ( - self.reduce(factor, box=reduce_box) - if callable(self.reduce) - else Image.reduce(self, factor, box=reduce_box) - ) - box = ( - (box[0] - reduce_box[0]) / factor_x, - (box[1] - reduce_box[1]) / factor_y, - (box[2] - reduce_box[0]) / factor_x, - (box[3] - reduce_box[1]) / factor_y, - ) - - return self._new(self.im.resize(size, resample, box)) - - def reduce( - self, - factor: int | tuple[int, int], - box: tuple[int, int, int, int] | None = None, - ) -> Image: - """ - Returns a copy of the image reduced ``factor`` times. - If the size of the image is not dividable by ``factor``, - the resulting size will be rounded up. - - :param factor: A greater than 0 integer or tuple of two integers - for width and height separately. - :param box: An optional 4-tuple of ints providing - the source image region to be reduced. - The values must be within ``(0, 0, width, height)`` rectangle. - If omitted or ``None``, the entire source is used. - """ - if not isinstance(factor, (list, tuple)): - factor = (factor, factor) - - if box is None: - box = (0, 0) + self.size - - if factor == (1, 1) and box == (0, 0) + self.size: - return self.copy() - - if self.mode in ["LA", "RGBA"]: - im = self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode]) - im = im.reduce(factor, box) - return im.convert(self.mode) - - self.load() - - return self._new(self.im.reduce(factor, box)) - - def rotate( - self, - angle: float, - resample: Resampling = Resampling.NEAREST, - expand: int | bool = False, - center: tuple[float, float] | None = None, - translate: tuple[int, int] | None = None, - fillcolor: float | tuple[float, ...] | str | None = None, - ) -> Image: - """ - Returns a rotated copy of this image. This method returns a - copy of this image, rotated the given number of degrees counter - clockwise around its centre. - - :param angle: In degrees counter clockwise. - :param resample: An optional resampling filter. This can be - one of :py:data:`Resampling.NEAREST` (use nearest neighbour), - :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2 - environment), or :py:data:`Resampling.BICUBIC` (cubic spline - interpolation in a 4x4 environment). If omitted, or if the image has - mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`. - See :ref:`concept-filters`. - :param expand: Optional expansion flag. If true, expands the output - image to make it large enough to hold the entire rotated image. - If false or omitted, make the output image the same size as the - input image. Note that the expand flag assumes rotation around - the center and no translation. - :param center: Optional center of rotation (a 2-tuple). Origin is - the upper left corner. Default is the center of the image. - :param translate: An optional post-rotate translation (a 2-tuple). - :param fillcolor: An optional color for area outside the rotated image. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - angle = angle % 360.0 - - # Fast paths regardless of filter, as long as we're not - # translating or changing the center. - if not (center or translate): - if angle == 0: - return self.copy() - if angle == 180: - return self.transpose(Transpose.ROTATE_180) - if angle in (90, 270) and (expand or self.width == self.height): - return self.transpose( - Transpose.ROTATE_90 if angle == 90 else Transpose.ROTATE_270 - ) - - # Calculate the affine matrix. Note that this is the reverse - # transformation (from destination image to source) because we - # want to interpolate the (discrete) destination pixel from - # the local area around the (floating) source pixel. - - # The matrix we actually want (note that it operates from the right): - # (1, 0, tx) (1, 0, cx) ( cos a, sin a, 0) (1, 0, -cx) - # (0, 1, ty) * (0, 1, cy) * (-sin a, cos a, 0) * (0, 1, -cy) - # (0, 0, 1) (0, 0, 1) ( 0, 0, 1) (0, 0, 1) - - # The reverse matrix is thus: - # (1, 0, cx) ( cos -a, sin -a, 0) (1, 0, -cx) (1, 0, -tx) - # (0, 1, cy) * (-sin -a, cos -a, 0) * (0, 1, -cy) * (0, 1, -ty) - # (0, 0, 1) ( 0, 0, 1) (0, 0, 1) (0, 0, 1) - - # In any case, the final translation may be updated at the end to - # compensate for the expand flag. - - w, h = self.size - - if translate is None: - post_trans = (0, 0) - else: - post_trans = translate - if center is None: - center = (w / 2, h / 2) - - angle = -math.radians(angle) - matrix = [ - round(math.cos(angle), 15), - round(math.sin(angle), 15), - 0.0, - round(-math.sin(angle), 15), - round(math.cos(angle), 15), - 0.0, - ] - - def transform(x: float, y: float, matrix: list[float]) -> tuple[float, float]: - (a, b, c, d, e, f) = matrix - return a * x + b * y + c, d * x + e * y + f - - matrix[2], matrix[5] = transform( - -center[0] - post_trans[0], -center[1] - post_trans[1], matrix - ) - matrix[2] += center[0] - matrix[5] += center[1] - - if expand: - # calculate output size - xx = [] - yy = [] - for x, y in ((0, 0), (w, 0), (w, h), (0, h)): - transformed_x, transformed_y = transform(x, y, matrix) - xx.append(transformed_x) - yy.append(transformed_y) - nw = math.ceil(max(xx)) - math.floor(min(xx)) - nh = math.ceil(max(yy)) - math.floor(min(yy)) - - # We multiply a translation matrix from the right. Because of its - # special form, this is the same as taking the image of the - # translation vector as new translation vector. - matrix[2], matrix[5] = transform(-(nw - w) / 2.0, -(nh - h) / 2.0, matrix) - w, h = nw, nh - - return self.transform( - (w, h), Transform.AFFINE, matrix, resample, fillcolor=fillcolor - ) - - def save( - self, fp: StrOrBytesPath | IO[bytes], format: str | None = None, **params: Any - ) -> None: - """ - Saves this image under the given filename. If no format is - specified, the format to use is determined from the filename - extension, if possible. - - Keyword options can be used to provide additional instructions - to the writer. If a writer doesn't recognise an option, it is - silently ignored. The available options are described in the - :doc:`image format documentation - <../handbook/image-file-formats>` for each writer. - - You can use a file object instead of a filename. In this case, - you must always specify the format. The file object must - implement the ``seek``, ``tell``, and ``write`` - methods, and be opened in binary mode. - - :param fp: A filename (string), os.PathLike object or file object. - :param format: Optional format override. If omitted, the - format to use is determined from the filename extension. - If a file object was used instead of a filename, this - parameter should always be used. - :param params: Extra parameters to the image writer. These can also be - set on the image itself through ``encoderinfo``. This is useful when - saving multiple images:: - - # Saving XMP data to a single image - from PIL import Image - red = Image.new("RGB", (1, 1), "#f00") - red.save("out.mpo", xmp=b"test") - - # Saving XMP data to the second frame of an image - from PIL import Image - black = Image.new("RGB", (1, 1)) - red = Image.new("RGB", (1, 1), "#f00") - red.encoderinfo = {"xmp": b"test"} - black.save("out.mpo", save_all=True, append_images=[red]) - :returns: None - :exception ValueError: If the output format could not be determined - from the file name. Use the format option to solve this. - :exception OSError: If the file could not be written. The file - may have been created, and may contain partial data. - """ - - filename: str | bytes = "" - open_fp = False - if is_path(fp): - filename = os.fspath(fp) - open_fp = True - elif fp == sys.stdout: - try: - fp = sys.stdout.buffer - except AttributeError: - pass - if not filename and hasattr(fp, "name") and is_path(fp.name): - # only set the name for metadata purposes - filename = os.fspath(fp.name) - - preinit() - - filename_ext = os.path.splitext(filename)[1].lower() - ext = filename_ext.decode() if isinstance(filename_ext, bytes) else filename_ext - - if not format: - if ext not in EXTENSION: - init() - try: - format = EXTENSION[ext] - except KeyError as e: - msg = f"unknown file extension: {ext}" - raise ValueError(msg) from e - - from . import ImageFile - - # may mutate self! - if isinstance(self, ImageFile.ImageFile) and os.path.abspath( - filename - ) == os.path.abspath(self.filename): - self._ensure_mutable() - else: - self.load() - - save_all = params.pop("save_all", None) - self._default_encoderinfo = params - encoderinfo = getattr(self, "encoderinfo", {}) - self._attach_default_encoderinfo(self) - self.encoderconfig: tuple[Any, ...] = () - - if format.upper() not in SAVE: - init() - if save_all or ( - save_all is None - and params.get("append_images") - and format.upper() in SAVE_ALL - ): - save_handler = SAVE_ALL[format.upper()] - else: - save_handler = SAVE[format.upper()] - - created = False - if open_fp: - created = not os.path.exists(filename) - if params.get("append", False): - # Open also for reading ("+"), because TIFF save_all - # writer needs to go back and edit the written data. - fp = builtins.open(filename, "r+b") - else: - fp = builtins.open(filename, "w+b") - else: - fp = cast(IO[bytes], fp) - - try: - save_handler(self, fp, filename) - except Exception: - if open_fp: - fp.close() - if created: - try: - os.remove(filename) - except PermissionError: - pass - raise - finally: - self.encoderinfo = encoderinfo - if open_fp: - fp.close() - - def _attach_default_encoderinfo(self, im: Image) -> dict[str, Any]: - encoderinfo = getattr(self, "encoderinfo", {}) - self.encoderinfo = {**im._default_encoderinfo, **encoderinfo} - return encoderinfo - - def seek(self, frame: int) -> None: - """ - Seeks to the given frame in this sequence file. If you seek - beyond the end of the sequence, the method raises an - ``EOFError`` exception. When a sequence file is opened, the - library automatically seeks to frame 0. - - See :py:meth:`~PIL.Image.Image.tell`. - - If defined, :attr:`~PIL.Image.Image.n_frames` refers to the - number of available frames. - - :param frame: Frame number, starting at 0. - :exception EOFError: If the call attempts to seek beyond the end - of the sequence. - """ - - # overridden by file handlers - if frame != 0: - msg = "no more images in file" - raise EOFError(msg) - - def show(self, title: str | None = None) -> None: - """ - Displays this image. This method is mainly intended for debugging purposes. - - This method calls :py:func:`PIL.ImageShow.show` internally. You can use - :py:func:`PIL.ImageShow.register` to override its default behaviour. - - The image is first saved to a temporary file. By default, it will be in - PNG format. - - On Unix, the image is then opened using the **xdg-open**, **display**, - **gm**, **eog** or **xv** utility, depending on which one can be found. - - On macOS, the image is opened with the native Preview application. - - On Windows, the image is opened with the standard PNG display utility. - - :param title: Optional title to use for the image window, where possible. - """ - - _show(self, title=title) - - def split(self) -> tuple[Image, ...]: - """ - Split this image into individual bands. This method returns a - tuple of individual image bands from an image. For example, - splitting an "RGB" image creates three new images each - containing a copy of one of the original bands (red, green, - blue). - - If you need only one band, :py:meth:`~PIL.Image.Image.getchannel` - method can be more convenient and faster. - - :returns: A tuple containing bands. - """ - - self.load() - if self.im.bands == 1: - return (self.copy(),) - return tuple(map(self._new, self.im.split())) - - def getchannel(self, channel: int | str) -> Image: - """ - Returns an image containing a single channel of the source image. - - :param channel: What channel to return. Could be index - (0 for "R" channel of "RGB") or channel name - ("A" for alpha channel of "RGBA"). - :returns: An image in "L" mode. - - .. versionadded:: 4.3.0 - """ - self.load() - - if isinstance(channel, str): - try: - channel = self.getbands().index(channel) - except ValueError as e: - msg = f'The image has no channel "{channel}"' - raise ValueError(msg) from e - - return self._new(self.im.getband(channel)) - - def tell(self) -> int: - """ - Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`. - - If defined, :attr:`~PIL.Image.Image.n_frames` refers to the - number of available frames. - - :returns: Frame number, starting with 0. - """ - return 0 - - def thumbnail( - self, - size: tuple[float, float], - resample: Resampling = Resampling.BICUBIC, - reducing_gap: float | None = 2.0, - ) -> None: - """ - Make this image into a thumbnail. This method modifies the - image to contain a thumbnail version of itself, no larger than - the given size. This method calculates an appropriate thumbnail - size to preserve the aspect of the image, calls the - :py:meth:`~PIL.Image.Image.draft` method to configure the file reader - (where applicable), and finally resizes the image. - - Note that this function modifies the :py:class:`~PIL.Image.Image` - object in place. If you need to use the full resolution image as well, - apply this method to a :py:meth:`~PIL.Image.Image.copy` of the original - image. - - :param size: The requested size in pixels, as a 2-tuple: - (width, height). - :param resample: Optional resampling filter. This can be one - of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`, - :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`, - :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`. - If omitted, it defaults to :py:data:`Resampling.BICUBIC`. - (was :py:data:`Resampling.NEAREST` prior to version 2.5.0). - See: :ref:`concept-filters`. - :param reducing_gap: Apply optimization by resizing the image - in two steps. First, reducing the image by integer times - using :py:meth:`~PIL.Image.Image.reduce` or - :py:meth:`~PIL.Image.Image.draft` for JPEG images. - Second, resizing using regular resampling. The last step - changes size no less than by ``reducing_gap`` times. - ``reducing_gap`` may be None (no first step is performed) - or should be greater than 1.0. The bigger ``reducing_gap``, - the closer the result to the fair resampling. - The smaller ``reducing_gap``, the faster resizing. - With ``reducing_gap`` greater or equal to 3.0, the result is - indistinguishable from fair resampling in most cases. - The default value is 2.0 (very close to fair resampling - while still being faster in many cases). - :returns: None - """ - - provided_size = tuple(map(math.floor, size)) - - def preserve_aspect_ratio() -> tuple[int, int] | None: - def round_aspect(number: float, key: Callable[[int], float]) -> int: - return max(min(math.floor(number), math.ceil(number), key=key), 1) - - x, y = provided_size - if x >= self.width and y >= self.height: - return None - - aspect = self.width / self.height - if x / y >= aspect: - x = round_aspect(y * aspect, key=lambda n: abs(aspect - n / y)) - else: - y = round_aspect( - x / aspect, key=lambda n: 0 if n == 0 else abs(aspect - x / n) - ) - return x, y - - preserved_size = preserve_aspect_ratio() - if preserved_size is None: - return - final_size = preserved_size - - box = None - if reducing_gap is not None: - res = self.draft( - None, (int(size[0] * reducing_gap), int(size[1] * reducing_gap)) - ) - if res is not None: - box = res[1] - - if self.size != final_size: - im = self.resize(final_size, resample, box=box, reducing_gap=reducing_gap) - - self.im = im.im - self._size = final_size - self._mode = self.im.mode - - self.readonly = 0 - - # FIXME: the different transform methods need further explanation - # instead of bloating the method docs, add a separate chapter. - def transform( - self, - size: tuple[int, int], - method: Transform | ImageTransformHandler | SupportsGetData, - data: Sequence[Any] | None = None, - resample: int = Resampling.NEAREST, - fill: int = 1, - fillcolor: float | tuple[float, ...] | str | None = None, - ) -> Image: - """ - Transforms this image. This method creates a new image with the - given size, and the same mode as the original, and copies data - to the new image using the given transform. - - :param size: The output size in pixels, as a 2-tuple: - (width, height). - :param method: The transformation method. This is one of - :py:data:`Transform.EXTENT` (cut out a rectangular subregion), - :py:data:`Transform.AFFINE` (affine transform), - :py:data:`Transform.PERSPECTIVE` (perspective transform), - :py:data:`Transform.QUAD` (map a quadrilateral to a rectangle), or - :py:data:`Transform.MESH` (map a number of source quadrilaterals - in one operation). - - It may also be an :py:class:`~PIL.Image.ImageTransformHandler` - object:: - - class Example(Image.ImageTransformHandler): - def transform(self, size, data, resample, fill=1): - # Return result - - Implementations of :py:class:`~PIL.Image.ImageTransformHandler` - for some of the :py:class:`Transform` methods are provided - in :py:mod:`~PIL.ImageTransform`. - - It may also be an object with a ``method.getdata`` method - that returns a tuple supplying new ``method`` and ``data`` values:: - - class Example: - def getdata(self): - method = Image.Transform.EXTENT - data = (0, 0, 100, 100) - return method, data - :param data: Extra data to the transformation method. - :param resample: Optional resampling filter. It can be one of - :py:data:`Resampling.NEAREST` (use nearest neighbour), - :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2 - environment), or :py:data:`Resampling.BICUBIC` (cubic spline - interpolation in a 4x4 environment). If omitted, or if the image - has mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`. - See: :ref:`concept-filters`. - :param fill: If ``method`` is an - :py:class:`~PIL.Image.ImageTransformHandler` object, this is one of - the arguments passed to it. Otherwise, it is unused. - :param fillcolor: Optional fill color for the area outside the - transform in the output image. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - if self.mode in ("LA", "RGBA") and resample != Resampling.NEAREST: - return ( - self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode]) - .transform(size, method, data, resample, fill, fillcolor) - .convert(self.mode) - ) - - if isinstance(method, ImageTransformHandler): - return method.transform(size, self, resample=resample, fill=fill) - - if hasattr(method, "getdata"): - # compatibility w. old-style transform objects - method, data = method.getdata() - - if data is None: - msg = "missing method data" - raise ValueError(msg) - - im = new(self.mode, size, fillcolor) - if self.mode == "P" and self.palette: - im.palette = self.palette.copy() - im.info = self.info.copy() - if method == Transform.MESH: - # list of quads - for box, quad in data: - im.__transformer( - box, self, Transform.QUAD, quad, resample, fillcolor is None - ) - else: - im.__transformer( - (0, 0) + size, self, method, data, resample, fillcolor is None - ) - - return im - - def __transformer( - self, - box: tuple[int, int, int, int], - image: Image, - method: Transform, - data: Sequence[float], - resample: int = Resampling.NEAREST, - fill: bool = True, - ) -> None: - w = box[2] - box[0] - h = box[3] - box[1] - - if method == Transform.AFFINE: - data = data[:6] - - elif method == Transform.EXTENT: - # convert extent to an affine transform - x0, y0, x1, y1 = data - xs = (x1 - x0) / w - ys = (y1 - y0) / h - method = Transform.AFFINE - data = (xs, 0, x0, 0, ys, y0) - - elif method == Transform.PERSPECTIVE: - data = data[:8] - - elif method == Transform.QUAD: - # quadrilateral warp. data specifies the four corners - # given as NW, SW, SE, and NE. - nw = data[:2] - sw = data[2:4] - se = data[4:6] - ne = data[6:8] - x0, y0 = nw - As = 1.0 / w - At = 1.0 / h - data = ( - x0, - (ne[0] - x0) * As, - (sw[0] - x0) * At, - (se[0] - sw[0] - ne[0] + x0) * As * At, - y0, - (ne[1] - y0) * As, - (sw[1] - y0) * At, - (se[1] - sw[1] - ne[1] + y0) * As * At, - ) - - else: - msg = "unknown transformation method" - raise ValueError(msg) - - if resample not in ( - Resampling.NEAREST, - Resampling.BILINEAR, - Resampling.BICUBIC, - ): - if resample in (Resampling.BOX, Resampling.HAMMING, Resampling.LANCZOS): - unusable: dict[int, str] = { - Resampling.BOX: "Image.Resampling.BOX", - Resampling.HAMMING: "Image.Resampling.HAMMING", - Resampling.LANCZOS: "Image.Resampling.LANCZOS", - } - msg = unusable[resample] + f" ({resample}) cannot be used." - else: - msg = f"Unknown resampling filter ({resample})." - - filters = [ - f"{filter[1]} ({filter[0]})" - for filter in ( - (Resampling.NEAREST, "Image.Resampling.NEAREST"), - (Resampling.BILINEAR, "Image.Resampling.BILINEAR"), - (Resampling.BICUBIC, "Image.Resampling.BICUBIC"), - ) - ] - msg += f" Use {', '.join(filters[:-1])} or {filters[-1]}" - raise ValueError(msg) - - image.load() - - self.load() - - if image.mode in ("1", "P"): - resample = Resampling.NEAREST - - self.im.transform(box, image.im, method, data, resample, fill) - - def transpose(self, method: Transpose) -> Image: - """ - Transpose image (flip or rotate in 90 degree steps) - - :param method: One of :py:data:`Transpose.FLIP_LEFT_RIGHT`, - :py:data:`Transpose.FLIP_TOP_BOTTOM`, :py:data:`Transpose.ROTATE_90`, - :py:data:`Transpose.ROTATE_180`, :py:data:`Transpose.ROTATE_270`, - :py:data:`Transpose.TRANSPOSE` or :py:data:`Transpose.TRANSVERSE`. - :returns: Returns a flipped or rotated copy of this image. - """ - - self.load() - return self._new(self.im.transpose(method)) - - def effect_spread(self, distance: int) -> Image: - """ - Randomly spread pixels in an image. - - :param distance: Distance to spread pixels. - """ - self.load() - return self._new(self.im.effect_spread(distance)) - - def toqimage(self) -> ImageQt.ImageQt: - """Returns a QImage copy of this image""" - from . import ImageQt - - if not ImageQt.qt_is_installed: - msg = "Qt bindings are not installed" - raise ImportError(msg) - return ImageQt.toqimage(self) - - def toqpixmap(self) -> ImageQt.QPixmap: - """Returns a QPixmap copy of this image""" - from . import ImageQt - - if not ImageQt.qt_is_installed: - msg = "Qt bindings are not installed" - raise ImportError(msg) - return ImageQt.toqpixmap(self) - - -# -------------------------------------------------------------------- -# Abstract handlers. - - -class ImagePointHandler(abc.ABC): - """ - Used as a mixin by point transforms - (for use with :py:meth:`~PIL.Image.Image.point`) - """ - - @abc.abstractmethod - def point(self, im: Image) -> Image: - pass - - -class ImageTransformHandler(abc.ABC): - """ - Used as a mixin by geometry transforms - (for use with :py:meth:`~PIL.Image.Image.transform`) - """ - - @abc.abstractmethod - def transform( - self, - size: tuple[int, int], - image: Image, - **options: Any, - ) -> Image: - pass - - -# -------------------------------------------------------------------- -# Factories - - -def _check_size(size: Any) -> None: - """ - Common check to enforce type and sanity check on size tuples - - :param size: Should be a 2 tuple of (width, height) - :returns: None, or raises a ValueError - """ - - if not isinstance(size, (list, tuple)): - msg = "Size must be a list or tuple" - raise ValueError(msg) - if len(size) != 2: - msg = "Size must be a sequence of length 2" - raise ValueError(msg) - if size[0] < 0 or size[1] < 0: - msg = "Width and height must be >= 0" - raise ValueError(msg) - - -def new( - mode: str, - size: tuple[int, int] | list[int], - color: float | tuple[float, ...] | str | None = 0, -) -> Image: - """ - Creates a new image with the given mode and size. - - :param mode: The mode to use for the new image. See: - :ref:`concept-modes`. - :param size: A 2-tuple, containing (width, height) in pixels. - :param color: What color to use for the image. Default is black. - If given, this should be a single integer or floating point value - for single-band modes, and a tuple for multi-band modes (one value - per band). When creating RGB or HSV images, you can also use color - strings as supported by the ImageColor module. If the color is - None, the image is not initialised. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - if mode in ("BGR;15", "BGR;16", "BGR;24"): - deprecate(mode, 12) - - _check_size(size) - - if color is None: - # don't initialize - return Image()._new(core.new(mode, size)) - - if isinstance(color, str): - # css3-style specifier - - from . import ImageColor - - color = ImageColor.getcolor(color, mode) - - im = Image() - if ( - mode == "P" - and isinstance(color, (list, tuple)) - and all(isinstance(i, int) for i in color) - ): - color_ints: tuple[int, ...] = cast(tuple[int, ...], tuple(color)) - if len(color_ints) == 3 or len(color_ints) == 4: - # RGB or RGBA value for a P image - from . import ImagePalette - - im.palette = ImagePalette.ImagePalette() - color = im.palette.getcolor(color_ints) - return im._new(core.fill(mode, size, color)) - - -def frombytes( - mode: str, - size: tuple[int, int], - data: bytes | bytearray | SupportsArrayInterface, - decoder_name: str = "raw", - *args: Any, -) -> Image: - """ - Creates a copy of an image memory from pixel data in a buffer. - - In its simplest form, this function takes three arguments - (mode, size, and unpacked pixel data). - - You can also use any pixel decoder supported by PIL. For more - information on available decoders, see the section - :ref:`Writing Your Own File Codec `. - - Note that this function decodes pixel data only, not entire images. - If you have an entire image in a string, wrap it in a - :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load - it. - - :param mode: The image mode. See: :ref:`concept-modes`. - :param size: The image size. - :param data: A byte buffer containing raw data for the given mode. - :param decoder_name: What decoder to use. - :param args: Additional parameters for the given decoder. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - _check_size(size) - - im = new(mode, size) - if im.width != 0 and im.height != 0: - decoder_args: Any = args - if len(decoder_args) == 1 and isinstance(decoder_args[0], tuple): - # may pass tuple instead of argument list - decoder_args = decoder_args[0] - - if decoder_name == "raw" and decoder_args == (): - decoder_args = mode - - im.frombytes(data, decoder_name, decoder_args) - return im - - -def frombuffer( - mode: str, - size: tuple[int, int], - data: bytes | SupportsArrayInterface, - decoder_name: str = "raw", - *args: Any, -) -> Image: - """ - Creates an image memory referencing pixel data in a byte buffer. - - This function is similar to :py:func:`~PIL.Image.frombytes`, but uses data - in the byte buffer, where possible. This means that changes to the - original buffer object are reflected in this image). Not all modes can - share memory; supported modes include "L", "RGBX", "RGBA", and "CMYK". - - Note that this function decodes pixel data only, not entire images. - If you have an entire image file in a string, wrap it in a - :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it. - - The default parameters used for the "raw" decoder differs from that used for - :py:func:`~PIL.Image.frombytes`. This is a bug, and will probably be fixed in a - future release. The current release issues a warning if you do this; to disable - the warning, you should provide the full set of parameters. See below for details. - - :param mode: The image mode. See: :ref:`concept-modes`. - :param size: The image size. - :param data: A bytes or other buffer object containing raw - data for the given mode. - :param decoder_name: What decoder to use. - :param args: Additional parameters for the given decoder. For the - default encoder ("raw"), it's recommended that you provide the - full set of parameters:: - - frombuffer(mode, size, data, "raw", mode, 0, 1) - - :returns: An :py:class:`~PIL.Image.Image` object. - - .. versionadded:: 1.1.4 - """ - - _check_size(size) - - # may pass tuple instead of argument list - if len(args) == 1 and isinstance(args[0], tuple): - args = args[0] - - if decoder_name == "raw": - if args == (): - args = mode, 0, 1 - if args[0] in _MAPMODES: - im = new(mode, (0, 0)) - im = im._new(core.map_buffer(data, size, decoder_name, 0, args)) - if mode == "P": - from . import ImagePalette - - im.palette = ImagePalette.ImagePalette("RGB", im.im.getpalette("RGB")) - im.readonly = 1 - return im - - return frombytes(mode, size, data, decoder_name, args) - - -class SupportsArrayInterface(Protocol): - """ - An object that has an ``__array_interface__`` dictionary. - """ - - @property - def __array_interface__(self) -> dict[str, Any]: - raise NotImplementedError() - - -class SupportsArrowArrayInterface(Protocol): - """ - An object that has an ``__arrow_c_array__`` method corresponding to the arrow c - data interface. - """ - - def __arrow_c_array__( - self, requested_schema: "PyCapsule" = None # type: ignore[name-defined] # noqa: F821, UP037 - ) -> tuple["PyCapsule", "PyCapsule"]: # type: ignore[name-defined] # noqa: F821, UP037 - raise NotImplementedError() - - -def fromarray(obj: SupportsArrayInterface, mode: str | None = None) -> Image: - """ - Creates an image memory from an object exporting the array interface - (using the buffer protocol):: - - from PIL import Image - import numpy as np - a = np.zeros((5, 5)) - im = Image.fromarray(a) - - If ``obj`` is not contiguous, then the ``tobytes`` method is called - and :py:func:`~PIL.Image.frombuffer` is used. - - In the case of NumPy, be aware that Pillow modes do not always correspond - to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels, - 32-bit signed integer pixels, and 32-bit floating point pixels. - - Pillow images can also be converted to arrays:: - - from PIL import Image - import numpy as np - im = Image.open("hopper.jpg") - a = np.asarray(im) - - When converting Pillow images to arrays however, only pixel values are - transferred. This means that P and PA mode images will lose their palette. - - :param obj: Object with array interface - :param mode: Optional mode to use when reading ``obj``. Will be determined from - type if ``None``. Deprecated. - - This will not be used to convert the data after reading, but will be used to - change how the data is read:: - - from PIL import Image - import numpy as np - a = np.full((1, 1), 300) - im = Image.fromarray(a, mode="L") - im.getpixel((0, 0)) # 44 - im = Image.fromarray(a, mode="RGB") - im.getpixel((0, 0)) # (44, 1, 0) - - See: :ref:`concept-modes` for general information about modes. - :returns: An image object. - - .. versionadded:: 1.1.6 - """ - arr = obj.__array_interface__ - shape = arr["shape"] - ndim = len(shape) - strides = arr.get("strides", None) - if mode is None: - try: - typekey = (1, 1) + shape[2:], arr["typestr"] - except KeyError as e: - msg = "Cannot handle this data type" - raise TypeError(msg) from e - try: - mode, rawmode = _fromarray_typemap[typekey] - except KeyError as e: - typekey_shape, typestr = typekey - msg = f"Cannot handle this data type: {typekey_shape}, {typestr}" - raise TypeError(msg) from e - else: - deprecate("'mode' parameter", 13) - rawmode = mode - if mode in ["1", "L", "I", "P", "F"]: - ndmax = 2 - elif mode == "RGB": - ndmax = 3 - else: - ndmax = 4 - if ndim > ndmax: - msg = f"Too many dimensions: {ndim} > {ndmax}." - raise ValueError(msg) - - size = 1 if ndim == 1 else shape[1], shape[0] - if strides is not None: - if hasattr(obj, "tobytes"): - obj = obj.tobytes() - elif hasattr(obj, "tostring"): - obj = obj.tostring() - else: - msg = "'strides' requires either tobytes() or tostring()" - raise ValueError(msg) - - return frombuffer(mode, size, obj, "raw", rawmode, 0, 1) - - -def fromarrow( - obj: SupportsArrowArrayInterface, mode: str, size: tuple[int, int] -) -> Image: - """Creates an image with zero-copy shared memory from an object exporting - the arrow_c_array interface protocol:: - - from PIL import Image - import pyarrow as pa - arr = pa.array([0]*(5*5*4), type=pa.uint8()) - im = Image.fromarrow(arr, 'RGBA', (5, 5)) - - If the data representation of the ``obj`` is not compatible with - Pillow internal storage, a ValueError is raised. - - Pillow images can also be converted to Arrow objects:: - - from PIL import Image - import pyarrow as pa - im = Image.open('hopper.jpg') - arr = pa.array(im) - - As with array support, when converting Pillow images to arrays, - only pixel values are transferred. This means that P and PA mode - images will lose their palette. - - :param obj: Object with an arrow_c_array interface - :param mode: Image mode. - :param size: Image size. This must match the storage of the arrow object. - :returns: An Image object - - Note that according to the Arrow spec, both the producer and the - consumer should consider the exported array to be immutable, as - unsynchronized updates will potentially cause inconsistent data. - - See: :ref:`arrow-support` for more detailed information - - .. versionadded:: 11.2.1 - - """ - if not hasattr(obj, "__arrow_c_array__"): - msg = "arrow_c_array interface not found" - raise ValueError(msg) - - (schema_capsule, array_capsule) = obj.__arrow_c_array__() - _im = core.new_arrow(mode, size, schema_capsule, array_capsule) - if _im: - return Image()._new(_im) - - msg = "new_arrow returned None without an exception" - raise ValueError(msg) - - -def fromqimage(im: ImageQt.QImage) -> ImageFile.ImageFile: - """Creates an image instance from a QImage image""" - from . import ImageQt - - if not ImageQt.qt_is_installed: - msg = "Qt bindings are not installed" - raise ImportError(msg) - return ImageQt.fromqimage(im) - - -def fromqpixmap(im: ImageQt.QPixmap) -> ImageFile.ImageFile: - """Creates an image instance from a QPixmap image""" - from . import ImageQt - - if not ImageQt.qt_is_installed: - msg = "Qt bindings are not installed" - raise ImportError(msg) - return ImageQt.fromqpixmap(im) - - -_fromarray_typemap = { - # (shape, typestr) => mode, rawmode - # first two members of shape are set to one - ((1, 1), "|b1"): ("1", "1;8"), - ((1, 1), "|u1"): ("L", "L"), - ((1, 1), "|i1"): ("I", "I;8"), - ((1, 1), "u2"): ("I", "I;16B"), - ((1, 1), "i2"): ("I", "I;16BS"), - ((1, 1), "u4"): ("I", "I;32B"), - ((1, 1), "i4"): ("I", "I;32BS"), - ((1, 1), "f4"): ("F", "F;32BF"), - ((1, 1), "f8"): ("F", "F;64BF"), - ((1, 1, 2), "|u1"): ("LA", "LA"), - ((1, 1, 3), "|u1"): ("RGB", "RGB"), - ((1, 1, 4), "|u1"): ("RGBA", "RGBA"), - # shortcuts: - ((1, 1), f"{_ENDIAN}i4"): ("I", "I"), - ((1, 1), f"{_ENDIAN}f4"): ("F", "F"), -} - - -def _decompression_bomb_check(size: tuple[int, int]) -> None: - if MAX_IMAGE_PIXELS is None: - return - - pixels = max(1, size[0]) * max(1, size[1]) - - if pixels > 2 * MAX_IMAGE_PIXELS: - msg = ( - f"Image size ({pixels} pixels) exceeds limit of {2 * MAX_IMAGE_PIXELS} " - "pixels, could be decompression bomb DOS attack." - ) - raise DecompressionBombError(msg) - - if pixels > MAX_IMAGE_PIXELS: - warnings.warn( - f"Image size ({pixels} pixels) exceeds limit of {MAX_IMAGE_PIXELS} pixels, " - "could be decompression bomb DOS attack.", - DecompressionBombWarning, - ) - - -def open( - fp: StrOrBytesPath | IO[bytes], - mode: Literal["r"] = "r", - formats: list[str] | tuple[str, ...] | None = None, -) -> ImageFile.ImageFile: - """ - Opens and identifies the given image file. - - This is a lazy operation; this function identifies the file, but - the file remains open and the actual image data is not read from - the file until you try to process the data (or call the - :py:meth:`~PIL.Image.Image.load` method). See - :py:func:`~PIL.Image.new`. See :ref:`file-handling`. - - :param fp: A filename (string), os.PathLike object or a file object. - The file object must implement ``file.read``, - ``file.seek``, and ``file.tell`` methods, - and be opened in binary mode. The file object will also seek to zero - before reading. - :param mode: The mode. If given, this argument must be "r". - :param formats: A list or tuple of formats to attempt to load the file in. - This can be used to restrict the set of formats checked. - Pass ``None`` to try all supported formats. You can print the set of - available formats by running ``python3 -m PIL`` or using - the :py:func:`PIL.features.pilinfo` function. - :returns: An :py:class:`~PIL.Image.Image` object. - :exception FileNotFoundError: If the file cannot be found. - :exception PIL.UnidentifiedImageError: If the image cannot be opened and - identified. - :exception ValueError: If the ``mode`` is not "r", or if a ``StringIO`` - instance is used for ``fp``. - :exception TypeError: If ``formats`` is not ``None``, a list or a tuple. - """ - - if mode != "r": - msg = f"bad mode {repr(mode)}" # type: ignore[unreachable] - raise ValueError(msg) - elif isinstance(fp, io.StringIO): - msg = ( # type: ignore[unreachable] - "StringIO cannot be used to open an image. " - "Binary data must be used instead." - ) - raise ValueError(msg) - - if formats is None: - formats = ID - elif not isinstance(formats, (list, tuple)): - msg = "formats must be a list or tuple" # type: ignore[unreachable] - raise TypeError(msg) - - exclusive_fp = False - filename: str | bytes = "" - if is_path(fp): - filename = os.fspath(fp) - fp = builtins.open(filename, "rb") - exclusive_fp = True - else: - fp = cast(IO[bytes], fp) - - try: - fp.seek(0) - except (AttributeError, io.UnsupportedOperation): - fp = io.BytesIO(fp.read()) - exclusive_fp = True - - prefix = fp.read(16) - - preinit() - - warning_messages: list[str] = [] - - def _open_core( - fp: IO[bytes], - filename: str | bytes, - prefix: bytes, - formats: list[str] | tuple[str, ...], - ) -> ImageFile.ImageFile | None: - for i in formats: - i = i.upper() - if i not in OPEN: - init() - try: - factory, accept = OPEN[i] - result = not accept or accept(prefix) - if isinstance(result, str): - warning_messages.append(result) - elif result: - fp.seek(0) - im = factory(fp, filename) - _decompression_bomb_check(im.size) - return im - except (SyntaxError, IndexError, TypeError, struct.error) as e: - if WARN_POSSIBLE_FORMATS: - warning_messages.append(i + " opening failed. " + str(e)) - except BaseException: - if exclusive_fp: - fp.close() - raise - return None - - im = _open_core(fp, filename, prefix, formats) - - if im is None and formats is ID: - checked_formats = ID.copy() - if init(): - im = _open_core( - fp, - filename, - prefix, - tuple(format for format in formats if format not in checked_formats), - ) - - if im: - im._exclusive_fp = exclusive_fp - return im - - if exclusive_fp: - fp.close() - for message in warning_messages: - warnings.warn(message) - msg = "cannot identify image file %r" % (filename if filename else fp) - raise UnidentifiedImageError(msg) - - -# -# Image processing. - - -def alpha_composite(im1: Image, im2: Image) -> Image: - """ - Alpha composite im2 over im1. - - :param im1: The first image. Must have mode RGBA. - :param im2: The second image. Must have mode RGBA, and the same size as - the first image. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - im1.load() - im2.load() - return im1._new(core.alpha_composite(im1.im, im2.im)) - - -def blend(im1: Image, im2: Image, alpha: float) -> Image: - """ - Creates a new image by interpolating between two input images, using - a constant alpha:: - - out = image1 * (1.0 - alpha) + image2 * alpha - - :param im1: The first image. - :param im2: The second image. Must have the same mode and size as - the first image. - :param alpha: The interpolation alpha factor. If alpha is 0.0, a - copy of the first image is returned. If alpha is 1.0, a copy of - the second image is returned. There are no restrictions on the - alpha value. If necessary, the result is clipped to fit into - the allowed output range. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - im1.load() - im2.load() - return im1._new(core.blend(im1.im, im2.im, alpha)) - - -def composite(image1: Image, image2: Image, mask: Image) -> Image: - """ - Create composite image by blending images using a transparency mask. - - :param image1: The first image. - :param image2: The second image. Must have the same mode and - size as the first image. - :param mask: A mask image. This image can have mode - "1", "L", or "RGBA", and must have the same size as the - other two images. - """ - - image = image2.copy() - image.paste(image1, None, mask) - return image - - -def eval(image: Image, *args: Callable[[int], float]) -> Image: - """ - Applies the function (which should take one argument) to each pixel - in the given image. If the image has more than one band, the same - function is applied to each band. Note that the function is - evaluated once for each possible pixel value, so you cannot use - random components or other generators. - - :param image: The input image. - :param function: A function object, taking one integer argument. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - return image.point(args[0]) - - -def merge(mode: str, bands: Sequence[Image]) -> Image: - """ - Merge a set of single band images into a new multiband image. - - :param mode: The mode to use for the output image. See: - :ref:`concept-modes`. - :param bands: A sequence containing one single-band image for - each band in the output image. All bands must have the - same size. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - - if getmodebands(mode) != len(bands) or "*" in mode: - msg = "wrong number of bands" - raise ValueError(msg) - for band in bands[1:]: - if band.mode != getmodetype(mode): - msg = "mode mismatch" - raise ValueError(msg) - if band.size != bands[0].size: - msg = "size mismatch" - raise ValueError(msg) - for band in bands: - band.load() - return bands[0]._new(core.merge(mode, *[b.im for b in bands])) - - -# -------------------------------------------------------------------- -# Plugin registry - - -def register_open( - id: str, - factory: ( - Callable[[IO[bytes], str | bytes], ImageFile.ImageFile] - | type[ImageFile.ImageFile] - ), - accept: Callable[[bytes], bool | str] | None = None, -) -> None: - """ - Register an image file plugin. This function should not be used - in application code. - - :param id: An image format identifier. - :param factory: An image file factory method. - :param accept: An optional function that can be used to quickly - reject images having another format. - """ - id = id.upper() - if id not in ID: - ID.append(id) - OPEN[id] = factory, accept - - -def register_mime(id: str, mimetype: str) -> None: - """ - Registers an image MIME type by populating ``Image.MIME``. This function - should not be used in application code. - - ``Image.MIME`` provides a mapping from image format identifiers to mime - formats, but :py:meth:`~PIL.ImageFile.ImageFile.get_format_mimetype` can - provide a different result for specific images. - - :param id: An image format identifier. - :param mimetype: The image MIME type for this format. - """ - MIME[id.upper()] = mimetype - - -def register_save( - id: str, driver: Callable[[Image, IO[bytes], str | bytes], None] -) -> None: - """ - Registers an image save function. This function should not be - used in application code. - - :param id: An image format identifier. - :param driver: A function to save images in this format. - """ - SAVE[id.upper()] = driver - - -def register_save_all( - id: str, driver: Callable[[Image, IO[bytes], str | bytes], None] -) -> None: - """ - Registers an image function to save all the frames - of a multiframe format. This function should not be - used in application code. - - :param id: An image format identifier. - :param driver: A function to save images in this format. - """ - SAVE_ALL[id.upper()] = driver - - -def register_extension(id: str, extension: str) -> None: - """ - Registers an image extension. This function should not be - used in application code. - - :param id: An image format identifier. - :param extension: An extension used for this format. - """ - EXTENSION[extension.lower()] = id.upper() - - -def register_extensions(id: str, extensions: list[str]) -> None: - """ - Registers image extensions. This function should not be - used in application code. - - :param id: An image format identifier. - :param extensions: A list of extensions used for this format. - """ - for extension in extensions: - register_extension(id, extension) - - -def registered_extensions() -> dict[str, str]: - """ - Returns a dictionary containing all file extensions belonging - to registered plugins - """ - init() - return EXTENSION - - -def register_decoder(name: str, decoder: type[ImageFile.PyDecoder]) -> None: - """ - Registers an image decoder. This function should not be - used in application code. - - :param name: The name of the decoder - :param decoder: An ImageFile.PyDecoder object - - .. versionadded:: 4.1.0 - """ - DECODERS[name] = decoder - - -def register_encoder(name: str, encoder: type[ImageFile.PyEncoder]) -> None: - """ - Registers an image encoder. This function should not be - used in application code. - - :param name: The name of the encoder - :param encoder: An ImageFile.PyEncoder object - - .. versionadded:: 4.1.0 - """ - ENCODERS[name] = encoder - - -# -------------------------------------------------------------------- -# Simple display support. - - -def _show(image: Image, **options: Any) -> None: - from . import ImageShow - - ImageShow.show(image, **options) - - -# -------------------------------------------------------------------- -# Effects - - -def effect_mandelbrot( - size: tuple[int, int], extent: tuple[float, float, float, float], quality: int -) -> Image: - """ - Generate a Mandelbrot set covering the given extent. - - :param size: The requested size in pixels, as a 2-tuple: - (width, height). - :param extent: The extent to cover, as a 4-tuple: - (x0, y0, x1, y1). - :param quality: Quality. - """ - return Image()._new(core.effect_mandelbrot(size, extent, quality)) - - -def effect_noise(size: tuple[int, int], sigma: float) -> Image: - """ - Generate Gaussian noise centered around 128. - - :param size: The requested size in pixels, as a 2-tuple: - (width, height). - :param sigma: Standard deviation of noise. - """ - return Image()._new(core.effect_noise(size, sigma)) - - -def linear_gradient(mode: str) -> Image: - """ - Generate 256x256 linear gradient from black to white, top to bottom. - - :param mode: Input mode. - """ - return Image()._new(core.linear_gradient(mode)) - - -def radial_gradient(mode: str) -> Image: - """ - Generate 256x256 radial gradient from black to white, centre to edge. - - :param mode: Input mode. - """ - return Image()._new(core.radial_gradient(mode)) - - -# -------------------------------------------------------------------- -# Resources - - -def _apply_env_variables(env: dict[str, str] | None = None) -> None: - env_dict = env if env is not None else os.environ - - for var_name, setter in [ - ("PILLOW_ALIGNMENT", core.set_alignment), - ("PILLOW_BLOCK_SIZE", core.set_block_size), - ("PILLOW_BLOCKS_MAX", core.set_blocks_max), - ]: - if var_name not in env_dict: - continue - - var = env_dict[var_name].lower() - - units = 1 - for postfix, mul in [("k", 1024), ("m", 1024 * 1024)]: - if var.endswith(postfix): - units = mul - var = var[: -len(postfix)] - - try: - var_int = int(var) * units - except ValueError: - warnings.warn(f"{var_name} is not int") - continue - - try: - setter(var_int) - except ValueError as e: - warnings.warn(f"{var_name}: {e}") - - -_apply_env_variables() -atexit.register(core.clear_cache) - - -if TYPE_CHECKING: - _ExifBase = MutableMapping[int, Any] -else: - _ExifBase = MutableMapping - - -class Exif(_ExifBase): - """ - This class provides read and write access to EXIF image data:: - - from PIL import Image - im = Image.open("exif.png") - exif = im.getexif() # Returns an instance of this class - - Information can be read and written, iterated over or deleted:: - - print(exif[274]) # 1 - exif[274] = 2 - for k, v in exif.items(): - print("Tag", k, "Value", v) # Tag 274 Value 2 - del exif[274] - - To access information beyond IFD0, :py:meth:`~PIL.Image.Exif.get_ifd` - returns a dictionary:: - - from PIL import ExifTags - im = Image.open("exif_gps.jpg") - exif = im.getexif() - gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo) - print(gps_ifd) - - Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.MakerNote``, - ``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``. - - :py:mod:`~PIL.ExifTags` also has enum classes to provide names for data:: - - print(exif[ExifTags.Base.Software]) # PIL - print(gps_ifd[ExifTags.GPS.GPSDateStamp]) # 1999:99:99 99:99:99 - """ - - endian: str | None = None - bigtiff = False - _loaded = False - - def __init__(self) -> None: - self._data: dict[int, Any] = {} - self._hidden_data: dict[int, Any] = {} - self._ifds: dict[int, dict[int, Any]] = {} - self._info: TiffImagePlugin.ImageFileDirectory_v2 | None = None - self._loaded_exif: bytes | None = None - - def _fixup(self, value: Any) -> Any: - try: - if len(value) == 1 and isinstance(value, tuple): - return value[0] - except Exception: - pass - return value - - def _fixup_dict(self, src_dict: dict[int, Any]) -> dict[int, Any]: - # Helper function - # returns a dict with any single item tuples/lists as individual values - return {k: self._fixup(v) for k, v in src_dict.items()} - - def _get_ifd_dict( - self, offset: int, group: int | None = None - ) -> dict[int, Any] | None: - try: - # an offset pointer to the location of the nested embedded IFD. - # It should be a long, but may be corrupted. - self.fp.seek(offset) - except (KeyError, TypeError): - return None - else: - from . import TiffImagePlugin - - info = TiffImagePlugin.ImageFileDirectory_v2(self.head, group=group) - info.load(self.fp) - return self._fixup_dict(dict(info)) - - def _get_head(self) -> bytes: - version = b"\x2b" if self.bigtiff else b"\x2a" - if self.endian == "<": - head = b"II" + version + b"\x00" + o32le(8) - else: - head = b"MM\x00" + version + o32be(8) - if self.bigtiff: - head += o32le(8) if self.endian == "<" else o32be(8) - head += b"\x00\x00\x00\x00" - return head - - def load(self, data: bytes) -> None: - # Extract EXIF information. This is highly experimental, - # and is likely to be replaced with something better in a future - # version. - - # The EXIF record consists of a TIFF file embedded in a JPEG - # application marker (!). - if data == self._loaded_exif: - return - self._loaded_exif = data - self._data.clear() - self._hidden_data.clear() - self._ifds.clear() - while data and data.startswith(b"Exif\x00\x00"): - data = data[6:] - if not data: - self._info = None - return - - self.fp: IO[bytes] = io.BytesIO(data) - self.head = self.fp.read(8) - # process dictionary - from . import TiffImagePlugin - - self._info = TiffImagePlugin.ImageFileDirectory_v2(self.head) - self.endian = self._info._endian - self.fp.seek(self._info.next) - self._info.load(self.fp) - - def load_from_fp(self, fp: IO[bytes], offset: int | None = None) -> None: - self._loaded_exif = None - self._data.clear() - self._hidden_data.clear() - self._ifds.clear() - - # process dictionary - from . import TiffImagePlugin - - self.fp = fp - if offset is not None: - self.head = self._get_head() - else: - self.head = self.fp.read(8) - self._info = TiffImagePlugin.ImageFileDirectory_v2(self.head) - if self.endian is None: - self.endian = self._info._endian - if offset is None: - offset = self._info.next - self.fp.tell() - self.fp.seek(offset) - self._info.load(self.fp) - - def _get_merged_dict(self) -> dict[int, Any]: - merged_dict = dict(self) - - # get EXIF extension - if ExifTags.IFD.Exif in self: - ifd = self._get_ifd_dict(self[ExifTags.IFD.Exif], ExifTags.IFD.Exif) - if ifd: - merged_dict.update(ifd) - - # GPS - if ExifTags.IFD.GPSInfo in self: - merged_dict[ExifTags.IFD.GPSInfo] = self._get_ifd_dict( - self[ExifTags.IFD.GPSInfo], ExifTags.IFD.GPSInfo - ) - - return merged_dict - - def tobytes(self, offset: int = 8) -> bytes: - from . import TiffImagePlugin - - head = self._get_head() - ifd = TiffImagePlugin.ImageFileDirectory_v2(ifh=head) - for tag, ifd_dict in self._ifds.items(): - if tag not in self: - ifd[tag] = ifd_dict - for tag, value in self.items(): - if tag in [ - ExifTags.IFD.Exif, - ExifTags.IFD.GPSInfo, - ] and not isinstance(value, dict): - value = self.get_ifd(tag) - if ( - tag == ExifTags.IFD.Exif - and ExifTags.IFD.Interop in value - and not isinstance(value[ExifTags.IFD.Interop], dict) - ): - value = value.copy() - value[ExifTags.IFD.Interop] = self.get_ifd(ExifTags.IFD.Interop) - ifd[tag] = value - return b"Exif\x00\x00" + head + ifd.tobytes(offset) - - def get_ifd(self, tag: int) -> dict[int, Any]: - if tag not in self._ifds: - if tag == ExifTags.IFD.IFD1: - if self._info is not None and self._info.next != 0: - ifd = self._get_ifd_dict(self._info.next) - if ifd is not None: - self._ifds[tag] = ifd - elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]: - offset = self._hidden_data.get(tag, self.get(tag)) - if offset is not None: - ifd = self._get_ifd_dict(offset, tag) - if ifd is not None: - self._ifds[tag] = ifd - elif tag in [ExifTags.IFD.Interop, ExifTags.IFD.MakerNote]: - if ExifTags.IFD.Exif not in self._ifds: - self.get_ifd(ExifTags.IFD.Exif) - tag_data = self._ifds[ExifTags.IFD.Exif][tag] - if tag == ExifTags.IFD.MakerNote: - from .TiffImagePlugin import ImageFileDirectory_v2 - - if tag_data.startswith(b"FUJIFILM"): - ifd_offset = i32le(tag_data, 8) - ifd_data = tag_data[ifd_offset:] - - makernote = {} - for i in range(struct.unpack(" 4: - (offset,) = struct.unpack("H", tag_data[:2])[0]): - ifd_tag, typ, count, data = struct.unpack( - ">HHL4s", tag_data[i * 12 + 2 : (i + 1) * 12 + 2] - ) - if ifd_tag == 0x1101: - # CameraInfo - (offset,) = struct.unpack(">L", data) - self.fp.seek(offset) - - camerainfo: dict[str, int | bytes] = { - "ModelID": self.fp.read(4) - } - - self.fp.read(4) - # Seconds since 2000 - camerainfo["TimeStamp"] = i32le(self.fp.read(12)) - - self.fp.read(4) - camerainfo["InternalSerialNumber"] = self.fp.read(4) - - self.fp.read(12) - parallax = self.fp.read(4) - handler = ImageFileDirectory_v2._load_dispatch[ - TiffTags.FLOAT - ][1] - camerainfo["Parallax"] = handler( - ImageFileDirectory_v2(), parallax, False - )[0] - - self.fp.read(4) - camerainfo["Category"] = self.fp.read(2) - - makernote = {0x1101: camerainfo} - self._ifds[tag] = makernote - else: - # Interop - ifd = self._get_ifd_dict(tag_data, tag) - if ifd is not None: - self._ifds[tag] = ifd - ifd = self._ifds.setdefault(tag, {}) - if tag == ExifTags.IFD.Exif and self._hidden_data: - ifd = { - k: v - for (k, v) in ifd.items() - if k not in (ExifTags.IFD.Interop, ExifTags.IFD.MakerNote) - } - return ifd - - def hide_offsets(self) -> None: - for tag in (ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo): - if tag in self: - self._hidden_data[tag] = self[tag] - del self[tag] - - def __str__(self) -> str: - if self._info is not None: - # Load all keys into self._data - for tag in self._info: - self[tag] - - return str(self._data) - - def __len__(self) -> int: - keys = set(self._data) - if self._info is not None: - keys.update(self._info) - return len(keys) - - def __getitem__(self, tag: int) -> Any: - if self._info is not None and tag not in self._data and tag in self._info: - self._data[tag] = self._fixup(self._info[tag]) - del self._info[tag] - return self._data[tag] - - def __contains__(self, tag: object) -> bool: - return tag in self._data or (self._info is not None and tag in self._info) - - def __setitem__(self, tag: int, value: Any) -> None: - if self._info is not None and tag in self._info: - del self._info[tag] - self._data[tag] = value - - def __delitem__(self, tag: int) -> None: - if self._info is not None and tag in self._info: - del self._info[tag] - else: - del self._data[tag] - - def __iter__(self) -> Iterator[int]: - keys = set(self._data) - if self._info is not None: - keys.update(self._info) - return iter(keys) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageChops.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageChops.py deleted file mode 100644 index 29a5c99..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageChops.py +++ /dev/null @@ -1,311 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# standard channel operations -# -# History: -# 1996-03-24 fl Created -# 1996-08-13 fl Added logical operations (for "1" images) -# 2000-10-12 fl Added offset method (from Image.py) -# -# Copyright (c) 1997-2000 by Secret Labs AB -# Copyright (c) 1996-2000 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# - -from __future__ import annotations - -from . import Image - - -def constant(image: Image.Image, value: int) -> Image.Image: - """Fill a channel with a given gray level. - - :rtype: :py:class:`~PIL.Image.Image` - """ - - return Image.new("L", image.size, value) - - -def duplicate(image: Image.Image) -> Image.Image: - """Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`. - - :rtype: :py:class:`~PIL.Image.Image` - """ - - return image.copy() - - -def invert(image: Image.Image) -> Image.Image: - """ - Invert an image (channel). :: - - out = MAX - image - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image.load() - return image._new(image.im.chop_invert()) - - -def lighter(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Compares the two images, pixel by pixel, and returns a new image containing - the lighter values. :: - - out = max(image1, image2) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_lighter(image2.im)) - - -def darker(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Compares the two images, pixel by pixel, and returns a new image containing - the darker values. :: - - out = min(image1, image2) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_darker(image2.im)) - - -def difference(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Returns the absolute value of the pixel-by-pixel difference between the two - images. :: - - out = abs(image1 - image2) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_difference(image2.im)) - - -def multiply(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Superimposes two images on top of each other. - - If you multiply an image with a solid black image, the result is black. If - you multiply with a solid white image, the image is unaffected. :: - - out = image1 * image2 / MAX - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_multiply(image2.im)) - - -def screen(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Superimposes two inverted images on top of each other. :: - - out = MAX - ((MAX - image1) * (MAX - image2) / MAX) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_screen(image2.im)) - - -def soft_light(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Superimposes two images on top of each other using the Soft Light algorithm - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_soft_light(image2.im)) - - -def hard_light(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Superimposes two images on top of each other using the Hard Light algorithm - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_hard_light(image2.im)) - - -def overlay(image1: Image.Image, image2: Image.Image) -> Image.Image: - """ - Superimposes two images on top of each other using the Overlay algorithm - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_overlay(image2.im)) - - -def add( - image1: Image.Image, image2: Image.Image, scale: float = 1.0, offset: float = 0 -) -> Image.Image: - """ - Adds two images, dividing the result by scale and adding the - offset. If omitted, scale defaults to 1.0, and offset to 0.0. :: - - out = ((image1 + image2) / scale + offset) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_add(image2.im, scale, offset)) - - -def subtract( - image1: Image.Image, image2: Image.Image, scale: float = 1.0, offset: float = 0 -) -> Image.Image: - """ - Subtracts two images, dividing the result by scale and adding the offset. - If omitted, scale defaults to 1.0, and offset to 0.0. :: - - out = ((image1 - image2) / scale + offset) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_subtract(image2.im, scale, offset)) - - -def add_modulo(image1: Image.Image, image2: Image.Image) -> Image.Image: - """Add two images, without clipping the result. :: - - out = ((image1 + image2) % MAX) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_add_modulo(image2.im)) - - -def subtract_modulo(image1: Image.Image, image2: Image.Image) -> Image.Image: - """Subtract two images, without clipping the result. :: - - out = ((image1 - image2) % MAX) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_subtract_modulo(image2.im)) - - -def logical_and(image1: Image.Image, image2: Image.Image) -> Image.Image: - """Logical AND between two images. - - Both of the images must have mode "1". If you would like to perform a - logical AND on an image with a mode other than "1", try - :py:meth:`~PIL.ImageChops.multiply` instead, using a black-and-white mask - as the second image. :: - - out = ((image1 and image2) % MAX) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_and(image2.im)) - - -def logical_or(image1: Image.Image, image2: Image.Image) -> Image.Image: - """Logical OR between two images. - - Both of the images must have mode "1". :: - - out = ((image1 or image2) % MAX) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_or(image2.im)) - - -def logical_xor(image1: Image.Image, image2: Image.Image) -> Image.Image: - """Logical XOR between two images. - - Both of the images must have mode "1". :: - - out = ((bool(image1) != bool(image2)) % MAX) - - :rtype: :py:class:`~PIL.Image.Image` - """ - - image1.load() - image2.load() - return image1._new(image1.im.chop_xor(image2.im)) - - -def blend(image1: Image.Image, image2: Image.Image, alpha: float) -> Image.Image: - """Blend images using constant transparency weight. Alias for - :py:func:`PIL.Image.blend`. - - :rtype: :py:class:`~PIL.Image.Image` - """ - - return Image.blend(image1, image2, alpha) - - -def composite( - image1: Image.Image, image2: Image.Image, mask: Image.Image -) -> Image.Image: - """Create composite using transparency mask. Alias for - :py:func:`PIL.Image.composite`. - - :rtype: :py:class:`~PIL.Image.Image` - """ - - return Image.composite(image1, image2, mask) - - -def offset(image: Image.Image, xoffset: int, yoffset: int | None = None) -> Image.Image: - """Returns a copy of the image where data has been offset by the given - distances. Data wraps around the edges. If ``yoffset`` is omitted, it - is assumed to be equal to ``xoffset``. - - :param image: Input image. - :param xoffset: The horizontal distance. - :param yoffset: The vertical distance. If omitted, both - distances are set to the same value. - :rtype: :py:class:`~PIL.Image.Image` - """ - - if yoffset is None: - yoffset = xoffset - image.load() - return image._new(image.im.offset(xoffset, yoffset)) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageCms.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageCms.py deleted file mode 100644 index a1584f1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageCms.py +++ /dev/null @@ -1,1123 +0,0 @@ -# The Python Imaging Library. -# $Id$ - -# Optional color management support, based on Kevin Cazabon's PyCMS -# library. - -# Originally released under LGPL. Graciously donated to PIL in -# March 2009, for distribution under the standard PIL license - -# History: - -# 2009-03-08 fl Added to PIL. - -# Copyright (C) 2002-2003 Kevin Cazabon -# Copyright (c) 2009 by Fredrik Lundh -# Copyright (c) 2013 by Eric Soroos - -# See the README file for information on usage and redistribution. See -# below for the original description. -from __future__ import annotations - -import operator -import sys -from enum import IntEnum, IntFlag -from functools import reduce -from typing import Any, Literal, SupportsFloat, SupportsInt, Union - -from . import Image, __version__ -from ._deprecate import deprecate -from ._typing import SupportsRead - -try: - from . import _imagingcms as core - - _CmsProfileCompatible = Union[ - str, SupportsRead[bytes], core.CmsProfile, "ImageCmsProfile" - ] -except ImportError as ex: - # Allow error import for doc purposes, but error out when accessing - # anything in core. - from ._util import DeferredError - - core = DeferredError.new(ex) - -_DESCRIPTION = """ -pyCMS - - a Python / PIL interface to the littleCMS ICC Color Management System - Copyright (C) 2002-2003 Kevin Cazabon - kevin@cazabon.com - https://www.cazabon.com - - pyCMS home page: https://www.cazabon.com/pyCMS - littleCMS home page: https://www.littlecms.com - (littleCMS is Copyright (C) 1998-2001 Marti Maria) - - Originally released under LGPL. Graciously donated to PIL in - March 2009, for distribution under the standard PIL license - - The pyCMS.py module provides a "clean" interface between Python/PIL and - pyCMSdll, taking care of some of the more complex handling of the direct - pyCMSdll functions, as well as error-checking and making sure that all - relevant data is kept together. - - While it is possible to call pyCMSdll functions directly, it's not highly - recommended. - - Version History: - - 1.0.0 pil Oct 2013 Port to LCMS 2. - - 0.1.0 pil mod March 10, 2009 - - Renamed display profile to proof profile. The proof - profile is the profile of the device that is being - simulated, not the profile of the device which is - actually used to display/print the final simulation - (that'd be the output profile) - also see LCMSAPI.txt - input colorspace -> using 'renderingIntent' -> proof - colorspace -> using 'proofRenderingIntent' -> output - colorspace - - Added LCMS FLAGS support. - Added FLAGS["SOFTPROOFING"] as default flag for - buildProofTransform (otherwise the proof profile/intent - would be ignored). - - 0.1.0 pil March 2009 - added to PIL, as PIL.ImageCms - - 0.0.2 alpha Jan 6, 2002 - - Added try/except statements around type() checks of - potential CObjects... Python won't let you use type() - on them, and raises a TypeError (stupid, if you ask - me!) - - Added buildProofTransformFromOpenProfiles() function. - Additional fixes in DLL, see DLL code for details. - - 0.0.1 alpha first public release, Dec. 26, 2002 - - Known to-do list with current version (of Python interface, not pyCMSdll): - - none - -""" - -_VERSION = "1.0.0 pil" - - -def __getattr__(name: str) -> Any: - if name == "DESCRIPTION": - deprecate("PIL.ImageCms.DESCRIPTION", 12) - return _DESCRIPTION - elif name == "VERSION": - deprecate("PIL.ImageCms.VERSION", 12) - return _VERSION - elif name == "FLAGS": - deprecate("PIL.ImageCms.FLAGS", 12, "PIL.ImageCms.Flags") - return _FLAGS - msg = f"module '{__name__}' has no attribute '{name}'" - raise AttributeError(msg) - - -# --------------------------------------------------------------------. - - -# -# intent/direction values - - -class Intent(IntEnum): - PERCEPTUAL = 0 - RELATIVE_COLORIMETRIC = 1 - SATURATION = 2 - ABSOLUTE_COLORIMETRIC = 3 - - -class Direction(IntEnum): - INPUT = 0 - OUTPUT = 1 - PROOF = 2 - - -# -# flags - - -class Flags(IntFlag): - """Flags and documentation are taken from ``lcms2.h``.""" - - NONE = 0 - NOCACHE = 0x0040 - """Inhibit 1-pixel cache""" - NOOPTIMIZE = 0x0100 - """Inhibit optimizations""" - NULLTRANSFORM = 0x0200 - """Don't transform anyway""" - GAMUTCHECK = 0x1000 - """Out of Gamut alarm""" - SOFTPROOFING = 0x4000 - """Do softproofing""" - BLACKPOINTCOMPENSATION = 0x2000 - NOWHITEONWHITEFIXUP = 0x0004 - """Don't fix scum dot""" - HIGHRESPRECALC = 0x0400 - """Use more memory to give better accuracy""" - LOWRESPRECALC = 0x0800 - """Use less memory to minimize resources""" - # this should be 8BITS_DEVICELINK, but that is not a valid name in Python: - USE_8BITS_DEVICELINK = 0x0008 - """Create 8 bits devicelinks""" - GUESSDEVICECLASS = 0x0020 - """Guess device class (for ``transform2devicelink``)""" - KEEP_SEQUENCE = 0x0080 - """Keep profile sequence for devicelink creation""" - FORCE_CLUT = 0x0002 - """Force CLUT optimization""" - CLUT_POST_LINEARIZATION = 0x0001 - """create postlinearization tables if possible""" - CLUT_PRE_LINEARIZATION = 0x0010 - """create prelinearization tables if possible""" - NONEGATIVES = 0x8000 - """Prevent negative numbers in floating point transforms""" - COPY_ALPHA = 0x04000000 - """Alpha channels are copied on ``cmsDoTransform()``""" - NODEFAULTRESOURCEDEF = 0x01000000 - - _GRIDPOINTS_1 = 1 << 16 - _GRIDPOINTS_2 = 2 << 16 - _GRIDPOINTS_4 = 4 << 16 - _GRIDPOINTS_8 = 8 << 16 - _GRIDPOINTS_16 = 16 << 16 - _GRIDPOINTS_32 = 32 << 16 - _GRIDPOINTS_64 = 64 << 16 - _GRIDPOINTS_128 = 128 << 16 - - @staticmethod - def GRIDPOINTS(n: int) -> Flags: - """ - Fine-tune control over number of gridpoints - - :param n: :py:class:`int` in range ``0 <= n <= 255`` - """ - return Flags.NONE | ((n & 0xFF) << 16) - - -_MAX_FLAG = reduce(operator.or_, Flags) - - -_FLAGS = { - "MATRIXINPUT": 1, - "MATRIXOUTPUT": 2, - "MATRIXONLY": (1 | 2), - "NOWHITEONWHITEFIXUP": 4, # Don't hot fix scum dot - # Don't create prelinearization tables on precalculated transforms - # (internal use): - "NOPRELINEARIZATION": 16, - "GUESSDEVICECLASS": 32, # Guess device class (for transform2devicelink) - "NOTCACHE": 64, # Inhibit 1-pixel cache - "NOTPRECALC": 256, - "NULLTRANSFORM": 512, # Don't transform anyway - "HIGHRESPRECALC": 1024, # Use more memory to give better accuracy - "LOWRESPRECALC": 2048, # Use less memory to minimize resources - "WHITEBLACKCOMPENSATION": 8192, - "BLACKPOINTCOMPENSATION": 8192, - "GAMUTCHECK": 4096, # Out of Gamut alarm - "SOFTPROOFING": 16384, # Do softproofing - "PRESERVEBLACK": 32768, # Black preservation - "NODEFAULTRESOURCEDEF": 16777216, # CRD special - "GRIDPOINTS": lambda n: (n & 0xFF) << 16, # Gridpoints -} - - -# --------------------------------------------------------------------. -# Experimental PIL-level API -# --------------------------------------------------------------------. - -## -# Profile. - - -class ImageCmsProfile: - def __init__(self, profile: str | SupportsRead[bytes] | core.CmsProfile) -> None: - """ - :param profile: Either a string representing a filename, - a file like object containing a profile or a - low-level profile object - - """ - self.filename = None - self.product_name = None # profile.product_name - self.product_info = None # profile.product_info - - if isinstance(profile, str): - if sys.platform == "win32": - profile_bytes_path = profile.encode() - try: - profile_bytes_path.decode("ascii") - except UnicodeDecodeError: - with open(profile, "rb") as f: - self.profile = core.profile_frombytes(f.read()) - return - self.filename = profile - self.profile = core.profile_open(profile) - elif hasattr(profile, "read"): - self.profile = core.profile_frombytes(profile.read()) - elif isinstance(profile, core.CmsProfile): - self.profile = profile - else: - msg = "Invalid type for Profile" # type: ignore[unreachable] - raise TypeError(msg) - - def tobytes(self) -> bytes: - """ - Returns the profile in a format suitable for embedding in - saved images. - - :returns: a bytes object containing the ICC profile. - """ - - return core.profile_tobytes(self.profile) - - -class ImageCmsTransform(Image.ImagePointHandler): - """ - Transform. This can be used with the procedural API, or with the standard - :py:func:`~PIL.Image.Image.point` method. - - Will return the output profile in the ``output.info['icc_profile']``. - """ - - def __init__( - self, - input: ImageCmsProfile, - output: ImageCmsProfile, - input_mode: str, - output_mode: str, - intent: Intent = Intent.PERCEPTUAL, - proof: ImageCmsProfile | None = None, - proof_intent: Intent = Intent.ABSOLUTE_COLORIMETRIC, - flags: Flags = Flags.NONE, - ): - supported_modes = ( - "RGB", - "RGBA", - "RGBX", - "CMYK", - "I;16", - "I;16L", - "I;16B", - "YCbCr", - "LAB", - "L", - "1", - ) - for mode in (input_mode, output_mode): - if mode not in supported_modes: - deprecate( - mode, - 12, - { - "L;16": "I;16 or I;16L", - "L:16B": "I;16B", - "YCCA": "YCbCr", - "YCC": "YCbCr", - }.get(mode), - ) - if proof is None: - self.transform = core.buildTransform( - input.profile, output.profile, input_mode, output_mode, intent, flags - ) - else: - self.transform = core.buildProofTransform( - input.profile, - output.profile, - proof.profile, - input_mode, - output_mode, - intent, - proof_intent, - flags, - ) - # Note: inputMode and outputMode are for pyCMS compatibility only - self.input_mode = self.inputMode = input_mode - self.output_mode = self.outputMode = output_mode - - self.output_profile = output - - def point(self, im: Image.Image) -> Image.Image: - return self.apply(im) - - def apply(self, im: Image.Image, imOut: Image.Image | None = None) -> Image.Image: - if imOut is None: - imOut = Image.new(self.output_mode, im.size, None) - self.transform.apply(im.getim(), imOut.getim()) - imOut.info["icc_profile"] = self.output_profile.tobytes() - return imOut - - def apply_in_place(self, im: Image.Image) -> Image.Image: - if im.mode != self.output_mode: - msg = "mode mismatch" - raise ValueError(msg) # wrong output mode - self.transform.apply(im.getim(), im.getim()) - im.info["icc_profile"] = self.output_profile.tobytes() - return im - - -def get_display_profile(handle: SupportsInt | None = None) -> ImageCmsProfile | None: - """ - (experimental) Fetches the profile for the current display device. - - :returns: ``None`` if the profile is not known. - """ - - if sys.platform != "win32": - return None - - from . import ImageWin # type: ignore[unused-ignore, unreachable] - - if isinstance(handle, ImageWin.HDC): - profile = core.get_display_profile_win32(int(handle), 1) - else: - profile = core.get_display_profile_win32(int(handle or 0)) - if profile is None: - return None - return ImageCmsProfile(profile) - - -# --------------------------------------------------------------------. -# pyCMS compatible layer -# --------------------------------------------------------------------. - - -class PyCMSError(Exception): - """(pyCMS) Exception class. - This is used for all errors in the pyCMS API.""" - - pass - - -def profileToProfile( - im: Image.Image, - inputProfile: _CmsProfileCompatible, - outputProfile: _CmsProfileCompatible, - renderingIntent: Intent = Intent.PERCEPTUAL, - outputMode: str | None = None, - inPlace: bool = False, - flags: Flags = Flags.NONE, -) -> Image.Image | None: - """ - (pyCMS) Applies an ICC transformation to a given image, mapping from - ``inputProfile`` to ``outputProfile``. - - If the input or output profiles specified are not valid filenames, a - :exc:`PyCMSError` will be raised. If ``inPlace`` is ``True`` and - ``outputMode != im.mode``, a :exc:`PyCMSError` will be raised. - If an error occurs during application of the profiles, - a :exc:`PyCMSError` will be raised. - If ``outputMode`` is not a mode supported by the ``outputProfile`` (or by pyCMS), - a :exc:`PyCMSError` will be raised. - - This function applies an ICC transformation to im from ``inputProfile``'s - color space to ``outputProfile``'s color space using the specified rendering - intent to decide how to handle out-of-gamut colors. - - ``outputMode`` can be used to specify that a color mode conversion is to - be done using these profiles, but the specified profiles must be able - to handle that mode. I.e., if converting im from RGB to CMYK using - profiles, the input profile must handle RGB data, and the output - profile must handle CMYK data. - - :param im: An open :py:class:`~PIL.Image.Image` object (i.e. Image.new(...) - or Image.open(...), etc.) - :param inputProfile: String, as a valid filename path to the ICC input - profile you wish to use for this image, or a profile object - :param outputProfile: String, as a valid filename path to the ICC output - profile you wish to use for this image, or a profile object - :param renderingIntent: Integer (0-3) specifying the rendering intent you - wish to use for the transform - - ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) - ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 - ImageCms.Intent.SATURATION = 2 - ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 - - see the pyCMS documentation for details on rendering intents and what - they do. - :param outputMode: A valid PIL mode for the output image (i.e. "RGB", - "CMYK", etc.). Note: if rendering the image "inPlace", outputMode - MUST be the same mode as the input, or omitted completely. If - omitted, the outputMode will be the same as the mode of the input - image (im.mode) - :param inPlace: Boolean. If ``True``, the original image is modified in-place, - and ``None`` is returned. If ``False`` (default), a new - :py:class:`~PIL.Image.Image` object is returned with the transform applied. - :param flags: Integer (0-...) specifying additional flags - :returns: Either None or a new :py:class:`~PIL.Image.Image` object, depending on - the value of ``inPlace`` - :exception PyCMSError: - """ - - if outputMode is None: - outputMode = im.mode - - if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3): - msg = "renderingIntent must be an integer between 0 and 3" - raise PyCMSError(msg) - - if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG): - msg = f"flags must be an integer between 0 and {_MAX_FLAG}" - raise PyCMSError(msg) - - try: - if not isinstance(inputProfile, ImageCmsProfile): - inputProfile = ImageCmsProfile(inputProfile) - if not isinstance(outputProfile, ImageCmsProfile): - outputProfile = ImageCmsProfile(outputProfile) - transform = ImageCmsTransform( - inputProfile, - outputProfile, - im.mode, - outputMode, - renderingIntent, - flags=flags, - ) - if inPlace: - transform.apply_in_place(im) - imOut = None - else: - imOut = transform.apply(im) - except (OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - return imOut - - -def getOpenProfile( - profileFilename: str | SupportsRead[bytes] | core.CmsProfile, -) -> ImageCmsProfile: - """ - (pyCMS) Opens an ICC profile file. - - The PyCMSProfile object can be passed back into pyCMS for use in creating - transforms and such (as in ImageCms.buildTransformFromOpenProfiles()). - - If ``profileFilename`` is not a valid filename for an ICC profile, - a :exc:`PyCMSError` will be raised. - - :param profileFilename: String, as a valid filename path to the ICC profile - you wish to open, or a file-like object. - :returns: A CmsProfile class object. - :exception PyCMSError: - """ - - try: - return ImageCmsProfile(profileFilename) - except (OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def buildTransform( - inputProfile: _CmsProfileCompatible, - outputProfile: _CmsProfileCompatible, - inMode: str, - outMode: str, - renderingIntent: Intent = Intent.PERCEPTUAL, - flags: Flags = Flags.NONE, -) -> ImageCmsTransform: - """ - (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the - ``outputProfile``. Use applyTransform to apply the transform to a given - image. - - If the input or output profiles specified are not valid filenames, a - :exc:`PyCMSError` will be raised. If an error occurs during creation - of the transform, a :exc:`PyCMSError` will be raised. - - If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile`` - (or by pyCMS), a :exc:`PyCMSError` will be raised. - - This function builds and returns an ICC transform from the ``inputProfile`` - to the ``outputProfile`` using the ``renderingIntent`` to determine what to do - with out-of-gamut colors. It will ONLY work for converting images that - are in ``inMode`` to images that are in ``outMode`` color format (PIL mode, - i.e. "RGB", "RGBA", "CMYK", etc.). - - Building the transform is a fair part of the overhead in - ImageCms.profileToProfile(), so if you're planning on converting multiple - images using the same input/output settings, this can save you time. - Once you have a transform object, it can be used with - ImageCms.applyProfile() to convert images without the need to re-compute - the lookup table for the transform. - - The reason pyCMS returns a class object rather than a handle directly - to the transform is that it needs to keep track of the PIL input/output - modes that the transform is meant for. These attributes are stored in - the ``inMode`` and ``outMode`` attributes of the object (which can be - manually overridden if you really want to, but I don't know of any - time that would be of use, or would even work). - - :param inputProfile: String, as a valid filename path to the ICC input - profile you wish to use for this transform, or a profile object - :param outputProfile: String, as a valid filename path to the ICC output - profile you wish to use for this transform, or a profile object - :param inMode: String, as a valid PIL mode that the appropriate profile - also supports (i.e. "RGB", "RGBA", "CMYK", etc.) - :param outMode: String, as a valid PIL mode that the appropriate profile - also supports (i.e. "RGB", "RGBA", "CMYK", etc.) - :param renderingIntent: Integer (0-3) specifying the rendering intent you - wish to use for the transform - - ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) - ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 - ImageCms.Intent.SATURATION = 2 - ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 - - see the pyCMS documentation for details on rendering intents and what - they do. - :param flags: Integer (0-...) specifying additional flags - :returns: A CmsTransform class object. - :exception PyCMSError: - """ - - if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3): - msg = "renderingIntent must be an integer between 0 and 3" - raise PyCMSError(msg) - - if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG): - msg = f"flags must be an integer between 0 and {_MAX_FLAG}" - raise PyCMSError(msg) - - try: - if not isinstance(inputProfile, ImageCmsProfile): - inputProfile = ImageCmsProfile(inputProfile) - if not isinstance(outputProfile, ImageCmsProfile): - outputProfile = ImageCmsProfile(outputProfile) - return ImageCmsTransform( - inputProfile, outputProfile, inMode, outMode, renderingIntent, flags=flags - ) - except (OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def buildProofTransform( - inputProfile: _CmsProfileCompatible, - outputProfile: _CmsProfileCompatible, - proofProfile: _CmsProfileCompatible, - inMode: str, - outMode: str, - renderingIntent: Intent = Intent.PERCEPTUAL, - proofRenderingIntent: Intent = Intent.ABSOLUTE_COLORIMETRIC, - flags: Flags = Flags.SOFTPROOFING, -) -> ImageCmsTransform: - """ - (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the - ``outputProfile``, but tries to simulate the result that would be - obtained on the ``proofProfile`` device. - - If the input, output, or proof profiles specified are not valid - filenames, a :exc:`PyCMSError` will be raised. - - If an error occurs during creation of the transform, - a :exc:`PyCMSError` will be raised. - - If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile`` - (or by pyCMS), a :exc:`PyCMSError` will be raised. - - This function builds and returns an ICC transform from the ``inputProfile`` - to the ``outputProfile``, but tries to simulate the result that would be - obtained on the ``proofProfile`` device using ``renderingIntent`` and - ``proofRenderingIntent`` to determine what to do with out-of-gamut - colors. This is known as "soft-proofing". It will ONLY work for - converting images that are in ``inMode`` to images that are in outMode - color format (PIL mode, i.e. "RGB", "RGBA", "CMYK", etc.). - - Usage of the resulting transform object is exactly the same as with - ImageCms.buildTransform(). - - Proof profiling is generally used when using an output device to get a - good idea of what the final printed/displayed image would look like on - the ``proofProfile`` device when it's quicker and easier to use the - output device for judging color. Generally, this means that the - output device is a monitor, or a dye-sub printer (etc.), and the simulated - device is something more expensive, complicated, or time consuming - (making it difficult to make a real print for color judgement purposes). - - Soft-proofing basically functions by adjusting the colors on the - output device to match the colors of the device being simulated. However, - when the simulated device has a much wider gamut than the output - device, you may obtain marginal results. - - :param inputProfile: String, as a valid filename path to the ICC input - profile you wish to use for this transform, or a profile object - :param outputProfile: String, as a valid filename path to the ICC output - (monitor, usually) profile you wish to use for this transform, or a - profile object - :param proofProfile: String, as a valid filename path to the ICC proof - profile you wish to use for this transform, or a profile object - :param inMode: String, as a valid PIL mode that the appropriate profile - also supports (i.e. "RGB", "RGBA", "CMYK", etc.) - :param outMode: String, as a valid PIL mode that the appropriate profile - also supports (i.e. "RGB", "RGBA", "CMYK", etc.) - :param renderingIntent: Integer (0-3) specifying the rendering intent you - wish to use for the input->proof (simulated) transform - - ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) - ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 - ImageCms.Intent.SATURATION = 2 - ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 - - see the pyCMS documentation for details on rendering intents and what - they do. - :param proofRenderingIntent: Integer (0-3) specifying the rendering intent - you wish to use for proof->output transform - - ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) - ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 - ImageCms.Intent.SATURATION = 2 - ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 - - see the pyCMS documentation for details on rendering intents and what - they do. - :param flags: Integer (0-...) specifying additional flags - :returns: A CmsTransform class object. - :exception PyCMSError: - """ - - if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3): - msg = "renderingIntent must be an integer between 0 and 3" - raise PyCMSError(msg) - - if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG): - msg = f"flags must be an integer between 0 and {_MAX_FLAG}" - raise PyCMSError(msg) - - try: - if not isinstance(inputProfile, ImageCmsProfile): - inputProfile = ImageCmsProfile(inputProfile) - if not isinstance(outputProfile, ImageCmsProfile): - outputProfile = ImageCmsProfile(outputProfile) - if not isinstance(proofProfile, ImageCmsProfile): - proofProfile = ImageCmsProfile(proofProfile) - return ImageCmsTransform( - inputProfile, - outputProfile, - inMode, - outMode, - renderingIntent, - proofProfile, - proofRenderingIntent, - flags, - ) - except (OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -buildTransformFromOpenProfiles = buildTransform -buildProofTransformFromOpenProfiles = buildProofTransform - - -def applyTransform( - im: Image.Image, transform: ImageCmsTransform, inPlace: bool = False -) -> Image.Image | None: - """ - (pyCMS) Applies a transform to a given image. - - If ``im.mode != transform.input_mode``, a :exc:`PyCMSError` is raised. - - If ``inPlace`` is ``True`` and ``transform.input_mode != transform.output_mode``, a - :exc:`PyCMSError` is raised. - - If ``im.mode``, ``transform.input_mode`` or ``transform.output_mode`` is not - supported by pyCMSdll or the profiles you used for the transform, a - :exc:`PyCMSError` is raised. - - If an error occurs while the transform is being applied, - a :exc:`PyCMSError` is raised. - - This function applies a pre-calculated transform (from - ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles()) - to an image. The transform can be used for multiple images, saving - considerable calculation time if doing the same conversion multiple times. - - If you want to modify im in-place instead of receiving a new image as - the return value, set ``inPlace`` to ``True``. This can only be done if - ``transform.input_mode`` and ``transform.output_mode`` are the same, because we - can't change the mode in-place (the buffer sizes for some modes are - different). The default behavior is to return a new :py:class:`~PIL.Image.Image` - object of the same dimensions in mode ``transform.output_mode``. - - :param im: An :py:class:`~PIL.Image.Image` object, and ``im.mode`` must be the same - as the ``input_mode`` supported by the transform. - :param transform: A valid CmsTransform class object - :param inPlace: Bool. If ``True``, ``im`` is modified in place and ``None`` is - returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the - transform applied is returned (and ``im`` is not changed). The default is - ``False``. - :returns: Either ``None``, or a new :py:class:`~PIL.Image.Image` object, - depending on the value of ``inPlace``. The profile will be returned in - the image's ``info['icc_profile']``. - :exception PyCMSError: - """ - - try: - if inPlace: - transform.apply_in_place(im) - imOut = None - else: - imOut = transform.apply(im) - except (TypeError, ValueError) as v: - raise PyCMSError(v) from v - - return imOut - - -def createProfile( - colorSpace: Literal["LAB", "XYZ", "sRGB"], colorTemp: SupportsFloat = 0 -) -> core.CmsProfile: - """ - (pyCMS) Creates a profile. - - If colorSpace not in ``["LAB", "XYZ", "sRGB"]``, - a :exc:`PyCMSError` is raised. - - If using LAB and ``colorTemp`` is not a positive integer, - a :exc:`PyCMSError` is raised. - - If an error occurs while creating the profile, - a :exc:`PyCMSError` is raised. - - Use this function to create common profiles on-the-fly instead of - having to supply a profile on disk and knowing the path to it. It - returns a normal CmsProfile object that can be passed to - ImageCms.buildTransformFromOpenProfiles() to create a transform to apply - to images. - - :param colorSpace: String, the color space of the profile you wish to - create. - Currently only "LAB", "XYZ", and "sRGB" are supported. - :param colorTemp: Positive number for the white point for the profile, in - degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for D50 - illuminant if omitted (5000k). colorTemp is ONLY applied to LAB - profiles, and is ignored for XYZ and sRGB. - :returns: A CmsProfile class object - :exception PyCMSError: - """ - - if colorSpace not in ["LAB", "XYZ", "sRGB"]: - msg = ( - f"Color space not supported for on-the-fly profile creation ({colorSpace})" - ) - raise PyCMSError(msg) - - if colorSpace == "LAB": - try: - colorTemp = float(colorTemp) - except (TypeError, ValueError) as e: - msg = f'Color temperature must be numeric, "{colorTemp}" not valid' - raise PyCMSError(msg) from e - - try: - return core.createProfile(colorSpace, colorTemp) - except (TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def getProfileName(profile: _CmsProfileCompatible) -> str: - """ - - (pyCMS) Gets the internal product name for the given profile. - - If ``profile`` isn't a valid CmsProfile object or filename to a profile, - a :exc:`PyCMSError` is raised If an error occurs while trying - to obtain the name tag, a :exc:`PyCMSError` is raised. - - Use this function to obtain the INTERNAL name of the profile (stored - in an ICC tag in the profile itself), usually the one used when the - profile was originally created. Sometimes this tag also contains - additional information supplied by the creator. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :returns: A string containing the internal name of the profile as stored - in an ICC tag. - :exception PyCMSError: - """ - - try: - # add an extra newline to preserve pyCMS compatibility - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - # do it in python, not c. - # // name was "%s - %s" (model, manufacturer) || Description , - # // but if the Model and Manufacturer were the same or the model - # // was long, Just the model, in 1.x - model = profile.profile.model - manufacturer = profile.profile.manufacturer - - if not (model or manufacturer): - return (profile.profile.profile_description or "") + "\n" - if not manufacturer or (model and len(model) > 30): - return f"{model}\n" - return f"{model} - {manufacturer}\n" - - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def getProfileInfo(profile: _CmsProfileCompatible) -> str: - """ - (pyCMS) Gets the internal product information for the given profile. - - If ``profile`` isn't a valid CmsProfile object or filename to a profile, - a :exc:`PyCMSError` is raised. - - If an error occurs while trying to obtain the info tag, - a :exc:`PyCMSError` is raised. - - Use this function to obtain the information stored in the profile's - info tag. This often contains details about the profile, and how it - was created, as supplied by the creator. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :returns: A string containing the internal profile information stored in - an ICC tag. - :exception PyCMSError: - """ - - try: - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - # add an extra newline to preserve pyCMS compatibility - # Python, not C. the white point bits weren't working well, - # so skipping. - # info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint - description = profile.profile.profile_description - cpright = profile.profile.copyright - elements = [element for element in (description, cpright) if element] - return "\r\n\r\n".join(elements) + "\r\n\r\n" - - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def getProfileCopyright(profile: _CmsProfileCompatible) -> str: - """ - (pyCMS) Gets the copyright for the given profile. - - If ``profile`` isn't a valid CmsProfile object or filename to a profile, a - :exc:`PyCMSError` is raised. - - If an error occurs while trying to obtain the copyright tag, - a :exc:`PyCMSError` is raised. - - Use this function to obtain the information stored in the profile's - copyright tag. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :returns: A string containing the internal profile information stored in - an ICC tag. - :exception PyCMSError: - """ - try: - # add an extra newline to preserve pyCMS compatibility - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - return (profile.profile.copyright or "") + "\n" - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def getProfileManufacturer(profile: _CmsProfileCompatible) -> str: - """ - (pyCMS) Gets the manufacturer for the given profile. - - If ``profile`` isn't a valid CmsProfile object or filename to a profile, a - :exc:`PyCMSError` is raised. - - If an error occurs while trying to obtain the manufacturer tag, a - :exc:`PyCMSError` is raised. - - Use this function to obtain the information stored in the profile's - manufacturer tag. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :returns: A string containing the internal profile information stored in - an ICC tag. - :exception PyCMSError: - """ - try: - # add an extra newline to preserve pyCMS compatibility - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - return (profile.profile.manufacturer or "") + "\n" - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def getProfileModel(profile: _CmsProfileCompatible) -> str: - """ - (pyCMS) Gets the model for the given profile. - - If ``profile`` isn't a valid CmsProfile object or filename to a profile, a - :exc:`PyCMSError` is raised. - - If an error occurs while trying to obtain the model tag, - a :exc:`PyCMSError` is raised. - - Use this function to obtain the information stored in the profile's - model tag. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :returns: A string containing the internal profile information stored in - an ICC tag. - :exception PyCMSError: - """ - - try: - # add an extra newline to preserve pyCMS compatibility - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - return (profile.profile.model or "") + "\n" - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def getProfileDescription(profile: _CmsProfileCompatible) -> str: - """ - (pyCMS) Gets the description for the given profile. - - If ``profile`` isn't a valid CmsProfile object or filename to a profile, a - :exc:`PyCMSError` is raised. - - If an error occurs while trying to obtain the description tag, - a :exc:`PyCMSError` is raised. - - Use this function to obtain the information stored in the profile's - description tag. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :returns: A string containing the internal profile information stored in an - ICC tag. - :exception PyCMSError: - """ - - try: - # add an extra newline to preserve pyCMS compatibility - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - return (profile.profile.profile_description or "") + "\n" - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def getDefaultIntent(profile: _CmsProfileCompatible) -> int: - """ - (pyCMS) Gets the default intent name for the given profile. - - If ``profile`` isn't a valid CmsProfile object or filename to a profile, a - :exc:`PyCMSError` is raised. - - If an error occurs while trying to obtain the default intent, a - :exc:`PyCMSError` is raised. - - Use this function to determine the default (and usually best optimized) - rendering intent for this profile. Most profiles support multiple - rendering intents, but are intended mostly for one type of conversion. - If you wish to use a different intent than returned, use - ImageCms.isIntentSupported() to verify it will work first. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :returns: Integer 0-3 specifying the default rendering intent for this - profile. - - ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) - ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 - ImageCms.Intent.SATURATION = 2 - ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 - - see the pyCMS documentation for details on rendering intents and what - they do. - :exception PyCMSError: - """ - - try: - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - return profile.profile.rendering_intent - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def isIntentSupported( - profile: _CmsProfileCompatible, intent: Intent, direction: Direction -) -> Literal[-1, 1]: - """ - (pyCMS) Checks if a given intent is supported. - - Use this function to verify that you can use your desired - ``intent`` with ``profile``, and that ``profile`` can be used for the - input/output/proof profile as you desire. - - Some profiles are created specifically for one "direction", can cannot - be used for others. Some profiles can only be used for certain - rendering intents, so it's best to either verify this before trying - to create a transform with them (using this function), or catch the - potential :exc:`PyCMSError` that will occur if they don't - support the modes you select. - - :param profile: EITHER a valid CmsProfile object, OR a string of the - filename of an ICC profile. - :param intent: Integer (0-3) specifying the rendering intent you wish to - use with this profile - - ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) - ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 - ImageCms.Intent.SATURATION = 2 - ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 - - see the pyCMS documentation for details on rendering intents and what - they do. - :param direction: Integer specifying if the profile is to be used for - input, output, or proof - - INPUT = 0 (or use ImageCms.Direction.INPUT) - OUTPUT = 1 (or use ImageCms.Direction.OUTPUT) - PROOF = 2 (or use ImageCms.Direction.PROOF) - - :returns: 1 if the intent/direction are supported, -1 if they are not. - :exception PyCMSError: - """ - - try: - if not isinstance(profile, ImageCmsProfile): - profile = ImageCmsProfile(profile) - # FIXME: I get different results for the same data w. different - # compilers. Bug in LittleCMS or in the binding? - if profile.profile.is_intent_supported(intent, direction): - return 1 - else: - return -1 - except (AttributeError, OSError, TypeError, ValueError) as v: - raise PyCMSError(v) from v - - -def versions() -> tuple[str, str | None, str, str]: - """ - (pyCMS) Fetches versions. - """ - - deprecate( - "PIL.ImageCms.versions()", - 12, - '(PIL.features.version("littlecms2"), sys.version, PIL.__version__)', - ) - return _VERSION, core.littlecms_version, sys.version.split()[0], __version__ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageColor.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageColor.py deleted file mode 100644 index 9a15a8e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageColor.py +++ /dev/null @@ -1,320 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# map CSS3-style colour description strings to RGB -# -# History: -# 2002-10-24 fl Added support for CSS-style color strings -# 2002-12-15 fl Added RGBA support -# 2004-03-27 fl Fixed remaining int() problems for Python 1.5.2 -# 2004-07-19 fl Fixed gray/grey spelling issues -# 2009-03-05 fl Fixed rounding error in grayscale calculation -# -# Copyright (c) 2002-2004 by Secret Labs AB -# Copyright (c) 2002-2004 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import re -from functools import lru_cache - -from . import Image - - -@lru_cache -def getrgb(color: str) -> tuple[int, int, int] | tuple[int, int, int, int]: - """ - Convert a color string to an RGB or RGBA tuple. If the string cannot be - parsed, this function raises a :py:exc:`ValueError` exception. - - .. versionadded:: 1.1.4 - - :param color: A color string - :return: ``(red, green, blue[, alpha])`` - """ - if len(color) > 100: - msg = "color specifier is too long" - raise ValueError(msg) - color = color.lower() - - rgb = colormap.get(color, None) - if rgb: - if isinstance(rgb, tuple): - return rgb - rgb_tuple = getrgb(rgb) - assert len(rgb_tuple) == 3 - colormap[color] = rgb_tuple - return rgb_tuple - - # check for known string formats - if re.match("#[a-f0-9]{3}$", color): - return int(color[1] * 2, 16), int(color[2] * 2, 16), int(color[3] * 2, 16) - - if re.match("#[a-f0-9]{4}$", color): - return ( - int(color[1] * 2, 16), - int(color[2] * 2, 16), - int(color[3] * 2, 16), - int(color[4] * 2, 16), - ) - - if re.match("#[a-f0-9]{6}$", color): - return int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16) - - if re.match("#[a-f0-9]{8}$", color): - return ( - int(color[1:3], 16), - int(color[3:5], 16), - int(color[5:7], 16), - int(color[7:9], 16), - ) - - m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color) - if m: - return int(m.group(1)), int(m.group(2)), int(m.group(3)) - - m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color) - if m: - return ( - int((int(m.group(1)) * 255) / 100.0 + 0.5), - int((int(m.group(2)) * 255) / 100.0 + 0.5), - int((int(m.group(3)) * 255) / 100.0 + 0.5), - ) - - m = re.match( - r"hsl\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color - ) - if m: - from colorsys import hls_to_rgb - - rgb_floats = hls_to_rgb( - float(m.group(1)) / 360.0, - float(m.group(3)) / 100.0, - float(m.group(2)) / 100.0, - ) - return ( - int(rgb_floats[0] * 255 + 0.5), - int(rgb_floats[1] * 255 + 0.5), - int(rgb_floats[2] * 255 + 0.5), - ) - - m = re.match( - r"hs[bv]\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color - ) - if m: - from colorsys import hsv_to_rgb - - rgb_floats = hsv_to_rgb( - float(m.group(1)) / 360.0, - float(m.group(2)) / 100.0, - float(m.group(3)) / 100.0, - ) - return ( - int(rgb_floats[0] * 255 + 0.5), - int(rgb_floats[1] * 255 + 0.5), - int(rgb_floats[2] * 255 + 0.5), - ) - - m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color) - if m: - return int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4)) - msg = f"unknown color specifier: {repr(color)}" - raise ValueError(msg) - - -@lru_cache -def getcolor(color: str, mode: str) -> int | tuple[int, ...]: - """ - Same as :py:func:`~PIL.ImageColor.getrgb` for most modes. However, if - ``mode`` is HSV, converts the RGB value to a HSV value, or if ``mode`` is - not color or a palette image, converts the RGB value to a grayscale value. - If the string cannot be parsed, this function raises a :py:exc:`ValueError` - exception. - - .. versionadded:: 1.1.4 - - :param color: A color string - :param mode: Convert result to this mode - :return: ``graylevel, (graylevel, alpha) or (red, green, blue[, alpha])`` - """ - # same as getrgb, but converts the result to the given mode - rgb, alpha = getrgb(color), 255 - if len(rgb) == 4: - alpha = rgb[3] - rgb = rgb[:3] - - if mode == "HSV": - from colorsys import rgb_to_hsv - - r, g, b = rgb - h, s, v = rgb_to_hsv(r / 255, g / 255, b / 255) - return int(h * 255), int(s * 255), int(v * 255) - elif Image.getmodebase(mode) == "L": - r, g, b = rgb - # ITU-R Recommendation 601-2 for nonlinear RGB - # scaled to 24 bits to match the convert's implementation. - graylevel = (r * 19595 + g * 38470 + b * 7471 + 0x8000) >> 16 - if mode[-1] == "A": - return graylevel, alpha - return graylevel - elif mode[-1] == "A": - return rgb + (alpha,) - return rgb - - -colormap: dict[str, str | tuple[int, int, int]] = { - # X11 colour table from https://drafts.csswg.org/css-color-4/, with - # gray/grey spelling issues fixed. This is a superset of HTML 4.0 - # colour names used in CSS 1. - "aliceblue": "#f0f8ff", - "antiquewhite": "#faebd7", - "aqua": "#00ffff", - "aquamarine": "#7fffd4", - "azure": "#f0ffff", - "beige": "#f5f5dc", - "bisque": "#ffe4c4", - "black": "#000000", - "blanchedalmond": "#ffebcd", - "blue": "#0000ff", - "blueviolet": "#8a2be2", - "brown": "#a52a2a", - "burlywood": "#deb887", - "cadetblue": "#5f9ea0", - "chartreuse": "#7fff00", - "chocolate": "#d2691e", - "coral": "#ff7f50", - "cornflowerblue": "#6495ed", - "cornsilk": "#fff8dc", - "crimson": "#dc143c", - "cyan": "#00ffff", - "darkblue": "#00008b", - "darkcyan": "#008b8b", - "darkgoldenrod": "#b8860b", - "darkgray": "#a9a9a9", - "darkgrey": "#a9a9a9", - "darkgreen": "#006400", - "darkkhaki": "#bdb76b", - "darkmagenta": "#8b008b", - "darkolivegreen": "#556b2f", - "darkorange": "#ff8c00", - "darkorchid": "#9932cc", - "darkred": "#8b0000", - "darksalmon": "#e9967a", - "darkseagreen": "#8fbc8f", - "darkslateblue": "#483d8b", - "darkslategray": "#2f4f4f", - "darkslategrey": "#2f4f4f", - "darkturquoise": "#00ced1", - "darkviolet": "#9400d3", - "deeppink": "#ff1493", - "deepskyblue": "#00bfff", - "dimgray": "#696969", - "dimgrey": "#696969", - "dodgerblue": "#1e90ff", - "firebrick": "#b22222", - "floralwhite": "#fffaf0", - "forestgreen": "#228b22", - "fuchsia": "#ff00ff", - "gainsboro": "#dcdcdc", - "ghostwhite": "#f8f8ff", - "gold": "#ffd700", - "goldenrod": "#daa520", - "gray": "#808080", - "grey": "#808080", - "green": "#008000", - "greenyellow": "#adff2f", - "honeydew": "#f0fff0", - "hotpink": "#ff69b4", - "indianred": "#cd5c5c", - "indigo": "#4b0082", - "ivory": "#fffff0", - "khaki": "#f0e68c", - "lavender": "#e6e6fa", - "lavenderblush": "#fff0f5", - "lawngreen": "#7cfc00", - "lemonchiffon": "#fffacd", - "lightblue": "#add8e6", - "lightcoral": "#f08080", - "lightcyan": "#e0ffff", - "lightgoldenrodyellow": "#fafad2", - "lightgreen": "#90ee90", - "lightgray": "#d3d3d3", - "lightgrey": "#d3d3d3", - "lightpink": "#ffb6c1", - "lightsalmon": "#ffa07a", - "lightseagreen": "#20b2aa", - "lightskyblue": "#87cefa", - "lightslategray": "#778899", - "lightslategrey": "#778899", - "lightsteelblue": "#b0c4de", - "lightyellow": "#ffffe0", - "lime": "#00ff00", - "limegreen": "#32cd32", - "linen": "#faf0e6", - "magenta": "#ff00ff", - "maroon": "#800000", - "mediumaquamarine": "#66cdaa", - "mediumblue": "#0000cd", - "mediumorchid": "#ba55d3", - "mediumpurple": "#9370db", - "mediumseagreen": "#3cb371", - "mediumslateblue": "#7b68ee", - "mediumspringgreen": "#00fa9a", - "mediumturquoise": "#48d1cc", - "mediumvioletred": "#c71585", - "midnightblue": "#191970", - "mintcream": "#f5fffa", - "mistyrose": "#ffe4e1", - "moccasin": "#ffe4b5", - "navajowhite": "#ffdead", - "navy": "#000080", - "oldlace": "#fdf5e6", - "olive": "#808000", - "olivedrab": "#6b8e23", - "orange": "#ffa500", - "orangered": "#ff4500", - "orchid": "#da70d6", - "palegoldenrod": "#eee8aa", - "palegreen": "#98fb98", - "paleturquoise": "#afeeee", - "palevioletred": "#db7093", - "papayawhip": "#ffefd5", - "peachpuff": "#ffdab9", - "peru": "#cd853f", - "pink": "#ffc0cb", - "plum": "#dda0dd", - "powderblue": "#b0e0e6", - "purple": "#800080", - "rebeccapurple": "#663399", - "red": "#ff0000", - "rosybrown": "#bc8f8f", - "royalblue": "#4169e1", - "saddlebrown": "#8b4513", - "salmon": "#fa8072", - "sandybrown": "#f4a460", - "seagreen": "#2e8b57", - "seashell": "#fff5ee", - "sienna": "#a0522d", - "silver": "#c0c0c0", - "skyblue": "#87ceeb", - "slateblue": "#6a5acd", - "slategray": "#708090", - "slategrey": "#708090", - "snow": "#fffafa", - "springgreen": "#00ff7f", - "steelblue": "#4682b4", - "tan": "#d2b48c", - "teal": "#008080", - "thistle": "#d8bfd8", - "tomato": "#ff6347", - "turquoise": "#40e0d0", - "violet": "#ee82ee", - "wheat": "#f5deb3", - "white": "#ffffff", - "whitesmoke": "#f5f5f5", - "yellow": "#ffff00", - "yellowgreen": "#9acd32", -} diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageDraw.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageDraw.py deleted file mode 100644 index 6cf1ee6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageDraw.py +++ /dev/null @@ -1,1232 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# drawing interface operations -# -# History: -# 1996-04-13 fl Created (experimental) -# 1996-08-07 fl Filled polygons, ellipses. -# 1996-08-13 fl Added text support -# 1998-06-28 fl Handle I and F images -# 1998-12-29 fl Added arc; use arc primitive to draw ellipses -# 1999-01-10 fl Added shape stuff (experimental) -# 1999-02-06 fl Added bitmap support -# 1999-02-11 fl Changed all primitives to take options -# 1999-02-20 fl Fixed backwards compatibility -# 2000-10-12 fl Copy on write, when necessary -# 2001-02-18 fl Use default ink for bitmap/text also in fill mode -# 2002-10-24 fl Added support for CSS-style color strings -# 2002-12-10 fl Added experimental support for RGBA-on-RGB drawing -# 2002-12-11 fl Refactored low-level drawing API (work in progress) -# 2004-08-26 fl Made Draw() a factory function, added getdraw() support -# 2004-09-04 fl Added width support to line primitive -# 2004-09-10 fl Added font mode handling -# 2006-06-19 fl Added font bearing support (getmask2) -# -# Copyright (c) 1997-2006 by Secret Labs AB -# Copyright (c) 1996-2006 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import math -import struct -from collections.abc import Sequence -from types import ModuleType -from typing import Any, AnyStr, Callable, Union, cast - -from . import Image, ImageColor -from ._deprecate import deprecate -from ._typing import Coords - -# experimental access to the outline API -Outline: Callable[[], Image.core._Outline] = Image.core.outline - -TYPE_CHECKING = False -if TYPE_CHECKING: - from . import ImageDraw2, ImageFont - -_Ink = Union[float, tuple[int, ...], str] - -""" -A simple 2D drawing interface for PIL images. -

-Application code should use the Draw factory, instead of -directly. -""" - - -class ImageDraw: - font: ( - ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont | None - ) = None - - def __init__(self, im: Image.Image, mode: str | None = None) -> None: - """ - Create a drawing instance. - - :param im: The image to draw in. - :param mode: Optional mode to use for color values. For RGB - images, this argument can be RGB or RGBA (to blend the - drawing into the image). For all other modes, this argument - must be the same as the image mode. If omitted, the mode - defaults to the mode of the image. - """ - im.load() - if im.readonly: - im._copy() # make it writeable - blend = 0 - if mode is None: - mode = im.mode - if mode != im.mode: - if mode == "RGBA" and im.mode == "RGB": - blend = 1 - else: - msg = "mode mismatch" - raise ValueError(msg) - if mode == "P": - self.palette = im.palette - else: - self.palette = None - self._image = im - self.im = im.im - self.draw = Image.core.draw(self.im, blend) - self.mode = mode - if mode in ("I", "F"): - self.ink = self.draw.draw_ink(1) - else: - self.ink = self.draw.draw_ink(-1) - if mode in ("1", "P", "I", "F"): - # FIXME: fix Fill2 to properly support matte for I+F images - self.fontmode = "1" - else: - self.fontmode = "L" # aliasing is okay for other modes - self.fill = False - - def getfont( - self, - ) -> ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont: - """ - Get the current default font. - - To set the default font for this ImageDraw instance:: - - from PIL import ImageDraw, ImageFont - draw.font = ImageFont.truetype("Tests/fonts/FreeMono.ttf") - - To set the default font for all future ImageDraw instances:: - - from PIL import ImageDraw, ImageFont - ImageDraw.ImageDraw.font = ImageFont.truetype("Tests/fonts/FreeMono.ttf") - - If the current default font is ``None``, - it is initialized with ``ImageFont.load_default()``. - - :returns: An image font.""" - if not self.font: - # FIXME: should add a font repository - from . import ImageFont - - self.font = ImageFont.load_default() - return self.font - - def _getfont( - self, font_size: float | None - ) -> ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont: - if font_size is not None: - from . import ImageFont - - return ImageFont.load_default(font_size) - else: - return self.getfont() - - def _getink( - self, ink: _Ink | None, fill: _Ink | None = None - ) -> tuple[int | None, int | None]: - result_ink = None - result_fill = None - if ink is None and fill is None: - if self.fill: - result_fill = self.ink - else: - result_ink = self.ink - else: - if ink is not None: - if isinstance(ink, str): - ink = ImageColor.getcolor(ink, self.mode) - if self.palette and isinstance(ink, tuple): - ink = self.palette.getcolor(ink, self._image) - result_ink = self.draw.draw_ink(ink) - if fill is not None: - if isinstance(fill, str): - fill = ImageColor.getcolor(fill, self.mode) - if self.palette and isinstance(fill, tuple): - fill = self.palette.getcolor(fill, self._image) - result_fill = self.draw.draw_ink(fill) - return result_ink, result_fill - - def arc( - self, - xy: Coords, - start: float, - end: float, - fill: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw an arc.""" - ink, fill = self._getink(fill) - if ink is not None: - self.draw.draw_arc(xy, start, end, ink, width) - - def bitmap( - self, xy: Sequence[int], bitmap: Image.Image, fill: _Ink | None = None - ) -> None: - """Draw a bitmap.""" - bitmap.load() - ink, fill = self._getink(fill) - if ink is None: - ink = fill - if ink is not None: - self.draw.draw_bitmap(xy, bitmap.im, ink) - - def chord( - self, - xy: Coords, - start: float, - end: float, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw a chord.""" - ink, fill_ink = self._getink(outline, fill) - if fill_ink is not None: - self.draw.draw_chord(xy, start, end, fill_ink, 1) - if ink is not None and ink != fill_ink and width != 0: - self.draw.draw_chord(xy, start, end, ink, 0, width) - - def ellipse( - self, - xy: Coords, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw an ellipse.""" - ink, fill_ink = self._getink(outline, fill) - if fill_ink is not None: - self.draw.draw_ellipse(xy, fill_ink, 1) - if ink is not None and ink != fill_ink and width != 0: - self.draw.draw_ellipse(xy, ink, 0, width) - - def circle( - self, - xy: Sequence[float], - radius: float, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw a circle given center coordinates and a radius.""" - ellipse_xy = (xy[0] - radius, xy[1] - radius, xy[0] + radius, xy[1] + radius) - self.ellipse(ellipse_xy, fill, outline, width) - - def line( - self, - xy: Coords, - fill: _Ink | None = None, - width: int = 0, - joint: str | None = None, - ) -> None: - """Draw a line, or a connected sequence of line segments.""" - ink = self._getink(fill)[0] - if ink is not None: - self.draw.draw_lines(xy, ink, width) - if joint == "curve" and width > 4: - points: Sequence[Sequence[float]] - if isinstance(xy[0], (list, tuple)): - points = cast(Sequence[Sequence[float]], xy) - else: - points = [ - cast(Sequence[float], tuple(xy[i : i + 2])) - for i in range(0, len(xy), 2) - ] - for i in range(1, len(points) - 1): - point = points[i] - angles = [ - math.degrees(math.atan2(end[0] - start[0], start[1] - end[1])) - % 360 - for start, end in ( - (points[i - 1], point), - (point, points[i + 1]), - ) - ] - if angles[0] == angles[1]: - # This is a straight line, so no joint is required - continue - - def coord_at_angle( - coord: Sequence[float], angle: float - ) -> tuple[float, ...]: - x, y = coord - angle -= 90 - distance = width / 2 - 1 - return tuple( - p + (math.floor(p_d) if p_d > 0 else math.ceil(p_d)) - for p, p_d in ( - (x, distance * math.cos(math.radians(angle))), - (y, distance * math.sin(math.radians(angle))), - ) - ) - - flipped = ( - angles[1] > angles[0] and angles[1] - 180 > angles[0] - ) or (angles[1] < angles[0] and angles[1] + 180 > angles[0]) - coords = [ - (point[0] - width / 2 + 1, point[1] - width / 2 + 1), - (point[0] + width / 2 - 1, point[1] + width / 2 - 1), - ] - if flipped: - start, end = (angles[1] + 90, angles[0] + 90) - else: - start, end = (angles[0] - 90, angles[1] - 90) - self.pieslice(coords, start - 90, end - 90, fill) - - if width > 8: - # Cover potential gaps between the line and the joint - if flipped: - gap_coords = [ - coord_at_angle(point, angles[0] + 90), - point, - coord_at_angle(point, angles[1] + 90), - ] - else: - gap_coords = [ - coord_at_angle(point, angles[0] - 90), - point, - coord_at_angle(point, angles[1] - 90), - ] - self.line(gap_coords, fill, width=3) - - def shape( - self, - shape: Image.core._Outline, - fill: _Ink | None = None, - outline: _Ink | None = None, - ) -> None: - """(Experimental) Draw a shape.""" - shape.close() - ink, fill_ink = self._getink(outline, fill) - if fill_ink is not None: - self.draw.draw_outline(shape, fill_ink, 1) - if ink is not None and ink != fill_ink: - self.draw.draw_outline(shape, ink, 0) - - def pieslice( - self, - xy: Coords, - start: float, - end: float, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw a pieslice.""" - ink, fill_ink = self._getink(outline, fill) - if fill_ink is not None: - self.draw.draw_pieslice(xy, start, end, fill_ink, 1) - if ink is not None and ink != fill_ink and width != 0: - self.draw.draw_pieslice(xy, start, end, ink, 0, width) - - def point(self, xy: Coords, fill: _Ink | None = None) -> None: - """Draw one or more individual pixels.""" - ink, fill = self._getink(fill) - if ink is not None: - self.draw.draw_points(xy, ink) - - def polygon( - self, - xy: Coords, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw a polygon.""" - ink, fill_ink = self._getink(outline, fill) - if fill_ink is not None: - self.draw.draw_polygon(xy, fill_ink, 1) - if ink is not None and ink != fill_ink and width != 0: - if width == 1: - self.draw.draw_polygon(xy, ink, 0, width) - elif self.im is not None: - # To avoid expanding the polygon outwards, - # use the fill as a mask - mask = Image.new("1", self.im.size) - mask_ink = self._getink(1)[0] - draw = Draw(mask) - draw.draw.draw_polygon(xy, mask_ink, 1) - - self.draw.draw_polygon(xy, ink, 0, width * 2 - 1, mask.im) - - def regular_polygon( - self, - bounding_circle: Sequence[Sequence[float] | float], - n_sides: int, - rotation: float = 0, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw a regular polygon.""" - xy = _compute_regular_polygon_vertices(bounding_circle, n_sides, rotation) - self.polygon(xy, fill, outline, width) - - def rectangle( - self, - xy: Coords, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - ) -> None: - """Draw a rectangle.""" - ink, fill_ink = self._getink(outline, fill) - if fill_ink is not None: - self.draw.draw_rectangle(xy, fill_ink, 1) - if ink is not None and ink != fill_ink and width != 0: - self.draw.draw_rectangle(xy, ink, 0, width) - - def rounded_rectangle( - self, - xy: Coords, - radius: float = 0, - fill: _Ink | None = None, - outline: _Ink | None = None, - width: int = 1, - *, - corners: tuple[bool, bool, bool, bool] | None = None, - ) -> None: - """Draw a rounded rectangle.""" - if isinstance(xy[0], (list, tuple)): - (x0, y0), (x1, y1) = cast(Sequence[Sequence[float]], xy) - else: - x0, y0, x1, y1 = cast(Sequence[float], xy) - if x1 < x0: - msg = "x1 must be greater than or equal to x0" - raise ValueError(msg) - if y1 < y0: - msg = "y1 must be greater than or equal to y0" - raise ValueError(msg) - if corners is None: - corners = (True, True, True, True) - - d = radius * 2 - - x0 = round(x0) - y0 = round(y0) - x1 = round(x1) - y1 = round(y1) - full_x, full_y = False, False - if all(corners): - full_x = d >= x1 - x0 - 1 - if full_x: - # The two left and two right corners are joined - d = x1 - x0 - full_y = d >= y1 - y0 - 1 - if full_y: - # The two top and two bottom corners are joined - d = y1 - y0 - if full_x and full_y: - # If all corners are joined, that is a circle - return self.ellipse(xy, fill, outline, width) - - if d == 0 or not any(corners): - # If the corners have no curve, - # or there are no corners, - # that is a rectangle - return self.rectangle(xy, fill, outline, width) - - r = int(d // 2) - ink, fill_ink = self._getink(outline, fill) - - def draw_corners(pieslice: bool) -> None: - parts: tuple[tuple[tuple[float, float, float, float], int, int], ...] - if full_x: - # Draw top and bottom halves - parts = ( - ((x0, y0, x0 + d, y0 + d), 180, 360), - ((x0, y1 - d, x0 + d, y1), 0, 180), - ) - elif full_y: - # Draw left and right halves - parts = ( - ((x0, y0, x0 + d, y0 + d), 90, 270), - ((x1 - d, y0, x1, y0 + d), 270, 90), - ) - else: - # Draw four separate corners - parts = tuple( - part - for i, part in enumerate( - ( - ((x0, y0, x0 + d, y0 + d), 180, 270), - ((x1 - d, y0, x1, y0 + d), 270, 360), - ((x1 - d, y1 - d, x1, y1), 0, 90), - ((x0, y1 - d, x0 + d, y1), 90, 180), - ) - ) - if corners[i] - ) - for part in parts: - if pieslice: - self.draw.draw_pieslice(*(part + (fill_ink, 1))) - else: - self.draw.draw_arc(*(part + (ink, width))) - - if fill_ink is not None: - draw_corners(True) - - if full_x: - self.draw.draw_rectangle((x0, y0 + r + 1, x1, y1 - r - 1), fill_ink, 1) - elif x1 - r - 1 > x0 + r + 1: - self.draw.draw_rectangle((x0 + r + 1, y0, x1 - r - 1, y1), fill_ink, 1) - if not full_x and not full_y: - left = [x0, y0, x0 + r, y1] - if corners[0]: - left[1] += r + 1 - if corners[3]: - left[3] -= r + 1 - self.draw.draw_rectangle(left, fill_ink, 1) - - right = [x1 - r, y0, x1, y1] - if corners[1]: - right[1] += r + 1 - if corners[2]: - right[3] -= r + 1 - self.draw.draw_rectangle(right, fill_ink, 1) - if ink is not None and ink != fill_ink and width != 0: - draw_corners(False) - - if not full_x: - top = [x0, y0, x1, y0 + width - 1] - if corners[0]: - top[0] += r + 1 - if corners[1]: - top[2] -= r + 1 - self.draw.draw_rectangle(top, ink, 1) - - bottom = [x0, y1 - width + 1, x1, y1] - if corners[3]: - bottom[0] += r + 1 - if corners[2]: - bottom[2] -= r + 1 - self.draw.draw_rectangle(bottom, ink, 1) - if not full_y: - left = [x0, y0, x0 + width - 1, y1] - if corners[0]: - left[1] += r + 1 - if corners[3]: - left[3] -= r + 1 - self.draw.draw_rectangle(left, ink, 1) - - right = [x1 - width + 1, y0, x1, y1] - if corners[1]: - right[1] += r + 1 - if corners[2]: - right[3] -= r + 1 - self.draw.draw_rectangle(right, ink, 1) - - def _multiline_check(self, text: AnyStr) -> bool: - split_character = "\n" if isinstance(text, str) else b"\n" - - return split_character in text - - def text( - self, - xy: tuple[float, float], - text: AnyStr, - fill: _Ink | None = None, - font: ( - ImageFont.ImageFont - | ImageFont.FreeTypeFont - | ImageFont.TransposedFont - | None - ) = None, - anchor: str | None = None, - spacing: float = 4, - align: str = "left", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - stroke_width: float = 0, - stroke_fill: _Ink | None = None, - embedded_color: bool = False, - *args: Any, - **kwargs: Any, - ) -> None: - """Draw text.""" - if embedded_color and self.mode not in ("RGB", "RGBA"): - msg = "Embedded color supported only in RGB and RGBA modes" - raise ValueError(msg) - - if font is None: - font = self._getfont(kwargs.get("font_size")) - - if self._multiline_check(text): - return self.multiline_text( - xy, - text, - fill, - font, - anchor, - spacing, - align, - direction, - features, - language, - stroke_width, - stroke_fill, - embedded_color, - ) - - def getink(fill: _Ink | None) -> int: - ink, fill_ink = self._getink(fill) - if ink is None: - assert fill_ink is not None - return fill_ink - return ink - - def draw_text(ink: int, stroke_width: float = 0) -> None: - mode = self.fontmode - if stroke_width == 0 and embedded_color: - mode = "RGBA" - coord = [] - for i in range(2): - coord.append(int(xy[i])) - start = (math.modf(xy[0])[0], math.modf(xy[1])[0]) - try: - mask, offset = font.getmask2( # type: ignore[union-attr,misc] - text, - mode, - direction=direction, - features=features, - language=language, - stroke_width=stroke_width, - stroke_filled=True, - anchor=anchor, - ink=ink, - start=start, - *args, - **kwargs, - ) - coord = [coord[0] + offset[0], coord[1] + offset[1]] - except AttributeError: - try: - mask = font.getmask( # type: ignore[misc] - text, - mode, - direction, - features, - language, - stroke_width, - anchor, - ink, - start=start, - *args, - **kwargs, - ) - except TypeError: - mask = font.getmask(text) - if mode == "RGBA": - # font.getmask2(mode="RGBA") returns color in RGB bands and mask in A - # extract mask and set text alpha - color, mask = mask, mask.getband(3) - ink_alpha = struct.pack("i", ink)[3] - color.fillband(3, ink_alpha) - x, y = coord - if self.im is not None: - self.im.paste( - color, (x, y, x + mask.size[0], y + mask.size[1]), mask - ) - else: - self.draw.draw_bitmap(coord, mask, ink) - - ink = getink(fill) - if ink is not None: - stroke_ink = None - if stroke_width: - stroke_ink = getink(stroke_fill) if stroke_fill is not None else ink - - if stroke_ink is not None: - # Draw stroked text - draw_text(stroke_ink, stroke_width) - - # Draw normal text - if ink != stroke_ink: - draw_text(ink) - else: - # Only draw normal text - draw_text(ink) - - def _prepare_multiline_text( - self, - xy: tuple[float, float], - text: AnyStr, - font: ( - ImageFont.ImageFont - | ImageFont.FreeTypeFont - | ImageFont.TransposedFont - | None - ), - anchor: str | None, - spacing: float, - align: str, - direction: str | None, - features: list[str] | None, - language: str | None, - stroke_width: float, - embedded_color: bool, - font_size: float | None, - ) -> tuple[ - ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont, - list[tuple[tuple[float, float], str, AnyStr]], - ]: - if anchor is None: - anchor = "lt" if direction == "ttb" else "la" - elif len(anchor) != 2: - msg = "anchor must be a 2 character string" - raise ValueError(msg) - elif anchor[1] in "tb" and direction != "ttb": - msg = "anchor not supported for multiline text" - raise ValueError(msg) - - if font is None: - font = self._getfont(font_size) - - lines = text.split("\n" if isinstance(text, str) else b"\n") - line_spacing = ( - self.textbbox((0, 0), "A", font, stroke_width=stroke_width)[3] - + stroke_width - + spacing - ) - - top = xy[1] - parts = [] - if direction == "ttb": - left = xy[0] - for line in lines: - parts.append(((left, top), anchor, line)) - left += line_spacing - else: - widths = [] - max_width: float = 0 - for line in lines: - line_width = self.textlength( - line, - font, - direction=direction, - features=features, - language=language, - embedded_color=embedded_color, - ) - widths.append(line_width) - max_width = max(max_width, line_width) - - if anchor[1] == "m": - top -= (len(lines) - 1) * line_spacing / 2.0 - elif anchor[1] == "d": - top -= (len(lines) - 1) * line_spacing - - for idx, line in enumerate(lines): - left = xy[0] - width_difference = max_width - widths[idx] - - # align by align parameter - if align in ("left", "justify"): - pass - elif align == "center": - left += width_difference / 2.0 - elif align == "right": - left += width_difference - else: - msg = 'align must be "left", "center", "right" or "justify"' - raise ValueError(msg) - - if ( - align == "justify" - and width_difference != 0 - and idx != len(lines) - 1 - ): - words = line.split(" " if isinstance(text, str) else b" ") - if len(words) > 1: - # align left by anchor - if anchor[0] == "m": - left -= max_width / 2.0 - elif anchor[0] == "r": - left -= max_width - - word_widths = [ - self.textlength( - word, - font, - direction=direction, - features=features, - language=language, - embedded_color=embedded_color, - ) - for word in words - ] - word_anchor = "l" + anchor[1] - width_difference = max_width - sum(word_widths) - for i, word in enumerate(words): - parts.append(((left, top), word_anchor, word)) - left += word_widths[i] + width_difference / (len(words) - 1) - top += line_spacing - continue - - # align left by anchor - if anchor[0] == "m": - left -= width_difference / 2.0 - elif anchor[0] == "r": - left -= width_difference - parts.append(((left, top), anchor, line)) - top += line_spacing - - return font, parts - - def multiline_text( - self, - xy: tuple[float, float], - text: AnyStr, - fill: _Ink | None = None, - font: ( - ImageFont.ImageFont - | ImageFont.FreeTypeFont - | ImageFont.TransposedFont - | None - ) = None, - anchor: str | None = None, - spacing: float = 4, - align: str = "left", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - stroke_width: float = 0, - stroke_fill: _Ink | None = None, - embedded_color: bool = False, - *, - font_size: float | None = None, - ) -> None: - font, lines = self._prepare_multiline_text( - xy, - text, - font, - anchor, - spacing, - align, - direction, - features, - language, - stroke_width, - embedded_color, - font_size, - ) - - for xy, anchor, line in lines: - self.text( - xy, - line, - fill, - font, - anchor, - direction=direction, - features=features, - language=language, - stroke_width=stroke_width, - stroke_fill=stroke_fill, - embedded_color=embedded_color, - ) - - def textlength( - self, - text: AnyStr, - font: ( - ImageFont.ImageFont - | ImageFont.FreeTypeFont - | ImageFont.TransposedFont - | None - ) = None, - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - embedded_color: bool = False, - *, - font_size: float | None = None, - ) -> float: - """Get the length of a given string, in pixels with 1/64 precision.""" - if self._multiline_check(text): - msg = "can't measure length of multiline text" - raise ValueError(msg) - if embedded_color and self.mode not in ("RGB", "RGBA"): - msg = "Embedded color supported only in RGB and RGBA modes" - raise ValueError(msg) - - if font is None: - font = self._getfont(font_size) - mode = "RGBA" if embedded_color else self.fontmode - return font.getlength(text, mode, direction, features, language) - - def textbbox( - self, - xy: tuple[float, float], - text: AnyStr, - font: ( - ImageFont.ImageFont - | ImageFont.FreeTypeFont - | ImageFont.TransposedFont - | None - ) = None, - anchor: str | None = None, - spacing: float = 4, - align: str = "left", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - stroke_width: float = 0, - embedded_color: bool = False, - *, - font_size: float | None = None, - ) -> tuple[float, float, float, float]: - """Get the bounding box of a given string, in pixels.""" - if embedded_color and self.mode not in ("RGB", "RGBA"): - msg = "Embedded color supported only in RGB and RGBA modes" - raise ValueError(msg) - - if font is None: - font = self._getfont(font_size) - - if self._multiline_check(text): - return self.multiline_textbbox( - xy, - text, - font, - anchor, - spacing, - align, - direction, - features, - language, - stroke_width, - embedded_color, - ) - - mode = "RGBA" if embedded_color else self.fontmode - bbox = font.getbbox( - text, mode, direction, features, language, stroke_width, anchor - ) - return bbox[0] + xy[0], bbox[1] + xy[1], bbox[2] + xy[0], bbox[3] + xy[1] - - def multiline_textbbox( - self, - xy: tuple[float, float], - text: AnyStr, - font: ( - ImageFont.ImageFont - | ImageFont.FreeTypeFont - | ImageFont.TransposedFont - | None - ) = None, - anchor: str | None = None, - spacing: float = 4, - align: str = "left", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - stroke_width: float = 0, - embedded_color: bool = False, - *, - font_size: float | None = None, - ) -> tuple[float, float, float, float]: - font, lines = self._prepare_multiline_text( - xy, - text, - font, - anchor, - spacing, - align, - direction, - features, - language, - stroke_width, - embedded_color, - font_size, - ) - - bbox: tuple[float, float, float, float] | None = None - - for xy, anchor, line in lines: - bbox_line = self.textbbox( - xy, - line, - font, - anchor, - direction=direction, - features=features, - language=language, - stroke_width=stroke_width, - embedded_color=embedded_color, - ) - if bbox is None: - bbox = bbox_line - else: - bbox = ( - min(bbox[0], bbox_line[0]), - min(bbox[1], bbox_line[1]), - max(bbox[2], bbox_line[2]), - max(bbox[3], bbox_line[3]), - ) - - if bbox is None: - return xy[0], xy[1], xy[0], xy[1] - return bbox - - -def Draw(im: Image.Image, mode: str | None = None) -> ImageDraw: - """ - A simple 2D drawing interface for PIL images. - - :param im: The image to draw in. - :param mode: Optional mode to use for color values. For RGB - images, this argument can be RGB or RGBA (to blend the - drawing into the image). For all other modes, this argument - must be the same as the image mode. If omitted, the mode - defaults to the mode of the image. - """ - try: - return getattr(im, "getdraw")(mode) - except AttributeError: - return ImageDraw(im, mode) - - -def getdraw( - im: Image.Image | None = None, hints: list[str] | None = None -) -> tuple[ImageDraw2.Draw | None, ModuleType]: - """ - :param im: The image to draw in. - :param hints: An optional list of hints. Deprecated. - :returns: A (drawing context, drawing resource factory) tuple. - """ - if hints is not None: - deprecate("'hints' parameter", 12) - from . import ImageDraw2 - - draw = ImageDraw2.Draw(im) if im is not None else None - return draw, ImageDraw2 - - -def floodfill( - image: Image.Image, - xy: tuple[int, int], - value: float | tuple[int, ...], - border: float | tuple[int, ...] | None = None, - thresh: float = 0, -) -> None: - """ - .. warning:: This method is experimental. - - Fills a bounded region with a given color. - - :param image: Target image. - :param xy: Seed position (a 2-item coordinate tuple). See - :ref:`coordinate-system`. - :param value: Fill color. - :param border: Optional border value. If given, the region consists of - pixels with a color different from the border color. If not given, - the region consists of pixels having the same color as the seed - pixel. - :param thresh: Optional threshold value which specifies a maximum - tolerable difference of a pixel value from the 'background' in - order for it to be replaced. Useful for filling regions of - non-homogeneous, but similar, colors. - """ - # based on an implementation by Eric S. Raymond - # amended by yo1995 @20180806 - pixel = image.load() - assert pixel is not None - x, y = xy - try: - background = pixel[x, y] - if _color_diff(value, background) <= thresh: - return # seed point already has fill color - pixel[x, y] = value - except (ValueError, IndexError): - return # seed point outside image - edge = {(x, y)} - # use a set to keep record of current and previous edge pixels - # to reduce memory consumption - full_edge = set() - while edge: - new_edge = set() - for x, y in edge: # 4 adjacent method - for s, t in ((x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)): - # If already processed, or if a coordinate is negative, skip - if (s, t) in full_edge or s < 0 or t < 0: - continue - try: - p = pixel[s, t] - except (ValueError, IndexError): - pass - else: - full_edge.add((s, t)) - if border is None: - fill = _color_diff(p, background) <= thresh - else: - fill = p not in (value, border) - if fill: - pixel[s, t] = value - new_edge.add((s, t)) - full_edge = edge # discard pixels processed - edge = new_edge - - -def _compute_regular_polygon_vertices( - bounding_circle: Sequence[Sequence[float] | float], n_sides: int, rotation: float -) -> list[tuple[float, float]]: - """ - Generate a list of vertices for a 2D regular polygon. - - :param bounding_circle: The bounding circle is a sequence defined - by a point and radius. The polygon is inscribed in this circle. - (e.g. ``bounding_circle=(x, y, r)`` or ``((x, y), r)``) - :param n_sides: Number of sides - (e.g. ``n_sides=3`` for a triangle, ``6`` for a hexagon) - :param rotation: Apply an arbitrary rotation to the polygon - (e.g. ``rotation=90``, applies a 90 degree rotation) - :return: List of regular polygon vertices - (e.g. ``[(25, 50), (50, 50), (50, 25), (25, 25)]``) - - How are the vertices computed? - 1. Compute the following variables - - theta: Angle between the apothem & the nearest polygon vertex - - side_length: Length of each polygon edge - - centroid: Center of bounding circle (1st, 2nd elements of bounding_circle) - - polygon_radius: Polygon radius (last element of bounding_circle) - - angles: Location of each polygon vertex in polar grid - (e.g. A square with 0 degree rotation => [225.0, 315.0, 45.0, 135.0]) - - 2. For each angle in angles, get the polygon vertex at that angle - The vertex is computed using the equation below. - X= xcos(φ) + ysin(φ) - Y= −xsin(φ) + ycos(φ) - - Note: - φ = angle in degrees - x = 0 - y = polygon_radius - - The formula above assumes rotation around the origin. - In our case, we are rotating around the centroid. - To account for this, we use the formula below - X = xcos(φ) + ysin(φ) + centroid_x - Y = −xsin(φ) + ycos(φ) + centroid_y - """ - # 1. Error Handling - # 1.1 Check `n_sides` has an appropriate value - if not isinstance(n_sides, int): - msg = "n_sides should be an int" # type: ignore[unreachable] - raise TypeError(msg) - if n_sides < 3: - msg = "n_sides should be an int > 2" - raise ValueError(msg) - - # 1.2 Check `bounding_circle` has an appropriate value - if not isinstance(bounding_circle, (list, tuple)): - msg = "bounding_circle should be a sequence" - raise TypeError(msg) - - if len(bounding_circle) == 3: - if not all(isinstance(i, (int, float)) for i in bounding_circle): - msg = "bounding_circle should only contain numeric data" - raise ValueError(msg) - - *centroid, polygon_radius = cast(list[float], list(bounding_circle)) - elif len(bounding_circle) == 2 and isinstance(bounding_circle[0], (list, tuple)): - if not all( - isinstance(i, (int, float)) for i in bounding_circle[0] - ) or not isinstance(bounding_circle[1], (int, float)): - msg = "bounding_circle should only contain numeric data" - raise ValueError(msg) - - if len(bounding_circle[0]) != 2: - msg = "bounding_circle centre should contain 2D coordinates (e.g. (x, y))" - raise ValueError(msg) - - centroid = cast(list[float], list(bounding_circle[0])) - polygon_radius = cast(float, bounding_circle[1]) - else: - msg = ( - "bounding_circle should contain 2D coordinates " - "and a radius (e.g. (x, y, r) or ((x, y), r) )" - ) - raise ValueError(msg) - - if polygon_radius <= 0: - msg = "bounding_circle radius should be > 0" - raise ValueError(msg) - - # 1.3 Check `rotation` has an appropriate value - if not isinstance(rotation, (int, float)): - msg = "rotation should be an int or float" # type: ignore[unreachable] - raise ValueError(msg) - - # 2. Define Helper Functions - def _apply_rotation(point: list[float], degrees: float) -> tuple[float, float]: - return ( - round( - point[0] * math.cos(math.radians(360 - degrees)) - - point[1] * math.sin(math.radians(360 - degrees)) - + centroid[0], - 2, - ), - round( - point[1] * math.cos(math.radians(360 - degrees)) - + point[0] * math.sin(math.radians(360 - degrees)) - + centroid[1], - 2, - ), - ) - - def _compute_polygon_vertex(angle: float) -> tuple[float, float]: - start_point = [polygon_radius, 0] - return _apply_rotation(start_point, angle) - - def _get_angles(n_sides: int, rotation: float) -> list[float]: - angles = [] - degrees = 360 / n_sides - # Start with the bottom left polygon vertex - current_angle = (270 - 0.5 * degrees) + rotation - for _ in range(n_sides): - angles.append(current_angle) - current_angle += degrees - if current_angle > 360: - current_angle -= 360 - return angles - - # 3. Variable Declarations - angles = _get_angles(n_sides, rotation) - - # 4. Compute Vertices - return [_compute_polygon_vertex(angle) for angle in angles] - - -def _color_diff( - color1: float | tuple[int, ...], color2: float | tuple[int, ...] -) -> float: - """ - Uses 1-norm distance to calculate difference between two values. - """ - first = color1 if isinstance(color1, tuple) else (color1,) - second = color2 if isinstance(color2, tuple) else (color2,) - - return sum(abs(first[i] - second[i]) for i in range(len(second))) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageDraw2.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageDraw2.py deleted file mode 100644 index 3d68658..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageDraw2.py +++ /dev/null @@ -1,243 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# WCK-style drawing interface operations -# -# History: -# 2003-12-07 fl created -# 2005-05-15 fl updated; added to PIL as ImageDraw2 -# 2005-05-15 fl added text support -# 2005-05-20 fl added arc/chord/pieslice support -# -# Copyright (c) 2003-2005 by Secret Labs AB -# Copyright (c) 2003-2005 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# - - -""" -(Experimental) WCK-style drawing interface operations - -.. seealso:: :py:mod:`PIL.ImageDraw` -""" -from __future__ import annotations - -from typing import Any, AnyStr, BinaryIO - -from . import Image, ImageColor, ImageDraw, ImageFont, ImagePath -from ._typing import Coords, StrOrBytesPath - - -class Pen: - """Stores an outline color and width.""" - - def __init__(self, color: str, width: int = 1, opacity: int = 255) -> None: - self.color = ImageColor.getrgb(color) - self.width = width - - -class Brush: - """Stores a fill color""" - - def __init__(self, color: str, opacity: int = 255) -> None: - self.color = ImageColor.getrgb(color) - - -class Font: - """Stores a TrueType font and color""" - - def __init__( - self, color: str, file: StrOrBytesPath | BinaryIO, size: float = 12 - ) -> None: - # FIXME: add support for bitmap fonts - self.color = ImageColor.getrgb(color) - self.font = ImageFont.truetype(file, size) - - -class Draw: - """ - (Experimental) WCK-style drawing interface - """ - - def __init__( - self, - image: Image.Image | str, - size: tuple[int, int] | list[int] | None = None, - color: float | tuple[float, ...] | str | None = None, - ) -> None: - if isinstance(image, str): - if size is None: - msg = "If image argument is mode string, size must be a list or tuple" - raise ValueError(msg) - image = Image.new(image, size, color) - self.draw = ImageDraw.Draw(image) - self.image = image - self.transform: tuple[float, float, float, float, float, float] | None = None - - def flush(self) -> Image.Image: - return self.image - - def render( - self, - op: str, - xy: Coords, - pen: Pen | Brush | None, - brush: Brush | Pen | None = None, - **kwargs: Any, - ) -> None: - # handle color arguments - outline = fill = None - width = 1 - if isinstance(pen, Pen): - outline = pen.color - width = pen.width - elif isinstance(brush, Pen): - outline = brush.color - width = brush.width - if isinstance(brush, Brush): - fill = brush.color - elif isinstance(pen, Brush): - fill = pen.color - # handle transformation - if self.transform: - path = ImagePath.Path(xy) - path.transform(self.transform) - xy = path - # render the item - if op in ("arc", "line"): - kwargs.setdefault("fill", outline) - else: - kwargs.setdefault("fill", fill) - kwargs.setdefault("outline", outline) - if op == "line": - kwargs.setdefault("width", width) - getattr(self.draw, op)(xy, **kwargs) - - def settransform(self, offset: tuple[float, float]) -> None: - """Sets a transformation offset.""" - (xoffset, yoffset) = offset - self.transform = (1, 0, xoffset, 0, 1, yoffset) - - def arc( - self, - xy: Coords, - pen: Pen | Brush | None, - start: float, - end: float, - *options: Any, - ) -> None: - """ - Draws an arc (a portion of a circle outline) between the start and end - angles, inside the given bounding box. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc` - """ - self.render("arc", xy, pen, *options, start=start, end=end) - - def chord( - self, - xy: Coords, - pen: Pen | Brush | None, - start: float, - end: float, - *options: Any, - ) -> None: - """ - Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points - with a straight line. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord` - """ - self.render("chord", xy, pen, *options, start=start, end=end) - - def ellipse(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: - """ - Draws an ellipse inside the given bounding box. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse` - """ - self.render("ellipse", xy, pen, *options) - - def line(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: - """ - Draws a line between the coordinates in the ``xy`` list. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line` - """ - self.render("line", xy, pen, *options) - - def pieslice( - self, - xy: Coords, - pen: Pen | Brush | None, - start: float, - end: float, - *options: Any, - ) -> None: - """ - Same as arc, but also draws straight lines between the end points and the - center of the bounding box. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice` - """ - self.render("pieslice", xy, pen, *options, start=start, end=end) - - def polygon(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: - """ - Draws a polygon. - - The polygon outline consists of straight lines between the given - coordinates, plus a straight line between the last and the first - coordinate. - - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon` - """ - self.render("polygon", xy, pen, *options) - - def rectangle(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: - """ - Draws a rectangle. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle` - """ - self.render("rectangle", xy, pen, *options) - - def text(self, xy: tuple[float, float], text: AnyStr, font: Font) -> None: - """ - Draws the string at the given position. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text` - """ - if self.transform: - path = ImagePath.Path(xy) - path.transform(self.transform) - xy = path - self.draw.text(xy, text, font=font.font, fill=font.color) - - def textbbox( - self, xy: tuple[float, float], text: AnyStr, font: Font - ) -> tuple[float, float, float, float]: - """ - Returns bounding box (in pixels) of given text. - - :return: ``(left, top, right, bottom)`` bounding box - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textbbox` - """ - if self.transform: - path = ImagePath.Path(xy) - path.transform(self.transform) - xy = path - return self.draw.textbbox(xy, text, font=font.font) - - def textlength(self, text: AnyStr, font: Font) -> float: - """ - Returns length (in pixels) of given text. - This is the amount by which following text should be offset. - - .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textlength` - """ - return self.draw.textlength(text, font=font.font) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageEnhance.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageEnhance.py deleted file mode 100644 index 0e7e6dd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageEnhance.py +++ /dev/null @@ -1,113 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# image enhancement classes -# -# For a background, see "Image Processing By Interpolation and -# Extrapolation", Paul Haeberli and Douglas Voorhies. Available -# at http://www.graficaobscura.com/interp/index.html -# -# History: -# 1996-03-23 fl Created -# 2009-06-16 fl Fixed mean calculation -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image, ImageFilter, ImageStat - - -class _Enhance: - image: Image.Image - degenerate: Image.Image - - def enhance(self, factor: float) -> Image.Image: - """ - Returns an enhanced image. - - :param factor: A floating point value controlling the enhancement. - Factor 1.0 always returns a copy of the original image, - lower factors mean less color (brightness, contrast, - etc), and higher values more. There are no restrictions - on this value. - :rtype: :py:class:`~PIL.Image.Image` - """ - return Image.blend(self.degenerate, self.image, factor) - - -class Color(_Enhance): - """Adjust image color balance. - - This class can be used to adjust the colour balance of an image, in - a manner similar to the controls on a colour TV set. An enhancement - factor of 0.0 gives a black and white image. A factor of 1.0 gives - the original image. - """ - - def __init__(self, image: Image.Image) -> None: - self.image = image - self.intermediate_mode = "L" - if "A" in image.getbands(): - self.intermediate_mode = "LA" - - if self.intermediate_mode != image.mode: - image = image.convert(self.intermediate_mode).convert(image.mode) - self.degenerate = image - - -class Contrast(_Enhance): - """Adjust image contrast. - - This class can be used to control the contrast of an image, similar - to the contrast control on a TV set. An enhancement factor of 0.0 - gives a solid gray image. A factor of 1.0 gives the original image. - """ - - def __init__(self, image: Image.Image) -> None: - self.image = image - if image.mode != "L": - image = image.convert("L") - mean = int(ImageStat.Stat(image).mean[0] + 0.5) - self.degenerate = Image.new("L", image.size, mean) - if self.degenerate.mode != self.image.mode: - self.degenerate = self.degenerate.convert(self.image.mode) - - if "A" in self.image.getbands(): - self.degenerate.putalpha(self.image.getchannel("A")) - - -class Brightness(_Enhance): - """Adjust image brightness. - - This class can be used to control the brightness of an image. An - enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the - original image. - """ - - def __init__(self, image: Image.Image) -> None: - self.image = image - self.degenerate = Image.new(image.mode, image.size, 0) - - if "A" in image.getbands(): - self.degenerate.putalpha(image.getchannel("A")) - - -class Sharpness(_Enhance): - """Adjust image sharpness. - - This class can be used to adjust the sharpness of an image. An - enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the - original image, and a factor of 2.0 gives a sharpened image. - """ - - def __init__(self, image: Image.Image) -> None: - self.image = image - self.degenerate = image.filter(ImageFilter.SMOOTH) - - if "A" in image.getbands(): - self.degenerate.putalpha(image.getchannel("A")) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageFile.py deleted file mode 100644 index bf556a2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageFile.py +++ /dev/null @@ -1,922 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# base class for image file handlers -# -# history: -# 1995-09-09 fl Created -# 1996-03-11 fl Fixed load mechanism. -# 1996-04-15 fl Added pcx/xbm decoders. -# 1996-04-30 fl Added encoders. -# 1996-12-14 fl Added load helpers -# 1997-01-11 fl Use encode_to_file where possible -# 1997-08-27 fl Flush output in _save -# 1998-03-05 fl Use memory mapping for some modes -# 1999-02-04 fl Use memory mapping also for "I;16" and "I;16B" -# 1999-05-31 fl Added image parser -# 2000-10-12 fl Set readonly flag on memory-mapped images -# 2002-03-20 fl Use better messages for common decoder errors -# 2003-04-21 fl Fall back on mmap/map_buffer if map is not available -# 2003-10-30 fl Added StubImageFile class -# 2004-02-25 fl Made incremental parser more robust -# -# Copyright (c) 1997-2004 by Secret Labs AB -# Copyright (c) 1995-2004 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import abc -import io -import itertools -import logging -import os -import struct -from typing import IO, Any, NamedTuple, cast - -from . import ExifTags, Image -from ._deprecate import deprecate -from ._util import DeferredError, is_path - -TYPE_CHECKING = False -if TYPE_CHECKING: - from ._typing import StrOrBytesPath - -logger = logging.getLogger(__name__) - -MAXBLOCK = 65536 - -SAFEBLOCK = 1024 * 1024 - -LOAD_TRUNCATED_IMAGES = False -"""Whether or not to load truncated image files. User code may change this.""" - -ERRORS = { - -1: "image buffer overrun error", - -2: "decoding error", - -3: "unknown error", - -8: "bad configuration", - -9: "out of memory error", -} -""" -Dict of known error codes returned from :meth:`.PyDecoder.decode`, -:meth:`.PyEncoder.encode` :meth:`.PyEncoder.encode_to_pyfd` and -:meth:`.PyEncoder.encode_to_file`. -""" - - -# -# -------------------------------------------------------------------- -# Helpers - - -def _get_oserror(error: int, *, encoder: bool) -> OSError: - try: - msg = Image.core.getcodecstatus(error) - except AttributeError: - msg = ERRORS.get(error) - if not msg: - msg = f"{'encoder' if encoder else 'decoder'} error {error}" - msg += f" when {'writing' if encoder else 'reading'} image file" - return OSError(msg) - - -def raise_oserror(error: int) -> OSError: - deprecate( - "raise_oserror", - 12, - action="It is only useful for translating error codes returned by a codec's " - "decode() method, which ImageFile already does automatically.", - ) - raise _get_oserror(error, encoder=False) - - -def _tilesort(t: _Tile) -> int: - # sort on offset - return t[2] - - -class _Tile(NamedTuple): - codec_name: str - extents: tuple[int, int, int, int] | None - offset: int = 0 - args: tuple[Any, ...] | str | None = None - - -# -# -------------------------------------------------------------------- -# ImageFile base class - - -class ImageFile(Image.Image): - """Base class for image file format handlers.""" - - def __init__( - self, fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None - ) -> None: - super().__init__() - - self._min_frame = 0 - - self.custom_mimetype: str | None = None - - self.tile: list[_Tile] = [] - """ A list of tile descriptors """ - - self.readonly = 1 # until we know better - - self.decoderconfig: tuple[Any, ...] = () - self.decodermaxblock = MAXBLOCK - - if is_path(fp): - # filename - self.fp = open(fp, "rb") - self.filename = os.fspath(fp) - self._exclusive_fp = True - else: - # stream - self.fp = cast(IO[bytes], fp) - self.filename = filename if filename is not None else "" - # can be overridden - self._exclusive_fp = False - - try: - try: - self._open() - except ( - IndexError, # end of data - TypeError, # end of data (ord) - KeyError, # unsupported mode - EOFError, # got header but not the first frame - struct.error, - ) as v: - raise SyntaxError(v) from v - - if not self.mode or self.size[0] <= 0 or self.size[1] <= 0: - msg = "not identified by this driver" - raise SyntaxError(msg) - except BaseException: - # close the file only if we have opened it this constructor - if self._exclusive_fp: - self.fp.close() - raise - - def _open(self) -> None: - pass - - def _close_fp(self): - if getattr(self, "_fp", False) and not isinstance(self._fp, DeferredError): - if self._fp != self.fp: - self._fp.close() - self._fp = DeferredError(ValueError("Operation on closed image")) - if self.fp: - self.fp.close() - - def close(self) -> None: - """ - Closes the file pointer, if possible. - - This operation will destroy the image core and release its memory. - The image data will be unusable afterward. - - This function is required to close images that have multiple frames or - have not had their file read and closed by the - :py:meth:`~PIL.Image.Image.load` method. See :ref:`file-handling` for - more information. - """ - try: - self._close_fp() - self.fp = None - except Exception as msg: - logger.debug("Error closing: %s", msg) - - super().close() - - def get_child_images(self) -> list[ImageFile]: - child_images = [] - exif = self.getexif() - ifds = [] - if ExifTags.Base.SubIFDs in exif: - subifd_offsets = exif[ExifTags.Base.SubIFDs] - if subifd_offsets: - if not isinstance(subifd_offsets, tuple): - subifd_offsets = (subifd_offsets,) - for subifd_offset in subifd_offsets: - ifds.append((exif._get_ifd_dict(subifd_offset), subifd_offset)) - ifd1 = exif.get_ifd(ExifTags.IFD.IFD1) - if ifd1 and ifd1.get(ExifTags.Base.JpegIFOffset): - assert exif._info is not None - ifds.append((ifd1, exif._info.next)) - - offset = None - for ifd, ifd_offset in ifds: - assert self.fp is not None - current_offset = self.fp.tell() - if offset is None: - offset = current_offset - - fp = self.fp - if ifd is not None: - thumbnail_offset = ifd.get(ExifTags.Base.JpegIFOffset) - if thumbnail_offset is not None: - thumbnail_offset += getattr(self, "_exif_offset", 0) - self.fp.seek(thumbnail_offset) - - length = ifd.get(ExifTags.Base.JpegIFByteCount) - assert isinstance(length, int) - data = self.fp.read(length) - fp = io.BytesIO(data) - - with Image.open(fp) as im: - from . import TiffImagePlugin - - if thumbnail_offset is None and isinstance( - im, TiffImagePlugin.TiffImageFile - ): - im._frame_pos = [ifd_offset] - im._seek(0) - im.load() - child_images.append(im) - - if offset is not None: - assert self.fp is not None - self.fp.seek(offset) - return child_images - - def get_format_mimetype(self) -> str | None: - if self.custom_mimetype: - return self.custom_mimetype - if self.format is not None: - return Image.MIME.get(self.format.upper()) - return None - - def __getstate__(self) -> list[Any]: - return super().__getstate__() + [self.filename] - - def __setstate__(self, state: list[Any]) -> None: - self.tile = [] - if len(state) > 5: - self.filename = state[5] - super().__setstate__(state) - - def verify(self) -> None: - """Check file integrity""" - - # raise exception if something's wrong. must be called - # directly after open, and closes file when finished. - if self._exclusive_fp: - self.fp.close() - self.fp = None - - def load(self) -> Image.core.PixelAccess | None: - """Load image data based on tile list""" - - if not self.tile and self._im is None: - msg = "cannot load this image" - raise OSError(msg) - - pixel = Image.Image.load(self) - if not self.tile: - return pixel - - self.map: mmap.mmap | None = None - use_mmap = self.filename and len(self.tile) == 1 - - readonly = 0 - - # look for read/seek overrides - if hasattr(self, "load_read"): - read = self.load_read - # don't use mmap if there are custom read/seek functions - use_mmap = False - else: - read = self.fp.read - - if hasattr(self, "load_seek"): - seek = self.load_seek - use_mmap = False - else: - seek = self.fp.seek - - if use_mmap: - # try memory mapping - decoder_name, extents, offset, args = self.tile[0] - if isinstance(args, str): - args = (args, 0, 1) - if ( - decoder_name == "raw" - and isinstance(args, tuple) - and len(args) >= 3 - and args[0] == self.mode - and args[0] in Image._MAPMODES - ): - try: - # use mmap, if possible - import mmap - - with open(self.filename) as fp: - self.map = mmap.mmap(fp.fileno(), 0, access=mmap.ACCESS_READ) - if offset + self.size[1] * args[1] > self.map.size(): - msg = "buffer is not large enough" - raise OSError(msg) - self.im = Image.core.map_buffer( - self.map, self.size, decoder_name, offset, args - ) - readonly = 1 - # After trashing self.im, - # we might need to reload the palette data. - if self.palette: - self.palette.dirty = 1 - except (AttributeError, OSError, ImportError): - self.map = None - - self.load_prepare() - err_code = -3 # initialize to unknown error - if not self.map: - # sort tiles in file order - self.tile.sort(key=_tilesort) - - # FIXME: This is a hack to handle TIFF's JpegTables tag. - prefix = getattr(self, "tile_prefix", b"") - - # Remove consecutive duplicates that only differ by their offset - self.tile = [ - list(tiles)[-1] - for _, tiles in itertools.groupby( - self.tile, lambda tile: (tile[0], tile[1], tile[3]) - ) - ] - for i, (decoder_name, extents, offset, args) in enumerate(self.tile): - seek(offset) - decoder = Image._getdecoder( - self.mode, decoder_name, args, self.decoderconfig - ) - try: - decoder.setimage(self.im, extents) - if decoder.pulls_fd: - decoder.setfd(self.fp) - err_code = decoder.decode(b"")[1] - else: - b = prefix - while True: - read_bytes = self.decodermaxblock - if i + 1 < len(self.tile): - next_offset = self.tile[i + 1].offset - if next_offset > offset: - read_bytes = next_offset - offset - try: - s = read(read_bytes) - except (IndexError, struct.error) as e: - # truncated png/gif - if LOAD_TRUNCATED_IMAGES: - break - else: - msg = "image file is truncated" - raise OSError(msg) from e - - if not s: # truncated jpeg - if LOAD_TRUNCATED_IMAGES: - break - else: - msg = ( - "image file is truncated " - f"({len(b)} bytes not processed)" - ) - raise OSError(msg) - - b = b + s - n, err_code = decoder.decode(b) - if n < 0: - break - b = b[n:] - finally: - # Need to cleanup here to prevent leaks - decoder.cleanup() - - self.tile = [] - self.readonly = readonly - - self.load_end() - - if self._exclusive_fp and self._close_exclusive_fp_after_loading: - self.fp.close() - self.fp = None - - if not self.map and not LOAD_TRUNCATED_IMAGES and err_code < 0: - # still raised if decoder fails to return anything - raise _get_oserror(err_code, encoder=False) - - return Image.Image.load(self) - - def load_prepare(self) -> None: - # create image memory if necessary - if self._im is None: - self.im = Image.core.new(self.mode, self.size) - # create palette (optional) - if self.mode == "P": - Image.Image.load(self) - - def load_end(self) -> None: - # may be overridden - pass - - # may be defined for contained formats - # def load_seek(self, pos: int) -> None: - # pass - - # may be defined for blocked formats (e.g. PNG) - # def load_read(self, read_bytes: int) -> bytes: - # pass - - def _seek_check(self, frame: int) -> bool: - if ( - frame < self._min_frame - # Only check upper limit on frames if additional seek operations - # are not required to do so - or ( - not (hasattr(self, "_n_frames") and self._n_frames is None) - and frame >= getattr(self, "n_frames") + self._min_frame - ) - ): - msg = "attempt to seek outside sequence" - raise EOFError(msg) - - return self.tell() != frame - - -class StubHandler(abc.ABC): - def open(self, im: StubImageFile) -> None: - pass - - @abc.abstractmethod - def load(self, im: StubImageFile) -> Image.Image: - pass - - -class StubImageFile(ImageFile, metaclass=abc.ABCMeta): - """ - Base class for stub image loaders. - - A stub loader is an image loader that can identify files of a - certain format, but relies on external code to load the file. - """ - - @abc.abstractmethod - def _open(self) -> None: - pass - - def load(self) -> Image.core.PixelAccess | None: - loader = self._load() - if loader is None: - msg = f"cannot find loader for this {self.format} file" - raise OSError(msg) - image = loader.load(self) - assert image is not None - # become the other object (!) - self.__class__ = image.__class__ # type: ignore[assignment] - self.__dict__ = image.__dict__ - return image.load() - - @abc.abstractmethod - def _load(self) -> StubHandler | None: - """(Hook) Find actual image loader.""" - pass - - -class Parser: - """ - Incremental image parser. This class implements the standard - feed/close consumer interface. - """ - - incremental = None - image: Image.Image | None = None - data: bytes | None = None - decoder: Image.core.ImagingDecoder | PyDecoder | None = None - offset = 0 - finished = 0 - - def reset(self) -> None: - """ - (Consumer) Reset the parser. Note that you can only call this - method immediately after you've created a parser; parser - instances cannot be reused. - """ - assert self.data is None, "cannot reuse parsers" - - def feed(self, data: bytes) -> None: - """ - (Consumer) Feed data to the parser. - - :param data: A string buffer. - :exception OSError: If the parser failed to parse the image file. - """ - # collect data - - if self.finished: - return - - if self.data is None: - self.data = data - else: - self.data = self.data + data - - # parse what we have - if self.decoder: - if self.offset > 0: - # skip header - skip = min(len(self.data), self.offset) - self.data = self.data[skip:] - self.offset = self.offset - skip - if self.offset > 0 or not self.data: - return - - n, e = self.decoder.decode(self.data) - - if n < 0: - # end of stream - self.data = None - self.finished = 1 - if e < 0: - # decoding error - self.image = None - raise _get_oserror(e, encoder=False) - else: - # end of image - return - self.data = self.data[n:] - - elif self.image: - # if we end up here with no decoder, this file cannot - # be incrementally parsed. wait until we've gotten all - # available data - pass - - else: - # attempt to open this file - try: - with io.BytesIO(self.data) as fp: - im = Image.open(fp) - except OSError: - pass # not enough data - else: - flag = hasattr(im, "load_seek") or hasattr(im, "load_read") - if flag or len(im.tile) != 1: - # custom load code, or multiple tiles - self.decode = None - else: - # initialize decoder - im.load_prepare() - d, e, o, a = im.tile[0] - im.tile = [] - self.decoder = Image._getdecoder(im.mode, d, a, im.decoderconfig) - self.decoder.setimage(im.im, e) - - # calculate decoder offset - self.offset = o - if self.offset <= len(self.data): - self.data = self.data[self.offset :] - self.offset = 0 - - self.image = im - - def __enter__(self) -> Parser: - return self - - def __exit__(self, *args: object) -> None: - self.close() - - def close(self) -> Image.Image: - """ - (Consumer) Close the stream. - - :returns: An image object. - :exception OSError: If the parser failed to parse the image file either - because it cannot be identified or cannot be - decoded. - """ - # finish decoding - if self.decoder: - # get rid of what's left in the buffers - self.feed(b"") - self.data = self.decoder = None - if not self.finished: - msg = "image was incomplete" - raise OSError(msg) - if not self.image: - msg = "cannot parse this image" - raise OSError(msg) - if self.data: - # incremental parsing not possible; reopen the file - # not that we have all data - with io.BytesIO(self.data) as fp: - try: - self.image = Image.open(fp) - finally: - self.image.load() - return self.image - - -# -------------------------------------------------------------------- - - -def _save(im: Image.Image, fp: IO[bytes], tile: list[_Tile], bufsize: int = 0) -> None: - """Helper to save image based on tile list - - :param im: Image object. - :param fp: File object. - :param tile: Tile list. - :param bufsize: Optional buffer size - """ - - im.load() - if not hasattr(im, "encoderconfig"): - im.encoderconfig = () - tile.sort(key=_tilesort) - # FIXME: make MAXBLOCK a configuration parameter - # It would be great if we could have the encoder specify what it needs - # But, it would need at least the image size in most cases. RawEncode is - # a tricky case. - bufsize = max(MAXBLOCK, bufsize, im.size[0] * 4) # see RawEncode.c - try: - fh = fp.fileno() - fp.flush() - _encode_tile(im, fp, tile, bufsize, fh) - except (AttributeError, io.UnsupportedOperation) as exc: - _encode_tile(im, fp, tile, bufsize, None, exc) - if hasattr(fp, "flush"): - fp.flush() - - -def _encode_tile( - im: Image.Image, - fp: IO[bytes], - tile: list[_Tile], - bufsize: int, - fh: int | None, - exc: BaseException | None = None, -) -> None: - for encoder_name, extents, offset, args in tile: - if offset > 0: - fp.seek(offset) - encoder = Image._getencoder(im.mode, encoder_name, args, im.encoderconfig) - try: - encoder.setimage(im.im, extents) - if encoder.pushes_fd: - encoder.setfd(fp) - errcode = encoder.encode_to_pyfd()[1] - else: - if exc: - # compress to Python file-compatible object - while True: - errcode, data = encoder.encode(bufsize)[1:] - fp.write(data) - if errcode: - break - else: - # slight speedup: compress to real file object - assert fh is not None - errcode = encoder.encode_to_file(fh, bufsize) - if errcode < 0: - raise _get_oserror(errcode, encoder=True) from exc - finally: - encoder.cleanup() - - -def _safe_read(fp: IO[bytes], size: int) -> bytes: - """ - Reads large blocks in a safe way. Unlike fp.read(n), this function - doesn't trust the user. If the requested size is larger than - SAFEBLOCK, the file is read block by block. - - :param fp: File handle. Must implement a read method. - :param size: Number of bytes to read. - :returns: A string containing size bytes of data. - - Raises an OSError if the file is truncated and the read cannot be completed - - """ - if size <= 0: - return b"" - if size <= SAFEBLOCK: - data = fp.read(size) - if len(data) < size: - msg = "Truncated File Read" - raise OSError(msg) - return data - blocks: list[bytes] = [] - remaining_size = size - while remaining_size > 0: - block = fp.read(min(remaining_size, SAFEBLOCK)) - if not block: - break - blocks.append(block) - remaining_size -= len(block) - if sum(len(block) for block in blocks) < size: - msg = "Truncated File Read" - raise OSError(msg) - return b"".join(blocks) - - -class PyCodecState: - def __init__(self) -> None: - self.xsize = 0 - self.ysize = 0 - self.xoff = 0 - self.yoff = 0 - - def extents(self) -> tuple[int, int, int, int]: - return self.xoff, self.yoff, self.xoff + self.xsize, self.yoff + self.ysize - - -class PyCodec: - fd: IO[bytes] | None - - def __init__(self, mode: str, *args: Any) -> None: - self.im: Image.core.ImagingCore | None = None - self.state = PyCodecState() - self.fd = None - self.mode = mode - self.init(args) - - def init(self, args: tuple[Any, ...]) -> None: - """ - Override to perform codec specific initialization - - :param args: Tuple of arg items from the tile entry - :returns: None - """ - self.args = args - - def cleanup(self) -> None: - """ - Override to perform codec specific cleanup - - :returns: None - """ - pass - - def setfd(self, fd: IO[bytes]) -> None: - """ - Called from ImageFile to set the Python file-like object - - :param fd: A Python file-like object - :returns: None - """ - self.fd = fd - - def setimage( - self, - im: Image.core.ImagingCore, - extents: tuple[int, int, int, int] | None = None, - ) -> None: - """ - Called from ImageFile to set the core output image for the codec - - :param im: A core image object - :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle - for this tile - :returns: None - """ - - # following c code - self.im = im - - if extents: - (x0, y0, x1, y1) = extents - else: - (x0, y0, x1, y1) = (0, 0, 0, 0) - - if x0 == 0 and x1 == 0: - self.state.xsize, self.state.ysize = self.im.size - else: - self.state.xoff = x0 - self.state.yoff = y0 - self.state.xsize = x1 - x0 - self.state.ysize = y1 - y0 - - if self.state.xsize <= 0 or self.state.ysize <= 0: - msg = "Size cannot be negative" - raise ValueError(msg) - - if ( - self.state.xsize + self.state.xoff > self.im.size[0] - or self.state.ysize + self.state.yoff > self.im.size[1] - ): - msg = "Tile cannot extend outside image" - raise ValueError(msg) - - -class PyDecoder(PyCodec): - """ - Python implementation of a format decoder. Override this class and - add the decoding logic in the :meth:`decode` method. - - See :ref:`Writing Your Own File Codec in Python` - """ - - _pulls_fd = False - - @property - def pulls_fd(self) -> bool: - return self._pulls_fd - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - """ - Override to perform the decoding process. - - :param buffer: A bytes object with the data to be decoded. - :returns: A tuple of ``(bytes consumed, errcode)``. - If finished with decoding return -1 for the bytes consumed. - Err codes are from :data:`.ImageFile.ERRORS`. - """ - msg = "unavailable in base decoder" - raise NotImplementedError(msg) - - def set_as_raw( - self, data: bytes, rawmode: str | None = None, extra: tuple[Any, ...] = () - ) -> None: - """ - Convenience method to set the internal image from a stream of raw data - - :param data: Bytes to be set - :param rawmode: The rawmode to be used for the decoder. - If not specified, it will default to the mode of the image - :param extra: Extra arguments for the decoder. - :returns: None - """ - - if not rawmode: - rawmode = self.mode - d = Image._getdecoder(self.mode, "raw", rawmode, extra) - assert self.im is not None - d.setimage(self.im, self.state.extents()) - s = d.decode(data) - - if s[0] >= 0: - msg = "not enough image data" - raise ValueError(msg) - if s[1] != 0: - msg = "cannot decode image data" - raise ValueError(msg) - - -class PyEncoder(PyCodec): - """ - Python implementation of a format encoder. Override this class and - add the decoding logic in the :meth:`encode` method. - - See :ref:`Writing Your Own File Codec in Python` - """ - - _pushes_fd = False - - @property - def pushes_fd(self) -> bool: - return self._pushes_fd - - def encode(self, bufsize: int) -> tuple[int, int, bytes]: - """ - Override to perform the encoding process. - - :param bufsize: Buffer size. - :returns: A tuple of ``(bytes encoded, errcode, bytes)``. - If finished with encoding return 1 for the error code. - Err codes are from :data:`.ImageFile.ERRORS`. - """ - msg = "unavailable in base encoder" - raise NotImplementedError(msg) - - def encode_to_pyfd(self) -> tuple[int, int]: - """ - If ``pushes_fd`` is ``True``, then this method will be used, - and ``encode()`` will only be called once. - - :returns: A tuple of ``(bytes consumed, errcode)``. - Err codes are from :data:`.ImageFile.ERRORS`. - """ - if not self.pushes_fd: - return 0, -8 # bad configuration - bytes_consumed, errcode, data = self.encode(0) - if data: - assert self.fd is not None - self.fd.write(data) - return bytes_consumed, errcode - - def encode_to_file(self, fh: int, bufsize: int) -> int: - """ - :param fh: File handle. - :param bufsize: Buffer size. - - :returns: If finished successfully, return 0. - Otherwise, return an error code. Err codes are from - :data:`.ImageFile.ERRORS`. - """ - errcode = 0 - while errcode == 0: - status, errcode, buf = self.encode(bufsize) - if status > 0: - os.write(fh, buf[status:]) - return errcode diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageFilter.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageFilter.py deleted file mode 100644 index b9ed54a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageFilter.py +++ /dev/null @@ -1,604 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# standard filters -# -# History: -# 1995-11-27 fl Created -# 2002-06-08 fl Added rank and mode filters -# 2003-09-15 fl Fixed rank calculation in rank filter; added expand call -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1995-2002 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import abc -import functools -from collections.abc import Sequence -from types import ModuleType -from typing import Any, Callable, cast - -TYPE_CHECKING = False -if TYPE_CHECKING: - from . import _imaging - from ._typing import NumpyArray - - -class Filter(abc.ABC): - @abc.abstractmethod - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - pass - - -class MultibandFilter(Filter): - pass - - -class BuiltinFilter(MultibandFilter): - filterargs: tuple[Any, ...] - - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - if image.mode == "P": - msg = "cannot filter palette images" - raise ValueError(msg) - return image.filter(*self.filterargs) - - -class Kernel(BuiltinFilter): - """ - Create a convolution kernel. This only supports 3x3 and 5x5 integer and floating - point kernels. - - Kernels can only be applied to "L" and "RGB" images. - - :param size: Kernel size, given as (width, height). This must be (3,3) or (5,5). - :param kernel: A sequence containing kernel weights. The kernel will be flipped - vertically before being applied to the image. - :param scale: Scale factor. If given, the result for each pixel is divided by this - value. The default is the sum of the kernel weights. - :param offset: Offset. If given, this value is added to the result, after it has - been divided by the scale factor. - """ - - name = "Kernel" - - def __init__( - self, - size: tuple[int, int], - kernel: Sequence[float], - scale: float | None = None, - offset: float = 0, - ) -> None: - if scale is None: - # default scale is sum of kernel - scale = functools.reduce(lambda a, b: a + b, kernel) - if size[0] * size[1] != len(kernel): - msg = "not enough coefficients in kernel" - raise ValueError(msg) - self.filterargs = size, scale, offset, kernel - - -class RankFilter(Filter): - """ - Create a rank filter. The rank filter sorts all pixels in - a window of the given size, and returns the ``rank``'th value. - - :param size: The kernel size, in pixels. - :param rank: What pixel value to pick. Use 0 for a min filter, - ``size * size / 2`` for a median filter, ``size * size - 1`` - for a max filter, etc. - """ - - name = "Rank" - - def __init__(self, size: int, rank: int) -> None: - self.size = size - self.rank = rank - - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - if image.mode == "P": - msg = "cannot filter palette images" - raise ValueError(msg) - image = image.expand(self.size // 2, self.size // 2) - return image.rankfilter(self.size, self.rank) - - -class MedianFilter(RankFilter): - """ - Create a median filter. Picks the median pixel value in a window with the - given size. - - :param size: The kernel size, in pixels. - """ - - name = "Median" - - def __init__(self, size: int = 3) -> None: - self.size = size - self.rank = size * size // 2 - - -class MinFilter(RankFilter): - """ - Create a min filter. Picks the lowest pixel value in a window with the - given size. - - :param size: The kernel size, in pixels. - """ - - name = "Min" - - def __init__(self, size: int = 3) -> None: - self.size = size - self.rank = 0 - - -class MaxFilter(RankFilter): - """ - Create a max filter. Picks the largest pixel value in a window with the - given size. - - :param size: The kernel size, in pixels. - """ - - name = "Max" - - def __init__(self, size: int = 3) -> None: - self.size = size - self.rank = size * size - 1 - - -class ModeFilter(Filter): - """ - Create a mode filter. Picks the most frequent pixel value in a box with the - given size. Pixel values that occur only once or twice are ignored; if no - pixel value occurs more than twice, the original pixel value is preserved. - - :param size: The kernel size, in pixels. - """ - - name = "Mode" - - def __init__(self, size: int = 3) -> None: - self.size = size - - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - return image.modefilter(self.size) - - -class GaussianBlur(MultibandFilter): - """Blurs the image with a sequence of extended box filters, which - approximates a Gaussian kernel. For details on accuracy see - - - :param radius: Standard deviation of the Gaussian kernel. Either a sequence of two - numbers for x and y, or a single number for both. - """ - - name = "GaussianBlur" - - def __init__(self, radius: float | Sequence[float] = 2) -> None: - self.radius = radius - - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - xy = self.radius - if isinstance(xy, (int, float)): - xy = (xy, xy) - if xy == (0, 0): - return image.copy() - return image.gaussian_blur(xy) - - -class BoxBlur(MultibandFilter): - """Blurs the image by setting each pixel to the average value of the pixels - in a square box extending radius pixels in each direction. - Supports float radius of arbitrary size. Uses an optimized implementation - which runs in linear time relative to the size of the image - for any radius value. - - :param radius: Size of the box in a direction. Either a sequence of two numbers for - x and y, or a single number for both. - - Radius 0 does not blur, returns an identical image. - Radius 1 takes 1 pixel in each direction, i.e. 9 pixels in total. - """ - - name = "BoxBlur" - - def __init__(self, radius: float | Sequence[float]) -> None: - xy = radius if isinstance(radius, (tuple, list)) else (radius, radius) - if xy[0] < 0 or xy[1] < 0: - msg = "radius must be >= 0" - raise ValueError(msg) - self.radius = radius - - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - xy = self.radius - if isinstance(xy, (int, float)): - xy = (xy, xy) - if xy == (0, 0): - return image.copy() - return image.box_blur(xy) - - -class UnsharpMask(MultibandFilter): - """Unsharp mask filter. - - See Wikipedia's entry on `digital unsharp masking`_ for an explanation of - the parameters. - - :param radius: Blur Radius - :param percent: Unsharp strength, in percent - :param threshold: Threshold controls the minimum brightness change that - will be sharpened - - .. _digital unsharp masking: https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking - - """ - - name = "UnsharpMask" - - def __init__( - self, radius: float = 2, percent: int = 150, threshold: int = 3 - ) -> None: - self.radius = radius - self.percent = percent - self.threshold = threshold - - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - return image.unsharp_mask(self.radius, self.percent, self.threshold) - - -class BLUR(BuiltinFilter): - name = "Blur" - # fmt: off - filterargs = (5, 5), 16, 0, ( - 1, 1, 1, 1, 1, - 1, 0, 0, 0, 1, - 1, 0, 0, 0, 1, - 1, 0, 0, 0, 1, - 1, 1, 1, 1, 1, - ) - # fmt: on - - -class CONTOUR(BuiltinFilter): - name = "Contour" - # fmt: off - filterargs = (3, 3), 1, 255, ( - -1, -1, -1, - -1, 8, -1, - -1, -1, -1, - ) - # fmt: on - - -class DETAIL(BuiltinFilter): - name = "Detail" - # fmt: off - filterargs = (3, 3), 6, 0, ( - 0, -1, 0, - -1, 10, -1, - 0, -1, 0, - ) - # fmt: on - - -class EDGE_ENHANCE(BuiltinFilter): - name = "Edge-enhance" - # fmt: off - filterargs = (3, 3), 2, 0, ( - -1, -1, -1, - -1, 10, -1, - -1, -1, -1, - ) - # fmt: on - - -class EDGE_ENHANCE_MORE(BuiltinFilter): - name = "Edge-enhance More" - # fmt: off - filterargs = (3, 3), 1, 0, ( - -1, -1, -1, - -1, 9, -1, - -1, -1, -1, - ) - # fmt: on - - -class EMBOSS(BuiltinFilter): - name = "Emboss" - # fmt: off - filterargs = (3, 3), 1, 128, ( - -1, 0, 0, - 0, 1, 0, - 0, 0, 0, - ) - # fmt: on - - -class FIND_EDGES(BuiltinFilter): - name = "Find Edges" - # fmt: off - filterargs = (3, 3), 1, 0, ( - -1, -1, -1, - -1, 8, -1, - -1, -1, -1, - ) - # fmt: on - - -class SHARPEN(BuiltinFilter): - name = "Sharpen" - # fmt: off - filterargs = (3, 3), 16, 0, ( - -2, -2, -2, - -2, 32, -2, - -2, -2, -2, - ) - # fmt: on - - -class SMOOTH(BuiltinFilter): - name = "Smooth" - # fmt: off - filterargs = (3, 3), 13, 0, ( - 1, 1, 1, - 1, 5, 1, - 1, 1, 1, - ) - # fmt: on - - -class SMOOTH_MORE(BuiltinFilter): - name = "Smooth More" - # fmt: off - filterargs = (5, 5), 100, 0, ( - 1, 1, 1, 1, 1, - 1, 5, 5, 5, 1, - 1, 5, 44, 5, 1, - 1, 5, 5, 5, 1, - 1, 1, 1, 1, 1, - ) - # fmt: on - - -class Color3DLUT(MultibandFilter): - """Three-dimensional color lookup table. - - Transforms 3-channel pixels using the values of the channels as coordinates - in the 3D lookup table and interpolating the nearest elements. - - This method allows you to apply almost any color transformation - in constant time by using pre-calculated decimated tables. - - .. versionadded:: 5.2.0 - - :param size: Size of the table. One int or tuple of (int, int, int). - Minimal size in any dimension is 2, maximum is 65. - :param table: Flat lookup table. A list of ``channels * size**3`` - float elements or a list of ``size**3`` channels-sized - tuples with floats. Channels are changed first, - then first dimension, then second, then third. - Value 0.0 corresponds lowest value of output, 1.0 highest. - :param channels: Number of channels in the table. Could be 3 or 4. - Default is 3. - :param target_mode: A mode for the result image. Should have not less - than ``channels`` channels. Default is ``None``, - which means that mode wouldn't be changed. - """ - - name = "Color 3D LUT" - - def __init__( - self, - size: int | tuple[int, int, int], - table: Sequence[float] | Sequence[Sequence[int]] | NumpyArray, - channels: int = 3, - target_mode: str | None = None, - **kwargs: bool, - ) -> None: - if channels not in (3, 4): - msg = "Only 3 or 4 output channels are supported" - raise ValueError(msg) - self.size = size = self._check_size(size) - self.channels = channels - self.mode = target_mode - - # Hidden flag `_copy_table=False` could be used to avoid extra copying - # of the table if the table is specially made for the constructor. - copy_table = kwargs.get("_copy_table", True) - items = size[0] * size[1] * size[2] - wrong_size = False - - numpy: ModuleType | None = None - if hasattr(table, "shape"): - try: - import numpy - except ImportError: - pass - - if numpy and isinstance(table, numpy.ndarray): - numpy_table: NumpyArray = table - if copy_table: - numpy_table = numpy_table.copy() - - if numpy_table.shape in [ - (items * channels,), - (items, channels), - (size[2], size[1], size[0], channels), - ]: - table = numpy_table.reshape(items * channels) - else: - wrong_size = True - - else: - if copy_table: - table = list(table) - - # Convert to a flat list - if table and isinstance(table[0], (list, tuple)): - raw_table = cast(Sequence[Sequence[int]], table) - flat_table: list[int] = [] - for pixel in raw_table: - if len(pixel) != channels: - msg = ( - "The elements of the table should " - f"have a length of {channels}." - ) - raise ValueError(msg) - flat_table.extend(pixel) - table = flat_table - - if wrong_size or len(table) != items * channels: - msg = ( - "The table should have either channels * size**3 float items " - "or size**3 items of channels-sized tuples with floats. " - f"Table should be: {channels}x{size[0]}x{size[1]}x{size[2]}. " - f"Actual length: {len(table)}" - ) - raise ValueError(msg) - self.table = table - - @staticmethod - def _check_size(size: Any) -> tuple[int, int, int]: - try: - _, _, _ = size - except ValueError as e: - msg = "Size should be either an integer or a tuple of three integers." - raise ValueError(msg) from e - except TypeError: - size = (size, size, size) - size = tuple(int(x) for x in size) - for size_1d in size: - if not 2 <= size_1d <= 65: - msg = "Size should be in [2, 65] range." - raise ValueError(msg) - return size - - @classmethod - def generate( - cls, - size: int | tuple[int, int, int], - callback: Callable[[float, float, float], tuple[float, ...]], - channels: int = 3, - target_mode: str | None = None, - ) -> Color3DLUT: - """Generates new LUT using provided callback. - - :param size: Size of the table. Passed to the constructor. - :param callback: Function with three parameters which correspond - three color channels. Will be called ``size**3`` - times with values from 0.0 to 1.0 and should return - a tuple with ``channels`` elements. - :param channels: The number of channels which should return callback. - :param target_mode: Passed to the constructor of the resulting - lookup table. - """ - size_1d, size_2d, size_3d = cls._check_size(size) - if channels not in (3, 4): - msg = "Only 3 or 4 output channels are supported" - raise ValueError(msg) - - table: list[float] = [0] * (size_1d * size_2d * size_3d * channels) - idx_out = 0 - for b in range(size_3d): - for g in range(size_2d): - for r in range(size_1d): - table[idx_out : idx_out + channels] = callback( - r / (size_1d - 1), g / (size_2d - 1), b / (size_3d - 1) - ) - idx_out += channels - - return cls( - (size_1d, size_2d, size_3d), - table, - channels=channels, - target_mode=target_mode, - _copy_table=False, - ) - - def transform( - self, - callback: Callable[..., tuple[float, ...]], - with_normals: bool = False, - channels: int | None = None, - target_mode: str | None = None, - ) -> Color3DLUT: - """Transforms the table values using provided callback and returns - a new LUT with altered values. - - :param callback: A function which takes old lookup table values - and returns a new set of values. The number - of arguments which function should take is - ``self.channels`` or ``3 + self.channels`` - if ``with_normals`` flag is set. - Should return a tuple of ``self.channels`` or - ``channels`` elements if it is set. - :param with_normals: If true, ``callback`` will be called with - coordinates in the color cube as the first - three arguments. Otherwise, ``callback`` - will be called only with actual color values. - :param channels: The number of channels in the resulting lookup table. - :param target_mode: Passed to the constructor of the resulting - lookup table. - """ - if channels not in (None, 3, 4): - msg = "Only 3 or 4 output channels are supported" - raise ValueError(msg) - ch_in = self.channels - ch_out = channels or ch_in - size_1d, size_2d, size_3d = self.size - - table: list[float] = [0] * (size_1d * size_2d * size_3d * ch_out) - idx_in = 0 - idx_out = 0 - for b in range(size_3d): - for g in range(size_2d): - for r in range(size_1d): - values = self.table[idx_in : idx_in + ch_in] - if with_normals: - values = callback( - r / (size_1d - 1), - g / (size_2d - 1), - b / (size_3d - 1), - *values, - ) - else: - values = callback(*values) - table[idx_out : idx_out + ch_out] = values - idx_in += ch_in - idx_out += ch_out - - return type(self)( - self.size, - table, - channels=ch_out, - target_mode=target_mode or self.mode, - _copy_table=False, - ) - - def __repr__(self) -> str: - r = [ - f"{self.__class__.__name__} from {self.table.__class__.__name__}", - "size={:d}x{:d}x{:d}".format(*self.size), - f"channels={self.channels:d}", - ] - if self.mode: - r.append(f"target_mode={self.mode}") - return "<{}>".format(" ".join(r)) - - def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: - from . import Image - - return image.color_lut_3d( - self.mode or image.mode, - Image.Resampling.BILINEAR, - self.channels, - self.size, - self.table, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageFont.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageFont.py deleted file mode 100644 index 329c463..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageFont.py +++ /dev/null @@ -1,1339 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# PIL raster font management -# -# History: -# 1996-08-07 fl created (experimental) -# 1997-08-25 fl minor adjustments to handle fonts from pilfont 0.3 -# 1999-02-06 fl rewrote most font management stuff in C -# 1999-03-17 fl take pth files into account in load_path (from Richard Jones) -# 2001-02-17 fl added freetype support -# 2001-05-09 fl added TransposedFont wrapper class -# 2002-03-04 fl make sure we have a "L" or "1" font -# 2002-12-04 fl skip non-directory entries in the system path -# 2003-04-29 fl add embedded default font -# 2003-09-27 fl added support for truetype charmap encodings -# -# Todo: -# Adapt to PILFONT2 format (16-bit fonts, compressed, single file) -# -# Copyright (c) 1997-2003 by Secret Labs AB -# Copyright (c) 1996-2003 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# - -from __future__ import annotations - -import base64 -import os -import sys -import warnings -from enum import IntEnum -from io import BytesIO -from types import ModuleType -from typing import IO, Any, BinaryIO, TypedDict, cast - -from . import Image, features -from ._typing import StrOrBytesPath -from ._util import DeferredError, is_path - -TYPE_CHECKING = False -if TYPE_CHECKING: - from . import ImageFile - from ._imaging import ImagingFont - from ._imagingft import Font - - -class Axis(TypedDict): - minimum: int | None - default: int | None - maximum: int | None - name: bytes | None - - -class Layout(IntEnum): - BASIC = 0 - RAQM = 1 - - -MAX_STRING_LENGTH = 1_000_000 - - -core: ModuleType | DeferredError -try: - from . import _imagingft as core -except ImportError as ex: - core = DeferredError.new(ex) - - -def _string_length_check(text: str | bytes | bytearray) -> None: - if MAX_STRING_LENGTH is not None and len(text) > MAX_STRING_LENGTH: - msg = "too many characters in string" - raise ValueError(msg) - - -# FIXME: add support for pilfont2 format (see FontFile.py) - -# -------------------------------------------------------------------- -# Font metrics format: -# "PILfont" LF -# fontdescriptor LF -# (optional) key=value... LF -# "DATA" LF -# binary data: 256*10*2 bytes (dx, dy, dstbox, srcbox) -# -# To place a character, cut out srcbox and paste at dstbox, -# relative to the character position. Then move the character -# position according to dx, dy. -# -------------------------------------------------------------------- - - -class ImageFont: - """PIL font wrapper""" - - font: ImagingFont - - def _load_pilfont(self, filename: str) -> None: - with open(filename, "rb") as fp: - image: ImageFile.ImageFile | None = None - root = os.path.splitext(filename)[0] - - for ext in (".png", ".gif", ".pbm"): - if image: - image.close() - try: - fullname = root + ext - image = Image.open(fullname) - except Exception: - pass - else: - if image and image.mode in ("1", "L"): - break - else: - if image: - image.close() - - msg = f"cannot find glyph data file {root}.{{gif|pbm|png}}" - raise OSError(msg) - - self.file = fullname - - self._load_pilfont_data(fp, image) - image.close() - - def _load_pilfont_data(self, file: IO[bytes], image: Image.Image) -> None: - # read PILfont header - if file.readline() != b"PILfont\n": - msg = "Not a PILfont file" - raise SyntaxError(msg) - file.readline().split(b";") - self.info = [] # FIXME: should be a dictionary - while True: - s = file.readline() - if not s or s == b"DATA\n": - break - self.info.append(s) - - # read PILfont metrics - data = file.read(256 * 20) - - # check image - if image.mode not in ("1", "L"): - msg = "invalid font image mode" - raise TypeError(msg) - - image.load() - - self.font = Image.core.font(image.im, data) - - def getmask( - self, text: str | bytes, mode: str = "", *args: Any, **kwargs: Any - ) -> Image.core.ImagingCore: - """ - Create a bitmap for the text. - - If the font uses antialiasing, the bitmap should have mode ``L`` and use a - maximum value of 255. Otherwise, it should have mode ``1``. - - :param text: Text to render. - :param mode: Used by some graphics drivers to indicate what mode the - driver prefers; if empty, the renderer may return either - mode. Note that the mode is always a string, to simplify - C-level implementations. - - .. versionadded:: 1.1.5 - - :return: An internal PIL storage memory instance as defined by the - :py:mod:`PIL.Image.core` interface module. - """ - _string_length_check(text) - Image._decompression_bomb_check(self.font.getsize(text)) - return self.font.getmask(text, mode) - - def getbbox( - self, text: str | bytes | bytearray, *args: Any, **kwargs: Any - ) -> tuple[int, int, int, int]: - """ - Returns bounding box (in pixels) of given text. - - .. versionadded:: 9.2.0 - - :param text: Text to render. - - :return: ``(left, top, right, bottom)`` bounding box - """ - _string_length_check(text) - width, height = self.font.getsize(text) - return 0, 0, width, height - - def getlength( - self, text: str | bytes | bytearray, *args: Any, **kwargs: Any - ) -> int: - """ - Returns length (in pixels) of given text. - This is the amount by which following text should be offset. - - .. versionadded:: 9.2.0 - """ - _string_length_check(text) - width, height = self.font.getsize(text) - return width - - -## -# Wrapper for FreeType fonts. Application code should use the -# truetype factory function to create font objects. - - -class FreeTypeFont: - """FreeType font wrapper (requires _imagingft service)""" - - font: Font - font_bytes: bytes - - def __init__( - self, - font: StrOrBytesPath | BinaryIO, - size: float = 10, - index: int = 0, - encoding: str = "", - layout_engine: Layout | None = None, - ) -> None: - # FIXME: use service provider instead - - if isinstance(core, DeferredError): - raise core.ex - - if size <= 0: - msg = f"font size must be greater than 0, not {size}" - raise ValueError(msg) - - self.path = font - self.size = size - self.index = index - self.encoding = encoding - - try: - from packaging.version import parse as parse_version - except ImportError: - pass - else: - if freetype_version := features.version_module("freetype2"): - if parse_version(freetype_version) < parse_version("2.9.1"): - warnings.warn( - "Support for FreeType 2.9.0 is deprecated and will be removed " - "in Pillow 12 (2025-10-15). Please upgrade to FreeType 2.9.1 " - "or newer, preferably FreeType 2.10.4 which fixes " - "CVE-2020-15999.", - DeprecationWarning, - ) - - if layout_engine not in (Layout.BASIC, Layout.RAQM): - layout_engine = Layout.BASIC - if core.HAVE_RAQM: - layout_engine = Layout.RAQM - elif layout_engine == Layout.RAQM and not core.HAVE_RAQM: - warnings.warn( - "Raqm layout was requested, but Raqm is not available. " - "Falling back to basic layout." - ) - layout_engine = Layout.BASIC - - self.layout_engine = layout_engine - - def load_from_bytes(f: IO[bytes]) -> None: - self.font_bytes = f.read() - self.font = core.getfont( - "", size, index, encoding, self.font_bytes, layout_engine - ) - - if is_path(font): - font = os.fspath(font) - if sys.platform == "win32": - font_bytes_path = font if isinstance(font, bytes) else font.encode() - try: - font_bytes_path.decode("ascii") - except UnicodeDecodeError: - # FreeType cannot load fonts with non-ASCII characters on Windows - # So load it into memory first - with open(font, "rb") as f: - load_from_bytes(f) - return - self.font = core.getfont( - font, size, index, encoding, layout_engine=layout_engine - ) - else: - load_from_bytes(cast(IO[bytes], font)) - - def __getstate__(self) -> list[Any]: - return [self.path, self.size, self.index, self.encoding, self.layout_engine] - - def __setstate__(self, state: list[Any]) -> None: - path, size, index, encoding, layout_engine = state - FreeTypeFont.__init__(self, path, size, index, encoding, layout_engine) - - def getname(self) -> tuple[str | None, str | None]: - """ - :return: A tuple of the font family (e.g. Helvetica) and the font style - (e.g. Bold) - """ - return self.font.family, self.font.style - - def getmetrics(self) -> tuple[int, int]: - """ - :return: A tuple of the font ascent (the distance from the baseline to - the highest outline point) and descent (the distance from the - baseline to the lowest outline point, a negative value) - """ - return self.font.ascent, self.font.descent - - def getlength( - self, - text: str | bytes, - mode: str = "", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - ) -> float: - """ - Returns length (in pixels with 1/64 precision) of given text when rendered - in font with provided direction, features, and language. - - This is the amount by which following text should be offset. - Text bounding box may extend past the length in some fonts, - e.g. when using italics or accents. - - The result is returned as a float; it is a whole number if using basic layout. - - Note that the sum of two lengths may not equal the length of a concatenated - string due to kerning. If you need to adjust for kerning, include the following - character and subtract its length. - - For example, instead of :: - - hello = font.getlength("Hello") - world = font.getlength("World") - hello_world = hello + world # not adjusted for kerning - assert hello_world == font.getlength("HelloWorld") # may fail - - use :: - - hello = font.getlength("HelloW") - font.getlength("W") # adjusted for kerning - world = font.getlength("World") - hello_world = hello + world # adjusted for kerning - assert hello_world == font.getlength("HelloWorld") # True - - or disable kerning with (requires libraqm) :: - - hello = draw.textlength("Hello", font, features=["-kern"]) - world = draw.textlength("World", font, features=["-kern"]) - hello_world = hello + world # kerning is disabled, no need to adjust - assert hello_world == draw.textlength("HelloWorld", font, features=["-kern"]) - - .. versionadded:: 8.0.0 - - :param text: Text to measure. - :param mode: Used by some graphics drivers to indicate what mode the - driver prefers; if empty, the renderer may return either - mode. Note that the mode is always a string, to simplify - C-level implementations. - - :param direction: Direction of the text. It can be 'rtl' (right to - left), 'ltr' (left to right) or 'ttb' (top to bottom). - Requires libraqm. - - :param features: A list of OpenType font features to be used during text - layout. This is usually used to turn on optional - font features that are not enabled by default, - for example 'dlig' or 'ss01', but can be also - used to turn off default font features for - example '-liga' to disable ligatures or '-kern' - to disable kerning. To get all supported - features, see - https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist - Requires libraqm. - - :param language: Language of the text. Different languages may use - different glyph shapes or ligatures. This parameter tells - the font which language the text is in, and to apply the - correct substitutions as appropriate, if available. - It should be a `BCP 47 language code - `_ - Requires libraqm. - - :return: Either width for horizontal text, or height for vertical text. - """ - _string_length_check(text) - return self.font.getlength(text, mode, direction, features, language) / 64 - - def getbbox( - self, - text: str | bytes, - mode: str = "", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - stroke_width: float = 0, - anchor: str | None = None, - ) -> tuple[float, float, float, float]: - """ - Returns bounding box (in pixels) of given text relative to given anchor - when rendered in font with provided direction, features, and language. - - Use :py:meth:`getlength()` to get the offset of following text with - 1/64 pixel precision. The bounding box includes extra margins for - some fonts, e.g. italics or accents. - - .. versionadded:: 8.0.0 - - :param text: Text to render. - :param mode: Used by some graphics drivers to indicate what mode the - driver prefers; if empty, the renderer may return either - mode. Note that the mode is always a string, to simplify - C-level implementations. - - :param direction: Direction of the text. It can be 'rtl' (right to - left), 'ltr' (left to right) or 'ttb' (top to bottom). - Requires libraqm. - - :param features: A list of OpenType font features to be used during text - layout. This is usually used to turn on optional - font features that are not enabled by default, - for example 'dlig' or 'ss01', but can be also - used to turn off default font features for - example '-liga' to disable ligatures or '-kern' - to disable kerning. To get all supported - features, see - https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist - Requires libraqm. - - :param language: Language of the text. Different languages may use - different glyph shapes or ligatures. This parameter tells - the font which language the text is in, and to apply the - correct substitutions as appropriate, if available. - It should be a `BCP 47 language code - `_ - Requires libraqm. - - :param stroke_width: The width of the text stroke. - - :param anchor: The text anchor alignment. Determines the relative location of - the anchor to the text. The default alignment is top left, - specifically ``la`` for horizontal text and ``lt`` for - vertical text. See :ref:`text-anchors` for details. - - :return: ``(left, top, right, bottom)`` bounding box - """ - _string_length_check(text) - size, offset = self.font.getsize( - text, mode, direction, features, language, anchor - ) - left, top = offset[0] - stroke_width, offset[1] - stroke_width - width, height = size[0] + 2 * stroke_width, size[1] + 2 * stroke_width - return left, top, left + width, top + height - - def getmask( - self, - text: str | bytes, - mode: str = "", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - stroke_width: float = 0, - anchor: str | None = None, - ink: int = 0, - start: tuple[float, float] | None = None, - ) -> Image.core.ImagingCore: - """ - Create a bitmap for the text. - - If the font uses antialiasing, the bitmap should have mode ``L`` and use a - maximum value of 255. If the font has embedded color data, the bitmap - should have mode ``RGBA``. Otherwise, it should have mode ``1``. - - :param text: Text to render. - :param mode: Used by some graphics drivers to indicate what mode the - driver prefers; if empty, the renderer may return either - mode. Note that the mode is always a string, to simplify - C-level implementations. - - .. versionadded:: 1.1.5 - - :param direction: Direction of the text. It can be 'rtl' (right to - left), 'ltr' (left to right) or 'ttb' (top to bottom). - Requires libraqm. - - .. versionadded:: 4.2.0 - - :param features: A list of OpenType font features to be used during text - layout. This is usually used to turn on optional - font features that are not enabled by default, - for example 'dlig' or 'ss01', but can be also - used to turn off default font features for - example '-liga' to disable ligatures or '-kern' - to disable kerning. To get all supported - features, see - https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist - Requires libraqm. - - .. versionadded:: 4.2.0 - - :param language: Language of the text. Different languages may use - different glyph shapes or ligatures. This parameter tells - the font which language the text is in, and to apply the - correct substitutions as appropriate, if available. - It should be a `BCP 47 language code - `_ - Requires libraqm. - - .. versionadded:: 6.0.0 - - :param stroke_width: The width of the text stroke. - - .. versionadded:: 6.2.0 - - :param anchor: The text anchor alignment. Determines the relative location of - the anchor to the text. The default alignment is top left, - specifically ``la`` for horizontal text and ``lt`` for - vertical text. See :ref:`text-anchors` for details. - - .. versionadded:: 8.0.0 - - :param ink: Foreground ink for rendering in RGBA mode. - - .. versionadded:: 8.0.0 - - :param start: Tuple of horizontal and vertical offset, as text may render - differently when starting at fractional coordinates. - - .. versionadded:: 9.4.0 - - :return: An internal PIL storage memory instance as defined by the - :py:mod:`PIL.Image.core` interface module. - """ - return self.getmask2( - text, - mode, - direction=direction, - features=features, - language=language, - stroke_width=stroke_width, - anchor=anchor, - ink=ink, - start=start, - )[0] - - def getmask2( - self, - text: str | bytes, - mode: str = "", - direction: str | None = None, - features: list[str] | None = None, - language: str | None = None, - stroke_width: float = 0, - anchor: str | None = None, - ink: int = 0, - start: tuple[float, float] | None = None, - *args: Any, - **kwargs: Any, - ) -> tuple[Image.core.ImagingCore, tuple[int, int]]: - """ - Create a bitmap for the text. - - If the font uses antialiasing, the bitmap should have mode ``L`` and use a - maximum value of 255. If the font has embedded color data, the bitmap - should have mode ``RGBA``. Otherwise, it should have mode ``1``. - - :param text: Text to render. - :param mode: Used by some graphics drivers to indicate what mode the - driver prefers; if empty, the renderer may return either - mode. Note that the mode is always a string, to simplify - C-level implementations. - - .. versionadded:: 1.1.5 - - :param direction: Direction of the text. It can be 'rtl' (right to - left), 'ltr' (left to right) or 'ttb' (top to bottom). - Requires libraqm. - - .. versionadded:: 4.2.0 - - :param features: A list of OpenType font features to be used during text - layout. This is usually used to turn on optional - font features that are not enabled by default, - for example 'dlig' or 'ss01', but can be also - used to turn off default font features for - example '-liga' to disable ligatures or '-kern' - to disable kerning. To get all supported - features, see - https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist - Requires libraqm. - - .. versionadded:: 4.2.0 - - :param language: Language of the text. Different languages may use - different glyph shapes or ligatures. This parameter tells - the font which language the text is in, and to apply the - correct substitutions as appropriate, if available. - It should be a `BCP 47 language code - `_ - Requires libraqm. - - .. versionadded:: 6.0.0 - - :param stroke_width: The width of the text stroke. - - .. versionadded:: 6.2.0 - - :param anchor: The text anchor alignment. Determines the relative location of - the anchor to the text. The default alignment is top left, - specifically ``la`` for horizontal text and ``lt`` for - vertical text. See :ref:`text-anchors` for details. - - .. versionadded:: 8.0.0 - - :param ink: Foreground ink for rendering in RGBA mode. - - .. versionadded:: 8.0.0 - - :param start: Tuple of horizontal and vertical offset, as text may render - differently when starting at fractional coordinates. - - .. versionadded:: 9.4.0 - - :return: A tuple of an internal PIL storage memory instance as defined by the - :py:mod:`PIL.Image.core` interface module, and the text offset, the - gap between the starting coordinate and the first marking - """ - _string_length_check(text) - if start is None: - start = (0, 0) - - def fill(width: int, height: int) -> Image.core.ImagingCore: - size = (width, height) - Image._decompression_bomb_check(size) - return Image.core.fill("RGBA" if mode == "RGBA" else "L", size) - - return self.font.render( - text, - fill, - mode, - direction, - features, - language, - stroke_width, - kwargs.get("stroke_filled", False), - anchor, - ink, - start, - ) - - def font_variant( - self, - font: StrOrBytesPath | BinaryIO | None = None, - size: float | None = None, - index: int | None = None, - encoding: str | None = None, - layout_engine: Layout | None = None, - ) -> FreeTypeFont: - """ - Create a copy of this FreeTypeFont object, - using any specified arguments to override the settings. - - Parameters are identical to the parameters used to initialize this - object. - - :return: A FreeTypeFont object. - """ - if font is None: - try: - font = BytesIO(self.font_bytes) - except AttributeError: - font = self.path - return FreeTypeFont( - font=font, - size=self.size if size is None else size, - index=self.index if index is None else index, - encoding=self.encoding if encoding is None else encoding, - layout_engine=layout_engine or self.layout_engine, - ) - - def get_variation_names(self) -> list[bytes]: - """ - :returns: A list of the named styles in a variation font. - :exception OSError: If the font is not a variation font. - """ - try: - names = self.font.getvarnames() - except AttributeError as e: - msg = "FreeType 2.9.1 or greater is required" - raise NotImplementedError(msg) from e - return [name.replace(b"\x00", b"") for name in names] - - def set_variation_by_name(self, name: str | bytes) -> None: - """ - :param name: The name of the style. - :exception OSError: If the font is not a variation font. - """ - names = self.get_variation_names() - if not isinstance(name, bytes): - name = name.encode() - index = names.index(name) + 1 - - if index == getattr(self, "_last_variation_index", None): - # When the same name is set twice in a row, - # there is an 'unknown freetype error' - # https://savannah.nongnu.org/bugs/?56186 - return - self._last_variation_index = index - - self.font.setvarname(index) - - def get_variation_axes(self) -> list[Axis]: - """ - :returns: A list of the axes in a variation font. - :exception OSError: If the font is not a variation font. - """ - try: - axes = self.font.getvaraxes() - except AttributeError as e: - msg = "FreeType 2.9.1 or greater is required" - raise NotImplementedError(msg) from e - for axis in axes: - if axis["name"]: - axis["name"] = axis["name"].replace(b"\x00", b"") - return axes - - def set_variation_by_axes(self, axes: list[float]) -> None: - """ - :param axes: A list of values for each axis. - :exception OSError: If the font is not a variation font. - """ - try: - self.font.setvaraxes(axes) - except AttributeError as e: - msg = "FreeType 2.9.1 or greater is required" - raise NotImplementedError(msg) from e - - -class TransposedFont: - """Wrapper for writing rotated or mirrored text""" - - def __init__( - self, font: ImageFont | FreeTypeFont, orientation: Image.Transpose | None = None - ): - """ - Wrapper that creates a transposed font from any existing font - object. - - :param font: A font object. - :param orientation: An optional orientation. If given, this should - be one of Image.Transpose.FLIP_LEFT_RIGHT, Image.Transpose.FLIP_TOP_BOTTOM, - Image.Transpose.ROTATE_90, Image.Transpose.ROTATE_180, or - Image.Transpose.ROTATE_270. - """ - self.font = font - self.orientation = orientation # any 'transpose' argument, or None - - def getmask( - self, text: str | bytes, mode: str = "", *args: Any, **kwargs: Any - ) -> Image.core.ImagingCore: - im = self.font.getmask(text, mode, *args, **kwargs) - if self.orientation is not None: - return im.transpose(self.orientation) - return im - - def getbbox( - self, text: str | bytes, *args: Any, **kwargs: Any - ) -> tuple[int, int, float, float]: - # TransposedFont doesn't support getmask2, move top-left point to (0, 0) - # this has no effect on ImageFont and simulates anchor="lt" for FreeTypeFont - left, top, right, bottom = self.font.getbbox(text, *args, **kwargs) - width = right - left - height = bottom - top - if self.orientation in (Image.Transpose.ROTATE_90, Image.Transpose.ROTATE_270): - return 0, 0, height, width - return 0, 0, width, height - - def getlength(self, text: str | bytes, *args: Any, **kwargs: Any) -> float: - if self.orientation in (Image.Transpose.ROTATE_90, Image.Transpose.ROTATE_270): - msg = "text length is undefined for text rotated by 90 or 270 degrees" - raise ValueError(msg) - return self.font.getlength(text, *args, **kwargs) - - -def load(filename: str) -> ImageFont: - """ - Load a font file. This function loads a font object from the given - bitmap font file, and returns the corresponding font object. For loading TrueType - or OpenType fonts instead, see :py:func:`~PIL.ImageFont.truetype`. - - :param filename: Name of font file. - :return: A font object. - :exception OSError: If the file could not be read. - """ - f = ImageFont() - f._load_pilfont(filename) - return f - - -def truetype( - font: StrOrBytesPath | BinaryIO, - size: float = 10, - index: int = 0, - encoding: str = "", - layout_engine: Layout | None = None, -) -> FreeTypeFont: - """ - Load a TrueType or OpenType font from a file or file-like object, - and create a font object. This function loads a font object from the given - file or file-like object, and creates a font object for a font of the given - size. For loading bitmap fonts instead, see :py:func:`~PIL.ImageFont.load` - and :py:func:`~PIL.ImageFont.load_path`. - - Pillow uses FreeType to open font files. On Windows, be aware that FreeType - will keep the file open as long as the FreeTypeFont object exists. Windows - limits the number of files that can be open in C at once to 512, so if many - fonts are opened simultaneously and that limit is approached, an - ``OSError`` may be thrown, reporting that FreeType "cannot open resource". - A workaround would be to copy the file(s) into memory, and open that instead. - - This function requires the _imagingft service. - - :param font: A filename or file-like object containing a TrueType font. - If the file is not found in this filename, the loader may also - search in other directories, such as: - - * The :file:`fonts/` directory on Windows, - * :file:`/Library/Fonts/`, :file:`/System/Library/Fonts/` - and :file:`~/Library/Fonts/` on macOS. - * :file:`~/.local/share/fonts`, :file:`/usr/local/share/fonts`, - and :file:`/usr/share/fonts` on Linux; or those specified by - the ``XDG_DATA_HOME`` and ``XDG_DATA_DIRS`` environment variables - for user-installed and system-wide fonts, respectively. - - :param size: The requested size, in pixels. - :param index: Which font face to load (default is first available face). - :param encoding: Which font encoding to use (default is Unicode). Possible - encodings include (see the FreeType documentation for more - information): - - * "unic" (Unicode) - * "symb" (Microsoft Symbol) - * "ADOB" (Adobe Standard) - * "ADBE" (Adobe Expert) - * "ADBC" (Adobe Custom) - * "armn" (Apple Roman) - * "sjis" (Shift JIS) - * "gb " (PRC) - * "big5" - * "wans" (Extended Wansung) - * "joha" (Johab) - * "lat1" (Latin-1) - - This specifies the character set to use. It does not alter the - encoding of any text provided in subsequent operations. - :param layout_engine: Which layout engine to use, if available: - :attr:`.ImageFont.Layout.BASIC` or :attr:`.ImageFont.Layout.RAQM`. - If it is available, Raqm layout will be used by default. - Otherwise, basic layout will be used. - - Raqm layout is recommended for all non-English text. If Raqm layout - is not required, basic layout will have better performance. - - You can check support for Raqm layout using - :py:func:`PIL.features.check_feature` with ``feature="raqm"``. - - .. versionadded:: 4.2.0 - :return: A font object. - :exception OSError: If the file could not be read. - :exception ValueError: If the font size is not greater than zero. - """ - - def freetype(font: StrOrBytesPath | BinaryIO) -> FreeTypeFont: - return FreeTypeFont(font, size, index, encoding, layout_engine) - - try: - return freetype(font) - except OSError: - if not is_path(font): - raise - ttf_filename = os.path.basename(font) - - dirs = [] - if sys.platform == "win32": - # check the windows font repository - # NOTE: must use uppercase WINDIR, to work around bugs in - # 1.5.2's os.environ.get() - windir = os.environ.get("WINDIR") - if windir: - dirs.append(os.path.join(windir, "fonts")) - elif sys.platform in ("linux", "linux2"): - data_home = os.environ.get("XDG_DATA_HOME") - if not data_home: - # The freedesktop spec defines the following default directory for - # when XDG_DATA_HOME is unset or empty. This user-level directory - # takes precedence over system-level directories. - data_home = os.path.expanduser("~/.local/share") - xdg_dirs = [data_home] - - data_dirs = os.environ.get("XDG_DATA_DIRS") - if not data_dirs: - # Similarly, defaults are defined for the system-level directories - data_dirs = "/usr/local/share:/usr/share" - xdg_dirs += data_dirs.split(":") - - dirs += [os.path.join(xdg_dir, "fonts") for xdg_dir in xdg_dirs] - elif sys.platform == "darwin": - dirs += [ - "/Library/Fonts", - "/System/Library/Fonts", - os.path.expanduser("~/Library/Fonts"), - ] - - ext = os.path.splitext(ttf_filename)[1] - first_font_with_a_different_extension = None - for directory in dirs: - for walkroot, walkdir, walkfilenames in os.walk(directory): - for walkfilename in walkfilenames: - if ext and walkfilename == ttf_filename: - return freetype(os.path.join(walkroot, walkfilename)) - elif not ext and os.path.splitext(walkfilename)[0] == ttf_filename: - fontpath = os.path.join(walkroot, walkfilename) - if os.path.splitext(fontpath)[1] == ".ttf": - return freetype(fontpath) - if not ext and first_font_with_a_different_extension is None: - first_font_with_a_different_extension = fontpath - if first_font_with_a_different_extension: - return freetype(first_font_with_a_different_extension) - raise - - -def load_path(filename: str | bytes) -> ImageFont: - """ - Load font file. Same as :py:func:`~PIL.ImageFont.load`, but searches for a - bitmap font along the Python path. - - :param filename: Name of font file. - :return: A font object. - :exception OSError: If the file could not be read. - """ - if not isinstance(filename, str): - filename = filename.decode("utf-8") - for directory in sys.path: - try: - return load(os.path.join(directory, filename)) - except OSError: - pass - msg = f'cannot find font file "{filename}" in sys.path' - if os.path.exists(filename): - msg += f', did you mean ImageFont.load("{filename}") instead?' - - raise OSError(msg) - - -def load_default_imagefont() -> ImageFont: - f = ImageFont() - f._load_pilfont_data( - # courB08 - BytesIO( - base64.b64decode( - b""" -UElMZm9udAo7Ozs7OzsxMDsKREFUQQoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAA//8AAQAAAAAAAAABAAEA -BgAAAAH/+gADAAAAAQAAAAMABgAGAAAAAf/6AAT//QADAAAABgADAAYAAAAA//kABQABAAYAAAAL -AAgABgAAAAD/+AAFAAEACwAAABAACQAGAAAAAP/5AAUAAAAQAAAAFQAHAAYAAP////oABQAAABUA -AAAbAAYABgAAAAH/+QAE//wAGwAAAB4AAwAGAAAAAf/5AAQAAQAeAAAAIQAIAAYAAAAB//kABAAB -ACEAAAAkAAgABgAAAAD/+QAE//0AJAAAACgABAAGAAAAAP/6AAX//wAoAAAALQAFAAYAAAAB//8A -BAACAC0AAAAwAAMABgAAAAD//AAF//0AMAAAADUAAQAGAAAAAf//AAMAAAA1AAAANwABAAYAAAAB -//kABQABADcAAAA7AAgABgAAAAD/+QAFAAAAOwAAAEAABwAGAAAAAP/5AAYAAABAAAAARgAHAAYA -AAAA//kABQAAAEYAAABLAAcABgAAAAD/+QAFAAAASwAAAFAABwAGAAAAAP/5AAYAAABQAAAAVgAH -AAYAAAAA//kABQAAAFYAAABbAAcABgAAAAD/+QAFAAAAWwAAAGAABwAGAAAAAP/5AAUAAABgAAAA -ZQAHAAYAAAAA//kABQAAAGUAAABqAAcABgAAAAD/+QAFAAAAagAAAG8ABwAGAAAAAf/8AAMAAABv -AAAAcQAEAAYAAAAA//wAAwACAHEAAAB0AAYABgAAAAD/+gAE//8AdAAAAHgABQAGAAAAAP/7AAT/ -/gB4AAAAfAADAAYAAAAB//oABf//AHwAAACAAAUABgAAAAD/+gAFAAAAgAAAAIUABgAGAAAAAP/5 -AAYAAQCFAAAAiwAIAAYAAP////oABgAAAIsAAACSAAYABgAA////+gAFAAAAkgAAAJgABgAGAAAA -AP/6AAUAAACYAAAAnQAGAAYAAP////oABQAAAJ0AAACjAAYABgAA////+gAFAAAAowAAAKkABgAG -AAD////6AAUAAACpAAAArwAGAAYAAAAA//oABQAAAK8AAAC0AAYABgAA////+gAGAAAAtAAAALsA -BgAGAAAAAP/6AAQAAAC7AAAAvwAGAAYAAP////oABQAAAL8AAADFAAYABgAA////+gAGAAAAxQAA -AMwABgAGAAD////6AAUAAADMAAAA0gAGAAYAAP////oABQAAANIAAADYAAYABgAA////+gAGAAAA -2AAAAN8ABgAGAAAAAP/6AAUAAADfAAAA5AAGAAYAAP////oABQAAAOQAAADqAAYABgAAAAD/+gAF -AAEA6gAAAO8ABwAGAAD////6AAYAAADvAAAA9gAGAAYAAAAA//oABQAAAPYAAAD7AAYABgAA//// -+gAFAAAA+wAAAQEABgAGAAD////6AAYAAAEBAAABCAAGAAYAAP////oABgAAAQgAAAEPAAYABgAA -////+gAGAAABDwAAARYABgAGAAAAAP/6AAYAAAEWAAABHAAGAAYAAP////oABgAAARwAAAEjAAYA -BgAAAAD/+gAFAAABIwAAASgABgAGAAAAAf/5AAQAAQEoAAABKwAIAAYAAAAA//kABAABASsAAAEv -AAgABgAAAAH/+QAEAAEBLwAAATIACAAGAAAAAP/5AAX//AEyAAABNwADAAYAAAAAAAEABgACATcA -AAE9AAEABgAAAAH/+QAE//wBPQAAAUAAAwAGAAAAAP/7AAYAAAFAAAABRgAFAAYAAP////kABQAA -AUYAAAFMAAcABgAAAAD/+wAFAAABTAAAAVEABQAGAAAAAP/5AAYAAAFRAAABVwAHAAYAAAAA//sA -BQAAAVcAAAFcAAUABgAAAAD/+QAFAAABXAAAAWEABwAGAAAAAP/7AAYAAgFhAAABZwAHAAYAAP// -//kABQAAAWcAAAFtAAcABgAAAAD/+QAGAAABbQAAAXMABwAGAAAAAP/5AAQAAgFzAAABdwAJAAYA -AP////kABgAAAXcAAAF+AAcABgAAAAD/+QAGAAABfgAAAYQABwAGAAD////7AAUAAAGEAAABigAF -AAYAAP////sABQAAAYoAAAGQAAUABgAAAAD/+wAFAAABkAAAAZUABQAGAAD////7AAUAAgGVAAAB -mwAHAAYAAAAA//sABgACAZsAAAGhAAcABgAAAAD/+wAGAAABoQAAAacABQAGAAAAAP/7AAYAAAGn -AAABrQAFAAYAAAAA//kABgAAAa0AAAGzAAcABgAA////+wAGAAABswAAAboABQAGAAD////7AAUA -AAG6AAABwAAFAAYAAP////sABgAAAcAAAAHHAAUABgAAAAD/+wAGAAABxwAAAc0ABQAGAAD////7 -AAYAAgHNAAAB1AAHAAYAAAAA//sABQAAAdQAAAHZAAUABgAAAAH/+QAFAAEB2QAAAd0ACAAGAAAA -Av/6AAMAAQHdAAAB3gAHAAYAAAAA//kABAABAd4AAAHiAAgABgAAAAD/+wAF//0B4gAAAecAAgAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAB -//sAAwACAecAAAHpAAcABgAAAAD/+QAFAAEB6QAAAe4ACAAGAAAAAP/5AAYAAAHuAAAB9AAHAAYA -AAAA//oABf//AfQAAAH5AAUABgAAAAD/+QAGAAAB+QAAAf8ABwAGAAAAAv/5AAMAAgH/AAACAAAJ -AAYAAAAA//kABQABAgAAAAIFAAgABgAAAAH/+gAE//sCBQAAAggAAQAGAAAAAP/5AAYAAAIIAAAC -DgAHAAYAAAAB//kABf/+Ag4AAAISAAUABgAA////+wAGAAACEgAAAhkABQAGAAAAAP/7AAX//gIZ -AAACHgADAAYAAAAA//wABf/9Ah4AAAIjAAEABgAAAAD/+QAHAAACIwAAAioABwAGAAAAAP/6AAT/ -+wIqAAACLgABAAYAAAAA//kABP/8Ai4AAAIyAAMABgAAAAD/+gAFAAACMgAAAjcABgAGAAAAAf/5 -AAT//QI3AAACOgAEAAYAAAAB//kABP/9AjoAAAI9AAQABgAAAAL/+QAE//sCPQAAAj8AAgAGAAD/ -///7AAYAAgI/AAACRgAHAAYAAAAA//kABgABAkYAAAJMAAgABgAAAAH//AAD//0CTAAAAk4AAQAG -AAAAAf//AAQAAgJOAAACUQADAAYAAAAB//kABP/9AlEAAAJUAAQABgAAAAH/+QAF//4CVAAAAlgA -BQAGAAD////7AAYAAAJYAAACXwAFAAYAAP////kABgAAAl8AAAJmAAcABgAA////+QAGAAACZgAA -Am0ABwAGAAD////5AAYAAAJtAAACdAAHAAYAAAAA//sABQACAnQAAAJ5AAcABgAA////9wAGAAAC -eQAAAoAACQAGAAD////3AAYAAAKAAAAChwAJAAYAAP////cABgAAAocAAAKOAAkABgAA////9wAG -AAACjgAAApUACQAGAAD////4AAYAAAKVAAACnAAIAAYAAP////cABgAAApwAAAKjAAkABgAA//// -+gAGAAACowAAAqoABgAGAAAAAP/6AAUAAgKqAAACrwAIAAYAAP////cABQAAAq8AAAK1AAkABgAA -////9wAFAAACtQAAArsACQAGAAD////3AAUAAAK7AAACwQAJAAYAAP////gABQAAAsEAAALHAAgA -BgAAAAD/9wAEAAACxwAAAssACQAGAAAAAP/3AAQAAALLAAACzwAJAAYAAAAA//cABAAAAs8AAALT -AAkABgAAAAD/+AAEAAAC0wAAAtcACAAGAAD////6AAUAAALXAAAC3QAGAAYAAP////cABgAAAt0A -AALkAAkABgAAAAD/9wAFAAAC5AAAAukACQAGAAAAAP/3AAUAAALpAAAC7gAJAAYAAAAA//cABQAA -Au4AAALzAAkABgAAAAD/9wAFAAAC8wAAAvgACQAGAAAAAP/4AAUAAAL4AAAC/QAIAAYAAAAA//oA -Bf//Av0AAAMCAAUABgAA////+gAGAAADAgAAAwkABgAGAAD////3AAYAAAMJAAADEAAJAAYAAP// -//cABgAAAxAAAAMXAAkABgAA////9wAGAAADFwAAAx4ACQAGAAD////4AAYAAAAAAAoABwASAAYA -AP////cABgAAAAcACgAOABMABgAA////+gAFAAAADgAKABQAEAAGAAD////6AAYAAAAUAAoAGwAQ -AAYAAAAA//gABgAAABsACgAhABIABgAAAAD/+AAGAAAAIQAKACcAEgAGAAAAAP/4AAYAAAAnAAoA -LQASAAYAAAAA//gABgAAAC0ACgAzABIABgAAAAD/+QAGAAAAMwAKADkAEQAGAAAAAP/3AAYAAAA5 -AAoAPwATAAYAAP////sABQAAAD8ACgBFAA8ABgAAAAD/+wAFAAIARQAKAEoAEQAGAAAAAP/4AAUA -AABKAAoATwASAAYAAAAA//gABQAAAE8ACgBUABIABgAAAAD/+AAFAAAAVAAKAFkAEgAGAAAAAP/5 -AAUAAABZAAoAXgARAAYAAAAA//gABgAAAF4ACgBkABIABgAAAAD/+AAGAAAAZAAKAGoAEgAGAAAA -AP/4AAYAAABqAAoAcAASAAYAAAAA//kABgAAAHAACgB2ABEABgAAAAD/+AAFAAAAdgAKAHsAEgAG -AAD////4AAYAAAB7AAoAggASAAYAAAAA//gABQAAAIIACgCHABIABgAAAAD/+AAFAAAAhwAKAIwA -EgAGAAAAAP/4AAUAAACMAAoAkQASAAYAAAAA//gABQAAAJEACgCWABIABgAAAAD/+QAFAAAAlgAK -AJsAEQAGAAAAAP/6AAX//wCbAAoAoAAPAAYAAAAA//oABQABAKAACgClABEABgAA////+AAGAAAA -pQAKAKwAEgAGAAD////4AAYAAACsAAoAswASAAYAAP////gABgAAALMACgC6ABIABgAA////+QAG -AAAAugAKAMEAEQAGAAD////4AAYAAgDBAAoAyAAUAAYAAP////kABQACAMgACgDOABMABgAA//// -+QAGAAIAzgAKANUAEw== -""" - ) - ), - Image.open( - BytesIO( - base64.b64decode( - b""" -iVBORw0KGgoAAAANSUhEUgAAAx4AAAAUAQAAAAArMtZoAAAEwElEQVR4nABlAJr/AHVE4czCI/4u -Mc4b7vuds/xzjz5/3/7u/n9vMe7vnfH/9++vPn/xyf5zhxzjt8GHw8+2d83u8x27199/nxuQ6Od9 -M43/5z2I+9n9ZtmDBwMQECDRQw/eQIQohJXxpBCNVE6QCCAAAAD//wBlAJr/AgALyj1t/wINwq0g -LeNZUworuN1cjTPIzrTX6ofHWeo3v336qPzfEwRmBnHTtf95/fglZK5N0PDgfRTslpGBvz7LFc4F -IUXBWQGjQ5MGCx34EDFPwXiY4YbYxavpnhHFrk14CDAAAAD//wBlAJr/AgKqRooH2gAgPeggvUAA -Bu2WfgPoAwzRAABAAAAAAACQgLz/3Uv4Gv+gX7BJgDeeGP6AAAD1NMDzKHD7ANWr3loYbxsAD791 -NAADfcoIDyP44K/jv4Y63/Z+t98Ovt+ub4T48LAAAAD//wBlAJr/AuplMlADJAAAAGuAphWpqhMx -in0A/fRvAYBABPgBwBUgABBQ/sYAyv9g0bCHgOLoGAAAAAAAREAAwI7nr0ArYpow7aX8//9LaP/9 -SjdavWA8ePHeBIKB//81/83ndznOaXx379wAAAD//wBlAJr/AqDxW+D3AABAAbUh/QMnbQag/gAY -AYDAAACgtgD/gOqAAAB5IA/8AAAk+n9w0AAA8AAAmFRJuPo27ciC0cD5oeW4E7KA/wD3ECMAn2tt -y8PgwH8AfAxFzC0JzeAMtratAsC/ffwAAAD//wBlAJr/BGKAyCAA4AAAAvgeYTAwHd1kmQF5chkG -ABoMIHcL5xVpTfQbUqzlAAAErwAQBgAAEOClA5D9il08AEh/tUzdCBsXkbgACED+woQg8Si9VeqY -lODCn7lmF6NhnAEYgAAA/NMIAAAAAAD//2JgjLZgVGBg5Pv/Tvpc8hwGBjYGJADjHDrAwPzAjv/H -/Wf3PzCwtzcwHmBgYGcwbZz8wHaCAQMDOwMDQ8MCBgYOC3W7mp+f0w+wHOYxO3OG+e376hsMZjk3 -AAAAAP//YmCMY2A4wMAIN5e5gQETPD6AZisDAwMDgzSDAAPjByiHcQMDAwMDg1nOze1lByRu5/47 -c4859311AYNZzg0AAAAA//9iYGDBYihOIIMuwIjGL39/fwffA8b//xv/P2BPtzzHwCBjUQAAAAD/ -/yLFBrIBAAAA//9i1HhcwdhizX7u8NZNzyLbvT97bfrMf/QHI8evOwcSqGUJAAAA//9iYBB81iSw -pEE170Qrg5MIYydHqwdDQRMrAwcVrQAAAAD//2J4x7j9AAMDn8Q/BgYLBoaiAwwMjPdvMDBYM1Tv -oJodAAAAAP//Yqo/83+dxePWlxl3npsel9lvLfPcqlE9725C+acfVLMEAAAA//9i+s9gwCoaaGMR -evta/58PTEWzr21hufPjA8N+qlnBwAAAAAD//2JiWLci5v1+HmFXDqcnULE/MxgYGBj+f6CaJQAA -AAD//2Ji2FrkY3iYpYC5qDeGgeEMAwPDvwQBBoYvcTwOVLMEAAAA//9isDBgkP///0EOg9z35v// -Gc/eeW7BwPj5+QGZhANUswMAAAD//2JgqGBgYGBgqEMXlvhMPUsAAAAA//8iYDd1AAAAAP//AwDR -w7IkEbzhVQAAAABJRU5ErkJggg== -""" - ) - ) - ), - ) - return f - - -def load_default(size: float | None = None) -> FreeTypeFont | ImageFont: - """If FreeType support is available, load a version of Aileron Regular, - https://dotcolon.net/fonts/aileron, with a more limited character set. - - Otherwise, load a "better than nothing" font. - - .. versionadded:: 1.1.4 - - :param size: The font size of Aileron Regular. - - .. versionadded:: 10.1.0 - - :return: A font object. - """ - if isinstance(core, ModuleType) or size is not None: - return truetype( - BytesIO( - base64.b64decode( - b""" -AAEAAAAPAIAAAwBwRkZUTYwDlUAAADFoAAAAHEdERUYAqADnAAAo8AAAACRHUE9ThhmITwAAKfgAA -AduR1NVQnHxefoAACkUAAAA4k9TLzJovoHLAAABeAAAAGBjbWFw5lFQMQAAA6gAAAGqZ2FzcP//AA -MAACjoAAAACGdseWYmRXoPAAAGQAAAHfhoZWFkE18ayQAAAPwAAAA2aGhlYQboArEAAAE0AAAAJGh -tdHjjERZ8AAAB2AAAAdBsb2NhuOexrgAABVQAAADqbWF4cAC7AEYAAAFYAAAAIG5hbWUr+h5lAAAk -OAAAA6Jwb3N0D3oPTQAAJ9wAAAEKAAEAAAABGhxJDqIhXw889QALA+gAAAAA0Bqf2QAAAADhCh2h/ -2r/LgOxAyAAAAAIAAIAAAAAAAAAAQAAA8r/GgAAA7j/av9qA7EAAQAAAAAAAAAAAAAAAAAAAHQAAQ -AAAHQAQwAFAAAAAAACAAAAAQABAAAAQAAAAAAAAAADAfoBkAAFAAgCigJYAAAASwKKAlgAAAFeADI -BPgAAAAAFAAAAAAAAAAAAAAcAAAAAAAAAAAAAAABVS1dOAEAAIPsCAwL/GgDIA8oA5iAAAJMAAAAA -AhICsgAAACAAAwH0AAAAAAAAAU0AAADYAAAA8gA5AVMAVgJEAEYCRAA1AuQAKQKOAEAAsAArATsAZ -AE7AB4CMABVAkQAUADc/+EBEgAgANwAJQEv//sCRAApAkQAggJEADwCRAAtAkQAIQJEADkCRAArAk -QAMgJEACwCRAAxANwAJQDc/+ECRABnAkQAUAJEAEQB8wAjA1QANgJ/AB0CcwBkArsALwLFAGQCSwB -kAjcAZALGAC8C2gBkAQgAZAIgADcCYQBkAj8AZANiAGQCzgBkAuEALwJWAGQC3QAvAmsAZAJJADQC -ZAAiAqoAXgJuACADuAAaAnEAGQJFABMCTwAuATMAYgEv//sBJwAiAkQAUAH0ADIBLAApAhMAJAJjA -EoCEQAeAmcAHgIlAB4BIgAVAmcAHgJRAEoA7gA+AOn/8wIKAEoA9wBGA1cASgJRAEoCSgAeAmMASg -JnAB4BSgBKAcsAGAE5ABQCUABCAgIAAQMRAAEB4v/6AgEAAQHOABQBLwBAAPoAYAEvACECRABNA0Y -AJAItAHgBKgAcAkQAUAEsAHQAygAgAi0AOQD3ADYA9wAWAaEANgGhABYCbAAlAYMAeAGDADkA6/9q -AhsAFAIKABUB/QAVAAAAAwAAAAMAAAAcAAEAAAAAAKQAAwABAAAAHAAEAIgAAAAeABAAAwAOAH4Aq -QCrALEAtAC3ALsgGSAdICYgOiBEISL7Av//AAAAIACpAKsAsAC0ALcAuyAYIBwgJiA5IEQhIvsB// -//4/+5/7j/tP+y/7D/reBR4E/gR+A14CzfTwVxAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAEGAAABAAAAAAAAAAECAAAAAgAAAAAAAAAAAAAAAAAAAAEAAAMEBQYHCAkKCwwNDg8QERIT -FBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMT -U5PUFFSU1RVVldYWVpbXF1eX2BhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGQAAA -AAAAAAYnFmAAAAAABlAAAAAAAAAAAAAAAAAAAAAAAAAAAAY2htAAAAAAAAAABrbGlqAAAAAHAAbm9 -ycwBnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmACYAJgAmAD4AUgCCAMoBCgFO -AVwBcgGIAaYBvAHKAdYB6AH2AgwCIAJKAogCpgLWAw4DIgNkA5wDugPUA+gD/AQQBEYEogS8BPoFJ -gVSBWoFgAWwBcoF1gX6BhQGJAZMBmgGiga0BuIHGgdUB2YHkAeiB8AH3AfyCAoIHAgqCDoITghcCG -oIogjSCPoJKglYCXwJwgnqCgIKKApACl4Klgq8CtwLDAs8C1YLjAuyC9oL7gwMDCYMSAxgDKAMrAz -qDQoNTA1mDYQNoA2uDcAN2g3oDfYODA4iDkoOXA5sDnoOnA7EDvwAAAAFAAAAAAH0ArwAAwAGAAkA -DAAPAAAxESERAxMhExcRASELARETAfT6qv6syKr+jgFUqsiqArz9RAGLAP/+1P8B/v3VAP8BLP4CA -P8AAgA5//IAuQKyAAMACwAANyMDMwIyFhQGIiY0oE4MZk84JCQ4JLQB/v3AJDgkJDgAAgBWAeUBPA -LfAAMABwAAEyMnMxcjJzOmRgpagkYKWgHl+vr6AAAAAAIARgAAAf4CsgAbAB8AAAEHMxUjByM3Iwc -jNyM1MzcjNTM3MwczNzMHMxUrAQczAZgdZXEvOi9bLzovWmYdZXEvOi9bLzovWp9bHlsBn4w429vb -2ziMONvb29s4jAAAAAMANf+mAg4DDAAfACYALAAAJRQGBxUjNS4BJzMeARcRLgE0Njc1MxUeARcjJ -icVHgEBFBYXNQ4BExU+ATU0Ag5xWDpgcgRcBz41Xl9oVTpVYwpcC1ttXP6cLTQuM5szOrVRZwlOTQ -ZqVzZECAEAGlukZAlOTQdrUG8O7iNlAQgxNhDlCDj+8/YGOjReAAAAAAUAKf/yArsCvAAHAAsAFQA -dACcAABIyFhQGIiY0EyMBMwQiBhUUFjI2NTQSMhYUBiImNDYiBhUUFjI2NTR5iFBQiFCVVwHAV/5c -OiMjOiPmiFBQiFCxOiMjOiMCvFaSVlaS/ZoCsjIzMC80NC8w/uNWklZWkhozMC80NC8wAAAAAgBA/ -/ICbgLAACIALgAAARUjEQYjIiY1NDY3LgE1NDYzMhcVJiMiBhUUFhcWOwE1MxUFFBYzMjc1IyIHDg -ECbmBcYYOOVkg7R4hsQjY4Q0RNRD4SLDxW/pJUXzksPCkUUk0BgUb+zBVUZ0BkDw5RO1huCkULQzp -COAMBcHDHRz0J/AIHRQAAAAEAKwHlAIUC3wADAAATIycze0YKWgHl+gAAAAABAGT/sAEXAwwACQAA -EzMGEBcjLgE0Nt06dXU6OUBAAwzG/jDGVePs4wAAAAEAHv+wANEDDAAJAAATMx4BFAYHIzYQHjo5Q -EA5OnUDDFXj7ONVxgHQAAAAAQBVAFIB2wHbAA4AAAE3FwcXBycHJzcnNxcnMwEtmxOfcTJjYzJxnx -ObCj4BKD07KYolmZkliik7PbMAAQBQAFUB9AIlAAsAAAEjFSM1IzUzNTMVMwH0tTq1tTq1AR/Kyjj -OzgAAAAAB/+H/iACMAGQABAAANwcjNzOMWlFOXVrS3AAAAQAgAP8A8gE3AAMAABMjNTPy0tIA/zgA -AQAl//IApQByAAcAADYyFhQGIiY0STgkJDgkciQ4JCQ4AAAAAf/7/+IBNALQAAMAABcjEzM5Pvs+H -gLuAAAAAAIAKf/yAhsCwAADAAcAABIgECA2IBAgKQHy/g5gATL+zgLA/TJEAkYAAAAAAQCCAAABlg -KyAAgAAAERIxEHNTc2MwGWVr6SIygCsv1OAldxW1sWAAEAPAAAAg4CwAAZAAA3IRUhNRM+ATU0JiM -iDwEjNz4BMzIWFRQGB7kBUv4x+kI2QTt+EAFWAQp8aGVtSl5GRjEA/0RVLzlLmAoKa3FsUkNxXQAA -AAEALf/yAhYCwAAqAAABHgEVFAYjIi8BMxceATMyNjU0KwE1MzI2NTQmIyIGDwEjNz4BMzIWFRQGA -YxBSZJo2RUBVgEHV0JBUaQREUBUQzc5TQcBVgEKfGhfcEMBbxJbQl1x0AoKRkZHPn9GSD80QUVCCg -pfbGBPOlgAAAACACEAAAIkArIACgAPAAAlIxUjNSE1ATMRMyMRBg8BAiRXVv6qAVZWV60dHLCurq4 -rAdn+QgFLMibzAAABADn/8gIZArIAHQAAATIWFRQGIyIvATMXFjMyNjU0JiMiByMTIRUhBzc2ATNv -d5Fl1RQBVgIad0VSTkVhL1IwAYj+vh8rMAHHgGdtgcUKCoFXTU5bYgGRRvAuHQAAAAACACv/8gITA -sAAFwAjAAABMhYVFAYjIhE0NjMyFh8BIycmIyIDNzYTMjY1NCYjIgYVFBYBLmp7imr0l3RZdAgBXA -IYZ5wKJzU6QVNJSz5SUAHSgWltiQFGxcNlVQoKdv7sPiz+ZF1LTmJbU0lhAAAAAQAyAAACGgKyAAY -AAAEVASMBITUCGv6oXAFL/oECsij9dgJsRgAAAAMALP/xAhgCwAAWACAALAAAAR4BFRQGIyImNTQ2 -Ny4BNTQ2MhYVFAYmIgYVFBYyNjU0AzI2NTQmIyIGFRQWAZQ5S5BmbIpPOjA7ecp5P2F8Q0J8RIVJS -0pLTEtOAW0TXTxpZ2ZqPF0SE1A3VWVlVTdQ/UU0N0RENzT9/ko+Ok1NOj1LAAIAMf/yAhkCwAAXAC -MAAAEyERQGIyImLwEzFxYzMhMHBiMiJjU0NhMyNjU0JiMiBhUUFgEl9Jd0WXQIAVwCGGecCic1SWp -7imo+UlBAQVNJAsD+usXDZVUKCnYBFD4sgWltif5kW1NJYV1LTmIAAAACACX/8gClAiAABwAPAAAS -MhYUBiImNBIyFhQGIiY0STgkJDgkJDgkJDgkAiAkOCQkOP52JDgkJDgAAAAC/+H/iAClAiAABwAMA -AASMhYUBiImNBMHIzczSTgkJDgkaFpSTl4CICQ4JCQ4/mba5gAAAQBnAB4B+AH0AAYAAAENARUlNS -UB+P6qAVb+bwGRAbCmpkbJRMkAAAIAUAC7AfQBuwADAAcAAAEhNSERITUhAfT+XAGk/lwBpAGDOP8 -AOAABAEQAHgHVAfQABgAAARUFNS0BNQHV/m8BVv6qAStEyUSmpkYAAAAAAgAj//IB1ALAABgAIAAA -ATIWFRQHDgEHIz4BNz4BNTQmIyIGByM+ARIyFhQGIiY0AQRibmktIAJWBSEqNig+NTlHBFoDezQ4J -CQ4JALAZ1BjaS03JS1DMD5LLDQ/SUVgcv2yJDgkJDgAAAAAAgA2/5gDFgKYADYAQgAAAQMGFRQzMj -Y1NCYjIg4CFRQWMzI2NxcGIyImNTQ+AjMyFhUUBiMiJwcGIyImNTQ2MzIfATcHNzYmIyIGFRQzMjY -Cej8EJjJJlnBAfGQ+oHtAhjUYg5OPx0h2k06Os3xRWQsVLjY5VHtdPBwJETcJDyUoOkZEJz8B0f74 -EQ8kZl6EkTFZjVOLlyknMVm1pmCiaTq4lX6CSCknTVRmmR8wPdYnQzxuSWVGAAIAHQAAAncCsgAHA -AoAACUjByMTMxMjATMDAcj+UVz4dO5d/sjPZPT0ArL9TgE6ATQAAAADAGQAAAJMArIAEAAbACcAAA -EeARUUBgcGKwERMzIXFhUUJRUzMjc2NTQnJiMTPgE1NCcmKwEVMzIBvkdHZkwiNt7LOSGq/oeFHBt -hahIlSTM+cB8Yj5UWAW8QT0VYYgwFArIEF5Fv1eMED2NfDAL93AU+N24PBP0AAAAAAQAv//ICjwLA -ABsAAAEyFh8BIycmIyIGFRQWMzI/ATMHDgEjIiY1NDYBdX+PCwFWAiKiaHx5ZaIiAlYBCpWBk6a0A -sCAagoKpqN/gaOmCgplhcicn8sAAAIAZAAAAp8CsgAMABkAAAEeARUUBgcGKwERMzITPgE1NCYnJi -sBETMyAY59lJp8IzXN0jUVWmdjWRs5d3I4Aq4QqJWUug8EArL9mQ+PeHGHDgX92gAAAAABAGQAAAI -vArIACwAAJRUhESEVIRUhFSEVAi/+NQHB/pUBTf6zRkYCskbwRvAAAAABAGQAAAIlArIACQAAExUh -FSERIxEhFboBQ/69VgHBAmzwRv7KArJGAAAAAAEAL//yAo8CwAAfAAABMxEjNQcGIyImNTQ2MzIWH -wEjJyYjIgYVFBYzMjY1IwGP90wfPnWTprSSf48LAVYCIqJofHllVG+hAU3+s3hARsicn8uAagoKpq -N/gaN1XAAAAAEAZAAAAowCsgALAAABESMRIREjETMRIRECjFb+hFZWAXwCsv1OAS7+0gKy/sQBPAA -AAAABAGQAAAC6ArIAAwAAMyMRM7pWVgKyAAABADf/8gHoArIAEwAAAREUBw4BIyImLwEzFxYzMjc2 -NREB6AIFcGpgbQIBVgIHfXQKAQKy/lYxIltob2EpKYyEFD0BpwAAAAABAGQAAAJ0ArIACwAACQEjA -wcVIxEzEQEzATsBJ3ntQlZWAVVlAWH+nwEnR+ACsv6RAW8AAQBkAAACLwKyAAUAACUVIREzEQIv/j -VWRkYCsv2UAAABAGQAAAMUArIAFAAAAREjETQ3BgcDIwMmJxYVESMRMxsBAxRWAiMxemx8NxsCVo7 -MywKy/U4BY7ZLco7+nAFmoFxLtP6dArL9lwJpAAAAAAEAZAAAAoACsgANAAAhIwEWFREjETMBJjUR -MwKAhP67A1aEAUUDVAJeeov+pwKy/aJ5jAFZAAAAAgAv//ICuwLAAAkAEwAAEiAWFRQGICY1NBIyN -jU0JiIGFRTbATSsrP7MrNrYenrYegLAxaKhxsahov47nIeIm5uIhwACAGQAAAJHArIADgAYAAABHg -EVFAYHBisBESMRMzITNjQnJisBETMyAZRUX2VOHzuAVtY7GlxcGDWIiDUCrgtnVlVpCgT+5gKy/rU -V1BUF/vgAAAACAC//zAK9AsAAEgAcAAAlFhcHJiMiBwYjIiY1NDYgFhUUJRQWMjY1NCYiBgI9PUMx -UDcfKh8omqysATSs/dR62Hp62HpICTg7NgkHxqGixcWitbWHnJyHiJubAAIAZAAAAlgCsgAXACMAA -CUWFyMmJyYnJisBESMRMzIXHgEVFAYHFiUzMjc+ATU0JyYrAQIqDCJfGQwNWhAhglbiOx9QXEY1Tv -6bhDATMj1lGSyMtYgtOXR0BwH+1wKyBApbU0BSESRAAgVAOGoQBAABADT/8gIoAsAAJQAAATIWFyM -uASMiBhUUFhceARUUBiMiJiczHgEzMjY1NCYnLgE1NDYBOmd2ClwGS0E6SUNRdW+HZnKKC1wPWkQ9 -Uk1cZGuEAsBwXUJHNjQ3OhIbZVZZbm5kREo+NT5DFRdYUFdrAAAAAAEAIgAAAmQCsgAHAAABIxEjE -SM1IQJk9lb2AkICbP2UAmxGAAEAXv/yAmQCsgAXAAABERQHDgEiJicmNREzERQXHgEyNjc2NRECZA -IIgfCBCAJWAgZYmlgGAgKy/k0qFFxzc1wUKgGz/lUrEkRQUEQSKwGrAAAAAAEAIAAAAnoCsgAGAAA -hIwMzGwEzAYJ07l3N1FwCsv2PAnEAAAEAGgAAA7ECsgAMAAABAyMLASMDMxsBMxsBA7HAcZyicrZi -kaB0nJkCsv1OAlP9rQKy/ZsCW/2kAmYAAAEAGQAAAm8CsgALAAAhCwEjEwMzGwEzAxMCCsrEY/bkY -re+Y/D6AST+3AFcAVb+5gEa/q3+oQAAAQATAAACUQKyAAgAAAERIxEDMxsBMwFdVvRjwLphARD+8A -EQAaL+sQFPAAABAC4AAAI5ArIACQAAJRUhNQEhNSEVAQI5/fUBof57Aen+YUZGQgIqRkX92QAAAAA -BAGL/sAEFAwwABwAAARUjETMVIxEBBWlpowMMOP0UOANcAAAB//v/4gE0AtAAAwAABSMDMwE0Pvs+ -HgLuAAAAAQAi/7AAxQMMAAcAABcjNTMRIzUzxaNpaaNQOALsOAABAFAA1wH0AmgABgAAJQsBIxMzE -wGwjY1GsESw1wFZ/qcBkf5vAAAAAQAy/6oBwv/iAAMAAAUhNSEBwv5wAZBWOAAAAAEAKQJEALYCsg -ADAAATIycztjhVUAJEbgAAAAACACT/8gHQAiAAHQAlAAAhJwcGIyImNTQ2OwE1NCcmIyIHIz4BMzI -XFh0BFBcnMjY9ASYVFAF6CR0wVUtgkJoiAgdgaQlaBm1Zrg4DCuQ9R+5MOSFQR1tbDiwUUXBUXowf -J8c9SjRORzYSgVwAAAAAAgBK//ICRQLfABEAHgAAATIWFRQGIyImLwEVIxEzETc2EzI2NTQmIyIGH -QEUFgFUcYCVbiNJEyNWVigySElcU01JXmECIJd4i5QTEDRJAt/+3jkq/hRuZV55ZWsdX14AAQAe// -IB9wIgABgAAAEyFhcjJiMiBhUUFjMyNjczDgEjIiY1NDYBF152DFocbEJXU0A1Rw1aE3pbaoKQAiB -oWH5qZm1tPDlaXYuLgZcAAAACAB7/8gIZAt8AEQAeAAABESM1BwYjIiY1NDYzMhYfAREDMjY9ATQm -IyIGFRQWAhlWKDJacYCVbiNJEyOnSV5hQUlcUwLf/SFVOSqXeIuUExA0ARb9VWVrHV9ebmVeeQACA -B7/8gH9AiAAFQAbAAABFAchHgEzMjY3Mw4BIyImNTQ2MzIWJyIGByEmAf0C/oAGUkA1SwlaD4FXbI -WObmt45UBVBwEqDQEYFhNjWD84W16Oh3+akU9aU60AAAEAFQAAARoC8gAWAAATBh0BMxUjESMRIzU -zNTQ3PgEzMhcVJqcDbW1WOTkDB0k8Hx5oAngVITRC/jQBzEIsJRs5PwVHEwAAAAIAHv8uAhkCIAAi -AC8AAAERFAcOASMiLwEzFx4BMzI2NzY9AQcGIyImNTQ2MzIWHwE1AzI2PQE0JiMiBhUUFgIZAQSEd -NwRAVcBBU5DTlUDASgyWnGAlW4jSRMjp0leYUFJXFMCEv5wSh1zeq8KCTI8VU0ZIQk5Kpd4i5QTED -RJ/iJlax1fXm5lXnkAAQBKAAACCgLkABcAAAEWFREjETQnLgEHDgEdASMRMxE3NjMyFgIIAlYCBDs -6RVRWViE5UVViAYUbQP7WASQxGzI7AQJyf+kC5P7TPSxUAAACAD4AAACsAsAABwALAAASMhYUBiIm -NBMjETNeLiAgLiBiVlYCwCAuICAu/WACEgAC//P/LgCnAsAABwAVAAASMhYUBiImNBcRFAcGIyInN -RY3NjURWS4gIC4gYgMLcRwNSgYCAsAgLiAgLo79wCUbZAJGBzMOHgJEAAAAAQBKAAACCALfAAsAAC -EnBxUjETMREzMHEwGTwTJWVvdu9/rgN6kC3/4oAQv6/ugAAQBG//wA3gLfAA8AABMRFBceATcVBiM -iJicmNRGcAQIcIxkkKi4CAQLf/bkhERoSBD4EJC8SNAJKAAAAAQBKAAADEAIgACQAAAEWFREjETQn -JiMiFREjETQnJiMiFREjETMVNzYzMhYXNzYzMhYDCwVWBAxedFYEDF50VlYiJko7ThAvJkpEVAGfI -jn+vAEcQyRZ1v76ARxDJFnW/voCEk08HzYtRB9HAAAAAAEASgAAAgoCIAAWAAABFhURIxE0JyYjIg -YdASMRMxU3NjMyFgIIAlYCCXBEVVZWITlRVWIBhRtA/tYBJDEbbHR/6QISWz0sVAAAAAACAB7/8gI -sAiAABwARAAASIBYUBiAmNBIyNjU0JiIGFRSlAQCHh/8Ah7ieWlqeWgIgn/Cfn/D+s3ZfYHV1YF8A -AgBK/zwCRQIgABEAHgAAATIWFRQGIyImLwERIxEzFTc2EzI2NTQmIyIGHQEUFgFUcYCVbiNJEyNWV -igySElcU01JXmECIJd4i5QTEDT+8wLWVTkq/hRuZV55ZWsdX14AAgAe/zwCGQIgABEAHgAAAREjEQ -cGIyImNTQ2MzIWHwE1AzI2PQE0JiMiBhUUFgIZVigyWnGAlW4jSRMjp0leYUFJXFMCEv0qARk5Kpd -4i5QTEDRJ/iJlax1fXm5lXnkAAQBKAAABPgIeAA0AAAEyFxUmBhURIxEzFTc2ARoWDkdXVlYwIwIe -B0EFVlf+0gISU0cYAAEAGP/yAa0CIAAjAAATMhYXIyYjIgYVFBYXHgEVFAYjIiYnMxYzMjY1NCYnL -gE1NDbkV2MJWhNdKy04PF1XbVhWbgxaE2ktOjlEUllkAiBaS2MrJCUoEBlPQkhOVFZoKCUmLhIWSE -BIUwAAAAEAFP/4ARQCiQAXAAATERQXHgE3FQYjIiYnJjURIzUzNTMVMxWxAQMmMx8qMjMEAUdHVmM -BzP7PGw4mFgY/BSwxDjQBNUJ7e0IAAAABAEL/8gICAhIAFwAAAREjNQcGIyImJyY1ETMRFBceATMy -Nj0BAgJWITlRT2EKBVYEBkA1RFECEv3uWj4qTToiOQE+/tIlJC43c4DpAAAAAAEAAQAAAfwCEgAGA -AABAyMDMxsBAfzJaclfop8CEv3uAhL+LQHTAAABAAEAAAMLAhIADAAAAQMjCwEjAzMbATMbAQMLqW -Z2dmapY3t0a3Z7AhL97gG+/kICEv5AAcD+QwG9AAAB//oAAAHWAhIACwAAARMjJwcjEwMzFzczARq -8ZIuKY763ZoWFYwEO/vLV1QEMAQbNzQAAAQAB/y4B+wISABEAAAEDDgEjIic1FjMyNj8BAzMbAQH7 -2iFZQB8NDRIpNhQH02GenQIS/cFVUAJGASozEwIt/i4B0gABABQAAAGxAg4ACQAAJRUhNQEhNSEVA -QGx/mMBNP7iAYL+zkREQgGIREX+ewAAAAABAED/sAEOAwwALAAAASMiBhUUFxYVFAYHHgEVFAcGFR -QWOwEVIyImNTQ3NjU0JzU2NTQnJjU0NjsBAQ4MKiMLDS4pKS4NCyMqDAtERAwLUlILDERECwLUGBk -WTlsgKzUFBTcrIFtOFhkYOC87GFVMIkUIOAhFIkxVGDsvAAAAAAEAYP84AJoDIAADAAAXIxEzmjo6 -yAPoAAEAIf+wAO8DDAAsAAATFQYVFBcWFRQGKwE1MzI2NTQnJjU0NjcuATU0NzY1NCYrATUzMhYVF -AcGFRTvUgsMREQLDCojCw0uKSkuDQsjKgwLREQMCwF6OAhFIkxVGDsvOBgZFk5bICs1BQU3KyBbTh -YZGDgvOxhVTCJFAAABAE0A3wH2AWQAEwAAATMUIyImJyYjIhUjNDMyFhcWMzIBvjhuGywtQR0xOG4 -bLC1BHTEBZIURGCNMhREYIwAAAwAk/94DIgLoAAcAEQApAAAAIBYQBiAmECQgBhUUFiA2NTQlMhYX -IyYjIgYUFjMyNjczDgEjIiY1NDYBAQFE3d3+vN0CB/7wubkBELn+xVBnD1wSWDo+QTcqOQZcEmZWX -HN2Aujg/rbg4AFKpr+Mjb6+jYxbWEldV5ZZNShLVn5na34AAgB4AFIB9AGeAAUACwAAAQcXIyc3Mw -cXIyc3AUqJiUmJifOJiUmJiQGepqampqampqYAAAIAHAHSAQ4CwAAHAA8AABIyFhQGIiY0NiIGFBY -yNjRgakREakSTNCEhNCECwEJqQkJqCiM4IyM4AAAAAAIAUAAAAfQCCwALAA8AAAEzFSMVIzUjNTM1 -MxMhNSEBP7W1OrW1OrX+XAGkAVs4tLQ4sP31OAAAAQB0AkQBAQKyAAMAABMjNzOsOD1QAkRuAAAAA -AEAIADsAKoBdgAHAAASMhYUBiImNEg6KCg6KAF2KDooKDoAAAIAOQBSAbUBngAFAAsAACUHIzcnMw -UHIzcnMwELiUmJiUkBM4lJiYlJ+KampqampqYAAAABADYB5QDhAt8ABAAAEzczByM2Xk1OXQHv8Po -AAQAWAeUAwQLfAAQAABMHIzczwV5NTl0C1fD6AAIANgHlAYsC3wAEAAkAABM3MwcjPwEzByM2Xk1O -XapeTU5dAe/w+grw+gAAAgAWAeUBawLfAAQACQAAEwcjNzMXByM3M8FeTU5dql5NTl0C1fD6CvD6A -AADACX/8gI1AHIABwAPABcAADYyFhQGIiY0NjIWFAYiJjQ2MhYUBiImNEk4JCQ4JOw4JCQ4JOw4JC -Q4JHIkOCQkOCQkOCQkOCQkOCQkOAAAAAEAeABSAUoBngAFAAABBxcjJzcBSomJSYmJAZ6mpqamAAA -AAAEAOQBSAQsBngAFAAAlByM3JzMBC4lJiYlJ+KampgAAAf9qAAABgQKyAAMAACsBATM/VwHAVwKy -AAAAAAIAFAHIAdwClAAHABQAABMVIxUjNSM1BRUjNwcjJxcjNTMXN9pKMkoByDICKzQqATJLKysCl -CmjoykBy46KiY3Lm5sAAQAVAAABvALyABgAAAERIxEjESMRIzUzNTQ3NjMyFxUmBgcGHQEBvFbCVj -k5AxHHHx5iVgcDAg798gHM/jQBzEIOJRuWBUcIJDAVIRYAAAABABX//AHkAvIAJQAAJR4BNxUGIyI -mJyY1ESYjIgcGHQEzFSMRIxEjNTM1NDc2MzIXERQBowIcIxkkKi4CAR4nXgwDbW1WLy8DEbNdOmYa -EQQ/BCQvEjQCFQZWFSEWQv40AcxCDiUblhP9uSEAAAAAAAAWAQ4AAQAAAAAAAAATACgAAQAAAAAAA -QAHAEwAAQAAAAAAAgAHAGQAAQAAAAAAAwAaAKIAAQAAAAAABAAHAM0AAQAAAAAABQA8AU8AAQAAAA -AABgAPAawAAQAAAAAACAALAdQAAQAAAAAACQALAfgAAQAAAAAACwAXAjQAAQAAAAAADAAXAnwAAwA -BBAkAAAAmAAAAAwABBAkAAQAOADwAAwABBAkAAgAOAFQAAwABBAkAAwA0AGwAAwABBAkABAAOAL0A -AwABBAkABQB4ANUAAwABBAkABgAeAYwAAwABBAkACAAWAbwAAwABBAkACQAWAeAAAwABBAkACwAuA -gQAAwABBAkADAAuAkwATgBvACAAUgBpAGcAaAB0AHMAIABSAGUAcwBlAHIAdgBlAGQALgAATm8gUm -lnaHRzIFJlc2VydmVkLgAAQQBpAGwAZQByAG8AbgAAQWlsZXJvbgAAUgBlAGcAdQBsAGEAcgAAUmV -ndWxhcgAAMQAuADEAMAAyADsAVQBLAFcATgA7AEEAaQBsAGUAcgBvAG4ALQBSAGUAZwB1AGwAYQBy -AAAxLjEwMjtVS1dOO0FpbGVyb24tUmVndWxhcgAAQQBpAGwAZQByAG8AbgAAQWlsZXJvbgAAVgBlA -HIAcwBpAG8AbgAgADEALgAxADAAMgA7AFAAUwAgADAAMAAxAC4AMQAwADIAOwBoAG8AdABjAG8Abg -B2ACAAMQAuADAALgA3ADAAOwBtAGEAawBlAG8AdABmAC4AbABpAGIAMgAuADUALgA1ADgAMwAyADk -AAFZlcnNpb24gMS4xMDI7UFMgMDAxLjEwMjtob3Rjb252IDEuMC43MDttYWtlb3RmLmxpYjIuNS41 -ODMyOQAAQQBpAGwAZQByAG8AbgAtAFIAZQBnAHUAbABhAHIAAEFpbGVyb24tUmVndWxhcgAAUwBvA -HIAYQAgAFMAYQBnAGEAbgBvAABTb3JhIFNhZ2FubwAAUwBvAHIAYQAgAFMAYQBnAGEAbgBvAABTb3 -JhIFNhZ2FubwAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGQAbwB0AGMAbwBsAG8AbgAuAG4AZQB0AAB -odHRwOi8vd3d3LmRvdGNvbG9uLm5ldAAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGQAbwB0AGMAbwBs -AG8AbgAuAG4AZQB0AABodHRwOi8vd3d3LmRvdGNvbG9uLm5ldAAAAAACAAAAAAAA/4MAMgAAAAAAA -AAAAAAAAAAAAAAAAAAAAHQAAAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATAB -QAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAA -xADIAMwA0ADUANgA3ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0A -TgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYABhAIsAqQCDAJMAjQDDAKoAtgC3A -LQAtQCrAL4AvwC8AIwAwADBAAAAAAAB//8AAgABAAAADAAAABwAAAACAAIAAwBxAAEAcgBzAAIABA -AAAAIAAAABAAAACgBMAGYAAkRGTFQADmxhdG4AGgAEAAAAAP//AAEAAAAWAANDQVQgAB5NT0wgABZ -ST00gABYAAP//AAEAAAAA//8AAgAAAAEAAmxpZ2EADmxvY2wAFAAAAAEAAQAAAAEAAAACAAYAEAAG -AAAAAgASADQABAAAAAEATAADAAAAAgAQABYAAQAcAAAAAQABAE8AAQABAGcAAQABAE8AAwAAAAIAE -AAWAAEAHAAAAAEAAQAvAAEAAQBnAAEAAQAvAAEAGgABAAgAAgAGAAwAcwACAE8AcgACAEwAAQABAE -kAAAABAAAACgBGAGAAAkRGTFQADmxhdG4AHAAEAAAAAP//AAIAAAABABYAA0NBVCAAFk1PTCAAFlJ -PTSAAFgAA//8AAgAAAAEAAmNwc3AADmtlcm4AFAAAAAEAAAAAAAEAAQACAAYADgABAAAAAQASAAIA -AAACAB4ANgABAAoABQAFAAoAAgABACQAPQAAAAEAEgAEAAAAAQAMAAEAOP/nAAEAAQAkAAIGigAEA -AAFJAXKABoAGQAA//gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAD/sv+4/+z/7v/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAD/xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/9T/6AAAAAD/8QAA -ABD/vQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/7gAAAAAAAAAAAAAAAAAA//MAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAP/5AAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/gAAD/4AAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//L/9AAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAA/+gAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/zAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/mAAAAAAAAAAAAAAAAAAD -/4gAA//AAAAAA//YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+AAAAAAAAP/OAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/zv/qAAAAAP/0AAAACAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/ZAAD/egAA/1kAAAAA/5D/rgAAAAAAAAAAAA -AAAAAAAAAAAAAAAAD/9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAD/8AAA/7b/8P+wAAD/8P/E/98AAAAA/8P/+P/0//oAAAAAAAAAAAAA//gA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+AAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/w//C/9MAAP/SAAD/9wAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAD/yAAA/+kAAAAA//QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/9wAAAAD//QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAP/2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAP/cAAAAAAAAAAAAAAAA/7YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAP/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/6AAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAkAFAAEAAAAAQACwAAABcA -BgAAAAAAAAAIAA4AAAAAAAsAEgAAAAAAAAATABkAAwANAAAAAQAJAAAAAAAAAAAAAAAAAAAAGAAAA -AAABwAAAAAAAAAAAAAAFQAFAAAAAAAYABgAAAAUAAAACgAAAAwAAgAPABEAFgAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAEAEQBdAAYAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAcAAAAAAAAABwAAAAAACAAAAAAAAAAAAAcAAAAHAAAAEwAJ -ABUADgAPAAAACwAQAAAAAAAAAAAAAAAAAAUAGAACAAIAAgAAAAIAGAAXAAAAGAAAABYAFgACABYAA -gAWAAAAEQADAAoAFAAMAA0ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAEgAGAAEAHgAkAC -YAJwApACoALQAuAC8AMgAzADcAOAA5ADoAPAA9AEUASABOAE8AUgBTAFUAVwBZAFoAWwBcAF0AcwA -AAAAAAQAAAADa3tfFAAAAANAan9kAAAAA4QodoQ== -""" - ) - ), - 10 if size is None else size, - layout_engine=Layout.BASIC, - ) - return load_default_imagefont() diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageGrab.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageGrab.py deleted file mode 100644 index 1eb4507..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageGrab.py +++ /dev/null @@ -1,196 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# screen grabber -# -# History: -# 2001-04-26 fl created -# 2001-09-17 fl use builtin driver, if present -# 2002-11-19 fl added grabclipboard support -# -# Copyright (c) 2001-2002 by Secret Labs AB -# Copyright (c) 2001-2002 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -import os -import shutil -import subprocess -import sys -import tempfile - -from . import Image - -TYPE_CHECKING = False -if TYPE_CHECKING: - from . import ImageWin - - -def grab( - bbox: tuple[int, int, int, int] | None = None, - include_layered_windows: bool = False, - all_screens: bool = False, - xdisplay: str | None = None, - window: int | ImageWin.HWND | None = None, -) -> Image.Image: - im: Image.Image - if xdisplay is None: - if sys.platform == "darwin": - fh, filepath = tempfile.mkstemp(".png") - os.close(fh) - args = ["screencapture"] - if bbox: - left, top, right, bottom = bbox - args += ["-R", f"{left},{top},{right-left},{bottom-top}"] - subprocess.call(args + ["-x", filepath]) - im = Image.open(filepath) - im.load() - os.unlink(filepath) - if bbox: - im_resized = im.resize((right - left, bottom - top)) - im.close() - return im_resized - return im - elif sys.platform == "win32": - if window is not None: - all_screens = -1 - offset, size, data = Image.core.grabscreen_win32( - include_layered_windows, - all_screens, - int(window) if window is not None else 0, - ) - im = Image.frombytes( - "RGB", - size, - data, - # RGB, 32-bit line padding, origin lower left corner - "raw", - "BGR", - (size[0] * 3 + 3) & -4, - -1, - ) - if bbox: - x0, y0 = offset - left, top, right, bottom = bbox - im = im.crop((left - x0, top - y0, right - x0, bottom - y0)) - return im - # Cast to Optional[str] needed for Windows and macOS. - display_name: str | None = xdisplay - try: - if not Image.core.HAVE_XCB: - msg = "Pillow was built without XCB support" - raise OSError(msg) - size, data = Image.core.grabscreen_x11(display_name) - except OSError: - if display_name is None and sys.platform not in ("darwin", "win32"): - if shutil.which("gnome-screenshot"): - args = ["gnome-screenshot", "-f"] - elif shutil.which("grim"): - args = ["grim"] - elif shutil.which("spectacle"): - args = ["spectacle", "-n", "-b", "-f", "-o"] - else: - raise - fh, filepath = tempfile.mkstemp(".png") - os.close(fh) - subprocess.call(args + [filepath]) - im = Image.open(filepath) - im.load() - os.unlink(filepath) - if bbox: - im_cropped = im.crop(bbox) - im.close() - return im_cropped - return im - else: - raise - else: - im = Image.frombytes("RGB", size, data, "raw", "BGRX", size[0] * 4, 1) - if bbox: - im = im.crop(bbox) - return im - - -def grabclipboard() -> Image.Image | list[str] | None: - if sys.platform == "darwin": - p = subprocess.run( - ["osascript", "-e", "get the clipboard as «class PNGf»"], - capture_output=True, - ) - if p.returncode != 0: - return None - - import binascii - - data = io.BytesIO(binascii.unhexlify(p.stdout[11:-3])) - return Image.open(data) - elif sys.platform == "win32": - fmt, data = Image.core.grabclipboard_win32() - if fmt == "file": # CF_HDROP - import struct - - o = struct.unpack_from("I", data)[0] - if data[16] == 0: - files = data[o:].decode("mbcs").split("\0") - else: - files = data[o:].decode("utf-16le").split("\0") - return files[: files.index("")] - if isinstance(data, bytes): - data = io.BytesIO(data) - if fmt == "png": - from . import PngImagePlugin - - return PngImagePlugin.PngImageFile(data) - elif fmt == "DIB": - from . import BmpImagePlugin - - return BmpImagePlugin.DibImageFile(data) - return None - else: - if os.getenv("WAYLAND_DISPLAY"): - session_type = "wayland" - elif os.getenv("DISPLAY"): - session_type = "x11" - else: # Session type check failed - session_type = None - - if shutil.which("wl-paste") and session_type in ("wayland", None): - args = ["wl-paste", "-t", "image"] - elif shutil.which("xclip") and session_type in ("x11", None): - args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"] - else: - msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux" - raise NotImplementedError(msg) - - p = subprocess.run(args, capture_output=True) - if p.returncode != 0: - err = p.stderr - for silent_error in [ - # wl-paste, when the clipboard is empty - b"Nothing is copied", - # Ubuntu/Debian wl-paste, when the clipboard is empty - b"No selection", - # Ubuntu/Debian wl-paste, when an image isn't available - b"No suitable type of content copied", - # wl-paste or Ubuntu/Debian xclip, when an image isn't available - b" not available", - # xclip, when an image isn't available - b"cannot convert ", - # xclip, when the clipboard isn't initialized - b"xclip: Error: There is no owner for the ", - ]: - if silent_error in err: - return None - msg = f"{args[0]} error" - if err: - msg += f": {err.strip().decode()}" - raise ChildProcessError(msg) - - data = io.BytesIO(p.stdout) - im = Image.open(data) - im.load() - return im diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageMath.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageMath.py deleted file mode 100644 index c33809c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageMath.py +++ /dev/null @@ -1,368 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# a simple math add-on for the Python Imaging Library -# -# History: -# 1999-02-15 fl Original PIL Plus release -# 2005-05-05 fl Simplified and cleaned up for PIL 1.1.6 -# 2005-09-12 fl Fixed int() and float() for Python 2.4.1 -# -# Copyright (c) 1999-2005 by Secret Labs AB -# Copyright (c) 2005 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import builtins -from types import CodeType -from typing import Any, Callable - -from . import Image, _imagingmath -from ._deprecate import deprecate - - -class _Operand: - """Wraps an image operand, providing standard operators""" - - def __init__(self, im: Image.Image): - self.im = im - - def __fixup(self, im1: _Operand | float) -> Image.Image: - # convert image to suitable mode - if isinstance(im1, _Operand): - # argument was an image. - if im1.im.mode in ("1", "L"): - return im1.im.convert("I") - elif im1.im.mode in ("I", "F"): - return im1.im - else: - msg = f"unsupported mode: {im1.im.mode}" - raise ValueError(msg) - else: - # argument was a constant - if isinstance(im1, (int, float)) and self.im.mode in ("1", "L", "I"): - return Image.new("I", self.im.size, im1) - else: - return Image.new("F", self.im.size, im1) - - def apply( - self, - op: str, - im1: _Operand | float, - im2: _Operand | float | None = None, - mode: str | None = None, - ) -> _Operand: - im_1 = self.__fixup(im1) - if im2 is None: - # unary operation - out = Image.new(mode or im_1.mode, im_1.size, None) - try: - op = getattr(_imagingmath, f"{op}_{im_1.mode}") - except AttributeError as e: - msg = f"bad operand type for '{op}'" - raise TypeError(msg) from e - _imagingmath.unop(op, out.getim(), im_1.getim()) - else: - # binary operation - im_2 = self.__fixup(im2) - if im_1.mode != im_2.mode: - # convert both arguments to floating point - if im_1.mode != "F": - im_1 = im_1.convert("F") - if im_2.mode != "F": - im_2 = im_2.convert("F") - if im_1.size != im_2.size: - # crop both arguments to a common size - size = ( - min(im_1.size[0], im_2.size[0]), - min(im_1.size[1], im_2.size[1]), - ) - if im_1.size != size: - im_1 = im_1.crop((0, 0) + size) - if im_2.size != size: - im_2 = im_2.crop((0, 0) + size) - out = Image.new(mode or im_1.mode, im_1.size, None) - try: - op = getattr(_imagingmath, f"{op}_{im_1.mode}") - except AttributeError as e: - msg = f"bad operand type for '{op}'" - raise TypeError(msg) from e - _imagingmath.binop(op, out.getim(), im_1.getim(), im_2.getim()) - return _Operand(out) - - # unary operators - def __bool__(self) -> bool: - # an image is "true" if it contains at least one non-zero pixel - return self.im.getbbox() is not None - - def __abs__(self) -> _Operand: - return self.apply("abs", self) - - def __pos__(self) -> _Operand: - return self - - def __neg__(self) -> _Operand: - return self.apply("neg", self) - - # binary operators - def __add__(self, other: _Operand | float) -> _Operand: - return self.apply("add", self, other) - - def __radd__(self, other: _Operand | float) -> _Operand: - return self.apply("add", other, self) - - def __sub__(self, other: _Operand | float) -> _Operand: - return self.apply("sub", self, other) - - def __rsub__(self, other: _Operand | float) -> _Operand: - return self.apply("sub", other, self) - - def __mul__(self, other: _Operand | float) -> _Operand: - return self.apply("mul", self, other) - - def __rmul__(self, other: _Operand | float) -> _Operand: - return self.apply("mul", other, self) - - def __truediv__(self, other: _Operand | float) -> _Operand: - return self.apply("div", self, other) - - def __rtruediv__(self, other: _Operand | float) -> _Operand: - return self.apply("div", other, self) - - def __mod__(self, other: _Operand | float) -> _Operand: - return self.apply("mod", self, other) - - def __rmod__(self, other: _Operand | float) -> _Operand: - return self.apply("mod", other, self) - - def __pow__(self, other: _Operand | float) -> _Operand: - return self.apply("pow", self, other) - - def __rpow__(self, other: _Operand | float) -> _Operand: - return self.apply("pow", other, self) - - # bitwise - def __invert__(self) -> _Operand: - return self.apply("invert", self) - - def __and__(self, other: _Operand | float) -> _Operand: - return self.apply("and", self, other) - - def __rand__(self, other: _Operand | float) -> _Operand: - return self.apply("and", other, self) - - def __or__(self, other: _Operand | float) -> _Operand: - return self.apply("or", self, other) - - def __ror__(self, other: _Operand | float) -> _Operand: - return self.apply("or", other, self) - - def __xor__(self, other: _Operand | float) -> _Operand: - return self.apply("xor", self, other) - - def __rxor__(self, other: _Operand | float) -> _Operand: - return self.apply("xor", other, self) - - def __lshift__(self, other: _Operand | float) -> _Operand: - return self.apply("lshift", self, other) - - def __rshift__(self, other: _Operand | float) -> _Operand: - return self.apply("rshift", self, other) - - # logical - def __eq__(self, other: _Operand | float) -> _Operand: # type: ignore[override] - return self.apply("eq", self, other) - - def __ne__(self, other: _Operand | float) -> _Operand: # type: ignore[override] - return self.apply("ne", self, other) - - def __lt__(self, other: _Operand | float) -> _Operand: - return self.apply("lt", self, other) - - def __le__(self, other: _Operand | float) -> _Operand: - return self.apply("le", self, other) - - def __gt__(self, other: _Operand | float) -> _Operand: - return self.apply("gt", self, other) - - def __ge__(self, other: _Operand | float) -> _Operand: - return self.apply("ge", self, other) - - -# conversions -def imagemath_int(self: _Operand) -> _Operand: - return _Operand(self.im.convert("I")) - - -def imagemath_float(self: _Operand) -> _Operand: - return _Operand(self.im.convert("F")) - - -# logical -def imagemath_equal(self: _Operand, other: _Operand | float | None) -> _Operand: - return self.apply("eq", self, other, mode="I") - - -def imagemath_notequal(self: _Operand, other: _Operand | float | None) -> _Operand: - return self.apply("ne", self, other, mode="I") - - -def imagemath_min(self: _Operand, other: _Operand | float | None) -> _Operand: - return self.apply("min", self, other) - - -def imagemath_max(self: _Operand, other: _Operand | float | None) -> _Operand: - return self.apply("max", self, other) - - -def imagemath_convert(self: _Operand, mode: str) -> _Operand: - return _Operand(self.im.convert(mode)) - - -ops = { - "int": imagemath_int, - "float": imagemath_float, - "equal": imagemath_equal, - "notequal": imagemath_notequal, - "min": imagemath_min, - "max": imagemath_max, - "convert": imagemath_convert, -} - - -def lambda_eval( - expression: Callable[[dict[str, Any]], Any], - options: dict[str, Any] = {}, - **kw: Any, -) -> Any: - """ - Returns the result of an image function. - - :py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band - images, use the :py:meth:`~PIL.Image.Image.split` method or - :py:func:`~PIL.Image.merge` function. - - :param expression: A function that receives a dictionary. - :param options: Values to add to the function's dictionary. Deprecated. - You can instead use one or more keyword arguments. - :param **kw: Values to add to the function's dictionary. - :return: The expression result. This is usually an image object, but can - also be an integer, a floating point value, or a pixel tuple, - depending on the expression. - """ - - if options: - deprecate( - "ImageMath.lambda_eval options", - 12, - "ImageMath.lambda_eval keyword arguments", - ) - - args: dict[str, Any] = ops.copy() - args.update(options) - args.update(kw) - for k, v in args.items(): - if isinstance(v, Image.Image): - args[k] = _Operand(v) - - out = expression(args) - try: - return out.im - except AttributeError: - return out - - -def unsafe_eval( - expression: str, - options: dict[str, Any] = {}, - **kw: Any, -) -> Any: - """ - Evaluates an image expression. This uses Python's ``eval()`` function to process - the expression string, and carries the security risks of doing so. It is not - recommended to process expressions without considering this. - :py:meth:`~lambda_eval` is a more secure alternative. - - :py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band - images, use the :py:meth:`~PIL.Image.Image.split` method or - :py:func:`~PIL.Image.merge` function. - - :param expression: A string containing a Python-style expression. - :param options: Values to add to the evaluation context. Deprecated. - You can instead use one or more keyword arguments. - :param **kw: Values to add to the evaluation context. - :return: The evaluated expression. This is usually an image object, but can - also be an integer, a floating point value, or a pixel tuple, - depending on the expression. - """ - - if options: - deprecate( - "ImageMath.unsafe_eval options", - 12, - "ImageMath.unsafe_eval keyword arguments", - ) - - # build execution namespace - args: dict[str, Any] = ops.copy() - for k in [*options, *kw]: - if "__" in k or hasattr(builtins, k): - msg = f"'{k}' not allowed" - raise ValueError(msg) - - args.update(options) - args.update(kw) - for k, v in args.items(): - if isinstance(v, Image.Image): - args[k] = _Operand(v) - - compiled_code = compile(expression, "", "eval") - - def scan(code: CodeType) -> None: - for const in code.co_consts: - if type(const) is type(compiled_code): - scan(const) - - for name in code.co_names: - if name not in args and name != "abs": - msg = f"'{name}' not allowed" - raise ValueError(msg) - - scan(compiled_code) - out = builtins.eval(expression, {"__builtins": {"abs": abs}}, args) - try: - return out.im - except AttributeError: - return out - - -def eval( - expression: str, - _dict: dict[str, Any] = {}, - **kw: Any, -) -> Any: - """ - Evaluates an image expression. - - Deprecated. Use lambda_eval() or unsafe_eval() instead. - - :param expression: A string containing a Python-style expression. - :param _dict: Values to add to the evaluation context. You - can either use a dictionary, or one or more keyword - arguments. - :return: The evaluated expression. This is usually an image object, but can - also be an integer, a floating point value, or a pixel tuple, - depending on the expression. - - .. deprecated:: 10.3.0 - """ - - deprecate( - "ImageMath.eval", - 12, - "ImageMath.lambda_eval or ImageMath.unsafe_eval", - ) - return unsafe_eval(expression, _dict, **kw) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageMode.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageMode.py deleted file mode 100644 index 92a08d2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageMode.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# standard mode descriptors -# -# History: -# 2006-03-20 fl Added -# -# Copyright (c) 2006 by Secret Labs AB. -# Copyright (c) 2006 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import sys -from functools import lru_cache -from typing import NamedTuple - -from ._deprecate import deprecate - - -class ModeDescriptor(NamedTuple): - """Wrapper for mode strings.""" - - mode: str - bands: tuple[str, ...] - basemode: str - basetype: str - typestr: str - - def __str__(self) -> str: - return self.mode - - -@lru_cache -def getmode(mode: str) -> ModeDescriptor: - """Gets a mode descriptor for the given mode.""" - endian = "<" if sys.byteorder == "little" else ">" - - modes = { - # core modes - # Bits need to be extended to bytes - "1": ("L", "L", ("1",), "|b1"), - "L": ("L", "L", ("L",), "|u1"), - "I": ("L", "I", ("I",), f"{endian}i4"), - "F": ("L", "F", ("F",), f"{endian}f4"), - "P": ("P", "L", ("P",), "|u1"), - "RGB": ("RGB", "L", ("R", "G", "B"), "|u1"), - "RGBX": ("RGB", "L", ("R", "G", "B", "X"), "|u1"), - "RGBA": ("RGB", "L", ("R", "G", "B", "A"), "|u1"), - "CMYK": ("RGB", "L", ("C", "M", "Y", "K"), "|u1"), - "YCbCr": ("RGB", "L", ("Y", "Cb", "Cr"), "|u1"), - # UNDONE - unsigned |u1i1i1 - "LAB": ("RGB", "L", ("L", "A", "B"), "|u1"), - "HSV": ("RGB", "L", ("H", "S", "V"), "|u1"), - # extra experimental modes - "RGBa": ("RGB", "L", ("R", "G", "B", "a"), "|u1"), - "BGR;15": ("RGB", "L", ("B", "G", "R"), "|u1"), - "BGR;16": ("RGB", "L", ("B", "G", "R"), "|u1"), - "BGR;24": ("RGB", "L", ("B", "G", "R"), "|u1"), - "LA": ("L", "L", ("L", "A"), "|u1"), - "La": ("L", "L", ("L", "a"), "|u1"), - "PA": ("RGB", "L", ("P", "A"), "|u1"), - } - if mode in modes: - if mode in ("BGR;15", "BGR;16", "BGR;24"): - deprecate(mode, 12) - base_mode, base_type, bands, type_str = modes[mode] - return ModeDescriptor(mode, bands, base_mode, base_type, type_str) - - mapping_modes = { - # I;16 == I;16L, and I;32 == I;32L - "I;16": "u2", - "I;16BS": ">i2", - "I;16N": f"{endian}u2", - "I;16NS": f"{endian}i2", - "I;32": "u4", - "I;32L": "i4", - "I;32LS": " -from __future__ import annotations - -import re - -from . import Image, _imagingmorph - -LUT_SIZE = 1 << 9 - -# fmt: off -ROTATION_MATRIX = [ - 6, 3, 0, - 7, 4, 1, - 8, 5, 2, -] -MIRROR_MATRIX = [ - 2, 1, 0, - 5, 4, 3, - 8, 7, 6, -] -# fmt: on - - -class LutBuilder: - """A class for building a MorphLut from a descriptive language - - The input patterns is a list of a strings sequences like these:: - - 4:(... - .1. - 111)->1 - - (whitespaces including linebreaks are ignored). The option 4 - describes a series of symmetry operations (in this case a - 4-rotation), the pattern is described by: - - - . or X - Ignore - - 1 - Pixel is on - - 0 - Pixel is off - - The result of the operation is described after "->" string. - - The default is to return the current pixel value, which is - returned if no other match is found. - - Operations: - - - 4 - 4 way rotation - - N - Negate - - 1 - Dummy op for no other operation (an op must always be given) - - M - Mirroring - - Example:: - - lb = LutBuilder(patterns = ["4:(... .1. 111)->1"]) - lut = lb.build_lut() - - """ - - def __init__( - self, patterns: list[str] | None = None, op_name: str | None = None - ) -> None: - if patterns is not None: - self.patterns = patterns - else: - self.patterns = [] - self.lut: bytearray | None = None - if op_name is not None: - known_patterns = { - "corner": ["1:(... ... ...)->0", "4:(00. 01. ...)->1"], - "dilation4": ["4:(... .0. .1.)->1"], - "dilation8": ["4:(... .0. .1.)->1", "4:(... .0. ..1)->1"], - "erosion4": ["4:(... .1. .0.)->0"], - "erosion8": ["4:(... .1. .0.)->0", "4:(... .1. ..0)->0"], - "edge": [ - "1:(... ... ...)->0", - "4:(.0. .1. ...)->1", - "4:(01. .1. ...)->1", - ], - } - if op_name not in known_patterns: - msg = f"Unknown pattern {op_name}!" - raise Exception(msg) - - self.patterns = known_patterns[op_name] - - def add_patterns(self, patterns: list[str]) -> None: - self.patterns += patterns - - def build_default_lut(self) -> None: - symbols = [0, 1] - m = 1 << 4 # pos of current pixel - self.lut = bytearray(symbols[(i & m) > 0] for i in range(LUT_SIZE)) - - def get_lut(self) -> bytearray | None: - return self.lut - - def _string_permute(self, pattern: str, permutation: list[int]) -> str: - """string_permute takes a pattern and a permutation and returns the - string permuted according to the permutation list. - """ - assert len(permutation) == 9 - return "".join(pattern[p] for p in permutation) - - def _pattern_permute( - self, basic_pattern: str, options: str, basic_result: int - ) -> list[tuple[str, int]]: - """pattern_permute takes a basic pattern and its result and clones - the pattern according to the modifications described in the $options - parameter. It returns a list of all cloned patterns.""" - patterns = [(basic_pattern, basic_result)] - - # rotations - if "4" in options: - res = patterns[-1][1] - for i in range(4): - patterns.append( - (self._string_permute(patterns[-1][0], ROTATION_MATRIX), res) - ) - # mirror - if "M" in options: - n = len(patterns) - for pattern, res in patterns[:n]: - patterns.append((self._string_permute(pattern, MIRROR_MATRIX), res)) - - # negate - if "N" in options: - n = len(patterns) - for pattern, res in patterns[:n]: - # Swap 0 and 1 - pattern = pattern.replace("0", "Z").replace("1", "0").replace("Z", "1") - res = 1 - int(res) - patterns.append((pattern, res)) - - return patterns - - def build_lut(self) -> bytearray: - """Compile all patterns into a morphology lut. - - TBD :Build based on (file) morphlut:modify_lut - """ - self.build_default_lut() - assert self.lut is not None - patterns = [] - - # Parse and create symmetries of the patterns strings - for p in self.patterns: - m = re.search(r"(\w*):?\s*\((.+?)\)\s*->\s*(\d)", p.replace("\n", "")) - if not m: - msg = 'Syntax error in pattern "' + p + '"' - raise Exception(msg) - options = m.group(1) - pattern = m.group(2) - result = int(m.group(3)) - - # Get rid of spaces - pattern = pattern.replace(" ", "").replace("\n", "") - - patterns += self._pattern_permute(pattern, options, result) - - # compile the patterns into regular expressions for speed - compiled_patterns = [] - for pattern in patterns: - p = pattern[0].replace(".", "X").replace("X", "[01]") - compiled_patterns.append((re.compile(p), pattern[1])) - - # Step through table and find patterns that match. - # Note that all the patterns are searched. The last one - # caught overrides - for i in range(LUT_SIZE): - # Build the bit pattern - bitpattern = bin(i)[2:] - bitpattern = ("0" * (9 - len(bitpattern)) + bitpattern)[::-1] - - for pattern, r in compiled_patterns: - if pattern.match(bitpattern): - self.lut[i] = [0, 1][r] - - return self.lut - - -class MorphOp: - """A class for binary morphological operators""" - - def __init__( - self, - lut: bytearray | None = None, - op_name: str | None = None, - patterns: list[str] | None = None, - ) -> None: - """Create a binary morphological operator""" - self.lut = lut - if op_name is not None: - self.lut = LutBuilder(op_name=op_name).build_lut() - elif patterns is not None: - self.lut = LutBuilder(patterns=patterns).build_lut() - - def apply(self, image: Image.Image) -> tuple[int, Image.Image]: - """Run a single morphological operation on an image - - Returns a tuple of the number of changed pixels and the - morphed image""" - if self.lut is None: - msg = "No operator loaded" - raise Exception(msg) - - if image.mode != "L": - msg = "Image mode must be L" - raise ValueError(msg) - outimage = Image.new(image.mode, image.size, None) - count = _imagingmorph.apply(bytes(self.lut), image.getim(), outimage.getim()) - return count, outimage - - def match(self, image: Image.Image) -> list[tuple[int, int]]: - """Get a list of coordinates matching the morphological operation on - an image. - - Returns a list of tuples of (x,y) coordinates - of all matching pixels. See :ref:`coordinate-system`.""" - if self.lut is None: - msg = "No operator loaded" - raise Exception(msg) - - if image.mode != "L": - msg = "Image mode must be L" - raise ValueError(msg) - return _imagingmorph.match(bytes(self.lut), image.getim()) - - def get_on_pixels(self, image: Image.Image) -> list[tuple[int, int]]: - """Get a list of all turned on pixels in a binary image - - Returns a list of tuples of (x,y) coordinates - of all matching pixels. See :ref:`coordinate-system`.""" - - if image.mode != "L": - msg = "Image mode must be L" - raise ValueError(msg) - return _imagingmorph.get_on_pixels(image.getim()) - - def load_lut(self, filename: str) -> None: - """Load an operator from an mrl file""" - with open(filename, "rb") as f: - self.lut = bytearray(f.read()) - - if len(self.lut) != LUT_SIZE: - self.lut = None - msg = "Wrong size operator file!" - raise Exception(msg) - - def save_lut(self, filename: str) -> None: - """Save an operator to an mrl file""" - if self.lut is None: - msg = "No operator loaded" - raise Exception(msg) - with open(filename, "wb") as f: - f.write(self.lut) - - def set_lut(self, lut: bytearray | None) -> None: - """Set the lut from an external source""" - self.lut = lut diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageOps.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageOps.py deleted file mode 100644 index da28854..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageOps.py +++ /dev/null @@ -1,745 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# standard image operations -# -# History: -# 2001-10-20 fl Created -# 2001-10-23 fl Added autocontrast operator -# 2001-12-18 fl Added Kevin's fit operator -# 2004-03-14 fl Fixed potential division by zero in equalize -# 2005-05-05 fl Fixed equalize for low number of values -# -# Copyright (c) 2001-2004 by Secret Labs AB -# Copyright (c) 2001-2004 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import functools -import operator -import re -from collections.abc import Sequence -from typing import Literal, Protocol, cast, overload - -from . import ExifTags, Image, ImagePalette - -# -# helpers - - -def _border(border: int | tuple[int, ...]) -> tuple[int, int, int, int]: - if isinstance(border, tuple): - if len(border) == 2: - left, top = right, bottom = border - elif len(border) == 4: - left, top, right, bottom = border - else: - left = top = right = bottom = border - return left, top, right, bottom - - -def _color(color: str | int | tuple[int, ...], mode: str) -> int | tuple[int, ...]: - if isinstance(color, str): - from . import ImageColor - - color = ImageColor.getcolor(color, mode) - return color - - -def _lut(image: Image.Image, lut: list[int]) -> Image.Image: - if image.mode == "P": - # FIXME: apply to lookup table, not image data - msg = "mode P support coming soon" - raise NotImplementedError(msg) - elif image.mode in ("L", "RGB"): - if image.mode == "RGB" and len(lut) == 256: - lut = lut + lut + lut - return image.point(lut) - else: - msg = f"not supported for mode {image.mode}" - raise OSError(msg) - - -# -# actions - - -def autocontrast( - image: Image.Image, - cutoff: float | tuple[float, float] = 0, - ignore: int | Sequence[int] | None = None, - mask: Image.Image | None = None, - preserve_tone: bool = False, -) -> Image.Image: - """ - Maximize (normalize) image contrast. This function calculates a - histogram of the input image (or mask region), removes ``cutoff`` percent of the - lightest and darkest pixels from the histogram, and remaps the image - so that the darkest pixel becomes black (0), and the lightest - becomes white (255). - - :param image: The image to process. - :param cutoff: The percent to cut off from the histogram on the low and - high ends. Either a tuple of (low, high), or a single - number for both. - :param ignore: The background pixel value (use None for no background). - :param mask: Histogram used in contrast operation is computed using pixels - within the mask. If no mask is given the entire image is used - for histogram computation. - :param preserve_tone: Preserve image tone in Photoshop-like style autocontrast. - - .. versionadded:: 8.2.0 - - :return: An image. - """ - if preserve_tone: - histogram = image.convert("L").histogram(mask) - else: - histogram = image.histogram(mask) - - lut = [] - for layer in range(0, len(histogram), 256): - h = histogram[layer : layer + 256] - if ignore is not None: - # get rid of outliers - if isinstance(ignore, int): - h[ignore] = 0 - else: - for ix in ignore: - h[ix] = 0 - if cutoff: - # cut off pixels from both ends of the histogram - if not isinstance(cutoff, tuple): - cutoff = (cutoff, cutoff) - # get number of pixels - n = 0 - for ix in range(256): - n = n + h[ix] - # remove cutoff% pixels from the low end - cut = int(n * cutoff[0] // 100) - for lo in range(256): - if cut > h[lo]: - cut = cut - h[lo] - h[lo] = 0 - else: - h[lo] -= cut - cut = 0 - if cut <= 0: - break - # remove cutoff% samples from the high end - cut = int(n * cutoff[1] // 100) - for hi in range(255, -1, -1): - if cut > h[hi]: - cut = cut - h[hi] - h[hi] = 0 - else: - h[hi] -= cut - cut = 0 - if cut <= 0: - break - # find lowest/highest samples after preprocessing - for lo in range(256): - if h[lo]: - break - for hi in range(255, -1, -1): - if h[hi]: - break - if hi <= lo: - # don't bother - lut.extend(list(range(256))) - else: - scale = 255.0 / (hi - lo) - offset = -lo * scale - for ix in range(256): - ix = int(ix * scale + offset) - if ix < 0: - ix = 0 - elif ix > 255: - ix = 255 - lut.append(ix) - return _lut(image, lut) - - -def colorize( - image: Image.Image, - black: str | tuple[int, ...], - white: str | tuple[int, ...], - mid: str | int | tuple[int, ...] | None = None, - blackpoint: int = 0, - whitepoint: int = 255, - midpoint: int = 127, -) -> Image.Image: - """ - Colorize grayscale image. - This function calculates a color wedge which maps all black pixels in - the source image to the first color and all white pixels to the - second color. If ``mid`` is specified, it uses three-color mapping. - The ``black`` and ``white`` arguments should be RGB tuples or color names; - optionally you can use three-color mapping by also specifying ``mid``. - Mapping positions for any of the colors can be specified - (e.g. ``blackpoint``), where these parameters are the integer - value corresponding to where the corresponding color should be mapped. - These parameters must have logical order, such that - ``blackpoint <= midpoint <= whitepoint`` (if ``mid`` is specified). - - :param image: The image to colorize. - :param black: The color to use for black input pixels. - :param white: The color to use for white input pixels. - :param mid: The color to use for midtone input pixels. - :param blackpoint: an int value [0, 255] for the black mapping. - :param whitepoint: an int value [0, 255] for the white mapping. - :param midpoint: an int value [0, 255] for the midtone mapping. - :return: An image. - """ - - # Initial asserts - assert image.mode == "L" - if mid is None: - assert 0 <= blackpoint <= whitepoint <= 255 - else: - assert 0 <= blackpoint <= midpoint <= whitepoint <= 255 - - # Define colors from arguments - rgb_black = cast(Sequence[int], _color(black, "RGB")) - rgb_white = cast(Sequence[int], _color(white, "RGB")) - rgb_mid = cast(Sequence[int], _color(mid, "RGB")) if mid is not None else None - - # Empty lists for the mapping - red = [] - green = [] - blue = [] - - # Create the low-end values - for i in range(blackpoint): - red.append(rgb_black[0]) - green.append(rgb_black[1]) - blue.append(rgb_black[2]) - - # Create the mapping (2-color) - if rgb_mid is None: - range_map = range(whitepoint - blackpoint) - - for i in range_map: - red.append( - rgb_black[0] + i * (rgb_white[0] - rgb_black[0]) // len(range_map) - ) - green.append( - rgb_black[1] + i * (rgb_white[1] - rgb_black[1]) // len(range_map) - ) - blue.append( - rgb_black[2] + i * (rgb_white[2] - rgb_black[2]) // len(range_map) - ) - - # Create the mapping (3-color) - else: - range_map1 = range(midpoint - blackpoint) - range_map2 = range(whitepoint - midpoint) - - for i in range_map1: - red.append( - rgb_black[0] + i * (rgb_mid[0] - rgb_black[0]) // len(range_map1) - ) - green.append( - rgb_black[1] + i * (rgb_mid[1] - rgb_black[1]) // len(range_map1) - ) - blue.append( - rgb_black[2] + i * (rgb_mid[2] - rgb_black[2]) // len(range_map1) - ) - for i in range_map2: - red.append(rgb_mid[0] + i * (rgb_white[0] - rgb_mid[0]) // len(range_map2)) - green.append( - rgb_mid[1] + i * (rgb_white[1] - rgb_mid[1]) // len(range_map2) - ) - blue.append(rgb_mid[2] + i * (rgb_white[2] - rgb_mid[2]) // len(range_map2)) - - # Create the high-end values - for i in range(256 - whitepoint): - red.append(rgb_white[0]) - green.append(rgb_white[1]) - blue.append(rgb_white[2]) - - # Return converted image - image = image.convert("RGB") - return _lut(image, red + green + blue) - - -def contain( - image: Image.Image, size: tuple[int, int], method: int = Image.Resampling.BICUBIC -) -> Image.Image: - """ - Returns a resized version of the image, set to the maximum width and height - within the requested size, while maintaining the original aspect ratio. - - :param image: The image to resize. - :param size: The requested output size in pixels, given as a - (width, height) tuple. - :param method: Resampling method to use. Default is - :py:attr:`~PIL.Image.Resampling.BICUBIC`. - See :ref:`concept-filters`. - :return: An image. - """ - - im_ratio = image.width / image.height - dest_ratio = size[0] / size[1] - - if im_ratio != dest_ratio: - if im_ratio > dest_ratio: - new_height = round(image.height / image.width * size[0]) - if new_height != size[1]: - size = (size[0], new_height) - else: - new_width = round(image.width / image.height * size[1]) - if new_width != size[0]: - size = (new_width, size[1]) - return image.resize(size, resample=method) - - -def cover( - image: Image.Image, size: tuple[int, int], method: int = Image.Resampling.BICUBIC -) -> Image.Image: - """ - Returns a resized version of the image, so that the requested size is - covered, while maintaining the original aspect ratio. - - :param image: The image to resize. - :param size: The requested output size in pixels, given as a - (width, height) tuple. - :param method: Resampling method to use. Default is - :py:attr:`~PIL.Image.Resampling.BICUBIC`. - See :ref:`concept-filters`. - :return: An image. - """ - - im_ratio = image.width / image.height - dest_ratio = size[0] / size[1] - - if im_ratio != dest_ratio: - if im_ratio < dest_ratio: - new_height = round(image.height / image.width * size[0]) - if new_height != size[1]: - size = (size[0], new_height) - else: - new_width = round(image.width / image.height * size[1]) - if new_width != size[0]: - size = (new_width, size[1]) - return image.resize(size, resample=method) - - -def pad( - image: Image.Image, - size: tuple[int, int], - method: int = Image.Resampling.BICUBIC, - color: str | int | tuple[int, ...] | None = None, - centering: tuple[float, float] = (0.5, 0.5), -) -> Image.Image: - """ - Returns a resized and padded version of the image, expanded to fill the - requested aspect ratio and size. - - :param image: The image to resize and crop. - :param size: The requested output size in pixels, given as a - (width, height) tuple. - :param method: Resampling method to use. Default is - :py:attr:`~PIL.Image.Resampling.BICUBIC`. - See :ref:`concept-filters`. - :param color: The background color of the padded image. - :param centering: Control the position of the original image within the - padded version. - - (0.5, 0.5) will keep the image centered - (0, 0) will keep the image aligned to the top left - (1, 1) will keep the image aligned to the bottom - right - :return: An image. - """ - - resized = contain(image, size, method) - if resized.size == size: - out = resized - else: - out = Image.new(image.mode, size, color) - if resized.palette: - palette = resized.getpalette() - if palette is not None: - out.putpalette(palette) - if resized.width != size[0]: - x = round((size[0] - resized.width) * max(0, min(centering[0], 1))) - out.paste(resized, (x, 0)) - else: - y = round((size[1] - resized.height) * max(0, min(centering[1], 1))) - out.paste(resized, (0, y)) - return out - - -def crop(image: Image.Image, border: int = 0) -> Image.Image: - """ - Remove border from image. The same amount of pixels are removed - from all four sides. This function works on all image modes. - - .. seealso:: :py:meth:`~PIL.Image.Image.crop` - - :param image: The image to crop. - :param border: The number of pixels to remove. - :return: An image. - """ - left, top, right, bottom = _border(border) - return image.crop((left, top, image.size[0] - right, image.size[1] - bottom)) - - -def scale( - image: Image.Image, factor: float, resample: int = Image.Resampling.BICUBIC -) -> Image.Image: - """ - Returns a rescaled image by a specific factor given in parameter. - A factor greater than 1 expands the image, between 0 and 1 contracts the - image. - - :param image: The image to rescale. - :param factor: The expansion factor, as a float. - :param resample: Resampling method to use. Default is - :py:attr:`~PIL.Image.Resampling.BICUBIC`. - See :ref:`concept-filters`. - :returns: An :py:class:`~PIL.Image.Image` object. - """ - if factor == 1: - return image.copy() - elif factor <= 0: - msg = "the factor must be greater than 0" - raise ValueError(msg) - else: - size = (round(factor * image.width), round(factor * image.height)) - return image.resize(size, resample) - - -class SupportsGetMesh(Protocol): - """ - An object that supports the ``getmesh`` method, taking an image as an - argument, and returning a list of tuples. Each tuple contains two tuples, - the source box as a tuple of 4 integers, and a tuple of 8 integers for the - final quadrilateral, in order of top left, bottom left, bottom right, top - right. - """ - - def getmesh( - self, image: Image.Image - ) -> list[ - tuple[tuple[int, int, int, int], tuple[int, int, int, int, int, int, int, int]] - ]: ... - - -def deform( - image: Image.Image, - deformer: SupportsGetMesh, - resample: int = Image.Resampling.BILINEAR, -) -> Image.Image: - """ - Deform the image. - - :param image: The image to deform. - :param deformer: A deformer object. Any object that implements a - ``getmesh`` method can be used. - :param resample: An optional resampling filter. Same values possible as - in the PIL.Image.transform function. - :return: An image. - """ - return image.transform( - image.size, Image.Transform.MESH, deformer.getmesh(image), resample - ) - - -def equalize(image: Image.Image, mask: Image.Image | None = None) -> Image.Image: - """ - Equalize the image histogram. This function applies a non-linear - mapping to the input image, in order to create a uniform - distribution of grayscale values in the output image. - - :param image: The image to equalize. - :param mask: An optional mask. If given, only the pixels selected by - the mask are included in the analysis. - :return: An image. - """ - if image.mode == "P": - image = image.convert("RGB") - h = image.histogram(mask) - lut = [] - for b in range(0, len(h), 256): - histo = [_f for _f in h[b : b + 256] if _f] - if len(histo) <= 1: - lut.extend(list(range(256))) - else: - step = (functools.reduce(operator.add, histo) - histo[-1]) // 255 - if not step: - lut.extend(list(range(256))) - else: - n = step // 2 - for i in range(256): - lut.append(n // step) - n = n + h[i + b] - return _lut(image, lut) - - -def expand( - image: Image.Image, - border: int | tuple[int, ...] = 0, - fill: str | int | tuple[int, ...] = 0, -) -> Image.Image: - """ - Add border to the image - - :param image: The image to expand. - :param border: Border width, in pixels. - :param fill: Pixel fill value (a color value). Default is 0 (black). - :return: An image. - """ - left, top, right, bottom = _border(border) - width = left + image.size[0] + right - height = top + image.size[1] + bottom - color = _color(fill, image.mode) - if image.palette: - palette = ImagePalette.ImagePalette(palette=image.getpalette()) - if isinstance(color, tuple) and (len(color) == 3 or len(color) == 4): - color = palette.getcolor(color) - else: - palette = None - out = Image.new(image.mode, (width, height), color) - if palette: - out.putpalette(palette.palette) - out.paste(image, (left, top)) - return out - - -def fit( - image: Image.Image, - size: tuple[int, int], - method: int = Image.Resampling.BICUBIC, - bleed: float = 0.0, - centering: tuple[float, float] = (0.5, 0.5), -) -> Image.Image: - """ - Returns a resized and cropped version of the image, cropped to the - requested aspect ratio and size. - - This function was contributed by Kevin Cazabon. - - :param image: The image to resize and crop. - :param size: The requested output size in pixels, given as a - (width, height) tuple. - :param method: Resampling method to use. Default is - :py:attr:`~PIL.Image.Resampling.BICUBIC`. - See :ref:`concept-filters`. - :param bleed: Remove a border around the outside of the image from all - four edges. The value is a decimal percentage (use 0.01 for - one percent). The default value is 0 (no border). - Cannot be greater than or equal to 0.5. - :param centering: Control the cropping position. Use (0.5, 0.5) for - center cropping (e.g. if cropping the width, take 50% off - of the left side, and therefore 50% off the right side). - (0.0, 0.0) will crop from the top left corner (i.e. if - cropping the width, take all of the crop off of the right - side, and if cropping the height, take all of it off the - bottom). (1.0, 0.0) will crop from the bottom left - corner, etc. (i.e. if cropping the width, take all of the - crop off the left side, and if cropping the height take - none from the top, and therefore all off the bottom). - :return: An image. - """ - - # by Kevin Cazabon, Feb 17/2000 - # kevin@cazabon.com - # https://www.cazabon.com - - centering_x, centering_y = centering - - if not 0.0 <= centering_x <= 1.0: - centering_x = 0.5 - if not 0.0 <= centering_y <= 1.0: - centering_y = 0.5 - - if not 0.0 <= bleed < 0.5: - bleed = 0.0 - - # calculate the area to use for resizing and cropping, subtracting - # the 'bleed' around the edges - - # number of pixels to trim off on Top and Bottom, Left and Right - bleed_pixels = (bleed * image.size[0], bleed * image.size[1]) - - live_size = ( - image.size[0] - bleed_pixels[0] * 2, - image.size[1] - bleed_pixels[1] * 2, - ) - - # calculate the aspect ratio of the live_size - live_size_ratio = live_size[0] / live_size[1] - - # calculate the aspect ratio of the output image - output_ratio = size[0] / size[1] - - # figure out if the sides or top/bottom will be cropped off - if live_size_ratio == output_ratio: - # live_size is already the needed ratio - crop_width = live_size[0] - crop_height = live_size[1] - elif live_size_ratio >= output_ratio: - # live_size is wider than what's needed, crop the sides - crop_width = output_ratio * live_size[1] - crop_height = live_size[1] - else: - # live_size is taller than what's needed, crop the top and bottom - crop_width = live_size[0] - crop_height = live_size[0] / output_ratio - - # make the crop - crop_left = bleed_pixels[0] + (live_size[0] - crop_width) * centering_x - crop_top = bleed_pixels[1] + (live_size[1] - crop_height) * centering_y - - crop = (crop_left, crop_top, crop_left + crop_width, crop_top + crop_height) - - # resize the image and return it - return image.resize(size, method, box=crop) - - -def flip(image: Image.Image) -> Image.Image: - """ - Flip the image vertically (top to bottom). - - :param image: The image to flip. - :return: An image. - """ - return image.transpose(Image.Transpose.FLIP_TOP_BOTTOM) - - -def grayscale(image: Image.Image) -> Image.Image: - """ - Convert the image to grayscale. - - :param image: The image to convert. - :return: An image. - """ - return image.convert("L") - - -def invert(image: Image.Image) -> Image.Image: - """ - Invert (negate) the image. - - :param image: The image to invert. - :return: An image. - """ - lut = list(range(255, -1, -1)) - return image.point(lut) if image.mode == "1" else _lut(image, lut) - - -def mirror(image: Image.Image) -> Image.Image: - """ - Flip image horizontally (left to right). - - :param image: The image to mirror. - :return: An image. - """ - return image.transpose(Image.Transpose.FLIP_LEFT_RIGHT) - - -def posterize(image: Image.Image, bits: int) -> Image.Image: - """ - Reduce the number of bits for each color channel. - - :param image: The image to posterize. - :param bits: The number of bits to keep for each channel (1-8). - :return: An image. - """ - mask = ~(2 ** (8 - bits) - 1) - lut = [i & mask for i in range(256)] - return _lut(image, lut) - - -def solarize(image: Image.Image, threshold: int = 128) -> Image.Image: - """ - Invert all pixel values above a threshold. - - :param image: The image to solarize. - :param threshold: All pixels above this grayscale level are inverted. - :return: An image. - """ - lut = [] - for i in range(256): - if i < threshold: - lut.append(i) - else: - lut.append(255 - i) - return _lut(image, lut) - - -@overload -def exif_transpose(image: Image.Image, *, in_place: Literal[True]) -> None: ... - - -@overload -def exif_transpose( - image: Image.Image, *, in_place: Literal[False] = False -) -> Image.Image: ... - - -def exif_transpose(image: Image.Image, *, in_place: bool = False) -> Image.Image | None: - """ - If an image has an EXIF Orientation tag, other than 1, transpose the image - accordingly, and remove the orientation data. - - :param image: The image to transpose. - :param in_place: Boolean. Keyword-only argument. - If ``True``, the original image is modified in-place, and ``None`` is returned. - If ``False`` (default), a new :py:class:`~PIL.Image.Image` object is returned - with the transposition applied. If there is no transposition, a copy of the - image will be returned. - """ - image.load() - image_exif = image.getexif() - orientation = image_exif.get(ExifTags.Base.Orientation, 1) - method = { - 2: Image.Transpose.FLIP_LEFT_RIGHT, - 3: Image.Transpose.ROTATE_180, - 4: Image.Transpose.FLIP_TOP_BOTTOM, - 5: Image.Transpose.TRANSPOSE, - 6: Image.Transpose.ROTATE_270, - 7: Image.Transpose.TRANSVERSE, - 8: Image.Transpose.ROTATE_90, - }.get(orientation) - if method is not None: - if in_place: - image.im = image.im.transpose(method) - image._size = image.im.size - else: - transposed_image = image.transpose(method) - exif_image = image if in_place else transposed_image - - exif = exif_image.getexif() - if ExifTags.Base.Orientation in exif: - del exif[ExifTags.Base.Orientation] - if "exif" in exif_image.info: - exif_image.info["exif"] = exif.tobytes() - elif "Raw profile type exif" in exif_image.info: - exif_image.info["Raw profile type exif"] = exif.tobytes().hex() - for key in ("XML:com.adobe.xmp", "xmp"): - if key in exif_image.info: - for pattern in ( - r'tiff:Orientation="([0-9])"', - r"([0-9])", - ): - value = exif_image.info[key] - if isinstance(value, str): - value = re.sub(pattern, "", value) - elif isinstance(value, tuple): - value = tuple( - re.sub(pattern.encode(), b"", v) for v in value - ) - else: - value = re.sub(pattern.encode(), b"", value) - exif_image.info[key] = value - if not in_place: - return transposed_image - elif not in_place: - return image.copy() - return None diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImagePalette.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImagePalette.py deleted file mode 100644 index 1036971..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImagePalette.py +++ /dev/null @@ -1,286 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# image palette object -# -# History: -# 1996-03-11 fl Rewritten. -# 1997-01-03 fl Up and running. -# 1997-08-23 fl Added load hack -# 2001-04-16 fl Fixed randint shadow bug in random() -# -# Copyright (c) 1997-2001 by Secret Labs AB -# Copyright (c) 1996-1997 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import array -from collections.abc import Sequence -from typing import IO - -from . import GimpGradientFile, GimpPaletteFile, ImageColor, PaletteFile - -TYPE_CHECKING = False -if TYPE_CHECKING: - from . import Image - - -class ImagePalette: - """ - Color palette for palette mapped images - - :param mode: The mode to use for the palette. See: - :ref:`concept-modes`. Defaults to "RGB" - :param palette: An optional palette. If given, it must be a bytearray, - an array or a list of ints between 0-255. The list must consist of - all channels for one color followed by the next color (e.g. RGBRGBRGB). - Defaults to an empty palette. - """ - - def __init__( - self, - mode: str = "RGB", - palette: Sequence[int] | bytes | bytearray | None = None, - ) -> None: - self.mode = mode - self.rawmode: str | None = None # if set, palette contains raw data - self.palette = palette or bytearray() - self.dirty: int | None = None - - @property - def palette(self) -> Sequence[int] | bytes | bytearray: - return self._palette - - @palette.setter - def palette(self, palette: Sequence[int] | bytes | bytearray) -> None: - self._colors: dict[tuple[int, ...], int] | None = None - self._palette = palette - - @property - def colors(self) -> dict[tuple[int, ...], int]: - if self._colors is None: - mode_len = len(self.mode) - self._colors = {} - for i in range(0, len(self.palette), mode_len): - color = tuple(self.palette[i : i + mode_len]) - if color in self._colors: - continue - self._colors[color] = i // mode_len - return self._colors - - @colors.setter - def colors(self, colors: dict[tuple[int, ...], int]) -> None: - self._colors = colors - - def copy(self) -> ImagePalette: - new = ImagePalette() - - new.mode = self.mode - new.rawmode = self.rawmode - if self.palette is not None: - new.palette = self.palette[:] - new.dirty = self.dirty - - return new - - def getdata(self) -> tuple[str, Sequence[int] | bytes | bytearray]: - """ - Get palette contents in format suitable for the low-level - ``im.putpalette`` primitive. - - .. warning:: This method is experimental. - """ - if self.rawmode: - return self.rawmode, self.palette - return self.mode, self.tobytes() - - def tobytes(self) -> bytes: - """Convert palette to bytes. - - .. warning:: This method is experimental. - """ - if self.rawmode: - msg = "palette contains raw palette data" - raise ValueError(msg) - if isinstance(self.palette, bytes): - return self.palette - arr = array.array("B", self.palette) - return arr.tobytes() - - # Declare tostring as an alias for tobytes - tostring = tobytes - - def _new_color_index( - self, image: Image.Image | None = None, e: Exception | None = None - ) -> int: - if not isinstance(self.palette, bytearray): - self._palette = bytearray(self.palette) - index = len(self.palette) // 3 - special_colors: tuple[int | tuple[int, ...] | None, ...] = () - if image: - special_colors = ( - image.info.get("background"), - image.info.get("transparency"), - ) - while index in special_colors: - index += 1 - if index >= 256: - if image: - # Search for an unused index - for i, count in reversed(list(enumerate(image.histogram()))): - if count == 0 and i not in special_colors: - index = i - break - if index >= 256: - msg = "cannot allocate more than 256 colors" - raise ValueError(msg) from e - return index - - def getcolor( - self, - color: tuple[int, ...], - image: Image.Image | None = None, - ) -> int: - """Given an rgb tuple, allocate palette entry. - - .. warning:: This method is experimental. - """ - if self.rawmode: - msg = "palette contains raw palette data" - raise ValueError(msg) - if isinstance(color, tuple): - if self.mode == "RGB": - if len(color) == 4: - if color[3] != 255: - msg = "cannot add non-opaque RGBA color to RGB palette" - raise ValueError(msg) - color = color[:3] - elif self.mode == "RGBA": - if len(color) == 3: - color += (255,) - try: - return self.colors[color] - except KeyError as e: - # allocate new color slot - index = self._new_color_index(image, e) - assert isinstance(self._palette, bytearray) - self.colors[color] = index - if index * 3 < len(self.palette): - self._palette = ( - self._palette[: index * 3] - + bytes(color) - + self._palette[index * 3 + 3 :] - ) - else: - self._palette += bytes(color) - self.dirty = 1 - return index - else: - msg = f"unknown color specifier: {repr(color)}" # type: ignore[unreachable] - raise ValueError(msg) - - def save(self, fp: str | IO[str]) -> None: - """Save palette to text file. - - .. warning:: This method is experimental. - """ - if self.rawmode: - msg = "palette contains raw palette data" - raise ValueError(msg) - if isinstance(fp, str): - fp = open(fp, "w") - fp.write("# Palette\n") - fp.write(f"# Mode: {self.mode}\n") - for i in range(256): - fp.write(f"{i}") - for j in range(i * len(self.mode), (i + 1) * len(self.mode)): - try: - fp.write(f" {self.palette[j]}") - except IndexError: - fp.write(" 0") - fp.write("\n") - fp.close() - - -# -------------------------------------------------------------------- -# Internal - - -def raw(rawmode: str, data: Sequence[int] | bytes | bytearray) -> ImagePalette: - palette = ImagePalette() - palette.rawmode = rawmode - palette.palette = data - palette.dirty = 1 - return palette - - -# -------------------------------------------------------------------- -# Factories - - -def make_linear_lut(black: int, white: float) -> list[int]: - if black == 0: - return [int(white * i // 255) for i in range(256)] - - msg = "unavailable when black is non-zero" - raise NotImplementedError(msg) # FIXME - - -def make_gamma_lut(exp: float) -> list[int]: - return [int(((i / 255.0) ** exp) * 255.0 + 0.5) for i in range(256)] - - -def negative(mode: str = "RGB") -> ImagePalette: - palette = list(range(256 * len(mode))) - palette.reverse() - return ImagePalette(mode, [i // len(mode) for i in palette]) - - -def random(mode: str = "RGB") -> ImagePalette: - from random import randint - - palette = [randint(0, 255) for _ in range(256 * len(mode))] - return ImagePalette(mode, palette) - - -def sepia(white: str = "#fff0c0") -> ImagePalette: - bands = [make_linear_lut(0, band) for band in ImageColor.getrgb(white)] - return ImagePalette("RGB", [bands[i % 3][i // 3] for i in range(256 * 3)]) - - -def wedge(mode: str = "RGB") -> ImagePalette: - palette = list(range(256 * len(mode))) - return ImagePalette(mode, [i // len(mode) for i in palette]) - - -def load(filename: str) -> tuple[bytes, str]: - # FIXME: supports GIMP gradients only - - with open(filename, "rb") as fp: - paletteHandlers: list[ - type[ - GimpPaletteFile.GimpPaletteFile - | GimpGradientFile.GimpGradientFile - | PaletteFile.PaletteFile - ] - ] = [ - GimpPaletteFile.GimpPaletteFile, - GimpGradientFile.GimpGradientFile, - PaletteFile.PaletteFile, - ] - for paletteHandler in paletteHandlers: - try: - fp.seek(0) - lut = paletteHandler(fp).getpalette() - if lut: - break - except (SyntaxError, ValueError): - pass - else: - msg = "cannot load palette" - raise OSError(msg) - - return lut # data, rawmode diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImagePath.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImagePath.py deleted file mode 100644 index 77e8a60..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImagePath.py +++ /dev/null @@ -1,20 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# path interface -# -# History: -# 1996-11-04 fl Created -# 2002-04-14 fl Added documentation stub class -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image - -Path = Image.core.path diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageQt.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageQt.py deleted file mode 100644 index df7a57b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageQt.py +++ /dev/null @@ -1,220 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# a simple Qt image interface. -# -# history: -# 2006-06-03 fl: created -# 2006-06-04 fl: inherit from QImage instead of wrapping it -# 2006-06-05 fl: removed toimage helper; move string support to ImageQt -# 2013-11-13 fl: add support for Qt5 (aurelien.ballier@cyclonit.com) -# -# Copyright (c) 2006 by Secret Labs AB -# Copyright (c) 2006 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import sys -from io import BytesIO -from typing import Any, Callable, Union - -from . import Image -from ._util import is_path - -TYPE_CHECKING = False -if TYPE_CHECKING: - import PyQt6 - import PySide6 - - from . import ImageFile - - QBuffer: type - QByteArray = Union[PyQt6.QtCore.QByteArray, PySide6.QtCore.QByteArray] - QIODevice = Union[PyQt6.QtCore.QIODevice, PySide6.QtCore.QIODevice] - QImage = Union[PyQt6.QtGui.QImage, PySide6.QtGui.QImage] - QPixmap = Union[PyQt6.QtGui.QPixmap, PySide6.QtGui.QPixmap] - -qt_version: str | None -qt_versions = [ - ["6", "PyQt6"], - ["side6", "PySide6"], -] - -# If a version has already been imported, attempt it first -qt_versions.sort(key=lambda version: version[1] in sys.modules, reverse=True) -for version, qt_module in qt_versions: - try: - qRgba: Callable[[int, int, int, int], int] - if qt_module == "PyQt6": - from PyQt6.QtCore import QBuffer, QIODevice - from PyQt6.QtGui import QImage, QPixmap, qRgba - elif qt_module == "PySide6": - from PySide6.QtCore import QBuffer, QIODevice - from PySide6.QtGui import QImage, QPixmap, qRgba - except (ImportError, RuntimeError): - continue - qt_is_installed = True - qt_version = version - break -else: - qt_is_installed = False - qt_version = None - - -def rgb(r: int, g: int, b: int, a: int = 255) -> int: - """(Internal) Turns an RGB color into a Qt compatible color integer.""" - # use qRgb to pack the colors, and then turn the resulting long - # into a negative integer with the same bitpattern. - return qRgba(r, g, b, a) & 0xFFFFFFFF - - -def fromqimage(im: QImage | QPixmap) -> ImageFile.ImageFile: - """ - :param im: QImage or PIL ImageQt object - """ - buffer = QBuffer() - qt_openmode: object - if qt_version == "6": - try: - qt_openmode = getattr(QIODevice, "OpenModeFlag") - except AttributeError: - qt_openmode = getattr(QIODevice, "OpenMode") - else: - qt_openmode = QIODevice - buffer.open(getattr(qt_openmode, "ReadWrite")) - # preserve alpha channel with png - # otherwise ppm is more friendly with Image.open - if im.hasAlphaChannel(): - im.save(buffer, "png") - else: - im.save(buffer, "ppm") - - b = BytesIO() - b.write(buffer.data()) - buffer.close() - b.seek(0) - - return Image.open(b) - - -def fromqpixmap(im: QPixmap) -> ImageFile.ImageFile: - return fromqimage(im) - - -def align8to32(bytes: bytes, width: int, mode: str) -> bytes: - """ - converts each scanline of data from 8 bit to 32 bit aligned - """ - - bits_per_pixel = {"1": 1, "L": 8, "P": 8, "I;16": 16}[mode] - - # calculate bytes per line and the extra padding if needed - bits_per_line = bits_per_pixel * width - full_bytes_per_line, remaining_bits_per_line = divmod(bits_per_line, 8) - bytes_per_line = full_bytes_per_line + (1 if remaining_bits_per_line else 0) - - extra_padding = -bytes_per_line % 4 - - # already 32 bit aligned by luck - if not extra_padding: - return bytes - - new_data = [ - bytes[i * bytes_per_line : (i + 1) * bytes_per_line] + b"\x00" * extra_padding - for i in range(len(bytes) // bytes_per_line) - ] - - return b"".join(new_data) - - -def _toqclass_helper(im: Image.Image | str | QByteArray) -> dict[str, Any]: - data = None - colortable = None - exclusive_fp = False - - # handle filename, if given instead of image name - if hasattr(im, "toUtf8"): - # FIXME - is this really the best way to do this? - im = str(im.toUtf8(), "utf-8") - if is_path(im): - im = Image.open(im) - exclusive_fp = True - assert isinstance(im, Image.Image) - - qt_format = getattr(QImage, "Format") if qt_version == "6" else QImage - if im.mode == "1": - format = getattr(qt_format, "Format_Mono") - elif im.mode == "L": - format = getattr(qt_format, "Format_Indexed8") - colortable = [rgb(i, i, i) for i in range(256)] - elif im.mode == "P": - format = getattr(qt_format, "Format_Indexed8") - palette = im.getpalette() - assert palette is not None - colortable = [rgb(*palette[i : i + 3]) for i in range(0, len(palette), 3)] - elif im.mode == "RGB": - # Populate the 4th channel with 255 - im = im.convert("RGBA") - - data = im.tobytes("raw", "BGRA") - format = getattr(qt_format, "Format_RGB32") - elif im.mode == "RGBA": - data = im.tobytes("raw", "BGRA") - format = getattr(qt_format, "Format_ARGB32") - elif im.mode == "I;16": - im = im.point(lambda i: i * 256) - - format = getattr(qt_format, "Format_Grayscale16") - else: - if exclusive_fp: - im.close() - msg = f"unsupported image mode {repr(im.mode)}" - raise ValueError(msg) - - size = im.size - __data = data or align8to32(im.tobytes(), size[0], im.mode) - if exclusive_fp: - im.close() - return {"data": __data, "size": size, "format": format, "colortable": colortable} - - -if qt_is_installed: - - class ImageQt(QImage): # type: ignore[misc] - def __init__(self, im: Image.Image | str | QByteArray) -> None: - """ - An PIL image wrapper for Qt. This is a subclass of PyQt's QImage - class. - - :param im: A PIL Image object, or a file name (given either as - Python string or a PyQt string object). - """ - im_data = _toqclass_helper(im) - # must keep a reference, or Qt will crash! - # All QImage constructors that take data operate on an existing - # buffer, so this buffer has to hang on for the life of the image. - # Fixes https://github.com/python-pillow/Pillow/issues/1370 - self.__data = im_data["data"] - super().__init__( - self.__data, - im_data["size"][0], - im_data["size"][1], - im_data["format"], - ) - if im_data["colortable"]: - self.setColorTable(im_data["colortable"]) - - -def toqimage(im: Image.Image | str | QByteArray) -> ImageQt: - return ImageQt(im) - - -def toqpixmap(im: Image.Image | str | QByteArray) -> QPixmap: - qimage = toqimage(im) - pixmap = getattr(QPixmap, "fromImage")(qimage) - if qt_version == "6": - pixmap.detach() - return pixmap diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageSequence.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageSequence.py deleted file mode 100644 index a6fc340..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageSequence.py +++ /dev/null @@ -1,86 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# sequence support classes -# -# history: -# 1997-02-20 fl Created -# -# Copyright (c) 1997 by Secret Labs AB. -# Copyright (c) 1997 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# - -## -from __future__ import annotations - -from typing import Callable - -from . import Image - - -class Iterator: - """ - This class implements an iterator object that can be used to loop - over an image sequence. - - You can use the ``[]`` operator to access elements by index. This operator - will raise an :py:exc:`IndexError` if you try to access a nonexistent - frame. - - :param im: An image object. - """ - - def __init__(self, im: Image.Image) -> None: - if not hasattr(im, "seek"): - msg = "im must have seek method" - raise AttributeError(msg) - self.im = im - self.position = getattr(self.im, "_min_frame", 0) - - def __getitem__(self, ix: int) -> Image.Image: - try: - self.im.seek(ix) - return self.im - except EOFError as e: - msg = "end of sequence" - raise IndexError(msg) from e - - def __iter__(self) -> Iterator: - return self - - def __next__(self) -> Image.Image: - try: - self.im.seek(self.position) - self.position += 1 - return self.im - except EOFError as e: - msg = "end of sequence" - raise StopIteration(msg) from e - - -def all_frames( - im: Image.Image | list[Image.Image], - func: Callable[[Image.Image], Image.Image] | None = None, -) -> list[Image.Image]: - """ - Applies a given function to all frames in an image or a list of images. - The frames are returned as a list of separate images. - - :param im: An image, or a list of images. - :param func: The function to apply to all of the image frames. - :returns: A list of images. - """ - if not isinstance(im, list): - im = [im] - - ims = [] - for imSequence in im: - current = imSequence.tell() - - ims += [im_frame.copy() for im_frame in Iterator(imSequence)] - - imSequence.seek(current) - return [func(im) for im in ims] if func else ims diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageShow.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageShow.py deleted file mode 100644 index 7705608..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageShow.py +++ /dev/null @@ -1,362 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# im.show() drivers -# -# History: -# 2008-04-06 fl Created -# -# Copyright (c) Secret Labs AB 2008. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import abc -import os -import shutil -import subprocess -import sys -from shlex import quote -from typing import Any - -from . import Image - -_viewers = [] - - -def register(viewer: type[Viewer] | Viewer, order: int = 1) -> None: - """ - The :py:func:`register` function is used to register additional viewers:: - - from PIL import ImageShow - ImageShow.register(MyViewer()) # MyViewer will be used as a last resort - ImageShow.register(MySecondViewer(), 0) # MySecondViewer will be prioritised - ImageShow.register(ImageShow.XVViewer(), 0) # XVViewer will be prioritised - - :param viewer: The viewer to be registered. - :param order: - Zero or a negative integer to prepend this viewer to the list, - a positive integer to append it. - """ - if isinstance(viewer, type) and issubclass(viewer, Viewer): - viewer = viewer() - if order > 0: - _viewers.append(viewer) - else: - _viewers.insert(0, viewer) - - -def show(image: Image.Image, title: str | None = None, **options: Any) -> bool: - r""" - Display a given image. - - :param image: An image object. - :param title: Optional title. Not all viewers can display the title. - :param \**options: Additional viewer options. - :returns: ``True`` if a suitable viewer was found, ``False`` otherwise. - """ - for viewer in _viewers: - if viewer.show(image, title=title, **options): - return True - return False - - -class Viewer: - """Base class for viewers.""" - - # main api - - def show(self, image: Image.Image, **options: Any) -> int: - """ - The main function for displaying an image. - Converts the given image to the target format and displays it. - """ - - if not ( - image.mode in ("1", "RGBA") - or (self.format == "PNG" and image.mode in ("I;16", "LA")) - ): - base = Image.getmodebase(image.mode) - if image.mode != base: - image = image.convert(base) - - return self.show_image(image, **options) - - # hook methods - - format: str | None = None - """The format to convert the image into.""" - options: dict[str, Any] = {} - """Additional options used to convert the image.""" - - def get_format(self, image: Image.Image) -> str | None: - """Return format name, or ``None`` to save as PGM/PPM.""" - return self.format - - def get_command(self, file: str, **options: Any) -> str: - """ - Returns the command used to display the file. - Not implemented in the base class. - """ - msg = "unavailable in base viewer" - raise NotImplementedError(msg) - - def save_image(self, image: Image.Image) -> str: - """Save to temporary file and return filename.""" - return image._dump(format=self.get_format(image), **self.options) - - def show_image(self, image: Image.Image, **options: Any) -> int: - """Display the given image.""" - return self.show_file(self.save_image(image), **options) - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - os.system(self.get_command(path, **options)) # nosec - return 1 - - -# -------------------------------------------------------------------- - - -class WindowsViewer(Viewer): - """The default viewer on Windows is the default system application for PNG files.""" - - format = "PNG" - options = {"compress_level": 1, "save_all": True} - - def get_command(self, file: str, **options: Any) -> str: - return ( - f'start "Pillow" /WAIT "{file}" ' - "&& ping -n 4 127.0.0.1 >NUL " - f'&& del /f "{file}"' - ) - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - subprocess.Popen( - self.get_command(path, **options), - shell=True, - creationflags=getattr(subprocess, "CREATE_NO_WINDOW"), - ) # nosec - return 1 - - -if sys.platform == "win32": - register(WindowsViewer) - - -class MacViewer(Viewer): - """The default viewer on macOS using ``Preview.app``.""" - - format = "PNG" - options = {"compress_level": 1, "save_all": True} - - def get_command(self, file: str, **options: Any) -> str: - # on darwin open returns immediately resulting in the temp - # file removal while app is opening - command = "open -a Preview.app" - command = f"({command} {quote(file)}; sleep 20; rm -f {quote(file)})&" - return command - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - subprocess.call(["open", "-a", "Preview.app", path]) - - pyinstaller = getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS") - executable = (not pyinstaller and sys.executable) or shutil.which("python3") - if executable: - subprocess.Popen( - [ - executable, - "-c", - "import os, sys, time; time.sleep(20); os.remove(sys.argv[1])", - path, - ] - ) - return 1 - - -if sys.platform == "darwin": - register(MacViewer) - - -class UnixViewer(abc.ABC, Viewer): - format = "PNG" - options = {"compress_level": 1, "save_all": True} - - @abc.abstractmethod - def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: - pass - - def get_command(self, file: str, **options: Any) -> str: - command = self.get_command_ex(file, **options)[0] - return f"{command} {quote(file)}" - - -class XDGViewer(UnixViewer): - """ - The freedesktop.org ``xdg-open`` command. - """ - - def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: - command = executable = "xdg-open" - return command, executable - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - subprocess.Popen(["xdg-open", path]) - return 1 - - -class DisplayViewer(UnixViewer): - """ - The ImageMagick ``display`` command. - This viewer supports the ``title`` parameter. - """ - - def get_command_ex( - self, file: str, title: str | None = None, **options: Any - ) -> tuple[str, str]: - command = executable = "display" - if title: - command += f" -title {quote(title)}" - return command, executable - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - args = ["display"] - title = options.get("title") - if title: - args += ["-title", title] - args.append(path) - - subprocess.Popen(args) - return 1 - - -class GmDisplayViewer(UnixViewer): - """The GraphicsMagick ``gm display`` command.""" - - def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: - executable = "gm" - command = "gm display" - return command, executable - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - subprocess.Popen(["gm", "display", path]) - return 1 - - -class EogViewer(UnixViewer): - """The GNOME Image Viewer ``eog`` command.""" - - def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: - executable = "eog" - command = "eog -n" - return command, executable - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - subprocess.Popen(["eog", "-n", path]) - return 1 - - -class XVViewer(UnixViewer): - """ - The X Viewer ``xv`` command. - This viewer supports the ``title`` parameter. - """ - - def get_command_ex( - self, file: str, title: str | None = None, **options: Any - ) -> tuple[str, str]: - # note: xv is pretty outdated. most modern systems have - # imagemagick's display command instead. - command = executable = "xv" - if title: - command += f" -name {quote(title)}" - return command, executable - - def show_file(self, path: str, **options: Any) -> int: - """ - Display given file. - """ - if not os.path.exists(path): - raise FileNotFoundError - args = ["xv"] - title = options.get("title") - if title: - args += ["-name", title] - args.append(path) - - subprocess.Popen(args) - return 1 - - -if sys.platform not in ("win32", "darwin"): # unixoids - if shutil.which("xdg-open"): - register(XDGViewer) - if shutil.which("display"): - register(DisplayViewer) - if shutil.which("gm"): - register(GmDisplayViewer) - if shutil.which("eog"): - register(EogViewer) - if shutil.which("xv"): - register(XVViewer) - - -class IPythonViewer(Viewer): - """The viewer for IPython frontends.""" - - def show_image(self, image: Image.Image, **options: Any) -> int: - ipython_display(image) - return 1 - - -try: - from IPython.display import display as ipython_display -except ImportError: - pass -else: - register(IPythonViewer) - - -if __name__ == "__main__": - if len(sys.argv) < 2: - print("Syntax: python3 ImageShow.py imagefile [title]") - sys.exit() - - with Image.open(sys.argv[1]) as im: - print(show(im, *sys.argv[2:])) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageStat.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageStat.py deleted file mode 100644 index 8bc5045..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageStat.py +++ /dev/null @@ -1,160 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# global image statistics -# -# History: -# 1996-04-05 fl Created -# 1997-05-21 fl Added mask; added rms, var, stddev attributes -# 1997-08-05 fl Added median -# 1998-07-05 hk Fixed integer overflow error -# -# Notes: -# This class shows how to implement delayed evaluation of attributes. -# To get a certain value, simply access the corresponding attribute. -# The __getattr__ dispatcher takes care of the rest. -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996-97. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import math -from functools import cached_property - -from . import Image - - -class Stat: - def __init__( - self, image_or_list: Image.Image | list[int], mask: Image.Image | None = None - ) -> None: - """ - Calculate statistics for the given image. If a mask is included, - only the regions covered by that mask are included in the - statistics. You can also pass in a previously calculated histogram. - - :param image: A PIL image, or a precalculated histogram. - - .. note:: - - For a PIL image, calculations rely on the - :py:meth:`~PIL.Image.Image.histogram` method. The pixel counts are - grouped into 256 bins, even if the image has more than 8 bits per - channel. So ``I`` and ``F`` mode images have a maximum ``mean``, - ``median`` and ``rms`` of 255, and cannot have an ``extrema`` maximum - of more than 255. - - :param mask: An optional mask. - """ - if isinstance(image_or_list, Image.Image): - self.h = image_or_list.histogram(mask) - elif isinstance(image_or_list, list): - self.h = image_or_list - else: - msg = "first argument must be image or list" # type: ignore[unreachable] - raise TypeError(msg) - self.bands = list(range(len(self.h) // 256)) - - @cached_property - def extrema(self) -> list[tuple[int, int]]: - """ - Min/max values for each band in the image. - - .. note:: - This relies on the :py:meth:`~PIL.Image.Image.histogram` method, and - simply returns the low and high bins used. This is correct for - images with 8 bits per channel, but fails for other modes such as - ``I`` or ``F``. Instead, use :py:meth:`~PIL.Image.Image.getextrema` to - return per-band extrema for the image. This is more correct and - efficient because, for non-8-bit modes, the histogram method uses - :py:meth:`~PIL.Image.Image.getextrema` to determine the bins used. - """ - - def minmax(histogram: list[int]) -> tuple[int, int]: - res_min, res_max = 255, 0 - for i in range(256): - if histogram[i]: - res_min = i - break - for i in range(255, -1, -1): - if histogram[i]: - res_max = i - break - return res_min, res_max - - return [minmax(self.h[i:]) for i in range(0, len(self.h), 256)] - - @cached_property - def count(self) -> list[int]: - """Total number of pixels for each band in the image.""" - return [sum(self.h[i : i + 256]) for i in range(0, len(self.h), 256)] - - @cached_property - def sum(self) -> list[float]: - """Sum of all pixels for each band in the image.""" - - v = [] - for i in range(0, len(self.h), 256): - layer_sum = 0.0 - for j in range(256): - layer_sum += j * self.h[i + j] - v.append(layer_sum) - return v - - @cached_property - def sum2(self) -> list[float]: - """Squared sum of all pixels for each band in the image.""" - - v = [] - for i in range(0, len(self.h), 256): - sum2 = 0.0 - for j in range(256): - sum2 += (j**2) * float(self.h[i + j]) - v.append(sum2) - return v - - @cached_property - def mean(self) -> list[float]: - """Average (arithmetic mean) pixel level for each band in the image.""" - return [self.sum[i] / self.count[i] for i in self.bands] - - @cached_property - def median(self) -> list[int]: - """Median pixel level for each band in the image.""" - - v = [] - for i in self.bands: - s = 0 - half = self.count[i] // 2 - b = i * 256 - for j in range(256): - s = s + self.h[b + j] - if s > half: - break - v.append(j) - return v - - @cached_property - def rms(self) -> list[float]: - """RMS (root-mean-square) for each band in the image.""" - return [math.sqrt(self.sum2[i] / self.count[i]) for i in self.bands] - - @cached_property - def var(self) -> list[float]: - """Variance for each band in the image.""" - return [ - (self.sum2[i] - (self.sum[i] ** 2.0) / self.count[i]) / self.count[i] - for i in self.bands - ] - - @cached_property - def stddev(self) -> list[float]: - """Standard deviation for each band in the image.""" - return [math.sqrt(self.var[i]) for i in self.bands] - - -Global = Stat # compatibility diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageTk.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageTk.py deleted file mode 100644 index 3a4cb81..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageTk.py +++ /dev/null @@ -1,266 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# a Tk display interface -# -# History: -# 96-04-08 fl Created -# 96-09-06 fl Added getimage method -# 96-11-01 fl Rewritten, removed image attribute and crop method -# 97-05-09 fl Use PyImagingPaste method instead of image type -# 97-05-12 fl Minor tweaks to match the IFUNC95 interface -# 97-05-17 fl Support the "pilbitmap" booster patch -# 97-06-05 fl Added file= and data= argument to image constructors -# 98-03-09 fl Added width and height methods to Image classes -# 98-07-02 fl Use default mode for "P" images without palette attribute -# 98-07-02 fl Explicitly destroy Tkinter image objects -# 99-07-24 fl Support multiple Tk interpreters (from Greg Couch) -# 99-07-26 fl Automatically hook into Tkinter (if possible) -# 99-08-15 fl Hook uses _imagingtk instead of _imaging -# -# Copyright (c) 1997-1999 by Secret Labs AB -# Copyright (c) 1996-1997 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import tkinter -from io import BytesIO -from typing import Any - -from . import Image, ImageFile - -TYPE_CHECKING = False -if TYPE_CHECKING: - from ._typing import CapsuleType - -# -------------------------------------------------------------------- -# Check for Tkinter interface hooks - - -def _get_image_from_kw(kw: dict[str, Any]) -> ImageFile.ImageFile | None: - source = None - if "file" in kw: - source = kw.pop("file") - elif "data" in kw: - source = BytesIO(kw.pop("data")) - if not source: - return None - return Image.open(source) - - -def _pyimagingtkcall( - command: str, photo: PhotoImage | tkinter.PhotoImage, ptr: CapsuleType -) -> None: - tk = photo.tk - try: - tk.call(command, photo, repr(ptr)) - except tkinter.TclError: - # activate Tkinter hook - # may raise an error if it cannot attach to Tkinter - from . import _imagingtk - - _imagingtk.tkinit(tk.interpaddr()) - tk.call(command, photo, repr(ptr)) - - -# -------------------------------------------------------------------- -# PhotoImage - - -class PhotoImage: - """ - A Tkinter-compatible photo image. This can be used - everywhere Tkinter expects an image object. If the image is an RGBA - image, pixels having alpha 0 are treated as transparent. - - The constructor takes either a PIL image, or a mode and a size. - Alternatively, you can use the ``file`` or ``data`` options to initialize - the photo image object. - - :param image: Either a PIL image, or a mode string. If a mode string is - used, a size must also be given. - :param size: If the first argument is a mode string, this defines the size - of the image. - :keyword file: A filename to load the image from (using - ``Image.open(file)``). - :keyword data: An 8-bit string containing image data (as loaded from an - image file). - """ - - def __init__( - self, - image: Image.Image | str | None = None, - size: tuple[int, int] | None = None, - **kw: Any, - ) -> None: - # Tk compatibility: file or data - if image is None: - image = _get_image_from_kw(kw) - - if image is None: - msg = "Image is required" - raise ValueError(msg) - elif isinstance(image, str): - mode = image - image = None - - if size is None: - msg = "If first argument is mode, size is required" - raise ValueError(msg) - else: - # got an image instead of a mode - mode = image.mode - if mode == "P": - # palette mapped data - image.apply_transparency() - image.load() - mode = image.palette.mode if image.palette else "RGB" - size = image.size - kw["width"], kw["height"] = size - - if mode not in ["1", "L", "RGB", "RGBA"]: - mode = Image.getmodebase(mode) - - self.__mode = mode - self.__size = size - self.__photo = tkinter.PhotoImage(**kw) - self.tk = self.__photo.tk - if image: - self.paste(image) - - def __del__(self) -> None: - try: - name = self.__photo.name - except AttributeError: - return - self.__photo.name = None - try: - self.__photo.tk.call("image", "delete", name) - except Exception: - pass # ignore internal errors - - def __str__(self) -> str: - """ - Get the Tkinter photo image identifier. This method is automatically - called by Tkinter whenever a PhotoImage object is passed to a Tkinter - method. - - :return: A Tkinter photo image identifier (a string). - """ - return str(self.__photo) - - def width(self) -> int: - """ - Get the width of the image. - - :return: The width, in pixels. - """ - return self.__size[0] - - def height(self) -> int: - """ - Get the height of the image. - - :return: The height, in pixels. - """ - return self.__size[1] - - def paste(self, im: Image.Image) -> None: - """ - Paste a PIL image into the photo image. Note that this can - be very slow if the photo image is displayed. - - :param im: A PIL image. The size must match the target region. If the - mode does not match, the image is converted to the mode of - the bitmap image. - """ - # convert to blittable - ptr = im.getim() - image = im.im - if not image.isblock() or im.mode != self.__mode: - block = Image.core.new_block(self.__mode, im.size) - image.convert2(block, image) # convert directly between buffers - ptr = block.ptr - - _pyimagingtkcall("PyImagingPhoto", self.__photo, ptr) - - -# -------------------------------------------------------------------- -# BitmapImage - - -class BitmapImage: - """ - A Tkinter-compatible bitmap image. This can be used everywhere Tkinter - expects an image object. - - The given image must have mode "1". Pixels having value 0 are treated as - transparent. Options, if any, are passed on to Tkinter. The most commonly - used option is ``foreground``, which is used to specify the color for the - non-transparent parts. See the Tkinter documentation for information on - how to specify colours. - - :param image: A PIL image. - """ - - def __init__(self, image: Image.Image | None = None, **kw: Any) -> None: - # Tk compatibility: file or data - if image is None: - image = _get_image_from_kw(kw) - - if image is None: - msg = "Image is required" - raise ValueError(msg) - self.__mode = image.mode - self.__size = image.size - - self.__photo = tkinter.BitmapImage(data=image.tobitmap(), **kw) - - def __del__(self) -> None: - try: - name = self.__photo.name - except AttributeError: - return - self.__photo.name = None - try: - self.__photo.tk.call("image", "delete", name) - except Exception: - pass # ignore internal errors - - def width(self) -> int: - """ - Get the width of the image. - - :return: The width, in pixels. - """ - return self.__size[0] - - def height(self) -> int: - """ - Get the height of the image. - - :return: The height, in pixels. - """ - return self.__size[1] - - def __str__(self) -> str: - """ - Get the Tkinter bitmap image identifier. This method is automatically - called by Tkinter whenever a BitmapImage object is passed to a Tkinter - method. - - :return: A Tkinter bitmap image identifier (a string). - """ - return str(self.__photo) - - -def getimage(photo: PhotoImage) -> Image.Image: - """Copies the contents of a PhotoImage to a PIL image memory.""" - im = Image.new("RGBA", (photo.width(), photo.height())) - - _pyimagingtkcall("PyImagingPhotoGet", photo, im.getim()) - - return im diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageTransform.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageTransform.py deleted file mode 100644 index fb144ff..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageTransform.py +++ /dev/null @@ -1,136 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# transform wrappers -# -# History: -# 2002-04-08 fl Created -# -# Copyright (c) 2002 by Secret Labs AB -# Copyright (c) 2002 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from collections.abc import Sequence -from typing import Any - -from . import Image - - -class Transform(Image.ImageTransformHandler): - """Base class for other transforms defined in :py:mod:`~PIL.ImageTransform`.""" - - method: Image.Transform - - def __init__(self, data: Sequence[Any]) -> None: - self.data = data - - def getdata(self) -> tuple[Image.Transform, Sequence[int]]: - return self.method, self.data - - def transform( - self, - size: tuple[int, int], - image: Image.Image, - **options: Any, - ) -> Image.Image: - """Perform the transform. Called from :py:meth:`.Image.transform`.""" - # can be overridden - method, data = self.getdata() - return image.transform(size, method, data, **options) - - -class AffineTransform(Transform): - """ - Define an affine image transform. - - This function takes a 6-tuple (a, b, c, d, e, f) which contain the first - two rows from the inverse of an affine transform matrix. For each pixel - (x, y) in the output image, the new value is taken from a position (a x + - b y + c, d x + e y + f) in the input image, rounded to nearest pixel. - - This function can be used to scale, translate, rotate, and shear the - original image. - - See :py:meth:`.Image.transform` - - :param matrix: A 6-tuple (a, b, c, d, e, f) containing the first two rows - from the inverse of an affine transform matrix. - """ - - method = Image.Transform.AFFINE - - -class PerspectiveTransform(Transform): - """ - Define a perspective image transform. - - This function takes an 8-tuple (a, b, c, d, e, f, g, h). For each pixel - (x, y) in the output image, the new value is taken from a position - ((a x + b y + c) / (g x + h y + 1), (d x + e y + f) / (g x + h y + 1)) in - the input image, rounded to nearest pixel. - - This function can be used to scale, translate, rotate, and shear the - original image. - - See :py:meth:`.Image.transform` - - :param matrix: An 8-tuple (a, b, c, d, e, f, g, h). - """ - - method = Image.Transform.PERSPECTIVE - - -class ExtentTransform(Transform): - """ - Define a transform to extract a subregion from an image. - - Maps a rectangle (defined by two corners) from the image to a rectangle of - the given size. The resulting image will contain data sampled from between - the corners, such that (x0, y0) in the input image will end up at (0,0) in - the output image, and (x1, y1) at size. - - This method can be used to crop, stretch, shrink, or mirror an arbitrary - rectangle in the current image. It is slightly slower than crop, but about - as fast as a corresponding resize operation. - - See :py:meth:`.Image.transform` - - :param bbox: A 4-tuple (x0, y0, x1, y1) which specifies two points in the - input image's coordinate system. See :ref:`coordinate-system`. - """ - - method = Image.Transform.EXTENT - - -class QuadTransform(Transform): - """ - Define a quad image transform. - - Maps a quadrilateral (a region defined by four corners) from the image to a - rectangle of the given size. - - See :py:meth:`.Image.transform` - - :param xy: An 8-tuple (x0, y0, x1, y1, x2, y2, x3, y3) which contain the - upper left, lower left, lower right, and upper right corner of the - source quadrilateral. - """ - - method = Image.Transform.QUAD - - -class MeshTransform(Transform): - """ - Define a mesh image transform. A mesh transform consists of one or more - individual quad transforms. - - See :py:meth:`.Image.transform` - - :param data: A list of (bbox, quad) tuples. - """ - - method = Image.Transform.MESH diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImageWin.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImageWin.py deleted file mode 100644 index 98c28f2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImageWin.py +++ /dev/null @@ -1,247 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# a Windows DIB display interface -# -# History: -# 1996-05-20 fl Created -# 1996-09-20 fl Fixed subregion exposure -# 1997-09-21 fl Added draw primitive (for tzPrint) -# 2003-05-21 fl Added experimental Window/ImageWindow classes -# 2003-09-05 fl Added fromstring/tostring methods -# -# Copyright (c) Secret Labs AB 1997-2003. -# Copyright (c) Fredrik Lundh 1996-2003. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image - - -class HDC: - """ - Wraps an HDC integer. The resulting object can be passed to the - :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose` - methods. - """ - - def __init__(self, dc: int) -> None: - self.dc = dc - - def __int__(self) -> int: - return self.dc - - -class HWND: - """ - Wraps an HWND integer. The resulting object can be passed to the - :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose` - methods, instead of a DC. - """ - - def __init__(self, wnd: int) -> None: - self.wnd = wnd - - def __int__(self) -> int: - return self.wnd - - -class Dib: - """ - A Windows bitmap with the given mode and size. The mode can be one of "1", - "L", "P", or "RGB". - - If the display requires a palette, this constructor creates a suitable - palette and associates it with the image. For an "L" image, 128 graylevels - are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together - with 20 graylevels. - - To make sure that palettes work properly under Windows, you must call the - ``palette`` method upon certain events from Windows. - - :param image: Either a PIL image, or a mode string. If a mode string is - used, a size must also be given. The mode can be one of "1", - "L", "P", or "RGB". - :param size: If the first argument is a mode string, this - defines the size of the image. - """ - - def __init__( - self, image: Image.Image | str, size: tuple[int, int] | None = None - ) -> None: - if isinstance(image, str): - mode = image - image = "" - if size is None: - msg = "If first argument is mode, size is required" - raise ValueError(msg) - else: - mode = image.mode - size = image.size - if mode not in ["1", "L", "P", "RGB"]: - mode = Image.getmodebase(mode) - self.image = Image.core.display(mode, size) - self.mode = mode - self.size = size - if image: - assert not isinstance(image, str) - self.paste(image) - - def expose(self, handle: int | HDC | HWND) -> None: - """ - Copy the bitmap contents to a device context. - - :param handle: Device context (HDC), cast to a Python integer, or an - HDC or HWND instance. In PythonWin, you can use - ``CDC.GetHandleAttrib()`` to get a suitable handle. - """ - handle_int = int(handle) - if isinstance(handle, HWND): - dc = self.image.getdc(handle_int) - try: - self.image.expose(dc) - finally: - self.image.releasedc(handle_int, dc) - else: - self.image.expose(handle_int) - - def draw( - self, - handle: int | HDC | HWND, - dst: tuple[int, int, int, int], - src: tuple[int, int, int, int] | None = None, - ) -> None: - """ - Same as expose, but allows you to specify where to draw the image, and - what part of it to draw. - - The destination and source areas are given as 4-tuple rectangles. If - the source is omitted, the entire image is copied. If the source and - the destination have different sizes, the image is resized as - necessary. - """ - if src is None: - src = (0, 0) + self.size - handle_int = int(handle) - if isinstance(handle, HWND): - dc = self.image.getdc(handle_int) - try: - self.image.draw(dc, dst, src) - finally: - self.image.releasedc(handle_int, dc) - else: - self.image.draw(handle_int, dst, src) - - def query_palette(self, handle: int | HDC | HWND) -> int: - """ - Installs the palette associated with the image in the given device - context. - - This method should be called upon **QUERYNEWPALETTE** and - **PALETTECHANGED** events from Windows. If this method returns a - non-zero value, one or more display palette entries were changed, and - the image should be redrawn. - - :param handle: Device context (HDC), cast to a Python integer, or an - HDC or HWND instance. - :return: The number of entries that were changed (if one or more entries, - this indicates that the image should be redrawn). - """ - handle_int = int(handle) - if isinstance(handle, HWND): - handle = self.image.getdc(handle_int) - try: - result = self.image.query_palette(handle) - finally: - self.image.releasedc(handle, handle) - else: - result = self.image.query_palette(handle_int) - return result - - def paste( - self, im: Image.Image, box: tuple[int, int, int, int] | None = None - ) -> None: - """ - Paste a PIL image into the bitmap image. - - :param im: A PIL image. The size must match the target region. - If the mode does not match, the image is converted to the - mode of the bitmap image. - :param box: A 4-tuple defining the left, upper, right, and - lower pixel coordinate. See :ref:`coordinate-system`. If - None is given instead of a tuple, all of the image is - assumed. - """ - im.load() - if self.mode != im.mode: - im = im.convert(self.mode) - if box: - self.image.paste(im.im, box) - else: - self.image.paste(im.im) - - def frombytes(self, buffer: bytes) -> None: - """ - Load display memory contents from byte data. - - :param buffer: A buffer containing display data (usually - data returned from :py:func:`~PIL.ImageWin.Dib.tobytes`) - """ - self.image.frombytes(buffer) - - def tobytes(self) -> bytes: - """ - Copy display memory contents to bytes object. - - :return: A bytes object containing display data. - """ - return self.image.tobytes() - - -class Window: - """Create a Window with the given title size.""" - - def __init__( - self, title: str = "PIL", width: int | None = None, height: int | None = None - ) -> None: - self.hwnd = Image.core.createwindow( - title, self.__dispatcher, width or 0, height or 0 - ) - - def __dispatcher(self, action: str, *args: int) -> None: - getattr(self, f"ui_handle_{action}")(*args) - - def ui_handle_clear(self, dc: int, x0: int, y0: int, x1: int, y1: int) -> None: - pass - - def ui_handle_damage(self, x0: int, y0: int, x1: int, y1: int) -> None: - pass - - def ui_handle_destroy(self) -> None: - pass - - def ui_handle_repair(self, dc: int, x0: int, y0: int, x1: int, y1: int) -> None: - pass - - def ui_handle_resize(self, width: int, height: int) -> None: - pass - - def mainloop(self) -> None: - Image.core.eventloop() - - -class ImageWindow(Window): - """Create an image window which displays the given image.""" - - def __init__(self, image: Image.Image | Dib, title: str = "PIL") -> None: - if not isinstance(image, Dib): - image = Dib(image) - self.image = image - width, height = image.size - super().__init__(title, width=width, height=height) - - def ui_handle_repair(self, dc: int, x0: int, y0: int, x1: int, y1: int) -> None: - self.image.draw(dc, (x0, y0, x1, y1)) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/ImtImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/ImtImagePlugin.py deleted file mode 100644 index c4eccee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/ImtImagePlugin.py +++ /dev/null @@ -1,103 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# IM Tools support for PIL -# -# history: -# 1996-05-27 fl Created (read 8-bit images only) -# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.2) -# -# Copyright (c) Secret Labs AB 1997-2001. -# Copyright (c) Fredrik Lundh 1996-2001. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import re - -from . import Image, ImageFile - -# -# -------------------------------------------------------------------- - -field = re.compile(rb"([a-z]*) ([^ \r\n]*)") - - -## -# Image plugin for IM Tools images. - - -class ImtImageFile(ImageFile.ImageFile): - format = "IMT" - format_description = "IM Tools" - - def _open(self) -> None: - # Quick rejection: if there's not a LF among the first - # 100 bytes, this is (probably) not a text header. - - assert self.fp is not None - - buffer = self.fp.read(100) - if b"\n" not in buffer: - msg = "not an IM file" - raise SyntaxError(msg) - - xsize = ysize = 0 - - while True: - if buffer: - s = buffer[:1] - buffer = buffer[1:] - else: - s = self.fp.read(1) - if not s: - break - - if s == b"\x0c": - # image data begins - self.tile = [ - ImageFile._Tile( - "raw", - (0, 0) + self.size, - self.fp.tell() - len(buffer), - self.mode, - ) - ] - - break - - else: - # read key/value pair - if b"\n" not in buffer: - buffer += self.fp.read(100) - lines = buffer.split(b"\n") - s += lines.pop(0) - buffer = b"\n".join(lines) - if len(s) == 1 or len(s) > 100: - break - if s[0] == ord(b"*"): - continue # comment - - m = field.match(s) - if not m: - break - k, v = m.group(1, 2) - if k == b"width": - xsize = int(v) - self._size = xsize, ysize - elif k == b"height": - ysize = int(v) - self._size = xsize, ysize - elif k == b"pixel" and v == b"n8": - self._mode = "L" - - -# -# -------------------------------------------------------------------- - -Image.register_open(ImtImageFile.format, ImtImageFile) - -# -# no extension registered (".im" is simply too common) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/IptcImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/IptcImagePlugin.py deleted file mode 100644 index fc024d6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/IptcImagePlugin.py +++ /dev/null @@ -1,250 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# IPTC/NAA file handling -# -# history: -# 1995-10-01 fl Created -# 1998-03-09 fl Cleaned up and added to PIL -# 2002-06-18 fl Added getiptcinfo helper -# -# Copyright (c) Secret Labs AB 1997-2002. -# Copyright (c) Fredrik Lundh 1995. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from collections.abc import Sequence -from io import BytesIO -from typing import cast - -from . import Image, ImageFile -from ._binary import i16be as i16 -from ._binary import i32be as i32 -from ._deprecate import deprecate - -COMPRESSION = {1: "raw", 5: "jpeg"} - - -def __getattr__(name: str) -> bytes: - if name == "PAD": - deprecate("IptcImagePlugin.PAD", 12) - return b"\0\0\0\0" - msg = f"module '{__name__}' has no attribute '{name}'" - raise AttributeError(msg) - - -# -# Helpers - - -def _i(c: bytes) -> int: - return i32((b"\0\0\0\0" + c)[-4:]) - - -def _i8(c: int | bytes) -> int: - return c if isinstance(c, int) else c[0] - - -def i(c: bytes) -> int: - """.. deprecated:: 10.2.0""" - deprecate("IptcImagePlugin.i", 12) - return _i(c) - - -def dump(c: Sequence[int | bytes]) -> None: - """.. deprecated:: 10.2.0""" - deprecate("IptcImagePlugin.dump", 12) - for i in c: - print(f"{_i8(i):02x}", end=" ") - print() - - -## -# Image plugin for IPTC/NAA datastreams. To read IPTC/NAA fields -# from TIFF and JPEG files, use the getiptcinfo function. - - -class IptcImageFile(ImageFile.ImageFile): - format = "IPTC" - format_description = "IPTC/NAA" - - def getint(self, key: tuple[int, int]) -> int: - return _i(self.info[key]) - - def field(self) -> tuple[tuple[int, int] | None, int]: - # - # get a IPTC field header - s = self.fp.read(5) - if not s.strip(b"\x00"): - return None, 0 - - tag = s[1], s[2] - - # syntax - if s[0] != 0x1C or tag[0] not in [1, 2, 3, 4, 5, 6, 7, 8, 9, 240]: - msg = "invalid IPTC/NAA file" - raise SyntaxError(msg) - - # field size - size = s[3] - if size > 132: - msg = "illegal field length in IPTC/NAA file" - raise OSError(msg) - elif size == 128: - size = 0 - elif size > 128: - size = _i(self.fp.read(size - 128)) - else: - size = i16(s, 3) - - return tag, size - - def _open(self) -> None: - # load descriptive fields - while True: - offset = self.fp.tell() - tag, size = self.field() - if not tag or tag == (8, 10): - break - if size: - tagdata = self.fp.read(size) - else: - tagdata = None - if tag in self.info: - if isinstance(self.info[tag], list): - self.info[tag].append(tagdata) - else: - self.info[tag] = [self.info[tag], tagdata] - else: - self.info[tag] = tagdata - - # mode - layers = self.info[(3, 60)][0] - component = self.info[(3, 60)][1] - if (3, 65) in self.info: - id = self.info[(3, 65)][0] - 1 - else: - id = 0 - if layers == 1 and not component: - self._mode = "L" - elif layers == 3 and component: - self._mode = "RGB"[id] - elif layers == 4 and component: - self._mode = "CMYK"[id] - - # size - self._size = self.getint((3, 20)), self.getint((3, 30)) - - # compression - try: - compression = COMPRESSION[self.getint((3, 120))] - except KeyError as e: - msg = "Unknown IPTC image compression" - raise OSError(msg) from e - - # tile - if tag == (8, 10): - self.tile = [ - ImageFile._Tile("iptc", (0, 0) + self.size, offset, compression) - ] - - def load(self) -> Image.core.PixelAccess | None: - if len(self.tile) != 1 or self.tile[0][0] != "iptc": - return ImageFile.ImageFile.load(self) - - offset, compression = self.tile[0][2:] - - self.fp.seek(offset) - - # Copy image data to temporary file - o = BytesIO() - if compression == "raw": - # To simplify access to the extracted file, - # prepend a PPM header - o.write(b"P5\n%d %d\n255\n" % self.size) - while True: - type, size = self.field() - if type != (8, 10): - break - while size > 0: - s = self.fp.read(min(size, 8192)) - if not s: - break - o.write(s) - size -= len(s) - - with Image.open(o) as _im: - _im.load() - self.im = _im.im - self.tile = [] - return Image.Image.load(self) - - -Image.register_open(IptcImageFile.format, IptcImageFile) - -Image.register_extension(IptcImageFile.format, ".iim") - - -def getiptcinfo( - im: ImageFile.ImageFile, -) -> dict[tuple[int, int], bytes | list[bytes]] | None: - """ - Get IPTC information from TIFF, JPEG, or IPTC file. - - :param im: An image containing IPTC data. - :returns: A dictionary containing IPTC information, or None if - no IPTC information block was found. - """ - from . import JpegImagePlugin, TiffImagePlugin - - data = None - - info: dict[tuple[int, int], bytes | list[bytes]] = {} - if isinstance(im, IptcImageFile): - # return info dictionary right away - for k, v in im.info.items(): - if isinstance(k, tuple): - info[k] = v - return info - - elif isinstance(im, JpegImagePlugin.JpegImageFile): - # extract the IPTC/NAA resource - photoshop = im.info.get("photoshop") - if photoshop: - data = photoshop.get(0x0404) - - elif isinstance(im, TiffImagePlugin.TiffImageFile): - # get raw data from the IPTC/NAA tag (PhotoShop tags the data - # as 4-byte integers, so we cannot use the get method...) - try: - data = im.tag_v2._tagdata[TiffImagePlugin.IPTC_NAA_CHUNK] - except KeyError: - pass - - if data is None: - return None # no properties - - # create an IptcImagePlugin object without initializing it - class FakeImage: - pass - - fake_im = FakeImage() - fake_im.__class__ = IptcImageFile # type: ignore[assignment] - iptc_im = cast(IptcImageFile, fake_im) - - # parse the IPTC information chunk - iptc_im.info = {} - iptc_im.fp = BytesIO(data) - - try: - iptc_im._open() - except (IndexError, KeyError): - pass # expected failure - - for k, v in iptc_im.info.items(): - if isinstance(k, tuple): - info[k] = v - return info diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/Jpeg2KImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/Jpeg2KImagePlugin.py deleted file mode 100644 index e0f4eca..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/Jpeg2KImagePlugin.py +++ /dev/null @@ -1,442 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# JPEG2000 file handling -# -# History: -# 2014-03-12 ajh Created -# 2021-06-30 rogermb Extract dpi information from the 'resc' header box -# -# Copyright (c) 2014 Coriolis Systems Limited -# Copyright (c) 2014 Alastair Houghton -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -import os -import struct -from collections.abc import Callable -from typing import IO, cast - -from . import Image, ImageFile, ImagePalette, _binary - - -class BoxReader: - """ - A small helper class to read fields stored in JPEG2000 header boxes - and to easily step into and read sub-boxes. - """ - - def __init__(self, fp: IO[bytes], length: int = -1) -> None: - self.fp = fp - self.has_length = length >= 0 - self.length = length - self.remaining_in_box = -1 - - def _can_read(self, num_bytes: int) -> bool: - if self.has_length and self.fp.tell() + num_bytes > self.length: - # Outside box: ensure we don't read past the known file length - return False - if self.remaining_in_box >= 0: - # Inside box contents: ensure read does not go past box boundaries - return num_bytes <= self.remaining_in_box - else: - return True # No length known, just read - - def _read_bytes(self, num_bytes: int) -> bytes: - if not self._can_read(num_bytes): - msg = "Not enough data in header" - raise SyntaxError(msg) - - data = self.fp.read(num_bytes) - if len(data) < num_bytes: - msg = f"Expected to read {num_bytes} bytes but only got {len(data)}." - raise OSError(msg) - - if self.remaining_in_box > 0: - self.remaining_in_box -= num_bytes - return data - - def read_fields(self, field_format: str) -> tuple[int | bytes, ...]: - size = struct.calcsize(field_format) - data = self._read_bytes(size) - return struct.unpack(field_format, data) - - def read_boxes(self) -> BoxReader: - size = self.remaining_in_box - data = self._read_bytes(size) - return BoxReader(io.BytesIO(data), size) - - def has_next_box(self) -> bool: - if self.has_length: - return self.fp.tell() + self.remaining_in_box < self.length - else: - return True - - def next_box_type(self) -> bytes: - # Skip the rest of the box if it has not been read - if self.remaining_in_box > 0: - self.fp.seek(self.remaining_in_box, os.SEEK_CUR) - self.remaining_in_box = -1 - - # Read the length and type of the next box - lbox, tbox = cast(tuple[int, bytes], self.read_fields(">I4s")) - if lbox == 1: - lbox = cast(int, self.read_fields(">Q")[0]) - hlen = 16 - else: - hlen = 8 - - if lbox < hlen or not self._can_read(lbox - hlen): - msg = "Invalid header length" - raise SyntaxError(msg) - - self.remaining_in_box = lbox - hlen - return tbox - - -def _parse_codestream(fp: IO[bytes]) -> tuple[tuple[int, int], str]: - """Parse the JPEG 2000 codestream to extract the size and component - count from the SIZ marker segment, returning a PIL (size, mode) tuple.""" - - hdr = fp.read(2) - lsiz = _binary.i16be(hdr) - siz = hdr + fp.read(lsiz - 2) - lsiz, rsiz, xsiz, ysiz, xosiz, yosiz, _, _, _, _, csiz = struct.unpack_from( - ">HHIIIIIIIIH", siz - ) - - size = (xsiz - xosiz, ysiz - yosiz) - if csiz == 1: - ssiz = struct.unpack_from(">B", siz, 38) - if (ssiz[0] & 0x7F) + 1 > 8: - mode = "I;16" - else: - mode = "L" - elif csiz == 2: - mode = "LA" - elif csiz == 3: - mode = "RGB" - elif csiz == 4: - mode = "RGBA" - else: - msg = "unable to determine J2K image mode" - raise SyntaxError(msg) - - return size, mode - - -def _res_to_dpi(num: int, denom: int, exp: int) -> float | None: - """Convert JPEG2000's (numerator, denominator, exponent-base-10) resolution, - calculated as (num / denom) * 10^exp and stored in dots per meter, - to floating-point dots per inch.""" - if denom == 0: - return None - return (254 * num * (10**exp)) / (10000 * denom) - - -def _parse_jp2_header( - fp: IO[bytes], -) -> tuple[ - tuple[int, int], - str, - str | None, - tuple[float, float] | None, - ImagePalette.ImagePalette | None, -]: - """Parse the JP2 header box to extract size, component count, - color space information, and optionally DPI information, - returning a (size, mode, mimetype, dpi) tuple.""" - - # Find the JP2 header box - reader = BoxReader(fp) - header = None - mimetype = None - while reader.has_next_box(): - tbox = reader.next_box_type() - - if tbox == b"jp2h": - header = reader.read_boxes() - break - elif tbox == b"ftyp": - if reader.read_fields(">4s")[0] == b"jpx ": - mimetype = "image/jpx" - assert header is not None - - size = None - mode = None - bpc = None - nc = None - dpi = None # 2-tuple of DPI info, or None - palette = None - - while header.has_next_box(): - tbox = header.next_box_type() - - if tbox == b"ihdr": - height, width, nc, bpc = header.read_fields(">IIHB") - assert isinstance(height, int) - assert isinstance(width, int) - assert isinstance(bpc, int) - size = (width, height) - if nc == 1 and (bpc & 0x7F) > 8: - mode = "I;16" - elif nc == 1: - mode = "L" - elif nc == 2: - mode = "LA" - elif nc == 3: - mode = "RGB" - elif nc == 4: - mode = "RGBA" - elif tbox == b"colr" and nc == 4: - meth, _, _, enumcs = header.read_fields(">BBBI") - if meth == 1 and enumcs == 12: - mode = "CMYK" - elif tbox == b"pclr" and mode in ("L", "LA"): - ne, npc = header.read_fields(">HB") - assert isinstance(ne, int) - assert isinstance(npc, int) - max_bitdepth = 0 - for bitdepth in header.read_fields(">" + ("B" * npc)): - assert isinstance(bitdepth, int) - if bitdepth > max_bitdepth: - max_bitdepth = bitdepth - if max_bitdepth <= 8: - palette = ImagePalette.ImagePalette("RGBA" if npc == 4 else "RGB") - for i in range(ne): - color: list[int] = [] - for value in header.read_fields(">" + ("B" * npc)): - assert isinstance(value, int) - color.append(value) - palette.getcolor(tuple(color)) - mode = "P" if mode == "L" else "PA" - elif tbox == b"res ": - res = header.read_boxes() - while res.has_next_box(): - tres = res.next_box_type() - if tres == b"resc": - vrcn, vrcd, hrcn, hrcd, vrce, hrce = res.read_fields(">HHHHBB") - assert isinstance(vrcn, int) - assert isinstance(vrcd, int) - assert isinstance(hrcn, int) - assert isinstance(hrcd, int) - assert isinstance(vrce, int) - assert isinstance(hrce, int) - hres = _res_to_dpi(hrcn, hrcd, hrce) - vres = _res_to_dpi(vrcn, vrcd, vrce) - if hres is not None and vres is not None: - dpi = (hres, vres) - break - - if size is None or mode is None: - msg = "Malformed JP2 header" - raise SyntaxError(msg) - - return size, mode, mimetype, dpi, palette - - -## -# Image plugin for JPEG2000 images. - - -class Jpeg2KImageFile(ImageFile.ImageFile): - format = "JPEG2000" - format_description = "JPEG 2000 (ISO 15444)" - - def _open(self) -> None: - sig = self.fp.read(4) - if sig == b"\xff\x4f\xff\x51": - self.codec = "j2k" - self._size, self._mode = _parse_codestream(self.fp) - self._parse_comment() - else: - sig = sig + self.fp.read(8) - - if sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a": - self.codec = "jp2" - header = _parse_jp2_header(self.fp) - self._size, self._mode, self.custom_mimetype, dpi, self.palette = header - if dpi is not None: - self.info["dpi"] = dpi - if self.fp.read(12).endswith(b"jp2c\xff\x4f\xff\x51"): - hdr = self.fp.read(2) - length = _binary.i16be(hdr) - self.fp.seek(length - 2, os.SEEK_CUR) - self._parse_comment() - else: - msg = "not a JPEG 2000 file" - raise SyntaxError(msg) - - self._reduce = 0 - self.layers = 0 - - fd = -1 - length = -1 - - try: - fd = self.fp.fileno() - length = os.fstat(fd).st_size - except Exception: - fd = -1 - try: - pos = self.fp.tell() - self.fp.seek(0, io.SEEK_END) - length = self.fp.tell() - self.fp.seek(pos) - except Exception: - length = -1 - - self.tile = [ - ImageFile._Tile( - "jpeg2k", - (0, 0) + self.size, - 0, - (self.codec, self._reduce, self.layers, fd, length), - ) - ] - - def _parse_comment(self) -> None: - while True: - marker = self.fp.read(2) - if not marker: - break - typ = marker[1] - if typ in (0x90, 0xD9): - # Start of tile or end of codestream - break - hdr = self.fp.read(2) - length = _binary.i16be(hdr) - if typ == 0x64: - # Comment - self.info["comment"] = self.fp.read(length - 2)[2:] - break - else: - self.fp.seek(length - 2, os.SEEK_CUR) - - @property # type: ignore[override] - def reduce( - self, - ) -> ( - Callable[[int | tuple[int, int], tuple[int, int, int, int] | None], Image.Image] - | int - ): - # https://github.com/python-pillow/Pillow/issues/4343 found that the - # new Image 'reduce' method was shadowed by this plugin's 'reduce' - # property. This attempts to allow for both scenarios - return self._reduce or super().reduce - - @reduce.setter - def reduce(self, value: int) -> None: - self._reduce = value - - def load(self) -> Image.core.PixelAccess | None: - if self.tile and self._reduce: - power = 1 << self._reduce - adjust = power >> 1 - self._size = ( - int((self.size[0] + adjust) / power), - int((self.size[1] + adjust) / power), - ) - - # Update the reduce and layers settings - t = self.tile[0] - assert isinstance(t[3], tuple) - t3 = (t[3][0], self._reduce, self.layers, t[3][3], t[3][4]) - self.tile = [ImageFile._Tile(t[0], (0, 0) + self.size, t[2], t3)] - - return ImageFile.ImageFile.load(self) - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith( - (b"\xff\x4f\xff\x51", b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a") - ) - - -# ------------------------------------------------------------ -# Save support - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - # Get the keyword arguments - info = im.encoderinfo - - if isinstance(filename, str): - filename = filename.encode() - if filename.endswith(b".j2k") or info.get("no_jp2", False): - kind = "j2k" - else: - kind = "jp2" - - offset = info.get("offset", None) - tile_offset = info.get("tile_offset", None) - tile_size = info.get("tile_size", None) - quality_mode = info.get("quality_mode", "rates") - quality_layers = info.get("quality_layers", None) - if quality_layers is not None and not ( - isinstance(quality_layers, (list, tuple)) - and all( - isinstance(quality_layer, (int, float)) for quality_layer in quality_layers - ) - ): - msg = "quality_layers must be a sequence of numbers" - raise ValueError(msg) - - num_resolutions = info.get("num_resolutions", 0) - cblk_size = info.get("codeblock_size", None) - precinct_size = info.get("precinct_size", None) - irreversible = info.get("irreversible", False) - progression = info.get("progression", "LRCP") - cinema_mode = info.get("cinema_mode", "no") - mct = info.get("mct", 0) - signed = info.get("signed", False) - comment = info.get("comment") - if isinstance(comment, str): - comment = comment.encode() - plt = info.get("plt", False) - - fd = -1 - if hasattr(fp, "fileno"): - try: - fd = fp.fileno() - except Exception: - fd = -1 - - im.encoderconfig = ( - offset, - tile_offset, - tile_size, - quality_mode, - quality_layers, - num_resolutions, - cblk_size, - precinct_size, - irreversible, - progression, - cinema_mode, - mct, - signed, - fd, - comment, - plt, - ) - - ImageFile._save(im, fp, [ImageFile._Tile("jpeg2k", (0, 0) + im.size, 0, kind)]) - - -# ------------------------------------------------------------ -# Registry stuff - - -Image.register_open(Jpeg2KImageFile.format, Jpeg2KImageFile, _accept) -Image.register_save(Jpeg2KImageFile.format, _save) - -Image.register_extensions( - Jpeg2KImageFile.format, [".jp2", ".j2k", ".jpc", ".jpf", ".jpx", ".j2c"] -) - -Image.register_mime(Jpeg2KImageFile.format, "image/jp2") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/JpegImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/JpegImagePlugin.py deleted file mode 100644 index defe9f7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/JpegImagePlugin.py +++ /dev/null @@ -1,902 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# JPEG (JFIF) file handling -# -# See "Digital Compression and Coding of Continuous-Tone Still Images, -# Part 1, Requirements and Guidelines" (CCITT T.81 / ISO 10918-1) -# -# History: -# 1995-09-09 fl Created -# 1995-09-13 fl Added full parser -# 1996-03-25 fl Added hack to use the IJG command line utilities -# 1996-05-05 fl Workaround Photoshop 2.5 CMYK polarity bug -# 1996-05-28 fl Added draft support, JFIF version (0.1) -# 1996-12-30 fl Added encoder options, added progression property (0.2) -# 1997-08-27 fl Save mode 1 images as BW (0.3) -# 1998-07-12 fl Added YCbCr to draft and save methods (0.4) -# 1998-10-19 fl Don't hang on files using 16-bit DQT's (0.4.1) -# 2001-04-16 fl Extract DPI settings from JFIF files (0.4.2) -# 2002-07-01 fl Skip pad bytes before markers; identify Exif files (0.4.3) -# 2003-04-25 fl Added experimental EXIF decoder (0.5) -# 2003-06-06 fl Added experimental EXIF GPSinfo decoder -# 2003-09-13 fl Extract COM markers -# 2009-09-06 fl Added icc_profile support (from Florian Hoech) -# 2009-03-06 fl Changed CMYK handling; always use Adobe polarity (0.6) -# 2009-03-08 fl Added subsampling support (from Justin Huff). -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1995-1996 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import array -import io -import math -import os -import struct -import subprocess -import sys -import tempfile -import warnings -from typing import IO, Any - -from . import Image, ImageFile -from ._binary import i16be as i16 -from ._binary import i32be as i32 -from ._binary import o8 -from ._binary import o16be as o16 -from ._deprecate import deprecate -from .JpegPresets import presets - -TYPE_CHECKING = False -if TYPE_CHECKING: - from .MpoImagePlugin import MpoImageFile - -# -# Parser - - -def Skip(self: JpegImageFile, marker: int) -> None: - n = i16(self.fp.read(2)) - 2 - ImageFile._safe_read(self.fp, n) - - -def APP(self: JpegImageFile, marker: int) -> None: - # - # Application marker. Store these in the APP dictionary. - # Also look for well-known application markers. - - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - - app = f"APP{marker & 15}" - - self.app[app] = s # compatibility - self.applist.append((app, s)) - - if marker == 0xFFE0 and s.startswith(b"JFIF"): - # extract JFIF information - self.info["jfif"] = version = i16(s, 5) # version - self.info["jfif_version"] = divmod(version, 256) - # extract JFIF properties - try: - jfif_unit = s[7] - jfif_density = i16(s, 8), i16(s, 10) - except Exception: - pass - else: - if jfif_unit == 1: - self.info["dpi"] = jfif_density - elif jfif_unit == 2: # cm - # 1 dpcm = 2.54 dpi - self.info["dpi"] = tuple(d * 2.54 for d in jfif_density) - self.info["jfif_unit"] = jfif_unit - self.info["jfif_density"] = jfif_density - elif marker == 0xFFE1 and s.startswith(b"Exif\0\0"): - # extract EXIF information - if "exif" in self.info: - self.info["exif"] += s[6:] - else: - self.info["exif"] = s - self._exif_offset = self.fp.tell() - n + 6 - elif marker == 0xFFE1 and s.startswith(b"http://ns.adobe.com/xap/1.0/\x00"): - self.info["xmp"] = s.split(b"\x00", 1)[1] - elif marker == 0xFFE2 and s.startswith(b"FPXR\0"): - # extract FlashPix information (incomplete) - self.info["flashpix"] = s # FIXME: value will change - elif marker == 0xFFE2 and s.startswith(b"ICC_PROFILE\0"): - # Since an ICC profile can be larger than the maximum size of - # a JPEG marker (64K), we need provisions to split it into - # multiple markers. The format defined by the ICC specifies - # one or more APP2 markers containing the following data: - # Identifying string ASCII "ICC_PROFILE\0" (12 bytes) - # Marker sequence number 1, 2, etc (1 byte) - # Number of markers Total of APP2's used (1 byte) - # Profile data (remainder of APP2 data) - # Decoders should use the marker sequence numbers to - # reassemble the profile, rather than assuming that the APP2 - # markers appear in the correct sequence. - self.icclist.append(s) - elif marker == 0xFFED and s.startswith(b"Photoshop 3.0\x00"): - # parse the image resource block - offset = 14 - photoshop = self.info.setdefault("photoshop", {}) - while s[offset : offset + 4] == b"8BIM": - try: - offset += 4 - # resource code - code = i16(s, offset) - offset += 2 - # resource name (usually empty) - name_len = s[offset] - # name = s[offset+1:offset+1+name_len] - offset += 1 + name_len - offset += offset & 1 # align - # resource data block - size = i32(s, offset) - offset += 4 - data = s[offset : offset + size] - if code == 0x03ED: # ResolutionInfo - photoshop[code] = { - "XResolution": i32(data, 0) / 65536, - "DisplayedUnitsX": i16(data, 4), - "YResolution": i32(data, 8) / 65536, - "DisplayedUnitsY": i16(data, 12), - } - else: - photoshop[code] = data - offset += size - offset += offset & 1 # align - except struct.error: - break # insufficient data - - elif marker == 0xFFEE and s.startswith(b"Adobe"): - self.info["adobe"] = i16(s, 5) - # extract Adobe custom properties - try: - adobe_transform = s[11] - except IndexError: - pass - else: - self.info["adobe_transform"] = adobe_transform - elif marker == 0xFFE2 and s.startswith(b"MPF\0"): - # extract MPO information - self.info["mp"] = s[4:] - # offset is current location minus buffer size - # plus constant header size - self.info["mpoffset"] = self.fp.tell() - n + 4 - - -def COM(self: JpegImageFile, marker: int) -> None: - # - # Comment marker. Store these in the APP dictionary. - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - - self.info["comment"] = s - self.app["COM"] = s # compatibility - self.applist.append(("COM", s)) - - -def SOF(self: JpegImageFile, marker: int) -> None: - # - # Start of frame marker. Defines the size and mode of the - # image. JPEG is colour blind, so we use some simple - # heuristics to map the number of layers to an appropriate - # mode. Note that this could be made a bit brighter, by - # looking for JFIF and Adobe APP markers. - - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - self._size = i16(s, 3), i16(s, 1) - - self.bits = s[0] - if self.bits != 8: - msg = f"cannot handle {self.bits}-bit layers" - raise SyntaxError(msg) - - self.layers = s[5] - if self.layers == 1: - self._mode = "L" - elif self.layers == 3: - self._mode = "RGB" - elif self.layers == 4: - self._mode = "CMYK" - else: - msg = f"cannot handle {self.layers}-layer images" - raise SyntaxError(msg) - - if marker in [0xFFC2, 0xFFC6, 0xFFCA, 0xFFCE]: - self.info["progressive"] = self.info["progression"] = 1 - - if self.icclist: - # fixup icc profile - self.icclist.sort() # sort by sequence number - if self.icclist[0][13] == len(self.icclist): - profile = [p[14:] for p in self.icclist] - icc_profile = b"".join(profile) - else: - icc_profile = None # wrong number of fragments - self.info["icc_profile"] = icc_profile - self.icclist = [] - - for i in range(6, len(s), 3): - t = s[i : i + 3] - # 4-tuples: id, vsamp, hsamp, qtable - self.layer.append((t[0], t[1] // 16, t[1] & 15, t[2])) - - -def DQT(self: JpegImageFile, marker: int) -> None: - # - # Define quantization table. Note that there might be more - # than one table in each marker. - - # FIXME: The quantization tables can be used to estimate the - # compression quality. - - n = i16(self.fp.read(2)) - 2 - s = ImageFile._safe_read(self.fp, n) - while len(s): - v = s[0] - precision = 1 if (v // 16 == 0) else 2 # in bytes - qt_length = 1 + precision * 64 - if len(s) < qt_length: - msg = "bad quantization table marker" - raise SyntaxError(msg) - data = array.array("B" if precision == 1 else "H", s[1:qt_length]) - if sys.byteorder == "little" and precision > 1: - data.byteswap() # the values are always big-endian - self.quantization[v & 15] = [data[i] for i in zigzag_index] - s = s[qt_length:] - - -# -# JPEG marker table - -MARKER = { - 0xFFC0: ("SOF0", "Baseline DCT", SOF), - 0xFFC1: ("SOF1", "Extended Sequential DCT", SOF), - 0xFFC2: ("SOF2", "Progressive DCT", SOF), - 0xFFC3: ("SOF3", "Spatial lossless", SOF), - 0xFFC4: ("DHT", "Define Huffman table", Skip), - 0xFFC5: ("SOF5", "Differential sequential DCT", SOF), - 0xFFC6: ("SOF6", "Differential progressive DCT", SOF), - 0xFFC7: ("SOF7", "Differential spatial", SOF), - 0xFFC8: ("JPG", "Extension", None), - 0xFFC9: ("SOF9", "Extended sequential DCT (AC)", SOF), - 0xFFCA: ("SOF10", "Progressive DCT (AC)", SOF), - 0xFFCB: ("SOF11", "Spatial lossless DCT (AC)", SOF), - 0xFFCC: ("DAC", "Define arithmetic coding conditioning", Skip), - 0xFFCD: ("SOF13", "Differential sequential DCT (AC)", SOF), - 0xFFCE: ("SOF14", "Differential progressive DCT (AC)", SOF), - 0xFFCF: ("SOF15", "Differential spatial (AC)", SOF), - 0xFFD0: ("RST0", "Restart 0", None), - 0xFFD1: ("RST1", "Restart 1", None), - 0xFFD2: ("RST2", "Restart 2", None), - 0xFFD3: ("RST3", "Restart 3", None), - 0xFFD4: ("RST4", "Restart 4", None), - 0xFFD5: ("RST5", "Restart 5", None), - 0xFFD6: ("RST6", "Restart 6", None), - 0xFFD7: ("RST7", "Restart 7", None), - 0xFFD8: ("SOI", "Start of image", None), - 0xFFD9: ("EOI", "End of image", None), - 0xFFDA: ("SOS", "Start of scan", Skip), - 0xFFDB: ("DQT", "Define quantization table", DQT), - 0xFFDC: ("DNL", "Define number of lines", Skip), - 0xFFDD: ("DRI", "Define restart interval", Skip), - 0xFFDE: ("DHP", "Define hierarchical progression", SOF), - 0xFFDF: ("EXP", "Expand reference component", Skip), - 0xFFE0: ("APP0", "Application segment 0", APP), - 0xFFE1: ("APP1", "Application segment 1", APP), - 0xFFE2: ("APP2", "Application segment 2", APP), - 0xFFE3: ("APP3", "Application segment 3", APP), - 0xFFE4: ("APP4", "Application segment 4", APP), - 0xFFE5: ("APP5", "Application segment 5", APP), - 0xFFE6: ("APP6", "Application segment 6", APP), - 0xFFE7: ("APP7", "Application segment 7", APP), - 0xFFE8: ("APP8", "Application segment 8", APP), - 0xFFE9: ("APP9", "Application segment 9", APP), - 0xFFEA: ("APP10", "Application segment 10", APP), - 0xFFEB: ("APP11", "Application segment 11", APP), - 0xFFEC: ("APP12", "Application segment 12", APP), - 0xFFED: ("APP13", "Application segment 13", APP), - 0xFFEE: ("APP14", "Application segment 14", APP), - 0xFFEF: ("APP15", "Application segment 15", APP), - 0xFFF0: ("JPG0", "Extension 0", None), - 0xFFF1: ("JPG1", "Extension 1", None), - 0xFFF2: ("JPG2", "Extension 2", None), - 0xFFF3: ("JPG3", "Extension 3", None), - 0xFFF4: ("JPG4", "Extension 4", None), - 0xFFF5: ("JPG5", "Extension 5", None), - 0xFFF6: ("JPG6", "Extension 6", None), - 0xFFF7: ("JPG7", "Extension 7", None), - 0xFFF8: ("JPG8", "Extension 8", None), - 0xFFF9: ("JPG9", "Extension 9", None), - 0xFFFA: ("JPG10", "Extension 10", None), - 0xFFFB: ("JPG11", "Extension 11", None), - 0xFFFC: ("JPG12", "Extension 12", None), - 0xFFFD: ("JPG13", "Extension 13", None), - 0xFFFE: ("COM", "Comment", COM), -} - - -def _accept(prefix: bytes) -> bool: - # Magic number was taken from https://en.wikipedia.org/wiki/JPEG - return prefix.startswith(b"\xff\xd8\xff") - - -## -# Image plugin for JPEG and JFIF images. - - -class JpegImageFile(ImageFile.ImageFile): - format = "JPEG" - format_description = "JPEG (ISO 10918)" - - def _open(self) -> None: - s = self.fp.read(3) - - if not _accept(s): - msg = "not a JPEG file" - raise SyntaxError(msg) - s = b"\xff" - - # Create attributes - self.bits = self.layers = 0 - self._exif_offset = 0 - - # JPEG specifics (internal) - self.layer: list[tuple[int, int, int, int]] = [] - self._huffman_dc: dict[Any, Any] = {} - self._huffman_ac: dict[Any, Any] = {} - self.quantization: dict[int, list[int]] = {} - self.app: dict[str, bytes] = {} # compatibility - self.applist: list[tuple[str, bytes]] = [] - self.icclist: list[bytes] = [] - - while True: - i = s[0] - if i == 0xFF: - s = s + self.fp.read(1) - i = i16(s) - else: - # Skip non-0xFF junk - s = self.fp.read(1) - continue - - if i in MARKER: - name, description, handler = MARKER[i] - if handler is not None: - handler(self, i) - if i == 0xFFDA: # start of scan - rawmode = self.mode - if self.mode == "CMYK": - rawmode = "CMYK;I" # assume adobe conventions - self.tile = [ - ImageFile._Tile("jpeg", (0, 0) + self.size, 0, (rawmode, "")) - ] - # self.__offset = self.fp.tell() - break - s = self.fp.read(1) - elif i in {0, 0xFFFF}: - # padded marker or junk; move on - s = b"\xff" - elif i == 0xFF00: # Skip extraneous data (escaped 0xFF) - s = self.fp.read(1) - else: - msg = "no marker found" - raise SyntaxError(msg) - - self._read_dpi_from_exif() - - def __getattr__(self, name: str) -> Any: - if name in ("huffman_ac", "huffman_dc"): - deprecate(name, 12) - return getattr(self, "_" + name) - raise AttributeError(name) - - def __getstate__(self) -> list[Any]: - return super().__getstate__() + [self.layers, self.layer] - - def __setstate__(self, state: list[Any]) -> None: - self.layers, self.layer = state[6:] - super().__setstate__(state) - - def load_read(self, read_bytes: int) -> bytes: - """ - internal: read more image data - For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker - so libjpeg can finish decoding - """ - s = self.fp.read(read_bytes) - - if not s and ImageFile.LOAD_TRUNCATED_IMAGES and not hasattr(self, "_ended"): - # Premature EOF. - # Pretend file is finished adding EOI marker - self._ended = True - return b"\xff\xd9" - - return s - - def draft( - self, mode: str | None, size: tuple[int, int] | None - ) -> tuple[str, tuple[int, int, float, float]] | None: - if len(self.tile) != 1: - return None - - # Protect from second call - if self.decoderconfig: - return None - - d, e, o, a = self.tile[0] - scale = 1 - original_size = self.size - - assert isinstance(a, tuple) - if a[0] == "RGB" and mode in ["L", "YCbCr"]: - self._mode = mode - a = mode, "" - - if size: - scale = min(self.size[0] // size[0], self.size[1] // size[1]) - for s in [8, 4, 2, 1]: - if scale >= s: - break - assert e is not None - e = ( - e[0], - e[1], - (e[2] - e[0] + s - 1) // s + e[0], - (e[3] - e[1] + s - 1) // s + e[1], - ) - self._size = ((self.size[0] + s - 1) // s, (self.size[1] + s - 1) // s) - scale = s - - self.tile = [ImageFile._Tile(d, e, o, a)] - self.decoderconfig = (scale, 0) - - box = (0, 0, original_size[0] / scale, original_size[1] / scale) - return self.mode, box - - def load_djpeg(self) -> None: - # ALTERNATIVE: handle JPEGs via the IJG command line utilities - - f, path = tempfile.mkstemp() - os.close(f) - if os.path.exists(self.filename): - subprocess.check_call(["djpeg", "-outfile", path, self.filename]) - else: - try: - os.unlink(path) - except OSError: - pass - - msg = "Invalid Filename" - raise ValueError(msg) - - try: - with Image.open(path) as _im: - _im.load() - self.im = _im.im - finally: - try: - os.unlink(path) - except OSError: - pass - - self._mode = self.im.mode - self._size = self.im.size - - self.tile = [] - - def _getexif(self) -> dict[int, Any] | None: - return _getexif(self) - - def _read_dpi_from_exif(self) -> None: - # If DPI isn't in JPEG header, fetch from EXIF - if "dpi" in self.info or "exif" not in self.info: - return - try: - exif = self.getexif() - resolution_unit = exif[0x0128] - x_resolution = exif[0x011A] - try: - dpi = float(x_resolution[0]) / x_resolution[1] - except TypeError: - dpi = x_resolution - if math.isnan(dpi): - msg = "DPI is not a number" - raise ValueError(msg) - if resolution_unit == 3: # cm - # 1 dpcm = 2.54 dpi - dpi *= 2.54 - self.info["dpi"] = dpi, dpi - except ( - struct.error, # truncated EXIF - KeyError, # dpi not included - SyntaxError, # invalid/unreadable EXIF - TypeError, # dpi is an invalid float - ValueError, # dpi is an invalid float - ZeroDivisionError, # invalid dpi rational value - ): - self.info["dpi"] = 72, 72 - - def _getmp(self) -> dict[int, Any] | None: - return _getmp(self) - - -def _getexif(self: JpegImageFile) -> dict[int, Any] | None: - if "exif" not in self.info: - return None - return self.getexif()._get_merged_dict() - - -def _getmp(self: JpegImageFile) -> dict[int, Any] | None: - # Extract MP information. This method was inspired by the "highly - # experimental" _getexif version that's been in use for years now, - # itself based on the ImageFileDirectory class in the TIFF plugin. - - # The MP record essentially consists of a TIFF file embedded in a JPEG - # application marker. - try: - data = self.info["mp"] - except KeyError: - return None - file_contents = io.BytesIO(data) - head = file_contents.read(8) - endianness = ">" if head.startswith(b"\x4d\x4d\x00\x2a") else "<" - # process dictionary - from . import TiffImagePlugin - - try: - info = TiffImagePlugin.ImageFileDirectory_v2(head) - file_contents.seek(info.next) - info.load(file_contents) - mp = dict(info) - except Exception as e: - msg = "malformed MP Index (unreadable directory)" - raise SyntaxError(msg) from e - # it's an error not to have a number of images - try: - quant = mp[0xB001] - except KeyError as e: - msg = "malformed MP Index (no number of images)" - raise SyntaxError(msg) from e - # get MP entries - mpentries = [] - try: - rawmpentries = mp[0xB002] - for entrynum in range(quant): - unpackedentry = struct.unpack_from( - f"{endianness}LLLHH", rawmpentries, entrynum * 16 - ) - labels = ("Attribute", "Size", "DataOffset", "EntryNo1", "EntryNo2") - mpentry = dict(zip(labels, unpackedentry)) - mpentryattr = { - "DependentParentImageFlag": bool(mpentry["Attribute"] & (1 << 31)), - "DependentChildImageFlag": bool(mpentry["Attribute"] & (1 << 30)), - "RepresentativeImageFlag": bool(mpentry["Attribute"] & (1 << 29)), - "Reserved": (mpentry["Attribute"] & (3 << 27)) >> 27, - "ImageDataFormat": (mpentry["Attribute"] & (7 << 24)) >> 24, - "MPType": mpentry["Attribute"] & 0x00FFFFFF, - } - if mpentryattr["ImageDataFormat"] == 0: - mpentryattr["ImageDataFormat"] = "JPEG" - else: - msg = "unsupported picture format in MPO" - raise SyntaxError(msg) - mptypemap = { - 0x000000: "Undefined", - 0x010001: "Large Thumbnail (VGA Equivalent)", - 0x010002: "Large Thumbnail (Full HD Equivalent)", - 0x020001: "Multi-Frame Image (Panorama)", - 0x020002: "Multi-Frame Image: (Disparity)", - 0x020003: "Multi-Frame Image: (Multi-Angle)", - 0x030000: "Baseline MP Primary Image", - } - mpentryattr["MPType"] = mptypemap.get(mpentryattr["MPType"], "Unknown") - mpentry["Attribute"] = mpentryattr - mpentries.append(mpentry) - mp[0xB002] = mpentries - except KeyError as e: - msg = "malformed MP Index (bad MP Entry)" - raise SyntaxError(msg) from e - # Next we should try and parse the individual image unique ID list; - # we don't because I've never seen this actually used in a real MPO - # file and so can't test it. - return mp - - -# -------------------------------------------------------------------- -# stuff to save JPEG files - -RAWMODE = { - "1": "L", - "L": "L", - "RGB": "RGB", - "RGBX": "RGB", - "CMYK": "CMYK;I", # assume adobe conventions - "YCbCr": "YCbCr", -} - -# fmt: off -zigzag_index = ( - 0, 1, 5, 6, 14, 15, 27, 28, - 2, 4, 7, 13, 16, 26, 29, 42, - 3, 8, 12, 17, 25, 30, 41, 43, - 9, 11, 18, 24, 31, 40, 44, 53, - 10, 19, 23, 32, 39, 45, 52, 54, - 20, 22, 33, 38, 46, 51, 55, 60, - 21, 34, 37, 47, 50, 56, 59, 61, - 35, 36, 48, 49, 57, 58, 62, 63, -) - -samplings = { - (1, 1, 1, 1, 1, 1): 0, - (2, 1, 1, 1, 1, 1): 1, - (2, 2, 1, 1, 1, 1): 2, -} -# fmt: on - - -def get_sampling(im: Image.Image) -> int: - # There's no subsampling when images have only 1 layer - # (grayscale images) or when they are CMYK (4 layers), - # so set subsampling to the default value. - # - # NOTE: currently Pillow can't encode JPEG to YCCK format. - # If YCCK support is added in the future, subsampling code will have - # to be updated (here and in JpegEncode.c) to deal with 4 layers. - if not isinstance(im, JpegImageFile) or im.layers in (1, 4): - return -1 - sampling = im.layer[0][1:3] + im.layer[1][1:3] + im.layer[2][1:3] - return samplings.get(sampling, -1) - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.width == 0 or im.height == 0: - msg = "cannot write empty image as JPEG" - raise ValueError(msg) - - try: - rawmode = RAWMODE[im.mode] - except KeyError as e: - msg = f"cannot write mode {im.mode} as JPEG" - raise OSError(msg) from e - - info = im.encoderinfo - - dpi = [round(x) for x in info.get("dpi", (0, 0))] - - quality = info.get("quality", -1) - subsampling = info.get("subsampling", -1) - qtables = info.get("qtables") - - if quality == "keep": - quality = -1 - subsampling = "keep" - qtables = "keep" - elif quality in presets: - preset = presets[quality] - quality = -1 - subsampling = preset.get("subsampling", -1) - qtables = preset.get("quantization") - elif not isinstance(quality, int): - msg = "Invalid quality setting" - raise ValueError(msg) - else: - if subsampling in presets: - subsampling = presets[subsampling].get("subsampling", -1) - if isinstance(qtables, str) and qtables in presets: - qtables = presets[qtables].get("quantization") - - if subsampling == "4:4:4": - subsampling = 0 - elif subsampling == "4:2:2": - subsampling = 1 - elif subsampling == "4:2:0": - subsampling = 2 - elif subsampling == "4:1:1": - # For compatibility. Before Pillow 4.3, 4:1:1 actually meant 4:2:0. - # Set 4:2:0 if someone is still using that value. - subsampling = 2 - elif subsampling == "keep": - if im.format != "JPEG": - msg = "Cannot use 'keep' when original image is not a JPEG" - raise ValueError(msg) - subsampling = get_sampling(im) - - def validate_qtables( - qtables: ( - str | tuple[list[int], ...] | list[list[int]] | dict[int, list[int]] | None - ), - ) -> list[list[int]] | None: - if qtables is None: - return qtables - if isinstance(qtables, str): - try: - lines = [ - int(num) - for line in qtables.splitlines() - for num in line.split("#", 1)[0].split() - ] - except ValueError as e: - msg = "Invalid quantization table" - raise ValueError(msg) from e - else: - qtables = [lines[s : s + 64] for s in range(0, len(lines), 64)] - if isinstance(qtables, (tuple, list, dict)): - if isinstance(qtables, dict): - qtables = [ - qtables[key] for key in range(len(qtables)) if key in qtables - ] - elif isinstance(qtables, tuple): - qtables = list(qtables) - if not (0 < len(qtables) < 5): - msg = "None or too many quantization tables" - raise ValueError(msg) - for idx, table in enumerate(qtables): - try: - if len(table) != 64: - msg = "Invalid quantization table" - raise TypeError(msg) - table_array = array.array("H", table) - except TypeError as e: - msg = "Invalid quantization table" - raise ValueError(msg) from e - else: - qtables[idx] = list(table_array) - return qtables - - if qtables == "keep": - if im.format != "JPEG": - msg = "Cannot use 'keep' when original image is not a JPEG" - raise ValueError(msg) - qtables = getattr(im, "quantization", None) - qtables = validate_qtables(qtables) - - extra = info.get("extra", b"") - - MAX_BYTES_IN_MARKER = 65533 - if xmp := info.get("xmp"): - overhead_len = 29 # b"http://ns.adobe.com/xap/1.0/\x00" - max_data_bytes_in_marker = MAX_BYTES_IN_MARKER - overhead_len - if len(xmp) > max_data_bytes_in_marker: - msg = "XMP data is too long" - raise ValueError(msg) - size = o16(2 + overhead_len + len(xmp)) - extra += b"\xff\xe1" + size + b"http://ns.adobe.com/xap/1.0/\x00" + xmp - - if icc_profile := info.get("icc_profile"): - overhead_len = 14 # b"ICC_PROFILE\0" + o8(i) + o8(len(markers)) - max_data_bytes_in_marker = MAX_BYTES_IN_MARKER - overhead_len - markers = [] - while icc_profile: - markers.append(icc_profile[:max_data_bytes_in_marker]) - icc_profile = icc_profile[max_data_bytes_in_marker:] - i = 1 - for marker in markers: - size = o16(2 + overhead_len + len(marker)) - extra += ( - b"\xff\xe2" - + size - + b"ICC_PROFILE\0" - + o8(i) - + o8(len(markers)) - + marker - ) - i += 1 - - comment = info.get("comment", im.info.get("comment")) - - # "progressive" is the official name, but older documentation - # says "progression" - # FIXME: issue a warning if the wrong form is used (post-1.1.7) - progressive = info.get("progressive", False) or info.get("progression", False) - - optimize = info.get("optimize", False) - - exif = info.get("exif", b"") - if isinstance(exif, Image.Exif): - exif = exif.tobytes() - if len(exif) > MAX_BYTES_IN_MARKER: - msg = "EXIF data is too long" - raise ValueError(msg) - - # get keyword arguments - im.encoderconfig = ( - quality, - progressive, - info.get("smooth", 0), - optimize, - info.get("keep_rgb", False), - info.get("streamtype", 0), - dpi, - subsampling, - info.get("restart_marker_blocks", 0), - info.get("restart_marker_rows", 0), - qtables, - comment, - extra, - exif, - ) - - # if we optimize, libjpeg needs a buffer big enough to hold the whole image - # in a shot. Guessing on the size, at im.size bytes. (raw pixel size is - # channels*size, this is a value that's been used in a django patch. - # https://github.com/matthewwithanm/django-imagekit/issues/50 - if optimize or progressive: - # CMYK can be bigger - if im.mode == "CMYK": - bufsize = 4 * im.size[0] * im.size[1] - # keep sets quality to -1, but the actual value may be high. - elif quality >= 95 or quality == -1: - bufsize = 2 * im.size[0] * im.size[1] - else: - bufsize = im.size[0] * im.size[1] - if exif: - bufsize += len(exif) + 5 - if extra: - bufsize += len(extra) + 1 - else: - # The EXIF info needs to be written as one block, + APP1, + one spare byte. - # Ensure that our buffer is big enough. Same with the icc_profile block. - bufsize = max(len(exif) + 5, len(extra) + 1) - - ImageFile._save( - im, fp, [ImageFile._Tile("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize - ) - - -def _save_cjpeg(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - # ALTERNATIVE: handle JPEGs via the IJG command line utilities. - tempfile = im._dump() - subprocess.check_call(["cjpeg", "-outfile", filename, tempfile]) - try: - os.unlink(tempfile) - except OSError: - pass - - -## -# Factory for making JPEG and MPO instances -def jpeg_factory( - fp: IO[bytes], filename: str | bytes | None = None -) -> JpegImageFile | MpoImageFile: - im = JpegImageFile(fp, filename) - try: - mpheader = im._getmp() - if mpheader is not None and mpheader[45057] > 1: - for segment, content in im.applist: - if segment == "APP1" and b' hdrgm:Version="' in content: - # Ultra HDR images are not yet supported - return im - # It's actually an MPO - from .MpoImagePlugin import MpoImageFile - - # Don't reload everything, just convert it. - im = MpoImageFile.adopt(im, mpheader) - except (TypeError, IndexError): - # It is really a JPEG - pass - except SyntaxError: - warnings.warn( - "Image appears to be a malformed MPO file, it will be " - "interpreted as a base JPEG file" - ) - return im - - -# --------------------------------------------------------------------- -# Registry stuff - -Image.register_open(JpegImageFile.format, jpeg_factory, _accept) -Image.register_save(JpegImageFile.format, _save) - -Image.register_extensions(JpegImageFile.format, [".jfif", ".jpe", ".jpg", ".jpeg"]) - -Image.register_mime(JpegImageFile.format, "image/jpeg") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/JpegPresets.py b/write-message/venv/lib/python3.10/site-packages/PIL/JpegPresets.py deleted file mode 100644 index d0e64a3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/JpegPresets.py +++ /dev/null @@ -1,242 +0,0 @@ -""" -JPEG quality settings equivalent to the Photoshop settings. -Can be used when saving JPEG files. - -The following presets are available by default: -``web_low``, ``web_medium``, ``web_high``, ``web_very_high``, ``web_maximum``, -``low``, ``medium``, ``high``, ``maximum``. -More presets can be added to the :py:data:`presets` dict if needed. - -To apply the preset, specify:: - - quality="preset_name" - -To apply only the quantization table:: - - qtables="preset_name" - -To apply only the subsampling setting:: - - subsampling="preset_name" - -Example:: - - im.save("image_name.jpg", quality="web_high") - -Subsampling ------------ - -Subsampling is the practice of encoding images by implementing less resolution -for chroma information than for luma information. -(ref.: https://en.wikipedia.org/wiki/Chroma_subsampling) - -Possible subsampling values are 0, 1 and 2 that correspond to 4:4:4, 4:2:2 and -4:2:0. - -You can get the subsampling of a JPEG with the -:func:`.JpegImagePlugin.get_sampling` function. - -In JPEG compressed data a JPEG marker is used instead of an EXIF tag. -(ref.: https://exiv2.org/tags.html) - - -Quantization tables -------------------- - -They are values use by the DCT (Discrete cosine transform) to remove -*unnecessary* information from the image (the lossy part of the compression). -(ref.: https://en.wikipedia.org/wiki/Quantization_matrix#Quantization_matrices, -https://en.wikipedia.org/wiki/JPEG#Quantization) - -You can get the quantization tables of a JPEG with:: - - im.quantization - -This will return a dict with a number of lists. You can pass this dict -directly as the qtables argument when saving a JPEG. - -The quantization table format in presets is a list with sublists. These formats -are interchangeable. - -Libjpeg ref.: -https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html - -""" - -from __future__ import annotations - -# fmt: off -presets = { - 'web_low': {'subsampling': 2, # "4:2:0" - 'quantization': [ - [20, 16, 25, 39, 50, 46, 62, 68, - 16, 18, 23, 38, 38, 53, 65, 68, - 25, 23, 31, 38, 53, 65, 68, 68, - 39, 38, 38, 53, 65, 68, 68, 68, - 50, 38, 53, 65, 68, 68, 68, 68, - 46, 53, 65, 68, 68, 68, 68, 68, - 62, 65, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68], - [21, 25, 32, 38, 54, 68, 68, 68, - 25, 28, 24, 38, 54, 68, 68, 68, - 32, 24, 32, 43, 66, 68, 68, 68, - 38, 38, 43, 53, 68, 68, 68, 68, - 54, 54, 66, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68] - ]}, - 'web_medium': {'subsampling': 2, # "4:2:0" - 'quantization': [ - [16, 11, 11, 16, 23, 27, 31, 30, - 11, 12, 12, 15, 20, 23, 23, 30, - 11, 12, 13, 16, 23, 26, 35, 47, - 16, 15, 16, 23, 26, 37, 47, 64, - 23, 20, 23, 26, 39, 51, 64, 64, - 27, 23, 26, 37, 51, 64, 64, 64, - 31, 23, 35, 47, 64, 64, 64, 64, - 30, 30, 47, 64, 64, 64, 64, 64], - [17, 15, 17, 21, 20, 26, 38, 48, - 15, 19, 18, 17, 20, 26, 35, 43, - 17, 18, 20, 22, 26, 30, 46, 53, - 21, 17, 22, 28, 30, 39, 53, 64, - 20, 20, 26, 30, 39, 48, 64, 64, - 26, 26, 30, 39, 48, 63, 64, 64, - 38, 35, 46, 53, 64, 64, 64, 64, - 48, 43, 53, 64, 64, 64, 64, 64] - ]}, - 'web_high': {'subsampling': 0, # "4:4:4" - 'quantization': [ - [6, 4, 4, 6, 9, 11, 12, 16, - 4, 5, 5, 6, 8, 10, 12, 12, - 4, 5, 5, 6, 10, 12, 14, 19, - 6, 6, 6, 11, 12, 15, 19, 28, - 9, 8, 10, 12, 16, 20, 27, 31, - 11, 10, 12, 15, 20, 27, 31, 31, - 12, 12, 14, 19, 27, 31, 31, 31, - 16, 12, 19, 28, 31, 31, 31, 31], - [7, 7, 13, 24, 26, 31, 31, 31, - 7, 12, 16, 21, 31, 31, 31, 31, - 13, 16, 17, 31, 31, 31, 31, 31, - 24, 21, 31, 31, 31, 31, 31, 31, - 26, 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] - ]}, - 'web_very_high': {'subsampling': 0, # "4:4:4" - 'quantization': [ - [2, 2, 2, 2, 3, 4, 5, 6, - 2, 2, 2, 2, 3, 4, 5, 6, - 2, 2, 2, 2, 4, 5, 7, 9, - 2, 2, 2, 4, 5, 7, 9, 12, - 3, 3, 4, 5, 8, 10, 12, 12, - 4, 4, 5, 7, 10, 12, 12, 12, - 5, 5, 7, 9, 12, 12, 12, 12, - 6, 6, 9, 12, 12, 12, 12, 12], - [3, 3, 5, 9, 13, 15, 15, 15, - 3, 4, 6, 11, 14, 12, 12, 12, - 5, 6, 9, 14, 12, 12, 12, 12, - 9, 11, 14, 12, 12, 12, 12, 12, - 13, 14, 12, 12, 12, 12, 12, 12, - 15, 12, 12, 12, 12, 12, 12, 12, - 15, 12, 12, 12, 12, 12, 12, 12, - 15, 12, 12, 12, 12, 12, 12, 12] - ]}, - 'web_maximum': {'subsampling': 0, # "4:4:4" - 'quantization': [ - [1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 1, 1, 1, 1, 2, 2, - 1, 1, 1, 1, 1, 2, 2, 3, - 1, 1, 1, 1, 2, 2, 3, 3, - 1, 1, 1, 2, 2, 3, 3, 3, - 1, 1, 2, 2, 3, 3, 3, 3], - [1, 1, 1, 2, 2, 3, 3, 3, - 1, 1, 1, 2, 3, 3, 3, 3, - 1, 1, 1, 3, 3, 3, 3, 3, - 2, 2, 3, 3, 3, 3, 3, 3, - 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3] - ]}, - 'low': {'subsampling': 2, # "4:2:0" - 'quantization': [ - [18, 14, 14, 21, 30, 35, 34, 17, - 14, 16, 16, 19, 26, 23, 12, 12, - 14, 16, 17, 21, 23, 12, 12, 12, - 21, 19, 21, 23, 12, 12, 12, 12, - 30, 26, 23, 12, 12, 12, 12, 12, - 35, 23, 12, 12, 12, 12, 12, 12, - 34, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12], - [20, 19, 22, 27, 20, 20, 17, 17, - 19, 25, 23, 14, 14, 12, 12, 12, - 22, 23, 14, 14, 12, 12, 12, 12, - 27, 14, 14, 12, 12, 12, 12, 12, - 20, 14, 12, 12, 12, 12, 12, 12, - 20, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12] - ]}, - 'medium': {'subsampling': 2, # "4:2:0" - 'quantization': [ - [12, 8, 8, 12, 17, 21, 24, 17, - 8, 9, 9, 11, 15, 19, 12, 12, - 8, 9, 10, 12, 19, 12, 12, 12, - 12, 11, 12, 21, 12, 12, 12, 12, - 17, 15, 19, 12, 12, 12, 12, 12, - 21, 19, 12, 12, 12, 12, 12, 12, - 24, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12], - [13, 11, 13, 16, 20, 20, 17, 17, - 11, 14, 14, 14, 14, 12, 12, 12, - 13, 14, 14, 14, 12, 12, 12, 12, - 16, 14, 14, 12, 12, 12, 12, 12, - 20, 14, 12, 12, 12, 12, 12, 12, - 20, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12] - ]}, - 'high': {'subsampling': 0, # "4:4:4" - 'quantization': [ - [6, 4, 4, 6, 9, 11, 12, 16, - 4, 5, 5, 6, 8, 10, 12, 12, - 4, 5, 5, 6, 10, 12, 12, 12, - 6, 6, 6, 11, 12, 12, 12, 12, - 9, 8, 10, 12, 12, 12, 12, 12, - 11, 10, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, - 16, 12, 12, 12, 12, 12, 12, 12], - [7, 7, 13, 24, 20, 20, 17, 17, - 7, 12, 16, 14, 14, 12, 12, 12, - 13, 16, 14, 14, 12, 12, 12, 12, - 24, 14, 14, 12, 12, 12, 12, 12, - 20, 14, 12, 12, 12, 12, 12, 12, - 20, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12, - 17, 12, 12, 12, 12, 12, 12, 12] - ]}, - 'maximum': {'subsampling': 0, # "4:4:4" - 'quantization': [ - [2, 2, 2, 2, 3, 4, 5, 6, - 2, 2, 2, 2, 3, 4, 5, 6, - 2, 2, 2, 2, 4, 5, 7, 9, - 2, 2, 2, 4, 5, 7, 9, 12, - 3, 3, 4, 5, 8, 10, 12, 12, - 4, 4, 5, 7, 10, 12, 12, 12, - 5, 5, 7, 9, 12, 12, 12, 12, - 6, 6, 9, 12, 12, 12, 12, 12], - [3, 3, 5, 9, 13, 15, 15, 15, - 3, 4, 6, 10, 14, 12, 12, 12, - 5, 6, 9, 14, 12, 12, 12, 12, - 9, 10, 14, 12, 12, 12, 12, 12, - 13, 14, 12, 12, 12, 12, 12, 12, - 15, 12, 12, 12, 12, 12, 12, 12, - 15, 12, 12, 12, 12, 12, 12, 12, - 15, 12, 12, 12, 12, 12, 12, 12] - ]}, -} -# fmt: on diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/McIdasImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/McIdasImagePlugin.py deleted file mode 100644 index 9a47933..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/McIdasImagePlugin.py +++ /dev/null @@ -1,78 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# Basic McIdas support for PIL -# -# History: -# 1997-05-05 fl Created (8-bit images only) -# 2009-03-08 fl Added 16/32-bit support. -# -# Thanks to Richard Jones and Craig Swank for specs and samples. -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1997. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import struct - -from . import Image, ImageFile - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"\x00\x00\x00\x00\x00\x00\x00\x04") - - -## -# Image plugin for McIdas area images. - - -class McIdasImageFile(ImageFile.ImageFile): - format = "MCIDAS" - format_description = "McIdas area file" - - def _open(self) -> None: - # parse area file directory - assert self.fp is not None - - s = self.fp.read(256) - if not _accept(s) or len(s) != 256: - msg = "not an McIdas area file" - raise SyntaxError(msg) - - self.area_descriptor_raw = s - self.area_descriptor = w = [0, *struct.unpack("!64i", s)] - - # get mode - if w[11] == 1: - mode = rawmode = "L" - elif w[11] == 2: - mode = rawmode = "I;16B" - elif w[11] == 4: - # FIXME: add memory map support - mode = "I" - rawmode = "I;32B" - else: - msg = "unsupported McIdas format" - raise SyntaxError(msg) - - self._mode = mode - self._size = w[10], w[9] - - offset = w[34] + w[15] - stride = w[15] + w[10] * w[11] * w[14] - - self.tile = [ - ImageFile._Tile("raw", (0, 0) + self.size, offset, (rawmode, stride, 1)) - ] - - -# -------------------------------------------------------------------- -# registry - -Image.register_open(McIdasImageFile.format, McIdasImageFile, _accept) - -# no default extension diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/MicImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/MicImagePlugin.py deleted file mode 100644 index 9ce38c4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/MicImagePlugin.py +++ /dev/null @@ -1,102 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# Microsoft Image Composer support for PIL -# -# Notes: -# uses TiffImagePlugin.py to read the actual image streams -# -# History: -# 97-01-20 fl Created -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1997. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import olefile - -from . import Image, TiffImagePlugin - -# -# -------------------------------------------------------------------- - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(olefile.MAGIC) - - -## -# Image plugin for Microsoft's Image Composer file format. - - -class MicImageFile(TiffImagePlugin.TiffImageFile): - format = "MIC" - format_description = "Microsoft Image Composer" - _close_exclusive_fp_after_loading = False - - def _open(self) -> None: - # read the OLE directory and see if this is a likely - # to be a Microsoft Image Composer file - - try: - self.ole = olefile.OleFileIO(self.fp) - except OSError as e: - msg = "not an MIC file; invalid OLE file" - raise SyntaxError(msg) from e - - # find ACI subfiles with Image members (maybe not the - # best way to identify MIC files, but what the... ;-) - - self.images = [ - path - for path in self.ole.listdir() - if path[1:] and path[0].endswith(".ACI") and path[1] == "Image" - ] - - # if we didn't find any images, this is probably not - # an MIC file. - if not self.images: - msg = "not an MIC file; no image entries" - raise SyntaxError(msg) - - self.frame = -1 - self._n_frames = len(self.images) - self.is_animated = self._n_frames > 1 - - self.__fp = self.fp - self.seek(0) - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - filename = self.images[frame] - self.fp = self.ole.openstream(filename) - - TiffImagePlugin.TiffImageFile._open(self) - - self.frame = frame - - def tell(self) -> int: - return self.frame - - def close(self) -> None: - self.__fp.close() - self.ole.close() - super().close() - - def __exit__(self, *args: object) -> None: - self.__fp.close() - self.ole.close() - super().__exit__() - - -# -# -------------------------------------------------------------------- - -Image.register_open(MicImageFile.format, MicImageFile, _accept) - -Image.register_extension(MicImageFile.format, ".mic") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/MpegImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/MpegImagePlugin.py deleted file mode 100644 index 47ebe9d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/MpegImagePlugin.py +++ /dev/null @@ -1,84 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# MPEG file handling -# -# History: -# 95-09-09 fl Created -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1995. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image, ImageFile -from ._binary import i8 -from ._typing import SupportsRead - -# -# Bitstream parser - - -class BitStream: - def __init__(self, fp: SupportsRead[bytes]) -> None: - self.fp = fp - self.bits = 0 - self.bitbuffer = 0 - - def next(self) -> int: - return i8(self.fp.read(1)) - - def peek(self, bits: int) -> int: - while self.bits < bits: - self.bitbuffer = (self.bitbuffer << 8) + self.next() - self.bits += 8 - return self.bitbuffer >> (self.bits - bits) & (1 << bits) - 1 - - def skip(self, bits: int) -> None: - while self.bits < bits: - self.bitbuffer = (self.bitbuffer << 8) + i8(self.fp.read(1)) - self.bits += 8 - self.bits = self.bits - bits - - def read(self, bits: int) -> int: - v = self.peek(bits) - self.bits = self.bits - bits - return v - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"\x00\x00\x01\xb3") - - -## -# Image plugin for MPEG streams. This plugin can identify a stream, -# but it cannot read it. - - -class MpegImageFile(ImageFile.ImageFile): - format = "MPEG" - format_description = "MPEG" - - def _open(self) -> None: - assert self.fp is not None - - s = BitStream(self.fp) - if s.read(32) != 0x1B3: - msg = "not an MPEG file" - raise SyntaxError(msg) - - self._mode = "RGB" - self._size = s.read(12), s.read(12) - - -# -------------------------------------------------------------------- -# Registry stuff - -Image.register_open(MpegImageFile.format, MpegImageFile, _accept) - -Image.register_extensions(MpegImageFile.format, [".mpg", ".mpeg"]) - -Image.register_mime(MpegImageFile.format, "video/mpeg") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/MpoImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/MpoImagePlugin.py deleted file mode 100644 index b1ae078..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/MpoImagePlugin.py +++ /dev/null @@ -1,202 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# MPO file handling -# -# See "Multi-Picture Format" (CIPA DC-007-Translation 2009, Standard of the -# Camera & Imaging Products Association) -# -# The multi-picture object combines multiple JPEG images (with a modified EXIF -# data format) into a single file. While it can theoretically be used much like -# a GIF animation, it is commonly used to represent 3D photographs and is (as -# of this writing) the most commonly used format by 3D cameras. -# -# History: -# 2014-03-13 Feneric Created -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -import struct -from typing import IO, Any, cast - -from . import ( - Image, - ImageFile, - ImageSequence, - JpegImagePlugin, - TiffImagePlugin, -) -from ._binary import o32le -from ._util import DeferredError - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - JpegImagePlugin._save(im, fp, filename) - - -def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - append_images = im.encoderinfo.get("append_images", []) - if not append_images and not getattr(im, "is_animated", False): - _save(im, fp, filename) - return - - mpf_offset = 28 - offsets: list[int] = [] - im_sequences = [im, *append_images] - total = sum(getattr(seq, "n_frames", 1) for seq in im_sequences) - for im_sequence in im_sequences: - for im_frame in ImageSequence.Iterator(im_sequence): - if not offsets: - # APP2 marker - ifd_length = 66 + 16 * total - im_frame.encoderinfo["extra"] = ( - b"\xff\xe2" - + struct.pack(">H", 6 + ifd_length) - + b"MPF\0" - + b" " * ifd_length - ) - exif = im_frame.encoderinfo.get("exif") - if isinstance(exif, Image.Exif): - exif = exif.tobytes() - im_frame.encoderinfo["exif"] = exif - if exif: - mpf_offset += 4 + len(exif) - - JpegImagePlugin._save(im_frame, fp, filename) - offsets.append(fp.tell()) - else: - encoderinfo = im_frame._attach_default_encoderinfo(im) - im_frame.save(fp, "JPEG") - im_frame.encoderinfo = encoderinfo - offsets.append(fp.tell() - offsets[-1]) - - ifd = TiffImagePlugin.ImageFileDirectory_v2() - ifd[0xB000] = b"0100" - ifd[0xB001] = len(offsets) - - mpentries = b"" - data_offset = 0 - for i, size in enumerate(offsets): - if i == 0: - mptype = 0x030000 # Baseline MP Primary Image - else: - mptype = 0x000000 # Undefined - mpentries += struct.pack(" None: - self.fp.seek(0) # prep the fp in order to pass the JPEG test - JpegImagePlugin.JpegImageFile._open(self) - self._after_jpeg_open() - - def _after_jpeg_open(self, mpheader: dict[int, Any] | None = None) -> None: - self.mpinfo = mpheader if mpheader is not None else self._getmp() - if self.mpinfo is None: - msg = "Image appears to be a malformed MPO file" - raise ValueError(msg) - self.n_frames = self.mpinfo[0xB001] - self.__mpoffsets = [ - mpent["DataOffset"] + self.info["mpoffset"] for mpent in self.mpinfo[0xB002] - ] - self.__mpoffsets[0] = 0 - # Note that the following assertion will only be invalid if something - # gets broken within JpegImagePlugin. - assert self.n_frames == len(self.__mpoffsets) - del self.info["mpoffset"] # no longer needed - self.is_animated = self.n_frames > 1 - self._fp = self.fp # FIXME: hack - self._fp.seek(self.__mpoffsets[0]) # get ready to read first frame - self.__frame = 0 - self.offset = 0 - # for now we can only handle reading and individual frame extraction - self.readonly = 1 - - def load_seek(self, pos: int) -> None: - if isinstance(self._fp, DeferredError): - raise self._fp.ex - self._fp.seek(pos) - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - if isinstance(self._fp, DeferredError): - raise self._fp.ex - self.fp = self._fp - self.offset = self.__mpoffsets[frame] - - original_exif = self.info.get("exif") - if "exif" in self.info: - del self.info["exif"] - - self.fp.seek(self.offset + 2) # skip SOI marker - if not self.fp.read(2): - msg = "No data found for frame" - raise ValueError(msg) - self.fp.seek(self.offset) - JpegImagePlugin.JpegImageFile._open(self) - if self.info.get("exif") != original_exif: - self._reload_exif() - - self.tile = [ - ImageFile._Tile("jpeg", (0, 0) + self.size, self.offset, self.tile[0][-1]) - ] - self.__frame = frame - - def tell(self) -> int: - return self.__frame - - @staticmethod - def adopt( - jpeg_instance: JpegImagePlugin.JpegImageFile, - mpheader: dict[int, Any] | None = None, - ) -> MpoImageFile: - """ - Transform the instance of JpegImageFile into - an instance of MpoImageFile. - After the call, the JpegImageFile is extended - to be an MpoImageFile. - - This is essentially useful when opening a JPEG - file that reveals itself as an MPO, to avoid - double call to _open. - """ - jpeg_instance.__class__ = MpoImageFile - mpo_instance = cast(MpoImageFile, jpeg_instance) - mpo_instance._after_jpeg_open(mpheader) - return mpo_instance - - -# --------------------------------------------------------------------- -# Registry stuff - -# Note that since MPO shares a factory with JPEG, we do not need to do a -# separate registration for it here. -# Image.register_open(MpoImageFile.format, -# JpegImagePlugin.jpeg_factory, _accept) -Image.register_save(MpoImageFile.format, _save) -Image.register_save_all(MpoImageFile.format, _save_all) - -Image.register_extension(MpoImageFile.format, ".mpo") - -Image.register_mime(MpoImageFile.format, "image/mpo") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/MspImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/MspImagePlugin.py deleted file mode 100644 index 277087a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/MspImagePlugin.py +++ /dev/null @@ -1,200 +0,0 @@ -# -# The Python Imaging Library. -# -# MSP file handling -# -# This is the format used by the Paint program in Windows 1 and 2. -# -# History: -# 95-09-05 fl Created -# 97-01-03 fl Read/write MSP images -# 17-02-21 es Fixed RLE interpretation -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1995-97. -# Copyright (c) Eric Soroos 2017. -# -# See the README file for information on usage and redistribution. -# -# More info on this format: https://archive.org/details/gg243631 -# Page 313: -# Figure 205. Windows Paint Version 1: "DanM" Format -# Figure 206. Windows Paint Version 2: "LinS" Format. Used in Windows V2.03 -# -# See also: https://www.fileformat.info/format/mspaint/egff.htm -from __future__ import annotations - -import io -import struct -from typing import IO - -from . import Image, ImageFile -from ._binary import i16le as i16 -from ._binary import o16le as o16 - -# -# read MSP files - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith((b"DanM", b"LinS")) - - -## -# Image plugin for Windows MSP images. This plugin supports both -# uncompressed (Windows 1.0). - - -class MspImageFile(ImageFile.ImageFile): - format = "MSP" - format_description = "Windows Paint" - - def _open(self) -> None: - # Header - assert self.fp is not None - - s = self.fp.read(32) - if not _accept(s): - msg = "not an MSP file" - raise SyntaxError(msg) - - # Header checksum - checksum = 0 - for i in range(0, 32, 2): - checksum = checksum ^ i16(s, i) - if checksum != 0: - msg = "bad MSP checksum" - raise SyntaxError(msg) - - self._mode = "1" - self._size = i16(s, 4), i16(s, 6) - - if s.startswith(b"DanM"): - self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 32, "1")] - else: - self.tile = [ImageFile._Tile("MSP", (0, 0) + self.size, 32)] - - -class MspDecoder(ImageFile.PyDecoder): - # The algo for the MSP decoder is from - # https://www.fileformat.info/format/mspaint/egff.htm - # cc-by-attribution -- That page references is taken from the - # Encyclopedia of Graphics File Formats and is licensed by - # O'Reilly under the Creative Common/Attribution license - # - # For RLE encoded files, the 32byte header is followed by a scan - # line map, encoded as one 16bit word of encoded byte length per - # line. - # - # NOTE: the encoded length of the line can be 0. This was not - # handled in the previous version of this encoder, and there's no - # mention of how to handle it in the documentation. From the few - # examples I've seen, I've assumed that it is a fill of the - # background color, in this case, white. - # - # - # Pseudocode of the decoder: - # Read a BYTE value as the RunType - # If the RunType value is zero - # Read next byte as the RunCount - # Read the next byte as the RunValue - # Write the RunValue byte RunCount times - # If the RunType value is non-zero - # Use this value as the RunCount - # Read and write the next RunCount bytes literally - # - # e.g.: - # 0x00 03 ff 05 00 01 02 03 04 - # would yield the bytes: - # 0xff ff ff 00 01 02 03 04 - # - # which are then interpreted as a bit packed mode '1' image - - _pulls_fd = True - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - - img = io.BytesIO() - blank_line = bytearray((0xFF,) * ((self.state.xsize + 7) // 8)) - try: - self.fd.seek(32) - rowmap = struct.unpack_from( - f"<{self.state.ysize}H", self.fd.read(self.state.ysize * 2) - ) - except struct.error as e: - msg = "Truncated MSP file in row map" - raise OSError(msg) from e - - for x, rowlen in enumerate(rowmap): - try: - if rowlen == 0: - img.write(blank_line) - continue - row = self.fd.read(rowlen) - if len(row) != rowlen: - msg = f"Truncated MSP file, expected {rowlen} bytes on row {x}" - raise OSError(msg) - idx = 0 - while idx < rowlen: - runtype = row[idx] - idx += 1 - if runtype == 0: - (runcount, runval) = struct.unpack_from("Bc", row, idx) - img.write(runval * runcount) - idx += 2 - else: - runcount = runtype - img.write(row[idx : idx + runcount]) - idx += runcount - - except struct.error as e: - msg = f"Corrupted MSP file in row {x}" - raise OSError(msg) from e - - self.set_as_raw(img.getvalue(), "1") - - return -1, 0 - - -Image.register_decoder("MSP", MspDecoder) - - -# -# write MSP files (uncompressed only) - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode != "1": - msg = f"cannot write mode {im.mode} as MSP" - raise OSError(msg) - - # create MSP header - header = [0] * 16 - - header[0], header[1] = i16(b"Da"), i16(b"nM") # version 1 - header[2], header[3] = im.size - header[4], header[5] = 1, 1 - header[6], header[7] = 1, 1 - header[8], header[9] = im.size - - checksum = 0 - for h in header: - checksum = checksum ^ h - header[12] = checksum # FIXME: is this the right field? - - # header - for h in header: - fp.write(o16(h)) - - # image body - ImageFile._save(im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 32, "1")]) - - -# -# registry - -Image.register_open(MspImageFile.format, MspImageFile, _accept) -Image.register_save(MspImageFile.format, _save) - -Image.register_extension(MspImageFile.format, ".msp") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PSDraw.py b/write-message/venv/lib/python3.10/site-packages/PIL/PSDraw.py deleted file mode 100644 index 7fd4c5c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PSDraw.py +++ /dev/null @@ -1,237 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# Simple PostScript graphics interface -# -# History: -# 1996-04-20 fl Created -# 1999-01-10 fl Added gsave/grestore to image method -# 2005-05-04 fl Fixed floating point issue in image (from Eric Etheridge) -# -# Copyright (c) 1997-2005 by Secret Labs AB. All rights reserved. -# Copyright (c) 1996 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import sys -from typing import IO - -from . import EpsImagePlugin - -TYPE_CHECKING = False - - -## -# Simple PostScript graphics interface. - - -class PSDraw: - """ - Sets up printing to the given file. If ``fp`` is omitted, - ``sys.stdout.buffer`` is assumed. - """ - - def __init__(self, fp: IO[bytes] | None = None) -> None: - if not fp: - fp = sys.stdout.buffer - self.fp = fp - - def begin_document(self, id: str | None = None) -> None: - """Set up printing of a document. (Write PostScript DSC header.)""" - # FIXME: incomplete - self.fp.write( - b"%!PS-Adobe-3.0\n" - b"save\n" - b"/showpage { } def\n" - b"%%EndComments\n" - b"%%BeginDocument\n" - ) - # self.fp.write(ERROR_PS) # debugging! - self.fp.write(EDROFF_PS) - self.fp.write(VDI_PS) - self.fp.write(b"%%EndProlog\n") - self.isofont: dict[bytes, int] = {} - - def end_document(self) -> None: - """Ends printing. (Write PostScript DSC footer.)""" - self.fp.write(b"%%EndDocument\nrestore showpage\n%%End\n") - if hasattr(self.fp, "flush"): - self.fp.flush() - - def setfont(self, font: str, size: int) -> None: - """ - Selects which font to use. - - :param font: A PostScript font name - :param size: Size in points. - """ - font_bytes = bytes(font, "UTF-8") - if font_bytes not in self.isofont: - # reencode font - self.fp.write( - b"/PSDraw-%s ISOLatin1Encoding /%s E\n" % (font_bytes, font_bytes) - ) - self.isofont[font_bytes] = 1 - # rough - self.fp.write(b"/F0 %d /PSDraw-%s F\n" % (size, font_bytes)) - - def line(self, xy0: tuple[int, int], xy1: tuple[int, int]) -> None: - """ - Draws a line between the two points. Coordinates are given in - PostScript point coordinates (72 points per inch, (0, 0) is the lower - left corner of the page). - """ - self.fp.write(b"%d %d %d %d Vl\n" % (*xy0, *xy1)) - - def rectangle(self, box: tuple[int, int, int, int]) -> None: - """ - Draws a rectangle. - - :param box: A tuple of four integers, specifying left, bottom, width and - height. - """ - self.fp.write(b"%d %d M 0 %d %d Vr\n" % box) - - def text(self, xy: tuple[int, int], text: str) -> None: - """ - Draws text at the given position. You must use - :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method. - """ - text_bytes = bytes(text, "UTF-8") - text_bytes = b"\\(".join(text_bytes.split(b"(")) - text_bytes = b"\\)".join(text_bytes.split(b")")) - self.fp.write(b"%d %d M (%s) S\n" % (xy + (text_bytes,))) - - if TYPE_CHECKING: - from . import Image - - def image( - self, box: tuple[int, int, int, int], im: Image.Image, dpi: int | None = None - ) -> None: - """Draw a PIL image, centered in the given box.""" - # default resolution depends on mode - if not dpi: - if im.mode == "1": - dpi = 200 # fax - else: - dpi = 100 # grayscale - # image size (on paper) - x = im.size[0] * 72 / dpi - y = im.size[1] * 72 / dpi - # max allowed size - xmax = float(box[2] - box[0]) - ymax = float(box[3] - box[1]) - if x > xmax: - y = y * xmax / x - x = xmax - if y > ymax: - x = x * ymax / y - y = ymax - dx = (xmax - x) / 2 + box[0] - dy = (ymax - y) / 2 + box[1] - self.fp.write(b"gsave\n%f %f translate\n" % (dx, dy)) - if (x, y) != im.size: - # EpsImagePlugin._save prints the image at (0,0,xsize,ysize) - sx = x / im.size[0] - sy = y / im.size[1] - self.fp.write(b"%f %f scale\n" % (sx, sy)) - EpsImagePlugin._save(im, self.fp, "", 0) - self.fp.write(b"\ngrestore\n") - - -# -------------------------------------------------------------------- -# PostScript driver - -# -# EDROFF.PS -- PostScript driver for Edroff 2 -# -# History: -# 94-01-25 fl: created (edroff 2.04) -# -# Copyright (c) Fredrik Lundh 1994. -# - - -EDROFF_PS = b"""\ -/S { show } bind def -/P { moveto show } bind def -/M { moveto } bind def -/X { 0 rmoveto } bind def -/Y { 0 exch rmoveto } bind def -/E { findfont - dup maxlength dict begin - { - 1 index /FID ne { def } { pop pop } ifelse - } forall - /Encoding exch def - dup /FontName exch def - currentdict end definefont pop -} bind def -/F { findfont exch scalefont dup setfont - [ exch /setfont cvx ] cvx bind def -} bind def -""" - -# -# VDI.PS -- PostScript driver for VDI meta commands -# -# History: -# 94-01-25 fl: created (edroff 2.04) -# -# Copyright (c) Fredrik Lundh 1994. -# - -VDI_PS = b"""\ -/Vm { moveto } bind def -/Va { newpath arcn stroke } bind def -/Vl { moveto lineto stroke } bind def -/Vc { newpath 0 360 arc closepath } bind def -/Vr { exch dup 0 rlineto - exch dup 0 exch rlineto - exch neg 0 rlineto - 0 exch neg rlineto - setgray fill } bind def -/Tm matrix def -/Ve { Tm currentmatrix pop - translate scale newpath 0 0 .5 0 360 arc closepath - Tm setmatrix -} bind def -/Vf { currentgray exch setgray fill setgray } bind def -""" - -# -# ERROR.PS -- Error handler -# -# History: -# 89-11-21 fl: created (pslist 1.10) -# - -ERROR_PS = b"""\ -/landscape false def -/errorBUF 200 string def -/errorNL { currentpoint 10 sub exch pop 72 exch moveto } def -errordict begin /handleerror { - initmatrix /Courier findfont 10 scalefont setfont - newpath 72 720 moveto $error begin /newerror false def - (PostScript Error) show errorNL errorNL - (Error: ) show - /errorname load errorBUF cvs show errorNL errorNL - (Command: ) show - /command load dup type /stringtype ne { errorBUF cvs } if show - errorNL errorNL - (VMstatus: ) show - vmstatus errorBUF cvs show ( bytes available, ) show - errorBUF cvs show ( bytes used at level ) show - errorBUF cvs show errorNL errorNL - (Operand stargck: ) show errorNL /ostargck load { - dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL - } forall errorNL - (Execution stargck: ) show errorNL /estargck load { - dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL - } forall - end showpage -} def end -""" diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PaletteFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/PaletteFile.py deleted file mode 100644 index 2a26e5d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PaletteFile.py +++ /dev/null @@ -1,54 +0,0 @@ -# -# Python Imaging Library -# $Id$ -# -# stuff to read simple, teragon-style palette files -# -# History: -# 97-08-23 fl Created -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1997. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from typing import IO - -from ._binary import o8 - - -class PaletteFile: - """File handler for Teragon-style palette files.""" - - rawmode = "RGB" - - def __init__(self, fp: IO[bytes]) -> None: - palette = [o8(i) * 3 for i in range(256)] - - while True: - s = fp.readline() - - if not s: - break - if s.startswith(b"#"): - continue - if len(s) > 100: - msg = "bad palette file" - raise SyntaxError(msg) - - v = [int(x) for x in s.split()] - try: - [i, r, g, b] = v - except ValueError: - [i, r] = v - g = b = r - - if 0 <= i <= 255: - palette[i] = o8(r) + o8(g) + o8(b) - - self.palette = b"".join(palette) - - def getpalette(self) -> tuple[bytes, str]: - return self.palette, self.rawmode diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PalmImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PalmImagePlugin.py deleted file mode 100644 index 15f7129..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PalmImagePlugin.py +++ /dev/null @@ -1,217 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# - -## -# Image plugin for Palm pixmap images (output only). -## -from __future__ import annotations - -from typing import IO - -from . import Image, ImageFile -from ._binary import o8 -from ._binary import o16be as o16b - -# fmt: off -_Palm8BitColormapValues = ( - (255, 255, 255), (255, 204, 255), (255, 153, 255), (255, 102, 255), - (255, 51, 255), (255, 0, 255), (255, 255, 204), (255, 204, 204), - (255, 153, 204), (255, 102, 204), (255, 51, 204), (255, 0, 204), - (255, 255, 153), (255, 204, 153), (255, 153, 153), (255, 102, 153), - (255, 51, 153), (255, 0, 153), (204, 255, 255), (204, 204, 255), - (204, 153, 255), (204, 102, 255), (204, 51, 255), (204, 0, 255), - (204, 255, 204), (204, 204, 204), (204, 153, 204), (204, 102, 204), - (204, 51, 204), (204, 0, 204), (204, 255, 153), (204, 204, 153), - (204, 153, 153), (204, 102, 153), (204, 51, 153), (204, 0, 153), - (153, 255, 255), (153, 204, 255), (153, 153, 255), (153, 102, 255), - (153, 51, 255), (153, 0, 255), (153, 255, 204), (153, 204, 204), - (153, 153, 204), (153, 102, 204), (153, 51, 204), (153, 0, 204), - (153, 255, 153), (153, 204, 153), (153, 153, 153), (153, 102, 153), - (153, 51, 153), (153, 0, 153), (102, 255, 255), (102, 204, 255), - (102, 153, 255), (102, 102, 255), (102, 51, 255), (102, 0, 255), - (102, 255, 204), (102, 204, 204), (102, 153, 204), (102, 102, 204), - (102, 51, 204), (102, 0, 204), (102, 255, 153), (102, 204, 153), - (102, 153, 153), (102, 102, 153), (102, 51, 153), (102, 0, 153), - (51, 255, 255), (51, 204, 255), (51, 153, 255), (51, 102, 255), - (51, 51, 255), (51, 0, 255), (51, 255, 204), (51, 204, 204), - (51, 153, 204), (51, 102, 204), (51, 51, 204), (51, 0, 204), - (51, 255, 153), (51, 204, 153), (51, 153, 153), (51, 102, 153), - (51, 51, 153), (51, 0, 153), (0, 255, 255), (0, 204, 255), - (0, 153, 255), (0, 102, 255), (0, 51, 255), (0, 0, 255), - (0, 255, 204), (0, 204, 204), (0, 153, 204), (0, 102, 204), - (0, 51, 204), (0, 0, 204), (0, 255, 153), (0, 204, 153), - (0, 153, 153), (0, 102, 153), (0, 51, 153), (0, 0, 153), - (255, 255, 102), (255, 204, 102), (255, 153, 102), (255, 102, 102), - (255, 51, 102), (255, 0, 102), (255, 255, 51), (255, 204, 51), - (255, 153, 51), (255, 102, 51), (255, 51, 51), (255, 0, 51), - (255, 255, 0), (255, 204, 0), (255, 153, 0), (255, 102, 0), - (255, 51, 0), (255, 0, 0), (204, 255, 102), (204, 204, 102), - (204, 153, 102), (204, 102, 102), (204, 51, 102), (204, 0, 102), - (204, 255, 51), (204, 204, 51), (204, 153, 51), (204, 102, 51), - (204, 51, 51), (204, 0, 51), (204, 255, 0), (204, 204, 0), - (204, 153, 0), (204, 102, 0), (204, 51, 0), (204, 0, 0), - (153, 255, 102), (153, 204, 102), (153, 153, 102), (153, 102, 102), - (153, 51, 102), (153, 0, 102), (153, 255, 51), (153, 204, 51), - (153, 153, 51), (153, 102, 51), (153, 51, 51), (153, 0, 51), - (153, 255, 0), (153, 204, 0), (153, 153, 0), (153, 102, 0), - (153, 51, 0), (153, 0, 0), (102, 255, 102), (102, 204, 102), - (102, 153, 102), (102, 102, 102), (102, 51, 102), (102, 0, 102), - (102, 255, 51), (102, 204, 51), (102, 153, 51), (102, 102, 51), - (102, 51, 51), (102, 0, 51), (102, 255, 0), (102, 204, 0), - (102, 153, 0), (102, 102, 0), (102, 51, 0), (102, 0, 0), - (51, 255, 102), (51, 204, 102), (51, 153, 102), (51, 102, 102), - (51, 51, 102), (51, 0, 102), (51, 255, 51), (51, 204, 51), - (51, 153, 51), (51, 102, 51), (51, 51, 51), (51, 0, 51), - (51, 255, 0), (51, 204, 0), (51, 153, 0), (51, 102, 0), - (51, 51, 0), (51, 0, 0), (0, 255, 102), (0, 204, 102), - (0, 153, 102), (0, 102, 102), (0, 51, 102), (0, 0, 102), - (0, 255, 51), (0, 204, 51), (0, 153, 51), (0, 102, 51), - (0, 51, 51), (0, 0, 51), (0, 255, 0), (0, 204, 0), - (0, 153, 0), (0, 102, 0), (0, 51, 0), (17, 17, 17), - (34, 34, 34), (68, 68, 68), (85, 85, 85), (119, 119, 119), - (136, 136, 136), (170, 170, 170), (187, 187, 187), (221, 221, 221), - (238, 238, 238), (192, 192, 192), (128, 0, 0), (128, 0, 128), - (0, 128, 0), (0, 128, 128), (0, 0, 0), (0, 0, 0), - (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), - (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), - (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), - (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), - (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), - (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)) -# fmt: on - - -# so build a prototype image to be used for palette resampling -def build_prototype_image() -> Image.Image: - image = Image.new("L", (1, len(_Palm8BitColormapValues))) - image.putdata(list(range(len(_Palm8BitColormapValues)))) - palettedata: tuple[int, ...] = () - for colormapValue in _Palm8BitColormapValues: - palettedata += colormapValue - palettedata += (0, 0, 0) * (256 - len(_Palm8BitColormapValues)) - image.putpalette(palettedata) - return image - - -Palm8BitColormapImage = build_prototype_image() - -# OK, we now have in Palm8BitColormapImage, -# a "P"-mode image with the right palette -# -# -------------------------------------------------------------------- - -_FLAGS = {"custom-colormap": 0x4000, "is-compressed": 0x8000, "has-transparent": 0x2000} - -_COMPRESSION_TYPES = {"none": 0xFF, "rle": 0x01, "scanline": 0x00} - - -# -# -------------------------------------------------------------------- - -## -# (Internal) Image save plugin for the Palm format. - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode == "P": - rawmode = "P" - bpp = 8 - version = 1 - - elif im.mode == "L": - if im.encoderinfo.get("bpp") in (1, 2, 4): - # this is 8-bit grayscale, so we shift it to get the high-order bits, - # and invert it because - # Palm does grayscale from white (0) to black (1) - bpp = im.encoderinfo["bpp"] - maxval = (1 << bpp) - 1 - shift = 8 - bpp - im = im.point(lambda x: maxval - (x >> shift)) - elif im.info.get("bpp") in (1, 2, 4): - # here we assume that even though the inherent mode is 8-bit grayscale, - # only the lower bpp bits are significant. - # We invert them to match the Palm. - bpp = im.info["bpp"] - maxval = (1 << bpp) - 1 - im = im.point(lambda x: maxval - (x & maxval)) - else: - msg = f"cannot write mode {im.mode} as Palm" - raise OSError(msg) - - # we ignore the palette here - im._mode = "P" - rawmode = f"P;{bpp}" - version = 1 - - elif im.mode == "1": - # monochrome -- write it inverted, as is the Palm standard - rawmode = "1;I" - bpp = 1 - version = 0 - - else: - msg = f"cannot write mode {im.mode} as Palm" - raise OSError(msg) - - # - # make sure image data is available - im.load() - - # write header - - cols = im.size[0] - rows = im.size[1] - - rowbytes = int((cols + (16 // bpp - 1)) / (16 // bpp)) * 2 - transparent_index = 0 - compression_type = _COMPRESSION_TYPES["none"] - - flags = 0 - if im.mode == "P": - flags |= _FLAGS["custom-colormap"] - colormap = im.im.getpalette() - colors = len(colormap) // 3 - colormapsize = 4 * colors + 2 - else: - colormapsize = 0 - - if "offset" in im.info: - offset = (rowbytes * rows + 16 + 3 + colormapsize) // 4 - else: - offset = 0 - - fp.write(o16b(cols) + o16b(rows) + o16b(rowbytes) + o16b(flags)) - fp.write(o8(bpp)) - fp.write(o8(version)) - fp.write(o16b(offset)) - fp.write(o8(transparent_index)) - fp.write(o8(compression_type)) - fp.write(o16b(0)) # reserved by Palm - - # now write colormap if necessary - - if colormapsize: - fp.write(o16b(colors)) - for i in range(colors): - fp.write(o8(i)) - fp.write(colormap[3 * i : 3 * i + 3]) - - # now convert data to raw form - ImageFile._save( - im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, rowbytes, 1))] - ) - - if hasattr(fp, "flush"): - fp.flush() - - -# -# -------------------------------------------------------------------- - -Image.register_save("Palm", _save) - -Image.register_extension("Palm", ".palm") - -Image.register_mime("Palm", "image/palm") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PcdImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PcdImagePlugin.py deleted file mode 100644 index 3aa2499..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PcdImagePlugin.py +++ /dev/null @@ -1,64 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# PCD file handling -# -# History: -# 96-05-10 fl Created -# 96-05-27 fl Added draft mode (128x192, 256x384) -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image, ImageFile - -## -# Image plugin for PhotoCD images. This plugin only reads the 768x512 -# image from the file; higher resolutions are encoded in a proprietary -# encoding. - - -class PcdImageFile(ImageFile.ImageFile): - format = "PCD" - format_description = "Kodak PhotoCD" - - def _open(self) -> None: - # rough - assert self.fp is not None - - self.fp.seek(2048) - s = self.fp.read(2048) - - if not s.startswith(b"PCD_"): - msg = "not a PCD file" - raise SyntaxError(msg) - - orientation = s[1538] & 3 - self.tile_post_rotate = None - if orientation == 1: - self.tile_post_rotate = 90 - elif orientation == 3: - self.tile_post_rotate = -90 - - self._mode = "RGB" - self._size = 768, 512 # FIXME: not correct for rotated images! - self.tile = [ImageFile._Tile("pcd", (0, 0) + self.size, 96 * 2048)] - - def load_end(self) -> None: - if self.tile_post_rotate: - # Handle rotated PCDs - self.im = self.im.rotate(self.tile_post_rotate) - self._size = self.im.size - - -# -# registry - -Image.register_open(PcdImageFile.format, PcdImageFile) - -Image.register_extension(PcdImageFile.format, ".pcd") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PcfFontFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/PcfFontFile.py deleted file mode 100644 index 0d1968b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PcfFontFile.py +++ /dev/null @@ -1,254 +0,0 @@ -# -# THIS IS WORK IN PROGRESS -# -# The Python Imaging Library -# $Id$ -# -# portable compiled font file parser -# -# history: -# 1997-08-19 fl created -# 2003-09-13 fl fixed loading of unicode fonts -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1997-2003 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -from typing import BinaryIO, Callable - -from . import FontFile, Image -from ._binary import i8 -from ._binary import i16be as b16 -from ._binary import i16le as l16 -from ._binary import i32be as b32 -from ._binary import i32le as l32 - -# -------------------------------------------------------------------- -# declarations - -PCF_MAGIC = 0x70636601 # "\x01fcp" - -PCF_PROPERTIES = 1 << 0 -PCF_ACCELERATORS = 1 << 1 -PCF_METRICS = 1 << 2 -PCF_BITMAPS = 1 << 3 -PCF_INK_METRICS = 1 << 4 -PCF_BDF_ENCODINGS = 1 << 5 -PCF_SWIDTHS = 1 << 6 -PCF_GLYPH_NAMES = 1 << 7 -PCF_BDF_ACCELERATORS = 1 << 8 - -BYTES_PER_ROW: list[Callable[[int], int]] = [ - lambda bits: ((bits + 7) >> 3), - lambda bits: ((bits + 15) >> 3) & ~1, - lambda bits: ((bits + 31) >> 3) & ~3, - lambda bits: ((bits + 63) >> 3) & ~7, -] - - -def sz(s: bytes, o: int) -> bytes: - return s[o : s.index(b"\0", o)] - - -class PcfFontFile(FontFile.FontFile): - """Font file plugin for the X11 PCF format.""" - - name = "name" - - def __init__(self, fp: BinaryIO, charset_encoding: str = "iso8859-1"): - self.charset_encoding = charset_encoding - - magic = l32(fp.read(4)) - if magic != PCF_MAGIC: - msg = "not a PCF file" - raise SyntaxError(msg) - - super().__init__() - - count = l32(fp.read(4)) - self.toc = {} - for i in range(count): - type = l32(fp.read(4)) - self.toc[type] = l32(fp.read(4)), l32(fp.read(4)), l32(fp.read(4)) - - self.fp = fp - - self.info = self._load_properties() - - metrics = self._load_metrics() - bitmaps = self._load_bitmaps(metrics) - encoding = self._load_encoding() - - # - # create glyph structure - - for ch, ix in enumerate(encoding): - if ix is not None: - ( - xsize, - ysize, - left, - right, - width, - ascent, - descent, - attributes, - ) = metrics[ix] - self.glyph[ch] = ( - (width, 0), - (left, descent - ysize, xsize + left, descent), - (0, 0, xsize, ysize), - bitmaps[ix], - ) - - def _getformat( - self, tag: int - ) -> tuple[BinaryIO, int, Callable[[bytes], int], Callable[[bytes], int]]: - format, size, offset = self.toc[tag] - - fp = self.fp - fp.seek(offset) - - format = l32(fp.read(4)) - - if format & 4: - i16, i32 = b16, b32 - else: - i16, i32 = l16, l32 - - return fp, format, i16, i32 - - def _load_properties(self) -> dict[bytes, bytes | int]: - # - # font properties - - properties = {} - - fp, format, i16, i32 = self._getformat(PCF_PROPERTIES) - - nprops = i32(fp.read(4)) - - # read property description - p = [(i32(fp.read(4)), i8(fp.read(1)), i32(fp.read(4))) for _ in range(nprops)] - - if nprops & 3: - fp.seek(4 - (nprops & 3), io.SEEK_CUR) # pad - - data = fp.read(i32(fp.read(4))) - - for k, s, v in p: - property_value: bytes | int = sz(data, v) if s else v - properties[sz(data, k)] = property_value - - return properties - - def _load_metrics(self) -> list[tuple[int, int, int, int, int, int, int, int]]: - # - # font metrics - - metrics: list[tuple[int, int, int, int, int, int, int, int]] = [] - - fp, format, i16, i32 = self._getformat(PCF_METRICS) - - append = metrics.append - - if (format & 0xFF00) == 0x100: - # "compressed" metrics - for i in range(i16(fp.read(2))): - left = i8(fp.read(1)) - 128 - right = i8(fp.read(1)) - 128 - width = i8(fp.read(1)) - 128 - ascent = i8(fp.read(1)) - 128 - descent = i8(fp.read(1)) - 128 - xsize = right - left - ysize = ascent + descent - append((xsize, ysize, left, right, width, ascent, descent, 0)) - - else: - # "jumbo" metrics - for i in range(i32(fp.read(4))): - left = i16(fp.read(2)) - right = i16(fp.read(2)) - width = i16(fp.read(2)) - ascent = i16(fp.read(2)) - descent = i16(fp.read(2)) - attributes = i16(fp.read(2)) - xsize = right - left - ysize = ascent + descent - append((xsize, ysize, left, right, width, ascent, descent, attributes)) - - return metrics - - def _load_bitmaps( - self, metrics: list[tuple[int, int, int, int, int, int, int, int]] - ) -> list[Image.Image]: - # - # bitmap data - - fp, format, i16, i32 = self._getformat(PCF_BITMAPS) - - nbitmaps = i32(fp.read(4)) - - if nbitmaps != len(metrics): - msg = "Wrong number of bitmaps" - raise OSError(msg) - - offsets = [i32(fp.read(4)) for _ in range(nbitmaps)] - - bitmap_sizes = [i32(fp.read(4)) for _ in range(4)] - - # byteorder = format & 4 # non-zero => MSB - bitorder = format & 8 # non-zero => MSB - padindex = format & 3 - - bitmapsize = bitmap_sizes[padindex] - offsets.append(bitmapsize) - - data = fp.read(bitmapsize) - - pad = BYTES_PER_ROW[padindex] - mode = "1;R" - if bitorder: - mode = "1" - - bitmaps = [] - for i in range(nbitmaps): - xsize, ysize = metrics[i][:2] - b, e = offsets[i : i + 2] - bitmaps.append( - Image.frombytes("1", (xsize, ysize), data[b:e], "raw", mode, pad(xsize)) - ) - - return bitmaps - - def _load_encoding(self) -> list[int | None]: - fp, format, i16, i32 = self._getformat(PCF_BDF_ENCODINGS) - - first_col, last_col = i16(fp.read(2)), i16(fp.read(2)) - first_row, last_row = i16(fp.read(2)), i16(fp.read(2)) - - i16(fp.read(2)) # default - - nencoding = (last_col - first_col + 1) * (last_row - first_row + 1) - - # map character code to bitmap index - encoding: list[int | None] = [None] * min(256, nencoding) - - encoding_offsets = [i16(fp.read(2)) for _ in range(nencoding)] - - for i in range(first_col, len(encoding)): - try: - encoding_offset = encoding_offsets[ - ord(bytearray([i]).decode(self.charset_encoding)) - ] - if encoding_offset != 0xFFFF: - encoding[i] = encoding_offset - except UnicodeDecodeError: - # character is not supported in selected encoding - pass - - return encoding diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PcxImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PcxImagePlugin.py deleted file mode 100644 index 458d586..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PcxImagePlugin.py +++ /dev/null @@ -1,228 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# PCX file handling -# -# This format was originally used by ZSoft's popular PaintBrush -# program for the IBM PC. It is also supported by many MS-DOS and -# Windows applications, including the Windows PaintBrush program in -# Windows 3. -# -# history: -# 1995-09-01 fl Created -# 1996-05-20 fl Fixed RGB support -# 1997-01-03 fl Fixed 2-bit and 4-bit support -# 1999-02-03 fl Fixed 8-bit support (broken in 1.0b1) -# 1999-02-07 fl Added write support -# 2002-06-09 fl Made 2-bit and 4-bit support a bit more robust -# 2002-07-30 fl Seek from to current position, not beginning of file -# 2003-06-03 fl Extract DPI settings (info["dpi"]) -# -# Copyright (c) 1997-2003 by Secret Labs AB. -# Copyright (c) 1995-2003 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -import logging -from typing import IO - -from . import Image, ImageFile, ImagePalette -from ._binary import i16le as i16 -from ._binary import o8 -from ._binary import o16le as o16 - -logger = logging.getLogger(__name__) - - -def _accept(prefix: bytes) -> bool: - return prefix[0] == 10 and prefix[1] in [0, 2, 3, 5] - - -## -# Image plugin for Paintbrush images. - - -class PcxImageFile(ImageFile.ImageFile): - format = "PCX" - format_description = "Paintbrush" - - def _open(self) -> None: - # header - assert self.fp is not None - - s = self.fp.read(68) - if not _accept(s): - msg = "not a PCX file" - raise SyntaxError(msg) - - # image - bbox = i16(s, 4), i16(s, 6), i16(s, 8) + 1, i16(s, 10) + 1 - if bbox[2] <= bbox[0] or bbox[3] <= bbox[1]: - msg = "bad PCX image size" - raise SyntaxError(msg) - logger.debug("BBox: %s %s %s %s", *bbox) - - offset = self.fp.tell() + 60 - - # format - version = s[1] - bits = s[3] - planes = s[65] - provided_stride = i16(s, 66) - logger.debug( - "PCX version %s, bits %s, planes %s, stride %s", - version, - bits, - planes, - provided_stride, - ) - - self.info["dpi"] = i16(s, 12), i16(s, 14) - - if bits == 1 and planes == 1: - mode = rawmode = "1" - - elif bits == 1 and planes in (2, 4): - mode = "P" - rawmode = f"P;{planes}L" - self.palette = ImagePalette.raw("RGB", s[16:64]) - - elif version == 5 and bits == 8 and planes == 1: - mode = rawmode = "L" - # FIXME: hey, this doesn't work with the incremental loader !!! - self.fp.seek(-769, io.SEEK_END) - s = self.fp.read(769) - if len(s) == 769 and s[0] == 12: - # check if the palette is linear grayscale - for i in range(256): - if s[i * 3 + 1 : i * 3 + 4] != o8(i) * 3: - mode = rawmode = "P" - break - if mode == "P": - self.palette = ImagePalette.raw("RGB", s[1:]) - - elif version == 5 and bits == 8 and planes == 3: - mode = "RGB" - rawmode = "RGB;L" - - else: - msg = "unknown PCX mode" - raise OSError(msg) - - self._mode = mode - self._size = bbox[2] - bbox[0], bbox[3] - bbox[1] - - # Don't trust the passed in stride. - # Calculate the approximate position for ourselves. - # CVE-2020-35653 - stride = (self._size[0] * bits + 7) // 8 - - # While the specification states that this must be even, - # not all images follow this - if provided_stride != stride: - stride += stride % 2 - - bbox = (0, 0) + self.size - logger.debug("size: %sx%s", *self.size) - - self.tile = [ImageFile._Tile("pcx", bbox, offset, (rawmode, planes * stride))] - - -# -------------------------------------------------------------------- -# save PCX files - - -SAVE = { - # mode: (version, bits, planes, raw mode) - "1": (2, 1, 1, "1"), - "L": (5, 8, 1, "L"), - "P": (5, 8, 1, "P"), - "RGB": (5, 8, 3, "RGB;L"), -} - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - try: - version, bits, planes, rawmode = SAVE[im.mode] - except KeyError as e: - msg = f"Cannot save {im.mode} images as PCX" - raise ValueError(msg) from e - - # bytes per plane - stride = (im.size[0] * bits + 7) // 8 - # stride should be even - stride += stride % 2 - # Stride needs to be kept in sync with the PcxEncode.c version. - # Ideally it should be passed in in the state, but the bytes value - # gets overwritten. - - logger.debug( - "PcxImagePlugin._save: xwidth: %d, bits: %d, stride: %d", - im.size[0], - bits, - stride, - ) - - # under windows, we could determine the current screen size with - # "Image.core.display_mode()[1]", but I think that's overkill... - - screen = im.size - - dpi = 100, 100 - - # PCX header - fp.write( - o8(10) - + o8(version) - + o8(1) - + o8(bits) - + o16(0) - + o16(0) - + o16(im.size[0] - 1) - + o16(im.size[1] - 1) - + o16(dpi[0]) - + o16(dpi[1]) - + b"\0" * 24 - + b"\xff" * 24 - + b"\0" - + o8(planes) - + o16(stride) - + o16(1) - + o16(screen[0]) - + o16(screen[1]) - + b"\0" * 54 - ) - - assert fp.tell() == 128 - - ImageFile._save( - im, fp, [ImageFile._Tile("pcx", (0, 0) + im.size, 0, (rawmode, bits * planes))] - ) - - if im.mode == "P": - # colour palette - fp.write(o8(12)) - palette = im.im.getpalette("RGB", "RGB") - palette += b"\x00" * (768 - len(palette)) - fp.write(palette) # 768 bytes - elif im.mode == "L": - # grayscale palette - fp.write(o8(12)) - for i in range(256): - fp.write(o8(i) * 3) - - -# -------------------------------------------------------------------- -# registry - - -Image.register_open(PcxImageFile.format, PcxImageFile, _accept) -Image.register_save(PcxImageFile.format, _save) - -Image.register_extension(PcxImageFile.format, ".pcx") - -Image.register_mime(PcxImageFile.format, "image/x-pcx") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PdfImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PdfImagePlugin.py deleted file mode 100644 index e9c20dd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PdfImagePlugin.py +++ /dev/null @@ -1,311 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# PDF (Acrobat) file handling -# -# History: -# 1996-07-16 fl Created -# 1997-01-18 fl Fixed header -# 2004-02-21 fl Fixes for 1/L/CMYK images, etc. -# 2004-02-24 fl Fixes for 1 and P images. -# -# Copyright (c) 1997-2004 by Secret Labs AB. All rights reserved. -# Copyright (c) 1996-1997 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# - -## -# Image plugin for PDF images (output only). -## -from __future__ import annotations - -import io -import math -import os -import time -from typing import IO, Any - -from . import Image, ImageFile, ImageSequence, PdfParser, __version__, features - -# -# -------------------------------------------------------------------- - -# object ids: -# 1. catalogue -# 2. pages -# 3. image -# 4. page -# 5. page contents - - -def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - _save(im, fp, filename, save_all=True) - - -## -# (Internal) Image save plugin for the PDF format. - - -def _write_image( - im: Image.Image, - filename: str | bytes, - existing_pdf: PdfParser.PdfParser, - image_refs: list[PdfParser.IndirectReference], -) -> tuple[PdfParser.IndirectReference, str]: - # FIXME: Should replace ASCIIHexDecode with RunLengthDecode - # (packbits) or LZWDecode (tiff/lzw compression). Note that - # PDF 1.2 also supports Flatedecode (zip compression). - - params = None - decode = None - - # - # Get image characteristics - - width, height = im.size - - dict_obj: dict[str, Any] = {"BitsPerComponent": 8} - if im.mode == "1": - if features.check("libtiff"): - decode_filter = "CCITTFaxDecode" - dict_obj["BitsPerComponent"] = 1 - params = PdfParser.PdfArray( - [ - PdfParser.PdfDict( - { - "K": -1, - "BlackIs1": True, - "Columns": width, - "Rows": height, - } - ) - ] - ) - else: - decode_filter = "DCTDecode" - dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceGray") - procset = "ImageB" # grayscale - elif im.mode == "L": - decode_filter = "DCTDecode" - # params = f"<< /Predictor 15 /Columns {width-2} >>" - dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceGray") - procset = "ImageB" # grayscale - elif im.mode == "LA": - decode_filter = "JPXDecode" - # params = f"<< /Predictor 15 /Columns {width-2} >>" - procset = "ImageB" # grayscale - dict_obj["SMaskInData"] = 1 - elif im.mode == "P": - decode_filter = "ASCIIHexDecode" - palette = im.getpalette() - assert palette is not None - dict_obj["ColorSpace"] = [ - PdfParser.PdfName("Indexed"), - PdfParser.PdfName("DeviceRGB"), - len(palette) // 3 - 1, - PdfParser.PdfBinary(palette), - ] - procset = "ImageI" # indexed color - - if "transparency" in im.info: - smask = im.convert("LA").getchannel("A") - smask.encoderinfo = {} - - image_ref = _write_image(smask, filename, existing_pdf, image_refs)[0] - dict_obj["SMask"] = image_ref - elif im.mode == "RGB": - decode_filter = "DCTDecode" - dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceRGB") - procset = "ImageC" # color images - elif im.mode == "RGBA": - decode_filter = "JPXDecode" - procset = "ImageC" # color images - dict_obj["SMaskInData"] = 1 - elif im.mode == "CMYK": - decode_filter = "DCTDecode" - dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceCMYK") - procset = "ImageC" # color images - decode = [1, 0, 1, 0, 1, 0, 1, 0] - else: - msg = f"cannot save mode {im.mode}" - raise ValueError(msg) - - # - # image - - op = io.BytesIO() - - if decode_filter == "ASCIIHexDecode": - ImageFile._save(im, op, [ImageFile._Tile("hex", (0, 0) + im.size, 0, im.mode)]) - elif decode_filter == "CCITTFaxDecode": - im.save( - op, - "TIFF", - compression="group4", - # use a single strip - strip_size=math.ceil(width / 8) * height, - ) - elif decode_filter == "DCTDecode": - Image.SAVE["JPEG"](im, op, filename) - elif decode_filter == "JPXDecode": - del dict_obj["BitsPerComponent"] - Image.SAVE["JPEG2000"](im, op, filename) - else: - msg = f"unsupported PDF filter ({decode_filter})" - raise ValueError(msg) - - stream = op.getvalue() - filter: PdfParser.PdfArray | PdfParser.PdfName - if decode_filter == "CCITTFaxDecode": - stream = stream[8:] - filter = PdfParser.PdfArray([PdfParser.PdfName(decode_filter)]) - else: - filter = PdfParser.PdfName(decode_filter) - - image_ref = image_refs.pop(0) - existing_pdf.write_obj( - image_ref, - stream=stream, - Type=PdfParser.PdfName("XObject"), - Subtype=PdfParser.PdfName("Image"), - Width=width, # * 72.0 / x_resolution, - Height=height, # * 72.0 / y_resolution, - Filter=filter, - Decode=decode, - DecodeParms=params, - **dict_obj, - ) - - return image_ref, procset - - -def _save( - im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False -) -> None: - is_appending = im.encoderinfo.get("append", False) - filename_str = filename.decode() if isinstance(filename, bytes) else filename - if is_appending: - existing_pdf = PdfParser.PdfParser(f=fp, filename=filename_str, mode="r+b") - else: - existing_pdf = PdfParser.PdfParser(f=fp, filename=filename_str, mode="w+b") - - dpi = im.encoderinfo.get("dpi") - if dpi: - x_resolution = dpi[0] - y_resolution = dpi[1] - else: - x_resolution = y_resolution = im.encoderinfo.get("resolution", 72.0) - - info = { - "title": ( - None if is_appending else os.path.splitext(os.path.basename(filename))[0] - ), - "author": None, - "subject": None, - "keywords": None, - "creator": None, - "producer": None, - "creationDate": None if is_appending else time.gmtime(), - "modDate": None if is_appending else time.gmtime(), - } - for k, default in info.items(): - v = im.encoderinfo.get(k) if k in im.encoderinfo else default - if v: - existing_pdf.info[k[0].upper() + k[1:]] = v - - # - # make sure image data is available - im.load() - - existing_pdf.start_writing() - existing_pdf.write_header() - existing_pdf.write_comment(f"created by Pillow {__version__} PDF driver") - - # - # pages - ims = [im] - if save_all: - append_images = im.encoderinfo.get("append_images", []) - for append_im in append_images: - append_im.encoderinfo = im.encoderinfo.copy() - ims.append(append_im) - number_of_pages = 0 - image_refs = [] - page_refs = [] - contents_refs = [] - for im in ims: - im_number_of_pages = 1 - if save_all: - im_number_of_pages = getattr(im, "n_frames", 1) - number_of_pages += im_number_of_pages - for i in range(im_number_of_pages): - image_refs.append(existing_pdf.next_object_id(0)) - if im.mode == "P" and "transparency" in im.info: - image_refs.append(existing_pdf.next_object_id(0)) - - page_refs.append(existing_pdf.next_object_id(0)) - contents_refs.append(existing_pdf.next_object_id(0)) - existing_pdf.pages.append(page_refs[-1]) - - # - # catalog and list of pages - existing_pdf.write_catalog() - - page_number = 0 - for im_sequence in ims: - im_pages: ImageSequence.Iterator | list[Image.Image] = ( - ImageSequence.Iterator(im_sequence) if save_all else [im_sequence] - ) - for im in im_pages: - image_ref, procset = _write_image(im, filename, existing_pdf, image_refs) - - # - # page - - existing_pdf.write_page( - page_refs[page_number], - Resources=PdfParser.PdfDict( - ProcSet=[PdfParser.PdfName("PDF"), PdfParser.PdfName(procset)], - XObject=PdfParser.PdfDict(image=image_ref), - ), - MediaBox=[ - 0, - 0, - im.width * 72.0 / x_resolution, - im.height * 72.0 / y_resolution, - ], - Contents=contents_refs[page_number], - ) - - # - # page contents - - page_contents = b"q %f 0 0 %f 0 0 cm /image Do Q\n" % ( - im.width * 72.0 / x_resolution, - im.height * 72.0 / y_resolution, - ) - - existing_pdf.write_obj(contents_refs[page_number], stream=page_contents) - - page_number += 1 - - # - # trailer - existing_pdf.write_xref_and_trailer() - if hasattr(fp, "flush"): - fp.flush() - existing_pdf.close() - - -# -# -------------------------------------------------------------------- - - -Image.register_save("PDF", _save) -Image.register_save_all("PDF", _save_all) - -Image.register_extension("PDF", ".pdf") - -Image.register_mime("PDF", "application/pdf") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PdfParser.py b/write-message/venv/lib/python3.10/site-packages/PIL/PdfParser.py deleted file mode 100644 index 73d8c21..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PdfParser.py +++ /dev/null @@ -1,1074 +0,0 @@ -from __future__ import annotations - -import calendar -import codecs -import collections -import mmap -import os -import re -import time -import zlib -from typing import IO, Any, NamedTuple, Union - - -# see 7.9.2.2 Text String Type on page 86 and D.3 PDFDocEncoding Character Set -# on page 656 -def encode_text(s: str) -> bytes: - return codecs.BOM_UTF16_BE + s.encode("utf_16_be") - - -PDFDocEncoding = { - 0x16: "\u0017", - 0x18: "\u02d8", - 0x19: "\u02c7", - 0x1A: "\u02c6", - 0x1B: "\u02d9", - 0x1C: "\u02dd", - 0x1D: "\u02db", - 0x1E: "\u02da", - 0x1F: "\u02dc", - 0x80: "\u2022", - 0x81: "\u2020", - 0x82: "\u2021", - 0x83: "\u2026", - 0x84: "\u2014", - 0x85: "\u2013", - 0x86: "\u0192", - 0x87: "\u2044", - 0x88: "\u2039", - 0x89: "\u203a", - 0x8A: "\u2212", - 0x8B: "\u2030", - 0x8C: "\u201e", - 0x8D: "\u201c", - 0x8E: "\u201d", - 0x8F: "\u2018", - 0x90: "\u2019", - 0x91: "\u201a", - 0x92: "\u2122", - 0x93: "\ufb01", - 0x94: "\ufb02", - 0x95: "\u0141", - 0x96: "\u0152", - 0x97: "\u0160", - 0x98: "\u0178", - 0x99: "\u017d", - 0x9A: "\u0131", - 0x9B: "\u0142", - 0x9C: "\u0153", - 0x9D: "\u0161", - 0x9E: "\u017e", - 0xA0: "\u20ac", -} - - -def decode_text(b: bytes) -> str: - if b[: len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE: - return b[len(codecs.BOM_UTF16_BE) :].decode("utf_16_be") - else: - return "".join(PDFDocEncoding.get(byte, chr(byte)) for byte in b) - - -class PdfFormatError(RuntimeError): - """An error that probably indicates a syntactic or semantic error in the - PDF file structure""" - - pass - - -def check_format_condition(condition: bool, error_message: str) -> None: - if not condition: - raise PdfFormatError(error_message) - - -class IndirectReferenceTuple(NamedTuple): - object_id: int - generation: int - - -class IndirectReference(IndirectReferenceTuple): - def __str__(self) -> str: - return f"{self.object_id} {self.generation} R" - - def __bytes__(self) -> bytes: - return self.__str__().encode("us-ascii") - - def __eq__(self, other: object) -> bool: - if self.__class__ is not other.__class__: - return False - assert isinstance(other, IndirectReference) - return other.object_id == self.object_id and other.generation == self.generation - - def __ne__(self, other: object) -> bool: - return not (self == other) - - def __hash__(self) -> int: - return hash((self.object_id, self.generation)) - - -class IndirectObjectDef(IndirectReference): - def __str__(self) -> str: - return f"{self.object_id} {self.generation} obj" - - -class XrefTable: - def __init__(self) -> None: - self.existing_entries: dict[int, tuple[int, int]] = ( - {} - ) # object ID => (offset, generation) - self.new_entries: dict[int, tuple[int, int]] = ( - {} - ) # object ID => (offset, generation) - self.deleted_entries = {0: 65536} # object ID => generation - self.reading_finished = False - - def __setitem__(self, key: int, value: tuple[int, int]) -> None: - if self.reading_finished: - self.new_entries[key] = value - else: - self.existing_entries[key] = value - if key in self.deleted_entries: - del self.deleted_entries[key] - - def __getitem__(self, key: int) -> tuple[int, int]: - try: - return self.new_entries[key] - except KeyError: - return self.existing_entries[key] - - def __delitem__(self, key: int) -> None: - if key in self.new_entries: - generation = self.new_entries[key][1] + 1 - del self.new_entries[key] - self.deleted_entries[key] = generation - elif key in self.existing_entries: - generation = self.existing_entries[key][1] + 1 - self.deleted_entries[key] = generation - elif key in self.deleted_entries: - generation = self.deleted_entries[key] - else: - msg = f"object ID {key} cannot be deleted because it doesn't exist" - raise IndexError(msg) - - def __contains__(self, key: int) -> bool: - return key in self.existing_entries or key in self.new_entries - - def __len__(self) -> int: - return len( - set(self.existing_entries.keys()) - | set(self.new_entries.keys()) - | set(self.deleted_entries.keys()) - ) - - def keys(self) -> set[int]: - return ( - set(self.existing_entries.keys()) - set(self.deleted_entries.keys()) - ) | set(self.new_entries.keys()) - - def write(self, f: IO[bytes]) -> int: - keys = sorted(set(self.new_entries.keys()) | set(self.deleted_entries.keys())) - deleted_keys = sorted(set(self.deleted_entries.keys())) - startxref = f.tell() - f.write(b"xref\n") - while keys: - # find a contiguous sequence of object IDs - prev: int | None = None - for index, key in enumerate(keys): - if prev is None or prev + 1 == key: - prev = key - else: - contiguous_keys = keys[:index] - keys = keys[index:] - break - else: - contiguous_keys = keys - keys = [] - f.write(b"%d %d\n" % (contiguous_keys[0], len(contiguous_keys))) - for object_id in contiguous_keys: - if object_id in self.new_entries: - f.write(b"%010d %05d n \n" % self.new_entries[object_id]) - else: - this_deleted_object_id = deleted_keys.pop(0) - check_format_condition( - object_id == this_deleted_object_id, - f"expected the next deleted object ID to be {object_id}, " - f"instead found {this_deleted_object_id}", - ) - try: - next_in_linked_list = deleted_keys[0] - except IndexError: - next_in_linked_list = 0 - f.write( - b"%010d %05d f \n" - % (next_in_linked_list, self.deleted_entries[object_id]) - ) - return startxref - - -class PdfName: - name: bytes - - def __init__(self, name: PdfName | bytes | str) -> None: - if isinstance(name, PdfName): - self.name = name.name - elif isinstance(name, bytes): - self.name = name - else: - self.name = name.encode("us-ascii") - - def name_as_str(self) -> str: - return self.name.decode("us-ascii") - - def __eq__(self, other: object) -> bool: - return ( - isinstance(other, PdfName) and other.name == self.name - ) or other == self.name - - def __hash__(self) -> int: - return hash(self.name) - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({repr(self.name)})" - - @classmethod - def from_pdf_stream(cls, data: bytes) -> PdfName: - return cls(PdfParser.interpret_name(data)) - - allowed_chars = set(range(33, 127)) - {ord(c) for c in "#%/()<>[]{}"} - - def __bytes__(self) -> bytes: - result = bytearray(b"/") - for b in self.name: - if b in self.allowed_chars: - result.append(b) - else: - result.extend(b"#%02X" % b) - return bytes(result) - - -class PdfArray(list[Any]): - def __bytes__(self) -> bytes: - return b"[ " + b" ".join(pdf_repr(x) for x in self) + b" ]" - - -TYPE_CHECKING = False -if TYPE_CHECKING: - _DictBase = collections.UserDict[Union[str, bytes], Any] -else: - _DictBase = collections.UserDict - - -class PdfDict(_DictBase): - def __setattr__(self, key: str, value: Any) -> None: - if key == "data": - collections.UserDict.__setattr__(self, key, value) - else: - self[key.encode("us-ascii")] = value - - def __getattr__(self, key: str) -> str | time.struct_time: - try: - value = self[key.encode("us-ascii")] - except KeyError as e: - raise AttributeError(key) from e - if isinstance(value, bytes): - value = decode_text(value) - if key.endswith("Date"): - if value.startswith("D:"): - value = value[2:] - - relationship = "Z" - if len(value) > 17: - relationship = value[14] - offset = int(value[15:17]) * 60 - if len(value) > 20: - offset += int(value[18:20]) - - format = "%Y%m%d%H%M%S"[: len(value) - 2] - value = time.strptime(value[: len(format) + 2], format) - if relationship in ["+", "-"]: - offset *= 60 - if relationship == "+": - offset *= -1 - value = time.gmtime(calendar.timegm(value) + offset) - return value - - def __bytes__(self) -> bytes: - out = bytearray(b"<<") - for key, value in self.items(): - if value is None: - continue - value = pdf_repr(value) - out.extend(b"\n") - out.extend(bytes(PdfName(key))) - out.extend(b" ") - out.extend(value) - out.extend(b"\n>>") - return bytes(out) - - -class PdfBinary: - def __init__(self, data: list[int] | bytes) -> None: - self.data = data - - def __bytes__(self) -> bytes: - return b"<%s>" % b"".join(b"%02X" % b for b in self.data) - - -class PdfStream: - def __init__(self, dictionary: PdfDict, buf: bytes) -> None: - self.dictionary = dictionary - self.buf = buf - - def decode(self) -> bytes: - try: - filter = self.dictionary[b"Filter"] - except KeyError: - return self.buf - if filter == b"FlateDecode": - try: - expected_length = self.dictionary[b"DL"] - except KeyError: - expected_length = self.dictionary[b"Length"] - return zlib.decompress(self.buf, bufsize=int(expected_length)) - else: - msg = f"stream filter {repr(filter)} unknown/unsupported" - raise NotImplementedError(msg) - - -def pdf_repr(x: Any) -> bytes: - if x is True: - return b"true" - elif x is False: - return b"false" - elif x is None: - return b"null" - elif isinstance(x, (PdfName, PdfDict, PdfArray, PdfBinary)): - return bytes(x) - elif isinstance(x, (int, float)): - return str(x).encode("us-ascii") - elif isinstance(x, time.struct_time): - return b"(D:" + time.strftime("%Y%m%d%H%M%SZ", x).encode("us-ascii") + b")" - elif isinstance(x, dict): - return bytes(PdfDict(x)) - elif isinstance(x, list): - return bytes(PdfArray(x)) - elif isinstance(x, str): - return pdf_repr(encode_text(x)) - elif isinstance(x, bytes): - # XXX escape more chars? handle binary garbage - x = x.replace(b"\\", b"\\\\") - x = x.replace(b"(", b"\\(") - x = x.replace(b")", b"\\)") - return b"(" + x + b")" - else: - return bytes(x) - - -class PdfParser: - """Based on - https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf - Supports PDF up to 1.4 - """ - - def __init__( - self, - filename: str | None = None, - f: IO[bytes] | None = None, - buf: bytes | bytearray | None = None, - start_offset: int = 0, - mode: str = "rb", - ) -> None: - if buf and f: - msg = "specify buf or f or filename, but not both buf and f" - raise RuntimeError(msg) - self.filename = filename - self.buf: bytes | bytearray | mmap.mmap | None = buf - self.f = f - self.start_offset = start_offset - self.should_close_buf = False - self.should_close_file = False - if filename is not None and f is None: - self.f = f = open(filename, mode) - self.should_close_file = True - if f is not None: - self.buf = self.get_buf_from_file(f) - self.should_close_buf = True - if not filename and hasattr(f, "name"): - self.filename = f.name - self.cached_objects: dict[IndirectReference, Any] = {} - self.root_ref: IndirectReference | None - self.info_ref: IndirectReference | None - self.pages_ref: IndirectReference | None - self.last_xref_section_offset: int | None - if self.buf: - self.read_pdf_info() - else: - self.file_size_total = self.file_size_this = 0 - self.root = PdfDict() - self.root_ref = None - self.info = PdfDict() - self.info_ref = None - self.page_tree_root = PdfDict() - self.pages: list[IndirectReference] = [] - self.orig_pages: list[IndirectReference] = [] - self.pages_ref = None - self.last_xref_section_offset = None - self.trailer_dict: dict[bytes, Any] = {} - self.xref_table = XrefTable() - self.xref_table.reading_finished = True - if f: - self.seek_end() - - def __enter__(self) -> PdfParser: - return self - - def __exit__(self, *args: object) -> None: - self.close() - - def start_writing(self) -> None: - self.close_buf() - self.seek_end() - - def close_buf(self) -> None: - if isinstance(self.buf, mmap.mmap): - self.buf.close() - self.buf = None - - def close(self) -> None: - if self.should_close_buf: - self.close_buf() - if self.f is not None and self.should_close_file: - self.f.close() - self.f = None - - def seek_end(self) -> None: - assert self.f is not None - self.f.seek(0, os.SEEK_END) - - def write_header(self) -> None: - assert self.f is not None - self.f.write(b"%PDF-1.4\n") - - def write_comment(self, s: str) -> None: - assert self.f is not None - self.f.write(f"% {s}\n".encode()) - - def write_catalog(self) -> IndirectReference: - assert self.f is not None - self.del_root() - self.root_ref = self.next_object_id(self.f.tell()) - self.pages_ref = self.next_object_id(0) - self.rewrite_pages() - self.write_obj(self.root_ref, Type=PdfName(b"Catalog"), Pages=self.pages_ref) - self.write_obj( - self.pages_ref, - Type=PdfName(b"Pages"), - Count=len(self.pages), - Kids=self.pages, - ) - return self.root_ref - - def rewrite_pages(self) -> None: - pages_tree_nodes_to_delete = [] - for i, page_ref in enumerate(self.orig_pages): - page_info = self.cached_objects[page_ref] - del self.xref_table[page_ref.object_id] - pages_tree_nodes_to_delete.append(page_info[PdfName(b"Parent")]) - if page_ref not in self.pages: - # the page has been deleted - continue - # make dict keys into strings for passing to write_page - stringified_page_info = {} - for key, value in page_info.items(): - # key should be a PdfName - stringified_page_info[key.name_as_str()] = value - stringified_page_info["Parent"] = self.pages_ref - new_page_ref = self.write_page(None, **stringified_page_info) - for j, cur_page_ref in enumerate(self.pages): - if cur_page_ref == page_ref: - # replace the page reference with the new one - self.pages[j] = new_page_ref - # delete redundant Pages tree nodes from xref table - for pages_tree_node_ref in pages_tree_nodes_to_delete: - while pages_tree_node_ref: - pages_tree_node = self.cached_objects[pages_tree_node_ref] - if pages_tree_node_ref.object_id in self.xref_table: - del self.xref_table[pages_tree_node_ref.object_id] - pages_tree_node_ref = pages_tree_node.get(b"Parent", None) - self.orig_pages = [] - - def write_xref_and_trailer( - self, new_root_ref: IndirectReference | None = None - ) -> None: - assert self.f is not None - if new_root_ref: - self.del_root() - self.root_ref = new_root_ref - if self.info: - self.info_ref = self.write_obj(None, self.info) - start_xref = self.xref_table.write(self.f) - num_entries = len(self.xref_table) - trailer_dict: dict[str | bytes, Any] = { - b"Root": self.root_ref, - b"Size": num_entries, - } - if self.last_xref_section_offset is not None: - trailer_dict[b"Prev"] = self.last_xref_section_offset - if self.info: - trailer_dict[b"Info"] = self.info_ref - self.last_xref_section_offset = start_xref - self.f.write( - b"trailer\n" - + bytes(PdfDict(trailer_dict)) - + b"\nstartxref\n%d\n%%%%EOF" % start_xref - ) - - def write_page( - self, ref: int | IndirectReference | None, *objs: Any, **dict_obj: Any - ) -> IndirectReference: - obj_ref = self.pages[ref] if isinstance(ref, int) else ref - if "Type" not in dict_obj: - dict_obj["Type"] = PdfName(b"Page") - if "Parent" not in dict_obj: - dict_obj["Parent"] = self.pages_ref - return self.write_obj(obj_ref, *objs, **dict_obj) - - def write_obj( - self, ref: IndirectReference | None, *objs: Any, **dict_obj: Any - ) -> IndirectReference: - assert self.f is not None - f = self.f - if ref is None: - ref = self.next_object_id(f.tell()) - else: - self.xref_table[ref.object_id] = (f.tell(), ref.generation) - f.write(bytes(IndirectObjectDef(*ref))) - stream = dict_obj.pop("stream", None) - if stream is not None: - dict_obj["Length"] = len(stream) - if dict_obj: - f.write(pdf_repr(dict_obj)) - for obj in objs: - f.write(pdf_repr(obj)) - if stream is not None: - f.write(b"stream\n") - f.write(stream) - f.write(b"\nendstream\n") - f.write(b"endobj\n") - return ref - - def del_root(self) -> None: - if self.root_ref is None: - return - del self.xref_table[self.root_ref.object_id] - del self.xref_table[self.root[b"Pages"].object_id] - - @staticmethod - def get_buf_from_file(f: IO[bytes]) -> bytes | mmap.mmap: - if hasattr(f, "getbuffer"): - return f.getbuffer() - elif hasattr(f, "getvalue"): - return f.getvalue() - else: - try: - return mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) - except ValueError: # cannot mmap an empty file - return b"" - - def read_pdf_info(self) -> None: - assert self.buf is not None - self.file_size_total = len(self.buf) - self.file_size_this = self.file_size_total - self.start_offset - self.read_trailer() - check_format_condition( - self.trailer_dict.get(b"Root") is not None, "Root is missing" - ) - self.root_ref = self.trailer_dict[b"Root"] - assert self.root_ref is not None - self.info_ref = self.trailer_dict.get(b"Info", None) - self.root = PdfDict(self.read_indirect(self.root_ref)) - if self.info_ref is None: - self.info = PdfDict() - else: - self.info = PdfDict(self.read_indirect(self.info_ref)) - check_format_condition(b"Type" in self.root, "/Type missing in Root") - check_format_condition( - self.root[b"Type"] == b"Catalog", "/Type in Root is not /Catalog" - ) - check_format_condition( - self.root.get(b"Pages") is not None, "/Pages missing in Root" - ) - check_format_condition( - isinstance(self.root[b"Pages"], IndirectReference), - "/Pages in Root is not an indirect reference", - ) - self.pages_ref = self.root[b"Pages"] - assert self.pages_ref is not None - self.page_tree_root = self.read_indirect(self.pages_ref) - self.pages = self.linearize_page_tree(self.page_tree_root) - # save the original list of page references - # in case the user modifies, adds or deletes some pages - # and we need to rewrite the pages and their list - self.orig_pages = self.pages[:] - - def next_object_id(self, offset: int | None = None) -> IndirectReference: - try: - # TODO: support reuse of deleted objects - reference = IndirectReference(max(self.xref_table.keys()) + 1, 0) - except ValueError: - reference = IndirectReference(1, 0) - if offset is not None: - self.xref_table[reference.object_id] = (offset, 0) - return reference - - delimiter = rb"[][()<>{}/%]" - delimiter_or_ws = rb"[][()<>{}/%\000\011\012\014\015\040]" - whitespace = rb"[\000\011\012\014\015\040]" - whitespace_or_hex = rb"[\000\011\012\014\015\0400-9a-fA-F]" - whitespace_optional = whitespace + b"*" - whitespace_mandatory = whitespace + b"+" - # No "\012" aka "\n" or "\015" aka "\r": - whitespace_optional_no_nl = rb"[\000\011\014\040]*" - newline_only = rb"[\r\n]+" - newline = whitespace_optional_no_nl + newline_only + whitespace_optional_no_nl - re_trailer_end = re.compile( - whitespace_mandatory - + rb"trailer" - + whitespace_optional - + rb"<<(.*>>)" - + newline - + rb"startxref" - + newline - + rb"([0-9]+)" - + newline - + rb"%%EOF" - + whitespace_optional - + rb"$", - re.DOTALL, - ) - re_trailer_prev = re.compile( - whitespace_optional - + rb"trailer" - + whitespace_optional - + rb"<<(.*?>>)" - + newline - + rb"startxref" - + newline - + rb"([0-9]+)" - + newline - + rb"%%EOF" - + whitespace_optional, - re.DOTALL, - ) - - def read_trailer(self) -> None: - assert self.buf is not None - search_start_offset = len(self.buf) - 16384 - if search_start_offset < self.start_offset: - search_start_offset = self.start_offset - m = self.re_trailer_end.search(self.buf, search_start_offset) - check_format_condition(m is not None, "trailer end not found") - # make sure we found the LAST trailer - last_match = m - while m: - last_match = m - m = self.re_trailer_end.search(self.buf, m.start() + 16) - if not m: - m = last_match - assert m is not None - trailer_data = m.group(1) - self.last_xref_section_offset = int(m.group(2)) - self.trailer_dict = self.interpret_trailer(trailer_data) - self.xref_table = XrefTable() - self.read_xref_table(xref_section_offset=self.last_xref_section_offset) - if b"Prev" in self.trailer_dict: - self.read_prev_trailer(self.trailer_dict[b"Prev"]) - - def read_prev_trailer(self, xref_section_offset: int) -> None: - assert self.buf is not None - trailer_offset = self.read_xref_table(xref_section_offset=xref_section_offset) - m = self.re_trailer_prev.search( - self.buf[trailer_offset : trailer_offset + 16384] - ) - check_format_condition(m is not None, "previous trailer not found") - assert m is not None - trailer_data = m.group(1) - check_format_condition( - int(m.group(2)) == xref_section_offset, - "xref section offset in previous trailer doesn't match what was expected", - ) - trailer_dict = self.interpret_trailer(trailer_data) - if b"Prev" in trailer_dict: - self.read_prev_trailer(trailer_dict[b"Prev"]) - - re_whitespace_optional = re.compile(whitespace_optional) - re_name = re.compile( - whitespace_optional - + rb"/([!-$&'*-.0-;=?-Z\\^-z|~]+)(?=" - + delimiter_or_ws - + rb")" - ) - re_dict_start = re.compile(whitespace_optional + rb"<<") - re_dict_end = re.compile(whitespace_optional + rb">>" + whitespace_optional) - - @classmethod - def interpret_trailer(cls, trailer_data: bytes) -> dict[bytes, Any]: - trailer = {} - offset = 0 - while True: - m = cls.re_name.match(trailer_data, offset) - if not m: - m = cls.re_dict_end.match(trailer_data, offset) - check_format_condition( - m is not None and m.end() == len(trailer_data), - "name not found in trailer, remaining data: " - + repr(trailer_data[offset:]), - ) - break - key = cls.interpret_name(m.group(1)) - assert isinstance(key, bytes) - value, value_offset = cls.get_value(trailer_data, m.end()) - trailer[key] = value - if value_offset is None: - break - offset = value_offset - check_format_condition( - b"Size" in trailer and isinstance(trailer[b"Size"], int), - "/Size not in trailer or not an integer", - ) - check_format_condition( - b"Root" in trailer and isinstance(trailer[b"Root"], IndirectReference), - "/Root not in trailer or not an indirect reference", - ) - return trailer - - re_hashes_in_name = re.compile(rb"([^#]*)(#([0-9a-fA-F]{2}))?") - - @classmethod - def interpret_name(cls, raw: bytes, as_text: bool = False) -> str | bytes: - name = b"" - for m in cls.re_hashes_in_name.finditer(raw): - if m.group(3): - name += m.group(1) + bytearray.fromhex(m.group(3).decode("us-ascii")) - else: - name += m.group(1) - if as_text: - return name.decode("utf-8") - else: - return bytes(name) - - re_null = re.compile(whitespace_optional + rb"null(?=" + delimiter_or_ws + rb")") - re_true = re.compile(whitespace_optional + rb"true(?=" + delimiter_or_ws + rb")") - re_false = re.compile(whitespace_optional + rb"false(?=" + delimiter_or_ws + rb")") - re_int = re.compile( - whitespace_optional + rb"([-+]?[0-9]+)(?=" + delimiter_or_ws + rb")" - ) - re_real = re.compile( - whitespace_optional - + rb"([-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+))(?=" - + delimiter_or_ws - + rb")" - ) - re_array_start = re.compile(whitespace_optional + rb"\[") - re_array_end = re.compile(whitespace_optional + rb"]") - re_string_hex = re.compile( - whitespace_optional + rb"<(" + whitespace_or_hex + rb"*)>" - ) - re_string_lit = re.compile(whitespace_optional + rb"\(") - re_indirect_reference = re.compile( - whitespace_optional - + rb"([-+]?[0-9]+)" - + whitespace_mandatory - + rb"([-+]?[0-9]+)" - + whitespace_mandatory - + rb"R(?=" - + delimiter_or_ws - + rb")" - ) - re_indirect_def_start = re.compile( - whitespace_optional - + rb"([-+]?[0-9]+)" - + whitespace_mandatory - + rb"([-+]?[0-9]+)" - + whitespace_mandatory - + rb"obj(?=" - + delimiter_or_ws - + rb")" - ) - re_indirect_def_end = re.compile( - whitespace_optional + rb"endobj(?=" + delimiter_or_ws + rb")" - ) - re_comment = re.compile( - rb"(" + whitespace_optional + rb"%[^\r\n]*" + newline + rb")*" - ) - re_stream_start = re.compile(whitespace_optional + rb"stream\r?\n") - re_stream_end = re.compile( - whitespace_optional + rb"endstream(?=" + delimiter_or_ws + rb")" - ) - - @classmethod - def get_value( - cls, - data: bytes | bytearray | mmap.mmap, - offset: int, - expect_indirect: IndirectReference | None = None, - max_nesting: int = -1, - ) -> tuple[Any, int | None]: - if max_nesting == 0: - return None, None - m = cls.re_comment.match(data, offset) - if m: - offset = m.end() - m = cls.re_indirect_def_start.match(data, offset) - if m: - check_format_condition( - int(m.group(1)) > 0, - "indirect object definition: object ID must be greater than 0", - ) - check_format_condition( - int(m.group(2)) >= 0, - "indirect object definition: generation must be non-negative", - ) - check_format_condition( - expect_indirect is None - or expect_indirect - == IndirectReference(int(m.group(1)), int(m.group(2))), - "indirect object definition different than expected", - ) - object, object_offset = cls.get_value( - data, m.end(), max_nesting=max_nesting - 1 - ) - if object_offset is None: - return object, None - m = cls.re_indirect_def_end.match(data, object_offset) - check_format_condition( - m is not None, "indirect object definition end not found" - ) - assert m is not None - return object, m.end() - check_format_condition( - not expect_indirect, "indirect object definition not found" - ) - m = cls.re_indirect_reference.match(data, offset) - if m: - check_format_condition( - int(m.group(1)) > 0, - "indirect object reference: object ID must be greater than 0", - ) - check_format_condition( - int(m.group(2)) >= 0, - "indirect object reference: generation must be non-negative", - ) - return IndirectReference(int(m.group(1)), int(m.group(2))), m.end() - m = cls.re_dict_start.match(data, offset) - if m: - offset = m.end() - result: dict[Any, Any] = {} - m = cls.re_dict_end.match(data, offset) - current_offset: int | None = offset - while not m: - assert current_offset is not None - key, current_offset = cls.get_value( - data, current_offset, max_nesting=max_nesting - 1 - ) - if current_offset is None: - return result, None - value, current_offset = cls.get_value( - data, current_offset, max_nesting=max_nesting - 1 - ) - result[key] = value - if current_offset is None: - return result, None - m = cls.re_dict_end.match(data, current_offset) - current_offset = m.end() - m = cls.re_stream_start.match(data, current_offset) - if m: - stream_len = result.get(b"Length") - if stream_len is None or not isinstance(stream_len, int): - msg = f"bad or missing Length in stream dict ({stream_len})" - raise PdfFormatError(msg) - stream_data = data[m.end() : m.end() + stream_len] - m = cls.re_stream_end.match(data, m.end() + stream_len) - check_format_condition(m is not None, "stream end not found") - assert m is not None - current_offset = m.end() - return PdfStream(PdfDict(result), stream_data), current_offset - return PdfDict(result), current_offset - m = cls.re_array_start.match(data, offset) - if m: - offset = m.end() - results = [] - m = cls.re_array_end.match(data, offset) - current_offset = offset - while not m: - assert current_offset is not None - value, current_offset = cls.get_value( - data, current_offset, max_nesting=max_nesting - 1 - ) - results.append(value) - if current_offset is None: - return results, None - m = cls.re_array_end.match(data, current_offset) - return results, m.end() - m = cls.re_null.match(data, offset) - if m: - return None, m.end() - m = cls.re_true.match(data, offset) - if m: - return True, m.end() - m = cls.re_false.match(data, offset) - if m: - return False, m.end() - m = cls.re_name.match(data, offset) - if m: - return PdfName(cls.interpret_name(m.group(1))), m.end() - m = cls.re_int.match(data, offset) - if m: - return int(m.group(1)), m.end() - m = cls.re_real.match(data, offset) - if m: - # XXX Decimal instead of float??? - return float(m.group(1)), m.end() - m = cls.re_string_hex.match(data, offset) - if m: - # filter out whitespace - hex_string = bytearray( - b for b in m.group(1) if b in b"0123456789abcdefABCDEF" - ) - if len(hex_string) % 2 == 1: - # append a 0 if the length is not even - yes, at the end - hex_string.append(ord(b"0")) - return bytearray.fromhex(hex_string.decode("us-ascii")), m.end() - m = cls.re_string_lit.match(data, offset) - if m: - return cls.get_literal_string(data, m.end()) - # return None, offset # fallback (only for debugging) - msg = f"unrecognized object: {repr(data[offset : offset + 32])}" - raise PdfFormatError(msg) - - re_lit_str_token = re.compile( - rb"(\\[nrtbf()\\])|(\\[0-9]{1,3})|(\\(\r\n|\r|\n))|(\r\n|\r|\n)|(\()|(\))" - ) - escaped_chars = { - b"n": b"\n", - b"r": b"\r", - b"t": b"\t", - b"b": b"\b", - b"f": b"\f", - b"(": b"(", - b")": b")", - b"\\": b"\\", - ord(b"n"): b"\n", - ord(b"r"): b"\r", - ord(b"t"): b"\t", - ord(b"b"): b"\b", - ord(b"f"): b"\f", - ord(b"("): b"(", - ord(b")"): b")", - ord(b"\\"): b"\\", - } - - @classmethod - def get_literal_string( - cls, data: bytes | bytearray | mmap.mmap, offset: int - ) -> tuple[bytes, int]: - nesting_depth = 0 - result = bytearray() - for m in cls.re_lit_str_token.finditer(data, offset): - result.extend(data[offset : m.start()]) - if m.group(1): - result.extend(cls.escaped_chars[m.group(1)[1]]) - elif m.group(2): - result.append(int(m.group(2)[1:], 8)) - elif m.group(3): - pass - elif m.group(5): - result.extend(b"\n") - elif m.group(6): - result.extend(b"(") - nesting_depth += 1 - elif m.group(7): - if nesting_depth == 0: - return bytes(result), m.end() - result.extend(b")") - nesting_depth -= 1 - offset = m.end() - msg = "unfinished literal string" - raise PdfFormatError(msg) - - re_xref_section_start = re.compile(whitespace_optional + rb"xref" + newline) - re_xref_subsection_start = re.compile( - whitespace_optional - + rb"([0-9]+)" - + whitespace_mandatory - + rb"([0-9]+)" - + whitespace_optional - + newline_only - ) - re_xref_entry = re.compile(rb"([0-9]{10}) ([0-9]{5}) ([fn])( \r| \n|\r\n)") - - def read_xref_table(self, xref_section_offset: int) -> int: - assert self.buf is not None - subsection_found = False - m = self.re_xref_section_start.match( - self.buf, xref_section_offset + self.start_offset - ) - check_format_condition(m is not None, "xref section start not found") - assert m is not None - offset = m.end() - while True: - m = self.re_xref_subsection_start.match(self.buf, offset) - if not m: - check_format_condition( - subsection_found, "xref subsection start not found" - ) - break - subsection_found = True - offset = m.end() - first_object = int(m.group(1)) - num_objects = int(m.group(2)) - for i in range(first_object, first_object + num_objects): - m = self.re_xref_entry.match(self.buf, offset) - check_format_condition(m is not None, "xref entry not found") - assert m is not None - offset = m.end() - is_free = m.group(3) == b"f" - if not is_free: - generation = int(m.group(2)) - new_entry = (int(m.group(1)), generation) - if i not in self.xref_table: - self.xref_table[i] = new_entry - return offset - - def read_indirect(self, ref: IndirectReference, max_nesting: int = -1) -> Any: - offset, generation = self.xref_table[ref[0]] - check_format_condition( - generation == ref[1], - f"expected to find generation {ref[1]} for object ID {ref[0]} in xref " - f"table, instead found generation {generation} at offset {offset}", - ) - assert self.buf is not None - value = self.get_value( - self.buf, - offset + self.start_offset, - expect_indirect=IndirectReference(*ref), - max_nesting=max_nesting, - )[0] - self.cached_objects[ref] = value - return value - - def linearize_page_tree( - self, node: PdfDict | None = None - ) -> list[IndirectReference]: - page_node = node if node is not None else self.page_tree_root - check_format_condition( - page_node[b"Type"] == b"Pages", "/Type of page tree node is not /Pages" - ) - pages = [] - for kid in page_node[b"Kids"]: - kid_object = self.read_indirect(kid) - if kid_object[b"Type"] == b"Page": - pages.append(kid) - else: - pages.extend(self.linearize_page_tree(node=kid_object)) - return pages diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PixarImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PixarImagePlugin.py deleted file mode 100644 index d2b6d0a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PixarImagePlugin.py +++ /dev/null @@ -1,72 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# PIXAR raster support for PIL -# -# history: -# 97-01-29 fl Created -# -# notes: -# This is incomplete; it is based on a few samples created with -# Photoshop 2.5 and 3.0, and a summary description provided by -# Greg Coats . Hopefully, "L" and -# "RGBA" support will be added in future versions. -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1997. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image, ImageFile -from ._binary import i16le as i16 - -# -# helpers - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"\200\350\000\000") - - -## -# Image plugin for PIXAR raster images. - - -class PixarImageFile(ImageFile.ImageFile): - format = "PIXAR" - format_description = "PIXAR raster image" - - def _open(self) -> None: - # assuming a 4-byte magic label - assert self.fp is not None - - s = self.fp.read(4) - if not _accept(s): - msg = "not a PIXAR file" - raise SyntaxError(msg) - - # read rest of header - s = s + self.fp.read(508) - - self._size = i16(s, 418), i16(s, 416) - - # get channel/depth descriptions - mode = i16(s, 424), i16(s, 426) - - if mode == (14, 2): - self._mode = "RGB" - # FIXME: to be continued... - - # create tile descriptor (assuming "dumped") - self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 1024, self.mode)] - - -# -# -------------------------------------------------------------------- - -Image.register_open(PixarImageFile.format, PixarImageFile, _accept) - -Image.register_extension(PixarImageFile.format, ".pxr") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PngImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PngImagePlugin.py deleted file mode 100644 index 1b9a89a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PngImagePlugin.py +++ /dev/null @@ -1,1551 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# PNG support code -# -# See "PNG (Portable Network Graphics) Specification, version 1.0; -# W3C Recommendation", 1996-10-01, Thomas Boutell (ed.). -# -# history: -# 1996-05-06 fl Created (couldn't resist it) -# 1996-12-14 fl Upgraded, added read and verify support (0.2) -# 1996-12-15 fl Separate PNG stream parser -# 1996-12-29 fl Added write support, added getchunks -# 1996-12-30 fl Eliminated circular references in decoder (0.3) -# 1998-07-12 fl Read/write 16-bit images as mode I (0.4) -# 2001-02-08 fl Added transparency support (from Zircon) (0.5) -# 2001-04-16 fl Don't close data source in "open" method (0.6) -# 2004-02-24 fl Don't even pretend to support interlaced files (0.7) -# 2004-08-31 fl Do basic sanity check on chunk identifiers (0.8) -# 2004-09-20 fl Added PngInfo chunk container -# 2004-12-18 fl Added DPI read support (based on code by Niki Spahiev) -# 2008-08-13 fl Added tRNS support for RGB images -# 2009-03-06 fl Support for preserving ICC profiles (by Florian Hoech) -# 2009-03-08 fl Added zTXT support (from Lowell Alleman) -# 2009-03-29 fl Read interlaced PNG files (from Conrado Porto Lopes Gouvua) -# -# Copyright (c) 1997-2009 by Secret Labs AB -# Copyright (c) 1996 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import itertools -import logging -import re -import struct -import warnings -import zlib -from collections.abc import Callable -from enum import IntEnum -from typing import IO, Any, NamedTuple, NoReturn, cast - -from . import Image, ImageChops, ImageFile, ImagePalette, ImageSequence -from ._binary import i16be as i16 -from ._binary import i32be as i32 -from ._binary import o8 -from ._binary import o16be as o16 -from ._binary import o32be as o32 -from ._deprecate import deprecate -from ._util import DeferredError - -TYPE_CHECKING = False -if TYPE_CHECKING: - from . import _imaging - -logger = logging.getLogger(__name__) - -is_cid = re.compile(rb"\w\w\w\w").match - - -_MAGIC = b"\211PNG\r\n\032\n" - - -_MODES = { - # supported bits/color combinations, and corresponding modes/rawmodes - # Grayscale - (1, 0): ("1", "1"), - (2, 0): ("L", "L;2"), - (4, 0): ("L", "L;4"), - (8, 0): ("L", "L"), - (16, 0): ("I;16", "I;16B"), - # Truecolour - (8, 2): ("RGB", "RGB"), - (16, 2): ("RGB", "RGB;16B"), - # Indexed-colour - (1, 3): ("P", "P;1"), - (2, 3): ("P", "P;2"), - (4, 3): ("P", "P;4"), - (8, 3): ("P", "P"), - # Grayscale with alpha - (8, 4): ("LA", "LA"), - (16, 4): ("RGBA", "LA;16B"), # LA;16B->LA not yet available - # Truecolour with alpha - (8, 6): ("RGBA", "RGBA"), - (16, 6): ("RGBA", "RGBA;16B"), -} - - -_simple_palette = re.compile(b"^\xff*\x00\xff*$") - -MAX_TEXT_CHUNK = ImageFile.SAFEBLOCK -""" -Maximum decompressed size for a iTXt or zTXt chunk. -Eliminates decompression bombs where compressed chunks can expand 1000x. -See :ref:`Text in PNG File Format`. -""" -MAX_TEXT_MEMORY = 64 * MAX_TEXT_CHUNK -""" -Set the maximum total text chunk size. -See :ref:`Text in PNG File Format`. -""" - - -# APNG frame disposal modes -class Disposal(IntEnum): - OP_NONE = 0 - """ - No disposal is done on this frame before rendering the next frame. - See :ref:`Saving APNG sequences`. - """ - OP_BACKGROUND = 1 - """ - This frame’s modified region is cleared to fully transparent black before rendering - the next frame. - See :ref:`Saving APNG sequences`. - """ - OP_PREVIOUS = 2 - """ - This frame’s modified region is reverted to the previous frame’s contents before - rendering the next frame. - See :ref:`Saving APNG sequences`. - """ - - -# APNG frame blend modes -class Blend(IntEnum): - OP_SOURCE = 0 - """ - All color components of this frame, including alpha, overwrite the previous output - image contents. - See :ref:`Saving APNG sequences`. - """ - OP_OVER = 1 - """ - This frame should be alpha composited with the previous output image contents. - See :ref:`Saving APNG sequences`. - """ - - -def _safe_zlib_decompress(s: bytes) -> bytes: - dobj = zlib.decompressobj() - plaintext = dobj.decompress(s, MAX_TEXT_CHUNK) - if dobj.unconsumed_tail: - msg = "Decompressed data too large for PngImagePlugin.MAX_TEXT_CHUNK" - raise ValueError(msg) - return plaintext - - -def _crc32(data: bytes, seed: int = 0) -> int: - return zlib.crc32(data, seed) & 0xFFFFFFFF - - -# -------------------------------------------------------------------- -# Support classes. Suitable for PNG and related formats like MNG etc. - - -class ChunkStream: - def __init__(self, fp: IO[bytes]) -> None: - self.fp: IO[bytes] | None = fp - self.queue: list[tuple[bytes, int, int]] | None = [] - - def read(self) -> tuple[bytes, int, int]: - """Fetch a new chunk. Returns header information.""" - cid = None - - assert self.fp is not None - if self.queue: - cid, pos, length = self.queue.pop() - self.fp.seek(pos) - else: - s = self.fp.read(8) - cid = s[4:] - pos = self.fp.tell() - length = i32(s) - - if not is_cid(cid): - if not ImageFile.LOAD_TRUNCATED_IMAGES: - msg = f"broken PNG file (chunk {repr(cid)})" - raise SyntaxError(msg) - - return cid, pos, length - - def __enter__(self) -> ChunkStream: - return self - - def __exit__(self, *args: object) -> None: - self.close() - - def close(self) -> None: - self.queue = self.fp = None - - def push(self, cid: bytes, pos: int, length: int) -> None: - assert self.queue is not None - self.queue.append((cid, pos, length)) - - def call(self, cid: bytes, pos: int, length: int) -> bytes: - """Call the appropriate chunk handler""" - - logger.debug("STREAM %r %s %s", cid, pos, length) - return getattr(self, f"chunk_{cid.decode('ascii')}")(pos, length) - - def crc(self, cid: bytes, data: bytes) -> None: - """Read and verify checksum""" - - # Skip CRC checks for ancillary chunks if allowed to load truncated - # images - # 5th byte of first char is 1 [specs, section 5.4] - if ImageFile.LOAD_TRUNCATED_IMAGES and (cid[0] >> 5 & 1): - self.crc_skip(cid, data) - return - - assert self.fp is not None - try: - crc1 = _crc32(data, _crc32(cid)) - crc2 = i32(self.fp.read(4)) - if crc1 != crc2: - msg = f"broken PNG file (bad header checksum in {repr(cid)})" - raise SyntaxError(msg) - except struct.error as e: - msg = f"broken PNG file (incomplete checksum in {repr(cid)})" - raise SyntaxError(msg) from e - - def crc_skip(self, cid: bytes, data: bytes) -> None: - """Read checksum""" - - assert self.fp is not None - self.fp.read(4) - - def verify(self, endchunk: bytes = b"IEND") -> list[bytes]: - # Simple approach; just calculate checksum for all remaining - # blocks. Must be called directly after open. - - cids = [] - - assert self.fp is not None - while True: - try: - cid, pos, length = self.read() - except struct.error as e: - msg = "truncated PNG file" - raise OSError(msg) from e - - if cid == endchunk: - break - self.crc(cid, ImageFile._safe_read(self.fp, length)) - cids.append(cid) - - return cids - - -class iTXt(str): - """ - Subclass of string to allow iTXt chunks to look like strings while - keeping their extra information - - """ - - lang: str | bytes | None - tkey: str | bytes | None - - @staticmethod - def __new__( - cls, text: str, lang: str | None = None, tkey: str | None = None - ) -> iTXt: - """ - :param cls: the class to use when creating the instance - :param text: value for this key - :param lang: language code - :param tkey: UTF-8 version of the key name - """ - - self = str.__new__(cls, text) - self.lang = lang - self.tkey = tkey - return self - - -class PngInfo: - """ - PNG chunk container (for use with save(pnginfo=)) - - """ - - def __init__(self) -> None: - self.chunks: list[tuple[bytes, bytes, bool]] = [] - - def add(self, cid: bytes, data: bytes, after_idat: bool = False) -> None: - """Appends an arbitrary chunk. Use with caution. - - :param cid: a byte string, 4 bytes long. - :param data: a byte string of the encoded data - :param after_idat: for use with private chunks. Whether the chunk - should be written after IDAT - - """ - - self.chunks.append((cid, data, after_idat)) - - def add_itxt( - self, - key: str | bytes, - value: str | bytes, - lang: str | bytes = "", - tkey: str | bytes = "", - zip: bool = False, - ) -> None: - """Appends an iTXt chunk. - - :param key: latin-1 encodable text key name - :param value: value for this key - :param lang: language code - :param tkey: UTF-8 version of the key name - :param zip: compression flag - - """ - - if not isinstance(key, bytes): - key = key.encode("latin-1", "strict") - if not isinstance(value, bytes): - value = value.encode("utf-8", "strict") - if not isinstance(lang, bytes): - lang = lang.encode("utf-8", "strict") - if not isinstance(tkey, bytes): - tkey = tkey.encode("utf-8", "strict") - - if zip: - self.add( - b"iTXt", - key + b"\0\x01\0" + lang + b"\0" + tkey + b"\0" + zlib.compress(value), - ) - else: - self.add(b"iTXt", key + b"\0\0\0" + lang + b"\0" + tkey + b"\0" + value) - - def add_text( - self, key: str | bytes, value: str | bytes | iTXt, zip: bool = False - ) -> None: - """Appends a text chunk. - - :param key: latin-1 encodable text key name - :param value: value for this key, text or an - :py:class:`PIL.PngImagePlugin.iTXt` instance - :param zip: compression flag - - """ - if isinstance(value, iTXt): - return self.add_itxt( - key, - value, - value.lang if value.lang is not None else b"", - value.tkey if value.tkey is not None else b"", - zip=zip, - ) - - # The tEXt chunk stores latin-1 text - if not isinstance(value, bytes): - try: - value = value.encode("latin-1", "strict") - except UnicodeError: - return self.add_itxt(key, value, zip=zip) - - if not isinstance(key, bytes): - key = key.encode("latin-1", "strict") - - if zip: - self.add(b"zTXt", key + b"\0\0" + zlib.compress(value)) - else: - self.add(b"tEXt", key + b"\0" + value) - - -# -------------------------------------------------------------------- -# PNG image stream (IHDR/IEND) - - -class _RewindState(NamedTuple): - info: dict[str | tuple[int, int], Any] - tile: list[ImageFile._Tile] - seq_num: int | None - - -class PngStream(ChunkStream): - def __init__(self, fp: IO[bytes]) -> None: - super().__init__(fp) - - # local copies of Image attributes - self.im_info: dict[str | tuple[int, int], Any] = {} - self.im_text: dict[str, str | iTXt] = {} - self.im_size = (0, 0) - self.im_mode = "" - self.im_tile: list[ImageFile._Tile] = [] - self.im_palette: tuple[str, bytes] | None = None - self.im_custom_mimetype: str | None = None - self.im_n_frames: int | None = None - self._seq_num: int | None = None - self.rewind_state = _RewindState({}, [], None) - - self.text_memory = 0 - - def check_text_memory(self, chunklen: int) -> None: - self.text_memory += chunklen - if self.text_memory > MAX_TEXT_MEMORY: - msg = ( - "Too much memory used in text chunks: " - f"{self.text_memory}>MAX_TEXT_MEMORY" - ) - raise ValueError(msg) - - def save_rewind(self) -> None: - self.rewind_state = _RewindState( - self.im_info.copy(), - self.im_tile, - self._seq_num, - ) - - def rewind(self) -> None: - self.im_info = self.rewind_state.info.copy() - self.im_tile = self.rewind_state.tile - self._seq_num = self.rewind_state.seq_num - - def chunk_iCCP(self, pos: int, length: int) -> bytes: - # ICC profile - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - # according to PNG spec, the iCCP chunk contains: - # Profile name 1-79 bytes (character string) - # Null separator 1 byte (null character) - # Compression method 1 byte (0) - # Compressed profile n bytes (zlib with deflate compression) - i = s.find(b"\0") - logger.debug("iCCP profile name %r", s[:i]) - comp_method = s[i + 1] - logger.debug("Compression method %s", comp_method) - if comp_method != 0: - msg = f"Unknown compression method {comp_method} in iCCP chunk" - raise SyntaxError(msg) - try: - icc_profile = _safe_zlib_decompress(s[i + 2 :]) - except ValueError: - if ImageFile.LOAD_TRUNCATED_IMAGES: - icc_profile = None - else: - raise - except zlib.error: - icc_profile = None # FIXME - self.im_info["icc_profile"] = icc_profile - return s - - def chunk_IHDR(self, pos: int, length: int) -> bytes: - # image header - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - if length < 13: - if ImageFile.LOAD_TRUNCATED_IMAGES: - return s - msg = "Truncated IHDR chunk" - raise ValueError(msg) - self.im_size = i32(s, 0), i32(s, 4) - try: - self.im_mode, self.im_rawmode = _MODES[(s[8], s[9])] - except Exception: - pass - if s[12]: - self.im_info["interlace"] = 1 - if s[11]: - msg = "unknown filter category" - raise SyntaxError(msg) - return s - - def chunk_IDAT(self, pos: int, length: int) -> NoReturn: - # image data - if "bbox" in self.im_info: - tile = [ImageFile._Tile("zip", self.im_info["bbox"], pos, self.im_rawmode)] - else: - if self.im_n_frames is not None: - self.im_info["default_image"] = True - tile = [ImageFile._Tile("zip", (0, 0) + self.im_size, pos, self.im_rawmode)] - self.im_tile = tile - self.im_idat = length - msg = "image data found" - raise EOFError(msg) - - def chunk_IEND(self, pos: int, length: int) -> NoReturn: - msg = "end of PNG image" - raise EOFError(msg) - - def chunk_PLTE(self, pos: int, length: int) -> bytes: - # palette - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - if self.im_mode == "P": - self.im_palette = "RGB", s - return s - - def chunk_tRNS(self, pos: int, length: int) -> bytes: - # transparency - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - if self.im_mode == "P": - if _simple_palette.match(s): - # tRNS contains only one full-transparent entry, - # other entries are full opaque - i = s.find(b"\0") - if i >= 0: - self.im_info["transparency"] = i - else: - # otherwise, we have a byte string with one alpha value - # for each palette entry - self.im_info["transparency"] = s - elif self.im_mode in ("1", "L", "I;16"): - self.im_info["transparency"] = i16(s) - elif self.im_mode == "RGB": - self.im_info["transparency"] = i16(s), i16(s, 2), i16(s, 4) - return s - - def chunk_gAMA(self, pos: int, length: int) -> bytes: - # gamma setting - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - self.im_info["gamma"] = i32(s) / 100000.0 - return s - - def chunk_cHRM(self, pos: int, length: int) -> bytes: - # chromaticity, 8 unsigned ints, actual value is scaled by 100,000 - # WP x,y, Red x,y, Green x,y Blue x,y - - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - raw_vals = struct.unpack(f">{len(s) // 4}I", s) - self.im_info["chromaticity"] = tuple(elt / 100000.0 for elt in raw_vals) - return s - - def chunk_sRGB(self, pos: int, length: int) -> bytes: - # srgb rendering intent, 1 byte - # 0 perceptual - # 1 relative colorimetric - # 2 saturation - # 3 absolute colorimetric - - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - if length < 1: - if ImageFile.LOAD_TRUNCATED_IMAGES: - return s - msg = "Truncated sRGB chunk" - raise ValueError(msg) - self.im_info["srgb"] = s[0] - return s - - def chunk_pHYs(self, pos: int, length: int) -> bytes: - # pixels per unit - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - if length < 9: - if ImageFile.LOAD_TRUNCATED_IMAGES: - return s - msg = "Truncated pHYs chunk" - raise ValueError(msg) - px, py = i32(s, 0), i32(s, 4) - unit = s[8] - if unit == 1: # meter - dpi = px * 0.0254, py * 0.0254 - self.im_info["dpi"] = dpi - elif unit == 0: - self.im_info["aspect"] = px, py - return s - - def chunk_tEXt(self, pos: int, length: int) -> bytes: - # text - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - try: - k, v = s.split(b"\0", 1) - except ValueError: - # fallback for broken tEXt tags - k = s - v = b"" - if k: - k_str = k.decode("latin-1", "strict") - v_str = v.decode("latin-1", "replace") - - self.im_info[k_str] = v if k == b"exif" else v_str - self.im_text[k_str] = v_str - self.check_text_memory(len(v_str)) - - return s - - def chunk_zTXt(self, pos: int, length: int) -> bytes: - # compressed text - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - try: - k, v = s.split(b"\0", 1) - except ValueError: - k = s - v = b"" - if v: - comp_method = v[0] - else: - comp_method = 0 - if comp_method != 0: - msg = f"Unknown compression method {comp_method} in zTXt chunk" - raise SyntaxError(msg) - try: - v = _safe_zlib_decompress(v[1:]) - except ValueError: - if ImageFile.LOAD_TRUNCATED_IMAGES: - v = b"" - else: - raise - except zlib.error: - v = b"" - - if k: - k_str = k.decode("latin-1", "strict") - v_str = v.decode("latin-1", "replace") - - self.im_info[k_str] = self.im_text[k_str] = v_str - self.check_text_memory(len(v_str)) - - return s - - def chunk_iTXt(self, pos: int, length: int) -> bytes: - # international text - assert self.fp is not None - r = s = ImageFile._safe_read(self.fp, length) - try: - k, r = r.split(b"\0", 1) - except ValueError: - return s - if len(r) < 2: - return s - cf, cm, r = r[0], r[1], r[2:] - try: - lang, tk, v = r.split(b"\0", 2) - except ValueError: - return s - if cf != 0: - if cm == 0: - try: - v = _safe_zlib_decompress(v) - except ValueError: - if ImageFile.LOAD_TRUNCATED_IMAGES: - return s - else: - raise - except zlib.error: - return s - else: - return s - if k == b"XML:com.adobe.xmp": - self.im_info["xmp"] = v - try: - k_str = k.decode("latin-1", "strict") - lang_str = lang.decode("utf-8", "strict") - tk_str = tk.decode("utf-8", "strict") - v_str = v.decode("utf-8", "strict") - except UnicodeError: - return s - - self.im_info[k_str] = self.im_text[k_str] = iTXt(v_str, lang_str, tk_str) - self.check_text_memory(len(v_str)) - - return s - - def chunk_eXIf(self, pos: int, length: int) -> bytes: - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - self.im_info["exif"] = b"Exif\x00\x00" + s - return s - - # APNG chunks - def chunk_acTL(self, pos: int, length: int) -> bytes: - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - if length < 8: - if ImageFile.LOAD_TRUNCATED_IMAGES: - return s - msg = "APNG contains truncated acTL chunk" - raise ValueError(msg) - if self.im_n_frames is not None: - self.im_n_frames = None - warnings.warn("Invalid APNG, will use default PNG image if possible") - return s - n_frames = i32(s) - if n_frames == 0 or n_frames > 0x80000000: - warnings.warn("Invalid APNG, will use default PNG image if possible") - return s - self.im_n_frames = n_frames - self.im_info["loop"] = i32(s, 4) - self.im_custom_mimetype = "image/apng" - return s - - def chunk_fcTL(self, pos: int, length: int) -> bytes: - assert self.fp is not None - s = ImageFile._safe_read(self.fp, length) - if length < 26: - if ImageFile.LOAD_TRUNCATED_IMAGES: - return s - msg = "APNG contains truncated fcTL chunk" - raise ValueError(msg) - seq = i32(s) - if (self._seq_num is None and seq != 0) or ( - self._seq_num is not None and self._seq_num != seq - 1 - ): - msg = "APNG contains frame sequence errors" - raise SyntaxError(msg) - self._seq_num = seq - width, height = i32(s, 4), i32(s, 8) - px, py = i32(s, 12), i32(s, 16) - im_w, im_h = self.im_size - if px + width > im_w or py + height > im_h: - msg = "APNG contains invalid frames" - raise SyntaxError(msg) - self.im_info["bbox"] = (px, py, px + width, py + height) - delay_num, delay_den = i16(s, 20), i16(s, 22) - if delay_den == 0: - delay_den = 100 - self.im_info["duration"] = float(delay_num) / float(delay_den) * 1000 - self.im_info["disposal"] = s[24] - self.im_info["blend"] = s[25] - return s - - def chunk_fdAT(self, pos: int, length: int) -> bytes: - assert self.fp is not None - if length < 4: - if ImageFile.LOAD_TRUNCATED_IMAGES: - s = ImageFile._safe_read(self.fp, length) - return s - msg = "APNG contains truncated fDAT chunk" - raise ValueError(msg) - s = ImageFile._safe_read(self.fp, 4) - seq = i32(s) - if self._seq_num != seq - 1: - msg = "APNG contains frame sequence errors" - raise SyntaxError(msg) - self._seq_num = seq - return self.chunk_IDAT(pos + 4, length - 4) - - -# -------------------------------------------------------------------- -# PNG reader - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(_MAGIC) - - -## -# Image plugin for PNG images. - - -class PngImageFile(ImageFile.ImageFile): - format = "PNG" - format_description = "Portable network graphics" - - def _open(self) -> None: - if not _accept(self.fp.read(8)): - msg = "not a PNG file" - raise SyntaxError(msg) - self._fp = self.fp - self.__frame = 0 - - # - # Parse headers up to the first IDAT or fDAT chunk - - self.private_chunks: list[tuple[bytes, bytes] | tuple[bytes, bytes, bool]] = [] - self.png: PngStream | None = PngStream(self.fp) - - while True: - # - # get next chunk - - cid, pos, length = self.png.read() - - try: - s = self.png.call(cid, pos, length) - except EOFError: - break - except AttributeError: - logger.debug("%r %s %s (unknown)", cid, pos, length) - s = ImageFile._safe_read(self.fp, length) - if cid[1:2].islower(): - self.private_chunks.append((cid, s)) - - self.png.crc(cid, s) - - # - # Copy relevant attributes from the PngStream. An alternative - # would be to let the PngStream class modify these attributes - # directly, but that introduces circular references which are - # difficult to break if things go wrong in the decoder... - # (believe me, I've tried ;-) - - self._mode = self.png.im_mode - self._size = self.png.im_size - self.info = self.png.im_info - self._text: dict[str, str | iTXt] | None = None - self.tile = self.png.im_tile - self.custom_mimetype = self.png.im_custom_mimetype - self.n_frames = self.png.im_n_frames or 1 - self.default_image = self.info.get("default_image", False) - - if self.png.im_palette: - rawmode, data = self.png.im_palette - self.palette = ImagePalette.raw(rawmode, data) - - if cid == b"fdAT": - self.__prepare_idat = length - 4 - else: - self.__prepare_idat = length # used by load_prepare() - - if self.png.im_n_frames is not None: - self._close_exclusive_fp_after_loading = False - self.png.save_rewind() - self.__rewind_idat = self.__prepare_idat - self.__rewind = self._fp.tell() - if self.default_image: - # IDAT chunk contains default image and not first animation frame - self.n_frames += 1 - self._seek(0) - self.is_animated = self.n_frames > 1 - - @property - def text(self) -> dict[str, str | iTXt]: - # experimental - if self._text is None: - # iTxt, tEXt and zTXt chunks may appear at the end of the file - # So load the file to ensure that they are read - if self.is_animated: - frame = self.__frame - # for APNG, seek to the final frame before loading - self.seek(self.n_frames - 1) - self.load() - if self.is_animated: - self.seek(frame) - assert self._text is not None - return self._text - - def verify(self) -> None: - """Verify PNG file""" - - if self.fp is None: - msg = "verify must be called directly after open" - raise RuntimeError(msg) - - # back up to beginning of IDAT block - self.fp.seek(self.tile[0][2] - 8) - - assert self.png is not None - self.png.verify() - self.png.close() - - if self._exclusive_fp: - self.fp.close() - self.fp = None - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - if frame < self.__frame: - self._seek(0, True) - - last_frame = self.__frame - for f in range(self.__frame + 1, frame + 1): - try: - self._seek(f) - except EOFError as e: - self.seek(last_frame) - msg = "no more images in APNG file" - raise EOFError(msg) from e - - def _seek(self, frame: int, rewind: bool = False) -> None: - assert self.png is not None - if isinstance(self._fp, DeferredError): - raise self._fp.ex - - self.dispose: _imaging.ImagingCore | None - dispose_extent = None - if frame == 0: - if rewind: - self._fp.seek(self.__rewind) - self.png.rewind() - self.__prepare_idat = self.__rewind_idat - self._im = None - self.info = self.png.im_info - self.tile = self.png.im_tile - self.fp = self._fp - self._prev_im = None - self.dispose = None - self.default_image = self.info.get("default_image", False) - self.dispose_op = self.info.get("disposal") - self.blend_op = self.info.get("blend") - dispose_extent = self.info.get("bbox") - self.__frame = 0 - else: - if frame != self.__frame + 1: - msg = f"cannot seek to frame {frame}" - raise ValueError(msg) - - # ensure previous frame was loaded - self.load() - - if self.dispose: - self.im.paste(self.dispose, self.dispose_extent) - self._prev_im = self.im.copy() - - self.fp = self._fp - - # advance to the next frame - if self.__prepare_idat: - ImageFile._safe_read(self.fp, self.__prepare_idat) - self.__prepare_idat = 0 - frame_start = False - while True: - self.fp.read(4) # CRC - - try: - cid, pos, length = self.png.read() - except (struct.error, SyntaxError): - break - - if cid == b"IEND": - msg = "No more images in APNG file" - raise EOFError(msg) - if cid == b"fcTL": - if frame_start: - # there must be at least one fdAT chunk between fcTL chunks - msg = "APNG missing frame data" - raise SyntaxError(msg) - frame_start = True - - try: - self.png.call(cid, pos, length) - except UnicodeDecodeError: - break - except EOFError: - if cid == b"fdAT": - length -= 4 - if frame_start: - self.__prepare_idat = length - break - ImageFile._safe_read(self.fp, length) - except AttributeError: - logger.debug("%r %s %s (unknown)", cid, pos, length) - ImageFile._safe_read(self.fp, length) - - self.__frame = frame - self.tile = self.png.im_tile - self.dispose_op = self.info.get("disposal") - self.blend_op = self.info.get("blend") - dispose_extent = self.info.get("bbox") - - if not self.tile: - msg = "image not found in APNG frame" - raise EOFError(msg) - if dispose_extent: - self.dispose_extent: tuple[float, float, float, float] = dispose_extent - - # setup frame disposal (actual disposal done when needed in the next _seek()) - if self._prev_im is None and self.dispose_op == Disposal.OP_PREVIOUS: - self.dispose_op = Disposal.OP_BACKGROUND - - self.dispose = None - if self.dispose_op == Disposal.OP_PREVIOUS: - if self._prev_im: - self.dispose = self._prev_im.copy() - self.dispose = self._crop(self.dispose, self.dispose_extent) - elif self.dispose_op == Disposal.OP_BACKGROUND: - self.dispose = Image.core.fill(self.mode, self.size) - self.dispose = self._crop(self.dispose, self.dispose_extent) - - def tell(self) -> int: - return self.__frame - - def load_prepare(self) -> None: - """internal: prepare to read PNG file""" - - if self.info.get("interlace"): - self.decoderconfig = self.decoderconfig + (1,) - - self.__idat = self.__prepare_idat # used by load_read() - ImageFile.ImageFile.load_prepare(self) - - def load_read(self, read_bytes: int) -> bytes: - """internal: read more image data""" - - assert self.png is not None - while self.__idat == 0: - # end of chunk, skip forward to next one - - self.fp.read(4) # CRC - - cid, pos, length = self.png.read() - - if cid not in [b"IDAT", b"DDAT", b"fdAT"]: - self.png.push(cid, pos, length) - return b"" - - if cid == b"fdAT": - try: - self.png.call(cid, pos, length) - except EOFError: - pass - self.__idat = length - 4 # sequence_num has already been read - else: - self.__idat = length # empty chunks are allowed - - # read more data from this chunk - if read_bytes <= 0: - read_bytes = self.__idat - else: - read_bytes = min(read_bytes, self.__idat) - - self.__idat = self.__idat - read_bytes - - return self.fp.read(read_bytes) - - def load_end(self) -> None: - """internal: finished reading image data""" - assert self.png is not None - if self.__idat != 0: - self.fp.read(self.__idat) - while True: - self.fp.read(4) # CRC - - try: - cid, pos, length = self.png.read() - except (struct.error, SyntaxError): - break - - if cid == b"IEND": - break - elif cid == b"fcTL" and self.is_animated: - # start of the next frame, stop reading - self.__prepare_idat = 0 - self.png.push(cid, pos, length) - break - - try: - self.png.call(cid, pos, length) - except UnicodeDecodeError: - break - except EOFError: - if cid == b"fdAT": - length -= 4 - try: - ImageFile._safe_read(self.fp, length) - except OSError as e: - if ImageFile.LOAD_TRUNCATED_IMAGES: - break - else: - raise e - except AttributeError: - logger.debug("%r %s %s (unknown)", cid, pos, length) - s = ImageFile._safe_read(self.fp, length) - if cid[1:2].islower(): - self.private_chunks.append((cid, s, True)) - self._text = self.png.im_text - if not self.is_animated: - self.png.close() - self.png = None - else: - if self._prev_im and self.blend_op == Blend.OP_OVER: - updated = self._crop(self.im, self.dispose_extent) - if self.im.mode == "RGB" and "transparency" in self.info: - mask = updated.convert_transparent( - "RGBA", self.info["transparency"] - ) - else: - if self.im.mode == "P" and "transparency" in self.info: - t = self.info["transparency"] - if isinstance(t, bytes): - updated.putpalettealphas(t) - elif isinstance(t, int): - updated.putpalettealpha(t) - mask = updated.convert("RGBA") - self._prev_im.paste(updated, self.dispose_extent, mask) - self.im = self._prev_im - - def _getexif(self) -> dict[int, Any] | None: - if "exif" not in self.info: - self.load() - if "exif" not in self.info and "Raw profile type exif" not in self.info: - return None - return self.getexif()._get_merged_dict() - - def getexif(self) -> Image.Exif: - if "exif" not in self.info: - self.load() - - return super().getexif() - - -# -------------------------------------------------------------------- -# PNG writer - -_OUTMODES = { - # supported PIL modes, and corresponding rawmode, bit depth and color type - "1": ("1", b"\x01", b"\x00"), - "L;1": ("L;1", b"\x01", b"\x00"), - "L;2": ("L;2", b"\x02", b"\x00"), - "L;4": ("L;4", b"\x04", b"\x00"), - "L": ("L", b"\x08", b"\x00"), - "LA": ("LA", b"\x08", b"\x04"), - "I": ("I;16B", b"\x10", b"\x00"), - "I;16": ("I;16B", b"\x10", b"\x00"), - "I;16B": ("I;16B", b"\x10", b"\x00"), - "P;1": ("P;1", b"\x01", b"\x03"), - "P;2": ("P;2", b"\x02", b"\x03"), - "P;4": ("P;4", b"\x04", b"\x03"), - "P": ("P", b"\x08", b"\x03"), - "RGB": ("RGB", b"\x08", b"\x02"), - "RGBA": ("RGBA", b"\x08", b"\x06"), -} - - -def putchunk(fp: IO[bytes], cid: bytes, *data: bytes) -> None: - """Write a PNG chunk (including CRC field)""" - - byte_data = b"".join(data) - - fp.write(o32(len(byte_data)) + cid) - fp.write(byte_data) - crc = _crc32(byte_data, _crc32(cid)) - fp.write(o32(crc)) - - -class _idat: - # wrap output from the encoder in IDAT chunks - - def __init__(self, fp: IO[bytes], chunk: Callable[..., None]) -> None: - self.fp = fp - self.chunk = chunk - - def write(self, data: bytes) -> None: - self.chunk(self.fp, b"IDAT", data) - - -class _fdat: - # wrap encoder output in fdAT chunks - - def __init__(self, fp: IO[bytes], chunk: Callable[..., None], seq_num: int) -> None: - self.fp = fp - self.chunk = chunk - self.seq_num = seq_num - - def write(self, data: bytes) -> None: - self.chunk(self.fp, b"fdAT", o32(self.seq_num), data) - self.seq_num += 1 - - -class _Frame(NamedTuple): - im: Image.Image - bbox: tuple[int, int, int, int] | None - encoderinfo: dict[str, Any] - - -def _write_multiple_frames( - im: Image.Image, - fp: IO[bytes], - chunk: Callable[..., None], - mode: str, - rawmode: str, - default_image: Image.Image | None, - append_images: list[Image.Image], -) -> Image.Image | None: - duration = im.encoderinfo.get("duration") - loop = im.encoderinfo.get("loop", im.info.get("loop", 0)) - disposal = im.encoderinfo.get("disposal", im.info.get("disposal", Disposal.OP_NONE)) - blend = im.encoderinfo.get("blend", im.info.get("blend", Blend.OP_SOURCE)) - - if default_image: - chain = itertools.chain(append_images) - else: - chain = itertools.chain([im], append_images) - - im_frames: list[_Frame] = [] - frame_count = 0 - for im_seq in chain: - for im_frame in ImageSequence.Iterator(im_seq): - if im_frame.mode == mode: - im_frame = im_frame.copy() - else: - im_frame = im_frame.convert(mode) - encoderinfo = im.encoderinfo.copy() - if isinstance(duration, (list, tuple)): - encoderinfo["duration"] = duration[frame_count] - elif duration is None and "duration" in im_frame.info: - encoderinfo["duration"] = im_frame.info["duration"] - if isinstance(disposal, (list, tuple)): - encoderinfo["disposal"] = disposal[frame_count] - if isinstance(blend, (list, tuple)): - encoderinfo["blend"] = blend[frame_count] - frame_count += 1 - - if im_frames: - previous = im_frames[-1] - prev_disposal = previous.encoderinfo.get("disposal") - prev_blend = previous.encoderinfo.get("blend") - if prev_disposal == Disposal.OP_PREVIOUS and len(im_frames) < 2: - prev_disposal = Disposal.OP_BACKGROUND - - if prev_disposal == Disposal.OP_BACKGROUND: - base_im = previous.im.copy() - dispose = Image.core.fill("RGBA", im.size, (0, 0, 0, 0)) - bbox = previous.bbox - if bbox: - dispose = dispose.crop(bbox) - else: - bbox = (0, 0) + im.size - base_im.paste(dispose, bbox) - elif prev_disposal == Disposal.OP_PREVIOUS: - base_im = im_frames[-2].im - else: - base_im = previous.im - delta = ImageChops.subtract_modulo( - im_frame.convert("RGBA"), base_im.convert("RGBA") - ) - bbox = delta.getbbox(alpha_only=False) - if ( - not bbox - and prev_disposal == encoderinfo.get("disposal") - and prev_blend == encoderinfo.get("blend") - and "duration" in encoderinfo - ): - previous.encoderinfo["duration"] += encoderinfo["duration"] - continue - else: - bbox = None - im_frames.append(_Frame(im_frame, bbox, encoderinfo)) - - if len(im_frames) == 1 and not default_image: - return im_frames[0].im - - # animation control - chunk( - fp, - b"acTL", - o32(len(im_frames)), # 0: num_frames - o32(loop), # 4: num_plays - ) - - # default image IDAT (if it exists) - if default_image: - if im.mode != mode: - im = im.convert(mode) - ImageFile._save( - im, - cast(IO[bytes], _idat(fp, chunk)), - [ImageFile._Tile("zip", (0, 0) + im.size, 0, rawmode)], - ) - - seq_num = 0 - for frame, frame_data in enumerate(im_frames): - im_frame = frame_data.im - if not frame_data.bbox: - bbox = (0, 0) + im_frame.size - else: - bbox = frame_data.bbox - im_frame = im_frame.crop(bbox) - size = im_frame.size - encoderinfo = frame_data.encoderinfo - frame_duration = int(round(encoderinfo.get("duration", 0))) - frame_disposal = encoderinfo.get("disposal", disposal) - frame_blend = encoderinfo.get("blend", blend) - # frame control - chunk( - fp, - b"fcTL", - o32(seq_num), # sequence_number - o32(size[0]), # width - o32(size[1]), # height - o32(bbox[0]), # x_offset - o32(bbox[1]), # y_offset - o16(frame_duration), # delay_numerator - o16(1000), # delay_denominator - o8(frame_disposal), # dispose_op - o8(frame_blend), # blend_op - ) - seq_num += 1 - # frame data - if frame == 0 and not default_image: - # first frame must be in IDAT chunks for backwards compatibility - ImageFile._save( - im_frame, - cast(IO[bytes], _idat(fp, chunk)), - [ImageFile._Tile("zip", (0, 0) + im_frame.size, 0, rawmode)], - ) - else: - fdat_chunks = _fdat(fp, chunk, seq_num) - ImageFile._save( - im_frame, - cast(IO[bytes], fdat_chunks), - [ImageFile._Tile("zip", (0, 0) + im_frame.size, 0, rawmode)], - ) - seq_num = fdat_chunks.seq_num - return None - - -def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - _save(im, fp, filename, save_all=True) - - -def _save( - im: Image.Image, - fp: IO[bytes], - filename: str | bytes, - chunk: Callable[..., None] = putchunk, - save_all: bool = False, -) -> None: - # save an image to disk (called by the save method) - - if save_all: - default_image = im.encoderinfo.get( - "default_image", im.info.get("default_image") - ) - modes = set() - sizes = set() - append_images = im.encoderinfo.get("append_images", []) - for im_seq in itertools.chain([im], append_images): - for im_frame in ImageSequence.Iterator(im_seq): - modes.add(im_frame.mode) - sizes.add(im_frame.size) - for mode in ("RGBA", "RGB", "P"): - if mode in modes: - break - else: - mode = modes.pop() - size = tuple(max(frame_size[i] for frame_size in sizes) for i in range(2)) - else: - size = im.size - mode = im.mode - - outmode = mode - if mode == "P": - # - # attempt to minimize storage requirements for palette images - if "bits" in im.encoderinfo: - # number of bits specified by user - colors = min(1 << im.encoderinfo["bits"], 256) - else: - # check palette contents - if im.palette: - colors = max(min(len(im.palette.getdata()[1]) // 3, 256), 1) - else: - colors = 256 - - if colors <= 16: - if colors <= 2: - bits = 1 - elif colors <= 4: - bits = 2 - else: - bits = 4 - outmode += f";{bits}" - - # encoder options - im.encoderconfig = ( - im.encoderinfo.get("optimize", False), - im.encoderinfo.get("compress_level", -1), - im.encoderinfo.get("compress_type", -1), - im.encoderinfo.get("dictionary", b""), - ) - - # get the corresponding PNG mode - try: - rawmode, bit_depth, color_type = _OUTMODES[outmode] - except KeyError as e: - msg = f"cannot write mode {mode} as PNG" - raise OSError(msg) from e - if outmode == "I": - deprecate("Saving I mode images as PNG", 13, stacklevel=4) - - # - # write minimal PNG file - - fp.write(_MAGIC) - - chunk( - fp, - b"IHDR", - o32(size[0]), # 0: size - o32(size[1]), - bit_depth, - color_type, - b"\0", # 10: compression - b"\0", # 11: filter category - b"\0", # 12: interlace flag - ) - - chunks = [b"cHRM", b"cICP", b"gAMA", b"sBIT", b"sRGB", b"tIME"] - - icc = im.encoderinfo.get("icc_profile", im.info.get("icc_profile")) - if icc: - # ICC profile - # according to PNG spec, the iCCP chunk contains: - # Profile name 1-79 bytes (character string) - # Null separator 1 byte (null character) - # Compression method 1 byte (0) - # Compressed profile n bytes (zlib with deflate compression) - name = b"ICC Profile" - data = name + b"\0\0" + zlib.compress(icc) - chunk(fp, b"iCCP", data) - - # You must either have sRGB or iCCP. - # Disallow sRGB chunks when an iCCP-chunk has been emitted. - chunks.remove(b"sRGB") - - info = im.encoderinfo.get("pnginfo") - if info: - chunks_multiple_allowed = [b"sPLT", b"iTXt", b"tEXt", b"zTXt"] - for info_chunk in info.chunks: - cid, data = info_chunk[:2] - if cid in chunks: - chunks.remove(cid) - chunk(fp, cid, data) - elif cid in chunks_multiple_allowed: - chunk(fp, cid, data) - elif cid[1:2].islower(): - # Private chunk - after_idat = len(info_chunk) == 3 and info_chunk[2] - if not after_idat: - chunk(fp, cid, data) - - if im.mode == "P": - palette_byte_number = colors * 3 - palette_bytes = im.im.getpalette("RGB")[:palette_byte_number] - while len(palette_bytes) < palette_byte_number: - palette_bytes += b"\0" - chunk(fp, b"PLTE", palette_bytes) - - transparency = im.encoderinfo.get("transparency", im.info.get("transparency", None)) - - if transparency or transparency == 0: - if im.mode == "P": - # limit to actual palette size - alpha_bytes = colors - if isinstance(transparency, bytes): - chunk(fp, b"tRNS", transparency[:alpha_bytes]) - else: - transparency = max(0, min(255, transparency)) - alpha = b"\xff" * transparency + b"\0" - chunk(fp, b"tRNS", alpha[:alpha_bytes]) - elif im.mode in ("1", "L", "I", "I;16"): - transparency = max(0, min(65535, transparency)) - chunk(fp, b"tRNS", o16(transparency)) - elif im.mode == "RGB": - red, green, blue = transparency - chunk(fp, b"tRNS", o16(red) + o16(green) + o16(blue)) - else: - if "transparency" in im.encoderinfo: - # don't bother with transparency if it's an RGBA - # and it's in the info dict. It's probably just stale. - msg = "cannot use transparency for this mode" - raise OSError(msg) - else: - if im.mode == "P" and im.im.getpalettemode() == "RGBA": - alpha = im.im.getpalette("RGBA", "A") - alpha_bytes = colors - chunk(fp, b"tRNS", alpha[:alpha_bytes]) - - dpi = im.encoderinfo.get("dpi") - if dpi: - chunk( - fp, - b"pHYs", - o32(int(dpi[0] / 0.0254 + 0.5)), - o32(int(dpi[1] / 0.0254 + 0.5)), - b"\x01", - ) - - if info: - chunks = [b"bKGD", b"hIST"] - for info_chunk in info.chunks: - cid, data = info_chunk[:2] - if cid in chunks: - chunks.remove(cid) - chunk(fp, cid, data) - - exif = im.encoderinfo.get("exif") - if exif: - if isinstance(exif, Image.Exif): - exif = exif.tobytes(8) - if exif.startswith(b"Exif\x00\x00"): - exif = exif[6:] - chunk(fp, b"eXIf", exif) - - single_im: Image.Image | None = im - if save_all: - single_im = _write_multiple_frames( - im, fp, chunk, mode, rawmode, default_image, append_images - ) - if single_im: - ImageFile._save( - single_im, - cast(IO[bytes], _idat(fp, chunk)), - [ImageFile._Tile("zip", (0, 0) + single_im.size, 0, rawmode)], - ) - - if info: - for info_chunk in info.chunks: - cid, data = info_chunk[:2] - if cid[1:2].islower(): - # Private chunk - after_idat = len(info_chunk) == 3 and info_chunk[2] - if after_idat: - chunk(fp, cid, data) - - chunk(fp, b"IEND", b"") - - if hasattr(fp, "flush"): - fp.flush() - - -# -------------------------------------------------------------------- -# PNG chunk converter - - -def getchunks(im: Image.Image, **params: Any) -> list[tuple[bytes, bytes, bytes]]: - """Return a list of PNG chunks representing this image.""" - from io import BytesIO - - chunks = [] - - def append(fp: IO[bytes], cid: bytes, *data: bytes) -> None: - byte_data = b"".join(data) - crc = o32(_crc32(byte_data, _crc32(cid))) - chunks.append((cid, byte_data, crc)) - - fp = BytesIO() - - try: - im.encoderinfo = params - _save(im, fp, "", append) - finally: - del im.encoderinfo - - return chunks - - -# -------------------------------------------------------------------- -# Registry - -Image.register_open(PngImageFile.format, PngImageFile, _accept) -Image.register_save(PngImageFile.format, _save) -Image.register_save_all(PngImageFile.format, _save_all) - -Image.register_extensions(PngImageFile.format, [".png", ".apng"]) - -Image.register_mime(PngImageFile.format, "image/png") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PpmImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PpmImagePlugin.py deleted file mode 100644 index db34d10..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PpmImagePlugin.py +++ /dev/null @@ -1,375 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# PPM support for PIL -# -# History: -# 96-03-24 fl Created -# 98-03-06 fl Write RGBA images (as RGB, that is) -# -# Copyright (c) Secret Labs AB 1997-98. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import math -from typing import IO - -from . import Image, ImageFile -from ._binary import i16be as i16 -from ._binary import o8 -from ._binary import o32le as o32 - -# -# -------------------------------------------------------------------- - -b_whitespace = b"\x20\x09\x0a\x0b\x0c\x0d" - -MODES = { - # standard - b"P1": "1", - b"P2": "L", - b"P3": "RGB", - b"P4": "1", - b"P5": "L", - b"P6": "RGB", - # extensions - b"P0CMYK": "CMYK", - b"Pf": "F", - # PIL extensions (for test purposes only) - b"PyP": "P", - b"PyRGBA": "RGBA", - b"PyCMYK": "CMYK", -} - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"P") and prefix[1] in b"0123456fy" - - -## -# Image plugin for PBM, PGM, and PPM images. - - -class PpmImageFile(ImageFile.ImageFile): - format = "PPM" - format_description = "Pbmplus image" - - def _read_magic(self) -> bytes: - assert self.fp is not None - - magic = b"" - # read until whitespace or longest available magic number - for _ in range(6): - c = self.fp.read(1) - if not c or c in b_whitespace: - break - magic += c - return magic - - def _read_token(self) -> bytes: - assert self.fp is not None - - token = b"" - while len(token) <= 10: # read until next whitespace or limit of 10 characters - c = self.fp.read(1) - if not c: - break - elif c in b_whitespace: # token ended - if not token: - # skip whitespace at start - continue - break - elif c == b"#": - # ignores rest of the line; stops at CR, LF or EOF - while self.fp.read(1) not in b"\r\n": - pass - continue - token += c - if not token: - # Token was not even 1 byte - msg = "Reached EOF while reading header" - raise ValueError(msg) - elif len(token) > 10: - msg_too_long = b"Token too long in file header: %s" % token - raise ValueError(msg_too_long) - return token - - def _open(self) -> None: - assert self.fp is not None - - magic_number = self._read_magic() - try: - mode = MODES[magic_number] - except KeyError: - msg = "not a PPM file" - raise SyntaxError(msg) - self._mode = mode - - if magic_number in (b"P1", b"P4"): - self.custom_mimetype = "image/x-portable-bitmap" - elif magic_number in (b"P2", b"P5"): - self.custom_mimetype = "image/x-portable-graymap" - elif magic_number in (b"P3", b"P6"): - self.custom_mimetype = "image/x-portable-pixmap" - - self._size = int(self._read_token()), int(self._read_token()) - - decoder_name = "raw" - if magic_number in (b"P1", b"P2", b"P3"): - decoder_name = "ppm_plain" - - args: str | tuple[str | int, ...] - if mode == "1": - args = "1;I" - elif mode == "F": - scale = float(self._read_token()) - if scale == 0.0 or not math.isfinite(scale): - msg = "scale must be finite and non-zero" - raise ValueError(msg) - self.info["scale"] = abs(scale) - - rawmode = "F;32F" if scale < 0 else "F;32BF" - args = (rawmode, 0, -1) - else: - maxval = int(self._read_token()) - if not 0 < maxval < 65536: - msg = "maxval must be greater than 0 and less than 65536" - raise ValueError(msg) - if maxval > 255 and mode == "L": - self._mode = "I" - - rawmode = mode - if decoder_name != "ppm_plain": - # If maxval matches a bit depth, use the raw decoder directly - if maxval == 65535 and mode == "L": - rawmode = "I;16B" - elif maxval != 255: - decoder_name = "ppm" - - args = rawmode if decoder_name == "raw" else (rawmode, maxval) - self.tile = [ - ImageFile._Tile(decoder_name, (0, 0) + self.size, self.fp.tell(), args) - ] - - -# -# -------------------------------------------------------------------- - - -class PpmPlainDecoder(ImageFile.PyDecoder): - _pulls_fd = True - _comment_spans: bool - - def _read_block(self) -> bytes: - assert self.fd is not None - - return self.fd.read(ImageFile.SAFEBLOCK) - - def _find_comment_end(self, block: bytes, start: int = 0) -> int: - a = block.find(b"\n", start) - b = block.find(b"\r", start) - return min(a, b) if a * b > 0 else max(a, b) # lowest nonnegative index (or -1) - - def _ignore_comments(self, block: bytes) -> bytes: - if self._comment_spans: - # Finish current comment - while block: - comment_end = self._find_comment_end(block) - if comment_end != -1: - # Comment ends in this block - # Delete tail of comment - block = block[comment_end + 1 :] - break - else: - # Comment spans whole block - # So read the next block, looking for the end - block = self._read_block() - - # Search for any further comments - self._comment_spans = False - while True: - comment_start = block.find(b"#") - if comment_start == -1: - # No comment found - break - comment_end = self._find_comment_end(block, comment_start) - if comment_end != -1: - # Comment ends in this block - # Delete comment - block = block[:comment_start] + block[comment_end + 1 :] - else: - # Comment continues to next block(s) - block = block[:comment_start] - self._comment_spans = True - break - return block - - def _decode_bitonal(self) -> bytearray: - """ - This is a separate method because in the plain PBM format, all data tokens are - exactly one byte, so the inter-token whitespace is optional. - """ - data = bytearray() - total_bytes = self.state.xsize * self.state.ysize - - while len(data) != total_bytes: - block = self._read_block() # read next block - if not block: - # eof - break - - block = self._ignore_comments(block) - - tokens = b"".join(block.split()) - for token in tokens: - if token not in (48, 49): - msg = b"Invalid token for this mode: %s" % bytes([token]) - raise ValueError(msg) - data = (data + tokens)[:total_bytes] - invert = bytes.maketrans(b"01", b"\xff\x00") - return data.translate(invert) - - def _decode_blocks(self, maxval: int) -> bytearray: - data = bytearray() - max_len = 10 - out_byte_count = 4 if self.mode == "I" else 1 - out_max = 65535 if self.mode == "I" else 255 - bands = Image.getmodebands(self.mode) - total_bytes = self.state.xsize * self.state.ysize * bands * out_byte_count - - half_token = b"" - while len(data) != total_bytes: - block = self._read_block() # read next block - if not block: - if half_token: - block = bytearray(b" ") # flush half_token - else: - # eof - break - - block = self._ignore_comments(block) - - if half_token: - block = half_token + block # stitch half_token to new block - half_token = b"" - - tokens = block.split() - - if block and not block[-1:].isspace(): # block might split token - half_token = tokens.pop() # save half token for later - if len(half_token) > max_len: # prevent buildup of half_token - msg = ( - b"Token too long found in data: %s" % half_token[: max_len + 1] - ) - raise ValueError(msg) - - for token in tokens: - if len(token) > max_len: - msg = b"Token too long found in data: %s" % token[: max_len + 1] - raise ValueError(msg) - value = int(token) - if value < 0: - msg_str = f"Channel value is negative: {value}" - raise ValueError(msg_str) - if value > maxval: - msg_str = f"Channel value too large for this mode: {value}" - raise ValueError(msg_str) - value = round(value / maxval * out_max) - data += o32(value) if self.mode == "I" else o8(value) - if len(data) == total_bytes: # finished! - break - return data - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - self._comment_spans = False - if self.mode == "1": - data = self._decode_bitonal() - rawmode = "1;8" - else: - maxval = self.args[-1] - data = self._decode_blocks(maxval) - rawmode = "I;32" if self.mode == "I" else self.mode - self.set_as_raw(bytes(data), rawmode) - return -1, 0 - - -class PpmDecoder(ImageFile.PyDecoder): - _pulls_fd = True - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - - data = bytearray() - maxval = self.args[-1] - in_byte_count = 1 if maxval < 256 else 2 - out_byte_count = 4 if self.mode == "I" else 1 - out_max = 65535 if self.mode == "I" else 255 - bands = Image.getmodebands(self.mode) - dest_length = self.state.xsize * self.state.ysize * bands * out_byte_count - while len(data) < dest_length: - pixels = self.fd.read(in_byte_count * bands) - if len(pixels) < in_byte_count * bands: - # eof - break - for b in range(bands): - value = ( - pixels[b] if in_byte_count == 1 else i16(pixels, b * in_byte_count) - ) - value = min(out_max, round(value / maxval * out_max)) - data += o32(value) if self.mode == "I" else o8(value) - rawmode = "I;32" if self.mode == "I" else self.mode - self.set_as_raw(bytes(data), rawmode) - return -1, 0 - - -# -# -------------------------------------------------------------------- - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode == "1": - rawmode, head = "1;I", b"P4" - elif im.mode == "L": - rawmode, head = "L", b"P5" - elif im.mode in ("I", "I;16"): - rawmode, head = "I;16B", b"P5" - elif im.mode in ("RGB", "RGBA"): - rawmode, head = "RGB", b"P6" - elif im.mode == "F": - rawmode, head = "F;32F", b"Pf" - else: - msg = f"cannot write mode {im.mode} as PPM" - raise OSError(msg) - fp.write(head + b"\n%d %d\n" % im.size) - if head == b"P6": - fp.write(b"255\n") - elif head == b"P5": - if rawmode == "L": - fp.write(b"255\n") - else: - fp.write(b"65535\n") - elif head == b"Pf": - fp.write(b"-1.0\n") - row_order = -1 if im.mode == "F" else 1 - ImageFile._save( - im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, 0, row_order))] - ) - - -# -# -------------------------------------------------------------------- - - -Image.register_open(PpmImageFile.format, PpmImageFile, _accept) -Image.register_save(PpmImageFile.format, _save) - -Image.register_decoder("ppm", PpmDecoder) -Image.register_decoder("ppm_plain", PpmPlainDecoder) - -Image.register_extensions(PpmImageFile.format, [".pbm", ".pgm", ".ppm", ".pnm", ".pfm"]) - -Image.register_mime(PpmImageFile.format, "image/x-portable-anymap") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/PsdImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/PsdImagePlugin.py deleted file mode 100644 index f49aaee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/PsdImagePlugin.py +++ /dev/null @@ -1,333 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# Adobe PSD 2.5/3.0 file handling -# -# History: -# 1995-09-01 fl Created -# 1997-01-03 fl Read most PSD images -# 1997-01-18 fl Fixed P and CMYK support -# 2001-10-21 fl Added seek/tell support (for layers) -# -# Copyright (c) 1997-2001 by Secret Labs AB. -# Copyright (c) 1995-2001 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -from functools import cached_property -from typing import IO - -from . import Image, ImageFile, ImagePalette -from ._binary import i8 -from ._binary import i16be as i16 -from ._binary import i32be as i32 -from ._binary import si16be as si16 -from ._binary import si32be as si32 -from ._util import DeferredError - -MODES = { - # (photoshop mode, bits) -> (pil mode, required channels) - (0, 1): ("1", 1), - (0, 8): ("L", 1), - (1, 8): ("L", 1), - (2, 8): ("P", 1), - (3, 8): ("RGB", 3), - (4, 8): ("CMYK", 4), - (7, 8): ("L", 1), # FIXME: multilayer - (8, 8): ("L", 1), # duotone - (9, 8): ("LAB", 3), -} - - -# --------------------------------------------------------------------. -# read PSD images - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"8BPS") - - -## -# Image plugin for Photoshop images. - - -class PsdImageFile(ImageFile.ImageFile): - format = "PSD" - format_description = "Adobe Photoshop" - _close_exclusive_fp_after_loading = False - - def _open(self) -> None: - read = self.fp.read - - # - # header - - s = read(26) - if not _accept(s) or i16(s, 4) != 1: - msg = "not a PSD file" - raise SyntaxError(msg) - - psd_bits = i16(s, 22) - psd_channels = i16(s, 12) - psd_mode = i16(s, 24) - - mode, channels = MODES[(psd_mode, psd_bits)] - - if channels > psd_channels: - msg = "not enough channels" - raise OSError(msg) - if mode == "RGB" and psd_channels == 4: - mode = "RGBA" - channels = 4 - - self._mode = mode - self._size = i32(s, 18), i32(s, 14) - - # - # color mode data - - size = i32(read(4)) - if size: - data = read(size) - if mode == "P" and size == 768: - self.palette = ImagePalette.raw("RGB;L", data) - - # - # image resources - - self.resources = [] - - size = i32(read(4)) - if size: - # load resources - end = self.fp.tell() + size - while self.fp.tell() < end: - read(4) # signature - id = i16(read(2)) - name = read(i8(read(1))) - if not (len(name) & 1): - read(1) # padding - data = read(i32(read(4))) - if len(data) & 1: - read(1) # padding - self.resources.append((id, name, data)) - if id == 1039: # ICC profile - self.info["icc_profile"] = data - - # - # layer and mask information - - self._layers_position = None - - size = i32(read(4)) - if size: - end = self.fp.tell() + size - size = i32(read(4)) - if size: - self._layers_position = self.fp.tell() - self._layers_size = size - self.fp.seek(end) - self._n_frames: int | None = None - - # - # image descriptor - - self.tile = _maketile(self.fp, mode, (0, 0) + self.size, channels) - - # keep the file open - self._fp = self.fp - self.frame = 1 - self._min_frame = 1 - - @cached_property - def layers( - self, - ) -> list[tuple[str, str, tuple[int, int, int, int], list[ImageFile._Tile]]]: - layers = [] - if self._layers_position is not None: - if isinstance(self._fp, DeferredError): - raise self._fp.ex - self._fp.seek(self._layers_position) - _layer_data = io.BytesIO(ImageFile._safe_read(self._fp, self._layers_size)) - layers = _layerinfo(_layer_data, self._layers_size) - self._n_frames = len(layers) - return layers - - @property - def n_frames(self) -> int: - if self._n_frames is None: - self._n_frames = len(self.layers) - return self._n_frames - - @property - def is_animated(self) -> bool: - return len(self.layers) > 1 - - def seek(self, layer: int) -> None: - if not self._seek_check(layer): - return - if isinstance(self._fp, DeferredError): - raise self._fp.ex - - # seek to given layer (1..max) - _, mode, _, tile = self.layers[layer - 1] - self._mode = mode - self.tile = tile - self.frame = layer - self.fp = self._fp - - def tell(self) -> int: - # return layer number (0=image, 1..max=layers) - return self.frame - - -def _layerinfo( - fp: IO[bytes], ct_bytes: int -) -> list[tuple[str, str, tuple[int, int, int, int], list[ImageFile._Tile]]]: - # read layerinfo block - layers = [] - - def read(size: int) -> bytes: - return ImageFile._safe_read(fp, size) - - ct = si16(read(2)) - - # sanity check - if ct_bytes < (abs(ct) * 20): - msg = "Layer block too short for number of layers requested" - raise SyntaxError(msg) - - for _ in range(abs(ct)): - # bounding box - y0 = si32(read(4)) - x0 = si32(read(4)) - y1 = si32(read(4)) - x1 = si32(read(4)) - - # image info - bands = [] - ct_types = i16(read(2)) - if ct_types > 4: - fp.seek(ct_types * 6 + 12, io.SEEK_CUR) - size = i32(read(4)) - fp.seek(size, io.SEEK_CUR) - continue - - for _ in range(ct_types): - type = i16(read(2)) - - if type == 65535: - b = "A" - else: - b = "RGBA"[type] - - bands.append(b) - read(4) # size - - # figure out the image mode - bands.sort() - if bands == ["R"]: - mode = "L" - elif bands == ["B", "G", "R"]: - mode = "RGB" - elif bands == ["A", "B", "G", "R"]: - mode = "RGBA" - else: - mode = "" # unknown - - # skip over blend flags and extra information - read(12) # filler - name = "" - size = i32(read(4)) # length of the extra data field - if size: - data_end = fp.tell() + size - - length = i32(read(4)) - if length: - fp.seek(length - 16, io.SEEK_CUR) - - length = i32(read(4)) - if length: - fp.seek(length, io.SEEK_CUR) - - length = i8(read(1)) - if length: - # Don't know the proper encoding, - # Latin-1 should be a good guess - name = read(length).decode("latin-1", "replace") - - fp.seek(data_end) - layers.append((name, mode, (x0, y0, x1, y1))) - - # get tiles - layerinfo = [] - for i, (name, mode, bbox) in enumerate(layers): - tile = [] - for m in mode: - t = _maketile(fp, m, bbox, 1) - if t: - tile.extend(t) - layerinfo.append((name, mode, bbox, tile)) - - return layerinfo - - -def _maketile( - file: IO[bytes], mode: str, bbox: tuple[int, int, int, int], channels: int -) -> list[ImageFile._Tile]: - tiles = [] - read = file.read - - compression = i16(read(2)) - - xsize = bbox[2] - bbox[0] - ysize = bbox[3] - bbox[1] - - offset = file.tell() - - if compression == 0: - # - # raw compression - for channel in range(channels): - layer = mode[channel] - if mode == "CMYK": - layer += ";I" - tiles.append(ImageFile._Tile("raw", bbox, offset, layer)) - offset = offset + xsize * ysize - - elif compression == 1: - # - # packbits compression - i = 0 - bytecount = read(channels * ysize * 2) - offset = file.tell() - for channel in range(channels): - layer = mode[channel] - if mode == "CMYK": - layer += ";I" - tiles.append(ImageFile._Tile("packbits", bbox, offset, layer)) - for y in range(ysize): - offset = offset + i16(bytecount, i) - i += 2 - - file.seek(offset) - - if offset & 1: - read(1) # padding - - return tiles - - -# -------------------------------------------------------------------- -# registry - - -Image.register_open(PsdImageFile.format, PsdImageFile, _accept) - -Image.register_extension(PsdImageFile.format, ".psd") - -Image.register_mime(PsdImageFile.format, "image/vnd.adobe.photoshop") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/QoiImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/QoiImagePlugin.py deleted file mode 100644 index dba5d80..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/QoiImagePlugin.py +++ /dev/null @@ -1,234 +0,0 @@ -# -# The Python Imaging Library. -# -# QOI support for PIL -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -from typing import IO - -from . import Image, ImageFile -from ._binary import i32be as i32 -from ._binary import o8 -from ._binary import o32be as o32 - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"qoif") - - -class QoiImageFile(ImageFile.ImageFile): - format = "QOI" - format_description = "Quite OK Image" - - def _open(self) -> None: - if not _accept(self.fp.read(4)): - msg = "not a QOI file" - raise SyntaxError(msg) - - self._size = i32(self.fp.read(4)), i32(self.fp.read(4)) - - channels = self.fp.read(1)[0] - self._mode = "RGB" if channels == 3 else "RGBA" - - self.fp.seek(1, os.SEEK_CUR) # colorspace - self.tile = [ImageFile._Tile("qoi", (0, 0) + self._size, self.fp.tell())] - - -class QoiDecoder(ImageFile.PyDecoder): - _pulls_fd = True - _previous_pixel: bytes | bytearray | None = None - _previously_seen_pixels: dict[int, bytes | bytearray] = {} - - def _add_to_previous_pixels(self, value: bytes | bytearray) -> None: - self._previous_pixel = value - - r, g, b, a = value - hash_value = (r * 3 + g * 5 + b * 7 + a * 11) % 64 - self._previously_seen_pixels[hash_value] = value - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - - self._previously_seen_pixels = {} - self._previous_pixel = bytearray((0, 0, 0, 255)) - - data = bytearray() - bands = Image.getmodebands(self.mode) - dest_length = self.state.xsize * self.state.ysize * bands - while len(data) < dest_length: - byte = self.fd.read(1)[0] - value: bytes | bytearray - if byte == 0b11111110 and self._previous_pixel: # QOI_OP_RGB - value = bytearray(self.fd.read(3)) + self._previous_pixel[3:] - elif byte == 0b11111111: # QOI_OP_RGBA - value = self.fd.read(4) - else: - op = byte >> 6 - if op == 0: # QOI_OP_INDEX - op_index = byte & 0b00111111 - value = self._previously_seen_pixels.get( - op_index, bytearray((0, 0, 0, 0)) - ) - elif op == 1 and self._previous_pixel: # QOI_OP_DIFF - value = bytearray( - ( - (self._previous_pixel[0] + ((byte & 0b00110000) >> 4) - 2) - % 256, - (self._previous_pixel[1] + ((byte & 0b00001100) >> 2) - 2) - % 256, - (self._previous_pixel[2] + (byte & 0b00000011) - 2) % 256, - self._previous_pixel[3], - ) - ) - elif op == 2 and self._previous_pixel: # QOI_OP_LUMA - second_byte = self.fd.read(1)[0] - diff_green = (byte & 0b00111111) - 32 - diff_red = ((second_byte & 0b11110000) >> 4) - 8 - diff_blue = (second_byte & 0b00001111) - 8 - - value = bytearray( - tuple( - (self._previous_pixel[i] + diff_green + diff) % 256 - for i, diff in enumerate((diff_red, 0, diff_blue)) - ) - ) - value += self._previous_pixel[3:] - elif op == 3 and self._previous_pixel: # QOI_OP_RUN - run_length = (byte & 0b00111111) + 1 - value = self._previous_pixel - if bands == 3: - value = value[:3] - data += value * run_length - continue - self._add_to_previous_pixels(value) - - if bands == 3: - value = value[:3] - data += value - self.set_as_raw(data) - return -1, 0 - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode == "RGB": - channels = 3 - elif im.mode == "RGBA": - channels = 4 - else: - msg = "Unsupported QOI image mode" - raise ValueError(msg) - - colorspace = 0 if im.encoderinfo.get("colorspace") == "sRGB" else 1 - - fp.write(b"qoif") - fp.write(o32(im.size[0])) - fp.write(o32(im.size[1])) - fp.write(o8(channels)) - fp.write(o8(colorspace)) - - ImageFile._save(im, fp, [ImageFile._Tile("qoi", (0, 0) + im.size)]) - - -class QoiEncoder(ImageFile.PyEncoder): - _pushes_fd = True - _previous_pixel: tuple[int, int, int, int] | None = None - _previously_seen_pixels: dict[int, tuple[int, int, int, int]] = {} - _run = 0 - - def _write_run(self) -> bytes: - data = o8(0b11000000 | (self._run - 1)) # QOI_OP_RUN - self._run = 0 - return data - - def _delta(self, left: int, right: int) -> int: - result = (left - right) & 255 - if result >= 128: - result -= 256 - return result - - def encode(self, bufsize: int) -> tuple[int, int, bytes]: - assert self.im is not None - - self._previously_seen_pixels = {0: (0, 0, 0, 0)} - self._previous_pixel = (0, 0, 0, 255) - - data = bytearray() - w, h = self.im.size - bands = Image.getmodebands(self.mode) - - for y in range(h): - for x in range(w): - pixel = self.im.getpixel((x, y)) - if bands == 3: - pixel = (*pixel, 255) - - if pixel == self._previous_pixel: - self._run += 1 - if self._run == 62: - data += self._write_run() - else: - if self._run: - data += self._write_run() - - r, g, b, a = pixel - hash_value = (r * 3 + g * 5 + b * 7 + a * 11) % 64 - if self._previously_seen_pixels.get(hash_value) == pixel: - data += o8(hash_value) # QOI_OP_INDEX - elif self._previous_pixel: - self._previously_seen_pixels[hash_value] = pixel - - prev_r, prev_g, prev_b, prev_a = self._previous_pixel - if prev_a == a: - delta_r = self._delta(r, prev_r) - delta_g = self._delta(g, prev_g) - delta_b = self._delta(b, prev_b) - - if ( - -2 <= delta_r < 2 - and -2 <= delta_g < 2 - and -2 <= delta_b < 2 - ): - data += o8( - 0b01000000 - | (delta_r + 2) << 4 - | (delta_g + 2) << 2 - | (delta_b + 2) - ) # QOI_OP_DIFF - else: - delta_gr = self._delta(delta_r, delta_g) - delta_gb = self._delta(delta_b, delta_g) - if ( - -8 <= delta_gr < 8 - and -32 <= delta_g < 32 - and -8 <= delta_gb < 8 - ): - data += o8( - 0b10000000 | (delta_g + 32) - ) # QOI_OP_LUMA - data += o8((delta_gr + 8) << 4 | (delta_gb + 8)) - else: - data += o8(0b11111110) # QOI_OP_RGB - data += bytes(pixel[:3]) - else: - data += o8(0b11111111) # QOI_OP_RGBA - data += bytes(pixel) - - self._previous_pixel = pixel - - if self._run: - data += self._write_run() - data += bytes((0, 0, 0, 0, 0, 0, 0, 1)) # padding - - return len(data), 0, data - - -Image.register_open(QoiImageFile.format, QoiImageFile, _accept) -Image.register_decoder("qoi", QoiDecoder) -Image.register_extension(QoiImageFile.format, ".qoi") - -Image.register_save(QoiImageFile.format, _save) -Image.register_encoder("qoi", QoiEncoder) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/SgiImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/SgiImagePlugin.py deleted file mode 100644 index 8530221..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/SgiImagePlugin.py +++ /dev/null @@ -1,231 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# SGI image file handling -# -# See "The SGI Image File Format (Draft version 0.97)", Paul Haeberli. -# -# -# -# History: -# 2017-22-07 mb Add RLE decompression -# 2016-16-10 mb Add save method without compression -# 1995-09-10 fl Created -# -# Copyright (c) 2016 by Mickael Bonfill. -# Copyright (c) 2008 by Karsten Hiddemann. -# Copyright (c) 1997 by Secret Labs AB. -# Copyright (c) 1995 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import os -import struct -from typing import IO - -from . import Image, ImageFile -from ._binary import i16be as i16 -from ._binary import o8 - - -def _accept(prefix: bytes) -> bool: - return len(prefix) >= 2 and i16(prefix) == 474 - - -MODES = { - (1, 1, 1): "L", - (1, 2, 1): "L", - (2, 1, 1): "L;16B", - (2, 2, 1): "L;16B", - (1, 3, 3): "RGB", - (2, 3, 3): "RGB;16B", - (1, 3, 4): "RGBA", - (2, 3, 4): "RGBA;16B", -} - - -## -# Image plugin for SGI images. -class SgiImageFile(ImageFile.ImageFile): - format = "SGI" - format_description = "SGI Image File Format" - - def _open(self) -> None: - # HEAD - assert self.fp is not None - - headlen = 512 - s = self.fp.read(headlen) - - if not _accept(s): - msg = "Not an SGI image file" - raise ValueError(msg) - - # compression : verbatim or RLE - compression = s[2] - - # bpc : 1 or 2 bytes (8bits or 16bits) - bpc = s[3] - - # dimension : 1, 2 or 3 (depending on xsize, ysize and zsize) - dimension = i16(s, 4) - - # xsize : width - xsize = i16(s, 6) - - # ysize : height - ysize = i16(s, 8) - - # zsize : channels count - zsize = i16(s, 10) - - # determine mode from bits/zsize - try: - rawmode = MODES[(bpc, dimension, zsize)] - except KeyError: - msg = "Unsupported SGI image mode" - raise ValueError(msg) - - self._size = xsize, ysize - self._mode = rawmode.split(";")[0] - if self.mode == "RGB": - self.custom_mimetype = "image/rgb" - - # orientation -1 : scanlines begins at the bottom-left corner - orientation = -1 - - # decoder info - if compression == 0: - pagesize = xsize * ysize * bpc - if bpc == 2: - self.tile = [ - ImageFile._Tile( - "SGI16", - (0, 0) + self.size, - headlen, - (self.mode, 0, orientation), - ) - ] - else: - self.tile = [] - offset = headlen - for layer in self.mode: - self.tile.append( - ImageFile._Tile( - "raw", (0, 0) + self.size, offset, (layer, 0, orientation) - ) - ) - offset += pagesize - elif compression == 1: - self.tile = [ - ImageFile._Tile( - "sgi_rle", (0, 0) + self.size, headlen, (rawmode, orientation, bpc) - ) - ] - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode not in {"RGB", "RGBA", "L"}: - msg = "Unsupported SGI image mode" - raise ValueError(msg) - - # Get the keyword arguments - info = im.encoderinfo - - # Byte-per-pixel precision, 1 = 8bits per pixel - bpc = info.get("bpc", 1) - - if bpc not in (1, 2): - msg = "Unsupported number of bytes per pixel" - raise ValueError(msg) - - # Flip the image, since the origin of SGI file is the bottom-left corner - orientation = -1 - # Define the file as SGI File Format - magic_number = 474 - # Run-Length Encoding Compression - Unsupported at this time - rle = 0 - - # X Dimension = width / Y Dimension = height - x, y = im.size - # Z Dimension: Number of channels - z = len(im.mode) - # Number of dimensions (x,y,z) - if im.mode == "L": - dimension = 1 if y == 1 else 2 - else: - dimension = 3 - - # Minimum Byte value - pinmin = 0 - # Maximum Byte value (255 = 8bits per pixel) - pinmax = 255 - # Image name (79 characters max, truncated below in write) - img_name = os.path.splitext(os.path.basename(filename))[0] - if isinstance(img_name, str): - img_name = img_name.encode("ascii", "ignore") - # Standard representation of pixel in the file - colormap = 0 - fp.write(struct.pack(">h", magic_number)) - fp.write(o8(rle)) - fp.write(o8(bpc)) - fp.write(struct.pack(">H", dimension)) - fp.write(struct.pack(">H", x)) - fp.write(struct.pack(">H", y)) - fp.write(struct.pack(">H", z)) - fp.write(struct.pack(">l", pinmin)) - fp.write(struct.pack(">l", pinmax)) - fp.write(struct.pack("4s", b"")) # dummy - fp.write(struct.pack("79s", img_name)) # truncates to 79 chars - fp.write(struct.pack("s", b"")) # force null byte after img_name - fp.write(struct.pack(">l", colormap)) - fp.write(struct.pack("404s", b"")) # dummy - - rawmode = "L" - if bpc == 2: - rawmode = "L;16B" - - for channel in im.split(): - fp.write(channel.tobytes("raw", rawmode, 0, orientation)) - - if hasattr(fp, "flush"): - fp.flush() - - -class SGI16Decoder(ImageFile.PyDecoder): - _pulls_fd = True - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - assert self.im is not None - - rawmode, stride, orientation = self.args - pagesize = self.state.xsize * self.state.ysize - zsize = len(self.mode) - self.fd.seek(512) - - for band in range(zsize): - channel = Image.new("L", (self.state.xsize, self.state.ysize)) - channel.frombytes( - self.fd.read(2 * pagesize), "raw", "L;16B", stride, orientation - ) - self.im.putband(channel.im, band) - - return -1, 0 - - -# -# registry - - -Image.register_decoder("SGI16", SGI16Decoder) -Image.register_open(SgiImageFile.format, SgiImageFile, _accept) -Image.register_save(SgiImageFile.format, _save) -Image.register_mime(SgiImageFile.format, "image/sgi") - -Image.register_extensions(SgiImageFile.format, [".bw", ".rgb", ".rgba", ".sgi"]) - -# End of file diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/SpiderImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/SpiderImagePlugin.py deleted file mode 100644 index 868019e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/SpiderImagePlugin.py +++ /dev/null @@ -1,331 +0,0 @@ -# -# The Python Imaging Library. -# -# SPIDER image file handling -# -# History: -# 2004-08-02 Created BB -# 2006-03-02 added save method -# 2006-03-13 added support for stack images -# -# Copyright (c) 2004 by Health Research Inc. (HRI) RENSSELAER, NY 12144. -# Copyright (c) 2004 by William Baxter. -# Copyright (c) 2004 by Secret Labs AB. -# Copyright (c) 2004 by Fredrik Lundh. -# - -## -# Image plugin for the Spider image format. This format is used -# by the SPIDER software, in processing image data from electron -# microscopy and tomography. -## - -# -# SpiderImagePlugin.py -# -# The Spider image format is used by SPIDER software, in processing -# image data from electron microscopy and tomography. -# -# Spider home page: -# https://spider.wadsworth.org/spider_doc/spider/docs/spider.html -# -# Details about the Spider image format: -# https://spider.wadsworth.org/spider_doc/spider/docs/image_doc.html -# -from __future__ import annotations - -import os -import struct -import sys -from typing import IO, Any, cast - -from . import Image, ImageFile -from ._util import DeferredError - -TYPE_CHECKING = False - - -def isInt(f: Any) -> int: - try: - i = int(f) - if f - i == 0: - return 1 - else: - return 0 - except (ValueError, OverflowError): - return 0 - - -iforms = [1, 3, -11, -12, -21, -22] - - -# There is no magic number to identify Spider files, so just check a -# series of header locations to see if they have reasonable values. -# Returns no. of bytes in the header, if it is a valid Spider header, -# otherwise returns 0 - - -def isSpiderHeader(t: tuple[float, ...]) -> int: - h = (99,) + t # add 1 value so can use spider header index start=1 - # header values 1,2,5,12,13,22,23 should be integers - for i in [1, 2, 5, 12, 13, 22, 23]: - if not isInt(h[i]): - return 0 - # check iform - iform = int(h[5]) - if iform not in iforms: - return 0 - # check other header values - labrec = int(h[13]) # no. records in file header - labbyt = int(h[22]) # total no. of bytes in header - lenbyt = int(h[23]) # record length in bytes - if labbyt != (labrec * lenbyt): - return 0 - # looks like a valid header - return labbyt - - -def isSpiderImage(filename: str) -> int: - with open(filename, "rb") as fp: - f = fp.read(92) # read 23 * 4 bytes - t = struct.unpack(">23f", f) # try big-endian first - hdrlen = isSpiderHeader(t) - if hdrlen == 0: - t = struct.unpack("<23f", f) # little-endian - hdrlen = isSpiderHeader(t) - return hdrlen - - -class SpiderImageFile(ImageFile.ImageFile): - format = "SPIDER" - format_description = "Spider 2D image" - _close_exclusive_fp_after_loading = False - - def _open(self) -> None: - # check header - n = 27 * 4 # read 27 float values - f = self.fp.read(n) - - try: - self.bigendian = 1 - t = struct.unpack(">27f", f) # try big-endian first - hdrlen = isSpiderHeader(t) - if hdrlen == 0: - self.bigendian = 0 - t = struct.unpack("<27f", f) # little-endian - hdrlen = isSpiderHeader(t) - if hdrlen == 0: - msg = "not a valid Spider file" - raise SyntaxError(msg) - except struct.error as e: - msg = "not a valid Spider file" - raise SyntaxError(msg) from e - - h = (99,) + t # add 1 value : spider header index starts at 1 - iform = int(h[5]) - if iform != 1: - msg = "not a Spider 2D image" - raise SyntaxError(msg) - - self._size = int(h[12]), int(h[2]) # size in pixels (width, height) - self.istack = int(h[24]) - self.imgnumber = int(h[27]) - - if self.istack == 0 and self.imgnumber == 0: - # stk=0, img=0: a regular 2D image - offset = hdrlen - self._nimages = 1 - elif self.istack > 0 and self.imgnumber == 0: - # stk>0, img=0: Opening the stack for the first time - self.imgbytes = int(h[12]) * int(h[2]) * 4 - self.hdrlen = hdrlen - self._nimages = int(h[26]) - # Point to the first image in the stack - offset = hdrlen * 2 - self.imgnumber = 1 - elif self.istack == 0 and self.imgnumber > 0: - # stk=0, img>0: an image within the stack - offset = hdrlen + self.stkoffset - self.istack = 2 # So Image knows it's still a stack - else: - msg = "inconsistent stack header values" - raise SyntaxError(msg) - - if self.bigendian: - self.rawmode = "F;32BF" - else: - self.rawmode = "F;32F" - self._mode = "F" - - self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, offset, self.rawmode)] - self._fp = self.fp # FIXME: hack - - @property - def n_frames(self) -> int: - return self._nimages - - @property - def is_animated(self) -> bool: - return self._nimages > 1 - - # 1st image index is zero (although SPIDER imgnumber starts at 1) - def tell(self) -> int: - if self.imgnumber < 1: - return 0 - else: - return self.imgnumber - 1 - - def seek(self, frame: int) -> None: - if self.istack == 0: - msg = "attempt to seek in a non-stack file" - raise EOFError(msg) - if not self._seek_check(frame): - return - if isinstance(self._fp, DeferredError): - raise self._fp.ex - self.stkoffset = self.hdrlen + frame * (self.hdrlen + self.imgbytes) - self.fp = self._fp - self.fp.seek(self.stkoffset) - self._open() - - # returns a byte image after rescaling to 0..255 - def convert2byte(self, depth: int = 255) -> Image.Image: - extrema = self.getextrema() - assert isinstance(extrema[0], float) - minimum, maximum = cast(tuple[float, float], extrema) - m: float = 1 - if maximum != minimum: - m = depth / (maximum - minimum) - b = -m * minimum - return self.point(lambda i: i * m + b).convert("L") - - if TYPE_CHECKING: - from . import ImageTk - - # returns a ImageTk.PhotoImage object, after rescaling to 0..255 - def tkPhotoImage(self) -> ImageTk.PhotoImage: - from . import ImageTk - - return ImageTk.PhotoImage(self.convert2byte(), palette=256) - - -# -------------------------------------------------------------------- -# Image series - - -# given a list of filenames, return a list of images -def loadImageSeries(filelist: list[str] | None = None) -> list[Image.Image] | None: - """create a list of :py:class:`~PIL.Image.Image` objects for use in a montage""" - if filelist is None or len(filelist) < 1: - return None - - byte_imgs = [] - for img in filelist: - if not os.path.exists(img): - print(f"unable to find {img}") - continue - try: - with Image.open(img) as im: - assert isinstance(im, SpiderImageFile) - byte_im = im.convert2byte() - except Exception: - if not isSpiderImage(img): - print(f"{img} is not a Spider image file") - continue - byte_im.info["filename"] = img - byte_imgs.append(byte_im) - return byte_imgs - - -# -------------------------------------------------------------------- -# For saving images in Spider format - - -def makeSpiderHeader(im: Image.Image) -> list[bytes]: - nsam, nrow = im.size - lenbyt = nsam * 4 # There are labrec records in the header - labrec = int(1024 / lenbyt) - if 1024 % lenbyt != 0: - labrec += 1 - labbyt = labrec * lenbyt - nvalues = int(labbyt / 4) - if nvalues < 23: - return [] - - hdr = [0.0] * nvalues - - # NB these are Fortran indices - hdr[1] = 1.0 # nslice (=1 for an image) - hdr[2] = float(nrow) # number of rows per slice - hdr[3] = float(nrow) # number of records in the image - hdr[5] = 1.0 # iform for 2D image - hdr[12] = float(nsam) # number of pixels per line - hdr[13] = float(labrec) # number of records in file header - hdr[22] = float(labbyt) # total number of bytes in header - hdr[23] = float(lenbyt) # record length in bytes - - # adjust for Fortran indexing - hdr = hdr[1:] - hdr.append(0.0) - # pack binary data into a string - return [struct.pack("f", v) for v in hdr] - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode != "F": - im = im.convert("F") - - hdr = makeSpiderHeader(im) - if len(hdr) < 256: - msg = "Error creating Spider header" - raise OSError(msg) - - # write the SPIDER header - fp.writelines(hdr) - - rawmode = "F;32NF" # 32-bit native floating point - ImageFile._save(im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, rawmode)]) - - -def _save_spider(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - # get the filename extension and register it with Image - filename_ext = os.path.splitext(filename)[1] - ext = filename_ext.decode() if isinstance(filename_ext, bytes) else filename_ext - Image.register_extension(SpiderImageFile.format, ext) - _save(im, fp, filename) - - -# -------------------------------------------------------------------- - - -Image.register_open(SpiderImageFile.format, SpiderImageFile) -Image.register_save(SpiderImageFile.format, _save_spider) - -if __name__ == "__main__": - if len(sys.argv) < 2: - print("Syntax: python3 SpiderImagePlugin.py [infile] [outfile]") - sys.exit() - - filename = sys.argv[1] - if not isSpiderImage(filename): - print("input image must be in Spider format") - sys.exit() - - with Image.open(filename) as im: - print(f"image: {im}") - print(f"format: {im.format}") - print(f"size: {im.size}") - print(f"mode: {im.mode}") - print("max, min: ", end=" ") - print(im.getextrema()) - - if len(sys.argv) > 2: - outfile = sys.argv[2] - - # perform some image operation - im = im.transpose(Image.Transpose.FLIP_LEFT_RIGHT) - print( - f"saving a flipped version of {os.path.basename(filename)} " - f"as {outfile} " - ) - im.save(outfile, SpiderImageFile.format) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/SunImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/SunImagePlugin.py deleted file mode 100644 index 8912379..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/SunImagePlugin.py +++ /dev/null @@ -1,145 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# Sun image file handling -# -# History: -# 1995-09-10 fl Created -# 1996-05-28 fl Fixed 32-bit alignment -# 1998-12-29 fl Import ImagePalette module -# 2001-12-18 fl Fixed palette loading (from Jean-Claude Rimbault) -# -# Copyright (c) 1997-2001 by Secret Labs AB -# Copyright (c) 1995-1996 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -from . import Image, ImageFile, ImagePalette -from ._binary import i32be as i32 - - -def _accept(prefix: bytes) -> bool: - return len(prefix) >= 4 and i32(prefix) == 0x59A66A95 - - -## -# Image plugin for Sun raster files. - - -class SunImageFile(ImageFile.ImageFile): - format = "SUN" - format_description = "Sun Raster File" - - def _open(self) -> None: - # The Sun Raster file header is 32 bytes in length - # and has the following format: - - # typedef struct _SunRaster - # { - # DWORD MagicNumber; /* Magic (identification) number */ - # DWORD Width; /* Width of image in pixels */ - # DWORD Height; /* Height of image in pixels */ - # DWORD Depth; /* Number of bits per pixel */ - # DWORD Length; /* Size of image data in bytes */ - # DWORD Type; /* Type of raster file */ - # DWORD ColorMapType; /* Type of color map */ - # DWORD ColorMapLength; /* Size of the color map in bytes */ - # } SUNRASTER; - - assert self.fp is not None - - # HEAD - s = self.fp.read(32) - if not _accept(s): - msg = "not an SUN raster file" - raise SyntaxError(msg) - - offset = 32 - - self._size = i32(s, 4), i32(s, 8) - - depth = i32(s, 12) - # data_length = i32(s, 16) # unreliable, ignore. - file_type = i32(s, 20) - palette_type = i32(s, 24) # 0: None, 1: RGB, 2: Raw/arbitrary - palette_length = i32(s, 28) - - if depth == 1: - self._mode, rawmode = "1", "1;I" - elif depth == 4: - self._mode, rawmode = "L", "L;4" - elif depth == 8: - self._mode = rawmode = "L" - elif depth == 24: - if file_type == 3: - self._mode, rawmode = "RGB", "RGB" - else: - self._mode, rawmode = "RGB", "BGR" - elif depth == 32: - if file_type == 3: - self._mode, rawmode = "RGB", "RGBX" - else: - self._mode, rawmode = "RGB", "BGRX" - else: - msg = "Unsupported Mode/Bit Depth" - raise SyntaxError(msg) - - if palette_length: - if palette_length > 1024: - msg = "Unsupported Color Palette Length" - raise SyntaxError(msg) - - if palette_type != 1: - msg = "Unsupported Palette Type" - raise SyntaxError(msg) - - offset = offset + palette_length - self.palette = ImagePalette.raw("RGB;L", self.fp.read(palette_length)) - if self.mode == "L": - self._mode = "P" - rawmode = rawmode.replace("L", "P") - - # 16 bit boundaries on stride - stride = ((self.size[0] * depth + 15) // 16) * 2 - - # file type: Type is the version (or flavor) of the bitmap - # file. The following values are typically found in the Type - # field: - # 0000h Old - # 0001h Standard - # 0002h Byte-encoded - # 0003h RGB format - # 0004h TIFF format - # 0005h IFF format - # FFFFh Experimental - - # Old and standard are the same, except for the length tag. - # byte-encoded is run-length-encoded - # RGB looks similar to standard, but RGB byte order - # TIFF and IFF mean that they were converted from T/IFF - # Experimental means that it's something else. - # (https://www.fileformat.info/format/sunraster/egff.htm) - - if file_type in (0, 1, 3, 4, 5): - self.tile = [ - ImageFile._Tile("raw", (0, 0) + self.size, offset, (rawmode, stride)) - ] - elif file_type == 2: - self.tile = [ - ImageFile._Tile("sun_rle", (0, 0) + self.size, offset, rawmode) - ] - else: - msg = "Unsupported Sun Raster file type" - raise SyntaxError(msg) - - -# -# registry - - -Image.register_open(SunImageFile.format, SunImageFile, _accept) - -Image.register_extension(SunImageFile.format, ".ras") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/TarIO.py b/write-message/venv/lib/python3.10/site-packages/PIL/TarIO.py deleted file mode 100644 index 86490a4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/TarIO.py +++ /dev/null @@ -1,61 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# read files from within a tar file -# -# History: -# 95-06-18 fl Created -# 96-05-28 fl Open files in binary mode -# -# Copyright (c) Secret Labs AB 1997. -# Copyright (c) Fredrik Lundh 1995-96. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io - -from . import ContainerIO - - -class TarIO(ContainerIO.ContainerIO[bytes]): - """A file object that provides read access to a given member of a TAR file.""" - - def __init__(self, tarfile: str, file: str) -> None: - """ - Create file object. - - :param tarfile: Name of TAR file. - :param file: Name of member file. - """ - self.fh = open(tarfile, "rb") - - while True: - s = self.fh.read(512) - if len(s) != 512: - self.fh.close() - - msg = "unexpected end of tar file" - raise OSError(msg) - - name = s[:100].decode("utf-8") - i = name.find("\0") - if i == 0: - self.fh.close() - - msg = "cannot find subfile" - raise OSError(msg) - if i > 0: - name = name[:i] - - size = int(s[124:135], 8) - - if file == name: - break - - self.fh.seek((size + 511) & (~511), io.SEEK_CUR) - - # Open region - super().__init__(self.fh, self.fh.tell(), size) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/TgaImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/TgaImagePlugin.py deleted file mode 100644 index 90d5b5c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/TgaImagePlugin.py +++ /dev/null @@ -1,264 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# TGA file handling -# -# History: -# 95-09-01 fl created (reads 24-bit files only) -# 97-01-04 fl support more TGA versions, including compressed images -# 98-07-04 fl fixed orientation and alpha layer bugs -# 98-09-11 fl fixed orientation for runlength decoder -# -# Copyright (c) Secret Labs AB 1997-98. -# Copyright (c) Fredrik Lundh 1995-97. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import warnings -from typing import IO - -from . import Image, ImageFile, ImagePalette -from ._binary import i16le as i16 -from ._binary import o8 -from ._binary import o16le as o16 - -# -# -------------------------------------------------------------------- -# Read RGA file - - -MODES = { - # map imagetype/depth to rawmode - (1, 8): "P", - (3, 1): "1", - (3, 8): "L", - (3, 16): "LA", - (2, 16): "BGRA;15Z", - (2, 24): "BGR", - (2, 32): "BGRA", -} - - -## -# Image plugin for Targa files. - - -class TgaImageFile(ImageFile.ImageFile): - format = "TGA" - format_description = "Targa" - - def _open(self) -> None: - # process header - assert self.fp is not None - - s = self.fp.read(18) - - id_len = s[0] - - colormaptype = s[1] - imagetype = s[2] - - depth = s[16] - - flags = s[17] - - self._size = i16(s, 12), i16(s, 14) - - # validate header fields - if ( - colormaptype not in (0, 1) - or self.size[0] <= 0 - or self.size[1] <= 0 - or depth not in (1, 8, 16, 24, 32) - ): - msg = "not a TGA file" - raise SyntaxError(msg) - - # image mode - if imagetype in (3, 11): - self._mode = "L" - if depth == 1: - self._mode = "1" # ??? - elif depth == 16: - self._mode = "LA" - elif imagetype in (1, 9): - self._mode = "P" if colormaptype else "L" - elif imagetype in (2, 10): - self._mode = "RGB" if depth == 24 else "RGBA" - else: - msg = "unknown TGA mode" - raise SyntaxError(msg) - - # orientation - orientation = flags & 0x30 - self._flip_horizontally = orientation in [0x10, 0x30] - if orientation in [0x20, 0x30]: - orientation = 1 - elif orientation in [0, 0x10]: - orientation = -1 - else: - msg = "unknown TGA orientation" - raise SyntaxError(msg) - - self.info["orientation"] = orientation - - if imagetype & 8: - self.info["compression"] = "tga_rle" - - if id_len: - self.info["id_section"] = self.fp.read(id_len) - - if colormaptype: - # read palette - start, size, mapdepth = i16(s, 3), i16(s, 5), s[7] - if mapdepth == 16: - self.palette = ImagePalette.raw( - "BGRA;15Z", bytes(2 * start) + self.fp.read(2 * size) - ) - self.palette.mode = "RGBA" - elif mapdepth == 24: - self.palette = ImagePalette.raw( - "BGR", bytes(3 * start) + self.fp.read(3 * size) - ) - elif mapdepth == 32: - self.palette = ImagePalette.raw( - "BGRA", bytes(4 * start) + self.fp.read(4 * size) - ) - else: - msg = "unknown TGA map depth" - raise SyntaxError(msg) - - # setup tile descriptor - try: - rawmode = MODES[(imagetype & 7, depth)] - if imagetype & 8: - # compressed - self.tile = [ - ImageFile._Tile( - "tga_rle", - (0, 0) + self.size, - self.fp.tell(), - (rawmode, orientation, depth), - ) - ] - else: - self.tile = [ - ImageFile._Tile( - "raw", - (0, 0) + self.size, - self.fp.tell(), - (rawmode, 0, orientation), - ) - ] - except KeyError: - pass # cannot decode - - def load_end(self) -> None: - if self._flip_horizontally: - self.im = self.im.transpose(Image.Transpose.FLIP_LEFT_RIGHT) - - -# -# -------------------------------------------------------------------- -# Write TGA file - - -SAVE = { - "1": ("1", 1, 0, 3), - "L": ("L", 8, 0, 3), - "LA": ("LA", 16, 0, 3), - "P": ("P", 8, 1, 1), - "RGB": ("BGR", 24, 0, 2), - "RGBA": ("BGRA", 32, 0, 2), -} - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - try: - rawmode, bits, colormaptype, imagetype = SAVE[im.mode] - except KeyError as e: - msg = f"cannot write mode {im.mode} as TGA" - raise OSError(msg) from e - - if "rle" in im.encoderinfo: - rle = im.encoderinfo["rle"] - else: - compression = im.encoderinfo.get("compression", im.info.get("compression")) - rle = compression == "tga_rle" - if rle: - imagetype += 8 - - id_section = im.encoderinfo.get("id_section", im.info.get("id_section", "")) - id_len = len(id_section) - if id_len > 255: - id_len = 255 - id_section = id_section[:255] - warnings.warn("id_section has been trimmed to 255 characters") - - if colormaptype: - palette = im.im.getpalette("RGB", "BGR") - colormaplength, colormapentry = len(palette) // 3, 24 - else: - colormaplength, colormapentry = 0, 0 - - if im.mode in ("LA", "RGBA"): - flags = 8 - else: - flags = 0 - - orientation = im.encoderinfo.get("orientation", im.info.get("orientation", -1)) - if orientation > 0: - flags = flags | 0x20 - - fp.write( - o8(id_len) - + o8(colormaptype) - + o8(imagetype) - + o16(0) # colormapfirst - + o16(colormaplength) - + o8(colormapentry) - + o16(0) - + o16(0) - + o16(im.size[0]) - + o16(im.size[1]) - + o8(bits) - + o8(flags) - ) - - if id_section: - fp.write(id_section) - - if colormaptype: - fp.write(palette) - - if rle: - ImageFile._save( - im, - fp, - [ImageFile._Tile("tga_rle", (0, 0) + im.size, 0, (rawmode, orientation))], - ) - else: - ImageFile._save( - im, - fp, - [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, 0, orientation))], - ) - - # write targa version 2 footer - fp.write(b"\000" * 8 + b"TRUEVISION-XFILE." + b"\000") - - -# -# -------------------------------------------------------------------- -# Registry - - -Image.register_open(TgaImageFile.format, TgaImageFile) -Image.register_save(TgaImageFile.format, _save) - -Image.register_extensions(TgaImageFile.format, [".tga", ".icb", ".vda", ".vst"]) - -Image.register_mime(TgaImageFile.format, "image/x-tga") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/TiffImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/TiffImagePlugin.py deleted file mode 100644 index daf20f2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/TiffImagePlugin.py +++ /dev/null @@ -1,2339 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# TIFF file handling -# -# TIFF is a flexible, if somewhat aged, image file format originally -# defined by Aldus. Although TIFF supports a wide variety of pixel -# layouts and compression methods, the name doesn't really stand for -# "thousands of incompatible file formats," it just feels that way. -# -# To read TIFF data from a stream, the stream must be seekable. For -# progressive decoding, make sure to use TIFF files where the tag -# directory is placed first in the file. -# -# History: -# 1995-09-01 fl Created -# 1996-05-04 fl Handle JPEGTABLES tag -# 1996-05-18 fl Fixed COLORMAP support -# 1997-01-05 fl Fixed PREDICTOR support -# 1997-08-27 fl Added support for rational tags (from Perry Stoll) -# 1998-01-10 fl Fixed seek/tell (from Jan Blom) -# 1998-07-15 fl Use private names for internal variables -# 1999-06-13 fl Rewritten for PIL 1.0 (1.0) -# 2000-10-11 fl Additional fixes for Python 2.0 (1.1) -# 2001-04-17 fl Fixed rewind support (seek to frame 0) (1.2) -# 2001-05-12 fl Added write support for more tags (from Greg Couch) (1.3) -# 2001-12-18 fl Added workaround for broken Matrox library -# 2002-01-18 fl Don't mess up if photometric tag is missing (D. Alan Stewart) -# 2003-05-19 fl Check FILLORDER tag -# 2003-09-26 fl Added RGBa support -# 2004-02-24 fl Added DPI support; fixed rational write support -# 2005-02-07 fl Added workaround for broken Corel Draw 10 files -# 2006-01-09 fl Added support for float/double tags (from Russell Nelson) -# -# Copyright (c) 1997-2006 by Secret Labs AB. All rights reserved. -# Copyright (c) 1995-1997 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import io -import itertools -import logging -import math -import os -import struct -import warnings -from collections.abc import Iterator, MutableMapping -from fractions import Fraction -from numbers import Number, Rational -from typing import IO, Any, Callable, NoReturn, cast - -from . import ExifTags, Image, ImageFile, ImageOps, ImagePalette, TiffTags -from ._binary import i16be as i16 -from ._binary import i32be as i32 -from ._binary import o8 -from ._deprecate import deprecate -from ._typing import StrOrBytesPath -from ._util import DeferredError, is_path -from .TiffTags import TYPES - -TYPE_CHECKING = False -if TYPE_CHECKING: - from ._typing import Buffer, IntegralLike - -logger = logging.getLogger(__name__) - -# Set these to true to force use of libtiff for reading or writing. -READ_LIBTIFF = False -WRITE_LIBTIFF = False -STRIP_SIZE = 65536 - -II = b"II" # little-endian (Intel style) -MM = b"MM" # big-endian (Motorola style) - -# -# -------------------------------------------------------------------- -# Read TIFF files - -# a few tag names, just to make the code below a bit more readable -OSUBFILETYPE = 255 -IMAGEWIDTH = 256 -IMAGELENGTH = 257 -BITSPERSAMPLE = 258 -COMPRESSION = 259 -PHOTOMETRIC_INTERPRETATION = 262 -FILLORDER = 266 -IMAGEDESCRIPTION = 270 -STRIPOFFSETS = 273 -SAMPLESPERPIXEL = 277 -ROWSPERSTRIP = 278 -STRIPBYTECOUNTS = 279 -X_RESOLUTION = 282 -Y_RESOLUTION = 283 -PLANAR_CONFIGURATION = 284 -RESOLUTION_UNIT = 296 -TRANSFERFUNCTION = 301 -SOFTWARE = 305 -DATE_TIME = 306 -ARTIST = 315 -PREDICTOR = 317 -COLORMAP = 320 -TILEWIDTH = 322 -TILELENGTH = 323 -TILEOFFSETS = 324 -TILEBYTECOUNTS = 325 -SUBIFD = 330 -EXTRASAMPLES = 338 -SAMPLEFORMAT = 339 -JPEGTABLES = 347 -YCBCRSUBSAMPLING = 530 -REFERENCEBLACKWHITE = 532 -COPYRIGHT = 33432 -IPTC_NAA_CHUNK = 33723 # newsphoto properties -PHOTOSHOP_CHUNK = 34377 # photoshop properties -ICCPROFILE = 34675 -EXIFIFD = 34665 -XMP = 700 -JPEGQUALITY = 65537 # pseudo-tag by libtiff - -# https://github.com/imagej/ImageJA/blob/master/src/main/java/ij/io/TiffDecoder.java -IMAGEJ_META_DATA_BYTE_COUNTS = 50838 -IMAGEJ_META_DATA = 50839 - -COMPRESSION_INFO = { - # Compression => pil compression name - 1: "raw", - 2: "tiff_ccitt", - 3: "group3", - 4: "group4", - 5: "tiff_lzw", - 6: "tiff_jpeg", # obsolete - 7: "jpeg", - 8: "tiff_adobe_deflate", - 32771: "tiff_raw_16", # 16-bit padding - 32773: "packbits", - 32809: "tiff_thunderscan", - 32946: "tiff_deflate", - 34676: "tiff_sgilog", - 34677: "tiff_sgilog24", - 34925: "lzma", - 50000: "zstd", - 50001: "webp", -} - -COMPRESSION_INFO_REV = {v: k for k, v in COMPRESSION_INFO.items()} - -OPEN_INFO = { - # (ByteOrder, PhotoInterpretation, SampleFormat, FillOrder, BitsPerSample, - # ExtraSamples) => mode, rawmode - (II, 0, (1,), 1, (1,), ()): ("1", "1;I"), - (MM, 0, (1,), 1, (1,), ()): ("1", "1;I"), - (II, 0, (1,), 2, (1,), ()): ("1", "1;IR"), - (MM, 0, (1,), 2, (1,), ()): ("1", "1;IR"), - (II, 1, (1,), 1, (1,), ()): ("1", "1"), - (MM, 1, (1,), 1, (1,), ()): ("1", "1"), - (II, 1, (1,), 2, (1,), ()): ("1", "1;R"), - (MM, 1, (1,), 2, (1,), ()): ("1", "1;R"), - (II, 0, (1,), 1, (2,), ()): ("L", "L;2I"), - (MM, 0, (1,), 1, (2,), ()): ("L", "L;2I"), - (II, 0, (1,), 2, (2,), ()): ("L", "L;2IR"), - (MM, 0, (1,), 2, (2,), ()): ("L", "L;2IR"), - (II, 1, (1,), 1, (2,), ()): ("L", "L;2"), - (MM, 1, (1,), 1, (2,), ()): ("L", "L;2"), - (II, 1, (1,), 2, (2,), ()): ("L", "L;2R"), - (MM, 1, (1,), 2, (2,), ()): ("L", "L;2R"), - (II, 0, (1,), 1, (4,), ()): ("L", "L;4I"), - (MM, 0, (1,), 1, (4,), ()): ("L", "L;4I"), - (II, 0, (1,), 2, (4,), ()): ("L", "L;4IR"), - (MM, 0, (1,), 2, (4,), ()): ("L", "L;4IR"), - (II, 1, (1,), 1, (4,), ()): ("L", "L;4"), - (MM, 1, (1,), 1, (4,), ()): ("L", "L;4"), - (II, 1, (1,), 2, (4,), ()): ("L", "L;4R"), - (MM, 1, (1,), 2, (4,), ()): ("L", "L;4R"), - (II, 0, (1,), 1, (8,), ()): ("L", "L;I"), - (MM, 0, (1,), 1, (8,), ()): ("L", "L;I"), - (II, 0, (1,), 2, (8,), ()): ("L", "L;IR"), - (MM, 0, (1,), 2, (8,), ()): ("L", "L;IR"), - (II, 1, (1,), 1, (8,), ()): ("L", "L"), - (MM, 1, (1,), 1, (8,), ()): ("L", "L"), - (II, 1, (2,), 1, (8,), ()): ("L", "L"), - (MM, 1, (2,), 1, (8,), ()): ("L", "L"), - (II, 1, (1,), 2, (8,), ()): ("L", "L;R"), - (MM, 1, (1,), 2, (8,), ()): ("L", "L;R"), - (II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"), - (II, 0, (1,), 1, (16,), ()): ("I;16", "I;16"), - (II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"), - (MM, 1, (1,), 1, (16,), ()): ("I;16B", "I;16B"), - (II, 1, (1,), 2, (16,), ()): ("I;16", "I;16R"), - (II, 1, (2,), 1, (16,), ()): ("I", "I;16S"), - (MM, 1, (2,), 1, (16,), ()): ("I", "I;16BS"), - (II, 0, (3,), 1, (32,), ()): ("F", "F;32F"), - (MM, 0, (3,), 1, (32,), ()): ("F", "F;32BF"), - (II, 1, (1,), 1, (32,), ()): ("I", "I;32N"), - (II, 1, (2,), 1, (32,), ()): ("I", "I;32S"), - (MM, 1, (2,), 1, (32,), ()): ("I", "I;32BS"), - (II, 1, (3,), 1, (32,), ()): ("F", "F;32F"), - (MM, 1, (3,), 1, (32,), ()): ("F", "F;32BF"), - (II, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"), - (MM, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"), - (II, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"), - (MM, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"), - (II, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"), - (MM, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"), - (II, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples - (MM, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples - (II, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGB", "RGBX"), - (MM, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGB", "RGBX"), - (II, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGB", "RGBXX"), - (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGB", "RGBXX"), - (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGB", "RGBXXX"), - (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGB", "RGBXXX"), - (II, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"), - (MM, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"), - (II, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"), - (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"), - (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"), - (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"), - (II, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"), - (MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"), - (II, 2, (1,), 1, (8, 8, 8, 8, 8), (2, 0)): ("RGBA", "RGBAX"), - (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (2, 0)): ("RGBA", "RGBAX"), - (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (2, 0, 0)): ("RGBA", "RGBAXX"), - (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (2, 0, 0)): ("RGBA", "RGBAXX"), - (II, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10 - (MM, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10 - (II, 2, (1,), 1, (16, 16, 16), ()): ("RGB", "RGB;16L"), - (MM, 2, (1,), 1, (16, 16, 16), ()): ("RGB", "RGB;16B"), - (II, 2, (1,), 1, (16, 16, 16, 16), ()): ("RGBA", "RGBA;16L"), - (MM, 2, (1,), 1, (16, 16, 16, 16), ()): ("RGBA", "RGBA;16B"), - (II, 2, (1,), 1, (16, 16, 16, 16), (0,)): ("RGB", "RGBX;16L"), - (MM, 2, (1,), 1, (16, 16, 16, 16), (0,)): ("RGB", "RGBX;16B"), - (II, 2, (1,), 1, (16, 16, 16, 16), (1,)): ("RGBA", "RGBa;16L"), - (MM, 2, (1,), 1, (16, 16, 16, 16), (1,)): ("RGBA", "RGBa;16B"), - (II, 2, (1,), 1, (16, 16, 16, 16), (2,)): ("RGBA", "RGBA;16L"), - (MM, 2, (1,), 1, (16, 16, 16, 16), (2,)): ("RGBA", "RGBA;16B"), - (II, 3, (1,), 1, (1,), ()): ("P", "P;1"), - (MM, 3, (1,), 1, (1,), ()): ("P", "P;1"), - (II, 3, (1,), 2, (1,), ()): ("P", "P;1R"), - (MM, 3, (1,), 2, (1,), ()): ("P", "P;1R"), - (II, 3, (1,), 1, (2,), ()): ("P", "P;2"), - (MM, 3, (1,), 1, (2,), ()): ("P", "P;2"), - (II, 3, (1,), 2, (2,), ()): ("P", "P;2R"), - (MM, 3, (1,), 2, (2,), ()): ("P", "P;2R"), - (II, 3, (1,), 1, (4,), ()): ("P", "P;4"), - (MM, 3, (1,), 1, (4,), ()): ("P", "P;4"), - (II, 3, (1,), 2, (4,), ()): ("P", "P;4R"), - (MM, 3, (1,), 2, (4,), ()): ("P", "P;4R"), - (II, 3, (1,), 1, (8,), ()): ("P", "P"), - (MM, 3, (1,), 1, (8,), ()): ("P", "P"), - (II, 3, (1,), 1, (8, 8), (0,)): ("P", "PX"), - (II, 3, (1,), 1, (8, 8), (2,)): ("PA", "PA"), - (MM, 3, (1,), 1, (8, 8), (2,)): ("PA", "PA"), - (II, 3, (1,), 2, (8,), ()): ("P", "P;R"), - (MM, 3, (1,), 2, (8,), ()): ("P", "P;R"), - (II, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"), - (MM, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"), - (II, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"), - (MM, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"), - (II, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"), - (MM, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"), - (II, 5, (1,), 1, (16, 16, 16, 16), ()): ("CMYK", "CMYK;16L"), - (MM, 5, (1,), 1, (16, 16, 16, 16), ()): ("CMYK", "CMYK;16B"), - (II, 6, (1,), 1, (8,), ()): ("L", "L"), - (MM, 6, (1,), 1, (8,), ()): ("L", "L"), - # JPEG compressed images handled by LibTiff and auto-converted to RGBX - # Minimal Baseline TIFF requires YCbCr images to have 3 SamplesPerPixel - (II, 6, (1,), 1, (8, 8, 8), ()): ("RGB", "RGBX"), - (MM, 6, (1,), 1, (8, 8, 8), ()): ("RGB", "RGBX"), - (II, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"), - (MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"), -} - -MAX_SAMPLESPERPIXEL = max(len(key_tp[4]) for key_tp in OPEN_INFO) - -PREFIXES = [ - b"MM\x00\x2a", # Valid TIFF header with big-endian byte order - b"II\x2a\x00", # Valid TIFF header with little-endian byte order - b"MM\x2a\x00", # Invalid TIFF header, assume big-endian - b"II\x00\x2a", # Invalid TIFF header, assume little-endian - b"MM\x00\x2b", # BigTIFF with big-endian byte order - b"II\x2b\x00", # BigTIFF with little-endian byte order -] - -if not getattr(Image.core, "libtiff_support_custom_tags", True): - deprecate("Support for LibTIFF earlier than version 4", 12) - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(tuple(PREFIXES)) - - -def _limit_rational( - val: float | Fraction | IFDRational, max_val: int -) -> tuple[IntegralLike, IntegralLike]: - inv = abs(val) > 1 - n_d = IFDRational(1 / val if inv else val).limit_rational(max_val) - return n_d[::-1] if inv else n_d - - -def _limit_signed_rational( - val: IFDRational, max_val: int, min_val: int -) -> tuple[IntegralLike, IntegralLike]: - frac = Fraction(val) - n_d: tuple[IntegralLike, IntegralLike] = frac.numerator, frac.denominator - - if min(float(i) for i in n_d) < min_val: - n_d = _limit_rational(val, abs(min_val)) - - n_d_float = tuple(float(i) for i in n_d) - if max(n_d_float) > max_val: - n_d = _limit_rational(n_d_float[0] / n_d_float[1], max_val) - - return n_d - - -## -# Wrapper for TIFF IFDs. - -_load_dispatch = {} -_write_dispatch = {} - - -def _delegate(op: str) -> Any: - def delegate( - self: IFDRational, *args: tuple[float, ...] - ) -> bool | float | Fraction: - return getattr(self._val, op)(*args) - - return delegate - - -class IFDRational(Rational): - """Implements a rational class where 0/0 is a legal value to match - the in the wild use of exif rationals. - - e.g., DigitalZoomRatio - 0.00/0.00 indicates that no digital zoom was used - """ - - """ If the denominator is 0, store this as a float('nan'), otherwise store - as a fractions.Fraction(). Delegate as appropriate - - """ - - __slots__ = ("_numerator", "_denominator", "_val") - - def __init__( - self, value: float | Fraction | IFDRational, denominator: int = 1 - ) -> None: - """ - :param value: either an integer numerator, a - float/rational/other number, or an IFDRational - :param denominator: Optional integer denominator - """ - self._val: Fraction | float - if isinstance(value, IFDRational): - self._numerator = value.numerator - self._denominator = value.denominator - self._val = value._val - return - - if isinstance(value, Fraction): - self._numerator = value.numerator - self._denominator = value.denominator - else: - if TYPE_CHECKING: - self._numerator = cast(IntegralLike, value) - else: - self._numerator = value - self._denominator = denominator - - if denominator == 0: - self._val = float("nan") - elif denominator == 1: - self._val = Fraction(value) - elif int(value) == value: - self._val = Fraction(int(value), denominator) - else: - self._val = Fraction(value / denominator) - - @property - def numerator(self) -> IntegralLike: - return self._numerator - - @property - def denominator(self) -> int: - return self._denominator - - def limit_rational(self, max_denominator: int) -> tuple[IntegralLike, int]: - """ - - :param max_denominator: Integer, the maximum denominator value - :returns: Tuple of (numerator, denominator) - """ - - if self.denominator == 0: - return self.numerator, self.denominator - - assert isinstance(self._val, Fraction) - f = self._val.limit_denominator(max_denominator) - return f.numerator, f.denominator - - def __repr__(self) -> str: - return str(float(self._val)) - - def __hash__(self) -> int: # type: ignore[override] - return self._val.__hash__() - - def __eq__(self, other: object) -> bool: - val = self._val - if isinstance(other, IFDRational): - other = other._val - if isinstance(other, float): - val = float(val) - return val == other - - def __getstate__(self) -> list[float | Fraction | IntegralLike]: - return [self._val, self._numerator, self._denominator] - - def __setstate__(self, state: list[float | Fraction | IntegralLike]) -> None: - IFDRational.__init__(self, 0) - _val, _numerator, _denominator = state - assert isinstance(_val, (float, Fraction)) - self._val = _val - if TYPE_CHECKING: - self._numerator = cast(IntegralLike, _numerator) - else: - self._numerator = _numerator - assert isinstance(_denominator, int) - self._denominator = _denominator - - """ a = ['add','radd', 'sub', 'rsub', 'mul', 'rmul', - 'truediv', 'rtruediv', 'floordiv', 'rfloordiv', - 'mod','rmod', 'pow','rpow', 'pos', 'neg', - 'abs', 'trunc', 'lt', 'gt', 'le', 'ge', 'bool', - 'ceil', 'floor', 'round'] - print("\n".join("__%s__ = _delegate('__%s__')" % (s,s) for s in a)) - """ - - __add__ = _delegate("__add__") - __radd__ = _delegate("__radd__") - __sub__ = _delegate("__sub__") - __rsub__ = _delegate("__rsub__") - __mul__ = _delegate("__mul__") - __rmul__ = _delegate("__rmul__") - __truediv__ = _delegate("__truediv__") - __rtruediv__ = _delegate("__rtruediv__") - __floordiv__ = _delegate("__floordiv__") - __rfloordiv__ = _delegate("__rfloordiv__") - __mod__ = _delegate("__mod__") - __rmod__ = _delegate("__rmod__") - __pow__ = _delegate("__pow__") - __rpow__ = _delegate("__rpow__") - __pos__ = _delegate("__pos__") - __neg__ = _delegate("__neg__") - __abs__ = _delegate("__abs__") - __trunc__ = _delegate("__trunc__") - __lt__ = _delegate("__lt__") - __gt__ = _delegate("__gt__") - __le__ = _delegate("__le__") - __ge__ = _delegate("__ge__") - __bool__ = _delegate("__bool__") - __ceil__ = _delegate("__ceil__") - __floor__ = _delegate("__floor__") - __round__ = _delegate("__round__") - # Python >= 3.11 - if hasattr(Fraction, "__int__"): - __int__ = _delegate("__int__") - - -_LoaderFunc = Callable[["ImageFileDirectory_v2", bytes, bool], Any] - - -def _register_loader(idx: int, size: int) -> Callable[[_LoaderFunc], _LoaderFunc]: - def decorator(func: _LoaderFunc) -> _LoaderFunc: - from .TiffTags import TYPES - - if func.__name__.startswith("load_"): - TYPES[idx] = func.__name__[5:].replace("_", " ") - _load_dispatch[idx] = size, func # noqa: F821 - return func - - return decorator - - -def _register_writer(idx: int) -> Callable[[Callable[..., Any]], Callable[..., Any]]: - def decorator(func: Callable[..., Any]) -> Callable[..., Any]: - _write_dispatch[idx] = func # noqa: F821 - return func - - return decorator - - -def _register_basic(idx_fmt_name: tuple[int, str, str]) -> None: - from .TiffTags import TYPES - - idx, fmt, name = idx_fmt_name - TYPES[idx] = name - size = struct.calcsize(f"={fmt}") - - def basic_handler( - self: ImageFileDirectory_v2, data: bytes, legacy_api: bool = True - ) -> tuple[Any, ...]: - return self._unpack(f"{len(data) // size}{fmt}", data) - - _load_dispatch[idx] = size, basic_handler # noqa: F821 - _write_dispatch[idx] = lambda self, *values: ( # noqa: F821 - b"".join(self._pack(fmt, value) for value in values) - ) - - -if TYPE_CHECKING: - _IFDv2Base = MutableMapping[int, Any] -else: - _IFDv2Base = MutableMapping - - -class ImageFileDirectory_v2(_IFDv2Base): - """This class represents a TIFF tag directory. To speed things up, we - don't decode tags unless they're asked for. - - Exposes a dictionary interface of the tags in the directory:: - - ifd = ImageFileDirectory_v2() - ifd[key] = 'Some Data' - ifd.tagtype[key] = TiffTags.ASCII - print(ifd[key]) - 'Some Data' - - Individual values are returned as the strings or numbers, sequences are - returned as tuples of the values. - - The tiff metadata type of each item is stored in a dictionary of - tag types in - :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype`. The types - are read from a tiff file, guessed from the type added, or added - manually. - - Data Structures: - - * ``self.tagtype = {}`` - - * Key: numerical TIFF tag number - * Value: integer corresponding to the data type from - :py:data:`.TiffTags.TYPES` - - .. versionadded:: 3.0.0 - - 'Internal' data structures: - - * ``self._tags_v2 = {}`` - - * Key: numerical TIFF tag number - * Value: decoded data, as tuple for multiple values - - * ``self._tagdata = {}`` - - * Key: numerical TIFF tag number - * Value: undecoded byte string from file - - * ``self._tags_v1 = {}`` - - * Key: numerical TIFF tag number - * Value: decoded data in the v1 format - - Tags will be found in the private attributes ``self._tagdata``, and in - ``self._tags_v2`` once decoded. - - ``self.legacy_api`` is a value for internal use, and shouldn't be changed - from outside code. In cooperation with - :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`, if ``legacy_api`` - is true, then decoded tags will be populated into both ``_tags_v1`` and - ``_tags_v2``. ``_tags_v2`` will be used if this IFD is used in the TIFF - save routine. Tags should be read from ``_tags_v1`` if - ``legacy_api == true``. - - """ - - _load_dispatch: dict[int, tuple[int, _LoaderFunc]] = {} - _write_dispatch: dict[int, Callable[..., Any]] = {} - - def __init__( - self, - ifh: bytes = b"II\x2a\x00\x00\x00\x00\x00", - prefix: bytes | None = None, - group: int | None = None, - ) -> None: - """Initialize an ImageFileDirectory. - - To construct an ImageFileDirectory from a real file, pass the 8-byte - magic header to the constructor. To only set the endianness, pass it - as the 'prefix' keyword argument. - - :param ifh: One of the accepted magic headers (cf. PREFIXES); also sets - endianness. - :param prefix: Override the endianness of the file. - """ - if not _accept(ifh): - msg = f"not a TIFF file (header {repr(ifh)} not valid)" - raise SyntaxError(msg) - self._prefix = prefix if prefix is not None else ifh[:2] - if self._prefix == MM: - self._endian = ">" - elif self._prefix == II: - self._endian = "<" - else: - msg = "not a TIFF IFD" - raise SyntaxError(msg) - self._bigtiff = ifh[2] == 43 - self.group = group - self.tagtype: dict[int, int] = {} - """ Dictionary of tag types """ - self.reset() - self.next = ( - self._unpack("Q", ifh[8:])[0] - if self._bigtiff - else self._unpack("L", ifh[4:])[0] - ) - self._legacy_api = False - - prefix = property(lambda self: self._prefix) - offset = property(lambda self: self._offset) - - @property - def legacy_api(self) -> bool: - return self._legacy_api - - @legacy_api.setter - def legacy_api(self, value: bool) -> NoReturn: - msg = "Not allowing setting of legacy api" - raise Exception(msg) - - def reset(self) -> None: - self._tags_v1: dict[int, Any] = {} # will remain empty if legacy_api is false - self._tags_v2: dict[int, Any] = {} # main tag storage - self._tagdata: dict[int, bytes] = {} - self.tagtype = {} # added 2008-06-05 by Florian Hoech - self._next = None - self._offset: int | None = None - - def __str__(self) -> str: - return str(dict(self)) - - def named(self) -> dict[str, Any]: - """ - :returns: dict of name|key: value - - Returns the complete tag dictionary, with named tags where possible. - """ - return { - TiffTags.lookup(code, self.group).name: value - for code, value in self.items() - } - - def __len__(self) -> int: - return len(set(self._tagdata) | set(self._tags_v2)) - - def __getitem__(self, tag: int) -> Any: - if tag not in self._tags_v2: # unpack on the fly - data = self._tagdata[tag] - typ = self.tagtype[tag] - size, handler = self._load_dispatch[typ] - self[tag] = handler(self, data, self.legacy_api) # check type - val = self._tags_v2[tag] - if self.legacy_api and not isinstance(val, (tuple, bytes)): - val = (val,) - return val - - def __contains__(self, tag: object) -> bool: - return tag in self._tags_v2 or tag in self._tagdata - - def __setitem__(self, tag: int, value: Any) -> None: - self._setitem(tag, value, self.legacy_api) - - def _setitem(self, tag: int, value: Any, legacy_api: bool) -> None: - basetypes = (Number, bytes, str) - - info = TiffTags.lookup(tag, self.group) - values = [value] if isinstance(value, basetypes) else value - - if tag not in self.tagtype: - if info.type: - self.tagtype[tag] = info.type - else: - self.tagtype[tag] = TiffTags.UNDEFINED - if all(isinstance(v, IFDRational) for v in values): - for v in values: - assert isinstance(v, IFDRational) - if v < 0: - self.tagtype[tag] = TiffTags.SIGNED_RATIONAL - break - else: - self.tagtype[tag] = TiffTags.RATIONAL - elif all(isinstance(v, int) for v in values): - short = True - signed_short = True - long = True - for v in values: - assert isinstance(v, int) - if short and not (0 <= v < 2**16): - short = False - if signed_short and not (-(2**15) < v < 2**15): - signed_short = False - if long and v < 0: - long = False - if short: - self.tagtype[tag] = TiffTags.SHORT - elif signed_short: - self.tagtype[tag] = TiffTags.SIGNED_SHORT - elif long: - self.tagtype[tag] = TiffTags.LONG - else: - self.tagtype[tag] = TiffTags.SIGNED_LONG - elif all(isinstance(v, float) for v in values): - self.tagtype[tag] = TiffTags.DOUBLE - elif all(isinstance(v, str) for v in values): - self.tagtype[tag] = TiffTags.ASCII - elif all(isinstance(v, bytes) for v in values): - self.tagtype[tag] = TiffTags.BYTE - - if self.tagtype[tag] == TiffTags.UNDEFINED: - values = [ - v.encode("ascii", "replace") if isinstance(v, str) else v - for v in values - ] - elif self.tagtype[tag] == TiffTags.RATIONAL: - values = [float(v) if isinstance(v, int) else v for v in values] - - is_ifd = self.tagtype[tag] == TiffTags.LONG and isinstance(values, dict) - if not is_ifd: - values = tuple( - info.cvt_enum(value) if isinstance(value, str) else value - for value in values - ) - - dest = self._tags_v1 if legacy_api else self._tags_v2 - - # Three branches: - # Spec'd length == 1, Actual length 1, store as element - # Spec'd length == 1, Actual > 1, Warn and truncate. Formerly barfed. - # No Spec, Actual length 1, Formerly (<4.2) returned a 1 element tuple. - # Don't mess with the legacy api, since it's frozen. - if not is_ifd and ( - (info.length == 1) - or self.tagtype[tag] == TiffTags.BYTE - or (info.length is None and len(values) == 1 and not legacy_api) - ): - # Don't mess with the legacy api, since it's frozen. - if legacy_api and self.tagtype[tag] in [ - TiffTags.RATIONAL, - TiffTags.SIGNED_RATIONAL, - ]: # rationals - values = (values,) - try: - (dest[tag],) = values - except ValueError: - # We've got a builtin tag with 1 expected entry - warnings.warn( - f"Metadata Warning, tag {tag} had too many entries: " - f"{len(values)}, expected 1" - ) - dest[tag] = values[0] - - else: - # Spec'd length > 1 or undefined - # Unspec'd, and length > 1 - dest[tag] = values - - def __delitem__(self, tag: int) -> None: - self._tags_v2.pop(tag, None) - self._tags_v1.pop(tag, None) - self._tagdata.pop(tag, None) - - def __iter__(self) -> Iterator[int]: - return iter(set(self._tagdata) | set(self._tags_v2)) - - def _unpack(self, fmt: str, data: bytes) -> tuple[Any, ...]: - return struct.unpack(self._endian + fmt, data) - - def _pack(self, fmt: str, *values: Any) -> bytes: - return struct.pack(self._endian + fmt, *values) - - list( - map( - _register_basic, - [ - (TiffTags.SHORT, "H", "short"), - (TiffTags.LONG, "L", "long"), - (TiffTags.SIGNED_BYTE, "b", "signed byte"), - (TiffTags.SIGNED_SHORT, "h", "signed short"), - (TiffTags.SIGNED_LONG, "l", "signed long"), - (TiffTags.FLOAT, "f", "float"), - (TiffTags.DOUBLE, "d", "double"), - (TiffTags.IFD, "L", "long"), - (TiffTags.LONG8, "Q", "long8"), - ], - ) - ) - - @_register_loader(1, 1) # Basic type, except for the legacy API. - def load_byte(self, data: bytes, legacy_api: bool = True) -> bytes: - return data - - @_register_writer(1) # Basic type, except for the legacy API. - def write_byte(self, data: bytes | int | IFDRational) -> bytes: - if isinstance(data, IFDRational): - data = int(data) - if isinstance(data, int): - data = bytes((data,)) - return data - - @_register_loader(2, 1) - def load_string(self, data: bytes, legacy_api: bool = True) -> str: - if data.endswith(b"\0"): - data = data[:-1] - return data.decode("latin-1", "replace") - - @_register_writer(2) - def write_string(self, value: str | bytes | int) -> bytes: - # remerge of https://github.com/python-pillow/Pillow/pull/1416 - if isinstance(value, int): - value = str(value) - if not isinstance(value, bytes): - value = value.encode("ascii", "replace") - return value + b"\0" - - @_register_loader(5, 8) - def load_rational( - self, data: bytes, legacy_api: bool = True - ) -> tuple[tuple[int, int] | IFDRational, ...]: - vals = self._unpack(f"{len(data) // 4}L", data) - - def combine(a: int, b: int) -> tuple[int, int] | IFDRational: - return (a, b) if legacy_api else IFDRational(a, b) - - return tuple(combine(num, denom) for num, denom in zip(vals[::2], vals[1::2])) - - @_register_writer(5) - def write_rational(self, *values: IFDRational) -> bytes: - return b"".join( - self._pack("2L", *_limit_rational(frac, 2**32 - 1)) for frac in values - ) - - @_register_loader(7, 1) - def load_undefined(self, data: bytes, legacy_api: bool = True) -> bytes: - return data - - @_register_writer(7) - def write_undefined(self, value: bytes | int | IFDRational) -> bytes: - if isinstance(value, IFDRational): - value = int(value) - if isinstance(value, int): - value = str(value).encode("ascii", "replace") - return value - - @_register_loader(10, 8) - def load_signed_rational( - self, data: bytes, legacy_api: bool = True - ) -> tuple[tuple[int, int] | IFDRational, ...]: - vals = self._unpack(f"{len(data) // 4}l", data) - - def combine(a: int, b: int) -> tuple[int, int] | IFDRational: - return (a, b) if legacy_api else IFDRational(a, b) - - return tuple(combine(num, denom) for num, denom in zip(vals[::2], vals[1::2])) - - @_register_writer(10) - def write_signed_rational(self, *values: IFDRational) -> bytes: - return b"".join( - self._pack("2l", *_limit_signed_rational(frac, 2**31 - 1, -(2**31))) - for frac in values - ) - - def _ensure_read(self, fp: IO[bytes], size: int) -> bytes: - ret = fp.read(size) - if len(ret) != size: - msg = ( - "Corrupt EXIF data. " - f"Expecting to read {size} bytes but only got {len(ret)}. " - ) - raise OSError(msg) - return ret - - def load(self, fp: IO[bytes]) -> None: - self.reset() - self._offset = fp.tell() - - try: - tag_count = ( - self._unpack("Q", self._ensure_read(fp, 8)) - if self._bigtiff - else self._unpack("H", self._ensure_read(fp, 2)) - )[0] - for i in range(tag_count): - tag, typ, count, data = ( - self._unpack("HHQ8s", self._ensure_read(fp, 20)) - if self._bigtiff - else self._unpack("HHL4s", self._ensure_read(fp, 12)) - ) - - tagname = TiffTags.lookup(tag, self.group).name - typname = TYPES.get(typ, "unknown") - msg = f"tag: {tagname} ({tag}) - type: {typname} ({typ})" - - try: - unit_size, handler = self._load_dispatch[typ] - except KeyError: - logger.debug("%s - unsupported type %s", msg, typ) - continue # ignore unsupported type - size = count * unit_size - if size > (8 if self._bigtiff else 4): - here = fp.tell() - (offset,) = self._unpack("Q" if self._bigtiff else "L", data) - msg += f" Tag Location: {here} - Data Location: {offset}" - fp.seek(offset) - data = ImageFile._safe_read(fp, size) - fp.seek(here) - else: - data = data[:size] - - if len(data) != size: - warnings.warn( - "Possibly corrupt EXIF data. " - f"Expecting to read {size} bytes but only got {len(data)}." - f" Skipping tag {tag}" - ) - logger.debug(msg) - continue - - if not data: - logger.debug(msg) - continue - - self._tagdata[tag] = data - self.tagtype[tag] = typ - - msg += " - value: " - msg += f"" if size > 32 else repr(data) - - logger.debug(msg) - - (self.next,) = ( - self._unpack("Q", self._ensure_read(fp, 8)) - if self._bigtiff - else self._unpack("L", self._ensure_read(fp, 4)) - ) - except OSError as msg: - warnings.warn(str(msg)) - return - - def _get_ifh(self) -> bytes: - ifh = self._prefix + self._pack("H", 43 if self._bigtiff else 42) - if self._bigtiff: - ifh += self._pack("HH", 8, 0) - ifh += self._pack("Q", 16) if self._bigtiff else self._pack("L", 8) - - return ifh - - def tobytes(self, offset: int = 0) -> bytes: - # FIXME What about tagdata? - result = self._pack("Q" if self._bigtiff else "H", len(self._tags_v2)) - - entries: list[tuple[int, int, int, bytes, bytes]] = [] - - fmt = "Q" if self._bigtiff else "L" - fmt_size = 8 if self._bigtiff else 4 - offset += ( - len(result) + len(self._tags_v2) * (20 if self._bigtiff else 12) + fmt_size - ) - stripoffsets = None - - # pass 1: convert tags to binary format - # always write tags in ascending order - for tag, value in sorted(self._tags_v2.items()): - if tag == STRIPOFFSETS: - stripoffsets = len(entries) - typ = self.tagtype[tag] - logger.debug("Tag %s, Type: %s, Value: %s", tag, typ, repr(value)) - is_ifd = typ == TiffTags.LONG and isinstance(value, dict) - if is_ifd: - ifd = ImageFileDirectory_v2(self._get_ifh(), group=tag) - values = self._tags_v2[tag] - for ifd_tag, ifd_value in values.items(): - ifd[ifd_tag] = ifd_value - data = ifd.tobytes(offset) - else: - values = value if isinstance(value, tuple) else (value,) - data = self._write_dispatch[typ](self, *values) - - tagname = TiffTags.lookup(tag, self.group).name - typname = "ifd" if is_ifd else TYPES.get(typ, "unknown") - msg = f"save: {tagname} ({tag}) - type: {typname} ({typ}) - value: " - msg += f"" if len(data) >= 16 else str(values) - logger.debug(msg) - - # count is sum of lengths for string and arbitrary data - if is_ifd: - count = 1 - elif typ in [TiffTags.BYTE, TiffTags.ASCII, TiffTags.UNDEFINED]: - count = len(data) - else: - count = len(values) - # figure out if data fits into the entry - if len(data) <= fmt_size: - entries.append((tag, typ, count, data.ljust(fmt_size, b"\0"), b"")) - else: - entries.append((tag, typ, count, self._pack(fmt, offset), data)) - offset += (len(data) + 1) // 2 * 2 # pad to word - - # update strip offset data to point beyond auxiliary data - if stripoffsets is not None: - tag, typ, count, value, data = entries[stripoffsets] - if data: - size, handler = self._load_dispatch[typ] - values = [val + offset for val in handler(self, data, self.legacy_api)] - data = self._write_dispatch[typ](self, *values) - else: - value = self._pack(fmt, self._unpack(fmt, value)[0] + offset) - entries[stripoffsets] = tag, typ, count, value, data - - # pass 2: write entries to file - for tag, typ, count, value, data in entries: - logger.debug("%s %s %s %s %s", tag, typ, count, repr(value), repr(data)) - result += self._pack( - "HHQ8s" if self._bigtiff else "HHL4s", tag, typ, count, value - ) - - # -- overwrite here for multi-page -- - result += self._pack(fmt, 0) # end of entries - - # pass 3: write auxiliary data to file - for tag, typ, count, value, data in entries: - result += data - if len(data) & 1: - result += b"\0" - - return result - - def save(self, fp: IO[bytes]) -> int: - if fp.tell() == 0: # skip TIFF header on subsequent pages - fp.write(self._get_ifh()) - - offset = fp.tell() - result = self.tobytes(offset) - fp.write(result) - return offset + len(result) - - -ImageFileDirectory_v2._load_dispatch = _load_dispatch -ImageFileDirectory_v2._write_dispatch = _write_dispatch -for idx, name in TYPES.items(): - name = name.replace(" ", "_") - setattr(ImageFileDirectory_v2, f"load_{name}", _load_dispatch[idx][1]) - setattr(ImageFileDirectory_v2, f"write_{name}", _write_dispatch[idx]) -del _load_dispatch, _write_dispatch, idx, name - - -# Legacy ImageFileDirectory support. -class ImageFileDirectory_v1(ImageFileDirectory_v2): - """This class represents the **legacy** interface to a TIFF tag directory. - - Exposes a dictionary interface of the tags in the directory:: - - ifd = ImageFileDirectory_v1() - ifd[key] = 'Some Data' - ifd.tagtype[key] = TiffTags.ASCII - print(ifd[key]) - ('Some Data',) - - Also contains a dictionary of tag types as read from the tiff image file, - :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v1.tagtype`. - - Values are returned as a tuple. - - .. deprecated:: 3.0.0 - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._legacy_api = True - - tags = property(lambda self: self._tags_v1) - tagdata = property(lambda self: self._tagdata) - - # defined in ImageFileDirectory_v2 - tagtype: dict[int, int] - """Dictionary of tag types""" - - @classmethod - def from_v2(cls, original: ImageFileDirectory_v2) -> ImageFileDirectory_v1: - """Returns an - :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` - instance with the same data as is contained in the original - :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` - instance. - - :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` - - """ - - ifd = cls(prefix=original.prefix) - ifd._tagdata = original._tagdata - ifd.tagtype = original.tagtype - ifd.next = original.next # an indicator for multipage tiffs - return ifd - - def to_v2(self) -> ImageFileDirectory_v2: - """Returns an - :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` - instance with the same data as is contained in the original - :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` - instance. - - :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` - - """ - - ifd = ImageFileDirectory_v2(prefix=self.prefix) - ifd._tagdata = dict(self._tagdata) - ifd.tagtype = dict(self.tagtype) - ifd._tags_v2 = dict(self._tags_v2) - return ifd - - def __contains__(self, tag: object) -> bool: - return tag in self._tags_v1 or tag in self._tagdata - - def __len__(self) -> int: - return len(set(self._tagdata) | set(self._tags_v1)) - - def __iter__(self) -> Iterator[int]: - return iter(set(self._tagdata) | set(self._tags_v1)) - - def __setitem__(self, tag: int, value: Any) -> None: - for legacy_api in (False, True): - self._setitem(tag, value, legacy_api) - - def __getitem__(self, tag: int) -> Any: - if tag not in self._tags_v1: # unpack on the fly - data = self._tagdata[tag] - typ = self.tagtype[tag] - size, handler = self._load_dispatch[typ] - for legacy in (False, True): - self._setitem(tag, handler(self, data, legacy), legacy) - val = self._tags_v1[tag] - if not isinstance(val, (tuple, bytes)): - val = (val,) - return val - - -# undone -- switch this pointer -ImageFileDirectory = ImageFileDirectory_v1 - - -## -# Image plugin for TIFF files. - - -class TiffImageFile(ImageFile.ImageFile): - format = "TIFF" - format_description = "Adobe TIFF" - _close_exclusive_fp_after_loading = False - - def __init__( - self, - fp: StrOrBytesPath | IO[bytes], - filename: str | bytes | None = None, - ) -> None: - self.tag_v2: ImageFileDirectory_v2 - """ Image file directory (tag dictionary) """ - - self.tag: ImageFileDirectory_v1 - """ Legacy tag entries """ - - super().__init__(fp, filename) - - def _open(self) -> None: - """Open the first image in a TIFF file""" - - # Header - ifh = self.fp.read(8) - if ifh[2] == 43: - ifh += self.fp.read(8) - - self.tag_v2 = ImageFileDirectory_v2(ifh) - - # setup frame pointers - self.__first = self.__next = self.tag_v2.next - self.__frame = -1 - self._fp = self.fp - self._frame_pos: list[int] = [] - self._n_frames: int | None = None - - logger.debug("*** TiffImageFile._open ***") - logger.debug("- __first: %s", self.__first) - logger.debug("- ifh: %s", repr(ifh)) # Use repr to avoid str(bytes) - - # and load the first frame - self._seek(0) - - @property - def n_frames(self) -> int: - current_n_frames = self._n_frames - if current_n_frames is None: - current = self.tell() - self._seek(len(self._frame_pos)) - while self._n_frames is None: - self._seek(self.tell() + 1) - self.seek(current) - assert self._n_frames is not None - return self._n_frames - - def seek(self, frame: int) -> None: - """Select a given frame as current image""" - if not self._seek_check(frame): - return - self._seek(frame) - if self._im is not None and ( - self.im.size != self._tile_size - or self.im.mode != self.mode - or self.readonly - ): - self._im = None - - def _seek(self, frame: int) -> None: - if isinstance(self._fp, DeferredError): - raise self._fp.ex - self.fp = self._fp - - while len(self._frame_pos) <= frame: - if not self.__next: - msg = "no more images in TIFF file" - raise EOFError(msg) - logger.debug( - "Seeking to frame %s, on frame %s, __next %s, location: %s", - frame, - self.__frame, - self.__next, - self.fp.tell(), - ) - if self.__next >= 2**63: - msg = "Unable to seek to frame" - raise ValueError(msg) - self.fp.seek(self.__next) - self._frame_pos.append(self.__next) - logger.debug("Loading tags, location: %s", self.fp.tell()) - self.tag_v2.load(self.fp) - if self.tag_v2.next in self._frame_pos: - # This IFD has already been processed - # Declare this to be the end of the image - self.__next = 0 - else: - self.__next = self.tag_v2.next - if self.__next == 0: - self._n_frames = frame + 1 - if len(self._frame_pos) == 1: - self.is_animated = self.__next != 0 - self.__frame += 1 - self.fp.seek(self._frame_pos[frame]) - self.tag_v2.load(self.fp) - if XMP in self.tag_v2: - xmp = self.tag_v2[XMP] - if isinstance(xmp, tuple) and len(xmp) == 1: - xmp = xmp[0] - self.info["xmp"] = xmp - elif "xmp" in self.info: - del self.info["xmp"] - self._reload_exif() - # fill the legacy tag/ifd entries - self.tag = self.ifd = ImageFileDirectory_v1.from_v2(self.tag_v2) - self.__frame = frame - self._setup() - - def tell(self) -> int: - """Return the current frame number""" - return self.__frame - - def get_photoshop_blocks(self) -> dict[int, dict[str, bytes]]: - """ - Returns a dictionary of Photoshop "Image Resource Blocks". - The keys are the image resource ID. For more information, see - https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037727 - - :returns: Photoshop "Image Resource Blocks" in a dictionary. - """ - blocks = {} - val = self.tag_v2.get(ExifTags.Base.ImageResources) - if val: - while val.startswith(b"8BIM"): - id = i16(val[4:6]) - n = math.ceil((val[6] + 1) / 2) * 2 - size = i32(val[6 + n : 10 + n]) - data = val[10 + n : 10 + n + size] - blocks[id] = {"data": data} - - val = val[math.ceil((10 + n + size) / 2) * 2 :] - return blocks - - def load(self) -> Image.core.PixelAccess | None: - if self.tile and self.use_load_libtiff: - return self._load_libtiff() - return super().load() - - def load_prepare(self) -> None: - if self._im is None: - Image._decompression_bomb_check(self._tile_size) - self.im = Image.core.new(self.mode, self._tile_size) - ImageFile.ImageFile.load_prepare(self) - - def load_end(self) -> None: - # allow closing if we're on the first frame, there's no next - # This is the ImageFile.load path only, libtiff specific below. - if not self.is_animated: - self._close_exclusive_fp_after_loading = True - - # load IFD data from fp before it is closed - exif = self.getexif() - for key in TiffTags.TAGS_V2_GROUPS: - if key not in exif: - continue - exif.get_ifd(key) - - ImageOps.exif_transpose(self, in_place=True) - if ExifTags.Base.Orientation in self.tag_v2: - del self.tag_v2[ExifTags.Base.Orientation] - - def _load_libtiff(self) -> Image.core.PixelAccess | None: - """Overload method triggered when we detect a compressed tiff - Calls out to libtiff""" - - Image.Image.load(self) - - self.load_prepare() - - if not len(self.tile) == 1: - msg = "Not exactly one tile" - raise OSError(msg) - - # (self._compression, (extents tuple), - # 0, (rawmode, self._compression, fp)) - extents = self.tile[0][1] - args = self.tile[0][3] - - # To be nice on memory footprint, if there's a - # file descriptor, use that instead of reading - # into a string in python. - try: - fp = hasattr(self.fp, "fileno") and self.fp.fileno() - # flush the file descriptor, prevents error on pypy 2.4+ - # should also eliminate the need for fp.tell - # in _seek - if hasattr(self.fp, "flush"): - self.fp.flush() - except OSError: - # io.BytesIO have a fileno, but returns an OSError if - # it doesn't use a file descriptor. - fp = False - - if fp: - assert isinstance(args, tuple) - args_list = list(args) - args_list[2] = fp - args = tuple(args_list) - - decoder = Image._getdecoder(self.mode, "libtiff", args, self.decoderconfig) - try: - decoder.setimage(self.im, extents) - except ValueError as e: - msg = "Couldn't set the image" - raise OSError(msg) from e - - close_self_fp = self._exclusive_fp and not self.is_animated - if hasattr(self.fp, "getvalue"): - # We've got a stringio like thing passed in. Yay for all in memory. - # The decoder needs the entire file in one shot, so there's not - # a lot we can do here other than give it the entire file. - # unless we could do something like get the address of the - # underlying string for stringio. - # - # Rearranging for supporting byteio items, since they have a fileno - # that returns an OSError if there's no underlying fp. Easier to - # deal with here by reordering. - logger.debug("have getvalue. just sending in a string from getvalue") - n, err = decoder.decode(self.fp.getvalue()) - elif fp: - # we've got a actual file on disk, pass in the fp. - logger.debug("have fileno, calling fileno version of the decoder.") - if not close_self_fp: - self.fp.seek(0) - # Save and restore the file position, because libtiff will move it - # outside of the Python runtime, and that will confuse - # io.BufferedReader and possible others. - # NOTE: This must use os.lseek(), and not fp.tell()/fp.seek(), - # because the buffer read head already may not equal the actual - # file position, and fp.seek() may just adjust it's internal - # pointer and not actually seek the OS file handle. - pos = os.lseek(fp, 0, os.SEEK_CUR) - # 4 bytes, otherwise the trace might error out - n, err = decoder.decode(b"fpfp") - os.lseek(fp, pos, os.SEEK_SET) - else: - # we have something else. - logger.debug("don't have fileno or getvalue. just reading") - self.fp.seek(0) - # UNDONE -- so much for that buffer size thing. - n, err = decoder.decode(self.fp.read()) - - self.tile = [] - self.readonly = 0 - - self.load_end() - - if close_self_fp: - self.fp.close() - self.fp = None # might be shared - - if err < 0: - msg = f"decoder error {err}" - raise OSError(msg) - - return Image.Image.load(self) - - def _setup(self) -> None: - """Setup this image object based on current tags""" - - if 0xBC01 in self.tag_v2: - msg = "Windows Media Photo files not yet supported" - raise OSError(msg) - - # extract relevant tags - self._compression = COMPRESSION_INFO[self.tag_v2.get(COMPRESSION, 1)] - self._planar_configuration = self.tag_v2.get(PLANAR_CONFIGURATION, 1) - - # photometric is a required tag, but not everyone is reading - # the specification - photo = self.tag_v2.get(PHOTOMETRIC_INTERPRETATION, 0) - - # old style jpeg compression images most certainly are YCbCr - if self._compression == "tiff_jpeg": - photo = 6 - - fillorder = self.tag_v2.get(FILLORDER, 1) - - logger.debug("*** Summary ***") - logger.debug("- compression: %s", self._compression) - logger.debug("- photometric_interpretation: %s", photo) - logger.debug("- planar_configuration: %s", self._planar_configuration) - logger.debug("- fill_order: %s", fillorder) - logger.debug("- YCbCr subsampling: %s", self.tag_v2.get(YCBCRSUBSAMPLING)) - - # size - try: - xsize = self.tag_v2[IMAGEWIDTH] - ysize = self.tag_v2[IMAGELENGTH] - except KeyError as e: - msg = "Missing dimensions" - raise TypeError(msg) from e - if not isinstance(xsize, int) or not isinstance(ysize, int): - msg = "Invalid dimensions" - raise ValueError(msg) - self._tile_size = xsize, ysize - orientation = self.tag_v2.get(ExifTags.Base.Orientation) - if orientation in (5, 6, 7, 8): - self._size = ysize, xsize - else: - self._size = xsize, ysize - - logger.debug("- size: %s", self.size) - - sample_format = self.tag_v2.get(SAMPLEFORMAT, (1,)) - if len(sample_format) > 1 and max(sample_format) == min(sample_format) == 1: - # SAMPLEFORMAT is properly per band, so an RGB image will - # be (1,1,1). But, we don't support per band pixel types, - # and anything more than one band is a uint8. So, just - # take the first element. Revisit this if adding support - # for more exotic images. - sample_format = (1,) - - bps_tuple = self.tag_v2.get(BITSPERSAMPLE, (1,)) - extra_tuple = self.tag_v2.get(EXTRASAMPLES, ()) - if photo in (2, 6, 8): # RGB, YCbCr, LAB - bps_count = 3 - elif photo == 5: # CMYK - bps_count = 4 - else: - bps_count = 1 - bps_count += len(extra_tuple) - bps_actual_count = len(bps_tuple) - samples_per_pixel = self.tag_v2.get( - SAMPLESPERPIXEL, - 3 if self._compression == "tiff_jpeg" and photo in (2, 6) else 1, - ) - - if samples_per_pixel > MAX_SAMPLESPERPIXEL: - # DOS check, samples_per_pixel can be a Long, and we extend the tuple below - logger.error( - "More samples per pixel than can be decoded: %s", samples_per_pixel - ) - msg = "Invalid value for samples per pixel" - raise SyntaxError(msg) - - if samples_per_pixel < bps_actual_count: - # If a file has more values in bps_tuple than expected, - # remove the excess. - bps_tuple = bps_tuple[:samples_per_pixel] - elif samples_per_pixel > bps_actual_count and bps_actual_count == 1: - # If a file has only one value in bps_tuple, when it should have more, - # presume it is the same number of bits for all of the samples. - bps_tuple = bps_tuple * samples_per_pixel - - if len(bps_tuple) != samples_per_pixel: - msg = "unknown data organization" - raise SyntaxError(msg) - - # mode: check photometric interpretation and bits per pixel - key = ( - self.tag_v2.prefix, - photo, - sample_format, - fillorder, - bps_tuple, - extra_tuple, - ) - logger.debug("format key: %s", key) - try: - self._mode, rawmode = OPEN_INFO[key] - except KeyError as e: - logger.debug("- unsupported format") - msg = "unknown pixel mode" - raise SyntaxError(msg) from e - - logger.debug("- raw mode: %s", rawmode) - logger.debug("- pil mode: %s", self.mode) - - self.info["compression"] = self._compression - - xres = self.tag_v2.get(X_RESOLUTION, 1) - yres = self.tag_v2.get(Y_RESOLUTION, 1) - - if xres and yres: - resunit = self.tag_v2.get(RESOLUTION_UNIT) - if resunit == 2: # dots per inch - self.info["dpi"] = (xres, yres) - elif resunit == 3: # dots per centimeter. convert to dpi - self.info["dpi"] = (xres * 2.54, yres * 2.54) - elif resunit is None: # used to default to 1, but now 2) - self.info["dpi"] = (xres, yres) - # For backward compatibility, - # we also preserve the old behavior - self.info["resolution"] = xres, yres - else: # No absolute unit of measurement - self.info["resolution"] = xres, yres - - # build tile descriptors - x = y = layer = 0 - self.tile = [] - self.use_load_libtiff = READ_LIBTIFF or self._compression != "raw" - if self.use_load_libtiff: - # Decoder expects entire file as one tile. - # There's a buffer size limit in load (64k) - # so large g4 images will fail if we use that - # function. - # - # Setup the one tile for the whole image, then - # use the _load_libtiff function. - - # libtiff handles the fillmode for us, so 1;IR should - # actually be 1;I. Including the R double reverses the - # bits, so stripes of the image are reversed. See - # https://github.com/python-pillow/Pillow/issues/279 - if fillorder == 2: - # Replace fillorder with fillorder=1 - key = key[:3] + (1,) + key[4:] - logger.debug("format key: %s", key) - # this should always work, since all the - # fillorder==2 modes have a corresponding - # fillorder=1 mode - self._mode, rawmode = OPEN_INFO[key] - # YCbCr images with new jpeg compression with pixels in one plane - # unpacked straight into RGB values - if ( - photo == 6 - and self._compression == "jpeg" - and self._planar_configuration == 1 - ): - rawmode = "RGB" - # libtiff always returns the bytes in native order. - # we're expecting image byte order. So, if the rawmode - # contains I;16, we need to convert from native to image - # byte order. - elif rawmode == "I;16": - rawmode = "I;16N" - elif rawmode.endswith((";16B", ";16L")): - rawmode = rawmode[:-1] + "N" - - # Offset in the tile tuple is 0, we go from 0,0 to - # w,h, and we only do this once -- eds - a = (rawmode, self._compression, False, self.tag_v2.offset) - self.tile.append(ImageFile._Tile("libtiff", (0, 0, xsize, ysize), 0, a)) - - elif STRIPOFFSETS in self.tag_v2 or TILEOFFSETS in self.tag_v2: - # striped image - if STRIPOFFSETS in self.tag_v2: - offsets = self.tag_v2[STRIPOFFSETS] - h = self.tag_v2.get(ROWSPERSTRIP, ysize) - w = xsize - else: - # tiled image - offsets = self.tag_v2[TILEOFFSETS] - tilewidth = self.tag_v2.get(TILEWIDTH) - h = self.tag_v2.get(TILELENGTH) - if not isinstance(tilewidth, int) or not isinstance(h, int): - msg = "Invalid tile dimensions" - raise ValueError(msg) - w = tilewidth - - if w == xsize and h == ysize and self._planar_configuration != 2: - # Every tile covers the image. Only use the last offset - offsets = offsets[-1:] - - for offset in offsets: - if x + w > xsize: - stride = w * sum(bps_tuple) / 8 # bytes per line - else: - stride = 0 - - tile_rawmode = rawmode - if self._planar_configuration == 2: - # each band on it's own layer - tile_rawmode = rawmode[layer] - # adjust stride width accordingly - stride /= bps_count - - args = (tile_rawmode, int(stride), 1) - self.tile.append( - ImageFile._Tile( - self._compression, - (x, y, min(x + w, xsize), min(y + h, ysize)), - offset, - args, - ) - ) - x += w - if x >= xsize: - x, y = 0, y + h - if y >= ysize: - y = 0 - layer += 1 - else: - logger.debug("- unsupported data organization") - msg = "unknown data organization" - raise SyntaxError(msg) - - # Fix up info. - if ICCPROFILE in self.tag_v2: - self.info["icc_profile"] = self.tag_v2[ICCPROFILE] - - # fixup palette descriptor - - if self.mode in ["P", "PA"]: - palette = [o8(b // 256) for b in self.tag_v2[COLORMAP]] - self.palette = ImagePalette.raw("RGB;L", b"".join(palette)) - - -# -# -------------------------------------------------------------------- -# Write TIFF files - -# little endian is default except for image modes with -# explicit big endian byte-order - -SAVE_INFO = { - # mode => rawmode, byteorder, photometrics, - # sampleformat, bitspersample, extra - "1": ("1", II, 1, 1, (1,), None), - "L": ("L", II, 1, 1, (8,), None), - "LA": ("LA", II, 1, 1, (8, 8), 2), - "P": ("P", II, 3, 1, (8,), None), - "PA": ("PA", II, 3, 1, (8, 8), 2), - "I": ("I;32S", II, 1, 2, (32,), None), - "I;16": ("I;16", II, 1, 1, (16,), None), - "I;16L": ("I;16L", II, 1, 1, (16,), None), - "F": ("F;32F", II, 1, 3, (32,), None), - "RGB": ("RGB", II, 2, 1, (8, 8, 8), None), - "RGBX": ("RGBX", II, 2, 1, (8, 8, 8, 8), 0), - "RGBA": ("RGBA", II, 2, 1, (8, 8, 8, 8), 2), - "CMYK": ("CMYK", II, 5, 1, (8, 8, 8, 8), None), - "YCbCr": ("YCbCr", II, 6, 1, (8, 8, 8), None), - "LAB": ("LAB", II, 8, 1, (8, 8, 8), None), - "I;16B": ("I;16B", MM, 1, 1, (16,), None), -} - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - try: - rawmode, prefix, photo, format, bits, extra = SAVE_INFO[im.mode] - except KeyError as e: - msg = f"cannot write mode {im.mode} as TIFF" - raise OSError(msg) from e - - encoderinfo = im.encoderinfo - encoderconfig = im.encoderconfig - - ifd = ImageFileDirectory_v2(prefix=prefix) - if encoderinfo.get("big_tiff"): - ifd._bigtiff = True - - try: - compression = encoderinfo["compression"] - except KeyError: - compression = im.info.get("compression") - if isinstance(compression, int): - # compression value may be from BMP. Ignore it - compression = None - if compression is None: - compression = "raw" - elif compression == "tiff_jpeg": - # OJPEG is obsolete, so use new-style JPEG compression instead - compression = "jpeg" - elif compression == "tiff_deflate": - compression = "tiff_adobe_deflate" - - libtiff = WRITE_LIBTIFF or compression != "raw" - - # required for color libtiff images - ifd[PLANAR_CONFIGURATION] = 1 - - ifd[IMAGEWIDTH] = im.size[0] - ifd[IMAGELENGTH] = im.size[1] - - # write any arbitrary tags passed in as an ImageFileDirectory - if "tiffinfo" in encoderinfo: - info = encoderinfo["tiffinfo"] - elif "exif" in encoderinfo: - info = encoderinfo["exif"] - if isinstance(info, bytes): - exif = Image.Exif() - exif.load(info) - info = exif - else: - info = {} - logger.debug("Tiffinfo Keys: %s", list(info)) - if isinstance(info, ImageFileDirectory_v1): - info = info.to_v2() - for key in info: - if isinstance(info, Image.Exif) and key in TiffTags.TAGS_V2_GROUPS: - ifd[key] = info.get_ifd(key) - else: - ifd[key] = info.get(key) - try: - ifd.tagtype[key] = info.tagtype[key] - except Exception: - pass # might not be an IFD. Might not have populated type - - legacy_ifd = {} - if hasattr(im, "tag"): - legacy_ifd = im.tag.to_v2() - - supplied_tags = {**legacy_ifd, **getattr(im, "tag_v2", {})} - for tag in ( - # IFD offset that may not be correct in the saved image - EXIFIFD, - # Determined by the image format and should not be copied from legacy_ifd. - SAMPLEFORMAT, - ): - if tag in supplied_tags: - del supplied_tags[tag] - - # additions written by Greg Couch, gregc@cgl.ucsf.edu - # inspired by image-sig posting from Kevin Cazabon, kcazabon@home.com - if hasattr(im, "tag_v2"): - # preserve tags from original TIFF image file - for key in ( - RESOLUTION_UNIT, - X_RESOLUTION, - Y_RESOLUTION, - IPTC_NAA_CHUNK, - PHOTOSHOP_CHUNK, - XMP, - ): - if key in im.tag_v2: - if key == IPTC_NAA_CHUNK and im.tag_v2.tagtype[key] not in ( - TiffTags.BYTE, - TiffTags.UNDEFINED, - ): - del supplied_tags[key] - else: - ifd[key] = im.tag_v2[key] - ifd.tagtype[key] = im.tag_v2.tagtype[key] - - # preserve ICC profile (should also work when saving other formats - # which support profiles as TIFF) -- 2008-06-06 Florian Hoech - icc = encoderinfo.get("icc_profile", im.info.get("icc_profile")) - if icc: - ifd[ICCPROFILE] = icc - - for key, name in [ - (IMAGEDESCRIPTION, "description"), - (X_RESOLUTION, "resolution"), - (Y_RESOLUTION, "resolution"), - (X_RESOLUTION, "x_resolution"), - (Y_RESOLUTION, "y_resolution"), - (RESOLUTION_UNIT, "resolution_unit"), - (SOFTWARE, "software"), - (DATE_TIME, "date_time"), - (ARTIST, "artist"), - (COPYRIGHT, "copyright"), - ]: - if name in encoderinfo: - ifd[key] = encoderinfo[name] - - dpi = encoderinfo.get("dpi") - if dpi: - ifd[RESOLUTION_UNIT] = 2 - ifd[X_RESOLUTION] = dpi[0] - ifd[Y_RESOLUTION] = dpi[1] - - if bits != (1,): - ifd[BITSPERSAMPLE] = bits - if len(bits) != 1: - ifd[SAMPLESPERPIXEL] = len(bits) - if extra is not None: - ifd[EXTRASAMPLES] = extra - if format != 1: - ifd[SAMPLEFORMAT] = format - - if PHOTOMETRIC_INTERPRETATION not in ifd: - ifd[PHOTOMETRIC_INTERPRETATION] = photo - elif im.mode in ("1", "L") and ifd[PHOTOMETRIC_INTERPRETATION] == 0: - if im.mode == "1": - inverted_im = im.copy() - px = inverted_im.load() - if px is not None: - for y in range(inverted_im.height): - for x in range(inverted_im.width): - px[x, y] = 0 if px[x, y] == 255 else 255 - im = inverted_im - else: - im = ImageOps.invert(im) - - if im.mode in ["P", "PA"]: - lut = im.im.getpalette("RGB", "RGB;L") - colormap = [] - colors = len(lut) // 3 - for i in range(3): - colormap += [v * 256 for v in lut[colors * i : colors * (i + 1)]] - colormap += [0] * (256 - colors) - ifd[COLORMAP] = colormap - # data orientation - w, h = ifd[IMAGEWIDTH], ifd[IMAGELENGTH] - stride = len(bits) * ((w * bits[0] + 7) // 8) - if ROWSPERSTRIP not in ifd: - # aim for given strip size (64 KB by default) when using libtiff writer - if libtiff: - im_strip_size = encoderinfo.get("strip_size", STRIP_SIZE) - rows_per_strip = 1 if stride == 0 else min(im_strip_size // stride, h) - # JPEG encoder expects multiple of 8 rows - if compression == "jpeg": - rows_per_strip = min(((rows_per_strip + 7) // 8) * 8, h) - else: - rows_per_strip = h - if rows_per_strip == 0: - rows_per_strip = 1 - ifd[ROWSPERSTRIP] = rows_per_strip - strip_byte_counts = 1 if stride == 0 else stride * ifd[ROWSPERSTRIP] - strips_per_image = (h + ifd[ROWSPERSTRIP] - 1) // ifd[ROWSPERSTRIP] - if strip_byte_counts >= 2**16: - ifd.tagtype[STRIPBYTECOUNTS] = TiffTags.LONG - ifd[STRIPBYTECOUNTS] = (strip_byte_counts,) * (strips_per_image - 1) + ( - stride * h - strip_byte_counts * (strips_per_image - 1), - ) - ifd[STRIPOFFSETS] = tuple( - range(0, strip_byte_counts * strips_per_image, strip_byte_counts) - ) # this is adjusted by IFD writer - # no compression by default: - ifd[COMPRESSION] = COMPRESSION_INFO_REV.get(compression, 1) - - if im.mode == "YCbCr": - for tag, default_value in { - YCBCRSUBSAMPLING: (1, 1), - REFERENCEBLACKWHITE: (0, 255, 128, 255, 128, 255), - }.items(): - ifd.setdefault(tag, default_value) - - blocklist = [TILEWIDTH, TILELENGTH, TILEOFFSETS, TILEBYTECOUNTS] - if libtiff: - if "quality" in encoderinfo: - quality = encoderinfo["quality"] - if not isinstance(quality, int) or quality < 0 or quality > 100: - msg = "Invalid quality setting" - raise ValueError(msg) - if compression != "jpeg": - msg = "quality setting only supported for 'jpeg' compression" - raise ValueError(msg) - ifd[JPEGQUALITY] = quality - - logger.debug("Saving using libtiff encoder") - logger.debug("Items: %s", sorted(ifd.items())) - _fp = 0 - if hasattr(fp, "fileno"): - try: - fp.seek(0) - _fp = fp.fileno() - except io.UnsupportedOperation: - pass - - # optional types for non core tags - types = {} - # STRIPOFFSETS and STRIPBYTECOUNTS are added by the library - # based on the data in the strip. - # OSUBFILETYPE is deprecated. - # The other tags expect arrays with a certain length (fixed or depending on - # BITSPERSAMPLE, etc), passing arrays with a different length will result in - # segfaults. Block these tags until we add extra validation. - # SUBIFD may also cause a segfault. - blocklist += [ - OSUBFILETYPE, - REFERENCEBLACKWHITE, - STRIPBYTECOUNTS, - STRIPOFFSETS, - TRANSFERFUNCTION, - SUBIFD, - ] - - # bits per sample is a single short in the tiff directory, not a list. - atts: dict[int, Any] = {BITSPERSAMPLE: bits[0]} - # Merge the ones that we have with (optional) more bits from - # the original file, e.g x,y resolution so that we can - # save(load('')) == original file. - for tag, value in itertools.chain(ifd.items(), supplied_tags.items()): - # Libtiff can only process certain core items without adding - # them to the custom dictionary. - # Custom items are supported for int, float, unicode, string and byte - # values. Other types and tuples require a tagtype. - if tag not in TiffTags.LIBTIFF_CORE: - if not getattr(Image.core, "libtiff_support_custom_tags", False): - continue - - if tag in TiffTags.TAGS_V2_GROUPS: - types[tag] = TiffTags.LONG8 - elif tag in ifd.tagtype: - types[tag] = ifd.tagtype[tag] - elif not (isinstance(value, (int, float, str, bytes))): - continue - else: - type = TiffTags.lookup(tag).type - if type: - types[tag] = type - if tag not in atts and tag not in blocklist: - if isinstance(value, str): - atts[tag] = value.encode("ascii", "replace") + b"\0" - elif isinstance(value, IFDRational): - atts[tag] = float(value) - else: - atts[tag] = value - - if SAMPLEFORMAT in atts and len(atts[SAMPLEFORMAT]) == 1: - atts[SAMPLEFORMAT] = atts[SAMPLEFORMAT][0] - - logger.debug("Converted items: %s", sorted(atts.items())) - - # libtiff always expects the bytes in native order. - # we're storing image byte order. So, if the rawmode - # contains I;16, we need to convert from native to image - # byte order. - if im.mode in ("I;16", "I;16B", "I;16L"): - rawmode = "I;16N" - - # Pass tags as sorted list so that the tags are set in a fixed order. - # This is required by libtiff for some tags. For example, the JPEGQUALITY - # pseudo tag requires that the COMPRESS tag was already set. - tags = list(atts.items()) - tags.sort() - a = (rawmode, compression, _fp, filename, tags, types) - encoder = Image._getencoder(im.mode, "libtiff", a, encoderconfig) - encoder.setimage(im.im, (0, 0) + im.size) - while True: - errcode, data = encoder.encode(ImageFile.MAXBLOCK)[1:] - if not _fp: - fp.write(data) - if errcode: - break - if errcode < 0: - msg = f"encoder error {errcode} when writing image file" - raise OSError(msg) - - else: - for tag in blocklist: - del ifd[tag] - offset = ifd.save(fp) - - ImageFile._save( - im, - fp, - [ImageFile._Tile("raw", (0, 0) + im.size, offset, (rawmode, stride, 1))], - ) - - # -- helper for multi-page save -- - if "_debug_multipage" in encoderinfo: - # just to access o32 and o16 (using correct byte order) - setattr(im, "_debug_multipage", ifd) - - -class AppendingTiffWriter(io.BytesIO): - fieldSizes = [ - 0, # None - 1, # byte - 1, # ascii - 2, # short - 4, # long - 8, # rational - 1, # sbyte - 1, # undefined - 2, # sshort - 4, # slong - 8, # srational - 4, # float - 8, # double - 4, # ifd - 2, # unicode - 4, # complex - 8, # long8 - ] - - Tags = { - 273, # StripOffsets - 288, # FreeOffsets - 324, # TileOffsets - 519, # JPEGQTables - 520, # JPEGDCTables - 521, # JPEGACTables - } - - def __init__(self, fn: StrOrBytesPath | IO[bytes], new: bool = False) -> None: - self.f: IO[bytes] - if is_path(fn): - self.name = fn - self.close_fp = True - try: - self.f = open(fn, "w+b" if new else "r+b") - except OSError: - self.f = open(fn, "w+b") - else: - self.f = cast(IO[bytes], fn) - self.close_fp = False - self.beginning = self.f.tell() - self.setup() - - def setup(self) -> None: - # Reset everything. - self.f.seek(self.beginning, os.SEEK_SET) - - self.whereToWriteNewIFDOffset: int | None = None - self.offsetOfNewPage = 0 - - self.IIMM = iimm = self.f.read(4) - self._bigtiff = b"\x2b" in iimm - if not iimm: - # empty file - first page - self.isFirst = True - return - - self.isFirst = False - if iimm not in PREFIXES: - msg = "Invalid TIFF file header" - raise RuntimeError(msg) - - self.setEndian("<" if iimm.startswith(II) else ">") - - if self._bigtiff: - self.f.seek(4, os.SEEK_CUR) - self.skipIFDs() - self.goToEnd() - - def finalize(self) -> None: - if self.isFirst: - return - - # fix offsets - self.f.seek(self.offsetOfNewPage) - - iimm = self.f.read(4) - if not iimm: - # Make it easy to finish a frame without committing to a new one. - return - - if iimm != self.IIMM: - msg = "IIMM of new page doesn't match IIMM of first page" - raise RuntimeError(msg) - - if self._bigtiff: - self.f.seek(4, os.SEEK_CUR) - ifd_offset = self._read(8 if self._bigtiff else 4) - ifd_offset += self.offsetOfNewPage - assert self.whereToWriteNewIFDOffset is not None - self.f.seek(self.whereToWriteNewIFDOffset) - self._write(ifd_offset, 8 if self._bigtiff else 4) - self.f.seek(ifd_offset) - self.fixIFD() - - def newFrame(self) -> None: - # Call this to finish a frame. - self.finalize() - self.setup() - - def __enter__(self) -> AppendingTiffWriter: - return self - - def __exit__(self, *args: object) -> None: - if self.close_fp: - self.close() - - def tell(self) -> int: - return self.f.tell() - self.offsetOfNewPage - - def seek(self, offset: int, whence: int = io.SEEK_SET) -> int: - """ - :param offset: Distance to seek. - :param whence: Whether the distance is relative to the start, - end or current position. - :returns: The resulting position, relative to the start. - """ - if whence == os.SEEK_SET: - offset += self.offsetOfNewPage - - self.f.seek(offset, whence) - return self.tell() - - def goToEnd(self) -> None: - self.f.seek(0, os.SEEK_END) - pos = self.f.tell() - - # pad to 16 byte boundary - pad_bytes = 16 - pos % 16 - if 0 < pad_bytes < 16: - self.f.write(bytes(pad_bytes)) - self.offsetOfNewPage = self.f.tell() - - def setEndian(self, endian: str) -> None: - self.endian = endian - self.longFmt = f"{self.endian}L" - self.shortFmt = f"{self.endian}H" - self.tagFormat = f"{self.endian}HH" + ("Q" if self._bigtiff else "L") - - def skipIFDs(self) -> None: - while True: - ifd_offset = self._read(8 if self._bigtiff else 4) - if ifd_offset == 0: - self.whereToWriteNewIFDOffset = self.f.tell() - ( - 8 if self._bigtiff else 4 - ) - break - - self.f.seek(ifd_offset) - num_tags = self._read(8 if self._bigtiff else 2) - self.f.seek(num_tags * (20 if self._bigtiff else 12), os.SEEK_CUR) - - def write(self, data: Buffer, /) -> int: - return self.f.write(data) - - def _fmt(self, field_size: int) -> str: - try: - return {2: "H", 4: "L", 8: "Q"}[field_size] - except KeyError: - msg = "offset is not supported" - raise RuntimeError(msg) - - def _read(self, field_size: int) -> int: - (value,) = struct.unpack( - self.endian + self._fmt(field_size), self.f.read(field_size) - ) - return value - - def readShort(self) -> int: - return self._read(2) - - def readLong(self) -> int: - return self._read(4) - - @staticmethod - def _verify_bytes_written(bytes_written: int | None, expected: int) -> None: - if bytes_written is not None and bytes_written != expected: - msg = f"wrote only {bytes_written} bytes but wanted {expected}" - raise RuntimeError(msg) - - def _rewriteLast( - self, value: int, field_size: int, new_field_size: int = 0 - ) -> None: - self.f.seek(-field_size, os.SEEK_CUR) - if not new_field_size: - new_field_size = field_size - bytes_written = self.f.write( - struct.pack(self.endian + self._fmt(new_field_size), value) - ) - self._verify_bytes_written(bytes_written, new_field_size) - - def rewriteLastShortToLong(self, value: int) -> None: - self._rewriteLast(value, 2, 4) - - def rewriteLastShort(self, value: int) -> None: - return self._rewriteLast(value, 2) - - def rewriteLastLong(self, value: int) -> None: - return self._rewriteLast(value, 4) - - def _write(self, value: int, field_size: int) -> None: - bytes_written = self.f.write( - struct.pack(self.endian + self._fmt(field_size), value) - ) - self._verify_bytes_written(bytes_written, field_size) - - def writeShort(self, value: int) -> None: - self._write(value, 2) - - def writeLong(self, value: int) -> None: - self._write(value, 4) - - def close(self) -> None: - self.finalize() - if self.close_fp: - self.f.close() - - def fixIFD(self) -> None: - num_tags = self._read(8 if self._bigtiff else 2) - - for i in range(num_tags): - tag, field_type, count = struct.unpack( - self.tagFormat, self.f.read(12 if self._bigtiff else 8) - ) - - field_size = self.fieldSizes[field_type] - total_size = field_size * count - fmt_size = 8 if self._bigtiff else 4 - is_local = total_size <= fmt_size - if not is_local: - offset = self._read(fmt_size) + self.offsetOfNewPage - self._rewriteLast(offset, fmt_size) - - if tag in self.Tags: - cur_pos = self.f.tell() - - logger.debug( - "fixIFD: %s (%d) - type: %s (%d) - type size: %d - count: %d", - TiffTags.lookup(tag).name, - tag, - TYPES.get(field_type, "unknown"), - field_type, - field_size, - count, - ) - - if is_local: - self._fixOffsets(count, field_size) - self.f.seek(cur_pos + fmt_size) - else: - self.f.seek(offset) - self._fixOffsets(count, field_size) - self.f.seek(cur_pos) - - elif is_local: - # skip the locally stored value that is not an offset - self.f.seek(fmt_size, os.SEEK_CUR) - - def _fixOffsets(self, count: int, field_size: int) -> None: - for i in range(count): - offset = self._read(field_size) - offset += self.offsetOfNewPage - - new_field_size = 0 - if self._bigtiff and field_size in (2, 4) and offset >= 2**32: - # offset is now too large - we must convert long to long8 - new_field_size = 8 - elif field_size == 2 and offset >= 2**16: - # offset is now too large - we must convert short to long - new_field_size = 4 - if new_field_size: - if count != 1: - msg = "not implemented" - raise RuntimeError(msg) # XXX TODO - - # simple case - the offset is just one and therefore it is - # local (not referenced with another offset) - self._rewriteLast(offset, field_size, new_field_size) - # Move back past the new offset, past 'count', and before 'field_type' - rewind = -new_field_size - 4 - 2 - self.f.seek(rewind, os.SEEK_CUR) - self.writeShort(new_field_size) # rewrite the type - self.f.seek(2 - rewind, os.SEEK_CUR) - else: - self._rewriteLast(offset, field_size) - - def fixOffsets( - self, count: int, isShort: bool = False, isLong: bool = False - ) -> None: - if isShort: - field_size = 2 - elif isLong: - field_size = 4 - else: - field_size = 0 - return self._fixOffsets(count, field_size) - - -def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - append_images = list(im.encoderinfo.get("append_images", [])) - if not hasattr(im, "n_frames") and not append_images: - return _save(im, fp, filename) - - cur_idx = im.tell() - try: - with AppendingTiffWriter(fp) as tf: - for ims in [im] + append_images: - encoderinfo = ims._attach_default_encoderinfo(im) - if not hasattr(ims, "encoderconfig"): - ims.encoderconfig = () - nfr = getattr(ims, "n_frames", 1) - - for idx in range(nfr): - ims.seek(idx) - ims.load() - _save(ims, tf, filename) - tf.newFrame() - ims.encoderinfo = encoderinfo - finally: - im.seek(cur_idx) - - -# -# -------------------------------------------------------------------- -# Register - -Image.register_open(TiffImageFile.format, TiffImageFile, _accept) -Image.register_save(TiffImageFile.format, _save) -Image.register_save_all(TiffImageFile.format, _save_all) - -Image.register_extensions(TiffImageFile.format, [".tif", ".tiff"]) - -Image.register_mime(TiffImageFile.format, "image/tiff") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/TiffTags.py b/write-message/venv/lib/python3.10/site-packages/PIL/TiffTags.py deleted file mode 100644 index 86adaa4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/TiffTags.py +++ /dev/null @@ -1,562 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# TIFF tags -# -# This module provides clear-text names for various well-known -# TIFF tags. the TIFF codec works just fine without it. -# -# Copyright (c) Secret Labs AB 1999. -# -# See the README file for information on usage and redistribution. -# - -## -# This module provides constants and clear-text names for various -# well-known TIFF tags. -## -from __future__ import annotations - -from typing import NamedTuple - - -class _TagInfo(NamedTuple): - value: int | None - name: str - type: int | None - length: int | None - enum: dict[str, int] - - -class TagInfo(_TagInfo): - __slots__: list[str] = [] - - def __new__( - cls, - value: int | None = None, - name: str = "unknown", - type: int | None = None, - length: int | None = None, - enum: dict[str, int] | None = None, - ) -> TagInfo: - return super().__new__(cls, value, name, type, length, enum or {}) - - def cvt_enum(self, value: str) -> int | str: - # Using get will call hash(value), which can be expensive - # for some types (e.g. Fraction). Since self.enum is rarely - # used, it's usually better to test it first. - return self.enum.get(value, value) if self.enum else value - - -def lookup(tag: int, group: int | None = None) -> TagInfo: - """ - :param tag: Integer tag number - :param group: Which :py:data:`~PIL.TiffTags.TAGS_V2_GROUPS` to look in - - .. versionadded:: 8.3.0 - - :returns: Taginfo namedtuple, From the ``TAGS_V2`` info if possible, - otherwise just populating the value and name from ``TAGS``. - If the tag is not recognized, "unknown" is returned for the name - - """ - - if group is not None: - info = TAGS_V2_GROUPS[group].get(tag) if group in TAGS_V2_GROUPS else None - else: - info = TAGS_V2.get(tag) - return info or TagInfo(tag, TAGS.get(tag, "unknown")) - - -## -# Map tag numbers to tag info. -# -# id: (Name, Type, Length[, enum_values]) -# -# The length here differs from the length in the tiff spec. For -# numbers, the tiff spec is for the number of fields returned. We -# agree here. For string-like types, the tiff spec uses the length of -# field in bytes. In Pillow, we are using the number of expected -# fields, in general 1 for string-like types. - - -BYTE = 1 -ASCII = 2 -SHORT = 3 -LONG = 4 -RATIONAL = 5 -SIGNED_BYTE = 6 -UNDEFINED = 7 -SIGNED_SHORT = 8 -SIGNED_LONG = 9 -SIGNED_RATIONAL = 10 -FLOAT = 11 -DOUBLE = 12 -IFD = 13 -LONG8 = 16 - -_tags_v2: dict[int, tuple[str, int, int] | tuple[str, int, int, dict[str, int]]] = { - 254: ("NewSubfileType", LONG, 1), - 255: ("SubfileType", SHORT, 1), - 256: ("ImageWidth", LONG, 1), - 257: ("ImageLength", LONG, 1), - 258: ("BitsPerSample", SHORT, 0), - 259: ( - "Compression", - SHORT, - 1, - { - "Uncompressed": 1, - "CCITT 1d": 2, - "Group 3 Fax": 3, - "Group 4 Fax": 4, - "LZW": 5, - "JPEG": 6, - "PackBits": 32773, - }, - ), - 262: ( - "PhotometricInterpretation", - SHORT, - 1, - { - "WhiteIsZero": 0, - "BlackIsZero": 1, - "RGB": 2, - "RGB Palette": 3, - "Transparency Mask": 4, - "CMYK": 5, - "YCbCr": 6, - "CieLAB": 8, - "CFA": 32803, # TIFF/EP, Adobe DNG - "LinearRaw": 32892, # Adobe DNG - }, - ), - 263: ("Threshholding", SHORT, 1), - 264: ("CellWidth", SHORT, 1), - 265: ("CellLength", SHORT, 1), - 266: ("FillOrder", SHORT, 1), - 269: ("DocumentName", ASCII, 1), - 270: ("ImageDescription", ASCII, 1), - 271: ("Make", ASCII, 1), - 272: ("Model", ASCII, 1), - 273: ("StripOffsets", LONG, 0), - 274: ("Orientation", SHORT, 1), - 277: ("SamplesPerPixel", SHORT, 1), - 278: ("RowsPerStrip", LONG, 1), - 279: ("StripByteCounts", LONG, 0), - 280: ("MinSampleValue", SHORT, 0), - 281: ("MaxSampleValue", SHORT, 0), - 282: ("XResolution", RATIONAL, 1), - 283: ("YResolution", RATIONAL, 1), - 284: ("PlanarConfiguration", SHORT, 1, {"Contiguous": 1, "Separate": 2}), - 285: ("PageName", ASCII, 1), - 286: ("XPosition", RATIONAL, 1), - 287: ("YPosition", RATIONAL, 1), - 288: ("FreeOffsets", LONG, 1), - 289: ("FreeByteCounts", LONG, 1), - 290: ("GrayResponseUnit", SHORT, 1), - 291: ("GrayResponseCurve", SHORT, 0), - 292: ("T4Options", LONG, 1), - 293: ("T6Options", LONG, 1), - 296: ("ResolutionUnit", SHORT, 1, {"none": 1, "inch": 2, "cm": 3}), - 297: ("PageNumber", SHORT, 2), - 301: ("TransferFunction", SHORT, 0), - 305: ("Software", ASCII, 1), - 306: ("DateTime", ASCII, 1), - 315: ("Artist", ASCII, 1), - 316: ("HostComputer", ASCII, 1), - 317: ("Predictor", SHORT, 1, {"none": 1, "Horizontal Differencing": 2}), - 318: ("WhitePoint", RATIONAL, 2), - 319: ("PrimaryChromaticities", RATIONAL, 6), - 320: ("ColorMap", SHORT, 0), - 321: ("HalftoneHints", SHORT, 2), - 322: ("TileWidth", LONG, 1), - 323: ("TileLength", LONG, 1), - 324: ("TileOffsets", LONG, 0), - 325: ("TileByteCounts", LONG, 0), - 330: ("SubIFDs", LONG, 0), - 332: ("InkSet", SHORT, 1), - 333: ("InkNames", ASCII, 1), - 334: ("NumberOfInks", SHORT, 1), - 336: ("DotRange", SHORT, 0), - 337: ("TargetPrinter", ASCII, 1), - 338: ("ExtraSamples", SHORT, 0), - 339: ("SampleFormat", SHORT, 0), - 340: ("SMinSampleValue", DOUBLE, 0), - 341: ("SMaxSampleValue", DOUBLE, 0), - 342: ("TransferRange", SHORT, 6), - 347: ("JPEGTables", UNDEFINED, 1), - # obsolete JPEG tags - 512: ("JPEGProc", SHORT, 1), - 513: ("JPEGInterchangeFormat", LONG, 1), - 514: ("JPEGInterchangeFormatLength", LONG, 1), - 515: ("JPEGRestartInterval", SHORT, 1), - 517: ("JPEGLosslessPredictors", SHORT, 0), - 518: ("JPEGPointTransforms", SHORT, 0), - 519: ("JPEGQTables", LONG, 0), - 520: ("JPEGDCTables", LONG, 0), - 521: ("JPEGACTables", LONG, 0), - 529: ("YCbCrCoefficients", RATIONAL, 3), - 530: ("YCbCrSubSampling", SHORT, 2), - 531: ("YCbCrPositioning", SHORT, 1), - 532: ("ReferenceBlackWhite", RATIONAL, 6), - 700: ("XMP", BYTE, 0), - 33432: ("Copyright", ASCII, 1), - 33723: ("IptcNaaInfo", UNDEFINED, 1), - 34377: ("PhotoshopInfo", BYTE, 0), - # FIXME add more tags here - 34665: ("ExifIFD", LONG, 1), - 34675: ("ICCProfile", UNDEFINED, 1), - 34853: ("GPSInfoIFD", LONG, 1), - 36864: ("ExifVersion", UNDEFINED, 1), - 37724: ("ImageSourceData", UNDEFINED, 1), - 40965: ("InteroperabilityIFD", LONG, 1), - 41730: ("CFAPattern", UNDEFINED, 1), - # MPInfo - 45056: ("MPFVersion", UNDEFINED, 1), - 45057: ("NumberOfImages", LONG, 1), - 45058: ("MPEntry", UNDEFINED, 1), - 45059: ("ImageUIDList", UNDEFINED, 0), # UNDONE, check - 45060: ("TotalFrames", LONG, 1), - 45313: ("MPIndividualNum", LONG, 1), - 45569: ("PanOrientation", LONG, 1), - 45570: ("PanOverlap_H", RATIONAL, 1), - 45571: ("PanOverlap_V", RATIONAL, 1), - 45572: ("BaseViewpointNum", LONG, 1), - 45573: ("ConvergenceAngle", SIGNED_RATIONAL, 1), - 45574: ("BaselineLength", RATIONAL, 1), - 45575: ("VerticalDivergence", SIGNED_RATIONAL, 1), - 45576: ("AxisDistance_X", SIGNED_RATIONAL, 1), - 45577: ("AxisDistance_Y", SIGNED_RATIONAL, 1), - 45578: ("AxisDistance_Z", SIGNED_RATIONAL, 1), - 45579: ("YawAngle", SIGNED_RATIONAL, 1), - 45580: ("PitchAngle", SIGNED_RATIONAL, 1), - 45581: ("RollAngle", SIGNED_RATIONAL, 1), - 40960: ("FlashPixVersion", UNDEFINED, 1), - 50741: ("MakerNoteSafety", SHORT, 1, {"Unsafe": 0, "Safe": 1}), - 50780: ("BestQualityScale", RATIONAL, 1), - 50838: ("ImageJMetaDataByteCounts", LONG, 0), # Can be more than one - 50839: ("ImageJMetaData", UNDEFINED, 1), # see Issue #2006 -} -_tags_v2_groups = { - # ExifIFD - 34665: { - 36864: ("ExifVersion", UNDEFINED, 1), - 40960: ("FlashPixVersion", UNDEFINED, 1), - 40965: ("InteroperabilityIFD", LONG, 1), - 41730: ("CFAPattern", UNDEFINED, 1), - }, - # GPSInfoIFD - 34853: { - 0: ("GPSVersionID", BYTE, 4), - 1: ("GPSLatitudeRef", ASCII, 2), - 2: ("GPSLatitude", RATIONAL, 3), - 3: ("GPSLongitudeRef", ASCII, 2), - 4: ("GPSLongitude", RATIONAL, 3), - 5: ("GPSAltitudeRef", BYTE, 1), - 6: ("GPSAltitude", RATIONAL, 1), - 7: ("GPSTimeStamp", RATIONAL, 3), - 8: ("GPSSatellites", ASCII, 0), - 9: ("GPSStatus", ASCII, 2), - 10: ("GPSMeasureMode", ASCII, 2), - 11: ("GPSDOP", RATIONAL, 1), - 12: ("GPSSpeedRef", ASCII, 2), - 13: ("GPSSpeed", RATIONAL, 1), - 14: ("GPSTrackRef", ASCII, 2), - 15: ("GPSTrack", RATIONAL, 1), - 16: ("GPSImgDirectionRef", ASCII, 2), - 17: ("GPSImgDirection", RATIONAL, 1), - 18: ("GPSMapDatum", ASCII, 0), - 19: ("GPSDestLatitudeRef", ASCII, 2), - 20: ("GPSDestLatitude", RATIONAL, 3), - 21: ("GPSDestLongitudeRef", ASCII, 2), - 22: ("GPSDestLongitude", RATIONAL, 3), - 23: ("GPSDestBearingRef", ASCII, 2), - 24: ("GPSDestBearing", RATIONAL, 1), - 25: ("GPSDestDistanceRef", ASCII, 2), - 26: ("GPSDestDistance", RATIONAL, 1), - 27: ("GPSProcessingMethod", UNDEFINED, 0), - 28: ("GPSAreaInformation", UNDEFINED, 0), - 29: ("GPSDateStamp", ASCII, 11), - 30: ("GPSDifferential", SHORT, 1), - }, - # InteroperabilityIFD - 40965: {1: ("InteropIndex", ASCII, 1), 2: ("InteropVersion", UNDEFINED, 1)}, -} - -# Legacy Tags structure -# these tags aren't included above, but were in the previous versions -TAGS: dict[int | tuple[int, int], str] = { - 347: "JPEGTables", - 700: "XMP", - # Additional Exif Info - 32932: "Wang Annotation", - 33434: "ExposureTime", - 33437: "FNumber", - 33445: "MD FileTag", - 33446: "MD ScalePixel", - 33447: "MD ColorTable", - 33448: "MD LabName", - 33449: "MD SampleInfo", - 33450: "MD PrepDate", - 33451: "MD PrepTime", - 33452: "MD FileUnits", - 33550: "ModelPixelScaleTag", - 33723: "IptcNaaInfo", - 33918: "INGR Packet Data Tag", - 33919: "INGR Flag Registers", - 33920: "IrasB Transformation Matrix", - 33922: "ModelTiepointTag", - 34264: "ModelTransformationTag", - 34377: "PhotoshopInfo", - 34735: "GeoKeyDirectoryTag", - 34736: "GeoDoubleParamsTag", - 34737: "GeoAsciiParamsTag", - 34850: "ExposureProgram", - 34852: "SpectralSensitivity", - 34855: "ISOSpeedRatings", - 34856: "OECF", - 34864: "SensitivityType", - 34865: "StandardOutputSensitivity", - 34866: "RecommendedExposureIndex", - 34867: "ISOSpeed", - 34868: "ISOSpeedLatitudeyyy", - 34869: "ISOSpeedLatitudezzz", - 34908: "HylaFAX FaxRecvParams", - 34909: "HylaFAX FaxSubAddress", - 34910: "HylaFAX FaxRecvTime", - 36864: "ExifVersion", - 36867: "DateTimeOriginal", - 36868: "DateTimeDigitized", - 37121: "ComponentsConfiguration", - 37122: "CompressedBitsPerPixel", - 37724: "ImageSourceData", - 37377: "ShutterSpeedValue", - 37378: "ApertureValue", - 37379: "BrightnessValue", - 37380: "ExposureBiasValue", - 37381: "MaxApertureValue", - 37382: "SubjectDistance", - 37383: "MeteringMode", - 37384: "LightSource", - 37385: "Flash", - 37386: "FocalLength", - 37396: "SubjectArea", - 37500: "MakerNote", - 37510: "UserComment", - 37520: "SubSec", - 37521: "SubSecTimeOriginal", - 37522: "SubsecTimeDigitized", - 40960: "FlashPixVersion", - 40961: "ColorSpace", - 40962: "PixelXDimension", - 40963: "PixelYDimension", - 40964: "RelatedSoundFile", - 40965: "InteroperabilityIFD", - 41483: "FlashEnergy", - 41484: "SpatialFrequencyResponse", - 41486: "FocalPlaneXResolution", - 41487: "FocalPlaneYResolution", - 41488: "FocalPlaneResolutionUnit", - 41492: "SubjectLocation", - 41493: "ExposureIndex", - 41495: "SensingMethod", - 41728: "FileSource", - 41729: "SceneType", - 41730: "CFAPattern", - 41985: "CustomRendered", - 41986: "ExposureMode", - 41987: "WhiteBalance", - 41988: "DigitalZoomRatio", - 41989: "FocalLengthIn35mmFilm", - 41990: "SceneCaptureType", - 41991: "GainControl", - 41992: "Contrast", - 41993: "Saturation", - 41994: "Sharpness", - 41995: "DeviceSettingDescription", - 41996: "SubjectDistanceRange", - 42016: "ImageUniqueID", - 42032: "CameraOwnerName", - 42033: "BodySerialNumber", - 42034: "LensSpecification", - 42035: "LensMake", - 42036: "LensModel", - 42037: "LensSerialNumber", - 42112: "GDAL_METADATA", - 42113: "GDAL_NODATA", - 42240: "Gamma", - 50215: "Oce Scanjob Description", - 50216: "Oce Application Selector", - 50217: "Oce Identification Number", - 50218: "Oce ImageLogic Characteristics", - # Adobe DNG - 50706: "DNGVersion", - 50707: "DNGBackwardVersion", - 50708: "UniqueCameraModel", - 50709: "LocalizedCameraModel", - 50710: "CFAPlaneColor", - 50711: "CFALayout", - 50712: "LinearizationTable", - 50713: "BlackLevelRepeatDim", - 50714: "BlackLevel", - 50715: "BlackLevelDeltaH", - 50716: "BlackLevelDeltaV", - 50717: "WhiteLevel", - 50718: "DefaultScale", - 50719: "DefaultCropOrigin", - 50720: "DefaultCropSize", - 50721: "ColorMatrix1", - 50722: "ColorMatrix2", - 50723: "CameraCalibration1", - 50724: "CameraCalibration2", - 50725: "ReductionMatrix1", - 50726: "ReductionMatrix2", - 50727: "AnalogBalance", - 50728: "AsShotNeutral", - 50729: "AsShotWhiteXY", - 50730: "BaselineExposure", - 50731: "BaselineNoise", - 50732: "BaselineSharpness", - 50733: "BayerGreenSplit", - 50734: "LinearResponseLimit", - 50735: "CameraSerialNumber", - 50736: "LensInfo", - 50737: "ChromaBlurRadius", - 50738: "AntiAliasStrength", - 50740: "DNGPrivateData", - 50778: "CalibrationIlluminant1", - 50779: "CalibrationIlluminant2", - 50784: "Alias Layer Metadata", -} - -TAGS_V2: dict[int, TagInfo] = {} -TAGS_V2_GROUPS: dict[int, dict[int, TagInfo]] = {} - - -def _populate() -> None: - for k, v in _tags_v2.items(): - # Populate legacy structure. - TAGS[k] = v[0] - if len(v) == 4: - for sk, sv in v[3].items(): - TAGS[(k, sv)] = sk - - TAGS_V2[k] = TagInfo(k, *v) - - for group, tags in _tags_v2_groups.items(): - TAGS_V2_GROUPS[group] = {k: TagInfo(k, *v) for k, v in tags.items()} - - -_populate() -## -# Map type numbers to type names -- defined in ImageFileDirectory. - -TYPES: dict[int, str] = {} - -# -# These tags are handled by default in libtiff, without -# adding to the custom dictionary. From tif_dir.c, searching for -# case TIFFTAG in the _TIFFVSetField function: -# Line: item. -# 148: case TIFFTAG_SUBFILETYPE: -# 151: case TIFFTAG_IMAGEWIDTH: -# 154: case TIFFTAG_IMAGELENGTH: -# 157: case TIFFTAG_BITSPERSAMPLE: -# 181: case TIFFTAG_COMPRESSION: -# 202: case TIFFTAG_PHOTOMETRIC: -# 205: case TIFFTAG_THRESHHOLDING: -# 208: case TIFFTAG_FILLORDER: -# 214: case TIFFTAG_ORIENTATION: -# 221: case TIFFTAG_SAMPLESPERPIXEL: -# 228: case TIFFTAG_ROWSPERSTRIP: -# 238: case TIFFTAG_MINSAMPLEVALUE: -# 241: case TIFFTAG_MAXSAMPLEVALUE: -# 244: case TIFFTAG_SMINSAMPLEVALUE: -# 247: case TIFFTAG_SMAXSAMPLEVALUE: -# 250: case TIFFTAG_XRESOLUTION: -# 256: case TIFFTAG_YRESOLUTION: -# 262: case TIFFTAG_PLANARCONFIG: -# 268: case TIFFTAG_XPOSITION: -# 271: case TIFFTAG_YPOSITION: -# 274: case TIFFTAG_RESOLUTIONUNIT: -# 280: case TIFFTAG_PAGENUMBER: -# 284: case TIFFTAG_HALFTONEHINTS: -# 288: case TIFFTAG_COLORMAP: -# 294: case TIFFTAG_EXTRASAMPLES: -# 298: case TIFFTAG_MATTEING: -# 305: case TIFFTAG_TILEWIDTH: -# 316: case TIFFTAG_TILELENGTH: -# 327: case TIFFTAG_TILEDEPTH: -# 333: case TIFFTAG_DATATYPE: -# 344: case TIFFTAG_SAMPLEFORMAT: -# 361: case TIFFTAG_IMAGEDEPTH: -# 364: case TIFFTAG_SUBIFD: -# 376: case TIFFTAG_YCBCRPOSITIONING: -# 379: case TIFFTAG_YCBCRSUBSAMPLING: -# 383: case TIFFTAG_TRANSFERFUNCTION: -# 389: case TIFFTAG_REFERENCEBLACKWHITE: -# 393: case TIFFTAG_INKNAMES: - -# Following pseudo-tags are also handled by default in libtiff: -# TIFFTAG_JPEGQUALITY 65537 - -# some of these are not in our TAGS_V2 dict and were included from tiff.h - -# This list also exists in encode.c -LIBTIFF_CORE = { - 255, - 256, - 257, - 258, - 259, - 262, - 263, - 266, - 274, - 277, - 278, - 280, - 281, - 340, - 341, - 282, - 283, - 284, - 286, - 287, - 296, - 297, - 321, - 320, - 338, - 32995, - 322, - 323, - 32998, - 32996, - 339, - 32997, - 330, - 531, - 530, - 301, - 532, - 333, - # as above - 269, # this has been in our tests forever, and works - 65537, -} - -LIBTIFF_CORE.remove(255) # We don't have support for subfiletypes -LIBTIFF_CORE.remove(322) # We don't have support for writing tiled images with libtiff -LIBTIFF_CORE.remove(323) # Tiled images -LIBTIFF_CORE.remove(333) # Ink Names either - -# Note to advanced users: There may be combinations of these -# parameters and values that when added properly, will work and -# produce valid tiff images that may work in your application. -# It is safe to add and remove tags from this set from Pillow's point -# of view so long as you test against libtiff. diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/WalImageFile.py b/write-message/venv/lib/python3.10/site-packages/PIL/WalImageFile.py deleted file mode 100644 index 87e3287..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/WalImageFile.py +++ /dev/null @@ -1,127 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# WAL file handling -# -# History: -# 2003-04-23 fl created -# -# Copyright (c) 2003 by Fredrik Lundh. -# -# See the README file for information on usage and redistribution. -# - -""" -This reader is based on the specification available from: -https://www.flipcode.com/archives/Quake_2_BSP_File_Format.shtml -and has been tested with a few sample files found using google. - -.. note:: - This format cannot be automatically recognized, so the reader - is not registered for use with :py:func:`PIL.Image.open()`. - To open a WAL file, use the :py:func:`PIL.WalImageFile.open()` function instead. -""" -from __future__ import annotations - -from typing import IO - -from . import Image, ImageFile -from ._binary import i32le as i32 -from ._typing import StrOrBytesPath - - -class WalImageFile(ImageFile.ImageFile): - format = "WAL" - format_description = "Quake2 Texture" - - def _open(self) -> None: - self._mode = "P" - - # read header fields - header = self.fp.read(32 + 24 + 32 + 12) - self._size = i32(header, 32), i32(header, 36) - Image._decompression_bomb_check(self.size) - - # load pixel data - offset = i32(header, 40) - self.fp.seek(offset) - - # strings are null-terminated - self.info["name"] = header[:32].split(b"\0", 1)[0] - next_name = header[56 : 56 + 32].split(b"\0", 1)[0] - if next_name: - self.info["next_name"] = next_name - - def load(self) -> Image.core.PixelAccess | None: - if self._im is None: - self.im = Image.core.new(self.mode, self.size) - self.frombytes(self.fp.read(self.size[0] * self.size[1])) - self.putpalette(quake2palette) - return Image.Image.load(self) - - -def open(filename: StrOrBytesPath | IO[bytes]) -> WalImageFile: - """ - Load texture from a Quake2 WAL texture file. - - By default, a Quake2 standard palette is attached to the texture. - To override the palette, use the :py:func:`PIL.Image.Image.putpalette()` method. - - :param filename: WAL file name, or an opened file handle. - :returns: An image instance. - """ - return WalImageFile(filename) - - -quake2palette = ( - # default palette taken from piffo 0.93 by Hans Häggström - b"\x01\x01\x01\x0b\x0b\x0b\x12\x12\x12\x17\x17\x17\x1b\x1b\x1b\x1e" - b"\x1e\x1e\x22\x22\x22\x26\x26\x26\x29\x29\x29\x2c\x2c\x2c\x2f\x2f" - b"\x2f\x32\x32\x32\x35\x35\x35\x37\x37\x37\x3a\x3a\x3a\x3c\x3c\x3c" - b"\x24\x1e\x13\x22\x1c\x12\x20\x1b\x12\x1f\x1a\x10\x1d\x19\x10\x1b" - b"\x17\x0f\x1a\x16\x0f\x18\x14\x0d\x17\x13\x0d\x16\x12\x0d\x14\x10" - b"\x0b\x13\x0f\x0b\x10\x0d\x0a\x0f\x0b\x0a\x0d\x0b\x07\x0b\x0a\x07" - b"\x23\x23\x26\x22\x22\x25\x22\x20\x23\x21\x1f\x22\x20\x1e\x20\x1f" - b"\x1d\x1e\x1d\x1b\x1c\x1b\x1a\x1a\x1a\x19\x19\x18\x17\x17\x17\x16" - b"\x16\x14\x14\x14\x13\x13\x13\x10\x10\x10\x0f\x0f\x0f\x0d\x0d\x0d" - b"\x2d\x28\x20\x29\x24\x1c\x27\x22\x1a\x25\x1f\x17\x38\x2e\x1e\x31" - b"\x29\x1a\x2c\x25\x17\x26\x20\x14\x3c\x30\x14\x37\x2c\x13\x33\x28" - b"\x12\x2d\x24\x10\x28\x1f\x0f\x22\x1a\x0b\x1b\x14\x0a\x13\x0f\x07" - b"\x31\x1a\x16\x30\x17\x13\x2e\x16\x10\x2c\x14\x0d\x2a\x12\x0b\x27" - b"\x0f\x0a\x25\x0f\x07\x21\x0d\x01\x1e\x0b\x01\x1c\x0b\x01\x1a\x0b" - b"\x01\x18\x0a\x01\x16\x0a\x01\x13\x0a\x01\x10\x07\x01\x0d\x07\x01" - b"\x29\x23\x1e\x27\x21\x1c\x26\x20\x1b\x25\x1f\x1a\x23\x1d\x19\x21" - b"\x1c\x18\x20\x1b\x17\x1e\x19\x16\x1c\x18\x14\x1b\x17\x13\x19\x14" - b"\x10\x17\x13\x0f\x14\x10\x0d\x12\x0f\x0b\x0f\x0b\x0a\x0b\x0a\x07" - b"\x26\x1a\x0f\x23\x19\x0f\x20\x17\x0f\x1c\x16\x0f\x19\x13\x0d\x14" - b"\x10\x0b\x10\x0d\x0a\x0b\x0a\x07\x33\x22\x1f\x35\x29\x26\x37\x2f" - b"\x2d\x39\x35\x34\x37\x39\x3a\x33\x37\x39\x30\x34\x36\x2b\x31\x34" - b"\x27\x2e\x31\x22\x2b\x2f\x1d\x28\x2c\x17\x25\x2a\x0f\x20\x26\x0d" - b"\x1e\x25\x0b\x1c\x22\x0a\x1b\x20\x07\x19\x1e\x07\x17\x1b\x07\x14" - b"\x18\x01\x12\x16\x01\x0f\x12\x01\x0b\x0d\x01\x07\x0a\x01\x01\x01" - b"\x2c\x21\x21\x2a\x1f\x1f\x29\x1d\x1d\x27\x1c\x1c\x26\x1a\x1a\x24" - b"\x18\x18\x22\x17\x17\x21\x16\x16\x1e\x13\x13\x1b\x12\x12\x18\x10" - b"\x10\x16\x0d\x0d\x12\x0b\x0b\x0d\x0a\x0a\x0a\x07\x07\x01\x01\x01" - b"\x2e\x30\x29\x2d\x2e\x27\x2b\x2c\x26\x2a\x2a\x24\x28\x29\x23\x27" - b"\x27\x21\x26\x26\x1f\x24\x24\x1d\x22\x22\x1c\x1f\x1f\x1a\x1c\x1c" - b"\x18\x19\x19\x16\x17\x17\x13\x13\x13\x10\x0f\x0f\x0d\x0b\x0b\x0a" - b"\x30\x1e\x1b\x2d\x1c\x19\x2c\x1a\x17\x2a\x19\x14\x28\x17\x13\x26" - b"\x16\x10\x24\x13\x0f\x21\x12\x0d\x1f\x10\x0b\x1c\x0f\x0a\x19\x0d" - b"\x0a\x16\x0b\x07\x12\x0a\x07\x0f\x07\x01\x0a\x01\x01\x01\x01\x01" - b"\x28\x29\x38\x26\x27\x36\x25\x26\x34\x24\x24\x31\x22\x22\x2f\x20" - b"\x21\x2d\x1e\x1f\x2a\x1d\x1d\x27\x1b\x1b\x25\x19\x19\x21\x17\x17" - b"\x1e\x14\x14\x1b\x13\x12\x17\x10\x0f\x13\x0d\x0b\x0f\x0a\x07\x07" - b"\x2f\x32\x29\x2d\x30\x26\x2b\x2e\x24\x29\x2c\x21\x27\x2a\x1e\x25" - b"\x28\x1c\x23\x26\x1a\x21\x25\x18\x1e\x22\x14\x1b\x1f\x10\x19\x1c" - b"\x0d\x17\x1a\x0a\x13\x17\x07\x10\x13\x01\x0d\x0f\x01\x0a\x0b\x01" - b"\x01\x3f\x01\x13\x3c\x0b\x1b\x39\x10\x20\x35\x14\x23\x31\x17\x23" - b"\x2d\x18\x23\x29\x18\x3f\x3f\x3f\x3f\x3f\x39\x3f\x3f\x31\x3f\x3f" - b"\x2a\x3f\x3f\x20\x3f\x3f\x14\x3f\x3c\x12\x3f\x39\x0f\x3f\x35\x0b" - b"\x3f\x32\x07\x3f\x2d\x01\x3d\x2a\x01\x3b\x26\x01\x39\x21\x01\x37" - b"\x1d\x01\x34\x1a\x01\x32\x16\x01\x2f\x12\x01\x2d\x0f\x01\x2a\x0b" - b"\x01\x27\x07\x01\x23\x01\x01\x1d\x01\x01\x17\x01\x01\x10\x01\x01" - b"\x3d\x01\x01\x19\x19\x3f\x3f\x01\x01\x01\x01\x3f\x16\x16\x13\x10" - b"\x10\x0f\x0d\x0d\x0b\x3c\x2e\x2a\x36\x27\x20\x30\x21\x18\x29\x1b" - b"\x10\x3c\x39\x37\x37\x32\x2f\x31\x2c\x28\x2b\x26\x21\x30\x22\x20" -) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/WebPImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/WebPImagePlugin.py deleted file mode 100644 index 1716a18..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/WebPImagePlugin.py +++ /dev/null @@ -1,320 +0,0 @@ -from __future__ import annotations - -from io import BytesIO -from typing import IO, Any - -from . import Image, ImageFile - -try: - from . import _webp - - SUPPORTED = True -except ImportError: - SUPPORTED = False - - -_VP8_MODES_BY_IDENTIFIER = { - b"VP8 ": "RGB", - b"VP8X": "RGBA", - b"VP8L": "RGBA", # lossless -} - - -def _accept(prefix: bytes) -> bool | str: - is_riff_file_format = prefix.startswith(b"RIFF") - is_webp_file = prefix[8:12] == b"WEBP" - is_valid_vp8_mode = prefix[12:16] in _VP8_MODES_BY_IDENTIFIER - - if is_riff_file_format and is_webp_file and is_valid_vp8_mode: - if not SUPPORTED: - return ( - "image file could not be identified because WEBP support not installed" - ) - return True - return False - - -class WebPImageFile(ImageFile.ImageFile): - format = "WEBP" - format_description = "WebP image" - __loaded = 0 - __logical_frame = 0 - - def _open(self) -> None: - # Use the newer AnimDecoder API to parse the (possibly) animated file, - # and access muxed chunks like ICC/EXIF/XMP. - self._decoder = _webp.WebPAnimDecoder(self.fp.read()) - - # Get info from decoder - self._size, loop_count, bgcolor, frame_count, mode = self._decoder.get_info() - self.info["loop"] = loop_count - bg_a, bg_r, bg_g, bg_b = ( - (bgcolor >> 24) & 0xFF, - (bgcolor >> 16) & 0xFF, - (bgcolor >> 8) & 0xFF, - bgcolor & 0xFF, - ) - self.info["background"] = (bg_r, bg_g, bg_b, bg_a) - self.n_frames = frame_count - self.is_animated = self.n_frames > 1 - self._mode = "RGB" if mode == "RGBX" else mode - self.rawmode = mode - - # Attempt to read ICC / EXIF / XMP chunks from file - icc_profile = self._decoder.get_chunk("ICCP") - exif = self._decoder.get_chunk("EXIF") - xmp = self._decoder.get_chunk("XMP ") - if icc_profile: - self.info["icc_profile"] = icc_profile - if exif: - self.info["exif"] = exif - if xmp: - self.info["xmp"] = xmp - - # Initialize seek state - self._reset(reset=False) - - def _getexif(self) -> dict[int, Any] | None: - if "exif" not in self.info: - return None - return self.getexif()._get_merged_dict() - - def seek(self, frame: int) -> None: - if not self._seek_check(frame): - return - - # Set logical frame to requested position - self.__logical_frame = frame - - def _reset(self, reset: bool = True) -> None: - if reset: - self._decoder.reset() - self.__physical_frame = 0 - self.__loaded = -1 - self.__timestamp = 0 - - def _get_next(self) -> tuple[bytes, int, int]: - # Get next frame - ret = self._decoder.get_next() - self.__physical_frame += 1 - - # Check if an error occurred - if ret is None: - self._reset() # Reset just to be safe - self.seek(0) - msg = "failed to decode next frame in WebP file" - raise EOFError(msg) - - # Compute duration - data, timestamp = ret - duration = timestamp - self.__timestamp - self.__timestamp = timestamp - - # libwebp gives frame end, adjust to start of frame - timestamp -= duration - return data, timestamp, duration - - def _seek(self, frame: int) -> None: - if self.__physical_frame == frame: - return # Nothing to do - if frame < self.__physical_frame: - self._reset() # Rewind to beginning - while self.__physical_frame < frame: - self._get_next() # Advance to the requested frame - - def load(self) -> Image.core.PixelAccess | None: - if self.__loaded != self.__logical_frame: - self._seek(self.__logical_frame) - - # We need to load the image data for this frame - data, timestamp, duration = self._get_next() - self.info["timestamp"] = timestamp - self.info["duration"] = duration - self.__loaded = self.__logical_frame - - # Set tile - if self.fp and self._exclusive_fp: - self.fp.close() - self.fp = BytesIO(data) - self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.rawmode)] - - return super().load() - - def load_seek(self, pos: int) -> None: - pass - - def tell(self) -> int: - return self.__logical_frame - - -def _convert_frame(im: Image.Image) -> Image.Image: - # Make sure image mode is supported - if im.mode not in ("RGBX", "RGBA", "RGB"): - im = im.convert("RGBA" if im.has_transparency_data else "RGB") - return im - - -def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - encoderinfo = im.encoderinfo.copy() - append_images = list(encoderinfo.get("append_images", [])) - - # If total frame count is 1, then save using the legacy API, which - # will preserve non-alpha modes - total = 0 - for ims in [im] + append_images: - total += getattr(ims, "n_frames", 1) - if total == 1: - _save(im, fp, filename) - return - - background: int | tuple[int, ...] = (0, 0, 0, 0) - if "background" in encoderinfo: - background = encoderinfo["background"] - elif "background" in im.info: - background = im.info["background"] - if isinstance(background, int): - # GifImagePlugin stores a global color table index in - # info["background"]. So it must be converted to an RGBA value - palette = im.getpalette() - if palette: - r, g, b = palette[background * 3 : (background + 1) * 3] - background = (r, g, b, 255) - else: - background = (background, background, background, 255) - - duration = im.encoderinfo.get("duration", im.info.get("duration", 0)) - loop = im.encoderinfo.get("loop", 0) - minimize_size = im.encoderinfo.get("minimize_size", False) - kmin = im.encoderinfo.get("kmin", None) - kmax = im.encoderinfo.get("kmax", None) - allow_mixed = im.encoderinfo.get("allow_mixed", False) - verbose = False - lossless = im.encoderinfo.get("lossless", False) - quality = im.encoderinfo.get("quality", 80) - alpha_quality = im.encoderinfo.get("alpha_quality", 100) - method = im.encoderinfo.get("method", 0) - icc_profile = im.encoderinfo.get("icc_profile") or "" - exif = im.encoderinfo.get("exif", "") - if isinstance(exif, Image.Exif): - exif = exif.tobytes() - xmp = im.encoderinfo.get("xmp", "") - if allow_mixed: - lossless = False - - # Sensible keyframe defaults are from gif2webp.c script - if kmin is None: - kmin = 9 if lossless else 3 - if kmax is None: - kmax = 17 if lossless else 5 - - # Validate background color - if ( - not isinstance(background, (list, tuple)) - or len(background) != 4 - or not all(0 <= v < 256 for v in background) - ): - msg = f"Background color is not an RGBA tuple clamped to (0-255): {background}" - raise OSError(msg) - - # Convert to packed uint - bg_r, bg_g, bg_b, bg_a = background - background = (bg_a << 24) | (bg_r << 16) | (bg_g << 8) | (bg_b << 0) - - # Setup the WebP animation encoder - enc = _webp.WebPAnimEncoder( - im.size, - background, - loop, - minimize_size, - kmin, - kmax, - allow_mixed, - verbose, - ) - - # Add each frame - frame_idx = 0 - timestamp = 0 - cur_idx = im.tell() - try: - for ims in [im] + append_images: - # Get number of frames in this image - nfr = getattr(ims, "n_frames", 1) - - for idx in range(nfr): - ims.seek(idx) - - frame = _convert_frame(ims) - - # Append the frame to the animation encoder - enc.add( - frame.getim(), - round(timestamp), - lossless, - quality, - alpha_quality, - method, - ) - - # Update timestamp and frame index - if isinstance(duration, (list, tuple)): - timestamp += duration[frame_idx] - else: - timestamp += duration - frame_idx += 1 - - finally: - im.seek(cur_idx) - - # Force encoder to flush frames - enc.add(None, round(timestamp), lossless, quality, alpha_quality, 0) - - # Get the final output from the encoder - data = enc.assemble(icc_profile, exif, xmp) - if data is None: - msg = "cannot write file as WebP (encoder returned None)" - raise OSError(msg) - - fp.write(data) - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - lossless = im.encoderinfo.get("lossless", False) - quality = im.encoderinfo.get("quality", 80) - alpha_quality = im.encoderinfo.get("alpha_quality", 100) - icc_profile = im.encoderinfo.get("icc_profile") or "" - exif = im.encoderinfo.get("exif", b"") - if isinstance(exif, Image.Exif): - exif = exif.tobytes() - if exif.startswith(b"Exif\x00\x00"): - exif = exif[6:] - xmp = im.encoderinfo.get("xmp", "") - method = im.encoderinfo.get("method", 4) - exact = 1 if im.encoderinfo.get("exact") else 0 - - im = _convert_frame(im) - - data = _webp.WebPEncode( - im.getim(), - lossless, - float(quality), - float(alpha_quality), - icc_profile, - method, - exact, - exif, - xmp, - ) - if data is None: - msg = "cannot write file as WebP (encoder returned None)" - raise OSError(msg) - - fp.write(data) - - -Image.register_open(WebPImageFile.format, WebPImageFile, _accept) -if SUPPORTED: - Image.register_save(WebPImageFile.format, _save) - Image.register_save_all(WebPImageFile.format, _save_all) - Image.register_extension(WebPImageFile.format, ".webp") - Image.register_mime(WebPImageFile.format, "image/webp") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/WmfImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/WmfImagePlugin.py deleted file mode 100644 index d569cb4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/WmfImagePlugin.py +++ /dev/null @@ -1,186 +0,0 @@ -# -# The Python Imaging Library -# $Id$ -# -# WMF stub codec -# -# history: -# 1996-12-14 fl Created -# 2004-02-22 fl Turned into a stub driver -# 2004-02-23 fl Added EMF support -# -# Copyright (c) Secret Labs AB 1997-2004. All rights reserved. -# Copyright (c) Fredrik Lundh 1996. -# -# See the README file for information on usage and redistribution. -# -# WMF/EMF reference documentation: -# https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-WMF/[MS-WMF].pdf -# http://wvware.sourceforge.net/caolan/index.html -# http://wvware.sourceforge.net/caolan/ora-wmf.html -from __future__ import annotations - -from typing import IO - -from . import Image, ImageFile -from ._binary import i16le as word -from ._binary import si16le as short -from ._binary import si32le as _long - -_handler = None - - -def register_handler(handler: ImageFile.StubHandler | None) -> None: - """ - Install application-specific WMF image handler. - - :param handler: Handler object. - """ - global _handler - _handler = handler - - -if hasattr(Image.core, "drawwmf"): - # install default handler (windows only) - - class WmfHandler(ImageFile.StubHandler): - def open(self, im: ImageFile.StubImageFile) -> None: - im._mode = "RGB" - self.bbox = im.info["wmf_bbox"] - - def load(self, im: ImageFile.StubImageFile) -> Image.Image: - im.fp.seek(0) # rewind - return Image.frombytes( - "RGB", - im.size, - Image.core.drawwmf(im.fp.read(), im.size, self.bbox), - "raw", - "BGR", - (im.size[0] * 3 + 3) & -4, - -1, - ) - - register_handler(WmfHandler()) - -# -# -------------------------------------------------------------------- -# Read WMF file - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith((b"\xd7\xcd\xc6\x9a\x00\x00", b"\x01\x00\x00\x00")) - - -## -# Image plugin for Windows metafiles. - - -class WmfStubImageFile(ImageFile.StubImageFile): - format = "WMF" - format_description = "Windows Metafile" - - def _open(self) -> None: - # check placable header - s = self.fp.read(44) - - if s.startswith(b"\xd7\xcd\xc6\x9a\x00\x00"): - # placeable windows metafile - - # get units per inch - inch = word(s, 14) - if inch == 0: - msg = "Invalid inch" - raise ValueError(msg) - self._inch: tuple[float, float] = inch, inch - - # get bounding box - x0 = short(s, 6) - y0 = short(s, 8) - x1 = short(s, 10) - y1 = short(s, 12) - - # normalize size to 72 dots per inch - self.info["dpi"] = 72 - size = ( - (x1 - x0) * self.info["dpi"] // inch, - (y1 - y0) * self.info["dpi"] // inch, - ) - - self.info["wmf_bbox"] = x0, y0, x1, y1 - - # sanity check (standard metafile header) - if s[22:26] != b"\x01\x00\t\x00": - msg = "Unsupported WMF file format" - raise SyntaxError(msg) - - elif s.startswith(b"\x01\x00\x00\x00") and s[40:44] == b" EMF": - # enhanced metafile - - # get bounding box - x0 = _long(s, 8) - y0 = _long(s, 12) - x1 = _long(s, 16) - y1 = _long(s, 20) - - # get frame (in 0.01 millimeter units) - frame = _long(s, 24), _long(s, 28), _long(s, 32), _long(s, 36) - - size = x1 - x0, y1 - y0 - - # calculate dots per inch from bbox and frame - xdpi = 2540.0 * (x1 - x0) / (frame[2] - frame[0]) - ydpi = 2540.0 * (y1 - y0) / (frame[3] - frame[1]) - - self.info["wmf_bbox"] = x0, y0, x1, y1 - - if xdpi == ydpi: - self.info["dpi"] = xdpi - else: - self.info["dpi"] = xdpi, ydpi - self._inch = xdpi, ydpi - - else: - msg = "Unsupported file format" - raise SyntaxError(msg) - - self._mode = "RGB" - self._size = size - - loader = self._load() - if loader: - loader.open(self) - - def _load(self) -> ImageFile.StubHandler | None: - return _handler - - def load( - self, dpi: float | tuple[float, float] | None = None - ) -> Image.core.PixelAccess | None: - if dpi is not None: - self.info["dpi"] = dpi - x0, y0, x1, y1 = self.info["wmf_bbox"] - if not isinstance(dpi, tuple): - dpi = dpi, dpi - self._size = ( - int((x1 - x0) * dpi[0] / self._inch[0]), - int((y1 - y0) * dpi[1] / self._inch[1]), - ) - return super().load() - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if _handler is None or not hasattr(_handler, "save"): - msg = "WMF save handler not installed" - raise OSError(msg) - _handler.save(im, fp, filename) - - -# -# -------------------------------------------------------------------- -# Registry stuff - - -Image.register_open(WmfStubImageFile.format, WmfStubImageFile, _accept) -Image.register_save(WmfStubImageFile.format, _save) - -Image.register_extensions(WmfStubImageFile.format, [".wmf", ".emf"]) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/XVThumbImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/XVThumbImagePlugin.py deleted file mode 100644 index cde2838..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/XVThumbImagePlugin.py +++ /dev/null @@ -1,83 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# XV Thumbnail file handler by Charles E. "Gene" Cash -# (gcash@magicnet.net) -# -# see xvcolor.c and xvbrowse.c in the sources to John Bradley's XV, -# available from ftp://ftp.cis.upenn.edu/pub/xv/ -# -# history: -# 98-08-15 cec created (b/w only) -# 98-12-09 cec added color palette -# 98-12-28 fl added to PIL (with only a few very minor modifications) -# -# To do: -# FIXME: make save work (this requires quantization support) -# -from __future__ import annotations - -from . import Image, ImageFile, ImagePalette -from ._binary import o8 - -_MAGIC = b"P7 332" - -# standard color palette for thumbnails (RGB332) -PALETTE = b"" -for r in range(8): - for g in range(8): - for b in range(4): - PALETTE = PALETTE + ( - o8((r * 255) // 7) + o8((g * 255) // 7) + o8((b * 255) // 3) - ) - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(_MAGIC) - - -## -# Image plugin for XV thumbnail images. - - -class XVThumbImageFile(ImageFile.ImageFile): - format = "XVThumb" - format_description = "XV thumbnail image" - - def _open(self) -> None: - # check magic - assert self.fp is not None - - if not _accept(self.fp.read(6)): - msg = "not an XV thumbnail file" - raise SyntaxError(msg) - - # Skip to beginning of next line - self.fp.readline() - - # skip info comments - while True: - s = self.fp.readline() - if not s: - msg = "Unexpected EOF reading XV thumbnail file" - raise SyntaxError(msg) - if s[0] != 35: # ie. when not a comment: '#' - break - - # parse header line (already read) - s = s.strip().split() - - self._mode = "P" - self._size = int(s[0]), int(s[1]) - - self.palette = ImagePalette.raw("RGB", PALETTE) - - self.tile = [ - ImageFile._Tile("raw", (0, 0) + self.size, self.fp.tell(), self.mode) - ] - - -# -------------------------------------------------------------------- - -Image.register_open(XVThumbImageFile.format, XVThumbImageFile, _accept) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/XbmImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/XbmImagePlugin.py deleted file mode 100644 index 1e57aa1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/XbmImagePlugin.py +++ /dev/null @@ -1,98 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# XBM File handling -# -# History: -# 1995-09-08 fl Created -# 1996-11-01 fl Added save support -# 1997-07-07 fl Made header parser more tolerant -# 1997-07-22 fl Fixed yet another parser bug -# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4) -# 2001-05-13 fl Added hotspot handling (based on code from Bernhard Herzog) -# 2004-02-24 fl Allow some whitespace before first #define -# -# Copyright (c) 1997-2004 by Secret Labs AB -# Copyright (c) 1996-1997 by Fredrik Lundh -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import re -from typing import IO - -from . import Image, ImageFile - -# XBM header -xbm_head = re.compile( - rb"\s*#define[ \t]+.*_width[ \t]+(?P[0-9]+)[\r\n]+" - b"#define[ \t]+.*_height[ \t]+(?P[0-9]+)[\r\n]+" - b"(?P" - b"#define[ \t]+[^_]*_x_hot[ \t]+(?P[0-9]+)[\r\n]+" - b"#define[ \t]+[^_]*_y_hot[ \t]+(?P[0-9]+)[\r\n]+" - b")?" - rb"[\000-\377]*_bits\[]" -) - - -def _accept(prefix: bytes) -> bool: - return prefix.lstrip().startswith(b"#define") - - -## -# Image plugin for X11 bitmaps. - - -class XbmImageFile(ImageFile.ImageFile): - format = "XBM" - format_description = "X11 Bitmap" - - def _open(self) -> None: - assert self.fp is not None - - m = xbm_head.match(self.fp.read(512)) - - if not m: - msg = "not a XBM file" - raise SyntaxError(msg) - - xsize = int(m.group("width")) - ysize = int(m.group("height")) - - if m.group("hotspot"): - self.info["hotspot"] = (int(m.group("xhot")), int(m.group("yhot"))) - - self._mode = "1" - self._size = xsize, ysize - - self.tile = [ImageFile._Tile("xbm", (0, 0) + self.size, m.end())] - - -def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: - if im.mode != "1": - msg = f"cannot write mode {im.mode} as XBM" - raise OSError(msg) - - fp.write(f"#define im_width {im.size[0]}\n".encode("ascii")) - fp.write(f"#define im_height {im.size[1]}\n".encode("ascii")) - - hotspot = im.encoderinfo.get("hotspot") - if hotspot: - fp.write(f"#define im_x_hot {hotspot[0]}\n".encode("ascii")) - fp.write(f"#define im_y_hot {hotspot[1]}\n".encode("ascii")) - - fp.write(b"static char im_bits[] = {\n") - - ImageFile._save(im, fp, [ImageFile._Tile("xbm", (0, 0) + im.size)]) - - fp.write(b"};\n") - - -Image.register_open(XbmImageFile.format, XbmImageFile, _accept) -Image.register_save(XbmImageFile.format, _save) - -Image.register_extension(XbmImageFile.format, ".xbm") - -Image.register_mime(XbmImageFile.format, "image/xbm") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/XpmImagePlugin.py b/write-message/venv/lib/python3.10/site-packages/PIL/XpmImagePlugin.py deleted file mode 100644 index 3be240f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/XpmImagePlugin.py +++ /dev/null @@ -1,157 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# XPM File handling -# -# History: -# 1996-12-29 fl Created -# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7) -# -# Copyright (c) Secret Labs AB 1997-2001. -# Copyright (c) Fredrik Lundh 1996-2001. -# -# See the README file for information on usage and redistribution. -# -from __future__ import annotations - -import re - -from . import Image, ImageFile, ImagePalette -from ._binary import o8 - -# XPM header -xpm_head = re.compile(b'"([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)') - - -def _accept(prefix: bytes) -> bool: - return prefix.startswith(b"/* XPM */") - - -## -# Image plugin for X11 pixel maps. - - -class XpmImageFile(ImageFile.ImageFile): - format = "XPM" - format_description = "X11 Pixel Map" - - def _open(self) -> None: - assert self.fp is not None - if not _accept(self.fp.read(9)): - msg = "not an XPM file" - raise SyntaxError(msg) - - # skip forward to next string - while True: - line = self.fp.readline() - if not line: - msg = "broken XPM file" - raise SyntaxError(msg) - m = xpm_head.match(line) - if m: - break - - self._size = int(m.group(1)), int(m.group(2)) - - palette_length = int(m.group(3)) - bpp = int(m.group(4)) - - # - # load palette description - - palette = {} - - for _ in range(palette_length): - line = self.fp.readline().rstrip() - - c = line[1 : bpp + 1] - s = line[bpp + 1 : -2].split() - - for i in range(0, len(s), 2): - if s[i] == b"c": - # process colour key - rgb = s[i + 1] - if rgb == b"None": - self.info["transparency"] = c - elif rgb.startswith(b"#"): - rgb_int = int(rgb[1:], 16) - palette[c] = ( - o8((rgb_int >> 16) & 255) - + o8((rgb_int >> 8) & 255) - + o8(rgb_int & 255) - ) - else: - # unknown colour - msg = "cannot read this XPM file" - raise ValueError(msg) - break - - else: - # missing colour key - msg = "cannot read this XPM file" - raise ValueError(msg) - - args: tuple[int, dict[bytes, bytes] | tuple[bytes, ...]] - if palette_length > 256: - self._mode = "RGB" - args = (bpp, palette) - else: - self._mode = "P" - self.palette = ImagePalette.raw("RGB", b"".join(palette.values())) - args = (bpp, tuple(palette.keys())) - - self.tile = [ImageFile._Tile("xpm", (0, 0) + self.size, self.fp.tell(), args)] - - def load_read(self, read_bytes: int) -> bytes: - # - # load all image data in one chunk - - xsize, ysize = self.size - - assert self.fp is not None - s = [self.fp.readline()[1 : xsize + 1].ljust(xsize) for i in range(ysize)] - - return b"".join(s) - - -class XpmDecoder(ImageFile.PyDecoder): - _pulls_fd = True - - def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: - assert self.fd is not None - - data = bytearray() - bpp, palette = self.args - dest_length = self.state.xsize * self.state.ysize - if self.mode == "RGB": - dest_length *= 3 - pixel_header = False - while len(data) < dest_length: - line = self.fd.readline() - if not line: - break - if line.rstrip() == b"/* pixels */" and not pixel_header: - pixel_header = True - continue - line = b'"'.join(line.split(b'"')[1:-1]) - for i in range(0, len(line), bpp): - key = line[i : i + bpp] - if self.mode == "RGB": - data += palette[key] - else: - data += o8(palette.index(key)) - self.set_as_raw(bytes(data)) - return -1, 0 - - -# -# Registry - - -Image.register_open(XpmImageFile.format, XpmImageFile, _accept) -Image.register_decoder("xpm", XpmDecoder) - -Image.register_extension(XpmImageFile.format, ".xpm") - -Image.register_mime(XpmImageFile.format, "image/xpm") diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__init__.py b/write-message/venv/lib/python3.10/site-packages/PIL/__init__.py deleted file mode 100644 index 6e4c23f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/__init__.py +++ /dev/null @@ -1,87 +0,0 @@ -"""Pillow (Fork of the Python Imaging Library) - -Pillow is the friendly PIL fork by Jeffrey A. Clark and contributors. - https://github.com/python-pillow/Pillow/ - -Pillow is forked from PIL 1.1.7. - -PIL is the Python Imaging Library by Fredrik Lundh and contributors. -Copyright (c) 1999 by Secret Labs AB. - -Use PIL.__version__ for this Pillow version. - -;-) -""" - -from __future__ import annotations - -from . import _version - -# VERSION was removed in Pillow 6.0.0. -# PILLOW_VERSION was removed in Pillow 9.0.0. -# Use __version__ instead. -__version__ = _version.__version__ -del _version - - -_plugins = [ - "AvifImagePlugin", - "BlpImagePlugin", - "BmpImagePlugin", - "BufrStubImagePlugin", - "CurImagePlugin", - "DcxImagePlugin", - "DdsImagePlugin", - "EpsImagePlugin", - "FitsImagePlugin", - "FliImagePlugin", - "FpxImagePlugin", - "FtexImagePlugin", - "GbrImagePlugin", - "GifImagePlugin", - "GribStubImagePlugin", - "Hdf5StubImagePlugin", - "IcnsImagePlugin", - "IcoImagePlugin", - "ImImagePlugin", - "ImtImagePlugin", - "IptcImagePlugin", - "JpegImagePlugin", - "Jpeg2KImagePlugin", - "McIdasImagePlugin", - "MicImagePlugin", - "MpegImagePlugin", - "MpoImagePlugin", - "MspImagePlugin", - "PalmImagePlugin", - "PcdImagePlugin", - "PcxImagePlugin", - "PdfImagePlugin", - "PixarImagePlugin", - "PngImagePlugin", - "PpmImagePlugin", - "PsdImagePlugin", - "QoiImagePlugin", - "SgiImagePlugin", - "SpiderImagePlugin", - "SunImagePlugin", - "TgaImagePlugin", - "TiffImagePlugin", - "WebPImagePlugin", - "WmfImagePlugin", - "XbmImagePlugin", - "XpmImagePlugin", - "XVThumbImagePlugin", -] - - -class UnidentifiedImageError(OSError): - """ - Raised in :py:meth:`PIL.Image.open` if an image cannot be opened and identified. - - If a PNG image raises this error, setting :data:`.ImageFile.LOAD_TRUNCATED_IMAGES` - to true may allow the image to be opened after all. The setting will ignore missing - data and checksum failures. - """ - - pass diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__main__.py b/write-message/venv/lib/python3.10/site-packages/PIL/__main__.py deleted file mode 100644 index 043156e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/__main__.py +++ /dev/null @@ -1,7 +0,0 @@ -from __future__ import annotations - -import sys - -from .features import pilinfo - -pilinfo(supported_formats="--report" not in sys.argv) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/AvifImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/AvifImagePlugin.cpython-310.pyc deleted file mode 100644 index 4eaf2fb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/AvifImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BdfFontFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BdfFontFile.cpython-310.pyc deleted file mode 100644 index 6b69066..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BdfFontFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BlpImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BlpImagePlugin.cpython-310.pyc deleted file mode 100644 index 964fcad..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BlpImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BmpImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BmpImagePlugin.cpython-310.pyc deleted file mode 100644 index f8bb07b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BmpImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BufrStubImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BufrStubImagePlugin.cpython-310.pyc deleted file mode 100644 index 8bdd1b9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/BufrStubImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ContainerIO.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ContainerIO.cpython-310.pyc deleted file mode 100644 index 3eaba31..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ContainerIO.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/CurImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/CurImagePlugin.cpython-310.pyc deleted file mode 100644 index 27ad028..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/CurImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/DcxImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/DcxImagePlugin.cpython-310.pyc deleted file mode 100644 index ee07d55..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/DcxImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/DdsImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/DdsImagePlugin.cpython-310.pyc deleted file mode 100644 index 575f528..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/DdsImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/EpsImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/EpsImagePlugin.cpython-310.pyc deleted file mode 100644 index 9a8f68f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/EpsImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ExifTags.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ExifTags.cpython-310.pyc deleted file mode 100644 index 625922e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ExifTags.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FitsImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FitsImagePlugin.cpython-310.pyc deleted file mode 100644 index 5481bf6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FitsImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FliImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FliImagePlugin.cpython-310.pyc deleted file mode 100644 index e8c3f30..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FliImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FontFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FontFile.cpython-310.pyc deleted file mode 100644 index 6ba0be2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FontFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FpxImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FpxImagePlugin.cpython-310.pyc deleted file mode 100644 index 1bd4133..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FpxImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FtexImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FtexImagePlugin.cpython-310.pyc deleted file mode 100644 index 27f3ab4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/FtexImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GbrImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GbrImagePlugin.cpython-310.pyc deleted file mode 100644 index 02c5ee7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GbrImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GdImageFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GdImageFile.cpython-310.pyc deleted file mode 100644 index 77e915d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GdImageFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GifImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GifImagePlugin.cpython-310.pyc deleted file mode 100644 index 31e1865..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GifImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GimpGradientFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GimpGradientFile.cpython-310.pyc deleted file mode 100644 index 82d6dad..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GimpGradientFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GimpPaletteFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GimpPaletteFile.cpython-310.pyc deleted file mode 100644 index 087e137..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GimpPaletteFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GribStubImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GribStubImagePlugin.cpython-310.pyc deleted file mode 100644 index bb0bc1a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/GribStubImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Hdf5StubImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Hdf5StubImagePlugin.cpython-310.pyc deleted file mode 100644 index 5f1aa6b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Hdf5StubImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IcnsImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IcnsImagePlugin.cpython-310.pyc deleted file mode 100644 index f4b0651..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IcnsImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IcoImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IcoImagePlugin.cpython-310.pyc deleted file mode 100644 index 0b8ab04..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IcoImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImImagePlugin.cpython-310.pyc deleted file mode 100644 index 25dca1e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Image.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Image.cpython-310.pyc deleted file mode 100644 index 7d3d59a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Image.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageChops.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageChops.cpython-310.pyc deleted file mode 100644 index 5a9ec0d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageChops.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageCms.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageCms.cpython-310.pyc deleted file mode 100644 index 206cea7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageCms.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageColor.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageColor.cpython-310.pyc deleted file mode 100644 index 7c3795f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageColor.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageDraw.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageDraw.cpython-310.pyc deleted file mode 100644 index f944ceb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageDraw.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageDraw2.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageDraw2.cpython-310.pyc deleted file mode 100644 index 45c66bc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageDraw2.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageEnhance.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageEnhance.cpython-310.pyc deleted file mode 100644 index b16b9c2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageEnhance.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFile.cpython-310.pyc deleted file mode 100644 index 83eef42..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFilter.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFilter.cpython-310.pyc deleted file mode 100644 index 771d367..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFilter.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFont.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFont.cpython-310.pyc deleted file mode 100644 index 4ba91f3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageFont.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageGrab.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageGrab.cpython-310.pyc deleted file mode 100644 index b3f7b93..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageGrab.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMath.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMath.cpython-310.pyc deleted file mode 100644 index a1e2c3c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMath.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMode.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMode.cpython-310.pyc deleted file mode 100644 index 3b4bdc8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMode.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMorph.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMorph.cpython-310.pyc deleted file mode 100644 index 2a8c41c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageMorph.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageOps.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageOps.cpython-310.pyc deleted file mode 100644 index 68169d7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageOps.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImagePalette.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImagePalette.cpython-310.pyc deleted file mode 100644 index 1f492f6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImagePalette.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImagePath.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImagePath.cpython-310.pyc deleted file mode 100644 index 217d1e5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImagePath.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageQt.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageQt.cpython-310.pyc deleted file mode 100644 index a99b80d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageQt.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageSequence.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageSequence.cpython-310.pyc deleted file mode 100644 index 1826bb9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageSequence.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageShow.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageShow.cpython-310.pyc deleted file mode 100644 index da811b1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageShow.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageStat.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageStat.cpython-310.pyc deleted file mode 100644 index 5a63afc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageStat.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageTk.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageTk.cpython-310.pyc deleted file mode 100644 index fe9f461..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageTk.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageTransform.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageTransform.cpython-310.pyc deleted file mode 100644 index 6695247..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageTransform.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageWin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageWin.cpython-310.pyc deleted file mode 100644 index 021ed25..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImageWin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImtImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImtImagePlugin.cpython-310.pyc deleted file mode 100644 index 8c8d4fa..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/ImtImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IptcImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IptcImagePlugin.cpython-310.pyc deleted file mode 100644 index 3b042d9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/IptcImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Jpeg2KImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Jpeg2KImagePlugin.cpython-310.pyc deleted file mode 100644 index 500aae1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/Jpeg2KImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/JpegImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/JpegImagePlugin.cpython-310.pyc deleted file mode 100644 index 6e29a95..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/JpegImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/JpegPresets.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/JpegPresets.cpython-310.pyc deleted file mode 100644 index 27ad853..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/JpegPresets.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/McIdasImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/McIdasImagePlugin.cpython-310.pyc deleted file mode 100644 index ed0b5d9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/McIdasImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MicImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MicImagePlugin.cpython-310.pyc deleted file mode 100644 index 9519cbe..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MicImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MpegImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MpegImagePlugin.cpython-310.pyc deleted file mode 100644 index f468555..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MpegImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MpoImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MpoImagePlugin.cpython-310.pyc deleted file mode 100644 index 94061ff..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MpoImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MspImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MspImagePlugin.cpython-310.pyc deleted file mode 100644 index 055bf4a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/MspImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PSDraw.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PSDraw.cpython-310.pyc deleted file mode 100644 index 98bc8fb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PSDraw.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PaletteFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PaletteFile.cpython-310.pyc deleted file mode 100644 index 1c0ab12..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PaletteFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PalmImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PalmImagePlugin.cpython-310.pyc deleted file mode 100644 index ea758ea..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PalmImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcdImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcdImagePlugin.cpython-310.pyc deleted file mode 100644 index 386c2ec..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcdImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcfFontFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcfFontFile.cpython-310.pyc deleted file mode 100644 index 5d35196..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcfFontFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcxImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcxImagePlugin.cpython-310.pyc deleted file mode 100644 index 83e7923..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PcxImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PdfImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PdfImagePlugin.cpython-310.pyc deleted file mode 100644 index 2450873..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PdfImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PdfParser.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PdfParser.cpython-310.pyc deleted file mode 100644 index 0a93e6a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PdfParser.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PixarImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PixarImagePlugin.cpython-310.pyc deleted file mode 100644 index 833f6e7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PixarImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PngImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PngImagePlugin.cpython-310.pyc deleted file mode 100644 index 477bb8b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PngImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PpmImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PpmImagePlugin.cpython-310.pyc deleted file mode 100644 index 31e6cbe..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PpmImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PsdImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PsdImagePlugin.cpython-310.pyc deleted file mode 100644 index 9ac5686..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/PsdImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/QoiImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/QoiImagePlugin.cpython-310.pyc deleted file mode 100644 index ddae1d3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/QoiImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SgiImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SgiImagePlugin.cpython-310.pyc deleted file mode 100644 index 3bb9f2b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SgiImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SpiderImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SpiderImagePlugin.cpython-310.pyc deleted file mode 100644 index 0c200ed..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SpiderImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SunImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SunImagePlugin.cpython-310.pyc deleted file mode 100644 index 5a34d81..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/SunImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TarIO.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TarIO.cpython-310.pyc deleted file mode 100644 index f82b0c5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TarIO.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TgaImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TgaImagePlugin.cpython-310.pyc deleted file mode 100644 index 291ac4a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TgaImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TiffImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TiffImagePlugin.cpython-310.pyc deleted file mode 100644 index de25cf2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TiffImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TiffTags.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TiffTags.cpython-310.pyc deleted file mode 100644 index 2c4e362..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/TiffTags.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WalImageFile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WalImageFile.cpython-310.pyc deleted file mode 100644 index f1e7f0a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WalImageFile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WebPImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WebPImagePlugin.cpython-310.pyc deleted file mode 100644 index b47da94..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WebPImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WmfImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WmfImagePlugin.cpython-310.pyc deleted file mode 100644 index 0e53f80..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/WmfImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-310.pyc deleted file mode 100644 index 47ecd80..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XbmImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XbmImagePlugin.cpython-310.pyc deleted file mode 100644 index 6dba2f6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XbmImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XpmImagePlugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XpmImagePlugin.cpython-310.pyc deleted file mode 100644 index 2405e0b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/XpmImagePlugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 8310d4b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/__main__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/__main__.cpython-310.pyc deleted file mode 100644 index a1d9125..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/__main__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_binary.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_binary.cpython-310.pyc deleted file mode 100644 index c0e13c5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_binary.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_deprecate.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_deprecate.cpython-310.pyc deleted file mode 100644 index 4397707..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_deprecate.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_tkinter_finder.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_tkinter_finder.cpython-310.pyc deleted file mode 100644 index 07e1fb0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_tkinter_finder.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_typing.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_typing.cpython-310.pyc deleted file mode 100644 index b74ad44..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_typing.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_util.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_util.cpython-310.pyc deleted file mode 100644 index 182e8b6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_util.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_version.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_version.cpython-310.pyc deleted file mode 100644 index e7372e3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/_version.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/features.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/features.cpython-310.pyc deleted file mode 100644 index 7a689c5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/features.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/report.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/report.cpython-310.pyc deleted file mode 100644 index d7e99f7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/__pycache__/report.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_avif.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_avif.cpython-310-darwin.so deleted file mode 100755 index 52f2be9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_avif.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_avif.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_avif.pyi deleted file mode 100644 index e27843e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_avif.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_binary.py b/write-message/venv/lib/python3.10/site-packages/PIL/_binary.py deleted file mode 100644 index 4594ccc..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_binary.py +++ /dev/null @@ -1,112 +0,0 @@ -# -# The Python Imaging Library. -# $Id$ -# -# Binary input/output support routines. -# -# Copyright (c) 1997-2003 by Secret Labs AB -# Copyright (c) 1995-2003 by Fredrik Lundh -# Copyright (c) 2012 by Brian Crowell -# -# See the README file for information on usage and redistribution. -# - - -"""Binary input/output support routines.""" -from __future__ import annotations - -from struct import pack, unpack_from - - -def i8(c: bytes) -> int: - return c[0] - - -def o8(i: int) -> bytes: - return bytes((i & 255,)) - - -# Input, le = little endian, be = big endian -def i16le(c: bytes, o: int = 0) -> int: - """ - Converts a 2-bytes (16 bits) string to an unsigned integer. - - :param c: string containing bytes to convert - :param o: offset of bytes to convert in string - """ - return unpack_from(" int: - """ - Converts a 2-bytes (16 bits) string to a signed integer. - - :param c: string containing bytes to convert - :param o: offset of bytes to convert in string - """ - return unpack_from(" int: - """ - Converts a 2-bytes (16 bits) string to a signed integer, big endian. - - :param c: string containing bytes to convert - :param o: offset of bytes to convert in string - """ - return unpack_from(">h", c, o)[0] - - -def i32le(c: bytes, o: int = 0) -> int: - """ - Converts a 4-bytes (32 bits) string to an unsigned integer. - - :param c: string containing bytes to convert - :param o: offset of bytes to convert in string - """ - return unpack_from(" int: - """ - Converts a 4-bytes (32 bits) string to a signed integer. - - :param c: string containing bytes to convert - :param o: offset of bytes to convert in string - """ - return unpack_from(" int: - """ - Converts a 4-bytes (32 bits) string to a signed integer, big endian. - - :param c: string containing bytes to convert - :param o: offset of bytes to convert in string - """ - return unpack_from(">i", c, o)[0] - - -def i16be(c: bytes, o: int = 0) -> int: - return unpack_from(">H", c, o)[0] - - -def i32be(c: bytes, o: int = 0) -> int: - return unpack_from(">I", c, o)[0] - - -# Output, le = little endian, be = big endian -def o16le(i: int) -> bytes: - return pack(" bytes: - return pack(" bytes: - return pack(">H", i) - - -def o32be(i: int) -> bytes: - return pack(">I", i) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_deprecate.py b/write-message/venv/lib/python3.10/site-packages/PIL/_deprecate.py deleted file mode 100644 index 170d444..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_deprecate.py +++ /dev/null @@ -1,72 +0,0 @@ -from __future__ import annotations - -import warnings - -from . import __version__ - - -def deprecate( - deprecated: str, - when: int | None, - replacement: str | None = None, - *, - action: str | None = None, - plural: bool = False, - stacklevel: int = 3, -) -> None: - """ - Deprecations helper. - - :param deprecated: Name of thing to be deprecated. - :param when: Pillow major version to be removed in. - :param replacement: Name of replacement. - :param action: Instead of "replacement", give a custom call to action - e.g. "Upgrade to new thing". - :param plural: if the deprecated thing is plural, needing "are" instead of "is". - - Usually of the form: - - "[deprecated] is deprecated and will be removed in Pillow [when] (yyyy-mm-dd). - Use [replacement] instead." - - You can leave out the replacement sentence: - - "[deprecated] is deprecated and will be removed in Pillow [when] (yyyy-mm-dd)" - - Or with another call to action: - - "[deprecated] is deprecated and will be removed in Pillow [when] (yyyy-mm-dd). - [action]." - """ - - is_ = "are" if plural else "is" - - if when is None: - removed = "a future version" - elif when <= int(__version__.split(".")[0]): - msg = f"{deprecated} {is_} deprecated and should be removed." - raise RuntimeError(msg) - elif when == 12: - removed = "Pillow 12 (2025-10-15)" - elif when == 13: - removed = "Pillow 13 (2026-10-15)" - else: - msg = f"Unknown removal version: {when}. Update {__name__}?" - raise ValueError(msg) - - if replacement and action: - msg = "Use only one of 'replacement' and 'action'" - raise ValueError(msg) - - if replacement: - action = f". Use {replacement} instead." - elif action: - action = f". {action.rstrip('.')}." - else: - action = "" - - warnings.warn( - f"{deprecated} {is_} deprecated and will be removed in {removed}{action}", - DeprecationWarning, - stacklevel=stacklevel, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so deleted file mode 100755 index a6e83e9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imaging.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_imaging.pyi deleted file mode 100644 index 998bc52..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_imaging.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Any - -class ImagingCore: - def __getitem__(self, index: int) -> float: ... - def __getattr__(self, name: str) -> Any: ... - -class ImagingFont: - def __getattr__(self, name: str) -> Any: ... - -class ImagingDraw: - def __getattr__(self, name: str) -> Any: ... - -class PixelAccess: - def __getitem__(self, xy: tuple[int, int]) -> float | tuple[int, ...]: ... - def __setitem__( - self, xy: tuple[int, int], color: float | tuple[int, ...] - ) -> None: ... - -class ImagingDecoder: - def __getattr__(self, name: str) -> Any: ... - -class ImagingEncoder: - def __getattr__(self, name: str) -> Any: ... - -class _Outline: - def close(self) -> None: ... - def __getattr__(self, name: str) -> Any: ... - -def font(image: ImagingCore, glyphdata: bytes) -> ImagingFont: ... -def outline() -> _Outline: ... -def __getattr__(name: str) -> Any: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingcms.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingcms.cpython-310-darwin.so deleted file mode 100755 index 06db946..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingcms.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingcms.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingcms.pyi deleted file mode 100644 index ddcf93a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingcms.pyi +++ /dev/null @@ -1,143 +0,0 @@ -import datetime -import sys -from typing import Literal, SupportsFloat, TypedDict - -from ._typing import CapsuleType - -littlecms_version: str | None - -_Tuple3f = tuple[float, float, float] -_Tuple2x3f = tuple[_Tuple3f, _Tuple3f] -_Tuple3x3f = tuple[_Tuple3f, _Tuple3f, _Tuple3f] - -class _IccMeasurementCondition(TypedDict): - observer: int - backing: _Tuple3f - geo: str - flare: float - illuminant_type: str - -class _IccViewingCondition(TypedDict): - illuminant: _Tuple3f - surround: _Tuple3f - illuminant_type: str - -class CmsProfile: - @property - def rendering_intent(self) -> int: ... - @property - def creation_date(self) -> datetime.datetime | None: ... - @property - def copyright(self) -> str | None: ... - @property - def target(self) -> str | None: ... - @property - def manufacturer(self) -> str | None: ... - @property - def model(self) -> str | None: ... - @property - def profile_description(self) -> str | None: ... - @property - def screening_description(self) -> str | None: ... - @property - def viewing_condition(self) -> str | None: ... - @property - def version(self) -> float: ... - @property - def icc_version(self) -> int: ... - @property - def attributes(self) -> int: ... - @property - def header_flags(self) -> int: ... - @property - def header_manufacturer(self) -> str: ... - @property - def header_model(self) -> str: ... - @property - def device_class(self) -> str: ... - @property - def connection_space(self) -> str: ... - @property - def xcolor_space(self) -> str: ... - @property - def profile_id(self) -> bytes: ... - @property - def is_matrix_shaper(self) -> bool: ... - @property - def technology(self) -> str | None: ... - @property - def colorimetric_intent(self) -> str | None: ... - @property - def perceptual_rendering_intent_gamut(self) -> str | None: ... - @property - def saturation_rendering_intent_gamut(self) -> str | None: ... - @property - def red_colorant(self) -> _Tuple2x3f | None: ... - @property - def green_colorant(self) -> _Tuple2x3f | None: ... - @property - def blue_colorant(self) -> _Tuple2x3f | None: ... - @property - def red_primary(self) -> _Tuple2x3f | None: ... - @property - def green_primary(self) -> _Tuple2x3f | None: ... - @property - def blue_primary(self) -> _Tuple2x3f | None: ... - @property - def media_white_point_temperature(self) -> float | None: ... - @property - def media_white_point(self) -> _Tuple2x3f | None: ... - @property - def media_black_point(self) -> _Tuple2x3f | None: ... - @property - def luminance(self) -> _Tuple2x3f | None: ... - @property - def chromatic_adaptation(self) -> tuple[_Tuple3x3f, _Tuple3x3f] | None: ... - @property - def chromaticity(self) -> _Tuple3x3f | None: ... - @property - def colorant_table(self) -> list[str] | None: ... - @property - def colorant_table_out(self) -> list[str] | None: ... - @property - def intent_supported(self) -> dict[int, tuple[bool, bool, bool]] | None: ... - @property - def clut(self) -> dict[int, tuple[bool, bool, bool]] | None: ... - @property - def icc_measurement_condition(self) -> _IccMeasurementCondition | None: ... - @property - def icc_viewing_condition(self) -> _IccViewingCondition | None: ... - def is_intent_supported(self, intent: int, direction: int, /) -> int: ... - -class CmsTransform: - def apply(self, id_in: CapsuleType, id_out: CapsuleType) -> int: ... - -def profile_open(profile: str, /) -> CmsProfile: ... -def profile_frombytes(profile: bytes, /) -> CmsProfile: ... -def profile_tobytes(profile: CmsProfile, /) -> bytes: ... -def buildTransform( - input_profile: CmsProfile, - output_profile: CmsProfile, - in_mode: str, - out_mode: str, - rendering_intent: int = 0, - cms_flags: int = 0, - /, -) -> CmsTransform: ... -def buildProofTransform( - input_profile: CmsProfile, - output_profile: CmsProfile, - proof_profile: CmsProfile, - in_mode: str, - out_mode: str, - rendering_intent: int = 0, - proof_intent: int = 0, - cms_flags: int = 0, - /, -) -> CmsTransform: ... -def createProfile( - color_space: Literal["LAB", "XYZ", "sRGB"], color_temp: SupportsFloat = 0.0, / -) -> CmsProfile: ... - -if sys.platform == "win32": - def get_display_profile_win32(handle: int = 0, is_dc: int = 0, /) -> str | None: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingft.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingft.cpython-310-darwin.so deleted file mode 100755 index aea8703..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingft.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingft.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingft.pyi deleted file mode 100644 index 1cb1429..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingft.pyi +++ /dev/null @@ -1,69 +0,0 @@ -from typing import Any, Callable - -from . import ImageFont, _imaging - -class Font: - @property - def family(self) -> str | None: ... - @property - def style(self) -> str | None: ... - @property - def ascent(self) -> int: ... - @property - def descent(self) -> int: ... - @property - def height(self) -> int: ... - @property - def x_ppem(self) -> int: ... - @property - def y_ppem(self) -> int: ... - @property - def glyphs(self) -> int: ... - def render( - self, - string: str | bytes, - fill: Callable[[int, int], _imaging.ImagingCore], - mode: str, - dir: str | None, - features: list[str] | None, - lang: str | None, - stroke_width: float, - stroke_filled: bool, - anchor: str | None, - foreground_ink_long: int, - start: tuple[float, float], - /, - ) -> tuple[_imaging.ImagingCore, tuple[int, int]]: ... - def getsize( - self, - string: str | bytes | bytearray, - mode: str, - dir: str | None, - features: list[str] | None, - lang: str | None, - anchor: str | None, - /, - ) -> tuple[tuple[int, int], tuple[int, int]]: ... - def getlength( - self, - string: str | bytes, - mode: str, - dir: str | None, - features: list[str] | None, - lang: str | None, - /, - ) -> float: ... - def getvarnames(self) -> list[bytes]: ... - def getvaraxes(self) -> list[ImageFont.Axis]: ... - def setvarname(self, instance_index: int, /) -> None: ... - def setvaraxes(self, axes: list[float], /) -> None: ... - -def getfont( - filename: str | bytes, - size: float, - index: int, - encoding: str, - font_bytes: bytes, - layout_engine: int, -) -> Font: ... -def __getattr__(name: str) -> Any: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmath.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmath.cpython-310-darwin.so deleted file mode 100755 index 2096cda..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmath.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmath.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmath.pyi deleted file mode 100644 index e27843e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmath.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmorph.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmorph.cpython-310-darwin.so deleted file mode 100755 index d6e1d72..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmorph.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmorph.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmorph.pyi deleted file mode 100644 index e27843e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingmorph.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingtk.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingtk.cpython-310-darwin.so deleted file mode 100755 index 47f76be..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingtk.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingtk.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_imagingtk.pyi deleted file mode 100644 index e27843e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_imagingtk.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_tkinter_finder.py b/write-message/venv/lib/python3.10/site-packages/PIL/_tkinter_finder.py deleted file mode 100644 index 9c01430..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_tkinter_finder.py +++ /dev/null @@ -1,20 +0,0 @@ -"""Find compiled module linking to Tcl / Tk libraries""" - -from __future__ import annotations - -import sys -import tkinter - -tk = getattr(tkinter, "_tkinter") - -try: - if hasattr(sys, "pypy_find_executable"): - TKINTER_LIB = tk.tklib_cffi.__file__ - else: - TKINTER_LIB = tk.__file__ -except AttributeError: - # _tkinter may be compiled directly into Python, in which case __file__ is - # not available. load_tkinter_funcs will check the binary first in any case. - TKINTER_LIB = None - -tk_version = str(tkinter.TkVersion) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_typing.py b/write-message/venv/lib/python3.10/site-packages/PIL/_typing.py deleted file mode 100644 index 373938e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_typing.py +++ /dev/null @@ -1,54 +0,0 @@ -from __future__ import annotations - -import os -import sys -from collections.abc import Sequence -from typing import Any, Protocol, TypeVar, Union - -TYPE_CHECKING = False -if TYPE_CHECKING: - from numbers import _IntegralLike as IntegralLike - - try: - import numpy.typing as npt - - NumpyArray = npt.NDArray[Any] # requires numpy>=1.21 - except (ImportError, AttributeError): - pass - -if sys.version_info >= (3, 13): - from types import CapsuleType -else: - CapsuleType = object - -if sys.version_info >= (3, 12): - from collections.abc import Buffer -else: - Buffer = Any - -if sys.version_info >= (3, 10): - from typing import TypeGuard -else: - try: - from typing_extensions import TypeGuard - except ImportError: - - class TypeGuard: # type: ignore[no-redef] - def __class_getitem__(cls, item: Any) -> type[bool]: - return bool - - -Coords = Union[Sequence[float], Sequence[Sequence[float]]] - - -_T_co = TypeVar("_T_co", covariant=True) - - -class SupportsRead(Protocol[_T_co]): - def read(self, length: int = ..., /) -> _T_co: ... - - -StrOrBytesPath = Union[str, bytes, os.PathLike[str], os.PathLike[bytes]] - - -__all__ = ["Buffer", "IntegralLike", "StrOrBytesPath", "SupportsRead", "TypeGuard"] diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_util.py b/write-message/venv/lib/python3.10/site-packages/PIL/_util.py deleted file mode 100644 index 8ef0d36..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_util.py +++ /dev/null @@ -1,26 +0,0 @@ -from __future__ import annotations - -import os -from typing import Any, NoReturn - -from ._typing import StrOrBytesPath, TypeGuard - - -def is_path(f: Any) -> TypeGuard[StrOrBytesPath]: - return isinstance(f, (bytes, str, os.PathLike)) - - -class DeferredError: - def __init__(self, ex: BaseException): - self.ex = ex - - def __getattr__(self, elt: str) -> NoReturn: - raise self.ex - - @staticmethod - def new(ex: BaseException) -> Any: - """ - Creates an object that raises the wrapped exception ``ex`` when used, - and casts it to :py:obj:`~typing.Any` type. - """ - return DeferredError(ex) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_version.py b/write-message/venv/lib/python3.10/site-packages/PIL/_version.py deleted file mode 100644 index 74e6335..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_version.py +++ /dev/null @@ -1,4 +0,0 @@ -# Master version for Pillow -from __future__ import annotations - -__version__ = "11.3.0" diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_webp.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/PIL/_webp.cpython-310-darwin.so deleted file mode 100755 index a00df45..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PIL/_webp.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/_webp.pyi b/write-message/venv/lib/python3.10/site-packages/PIL/_webp.pyi deleted file mode 100644 index e27843e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/_webp.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Any - -def __getattr__(name: str) -> Any: ... diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/features.py b/write-message/venv/lib/python3.10/site-packages/PIL/features.py deleted file mode 100644 index 573f1d4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/features.py +++ /dev/null @@ -1,361 +0,0 @@ -from __future__ import annotations - -import collections -import os -import sys -import warnings -from typing import IO - -import PIL - -from . import Image -from ._deprecate import deprecate - -modules = { - "pil": ("PIL._imaging", "PILLOW_VERSION"), - "tkinter": ("PIL._tkinter_finder", "tk_version"), - "freetype2": ("PIL._imagingft", "freetype2_version"), - "littlecms2": ("PIL._imagingcms", "littlecms_version"), - "webp": ("PIL._webp", "webpdecoder_version"), - "avif": ("PIL._avif", "libavif_version"), -} - - -def check_module(feature: str) -> bool: - """ - Checks if a module is available. - - :param feature: The module to check for. - :returns: ``True`` if available, ``False`` otherwise. - :raises ValueError: If the module is not defined in this version of Pillow. - """ - if feature not in modules: - msg = f"Unknown module {feature}" - raise ValueError(msg) - - module, ver = modules[feature] - - try: - __import__(module) - return True - except ModuleNotFoundError: - return False - except ImportError as ex: - warnings.warn(str(ex)) - return False - - -def version_module(feature: str) -> str | None: - """ - :param feature: The module to check for. - :returns: - The loaded version number as a string, or ``None`` if unknown or not available. - :raises ValueError: If the module is not defined in this version of Pillow. - """ - if not check_module(feature): - return None - - module, ver = modules[feature] - - return getattr(__import__(module, fromlist=[ver]), ver) - - -def get_supported_modules() -> list[str]: - """ - :returns: A list of all supported modules. - """ - return [f for f in modules if check_module(f)] - - -codecs = { - "jpg": ("jpeg", "jpeglib"), - "jpg_2000": ("jpeg2k", "jp2klib"), - "zlib": ("zip", "zlib"), - "libtiff": ("libtiff", "libtiff"), -} - - -def check_codec(feature: str) -> bool: - """ - Checks if a codec is available. - - :param feature: The codec to check for. - :returns: ``True`` if available, ``False`` otherwise. - :raises ValueError: If the codec is not defined in this version of Pillow. - """ - if feature not in codecs: - msg = f"Unknown codec {feature}" - raise ValueError(msg) - - codec, lib = codecs[feature] - - return f"{codec}_encoder" in dir(Image.core) - - -def version_codec(feature: str) -> str | None: - """ - :param feature: The codec to check for. - :returns: - The version number as a string, or ``None`` if not available. - Checked at compile time for ``jpg``, run-time otherwise. - :raises ValueError: If the codec is not defined in this version of Pillow. - """ - if not check_codec(feature): - return None - - codec, lib = codecs[feature] - - version = getattr(Image.core, f"{lib}_version") - - if feature == "libtiff": - return version.split("\n")[0].split("Version ")[1] - - return version - - -def get_supported_codecs() -> list[str]: - """ - :returns: A list of all supported codecs. - """ - return [f for f in codecs if check_codec(f)] - - -features: dict[str, tuple[str, str | bool, str | None]] = { - "webp_anim": ("PIL._webp", True, None), - "webp_mux": ("PIL._webp", True, None), - "transp_webp": ("PIL._webp", True, None), - "raqm": ("PIL._imagingft", "HAVE_RAQM", "raqm_version"), - "fribidi": ("PIL._imagingft", "HAVE_FRIBIDI", "fribidi_version"), - "harfbuzz": ("PIL._imagingft", "HAVE_HARFBUZZ", "harfbuzz_version"), - "libjpeg_turbo": ("PIL._imaging", "HAVE_LIBJPEGTURBO", "libjpeg_turbo_version"), - "mozjpeg": ("PIL._imaging", "HAVE_MOZJPEG", "libjpeg_turbo_version"), - "zlib_ng": ("PIL._imaging", "HAVE_ZLIBNG", "zlib_ng_version"), - "libimagequant": ("PIL._imaging", "HAVE_LIBIMAGEQUANT", "imagequant_version"), - "xcb": ("PIL._imaging", "HAVE_XCB", None), -} - - -def check_feature(feature: str) -> bool | None: - """ - Checks if a feature is available. - - :param feature: The feature to check for. - :returns: ``True`` if available, ``False`` if unavailable, ``None`` if unknown. - :raises ValueError: If the feature is not defined in this version of Pillow. - """ - if feature not in features: - msg = f"Unknown feature {feature}" - raise ValueError(msg) - - module, flag, ver = features[feature] - - if isinstance(flag, bool): - deprecate(f'check_feature("{feature}")', 12) - try: - imported_module = __import__(module, fromlist=["PIL"]) - if isinstance(flag, bool): - return flag - return getattr(imported_module, flag) - except ModuleNotFoundError: - return None - except ImportError as ex: - warnings.warn(str(ex)) - return None - - -def version_feature(feature: str) -> str | None: - """ - :param feature: The feature to check for. - :returns: The version number as a string, or ``None`` if not available. - :raises ValueError: If the feature is not defined in this version of Pillow. - """ - if not check_feature(feature): - return None - - module, flag, ver = features[feature] - - if ver is None: - return None - - return getattr(__import__(module, fromlist=[ver]), ver) - - -def get_supported_features() -> list[str]: - """ - :returns: A list of all supported features. - """ - supported_features = [] - for f, (module, flag, _) in features.items(): - if flag is True: - for feature, (feature_module, _) in modules.items(): - if feature_module == module: - if check_module(feature): - supported_features.append(f) - break - elif check_feature(f): - supported_features.append(f) - return supported_features - - -def check(feature: str) -> bool | None: - """ - :param feature: A module, codec, or feature name. - :returns: - ``True`` if the module, codec, or feature is available, - ``False`` or ``None`` otherwise. - """ - - if feature in modules: - return check_module(feature) - if feature in codecs: - return check_codec(feature) - if feature in features: - return check_feature(feature) - warnings.warn(f"Unknown feature '{feature}'.", stacklevel=2) - return False - - -def version(feature: str) -> str | None: - """ - :param feature: - The module, codec, or feature to check for. - :returns: - The version number as a string, or ``None`` if unknown or not available. - """ - if feature in modules: - return version_module(feature) - if feature in codecs: - return version_codec(feature) - if feature in features: - return version_feature(feature) - return None - - -def get_supported() -> list[str]: - """ - :returns: A list of all supported modules, features, and codecs. - """ - - ret = get_supported_modules() - ret.extend(get_supported_features()) - ret.extend(get_supported_codecs()) - return ret - - -def pilinfo(out: IO[str] | None = None, supported_formats: bool = True) -> None: - """ - Prints information about this installation of Pillow. - This function can be called with ``python3 -m PIL``. - It can also be called with ``python3 -m PIL.report`` or ``python3 -m PIL --report`` - to have "supported_formats" set to ``False``, omitting the list of all supported - image file formats. - - :param out: - The output stream to print to. Defaults to ``sys.stdout`` if ``None``. - :param supported_formats: - If ``True``, a list of all supported image file formats will be printed. - """ - - if out is None: - out = sys.stdout - - Image.init() - - print("-" * 68, file=out) - print(f"Pillow {PIL.__version__}", file=out) - py_version_lines = sys.version.splitlines() - print(f"Python {py_version_lines[0].strip()}", file=out) - for py_version in py_version_lines[1:]: - print(f" {py_version.strip()}", file=out) - print("-" * 68, file=out) - print(f"Python executable is {sys.executable or 'unknown'}", file=out) - if sys.prefix != sys.base_prefix: - print(f"Environment Python files loaded from {sys.prefix}", file=out) - print(f"System Python files loaded from {sys.base_prefix}", file=out) - print("-" * 68, file=out) - print( - f"Python Pillow modules loaded from {os.path.dirname(Image.__file__)}", - file=out, - ) - print( - f"Binary Pillow modules loaded from {os.path.dirname(Image.core.__file__)}", - file=out, - ) - print("-" * 68, file=out) - - for name, feature in [ - ("pil", "PIL CORE"), - ("tkinter", "TKINTER"), - ("freetype2", "FREETYPE2"), - ("littlecms2", "LITTLECMS2"), - ("webp", "WEBP"), - ("avif", "AVIF"), - ("jpg", "JPEG"), - ("jpg_2000", "OPENJPEG (JPEG2000)"), - ("zlib", "ZLIB (PNG/ZIP)"), - ("libtiff", "LIBTIFF"), - ("raqm", "RAQM (Bidirectional Text)"), - ("libimagequant", "LIBIMAGEQUANT (Quantization method)"), - ("xcb", "XCB (X protocol)"), - ]: - if check(name): - v: str | None = None - if name == "jpg": - libjpeg_turbo_version = version_feature("libjpeg_turbo") - if libjpeg_turbo_version is not None: - v = "mozjpeg" if check_feature("mozjpeg") else "libjpeg-turbo" - v += " " + libjpeg_turbo_version - if v is None: - v = version(name) - if v is not None: - version_static = name in ("pil", "jpg") - if name == "littlecms2": - # this check is also in src/_imagingcms.c:setup_module() - version_static = tuple(int(x) for x in v.split(".")) < (2, 7) - t = "compiled for" if version_static else "loaded" - if name == "zlib": - zlib_ng_version = version_feature("zlib_ng") - if zlib_ng_version is not None: - v += ", compiled for zlib-ng " + zlib_ng_version - elif name == "raqm": - for f in ("fribidi", "harfbuzz"): - v2 = version_feature(f) - if v2 is not None: - v += f", {f} {v2}" - print("---", feature, "support ok,", t, v, file=out) - else: - print("---", feature, "support ok", file=out) - else: - print("***", feature, "support not installed", file=out) - print("-" * 68, file=out) - - if supported_formats: - extensions = collections.defaultdict(list) - for ext, i in Image.EXTENSION.items(): - extensions[i].append(ext) - - for i in sorted(Image.ID): - line = f"{i}" - if i in Image.MIME: - line = f"{line} {Image.MIME[i]}" - print(line, file=out) - - if i in extensions: - print( - "Extensions: {}".format(", ".join(sorted(extensions[i]))), file=out - ) - - features = [] - if i in Image.OPEN: - features.append("open") - if i in Image.SAVE: - features.append("save") - if i in Image.SAVE_ALL: - features.append("save_all") - if i in Image.DECODERS: - features.append("decode") - if i in Image.ENCODERS: - features.append("encode") - - print("Features: {}".format(", ".join(features)), file=out) - print("-" * 68, file=out) diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/py.typed b/write-message/venv/lib/python3.10/site-packages/PIL/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/PIL/report.py b/write-message/venv/lib/python3.10/site-packages/PIL/report.py deleted file mode 100644 index d2815e8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PIL/report.py +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import annotations - -from .features import pilinfo - -pilinfo(supported_formats=False) diff --git a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/PKG-INFO b/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/PKG-INFO deleted file mode 100644 index c957b47..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/PKG-INFO +++ /dev/null @@ -1,95 +0,0 @@ -Metadata-Version: 2.1 -Name: PyGetWindow -Version: 0.0.9 -Summary: A simple, cross-platform module for obtaining GUI information on application's windows. -Home-page: https://github.com/asweigart/pygetwindow -Author: Al Sweigart -Author-email: al@inventwithpython.com -License: BSD -Keywords: gui window geometry resize minimize maximize close title -Classifier: Development Status :: 4 - Beta -Classifier: Environment :: Win32 (MS Windows) -Classifier: Environment :: X11 Applications -Classifier: Environment :: MacOS X -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: BSD 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 -Description-Content-Type: text/markdown - -PyGetWindow -=========== - -A simple, cross-platform module for obtaining GUI information on and controlling application's windows. - - -Still under development. Currently only the Windows platform is implemented. If you want to help contribute, please contact al@inventwithpython.com! - - -Install -------- - - pip install pygetwindow - - -Examples --------- - -(For this example, I'm using Windows and opened the Notepad application, which has a title of "Untitled - Notepad". Most of the effects of these functions can't be seen in text.) - -PyGetWindow has functions for obtaining ``Window`` objects from a place on the screen, from the window title, or just getting all windows. (``hWnd`` is specific to the Windows platform.) - - >>> import pygetwindow as gw - >>> gw.getAllTitles() - ('', 'C:\\WINDOWS\\system32\\cmd.exe - pipenv shell - python', 'C:\\github\\PyGetWindow\\README.md • - Sublime Text', "asweigart/PyGetWindow: A simple, cross-platform module for obtaining GUI information on application's windows. - Google Chrome", 'Untitled - Notepad', 'C:\\Users\\Al\\Desktop\\xlibkey.py • - Sublime Text', 'https://tronche.com/gui/x/xlib/ - Google Chrome', 'Xlib Programming Manual: XGetWindowAttributes - Google Chrome', 'Generic Ubuntu Box [Running] - Oracle VM VirtualBox', 'Oracle VM VirtualBox Manager', 'Microsoft Edge', 'Microsoft Edge', 'Microsoft Edge', '', 'Microsoft Edge', 'Settings', 'Settings', 'Microsoft Store', 'Microsoft Store', '', '', 'Backup and Sync', 'Google Hangouts - asweigart@gmail.com', 'Downloads', '', '', 'Program Manager') - >>> gw.getAllWindows() - (Win32Window(hWnd=131318), Win32Window(hWnd=1050492), Win32Window(hWnd=67206), Win32Window(hWnd=66754), Win32Window(hWnd=264354), Win32Window(hWnd=329210), Win32Window(hWnd=1114374), Win32Window(hWnd=852550), Win32Window(hWnd=328358), Win32Window(hWnd=66998), Win32Window(hWnd=132508), Win32Window(hWnd=66964), Win32Window(hWnd=66882), Win32Window(hWnd=197282), Win32Window(hWnd=393880), Win32Window(hWnd=66810), Win32Window(hWnd=328466), Win32Window(hWnd=132332), Win32Window(hWnd=262904), Win32Window(hWnd=65962), Win32Window(hWnd=65956), Win32Window(hWnd=197522), Win32Window(hWnd=131944), Win32Window(hWnd=329334), Win32Window(hWnd=395034), Win32Window(hWnd=132928), Win32Window(hWnd=65882)) - >>> gw.getWindowsWithTitle('Untitled') - (Win32Window(hWnd=264354),) - >>> gw.getActiveWindow() - Win32Window(hWnd=1050492) - >>> gw.getActiveWindow().title - 'C:\\WINDOWS\\system32\\cmd.exe - pipenv shell - python' - >>> gw.getWindowsAt(10, 10) - (Win32Window(hWnd=67206), Win32Window(hWnd=66754), Win32Window(hWnd=329210), Win32Window(hWnd=1114374), Win32Window(hWnd=852550), Win32Window(hWnd=132508), Win32Window(hWnd=66964), Win32Window(hWnd=66882), Win32Window(hWnd=197282), Win32Window(hWnd=393880), Win32Window(hWnd=66810), Win32Window(hWnd=328466), Win32Window(hWnd=395034), Win32Window(hWnd=132928), Win32Window(hWnd=65882)) - - -``Window`` objects can be minimized/maximized/restored/activated/resized/moved/closed and also have attributes for their current position, size, and state. - - >>> notepadWindow = gw.getWindowsWithTitle('Untitled')[0] - >>> notepadWindow.isMaximized - False - >>> notepadWindow.maximize() - >>> notepadWindow.isMaximized - True - >>> notepadWindow.restore() - >>> notepadWindow.minimize() - >>> notepadWindow.restore() - >>> notepadWindow.activate() - >>> notepadWindow.resize(10, 10) # increase by 10, 10 - >>> notepadWindow.resizeTo(100, 100) # set size to 100x100 - >>> notepadWindow.move(10, 10) # move 10 pixels right and 10 down - >>> notepadWindow.moveTo(10, 10) # move window to 10, 10 - >>> notepadWindow.size - (132, 100) - >>> notepadWindow.width - 132 - >>> notepadWindow.height - 100 - >>> notepadWindow.topleft - (10, 10) - >>> notepadWindow.top - 10 - >>> notepadWindow.left - 10 - >>> notepadWindow.bottomright - (142, 110) - >>> notepadWindow.close() - >>> diff --git a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/SOURCES.txt b/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/SOURCES.txt deleted file mode 100644 index 23a9751..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/SOURCES.txt +++ /dev/null @@ -1,15 +0,0 @@ -README.md -setup.cfg -setup.py -src/PyGetWindow.egg-info/PKG-INFO -src/PyGetWindow.egg-info/SOURCES.txt -src/PyGetWindow.egg-info/dependency_links.txt -src/PyGetWindow.egg-info/requires.txt -src/PyGetWindow.egg-info/top_level.txt -src/pygetwindow/__init__.py -src/pygetwindow/_pygetwindow_macos.py -src/pygetwindow/_pygetwindow_win.py -src/pygetwindow.egg-info/PKG-INFO -src/pygetwindow.egg-info/SOURCES.txt -src/pygetwindow.egg-info/dependency_links.txt -src/pygetwindow.egg-info/top_level.txt \ No newline at end of file diff --git a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/dependency_links.txt b/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/installed-files.txt b/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/installed-files.txt deleted file mode 100644 index 4518baa..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/installed-files.txt +++ /dev/null @@ -1,11 +0,0 @@ -../pygetwindow/__init__.py -../pygetwindow/__pycache__/__init__.cpython-310.pyc -../pygetwindow/__pycache__/_pygetwindow_macos.cpython-310.pyc -../pygetwindow/__pycache__/_pygetwindow_win.cpython-310.pyc -../pygetwindow/_pygetwindow_macos.py -../pygetwindow/_pygetwindow_win.py -PKG-INFO -SOURCES.txt -dependency_links.txt -requires.txt -top_level.txt diff --git a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/requires.txt b/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/requires.txt deleted file mode 100644 index f2b1100..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/requires.txt +++ /dev/null @@ -1 +0,0 @@ -pyrect diff --git a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/top_level.txt deleted file mode 100644 index 392e30f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyGetWindow-0.0.9-py3.10.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -pygetwindow diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/AppCategories.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/AppCategories.py deleted file mode 100644 index 14ede23..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/AppCategories.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -A number of useful categories on AppKit classes -""" -__all__ = () -import objc -from AppKit import NSAnimationContext, NSGraphicsContext - - -class _ctxHelper: - def __enter__(self): - NSGraphicsContext.saveGraphicsState() - - def __exit__(self, exc_type, exc_value, exc_tb): - NSGraphicsContext.restoreGraphicsState() - return False - - -class NSGraphicsContext(objc.Category(NSGraphicsContext)): - @classmethod - def savedGraphicsState(self): - return _ctxHelper() - - -@objc.python_method -def __enter__(cls): - cls.beginGrouping() - - -@objc.python_method -def __exit__(cls, exc_type, exc_value, exc_tb): - cls.endGrouping() - - -# Cannot use a category here because these special methods -# must be defined on the metaclass. -type(NSAnimationContext).__enter__ = __enter__ -type(NSAnimationContext).__exit__ = __exit__ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/AppHelper.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/AppHelper.py deleted file mode 100644 index c2b0179..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/AppHelper.py +++ /dev/null @@ -1,347 +0,0 @@ -"""AppKit helpers. - -Exported functions: -* runEventLoop - run NSApplicationMain in a safer way -* runConsoleEventLoop - run NSRunLoop.run() in a stoppable manner -* stopEventLoop - stops the event loop or terminates the application -* endSheetMethod - set correct signature for NSSheet callbacks -* callAfter - call a function on the main thread (async) -* callLater - call a function on the main thread after a delay (async) -""" - -__all__ = ( - "runEventLoop", - "runConsoleEventLoop", - "stopEventLoop", - "endSheetMethod", - "callAfter", - "callLater", -) - -import os -import sys -import traceback - -import objc -from AppKit import ( - NSApp, - NSApplicationDidFinishLaunchingNotification, - NSApplicationMain, - NSRunAlertPanel, -) -from Foundation import ( - NSAutoreleasePool, - NSDate, - NSDefaultRunLoopMode, - NSLog, - NSNotificationCenter, - NSObject, - NSRunLoop, - NSThread, - NSTimer, -) -from objc import super # noqa: A004 - - -class PyObjCMessageRunner(NSObject): - """ - Wraps a Python function and its arguments and allows it to be posted to the - MainThread's `NSRunLoop`. - """ - - def initWithPayload_(self, payload): - """ - Designated initializer. - """ - self = super().init() - if not self: - return None - - self._payload = payload - - return self - - def callAfter(self): - """ - Posts a message to the Main thread, to be executed immediately. - """ - self.performSelectorOnMainThread_withObject_waitUntilDone_( - self.scheduleCallWithDelay_, None, False - ) - - def callLater_(self, delay): - """ - Posts a message to the Main thread, to be executed after the given - delay, in seconds. - """ - self.performSelectorOnMainThread_withObject_waitUntilDone_( - self.scheduleCallWithDelay_, delay, False - ) - - def scheduleCallWithDelay_(self, delay): - """ - This is run once we're on the Main thread. - """ - assert NSThread.isMainThread(), "Call is not executing on the Main thread!" - - # There's no delay, just run the call now. - if not delay: - self.performCall() - return - - # There's a delay, schedule it for later. - self.performSelector_withObject_afterDelay_(self.performCall, None, delay) - - def performCall(self): - """ - Actually runs the payload. - """ - assert NSThread.isMainThread(), "Call is not executing on the Main thread!" - - # Unpack the payload. - (func, args, kwargs) = self._payload - - # Run it. - func(*args, **kwargs) - - -def callAfter(func, *args, **kwargs): - """ - Call a function on the Main thread (async). - """ - pool = NSAutoreleasePool.alloc().init() - runner = PyObjCMessageRunner.alloc().initWithPayload_((func, args, kwargs)) - runner.callAfter() - del runner - del pool - - -def callLater(delay, func, *args, **kwargs): - """ - Call a function on the Main thread after a delay (async). - """ - pool = NSAutoreleasePool.alloc().init() - runner = PyObjCMessageRunner.alloc().initWithPayload_((func, args, kwargs)) - runner.callLater_(delay) - del runner - del pool - - -class PyObjCAppHelperApplicationActivator(NSObject): - def activateNow_(self, aNotification): - NSApp().activateIgnoringOtherApps_(True) - - -class PyObjCAppHelperRunLoopStopper(NSObject): - singletons = {} - - def currentRunLoopStopper(cls): - runLoop = NSRunLoop.currentRunLoop() - return cls.singletons.get(runLoop) - - currentRunLoopStopper = classmethod(currentRunLoopStopper) - - def init(self): - self = super().init() - self.shouldStop = False - return self - - def shouldRun(self): - return not self.shouldStop - - def addRunLoopStopper_toRunLoop_(cls, runLoopStopper, runLoop): - if runLoop in cls.singletons: - raise ValueError("Stopper already registered for this runLoop") - cls.singletons[runLoop] = runLoopStopper - - addRunLoopStopper_toRunLoop_ = classmethod(addRunLoopStopper_toRunLoop_) - - def removeRunLoopStopperFromRunLoop_(cls, runLoop): - if runLoop not in cls.singletons: - raise ValueError("Stopper not registered for this runLoop") - del cls.singletons[runLoop] - - removeRunLoopStopperFromRunLoop_ = classmethod(removeRunLoopStopperFromRunLoop_) - - def stop(self): - self.shouldStop = True - # this should go away when/if runEventLoop uses - # runLoop iteration - if NSApp() is not None: - NSApp().terminate_(self) - - def performStop_(self, sender): - self.stop() - - -def stopEventLoop(): - """ - Stop the current event loop if possible - returns True if it expects that it was successful, False otherwise - """ - stopper = PyObjCAppHelperRunLoopStopper.currentRunLoopStopper() - if stopper is None: - if NSApp() is not None: - NSApp().terminate_(None) - return True - return False - NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( - 0.0, stopper, "performStop:", None, False - ) - return True - - -def endSheetMethod(meth): - """ - Return a selector that can be used as the delegate callback for - sheet methods - """ - return objc.selector( - meth, signature=b"v@:@" + objc._C_NSInteger + objc._C_NSInteger - ) - - -def unexpectedErrorAlertPanel(): - exceptionInfo = traceback.format_exception_only(*sys.exc_info()[:2])[0].strip() - return NSRunAlertPanel( - "An unexpected error has occurred", - "%@", - "Continue", - "Quit", - None, - "(%s)" % exceptionInfo, - ) - - -def unexpectedErrorAlertPdb(): - import pdb - - traceback.print_exc() - pdb.post_mortem(sys.exc_info()[2]) - return True - - -def machInterrupt(signum): - stopper = PyObjCAppHelperRunLoopStopper.currentRunLoopStopper() - if stopper is not None: - stopper.stop() - elif NSApp() is not None: - NSApp().terminate_(None) - else: - import os - - os._exit(1) - - -def installMachInterrupt(): - import signal - from PyObjCTools import MachSignals - - MachSignals.signal(signal.SIGINT, machInterrupt) - - -def runConsoleEventLoop( - argv=None, installInterrupt=False, mode=NSDefaultRunLoopMode, maxTimeout=3.0 -): - if argv is None: - argv = sys.argv - if installInterrupt: - installMachInterrupt() - runLoop = NSRunLoop.currentRunLoop() - stopper = PyObjCAppHelperRunLoopStopper.alloc().init() - PyObjCAppHelperRunLoopStopper.addRunLoopStopper_toRunLoop_(stopper, runLoop) - try: - while stopper.shouldRun(): - nextfire = runLoop.limitDateForMode_(mode) - if not stopper.shouldRun(): - break - - soon = NSDate.dateWithTimeIntervalSinceNow_(maxTimeout) - if nextfire is not None: - nextfire = soon.earlierDate_(nextfire) - if not runLoop.runMode_beforeDate_(mode, nextfire): - stopper.stop() - - finally: - PyObjCAppHelperRunLoopStopper.removeRunLoopStopperFromRunLoop_(runLoop) - - -RAISETHESE = (SystemExit, MemoryError, KeyboardInterrupt) - - -def runEventLoop( - argv=None, - unexpectedErrorAlert=None, - installInterrupt=None, - pdb=None, - main=NSApplicationMain, -): - """Run the event loop, ask the user if we should continue if an - exception is caught. Use this function instead of NSApplicationMain(). - """ - if argv is None: - argv = sys.argv - - if pdb is None: - pdb = "USE_PDB" in os.environ - - if pdb: - from PyObjCTools import Debugging - - Debugging.installVerboseExceptionHandler() - # bring it to the front, starting from terminal - # often won't - activator = PyObjCAppHelperApplicationActivator.alloc().init() - NSNotificationCenter.defaultCenter().addObserver_selector_name_object_( - activator, "activateNow:", NSApplicationDidFinishLaunchingNotification, None - ) - else: - Debugging = None - - if installInterrupt is None and pdb: - installInterrupt = True - - if unexpectedErrorAlert is None: - if pdb: - unexpectedErrorAlert = unexpectedErrorAlertPdb - else: - unexpectedErrorAlert = unexpectedErrorAlertPanel - - runLoop = NSRunLoop.currentRunLoop() - stopper = PyObjCAppHelperRunLoopStopper.alloc().init() - PyObjCAppHelperRunLoopStopper.addRunLoopStopper_toRunLoop_(stopper, runLoop) - - firstRun = NSApp() is None - try: - while stopper.shouldRun(): - try: - if firstRun: - firstRun = False - if installInterrupt: - installMachInterrupt() - main(argv) - else: - NSApp().run() - except RAISETHESE: - traceback.print_exc() - break - except: # noqa: E722, B001 - exctype, e, tb = sys.exc_info() - if isinstance(e, objc.error): - error_str = str(e) - - NSLog("%@", error_str) - elif not unexpectedErrorAlert(): - NSLog("%@", "An exception has occurred:") - traceback.print_exc() - sys.exit(0) - else: - NSLog("%@", "An exception has occurred:") - traceback.print_exc() - else: - break - - finally: - if Debugging is not None: - Debugging.removeExceptionHandler() - PyObjCAppHelperRunLoopStopper.removeRunLoopStopperFromRunLoop_(runLoop) diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/Conversion.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/Conversion.py deleted file mode 100644 index 220ee32..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/Conversion.py +++ /dev/null @@ -1,238 +0,0 @@ -""" -Conversion.py -- Tools for converting between Python and Objective-C objects. - -Conversion offers API to convert between Python and Objective-C instances of -various classes. Currently, the focus is on Python and Objective-C -collections. -""" - -__all__ = [ - "pythonCollectionFromPropertyList", - "propertyListFromPythonCollection", - "serializePropertyList", - "deserializePropertyList", - "toPythonDecimal", - "fromPythonDecimal", -] - -import datetime -import decimal -import time - -import Foundation -import objc -from objc._pythonify import OC_PythonFloat, OC_PythonLong - -PYTHON_TYPES = ( - str, - bool, - int, - float, - list, - tuple, - dict, - set, - datetime.date, - datetime.datetime, - bool, - type(None), - bytes, -) - -DECIMAL_LOCALE = Foundation.NSDictionary.dictionaryWithObject_forKey_( - ".", "NSDecimalSeparator" -) - - -def toPythonDecimal(aNSDecimalNumber): - """ - Convert a NSDecimalNumber to a Python decimal.Decimal - """ - return decimal.Decimal(aNSDecimalNumber.descriptionWithLocale_(DECIMAL_LOCALE)) - - -def fromPythonDecimal(aPythonDecimal): - """ - Convert a Python decimal.Decimal to a NSDecimalNumber - """ - value_str = str(aPythonDecimal) - - return Foundation.NSDecimalNumber.decimalNumberWithString_locale_( - value_str, DECIMAL_LOCALE - ) - - -FORMATS = { - "xml": Foundation.NSPropertyListXMLFormat_v1_0, - "binary": Foundation.NSPropertyListBinaryFormat_v1_0, - "ascii": Foundation.NSPropertyListOpenStepFormat, -} - - -def serializePropertyList(aPropertyList, format="xml"): # noqa: A002 - """ - Serialize a property list to an NSData object. Format is one of the - following strings: - - xml (default): - NSPropertyListXMLFormat_v1_0, the XML representation - - binary: - NSPropertyListBinaryFormat_v1_0, the efficient binary representation - - ascii: - NSPropertyListOpenStepFormat, the old-style ASCII property list - - It is expected that this property list is comprised of Objective-C - objects. In most cases Python data structures will work, but - decimal.Decimal and datetime.datetime objects are not transparently - bridged so it will fail in that case. If you expect to have these - objects in your property list, then use propertyListFromPythonCollection - before serializing it. - """ - try: - formatOption = FORMATS[format] - except KeyError: - raise ValueError(f"Invalid format: {format}") - ( - data, - err, - ) = Foundation.NSPropertyListSerialization.dataFromPropertyList_format_errorDescription_( # noqa: B950 - aPropertyList, formatOption, None - ) - if err is not None: - raise ValueError(err) - return data - - -def deserializePropertyList(propertyListData): - """ - Deserialize a property list from a NSData, str or bytes object - - Returns an Objective-C property list. - """ - if isinstance(propertyListData, str): - propertyListData = propertyListData.encode("utf-8") - ( - plist, - fmt, - err, - ) = Foundation.NSPropertyListSerialization.propertyListFromData_mutabilityOption_format_errorDescription_( # noqa: B950 - propertyListData, Foundation.NSPropertyListMutableContainers, None, None - ) - if err is not None: - raise ValueError(err) - return plist - - -def propertyListFromPythonCollection(aPyCollection, conversionHelper=None): - """ - Convert a Python collection (dict, list, tuple, string) into an - Objective-C collection. - - If conversionHelper is defined, it must be a callable. It will be called - for any object encountered for which propertyListFromPythonCollection() - cannot automatically convert the object. The supplied helper function - should convert the object and return the converted form. If the conversion - helper cannot convert the type, it should raise an exception or return - None. - """ - if isinstance(aPyCollection, dict): - collection = Foundation.NSMutableDictionary.dictionary() - for aKey in aPyCollection: - if not isinstance(aKey, str): - raise TypeError("Property list keys must be strings") - convertedValue = propertyListFromPythonCollection( - aPyCollection[aKey], conversionHelper=conversionHelper - ) - collection[aKey] = convertedValue - return collection - elif isinstance(aPyCollection, (list, tuple)): - collection = Foundation.NSMutableArray.array() - for aValue in aPyCollection: - convertedValue = propertyListFromPythonCollection( - aValue, conversionHelper=conversionHelper - ) - collection.append(convertedValue) - return collection - elif isinstance(aPyCollection, (datetime.datetime, datetime.date)): - return Foundation.NSDate.dateWithTimeIntervalSince1970_( - time.mktime(aPyCollection.timetuple()) - ) - elif isinstance(aPyCollection, (set, frozenset)): - collection = Foundation.NSMutableSet.set() - for aValue in aPyCollection: - convertedValue = propertyListFromPythonCollection( - aValue, conversionHelper=conversionHelper - ) - collection.add(convertedValue) - return collection - - elif isinstance(aPyCollection, decimal.Decimal): - return fromPythonDecimal(aPyCollection) - elif isinstance(aPyCollection, PYTHON_TYPES): - # bridge will convert - return aPyCollection - elif conversionHelper is not None: - return conversionHelper(aPyCollection) - raise TypeError( - "Type '%s' encountered in Python collection; don't know how to convert." - % type(aPyCollection) - ) - - -def pythonCollectionFromPropertyList(aCollection, conversionHelper=None): - """ - Converts a Foundation based property list into a Python - collection (all members will be instances or subclasses of standard Python - types) - - Like propertyListFromPythonCollection(), conversionHelper is an optional - callable that will be invoked any time an encountered object cannot be - converted. - """ - if isinstance(aCollection, Foundation.NSDictionary): - pyCollection = {} - for k in aCollection: - convertedValue = pythonCollectionFromPropertyList( - aCollection[k], conversionHelper - ) - pyCollection[pythonCollectionFromPropertyList(k)] = convertedValue - return pyCollection - elif isinstance(aCollection, Foundation.NSArray): - return [ - pythonCollectionFromPropertyList(item, conversionHelper) - for item in aCollection - ] - - elif isinstance(aCollection, Foundation.NSSet): - value = set() - for item in aCollection: - item = pythonCollectionFromPropertyList(item, conversionHelper) - if isinstance(item, list): - item = tuple(item) - - value.add(item) - return value - elif isinstance(aCollection, Foundation.NSData): - return bytes(aCollection) - elif isinstance(aCollection, Foundation.NSDate): - return datetime.datetime.fromtimestamp(aCollection.timeIntervalSince1970()) - elif isinstance(aCollection, (objc.pyobjc_unicode, Foundation.NSString)): - return str(aCollection) - elif isinstance(aCollection, OC_PythonLong): - return int(aCollection) - elif isinstance(aCollection, OC_PythonFloat): - return float(aCollection) - elif isinstance(aCollection, Foundation.NSDecimalNumber): - return toPythonDecimal(aCollection) - elif aCollection is Foundation.NSNull.null(): - return None - elif isinstance(aCollection, PYTHON_TYPES): - return aCollection - elif conversionHelper: - return conversionHelper(aCollection) - raise TypeError( - "Type '%s' encountered in ObjC collection; don't know how to convert." - % type(aCollection) - ) diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/FndCategories.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/FndCategories.py deleted file mode 100644 index 6f3de1a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/FndCategories.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -A number of useful categories on Foundation classes -""" -__all__ = () -import objc -from Foundation import NSAffineTransform - - -class NSAffineTransform(objc.Category(NSAffineTransform)): - def rotateByDegrees_atPoint_(self, angle, point): - """ - Rotate the coordinatespace ``angle`` degrees around - ``point``. - """ - self.rotateByDegrees_(angle) - - tf = NSAffineTransform.transform() - tf.rotateByDegrees_(-angle) - oldPt = tf.transformPoint_(point) - oldPt.x -= point.x - oldPt.y -= point.y - self.translateXBy_yBy_(oldPt.x, oldPt.y) - - def rotateByRadians_atPoint_(self, angle, point): - """ - Rotate the coordinatespace ``angle`` radians around - ``point``. - """ - self.rotateByRadians_(angle) - - tf = NSAffineTransform.transform() - tf.rotateByRadians_(-angle) - oldPt = tf.transformPoint_(point) - oldPt.x -= point.x - oldPt.y -= point.y - self.translateXBy_yBy_(oldPt.x, oldPt.y) diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/KeyValueCoding.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/KeyValueCoding.py deleted file mode 100644 index b96c301..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/KeyValueCoding.py +++ /dev/null @@ -1,384 +0,0 @@ -""" -Support for Key-Value Coding in Python. This provides a simple functional -interface to Cocoa's Key-Value coding that also works for regular Python -objects. - -Public API: - - setKey(obj, key, value) -> None - setKeyPath (obj, keypath, value) -> None - - getKey(obj, key) -> value - getKeyPath (obj, keypath) -> value - -A keypath is a string containing a sequence of keys separated by dots. The -path is followed by repeated calls to 'getKey'. This can be used to easily -access nested attributes. - -This API is mirroring the 'getattr' and 'setattr' APIs in Python, this makes -it more natural to work with Key-Value coding from Python. It also doesn't -require changes to existing Python classes to make use of Key-Value coding, -making it easier to build applications as a platform independent core with -a Cocoa GUI layer. - -See the Cocoa documentation on the Apple developer website for more -information on Key-Value coding. The protocol is basically used to enable -weaker coupling between the view and model layers. -""" - -import collections.abc -import types - -import objc - -__all__ = ("getKey", "setKey", "getKeyPath", "setKeyPath") -_null = objc.lookUpClass("NSNull").null() - - -def keyCaps(s): - return s[:1].capitalize() + s[1:] - - -# From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/393090 -# Title: Binary floating point summation accurate to full precision -# Version no: 2.2 - - -def msum(iterable): - """ - Full precision summation using multiple floats for intermediate values - """ - # sorted, non-overlapping partial sums - partials = [] - for x in iterable: - i = 0 - for y in partials: - if abs(x) < abs(y): - x, y = y, x - hi = x + y - lo = y - (hi - x) - if lo: - partials[i] = lo - i += 1 - x = hi - partials[i:] = [x] - return sum(partials, 0.0) - - -class _ArrayOperators: - @staticmethod - def avg(obj, segments): - path = ".".join(segments) - lst = getKeyPath(obj, path) - count = len(lst) - if count == 0: - return 0.0 - return msum(float(x) if x is not _null else 0.0 for x in lst) / count - - @staticmethod - def count(obj, segments): - return len(obj) - - @staticmethod - def distinctUnionOfArrays(obj, segments): - path = ".".join(segments) - rval = [] - s = set() - r = [] - for lst in obj: - for item in (getKeyPath(item, path) for item in lst): - try: - if item in s or item in r: - continue - rval.append(item) - s.add(item) - - except TypeError: - if item in rval: - continue - - rval.append(item) - r.append(item) - return rval - - @staticmethod - def distinctUnionOfSets(obj, segments): - path = ".".join(segments) - rval = set() - for lst in obj: - for item in (getKeyPath(item, path) for item in lst): - rval.add(item) - return rval - - @staticmethod - def distinctUnionOfObjects(obj, segments): - path = ".".join(segments) - rval = [] - s = set() - r = [] - for item in (getKeyPath(item, path) for item in obj): - try: - if item in s or item in r: - continue - - rval.append(item) - s.add(item) - - except TypeError: - if item in rval: - continue - - rval.append(item) - r.append(item) - return rval - - @staticmethod - def max(obj, segments): # noqa: A003 - path = ".".join(segments) - return max(x for x in getKeyPath(obj, path) if x is not _null) - - @staticmethod - def min(obj, segments): # noqa: A003 - path = ".".join(segments) - return min(x for x in getKeyPath(obj, path) if x is not _null) - - @staticmethod - def sum(obj, segments): # noqa: A003 - path = ".".join(segments) - lst = getKeyPath(obj, path) - return msum(float(x) if x is not _null else 0.0 for x in lst) - - @staticmethod - def unionOfArrays(obj, segments): - path = ".".join(segments) - rval = [] - for lst in obj: - rval.extend(getKeyPath(item, path) for item in lst) - return rval - - @staticmethod - def unionOfObjects(obj, segments): - path = ".".join(segments) - return [getKeyPath(item, path) for item in obj] - - -def getKey(obj, key): - """ - Get the attribute referenced by 'key'. The key is used - to build the name of an attribute, or attribute accessor method. - - The following attributes and accessors are tried (in this order): - - - Accessor 'getKey' - - Accesoor 'get_key' - - Accessor or attribute 'key' - - Accessor or attribute 'isKey' - - Attribute '_key' - - If none of these exist, raise KeyError - """ - if obj is None: - return None - if isinstance(obj, (objc.objc_object, objc.objc_class)): - return obj.valueForKey_(key) - - # check for dict-like objects - getitem = getattr(obj, "__getitem__", None) - if getitem is not None: - try: - return getitem(key) - except (KeyError, IndexError, TypeError): - pass - - # check for array-like objects - if isinstance( - obj, (collections.abc.Sequence, collections.abc.Set) - ) and not isinstance(obj, (str, collections.abc.Mapping)): - - def maybe_get(obj, key): - try: - return getKey(obj, key) - except KeyError: - return _null - - return [maybe_get(obj, key) for obj in iter(obj)] - - try: - m = getattr(obj, "get" + keyCaps(key)) - except AttributeError: - pass - else: - return m() - - try: - m = getattr(obj, "get_" + key) - except AttributeError: - pass - else: - return m() - - for keyName in (key, "is" + keyCaps(key)): - try: - m = getattr(obj, keyName) - except AttributeError: - continue - - if isinstance(m, types.MethodType) and m.__self__ is obj: - return m() - - elif isinstance(m, types.BuiltinMethodType): - # Can't access the bound self of methods of builtin classes :-( - return m() - - elif isinstance(m, objc.selector) and m.self is obj: - return m() - - else: - return m - - try: - return getattr(obj, "_" + key) - except AttributeError: - raise KeyError(f"Key {key} does not exist") - - -def setKey(obj, key, value): - """ - Set the attribute referenced by 'key' to 'value'. The key is used - to build the name of an attribute, or attribute accessor method. - - The following attributes and accessors are tried (in this order): - - Mapping access (that is __setitem__ for collection.Mapping instances) - - Accessor 'setKey_' - - Accessor 'setKey' - - Accessor 'set_key' - - Attribute '_key' - - Attribute 'key' - - Raises KeyError if the key doesn't exist. - """ - if obj is None: - return - if isinstance(obj, (objc.objc_object, objc.objc_class)): - obj.setValue_forKey_(value, key) - return - - if isinstance(obj, collections.abc.Mapping): - obj[key] = value - return - - aBase = "set" + keyCaps(key) - for accessor in (aBase + "_", aBase, "set_" + key): - m = getattr(obj, accessor, None) - if m is None: - continue - try: - m(value) - return - except TypeError: - pass - - try: - m = getattr(obj, key) - except AttributeError: - pass - - else: - if isinstance(m, types.MethodType) and m.__self__ is obj: - # This looks like a getter method, don't call setattr - pass - - else: - try: - setattr(obj, key, value) - return - except AttributeError: - raise KeyError(f"Key {key} does not exist") - - try: - getattr(obj, "_" + key) - except AttributeError: - pass - else: - setattr(obj, "_" + key, value) - return - - try: - setattr(obj, key, value) - except AttributeError: - raise KeyError(f"Key {key} does not exist") - - -def getKeyPath(obj, keypath): - """ - Get the value for the keypath. Keypath is a string containing a - path of keys, path elements are separated by dots. - """ - if not keypath: - raise KeyError - - if obj is None: - return None - - if isinstance(obj, (objc.objc_object, objc.objc_class)): - return obj.valueForKeyPath_(keypath) - - elements = keypath.split(".") - cur = obj - elemiter = iter(elements) - for e in elemiter: - if e[:1] == "@": - try: - oper = getattr(_ArrayOperators, e[1:]) - except AttributeError: - raise KeyError(f"Array operator {e} not implemented") - return oper(cur, elemiter) - cur = getKey(cur, e) - return cur - - -def setKeyPath(obj, keypath, value): - """ - Set the value at 'keypath'. The keypath is a string containing a - path of keys, separated by dots. - """ - if obj is None: - return - - if isinstance(obj, (objc.objc_object, objc.objc_class)): - return obj.setValue_forKeyPath_(value, keypath) - - elements = keypath.split(".") - cur = obj - for e in elements[:-1]: - cur = getKey(cur, e) - - return setKey(cur, elements[-1], value) - - -class kvc: - def __init__(self, obj): - self.__pyobjc_object__ = obj - - def __getattr__(self, attr): - return getKey(self.__pyobjc_object__, attr) - - def __repr__(self): - return repr(self.__pyobjc_object__) - - def __setattr__(self, attr, value): - if not attr.startswith("_"): - setKey(self.__pyobjc_object__, attr, value) - - else: - object.__setattr__(self, attr, value) - - def __getitem__(self, item): - if not isinstance(item, str): - raise TypeError("Keys must be strings") - return getKeyPath(self.__pyobjc_object__, item) - - def __setitem__(self, item, value): - if not isinstance(item, str): - raise TypeError("Keys must be strings") - setKeyPath(self.__pyobjc_object__, item, value) diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/MachSignals.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/MachSignals.py deleted file mode 100644 index a5e1b68..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/MachSignals.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -Substitute for the signal module when using a CFRunLoop. - -This module is generally only used to support: - PyObjCTools.AppHelper.installMachInterrupt() - -A mach port is opened and registered to the CFRunLoop. -When a signal occurs the signal number is sent in a mach -message to the CFRunLoop. The handler then causes Python -code to get executed. - -In other words, Python's signal handling code does not wake -reliably when not running Python code, but this does. - -Note that signals will only be processed while a Cocoa -run loop is running in the default mode. -""" - -from objc import _machsignals - -__all__ = ["getsignal", "signal"] - - -def getsignal(signum): - """ - Return the signal handler for signal ``signum``. Returns ``None`` when - there is no signal handler for the signal. - """ - return _machsignals._signalmapping.get(signum) - - -def signal(signum, handler): - """ - Install a new signal handler for ``signum``. Returns the old signal - handler (``None`` when there is no previous handler. - - The handler should have one argument: the signal number - """ - rval = getsignal(signum) - _machsignals._signalmapping[signum] = handler - _machsignals.handle_signal(signum) - return rval diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/Signals.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/Signals.py deleted file mode 100644 index 6b0d824..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/Signals.py +++ /dev/null @@ -1,91 +0,0 @@ -"""Signals.py -- dump a python stacktrace if something bad happens. - - DO NOT USE THIS MODULE IN PRODUCTION CODE - -This module has two functions in its public API: - -- dumpStackOnFatalSignal() - This function will install signal handlers that print a stacktrace and - then reraise the signal. - -- resetFatalSignals() - Restores the signal handlers to the state they had before the call to - dumpStackOnFatalSignal. - -This module is not designed to provide fine grained control over signal -handling. Nor is it intended to be terribly robust. It may give useful -information when your program gets unexpected signals, but it might just -as easily cause a crash when such a signal gets in. - - DO NOT USE THIS MODULE IN PRODUCTION CODE -""" - -import os -import signal -import traceback -import warnings -import sys - -__all__ = ["dumpStackOnFatalSignal", "resetFatalSignals"] - -warnings.warn( - "PyObjCTools.Signals is deprecated and will be removed in PyObjC 9", - DeprecationWarning, - stacklevel=1, -) - - -originalHandlers = None - - -def dumpHandler(signum, frame): - """ - the signal handler used in this module: print a stacktrace and - then re-raise the signal - """ - resetFatalSignals() - print("*** Handling fatal signal '%d'." % signum, file=sys.stderr) - traceback.print_stack(frame) - print("*** Restored handlers and resignaling.", file=sys.stderr) - os.kill(os.getpid(), signum) - - -def installHandler(sig): - """ - Install our signal handler for a signal. The original handler - is saved in 'originalHandlers'. - """ - originalHandlers[sig] = signal.signal(sig, dumpHandler) - - -def dumpStackOnFatalSignal(): - """ - Install signal handlers that might print a useful stack trace when - this process receives a fatal signal. - - NOTE: See module docstring - """ - - global originalHandlers - if not originalHandlers: - originalHandlers = {} - installHandler(signal.SIGQUIT) - installHandler(signal.SIGILL) - installHandler(signal.SIGTRAP) - installHandler(signal.SIGABRT) - installHandler(signal.SIGEMT) - installHandler(signal.SIGFPE) - installHandler(signal.SIGBUS) - installHandler(signal.SIGSEGV) - installHandler(signal.SIGSYS) - - -def resetFatalSignals(): - """ - Restore the original signal handlers - """ - global originalHandlers - if originalHandlers: - for sig in originalHandlers: - signal.signal(sig, originalHandlers[sig]) - originalHandlers = None diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/TestSupport.py b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/TestSupport.py deleted file mode 100644 index c4fb055..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/TestSupport.py +++ /dev/null @@ -1,1441 +0,0 @@ -""" -Helper code for implementing unittests. - -This module is unsupported and is primairily used in the PyObjC -testsuite. -""" - -import contextlib -import gc as _gc -import os as _os -import re as _re -import struct as _struct -import sys as _sys -import unittest as _unittest -import subprocess as _subprocess -import pickle as _pickle -from sysconfig import get_config_var as _get_config_var - -import objc - - -# Ensure that methods in this module get filtered in the tracebacks -# from unittest -__unittest = False - -# Have a way to disable the autorelease pool behaviour -_usepool = not _os.environ.get("PYOBJC_NO_AUTORELEASE") - -# XXX: Python 2 Compatibility for the PyObjC Test Suite -try: - unicode -except NameError: - unicode = str - -try: - long -except NameError: - long = int - -try: - basestring -except NameError: - basestring = str - -try: - unichr -except NameError: - unichr = chr - - -def _typemap(tp): - if tp is None: - return None - return ( - tp.replace(b"_NSRect", b"CGRect") - .replace(b"_NSPoint", b"CGPoint") - .replace(b"_NSSize", b"CGSize") - ) - - -@contextlib.contextmanager -def pyobjc_options(**kwds): - orig = {} - try: - for k in kwds: - orig[k] = getattr(objc.options, k) - setattr(objc.options, k, kwds[k]) - - yield - - finally: - for k in orig: - setattr(objc.options, k, orig[k]) - - -def sdkForPython(_cache=[]): # noqa: B006, M511 - """ - Return the SDK version used to compile Python itself, - or None if no framework was used - """ - if not _cache: - cflags = _get_config_var("CFLAGS") - m = _re.search(r"-isysroot\s+([^ ]*)(\s|$)", cflags) - if m is None: - _cache.append(None) - return None - - path = m.group(1) - if path == "/": - result = tuple(map(int, os_release().split("."))) - _cache.append(result) - return result - - bn = _os.path.basename(path) - version = bn[6:-4] - if version.endswith("u"): - version = version[:-1] - - result = tuple(map(int, version.split("."))) - _cache.append(result) - return result - - return _cache[0] - - -def fourcc(v): - """ - Decode four-character-code integer definition - - (e.g. 'abcd') - """ - return _struct.unpack(">i", v)[0] - - -def cast_int(value): - """ - Cast value to 32bit integer - - Usage: - cast_int(1 << 31) == -1 - - (where as: 1 << 31 == 2147483648) - """ - value = value & 0xFFFFFFFF - if value & 0x80000000: - value = ~value + 1 & 0xFFFFFFFF - return -value - else: - return value - - -def cast_longlong(value): - """ - Cast value to 64bit integer - - Usage: - cast_longlong(1 << 63) == -1 - """ - value = value & 0xFFFFFFFFFFFFFFFF - if value & 0x8000000000000000: - value = ~value + 1 & 0xFFFFFFFFFFFFFFFF - return -value - else: - return value - - -def cast_uint(value): - """ - Cast value to 32bit integer - - Usage: - cast_int(1 << 31) == 2147483648 - - """ - value = value & 0xFFFFFFFF - return value - - -def cast_ulonglong(value): - """ - Cast value to 64bit integer - """ - value = value & 0xFFFFFFFFFFFFFFFF - return value - - -_os_release = None - - -def os_release(): - """ - Returns the release of macOS (for example 10.5.1). - """ - global _os_release - if _os_release is not None: - return _os_release - - _os_release = ( - _subprocess.check_output(["sw_vers", "-productVersion"]).decode().strip() - ) - - return _os_release - - -def arch_only(arch): - """ - Usage:: - class Tests (unittest.TestCase): - - @arch_only("arm64") - def testArm64(self): - pass - - The test runs only when the specified architecture matches - """ - - def decorator(function): - return _unittest.skipUnless(objc.arch == arch, f"{arch} only")(function) - - return decorator - - -def min_python_release(version): - """ - Usage:: - - class Tests (unittest.TestCase): - - @min_python_release('3.2') - def test_python_3_2(self): - pass - """ - parts = tuple(map(int, version.split("."))) - return _unittest.skipUnless( - _sys.version_info[:2] >= parts, f"Requires Python {version} or later" - ) - - -def _sort_key(version): - parts = version.split(".") - if len(parts) == 2: - parts.append("0") - - if len(parts) != 3: - raise ValueError(f"Invalid version: {version!r}") - - return tuple(int(x) for x in parts) - - -def os_level_key(release): - """ - Return an object that can be used to compare two releases. - """ - return _sort_key(release) - - -def min_sdk_level(release): - """ - Usage:: - - class Tests (unittest.TestCase): - @min_sdk_level('10.6') - def testSnowLeopardSDK(self): - pass - """ - v = (objc.PyObjC_BUILD_RELEASE // 100, objc.PyObjC_BUILD_RELEASE % 100, 0) - return _unittest.skipUnless( - v >= os_level_key(release), f"Requires build with SDK {release} or later" - ) - - -def max_sdk_level(release): - """ - Usage:: - - class Tests (unittest.TestCase): - @max_sdk_level('10.5') - def testUntilLeopardSDK(self): - pass - """ - v = (objc.PyObjC_BUILD_RELEASE // 100, objc.PyObjC_BUILD_RELEASE % 100, 0) - return _unittest.skipUnless( - v <= os_level_key(release), f"Requires build with SDK {release} or later" - ) - - -def min_os_level(release): - """ - Usage:: - - class Tests (unittest.TestCase): - - @min_os_level('10.6') - def testSnowLeopardCode(self): - pass - """ - return _unittest.skipUnless( - os_level_key(os_release()) >= os_level_key(release), - f"Requires macOS {release} or later", - ) - - -def max_os_level(release): - """ - Usage:: - - class Tests (unittest.TestCase): - - @max_os_level('10.5') - def testUntilLeopard(self): - pass - """ - return _unittest.skipUnless( - os_level_key(os_release()) <= os_level_key(release), - f"Requires macOS up to {release}", - ) - - -def os_level_between(min_release, max_release): - """ - Usage:: - - class Tests (unittest.TestCase): - - @os_level_between('10.5', '10.8') - def testUntilLeopard(self): - pass - """ - return _unittest.skipUnless( - os_level_key(min_release) - <= os_level_key(os_release()) - <= os_level_key(max_release), - f"Requires macOS {min_release} up to {max_release}", - ) - - -_poolclass = objc.lookUpClass("NSAutoreleasePool") - -# NOTE: On at least macOS 10.8 there are multiple proxy classes for CFTypeRef... -_nscftype = tuple(cls for cls in objc.getClassList(1) if "NSCFType" in cls.__name__) - -_typealias = {} - -_typealias[objc._C_LNG_LNG] = objc._C_LNG -_typealias[objc._C_ULNG_LNG] = objc._C_ULNG - -_idlike_cache = set() - - -class TestCase(_unittest.TestCase): - """ - A version of TestCase that wraps every test into its own - autorelease pool. - - This also adds a number of useful assertion methods - """ - - # New API for testing function/method signatures, with one assert for - # the callable and one assert each for every return value and argument. - # - # Primary reason for the new API is to ensure that all metadata overrides - # are explicitly tested. - - def assertManualBinding(self, func): - if hasattr(func, "__metadata__"): - self.fail(f"{func} has automatic bindings") - - def assertIsCFType(self, tp, message=None): - if not isinstance(tp, objc.objc_class): - self.fail(message or f"{tp!r} is not a CFTypeRef type") - - if any(x is tp for x in _nscftype): - self.fail(message or f"{tp!r} is not a unique CFTypeRef type") - - for cls in tp.__bases__: - if "NSCFType" in cls.__name__: - return - - self.fail(message or f"{tp!r} is not a CFTypeRef type") - - # NOTE: Don't test if this is a subclass of one of the known - # CF roots, this tests is mostly used to ensure that the - # type is distinct from one of those roots. - # NOTE: With the next two lines enabled there are spurious test - # failures when a CF type is toll-free bridged to an - # (undocumented) Cocoa class. It might be worthwhile to - # look for these, but not in the test suite. - # if not issubclass(tp, _nscftype): - # self.fail(message or "%r is not a CFTypeRef subclass"%(tp,)) - - def assertIsEnumType(self, tp): - if not hasattr(tp, "__supertype__"): - # Ducktyping for compatibility with Python 3.7 - # or earlier. - self.fail(f"{tp!r} is not a typing.NewType") - - if tp.__supertype__ != int: - self.fail(f"{tp!r} is not a typing.NewType based on 'int'") - - def assertIsTypedEnum(self, tp, base): - if not hasattr(tp, "__supertype__"): - # Ducktyping for compatibility with Python 3.7 - # or earlier. - self.fail(f"{tp!r} is not a typing.NewType") - - if tp.__supertype__ != base: - self.fail(f"{tp!r} is not a typing.NewType based on {base.__name__!r}") - - def assertIsOpaquePointer(self, tp, message=None): - if not hasattr(tp, "__pointer__"): - self.fail(message or f"{tp!r} is not an opaque-pointer") - - if not hasattr(tp, "__typestr__"): - self.fail(message or f"{tp!r} is not an opaque-pointer") - - def assertResultIsNullTerminated(self, method, message=None): - info = method.__metadata__() - if not info.get("retval", {}).get("c_array_delimited_by_null"): - self.fail(message or f"result of {method!r} is not a null-terminated array") - - def assertIsNullTerminated(self, method, message=None): - info = method.__metadata__() - if not info.get("c_array_delimited_by_null") or not info.get("variadic"): - self.fail( - message - or "%s is not a variadic function with a " - "null-terminated list of arguments" % (method,) - ) - - def assertArgIsIDLike(self, method, argno, message=None): - global _idlike_cache - - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - tp = info["arguments"][argno + offset].get("type") - - if tp in {b"@", b"^@", b"n^@", b"N^@", b"o^@"}: - return - - if tp in _idlike_cache: - return - elif tp.startswith(b"^") and tp[1:] in _idlike_cache: - return - elif tp.startswith(b"o^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"n^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"N^") and tp[2:] in _idlike_cache: - return - - # Assume that tests are supposed to pass, - # our cache may be out of date - tmp = set(objc._idSignatures()) - _idlike_cache = set(tmp) - - if tp in _idlike_cache: - return - elif tp.startswith(b"^") and tp[1:] in _idlike_cache: - return - elif tp.startswith(b"o^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"n^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"N^") and tp[2:] in _idlike_cache: - return - - self.fail( - message or "argument %d of %r is not IDLike (%r)" % (argno, method, tp) - ) - - def assertResultIsIDLike(self, method, message=None): - global _idlike_cache - - info = method.__metadata__() - tp = info["retval"].get("type") - - if tp in {b"@", b"^@", b"n^@", b"N^@", b"o^@"}: - return - - if tp in _idlike_cache: - return - elif tp.startswith(b"^") and tp[1:] in _idlike_cache: - return - elif tp.startswith(b"o^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"n^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"N^") and tp[2:] in _idlike_cache: - return - - # Assume that tests are supposed to pass, - # our cache may be out of date - tmp = set(objc._idSignatures()) - _idlike_cache = set(tmp) - - if tp in _idlike_cache: - return - elif tp.startswith(b"^") and tp[1:] in _idlike_cache: - return - elif tp.startswith(b"o^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"n^") and tp[2:] in _idlike_cache: - return - elif tp.startswith(b"N^") and tp[2:] in _idlike_cache: - return - - self.fail(message or f"result of {method!r} is not IDLike ({tp!r})") - - def assertArgIsNullTerminated(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - if not info["arguments"][argno + offset].get("c_array_delimited_by_null"): - self.fail( - message - or "argument %d of %r is not a null-terminated array" - % (argno, method) - ) - except (KeyError, IndexError): - self.fail( - message - or "argument %d of %r is not a null-terminated array" % (argno, method) - ) - - def assertArgIsVariableSize(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - if not info["arguments"][argno + offset].get("c_array_of_variable_length"): - self.fail( - message - or "argument %d of %r is not a variable sized array" - % (argno, method) - ) - except (KeyError, IndexError): - self.fail( - message - or "argument %d of %r is not a variable sized array" % (argno, method) - ) - - def assertResultIsVariableSize(self, method, message=None): - info = method.__metadata__() - if not info.get("retval", {}).get("c_array_of_variable_length", False): - self.fail(message or f"result of {method!r} is not a variable sized array") - - def assertArgSizeInResult(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - if not info["arguments"][argno + offset].get("c_array_length_in_result"): - self.fail( - message - or "argument %d of %r does not have size in result" - % (argno, method) - ) - except (KeyError, IndexError): - self.fail( - message - or "argument %d of %r does not have size in result" % (argno, method) - ) - - def assertArgIsPrintf(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - if not info.get("variadic"): - self.fail(message or f"{method!r} is not a variadic function") - - try: - if not info["arguments"][argno + offset].get("printf_format"): - self.fail( - message - or "%r argument %d is not a printf format string" % (method, argno) - ) - except (KeyError, IndexError): - self.fail( - message - or "%r argument %d is not a printf format string" % (method, argno) - ) - - def assertArgIsCFRetained(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - - try: - if not info["arguments"][argno + offset]["already_cfretained"]: - self.fail( - message or f"Argument {argno} of {method!r} is not cfretained" - ) - except (KeyError, IndexError): - self.fail(message or f"Argument {argno} of {method!r} is not cfretained") - - def assertArgIsNotCFRetained(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - if info["arguments"][argno + offset]["already_cfretained"]: - self.fail(message or f"Argument {argno} of {method!r} is cfretained") - except (KeyError, IndexError): - pass - - def assertResultIsCFRetained(self, method, message=None): - info = method.__metadata__() - - if not info.get("retval", {}).get("already_cfretained", False): - self.fail(message or f"{method!r} is not cfretained") - - def assertResultIsNotCFRetained(self, method, message=None): - info = method.__metadata__() - if info.get("retval", {}).get("already_cfretained", False): - self.fail(message or f"{method!r} is cfretained") - - def assertArgIsRetained(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - - try: - if not info["arguments"][argno + offset]["already_retained"]: - self.fail(message or f"Argument {argno} of {method!r} is not retained") - except (KeyError, IndexError): - self.fail(message or f"Argument {argno} of {method!r} is not retained") - - def assertArgIsNotRetained(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - if info["arguments"][argno + offset]["already_retained"]: - self.fail(message or f"Argument {argno} of {method!r} is retained") - except (KeyError, IndexError): - pass - - def assertResultIsRetained(self, method, message=None): - info = method.__metadata__() - if not info.get("retval", {}).get("already_retained", False): - self.fail(message or f"Result of {method!r} is not retained") - - def assertResultIsNotRetained(self, method, message=None): - info = method.__metadata__() - if info.get("retval", {}).get("already_retained", False): - self.fail(message or f"Result of {method!r} is retained") - - def assertResultHasType(self, method, tp, message=None): - info = method.__metadata__() - typestr = info.get("retval").get("type", b"v") - if ( - typestr != tp - and _typemap(typestr) != _typemap(tp) - and _typealias.get(typestr, typestr) != _typealias.get(tp, tp) - ): - self.fail( - message - or f"result of {method!r} is not of type {tp!r}, but {typestr!r}" - ) - - def assertArgHasType(self, method, argno, tp, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - i = info["arguments"][argno + offset] - - except (KeyError, IndexError): - self.fail( - message - or "arg %d of %s has no metadata (or doesn't exist)" % (argno, method) - ) - - else: - typestr = i.get("type", b"@") - - if ( - typestr != tp - and _typemap(typestr) != _typemap(tp) - and _typealias.get(typestr, typestr) != _typealias.get(tp, tp) - ): - self.fail( - message - or "arg %d of %s is not of type %r, but %r" - % (argno, method, tp, typestr) - ) - - def assertArgIsFunction(self, method, argno, sel_type, retained, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - - try: - i = info["arguments"][argno + offset] - except (KeyError, IndexError): - self.fail( - message - or "arg %d of %s has no metadata (or doesn't exist)" % (argno, method) - ) - - else: - typestr = i.get("type", b"@") - - if typestr != b"^?": - self.fail( - message - or "arg %d of %s is not of type function_pointer" % (argno, method) - ) - - st = i.get("callable") - if st is None: - self.fail( - message - or "arg %d of %s is not of type function_pointer" % (argno, method) - ) - - try: - iface = st["retval"]["type"] - for a in st["arguments"]: - iface += a["type"] - except KeyError: - self.fail( - message - or "arg %d of %s is a function pointer with incomplete type information" - % (argno, method) - ) - - if iface != sel_type: - self.fail( - message - or "arg %d of %s is not a function_pointer with type %r, but %r" - % (argno, method, sel_type, iface) - ) - - st = info["arguments"][argno + offset].get("callable_retained", False) - if bool(st) != bool(retained): - self.fail( - message - or "arg %d of %s; retained: %r, expected: %r" - % (argno, method, st, retained) - ) - - def assertResultIsFunction(self, method, sel_type, message=None): - info = method.__metadata__() - - try: - i = info["retval"] - except (KeyError, IndexError): - self.fail( - message or f"result of {method} has no metadata (or doesn't exist)" - ) - - else: - typestr = i.get("type", b"@") - - if typestr != b"^?": - self.fail(message or f"result of {method} is not of type function_pointer") - - st = i.get("callable") - if st is None: - self.fail(message or f"result of {method} is not of type function_pointer") - - try: - iface = st["retval"]["type"] - for a in st["arguments"]: - iface += a["type"] - except KeyError: - self.fail( - message - or "result of %s is a function pointer with incomplete type information" - % (method,) - ) - - if iface != sel_type: - self.fail( - message - or "result of %s is not a function_pointer with type %r, but %r" - % (method, sel_type, iface) - ) - - def assertArgIsBlock(self, method, argno, sel_type, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - typestr = info["arguments"][argno + offset]["type"] - except (IndexError, KeyError): - self.fail("arg %d of %s does not exist" % (argno, method)) - - if typestr != b"@?": - self.fail( - message - or "arg %d of %s is not of type block: %s" % (argno, method, typestr) - ) - - st = info["arguments"][argno + offset].get("callable") - if st is None: - self.fail( - message - or "arg %d of %s is not of type block: no callable" % (argno, method) - ) - - try: - iface = st["retval"]["type"] - if st["arguments"][0]["type"] != b"^v": - self.fail( - message - or "arg %d of %s has an invalid block signature %r for argument 0" - % (argno, method, st["arguments"][0]["type"]) - ) - for a in st["arguments"][1:]: - iface += a["type"] - except KeyError: - self.fail( - message - or "result of %s is a block pointer with incomplete type information" - % (method,) - ) - - if iface != sel_type: - self.fail( - message - or "arg %d of %s is not a block with type %r, but %r" - % (argno, method, sel_type, iface) - ) - - def assertResultIsBlock(self, method, sel_type, message=None): - info = method.__metadata__() - - try: - typestr = info["retval"]["type"] - if typestr != b"@?": - self.fail( - message or f"result of {method} is not of type block: {typestr}" - ) - except KeyError: - self.fail( - message or "result of {} is not of type block: {}".format(method, b"v") - ) - - st = info["retval"].get("callable") - if st is None: - self.fail( - message - or "result of %s is not of type block: no callable specified" % (method) - ) - - try: - iface = st["retval"]["type"] - if st["arguments"][0]["type"] != b"^v": - self.fail( - message - or "result %s has an invalid block signature %r for argument 0" - % (method, st["arguments"][0]["type"]) - ) - for a in st["arguments"][1:]: - iface += a["type"] - except KeyError: - self.fail( - message - or "result of %s is a block pointer with incomplete type information" - % (method,) - ) - - if iface != sel_type: - self.fail( - message - or "result of %s is not a block with type %r, but %r" - % (method, sel_type, iface) - ) - - def assertResultIsSEL(self, method, sel_type, message=None): - info = method.__metadata__() - try: - i = info["retval"] - except (KeyError, IndexError): - self.fail( - message or f"result of {method} has no metadata (or doesn't exist)" - ) - - typestr = i.get("type", b"@") - if typestr != objc._C_SEL: - self.fail(message or f"result of {method} is not of type SEL") - - st = i.get("sel_of_type") - if st != sel_type and _typemap(st) != _typemap(sel_type): - self.fail( - message - or "result of %s doesn't have sel_type %r but %r" - % (method, sel_type, st) - ) - - def assertArgIsSEL(self, method, argno, sel_type, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - i = info["arguments"][argno + offset] - except (KeyError, IndexError): - self.fail( - message - or "arg %d of %s has no metadata (or doesn't exist)" % (argno, method) - ) - - typestr = i.get("type", b"@") - if typestr != objc._C_SEL: - self.fail(message or "arg %d of %s is not of type SEL" % (argno, method)) - - st = i.get("sel_of_type") - if st != sel_type and _typemap(st) != _typemap(sel_type): - self.fail( - message - or "arg %d of %s doesn't have sel_type %r but %r" - % (argno, method, sel_type, st) - ) - - def assertResultIsBOOL(self, method, message=None): - info = method.__metadata__() - typestr = info["retval"]["type"] - if typestr not in (objc._C_NSBOOL, objc._C_BOOL): - self.fail( - message or f"result of {method} is not of type BOOL, but {typestr!r}" - ) - - def assertArgIsBOOL(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - typestr = info["arguments"][argno + offset]["type"] - if typestr not in (objc._C_NSBOOL, objc._C_BOOL): - self.fail( - message - or "arg %d of %s is not of type BOOL, but %r" % (argno, method, typestr) - ) - - def assertArgIsFixedSize(self, method, argno, count, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - cnt = info["arguments"][argno + offset]["c_array_of_fixed_length"] - if cnt != count: - self.fail( - message - or "arg %d of %s is not a C-array of length %d" - % (argno, method, count) - ) - except (KeyError, IndexError): - self.fail( - message - or "arg %d of %s is not a C-array of length %d" % (argno, method, count) - ) - - def assertResultIsFixedSize(self, method, count, message=None): - info = method.__metadata__() - try: - cnt = info["retval"]["c_array_of_fixed_length"] - if cnt != count: - self.fail( - message - or "result of %s is not a C-array of length %d" % (method, count) - ) - except (KeyError, IndexError): - self.fail( - message - or "result of %s is not a C-array of length %d" % (method, count) - ) - - def assertArgSizeInArg(self, method, argno, count, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - try: - cnt = info["arguments"][argno + offset]["c_array_length_in_arg"] - except (KeyError, IndexError): - self.fail( - message - or "arg %d of %s is not a C-array of with length in arg %s" - % (argno, method, count) - ) - - if isinstance(count, (list, tuple)): - count2 = tuple(x + offset for x in count) - else: - count2 = count + offset - if cnt != count2: - self.fail( - message - or "arg %d of %s is not a C-array of with length in arg %s" - % (argno, method, count) - ) - - def assertResultSizeInArg(self, method, count, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - cnt = info["retval"]["c_array_length_in_arg"] - if cnt != count + offset: - self.fail( - message - or "result %s is not a C-array of with length in arg %d" - % (method, count) - ) - - def assertArgIsOut(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - typestr = info["arguments"][argno + offset]["type"] - if not typestr.startswith(b"o^") and not typestr.startswith(b"o*"): - self.fail( - message or "arg %d of %s is not an 'out' argument" % (argno, method) - ) - - def assertArgIsInOut(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - typestr = info["arguments"][argno + offset]["type"] - if not typestr.startswith(b"N^") and not typestr.startswith(b"N*"): - self.fail( - message or "arg %d of %s is not an 'inout' argument" % (argno, method) - ) - - def assertArgIsIn(self, method, argno, message=None): - if isinstance(method, objc.selector): - offset = 2 - else: - offset = 0 - info = method.__metadata__() - typestr = info["arguments"][argno + offset]["type"] - if not typestr.startswith(b"n^") and not typestr.startswith(b"n*"): - self.fail( - message or "arg %d of %s is not an 'in' argument" % (argno, method) - ) - - def assertStartswith(self, value, test, message=None): - if not value.startswith(test): - self.fail(message or f"{value!r} does not start with {test!r}") - - def assertHasAttr(self, value, key, message=None): - if not hasattr(value, key): - self.fail(message or f"{key} is not an attribute of {value!r}") - - def assertNotHasAttr(self, value, key, message=None): - if hasattr(value, key): - self.fail(message or f"{key} is an attribute of {value!r}") - - def assertIsSubclass(self, value, types, message=None): - if not issubclass(value, types): - self.fail(message or f"{value} is not a subclass of {types!r}") - - def assertIsNotSubclass(self, value, types, message=None): - if issubclass(value, types): - self.fail(message or f"{value} is a subclass of {types!r}") - - def assertClassIsFinal(self, cls): - if not isinstance(cls, objc.objc_class): - self.fail(f"{cls} is not an Objective-C class") - elif not cls.__objc_final__: - self.fail(f"{cls} is not a final class") - - def assertProtocolExists(self, name): - ok = True - try: - proto = objc.protocolNamed(name) - - except objc.ProtocolError: - ok = False - - if not ok: - self.fail(f"Protocol {name!r} does not exist") - - if not isinstance(proto, objc.formal_protocol): - # Should never happen - self.fail(f"Protocol {name!r} is not a protocol, but {type(proto)}") - - def assertPickleRoundTrips(self, value): - try: - buf = _pickle.dumps(value) - clone = _pickle.loads(buf) - except Exception: - self.fail(f"{value} cannot be pickled") - - self.assertEqual(clone, value) - self.assertIsInstance(clone, type(value)) - - def _validateCallableMetadata( - self, value, class_name=None, skip_simple_charptr_check=False - ): - if False and isinstance(value, objc.selector): - # Check if the signature might contain types that are interesting - # for this method. This avoids creating a metadata dict for 'simple' - # methods. - # XXX: Disabled this shortcut due to adding already_retained tests - signature = value.signature - if objc._C_PTR not in signature and objc._C_CHARPTR not in signature: - return - - callable_meta = value.__metadata__() - argcount = len(callable_meta["arguments"]) - - for idx, meta in [("retval", callable_meta["retval"])] + list( - enumerate(callable_meta["arguments"]) - ): - if meta.get("already_retained", False) and meta.get( - "already_cfretained", False - ): - self.fail( - f"{value}: {idx}: both already_retained and already_cfretained" - ) - - if meta["type"].endswith(objc._C_PTR + objc._C_CHR) or meta[ - "type" - ].endswith(objc._C_CHARPTR): - if meta.get("c_array_delimited_by_null", False): - self.fail( - f"{value}: {idx}: null-delimited 'char*', use _C_CHAR_AS_TEXT instead {class_name or ''}" - ) - if not skip_simple_charptr_check: - self.fail(f"{value}: {idx}: 'char*' {class_name or ''}") - - v = meta.get("c_array_size_in_arg", None) - if isinstance(v, int): - if not (0 <= v < argcount): - self.fail( - f"{value}: {idx}: c_array_size_in_arg out of range {v} {class_name or ''}" - ) - elif isinstance(v, tuple): - b, e = v - if not (0 <= b < argcount): - self.fail( - f"{value}: {idx}: c_array_size_in_arg out of range {b} {class_name or ''}" - ) - if not (0 <= e < argcount): - self.fail( - f"{value}: {idx}: c_array_size_in_arg out of range {e} {class_name or ''}" - ) - - tp = meta["type"] - if any( - tp.startswith(pfx) for pfx in (objc._C_IN, objc._C_OUT, objc._C_INOUT) - ): - rest = tp[1:] - if not rest.startswith(objc._C_PTR) and not rest.startswith( - objc._C_CHARPTR - ): - self.fail( - f"{value}: {idx}: byref specifier on non-pointer: {tp} {class_name or ''}" - ) - - rest = rest[1:] - - if rest.startswith(objc._C_STRUCT_B): - name, fields = objc.splitStructSignature(rest) - if not fields: - self.fail( - f"{value}: {idx}: byref to empty struct (handle/CFType?): {tp} {class_name or ''}" - ) - - if not isinstance(value, objc.selector): - # This gives too many false positives for selectors (sadly) - if ( - tp.startswith(objc._C_PTR) - and tp not in (b"^v", b"^?") - and tp != b"^{AudioBufferList=I[1{AudioBuffer=II^v}]}" - and tp != b"^{_CFArrayCallBacks=q^?^?^?^?}" - ): - if tp[1:].startswith(objc._C_STRUCT_B): - name, fields = objc.splitStructSignature(tp[1:]) - if not fields: - continue - - if idx == "retval": - if any( - x in meta - for x in { - "deref_result_pointer", - "c_array_delimited_by_null", - "c_array_of_variable_length", - "c_array_length_in_arg", - "c_array_size_in_arg", - } - ): - continue - self.fail( - f"{value}: {idx}: pointer argument, but no by-ref annotation:{tp!r} {class_name or ''}" - ) - - def assertCallableMetadataIsSane( - self, module, *, exclude_cocoa=True, exclude_attrs=() - ): - # Do some sanity checking on module metadata for - # callables. - # - # This test is *very* expensive, made slightly - # better by excluding CoreFoundation/Foundation/AppKit - # by default - # - # XXX: exclude_cocoa may exclude too much depending on - # import order. - - if hasattr(module, "__bundle__"): - with self.subTest("validate framework identifier"): - self.assertHasAttr(module, "__framework_identifier__") - self.assertEqual( - module.__bundle__.bundleIdentifier(), - module.__framework_identifier__, - ) - - if exclude_cocoa: - import Cocoa - - exclude_names = set(dir(Cocoa)) - - # Don't exclude NSObject' because a number - # of frameworks define categories on this class. - exclude_names -= {"NSObject"} - else: - exclude_names = set() - - exclude_method_names = { - "copyRenderedTextureForCGLContext_pixelFormat_bounds_isFlipped_", - "newTaggedNSStringWithASCIIBytes__length__", - "utf8ValueSafe", - "utf8ValueSafe_", - "isKeyExcludedFromWebScript_", - } - - exclude_attrs = set(exclude_attrs) - exclude_attrs.add("FBSMutableSceneClientSettings") - exclude_attrs.add("FBSSceneClientSettings") - exclude_attrs.add(("NSColor", "scn_C3DColorIgnoringColorSpace_success_")) - exclude_attrs.add( - ("AVKitPlatformColorClass", "scn_C3DColorIgnoringColorSpace_success_") - ) - exclude_attrs.add( - ("PDFKitPlatformColor", "scn_C3DColorIgnoringColorSpace_success_") - ) - exclude_attrs.add(("SCNColor", "scn_C3DColorIgnoringColorSpace_success_")) - exclude_attrs.add(("SKColor", "scn_C3DColorIgnoringColorSpace_success_")) - exclude_attrs.add( - ( - "NSObject", - "copyRenderedTextureForCGLContext_pixelFormat_bounds_isFlipped_", - ) - ) - exclude_attrs.add( - ( - "NSObject", - "newTaggedNSStringWithASCIIBytes__length__", - ) - ) - exclude_attrs.add( - ( - "NSObject", - "utf8ValueSafe", - ) - ) - exclude_attrs.add( - ( - "NSObject", - "utf8ValueSafe_", - ) - ) - exclude_attrs.add( - ( - "NSObject", - "isKeyExcludedFromWebScript_", - ) - ) - - # Two (private) classes that end up being found in - # test runs on macOS 10.12 and 10.13 - exclude_attrs.add("ABCDContact_ABCDContact_") - exclude_attrs.add("ABCDGroup_ABCDGroup_") - - # Some bindings in CoreAudio with false positives - exclude_attrs.add("AudioHardwareClaimAudioDeviceID") - exclude_attrs.add("AudioHardwareClaimAudioStreamID") - exclude_attrs.add("AudioHardwareDevicePropertyChanged") - exclude_attrs.add("AudioHardwareDevicesCreated") - exclude_attrs.add("AudioHardwareDevicesDied") - exclude_attrs.add("AudioHardwareStreamPropertyChanged") - exclude_attrs.add("AudioHardwareStreamsCreated") - exclude_attrs.add("AudioHardwareStreamsDied") - exclude_attrs.add("AudioObjectCreate") - exclude_attrs.add("AudioObjectPropertiesChanged") - exclude_attrs.add("AudioObjectsPublishedAndDied") - - # Calculate all (interesting) names in the module. This pokes into - # the implementation details of objc.ObjCLazyModule to avoid loading - # all attributes (which is expensive for larger bindings). - if isinstance(module, objc.ObjCLazyModule) and False: - module_names = [] - module_names.extend( - cls.__name__ - for cls in objc.getClassList() - if (not cls.__name__.startswith("_")) and ("." not in cls.__name__) - ) - module_names.extend(module._ObjCLazyModule__funcmap or []) - module_names.extend(module.__dict__.keys()) - todo = list(module._ObjCLazyModule__parents or []) - while todo: - parent = todo.pop() - if isinstance(parent, objc.ObjCLazyModule): - module_names.extend(parent._ObjCLazyModule__funcmap or ()) - todo.extend(parent._ObjCLazyModule__parents or ()) - module_names.extend(parent.__dict__.keys()) - else: - module_names.extend(dir(module)) - - # The module_names list might contain duplicates - module_names = sorted(set(module_names)) - else: - module_names = sorted(set(dir(module))) - - for _idx, nm in enumerate(module_names): - # print(f"{_idx}/{len(module_names)} {nm}") - if nm in exclude_names: - continue - if nm in exclude_attrs: - continue - - try: - value = getattr(module, nm) - except AttributeError: - continue - if isinstance(value, objc.objc_class): - if value.__name__ == "Object": - # Root class, does not conform to the NSObject - # protocol and useless to test. - continue - for attr_name, attr in value.pyobjc_instanceMethods.__dict__.items(): - if attr_name in exclude_method_names: - continue - if (nm, attr_name) in exclude_attrs: - continue - if attr_name.startswith("_"): - # Skip private names - continue - - with self.subTest(classname=nm, instance_method=attr_name): - if isinstance(attr, objc.selector): # pragma: no branch - self._validateCallableMetadata( - attr, nm, skip_simple_charptr_check=not exclude_cocoa - ) - - for attr_name, attr in value.pyobjc_classMethods.__dict__.items(): - if attr_name in exclude_method_names: - continue - if (nm, attr_name) in exclude_attrs: - continue - if attr_name.startswith("_"): - # Skip private names - continue - - with self.subTest(classname=nm, instance_method=attr_name): - attr = getattr(value.pyobjc_classMethods, attr_name, None) - if isinstance(attr, objc.selector): # pragma: no branch - self._validateCallableMetadata( - attr, nm, skip_simple_charptr_check=not exclude_cocoa - ) - elif isinstance(value, objc.function): - with self.subTest(function=nm): - self._validateCallableMetadata(value) - - else: - continue - - def __init__(self, methodName="runTest"): - super().__init__(methodName) - - testMethod = getattr(self, methodName) - - if getattr(testMethod, "_no_autorelease_pool", False): - self._skip_usepool = True - else: - self._skip_usepool = False - - def run(self, *args, **kwds): - """ - Run the test, same as unittest.TestCase.run, but every test is - run with a fresh autorelease pool. - """ - try: - cls = objc.lookUpClass("NSApplication") - except objc.error: - pass - else: - cls.sharedApplication() - - if _usepool and not self._skip_usepool: - p = _poolclass.alloc().init() - else: - p = 1 - - try: - _unittest.TestCase.run(self, *args, **kwds) - finally: - _gc.collect() - del p - _gc.collect() - - -main = _unittest.main -expectedFailure = _unittest.expectedFailure -skipUnless = _unittest.skipUnless -SkipTest = _unittest.SkipTest - - -def expectedFailureIf(condition): - if condition: - return expectedFailure - else: - return lambda func: func - - -def no_autorelease_pool(func): - func._no_autorelease_pool = True - return func diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/AppCategories.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/AppCategories.cpython-310.pyc deleted file mode 100644 index 7f990a6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/AppCategories.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/AppHelper.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/AppHelper.cpython-310.pyc deleted file mode 100644 index 05a1a76..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/AppHelper.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/Conversion.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/Conversion.cpython-310.pyc deleted file mode 100644 index 1753286..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/Conversion.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/FndCategories.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/FndCategories.cpython-310.pyc deleted file mode 100644 index eba6eec..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/FndCategories.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/KeyValueCoding.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/KeyValueCoding.cpython-310.pyc deleted file mode 100644 index d27d4c9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/KeyValueCoding.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/MachSignals.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/MachSignals.cpython-310.pyc deleted file mode 100644 index 962882f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/MachSignals.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/Signals.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/Signals.cpython-310.pyc deleted file mode 100644 index 71ca89c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/Signals.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/TestSupport.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/TestSupport.cpython-310.pyc deleted file mode 100644 index 1be1769..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/PyObjCTools/__pycache__/TestSupport.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/PKG-INFO b/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/PKG-INFO deleted file mode 100644 index 745689a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/PKG-INFO +++ /dev/null @@ -1,132 +0,0 @@ -Metadata-Version: 2.1 -Name: PyRect -Version: 0.2.0 -Summary: PyRect is a simple module with a Rect class for Pygame-like rectangular areas. -Home-page: https://github.com/asweigart/pyrect -Author: Al Sweigart -Author-email: al@inventwithpython.com -License: BSD -Keywords: pygame rect rectangular rectangle area -Classifier: Development Status :: 4 - Beta -Classifier: Environment :: Win32 (MS Windows) -Classifier: Environment :: MacOS X -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.5 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.1 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.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 -License-File: LICENSE.txt -License-File: AUTHORS.txt - -====== -PyRect -====== -PyRect is a simple module with a Rect class for Pygame-like rectangular areas. - -This module is like a stand-alone version of Pygame's Rect class. It is similar to the Rect module by Simon Wittber, but compatible with both Python 2 and 3. - -Currently under development, though the basic features work. - -Installation -============ - - ``pip install pyrect`` - -Quickstart Guide -================ - -First, create a Rect object by providing the XY coordinates of its top-left corner, and then the width and height: - - >>> import pyrect - >>> r = pyrect.Rect(0, 0, 10, 20) - -There are several attributes that are automatically calculated (they have the same names as Pygame's Rect objects): - - >>> r.width, r.height, r.size - (10, 20, (10, 20)) - >>> r. left - 0 - >>> r.right - 10 - >>> r.top - 0 - >>> r.bottom - 20 - >>> r.center - (5, 10) - >>> r.topleft - (0, 0) - >>> r.topright - (10, 0) - >>> r.midleft - (0, 10) - -Changing these attributes re-calculates the others. The top-left corner is anchored for any growing or shrinking that takes place. - - >>> r.topleft - (0, 0) - >>> r.left = 100 - >>> r.topleft - (100, 0) - >>> r.topright - (110, 0) - >>> r.width = 30 - >>> r.topright - (130, 0) - -Rect objects are locked to integers, unless you set `enableFloat` to `True`: - - >>> r = pyrect.Rect(0, 0, 10, 20) - >>> r.width = 10.5 - >>> r.width - 10 - >>> r.enableFloat = True - >>> r.width = 10.5 - >>> r.width - 10.5 - >>> r2 = pyrect.Rect(0, 0, 10.5, 20.5, enableFloat=True) - >>> r2.size - (10.5, 20.5) - -Rect Attributes -=============== - -Rect objects have several attributes that can be read or modified. They are identical to Pygame's Rect objects: - - ``x, y`` - - ``top, left, bottom, right`` - - ``topleft, bottomleft, topright, bottomright`` - - ``midtop, midleft, midbottom, midright`` - - ``center, centerx, centery`` - - ``size, width, height`` - - ``w, h`` - -There are a couple other attributes as well: - - ``box (a tuple (left, top, width, height))`` - - ``area (read-only)`` - - ``perimeter (read-only)`` - diff --git a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/SOURCES.txt b/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/SOURCES.txt deleted file mode 100644 index 742ce2f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/SOURCES.txt +++ /dev/null @@ -1,18 +0,0 @@ -AUTHORS.txt -LICENSE.txt -README.rst -setup.cfg -setup.py -PyRect.egg-info/PKG-INFO -PyRect.egg-info/SOURCES.txt -PyRect.egg-info/dependency_links.txt -PyRect.egg-info/top_level.txt -docs/Makefile -docs/conf.py -docs/index.rst -docs/make.bat -docs/modules.rst -docs/pyrect.rst -docs/roadmap.rst -pyrect/__init__.py -tests/test_pyrect.py \ No newline at end of file diff --git a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/dependency_links.txt b/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/installed-files.txt b/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/installed-files.txt deleted file mode 100644 index 82d983b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/installed-files.txt +++ /dev/null @@ -1,6 +0,0 @@ -../pyrect/__init__.py -../pyrect/__pycache__/__init__.cpython-310.pyc -PKG-INFO -SOURCES.txt -dependency_links.txt -top_level.txt diff --git a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/top_level.txt deleted file mode 100644 index f2b1100..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyRect-0.2.0-py3.10.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -pyrect diff --git a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/LICENSE b/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/LICENSE deleted file mode 100644 index 2f1b8e1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2017-2021 Ingy döt Net -Copyright (c) 2006-2016 Kirill Simonov - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/METADATA deleted file mode 100644 index db029b7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/METADATA +++ /dev/null @@ -1,46 +0,0 @@ -Metadata-Version: 2.1 -Name: PyYAML -Version: 6.0.2 -Summary: YAML parser and emitter for Python -Home-page: https://pyyaml.org/ -Download-URL: https://pypi.org/project/PyYAML/ -Author: Kirill Simonov -Author-email: xi@resolvent.net -License: MIT -Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues -Project-URL: CI, https://github.com/yaml/pyyaml/actions -Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation -Project-URL: Mailing lists, http://lists.sourceforge.net/lists/listinfo/yaml-core -Project-URL: Source Code, https://github.com/yaml/pyyaml -Platform: Any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Cython -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.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 :: 3.13 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Text Processing :: Markup -Requires-Python: >=3.8 -License-File: LICENSE - -YAML is a data serialization format designed for human readability -and interaction with scripting languages. PyYAML is a YAML parser -and emitter for Python. - -PyYAML features a complete YAML 1.1 parser, Unicode support, pickle -support, capable extension API, and sensible error messages. PyYAML -supports standard YAML tags and provides Python-specific tags that -allow to represent an arbitrary Python object. - -PyYAML is applicable for a broad range of tasks from complex -configuration files to object serialization and persistence. diff --git a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/RECORD deleted file mode 100644 index dfd1804..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/RECORD +++ /dev/null @@ -1,43 +0,0 @@ -PyYAML-6.0.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -PyYAML-6.0.2.dist-info/LICENSE,sha256=jTko-dxEkP1jVwfLiOsmvXZBAqcoKVQwfT5RZ6V36KQ,1101 -PyYAML-6.0.2.dist-info/METADATA,sha256=9-odFB5seu4pGPcEv7E8iyxNF51_uKnaNGjLAhz2lto,2060 -PyYAML-6.0.2.dist-info/RECORD,, -PyYAML-6.0.2.dist-info/WHEEL,sha256=ouErvQ11jObv_Zc_3angaSrUe1BdXm5BVGaL2Y171WY,110 -PyYAML-6.0.2.dist-info/top_level.txt,sha256=rpj0IVMTisAjh_1vG3Ccf9v5jpCQwAz6cD1IVU5ZdhQ,11 -_yaml/__init__.py,sha256=04Ae_5osxahpJHa3XBZUAf4wi6XX32gR8D6X6p64GEA,1402 -_yaml/__pycache__/__init__.cpython-310.pyc,, -yaml/__init__.py,sha256=N35S01HMesFTe0aRRMWkPj0Pa8IEbHpE9FK7cr5Bdtw,12311 -yaml/__pycache__/__init__.cpython-310.pyc,, -yaml/__pycache__/composer.cpython-310.pyc,, -yaml/__pycache__/constructor.cpython-310.pyc,, -yaml/__pycache__/cyaml.cpython-310.pyc,, -yaml/__pycache__/dumper.cpython-310.pyc,, -yaml/__pycache__/emitter.cpython-310.pyc,, -yaml/__pycache__/error.cpython-310.pyc,, -yaml/__pycache__/events.cpython-310.pyc,, -yaml/__pycache__/loader.cpython-310.pyc,, -yaml/__pycache__/nodes.cpython-310.pyc,, -yaml/__pycache__/parser.cpython-310.pyc,, -yaml/__pycache__/reader.cpython-310.pyc,, -yaml/__pycache__/representer.cpython-310.pyc,, -yaml/__pycache__/resolver.cpython-310.pyc,, -yaml/__pycache__/scanner.cpython-310.pyc,, -yaml/__pycache__/serializer.cpython-310.pyc,, -yaml/__pycache__/tokens.cpython-310.pyc,, -yaml/_yaml.cpython-310-darwin.so,sha256=msW_rKn1orYPl37o3WFkLntefS1XILMlu7BczfK5wBw,359112 -yaml/composer.py,sha256=_Ko30Wr6eDWUeUpauUGT3Lcg9QPBnOPVlTnIMRGJ9FM,4883 -yaml/constructor.py,sha256=kNgkfaeLUkwQYY_Q6Ff1Tz2XVw_pG1xVE9Ak7z-viLA,28639 -yaml/cyaml.py,sha256=6ZrAG9fAYvdVe2FK_w0hmXoG7ZYsoYUwapG8CiC72H0,3851 -yaml/dumper.py,sha256=PLctZlYwZLp7XmeUdwRuv4nYOZ2UBnDIUy8-lKfLF-o,2837 -yaml/emitter.py,sha256=jghtaU7eFwg31bG0B7RZea_29Adi9CKmXq_QjgQpCkQ,43006 -yaml/error.py,sha256=Ah9z-toHJUbE9j-M8YpxgSRM5CgLCcwVzJgLLRF2Fxo,2533 -yaml/events.py,sha256=50_TksgQiE4up-lKo_V-nBy-tAIxkIPQxY5qDhKCeHw,2445 -yaml/loader.py,sha256=UVa-zIqmkFSCIYq_PgSGm4NSJttHY2Rf_zQ4_b1fHN0,2061 -yaml/nodes.py,sha256=gPKNj8pKCdh2d4gr3gIYINnPOaOxGhJAUiYhGRnPE84,1440 -yaml/parser.py,sha256=ilWp5vvgoHFGzvOZDItFoGjD6D42nhlZrZyjAwa0oJo,25495 -yaml/reader.py,sha256=0dmzirOiDG4Xo41RnuQS7K9rkY3xjHiVasfDMNTqCNw,6794 -yaml/representer.py,sha256=IuWP-cAW9sHKEnS0gCqSa894k1Bg4cgTxaDwIcbRQ-Y,14190 -yaml/resolver.py,sha256=9L-VYfm4mWHxUD1Vg4X7rjDRK_7VZd6b92wzq7Y2IKY,9004 -yaml/scanner.py,sha256=YEM3iLZSaQwXcQRg2l2R4MdT0zGP2F9eHkKGKnHyWQY,51279 -yaml/serializer.py,sha256=ChuFgmhU01hj4xgI8GaKv6vfM2Bujwa9i7d2FAHj7cA,4165 -yaml/tokens.py,sha256=lTQIzSVw8Mg9wv459-TjiOQe6wVziqaRlqX2_89rp54,2573 diff --git a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/WHEEL deleted file mode 100644 index 92607bf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.44.0) -Root-Is-Purelib: false -Tag: cp310-cp310-macosx_11_0_arm64 - diff --git a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/top_level.txt deleted file mode 100644 index e6475e9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/top_level.txt +++ /dev/null @@ -1,2 +0,0 @@ -_yaml -yaml diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__init__.py deleted file mode 100644 index de38fa6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__init__.py +++ /dev/null @@ -1,80 +0,0 @@ -""" -Python mapping for the CoreGraphics framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import CoreFoundation - import objc - import os - from . import ( - _metadata, - _callbacks, - _doubleindirect, - _sortandmap, - _coregraphics, - _contextmanager, - ) - from ._inlines import _inline_list_ - - if os.path.exists("/System/Library/Frameworks/CoreGraphics.framework"): - frameworkPath = "/System/Library/Frameworks/CoreGraphics.framework" - frameworkIdentifier = "com.apple.CoreGraphics" - else: - frameworkPath = "/System/Library/Frameworks/ApplicationServices.framework" - frameworkIdentifier = "com.apple.ApplicationServices" - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.CoreGraphics", - frameworkIdentifier=frameworkIdentifier, - frameworkPath=objc.pathForFramework(frameworkPath), - globals_dict=globals(), - inline_list=_inline_list_, - parents=( - _callbacks, - _doubleindirect, - _sortandmap, - _coregraphics, - _contextmanager, - CoreFoundation, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.CoreGraphics._metadata"] - - # XXX: To be verified - from . import CGPathElement - - _sortandmap.setCGPathElement(CGPathElement) - del _sortandmap.setCGPathElement - - # XXX: Move these to metadata! - - global CGFLOAT_MIN, CGFLOAT_MAX - CGFLOAT_MIN = 1.175_494_350_822_287_5e-38 - CGFLOAT_MAX = 3.402_823_466_385_288_6e38 - - global kCGAnyInputEventType - kCGAnyInputEventType = 0xFFFFFFFF - - global CGEventMaskBit - - def CGEventMaskBit(eventType): - return 1 << eventType - - global kCGColorSpaceUserGray, kCGColorSpaceUserRGB, kCGColorSpaceUserCMYK - kCGColorSpaceUserGray = "kCGColorSpaceUserGray" - kCGColorSpaceUserRGB = "kCGColorSpaceUserRGB" - kCGColorSpaceUserCMYK = "kCGColorSpaceUserCMYK" - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 45cc22e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/_contextmanager.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/_contextmanager.cpython-310.pyc deleted file mode 100644 index 92607d4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/_contextmanager.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index 2c6ceab..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_callbacks.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_callbacks.cpython-310-darwin.so deleted file mode 100755 index 0aa86aa..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_callbacks.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_contextmanager.py b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_contextmanager.py deleted file mode 100644 index dd6738c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_contextmanager.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -This module defines a number of context managers. These are meant to be used -in the context of the with statement (introduced in Python 2.5). -""" -__all__ = ("CGSavedGState", "CGTransparencyLayer", "CGContextPage") -import Quartz - - -class CGSavedGState: - """ - Context manager for saving and restoring the graphics state. - - Usage:: - - with CGSavedGState(context): - statement - - This is equivalent to: - CGContextSaveGState(context) - try: - statement - - finally: - CGContextRestoreGState(context) - """ - - def __init__(self, context): - self.context = context - - def __enter__(self): - Quartz.CGContextSaveGState(self.context) - return self - - def __exit__(self, exc_type, exc_value, exc_tp): - Quartz.CGContextRestoreGState(self.context) - return False - - -class CGTransparencyLayer: - """ - Context manager for working in a transparancylayer. - - Usage:: - - with CGTransparencyLayer(context, info [, rect]): - statement - - This is equivalent to: - CGContextBeginTransparencyLayer(context, info) - try: - statement - - finally: - CGContextEndTransparencyLayer(context) - """ - - def __init__(self, context, info, rect=None): - self.context = context - self.info = info - self.rect = rect - - def __enter__(self): - if self.rect is None: - result = Quartz.CGContextBeginTransparencyLayer(self.context, self.info) - else: - result = Quartz.CGContextBeginTransparencyLayerWithRect( - self.context, self.rect, self.info - ) - return result - - def __exit__(self, exc_type, exc_value, exc_tp): - Quartz.CGContextEndTransparencyLayer(self.context) - return False - - -class CGContextPage: - """ - Context manager for saving and restoring the graphics state. - - Usage:: - - with CGContextPage(context) as mediaRect: - statement - - This is equivalent to: - mediaRect = CGContextBeginPage(context, None) - try: - statement - - finally: - CGContextEndPage(context) - """ - - def __init__(self, context, mediaBox=None): - self.context = context - self.mediaBox = mediaBox - - def __enter__(self): - mediaRect = Quartz.CGContextBeginPage(self.context, self.mediaBox) - return mediaRect - - def __exit__(self, exc_type, exc_value, exc_tp): - Quartz.CGContextEndPage(self.context) - return False diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_coregraphics.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_coregraphics.cpython-310-darwin.so deleted file mode 100755 index 0e30917..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_coregraphics.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_doubleindirect.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_doubleindirect.abi3.so deleted file mode 100755 index 6786374..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_doubleindirect.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_inlines.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_inlines.abi3.so deleted file mode 100755 index ce3575d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_inlines.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_metadata.py deleted file mode 100644 index 1de7898..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_metadata.py +++ /dev/null @@ -1,2785 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 1 14:05:21 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -misc.update( - { - "CGFunctionCallbacks": objc.createStructType( - "Quartz.CoreGraphics.CGFunctionCallbacks", - b"{CGFunctionCallbacks=I^?^?}", - [], - ), - "CGDeviceByteColor": objc.createStructType( - "Quartz.CoreGraphics.CGDeviceByteColor", - b"{CGDeviceByteColor=CCC}", - ["red", "green", "blue"], - ), - "CGDataProviderCallbacks": objc.createStructType( - "Quartz.CoreGraphics.CGDataProviderCallbacks", - b"{CGDataProviderCallbacks=^?^?^?^?}", - [], - ), - "CGDataProviderSequentialCallbacks": objc.createStructType( - "Quartz.CoreGraphics.CGDataProviderSequentialCallbacks", - b"{CGDataProviderSequentialCallbacks=I^?^?^?^?}", - [], - ), - "CGPatternCallbacks": objc.createStructType( - "Quartz.CoreGraphics.CGPatternCallbacks", b"{CGPatternCallbacks=I^?^?}", [] - ), - "CGDeviceColor": objc.createStructType( - "Quartz.CoreGraphics.CGDeviceColor", - b"{CGDeviceColor=fff}", - ["red", "green", "blue"], - ), - "CGColorDataFormat": objc.createStructType( - "Quartz.CoreGraphics.CGColorDataFormat", - b"{CGColorDataFormat=I@IQQi^d}", - [ - "version", - "colorspace_info", - "bitmap_info", - "bits_per_component", - "bytes_per_row", - "intent", - "decode", - ], - ), - "CGDataConsumerCallbacks": objc.createStructType( - "Quartz.CoreGraphics.CGDataConsumerCallbacks", - b"{CGDataConsumerCallbacks=^?^?}", - [], - ), - "CGDataProviderDirectAccessCallbacks": objc.createStructType( - "Quartz.CoreGraphics.CGDataProviderDirectAccessCallbacks", - b"{CGDataProviderDirectAccessCallbacks=^?^?^?^?}", - [], - ), - "CGPathElement": objc.createStructType( - "Quartz.CoreGraphics.CGPathElement", - b"{CGPathElement=i^{CGPoint=dd}}", - ["type", "points"], - ), - "CGScreenUpdateMoveDelta": objc.createStructType( - "Quartz.CoreGraphics.CGScreenUpdateMoveDelta", - b"{CGScreenUpdateMoveDelta=ii}", - ["dX", "dY"], - ), - "CGEventTapInformation": objc.createStructType( - "Quartz.CoreGraphics.CGEventTapInformation", - b"{__CGEventTapInformation=IIIQiiBfff}", - [ - "eventTapID", - "tapPoint", - "options", - "eventsOfInterest", - "tappingProcess", - "processBeingTapped", - "enabled", - "minUsecLatency", - "avgUsecLatency", - "maxUsecLatency", - ], - ), - "CGPSConverterCallbacks": objc.createStructType( - "Quartz.CoreGraphics.CGPSConverterCallbacks", - b"{CGPSConverterCallbacks=I^?^?^?^?^?^?^?}", - [], - ), - } -) -constants = """$CGAffineTransformIdentity@{CGAffineTransform=dddddd}$CGPointZero@{CGPoint=dd}$CGRectInfinite@{CGRect={CGPoint=dd}{CGSize=dd}}$CGRectNull@{CGRect={CGPoint=dd}{CGSize=dd}}$CGRectZero@{CGRect={CGPoint=dd}{CGSize=dd}}$CGSizeZero@{CGSize=dd}$kCGColorBlack$kCGColorClear$kCGColorConversionBlackPointCompensation$kCGColorConversionTRCSize$kCGColorSpaceACESCGLinear$kCGColorSpaceAdobeRGB1998$kCGColorSpaceDCIP3$kCGColorSpaceDisplayP3$kCGColorSpaceDisplayP3_HLG$kCGColorSpaceDisplayP3_PQ$kCGColorSpaceDisplayP3_PQ_EOTF$kCGColorSpaceExtendedDisplayP3$kCGColorSpaceExtendedGray$kCGColorSpaceExtendedITUR_2020$kCGColorSpaceExtendedLinearDisplayP3$kCGColorSpaceExtendedLinearGray$kCGColorSpaceExtendedLinearITUR_2020$kCGColorSpaceExtendedLinearSRGB$kCGColorSpaceExtendedRange$kCGColorSpaceExtendedSRGB$kCGColorSpaceGenericCMYK$kCGColorSpaceGenericGray$kCGColorSpaceGenericGrayGamma2_2$kCGColorSpaceGenericLab$kCGColorSpaceGenericRGB$kCGColorSpaceGenericRGBLinear$kCGColorSpaceGenericXYZ$kCGColorSpaceITUR_2020$kCGColorSpaceITUR_2020_HLG$kCGColorSpaceITUR_2020_PQ$kCGColorSpaceITUR_2020_PQ_EOTF$kCGColorSpaceITUR_2020_sRGBGamma$kCGColorSpaceITUR_2100_HLG$kCGColorSpaceITUR_2100_PQ$kCGColorSpaceITUR_709$kCGColorSpaceITUR_709_HLG$kCGColorSpaceITUR_709_PQ$kCGColorSpaceLinearDisplayP3$kCGColorSpaceLinearGray$kCGColorSpaceLinearITUR_2020$kCGColorSpaceLinearSRGB$kCGColorSpaceROMMRGB$kCGColorSpaceSRGB$kCGColorWhite$kCGDisplayShowDuplicateLowResolutionModes$kCGDisplayStreamColorSpace$kCGDisplayStreamDestinationRect$kCGDisplayStreamMinimumFrameTime$kCGDisplayStreamPreserveAspectRatio$kCGDisplayStreamQueueDepth$kCGDisplayStreamShowCursor$kCGDisplayStreamSourceRect$kCGDisplayStreamYCbCrMatrix$kCGDisplayStreamYCbCrMatrix_ITU_R_601_4$kCGDisplayStreamYCbCrMatrix_ITU_R_709_2$kCGDisplayStreamYCbCrMatrix_SMPTE_240M_1995$kCGFontVariationAxisDefaultValue$kCGFontVariationAxisMaxValue$kCGFontVariationAxisMinValue$kCGFontVariationAxisName$kCGImageDestinationPreserveGainMap$kCGPDFContextAccessPermissions$kCGPDFContextAllowsCopying$kCGPDFContextAllowsPrinting$kCGPDFContextArtBox$kCGPDFContextAuthor$kCGPDFContextBleedBox$kCGPDFContextCreateLinearizedPDF$kCGPDFContextCreatePDFA$kCGPDFContextCreator$kCGPDFContextCropBox$kCGPDFContextEncryptionKeyLength$kCGPDFContextKeywords$kCGPDFContextMediaBox$kCGPDFContextOutputIntent$kCGPDFContextOutputIntents$kCGPDFContextOwnerPassword$kCGPDFContextSubject$kCGPDFContextTitle$kCGPDFContextTrimBox$kCGPDFContextUserPassword$kCGPDFOutlineChildren$kCGPDFOutlineDestination$kCGPDFOutlineDestinationRect$kCGPDFOutlineTitle$kCGPDFTagPropertyActualText$kCGPDFTagPropertyAlternativeText$kCGPDFTagPropertyLanguageText$kCGPDFTagPropertyTitleText$kCGPDFXDestinationOutputProfile$kCGPDFXInfo$kCGPDFXOutputCondition$kCGPDFXOutputConditionIdentifier$kCGPDFXOutputIntentSubtype$kCGPDFXRegistryName$kCGWindowAlpha$kCGWindowBackingLocationVideoMemory$kCGWindowBounds$kCGWindowIsOnscreen$kCGWindowLayer$kCGWindowMemoryUsage$kCGWindowName$kCGWindowNumber$kCGWindowOwnerName$kCGWindowOwnerPID$kCGWindowSharingState$kCGWindowStoreType$kCGWindowWorkspace$kCIImageAuxiliarySemanticSegmentationGlassesMatte$kCIImageAuxiliarySemanticSegmentationSkyMatte$kCIImageRepresentationSemanticSegmentationGlassesMatteImage$kCIImageRepresentationSemanticSegmentationSkyMatteImage$kCIImageToneMapHDRtoSDR$kCIInputLocalToneMapAmountKey$""" -enums = """$CGFLOAT_DEFINED@1$CGFLOAT_IS_DOUBLE@1$CGGlyphMax@65534$CGGlyphMin@0$CGPDFDataFormatJPEG2000@2$CGPDFDataFormatJPEGEncoded@1$CGPDFDataFormatRaw@0$CGPDFTagTypeAnnotation@507$CGPDFTagTypeArt@102$CGPDFTagTypeBibliography@504$CGPDFTagTypeBlockQuote@105$CGPDFTagTypeCaption@106$CGPDFTagTypeCode@505$CGPDFTagTypeDiv@104$CGPDFTagTypeDocument@100$CGPDFTagTypeFigure@700$CGPDFTagTypeForm@702$CGPDFTagTypeFormula@701$CGPDFTagTypeHeader@201$CGPDFTagTypeHeader1@202$CGPDFTagTypeHeader2@203$CGPDFTagTypeHeader3@204$CGPDFTagTypeHeader4@205$CGPDFTagTypeHeader5@206$CGPDFTagTypeHeader6@207$CGPDFTagTypeIndex@109$CGPDFTagTypeLabel@302$CGPDFTagTypeLink@506$CGPDFTagTypeList@300$CGPDFTagTypeListBody@303$CGPDFTagTypeListItem@301$CGPDFTagTypeNonStructure@110$CGPDFTagTypeNote@502$CGPDFTagTypeParagraph@200$CGPDFTagTypePart@101$CGPDFTagTypePrivate@111$CGPDFTagTypeQuote@501$CGPDFTagTypeReference@503$CGPDFTagTypeRuby@600$CGPDFTagTypeRubyAnnotationText@602$CGPDFTagTypeRubyBaseText@601$CGPDFTagTypeRubyPunctuation@603$CGPDFTagTypeSection@103$CGPDFTagTypeSpan@500$CGPDFTagTypeTOC@107$CGPDFTagTypeTOCI@108$CGPDFTagTypeTable@400$CGPDFTagTypeTableBody@405$CGPDFTagTypeTableDataCell@403$CGPDFTagTypeTableFooter@406$CGPDFTagTypeTableHeader@404$CGPDFTagTypeTableHeaderCell@402$CGPDFTagTypeTableRow@401$CGPDFTagTypeWarichu@604$CGPDFTagTypeWarichuPunctiation@606$CGPDFTagTypeWarichuText@605$CGRectMaxXEdge@2$CGRectMaxYEdge@3$CGRectMinXEdge@0$CGRectMinYEdge@1$CGVECTOR_DEFINED@1$CG_HDR_BT_2100@1$kCGAnnotatedSessionEventTap@2$kCGAssistiveTechHighWindowLevel@1500$kCGAssistiveTechHighWindowLevelKey@20$kCGBackingStoreBuffered@2$kCGBackingStoreNonretained@1$kCGBackingStoreRetained@0$kCGBackstopMenuLevel@-20$kCGBackstopMenuLevelKey@3$kCGBaseWindowLevelKey@0$kCGBitmapAlphaInfoMask@31$kCGBitmapByteOrder16Big@12288$kCGBitmapByteOrder16Little@4096$kCGBitmapByteOrder32Big@16384$kCGBitmapByteOrder32Little@8192$kCGBitmapByteOrderDefault@0$kCGBitmapByteOrderMask@28672$kCGBitmapFloatComponents@256$kCGBitmapFloatInfoMask@3840$kCGBlendModeClear@16$kCGBlendModeColor@14$kCGBlendModeColorBurn@7$kCGBlendModeColorDodge@6$kCGBlendModeCopy@17$kCGBlendModeDarken@4$kCGBlendModeDestinationAtop@24$kCGBlendModeDestinationIn@22$kCGBlendModeDestinationOut@23$kCGBlendModeDestinationOver@21$kCGBlendModeDifference@10$kCGBlendModeExclusion@11$kCGBlendModeHardLight@9$kCGBlendModeHue@12$kCGBlendModeLighten@5$kCGBlendModeLuminosity@15$kCGBlendModeMultiply@1$kCGBlendModeNormal@0$kCGBlendModeOverlay@3$kCGBlendModePlusDarker@26$kCGBlendModePlusLighter@27$kCGBlendModeSaturation@13$kCGBlendModeScreen@2$kCGBlendModeSoftLight@8$kCGBlendModeSourceAtop@20$kCGBlendModeSourceIn@18$kCGBlendModeSourceOut@19$kCGBlendModeXOR@25$kCGCaptureNoFill@1$kCGCaptureNoOptions@0$kCGColorConversionTransformApplySpace@2$kCGColorConversionTransformFromSpace@0$kCGColorConversionTransformToSpace@1$kCGColorConverterTransformApplySpace@2$kCGColorConverterTransformFromSpace@0$kCGColorConverterTransformToSpace@1$kCGColorSpaceModelCMYK@2$kCGColorSpaceModelDeviceN@4$kCGColorSpaceModelIndexed@5$kCGColorSpaceModelLab@3$kCGColorSpaceModelMonochrome@0$kCGColorSpaceModelPattern@6$kCGColorSpaceModelRGB@1$kCGColorSpaceModelUnknown@-1$kCGColorSpaceModelXYZ@7$kCGConfigureForAppOnly@0$kCGConfigureForSession@1$kCGConfigurePermanently@2$kCGCursorWindowLevelKey@19$kCGDesktopIconWindowLevelKey@18$kCGDesktopWindowLevelKey@2$kCGDisplayAddFlag@16$kCGDisplayBeginConfigurationFlag@1$kCGDisplayDesktopShapeChangedFlag@4096$kCGDisplayDisabledFlag@512$kCGDisplayEnabledFlag@256$kCGDisplayFadeReservationInvalidToken@0$kCGDisplayMirrorFlag@1024$kCGDisplayMovedFlag@2$kCGDisplayRemoveFlag@32$kCGDisplaySetMainFlag@4$kCGDisplaySetModeFlag@8$kCGDisplayStreamFrameStatusFrameBlank@2$kCGDisplayStreamFrameStatusFrameComplete@0$kCGDisplayStreamFrameStatusFrameIdle@1$kCGDisplayStreamFrameStatusStopped@3$kCGDisplayStreamUpdateDirtyRects@2$kCGDisplayStreamUpdateMovedRects@1$kCGDisplayStreamUpdateReducedDirtyRects@3$kCGDisplayStreamUpdateRefreshedRects@0$kCGDisplayUnMirrorFlag@2048$kCGDockWindowLevel@20$kCGDockWindowLevelKey@7$kCGDraggingWindowLevel@500$kCGDraggingWindowLevelKey@12$kCGEncodingFontSpecific@0$kCGEncodingMacRoman@1$kCGErrorApplicationAlreadyRunning@1025$kCGErrorApplicationCanOnlyBeRunInOneSessionAtATime@1026$kCGErrorApplicationIncorrectExecutableFormatFound@1023$kCGErrorApplicationIsLaunching@1024$kCGErrorApplicationNotPermittedToExecute@1016$kCGErrorApplicationRequiresNewerSystem@1015$kCGErrorCannotComplete@1004$kCGErrorClassicApplicationsMustBeLaunchedByClassic@1027$kCGErrorFailure@1000$kCGErrorFirst@1000$kCGErrorForkFailed@1028$kCGErrorIllegalArgument@1001$kCGErrorInvalidConnection@1002$kCGErrorInvalidContext@1003$kCGErrorInvalidOperation@1010$kCGErrorLast@1029$kCGErrorNameTooLong@1005$kCGErrorNoCurrentPoint@1009$kCGErrorNoneAvailable@1011$kCGErrorNotImplemented@1006$kCGErrorRangeCheck@1007$kCGErrorRetryRegistration@1029$kCGErrorSuccess@0$kCGErrorTypeCheck@1008$kCGEventFilterMaskPermitLocalKeyboardEvents@2$kCGEventFilterMaskPermitLocalMouseEvents@1$kCGEventFilterMaskPermitSystemDefinedEvents@4$kCGEventFlagMaskAlphaShift@65536$kCGEventFlagMaskAlternate@524288$kCGEventFlagMaskCommand@1048576$kCGEventFlagMaskControl@262144$kCGEventFlagMaskHelp@4194304$kCGEventFlagMaskNonCoalesced@256$kCGEventFlagMaskNumericPad@2097152$kCGEventFlagMaskSecondaryFn@8388608$kCGEventFlagMaskShift@131072$kCGEventFlagsChanged@12$kCGEventKeyDown@10$kCGEventKeyUp@11$kCGEventLeftMouseDown@1$kCGEventLeftMouseDragged@6$kCGEventLeftMouseUp@2$kCGEventMaskForAllEvents@18446744073709551615$kCGEventMouseMoved@5$kCGEventMouseSubtypeDefault@0$kCGEventMouseSubtypeTabletPoint@1$kCGEventMouseSubtypeTabletProximity@2$kCGEventNull@0$kCGEventOtherMouseDown@25$kCGEventOtherMouseDragged@27$kCGEventOtherMouseUp@26$kCGEventRightMouseDown@3$kCGEventRightMouseDragged@7$kCGEventRightMouseUp@4$kCGEventScrollWheel@22$kCGEventSourceGroupID@44$kCGEventSourceStateCombinedSessionState@0$kCGEventSourceStateHIDSystemState@1$kCGEventSourceStateID@45$kCGEventSourceStatePrivate@-1$kCGEventSourceUnixProcessID@41$kCGEventSourceUserData@42$kCGEventSourceUserID@43$kCGEventSuppressionStateRemoteMouseDrag@1$kCGEventSuppressionStateSuppressionInterval@0$kCGEventTabletPointer@23$kCGEventTabletProximity@24$kCGEventTapDisabledByTimeout@4294967294$kCGEventTapDisabledByUserInput@4294967295$kCGEventTapOptionDefault@0$kCGEventTapOptionListenOnly@1$kCGEventTargetProcessSerialNumber@39$kCGEventTargetUnixProcessID@40$kCGEventUnacceleratedPointerMovementX@170$kCGEventUnacceleratedPointerMovementY@171$kCGFloatingWindowLevel@3$kCGFloatingWindowLevelKey@5$kCGFontIndexInvalid@65535$kCGFontIndexMax@65534$kCGFontPostScriptFormatType1@1$kCGFontPostScriptFormatType3@3$kCGFontPostScriptFormatType42@42$kCGGesturePhaseBegan@1$kCGGesturePhaseCancelled@8$kCGGesturePhaseChanged@2$kCGGesturePhaseEnded@4$kCGGesturePhaseMayBegin@128$kCGGesturePhaseNone@0$kCGGlyphMax@65534$kCGGradientDrawsAfterEndLocation@2$kCGGradientDrawsBeforeStartLocation@1$kCGHIDEventTap@0$kCGHeadInsertEventTap@0$kCGHelpWindowLevel@200$kCGHelpWindowLevelKey@16$kCGImageAlphaFirst@4$kCGImageAlphaLast@3$kCGImageAlphaNone@0$kCGImageAlphaNoneSkipFirst@6$kCGImageAlphaNoneSkipLast@5$kCGImageAlphaOnly@7$kCGImageAlphaPremultipliedFirst@2$kCGImageAlphaPremultipliedLast@1$kCGImageByteOrder16Big@12288$kCGImageByteOrder16Little@4096$kCGImageByteOrder32Big@16384$kCGImageByteOrder32Little@8192$kCGImageByteOrderDefault@0$kCGImageByteOrderMask@28672$kCGImagePixelFormatMask@983040$kCGImagePixelFormatPacked@0$kCGImagePixelFormatRGB101010@196608$kCGImagePixelFormatRGB555@65536$kCGImagePixelFormatRGB565@131072$kCGImagePixelFormatRGBCIF10@262144$kCGInterpolationDefault@0$kCGInterpolationHigh@3$kCGInterpolationLow@2$kCGInterpolationMedium@4$kCGInterpolationNone@1$kCGKeyboardEventAutorepeat@8$kCGKeyboardEventKeyboardType@10$kCGKeyboardEventKeycode@9$kCGLineCapButt@0$kCGLineCapRound@1$kCGLineCapSquare@2$kCGLineJoinBevel@2$kCGLineJoinMiter@0$kCGLineJoinRound@1$kCGMainMenuWindowLevel@24$kCGMainMenuWindowLevelKey@8$kCGMaximumWindowLevelKey@14$kCGMinimumWindowLevelKey@1$kCGModalPanelWindowLevel@8$kCGModalPanelWindowLevelKey@10$kCGMomentumScrollPhaseBegin@1$kCGMomentumScrollPhaseContinue@2$kCGMomentumScrollPhaseEnd@3$kCGMomentumScrollPhaseNone@0$kCGMouseButtonCenter@2$kCGMouseButtonLeft@0$kCGMouseButtonRight@1$kCGMouseEventButtonNumber@3$kCGMouseEventClickState@1$kCGMouseEventDeltaX@4$kCGMouseEventDeltaY@5$kCGMouseEventInstantMouser@6$kCGMouseEventNumber@0$kCGMouseEventPressure@2$kCGMouseEventSubtype@7$kCGMouseEventWindowUnderMousePointer@91$kCGMouseEventWindowUnderMousePointerThatCanHandleThisEvent@92$kCGNormalWindowLevel@0$kCGNormalWindowLevelKey@4$kCGNullDirectDisplay@0$kCGNullWindowID@0$kCGNumReservedBaseWindowLevels@5$kCGNumReservedWindowLevels@16$kCGNumberOfEventSuppressionStates@2$kCGNumberOfWindowLevelKeys@21$kCGOverlayWindowLevel@102$kCGOverlayWindowLevelKey@15$kCGPDFAllowsCommenting@64$kCGPDFAllowsContentAccessibility@32$kCGPDFAllowsContentCopying@16$kCGPDFAllowsDocumentAssembly@8$kCGPDFAllowsDocumentChanges@4$kCGPDFAllowsFormFieldEntry@128$kCGPDFAllowsHighQualityPrinting@2$kCGPDFAllowsLowQualityPrinting@1$kCGPDFArtBox@4$kCGPDFBleedBox@2$kCGPDFCropBox@1$kCGPDFMediaBox@0$kCGPDFObjectTypeArray@7$kCGPDFObjectTypeBoolean@2$kCGPDFObjectTypeDictionary@8$kCGPDFObjectTypeInteger@3$kCGPDFObjectTypeName@5$kCGPDFObjectTypeNull@1$kCGPDFObjectTypeReal@4$kCGPDFObjectTypeStream@9$kCGPDFObjectTypeString@6$kCGPDFTrimBox@3$kCGPathEOFill@1$kCGPathEOFillStroke@4$kCGPathElementAddCurveToPoint@3$kCGPathElementAddLineToPoint@1$kCGPathElementAddQuadCurveToPoint@2$kCGPathElementCloseSubpath@4$kCGPathElementMoveToPoint@0$kCGPathFill@0$kCGPathFillStroke@3$kCGPathStroke@2$kCGPatternTilingConstantSpacing@2$kCGPatternTilingConstantSpacingMinimalDistortion@1$kCGPatternTilingNoDistortion@0$kCGPopUpMenuWindowLevel@101$kCGPopUpMenuWindowLevelKey@11$kCGRenderingIntentAbsoluteColorimetric@1$kCGRenderingIntentDefault@0$kCGRenderingIntentPerceptual@3$kCGRenderingIntentRelativeColorimetric@2$kCGRenderingIntentSaturation@4$kCGScreenSaverWindowLevel@1000$kCGScreenSaverWindowLevelKey@13$kCGScreenUpdateOperationMove@1$kCGScreenUpdateOperationReducedDirtyRectangleCount@2147483648$kCGScreenUpdateOperationRefresh@0$kCGScrollEventUnitLine@1$kCGScrollEventUnitPixel@0$kCGScrollPhaseBegan@1$kCGScrollPhaseCancelled@8$kCGScrollPhaseChanged@2$kCGScrollPhaseEnded@4$kCGScrollPhaseMayBegin@128$kCGScrollWheelEventDeltaAxis1@11$kCGScrollWheelEventDeltaAxis2@12$kCGScrollWheelEventDeltaAxis3@13$kCGScrollWheelEventFixedPtDeltaAxis1@93$kCGScrollWheelEventFixedPtDeltaAxis2@94$kCGScrollWheelEventFixedPtDeltaAxis3@95$kCGScrollWheelEventInstantMouser@14$kCGScrollWheelEventIsContinuous@88$kCGScrollWheelEventMomentumPhase@123$kCGScrollWheelEventPointDeltaAxis1@96$kCGScrollWheelEventPointDeltaAxis2@97$kCGScrollWheelEventPointDeltaAxis3@98$kCGScrollWheelEventScrollCount@100$kCGScrollWheelEventScrollPhase@99$kCGSessionEventTap@1$kCGStatusWindowLevel@25$kCGStatusWindowLevelKey@9$kCGTabletEventDeviceID@24$kCGTabletEventPointButtons@18$kCGTabletEventPointPressure@19$kCGTabletEventPointX@15$kCGTabletEventPointY@16$kCGTabletEventPointZ@17$kCGTabletEventRotation@22$kCGTabletEventTangentialPressure@23$kCGTabletEventTiltX@20$kCGTabletEventTiltY@21$kCGTabletEventVendor1@25$kCGTabletEventVendor2@26$kCGTabletEventVendor3@27$kCGTabletProximityEventCapabilityMask@36$kCGTabletProximityEventDeviceID@31$kCGTabletProximityEventEnterProximity@38$kCGTabletProximityEventPointerID@30$kCGTabletProximityEventPointerType@37$kCGTabletProximityEventSystemTabletID@32$kCGTabletProximityEventTabletID@29$kCGTabletProximityEventVendorID@28$kCGTabletProximityEventVendorPointerSerialNumber@34$kCGTabletProximityEventVendorPointerType@33$kCGTabletProximityEventVendorUniqueID@35$kCGTailAppendEventTap@1$kCGTextClip@7$kCGTextFill@0$kCGTextFillClip@4$kCGTextFillStroke@2$kCGTextFillStrokeClip@6$kCGTextInvisible@3$kCGTextStroke@1$kCGTextStrokeClip@5$kCGTornOffMenuWindowLevel@3$kCGTornOffMenuWindowLevelKey@6$kCGUtilityWindowLevel@19$kCGUtilityWindowLevelKey@17$kCGWindowImageBestResolution@8$kCGWindowImageBoundsIgnoreFraming@1$kCGWindowImageDefault@0$kCGWindowImageNominalResolution@16$kCGWindowImageOnlyShadows@4$kCGWindowImageShouldBeOpaque@2$kCGWindowListExcludeDesktopElements@16$kCGWindowListOptionAll@0$kCGWindowListOptionIncludingWindow@8$kCGWindowListOptionOnScreenAboveWindow@2$kCGWindowListOptionOnScreenBelowWindow@4$kCGWindowListOptionOnScreenOnly@1$kCGWindowSharingNone@0$kCGWindowSharingReadOnly@1$kCGWindowSharingReadWrite@2$""" -misc.update( - { - "CGWindowSharingType": NewType("CGWindowSharingType", int), - "CGPDFBox": NewType("CGPDFBox", int), - "CGMomentumScrollPhase": NewType("CGMomentumScrollPhase", int), - "CGWindowLevelKey": NewType("CGWindowLevelKey", int), - "CGImagePixelFormatInfo": NewType("CGImagePixelFormatInfo", int), - "CGEventTapPlacement": NewType("CGEventTapPlacement", int), - "CGEventField": NewType("CGEventField", int), - "CGConfigureOption": NewType("CGConfigureOption", int), - "CGMouseButton": NewType("CGMouseButton", int), - "CGWindowImageOption": NewType("CGWindowImageOption", int), - "CGLineJoin": NewType("CGLineJoin", int), - "CGColorSpaceModel": NewType("CGColorSpaceModel", int), - "CGEventTapOptions": NewType("CGEventTapOptions", int), - "CGTextEncoding": NewType("CGTextEncoding", int), - "CGFontPostScriptFormat": NewType("CGFontPostScriptFormat", int), - "CGEventSourceStateID": NewType("CGEventSourceStateID", int), - "CGPathElementType": NewType("CGPathElementType", int), - "CGEventMouseSubtype": NewType("CGEventMouseSubtype", int), - "CGDisplayStreamFrameStatus": NewType("CGDisplayStreamFrameStatus", int), - "CGScrollEventUnit": NewType("CGScrollEventUnit", int), - "CGEventFilterMask": NewType("CGEventFilterMask", int), - "CGColorConversionInfoTransformType": NewType( - "CGColorConversionInfoTransformType", int - ), - "CGBitmapInfo": NewType("CGBitmapInfo", int), - "CGPDFAccessPermissions": NewType("CGPDFAccessPermissions", int), - "CGPatternTiling": NewType("CGPatternTiling", int), - "CGInterpolationQuality": NewType("CGInterpolationQuality", int), - "CGScrollPhase": NewType("CGScrollPhase", int), - "CGLineCap": NewType("CGLineCap", int), - "CGGesturePhase": NewType("CGGesturePhase", int), - "CGWindowListOption": NewType("CGWindowListOption", int), - "CGBlendMode": NewType("CGBlendMode", int), - "CGCaptureOptions": NewType("CGCaptureOptions", int), - "CGTextDrawingMode": NewType("CGTextDrawingMode", int), - "CGRectEdge": NewType("CGRectEdge", int), - "CGEventSuppressionState": NewType("CGEventSuppressionState", int), - "CGEventTapLocation": NewType("CGEventTapLocation", int), - "CGPDFTagType": NewType("CGPDFTagType", int), - "CGPDFObjectType": NewType("CGPDFObjectType", int), - "CGImageAlphaInfo": NewType("CGImageAlphaInfo", int), - "CGGlyphDeprecatedEnum": NewType("CGGlyphDeprecatedEnum", int), - "CGDisplayChangeSummaryFlags": NewType("CGDisplayChangeSummaryFlags", int), - "CGPDFDataFormat": NewType("CGPDFDataFormat", int), - "CIRenderDestinationAlphaMode": NewType("CIRenderDestinationAlphaMode", int), - "CGGradientDrawingOptions": NewType("CGGradientDrawingOptions", int), - "CGScreenUpdateOperation": NewType("CGScreenUpdateOperation", int), - "CGEventFlags": NewType("CGEventFlags", int), - "CGWindowBackingType": NewType("CGWindowBackingType", int), - "CGError": NewType("CGError", int), - "CGDisplayStreamUpdateRectType": NewType("CGDisplayStreamUpdateRectType", int), - "CGColorRenderingIntent": NewType("CGColorRenderingIntent", int), - "CGEventType": NewType("CGEventType", int), - "CGPathDrawingMode": NewType("CGPathDrawingMode", int), - "CGImageByteOrderInfo": NewType("CGImageByteOrderInfo", int), - } -) -misc.update( - { - "CIContextOption": NewType("CIContextOption", str), - "CIFormat": NewType("CIFormat", int), - "CIRAWDecoderVersion": NewType("CIRAWDecoderVersion", str), - "CIImageAutoAdjustmentOption": NewType("CIImageAutoAdjustmentOption", str), - "CIImageRepresentationOption": NewType("CIImageRepresentationOption", str), - "CIRAWFilterOption": NewType("CIRAWFilterOption", str), - "CIImageOption": NewType("CIImageOption", str), - } -) -misc.update( - { - "kCGDisplayModeIsTelevisionOutput": "kCGDisplayModeIsTelevisionOutput", - "kCGSessionUserNameKey": "kCGSSessionUserNameKey", - "kCGSessionOnConsoleKey": "kCGSSessionOnConsoleKey", - "kCGDisplayIOFlags": "IOFlags", - "kCGDisplayModeIsStretched": "kCGDisplayModeIsStretched", - "kCGNotifyGUIConsoleSessionChanged": b"com.apple.coregraphics.GUIConsoleSessionChanged", - "kCGSessionUserIDKey": "kCGSSessionUserIDKey", - "kCGDisplayModeIsInterlaced": "kCGDisplayModeIsInterlaced", - "kCGDisplayBlendSolidColor": 1.0, - "kCGDisplayHeight": "Height", - "kCGDisplayBitsPerSample": "BitsPerSample", - "kCGDisplayBlendNormal": 0.0, - "kCGMouseDownEventMaskingDeadSwitchTimeout": 60.0, - "kCGMaxDisplayReservationInterval": 15.0, - "kCGDisplayWidth": "Width", - "kCGDisplaySamplesPerPixel": "SamplesPerPixel", - "kCGNotifyEventTapRemoved": b"com.apple.coregraphics.eventTapRemoved", - "kCGSessionConsoleSetKey": "kCGSSessionConsoleSetKey", - "kCGDisplayRefreshRate": "RefreshRate", - "kCGDisplayBytesPerRow": "kCGDisplayBytesPerRow", - "kCGDisplayBitsPerPixel": "BitsPerPixel", - "kCGDisplayModeUsableForDesktopGUI": "UsableForDesktopGUI", - "kCGSessionLoginDoneKey": "kCGSessionLoginDoneKey", - "kCGIODisplayModeID": "IODisplayModeID", - "kCGDisplayMode": "Mode", - "kCGNotifyEventTapAdded": b"com.apple.coregraphics.eventTapAdded", - "kCGDisplayModeIsSafeForHardware": "kCGDisplayModeIsSafeForHardware", - "kCGNotifyGUISessionUserChanged": b"com.apple.coregraphics.GUISessionUserChanged", - } -) -functions = { - "CGPDFDocumentGetVersion": ( - b"v^{CGPDFDocument=}^i^i", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "CGContextAddArcToPoint": (b"v^{CGContext=}ddddd",), - "CGRectIntersection": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGDataConsumerRetain": (b"^{CGDataConsumer=}^{CGDataConsumer=}",), - "CGColorSpaceCreateDeviceCMYK": ( - b"^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGGradientGetTypeID": (b"Q",), - "CGColorConversionInfoCreate": ( - b"^{CGColorConversionInfo=}^{CGColorSpace=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFPageGetDrawingTransform": ( - b"{CGAffineTransform=dddddd}^{CGPDFPage=}i{CGRect={CGPoint=dd}{CGSize=dd}}iB", - ), - "CGFontCanCreatePostScriptSubset": ( - b"B^{CGFont=}i", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextSetStrokeColorSpace": (b"v^{CGContext=}^{CGColorSpace=}",), - "CGContextPathContainsPoint": (b"B^{CGContext=}{CGPoint=dd}i",), - "CGAffineTransformRotate": ( - b"{CGAffineTransform=dddddd}{CGAffineTransform=dddddd}d", - ), - "CGContextRelease": (b"v^{CGContext=}",), - "CGPDFArrayGetStream": ( - b"B^{CGPDFArray=}Q^^{CGPDFStream=}", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGEventKeyboardSetUnicodeString": ( - b"v^{__CGEvent=}Q^T", - "", - {"arguments": {2: {"c_array_length_in_arg": 1, "type_modifier": "n"}}}, - ), - "CGDisplayModeGetRefreshRate": (b"d^{CGDisplayMode=}",), - "CGShieldingWindowID": (b"II",), - "CGColorSpaceCreateWithColorSyncProfile": ( - b"^{CGColorSpace=}^{ColorSyncProfile=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGAffineTransformMake": (b"{CGAffineTransform=dddddd}dddddd",), - "CGWindowListCreateDescriptionFromArray": ( - b"^{__CFArray=}^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextAddLines": ( - b"v^{CGContext=}^{CGPoint=dd}Q", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CGContextSetTextPosition": (b"v^{CGContext=}dd",), - "CGColorCreateSRGB": ( - b"^{CGColor=}dddd", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextGetTextPosition": (b"{CGPoint=dd}^{CGContext=}",), - "CGPDFPageGetRotationAngle": (b"i^{CGPDFPage=}",), - "CGContextGetPathBoundingBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGContext=}",), - "CGRectContainsPoint": (b"B{CGRect={CGPoint=dd}{CGSize=dd}}{CGPoint=dd}",), - "CGPDFDictionaryGetCount": (b"Q^{CGPDFDictionary=}",), - "CGRectMake": (b"{CGRect={CGPoint=dd}{CGSize=dd}}dddd",), - "CGColorSpaceRetain": (b"^{CGColorSpace=}^{CGColorSpace=}",), - "CGPathCreateCopyByStrokingPath": ( - b"^{CGPath=}^{CGPath=}^{CGAffineTransform=dddddd}diid", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CGContextAddEllipseInRect": (b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGContextEndTransparencyLayer": (b"v^{CGContext=}",), - "CGContextSelectFont": ( - b"v^{CGContext=}^tdi", - "", - {"arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}}, - ), - "CGLayerGetSize": (b"{CGSize=dd}^{CGLayer=}",), - "CGWindowListCreate": ( - b"^{__CFArray=}II", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGSizeEqualToSize": (b"B{CGSize=dd}{CGSize=dd}",), - "CGColorConverterCreateSimple": ( - b"^{CGColorConversionInfo=}^{CGColorSpace=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFStringCopyTextString": ( - b"^{__CFString=}^{CGPDFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorSpaceGetBaseColorSpace": (b"^{CGColorSpace=}^{CGColorSpace=}",), - "CGPathCreateMutable": ( - b"^{CGPath=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPatternCreate": ( - b"^{CGPattern=}^v{CGRect={CGPoint=dd}{CGSize=dd}}{CGAffineTransform=dddddd}ddiB^{CGPatternCallbacks=I^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGBitmapContextGetHeight": (b"Q^{CGContext=}",), - "CGPDFPageGetBoxRect": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPDFPage=}i",), - "CGPDFStringCopyDate": ( - b"^{__CFDate=}^{CGPDFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayStreamUpdateGetDropCount": (b"Q^{CGDisplayStreamUpdate=}",), - "CGDisplayBestModeForParametersAndRefreshRate": ( - selAorI(b"^{__CFDictionary=}IQQQd^i", b"^{__CFDictionary=}IQQQd^I"), - "", - {"arguments": {5: {"type_modifier": "o"}}}, - ), - "CGPDFScannerPopString": ( - b"B^{CGPDFScanner=}^^{CGPDFString=}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGPDFPageGetTypeID": (b"Q",), - "CGContextAddRect": (b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGDataProviderCreateWithURL": ( - b"^{CGDataProvider=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFScannerCreate": ( - b"^{CGPDFScanner=}^{CGPDFContentStream=}^{CGPDFOperatorTable=}^v", - "", - {"retval": {"already_cfretained": False}}, - ), - "CGConfigureDisplayFadeEffect": (b"i^{_CGDisplayConfigRef=}fffff",), - "CGDisplayFade": (selAorI(b"iIffffffi", b"iIffffffI"),), - "CGPDFArrayGetObject": ( - b"B^{CGPDFArray=}Q^^{CGPDFObject=}", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGEventSetType": (b"v^{__CGEvent=}I",), - "CGDataProviderCreateWithFilename": ( - b"^{CGDataProvider=}^t", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {0: {"c_array_delimited_by_null": True, "type_modifier": "n"}}, - }, - ), - "CGColorGetComponents": ( - b"^d^{CGColor=}", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CGPDFContextSetOutline": (b"v^{CGContext=}^{__CFDictionary=}",), - "CGAffineTransformMakeTranslation": (b"{CGAffineTransform=dddddd}dd",), - "CGSizeMake": (b"{CGSize=dd}dd",), - "CGDisplayVendorNumber": (b"II",), - "CGPDFContextBeginTag": (b"v^{CGContext=}i^{__CFDictionary=}",), - "CGPDFDocumentGetID": (b"^{CGPDFArray=}^{CGPDFDocument=}",), - "CGDataProviderCreateWithData": ( - b"^{CGDataProvider=}^v^vQ^?", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"^v"}, - 2: {"type": b"Q"}, - }, - } - } - }, - }, - ), - "CGColorSpaceCreatePattern": ( - b"^{CGColorSpace=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextSynchronize": (b"v^{CGContext=}",), - "CGDisplayModeGetIODisplayModeID": (b"i^{CGDisplayMode=}",), - "CGFontGetGlyphBBoxes": ( - b"B^{CGFont=}^SQ^{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - { - "arguments": { - 1: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - 3: {"c_array_length_in_arg": 2, "type_modifier": "o"}, - } - }, - ), - "CGPaletteCreateWithByteSamples": ( - b"^{_CGDirectPaletteRef=}^{CGDeviceByteColor=CCC}I", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {0: {"c_array_length_in_arg": 1, "type_modifier": "n"}}, - }, - ), - "CGPDFContentStreamGetResource": ( - b"^{CGPDFObject=}^{CGPDFContentStream=}^t^t", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - } - }, - ), - "CGAffineTransformMakeRotation": (b"{CGAffineTransform=dddddd}d",), - "CGGradientRetain": (b"^{CGGradient=}^{CGGradient=}",), - "CGPaletteCreateWithDisplay": ( - b"^{_CGDirectPaletteRef=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayCreateImageForRect": ( - b"^{CGImage=}I{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageGetWidth": (b"Q^{CGImage=}",), - "CGPDFDocumentIsUnlocked": (b"B^{CGPDFDocument=}",), - "CGPathCreateWithRect": ( - b"^{CGPath=}{CGRect={CGPoint=dd}{CGSize=dd}}^{CGAffineTransform=dddddd}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CGImageGetBitmapInfo": (b"I^{CGImage=}",), - "CGEventSourceSetKeyboardType": (b"v^{__CGEventSource=}I",), - "CGDataProviderGetInfo": (b"^v^{CGDataProvider=}",), - "CGContextSetAllowsFontSmoothing": (b"v^{CGContext=}B",), - "CGDisplayUsesOpenGLAcceleration": (selAorI(b"iI", b"II"),), - "CGPointMakeWithDictionaryRepresentation": ( - b"B^{__CFDictionary=}^{CGPoint=dd}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGContextResetClip": (b"v^{CGContext=}",), - "CGPDFDictionaryApplyFunction": ( - b"v^{CGPDFDictionary=}^?^v", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: { - "type": b"^t", - "c_array_delimeted_by_null": True, - "type_modifier": "n", - }, - 1: {"type": b"^{CGPDFObject=}"}, - 2: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CGWindowServerCreateServerPort": ( - b"^{__CFMachPort=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathAddEllipseInRect": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGColorSpaceGetColorTableCount": (b"Q^{CGColorSpace=}",), - "CGWindowListCreateImage": ( - b"^{CGImage=}{CGRect={CGPoint=dd}{CGSize=dd}}III", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathCreateCopyByTransformingPath": ( - b"^{CGPath=}^{CGPath=}^{CGAffineTransform=dddddd}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CGContextClearRect": (b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGPDFDocumentGetAccessPermissions": (b"I^{CGPDFDocument=}",), - "CGBitmapContextGetBitmapInfo": (b"I^{CGContext=}",), - "CGPathAddQuadCurveToPoint": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}dddd", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGColorSpaceCreateDeviceGray": ( - b"^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGRectIntersectsRect": ( - b"B{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGPDFPageGetDocument": (b"^{CGPDFDocument=}^{CGPDFPage=}",), - "CGRestorePermanentDisplayConfiguration": (b"v",), - "CGImageGetTypeID": (b"Q",), - "CGFontCreatePostScriptEncoding": ( - b"^{__CFData=}^{CGFont=}^d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"c_array_of_fixed_length": 256, "type_modifier": "n"}}, - }, - ), - "CGAffineTransformMakeWithComponents": ( - b"{CGAffineTransform=dddddd}{CGAffineTransformComponents={CGSize=dd}dd{CGVector=dd}}", - ), - "CGPointApplyAffineTransform": ( - b"{CGPoint=dd}{CGPoint=dd}{CGAffineTransform=dddddd}", - ), - "CGEventSourceGetSourceStateID": (b"i^{__CGEventSource=}",), - "CGRectStandardize": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGPathAddLineToPoint": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}dd", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGDataProviderCopyData": ( - b"^{__CFData=}^{CGDataProvider=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorCreateGenericGray": ( - b"^{CGColor=}dd", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorSpaceIsWideGamutRGB": (b"B^{CGColorSpace=}",), - "CGPDFContextSetURLForRect": ( - b"v^{CGContext=}^{__CFURL=}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGColorRetain": (b"^{CGColor=}^{CGColor=}",), - "CGColorCreateGenericCMYK": ( - b"^{CGColor=}ddddd", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGGLContextCreate": ( - b"^{CGContext=}^v{CGSize=dd}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGBeginDisplayConfiguration": ( - b"i^^{_CGDisplayConfigRef=}", - "", - {"arguments": {0: {"type_modifier": "o"}}}, - ), - "CGDisplayStreamGetTypeID": (b"Q",), - "CGBitmapContextGetBitsPerPixel": (b"Q^{CGContext=}",), - "CGPDFDictionaryGetArray": ( - b"B^{CGPDFDictionary=}^t^^{CGPDFArray=}", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGColorSpaceCreateWithPlatformColorSpace": ( - b"^{CGColorSpace=}^v", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextSetCMYKStrokeColor": (b"v^{CGContext=}ddddd",), - "CGDisplayStreamGetRunLoopSource": (b"^{__CFRunLoopSource=}^{CGDisplayStream=}",), - "CGContextEndPage": (b"v^{CGContext=}",), - "CGUnregisterScreenRefreshCallback": ( - b"v^?^v", - "", - { - "arguments": { - 0: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"I"}, - 1: {"type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 2: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CGPathAddRect": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGPDFContentStreamRelease": (b"v^{CGPDFContentStream=}",), - "CGPathApplyWithBlock": ( - b"v^{CGPath=}@?", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"typestr": "^v"}, - 1: {"typestr": "^{CGPathElement=}"}, - }, - } - } - } - }, - ), - "CGContextGetCTM": (b"{CGAffineTransform=dddddd}^{CGContext=}",), - "CGDisplayStreamUpdateGetRects": ( - b"^{CGRect={CGPoint=dd}{CGSize=dd}}^{CGDisplayStreamUpdate=}i^Q", - "", - { - "retval": {"c_array_length_in_arg": 2}, - "arguments": {2: {"type_modifier": "o"}}, - }, - ), - "CGPDFArrayGetName": ( - b"B^{CGPDFArray=}Q^^t", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGEventSourceGetPixelsPerLine": (b"d^{__CGEventSource=}",), - "CGDisplayStreamUpdateGetMovedRectsDelta": ( - b"v^{CGDisplayStreamUpdate=}^d^d", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "CGRectGetHeight": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGEventSourceGetTypeID": (b"Q",), - "CGPDFDictionaryGetStream": ( - b"B^{CGPDFDictionary=}^t^^{CGPDFStream=}", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGDataProviderCreateWithCFData": ( - b"^{CGDataProvider=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGShieldingWindowLevel": (b"i",), - "CGDisplaySetPalette": (b"iI^{_CGDirectPaletteRef=}",), - "CGDisplayIsOnline": (selAorI(b"iI", b"II"),), - "CGDisplayStreamCreate": ( - b"^{CGDisplayStream=}IQQi^{__CFDictionary=}@?", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 5: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "I"}, - 2: {"type": "Q"}, - 3: {"type": "@"}, - 4: {"type": "@"}, - }, - } - } - }, - }, - ), - "CGFontGetCapHeight": (b"i^{CGFont=}",), - "CGContextShowGlyphsWithAdvances": ( - b"v^{CGContext=}^S^{CGSize=dd}Q", - "", - { - "arguments": { - 1: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - 2: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - } - }, - ), - "CGDataConsumerCreate": ( - b"^{CGDataConsumer=}^v^{CGDataConsumerCallbacks=^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFArrayGetInteger": ( - b"B^{CGPDFArray=}Q^q", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGPostScrollWheelEvent": ( - b"iIi", - "", - {"c_array_length_in_arg": 0, "variadic": True}, - ), - "CGColorCreateCopy": ( - b"^{CGColor=}^{CGColor=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGBitmapContextCreate": ( - b"^{CGContext=}^vQQQQ^{CGColorSpace=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFArrayApplyBlock": ( - b"v^{CGPDFArray=}@?^v", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"B"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "l"}, - 2: {"type": "^{CGPDFObject=}"}, - 3: {"type": "^v"}, - }, - } - } - } - }, - ), - "CGPathAddRelativeArc": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}ddddd", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGDisplaySetStereoOperation": (selAorI(b"iIiiI", b"iIIII"),), - "CGPaletteIsEqualToPalette": (b"B^{_CGDirectPaletteRef=}^{_CGDirectPaletteRef=}",), - "CGContextSetShouldAntialias": (b"v^{CGContext=}B",), - "CGDisplayModeGetHeight": (b"Q^{CGDisplayMode=}",), - "CGContextSetFillColor": ( - b"v^{CGContext=}^d", - "", - {"arguments": {1: {"c_array_of_variable_length": True, "type_modifier": "n"}}}, - ), - "CGImageRelease": (b"v^{CGImage=}",), - "CGInhibitLocalEvents": (selAorI(b"ii", b"iI"),), - "CGContextSetGrayFillColor": (b"v^{CGContext=}dd",), - "CGColorSpaceIsHDR": (b"B^{CGColorSpace=}",), - "CGImageGetUTType": (b"^{__CFString=}^{CGImage=}",), - "CGPSConverterCreate": ( - b"^{CGPSConverter=}^v^{CGPSConverterCallbacks=I^?^?^?^?^?^?^?}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDirectDisplayCopyCurrentMetalDevice": ( - b"@I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextClipToMask": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}^{CGImage=}", - ), - "CGDisplayCopyColorSpace": ( - b"^{CGColorSpace=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextAddLineToPoint": (b"v^{CGContext=}dd",), - "CGEventSourceGetLocalEventsSuppressionInterval": (b"d^{__CGEventSource=}",), - "CGColorSpaceGetTypeID": (b"Q",), - "CGPathAddPath": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}^{CGPath=}", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGDataProviderRetain": (b"^{CGDataProvider=}^{CGDataProvider=}",), - "CGEventCreateFromData": ( - b"^{__CGEvent=}^{__CFAllocator=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayPixelsHigh": (b"QI",), - "CGConfigureDisplayStereoOperation": ( - selAorI(b"i^{_CGDisplayConfigRef=}Iii", b"i^{_CGDisplayConfigRef=}III"), - ), - "CGFontGetNumberOfGlyphs": (b"Q^{CGFont=}",), - "CGPDFOperatorTableCreate": ( - b"^{CGPDFOperatorTable=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFContextAddDestinationAtPoint": (b"v^{CGContext=}^{__CFString=}{CGPoint=dd}",), - "CGPDFScannerGetContentStream": (b"^{CGPDFContentStream=}^{CGPDFScanner=}",), - "CGContextSetShouldSubpixelQuantizeFonts": (b"v^{CGContext=}B",), - "CGPathContainsPoint": ( - b"B^{CGPath=}^{CGAffineTransform=dddddd}{CGPoint=dd}B", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGSizeApplyAffineTransform": ( - b"{CGSize=dd}{CGSize=dd}{CGAffineTransform=dddddd}", - ), - "CGRectIntegral": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGDisplayPrimaryDisplay": (b"II",), - "CGContextConcatCTM": (b"v^{CGContext=}{CGAffineTransform=dddddd}",), - "CGFunctionRelease": (b"v^{CGFunction=}",), - "CGPDFDocumentGetOutline": (b"^{__CFDictionary=}^{CGPDFDocument=}",), - "CGWindowListCreateImageFromArray": ( - b"^{CGImage=}{CGRect={CGPoint=dd}{CGSize=dd}}^{__CFArray=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPatternRetain": (b"^{CGPattern=}^{CGPattern=}",), - "CGPaletteCreateWithSamples": ( - b"^{_CGDirectPaletteRef=}^{CGDeviceColor=fff}I", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {0: {"c_array_length_in_arg": 1, "type_modifier": "n"}}, - }, - ), - "CGDataProviderGetTypeID": (b"Q",), - "CGPaletteCreateWithCapacity": ( - b"^{_CGDirectPaletteRef=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayBytesPerRow": (b"QI",), - "CGSetLocalEventsSuppressionInterval": (b"id",), - "CGPDFArrayGetCount": (b"Q^{CGPDFArray=}",), - "CGPDFContextClose": (b"v^{CGContext=}",), - "CGDisplayIsBuiltin": (selAorI(b"iI", b"II"),), - "CGContextIsPathEmpty": (b"B^{CGContext=}",), - "CGContextSetShadow": (b"v^{CGContext=}{CGSize=dd}d",), - "CGPathGetBoundingBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPath=}",), - "CGColorGetNumberOfComponents": (b"Q^{CGColor=}",), - "CGColorSpaceRelease": (b"v^{CGColorSpace=}",), - "CGGetDisplayTransferByTable": ( - b"iII^f^f^f^I", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": (1, 5), "type_modifier": "o"}, - 3: {"c_array_length_in_arg": (1, 5), "type_modifier": "o"}, - 4: {"c_array_length_in_arg": (1, 5), "type_modifier": "o"}, - 5: {"type_modifier": "o"}, - } - }, - ), - "CGPDFDictionaryApplyBlock": ( - b"v^{CGPDFDictionary=}@?^v", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"c_array_delimited_by_null": True, "type": "n^t"}, - 2: {"type": "^{CGPDFObject=}"}, - 3: {"type": "^v"}, - }, - } - } - } - }, - ), - "CGPathCreateCopyOfLineByIntersectingPath": ( - b"^{CGPath=}^{CGPath=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextShowGlyphsAtPoint": ( - b"v^{CGContext=}dd^SQ", - "", - {"arguments": {3: {"c_array_length_in_arg": 4, "type_modifier": "n"}}}, - ), - "CGPathIntersectsPath": (b"B^{CGPath=}^{CGPath=}B",), - "CGPathAddLines": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}^{CGPoint=dd}Q", - "", - { - "arguments": { - 1: {"type_modifier": "n"}, - 2: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - } - }, - ), - "CGColorCreateGenericRGB": ( - b"^{CGColor=}dddd", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextDrawPDFPage": (b"v^{CGContext=}^{CGPDFPage=}",), - "CGDisplayModeRetain": (b"^{CGDisplayMode=}^{CGDisplayMode=}",), - "CGDisplayGammaTableCapacity": (b"II",), - "CGFontCreateWithFontName": ( - b"^{CGFont=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayCopyAllDisplayModes": ( - b"^{__CFArray=}I^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextScaleCTM": (b"v^{CGContext=}dd",), - "CGRectDivide": ( - b"v{CGRect={CGPoint=dd}{CGSize=dd}}^{CGRect={CGPoint=dd}{CGSize=dd}}^{CGRect={CGPoint=dd}{CGSize=dd}}dI", - "", - {"arguments": {1: {"type_modifier": "o"}, 2: {"type_modifier": "o"}}}, - ), - "CGContextSetLineCap": (b"v^{CGContext=}i",), - "CGImageMaskCreate": ( - b"^{CGImage=}QQQQQ^{CGDataProvider=}^dB", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 6: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGContextDrawRadialGradient": ( - b"v^{CGContext=}^{CGGradient=}{CGPoint=dd}d{CGPoint=dd}dI", - ), - "CGFontCopyVariations": ( - b"^{__CFDictionary=}^{CGFont=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGConfigureDisplayMirrorOfDisplay": (b"i^{_CGDisplayConfigRef=}II",), - "CGEventSourceCreate": ( - b"^{__CGEventSource=}i", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPreflightListenEventAccess": (b"B",), - "CGEventGetTimestamp": (b"Q^{__CGEvent=}",), - "CGContextFillEllipseInRect": (b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGContextSetAlpha": (b"v^{CGContext=}d",), - "CGContextAddQuadCurveToPoint": (b"v^{CGContext=}dddd",), - "CGColorSpaceGetNumberOfComponents": (b"Q^{CGColorSpace=}",), - "CGPathCreateCopyByFlattening": ( - b"^{CGPath=}^{CGPath=}d", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGEventCreateKeyboardEvent": ( - b"^{__CGEvent=}^{__CGEventSource=}SB", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFDocumentGetMediaBox": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPDFDocument=}i", - ), - "CGEventSetSource": (b"v^{__CGEvent=}^{__CGEventSource=}",), - "CGSetDisplayTransferByByteTable": ( - b"iII^z^z^z", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": 1, "type_modifier": "n"}, - 3: {"c_array_length_in_arg": 1, "type_modifier": "n"}, - 4: {"c_array_length_in_arg": 1, "type_modifier": "n"}, - } - }, - ), - "CGPDFDictionaryGetString": ( - b"B^{CGPDFDictionary=}^t^^{CGPDFString=}", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGRegisterScreenRefreshCallback": ( - b"i^?^v", - "", - { - "arguments": { - 0: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"I"}, - 1: {"type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 2: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CGFontGetUnitsPerEm": (b"i^{CGFont=}",), - "CGContextEOClip": (b"v^{CGContext=}",), - "CGAcquireDisplayFadeReservation": ( - b"if^I", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGBitmapContextGetData": ( - b"^v^{CGContext=}", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CGAffineTransformIsIdentity": (b"B{CGAffineTransform=dddddd}",), - "CGContextGetInterpolationQuality": (b"i^{CGContext=}",), - "CGPathGetPathBoundingBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPath=}",), - "CGContextRotateCTM": (b"v^{CGContext=}d",), - "CGImageCreateCopy": ( - b"^{CGImage=}^{CGImage=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageGetShouldInterpolate": (b"B^{CGImage=}",), - "CGContextStrokeRect": (b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGImageGetDecode": ( - b"^d^{CGImage=}", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CGColorCreateCopyByMatchingToColorSpace": ( - b"^{CGColor=}^{CGColorSpace=}i^{CGColor=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextSetAllowsAntialiasing": (b"v^{CGContext=}B",), - "CGPDFScannerPopDictionary": ( - b"B^{CGPDFScanner=}^^{CGPDFDictionary=}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGRectGetMidX": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGFontCopyTableForTag": ( - b"^{__CFData=}^{CGFont=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGEventSourceGetLocalEventsFilterDuringSuppressionState": ( - b"I^{__CGEventSource=}I", - ), - "CGColorGetTypeID": (b"Q",), - "CGSetDisplayTransferByFormula": (b"iIfffffffff",), - "CGPDFStreamGetDictionary": (b"^{CGPDFDictionary=}^{CGPDFStream=}",), - "CGEventSourceSetLocalEventsFilterDuringSuppressionState": ( - b"v^{__CGEventSource=}II", - ), - "CGRectContainsRect": ( - b"B{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGColorGetPattern": (b"^{CGPattern=}^{CGColor=}",), - "CGPaletteCreateDefaultColorPalette": ( - b"^{_CGDirectPaletteRef=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGFontCreatePostScriptSubset": ( - b"^{__CFData=}^{CGFont=}^{__CFString=}i^SQ^S", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: {"c_array_length_in_arg": 4, "type_modifier": "n"}, - 5: {"type_modifier": "n"}, - }, - }, - ), - "CGPDFDocumentGetCatalog": (b"^{CGPDFDictionary=}^{CGPDFDocument=}",), - "CGColorSpaceGetModel": (b"i^{CGColorSpace=}",), - "CGImageGetColorSpace": (b"^{CGColorSpace=}^{CGImage=}",), - "CGPDFArrayGetString": ( - b"B^{CGPDFArray=}Q^^{CGPDFString=}", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGPointMake": (b"{CGPoint=dd}dd",), - "CGPaletteRelease": (b"v^{_CGDirectPaletteRef=}",), - "CGPDFDictionaryGetObject": ( - b"B^{CGPDFDictionary=}^t^^{CGPDFObject=}", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGEventTapCreateForPSN": ( - b"^{__CFMachPort=}^vIIQ^?^v", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 4: { - "callable": { - "retval": {"type": b"^{__CGEvent=}"}, - "arguments": { - 0: {"type": b"^{__CGEventTapProxy=}"}, - 1: {"type": b"I"}, - 2: {"type": b"^{__CGEvent=}"}, - 3: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CGReleaseDisplayFadeReservation": (b"iI",), - "CGPathCreateCopyByNormalizing": ( - b"^{CGPath=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayRegisterReconfigurationCallback": ( - b"i^?^v", - "", - { - "arguments": { - 0: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"I"}, - 1: {"type": b"I"}, - 2: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CGPDFPageRetain": (b"^{CGPDFPage=}^{CGPDFPage=}",), - "CGLayerCreateWithContext": ( - b"^{CGLayer=}^{CGContext=}{CGSize=dd}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextStrokeLineSegments": ( - b"v^{CGContext=}^{CGPoint=dd}Q", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CGContextSetTextMatrix": (b"v^{CGContext=}{CGAffineTransform=dddddd}",), - "CGImageIsMask": (b"B^{CGImage=}",), - "CGPDFObjectGetType": (b"i^{CGPDFObject=}",), - "CGEventSourceGetUserData": (b"q^{__CGEventSource=}",), - "CGContextSetStrokeColor": ( - b"v^{CGContext=}^d", - "", - {"arguments": {1: {"c_array_of_variable_length": True, "type_modifier": "n"}}}, - ), - "CGPDFContextEndTag": (b"v^{CGContext=}",), - "CGPDFScannerPopBoolean": ( - b"B^{CGPDFScanner=}^C", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGGradientRelease": (b"v^{CGGradient=}",), - "CGConfigureDisplayMode": (b"i^{_CGDisplayConfigRef=}I^{__CFDictionary=}",), - "CGWarpMouseCursorPosition": (b"i{CGPoint=dd}",), - "CGPathCreateWithRoundedRect": ( - b"^{CGPath=}{CGRect={CGPoint=dd}{CGSize=dd}}dd^{CGAffineTransform=dddddd}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"type_modifier": "n"}}, - }, - ), - "CGPDFDocumentGetInfo": (b"^{CGPDFDictionary=}^{CGPDFDocument=}",), - "CGContextSetStrokePattern": ( - b"v^{CGContext=}^{CGPattern=}^d", - "", - {"arguments": {2: {"c_array_of_variable_length": True, "type_modifier": "n"}}}, - ), - "CGDisplayCanSetPalette": (b"II",), - "CGRectApplyAffineTransform": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}{CGAffineTransform=dddddd}", - ), - "CGEventSetDoubleValueField": (b"v^{__CGEvent=}Id",), - "CGContextFlush": (b"v^{CGContext=}",), - "CGWindowListCopyWindowInfo": ( - b"^{__CFArray=}II", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGFontGetXHeight": (b"i^{CGFont=}",), - "CGPDFContextCreate": ( - b"^{CGContext=}^{CGDataConsumer=}^{CGRect={CGPoint=dd}{CGSize=dd}}^{__CFDictionary=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CGPaletteGetIndexForColor": (b"I^{_CGDirectPaletteRef=}{CGDeviceColor=fff}",), - "CGImageCreateWithJPEGDataProvider": ( - b"^{CGImage=}^{CGDataProvider=}^dBi", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGPDFDocumentCreateWithURL": ( - b"^{CGPDFDocument=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathAddArcToPoint": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}ddddd", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGVectorMake": (b"{CGVector=dd}dd",), - "CGDisplayIsActive": (selAorI(b"iI", b"II"),), - "CGPDFScannerScan": (b"B^{CGPDFScanner=}",), - "CGPathCreateMutableCopyByTransformingPath": ( - b"^{CGPath=}^{CGPath=}^{CGAffineTransform=dddddd}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CGSetDisplayTransferByTable": ( - b"iII^f^f^f", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": 1, "type_modifier": "n"}, - 3: {"c_array_length_in_arg": 1, "type_modifier": "n"}, - 4: {"c_array_length_in_arg": 1, "type_modifier": "n"}, - } - }, - ), - "CGFontGetDescent": (b"i^{CGFont=}",), - "CGImageGetPixelFormatInfo": (b"I^{CGImage=}",), - "CGImageGetRenderingIntent": (b"i^{CGImage=}",), - "CGGLContextUpdateViewportSize": (b"v^{CGContext=}{CGSize=dd}",), - "CGGetEventTapList": ( - b"iI^{__CGEventTapInformation=IIIQiiBfff}^I", - "", - { - "arguments": { - 1: {"c_array_length_in_arg": (0, 2), "type_modifier": "o"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGEnableEventStateCombining": (selAorI(b"ii", b"iI"),), - "CGColorSpaceCreateDeviceRGB": ( - b"^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathEqualToPath": (b"B^{CGPath=}^{CGPath=}",), - "CGPDFScannerPopObject": ( - b"B^{CGPDFScanner=}^^{CGPDFObject=}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGDisplayIsCaptured": (selAorI(b"iI", b"II"),), - "CGPDFPageRelease": (b"v^{CGPDFPage=}",), - "CGDisplayStreamStart": (b"i^{CGDisplayStream=}",), - "CGRectIsEmpty": (b"B{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGDisplayMoveCursorToPoint": (b"iI{CGPoint=dd}",), - "CGPDFScannerPopInteger": ( - b"B^{CGPDFScanner=}^q", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGPaletteGetNumberOfSamples": (b"I^{_CGDirectPaletteRef=}",), - "CGContextStrokePath": (b"v^{CGContext=}",), - "CGEventSetLocation": (b"v^{__CGEvent=}{CGPoint=dd}",), - "CGColorSpaceIsPQBased": (b"B^{CGColorSpace=}",), - "CGAffineTransformScale": ( - b"{CGAffineTransform=dddddd}{CGAffineTransform=dddddd}dd", - ), - "CGEventSourceSetUserData": (b"v^{__CGEventSource=}q",), - "CGAffineTransformDecompose": ( - b"{CGAffineTransformComponents={CGSize=dd}dd{CGVector=dd}}{CGAffineTransform=dddddd}", - ), - "CGColorSpaceCreateExtended": ( - b"^{CGColorSpace=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFArrayGetArray": ( - b"B^{CGPDFArray=}Q^^{CGPDFArray=}", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGContextDrawLayerInRect": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}^{CGLayer=}", - ), - "CGDataProviderRelease": (b"v^{CGDataProvider=}",), - "CGEventPost": (b"vI^{__CGEvent=}",), - "CGFontCreateCopyWithVariations": ( - b"^{CGFont=}^{CGFont=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGMainDisplayID": (b"I",), - "CGFontGetTypeID": (b"Q",), - "CGPathAddRoundedRect": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}{CGRect={CGPoint=dd}{CGSize=dd}}dd", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGRectEqualToRect": ( - b"B{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGRectGetMaxY": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGBitmapContextGetWidth": (b"Q^{CGContext=}",), - "CGShadingCreateRadial": ( - b"^{CGShading=}^{CGColorSpace=}{CGPoint=dd}d{CGPoint=dd}d^{CGFunction=}BB", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFScannerRetain": (b"^{CGPDFScanner=}^{CGPDFScanner=}",), - "CGDisplayMirrorsDisplay": (b"II",), - "CGContextAddRects": ( - b"v^{CGContext=}^{CGRect={CGPoint=dd}{CGSize=dd}}Q", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CGDataConsumerCreateWithURL": ( - b"^{CGDataConsumer=}^{__CFURL=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextConvertRectToUserSpace": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGGradientCreateWithColors": ( - b"^{CGGradient=}^{CGColorSpace=}^{__CFArray=}^d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {2: {"c_array_length_in_arg": 1, "type_modifier": "n"}}, - }, - ), - "CGPathApply": ( - b"v^{CGPath=}^v^?", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"^{CGPathElement=i^{CGPoint=dd}}"}, - }, - } - } - } - }, - ), - "CGGetDisplaysWithOpenGLDisplayMask": ( - b"iII^I^I", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": (1, 3), "type_modifier": "o"}, - 3: {"type_modifier": "o"}, - } - }, - ), - "CGImageRetain": (b"^{CGImage=}^{CGImage=}",), - "CGContextAddArc": (b"v^{CGContext=}dddddi",), - "CGFontCreateWithPlatformFont": ( - b"^{CGFont=}^v", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorSpaceCreateExtendedLinearized": ( - b"^{CGColorSpace=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFContentStreamRetain": (b"^{CGPDFContentStream=}^{CGPDFContentStream=}",), - "CGErrorSetCallback": ( - b"v^?", - "", - {"arguments": {0: {"callable": {"retval": {"type": b"v"}, "arguments": {}}}}}, - ), - "CGCompleteDisplayConfiguration": (b"i^{_CGDisplayConfigRef=}I",), - "CGAffineTransformTranslate": ( - b"{CGAffineTransform=dddddd}{CGAffineTransform=dddddd}dd", - ), - "CGContextAddCurveToPoint": (b"v^{CGContext=}dddddd",), - "CGPDFContentStreamCreateWithPage": ( - b"^{CGPDFContentStream=}^{CGPDFPage=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGEventSourceGetKeyboardType": (b"I^{__CGEventSource=}",), - "CGEventKeyboardGetUnicodeString": ( - b"v^{__CGEvent=}Q^Q^T", - "", - { - "arguments": { - 2: {"type_modifier": "o"}, - 3: {"c_array_length_in_arg": (1, 2), "type_modifier": "o"}, - } - }, - ), - "CGDisplaySwitchToMode": (b"iI^{__CFDictionary=}",), - "CGEventSetIntegerValueField": (b"v^{__CGEvent=}Iq",), - "CGEventCreate": ( - b"^{__CGEvent=}^{__CGEventSource=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextSetFillColorSpace": (b"v^{CGContext=}^{CGColorSpace=}",), - "CGFontGetGlyphWithGlyphName": (b"S^{CGFont=}^{__CFString=}",), - "CGFunctionRetain": (b"^{CGFunction=}^{CGFunction=}",), - "CGContextConvertPointToUserSpace": (b"{CGPoint=dd}^{CGContext=}{CGPoint=dd}",), - "CGColorSpaceCopyName": ( - b"^{__CFString=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPatternRelease": (b"v^{CGPattern=}",), - "CGPointEqualToPoint": (b"B{CGPoint=dd}{CGPoint=dd}",), - "CGCursorIsDrawnInFramebuffer": (selAorI(b"i", b"I"),), - "CGEventSourceCounterForEventType": (b"IiI",), - "CGDisplayCaptureWithOptions": (b"iII",), - "CGDisplayIsStereo": (selAorI(b"iI", b"II"),), - "CGPDFTagTypeGetName": ( - b"^ti", - "", - {"retval": {"c_array_delimited_by_null": True}}, - ), - "CGBitmapContextGetBytesPerRow": (b"Q^{CGContext=}",), - "CGContextBeginTransparencyLayer": (b"v^{CGContext=}^{__CFDictionary=}",), - "CGEventPostToPSN": ( - b"v^{ProcessSerialNumber=II}^{__CGEvent=}", - "", - {"arguments": {0: {"type_modifier": "n"}}}, - ), - "CGFontRetain": (b"^{CGFont=}^{CGFont=}",), - "CGContextSetLineDash": ( - b"v^{CGContext=}d^dQ", - "", - {"arguments": {2: {"c_array_length_in_arg": 3, "type_modifier": "n"}}}, - ), - "CGColorSpaceCreateICCBased": ( - b"^{CGColorSpace=}Q^d^{CGDataProvider=}^{CGColorSpace=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGContextSetGrayStrokeColor": (b"v^{CGContext=}dd",), - "CGPDFOperatorTableRelease": (b"v^{CGPDFOperatorTable=}",), - "CGContextGetTypeID": (b"Q",), - "CGRectOffset": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}dd", - ), - "CGLayerGetTypeID": (b"Q",), - "CGColorSpaceCreateCalibratedGray": ( - b"^{CGColorSpace=}^d^dd", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 0: {"c_array_of_fixed_length": 3, "type_modifier": "n"}, - 1: {"c_array_of_fixed_length": 3, "type_modifier": "n"}, - }, - }, - ), - "CGEventTapCreate": ( - b"^{__CFMachPort=}IIIQ^?^v", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 4: { - "callable": { - "retval": {"type": b"^{__CGEvent=}"}, - "arguments": { - 0: {"type": b"^{__CGEventTapProxy=}"}, - 1: {"type": b"I"}, - 2: {"type": b"^{__CGEvent=}"}, - 3: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CGContextSetRenderingIntent": (b"v^{CGContext=}i",), - "CGColorSpaceIsHLGBased": (b"B^{CGColorSpace=}",), - "CGDisplayCurrentMode": (b"^{__CFDictionary=}I",), - "CGConfigureDisplayWithDisplayMode": ( - b"i^{_CGDisplayConfigRef=}I^{CGDisplayMode=}^{__CFDictionary=}", - ), - "CGCursorIsVisible": (selAorI(b"i", b"I"),), - "CGDisplayIsMain": (selAorI(b"iI", b"II"),), - "CGSetLocalEventsFilterDuringSuppressionState": (b"iII",), - "CGPDFDictionaryGetNumber": ( - b"B^{CGPDFDictionary=}^t^d", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGAssociateMouseAndMouseCursorPosition": (selAorI(b"ii", b"iI"),), - "CGEventGetDoubleValueField": (b"d^{__CGEvent=}I",), - "CGPDFDocumentAllowsPrinting": (b"B^{CGPDFDocument=}",), - "CGContextSetBlendMode": (b"v^{CGContext=}i",), - "CGFontGetGlyphAdvances": ( - b"B^{CGFont=}^SQ^i", - "", - { - "arguments": { - 1: {"c_array_length_in_arg": 2, "type_modifier": "n"}, - 3: {"c_array_length_in_arg": 2, "type_modifier": "o"}, - } - }, - ), - "CGContextReplacePathWithStrokedPath": (b"v^{CGContext=}",), - "CGGetDisplayTransferByFormula": ( - b"iI^f^f^f^f^f^f^f^f^f", - "", - { - "arguments": { - 1: {"type_modifier": "o"}, - 2: {"type_modifier": "o"}, - 3: {"type_modifier": "o"}, - 4: {"type_modifier": "o"}, - 5: {"type_modifier": "o"}, - 6: {"type_modifier": "o"}, - 7: {"type_modifier": "o"}, - 8: {"type_modifier": "o"}, - 9: {"type_modifier": "o"}, - } - }, - ), - "CGDisplayIsInHWMirrorSet": (selAorI(b"iI", b"II"),), - "CGDisplayCapture": (b"iI",), - "CGColorSpaceGetName": (b"^{__CFString=}^{CGColorSpace=}",), - "CGImageGetAlphaInfo": (b"I^{CGImage=}",), - "CGSizeCreateDictionaryRepresentation": ( - b"^{__CFDictionary=}{CGSize=dd}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFStringGetLength": (b"Q^{CGPDFString=}",), - "CGScreenRegisterMoveCallback": ( - b"i^?^v", - "", - { - "arguments": { - 0: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"{CGScreenUpdateMoveDelta=ii}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CGColorConversionInfoGetTypeID": (b"Q",), - "CGPDFDocumentRetain": (b"^{CGPDFDocument=}^{CGPDFDocument=}",), - "CGContextClip": (b"v^{CGContext=}",), - "CGPreflightPostEventAccess": (b"B",), - "CGWaitForScreenUpdateRects": ( - b"iI^I^^{CGRect={CGPoint=dd}{CGSize=dd}}^Q^{CGScreenUpdateMoveDelta=ii}", - ), - "CGDisplayBitsPerSample": (b"QI",), - "CGDisplayModeGetPixelHeight": (b"Q^{CGDisplayMode=}",), - "CGContextDrawTiledImage": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}^{CGImage=}", - ), - "CGBitmapContextGetBitsPerComponent": (b"Q^{CGContext=}",), - "CGContextAddPath": (b"v^{CGContext=}^{CGPath=}",), - "CGConfigureDisplayOrigin": (b"i^{_CGDisplayConfigRef=}Iii",), - "CGContextSetCharacterSpacing": (b"v^{CGContext=}d",), - "CGDisplaySamplesPerPixel": (b"QI",), - "CGOpenGLDisplayMaskToDisplayID": (b"II",), - "CGPDFArrayGetNumber": ( - b"B^{CGPDFArray=}Q^d", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGDisplaySetDisplayMode": (b"iI^{CGDisplayMode=}^{__CFDictionary=}",), - "CGRectIsNull": (b"B{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGDataConsumerRelease": (b"v^{CGDataConsumer=}",), - "CGColorSpaceCreateWithICCProfile": ( - b"^{CGColorSpace=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayModeGetWidth": (b"Q^{CGDisplayMode=}",), - "CGCaptureAllDisplays": (b"i",), - "CGPDFScannerPopArray": ( - b"B^{CGPDFScanner=}^^{CGPDFArray=}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGContextClipToRect": (b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGDisplayStreamUpdateCreateMergedUpdate": ( - b"^{CGDisplayStreamUpdate=}^{CGDisplayStreamUpdate=}^{CGDisplayStreamUpdate=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayHideCursor": (b"iI",), - "CGPDFDocumentGetPage": (b"^{CGPDFPage=}^{CGPDFDocument=}Q",), - "CGSessionCopyCurrentDictionary": ( - b"^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGFontGetFontBBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGFont=}",), - "CGImageGetBitsPerComponent": (b"Q^{CGImage=}",), - "CGFontCopyTableTags": ( - b"^{__CFArray=}^{CGFont=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGWaitForScreenRefreshRects": (b"i^^{CGRect={CGPoint=dd}{CGSize=dd}}^I",), - "CGDisplayStreamStop": (b"i^{CGDisplayStream=}",), - "CGShadingRetain": (b"^{CGShading=}^{CGShading=}",), - "CGBitmapContextGetColorSpace": (b"^{CGColorSpace=}^{CGContext=}",), - "CGRequestPostEventAccess": (b"B",), - "CGContextShowTextAtPoint": ( - b"v^{CGContext=}dd^tQ", - "", - {"arguments": {3: {"c_array_length_in_arg": 4, "type_modifier": "n"}}}, - ), - "CGBitmapContextCreateImage": ( - b"^{CGImage=}^{CGContext=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextTranslateCTM": (b"v^{CGContext=}dd",), - "CGDisplayModelNumber": (b"II",), - "CGPDFContextCreateWithURL": ( - b"^{CGContext=}^{__CFURL=}^{CGRect={CGPoint=dd}{CGSize=dd}}^{__CFDictionary=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CGColorSpaceCopyICCProfile": ( - b"^{__CFData=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextSetRGBStrokeColor": (b"v^{CGContext=}dddd",), - "CGBitmapContextCreateWithData": ( - b"^{CGContext=}^vQQQQ^{CGColorSpace=}I^?^v", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 7: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"^v"}}, - } - } - }, - }, - ), - "CGDisplayModeRelease": (b"v^{CGDisplayMode=}",), - "CGAffineTransformConcat": ( - b"{CGAffineTransform=dddddd}{CGAffineTransform=dddddd}{CGAffineTransform=dddddd}", - ), - "CGImageGetDataProvider": (b"^{CGDataProvider=}^{CGImage=}",), - "CGContextConvertRectToDeviceSpace": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGImageCreateWithMaskingColors": ( - b"^{CGImage=}^{CGImage=}^d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGPDFDictionaryGetInteger": ( - b"B^{CGPDFDictionary=}^t^q", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGColorGetAlpha": (b"d^{CGColor=}",), - "CGContextSetAllowsFontSubpixelPositioning": (b"v^{CGContext=}B",), - "CGPDFDocumentIsEncrypted": (b"B^{CGPDFDocument=}",), - "CGDisplayBestModeForParameters": ( - selAorI(b"^{__CFDictionary=}IQQQ^i", b"^{__CFDictionary=}IQQQ^I"), - "", - {"arguments": {4: {"type_modifier": "o"}}}, - ), - "CGPDFArrayGetBoolean": ( - b"B^{CGPDFArray=}Q^C", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGShadingCreateAxial": ( - b"^{CGShading=}^{CGColorSpace=}{CGPoint=dd}{CGPoint=dd}^{CGFunction=}BB", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGEventCreateData": ( - b"^{__CFData=}^{__CFAllocator=}^{__CGEvent=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorConverterRetain": (b"^{CGColorConversionInfo=}^{CGColorConversionInfo=}",), - "CGRectMakeWithDictionaryRepresentation": ( - b"B^{__CFDictionary=}^{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGFunctionCreate": ( - b"^{CGFunction=}^vQ^dQ^d^{CGFunctionCallbacks=I^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPaletteCreateFromPaletteBlendedWithColor": ( - b"^{_CGDirectPaletteRef=}^{_CGDirectPaletteRef=}f{CGDeviceColor=fff}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextGetTextMatrix": (b"{CGAffineTransform=dddddd}^{CGContext=}",), - "CGDisplayModeGetIOFlags": (b"I^{CGDisplayMode=}",), - "CGDisplayModeCopyPixelEncoding": ( - b"^{__CFString=}^{CGDisplayMode=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGGetDisplaysWithRect": ( - b"i{CGRect={CGPoint=dd}{CGSize=dd}}I^I^I", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": (1, 3), "type_modifier": "o"}, - 3: {"type_modifier": "o"}, - } - }, - ), - "CGFontCopyFullName": ( - b"^{__CFString=}^{CGFont=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGGetDisplaysWithPoint": ( - b"i{CGPoint=dd}I^I^I", - "", - { - "arguments": { - 2: {"c_array_length_in_arg": (1, 3), "type_modifier": "o"}, - 3: {"type_modifier": "o"}, - } - }, - ), - "CGPDFStreamCopyData": ( - b"^{__CFData=}^{CGPDFStream=}^i", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "o"}}, - }, - ), - "CGPathCreateSeparateComponents": ( - b"^{__CFArray=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageGetHeight": (b"Q^{CGImage=}",), - "CGDisplayBitsPerPixel": (b"QI",), - "CGPDFDocumentGetTrimBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPDFDocument=}i",), - "CGGetActiveDisplayList": ( - b"iI^I^I", - "", - { - "arguments": { - 1: {"c_array_length_in_arg": (0, 2), "type_modifier": "o"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGContextGetClipBoundingBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGContext=}",), - "CGContextRetain": (b"^{CGContext=}^{CGContext=}",), - "CGDisplayRemoveReconfigurationCallback": ( - b"i^?^v", - "", - { - "arguments": { - 0: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"I"}, - 1: {"type": b"I"}, - 2: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CGPDFDocumentGetRotationAngle": (b"i^{CGPDFDocument=}i",), - "CGDisplayModeGetPixelWidth": (b"Q^{CGDisplayMode=}",), - "CGContextClipToRects": ( - b"v^{CGContext=}^{CGRect={CGPoint=dd}{CGSize=dd}}Q", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CGEventCreateCopy": ( - b"^{__CGEvent=}^{__CGEvent=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGEventSourceSetLocalEventsSuppressionInterval": (b"v^{__CGEventSource=}d",), - "CGPDFDocumentGetBleedBox": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPDFDocument=}i", - ), - "CGPathGetCurrentPoint": (b"{CGPoint=dd}^{CGPath=}",), - "CGContextShowGlyphsAtPositions": ( - b"v^{CGContext=}^S^{CGPoint=dd}Q", - "", - { - "arguments": { - 1: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - 2: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - } - }, - ), - "CGEventCreateMouseEvent": ( - b"^{__CGEvent=}^{__CGEventSource=}I{CGPoint=dd}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextSetStrokeColorWithColor": (b"v^{CGContext=}^{CGColor=}",), - "CGPaletteSetColorAtIndex": (b"v^{_CGDirectPaletteRef=}{CGDeviceColor=fff}I",), - "CGContextSetCMYKFillColor": (b"v^{CGContext=}ddddd",), - "CGImageCreateWithImageInRect": ( - b"^{CGImage=}^{CGImage=}{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextBeginPage": ( - b"v^{CGContext=}^{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGImageCreateCopyWithColorSpace": ( - b"^{CGImage=}^{CGImage=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextDrawPDFDocument": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPDFDocument=}i", - ), - "CGEventGetUnflippedLocation": (b"{CGPoint=dd}^{__CGEvent=}",), - "CGFunctionGetTypeID": (b"Q",), - "CGCaptureAllDisplaysWithOptions": (b"iI",), - "CGContextSetShadowWithColor": (b"v^{CGContext=}{CGSize=dd}d^{CGColor=}",), - "CGContextSetInterpolationQuality": (b"v^{CGContext=}i",), - "CGPDFPageGetDictionary": (b"^{CGPDFDictionary=}^{CGPDFPage=}",), - "CGContextDrawLayerAtPoint": (b"v^{CGContext=}{CGPoint=dd}^{CGLayer=}",), - "CGRequestScreenCaptureAccess": (b"B",), - "CGDisplayRestoreColorSyncSettings": (b"v",), - "CGPathCreateWithEllipseInRect": ( - b"^{CGPath=}{CGRect={CGPoint=dd}{CGSize=dd}}^{CGAffineTransform=dddddd}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"type_modifier": "n"}}, - }, - ), - "CGPDFPageGetPageNumber": (b"Q^{CGPDFPage=}",), - "CGColorRelease": (b"v^{CGColor=}",), - "CGLayerRelease": (b"v^{CGLayer=}",), - "CGColorSpaceGetColorTable": ( - b"v^{CGColorSpace=}^C", - "", - {"arguments": {1: {"c_array_of_variable_length": True, "type_modifier": "o"}}}, - ), - "CGColorSpaceCopyICCData": ( - b"^{__CFData=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayIsAlwaysInMirrorSet": (selAorI(b"iI", b"II"),), - "CGFontCopyPostScriptName": ( - b"^{__CFString=}^{CGFont=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGFontCreateWithDataProvider": ( - b"^{CGFont=}^{CGDataProvider=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGRectCreateDictionaryRepresentation": ( - b"^{__CFDictionary=}{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGRectInset": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}dd", - ), - "CGRectGetWidth": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGContextStrokeRectWithWidth": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}d", - ), - "CGEventGetTypeID": (b"Q",), - "CGFontGetItalicAngle": (b"d^{CGFont=}",), - "CGColorSpaceCopyPropertyList": ( - b"@^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGRectUnion": ( - b"{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGPathAddRects": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}^{CGRect={CGPoint=dd}{CGSize=dd}}Q", - "", - { - "arguments": { - 1: {"type_modifier": "n"}, - 2: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - } - }, - ), - "CGColorSpaceSupportsOutput": (b"B^{CGColorSpace=}",), - "CGPDFContextSetDestinationForRect": ( - b"v^{CGContext=}^{__CFString=}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGEventTapCreateForPid": ( - b"^{__CFMachPort=}iIIQ^?^v", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 4: { - "callable": { - "retval": {"type": b"^{__CGEvent=}"}, - "arguments": { - 0: {"type": b"^{__CGEventTapProxy=}"}, - 1: {"type": b"I"}, - 2: {"type": b"^{__CGEvent=}"}, - 3: {"type": b"^v"}, - }, - } - } - }, - }, - ), - "CGPDFOperatorTableRetain": (b"^{CGPDFOperatorTable=}^{CGPDFOperatorTable=}",), - "CGPDFScannerPopName": ( - b"B^{CGPDFScanner=}^^t", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGLayerGetContext": (b"^{CGContext=}^{CGLayer=}",), - "CGImageGetBitsPerPixel": (b"Q^{CGImage=}",), - "CGPathAddArc": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}dddddB", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGContextDrawLinearGradient": ( - b"v^{CGContext=}^{CGGradient=}{CGPoint=dd}{CGPoint=dd}I", - ), - "CGDataConsumerGetTypeID": (b"Q",), - "CGEventGetLocation": (b"{CGPoint=dd}^{__CGEvent=}",), - "CGDisplayModeIsUsableForDesktopGUI": (b"B^{CGDisplayMode=}",), - "CGRectIsInfinite": (b"B{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGEventSetTimestamp": (b"v^{__CGEvent=}Q",), - "CGPDFContextAddDocumentMetadata": (b"v^{CGContext=}^{__CFData=}",), - "CGDisplayWaitForBeamPositionOutsideLines": (b"iIII",), - "CGColorSpaceCreateWithICCData": ( - b"^{CGColorSpace=}@", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFContextBeginPage": (b"v^{CGContext=}^{__CFDictionary=}",), - "CGPSConverterIsConverting": (b"B^{CGPSConverter=}",), - "CGEventPostToPid": (b"vi^{__CGEvent=}",), - "CGPathIsEmpty": (b"B^{CGPath=}",), - "CGDisplayScreenSize": (b"{CGSize=dd}I",), - "CGDisplayIsInMirrorSet": (selAorI(b"iI", b"II"),), - "CGFontCopyGlyphNameForGlyph": ( - b"^{__CFString=}^{CGFont=}S", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGBitmapContextGetAlphaInfo": (b"I^{CGContext=}",), - "CGColorSpaceCreateCopyWithStandardRange": ( - b"^{CGColorSpace=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFScannerRelease": (b"v^{CGPDFScanner=}",), - "CGContextCopyPath": ( - b"^{CGPath=}^{CGContext=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGShadingRelease": (b"v^{CGShading=}",), - "CGDisplayFadeOperationInProgress": (selAorI(b"i", b"I"),), - "CGPostMouseEvent": ( - selAorI(b"i{CGPoint=dd}iIi", b"i{CGPoint=dd}III"), - "", - {"c_array_length_in_arg": 2, "variadic": True}, - ), - "CGPDFContentStreamGetStreams": (b"^{__CFArray=}^{CGPDFContentStream=}",), - "CGContextSetMiterLimit": (b"v^{CGContext=}d",), - "CGRequestListenEventAccess": (b"B",), - "CGPDFOperatorTableSetCallback": ( - b"v^{CGPDFOperatorTable=}^t^?", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^{CGPDFScanner=}"}, - 1: {"type": b"^v"}, - }, - } - }, - } - }, - ), - "CGEventTapIsEnabled": (b"B^{__CFMachPort=}",), - "CGContextDrawPath": (b"v^{CGContext=}i",), - "CGWindowServerCFMachPort": (b"^{__CFMachPort=}",), - "CGColorEqualToColor": (b"B^{CGColor=}^{CGColor=}",), - "CGContextSetFontSize": (b"v^{CGContext=}d",), - "CGEventGetIntegerValueField": (b"q^{__CGEvent=}I",), - "CGContextShowText": ( - b"v^{CGContext=}^tQ", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CGColorSpaceCreateWithName": ( - b"^{CGColorSpace=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGRectGetMaxX": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGImageCreateWithMask": ( - b"^{CGImage=}^{CGImage=}^{CGImage=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGRectGetMidY": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGImageCreateWithPNGDataProvider": ( - b"^{CGImage=}^{CGDataProvider=}^dBi", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGContextSetTextDrawingMode": (b"v^{CGContext=}i",), - "CGContextGetUserSpaceToDeviceSpaceTransform": ( - b"{CGAffineTransform=dddddd}^{CGContext=}", - ), - "CGDataConsumerCreateWithCFData": ( - b"^{CGDataConsumer=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathCreateCopyByUnioningPath": ( - b"^{CGPath=}^{CGPath=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorSpaceCreateCalibratedRGB": ( - b"^{CGColorSpace=}^d^d^d^d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 0: {"c_array_of_fixed_length": 3, "type_modifier": "n"}, - 1: {"c_array_of_fixed_length": 3, "type_modifier": "n"}, - 2: {"c_array_of_fixed_length": 3, "type_modifier": "n"}, - 3: {"c_array_of_fixed_length": 9, "type_modifier": "n"}, - }, - }, - ), - "CGContextSetLineJoin": (b"v^{CGContext=}i",), - "CGDataProviderCreateSequential": ( - b"^{CGDataProvider=}^v^{CGDataProviderSequentialCallbacks=I^?^?^?^?}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFArrayGetNull": (b"B^{CGPDFArray=}Q",), - "CGPDFScannerStop": (b"v^{CGPDFScanner=}",), - "CGEventSourceSecondsSinceLastEventType": (b"diI",), - "CGContextSetRGBFillColor": (b"v^{CGContext=}dddd",), - "CGPaletteCreateCopy": ( - b"^{_CGDirectPaletteRef=}^{_CGDirectPaletteRef=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGGetLastMouseDelta": ( - b"v^i^i", - "", - {"arguments": {0: {"type_modifier": "o"}, 1: {"type_modifier": "o"}}}, - ), - "CGPDFArrayGetDictionary": ( - b"B^{CGPDFArray=}Q^^{CGPDFDictionary=}", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CGPathCloseSubpath": (b"v^{CGPath=}",), - "CGPDFContentStreamCreateWithStream": ( - b"^{CGPDFContentStream=}^{CGPDFStream=}^{CGPDFDictionary=}^{CGPDFContentStream=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplaySerialNumber": (b"II",), - "CGGetOnlineDisplayList": ( - b"iI^I^I", - "", - { - "arguments": { - 1: {"c_array_length_in_arg": (0, 2), "type_modifier": "o"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGCancelDisplayConfiguration": (b"i^{_CGDisplayConfigRef=}",), - "CGEventSourceSetPixelsPerLine": (b"v^{__CGEventSource=}d",), - "CGAffineTransformEqualToTransform": ( - b"B{CGAffineTransform=dddddd}{CGAffineTransform=dddddd}", - ), - "CGContextSetShouldSubpixelPositionFonts": (b"v^{CGContext=}B",), - "CGContextSaveGState": (b"v^{CGContext=}",), - "CGColorSpaceCreateLinearized": ( - b"^{CGColorSpace=}^{CGColorSpace=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGReleaseAllDisplays": (b"i",), - "CGDisplayRelease": (b"iI",), - "CGContextConvertSizeToUserSpace": (b"{CGSize=dd}^{CGContext=}{CGSize=dd}",), - "CGColorCreateCopyWithAlpha": ( - b"^{CGColor=}^{CGColor=}d", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFScannerPopNumber": ( - b"B^{CGPDFScanner=}^d", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGContextEOFillPath": (b"v^{CGContext=}",), - "CGPathCreateCopy": ( - b"^{CGPath=}^{CGPath=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPSConverterAbort": (b"B^{CGPSConverter=}",), - "CGContextFillPath": (b"v^{CGContext=}",), - "CGDisplayBaseAddress": ( - b"^vI", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CGContextFillRects": ( - b"v^{CGContext=}^{CGRect={CGPoint=dd}{CGSize=dd}}Q", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CGContextStrokeEllipseInRect": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}", - ), - "CGEventGetFlags": (b"Q^{__CGEvent=}",), - "CGPDFContextEndPage": (b"v^{CGContext=}",), - "CGEventSourceButtonState": (b"BiI",), - "CGContextConvertSizeToDeviceSpace": (b"{CGSize=dd}^{CGContext=}{CGSize=dd}",), - "CGReleaseScreenRefreshRects": (b"v^{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGContextSetFlatness": (b"v^{CGContext=}d",), - "CGColorSpaceUsesExtendedRange": (b"B^{CGColorSpace=}",), - "CGContextDrawShading": (b"v^{CGContext=}^{CGShading=}",), - "CGWindowLevelForKey": (b"ii",), - "CGFontCopyVariationAxes": ( - b"^{__CFArray=}^{CGFont=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextDrawImage": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}^{CGImage=}", - ), - "CGPDFDocumentCreateWithProvider": ( - b"^{CGPDFDocument=}^{CGDataProvider=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFDocumentGetArtBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPDFDocument=}i",), - "CGContextBeginPath": (b"v^{CGContext=}",), - "CGEventCreateScrollWheelEvent2": ( - b"^{__CGEvent=}^{__CGEventSource=}IIiii", - "", - { - "retval": {"already_cfretained": True}, - "c_array_length_in_arg": 2, - "variadic": True, - }, - ), - "CGColorConversionInfoCreateWithOptions": ( - b"^{CGColorConversionInfo=}^{CGColorSpace=}^{CGColorSpace=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathIsRect": ( - b"B^{CGPath=}^{CGRect={CGPoint=dd}{CGSize=dd}}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGPathCreateCopyByDashingPath": ( - b"^{CGPath=}^{CGPath=}^{CGAffineTransform=dddddd}d^dQ", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"type_modifier": "n"}, - 3: {"c_array_length_in_arg": 4, "type_modifier": "n"}, - }, - }, - ), - "CGDisplayIsAsleep": (selAorI(b"iI", b"II"),), - "CGPSConverterConvert": ( - b"B^{CGPSConverter=}^{CGDataProvider=}^{CGDataConsumer=}^{__CFDictionary=}", - ), - "CGDisplayAddressForPosition": ( - b"^vIii", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CGContextConvertPointToDeviceSpace": (b"{CGPoint=dd}^{CGContext=}{CGPoint=dd}",), - "CGDisplayBounds": (b"{CGRect={CGPoint=dd}{CGSize=dd}}I",), - "CGEventTapEnable": (b"v^{__CFMachPort=}B",), - "CGColorGetConstantColor": (b"^{CGColor=}^{__CFString=}",), - "CGDisplayUnitNumber": (b"II",), - "CGContextClosePath": (b"v^{CGContext=}",), - "CGFontGetStemV": (b"d^{CGFont=}",), - "CGDisplayCopyDisplayMode": ( - b"^{CGDisplayMode=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFDocumentAllowsCopying": ( - b"B^{CGPDFDocument=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayCreateImage": ( - b"^{CGImage=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathCreateCopyBySubtractingPath": ( - b"^{CGPath=}^{CGPath=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGDisplayRotation": (b"dI",), - "CGDisplayBestModeForParametersAndRefreshRateWithProperty": ( - b"^{__CFDictionary=}IQQQd^{__CFString=}^I", - "", - {"arguments": {6: {"type_modifier": "o"}}}, - ), - "CGDisplayIDToOpenGLDisplayMask": (b"II",), - "CGColorCreate": ( - b"^{CGColor=}^{CGColorSpace=}^d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGEventTapPostEvent": (b"v^{__CGEventTapProxy=}^{__CGEvent=}",), - "CGImageGetByteOrderInfo": (b"I^{CGImage=}",), - "CGDisplayBeamPosition": (b"II",), - "CGPDFDocumentGetTypeID": (b"Q",), - "CGShadingGetTypeID": (b"Q",), - "CGEventSourceKeyState": (b"BiS",), - "CGContextBeginTransparencyLayerWithRect": ( - b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}^{__CFDictionary=}", - ), - "CGPointCreateDictionaryRepresentation": ( - b"^{__CFDictionary=}{CGPoint=dd}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorCreateWithPattern": ( - b"^{CGColor=}^{CGColorSpace=}^{CGPattern=}^d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGContextDrawConicGradient": (b"v^{CGContext=}^{CGGradient=}{CGPoint=dd}d",), - "CGDisplayPixelsWide": (b"QI",), - "CGEventSourceFlagsState": (b"Qi",), - "CGLayerRetain": (b"^{CGLayer=}^{CGLayer=}",), - "CGContextFillRect": (b"v^{CGContext=}{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGAffineTransformInvert": ( - b"{CGAffineTransform=dddddd}{CGAffineTransform=dddddd}", - ), - "CGPaletteGetColorAtIndex": (b"{CGDeviceColor=fff}^{_CGDirectPaletteRef=}I",), - "CGEventSetFlags": (b"v^{__CGEvent=}Q",), - "CGPDFDocumentGetCropBox": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{CGPDFDocument=}i",), - "CGEventCreateScrollWheelEvent": ( - b"^{__CGEvent=}^{__CGEventSource=}IIi", - "", - { - "retval": {"already_cfretained": True}, - "c_array_length_in_arg": 2, - "variadic": True, - }, - ), - "CGPatternGetTypeID": (b"Q",), - "CGImageGetBytesPerRow": (b"Q^{CGImage=}",), - "CGPathRelease": (b"v^{CGPath=}",), - "CGDisplayModeGetTypeID": (b"Q",), - "CGEventGetType": (b"I^{__CGEvent=}",), - "CGContextSetAllowsFontSubpixelQuantization": (b"v^{CGContext=}B",), - "CGPathMoveToPoint": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}dd", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGFontRelease": (b"v^{CGFont=}",), - "CGPSConverterGetTypeID": (b"Q",), - "CGPDFDocumentRelease": (b"v^{CGPDFDocument=}",), - "CGContextSetLineWidth": (b"v^{CGContext=}d",), - "CGDisplayStreamCreateWithDispatchQueue": ( - b"^{CGDisplayStream=}IQQi^{__CFDictionary=}@@?", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "I"}, - 2: {"type": "Q"}, - 3: {"type": "@"}, - 4: {"type": "@"}, - }, - } - } - }, - }, - ), - "CGColorSpaceCreateWithPropertyList": ( - b"^{CGColorSpace=}@", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGContextGetPathCurrentPoint": (b"{CGPoint=dd}^{CGContext=}",), - "CGContextSetPatternPhase": (b"v^{CGContext=}{CGSize=dd}",), - "CGFontGetAscent": (b"i^{CGFont=}",), - "CGPDFDictionaryGetDictionary": ( - b"B^{CGPDFDictionary=}^t^^{CGPDFDictionary=}", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGContextShowGlyphs": ( - b"v^{CGContext=}^SQ", - "", - {"arguments": {1: {"c_array_length_in_arg": 2, "type_modifier": "n"}}}, - ), - "CGFontGetLeading": (b"i^{CGFont=}",), - "CGGradientCreateWithColorComponents": ( - b"^{CGGradient=}^{CGColorSpace=}^d^dQ", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 1: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - 2: {"c_array_length_in_arg": 3, "type_modifier": "n"}, - }, - }, - ), - "CGDisplayGetDrawingContext": (b"^{CGContext=}I",), - "CGContextMoveToPoint": (b"v^{CGContext=}dd",), - "CGDisplayStreamUpdateGetTypeID": (b"Q",), - "CGRectGetMinY": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGRectGetMinX": (b"d{CGRect={CGPoint=dd}{CGSize=dd}}",), - "CGContextSetFont": (b"v^{CGContext=}^{CGFont=}",), - "CGDisplayShowCursor": (b"iI",), - "CGContextRestoreGState": (b"v^{CGContext=}",), - "CGPathRetain": (b"^{CGPath=}^{CGPath=}",), - "CGPDFDocumentGetNumberOfPages": (b"Q^{CGPDFDocument=}",), - "CGAffineTransformMakeScale": (b"{CGAffineTransform=dddddd}dd",), - "CGPathAddCurveToPoint": ( - b"v^{CGPath=}^{CGAffineTransform=dddddd}dddddd", - "", - {"arguments": {1: {"type_modifier": "n"}}}, - ), - "CGImageCreate": ( - b"^{CGImage=}QQQQQ^{CGColorSpace=}I^{CGDataProvider=}^dBi", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 8: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGContextSetShouldSmoothFonts": (b"v^{CGContext=}B",), - "CGPathCreateCopyByIntersectingPath": ( - b"^{CGPath=}^{CGPath=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFDictionaryGetBoolean": ( - b"B^{CGPDFDictionary=}^t^C", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), - "CGPDFStringGetBytePtr": ( - b"^C^{CGPDFString=}", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CGScreenUnregisterMoveCallback": ( - b"v^?^v", - "", - { - "arguments": { - 0: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"{CGScreenUpdateMoveDelta=ii}"}, - 1: {"type": b"Q"}, - 2: {"type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 3: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CGColorGetColorSpace": (b"^{CGColorSpace=}^{CGColor=}",), - "CGPathCreateCopyOfLineBySubtractingPath": ( - b"^{CGPath=}^{CGPath=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGColorConverterRelease": (b"v^{CGColorConversionInfo=}",), - "CGColorSpaceUsesITUR_2100TF": (b"B^{CGColorSpace=}",), - "CGDisplayAvailableModes": (b"^{__CFArray=}I",), - "CGColorCreateGenericGrayGamma2_2": ( - b"^{CGColor=}dd", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGEventCreateSourceFromEvent": ( - b"^{__CGEventSource=}^{__CGEvent=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPostKeyboardEvent": (selAorI(b"iSSi", b"iSSI"),), - "CGPathCreateCopyBySymmetricDifferenceOfPath": ( - b"^{CGPath=}^{CGPath=}^{CGPath=}B", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPDFScannerPopStream": ( - b"B^{CGPDFScanner=}^^{CGPDFStream=}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGPathCreateMutableCopy": ( - b"^{CGPath=}^{CGPath=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGPathGetTypeID": (b"Q",), - "CGColorSpaceCreateIndexed": ( - b"^{CGColorSpace=}^{CGColorSpace=}Q^C", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 2: {"c_array_of_variable_length": True, "type_modifier": "n"} - }, - }, - ), - "CGColorSpaceCreateLab": ( - b"^{CGColorSpace=}^d^d^d", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 0: {"c_array_of_fixed_length": 3, "type_modifier": "n"}, - 1: {"c_array_of_fixed_length": 3, "type_modifier": "n"}, - 2: {"c_array_of_fixed_length": 4, "type_modifier": "n"}, - }, - }, - ), - "CGDisplayIOServicePort": (b"II",), - "CGContextSetFillPattern": ( - b"v^{CGContext=}^{CGPattern=}^d", - "", - {"arguments": {2: {"c_array_of_variable_length": True, "type_modifier": "n"}}}, - ), - "CGPreflightScreenCaptureAccess": (b"B",), - "CGSizeMakeWithDictionaryRepresentation": ( - b"B^{__CFDictionary=}^{CGSize=dd}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CGPDFDocumentUnlockWithPassword": ( - b"B^{CGPDFDocument=}^t", - "", - {"arguments": {1: {"c_array_delimited_by_null": True, "type_modifier": "n"}}}, - ), - "CGConvertColorDataWithFormat": ( - b"BQQ^v{CGColorDataFormat=I@IQQi^d}^v{CGColorDataFormat=I@IQQi^d}^{__CFDictionary=}", - "", - { - "arguments": { - 2: {"c_array_of_variable_length": True, "type_modifier": "o"}, - 4: {"c_array_of_variable_length": True, "type_modifier": "n"}, - } - }, - ), - "CGContextSetFillColorWithColor": (b"v^{CGContext=}^{CGColor=}",), - "CGPDFDictionaryGetName": ( - b"B^{CGPDFDictionary=}^t^^t", - "", - { - "arguments": { - 1: {"c_array_delimited_by_null": True, "type_modifier": "n"}, - 2: {"type_modifier": "o"}, - } - }, - ), -} -aliases = { - "CGSizeApplyAffineTransform": "__CGSizeApplyAffineTransform", - "CG_NULLABLE_ARRAY": "__nullable", - "CGSizeEqualToSize": "__CGSizeEqualToSize", - "CGFLOAT_TYPE": "double", - "CGPointApplyAffineTransform": "__CGPointApplyAffineTransform", - "kCGWindowIDCFNumberType": "kCFNumberSInt32Type", - "CGColorConverterRef": "CGColorConversionInfoRef", - "kCGBitmapByteOrder16Host": "kCGBitmapByteOrder16Little", - "CGPointEqualToPoint": "__CGPointEqualToPoint", - "kCGEventSupressionStateRemoteMouseDrag": "kCGEventSuppressionStateRemoteMouseDrag", - "kCGEventSupressionStateSupressionInterval": "kCGEventSuppressionStateSuppressionInterval", - "CG_SKYLIGHT_EXTERN_64": "CG_EXTERN", - "CGEventSupressionState": "CGEventSuppressionState", - "kCGBitmapByteOrder32Big": "kCGImageByteOrder32Big", - "CG_PRIVATE_EXTERN": "CG_LOCAL", - "CG_AVAILABLE_STARTING": "__OSX_AVAILABLE_STARTING", - "CG_LOCAL": "__private_extern__", - "cg_nullable": "__nullable", - "kCGGlyphMax": "kCGFontIndexMax", - "CG_EXTERN_64": "CG_EXTERN", - "CG_NONNULL_ARRAY": "__nonnull", - "kCGWindowBackingCFNumberType": "kCFNumberSInt32Type", - "CGFLOAT_MIN": "DBL_MIN", - "CG_LOCAL_64": "CG_LOCAL", - "kCGBitmapByteOrderMask": "kCGImageByteOrderMask", - "CGEventNoErr": "kCGErrorSuccess", - "CGAffineTransformMake": "__CGAffineTransformMake", - "kCGBitmapByteOrder16Little": "kCGImageByteOrder16Little", - "CGFLOAT_MAX": "DBL_MAX", - "kCGBitmapByteOrderDefault": "kCGImageByteOrderDefault", - "CGFLOAT_EPSILON": "DBL_EPSILON", - "kCGWindowSharingCFNumberType": "kCFNumberSInt32Type", - "kCGBitmapByteOrder16Big": "kCGImageByteOrder16Big", - "CGDisplayNoErr": "kCGErrorSuccess", - "CG_OBSOLETE": "__CG_DEPRECATED", - "kCGNumberOfEventSupressionStates": "kCGNumberOfEventSuppressionStates", - "CG_AVAILABLE_BUT_DEPRECATED": "__OSX_AVAILABLE_BUT_DEPRECATED", - "CGSetLocalEventsFilterDuringSupressionState": "CGSetLocalEventsFilterDuringSuppressionState", - "kCGBitmapByteOrder32Little": "kCGImageByteOrder32Little", - "kCGBitmapByteOrder32Host": "kCGBitmapByteOrder32Little", -} -cftypes = [ - ("CGEventRef", b"^{__CGEvent=}", "CGEventGetTypeID", None), - ("CGEventSourceRef", b"^{__CGEventSource=}", "CGEventSourceGetTypeID", None), - ("IOSurfaceRef", b"^{__IOSurface=}", None, None), - ("CGColorRef", b"^{CGColor=}", "CGColorGetTypeID", None), - ("CGFontRef", b"^{CGFont=}", "CGFontGetTypeID", None), - ( - "CGColorConversionInfoRef", - b"^{CGColorConversionInfo=}", - "CGColorConversionInfoGetTypeID", - None, - ), - ("CGDataConsumerRef", b"^{CGDataConsumer=}", "CGDataConsumerGetTypeID", None), - ("CGPathRef", b"^{CGPath=}", "CGPathGetTypeID", None), - ("CGDisplayModeRef", b"^{CGDisplayMode}", "CGDisplayModeGetTypeID", None), - ("CGGradientRef", b"^{CGGradient=}", "CGGradientGetTypeID", None), - ("CGDirectDisplay", b"^{CGDirectDisplay=}", "CGDirectDisplayGetTypeID", None), - ("CGColorSpaceRef", b"^{CGColorSpace=}", "CGColorSpaceGetTypeID", None), - ("CGPDFDocumentRef", b"^{CGPDFDocument=}", "CGPDFDocumentGetTypeID", None), - ("CGFunctionRef", b"^{CGFunction=}", "CGFunctionGetTypeID", None), - ("CGImageRef", b"^{CGImage=}", "CGImageGetTypeID", None), - ("CGDisplayStreamRef", b"^{CGDisplayStream=}", "CGDisplayStreamGetTypeID", None), - ("CGPDFPageRef", b"^{CGPDFPage=}", "CGPDFPageGetTypeID", None), - ("CGLayerRef", b"^{CGLayer=}", "CGLayerGetTypeID", None), - ("CGPatternRef", b"^{CGPattern=}", "CGPatternGetTypeID", None), - ("CGPSConverterRef", b"^{CGPSConverter=}", "CGPSConverterGetTypeID", None), - ("CGContextRef", b"^{CGContext=}", "CGContextGetTypeID", None), - ("CGShadingRef", b"^{CGShading=}", "CGShadingGetTypeID", None), - ("CGDataProviderRef", b"^{CGDataProvider=}", "CGDataProviderGetTypeID", None), - ( - "CGDisplayStreamUpdateRef", - b"^{CGDisplayStreamUpdate=}", - "CGDisplayStreamUpdateGetTypeID", - None, - ), -] -misc.update( - { - "CGPDFContentStreamRef": objc.createOpaquePointerType( - "CGPDFContentStreamRef", b"^{CGPDFContentStream=}" - ), - "CGPDFScannerRef": objc.createOpaquePointerType( - "CGPDFScannerRef", b"^{CGPDFScanner=}" - ), - "CGDirectPaletteRef": objc.createOpaquePointerType( - "CGDirectPaletteRef", b"^{_CGDirectPaletteRef=}" - ), - "CGPDFStringRef": objc.createOpaquePointerType( - "CGPDFStringRef", b"^{CGPDFString=}" - ), - "CGPDFObject": objc.createOpaquePointerType("CGPDFObject", b"^{CGPDFObject=}"), - "CGPDFOperatorTableRef": objc.createOpaquePointerType( - "CGPDFOperatorTableRef", b"^{CGPDFOperatorTable}" - ), - "CGDisplayConfigRef": objc.createOpaquePointerType( - "CGDisplayConfigRef", b"^{_CGDisplayConfigRef=}" - ), - "CGPDFDictionaryRef": objc.createOpaquePointerType( - "CGPDFDictionaryRef", b"^{CGPDFDictionary=}" - ), - "CGPDFStreamRef": objc.createOpaquePointerType( - "CGPDFStreamRef", b"^{CGPDFStream=}" - ), - "CGEventTapProxy": objc.createOpaquePointerType( - "CGEventTapProxy", b"^{__CGEventTapProxy=}" - ), - "CGPDFArrayRef": objc.createOpaquePointerType( - "CGPDFArrayRef", b"^{CGPDFArray=}" - ), - } -) -expressions = { - "kCGOverlayWindowLevel": "CGWindowLevelForKey(kCGOverlayWindowLevelKey)", - "kCGMainMenuWindowLevel": "CGWindowLevelForKey(kCGMainMenuWindowLevelKey)", - "kCGBaseWindowLevel": "CGWindowLevelForKey(kCGBaseWindowLevelKey)", - "kCGStatusWindowLevel": "CGWindowLevelForKey(kCGStatusWindowLevelKey)", - "kCGHelpWindowLevel": "CGWindowLevelForKey(kCGHelpWindowLevelKey)", - "kCGNormalWindowLevel": "CGWindowLevelForKey(kCGNormalWindowLevelKey)", - "kCGScreenSaverWindowLevel": "CGWindowLevelForKey(kCGScreenSaverWindowLevelKey)", - "kCGMaximumWindowLevel": "CGWindowLevelForKey(kCGMaximumWindowLevelKey)", - "kCGUtilityWindowLevel": "CGWindowLevelForKey(kCGUtilityWindowLevelKey)", - "kCGCursorWindowLevel": "CGWindowLevelForKey(kCGCursorWindowLevelKey)", - "kCGAssistiveTechHighWindowLevel": "CGWindowLevelForKey(kCGAssistiveTechHighWindowLevelKey)", - "kCGModalPanelWindowLevel": "CGWindowLevelForKey(kCGModalPanelWindowLevelKey)", - "kCGEventFilterMaskPermitAllEvents": "(kCGEventFilterMaskPermitLocalMouseEvents | kCGEventFilterMaskPermitLocalKeyboardEvents | kCGEventFilterMaskPermitSystemDefinedEvents)", - "kCGMinimumWindowLevel": "CGWindowLevelForKey(kCGMinimumWindowLevelKey)", - "kCGPopUpMenuWindowLevel": "CGWindowLevelForKey(kCGPopUpMenuWindowLevelKey)", - "kCGDesktopWindowLevel": "CGWindowLevelForKey(kCGDesktopWindowLevelKey)", - "kCGFloatingWindowLevel": "CGWindowLevelForKey(kCGFloatingWindowLevelKey)", - "kCGDraggingWindowLevel": "CGWindowLevelForKey(kCGDraggingWindowLevelKey)", - "kCGDockWindowLevel": "CGWindowLevelForKey(kCGDockWindowLevelKey)", - "kCGDesktopIconWindowLevel": "CGWindowLevelForKey(kCGDesktopIconWindowLevelKey)", - "kCGBackstopMenuLevel": "CGWindowLevelForKey(kCGBackstopMenuLevelKey)", - "kCGTornOffMenuWindowLevel": "CGWindowLevelForKey(kCGTornOffMenuWindowLevelKey)", -} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_sortandmap.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_sortandmap.abi3.so deleted file mode 100755 index 5b122bd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreGraphics/_sortandmap.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/_CVPixelBuffer.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/_CVPixelBuffer.abi3.so deleted file mode 100755 index a32d747..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/_CVPixelBuffer.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__init__.py deleted file mode 100644 index bf0f400..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__init__.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Python mapping for the CoreVideo framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import CoreFoundation - import objc - from . import _metadata, _CVPixelBuffer - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.CoreVideo", - frameworkIdentifier="com.apple.CoreVideo", - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/CoreVideo.framework" - ), - globals_dict=globals(), - inline_list=None, - parents=( - _CVPixelBuffer, - CoreFoundation, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.CoreVideo._metadata"] - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index b5d9689..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index 25a6398..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/_metadata.py deleted file mode 100644 index 6dad167..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/CoreVideo/_metadata.py +++ /dev/null @@ -1,608 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Fri Nov 17 11:44:05 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -misc.update( - { - "CVTimeStamp": objc.createStructType( - "Quartz.CoreVideo.CVTimeStamp", - b"{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - [ - "version", - "videoTimeScale", - "videoTime", - "hostTime", - "rateScalar", - "videoRefreshPeriod", - "smpteTime", - "flags", - "reserved", - ], - ), - "CVPlanarPixelBufferInfo_YCbCrBiPlanar": objc.createStructType( - "Quartz.CoreVideo.CVPlanarPixelBufferInfo_YCbCrBiPlanar", - b"{CVPlanarPixelBufferInfo_YCbCrBiPlanar={CVPlanarComponentInfo=iI}{CVPlanarComponentInfo=iI}}", - ["componentInfoY", "componentInfoCbCr"], - ), - "CVPlanarPixelBufferInfo_YCbCrPlanar": objc.createStructType( - "Quartz.CoreVideo.CVPlanarPixelBufferInfo_YCbCrPlanar", - b"{CVPlanarPixelBufferInfo_YCbCrPlanar={CVPlanarComponentInfo=iI}{CVPlanarComponentInfo=iI}{CVPlanarComponentInfo=iI}}", - ["componentInfoY", "componentInfoCb", "componentInfoCr"], - ), - "CVPlanarComponentInfo": objc.createStructType( - "Quartz.CoreVideo.CVPlanarComponentInfo", - b"{CVPlanarComponentInfo=iI}", - ["offset", "rowBytes"], - ), - "CVTime": objc.createStructType( - "Quartz.CoreVideo.CVTime", - b"{CVTime=qii}", - ["timeValue", "timeScale", "flags"], - ), - "CVSMPTETime": objc.createStructType( - "Quartz.CoreVideo.CVSMPTETime", - b"{CVSMPTETime=ssIIIssss}", - [ - "subframes", - "subframeDivisor", - "counter", - "type", - "flags", - "hours", - "minutes", - "seconds", - "frames", - ], - ), - "CVPlanarPixelBufferInfo": objc.createStructType( - "Quartz.CoreVideo.CVPlanarPixelBufferInfo", - b"{CVPlanarPixelBufferInfo=[1{CVPlanarComponentInfo=iI}]}", - ["componentInfo"], - ), - } -) -constants = """$kCVBufferMovieTimeKey$kCVBufferNonPropagatedAttachmentsKey$kCVBufferPropagatedAttachmentsKey$kCVBufferTimeScaleKey$kCVBufferTimeValueKey$kCVImageBufferAlphaChannelIsOpaque$kCVImageBufferAlphaChannelModeKey$kCVImageBufferAlphaChannelMode_PremultipliedAlpha$kCVImageBufferAlphaChannelMode_StraightAlpha$kCVImageBufferAmbientViewingEnvironmentKey$kCVImageBufferCGColorSpaceKey$kCVImageBufferChromaLocationBottomFieldKey$kCVImageBufferChromaLocationTopFieldKey$kCVImageBufferChromaLocation_Bottom$kCVImageBufferChromaLocation_BottomLeft$kCVImageBufferChromaLocation_Center$kCVImageBufferChromaLocation_DV420$kCVImageBufferChromaLocation_Left$kCVImageBufferChromaLocation_Top$kCVImageBufferChromaLocation_TopLeft$kCVImageBufferChromaSubsamplingKey$kCVImageBufferChromaSubsampling_411$kCVImageBufferChromaSubsampling_420$kCVImageBufferChromaSubsampling_422$kCVImageBufferCleanApertureHeightKey$kCVImageBufferCleanApertureHorizontalOffsetKey$kCVImageBufferCleanApertureKey$kCVImageBufferCleanApertureVerticalOffsetKey$kCVImageBufferCleanApertureWidthKey$kCVImageBufferColorPrimariesKey$kCVImageBufferColorPrimaries_DCI_P3$kCVImageBufferColorPrimaries_EBU_3213$kCVImageBufferColorPrimaries_ITU_R_2020$kCVImageBufferColorPrimaries_ITU_R_709_2$kCVImageBufferColorPrimaries_P22$kCVImageBufferColorPrimaries_P3_D65$kCVImageBufferColorPrimaries_SMPTE_C$kCVImageBufferContentLightLevelInfoKey$kCVImageBufferDisplayDimensionsKey$kCVImageBufferDisplayHeightKey$kCVImageBufferDisplayWidthKey$kCVImageBufferFieldCountKey$kCVImageBufferFieldDetailKey$kCVImageBufferFieldDetailSpatialFirstLineEarly$kCVImageBufferFieldDetailSpatialFirstLineLate$kCVImageBufferFieldDetailTemporalBottomFirst$kCVImageBufferFieldDetailTemporalTopFirst$kCVImageBufferGammaLevelKey$kCVImageBufferICCProfileKey$kCVImageBufferLogTransferFunctionKey$kCVImageBufferLogTransferFunction_AppleLog$kCVImageBufferMasteringDisplayColorVolumeKey$kCVImageBufferPixelAspectRatioHorizontalSpacingKey$kCVImageBufferPixelAspectRatioKey$kCVImageBufferPixelAspectRatioVerticalSpacingKey$kCVImageBufferPreferredCleanApertureKey$kCVImageBufferRegionOfInterestKey$kCVImageBufferTransferFunctionKey$kCVImageBufferTransferFunction_EBU_3213$kCVImageBufferTransferFunction_ITU_R_2020$kCVImageBufferTransferFunction_ITU_R_2100_HLG$kCVImageBufferTransferFunction_ITU_R_709_2$kCVImageBufferTransferFunction_Linear$kCVImageBufferTransferFunction_SMPTE_240M_1995$kCVImageBufferTransferFunction_SMPTE_C$kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ$kCVImageBufferTransferFunction_SMPTE_ST_428_1$kCVImageBufferTransferFunction_UseGamma$kCVImageBufferTransferFunction_sRGB$kCVImageBufferYCbCrMatrixKey$kCVImageBufferYCbCrMatrix_DCI_P3$kCVImageBufferYCbCrMatrix_ITU_R_2020$kCVImageBufferYCbCrMatrix_ITU_R_601_4$kCVImageBufferYCbCrMatrix_ITU_R_709_2$kCVImageBufferYCbCrMatrix_P3_D65$kCVImageBufferYCbCrMatrix_SMPTE_240M_1995$kCVIndefiniteTime@{CVTime=qii}$kCVMetalTextureCacheMaximumTextureAgeKey$kCVMetalTextureStorageMode$kCVMetalTextureUsage$kCVOpenGLBufferHeight$kCVOpenGLBufferInternalFormat$kCVOpenGLBufferMaximumMipmapLevel$kCVOpenGLBufferPoolMaximumBufferAgeKey$kCVOpenGLBufferPoolMinimumBufferCountKey$kCVOpenGLBufferTarget$kCVOpenGLBufferWidth$kCVOpenGLTextureCacheChromaSamplingModeAutomatic$kCVOpenGLTextureCacheChromaSamplingModeBestPerformance$kCVOpenGLTextureCacheChromaSamplingModeHighestQuality$kCVOpenGLTextureCacheChromaSamplingModeKey$kCVPixelBufferBytesPerRowAlignmentKey$kCVPixelBufferCGBitmapContextCompatibilityKey$kCVPixelBufferCGImageCompatibilityKey$kCVPixelBufferExtendedPixelsBottomKey$kCVPixelBufferExtendedPixelsLeftKey$kCVPixelBufferExtendedPixelsRightKey$kCVPixelBufferExtendedPixelsTopKey$kCVPixelBufferHeightKey$kCVPixelBufferIOSurfaceCoreAnimationCompatibilityKey$kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey$kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey$kCVPixelBufferIOSurfaceOpenGLFBOCompatibilityKey$kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey$kCVPixelBufferIOSurfacePropertiesKey$kCVPixelBufferMemoryAllocatorKey$kCVPixelBufferMetalCompatibilityKey$kCVPixelBufferOpenGLCompatibilityKey$kCVPixelBufferOpenGLESCompatibilityKey$kCVPixelBufferOpenGLESTextureCacheCompatibilityKey$kCVPixelBufferOpenGLTextureCacheCompatibilityKey$kCVPixelBufferPixelFormatTypeKey$kCVPixelBufferPlaneAlignmentKey$kCVPixelBufferPoolAllocationThresholdKey$kCVPixelBufferPoolFreeBufferNotification$kCVPixelBufferPoolMaximumBufferAgeKey$kCVPixelBufferPoolMinimumBufferCountKey$kCVPixelBufferProResRAWKey_BlackLevel$kCVPixelBufferProResRAWKey_ColorMatrix$kCVPixelBufferProResRAWKey_GainFactor$kCVPixelBufferProResRAWKey_MetadataExtension$kCVPixelBufferProResRAWKey_RecommendedCrop$kCVPixelBufferProResRAWKey_SenselSitingOffsets$kCVPixelBufferProResRAWKey_WhiteBalanceBlueFactor$kCVPixelBufferProResRAWKey_WhiteBalanceCCT$kCVPixelBufferProResRAWKey_WhiteBalanceRedFactor$kCVPixelBufferProResRAWKey_WhiteLevel$kCVPixelBufferVersatileBayerKey_BayerPattern$kCVPixelBufferWidthKey$kCVPixelFormatBitsPerBlock$kCVPixelFormatBlackBlock$kCVPixelFormatBlockHeight$kCVPixelFormatBlockHorizontalAlignment$kCVPixelFormatBlockVerticalAlignment$kCVPixelFormatBlockWidth$kCVPixelFormatCGBitmapContextCompatibility$kCVPixelFormatCGBitmapInfo$kCVPixelFormatCGImageCompatibility$kCVPixelFormatCodecType$kCVPixelFormatComponentRange$kCVPixelFormatComponentRange_FullRange$kCVPixelFormatComponentRange_VideoRange$kCVPixelFormatComponentRange_WideRange$kCVPixelFormatConstant$kCVPixelFormatContainsAlpha$kCVPixelFormatContainsGrayscale$kCVPixelFormatContainsRGB$kCVPixelFormatContainsSenselArray$kCVPixelFormatContainsYCbCr$kCVPixelFormatFillExtendedPixelsCallback$kCVPixelFormatFourCC$kCVPixelFormatHorizontalSubsampling$kCVPixelFormatName$kCVPixelFormatOpenGLCompatibility$kCVPixelFormatOpenGLESCompatibility$kCVPixelFormatOpenGLFormat$kCVPixelFormatOpenGLInternalFormat$kCVPixelFormatOpenGLType$kCVPixelFormatPlanes$kCVPixelFormatQDCompatibility$kCVPixelFormatVerticalSubsampling$kCVZeroTime@{CVTime=qii}$""" -enums = """$COREVIDEO_INCLUDED_IOSURFACE_HEADER_FILE@1$kCVAttachmentMode_ShouldNotPropagate@0$kCVAttachmentMode_ShouldPropagate@1$kCVPixelBufferLock_ReadOnly@1$kCVPixelBufferPoolFlushExcessBuffers@1$kCVPixelFormatType_128RGBAFloat@1380410945$kCVPixelFormatType_14Bayer_BGGR@1650943796$kCVPixelFormatType_14Bayer_GBRG@1734505012$kCVPixelFormatType_14Bayer_GRBG@1735549492$kCVPixelFormatType_14Bayer_RGGB@1919379252$kCVPixelFormatType_16BE555@16$kCVPixelFormatType_16BE565@1110783541$kCVPixelFormatType_16Gray@1647392359$kCVPixelFormatType_16LE555@1278555445$kCVPixelFormatType_16LE5551@892679473$kCVPixelFormatType_16LE565@1278555701$kCVPixelFormatType_16VersatileBayer@1651519798$kCVPixelFormatType_1IndexedGray_WhiteIsZero@33$kCVPixelFormatType_1Monochrome@1$kCVPixelFormatType_24BGR@842285639$kCVPixelFormatType_24RGB@24$kCVPixelFormatType_2Indexed@2$kCVPixelFormatType_2IndexedGray_WhiteIsZero@34$kCVPixelFormatType_30RGB@1378955371$kCVPixelFormatType_30RGBLEPackedWideGamut@1999843442$kCVPixelFormatType_32ABGR@1094862674$kCVPixelFormatType_32ARGB@32$kCVPixelFormatType_32AlphaGray@1647522401$kCVPixelFormatType_32BGRA@1111970369$kCVPixelFormatType_32RGBA@1380401729$kCVPixelFormatType_40ARGBLEWideGamut@1999908961$kCVPixelFormatType_40ARGBLEWideGamutPremultiplied@1999908973$kCVPixelFormatType_420YpCbCr10BiPlanarFullRange@2019963440$kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange@2016686640$kCVPixelFormatType_420YpCbCr8BiPlanarFullRange@875704422$kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange@875704438$kCVPixelFormatType_420YpCbCr8Planar@2033463856$kCVPixelFormatType_420YpCbCr8PlanarFullRange@1714696752$kCVPixelFormatType_420YpCbCr8VideoRange_8A_TriPlanar@1982882104$kCVPixelFormatType_422YpCbCr10@1983000880$kCVPixelFormatType_422YpCbCr10BiPlanarFullRange@2019963442$kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange@2016686642$kCVPixelFormatType_422YpCbCr16@1983000886$kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange@1937125938$kCVPixelFormatType_422YpCbCr8@846624121$kCVPixelFormatType_422YpCbCr8BiPlanarFullRange@875704934$kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange@875704950$kCVPixelFormatType_422YpCbCr8FullRange@2037741158$kCVPixelFormatType_422YpCbCr8_yuvs@2037741171$kCVPixelFormatType_422YpCbCr_4A_8BiPlanar@1630697081$kCVPixelFormatType_4444AYpCbCr16@2033463606$kCVPixelFormatType_4444AYpCbCr8@2033463352$kCVPixelFormatType_4444AYpCbCrFloat@1916036716$kCVPixelFormatType_4444YpCbCrA8@1983131704$kCVPixelFormatType_4444YpCbCrA8R@1916022840$kCVPixelFormatType_444YpCbCr10@1983131952$kCVPixelFormatType_444YpCbCr10BiPlanarFullRange@2019963956$kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange@2016687156$kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange@1937126452$kCVPixelFormatType_444YpCbCr16VideoRange_16A_TriPlanar@1932812659$kCVPixelFormatType_444YpCbCr8@1983066168$kCVPixelFormatType_444YpCbCr8BiPlanarFullRange@875836518$kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange@875836534$kCVPixelFormatType_48RGB@1647589490$kCVPixelFormatType_4Indexed@4$kCVPixelFormatType_4IndexedGray_WhiteIsZero@36$kCVPixelFormatType_64ARGB@1647719521$kCVPixelFormatType_64RGBAHalf@1380411457$kCVPixelFormatType_64RGBALE@1815491698$kCVPixelFormatType_64RGBA_DownscaledProResRAW@1651521076$kCVPixelFormatType_8Indexed@8$kCVPixelFormatType_8IndexedGray_WhiteIsZero@40$kCVPixelFormatType_ARGB2101010LEPacked@1815162994$kCVPixelFormatType_DepthFloat16@1751410032$kCVPixelFormatType_DepthFloat32@1717855600$kCVPixelFormatType_DisparityFloat16@1751411059$kCVPixelFormatType_DisparityFloat32@1717856627$kCVPixelFormatType_Lossless_32BGRA@641877825$kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarVideoRange@645428784$kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarFullRange@641230384$kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange@641234480$kCVPixelFormatType_Lossless_422YpCbCr10PackedBiPlanarVideoRange@645428786$kCVPixelFormatType_Lossy_32BGRA@759318337$kCVPixelFormatType_Lossy_420YpCbCr10PackedBiPlanarVideoRange@762869296$kCVPixelFormatType_Lossy_420YpCbCr8BiPlanarFullRange@758670896$kCVPixelFormatType_Lossy_420YpCbCr8BiPlanarVideoRange@758674992$kCVPixelFormatType_Lossy_422YpCbCr10PackedBiPlanarVideoRange@762869298$kCVPixelFormatType_OneComponent10@1278226736$kCVPixelFormatType_OneComponent12@1278226738$kCVPixelFormatType_OneComponent16@1278226742$kCVPixelFormatType_OneComponent16Half@1278226536$kCVPixelFormatType_OneComponent32Float@1278226534$kCVPixelFormatType_OneComponent8@1278226488$kCVPixelFormatType_TwoComponent16@843264310$kCVPixelFormatType_TwoComponent16Half@843264104$kCVPixelFormatType_TwoComponent32Float@843264102$kCVPixelFormatType_TwoComponent8@843264056$kCVReturnAllocationFailed@-6662$kCVReturnDisplayLinkAlreadyRunning@-6671$kCVReturnDisplayLinkCallbacksNotSet@-6673$kCVReturnDisplayLinkNotRunning@-6672$kCVReturnError@-6660$kCVReturnFirst@-6660$kCVReturnInvalidArgument@-6661$kCVReturnInvalidDisplay@-6670$kCVReturnInvalidPixelBufferAttributes@-6682$kCVReturnInvalidPixelFormat@-6680$kCVReturnInvalidPoolAttributes@-6691$kCVReturnInvalidSize@-6681$kCVReturnLast@-6699$kCVReturnPixelBufferNotMetalCompatible@-6684$kCVReturnPixelBufferNotOpenGLCompatible@-6683$kCVReturnPoolAllocationFailed@-6690$kCVReturnRetry@-6692$kCVReturnSuccess@0$kCVReturnUnsupported@-6663$kCVReturnWouldExceedAllocationThreshold@-6689$kCVSMPTETimeRunning@2$kCVSMPTETimeType24@0$kCVSMPTETimeType25@1$kCVSMPTETimeType2997@4$kCVSMPTETimeType2997Drop@5$kCVSMPTETimeType30@3$kCVSMPTETimeType30Drop@2$kCVSMPTETimeType5994@7$kCVSMPTETimeType60@6$kCVSMPTETimeValid@1$kCVTimeIsIndefinite@1$kCVTimeStampBottomField@131072$kCVTimeStampHostTimeValid@2$kCVTimeStampIsInterlaced@196608$kCVTimeStampRateScalarValid@16$kCVTimeStampSMPTETimeValid@4$kCVTimeStampTopField@65536$kCVTimeStampVideoHostTimeValid@3$kCVTimeStampVideoRefreshPeriodValid@8$kCVTimeStampVideoTimeValid@1$kCVVersatileBayer_BayerPattern_BGGR@3$kCVVersatileBayer_BayerPattern_GBRG@2$kCVVersatileBayer_BayerPattern_GRBG@1$kCVVersatileBayer_BayerPattern_RGGB@0$kReturnRetry@-6692$""" -misc.update( - { - "CVPixelBufferPoolFlushFlags": NewType("CVPixelBufferPoolFlushFlags", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:171:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:171:1)", - int, - ), - "CVTimeStampFlags": NewType("CVTimeStampFlags", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVReturn.h:56:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVReturn.h:56:1)", - int, - ), - "CVSMPTETimeType": NewType("CVSMPTETimeType", int), - "CVPixelBufferLockFlags": NewType("CVPixelBufferLockFlags", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:35:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:35:1)", - int, - ), - "CVSMPTETimeFlags": NewType("CVSMPTETimeFlags", int), - "CVTimeFlags": NewType("CVTimeFlags", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:250:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:250:1)", - int, - ), - "CVAttachmentMode": NewType("CVAttachmentMode", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:250:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:250:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:142:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:142:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:35:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:35:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVReturn.h:56:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVReturn.h:56:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:142:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:142:1)", - int, - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:171:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:171:1)", - int, - ), - } -) -misc.update({}) -misc.update({}) -functions = { - "CVImageBufferGetEncodedSize": (b"{CGSize=dd}^{__CVBuffer=}",), - "CVOpenGLTextureRelease": (b"v^{__CVBuffer=}",), - "CVPixelBufferPoolRelease": (b"v^{__CVPixelBufferPool=}",), - "CVPixelBufferPoolGetTypeID": (b"Q",), - "CVYCbCrMatrixGetIntegerCodePointForString": (b"i^{__CFString=}",), - "CVPixelBufferCreate": ( - b"i^{__CFAllocator=}QQI^{__CFDictionary=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {5: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVOpenGLBufferPoolGetTypeID": (b"Q",), - "CVPixelBufferFillExtendedPixels": (b"i^{__CVBuffer=}",), - "CVOpenGLTextureCacheRetain": ( - b"^{__CVOpenGLTextureCache=}^{__CVOpenGLTextureCache=}", - ), - "CVOpenGLBufferPoolCreateOpenGLBuffer": ( - b"i^{__CFAllocator=}^{__CVOpenGLBufferPool=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {2: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVDisplayLinkSetCurrentCGDisplay": (b"i^{__CVDisplayLink=}I",), - "CVBufferSetAttachment": (b"v^{__CVBuffer=}^{__CFString=}@I",), - "CVGetCurrentHostTime": (b"Q", "", {"variadic": False}), - "CVPixelBufferPoolCreate": ( - b"i^{__CFAllocator=}^{__CFDictionary=}^{__CFDictionary=}^^{__CVPixelBufferPool=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVPixelBufferGetHeightOfPlane": (b"Q^{__CVBuffer=}Q",), - "CVBufferRetain": (b"^{__CVBuffer=}^{__CVBuffer=}",), - "CVBufferHasAttachment": (b"Z^{__CVBuffer=}^{__CFString=}",), - "CVDisplayLinkTranslateTime": ( - b"i^{__CVDisplayLink=}^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "", - {"arguments": {1: {"type_modifier": "n"}, 2: {"type_modifier": "o"}}}, - ), - "CVPixelBufferRetain": (b"^{__CVBuffer=}^{__CVBuffer=}",), - "CVPixelBufferGetPlaneCount": (b"Q^{__CVBuffer=}",), - "CVOpenGLTextureCacheRelease": (b"v^{__CVOpenGLTextureCache=}",), - "CVPixelBufferGetBaseAddress": ( - b"^v^{__CVBuffer=}", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CVOpenGLBufferPoolRelease": (b"v^{__CVOpenGLBufferPool=}",), - "CVPixelBufferLockBaseAddress": (b"i^{__CVBuffer=}Q",), - "CVMetalTextureCacheCreateFromImage": ( - b"i@@@@QQQ^@", - "", - {"arguments": {7: {"already_cfretained": True, "type_modifier": "o"}}}, - ), - "CVOpenGLTextureCacheGetTypeID": (b"Q",), - "CVMetalTextureCacheCreateTextureFromImage": ( - b"i^{__CFAllocator=}^{__CVMetalTextureCache=}^{__CVBuffer=}^{__CFDictionary=}QQQQ^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {8: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVOpenGLTextureIsFlipped": (b"Z^{__CVBuffer=}",), - "CVMetalTextureCacheFlush": (b"v^{__CVMetalTextureCache=}Q",), - "CVPixelBufferPoolCreatePixelBuffer": ( - b"i^{__CFAllocator=}^{__CVPixelBufferPool=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {2: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVPixelBufferGetTypeID": (b"Q",), - "CVDisplayLinkGetActualOutputVideoRefreshPeriod": (b"d^{__CVDisplayLink=}",), - "CVPixelBufferGetWidth": (b"Q^{__CVBuffer=}",), - "CVMetalTextureCacheGetTypeID": (b"Q",), - "CVDisplayLinkCreateWithCGDisplay": ( - b"iI^^{__CVDisplayLink=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVBufferRelease": (b"v^{__CVBuffer=}",), - "CVBufferCopyAttachments": ( - b"^{__CFDictionary=}^{__CVBuffer=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CVDisplayLinkGetCurrentTime": ( - b"i^{__CVDisplayLink=}^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "", - {"arguments": {1: {"type_modifier": "o"}}}, - ), - "CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes": ( - b"^{__CFArray=}^{__CFAllocator=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CVPixelBufferPoolGetAttributes": (b"^{__CFDictionary=}^{__CVPixelBufferPool=}",), - "CVBufferGetAttachments": (b"^{__CFDictionary=}^{__CVBuffer=}I",), - "CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType": ( - b"v^{__CFDictionary=}I", - ), - "CVOpenGLBufferPoolCreate": ( - b"i^{__CFAllocator=}^{__CFDictionary=}^{__CFDictionary=}^^{__CVOpenGLBufferPool=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVDisplayLinkRetain": (b"^{__CVDisplayLink=}^{__CVDisplayLink=}",), - "CVPixelBufferCreateWithIOSurface": ( - b"i^{__CFAllocator=}^{__IOSurface=}^{__CFDictionary=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVDisplayLinkCreateWithOpenGLDisplayMask": ( - b"iI^^{__CVDisplayLink=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {1: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVDisplayLinkSetOutputHandler": ( - b"i^{__CVDisplayLink=}@?", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"i"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "^{__CVDisplayLink=}"}, - 2: { - "type": "^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": "n", - }, - 3: { - "type": "^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": "n", - }, - 4: {"type": "Q"}, - 5: {"type": "o^Q"}, - }, - } - } - } - }, - ), - "CVYCbCrMatrixGetStringForIntegerCodePoint": (b"^{__CFString=}i",), - "CVOpenGLBufferCreate": ( - b"i^{__CFAllocator=}QQ^{__CFDictionary=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {4: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVPixelBufferPoolCreatePixelBufferWithAuxAttributes": ( - b"i^{__CFAllocator=}^{__CVPixelBufferPool=}^{__CFDictionary=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {3: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVOpenGLTextureCacheFlush": (b"v^{__CVOpenGLTextureCache=}Q",), - "CVDisplayLinkCreateWithActiveCGDisplays": ( - b"i^^{__CVDisplayLink=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {0: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVDisplayLinkGetNominalOutputVideoRefreshPeriod": ( - b"{CVTime=qii}^{__CVDisplayLink=}", - ), - "CVPixelBufferCreateResolvedAttributesDictionary": ( - b"i^{__CFAllocator=}^{__CFArray=}^^{__CFDictionary=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {2: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVDisplayLinkSetOutputCallback": ( - b"i^{__CVDisplayLink=}^?^v", - "", - { - "arguments": { - 1: { - "callable": { - "retval": {"type": b"i"}, - "arguments": { - 0: {"type": b"^{__CVDisplayLink=}"}, - 1: { - "type": b"^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": "n", - }, - 2: { - "type": b"^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": "N", - }, - 3: {"type": b"Q"}, - 4: {"type": b"^Q", "type_modifier": "o"}, - 5: {"type": b"^v"}, - }, - } - } - } - }, - ), - "CVOpenGLTextureGetName": (b"I^{__CVBuffer=}",), - "CVOpenGLBufferRelease": (b"v^{__CVBuffer=}",), - "CVOpenGLTextureRetain": (b"^{__CVBuffer=}^{__CVBuffer=}",), - "CVOpenGLBufferPoolGetAttributes": (b"^{__CFDictionary=}^{__CVOpenGLBufferPool=}",), - "CVPixelBufferGetWidthOfPlane": (b"Q^{__CVBuffer=}Q",), - "CVBufferPropagateAttachments": (b"v^{__CVBuffer=}^{__CVBuffer=}",), - "CVPixelBufferPoolRetain": (b"^{__CVPixelBufferPool=}^{__CVPixelBufferPool=}",), - "CVPixelBufferGetHeight": (b"Q^{__CVBuffer=}",), - "CVColorPrimariesGetIntegerCodePointForString": (b"i^{__CFString=}",), - "CVOpenGLBufferGetTypeID": (b"Q",), - "CVDisplayLinkRelease": (b"v^{__CVDisplayLink=}",), - "CVBufferGetAttachment": ( - b"@^{__CVBuffer=}^{__CFString=}^I", - "", - {"arguments": {2: {"type_modifier": "o"}}}, - ), - "CVDisplayLinkStop": (b"i^{__CVDisplayLink=}",), - "CVPixelFormatDescriptionCreateWithPixelFormatType": ( - b"^{__CFDictionary=}^{__CFAllocator=}I", - "", - {"retval": {"already_cfretained": True}}, - ), - "CVMetalTextureGetCleanTexCoords": ( - b"v^{__CVBuffer=}^f^f^f^f", - "", - { - "arguments": { - 1: {"c_array_of_fixed_length": 2, "type_modifier": "o"}, - 2: {"c_array_of_fixed_length": 2, "type_modifier": "o"}, - 3: {"c_array_of_fixed_length": 2, "type_modifier": "o"}, - 4: {"c_array_of_fixed_length": 2, "type_modifier": "o"}, - } - }, - ), - "CVPixelBufferGetIOSurface": (b"^{__IOSurface=}^{__CVBuffer=}",), - "CVOpenGLTextureCacheCreateTextureFromImage": ( - b"i^{__CFAllocator=}^{__CVOpenGLTextureCache=}^{__CVBuffer=}^{__CFDictionary=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {4: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVDisplayLinkCreateWithCGDisplays": ( - b"i^Iq^^{__CVDisplayLink=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 0: {"c_array_length_in_arg": 1, "type_modifier": "n"}, - 2: {"already_cfretained": True, "type_modifier": "o"}, - }, - }, - ), - "CVPixelBufferPoolGetPixelBufferAttributes": ( - b"^{__CFDictionary=}^{__CVPixelBufferPool=}", - ), - "CVOpenGLTextureGetTypeID": (b"Q",), - "CVIsCompressedPixelFormatAvailable": (b"ZI",), - "CVImageBufferIsFlipped": (b"Z^{__CVBuffer=}",), - "CVBufferCopyAttachment": ( - b"@^{__CVBuffer=}^{__CFString=}^I", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {2: {"type_modifier": "o"}}, - }, - ), - "CVMetalTextureGetTexture": (b"@^{__CVBuffer=}",), - "CVPixelBufferIsPlanar": (b"Z^{__CVBuffer=}",), - "CVBufferRemoveAllAttachments": (b"v^{__CVBuffer=}",), - "CVTransferFunctionGetIntegerCodePointForString": (b"i^{__CFString=}",), - "CVPixelBufferCreateWithBytes": ( - b"i^{__CFAllocator=}QQI^vQ^?^v^{__CFDictionary=}^^{__CVBuffer=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 6: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"^v"}}, - } - } - }, - }, - ), - "CVMetalTextureGetTypeID": (b"Q",), - "CVOpenGLBufferPoolRetain": (b"^{__CVOpenGLBufferPool=}^{__CVOpenGLBufferPool=}",), - "CVPixelBufferUnlockBaseAddress": (b"i^{__CVBuffer=}Q",), - "CVImageBufferGetCleanRect": (b"{CGRect={CGPoint=dd}{CGSize=dd}}^{__CVBuffer=}",), - "CVImageBufferCreateColorSpaceFromAttachments": ( - b"^{CGColorSpace=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CVPixelBufferGetBytesPerRowOfPlane": (b"Q^{__CVBuffer=}Q",), - "CVColorPrimariesGetStringForIntegerCodePoint": (b"^{__CFString=}i",), - "CVDisplayLinkStart": (b"i^{__CVDisplayLink=}",), - "CVDisplayLinkGetTypeID": (b"Q",), - "CVImageBufferGetDisplaySize": (b"{CGSize=dd}^{__CVBuffer=}",), - "CVPixelBufferGetDataSize": (b"Q^{__CVBuffer=}",), - "CVOpenGLBufferPoolGetOpenGLBufferAttributes": ( - b"^{__CFDictionary=}^{__CVOpenGLBufferPool=}", - ), - "CVOpenGLBufferAttach": (b"i^{__CVBuffer=}^{_CGLContextObject=}Iii",), - "CVPixelBufferGetBaseAddressOfPlane": ( - b"^v^{__CVBuffer=}Q", - "", - {"retval": {"c_array_of_variable_length": True}}, - ), - "CVDisplayLinkIsRunning": (b"Z^{__CVDisplayLink=}",), - "CVPixelBufferGetPixelFormatType": (b"I^{__CVBuffer=}",), - "CVBufferRemoveAttachment": (b"v^{__CVBuffer=}^{__CFString=}",), - "CVPixelBufferCopyCreationAttributes": ( - b"^{__CFDictionary=}^{__CVBuffer=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CVOpenGLBufferGetAttributes": (b"^{__CFDictionary=}^{__CVBuffer=}",), - "CVDisplayLinkGetOutputVideoLatency": (b"{CVTime=qii}^{__CVDisplayLink=}",), - "CVPixelBufferGetBytesPerRow": (b"Q^{__CVBuffer=}",), - "CVMetalTextureCacheCreate": ( - b"i^{__CFAllocator=}^{__CFDictionary=}@^{__CFDictionary=}^^{__CVMetalTextureCache=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {4: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVPixelBufferGetExtendedPixels": ( - b"v^{__CVBuffer=}^Q^Q^Q^Q", - "", - { - "arguments": { - 1: {"type_modifier": "o"}, - 2: {"type_modifier": "o"}, - 3: {"type_modifier": "o"}, - 4: {"type_modifier": "o"}, - } - }, - ), - "CVTransferFunctionGetStringForIntegerCodePoint": (b"^{__CFString=}i",), - "CVImageBufferGetColorSpace": (b"^{CGColorSpace=}^{__CVBuffer=}",), - "CVDisplayLinkGetCurrentCGDisplay": (b"I^{__CVDisplayLink=}",), - "CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext": ( - b"i^{__CVDisplayLink=}^{_CGLContextObject=}^{_CGLPixelFormatObject=}", - ), - "CVPixelBufferRelease": (b"v^{__CVBuffer=}",), - "CVBufferSetAttachments": (b"v^{__CVBuffer=}^{__CFDictionary=}I",), - "CVOpenGLTextureGetTarget": (b"I^{__CVBuffer=}",), - "CVGetHostClockFrequency": (b"d", "", {"variadic": False}), - "CVGetHostClockMinimumTimeDelta": (b"I", "", {"variadic": False}), - "CVOpenGLBufferRetain": (b"^{__CVBuffer=}^{__CVBuffer=}",), - "CVMetalTextureIsFlipped": (b"Z^{__CVBuffer=}",), - "CVOpenGLTextureCacheCreate": ( - b"i^{__CFAllocator=}^{__CFDictionary=}^{_CGLContextObject=}^{_CGLPixelFormatObject=}^{__CFDictionary=}^^{__CVOpenGLTextureCache=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": {5: {"already_cfretained": True, "type_modifier": "o"}}, - }, - ), - "CVPixelBufferPoolFlush": (b"v^{__CVPixelBufferPool=}Q",), - "CVOpenGLTextureGetCleanTexCoords": ( - b"v^{__CVBuffer=}^f^f^f^f", - "", - { - "arguments": { - 1: {"c_array_of_fixed_length": 2, "type_modifier": "n"}, - 2: {"c_array_of_fixed_length": 2, "type_modifier": "n"}, - 3: {"c_array_of_fixed_length": 2, "type_modifier": "n"}, - 4: {"c_array_of_fixed_length": 2, "type_modifier": "n"}, - } - }, - ), -} -aliases = { - "CVDIRECT3DSURFACE": "LPDIRECT3DSURFACE9", - "COREVIDEO_SUPPORTS_OPENGLES": "COREVIDEO_FALSE", - "CV_NONNULL": "__nonnull", - "COREVIDEO_SUPPORTS_PERMANENT_ALLOCATOR": "COREVIDEO_FALSE", - "CVImageBufferRef": "CVBufferRef", - "COREVIDEO_SUPPORTS_PREFETCH": "COREVIDEO_TRUE", - "COREVIDEO_SUPPORTS_OPENGL": "COREVIDEO_TRUE", - "COREVIDEO_SUPPORTS_IOSURFACE": "COREVIDEO_TRUE", - "COREVIDEO_USE_DERIVED_ENUMS_FOR_CONSTANTS": "COREVIDEO_TRUE", - "CV_INLINE": "CF_INLINE", - "kCVReturnError": "kCVReturnFirst", - "COREVIDEO_SUPPORTS_DIRECT3D": "COREVIDEO_FALSE", - "CVDIRECT3DTEXTURE": "LPDIRECT3DTEXTURE9", - "COREVIDEO_DECLARE_NULLABILITY": "COREVIDEO_TRUE", - "CV_RELEASES_ARGUMENT": "CF_RELEASES_ARGUMENT", - "COREVIDEO_SUPPORTS_DISPLAYLINK": "COREVIDEO_TRUE", - "CV_RETURNS_RETAINED": "CF_RETURNS_RETAINED", - "CV_NULLABLE": "__nullable", - "COREVIDEO_USE_IOSURFACEREF": "COREVIDEO_FALSE", - "CVDIRECT3DDEVICE": "LPDIRECT3DDEVICE9", - "COREVIDEO_SUPPORTS_METAL": "COREVIDEO_TRUE", - "COREVIDEO_SUPPORTS_GLES_TEX_IMAGE_IOSURFACE": "COREVIDEO_SUPPORTS_IOSURFACE", - "CVDIRECT3D": "LPDIRECT3D9", - "COREVIDEO_SUPPORTS_COLORSPACE": "COREVIDEO_TRUE", - "CV_RETURNS_RETAINED_PARAMETER": "CF_RETURNS_RETAINED", -} -cftypes = [ - ("CVBufferRef", b"^{__CVBuffer=}", "CVBufferGetTypeID", None), - ("CVDisplayLinkRef", b"^{__CVDisplayLink=}", "CVDisplayLinkGetTypeID", None), - ("CVMetalTextureCacheRef", b"^{__CVMetalTextureCache=}", None, None), - ( - "CVOpenGLBufferPoolRef", - b"^{__CVOpenGLBufferPool=}", - "CVOpenGLBufferPoolGetTypeID", - None, - ), - ( - "CVOpenGLTextureCacheRef", - b"^{__CVOpenGLTextureCache=}", - "CVOpenGLTextureCacheGetTypeID", - None, - ), - ( - "CVPixelBufferPoolRef", - b"^{__CVPixelBufferPool=}", - "CVPixelBufferPoolGetTypeID", - None, - ), - ("CVOpenGLBufferRef", b"^{__CVOpenGLBuffer=}", "CVOpenGLBufferGetTypeID", None), - ("CVPixelBufferRef", b"^{__CVPixelBuffer=}", "CVPixelBufferGetTypeID", None), - ("CVOpenGLTextureRef", b"^{__CVOpenGLTexture=}", "CVOpenGLTextureGetTypeID", None), -] -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/PyObjCOverrides.bridgesupport b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/PyObjCOverrides.bridgesupport deleted file mode 100644 index 44e6ec9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/PyObjCOverrides.bridgesupport +++ /dev/null @@ -1,393 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__init__.py deleted file mode 100644 index d1783ed..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Python mapping for the ImageIO framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - from Quartz import CoreGraphics - import objc - from . import _metadata - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.ImageIO", - frameworkIdentifier="com.apple.ApplicationServices", - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/ApplicationServices.framework" - ), - globals_dict=globals(), - inline_list=None, - parents=(CoreGraphics,), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.ImageIO._metadata"] - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index ceb3c3b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index b75da75..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/_metadata.py deleted file mode 100644 index ed098de..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageIO/_metadata.py +++ /dev/null @@ -1,340 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 1 14:05:31 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -constants = """$kCFErrorDomainCGImageMetadata$kCGImageAnimationDelayTime$kCGImageAnimationLoopCount$kCGImageAnimationStartIndex$kCGImageAuxiliaryDataInfoData$kCGImageAuxiliaryDataInfoDataDescription$kCGImageAuxiliaryDataInfoMetadata$kCGImageAuxiliaryDataTypeDepth$kCGImageAuxiliaryDataTypeDisparity$kCGImageAuxiliaryDataTypeHDRGainMap$kCGImageAuxiliaryDataTypePortraitEffectsMatte$kCGImageAuxiliaryDataTypeSemanticSegmentationGlassesMatte$kCGImageAuxiliaryDataTypeSemanticSegmentationHairMatte$kCGImageAuxiliaryDataTypeSemanticSegmentationSkinMatte$kCGImageAuxiliaryDataTypeSemanticSegmentationSkyMatte$kCGImageAuxiliaryDataTypeSemanticSegmentationTeethMatte$kCGImageDestinationBackgroundColor$kCGImageDestinationDateTime$kCGImageDestinationEmbedThumbnail$kCGImageDestinationImageMaxPixelSize$kCGImageDestinationLossyCompressionQuality$kCGImageDestinationMergeMetadata$kCGImageDestinationMetadata$kCGImageDestinationOptimizeColorForSharing$kCGImageDestinationOrientation$kCGImageDestinationPreserveGainMap$kCGImageMetadataEnumerateRecursively$kCGImageMetadataNamespaceDublinCore$kCGImageMetadataNamespaceExif$kCGImageMetadataNamespaceExifAux$kCGImageMetadataNamespaceExifEX$kCGImageMetadataNamespaceIPTCCore$kCGImageMetadataNamespaceIPTCExtension$kCGImageMetadataNamespacePhotoshop$kCGImageMetadataNamespaceTIFF$kCGImageMetadataNamespaceXMPBasic$kCGImageMetadataNamespaceXMPRights$kCGImageMetadataPrefixDublinCore$kCGImageMetadataPrefixExif$kCGImageMetadataPrefixExifAux$kCGImageMetadataPrefixExifEX$kCGImageMetadataPrefixIPTCCore$kCGImageMetadataPrefixIPTCExtension$kCGImageMetadataPrefixPhotoshop$kCGImageMetadataPrefixTIFF$kCGImageMetadataPrefixXMPBasic$kCGImageMetadataPrefixXMPRights$kCGImageMetadataShouldExcludeGPS$kCGImageMetadataShouldExcludeXMP$kCGImageProperty8BIMDictionary$kCGImageProperty8BIMLayerNames$kCGImageProperty8BIMVersion$kCGImagePropertyAPNGCanvasPixelHeight$kCGImagePropertyAPNGCanvasPixelWidth$kCGImagePropertyAPNGDelayTime$kCGImagePropertyAPNGFrameInfoArray$kCGImagePropertyAPNGLoopCount$kCGImagePropertyAPNGUnclampedDelayTime$kCGImagePropertyAVISDictionary$kCGImagePropertyAuxiliaryData$kCGImagePropertyAuxiliaryDataType$kCGImagePropertyBytesPerRow$kCGImagePropertyCIFFCameraSerialNumber$kCGImagePropertyCIFFContinuousDrive$kCGImagePropertyCIFFDescription$kCGImagePropertyCIFFDictionary$kCGImagePropertyCIFFFirmware$kCGImagePropertyCIFFFlashExposureComp$kCGImagePropertyCIFFFocusMode$kCGImagePropertyCIFFImageFileName$kCGImagePropertyCIFFImageName$kCGImagePropertyCIFFImageSerialNumber$kCGImagePropertyCIFFLensMaxMM$kCGImagePropertyCIFFLensMinMM$kCGImagePropertyCIFFLensModel$kCGImagePropertyCIFFMeasuredEV$kCGImagePropertyCIFFMeteringMode$kCGImagePropertyCIFFOwnerName$kCGImagePropertyCIFFRecordID$kCGImagePropertyCIFFReleaseMethod$kCGImagePropertyCIFFReleaseTiming$kCGImagePropertyCIFFSelfTimingTime$kCGImagePropertyCIFFShootingMode$kCGImagePropertyCIFFWhiteBalanceIndex$kCGImagePropertyColorModel$kCGImagePropertyColorModelCMYK$kCGImagePropertyColorModelGray$kCGImagePropertyColorModelLab$kCGImagePropertyColorModelRGB$kCGImagePropertyDNGActiveArea$kCGImagePropertyDNGAnalogBalance$kCGImagePropertyDNGAntiAliasStrength$kCGImagePropertyDNGAsShotICCProfile$kCGImagePropertyDNGAsShotNeutral$kCGImagePropertyDNGAsShotPreProfileMatrix$kCGImagePropertyDNGAsShotProfileName$kCGImagePropertyDNGAsShotWhiteXY$kCGImagePropertyDNGBackwardVersion$kCGImagePropertyDNGBaselineExposure$kCGImagePropertyDNGBaselineExposureOffset$kCGImagePropertyDNGBaselineNoise$kCGImagePropertyDNGBaselineSharpness$kCGImagePropertyDNGBayerGreenSplit$kCGImagePropertyDNGBestQualityScale$kCGImagePropertyDNGBlackLevel$kCGImagePropertyDNGBlackLevelDeltaH$kCGImagePropertyDNGBlackLevelDeltaV$kCGImagePropertyDNGBlackLevelRepeatDim$kCGImagePropertyDNGCFALayout$kCGImagePropertyDNGCFAPlaneColor$kCGImagePropertyDNGCalibrationIlluminant1$kCGImagePropertyDNGCalibrationIlluminant2$kCGImagePropertyDNGCameraCalibration1$kCGImagePropertyDNGCameraCalibration2$kCGImagePropertyDNGCameraCalibrationSignature$kCGImagePropertyDNGCameraSerialNumber$kCGImagePropertyDNGChromaBlurRadius$kCGImagePropertyDNGColorMatrix1$kCGImagePropertyDNGColorMatrix2$kCGImagePropertyDNGColorimetricReference$kCGImagePropertyDNGCurrentICCProfile$kCGImagePropertyDNGCurrentPreProfileMatrix$kCGImagePropertyDNGDefaultBlackRender$kCGImagePropertyDNGDefaultCropOrigin$kCGImagePropertyDNGDefaultCropSize$kCGImagePropertyDNGDefaultScale$kCGImagePropertyDNGDefaultUserCrop$kCGImagePropertyDNGDictionary$kCGImagePropertyDNGExtraCameraProfiles$kCGImagePropertyDNGFixVignetteRadial$kCGImagePropertyDNGForwardMatrix1$kCGImagePropertyDNGForwardMatrix2$kCGImagePropertyDNGLensInfo$kCGImagePropertyDNGLinearResponseLimit$kCGImagePropertyDNGLinearizationTable$kCGImagePropertyDNGLocalizedCameraModel$kCGImagePropertyDNGMakerNoteSafety$kCGImagePropertyDNGMaskedAreas$kCGImagePropertyDNGNewRawImageDigest$kCGImagePropertyDNGNoiseProfile$kCGImagePropertyDNGNoiseReductionApplied$kCGImagePropertyDNGOpcodeList1$kCGImagePropertyDNGOpcodeList2$kCGImagePropertyDNGOpcodeList3$kCGImagePropertyDNGOriginalBestQualityFinalSize$kCGImagePropertyDNGOriginalDefaultCropSize$kCGImagePropertyDNGOriginalDefaultFinalSize$kCGImagePropertyDNGOriginalRawFileData$kCGImagePropertyDNGOriginalRawFileDigest$kCGImagePropertyDNGOriginalRawFileName$kCGImagePropertyDNGPreviewApplicationName$kCGImagePropertyDNGPreviewApplicationVersion$kCGImagePropertyDNGPreviewColorSpace$kCGImagePropertyDNGPreviewDateTime$kCGImagePropertyDNGPreviewSettingsDigest$kCGImagePropertyDNGPreviewSettingsName$kCGImagePropertyDNGPrivateData$kCGImagePropertyDNGProfileCalibrationSignature$kCGImagePropertyDNGProfileCopyright$kCGImagePropertyDNGProfileEmbedPolicy$kCGImagePropertyDNGProfileHueSatMapData1$kCGImagePropertyDNGProfileHueSatMapData2$kCGImagePropertyDNGProfileHueSatMapDims$kCGImagePropertyDNGProfileHueSatMapEncoding$kCGImagePropertyDNGProfileLookTableData$kCGImagePropertyDNGProfileLookTableDims$kCGImagePropertyDNGProfileLookTableEncoding$kCGImagePropertyDNGProfileName$kCGImagePropertyDNGProfileToneCurve$kCGImagePropertyDNGRawDataUniqueID$kCGImagePropertyDNGRawImageDigest$kCGImagePropertyDNGRawToPreviewGain$kCGImagePropertyDNGReductionMatrix1$kCGImagePropertyDNGReductionMatrix2$kCGImagePropertyDNGRowInterleaveFactor$kCGImagePropertyDNGShadowScale$kCGImagePropertyDNGSubTileBlockSize$kCGImagePropertyDNGUniqueCameraModel$kCGImagePropertyDNGVersion$kCGImagePropertyDNGWarpFisheye$kCGImagePropertyDNGWarpRectilinear$kCGImagePropertyDNGWhiteLevel$kCGImagePropertyDPIHeight$kCGImagePropertyDPIWidth$kCGImagePropertyDepth$kCGImagePropertyExifApertureValue$kCGImagePropertyExifAuxDictionary$kCGImagePropertyExifAuxFirmware$kCGImagePropertyExifAuxFlashCompensation$kCGImagePropertyExifAuxImageNumber$kCGImagePropertyExifAuxLensID$kCGImagePropertyExifAuxLensInfo$kCGImagePropertyExifAuxLensModel$kCGImagePropertyExifAuxLensSerialNumber$kCGImagePropertyExifAuxOwnerName$kCGImagePropertyExifAuxSerialNumber$kCGImagePropertyExifBodySerialNumber$kCGImagePropertyExifBrightnessValue$kCGImagePropertyExifCFAPattern$kCGImagePropertyExifCameraOwnerName$kCGImagePropertyExifColorSpace$kCGImagePropertyExifComponentsConfiguration$kCGImagePropertyExifCompositeImage$kCGImagePropertyExifCompressedBitsPerPixel$kCGImagePropertyExifContrast$kCGImagePropertyExifCustomRendered$kCGImagePropertyExifDateTimeDigitized$kCGImagePropertyExifDateTimeOriginal$kCGImagePropertyExifDeviceSettingDescription$kCGImagePropertyExifDictionary$kCGImagePropertyExifDigitalZoomRatio$kCGImagePropertyExifExposureBiasValue$kCGImagePropertyExifExposureIndex$kCGImagePropertyExifExposureMode$kCGImagePropertyExifExposureProgram$kCGImagePropertyExifExposureTime$kCGImagePropertyExifFNumber$kCGImagePropertyExifFileSource$kCGImagePropertyExifFlash$kCGImagePropertyExifFlashEnergy$kCGImagePropertyExifFlashPixVersion$kCGImagePropertyExifFocalLenIn35mmFilm$kCGImagePropertyExifFocalLength$kCGImagePropertyExifFocalPlaneResolutionUnit$kCGImagePropertyExifFocalPlaneXResolution$kCGImagePropertyExifFocalPlaneYResolution$kCGImagePropertyExifGainControl$kCGImagePropertyExifGamma$kCGImagePropertyExifISOSpeed$kCGImagePropertyExifISOSpeedLatitudeyyy$kCGImagePropertyExifISOSpeedLatitudezzz$kCGImagePropertyExifISOSpeedRatings$kCGImagePropertyExifImageUniqueID$kCGImagePropertyExifLensMake$kCGImagePropertyExifLensModel$kCGImagePropertyExifLensSerialNumber$kCGImagePropertyExifLensSpecification$kCGImagePropertyExifLightSource$kCGImagePropertyExifMakerNote$kCGImagePropertyExifMaxApertureValue$kCGImagePropertyExifMeteringMode$kCGImagePropertyExifOECF$kCGImagePropertyExifOffsetTime$kCGImagePropertyExifOffsetTimeDigitized$kCGImagePropertyExifOffsetTimeOriginal$kCGImagePropertyExifPixelXDimension$kCGImagePropertyExifPixelYDimension$kCGImagePropertyExifRecommendedExposureIndex$kCGImagePropertyExifRelatedSoundFile$kCGImagePropertyExifSaturation$kCGImagePropertyExifSceneCaptureType$kCGImagePropertyExifSceneType$kCGImagePropertyExifSensingMethod$kCGImagePropertyExifSensitivityType$kCGImagePropertyExifSharpness$kCGImagePropertyExifShutterSpeedValue$kCGImagePropertyExifSourceExposureTimesOfCompositeImage$kCGImagePropertyExifSourceImageNumberOfCompositeImage$kCGImagePropertyExifSpatialFrequencyResponse$kCGImagePropertyExifSpectralSensitivity$kCGImagePropertyExifStandardOutputSensitivity$kCGImagePropertyExifSubjectArea$kCGImagePropertyExifSubjectDistRange$kCGImagePropertyExifSubjectDistance$kCGImagePropertyExifSubjectLocation$kCGImagePropertyExifSubsecTime$kCGImagePropertyExifSubsecTimeDigitized$kCGImagePropertyExifSubsecTimeOrginal$kCGImagePropertyExifSubsecTimeOriginal$kCGImagePropertyExifUserComment$kCGImagePropertyExifVersion$kCGImagePropertyExifWhiteBalance$kCGImagePropertyFileContentsDictionary$kCGImagePropertyFileSize$kCGImagePropertyGIFCanvasPixelHeight$kCGImagePropertyGIFCanvasPixelWidth$kCGImagePropertyGIFDelayTime$kCGImagePropertyGIFDictionary$kCGImagePropertyGIFFrameInfoArray$kCGImagePropertyGIFHasGlobalColorMap$kCGImagePropertyGIFImageColorMap$kCGImagePropertyGIFLoopCount$kCGImagePropertyGIFUnclampedDelayTime$kCGImagePropertyGPSAltitude$kCGImagePropertyGPSAltitudeRef$kCGImagePropertyGPSAreaInformation$kCGImagePropertyGPSDOP$kCGImagePropertyGPSDateStamp$kCGImagePropertyGPSDestBearing$kCGImagePropertyGPSDestBearingRef$kCGImagePropertyGPSDestDistance$kCGImagePropertyGPSDestDistanceRef$kCGImagePropertyGPSDestLatitude$kCGImagePropertyGPSDestLatitudeRef$kCGImagePropertyGPSDestLongitude$kCGImagePropertyGPSDestLongitudeRef$kCGImagePropertyGPSDictionary$kCGImagePropertyGPSDifferental$kCGImagePropertyGPSHPositioningError$kCGImagePropertyGPSImgDirection$kCGImagePropertyGPSImgDirectionRef$kCGImagePropertyGPSLatitude$kCGImagePropertyGPSLatitudeRef$kCGImagePropertyGPSLongitude$kCGImagePropertyGPSLongitudeRef$kCGImagePropertyGPSMapDatum$kCGImagePropertyGPSMeasureMode$kCGImagePropertyGPSProcessingMethod$kCGImagePropertyGPSSatellites$kCGImagePropertyGPSSpeed$kCGImagePropertyGPSSpeedRef$kCGImagePropertyGPSStatus$kCGImagePropertyGPSTimeStamp$kCGImagePropertyGPSTrack$kCGImagePropertyGPSTrackRef$kCGImagePropertyGPSVersion$kCGImagePropertyGroupImageBaseline$kCGImagePropertyGroupImageDisparityAdjustment$kCGImagePropertyGroupImageIndexLeft$kCGImagePropertyGroupImageIndexRight$kCGImagePropertyGroupImageIsAlternateImage$kCGImagePropertyGroupImageIsLeftImage$kCGImagePropertyGroupImageIsRightImage$kCGImagePropertyGroupImagesAlternate$kCGImagePropertyGroupIndex$kCGImagePropertyGroupType$kCGImagePropertyGroupTypeAlternate$kCGImagePropertyGroupTypeStereoPair$kCGImagePropertyGroups$kCGImagePropertyHEICSCanvasPixelHeight$kCGImagePropertyHEICSCanvasPixelWidth$kCGImagePropertyHEICSDelayTime$kCGImagePropertyHEICSDictionary$kCGImagePropertyHEICSFrameInfoArray$kCGImagePropertyHEICSLoopCount$kCGImagePropertyHEICSUnclampedDelayTime$kCGImagePropertyHEIFDictionary$kCGImagePropertyHasAlpha$kCGImagePropertyHeight$kCGImagePropertyIPTCActionAdvised$kCGImagePropertyIPTCByline$kCGImagePropertyIPTCBylineTitle$kCGImagePropertyIPTCCaptionAbstract$kCGImagePropertyIPTCCategory$kCGImagePropertyIPTCCity$kCGImagePropertyIPTCContact$kCGImagePropertyIPTCContactInfoAddress$kCGImagePropertyIPTCContactInfoCity$kCGImagePropertyIPTCContactInfoCountry$kCGImagePropertyIPTCContactInfoEmails$kCGImagePropertyIPTCContactInfoPhones$kCGImagePropertyIPTCContactInfoPostalCode$kCGImagePropertyIPTCContactInfoStateProvince$kCGImagePropertyIPTCContactInfoWebURLs$kCGImagePropertyIPTCContentLocationCode$kCGImagePropertyIPTCContentLocationName$kCGImagePropertyIPTCCopyrightNotice$kCGImagePropertyIPTCCountryPrimaryLocationCode$kCGImagePropertyIPTCCountryPrimaryLocationName$kCGImagePropertyIPTCCreatorContactInfo$kCGImagePropertyIPTCCredit$kCGImagePropertyIPTCDateCreated$kCGImagePropertyIPTCDictionary$kCGImagePropertyIPTCDigitalCreationDate$kCGImagePropertyIPTCDigitalCreationTime$kCGImagePropertyIPTCEditStatus$kCGImagePropertyIPTCEditorialUpdate$kCGImagePropertyIPTCExpirationDate$kCGImagePropertyIPTCExpirationTime$kCGImagePropertyIPTCExtAboutCvTerm$kCGImagePropertyIPTCExtAboutCvTermCvId$kCGImagePropertyIPTCExtAboutCvTermId$kCGImagePropertyIPTCExtAboutCvTermName$kCGImagePropertyIPTCExtAboutCvTermRefinedAbout$kCGImagePropertyIPTCExtAddlModelInfo$kCGImagePropertyIPTCExtArtworkCircaDateCreated$kCGImagePropertyIPTCExtArtworkContentDescription$kCGImagePropertyIPTCExtArtworkContributionDescription$kCGImagePropertyIPTCExtArtworkCopyrightNotice$kCGImagePropertyIPTCExtArtworkCopyrightOwnerID$kCGImagePropertyIPTCExtArtworkCopyrightOwnerName$kCGImagePropertyIPTCExtArtworkCreator$kCGImagePropertyIPTCExtArtworkCreatorID$kCGImagePropertyIPTCExtArtworkDateCreated$kCGImagePropertyIPTCExtArtworkLicensorID$kCGImagePropertyIPTCExtArtworkLicensorName$kCGImagePropertyIPTCExtArtworkOrObject$kCGImagePropertyIPTCExtArtworkPhysicalDescription$kCGImagePropertyIPTCExtArtworkSource$kCGImagePropertyIPTCExtArtworkSourceInvURL$kCGImagePropertyIPTCExtArtworkSourceInventoryNo$kCGImagePropertyIPTCExtArtworkStylePeriod$kCGImagePropertyIPTCExtArtworkTitle$kCGImagePropertyIPTCExtAudioBitrate$kCGImagePropertyIPTCExtAudioBitrateMode$kCGImagePropertyIPTCExtAudioChannelCount$kCGImagePropertyIPTCExtCircaDateCreated$kCGImagePropertyIPTCExtContainerFormat$kCGImagePropertyIPTCExtContainerFormatIdentifier$kCGImagePropertyIPTCExtContainerFormatName$kCGImagePropertyIPTCExtContributor$kCGImagePropertyIPTCExtContributorIdentifier$kCGImagePropertyIPTCExtContributorName$kCGImagePropertyIPTCExtContributorRole$kCGImagePropertyIPTCExtControlledVocabularyTerm$kCGImagePropertyIPTCExtCopyrightYear$kCGImagePropertyIPTCExtCreator$kCGImagePropertyIPTCExtCreatorIdentifier$kCGImagePropertyIPTCExtCreatorName$kCGImagePropertyIPTCExtCreatorRole$kCGImagePropertyIPTCExtDataOnScreen$kCGImagePropertyIPTCExtDataOnScreenRegion$kCGImagePropertyIPTCExtDataOnScreenRegionD$kCGImagePropertyIPTCExtDataOnScreenRegionH$kCGImagePropertyIPTCExtDataOnScreenRegionText$kCGImagePropertyIPTCExtDataOnScreenRegionUnit$kCGImagePropertyIPTCExtDataOnScreenRegionW$kCGImagePropertyIPTCExtDataOnScreenRegionX$kCGImagePropertyIPTCExtDataOnScreenRegionY$kCGImagePropertyIPTCExtDigitalImageGUID$kCGImagePropertyIPTCExtDigitalSourceFileType$kCGImagePropertyIPTCExtDigitalSourceType$kCGImagePropertyIPTCExtDopesheet$kCGImagePropertyIPTCExtDopesheetLink$kCGImagePropertyIPTCExtDopesheetLinkLink$kCGImagePropertyIPTCExtDopesheetLinkLinkQualifier$kCGImagePropertyIPTCExtEmbdEncRightsExpr$kCGImagePropertyIPTCExtEmbeddedEncodedRightsExpr$kCGImagePropertyIPTCExtEmbeddedEncodedRightsExprLangID$kCGImagePropertyIPTCExtEmbeddedEncodedRightsExprType$kCGImagePropertyIPTCExtEpisode$kCGImagePropertyIPTCExtEpisodeIdentifier$kCGImagePropertyIPTCExtEpisodeName$kCGImagePropertyIPTCExtEpisodeNumber$kCGImagePropertyIPTCExtEvent$kCGImagePropertyIPTCExtExternalMetadataLink$kCGImagePropertyIPTCExtFeedIdentifier$kCGImagePropertyIPTCExtGenre$kCGImagePropertyIPTCExtGenreCvId$kCGImagePropertyIPTCExtGenreCvTermId$kCGImagePropertyIPTCExtGenreCvTermName$kCGImagePropertyIPTCExtGenreCvTermRefinedAbout$kCGImagePropertyIPTCExtHeadline$kCGImagePropertyIPTCExtIPTCLastEdited$kCGImagePropertyIPTCExtLinkedEncRightsExpr$kCGImagePropertyIPTCExtLinkedEncodedRightsExpr$kCGImagePropertyIPTCExtLinkedEncodedRightsExprLangID$kCGImagePropertyIPTCExtLinkedEncodedRightsExprType$kCGImagePropertyIPTCExtLocationCity$kCGImagePropertyIPTCExtLocationCountryCode$kCGImagePropertyIPTCExtLocationCountryName$kCGImagePropertyIPTCExtLocationCreated$kCGImagePropertyIPTCExtLocationGPSAltitude$kCGImagePropertyIPTCExtLocationGPSLatitude$kCGImagePropertyIPTCExtLocationGPSLongitude$kCGImagePropertyIPTCExtLocationIdentifier$kCGImagePropertyIPTCExtLocationLocationId$kCGImagePropertyIPTCExtLocationLocationName$kCGImagePropertyIPTCExtLocationProvinceState$kCGImagePropertyIPTCExtLocationShown$kCGImagePropertyIPTCExtLocationSublocation$kCGImagePropertyIPTCExtLocationWorldRegion$kCGImagePropertyIPTCExtMaxAvailHeight$kCGImagePropertyIPTCExtMaxAvailWidth$kCGImagePropertyIPTCExtModelAge$kCGImagePropertyIPTCExtOrganisationInImageCode$kCGImagePropertyIPTCExtOrganisationInImageName$kCGImagePropertyIPTCExtPersonHeard$kCGImagePropertyIPTCExtPersonHeardIdentifier$kCGImagePropertyIPTCExtPersonHeardName$kCGImagePropertyIPTCExtPersonInImage$kCGImagePropertyIPTCExtPersonInImageCharacteristic$kCGImagePropertyIPTCExtPersonInImageCvTermCvId$kCGImagePropertyIPTCExtPersonInImageCvTermId$kCGImagePropertyIPTCExtPersonInImageCvTermName$kCGImagePropertyIPTCExtPersonInImageCvTermRefinedAbout$kCGImagePropertyIPTCExtPersonInImageDescription$kCGImagePropertyIPTCExtPersonInImageId$kCGImagePropertyIPTCExtPersonInImageName$kCGImagePropertyIPTCExtPersonInImageWDetails$kCGImagePropertyIPTCExtProductInImage$kCGImagePropertyIPTCExtProductInImageDescription$kCGImagePropertyIPTCExtProductInImageGTIN$kCGImagePropertyIPTCExtProductInImageName$kCGImagePropertyIPTCExtPublicationEvent$kCGImagePropertyIPTCExtPublicationEventDate$kCGImagePropertyIPTCExtPublicationEventIdentifier$kCGImagePropertyIPTCExtPublicationEventName$kCGImagePropertyIPTCExtRating$kCGImagePropertyIPTCExtRatingRatingRegion$kCGImagePropertyIPTCExtRatingRegionCity$kCGImagePropertyIPTCExtRatingRegionCountryCode$kCGImagePropertyIPTCExtRatingRegionCountryName$kCGImagePropertyIPTCExtRatingRegionGPSAltitude$kCGImagePropertyIPTCExtRatingRegionGPSLatitude$kCGImagePropertyIPTCExtRatingRegionGPSLongitude$kCGImagePropertyIPTCExtRatingRegionIdentifier$kCGImagePropertyIPTCExtRatingRegionLocationId$kCGImagePropertyIPTCExtRatingRegionLocationName$kCGImagePropertyIPTCExtRatingRegionProvinceState$kCGImagePropertyIPTCExtRatingRegionSublocation$kCGImagePropertyIPTCExtRatingRegionWorldRegion$kCGImagePropertyIPTCExtRatingScaleMaxValue$kCGImagePropertyIPTCExtRatingScaleMinValue$kCGImagePropertyIPTCExtRatingSourceLink$kCGImagePropertyIPTCExtRatingValue$kCGImagePropertyIPTCExtRatingValueLogoLink$kCGImagePropertyIPTCExtRegistryEntryRole$kCGImagePropertyIPTCExtRegistryID$kCGImagePropertyIPTCExtRegistryItemID$kCGImagePropertyIPTCExtRegistryOrganisationID$kCGImagePropertyIPTCExtReleaseReady$kCGImagePropertyIPTCExtSeason$kCGImagePropertyIPTCExtSeasonIdentifier$kCGImagePropertyIPTCExtSeasonName$kCGImagePropertyIPTCExtSeasonNumber$kCGImagePropertyIPTCExtSeries$kCGImagePropertyIPTCExtSeriesIdentifier$kCGImagePropertyIPTCExtSeriesName$kCGImagePropertyIPTCExtShownEvent$kCGImagePropertyIPTCExtShownEventIdentifier$kCGImagePropertyIPTCExtShownEventName$kCGImagePropertyIPTCExtStorylineIdentifier$kCGImagePropertyIPTCExtStreamReady$kCGImagePropertyIPTCExtStylePeriod$kCGImagePropertyIPTCExtSupplyChainSource$kCGImagePropertyIPTCExtSupplyChainSourceIdentifier$kCGImagePropertyIPTCExtSupplyChainSourceName$kCGImagePropertyIPTCExtTemporalCoverage$kCGImagePropertyIPTCExtTemporalCoverageFrom$kCGImagePropertyIPTCExtTemporalCoverageTo$kCGImagePropertyIPTCExtTranscript$kCGImagePropertyIPTCExtTranscriptLink$kCGImagePropertyIPTCExtTranscriptLinkLink$kCGImagePropertyIPTCExtTranscriptLinkLinkQualifier$kCGImagePropertyIPTCExtVideoBitrate$kCGImagePropertyIPTCExtVideoBitrateMode$kCGImagePropertyIPTCExtVideoDisplayAspectRatio$kCGImagePropertyIPTCExtVideoEncodingProfile$kCGImagePropertyIPTCExtVideoShotType$kCGImagePropertyIPTCExtVideoShotTypeIdentifier$kCGImagePropertyIPTCExtVideoShotTypeName$kCGImagePropertyIPTCExtVideoStreamsCount$kCGImagePropertyIPTCExtVisualColor$kCGImagePropertyIPTCExtWorkflowTag$kCGImagePropertyIPTCExtWorkflowTagCvId$kCGImagePropertyIPTCExtWorkflowTagCvTermId$kCGImagePropertyIPTCExtWorkflowTagCvTermName$kCGImagePropertyIPTCExtWorkflowTagCvTermRefinedAbout$kCGImagePropertyIPTCFixtureIdentifier$kCGImagePropertyIPTCHeadline$kCGImagePropertyIPTCImageOrientation$kCGImagePropertyIPTCImageType$kCGImagePropertyIPTCKeywords$kCGImagePropertyIPTCLanguageIdentifier$kCGImagePropertyIPTCObjectAttributeReference$kCGImagePropertyIPTCObjectCycle$kCGImagePropertyIPTCObjectName$kCGImagePropertyIPTCObjectTypeReference$kCGImagePropertyIPTCOriginalTransmissionReference$kCGImagePropertyIPTCOriginatingProgram$kCGImagePropertyIPTCProgramVersion$kCGImagePropertyIPTCProvinceState$kCGImagePropertyIPTCReferenceDate$kCGImagePropertyIPTCReferenceNumber$kCGImagePropertyIPTCReferenceService$kCGImagePropertyIPTCReleaseDate$kCGImagePropertyIPTCReleaseTime$kCGImagePropertyIPTCRightsUsageTerms$kCGImagePropertyIPTCScene$kCGImagePropertyIPTCSource$kCGImagePropertyIPTCSpecialInstructions$kCGImagePropertyIPTCStarRating$kCGImagePropertyIPTCSubLocation$kCGImagePropertyIPTCSubjectReference$kCGImagePropertyIPTCSupplementalCategory$kCGImagePropertyIPTCTimeCreated$kCGImagePropertyIPTCUrgency$kCGImagePropertyIPTCWriterEditor$kCGImagePropertyImageCount$kCGImagePropertyImageIndex$kCGImagePropertyImages$kCGImagePropertyIsFloat$kCGImagePropertyIsIndexed$kCGImagePropertyIsSticker$kCGImagePropertyJFIFDensityUnit$kCGImagePropertyJFIFDictionary$kCGImagePropertyJFIFIsProgressive$kCGImagePropertyJFIFVersion$kCGImagePropertyJFIFXDensity$kCGImagePropertyJFIFYDensity$kCGImagePropertyMakerAppleDictionary$kCGImagePropertyMakerCanonAspectRatioInfo$kCGImagePropertyMakerCanonCameraSerialNumber$kCGImagePropertyMakerCanonContinuousDrive$kCGImagePropertyMakerCanonDictionary$kCGImagePropertyMakerCanonFirmware$kCGImagePropertyMakerCanonFlashExposureComp$kCGImagePropertyMakerCanonImageSerialNumber$kCGImagePropertyMakerCanonLensModel$kCGImagePropertyMakerCanonOwnerName$kCGImagePropertyMakerFujiDictionary$kCGImagePropertyMakerMinoltaDictionary$kCGImagePropertyMakerNikonCameraSerialNumber$kCGImagePropertyMakerNikonColorMode$kCGImagePropertyMakerNikonDictionary$kCGImagePropertyMakerNikonDigitalZoom$kCGImagePropertyMakerNikonFlashExposureComp$kCGImagePropertyMakerNikonFlashSetting$kCGImagePropertyMakerNikonFocusDistance$kCGImagePropertyMakerNikonFocusMode$kCGImagePropertyMakerNikonISOSelection$kCGImagePropertyMakerNikonISOSetting$kCGImagePropertyMakerNikonImageAdjustment$kCGImagePropertyMakerNikonLensAdapter$kCGImagePropertyMakerNikonLensInfo$kCGImagePropertyMakerNikonLensType$kCGImagePropertyMakerNikonQuality$kCGImagePropertyMakerNikonSharpenMode$kCGImagePropertyMakerNikonShootingMode$kCGImagePropertyMakerNikonShutterCount$kCGImagePropertyMakerNikonWhiteBalanceMode$kCGImagePropertyMakerOlympusDictionary$kCGImagePropertyMakerPentaxDictionary$kCGImagePropertyNamedColorSpace$kCGImagePropertyOpenEXRAspectRatio$kCGImagePropertyOpenEXRCompression$kCGImagePropertyOpenEXRDictionary$kCGImagePropertyOrientation$kCGImagePropertyPNGAuthor$kCGImagePropertyPNGChromaticities$kCGImagePropertyPNGComment$kCGImagePropertyPNGCompressionFilter$kCGImagePropertyPNGCopyright$kCGImagePropertyPNGCreationTime$kCGImagePropertyPNGDescription$kCGImagePropertyPNGDictionary$kCGImagePropertyPNGDisclaimer$kCGImagePropertyPNGGamma$kCGImagePropertyPNGInterlaceType$kCGImagePropertyPNGModificationTime$kCGImagePropertyPNGPixelsAspectRatio$kCGImagePropertyPNGSoftware$kCGImagePropertyPNGSource$kCGImagePropertyPNGTitle$kCGImagePropertyPNGTransparency$kCGImagePropertyPNGWarning$kCGImagePropertyPNGXPixelsPerMeter$kCGImagePropertyPNGYPixelsPerMeter$kCGImagePropertyPNGsRGBIntent$kCGImagePropertyPixelFormat$kCGImagePropertyPixelHeight$kCGImagePropertyPixelWidth$kCGImagePropertyPrimaryImage$kCGImagePropertyProfileName$kCGImagePropertyRawDictionary$kCGImagePropertyTGACompression$kCGImagePropertyTGADictionary$kCGImagePropertyTIFFArtist$kCGImagePropertyTIFFCompression$kCGImagePropertyTIFFCopyright$kCGImagePropertyTIFFDateTime$kCGImagePropertyTIFFDictionary$kCGImagePropertyTIFFDocumentName$kCGImagePropertyTIFFHostComputer$kCGImagePropertyTIFFImageDescription$kCGImagePropertyTIFFMake$kCGImagePropertyTIFFModel$kCGImagePropertyTIFFOrientation$kCGImagePropertyTIFFPhotometricInterpretation$kCGImagePropertyTIFFPrimaryChromaticities$kCGImagePropertyTIFFResolutionUnit$kCGImagePropertyTIFFSoftware$kCGImagePropertyTIFFTileLength$kCGImagePropertyTIFFTileWidth$kCGImagePropertyTIFFTransferFunction$kCGImagePropertyTIFFWhitePoint$kCGImagePropertyTIFFXResolution$kCGImagePropertyTIFFYResolution$kCGImagePropertyThumbnailImages$kCGImagePropertyWebPCanvasPixelHeight$kCGImagePropertyWebPCanvasPixelWidth$kCGImagePropertyWebPDelayTime$kCGImagePropertyWebPDictionary$kCGImagePropertyWebPFrameInfoArray$kCGImagePropertyWebPLoopCount$kCGImagePropertyWebPUnclampedDelayTime$kCGImagePropertyWidth$kCGImageSourceCreateThumbnailFromImageAlways$kCGImageSourceCreateThumbnailFromImageIfAbsent$kCGImageSourceCreateThumbnailWithTransform$kCGImageSourceDecodeRequest$kCGImageSourceDecodeRequestOptions$kCGImageSourceDecodeToHDR$kCGImageSourceDecodeToSDR$kCGImageSourceShouldAllowFloat$kCGImageSourceShouldCache$kCGImageSourceShouldCacheImmediately$kCGImageSourceSubsampleFactor$kCGImageSourceThumbnailMaxPixelSize$kCGImageSourceTypeIdentifierHint$kIIOCameraExtrinsics_CoordinateSystemID$kIIOCameraExtrinsics_Position$kIIOCameraExtrinsics_Rotation$kIIOCameraModelType_GenericPinhole$kIIOCameraModelType_SimplifiedPinhole$kIIOCameraModel_Intrinsics$kIIOCameraModel_ModelType$kIIOMetadata_CameraExtrinsicsKey$kIIOMetadata_CameraModelKey$""" -enums = """$IIO_HAS_IOSURFACE@1$IMAGEIO_PNG_ALL_FILTERS@248$IMAGEIO_PNG_FILTER_AVG@64$IMAGEIO_PNG_FILTER_NONE@8$IMAGEIO_PNG_FILTER_PAETH@128$IMAGEIO_PNG_FILTER_SUB@16$IMAGEIO_PNG_FILTER_UP@32$IMAGEIO_PNG_NO_FILTERS@0$kCGImageAnimationStatus_AllocationFailure@-22144$kCGImageAnimationStatus_CorruptInputImage@-22141$kCGImageAnimationStatus_IncompleteInputImage@-22143$kCGImageAnimationStatus_ParameterError@-22140$kCGImageAnimationStatus_UnsupportedFormat@-22142$kCGImageMetadataErrorBadArgument@2$kCGImageMetadataErrorConflictingArguments@3$kCGImageMetadataErrorPrefixConflict@4$kCGImageMetadataErrorUnknown@0$kCGImageMetadataErrorUnsupportedFormat@1$kCGImageMetadataTypeAlternateArray@4$kCGImageMetadataTypeAlternateText@5$kCGImageMetadataTypeArrayOrdered@3$kCGImageMetadataTypeArrayUnordered@2$kCGImageMetadataTypeDefault@0$kCGImageMetadataTypeInvalid@-1$kCGImageMetadataTypeString@1$kCGImageMetadataTypeStructure@6$kCGImagePropertyOrientationDown@3$kCGImagePropertyOrientationDownMirrored@4$kCGImagePropertyOrientationLeft@8$kCGImagePropertyOrientationLeftMirrored@5$kCGImagePropertyOrientationRight@6$kCGImagePropertyOrientationRightMirrored@7$kCGImagePropertyOrientationUp@1$kCGImagePropertyOrientationUpMirrored@2$kCGImageStatusComplete@0$kCGImageStatusIncomplete@-1$kCGImageStatusInvalidData@-4$kCGImageStatusReadingHeader@-2$kCGImageStatusUnexpectedEOF@-5$kCGImageStatusUnknownType@-3$kCGImageTGACompressionNone@0$kCGImageTGACompressionRLE@1$""" -misc.update( - { - "CGImageMetadataErrors": NewType("CGImageMetadataErrors", int), - "CGImageMetadataType": NewType("CGImageMetadataType", int), - "CGImagePropertyOrientation": NewType("CGImagePropertyOrientation", int), - "CGImageAnimationStatus": NewType("CGImageAnimationStatus", int), - "CGImagePropertyTGACompression": NewType("CGImagePropertyTGACompression", int), - "CGImageSourceStatus": NewType("CGImageSourceStatus", int), - } -) -misc.update({}) -misc.update({}) -functions = { - "CGImageMetadataSetValueMatchingImageProperty": ( - b"B^{CGImageMetadata=}^{__CFString=}^{__CFString=}@", - ), - "CGImageMetadataCreateFromXMPData": ( - b"^{CGImageMetadata=}^{__CFData=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceGetCount": (b"Q^{CGImageSource=}",), - "CGImageSourceCreateWithData": ( - b"^{CGImageSource=}^{__CFData=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceCopyTypeIdentifiers": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataCopyTagWithPath": ( - b"^{CGImageMetadataTag=}^{CGImageMetadata=}^{CGImageMetadataTag=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataGetTypeID": (b"Q",), - "CGImageDestinationAddAuxiliaryDataInfo": ( - b"v^{CGImageDestination=}^{__CFString=}^{__CFDictionary=}", - ), - "CGImageMetadataTagGetType": (b"i^{CGImageMetadataTag=}",), - "CGImageSourceGetStatus": (b"i^{CGImageSource=}",), - "CGImageMetadataCreateXMPData": ( - b"^{__CFData=}^{CGImageMetadata=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceCreateImageAtIndex": ( - b"^{CGImage=}^{CGImageSource=}Q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataTagCopyNamespace": ( - b"^{__CFString=}^{CGImageMetadataTag=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceCopyMetadataAtIndex": ( - b"^{CGImageMetadata=}^{CGImageSource=}Q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageDestinationCreateWithURL": ( - b"^{CGImageDestination=}^{__CFURL=}^{__CFString=}Q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceRemoveCacheAtIndex": (b"v^{CGImageSource=}Q",), - "CGImageSourceCreateThumbnailAtIndex": ( - b"^{CGImage=}^{CGImageSource=}Q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceCreateIncremental": ( - b"^{CGImageSource=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceCopyPropertiesAtIndex": ( - b"^{__CFDictionary=}^{CGImageSource=}Q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceUpdateData": (b"v^{CGImageSource=}^{__CFData=}B",), - "CGImageDestinationSetProperties": (b"v^{CGImageDestination=}^{__CFDictionary=}",), - "CGImageMetadataSetTagWithPath": ( - b"B^{CGImageMetadata=}^{CGImageMetadataTag=}^{__CFString=}^{CGImageMetadataTag=}", - ), - "CGAnimateImageAtURLWithBlock": ( - b"i^{__CFURL=}^{__CFDictionary=}@?", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "l"}, - 2: {"type": "@"}, - 3: {"type": "o^B"}, - }, - } - } - } - }, - ), - "CGImageDestinationCreateWithDataConsumer": ( - b"^{CGImageDestination=}^{CGDataConsumer=}^{__CFString=}Q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageDestinationCopyTypeIdentifiers": ( - b"^{__CFArray=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageDestinationCreateWithData": ( - b"^{CGImageDestination=}^{__CFData=}^{__CFString=}Q^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceCopyAuxiliaryDataInfoAtIndex": ( - b"^{__CFDictionary=}^{CGImageSource=}Q^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGAnimateImageDataWithBlock": ( - b"i^{__CFData=}^{__CFDictionary=}@?", - "", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "l"}, - 2: {"type": "@"}, - 3: {"type": "o^B"}, - }, - } - } - } - }, - ), - "CGImageSourceGetTypeID": (b"Q",), - "CGImageDestinationAddImageAndMetadata": ( - b"v^{CGImageDestination=}^{CGImage=}^{CGImageMetadata=}^{__CFDictionary=}", - ), - "CGImageMetadataTagCreate": ( - b"^{CGImageMetadataTag=}^{__CFString=}^{__CFString=}^{__CFString=}i@", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageDestinationCopyImageSource": ( - b"B^{CGImageDestination=}^{CGImageSource=}^{__CFDictionary=}^^{__CFError=}", - "", - { - "retval": {"already_cfretained": True}, - "arguments": { - 3: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - }, - }, - ), - "CGImageSourceUpdateDataProvider": (b"v^{CGImageSource=}^{CGDataProvider=}B",), - "CGImageDestinationAddImage": ( - b"v^{CGImageDestination=}^{CGImage=}^{__CFDictionary=}", - ), - "CGImageMetadataRemoveTagWithPath": ( - b"B^{CGImageMetadata=}^{CGImageMetadataTag=}^{__CFString=}", - ), - "CGImageSourceGetStatusAtIndex": (b"i^{CGImageSource=}Q",), - "CGImageSourceCreateWithURL": ( - b"^{CGImageSource=}^{__CFURL=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataTagCopyValue": ( - b"@^{CGImageMetadataTag=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataCopyTags": ( - b"^{__CFArray=}^{CGImageMetadata=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataCopyStringValueWithPath": ( - b"^{__CFString=}^{CGImageMetadata=}^{CGImageMetadataTag=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceGetType": (b"^{__CFString=}^{CGImageSource=}",), - "CGImageDestinationAddImageFromSource": ( - b"v^{CGImageDestination=}^{CGImageSource=}Q^{__CFDictionary=}", - ), - "CGImageDestinationGetTypeID": (b"Q",), - "CGImageDestinationFinalize": (b"B^{CGImageDestination=}",), - "CGImageSourceGetPrimaryImageIndex": (b"Q^{CGImageSource=}",), - "CGImageSourceCopyProperties": ( - b"^{__CFDictionary=}^{CGImageSource=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataTagGetTypeID": (b"Q",), - "CGImageMetadataSetValueWithPath": ( - b"B^{CGImageMetadata=}^{CGImageMetadataTag=}^{__CFString=}@", - ), - "CGImageMetadataCopyTagMatchingImageProperty": ( - b"^{CGImageMetadataTag=}^{CGImageMetadata=}^{__CFString=}^{__CFString=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataRegisterNamespaceForPrefix": ( - b"B^{CGImageMetadata=}^{__CFString=}^{__CFString=}^^{__CFError=}", - "", - { - "arguments": { - 3: { - "already_cfretained": True, - "type_modifier": "o", - "null_accepted": True, - } - } - }, - ), - "CGImageMetadataTagCopyPrefix": ( - b"^{__CFString=}^{CGImageMetadataTag=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataTagCopyName": ( - b"^{__CFString=}^{CGImageMetadataTag=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataEnumerateTagsUsingBlock": ( - b"v^{CGImageMetadata=}^{__CFString=}^{__CFDictionary=}@?", - "", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"B"}, - "arguments": { - 0: {"type": "^v"}, - 1: {"type": "@"}, - 2: {"type": "@"}, - }, - } - } - } - }, - ), - "CGImageMetadataCreateMutable": ( - b"^{CGImageMetadata=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageSourceCreateWithDataProvider": ( - b"^{CGImageSource=}^{CGDataProvider=}^{__CFDictionary=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataTagCopyQualifiers": ( - b"^{__CFArray=}^{CGImageMetadataTag=}", - "", - {"retval": {"already_cfretained": True}}, - ), - "CGImageMetadataCreateMutableCopy": ( - b"^{CGImageMetadata=}^{CGImageMetadata=}", - "", - {"retval": {"already_cfretained": True}}, - ), -} -aliases = { - "IMAGEIO_AVAILABLE_STARTING": "__OSX_AVAILABLE_STARTING", - "IMAGEIO_AVAILABLE_BUT_DEPRECATED": "__OSX_AVAILABLE_BUT_DEPRECATED", - "_iio_Nullable": "_Nullable", - "_iio_Nonnull": "_Nonnull", -} -cftypes = [ - ("CGImageSourceRef", b"^{CGImageSource=}", "CGImageSourceGetTypeID", None), - ( - "CGImageDestinationRef", - b"^{CGImageDestination=}", - "CGImageDestinationGetTypeID", - None, - ), - ( - "CGImageMetadataTagRef", - b"^{CGImageMetadataTag=}", - "CGImageMetadataTagGetTypeID", - None, - ), - ("CGImageMetadataRef", b"^{CGImageMetadata=}", "CGImageMetadataGetTypeID", None), -] -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__init__.py deleted file mode 100644 index 7b5f5fe..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__init__.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -Python mapping for the ImageKit framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import AppKit - import objc - from . import _metadata, _imagekit - - if objc.macos_available(14, 0): - identifier = "com.apple.quartzframework" - elif objc.macos_available(13, 0): - identifier = "com.apple.Quartz" - else: - identifier = "com.apple.quartzframework" - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.ImageKit", - frameworkIdentifier=identifier, - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/Quartz.framework" - ), - globals_dict=globals(), - inline_list=None, - parents=( - _imagekit, - AppKit, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.ImageKit._metadata"] - - objc.addConvenienceForBasicMapping("IKImageBrowserGridGroup", False) - objc.addConvenienceForBasicMapping("IKImageCell", False) - objc.addConvenienceForBasicMapping("IKImageState", False) - objc.addConvenienceForBasicSequence("IKLinkedList", True) - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 388d254..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index f868666..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/_imagekit.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/_imagekit.abi3.so deleted file mode 100755 index 11c9176..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/_imagekit.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/_metadata.py deleted file mode 100644 index b00b143..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/ImageKit/_metadata.py +++ /dev/null @@ -1,660 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 1 14:05:38 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -constants = """$IKFilterBrowserDefaultInputImage$IKFilterBrowserExcludeCategories$IKFilterBrowserExcludeFilters$IKFilterBrowserFilterDoubleClickNotification$IKFilterBrowserFilterSelectedNotification$IKFilterBrowserShowCategories$IKFilterBrowserShowPreview$IKFilterBrowserWillPreviewFilterNotification$IKImageBrowserBackgroundColorKey$IKImageBrowserCGImageRepresentationType$IKImageBrowserCGImageSourceRepresentationType$IKImageBrowserCellBackgroundLayer$IKImageBrowserCellForegroundLayer$IKImageBrowserCellLayerTypeBackground$IKImageBrowserCellLayerTypeForeground$IKImageBrowserCellLayerTypePlaceHolder$IKImageBrowserCellLayerTypeSelection$IKImageBrowserCellPlaceHolderLayer$IKImageBrowserCellSelectionLayer$IKImageBrowserCellsHighlightedTitleAttributesKey$IKImageBrowserCellsOutlineColorKey$IKImageBrowserCellsSubtitleAttributesKey$IKImageBrowserCellsTitleAttributesKey$IKImageBrowserGroupBackgroundColorKey$IKImageBrowserGroupFooterLayer$IKImageBrowserGroupHeaderLayer$IKImageBrowserGroupRangeKey$IKImageBrowserGroupStyleKey$IKImageBrowserGroupTitleKey$IKImageBrowserIconRefPathRepresentationType$IKImageBrowserIconRefRepresentationType$IKImageBrowserNSBitmapImageRepresentationType$IKImageBrowserNSDataRepresentationType$IKImageBrowserNSImageRepresentationType$IKImageBrowserNSURLRepresentationType$IKImageBrowserPDFPageRepresentationType$IKImageBrowserPathRepresentationType$IKImageBrowserQCCompositionPathRepresentationType$IKImageBrowserQCCompositionRepresentationType$IKImageBrowserQTMoviePathRepresentationType$IKImageBrowserQTMovieRepresentationType$IKImageBrowserQuickLookPathRepresentationType$IKImageBrowserSelectionColorKey$IKOverlayTypeBackground$IKOverlayTypeImage$IKPictureTakerAllowsEditingKey$IKPictureTakerAllowsFileChoosingKey$IKPictureTakerAllowsVideoCaptureKey$IKPictureTakerCropAreaSizeKey$IKPictureTakerImageTransformsKey$IKPictureTakerInformationalTextKey$IKPictureTakerOutputImageMaxSizeKey$IKPictureTakerRemainOpenAfterValidateKey$IKPictureTakerShowAddressBookPicture$IKPictureTakerShowAddressBookPictureKey$IKPictureTakerShowEffectsKey$IKPictureTakerShowEmptyPicture$IKPictureTakerShowEmptyPictureKey$IKPictureTakerShowRecentPictureKey$IKPictureTakerUpdateRecentPictureKey$IKSlideshowAudioFile$IKSlideshowModeImages$IKSlideshowModeOther$IKSlideshowModePDF$IKSlideshowPDFDisplayBox$IKSlideshowPDFDisplayMode$IKSlideshowPDFDisplaysAsBook$IKSlideshowScreen$IKSlideshowStartIndex$IKSlideshowStartPaused$IKSlideshowWrapAround$IKToolModeAnnotate$IKToolModeCrop$IKToolModeMove$IKToolModeNone$IKToolModeRotate$IKToolModeSelect$IKToolModeSelectEllipse$IKToolModeSelectLasso$IKToolModeSelectRect$IKUIFlavorAllowFallback$IKUISizeFlavor$IKUISizeMini$IKUISizeRegular$IKUISizeSmall$IKUImaxSize$IK_ApertureBundleIdentifier$IK_MailBundleIdentifier$IK_PhotosBundleIdentifier$IK_iPhotoBundleIdentifier$""" -enums = """$IKCameraDeviceViewDisplayModeIcon@1$IKCameraDeviceViewDisplayModeNone@-1$IKCameraDeviceViewDisplayModeTable@0$IKCameraDeviceViewTransferModeFileBased@0$IKCameraDeviceViewTransferModeMemoryBased@1$IKCellsStyleNone@0$IKCellsStyleOutlined@2$IKCellsStyleShadowed@1$IKCellsStyleSubtitled@8$IKCellsStyleTitled@4$IKDeviceBrowserViewDisplayModeIcon@2$IKDeviceBrowserViewDisplayModeOutline@1$IKDeviceBrowserViewDisplayModeTable@0$IKGroupBezelStyle@0$IKGroupDisclosureStyle@1$IKImageBrowserDropBefore@1$IKImageBrowserDropOn@0$IKImageStateInvalid@1$IKImageStateNoImage@0$IKImageStateReady@2$IKScannerDeviceViewDisplayModeAdvanced@1$IKScannerDeviceViewDisplayModeNone@-1$IKScannerDeviceViewDisplayModeSimple@0$IKScannerDeviceViewTransferModeFileBased@0$IKScannerDeviceViewTransferModeMemoryBased@1$""" -misc.update( - { - "IKCameraDeviceViewDisplayMode": NewType("IKCameraDeviceViewDisplayMode", int), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:36:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:36:1)", - int, - ), - "IKCameraDeviceViewTransferMode": NewType( - "IKCameraDeviceViewTransferMode", int - ), - "IKImageBrowserCellState": NewType("IKImageBrowserCellState", int), - "IKScannerDeviceViewDisplayMode": NewType( - "IKScannerDeviceViewDisplayMode", int - ), - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:25:1)": NewType( - "enum (unnamed at /Users/ronald/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:25:1)", - int, - ), - "IKScannerDeviceViewTransferMode": NewType( - "IKScannerDeviceViewTransferMode", int - ), - "IKImageBrowserDropOperation": NewType("IKImageBrowserDropOperation", int), - "IKDeviceBrowserViewDisplayMode": NewType( - "IKDeviceBrowserViewDisplayMode", int - ), - } -) -misc.update({}) -misc.update({}) -aliases = { - "IKImagePickerShowEffectsKey": "IKPictureTakerShowEffectsKey", - "IKImagePickerOutputImageMaxSizeKey": "IKPictureTakerOutputImageMaxSizeKey", - "IKImagePickerImageTransformsKey": "IKPictureTakerImageTransformsKey", - "IKImagePickerAllowsFileChoosingKey": "IKPictureTakerAllowsFileChoosingKey", - "IK_API_DEPRECATED": "API_DEPRECATED", - "IKImagePickerAllowsEditingKey": "IKPictureTakerAllowsEditingKey", - "IKImagePickerInformationalTextKey": "IKPictureTakerInformationalTextKey", - "IKImagePickerCropAreaSizeKey": "IKPictureTakerCropAreaSizeKey", - "IKImagePickerAllowsVideoCaptureKey": "IKPictureTakerAllowsVideoCaptureKey", - "IKImagePickerUpdateRecentPictureKey": "IKPictureTakerUpdateRecentPictureKey", - "IKImagePickerShowRecentPictureKey": "IKPictureTakerShowRecentPictureKey", -} -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r(b"IKCameraDeviceView", b"canDeleteSelectedItems", {"retval": {"type": b"Z"}}) - r(b"IKCameraDeviceView", b"canDownloadSelectedItems", {"retval": {"type": b"Z"}}) - r(b"IKCameraDeviceView", b"canRotateSelectedItemsLeft", {"retval": {"type": b"Z"}}) - r(b"IKCameraDeviceView", b"canRotateSelectedItemsRight", {"retval": {"type": b"Z"}}) - r( - b"IKCameraDeviceView", - b"displaysDownloadsDirectoryControl", - {"retval": {"type": b"Z"}}, - ) - r( - b"IKCameraDeviceView", - b"displaysPostProcessApplicationControl", - {"retval": {"type": b"Z"}}, - ) - r(b"IKCameraDeviceView", b"hasDisplayModeIcon", {"retval": {"type": b"Z"}}) - r(b"IKCameraDeviceView", b"hasDisplayModeTable", {"retval": {"type": b"Z"}}) - r( - b"IKCameraDeviceView", - b"selectIndexes:byExtendingSelection:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"IKCameraDeviceView", - b"setDisplaysDownloadsDirectoryControl:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKCameraDeviceView", - b"setDisplaysPostProcessApplicationControl:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKCameraDeviceView", - b"setHasDisplayModeIcon:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKCameraDeviceView", - b"setHasDisplayModeTable:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKCameraDeviceView", - b"setShowStatusInfoAsWindowSubtitle:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"IKDeviceBrowserView", b"displaysLocalCameras", {"retval": {"type": b"Z"}}) - r(b"IKDeviceBrowserView", b"displaysLocalScanners", {"retval": {"type": b"Z"}}) - r(b"IKDeviceBrowserView", b"displaysNetworkCameras", {"retval": {"type": b"Z"}}) - r(b"IKDeviceBrowserView", b"displaysNetworkScanners", {"retval": {"type": b"Z"}}) - r( - b"IKDeviceBrowserView", - b"setDisplaysLocalCameras:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKDeviceBrowserView", - b"setDisplaysLocalScanners:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKDeviceBrowserView", - b"setDisplaysNetworkCameras:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKDeviceBrowserView", - b"setDisplaysNetworkScanners:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKFilterBrowserPanel", - b"beginSheetWithOptions:modalForWindow:modalDelegate:didEndSelector:contextInfo:", - {"arguments": {5: {"sel_of_type": sel32or64(b"v@:@i^v", b"v@:@q^v")}}}, - ) - r( - b"IKFilterBrowserPanel", - b"beginWithOptions:modelessDelegate:didEndSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": sel32or64(b"v@:@i^v", b"v@:@q^v")}}}, - ) - r(b"IKFilterBrowserView", b"setPreviewState:", {"arguments": {2: {"type": b"Z"}}}) - r(b"IKImageBrowserCell", b"isSelected", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"allowsDroppingOnItems", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"allowsEmptySelection", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"allowsMultipleSelection", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"allowsReordering", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"animates", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"canControlQuickLookPanel", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"constrainsToOriginalSize", {"retval": {"type": b"Z"}}) - r(b"IKImageBrowserView", b"isGroupExpandedAtIndex:", {"retval": {"type": b"Z"}}) - r( - b"IKImageBrowserView", - b"setAllowsDroppingOnItems:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKImageBrowserView", - b"setAllowsEmptySelection:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKImageBrowserView", - b"setAllowsMultipleSelection:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKImageBrowserView", - b"setAllowsReordering:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"IKImageBrowserView", b"setAnimates:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"IKImageBrowserView", - b"setCanControlQuickLookPanel:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKImageBrowserView", - b"setConstrainsToOriginalSize:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKImageBrowserView", - b"setSelectionIndexes:byExtendingSelection:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"IKImagePicker", - b"beginImagePickerSheetForWindow:withDelegate:didEndSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": sel32or64(b"v@:@I^v", b"v@:@Q^v")}}}, - ) - r( - b"IKImagePicker", - b"beginImagePickerWithDelegate:didEndSelector:contextInfo:", - {"arguments": {3: {"sel_of_type": sel32or64(b"v@:@I^v", b"v@:@Q^v")}}}, - ) - r(b"IKImageView", b"autohidesScrollers", {"retval": {"type": b"Z"}}) - r(b"IKImageView", b"autoresizes", {"retval": {"type": b"Z"}}) - r(b"IKImageView", b"doubleClickOpensImageEditPanel", {"retval": {"type": b"Z"}}) - r(b"IKImageView", b"editable", {"retval": {"type": b"Z"}}) - r(b"IKImageView", b"hasHorizontalScroller", {"retval": {"type": b"Z"}}) - r(b"IKImageView", b"hasVerticalScroller", {"retval": {"type": b"Z"}}) - r(b"IKImageView", b"setAutohidesScrollers:", {"arguments": {2: {"type": b"Z"}}}) - r(b"IKImageView", b"setAutoresizes:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"IKImageView", - b"setDoubleClickOpensImageEditPanel:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"IKImageView", b"setEditable:", {"arguments": {2: {"type": b"Z"}}}) - r(b"IKImageView", b"setHasHorizontalScroller:", {"arguments": {2: {"type": b"Z"}}}) - r(b"IKImageView", b"setHasVerticalScroller:", {"arguments": {2: {"type": b"Z"}}}) - r(b"IKImageView", b"setSupportsDragAndDrop:", {"arguments": {2: {"type": b"Z"}}}) - r(b"IKImageView", b"supportsDragAndDrop", {"retval": {"type": b"Z"}}) - r( - b"IKPictureTaker", - b"beginPictureTakerSheetForWindow:withDelegate:didEndSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": sel32or64(b"v@:@i^v", b"v@:@q^v")}}}, - ) - r( - b"IKPictureTaker", - b"beginPictureTakerWithDelegate:didEndSelector:contextInfo:", - {"arguments": {3: {"sel_of_type": sel32or64(b"v@:@i^v", b"v@:@q^v")}}}, - ) - r(b"IKPictureTaker", b"mirroring", {"retval": {"type": b"Z"}}) - r( - b"IKPictureTaker", - b"popUpRecentsMenuForView:withDelegate:didEndSelector:contextInfo:", - {"arguments": {4: {"sel_of_type": sel32or64(b"v@:@i^v", b"v@:@q^v")}}}, - ) - r(b"IKPictureTaker", b"setMirroring:", {"arguments": {2: {"type": b"Z"}}}) - r(b"IKSaveOptions", b"rememberLastSetting", {"retval": {"type": b"Z"}}) - r(b"IKSaveOptions", b"setRememberLastSetting:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"IKScannerDeviceView", - b"displaysDownloadsDirectoryControl", - {"retval": {"type": b"Z"}}, - ) - r( - b"IKScannerDeviceView", - b"displaysPostProcessApplicationControl", - {"retval": {"type": b"Z"}}, - ) - r(b"IKScannerDeviceView", b"hasDisplayModeAdvanced", {"retval": {"type": b"Z"}}) - r(b"IKScannerDeviceView", b"hasDisplayModeSimple", {"retval": {"type": b"Z"}}) - r( - b"IKScannerDeviceView", - b"setDisplaysDownloadsDirectoryControl:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKScannerDeviceView", - b"setDisplaysPostProcessApplicationControl:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKScannerDeviceView", - b"setHasDisplayModeAdvanced:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"IKScannerDeviceView", - b"setHasDisplayModeSimple:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"IKSlideshow", b"canExportToApplication:", {"retval": {"type": b"Z"}}) - r( - b"NSObject", - b"cameraDeviceView:didDownloadFile:location:fileData:error:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - 6: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"cameraDeviceView:didEncounterError:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"cameraDeviceViewSelectionDidChange:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"canExportSlideshowItemAtIndex:toApplication:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"Q"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"deviceBrowserView:didEncounterError:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"deviceBrowserView:selectionDidChange:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"hasAdjustMode", {"required": False, "retval": {"type": b"Z"}}) - r(b"NSObject", b"hasDetailsMode", {"required": False, "retval": {"type": b"Z"}}) - r(b"NSObject", b"hasEffectsMode", {"required": False, "retval": {"type": b"Z"}}) - r(b"NSObject", b"image", {"required": True, "retval": {"type": b"^{CGImage=}"}}) - r( - b"NSObject", - b"imageBrowser:backgroundWasRightClickedWithEvent:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"imageBrowser:cellAtIndex:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"L"}}}, - ) - r( - b"NSObject", - b"imageBrowser:cellWasDoubleClickedAtIndex:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"Q"}}}, - ) - r( - b"NSObject", - b"imageBrowser:cellWasRightClickedAtIndex:withEvent:", - { - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"Q"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"imageBrowser:groupAtIndex:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"Q"}}}, - ) - r( - b"NSObject", - b"imageBrowser:itemAtIndex:", - {"retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"Q"}}}, - ) - r( - b"NSObject", - b"imageBrowser:moveCellsAtIndexes:toIndex:", - { - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"L"}}, - }, - ) - r( - b"NSObject", - b"imageBrowser:moveItemsAtIndexes:toIndex:", - { - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"Q"}}, - }, - ) - r( - b"NSObject", - b"imageBrowser:removeCellsAtIndexes:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"imageBrowser:removeItemsAtIndexes:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"imageBrowser:writeCellsAtIndexes:toPasteboard:", - { - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"imageBrowser:writeItemsAtIndexes:toPasteboard:", - { - "retval": {"type": b"Q"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"imageBrowserSelectionDidChange:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"imageProperties", {"required": False, "retval": {"type": b"@"}}) - r(b"NSObject", b"imageRepresentation", {"retval": {"type": b"@"}}) - r(b"NSObject", b"imageRepresentationType", {"retval": {"type": b"@"}}) - r(b"NSObject", b"imageSubtitle", {"retval": {"type": b"@"}}) - r(b"NSObject", b"imageTitle", {"retval": {"type": b"@"}}) - r(b"NSObject", b"imageUID", {"retval": {"type": b"@"}}) - r(b"NSObject", b"imageVersion", {"retval": {"type": b"Q"}}) - r(b"NSObject", b"isSelectable", {"retval": {"type": b"Z"}}) - r( - b"NSObject", - b"nameOfSlideshowItemAtIndex:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"Q"}}}, - ) - r( - b"NSObject", - b"numberOfCellsInImageBrowser:", - {"retval": {"type": b"L"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfGroupsInImageBrowser:", - {"retval": {"type": b"Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfItemsInImageBrowser:", - {"retval": {"type": b"Q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfSlideshowItems", - {"required": True, "retval": {"type": b"Q"}}, - ) - r( - b"NSObject", - b"provideViewForUIConfiguration:excludedKeys:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"saveOptions:shouldShowUTType:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"scannerDeviceView:didEncounterError:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"scannerDeviceView:didScanToBandData:scanInfo:error:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"scannerDeviceView:didScanToURL:error:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"scannerDeviceView:didScanToURL:fileData:error:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: {"type": b"@"}, - 5: {"type": b"@"}, - }, - }, - ) - r( - b"NSObject", - b"setImage:imageProperties:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"^{CGImage=}"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"slideshowDidChangeCurrentIndex:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Q"}}}, - ) - r(b"NSObject", b"slideshowDidStop", {"required": False, "retval": {"type": b"v"}}) - r( - b"NSObject", - b"slideshowItemAtIndex:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"Q"}}}, - ) - r(b"NSObject", b"slideshowWillStart", {"required": False, "retval": {"type": b"v"}}) - r( - b"NSObject", - b"thumbnailWithMaximumSize:", - { - "required": False, - "retval": {"type": b"^{CGImage=}"}, - "arguments": {2: {"type": b"{CGSize=dd}"}}, - }, - ) - r(b"null", b"saveOptions:shouldShowUTType:", {"retval": {"type": b"Z"}}) -finally: - objc._updatingMetadata(False) -protocols = { - "IKImageBrowserItem": objc.informal_protocol( - "IKImageBrowserItem", - [ - objc.selector(None, b"imageTitle", b"@@:", isRequired=False), - objc.selector(None, b"imageSubtitle", b"@@:", isRequired=False), - objc.selector(None, b"imageRepresentationType", b"@@:", isRequired=False), - objc.selector(None, b"imageUID", b"@@:", isRequired=False), - objc.selector(None, b"isSelectable", b"Z@:", isRequired=False), - objc.selector(None, b"imageVersion", b"Q@:", isRequired=False), - objc.selector(None, b"imageRepresentation", b"@@:", isRequired=False), - ], - ), - "IKImageBrowserDataSourceDeprecated": objc.informal_protocol( - "IKImageBrowserDataSourceDeprecated", - [ - objc.selector( - None, b"numberOfCellsInImageBrowser:", b"L@:@", isRequired=False - ), - objc.selector( - None, b"imageBrowser:cellAtIndex:", b"@@:@L", isRequired=False - ), - objc.selector( - None, b"imageBrowser:removeCellsAtIndexes:", b"v@:@@", isRequired=False - ), - objc.selector( - None, - b"imageBrowser:moveCellsAtIndexes:toIndex:", - b"Z@:@@L", - isRequired=False, - ), - objc.selector( - None, - b"imageBrowser:writeCellsAtIndexes:toPasteboard:", - b"v@:@@@", - isRequired=False, - ), - ], - ), - "IKSaveOptionsDelegate": objc.informal_protocol( - "IKSaveOptionsDelegate", - [ - objc.selector( - None, b"saveOptions:shouldShowUTType:", b"Z@:@@", isRequired=False - ) - ], - ), - "IKImageBrowserDelegate": objc.informal_protocol( - "IKImageBrowserDelegate", - [ - objc.selector( - None, - b"imageBrowser:cellWasRightClickedAtIndex:withEvent:", - b"v@:@Q@", - isRequired=False, - ), - objc.selector( - None, b"imageBrowserSelectionDidChange:", b"v@:@", isRequired=False - ), - objc.selector( - None, - b"imageBrowser:cellWasDoubleClickedAtIndex:", - b"v@:@Q", - isRequired=False, - ), - objc.selector( - None, - b"imageBrowser:backgroundWasRightClickedWithEvent:", - b"v@:@@", - isRequired=False, - ), - ], - ), - "IKImageBrowserDataSource": objc.informal_protocol( - "IKImageBrowserDataSource", - [ - objc.selector( - None, b"imageBrowser:groupAtIndex:", b"@@:@Q", isRequired=False - ), - objc.selector( - None, b"numberOfItemsInImageBrowser:", b"Q@:@", isRequired=False - ), - objc.selector( - None, - b"imageBrowser:moveItemsAtIndexes:toIndex:", - b"Z@:@@Q", - isRequired=False, - ), - objc.selector( - None, b"numberOfGroupsInImageBrowser:", b"Q@:@", isRequired=False - ), - objc.selector( - None, b"imageBrowser:itemAtIndex:", b"@@:@Q", isRequired=False - ), - objc.selector( - None, b"imageBrowser:removeItemsAtIndexes:", b"v@:@@", isRequired=False - ), - objc.selector( - None, - b"imageBrowser:writeItemsAtIndexes:toPasteboard:", - b"Q@:@@@", - isRequired=False, - ), - ], - ), -} -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/_PDFKit.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/_PDFKit.abi3.so deleted file mode 100755 index 6eaa8a7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/_PDFKit.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__init__.py deleted file mode 100644 index 53ff8b4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Python mapping for the PDFKit framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - import os - - import AppKit - import objc - from . import _metadata, _PDFKit - - frameworkPath = "/System/Library/Frameworks/PDFKit.framework" - frameworkIdentifier = "com.apple.PDFKit" - if not os.path.exists(frameworkPath): - frameworkPath = "/System/Library/Frameworks/Quartz.framework" - if objc.macos_available(13, 0): - frameworkIdentifier = "com.apple.Quartz" - else: - frameworkIdentifier = "com.apple.quartzframework" - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.PDFKit", - frameworkIdentifier=frameworkIdentifier, - frameworkPath=objc.pathForFramework(frameworkPath), - globals_dict=globals(), - inline_list=None, - parents=( - _PDFKit, - AppKit, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.PDFKit._metadata"] - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 403dfd6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index 78c5bff..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/_metadata.py deleted file mode 100644 index 2893722..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/PDFKit/_metadata.py +++ /dev/null @@ -1,424 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 1 14:05:45 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -constants = """$PDFAnnotationHighlightingModeInvert$PDFAnnotationHighlightingModeNone$PDFAnnotationHighlightingModeOutline$PDFAnnotationHighlightingModePush$PDFAnnotationKeyAction$PDFAnnotationKeyAdditionalActions$PDFAnnotationKeyAppearanceDictionary$PDFAnnotationKeyAppearanceState$PDFAnnotationKeyBorder$PDFAnnotationKeyBorderStyle$PDFAnnotationKeyColor$PDFAnnotationKeyContents$PDFAnnotationKeyDate$PDFAnnotationKeyDefaultAppearance$PDFAnnotationKeyDestination$PDFAnnotationKeyFlags$PDFAnnotationKeyHighlightingMode$PDFAnnotationKeyIconName$PDFAnnotationKeyInklist$PDFAnnotationKeyInteriorColor$PDFAnnotationKeyLineEndingStyles$PDFAnnotationKeyLinePoints$PDFAnnotationKeyName$PDFAnnotationKeyOpen$PDFAnnotationKeyPage$PDFAnnotationKeyParent$PDFAnnotationKeyPopup$PDFAnnotationKeyQuadPoints$PDFAnnotationKeyQuadding$PDFAnnotationKeyRect$PDFAnnotationKeySubtype$PDFAnnotationKeyTextLabel$PDFAnnotationKeyWidgetAppearanceDictionary$PDFAnnotationKeyWidgetBackgroundColor$PDFAnnotationKeyWidgetBorderColor$PDFAnnotationKeyWidgetCaption$PDFAnnotationKeyWidgetDefaultValue$PDFAnnotationKeyWidgetDownCaption$PDFAnnotationKeyWidgetFieldFlags$PDFAnnotationKeyWidgetFieldType$PDFAnnotationKeyWidgetMaxLen$PDFAnnotationKeyWidgetOptions$PDFAnnotationKeyWidgetRolloverCaption$PDFAnnotationKeyWidgetRotation$PDFAnnotationKeyWidgetTextLabelUI$PDFAnnotationKeyWidgetValue$PDFAnnotationLineEndingStyleCircle$PDFAnnotationLineEndingStyleClosedArrow$PDFAnnotationLineEndingStyleDiamond$PDFAnnotationLineEndingStyleNone$PDFAnnotationLineEndingStyleOpenArrow$PDFAnnotationLineEndingStyleSquare$PDFAnnotationSubtypeCircle$PDFAnnotationSubtypeFreeText$PDFAnnotationSubtypeHighlight$PDFAnnotationSubtypeInk$PDFAnnotationSubtypeLine$PDFAnnotationSubtypeLink$PDFAnnotationSubtypePopup$PDFAnnotationSubtypeSquare$PDFAnnotationSubtypeStamp$PDFAnnotationSubtypeStrikeOut$PDFAnnotationSubtypeText$PDFAnnotationSubtypeUnderline$PDFAnnotationSubtypeWidget$PDFAnnotationTextIconTypeComment$PDFAnnotationTextIconTypeHelp$PDFAnnotationTextIconTypeInsert$PDFAnnotationTextIconTypeKey$PDFAnnotationTextIconTypeNewParagraph$PDFAnnotationTextIconTypeNote$PDFAnnotationTextIconTypeParagraph$PDFAnnotationWidgetSubtypeButton$PDFAnnotationWidgetSubtypeChoice$PDFAnnotationWidgetSubtypeSignature$PDFAnnotationWidgetSubtypeText$PDFAppearanceCharacteristicsKeyBackgroundColor$PDFAppearanceCharacteristicsKeyBorderColor$PDFAppearanceCharacteristicsKeyCaption$PDFAppearanceCharacteristicsKeyDownCaption$PDFAppearanceCharacteristicsKeyRolloverCaption$PDFAppearanceCharacteristicsKeyRotation$PDFBorderKeyDashPattern$PDFBorderKeyLineWidth$PDFBorderKeyStyle$PDFDocumentAccessPermissionsOption$PDFDocumentAuthorAttribute$PDFDocumentBurnInAnnotationsOption$PDFDocumentCreationDateAttribute$PDFDocumentCreatorAttribute$PDFDocumentDidBeginFindNotification$PDFDocumentDidBeginPageFindNotification$PDFDocumentDidBeginPageWriteNotification$PDFDocumentDidBeginWriteNotification$PDFDocumentDidEndFindNotification$PDFDocumentDidEndPageFindNotification$PDFDocumentDidEndPageWriteNotification$PDFDocumentDidEndWriteNotification$PDFDocumentDidFindMatchNotification$PDFDocumentDidUnlockNotification$PDFDocumentFoundSelectionKey$PDFDocumentKeywordsAttribute$PDFDocumentModificationDateAttribute$PDFDocumentOptimizeImagesForScreenOption$PDFDocumentOwnerPasswordOption$PDFDocumentPageIndexKey$PDFDocumentProducerAttribute$PDFDocumentSaveImagesAsJPEGOption$PDFDocumentSaveTextFromOCROption$PDFDocumentSubjectAttribute$PDFDocumentTitleAttribute$PDFDocumentUserPasswordOption$PDFPageImageInitializationOptionCompressionQuality$PDFPageImageInitializationOptionMediaBox$PDFPageImageInitializationOptionRotation$PDFPageImageInitializationOptionUpscaleIfSmaller$PDFThumbnailViewDocumentEditedNotification$PDFViewAnnotationHitNotification$PDFViewAnnotationWillHitNotification$PDFViewChangedHistoryNotification$PDFViewCopyPermissionNotification$PDFViewDisplayBoxChangedNotification$PDFViewDisplayModeChangedNotification$PDFViewDocumentChangedNotification$PDFViewPageChangedNotification$PDFViewPrintPermissionNotification$PDFViewScaleChangedNotification$PDFViewSelectionChangedNotification$PDFViewVisiblePagesChangedNotification$kPDFAnnotationKey_Action$kPDFAnnotationKey_AdditionalActions$kPDFAnnotationKey_AppearanceDictionary$kPDFAnnotationKey_AppearanceState$kPDFAnnotationKey_AppleExtras$kPDFAnnotationKey_Border$kPDFAnnotationKey_BorderStyle$kPDFAnnotationKey_Color$kPDFAnnotationKey_Contents$kPDFAnnotationKey_Date$kPDFAnnotationKey_DefaultAppearance$kPDFAnnotationKey_Destination$kPDFAnnotationKey_Flags$kPDFAnnotationKey_HighlightingMode$kPDFAnnotationKey_IconName$kPDFAnnotationKey_Inklist$kPDFAnnotationKey_InteriorColor$kPDFAnnotationKey_LineEndingStyles$kPDFAnnotationKey_LinePoints$kPDFAnnotationKey_Name$kPDFAnnotationKey_Open$kPDFAnnotationKey_Page$kPDFAnnotationKey_Parent$kPDFAnnotationKey_Popup$kPDFAnnotationKey_QuadPoints$kPDFAnnotationKey_Quadding$kPDFAnnotationKey_Rect$kPDFAnnotationKey_Subtype$kPDFAnnotationKey_TextLabel$kPDFAnnotationKey_WidgetAppearanceDictionary$kPDFAnnotationKey_WidgetDefaultValue$kPDFAnnotationKey_WidgetFieldFlags$kPDFAnnotationKey_WidgetFieldType$kPDFAnnotationKey_WidgetMaxLen$kPDFAnnotationKey_WidgetOptions$kPDFAnnotationKey_WidgetTextLabelUI$kPDFAnnotationKey_WidgetValue$kPDFDestinationUnspecifiedValue@d$""" -enums = """$PDFAllowsCommenting@64$PDFAllowsContentAccessibility@32$PDFAllowsContentCopying@16$PDFAllowsDocumentAssembly@8$PDFAllowsDocumentChanges@4$PDFAllowsFormFieldEntry@128$PDFAllowsHighQualityPrinting@2$PDFAllowsLowQualityPrinting@1$kPDFActionNamedFind@8$kPDFActionNamedFirstPage@3$kPDFActionNamedGoBack@5$kPDFActionNamedGoForward@6$kPDFActionNamedGoToPage@7$kPDFActionNamedLastPage@4$kPDFActionNamedNextPage@1$kPDFActionNamedNone@0$kPDFActionNamedPreviousPage@2$kPDFActionNamedPrint@9$kPDFActionNamedZoomIn@10$kPDFActionNamedZoomOut@11$kPDFAnnotationArea@4$kPDFAnyArea@9223372036854775807$kPDFBorderStyleBeveled@2$kPDFBorderStyleDashed@1$kPDFBorderStyleInset@3$kPDFBorderStyleSolid@0$kPDFBorderStyleUnderline@4$kPDFControlArea@16$kPDFDisplayBoxArtBox@4$kPDFDisplayBoxBleedBox@2$kPDFDisplayBoxCropBox@1$kPDFDisplayBoxMediaBox@0$kPDFDisplayBoxTrimBox@3$kPDFDisplayDirectionHorizontal@1$kPDFDisplayDirectionVertical@0$kPDFDisplaySinglePage@0$kPDFDisplaySinglePageContinuous@1$kPDFDisplayTwoUp@2$kPDFDisplayTwoUpContinuous@3$kPDFDocumentPermissionsNone@0$kPDFDocumentPermissionsOwner@2$kPDFDocumentPermissionsUser@1$kPDFIconArea@64$kPDFImageArea@256$kPDFInterpolationQualityHigh@2$kPDFInterpolationQualityLow@1$kPDFInterpolationQualityNone@0$kPDFLineStyleCircle@2$kPDFLineStyleClosedArrow@5$kPDFLineStyleDiamond@3$kPDFLineStyleNone@0$kPDFLineStyleOpenArrow@4$kPDFLineStyleSquare@1$kPDFLinkArea@8$kPDFMarkupTypeHighlight@0$kPDFMarkupTypeRedact@3$kPDFMarkupTypeStrikeOut@1$kPDFMarkupTypeUnderline@2$kPDFNoArea@0$kPDFPageArea@1$kPDFPopupArea@128$kPDFPrintPageScaleDownToFit@2$kPDFPrintPageScaleNone@0$kPDFPrintPageScaleToFit@1$kPDFTextAnnotationIconComment@0$kPDFTextAnnotationIconHelp@3$kPDFTextAnnotationIconInsert@6$kPDFTextAnnotationIconKey@1$kPDFTextAnnotationIconNewParagraph@4$kPDFTextAnnotationIconNote@2$kPDFTextAnnotationIconParagraph@5$kPDFTextArea@2$kPDFTextFieldArea@32$kPDFWidgetCheckBoxControl@2$kPDFWidgetMixedState@-1$kPDFWidgetOffState@0$kPDFWidgetOnState@1$kPDFWidgetPushButtonControl@0$kPDFWidgetRadioButtonControl@1$kPDFWidgetUnknownControl@-1$""" -misc.update( - { - "PDFDocumentPermissions": NewType("PDFDocumentPermissions", int), - "PDFMarkupType": NewType("PDFMarkupType", int), - "PDFWidgetControlType": NewType("PDFWidgetControlType", int), - "PDFAccessPermissions": NewType("PDFAccessPermissions", int), - "PDFActionNamedName": NewType("PDFActionNamedName", int), - "PDFDisplayBox": NewType("PDFDisplayBox", int), - "PDFInterpolationQuality": NewType("PDFInterpolationQuality", int), - "PDFLineStyle": NewType("PDFLineStyle", int), - "PDFWidgetCellState": NewType("PDFWidgetCellState", int), - "PDFAreaOfInterest": NewType("PDFAreaOfInterest", int), - "PDFPrintScalingMode": NewType("PDFPrintScalingMode", int), - "PDFTextAnnotationIconType": NewType("PDFTextAnnotationIconType", int), - "PDFDisplayMode": NewType("PDFDisplayMode", int), - "PDFDisplayDirection": NewType("PDFDisplayDirection", int), - "PDFBorderStyle": NewType("PDFBorderStyle", int), - } -) -misc.update( - { - "PDFAnnotationTextIconType": NewType("PDFAnnotationTextIconType", str), - "PDFBorderKey": NewType("PDFBorderKey", str), - "PDFDocumentAttribute": NewType("PDFDocumentAttribute", str), - "PDFAnnotationKey": NewType("PDFAnnotationKey", str), - "PDFDocumentWriteOption": NewType("PDFDocumentWriteOption", str), - "PDFPageImageInitializationOption": NewType( - "PDFPageImageInitializationOption", str - ), - "PDFAnnotationSubtype": NewType("PDFAnnotationSubtype", str), - "PDFAppearanceCharacteristicsKey": NewType( - "PDFAppearanceCharacteristicsKey", str - ), - "PDFAnnotationHighlightingMode": NewType("PDFAnnotationHighlightingMode", str), - "PDFAnnotationWidgetSubtype": NewType("PDFAnnotationWidgetSubtype", str), - "PDFAnnotationLineEndingStyle": NewType("PDFAnnotationLineEndingStyle", str), - } -) -misc.update({}) -aliases = { - "PDFKitPlatformViewController": "NSViewController", - "PDFKitPlatformEvent": "NSEvent", - "PDFKitPlatformControl": "NSControl", - "PDFKitPlatformTextContentType": "NSTextContentType", - "PDFPointZero": "NSZeroPoint", - "PDFKitPlatformTextViewDelegate": "NSTextViewDelegate", - "PDFRectZero": "NSZeroRect", - "PDFKitPlatformButtonCell": "NSButtonCell", - "PDFEdgeInsets": "NSEdgeInsets", - "PDFKitPlatformButton": "NSButton", - "PDFKitTextContentType": "NSTextContentType", - "PDFSize": "NSSize", - "PDFRect": "NSRect", - "kPDFImageArea": "FLT_MX", - "PDFKitPlatformAccessibilityElement": "NSAccessibilityElement", - "PDFKitPlatformTextView": "NSTextView", - "PDFKitPlatformChoiceWidgetListView": "NSTableView", - "PDFKitPlatformView": "NSView", - "PDFSizeZero": "NSZeroSize", - "kPDFDestinationUnspecifiedValue": "FLT_MAX", - "PDFKitPlatformBezierPathElement": "NSBezierPathElement", - "PDFKitPlatformColor": "NSColor", - "PDFKitPlatformScrollView": "NSScrollView", - "PDFKitPlatformImageView": "NSImageView", - "PDFPoint": "NSPoint", - "PDFKitPlatformImage": "NSImage", - "PDFKitPlatformChoiceWidgetComboBoxView": "NSPopUpButton", - "PDFKitPlatformBezierPath": "NSBezierPath", - "PDFTrackingRunLoopMode": "NSEventTrackingRunLoopMode", - "PDFEdgeInsetsZero": "NSEdgeInsetsZero", - "PDFKitPlatformFontWeightRegular": "NSFontWeightRegular", - "PDFKitPlatformTextField": "NSTextField", - "PDFKitPlatformFont": "NSFont", - "PDFKitResponder": "NSResponder", -} -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r( - b"NSObject", - b"PDFViewOpenPDF:forRemoteGoToAction:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"PDFViewPerformFind:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"PDFViewPerformGoToPage:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"PDFViewPerformPrint:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"PDFViewPrintJobTitle:", - {"required": False, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"PDFViewWillChangeScaleFactor:toScale:", - { - "required": False, - "retval": {"type": b"d"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"d"}}, - }, - ) - r( - b"NSObject", - b"PDFViewWillClickOnLink:withURL:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"classForAnnotationClass:", - {"required": False, "retval": {"type": "#"}, "arguments": {2: {"type": b"#"}}}, - ) - r( - b"NSObject", - b"classForAnnotationType:", - {"required": False, "retval": {"type": "#"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"classForPage", {"required": False, "retval": {"type": "#"}}) - r( - b"NSObject", - b"didMatchString:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"documentDidBeginDocumentFind:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"documentDidBeginPageFind:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"documentDidEndDocumentFind:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"documentDidEndPageFind:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"documentDidFindMatch:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"documentDidUnlock:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"pdfView:overlayViewForPage:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pdfView:willDisplayOverlayView:forPage:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"pdfView:willEndDisplayingOverlayView:forPage:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r(b"PDFActionResetForm", b"fieldsIncludedAreCleared", {"retval": {"type": b"Z"}}) - r( - b"PDFActionResetForm", - b"setFieldsIncludedAreCleared:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"PDFAnnotation", b"allowsToggleToOff", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"hasAppearanceStream", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotation", b"hasComb", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"isActivatableTextField", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotation", b"isHighlighted", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotation", b"isListChoice", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotation", b"isMultiline", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotation", b"isOpen", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotation", b"isPasswordField", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"isReadOnly", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"isSignature", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"radiosInUnison", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"setAllowsToggleToOff:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"PDFAnnotation", - b"setBoolean:forAnnotationKey:", - {"retval": {"type": "Z"}, "arguments": {2: {"type": "Z"}}}, - ) - r(b"PDFAnnotation", b"setComb:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotation", b"setHighlighted:", {"arguments": {2: {"type": "Z"}}}) - r(b"PDFAnnotation", b"setListChoice:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotation", b"setMultiline:", {"arguments": {2: {"type": "Z"}}}) - r(b"PDFAnnotation", b"setOpen:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotation", b"setRadiosInUnison:", {"arguments": {2: {"type": "Z"}}}) - r(b"PDFAnnotation", b"setReadOnly:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotation", b"setRect:forAnnotationKey:", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"setShouldDisplay:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotation", b"setShouldPrint:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotation", b"setValue:forAnnotationKey:", {"retval": {"type": "Z"}}) - r(b"PDFAnnotation", b"shouldDisplay", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotation", b"shouldPrint", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotationButtonWidget", b"allowsToggleToOff", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotationButtonWidget", b"isHighlighted", {"retval": {"type": b"Z"}}) - r( - b"PDFAnnotationButtonWidget", - b"setAllowsToggleToOff:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"PDFAnnotationButtonWidget", - b"setHighlighted:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"PDFAnnotationChoiceWidget", b"isListChoice", {"retval": {"type": b"Z"}}) - r( - b"PDFAnnotationChoiceWidget", - b"setIsListChoice:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"PDFAnnotationLink", b"setHighlighted:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotationPopup", b"isOpen", {"retval": {"type": b"Z"}}) - r(b"PDFAnnotationPopup", b"setIsOpen:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFAnnotationStamp", b"isSignature", {"retval": {"type": "Z"}}) - r(b"PDFAnnotationTextWidget", b"isMultiline", {"retval": {"type": b"Z"}}) - r( - b"PDFAnnotationTextWidget", - b"setIsMultiline:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"PDFDocument", b"allowsCommenting", {"retval": {"type": "Z"}}) - r(b"PDFDocument", b"allowsContentAccessibility", {"retval": {"type": "Z"}}) - r(b"PDFDocument", b"allowsCopying", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"allowsDocumentAssembly", {"retval": {"type": "Z"}}) - r(b"PDFDocument", b"allowsDocumentChanges", {"retval": {"type": "Z"}}) - r(b"PDFDocument", b"allowsFormFieldEntry", {"retval": {"type": "Z"}}) - r(b"PDFDocument", b"allowsPrinting", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"isEncrypted", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"isFinding", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"isLocked", {"retval": {"type": b"Z"}}) - r( - b"PDFDocument", - b"printOperationForPrintInfo:scalingMode:autoRotate:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r(b"PDFDocument", b"unlockWithPassword:", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"writeToFile:", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"writeToFile:withOptions:", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"writeToURL:", {"retval": {"type": b"Z"}}) - r(b"PDFDocument", b"writeToURL:withOptions:", {"retval": {"type": b"Z"}}) - r(b"PDFOutline", b"isOpen", {"retval": {"type": b"Z"}}) - r(b"PDFOutline", b"setIsOpen:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFPage", b"displaysAnnotations", {"retval": {"type": b"Z"}}) - r(b"PDFPage", b"setDisplaysAnnotations:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFSelection", b"drawForPage:active:", {"arguments": {3: {"type": b"Z"}}}) - r( - b"PDFSelection", - b"drawForPage:withBox:active:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r(b"PDFThumbnailView", b"allowsDragging", {"retval": {"type": b"Z"}}) - r(b"PDFThumbnailView", b"allowsMultipleSelection", {"retval": {"type": b"Z"}}) - r(b"PDFThumbnailView", b"setAllowsDragging:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"PDFThumbnailView", - b"setAllowsMultipleSelection:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"PDFView", b"acceptsDraggedFiles", {"retval": {"type": "Z"}}) - r(b"PDFView", b"allowsDragging", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"autoScales", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canGoBack", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canGoForward", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canGoToFirstPage", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canGoToLastPage", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canGoToNextPage", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canGoToPreviousPage", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canZoomIn", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"canZoomOut", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"displaysAsBook", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"displaysPageBreaks", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"displaysRTL", {"retval": {"type": "Z"}}) - r(b"PDFView", b"enableDataDetectors", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"enablePageShadows:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"isInMarkupMode", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"pageForPoint:nearest:", {"arguments": {3: {"type": b"Z"}}}) - r(b"PDFView", b"pageShadowsEnabled", {"retval": {"type": b"Z"}}) - r(b"PDFView", b"printWithInfo:autoRotate:", {"arguments": {3: {"type": b"Z"}}}) - r( - b"PDFView", - b"printWithInfo:autoRotate:pageScaling:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"PDFView", b"setAcceptsDraggedFiles:", {"arguments": {2: {"type": "Z"}}}) - r(b"PDFView", b"setAllowsDragging:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"setAutoScales:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"setCurrentSelection:animate:", {"arguments": {3: {"type": b"Z"}}}) - r(b"PDFView", b"setDisplaysAsBook:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"setDisplaysPageBreaks:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"setDisplaysRTL:", {"arguments": {2: {"type": "Z"}}}) - r(b"PDFView", b"setEnableDataDetectors:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"setInMarkupMode:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"setShouldAntiAlias:", {"arguments": {2: {"type": b"Z"}}}) - r(b"PDFView", b"shouldAntiAlias", {"retval": {"type": b"Z"}}) -finally: - objc._updatingMetadata(False) -protocols = { - "PDFViewDelegate": objc.informal_protocol( - "PDFViewDelegate", - [ - objc.selector( - None, b"PDFViewWillClickOnLink:withURL:", b"v@:@@", isRequired=False - ), - objc.selector( - None, b"PDFViewOpenPDF:forRemoteGoToAction:", b"v@:@@", isRequired=False - ), - objc.selector(None, b"PDFViewPerformFind:", b"v@:@", isRequired=False), - objc.selector( - None, - b"PDFViewWillChangeScaleFactor:toScale:", - b"d@:@d", - isRequired=False, - ), - objc.selector(None, b"PDFViewPerformPrint:", b"v@:@", isRequired=False), - objc.selector(None, b"PDFViewPrintJobTitle:", b"@@:@", isRequired=False), - objc.selector(None, b"PDFViewPerformGoToPage:", b"v@:@", isRequired=False), - ], - ), - "PDFDocumentDelegate": objc.informal_protocol( - "PDFDocumentDelegate", - [ - objc.selector(None, b"classForPage", b"#@:", isRequired=False), - objc.selector(None, b"classForAnnotationClass:", b"#@:#", isRequired=False), - objc.selector(None, b"didMatchString:", b"v@:@", isRequired=False), - ], - ), - "PDFDocumentNotifications": objc.informal_protocol( - "PDFDocumentNotifications", - [ - objc.selector(None, b"documentDidFindMatch:", b"v@:@", isRequired=False), - objc.selector( - None, b"documentDidBeginPageFind:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"documentDidBeginDocumentFind:", b"v@:@", isRequired=False - ), - objc.selector(None, b"documentDidUnlock:", b"v@:@", isRequired=False), - objc.selector(None, b"documentDidEndPageFind:", b"v@:@", isRequired=False), - objc.selector( - None, b"documentDidEndDocumentFind:", b"v@:@", isRequired=False - ), - ], - ), -} -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__init__.py deleted file mode 100644 index bb9c89c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Python mapping for the QuartzComposer framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import Foundation - from Quartz import CoreGraphics - import objc - from . import _metadata - - if objc.macos_available(14, 0): - identifier = "com.apple.quartzframework" - elif objc.macos_available(13, 0): - identifier = "com.apple.Quartz" - else: - identifier = "com.apple.quartzframework" - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.QuartzComposer", - frameworkIdentifier=identifier, - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/Quartz.framework" - ), - globals_dict=globals(), - inline_list=None, - parents=( - CoreGraphics, - Foundation, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.QuartzComposer._metadata"] - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index e2cd884..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index e47f409..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/_metadata.py deleted file mode 100644 index a2e1fef..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzComposer/_metadata.py +++ /dev/null @@ -1,432 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 1 14:05:52 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -constants = """$QCCompositionAttributeBuiltInKey$QCCompositionAttributeCategoryKey$QCCompositionAttributeCopyrightKey$QCCompositionAttributeDescriptionKey$QCCompositionAttributeHasConsumersKey$QCCompositionAttributeIsTimeDependentKey$QCCompositionAttributeNameKey$QCCompositionCategoryDistortion$QCCompositionCategoryStylize$QCCompositionCategoryUtility$QCCompositionInputAudioPeakKey$QCCompositionInputAudioSpectrumKey$QCCompositionInputDestinationImageKey$QCCompositionInputImageKey$QCCompositionInputPaceKey$QCCompositionInputPreviewModeKey$QCCompositionInputPrimaryColorKey$QCCompositionInputRSSArticleDurationKey$QCCompositionInputRSSFeedURLKey$QCCompositionInputScreenImageKey$QCCompositionInputSecondaryColorKey$QCCompositionInputSourceImageKey$QCCompositionInputTrackInfoKey$QCCompositionInputTrackPositionKey$QCCompositionInputTrackSignalKey$QCCompositionInputXKey$QCCompositionInputYKey$QCCompositionOutputImageKey$QCCompositionOutputWebPageURLKey$QCCompositionPickerPanelDidSelectCompositionNotification$QCCompositionPickerViewDidSelectCompositionNotification$QCCompositionProtocolGraphicAnimation$QCCompositionProtocolGraphicTransition$QCCompositionProtocolImageFilter$QCCompositionProtocolMusicVisualizer$QCCompositionProtocolRSSVisualizer$QCCompositionProtocolScreenSaver$QCCompositionRepositoryDidUpdateNotification$QCPlugInAttributeCategoriesKey$QCPlugInAttributeCopyrightKey$QCPlugInAttributeDescriptionKey$QCPlugInAttributeExamplesKey$QCPlugInAttributeNameKey$QCPlugInExecutionArgumentEventKey$QCPlugInExecutionArgumentMouseLocationKey$QCPlugInPixelFormatARGB8$QCPlugInPixelFormatBGRA8$QCPlugInPixelFormatI8$QCPlugInPixelFormatIf$QCPlugInPixelFormatRGBAf$QCPortAttributeDefaultValueKey$QCPortAttributeMaximumValueKey$QCPortAttributeMenuItemsKey$QCPortAttributeMinimumValueKey$QCPortAttributeNameKey$QCPortAttributeTypeKey$QCPortTypeBoolean$QCPortTypeColor$QCPortTypeImage$QCPortTypeIndex$QCPortTypeNumber$QCPortTypeString$QCPortTypeStructure$QCRendererEventKey$QCRendererMouseLocationKey$QCViewDidStartRenderingNotification$QCViewDidStopRenderingNotification$""" -enums = """$kQCPlugInExecutionModeConsumer@3$kQCPlugInExecutionModeProcessor@2$kQCPlugInExecutionModeProvider@1$kQCPlugInTimeModeIdle@1$kQCPlugInTimeModeNone@0$kQCPlugInTimeModeTimeBase@2$""" -misc.update( - { - "QCPlugInExecutionMode": NewType("QCPlugInExecutionMode", int), - "QCPlugInTimeMode": NewType("QCPlugInTimeMode", int), - } -) -misc.update({}) -misc.update({}) -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r( - b"NSObject", - b"CGLContextObj", - {"required": True, "retval": {"type": b"^{_CGLContextObject=}"}}, - ) - r(b"NSObject", b"attributes", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"bindTextureRepresentationToCGLContext:textureUnit:normalizeCoordinates:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"^{_CGLContextObject=}"}, - 3: {"type": b"I"}, - 4: {"type": b"Z"}, - }, - }, - ) - r( - b"NSObject", - b"bounds", - {"required": True, "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSObject", b"bufferBaseAddress", {"required": True, "retval": {"type": b"^v"}}) - r(b"NSObject", b"bufferBytesPerRow", {"required": True, "retval": {"type": b"Q"}}) - r( - b"NSObject", - b"bufferColorSpace", - {"required": True, "retval": {"type": b"^{CGColorSpace=}"}}, - ) - r(b"NSObject", b"bufferPixelFormat", {"required": True, "retval": {"type": b"@"}}) - r(b"NSObject", b"bufferPixelsHigh", {"required": True, "retval": {"type": b"Q"}}) - r(b"NSObject", b"bufferPixelsWide", {"required": True, "retval": {"type": b"Q"}}) - r( - b"NSObject", - b"canRenderWithCGLContext:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"^{_CGLContextObject=}"}}, - }, - ) - r( - b"NSObject", - b"colorSpace", - {"required": True, "retval": {"type": b"^{CGColorSpace=}"}}, - ) - r( - b"NSObject", - b"compositionParameterView:didChangeParameterWithKey:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"compositionParameterView:shouldDisplayParameterWithKey:attributes:", - { - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"compositionPickerView:didSelectComposition:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"compositionPickerViewDidStartAnimating:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"compositionPickerViewWillStopAnimating:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"compositionURL", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"copyRenderedTextureForCGLContext:pixelFormat:bounds:isFlipped:", - { - "required": False, - "retval": {"type": b"I"}, - "arguments": { - 2: {"type": b"^{_CGLContextObject=}"}, - 3: {"type": b"@"}, - 4: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - 5: {"type": b"^Z"}, - }, - }, - ) - r( - b"NSObject", - b"imageBounds", - {"required": True, "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r( - b"NSObject", - b"imageColorSpace", - {"required": True, "retval": {"type": b"^{CGColorSpace=}"}}, - ) - r(b"NSObject", b"inputKeys", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"lockBufferRepresentationWithPixelFormat:colorSpace:forBounds:", - { - "required": True, - "retval": {"type": b"Z"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"^{CGColorSpace=}"}, - 4: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"lockTextureRepresentationWithColorSpace:forBounds:", - { - "required": True, - "retval": {"type": b"Z"}, - "arguments": { - 2: {"type": b"^{CGColorSpace=}"}, - 3: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"logMessage:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}}, - "variadic": True, - }, - ) - r( - b"NSObject", - b"outputImageProviderFromBufferWithPixelFormat:pixelsWide:pixelsHigh:baseAddress:bytesPerRow:releaseCallback:releaseContext:colorSpace:shouldColorMatch:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"Q"}, - 4: {"type": b"Q"}, - 5: {"type": b"^v"}, - 6: {"type": b"Q"}, - 7: {"type": b"^?"}, - 8: {"type": b"^v"}, - 9: {"type": b"^{CGColorSpace=}"}, - 10: {"type": b"Z"}, - }, - }, - ) - r( - b"NSObject", - b"outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"Q"}, - 4: {"type": b"Q"}, - 5: {"type": b"I"}, - 6: {"type": b"Z"}, - 7: {"type": b"^?"}, - 8: {"type": b"^v"}, - 9: {"type": b"^{CGColorSpace=}"}, - 10: {"type": b"Z"}, - }, - }, - ) - r(b"NSObject", b"outputKeys", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"propertyListFromInputValues", - {"required": True, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"releaseRenderedTexture:forCGLContext:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"I"}, 3: {"type": b"^{_CGLContextObject=}"}}, - }, - ) - r( - b"NSObject", - b"renderToBuffer:withBytesPerRow:pixelFormat:forBounds:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": { - 2: {"type": b"^v"}, - 3: {"type": b"Q"}, - 4: {"type": b"@"}, - 5: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"renderWithCGLContext:forBounds:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": { - 2: {"type": b"^{_CGLContextObject=}"}, - 3: {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - }, - }, - ) - r( - b"NSObject", - b"setInputValuesWithPropertyList:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setValue:forInputKey:", - { - "required": True, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"shouldColorMatch", {"required": False, "retval": {"type": b"Z"}}) - r( - b"NSObject", - b"supportedBufferPixelFormats", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"supportedRenderedTexturePixelFormats", - {"required": False, "retval": {"type": b"@"}}, - ) - r( - b"NSObject", - b"textureColorSpace", - {"required": True, "retval": {"type": b"^{CGColorSpace=}"}}, - ) - r(b"NSObject", b"textureFlipped", {"required": True, "retval": {"type": b"Z"}}) - r(b"NSObject", b"textureMatrix", {"required": True, "retval": {"type": b"^f"}}) - r(b"NSObject", b"textureName", {"required": True, "retval": {"type": b"I"}}) - r(b"NSObject", b"texturePixelsHigh", {"required": True, "retval": {"type": b"Q"}}) - r(b"NSObject", b"texturePixelsWide", {"required": True, "retval": {"type": b"Q"}}) - r(b"NSObject", b"textureTarget", {"required": True, "retval": {"type": b"I"}}) - r( - b"NSObject", - b"unbindTextureRepresentationFromCGLContext:textureUnit:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"^{_CGLContextObject=}"}, 3: {"type": b"I"}}, - }, - ) - r( - b"NSObject", - b"unlockBufferRepresentation", - {"required": True, "retval": {"type": b"v"}}, - ) - r( - b"NSObject", - b"unlockTextureRepresentation", - {"required": True, "retval": {"type": b"v"}}, - ) - r(b"NSObject", b"userInfo", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"valueForInputKey:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valueForOutputKey:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"valueForOutputKey:ofType:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"QCCompositionParameterView", b"drawsBackground", {"retval": {"type": b"Z"}}) - r(b"QCCompositionParameterView", b"hasParameters", {"retval": {"type": b"Z"}}) - r( - b"QCCompositionParameterView", - b"setDrawsBackground:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"QCCompositionPickerView", b"allowsEmptySelection", {"retval": {"type": b"Z"}}) - r(b"QCCompositionPickerView", b"drawsBackground", {"retval": {"type": b"Z"}}) - r(b"QCCompositionPickerView", b"isAnimating", {"retval": {"type": b"Z"}}) - r( - b"QCCompositionPickerView", - b"setAllowsEmptySelection:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"QCCompositionPickerView", - b"setDrawsBackground:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r( - b"QCCompositionPickerView", - b"setShowsCompositionNames:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"QCCompositionPickerView", b"showsCompositionNames", {"retval": {"type": b"Z"}}) - r(b"QCPlugIn", b"createViewController", {"retval": {"already_retained": True}}) - r(b"QCPlugIn", b"didValueForInputKeyChange:", {"retval": {"type": b"Z"}}) - r(b"QCPlugIn", b"execute:atTime:withArguments:", {"retval": {"type": b"Z"}}) - r(b"QCPlugIn", b"loadPlugInAtPath:", {"retval": {"type": b"Z"}}) - r(b"QCPlugIn", b"setValue:forOutputKey:", {"retval": {"type": b"Z"}}) - r(b"QCPlugIn", b"startExecution:", {"retval": {"type": b"Z"}}) - r(b"QCRenderer", b"renderAtTime:arguments:", {"retval": {"type": b"Z"}}) - r(b"QCView", b"autostartsRendering", {"retval": {"type": b"Z"}}) - r(b"QCView", b"isPausedRendering", {"retval": {"type": b"Z"}}) - r(b"QCView", b"isRendering", {"retval": {"type": b"Z"}}) - r(b"QCView", b"loadComposition:", {"retval": {"type": b"Z"}}) - r(b"QCView", b"loadCompositionFromFile:", {"retval": {"type": b"Z"}}) - r(b"QCView", b"renderAtTime:arguments:", {"retval": {"type": b"Z"}}) - r(b"QCView", b"setAutostartsRendering:", {"arguments": {2: {"type": b"Z"}}}) - r(b"QCView", b"startRendering", {"retval": {"type": b"Z"}}) - r( - b"null", - b"compositionParameterView:shouldDisplayParameterWithKey:attributes:", - {"retval": {"type": b"Z"}}, - ) - r(b"null", b"didValueForInputKeyChange:", {"retval": {"type": b"Z"}}) - r(b"null", b"loadPlugInAtPath:", {"retval": {"type": b"Z"}}) - r(b"null", b"setValue:forOutputKey:", {"retval": {"type": b"Z"}}) -finally: - objc._updatingMetadata(False) -protocols = { - "QCCompositionPickerViewDelegate": objc.informal_protocol( - "QCCompositionPickerViewDelegate", - [ - objc.selector( - None, - b"compositionPickerView:didSelectComposition:", - b"v@:@@", - isRequired=False, - ), - objc.selector( - None, - b"compositionPickerViewWillStopAnimating:", - b"v@:@", - isRequired=False, - ), - objc.selector( - None, - b"compositionPickerViewDidStartAnimating:", - b"v@:@", - isRequired=False, - ), - ], - ), - "QCCompositionParameterViewDelegate": objc.informal_protocol( - "QCCompositionParameterViewDelegate", - [ - objc.selector( - None, - b"compositionParameterView:didChangeParameterWithKey:", - b"v@:@@", - isRequired=False, - ), - objc.selector( - None, - b"compositionParameterView:shouldDisplayParameterWithKey:attributes:", - b"Z@:@@@", - isRequired=False, - ), - ], - ), -} -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__init__.py deleted file mode 100644 index ad9bc42..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__init__.py +++ /dev/null @@ -1,78 +0,0 @@ -""" -Python mapping for the QuartzCore framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import Foundation - import objc - from . import _metadata, _quartzcore - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.QuartzCore", - frameworkIdentifier="com.apple.QuartzCore", - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/QuartzCore.framework" - ), - globals_dict=globals(), - inline_list=None, - parents=( - _quartzcore, - Foundation, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.QuartzCore._metadata"] - - def CIVector__getitem__(self, idx): - if isinstance(idx, slice): - start, stop, step = idx.indices(self.count()) - return [self[i] for i in range(start, stop, step)] - - if idx < 0: - new = self.count() + idx - if new < 0: - raise IndexError(idx) - idx = new - - return self.valueAtIndex_(idx) - - objc.addConvenienceForClass( - "CIVector", - (("__len__", lambda self: self.count()), ("__getitem__", CIVector__getitem__)), - ) - - objc.addConvenienceForClass( - "CIContext", - ( - ("__getitem__", lambda self, key: self.objectForKey_(key)), - ( - "__setitem__", - lambda self, key, value: self.setObject_forKey_(value, key), - ), - ), - ) - objc.addConvenienceForClass( - "CIContextImpl", - ( - ("__getitem__", lambda self, key: self.objectForKey_(key)), - ( - "__setitem__", - lambda self, key, value: self.setObject_forKey_(value, key), - ), - ), - ) - - objc.addConvenienceForBasicSequence("QCStructure", True) - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 19048c8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index 287afcd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/_metadata.py deleted file mode 100644 index c8c6e95..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/_metadata.py +++ /dev/null @@ -1,1139 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 22 13:51:30 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -misc.update( - { - "CATransform3D": objc.createStructType( - "Quartz.QuartzCore.CATransform3D", - b"{CATransform3D=dddddddddddddddd}", - [ - "m11", - "m12", - "m13", - "m14", - "m21", - "m22", - "m23", - "m24", - "m31", - "m32", - "m33", - "m34", - "m41", - "m42", - "m43", - "m44", - ], - ), - "CAFrameRateRange": objc.createStructType( - "Quartz.QuartzCore.CAFrameRateRange", - b"{CAFrameRateRange=fff}", - ["minimum", "maximum", "preferred"], - ), - } -) -constants = """$CAFrameRateRangeDefault@{CAFrameRateRange=fff}$CATransform3DIdentity@{CATransform3D=dddddddddddddddd}$CIDetectorAccuracy$CIDetectorAccuracyHigh$CIDetectorAccuracyLow$CIDetectorAspectRatio$CIDetectorEyeBlink$CIDetectorFocalLength$CIDetectorImageOrientation$CIDetectorMaxFeatureCount$CIDetectorMinFeatureSize$CIDetectorNumberOfAngles$CIDetectorReturnSubFeatures$CIDetectorSmile$CIDetectorTracking$CIDetectorTypeFace$CIDetectorTypeQRCode$CIDetectorTypeRectangle$CIDetectorTypeText$CIFeatureTypeFace$CIFeatureTypeQRCode$CIFeatureTypeRectangle$CIFeatureTypeText$CIRAWDecoderVersion6$CIRAWDecoderVersion6DNG$CIRAWDecoderVersion7$CIRAWDecoderVersion7DNG$CIRAWDecoderVersion8$CIRAWDecoderVersion8DNG$CIRAWDecoderVersionNone$kCAAlignmentCenter$kCAAlignmentJustified$kCAAlignmentLeft$kCAAlignmentNatural$kCAAlignmentRight$kCAAnimationCubic$kCAAnimationCubicPaced$kCAAnimationDiscrete$kCAAnimationLinear$kCAAnimationPaced$kCAAnimationRotateAuto$kCAAnimationRotateAutoReverse$kCAContentsFormatGray8Uint$kCAContentsFormatRGBA16Float$kCAContentsFormatRGBA8Uint$kCACornerCurveCircular$kCACornerCurveContinuous$kCAEmitterBehaviorAlignToMotion$kCAEmitterBehaviorAttractor$kCAEmitterBehaviorColorOverLife$kCAEmitterBehaviorDrag$kCAEmitterBehaviorLight$kCAEmitterBehaviorSimpleAttractor$kCAEmitterBehaviorValueOverLife$kCAEmitterBehaviorWave$kCAEmitterLayerAdditive$kCAEmitterLayerBackToFront$kCAEmitterLayerCircle$kCAEmitterLayerCuboid$kCAEmitterLayerLine$kCAEmitterLayerOldestFirst$kCAEmitterLayerOldestLast$kCAEmitterLayerOutline$kCAEmitterLayerPoint$kCAEmitterLayerPoints$kCAEmitterLayerRectangle$kCAEmitterLayerSphere$kCAEmitterLayerSurface$kCAEmitterLayerUnordered$kCAEmitterLayerVolume$kCAFillModeBackwards$kCAFillModeBoth$kCAFillModeForwards$kCAFillModeFrozen$kCAFillModeRemoved$kCAFillRuleEvenOdd$kCAFillRuleNonZero$kCAFilterLinear$kCAFilterNearest$kCAFilterTrilinear$kCAGradientLayerAxial$kCAGradientLayerConic$kCAGradientLayerRadial$kCAGravityBottom$kCAGravityBottomLeft$kCAGravityBottomRight$kCAGravityCenter$kCAGravityLeft$kCAGravityResize$kCAGravityResizeAspect$kCAGravityResizeAspectFill$kCAGravityRight$kCAGravityTop$kCAGravityTopLeft$kCAGravityTopRight$kCALineCapButt$kCALineCapRound$kCALineCapSquare$kCALineJoinBevel$kCALineJoinMiter$kCALineJoinRound$kCAMediaTimingFunctionDefault$kCAMediaTimingFunctionEaseIn$kCAMediaTimingFunctionEaseInEaseOut$kCAMediaTimingFunctionEaseOut$kCAMediaTimingFunctionLinear$kCAOnOrderIn$kCAOnOrderOut$kCARendererColorSpace$kCARendererMetalCommandQueue$kCAScrollBoth$kCAScrollHorizontally$kCAScrollNone$kCAScrollVertically$kCATransactionAnimationDuration$kCATransactionAnimationTimingFunction$kCATransactionCompletionBlock$kCATransactionDisableActions$kCATransition$kCATransitionFade$kCATransitionFromBottom$kCATransitionFromLeft$kCATransitionFromRight$kCATransitionFromTop$kCATransitionMoveIn$kCATransitionPush$kCATransitionReveal$kCATruncationEnd$kCATruncationMiddle$kCATruncationNone$kCATruncationStart$kCAValueFunctionRotateX$kCAValueFunctionRotateY$kCAValueFunctionRotateZ$kCAValueFunctionScale$kCAValueFunctionScaleX$kCAValueFunctionScaleY$kCAValueFunctionScaleZ$kCAValueFunctionTranslate$kCAValueFunctionTranslateX$kCAValueFunctionTranslateY$kCAValueFunctionTranslateZ$kCIActiveKeys$kCIApplyOptionColorSpace$kCIApplyOptionDefinition$kCIApplyOptionExtent$kCIApplyOptionUserInfo$kCIAttributeClass$kCIAttributeDefault$kCIAttributeDescription$kCIAttributeDisplayName$kCIAttributeFilterAvailable_Mac$kCIAttributeFilterAvailable_iOS$kCIAttributeFilterCategories$kCIAttributeFilterDisplayName$kCIAttributeFilterName$kCIAttributeIdentity$kCIAttributeMax$kCIAttributeMin$kCIAttributeName$kCIAttributeReferenceDocumentation$kCIAttributeSliderMax$kCIAttributeSliderMin$kCIAttributeType$kCIAttributeTypeAngle$kCIAttributeTypeBoolean$kCIAttributeTypeColor$kCIAttributeTypeCount$kCIAttributeTypeDistance$kCIAttributeTypeGradient$kCIAttributeTypeImage$kCIAttributeTypeInteger$kCIAttributeTypeOffset$kCIAttributeTypeOpaqueColor$kCIAttributeTypePosition$kCIAttributeTypePosition3$kCIAttributeTypeRectangle$kCIAttributeTypeScalar$kCIAttributeTypeTime$kCIAttributeTypeTransform$kCICategoryBlur$kCICategoryBuiltIn$kCICategoryColorAdjustment$kCICategoryColorEffect$kCICategoryCompositeOperation$kCICategoryDistortionEffect$kCICategoryFilterGenerator$kCICategoryGenerator$kCICategoryGeometryAdjustment$kCICategoryGradient$kCICategoryHalftoneEffect$kCICategoryHighDynamicRange$kCICategoryInterlaced$kCICategoryNonSquarePixels$kCICategoryReduction$kCICategorySharpen$kCICategoryStillImage$kCICategoryStylize$kCICategoryTileEffect$kCICategoryTransition$kCICategoryVideo$kCIContextAllowLowPower$kCIContextCacheIntermediates$kCIContextHighQualityDownsample$kCIContextMemoryLimit$kCIContextName$kCIContextOutputColorSpace$kCIContextOutputPremultiplied$kCIContextPriorityRequestLow$kCIContextUseSoftwareRenderer$kCIContextWorkingColorSpace$kCIContextWorkingFormat$kCIFilterGeneratorExportedKey$kCIFilterGeneratorExportedKeyName$kCIFilterGeneratorExportedKeyTargetObject$kCIFormatA16@i$kCIFormatA8@i$kCIFormatABGR8@i$kCIFormatARGB8@i$kCIFormatAf@i$kCIFormatAh@i$kCIFormatBGRA8@i$kCIFormatL16@i$kCIFormatL8@i$kCIFormatLA16@i$kCIFormatLA8@i$kCIFormatLAf@i$kCIFormatLAh@i$kCIFormatLf@i$kCIFormatLh@i$kCIFormatR16@i$kCIFormatR8@i$kCIFormatRG16@i$kCIFormatRG8@i$kCIFormatRGB10@i$kCIFormatRGBA16@i$kCIFormatRGBA8@i$kCIFormatRGBAf@i$kCIFormatRGBAh@i$kCIFormatRGBX16@i$kCIFormatRGBXf@i$kCIFormatRGBXh@i$kCIFormatRGf@i$kCIFormatRGh@i$kCIFormatRf@i$kCIFormatRh@i$kCIImageApplyOrientationProperty$kCIImageAutoAdjustCrop$kCIImageAutoAdjustEnhance$kCIImageAutoAdjustFeatures$kCIImageAutoAdjustLevel$kCIImageAutoAdjustRedEye$kCIImageAuxiliaryDepth$kCIImageAuxiliaryDisparity$kCIImageAuxiliaryHDRGainMap$kCIImageAuxiliaryPortraitEffectsMatte$kCIImageAuxiliarySemanticSegmentationHairMatte$kCIImageAuxiliarySemanticSegmentationSkinMatte$kCIImageAuxiliarySemanticSegmentationTeethMatte$kCIImageCacheImmediately$kCIImageColorSpace$kCIImageExpandToHDR$kCIImageNearestSampling$kCIImageProperties$kCIImageProviderTileSize$kCIImageProviderUserInfo$kCIImageRepresentationAVDepthData$kCIImageRepresentationAVPortraitEffectsMatte$kCIImageRepresentationAVSemanticSegmentationMattes$kCIImageRepresentationDepthImage$kCIImageRepresentationDisparityImage$kCIImageRepresentationPortraitEffectsMatteImage$kCIImageRepresentationSemanticSegmentationHairMatteImage$kCIImageRepresentationSemanticSegmentationSkinMatteImage$kCIImageRepresentationSemanticSegmentationTeethMatteImage$kCIImageTextureFormat$kCIImageTextureTarget$kCIInputAllowDraftModeKey$kCIInputAmountKey$kCIInputAngleKey$kCIInputAspectRatioKey$kCIInputBackgroundImageKey$kCIInputBaselineExposureKey$kCIInputBiasKey$kCIInputBoostKey$kCIInputBoostShadowAmountKey$kCIInputBrightnessKey$kCIInputCenterKey$kCIInputColorKey$kCIInputColorNoiseReductionAmountKey$kCIInputContrastKey$kCIInputDecoderVersionKey$kCIInputDepthImageKey$kCIInputDisableGamutMapKey$kCIInputDisparityImageKey$kCIInputEVKey$kCIInputEnableChromaticNoiseTrackingKey$kCIInputEnableEDRModeKey$kCIInputEnableSharpeningKey$kCIInputEnableVendorLensCorrectionKey$kCIInputExtentKey$kCIInputGradientImageKey$kCIInputIgnoreImageOrientationKey$kCIInputImageKey$kCIInputImageOrientationKey$kCIInputIntensityKey$kCIInputLinearSpaceFilter$kCIInputLuminanceNoiseReductionAmountKey$kCIInputMaskImageKey$kCIInputMatteImageKey$kCIInputMoireAmountKey$kCIInputNeutralChromaticityXKey$kCIInputNeutralChromaticityYKey$kCIInputNeutralLocationKey$kCIInputNeutralTemperatureKey$kCIInputNeutralTintKey$kCIInputNoiseReductionAmountKey$kCIInputNoiseReductionContrastAmountKey$kCIInputNoiseReductionDetailAmountKey$kCIInputNoiseReductionSharpnessAmountKey$kCIInputRadiusKey$kCIInputRefractionKey$kCIInputSaturationKey$kCIInputScaleFactorKey$kCIInputScaleKey$kCIInputShadingImageKey$kCIInputSharpnessKey$kCIInputTargetImageKey$kCIInputTimeKey$kCIInputTransformKey$kCIInputVersionKey$kCIInputWeightsKey$kCIInputWidthKey$kCIOutputImageKey$kCIOutputNativeSizeKey$kCISamplerAffineMatrix$kCISamplerColorSpace$kCISamplerFilterLinear$kCISamplerFilterMode$kCISamplerFilterNearest$kCISamplerWrapBlack$kCISamplerWrapClamp$kCISamplerWrapMode$kCISupportedDecoderVersionsKey$kCIUIParameterSet$kCIUISetAdvanced$kCIUISetBasic$kCIUISetDevelopment$kCIUISetIntermediate$""" -enums = """$CA_TEST@0$CA_WARN_DEPRECATED@1$CIDataMatrixCodeECCVersion000@0$CIDataMatrixCodeECCVersion050@50$CIDataMatrixCodeECCVersion080@80$CIDataMatrixCodeECCVersion100@100$CIDataMatrixCodeECCVersion140@140$CIDataMatrixCodeECCVersion200@200$CIQRCodeErrorCorrectionLevelH@72$CIQRCodeErrorCorrectionLevelL@76$CIQRCodeErrorCorrectionLevelM@77$CIQRCodeErrorCorrectionLevelQ@81$CIRenderDestinationAlphaNone@0$CIRenderDestinationAlphaPremultiplied@1$CIRenderDestinationAlphaUnpremultiplied@2$kCAConstraintHeight@7$kCAConstraintMaxX@2$kCAConstraintMaxY@6$kCAConstraintMidX@1$kCAConstraintMidY@5$kCAConstraintMinX@0$kCAConstraintMinY@4$kCAConstraintWidth@3$kCALayerBottomEdge@4$kCALayerHeightSizable@16$kCALayerLeftEdge@1$kCALayerMaxXMargin@4$kCALayerMaxXMaxYCorner@8$kCALayerMaxXMinYCorner@2$kCALayerMaxYMargin@32$kCALayerMinXMargin@1$kCALayerMinXMaxYCorner@4$kCALayerMinXMinYCorner@1$kCALayerMinYMargin@8$kCALayerNotSizable@0$kCALayerRightEdge@2$kCALayerTopEdge@8$kCALayerWidthSizable@2$""" -misc.update( - { - "CAEdgeAntialiasingMask": NewType("CAEdgeAntialiasingMask", int), - "CAAutoresizingMask": NewType("CAAutoresizingMask", int), - "CAConstraintAttribute": NewType("CAConstraintAttribute", int), - "CACornerMask": NewType("CACornerMask", int), - } -) -misc.update( - { - "CAEmitterLayerRenderMode": NewType("CAEmitterLayerRenderMode", str), - "CATransitionType": NewType("CATransitionType", str), - "CALayerContentsFilter": NewType("CALayerContentsFilter", str), - "CAEmitterLayerEmitterMode": NewType("CAEmitterLayerEmitterMode", str), - "CAEmitterLayerEmitterShape": NewType("CAEmitterLayerEmitterShape", str), - "CAValueFunctionName": NewType("CAValueFunctionName", str), - "CAShapeLayerFillRule": NewType("CAShapeLayerFillRule", str), - "CAAnimationRotationMode": NewType("CAAnimationRotationMode", str), - "CAShapeLayerLineCap": NewType("CAShapeLayerLineCap", str), - "CALayerContentsGravity": NewType("CALayerContentsGravity", str), - "CATextLayerTruncationMode": NewType("CATextLayerTruncationMode", str), - "CAMediaTimingFunctionName": NewType("CAMediaTimingFunctionName", str), - "CALayerCornerCurve": NewType("CALayerCornerCurve", str), - "CAGradientLayerType": NewType("CAGradientLayerType", str), - "CATransitionSubtype": NewType("CATransitionSubtype", str), - "CAAnimationCalculationMode": NewType("CAAnimationCalculationMode", str), - "CAMediaTimingFillMode": NewType("CAMediaTimingFillMode", str), - "CAShapeLayerLineJoin": NewType("CAShapeLayerLineJoin", str), - "CAScrollLayerScrollMode": NewType("CAScrollLayerScrollMode", str), - "CATextLayerAlignmentMode": NewType("CATextLayerAlignmentMode", str), - "CALayerContentsFormat": NewType("CALayerContentsFormat", str), - } -) -misc.update({}) -functions = { - "CATransform3DIsAffine": (b"B{CATransform3D=dddddddddddddddd}",), - "CATransform3DInvert": ( - b"{CATransform3D=dddddddddddddddd}{CATransform3D=dddddddddddddddd}", - ), - "CATransform3DIsIdentity": (b"B{CATransform3D=dddddddddddddddd}",), - "CAFrameRateRangeMake": (b"{CAFrameRateRange=fff}fff",), - "CATransform3DMakeScale": (b"{CATransform3D=dddddddddddddddd}ddd",), - "CATransform3DTranslate": ( - b"{CATransform3D=dddddddddddddddd}{CATransform3D=dddddddddddddddd}ddd", - ), - "CATransform3DEqualToTransform": ( - b"B{CATransform3D=dddddddddddddddd}{CATransform3D=dddddddddddddddd}", - ), - "CATransform3DRotate": ( - b"{CATransform3D=dddddddddddddddd}{CATransform3D=dddddddddddddddd}dddd", - ), - "CACurrentMediaTime": (b"d",), - "CATransform3DMakeRotation": (b"{CATransform3D=dddddddddddddddd}dddd",), - "CAFrameRateRangeIsEqualToRange": ( - b"B{CAFrameRateRange=fff}{CAFrameRateRange=fff}", - ), - "CATransform3DConcat": ( - b"{CATransform3D=dddddddddddddddd}{CATransform3D=dddddddddddddddd}{CATransform3D=dddddddddddddddd}", - ), - "CATransform3DScale": ( - b"{CATransform3D=dddddddddddddddd}{CATransform3D=dddddddddddddddd}ddd", - ), - "CATransform3DMakeTranslation": (b"{CATransform3D=dddddddddddddddd}ddd",), - "CATransform3DGetAffineTransform": ( - b"{CGAffineTransform=dddddd}{CATransform3D=dddddddddddddddd}", - ), - "CATransform3DMakeAffineTransform": ( - b"{CATransform3D=dddddddddddddddd}{CGAffineTransform=dddddd}", - ), -} -aliases = {"CA_TESTABLE_CLASS": "CA_HIDDEN", "CA_TESTABLE": "CA_HIDDEN"} -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r(b"CAAnimation", b"isRemovedOnCompletion", {"retval": {"type": b"Z"}}) - r(b"CAAnimation", b"setEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"CAAnimation", b"setRemovedOnCompletion:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CAAnimation", b"shouldArchiveValueForKey:", {"retval": {"type": b"Z"}}) - r( - b"CADisplayLink", - b"displayLinkWithTarget:selector", - {"arguments": {3: {"sel_of_type": b"v@:@"}}}, - ) - r(b"CADisplayLink", b"isPaused", {"retval": {"type": b"Z"}}) - r(b"CADisplayLink", b"setPaused:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CAEDRMetadata", b"isAvailable", {"retval": {"type": b"Z"}}) - r(b"CAEmitterBehavior", b"isEnabled", {"retval": {"type": b"Z"}}) - r(b"CAEmitterBehavior", b"setEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CAEmitterCell", b"isEnabled", {"retval": {"type": b"Z"}}) - r(b"CAEmitterCell", b"setEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CAEmitterCell", b"shouldArchiveValueForKey:", {"retval": {"type": b"Z"}}) - r(b"CAEmitterLayer", b"preservesDepth", {"retval": {"type": b"Z"}}) - r(b"CAEmitterLayer", b"setPreservesDepth:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"allowsEdgeAntialiasing", {"retval": {"type": "Z"}}) - r(b"CALayer", b"allowsGroupOpacity", {"retval": {"type": "Z"}}) - r(b"CALayer", b"containsPoint:", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"contentsAreFlipped", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"drawsAsynchronously", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"isDoubleSided", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"isGeometryFlipped", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"isHidden", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"isOpaque", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"masksToBounds", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"needsDisplay", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"needsDisplayForKey:", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"needsDisplayOnBoundsChange", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"needsLayout", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"setAllowsEdgeAntialiasing:", {"arguments": {2: {"type": "Z"}}}) - r(b"CALayer", b"setAllowsGroupOpacity:", {"arguments": {2: {"type": "Z"}}}) - r(b"CALayer", b"setDoubleSided:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"setDrawsAsynchronously:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"setGeometryFlipped:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"setHidden:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"setMasksToBounds:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"setNeedsDisplayOnBoundsChange:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"setOpaque:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CALayer", b"setShouldRasterize:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"CALayer", - b"setWantsExtendedDynamicRangeContent:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CALayer", b"shouldArchiveValueForKey:", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"shouldRasterize", {"retval": {"type": b"Z"}}) - r(b"CALayer", b"wantsExtendedDynamicRangeContent", {"retval": {"type": "Z"}}) - r(b"CAMetalDisplayLink", b"isPaused", {"retval": {"type": b"Z"}}) - r(b"CAMetalDisplayLink", b"setPaused:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CAMetalLayer", b"allowsNextDrawableTimeout", {"retval": {"type": "Z"}}) - r(b"CAMetalLayer", b"displaySyncEnabled", {"retval": {"type": "Z"}}) - r(b"CAMetalLayer", b"framebufferOnly", {"retval": {"type": "Z"}}) - r(b"CAMetalLayer", b"presentsWithTransaction", {"retval": {"type": "Z"}}) - r( - b"CAMetalLayer", - b"setAllowsNextDrawableTimeout:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CAMetalLayer", b"setDisplaySyncEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"CAMetalLayer", b"setFramebufferOnly:", {"arguments": {2: {"type": "Z"}}}) - r( - b"CAMetalLayer", - b"setPresentsWithTransaction:", - {"arguments": {2: {"type": "Z"}}}, - ) - r( - b"CAMetalLayer", - b"setWantsExtendedDynamicRangeContent:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CAMetalLayer", b"wantsExtendedDynamicRangeContent", {"retval": {"type": "Z"}}) - r( - b"CAOpenGLLayer", - b"canDrawInCGLContext:pixelFormat:forLayerTime:displayTime:", - { - "retval": {"type": b"Z"}, - "arguments": { - 5: { - "type": b"^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": b"n", - } - }, - }, - ) - r( - b"CAOpenGLLayer", - b"drawInCGLContext:pixelFormat:forLayerTime:displayTime:", - { - "arguments": { - 5: { - "type": b"^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": b"n", - } - } - }, - ) - r(b"CAOpenGLLayer", b"isAsynchronous", {"retval": {"type": b"Z"}}) - r(b"CAOpenGLLayer", b"setAsynchronous:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"CAOpenGLLayer", - b"setWantsExtendedDynamicRangeContent:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CAOpenGLLayer", b"wantsExtendedDynamicRangeContent", {"retval": {"type": "Z"}}) - r(b"CAPropertyAnimation", b"isAdditive", {"retval": {"type": b"Z"}}) - r(b"CAPropertyAnimation", b"isCumulative", {"retval": {"type": b"Z"}}) - r(b"CAPropertyAnimation", b"setAdditive:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CAPropertyAnimation", b"setCumulative:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"CARenderer", - b"beginFrameAtTime:timeStamp:", - { - "arguments": { - 3: { - "type": b"^{CVTimeStamp=IiqQdq{CVSMPTETime=ssIIIssss}QQ}", - "type_modifier": b"n", - } - } - }, - ) - r( - b"CARenderer", - b"rendererWithCGLContext:options:", - {"arguments": {2: {"type": "^{_CGLContextObject=}"}}}, - ) - r(b"CAReplicatorLayer", b"preservesDepth", {"retval": {"type": b"Z"}}) - r(b"CAReplicatorLayer", b"setPreservesDepth:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CASpringAnimation", b"allowsOverdamping", {"retval": {"type": b"Z"}}) - r( - b"CASpringAnimation", - b"setAllowsOverdamping:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"CATextLayer", b"allowsFontSubpixelQuantization", {"retval": {"type": "Z"}}) - r(b"CATextLayer", b"font", {"retval": {"type": b"@"}}) - r(b"CATextLayer", b"isWrapped", {"retval": {"type": b"Z"}}) - r( - b"CATextLayer", - b"setAllowsFontSubpixelQuantization:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CATextLayer", b"setFont:", {"arguments": {2: {"type": b"@"}}}) - r(b"CATextLayer", b"setWrapped:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"CATransaction", - b"completionBlock", - { - "retval": { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - }, - ) - r(b"CATransaction", b"disableActions", {"retval": {"type": b"Z"}}) - r( - b"CATransaction", - b"setCompletionBlock:", - { - "arguments": { - 2: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"CATransaction", b"setDisableActions:", {"arguments": {2: {"type": b"Z"}}}) - r(b"CIAztecCodeDescriptor", b"isCompact", {"retval": {"type": "Z"}}) - r(b"CIColor", b"components", {"retval": {"c_array_of_variable_length": True}}) - r( - b"CIContext", - b"HEIF10RepresentationOfImage:colorSpace:options:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"OpenEXRRepresentationOfImage:options:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"createCGImage:fromRect:format:colorSpace:deferred:", - {"retval": {"already_cfretained": True}, "arguments": {6: {"type": "Z"}}}, - ) - r( - b"CIContext", - b"createCGLayerWithSize:info:", - {"retval": {"already_cfretained": True}}, - ) - r( - b"CIContext", - b"prepareRender:fromRect:toDestination:atPoint:error:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"render:toBitmap:rowBytes:bounds:format:colorSpace:", - {"arguments": {3: {"type_modifier": b"o", "c_array_of_variable_length": True}}}, - ) - r( - b"CIContext", - b"startTaskToClear:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"startTaskToRender:fromRect:toDestination:atPoint:error:", - {"arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"startTaskToRender:toDestination:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"writeHEIF10RepresentationOfImage:toURL:colorSpace:options:error:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"writeHEIFRepresentationOfImage:toURL:format:colorSpace:options:error:", - {"retval": {"type": "Z"}, "arguments": {7: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"writeJPEGRepresentationOfImage:toURL:colorSpace:options:error:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"writeOpenEXRRepresentationOfImage:toURL:options:error:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"CIContext", - b"writePNGRepresentationOfImage:toURL:format:colorSpace:options:error:", - {"retval": {"type": "Z"}, "arguments": {7: {"type_modifier": b"o"}}}, - ) - r(b"CIFaceFeature", b"hasFaceAngle", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"hasLeftEyePosition", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"hasMouthPosition", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"hasRightEyePosition", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"hasSmile", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"hasTrackingFrameCount", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"hasTrackingID", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"leftEyeClosed", {"retval": {"type": b"Z"}}) - r(b"CIFaceFeature", b"rightEyeClosed", {"retval": {"type": b"Z"}}) - r(b"CIFilter", b"apply:", {"c_array_delimited_by_null": True, "variadic": True}) - r( - b"CIFilter", - b"filterArrayFromSerializedXMP:inputImageExtent:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"CIFilter", - b"filterWithName:keysAndValues:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r(b"CIFilter", b"isEnabled", {"retval": {"type": b"Z"}}) - r(b"CIFilter", b"setEnabled:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"CIFilterGenerator", - b"writeToURL:atomically:", - {"retval": {"type": b"Z"}, "arguments": {3: {"type": b"Z"}}}, - ) - r(b"CIFilterShape", b"transformBy:interior:", {"arguments": {3: {"type": b"Z"}}}) - r( - b"CIImage", - b"imageByApplyingTransform:highQualityDownsample:", - {"arguments": {3: {"type": "Z"}}}, - ) - r( - b"CIImage", - b"imageWithTexture:size:flipped:colorSpace:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"CIImage", - b"imageWithTexture:size:flipped:options:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"CIImage", - b"initWithTexture:size:flipped:colorSpace:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"CIImage", - b"initWithTexture:size:flipped:options:", - {"arguments": {4: {"type": b"Z"}}}, - ) - r( - b"CIImage", - b"writeHEIFRepresentationOfImage:toURL:format:colorSpace:options:error:", - {"retval": {"type": "Z"}, "arguments": {7: {"type_modifier": b"o"}}}, - ) - r( - b"CIImage", - b"writeJPEGRepresentationOfImage:toURL:colorSpace:options:error:", - {"retval": {"type": "Z"}, "arguments": {6: {"type_modifier": b"o"}}}, - ) - r( - b"CIImage", - b"writePNGRepresentationOfImage:toURL:format:colorSpace:options:error:", - {"retval": {"type": "Z"}, "arguments": {7: {"type_modifier": b"o"}}}, - ) - r( - b"CIImageProcessorKernel", - b"applyWithExtent:inputs:arguments:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"CIImageProcessorKernel", - b"processWithInputs:arguments:output:error:", - {"retval": {"type": "Z"}, "arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"CIKernel", - b"applyWithExtent:roiCallback:arguments:", - { - "arguments": { - 3: { - "callable": { - "retval": { - "type": sel32or64( - b"{_NSRect={_NSPoint=ff}{_NSSize=ff}}", - b"{CGRect={CGPoint=dd}{CGSize=dd}}", - ) - }, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"i"}, - 2: { - "type": sel32or64( - b"{_NSRect={_NSPoint=ff}{_NSSize=ff}}", - b"{CGRect={CGPoint=dd}{CGSize=dd}}", - ) - }, - }, - } - } - } - }, - ) - r( - b"CIKernel", - b"kernelWithFunctionName:fromMetalLibraryData:error:", - {"arguments": {4: {"type_modifier": b"o"}}}, - ) - r( - b"CIKernel", - b"kernelWithFunctionName:fromMetalLibraryData:outputPixelFormat:error:", - {"arguments": {5: {"type_modifier": b"o"}}}, - ) - r( - b"CIKernel", - b"kernelsWithMetalString:error:", - {"arguments": {3: {"type_modifier": b"o"}}}, - ) - r( - b"CIKernel", - b"setROISelector:", - { - "arguments": { - 2: { - "sel_of_type": sel32or64( - b"{CGRect={CGPoint=ff}{CGSize=ff}}@:i{CGRect={CGPoint=ff}{CGSize=ff}}@", - b"{CGRect={CGPoint=dd}{CGSize=dd}}@:i{CGRect={CGPoint=dd}{CGSize=dd}}@", - ) - } - } - }, - ) - r(b"CIPDF417CodeDescriptor", b"isCompact", {"retval": {"type": "Z"}}) - r( - b"CIPlugIn", - b"loadPlugIn:allowExecutableCode:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r( - b"CIPlugIn", - b"loadPlugIn:allowNonExecutable:", - {"arguments": {3: {"type": b"Z"}}}, - ) - r(b"CIRAWFilter", b"isColorNoiseReductionSupported", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isContrastSupported", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isDetailSupported", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isGamutMappingEnabled", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isLensCorrectionEnabled", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isLensCorrectionSupported", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isLocalToneMapSupported", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isLuminanceNoiseReductionSupported", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isMoireReductionSupported", {"retval": {"type": "Z"}}) - r(b"CIRAWFilter", b"isSharpnessSupported", {"retval": {"type": "Z"}}) - r( - b"CIRAWFilter", - b"setColorNoiseReductionSupported:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CIRAWFilter", b"setContrastSupported:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRAWFilter", b"setDetailSupported:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRAWFilter", b"setGamutMappingEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRAWFilter", b"setLensCorrectionEnabled:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRAWFilter", b"setLensCorrectionSupported:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRAWFilter", b"setLocalToneMapSupported:", {"arguments": {2: {"type": "Z"}}}) - r( - b"CIRAWFilter", - b"setLuminanceNoiseReductionSupported:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CIRAWFilter", b"setMoireReductionSupported:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRAWFilter", b"setSharpnessSupported:", {"arguments": {2: {"type": "Z"}}}) - r( - b"CIRenderDestination", - b"blendsInDestinationColorSpace", - {"retval": {"type": "Z"}}, - ) - r( - b"CIRenderDestination", - b"initWithWidth:height:pixelFormat:commandBuffer:mtlTextureProvider:", - { - "arguments": { - 6: { - "callable": { - "retval": {"type": b"@"}, - "arguments": {0: {"type": b"^v"}}, - } - } - } - }, - ) - r(b"CIRenderDestination", b"isClamped", {"retval": {"type": "Z"}}) - r(b"CIRenderDestination", b"isDithered", {"retval": {"type": "Z"}}) - r(b"CIRenderDestination", b"isFlipped", {"retval": {"type": "Z"}}) - r( - b"CIRenderDestination", - b"setBlendsInDestinationColorSpace:", - {"arguments": {2: {"type": "Z"}}}, - ) - r(b"CIRenderDestination", b"setClamped:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRenderDestination", b"setDithered:", {"arguments": {2: {"type": "Z"}}}) - r(b"CIRenderDestination", b"setFlipped:", {"arguments": {2: {"type": "Z"}}}) - r( - b"CIRenderTask", - b"waitUntilCompletedAndReturnError:", - {"arguments": {2: {"type_modifier": b"o"}}}, - ) - r( - b"CISampler", - b"initWithImage:keysAndValues:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"CISampler", - b"samplerWithImage:keysAndValues:", - {"c_array_delimited_by_null": True, "variadic": True}, - ) - r( - b"CIVector", - b"initWithValues:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"CIVector", - b"vectorWithValues:count:", - {"arguments": {2: {"type_modifier": b"n", "c_array_length_in_arg": 3}}}, - ) - r( - b"CIWarpKernel", - b"applyWithExtent:roiCallback:inputImage:arguments:", - { - "arguments": { - 3: { - "callable": { - "retval": { - "type": sel32or64( - b"{_NSRect={_NSPoint=ff}{_NSSize=ff}}", - b"{CGRect={CGPoint=dd}{CGSize=dd}}", - ) - }, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"i"}, - 2: { - "type": sel32or64( - b"{_NSRect={_NSPoint=ff}{_NSSize=ff}}", - b"{CGRect={CGPoint=dd}{CGSize=dd}}", - ) - }, - }, - } - } - } - }, - ) - r(b"NSObject", b"EV", {"retval": {"type": "f"}}) - r(b"NSObject", b"NRNoiseLevel", {"retval": {"type": "f"}}) - r(b"NSObject", b"NRSharpness", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"actionForLayer:forKey:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"acuteAngle", {"retval": {"type": "f"}}) - r(b"NSObject", b"alwaysSpecifyCompaction", {"retval": {"type": "f"}}) - r(b"NSObject", b"amount", {"retval": {"type": "f"}}) - r(b"NSObject", b"angle", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"animationDidStart:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"animationDidStop:finished:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"Z"}}, - }, - ) - r(b"NSObject", b"aspectRatio", {"retval": {"type": "f"}}) - r(b"NSObject", b"autoreverses", {"required": True, "retval": {"type": b"Z"}}) - r(b"NSObject", b"barOffset", {"retval": {"type": "f"}}) - r(b"NSObject", b"barcodeHeight", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"baseAddress", - {"retval": {"type": "^v", "c_array_of_variable_length": True}}, - ) - r(b"NSObject", b"beginTime", {"required": True, "retval": {"type": b"d"}}) - r(b"NSObject", b"bias", {"retval": {"type": "f"}}) - r(b"NSObject", b"bottomHeight", {"retval": {"type": "f"}}) - r(b"NSObject", b"bottomLeft", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"bottomRight", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"breakpoint0", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"breakpoint1", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"brightness", {"retval": {"type": "f"}}) - r(b"NSObject", b"bytesPerRow", {"retval": {"type": "L"}}) - r(b"NSObject", b"centerStretchAmount", {"retval": {"type": "f"}}) - r(b"NSObject", b"closeness1", {"retval": {"type": "f"}}) - r(b"NSObject", b"closeness2", {"retval": {"type": "f"}}) - r(b"NSObject", b"closeness3", {"retval": {"type": "f"}}) - r(b"NSObject", b"compactStyle", {"retval": {"type": "f"}}) - r(b"NSObject", b"compactionMode", {"retval": {"type": "f"}}) - r(b"NSObject", b"compression", {"retval": {"type": "f"}}) - r(b"NSObject", b"concentration", {"retval": {"type": "f"}}) - r(b"NSObject", b"contrast", {"retval": {"type": "f"}}) - r(b"NSObject", b"contrast1", {"retval": {"type": "f"}}) - r(b"NSObject", b"contrast2", {"retval": {"type": "f"}}) - r(b"NSObject", b"contrast3", {"retval": {"type": "f"}}) - r(b"NSObject", b"correctionLevel", {"retval": {"type": "f"}}) - r(b"NSObject", b"count", {"retval": {"type": "q"}}) - r(b"NSObject", b"crop", {"retval": {"type": "B"}}) - r(b"NSObject", b"cropAmount", {"retval": {"type": "f"}}) - r(b"NSObject", b"crossAngle", {"retval": {"type": "f"}}) - r(b"NSObject", b"crossOpacity", {"retval": {"type": "f"}}) - r(b"NSObject", b"crossScale", {"retval": {"type": "f"}}) - r(b"NSObject", b"crossWidth", {"retval": {"type": "f"}}) - r(b"NSObject", b"cubeDimension", {"retval": {"type": "f"}}) - r(b"NSObject", b"dataColumns", {"retval": {"type": "f"}}) - r(b"NSObject", b"decay", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"displayLayer:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"dither", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"drawLayer:inContext:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"^{CGContext=}"}}, - }, - ) - r(b"NSObject", b"duration", {"required": True, "retval": {"type": b"d"}}) - r(b"NSObject", b"edgeIntensity", {"retval": {"type": "f"}}) - r(b"NSObject", b"epsilon", {"retval": {"type": "f"}}) - r(b"NSObject", b"extent", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r(b"NSObject", b"fadeThreshold", {"retval": {"type": "f"}}) - r(b"NSObject", b"falloff", {"retval": {"type": "f"}}) - r(b"NSObject", b"fillMode", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"filterWithName:", - {"required": True, "retval": {"type": b"@"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"flipYTiles", {"retval": {"type": "B"}}) - r(b"NSObject", b"focalLength", {"retval": {"type": "f"}}) - r(b"NSObject", b"foldShadowAmount", {"retval": {"type": "f"}}) - r(b"NSObject", b"fontSize", {"retval": {"type": "f"}}) - r(b"NSObject", b"format", {"retval": {"type": "q"}}) - r(b"NSObject", b"gaussianSigma", {"retval": {"type": "f"}}) - r(b"NSObject", b"grayComponentReplacement", {"retval": {"type": "f"}}) - r(b"NSObject", b"growAmount", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"haloOverlap", {"retval": {"type": "f"}}) - r(b"NSObject", b"haloRadius", {"retval": {"type": "f"}}) - r(b"NSObject", b"haloWidth", {"retval": {"type": "f"}}) - r(b"NSObject", b"headIndex", {"retval": {"type": "f"}}) - r(b"NSObject", b"height", {"retval": {"type": "f"}}) - r(b"NSObject", b"highLimit", {"retval": {"type": "f"}}) - r(b"NSObject", b"highlightAmount", {"retval": {"type": "f"}}) - r(b"NSObject", b"hysteresisPasses", {"retval": {"type": "q"}}) - r(b"NSObject", b"insetPoint0", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"insetPoint1", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"intensity", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"invalidateLayoutOfLayer:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"layer", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"layerWillDraw:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"layers", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"layoutSublayersOfLayer:", - {"required": False, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"levels", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"load:", - {"required": True, "retval": {"type": b"Z"}, "arguments": {2: {"type": b"^v"}}}, - ) - r(b"NSObject", b"lowLimit", {"retval": {"type": "f"}}) - r(b"NSObject", b"lumaSigma", {"retval": {"type": "f"}}) - r(b"NSObject", b"maxHeight", {"retval": {"type": "f"}}) - r(b"NSObject", b"maxStriationRadius", {"retval": {"type": "f"}}) - r(b"NSObject", b"maxWidth", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"metalDisplayLink:needsUpdate:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"minHeight", {"retval": {"type": "f"}}) - r(b"NSObject", b"minWidth", {"retval": {"type": "f"}}) - r(b"NSObject", b"neutral", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"noiseLevel", {"retval": {"type": "f"}}) - r(b"NSObject", b"numberOfFolds", {"retval": {"type": "f"}}) - r(b"NSObject", b"opacity", {"retval": {"type": "f"}}) - r(b"NSObject", b"parameterB", {"retval": {"type": "f"}}) - r(b"NSObject", b"parameterC", {"retval": {"type": "f"}}) - r(b"NSObject", b"passes", {"retval": {"type": "f"}}) - r(b"NSObject", b"perceptual", {"retval": {"type": "B"}}) - r(b"NSObject", b"periodicity", {"retval": {"type": "f"}}) - r(b"NSObject", b"pitch", {"retval": {"type": "f"}}) - r(b"NSObject", b"point", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"point0", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"point1", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"point2", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"point3", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"point4", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"power", {"retval": {"type": "f"}}) - r(b"NSObject", b"preferredAspectRatio", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"preferredSizeOfLayer:", - { - "required": False, - "retval": {"type": b"{CGSize=dd}"}, - "arguments": {2: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"provideImageData:bytesPerRow:origin::size::userInfo:", - { - "retval": {"type": b"v"}, - "arguments": { - 2: { - "type": b"^v", - "type_modifier": b"o", - "c_array_of_variable_length": True, - }, - 3: {"type": b"Q"}, - 4: {"type": b"Q"}, - 5: {"type": b"Q"}, - 6: {"type": b"Q"}, - 7: {"type": b"Q"}, - 8: {"type": b"@"}, - }, - }, - ) - r(b"NSObject", b"quietSpace", {"retval": {"type": "f"}}) - r(b"NSObject", b"radius", {"retval": {"type": "f"}}) - r(b"NSObject", b"radius0", {"retval": {"type": "f"}}) - r(b"NSObject", b"radius1", {"retval": {"type": "f"}}) - r(b"NSObject", b"refraction", {"retval": {"type": "f"}}) - r(b"NSObject", b"region", {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}) - r(b"NSObject", b"repeatCount", {"required": True, "retval": {"type": b"f"}}) - r(b"NSObject", b"repeatDuration", {"required": True, "retval": {"type": b"d"}}) - r(b"NSObject", b"ringAmount", {"retval": {"type": "f"}}) - r(b"NSObject", b"ringSize", {"retval": {"type": "f"}}) - r(b"NSObject", b"roll", {"retval": {"type": "f"}}) - r(b"NSObject", b"rotation", {"retval": {"type": "f"}}) - r(b"NSObject", b"rows", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"runActionForKey:object:arguments:", - { - "required": True, - "retval": {"type": b"v"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}, 4: {"type": b"@"}}, - }, - ) - r(b"NSObject", b"saturation", {"retval": {"type": "f"}}) - r(b"NSObject", b"scaleFactor", {"retval": {"type": "f"}}) - r(b"NSObject", b"setAcuteAngle:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setAlwaysSpecifyCompaction:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setAmount:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setAngle:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setAspectRatio:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setAutoreverses:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"Z"}}}, - ) - r(b"NSObject", b"setBarOffset:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setBarcodeHeight:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setBeginTime:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"d"}}}, - ) - r(b"NSObject", b"setBias:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setBottomHeight:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setBottomLeft:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setBottomRight:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setBreakpoint0:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setBreakpoint1:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setBrightness:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCenterStretchAmount:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCloseness1:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCloseness2:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCloseness3:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCompactStyle:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCompactionMode:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCompression:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setConcentration:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setContrast1:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setContrast2:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setContrast3:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setContrast:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCorrectionLevel:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCount:", {"arguments": {2: {"type": "q"}}}) - r(b"NSObject", b"setCrop:", {"arguments": {2: {"type": "B"}}}) - r(b"NSObject", b"setCropAmount:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCrossAngle:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCrossOpacity:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCrossScale:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCrossWidth:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setCubeDimension:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setDataColumns:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setDecay:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setDither:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setDuration:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"d"}}}, - ) - r(b"NSObject", b"setEV:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setEdgeIntensity:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setEpsilon:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setExtent:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSObject", b"setFadeThreshold:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setFalloff:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setFillMode:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r(b"NSObject", b"setFlipYTiles:", {"arguments": {2: {"type": "B"}}}) - r(b"NSObject", b"setFocalLength:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setFoldShadowAmount:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setFontSize:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setGaussianSigma:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setGrayComponentReplacement:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setGrowAmount:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setHaloOverlap:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setHaloRadius:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setHaloWidth:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setHeadIndex:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setHeight:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setHighLimit:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setHighlightAmount:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setHysteresisPasses:", {"arguments": {2: {"type": "q"}}}) - r(b"NSObject", b"setInsetPoint0:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setInsetPoint1:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setIntensity:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setLayers:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setLevels:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setLowLimit:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setLumaSigma:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setMaxHeight:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setMaxStriationRadius:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setMaxWidth:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setMinHeight:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setMinWidth:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setNRNoiseLevel:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setNRSharpness:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setNeutral:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setNoiseLevel:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setNumberOfFolds:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setOpacity:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setParameterB:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setParameterC:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setPasses:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setPerceptual:", {"arguments": {2: {"type": "B"}}}) - r(b"NSObject", b"setPeriodicity:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setPitch:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setPoint0:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setPoint1:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setPoint2:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setPoint3:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setPoint4:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setPoint:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setPower:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setPreferredAspectRatio:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setQuietSpace:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRadius0:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRadius1:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRadius:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRefraction:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setRepeatCount:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"f"}}}, - ) - r( - b"NSObject", - b"setRepeatDuration:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"d"}}}, - ) - r(b"NSObject", b"setRingAmount:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRingSize:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRoll:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRotation:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setRows:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setSaturation:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setScaleFactor:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setSftmaxNormalization:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setShadowAmount:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setShadowDensity:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setShadowExtent:", - {"arguments": {2: {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}}, - ) - r(b"NSObject", b"setShadowOffset:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setShadowRadius:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setShadowSize:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setSharpness:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setSigma:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setSoftmaxNormalization:", {"arguments": {2: {"type": "B"}}}) - r(b"NSObject", b"setSoftness:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setSpatialSigma:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setSpeed:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"f"}}}, - ) - r(b"NSObject", b"setStrands:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setStriationContrast:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setStriationStrength:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setSunRadius:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setTargetNeutral:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setThreshold:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setThresholdHigh:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setThresholdLow:", {"arguments": {2: {"type": "f"}}}) - r( - b"NSObject", - b"setTimeOffset:", - {"required": True, "retval": {"type": b"v"}, "arguments": {2: {"type": b"d"}}}, - ) - r(b"NSObject", b"setTopLeft:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r(b"NSObject", b"setTopRight:", {"arguments": {2: {"type": "{CGPoint=dd}"}}}) - r( - b"NSObject", - b"setTransform:", - {"arguments": {2: {"type": "{CGAffineTransform=dddddd}"}}}, - ) - r(b"NSObject", b"setUnderColorRemoval:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setUnsharpMaskIntensity:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setUnsharpMaskRadius:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setValue:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setWidth:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setYaw:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"setZoom:", {"arguments": {2: {"type": "f"}}}) - r(b"NSObject", b"shadowAmount", {"retval": {"type": "f"}}) - r(b"NSObject", b"shadowDensity", {"retval": {"type": "f"}}) - r( - b"NSObject", - b"shadowExtent", - {"retval": {"type": "{CGRect={CGPoint=dd}{CGSize=dd}}"}}, - ) - r(b"NSObject", b"shadowOffset", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"shadowRadius", {"retval": {"type": "f"}}) - r(b"NSObject", b"shadowSize", {"retval": {"type": "f"}}) - r(b"NSObject", b"sharpness", {"retval": {"type": "f"}}) - r(b"NSObject", b"sigma", {"retval": {"type": "f"}}) - r(b"NSObject", b"softmaxNormalization", {"retval": {"type": "B"}}) - r(b"NSObject", b"softness", {"retval": {"type": "f"}}) - r(b"NSObject", b"spatialSigma", {"retval": {"type": "f"}}) - r(b"NSObject", b"speed", {"required": True, "retval": {"type": b"f"}}) - r(b"NSObject", b"strands", {"retval": {"type": "f"}}) - r(b"NSObject", b"striationContrast", {"retval": {"type": "f"}}) - r(b"NSObject", b"striationStrength", {"retval": {"type": "f"}}) - r(b"NSObject", b"sunRadius", {"retval": {"type": "f"}}) - r(b"NSObject", b"targetNeutral", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"texture", {"required": True, "retval": {"type": b"@"}}) - r(b"NSObject", b"threshold", {"retval": {"type": "f"}}) - r(b"NSObject", b"thresholdHigh", {"retval": {"type": "f"}}) - r(b"NSObject", b"thresholdLow", {"retval": {"type": "f"}}) - r(b"NSObject", b"timeOffset", {"required": True, "retval": {"type": b"d"}}) - r(b"NSObject", b"topLeft", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"topRight", {"retval": {"type": "{CGPoint=dd}"}}) - r(b"NSObject", b"transform", {"retval": {"type": "{CGAffineTransform=dddddd}"}}) - r(b"NSObject", b"underColorRemoval", {"retval": {"type": "f"}}) - r(b"NSObject", b"unsharpMaskIntensity", {"retval": {"type": "f"}}) - r(b"NSObject", b"unsharpMaskRadius", {"retval": {"type": "f"}}) - r(b"NSObject", b"value", {"retval": {"type": "f"}}) - r(b"NSObject", b"width", {"retval": {"type": "f"}}) - r(b"NSObject", b"yaw", {"retval": {"type": "f"}}) - r(b"NSObject", b"zoom", {"retval": {"type": "f"}}) -finally: - objc._updatingMetadata(False) -protocols = { - "CAAnimationDelegate": objc.informal_protocol( - "CAAnimationDelegate", - [ - objc.selector(None, b"animationDidStart:", b"v@:@", isRequired=False), - objc.selector( - None, b"animationDidStop:finished:", b"v@:@Z", isRequired=False - ), - ], - ), - "CALayerDelegate": objc.informal_protocol( - "CALayerDelegate", - [ - objc.selector( - None, b"drawLayer:inContext:", b"v@:@^{CGContext=}", isRequired=False - ), - objc.selector(None, b"actionForLayer:forKey:", b"@@:@@", isRequired=False), - objc.selector(None, b"displayLayer:", b"v@:@", isRequired=False), - objc.selector(None, b"layoutSublayersOfLayer:", b"v@:@", isRequired=False), - ], - ), - "CIImageProvider": objc.informal_protocol( - "CIImageProvider", - [ - objc.selector( - None, - b"provideImageData:bytesPerRow:origin::size::userInfo:", - b"v@:^vQQQQQ@", - isRequired=False, - ) - ], - ), - "CALayoutManager": objc.informal_protocol( - "CALayoutManager", - [ - objc.selector( - None, b"preferredSizeOfLayer:", b"{CGSize=dd}@:@", isRequired=False - ), - objc.selector(None, b"layoutSublayersOfLayer:", b"v@:@", isRequired=False), - objc.selector(None, b"invalidateLayoutOfLayer:", b"v@:@", isRequired=False), - ], - ), -} -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/_quartzcore.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/_quartzcore.abi3.so deleted file mode 100755 index 4c37713..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzCore/_quartzcore.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__init__.py deleted file mode 100644 index 7591f67..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -Python mapping for the QuartzCore framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - - import Foundation - import objc - from . import _metadata - - if objc.macos_available(14, 0): - identifier = "com.apple.quartzframework" - elif objc.macos_available(13, 0): - identifier = "com.apple.Quartz" - else: - identifier = "com.apple.quartzframework" - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.QuartzFilters", - frameworkIdentifier=identifier, - frameworkPath=objc.pathForFramework( - "/System/Library/Frameworks/Quartz.framework" - ), - globals_dict=globals(), - inline_list=None, - parents=(Foundation,), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - del sys.modules["Quartz.QuartzFilters._metadata"] - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 4ddc929..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index e0e6f5a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/_metadata.py deleted file mode 100644 index 0cd15a4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuartzFilters/_metadata.py +++ /dev/null @@ -1,95 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 1 14:06:05 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -constants = """$globalUpdateOK@Z$kQuartzFilterApplicationDomain$kQuartzFilterManagerDidAddFilterNotification$kQuartzFilterManagerDidModifyFilterNotification$kQuartzFilterManagerDidRemoveFilterNotification$kQuartzFilterManagerDidSelectFilterNotification$kQuartzFilterPDFWorkflowDomain$kQuartzFilterPrintingDomain$""" -enums = """$$""" -misc.update({}) -misc.update({}) -misc.update({}) -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r( - b"NSObject", - b"quartzFilterManager:didAddFilter:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"quartzFilterManager:didModifyFilter:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"quartzFilterManager:didRemoveFilter:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"quartzFilterManager:didSelectFilter:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}}, - ) - r(b"QuartzFilter", b"applyToContext:", {"retval": {"type": b"Z"}}) - r(b"QuartzFilterManager", b"selectFilter:", {"retval": {"type": b"Z"}}) -finally: - objc._updatingMetadata(False) -protocols = { - "QuartzFilterManagerDelegate": objc.informal_protocol( - "QuartzFilterManagerDelegate", - [ - objc.selector( - None, - b"quartzFilterManager:didSelectFilter:", - b"v@:@@", - isRequired=False, - ), - objc.selector( - None, b"quartzFilterManager:didAddFilter:", b"v@:@@", isRequired=False - ), - objc.selector( - None, - b"quartzFilterManager:didModifyFilter:", - b"v@:@@", - isRequired=False, - ), - objc.selector( - None, - b"quartzFilterManager:didRemoveFilter:", - b"v@:@@", - isRequired=False, - ), - ], - ) -} -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/_QuickLookUI.abi3.so b/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/_QuickLookUI.abi3.so deleted file mode 100755 index e456e63..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/_QuickLookUI.abi3.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__init__.py deleted file mode 100644 index 035cdd4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__init__.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Python mapping for the QuickLookUI framework. - -This module does not contain docstrings for the wrapped code, check Apple's -documentation for details on how to use these functions and classes. -""" - - -def _setup(): - import sys - import os - - import AppKit - import objc - from . import _metadata, _QuickLookUI - - frameworkPath = "/System/Library/Frameworks/QuickLookUI.framework" - frameworkIdentifier = "com.apple.QuickLookUIFramework" - if not os.path.exists(frameworkPath): - frameworkPath = "/System/Library/Frameworks/Quartz.framework" - if objc.macos_available(13, 0): - frameworkIdentifier = "com.apple.Quartz" - else: - frameworkIdentifier = "com.apple.quartzframework" - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz.QuickLookUI", - frameworkIdentifier=frameworkIdentifier, - frameworkPath=objc.pathForFramework(frameworkPath), - globals_dict=globals(), - inline_list=None, - parents=( - _QuickLookUI, - AppKit, - ), - metadict=_metadata.__dict__, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - # XXX: - del sys.modules["Quartz.QuickLookUI._metadata"] - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 45c5e13..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__pycache__/_metadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__pycache__/_metadata.cpython-310.pyc deleted file mode 100644 index be626f6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/__pycache__/_metadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/_metadata.py b/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/_metadata.py deleted file mode 100644 index 2603b56..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/QuickLookUI/_metadata.py +++ /dev/null @@ -1,274 +0,0 @@ -# This file is generated by objective.metadata -# -# Last update: Sat Jul 1 14:06:11 2023 -# -# flake8: noqa - -import objc, sys -from typing import NewType - -if sys.maxsize > 2**32: - - def sel32or64(a, b): - return b - -else: - - def sel32or64(a, b): - return a - - -if objc.arch == "arm64": - - def selAorI(a, b): - return a - -else: - - def selAorI(a, b): - return b - - -misc = {} -constants = """$$""" -enums = """$QLPreviewViewStyleCompact@1$QLPreviewViewStyleNormal@0$""" -misc.update({"QLPreviewViewStyle": NewType("QLPreviewViewStyle", int)}) -misc.update({}) -misc.update({}) -r = objc.registerMetaDataForSelector -objc._updatingMetadata(True) -try: - r( - b"NSObject", - b"acceptsPreviewPanelControl:", - {"retval": {"type": b"Z"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"beginPreviewPanelControl:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"endPreviewPanelControl:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"numberOfPreviewItemsInPreviewPanel:", - {"required": True, "retval": {"type": b"q"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"preparePreviewOfFileAtURL:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - }, - }, - }, - ) - r( - b"NSObject", - b"preparePreviewOfSearchableItemWithIdentifier:queryString:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: { - "callable": { - "retval": {"type": b"v"}, - "arguments": {0: {"type": b"^v"}, 1: {"type": b"@"}}, - }, - "type": "@?", - }, - }, - }, - ) - r( - b"NSObject", - b"previewItemDisplayState", - {"required": False, "retval": {"type": b"@"}}, - ) - r(b"NSObject", b"previewItemTitle", {"required": False, "retval": {"type": b"@"}}) - r(b"NSObject", b"previewItemURL", {"required": True, "retval": {"type": b"@"}}) - r( - b"NSObject", - b"previewPanel:handleEvent:", - { - "required": False, - "retval": {"type": b"Z"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"previewPanel:previewItemAtIndex:", - { - "required": True, - "retval": {"type": b"@"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"q"}}, - }, - ) - r( - b"NSObject", - b"previewPanel:sourceFrameOnScreenForPreviewItem:", - { - "required": False, - "retval": {"type": b"{CGRect={CGPoint=dd}{CGSize=dd}}"}, - "arguments": {2: {"type": b"@"}, 3: {"type": b"@"}}, - }, - ) - r( - b"NSObject", - b"previewPanel:transitionImageForPreviewItem:contentRect:", - { - "required": False, - "retval": {"type": b"@"}, - "arguments": { - 2: {"type": b"@"}, - 3: {"type": b"@"}, - 4: { - "type": b"^{CGRect={CGPoint=dd}{CGSize=dd}}", - "type_modifier": b"n", - }, - }, - }, - ) - r( - b"NSObject", - b"providePreviewForFileRequest:completionHandler:", - { - "required": False, - "retval": {"type": b"v"}, - "arguments": { - 2: {"type": b"@"}, - 3: { - "callable": { - "retval": {"type": b"v"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"@"}, - }, - }, - "type": b"@?", - }, - }, - }, - ) - r( - b"NSObject", - b"setPreviewItemDisplayState:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setPreviewItemTitle:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"NSObject", - b"setPreviewItemURL:", - {"retval": {"type": b"v"}, "arguments": {2: {"type": b"@"}}}, - ) - r( - b"QLPreviewPanel", - b"enterFullScreenMode:withOptions:", - {"retval": {"type": b"Z"}}, - ) - r(b"QLPreviewPanel", b"isInFullScreenMode", {"retval": {"type": b"Z"}}) - r(b"QLPreviewPanel", b"sharedPreviewPanelExists", {"retval": {"type": b"Z"}}) - r( - b"QLPreviewReply", - b"initForPDFWithPageSize:documentCreationBlock:", - { - "arguments": { - 3: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^@"}, - }, - } - } - } - }, - ) - r( - b"QLPreviewReply", - b"initWithContextSize:isBitmap:drawingBlock:", - { - "arguments": { - 3: {"type": b"Z"}, - 4: { - "callable": { - "retval": {"type": b"Z"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"^{CGContext=}"}, - 2: {"type": b"@"}, - 3: {"type": b"o^@"}, - }, - } - }, - } - }, - ) - r( - b"QLPreviewReply", - b"initWithDataOfContentType:contentSize:dataCreationBlock:", - { - "arguments": { - 4: { - "callable": { - "retval": {"type": b"@"}, - "arguments": { - 0: {"type": b"^v"}, - 1: {"type": b"@"}, - 2: {"type": b"o^@"}, - }, - } - } - } - }, - ) - r(b"QLPreviewView", b"autostarts", {"retval": {"type": b"Z"}}) - r(b"QLPreviewView", b"setAutostarts:", {"arguments": {2: {"type": b"Z"}}}) - r( - b"QLPreviewView", - b"setShouldCloseWithWindow:", - {"arguments": {2: {"type": b"Z"}}}, - ) - r(b"QLPreviewView", b"shouldCloseWithWindow", {"retval": {"type": b"Z"}}) -finally: - objc._updatingMetadata(False) -protocols = { - "QLPreviewPanelController": objc.informal_protocol( - "QLPreviewPanelController", - [ - objc.selector( - None, b"beginPreviewPanelControl:", b"v@:@", isRequired=False - ), - objc.selector( - None, b"acceptsPreviewPanelControl:", b"Z@:@", isRequired=False - ), - objc.selector(None, b"endPreviewPanelControl:", b"v@:@", isRequired=False), - ], - ) -} -expressions = {} - -# END OF FILE diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/__init__.py b/write-message/venv/lib/python3.10/site-packages/Quartz/__init__.py deleted file mode 100644 index fa576e9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/Quartz/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Helper module that makes it easier to import all of Quartz -""" - - -def _setup(): - import AppKit - import objc - - from . import ( - CoreGraphics, - ImageIO, - ImageKit, - CoreVideo, - QuartzCore, - PDFKit, - QuartzFilters, - QuickLookUI, - QuartzComposer, - ) - - dir_func, getattr_func = objc.createFrameworkDirAndGetattr( - name="Quartz", - frameworkIdentifier=None, - frameworkPath=None, - globals_dict=globals(), - inline_list=None, - parents=( - CoreGraphics, - ImageIO, - ImageKit, - CoreVideo, - QuartzCore, - PDFKit, - QuartzFilters, - QuickLookUI, - QuartzComposer, - AppKit, - ), - metadict={}, - ) - - globals()["__dir__"] = dir_func - globals()["__getattr__"] = getattr_func - - -globals().pop("_setup")() diff --git a/write-message/venv/lib/python3.10/site-packages/Quartz/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/Quartz/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index cd60bc0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/Quartz/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/__pycache__/typing_extensions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/__pycache__/typing_extensions.cpython-310.pyc deleted file mode 100644 index fadbfa4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/__pycache__/typing_extensions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__init__.py b/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__init__.py deleted file mode 100644 index f987a53..0000000 --- a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__init__.py +++ /dev/null @@ -1,222 +0,0 @@ -# don't import any costly modules -import sys -import os - - -is_pypy = '__pypy__' in sys.builtin_module_names - - -def warn_distutils_present(): - if 'distutils' not in sys.modules: - return - if is_pypy and sys.version_info < (3, 7): - # PyPy for 3.6 unconditionally imports distutils, so bypass the warning - # https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250 - return - import warnings - - warnings.warn( - "Distutils was imported before Setuptools, but importing Setuptools " - "also replaces the `distutils` module in `sys.modules`. This may lead " - "to undesirable behaviors or errors. To avoid these issues, avoid " - "using distutils directly, ensure that setuptools is installed in the " - "traditional way (e.g. not an editable install), and/or make sure " - "that setuptools is always imported before distutils." - ) - - -def clear_distutils(): - if 'distutils' not in sys.modules: - return - import warnings - - warnings.warn("Setuptools is replacing distutils.") - mods = [ - name - for name in sys.modules - if name == "distutils" or name.startswith("distutils.") - ] - for name in mods: - del sys.modules[name] - - -def enabled(): - """ - Allow selection of distutils by environment variable. - """ - which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local') - return which == 'local' - - -def ensure_local_distutils(): - import importlib - - clear_distutils() - - # With the DistutilsMetaFinder in place, - # perform an import to cause distutils to be - # loaded from setuptools._distutils. Ref #2906. - with shim(): - importlib.import_module('distutils') - - # check that submodules load as expected - core = importlib.import_module('distutils.core') - assert '_distutils' in core.__file__, core.__file__ - assert 'setuptools._distutils.log' not in sys.modules - - -def do_override(): - """ - Ensure that the local copy of distutils is preferred over stdlib. - - See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 - for more motivation. - """ - if enabled(): - warn_distutils_present() - ensure_local_distutils() - - -class _TrivialRe: - def __init__(self, *patterns): - self._patterns = patterns - - def match(self, string): - return all(pat in string for pat in self._patterns) - - -class DistutilsMetaFinder: - def find_spec(self, fullname, path, target=None): - # optimization: only consider top level modules and those - # found in the CPython test suite. - if path is not None and not fullname.startswith('test.'): - return - - method_name = 'spec_for_{fullname}'.format(**locals()) - method = getattr(self, method_name, lambda: None) - return method() - - def spec_for_distutils(self): - if self.is_cpython(): - return - - import importlib - import importlib.abc - import importlib.util - - try: - mod = importlib.import_module('setuptools._distutils') - except Exception: - # There are a couple of cases where setuptools._distutils - # may not be present: - # - An older Setuptools without a local distutils is - # taking precedence. Ref #2957. - # - Path manipulation during sitecustomize removes - # setuptools from the path but only after the hook - # has been loaded. Ref #2980. - # In either case, fall back to stdlib behavior. - return - - class DistutilsLoader(importlib.abc.Loader): - def create_module(self, spec): - mod.__name__ = 'distutils' - return mod - - def exec_module(self, module): - pass - - return importlib.util.spec_from_loader( - 'distutils', DistutilsLoader(), origin=mod.__file__ - ) - - @staticmethod - def is_cpython(): - """ - Suppress supplying distutils for CPython (build and tests). - Ref #2965 and #3007. - """ - return os.path.isfile('pybuilddir.txt') - - def spec_for_pip(self): - """ - Ensure stdlib distutils when running under pip. - See pypa/pip#8761 for rationale. - """ - if self.pip_imported_during_build(): - return - clear_distutils() - self.spec_for_distutils = lambda: None - - @classmethod - def pip_imported_during_build(cls): - """ - Detect if pip is being imported in a build script. Ref #2355. - """ - import traceback - - return any( - cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None) - ) - - @staticmethod - def frame_file_is_setup(frame): - """ - Return True if the indicated frame suggests a setup.py file. - """ - # some frames may not have __file__ (#2940) - return frame.f_globals.get('__file__', '').endswith('setup.py') - - def spec_for_sensitive_tests(self): - """ - Ensure stdlib distutils when running select tests under CPython. - - python/cpython#91169 - """ - clear_distutils() - self.spec_for_distutils = lambda: None - - sensitive_tests = ( - [ - 'test.test_distutils', - 'test.test_peg_generator', - 'test.test_importlib', - ] - if sys.version_info < (3, 10) - else [ - 'test.test_distutils', - ] - ) - - -for name in DistutilsMetaFinder.sensitive_tests: - setattr( - DistutilsMetaFinder, - f'spec_for_{name}', - DistutilsMetaFinder.spec_for_sensitive_tests, - ) - - -DISTUTILS_FINDER = DistutilsMetaFinder() - - -def add_shim(): - DISTUTILS_FINDER in sys.meta_path or insert_shim() - - -class shim: - def __enter__(self): - insert_shim() - - def __exit__(self, exc, value, tb): - remove_shim() - - -def insert_shim(): - sys.meta_path.insert(0, DISTUTILS_FINDER) - - -def remove_shim(): - try: - sys.meta_path.remove(DISTUTILS_FINDER) - except ValueError: - pass diff --git a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index f7df4fc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__pycache__/override.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__pycache__/override.cpython-310.pyc deleted file mode 100644 index 6e94b66..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/__pycache__/override.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/override.py b/write-message/venv/lib/python3.10/site-packages/_distutils_hack/override.py deleted file mode 100644 index 2cc433a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/_distutils_hack/override.py +++ /dev/null @@ -1 +0,0 @@ -__import__('_distutils_hack').do_override() diff --git a/write-message/venv/lib/python3.10/site-packages/_yaml/__init__.py b/write-message/venv/lib/python3.10/site-packages/_yaml/__init__.py deleted file mode 100644 index 7baa8c4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/_yaml/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# This is a stub package designed to roughly emulate the _yaml -# extension module, which previously existed as a standalone module -# and has been moved into the `yaml` package namespace. -# It does not perfectly mimic its old counterpart, but should get -# close enough for anyone who's relying on it even when they shouldn't. -import yaml - -# in some circumstances, the yaml module we imoprted may be from a different version, so we need -# to tread carefully when poking at it here (it may not have the attributes we expect) -if not getattr(yaml, '__with_libyaml__', False): - from sys import version_info - - exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError - raise exc("No module named '_yaml'") -else: - from yaml._yaml import * - import warnings - warnings.warn( - 'The _yaml extension module is now located at yaml._yaml' - ' and its location is subject to change. To use the' - ' LibYAML-based parser and emitter, import from `yaml`:' - ' `from yaml import CLoader as Loader, CDumper as Dumper`.', - DeprecationWarning - ) - del warnings - # Don't `del yaml` here because yaml is actually an existing - # namespace member of _yaml. - -__name__ = '_yaml' -# If the module is top-level (i.e. not a part of any specific package) -# then the attribute should be set to ''. -# https://docs.python.org/3.8/library/types.html -__package__ = '' diff --git a/write-message/venv/lib/python3.10/site-packages/_yaml/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/_yaml/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 1cef2e3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/_yaml/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/METADATA deleted file mode 100644 index 3ac05cf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/METADATA +++ /dev/null @@ -1,295 +0,0 @@ -Metadata-Version: 2.3 -Name: annotated-types -Version: 0.7.0 -Summary: Reusable constraint types to use with typing.Annotated -Project-URL: Homepage, https://github.com/annotated-types/annotated-types -Project-URL: Source, https://github.com/annotated-types/annotated-types -Project-URL: Changelog, https://github.com/annotated-types/annotated-types/releases -Author-email: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>, Samuel Colvin , Zac Hatfield-Dodds -License-File: LICENSE -Classifier: Development Status :: 4 - Beta -Classifier: Environment :: Console -Classifier: Environment :: MacOS X -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Information Technology -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: POSIX :: Linux -Classifier: Operating System :: Unix -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Typing :: Typed -Requires-Python: >=3.8 -Requires-Dist: typing-extensions>=4.0.0; python_version < '3.9' -Description-Content-Type: text/markdown - -# annotated-types - -[![CI](https://github.com/annotated-types/annotated-types/workflows/CI/badge.svg?event=push)](https://github.com/annotated-types/annotated-types/actions?query=event%3Apush+branch%3Amain+workflow%3ACI) -[![pypi](https://img.shields.io/pypi/v/annotated-types.svg)](https://pypi.python.org/pypi/annotated-types) -[![versions](https://img.shields.io/pypi/pyversions/annotated-types.svg)](https://github.com/annotated-types/annotated-types) -[![license](https://img.shields.io/github/license/annotated-types/annotated-types.svg)](https://github.com/annotated-types/annotated-types/blob/main/LICENSE) - -[PEP-593](https://peps.python.org/pep-0593/) added `typing.Annotated` as a way of -adding context-specific metadata to existing types, and specifies that -`Annotated[T, x]` _should_ be treated as `T` by any tool or library without special -logic for `x`. - -This package provides metadata objects which can be used to represent common -constraints such as upper and lower bounds on scalar values and collection sizes, -a `Predicate` marker for runtime checks, and -descriptions of how we intend these metadata to be interpreted. In some cases, -we also note alternative representations which do not require this package. - -## Install - -```bash -pip install annotated-types -``` - -## Examples - -```python -from typing import Annotated -from annotated_types import Gt, Len, Predicate - -class MyClass: - age: Annotated[int, Gt(18)] # Valid: 19, 20, ... - # Invalid: 17, 18, "19", 19.0, ... - factors: list[Annotated[int, Predicate(is_prime)]] # Valid: 2, 3, 5, 7, 11, ... - # Invalid: 4, 8, -2, 5.0, "prime", ... - - my_list: Annotated[list[int], Len(0, 10)] # Valid: [], [10, 20, 30, 40, 50] - # Invalid: (1, 2), ["abc"], [0] * 20 -``` - -## Documentation - -_While `annotated-types` avoids runtime checks for performance, users should not -construct invalid combinations such as `MultipleOf("non-numeric")` or `Annotated[int, Len(3)]`. -Downstream implementors may choose to raise an error, emit a warning, silently ignore -a metadata item, etc., if the metadata objects described below are used with an -incompatible type - or for any other reason!_ - -### Gt, Ge, Lt, Le - -Express inclusive and/or exclusive bounds on orderable values - which may be numbers, -dates, times, strings, sets, etc. Note that the boundary value need not be of the -same type that was annotated, so long as they can be compared: `Annotated[int, Gt(1.5)]` -is fine, for example, and implies that the value is an integer x such that `x > 1.5`. - -We suggest that implementors may also interpret `functools.partial(operator.le, 1.5)` -as being equivalent to `Gt(1.5)`, for users who wish to avoid a runtime dependency on -the `annotated-types` package. - -To be explicit, these types have the following meanings: - -* `Gt(x)` - value must be "Greater Than" `x` - equivalent to exclusive minimum -* `Ge(x)` - value must be "Greater than or Equal" to `x` - equivalent to inclusive minimum -* `Lt(x)` - value must be "Less Than" `x` - equivalent to exclusive maximum -* `Le(x)` - value must be "Less than or Equal" to `x` - equivalent to inclusive maximum - -### Interval - -`Interval(gt, ge, lt, le)` allows you to specify an upper and lower bound with a single -metadata object. `None` attributes should be ignored, and non-`None` attributes -treated as per the single bounds above. - -### MultipleOf - -`MultipleOf(multiple_of=x)` might be interpreted in two ways: - -1. Python semantics, implying `value % multiple_of == 0`, or -2. [JSONschema semantics](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.1), - where `int(value / multiple_of) == value / multiple_of`. - -We encourage users to be aware of these two common interpretations and their -distinct behaviours, especially since very large or non-integer numbers make -it easy to cause silent data corruption due to floating-point imprecision. - -We encourage libraries to carefully document which interpretation they implement. - -### MinLen, MaxLen, Len - -`Len()` implies that `min_length <= len(value) <= max_length` - lower and upper bounds are inclusive. - -As well as `Len()` which can optionally include upper and lower bounds, we also -provide `MinLen(x)` and `MaxLen(y)` which are equivalent to `Len(min_length=x)` -and `Len(max_length=y)` respectively. - -`Len`, `MinLen`, and `MaxLen` may be used with any type which supports `len(value)`. - -Examples of usage: - -* `Annotated[list, MaxLen(10)]` (or `Annotated[list, Len(max_length=10))`) - list must have a length of 10 or less -* `Annotated[str, MaxLen(10)]` - string must have a length of 10 or less -* `Annotated[list, MinLen(3))` (or `Annotated[list, Len(min_length=3))`) - list must have a length of 3 or more -* `Annotated[list, Len(4, 6)]` - list must have a length of 4, 5, or 6 -* `Annotated[list, Len(8, 8)]` - list must have a length of exactly 8 - -#### Changed in v0.4.0 - -* `min_inclusive` has been renamed to `min_length`, no change in meaning -* `max_exclusive` has been renamed to `max_length`, upper bound is now **inclusive** instead of **exclusive** -* The recommendation that slices are interpreted as `Len` has been removed due to ambiguity and different semantic - meaning of the upper bound in slices vs. `Len` - -See [issue #23](https://github.com/annotated-types/annotated-types/issues/23) for discussion. - -### Timezone - -`Timezone` can be used with a `datetime` or a `time` to express which timezones -are allowed. `Annotated[datetime, Timezone(None)]` must be a naive datetime. -`Timezone[...]` ([literal ellipsis](https://docs.python.org/3/library/constants.html#Ellipsis)) -expresses that any timezone-aware datetime is allowed. You may also pass a specific -timezone string or [`tzinfo`](https://docs.python.org/3/library/datetime.html#tzinfo-objects) -object such as `Timezone(timezone.utc)` or `Timezone("Africa/Abidjan")` to express that you only -allow a specific timezone, though we note that this is often a symptom of fragile design. - -#### Changed in v0.x.x - -* `Timezone` accepts [`tzinfo`](https://docs.python.org/3/library/datetime.html#tzinfo-objects) objects instead of - `timezone`, extending compatibility to [`zoneinfo`](https://docs.python.org/3/library/zoneinfo.html) and third party libraries. - -### Unit - -`Unit(unit: str)` expresses that the annotated numeric value is the magnitude of -a quantity with the specified unit. For example, `Annotated[float, Unit("m/s")]` -would be a float representing a velocity in meters per second. - -Please note that `annotated_types` itself makes no attempt to parse or validate -the unit string in any way. That is left entirely to downstream libraries, -such as [`pint`](https://pint.readthedocs.io) or -[`astropy.units`](https://docs.astropy.org/en/stable/units/). - -An example of how a library might use this metadata: - -```python -from annotated_types import Unit -from typing import Annotated, TypeVar, Callable, Any, get_origin, get_args - -# given a type annotated with a unit: -Meters = Annotated[float, Unit("m")] - - -# you can cast the annotation to a specific unit type with any -# callable that accepts a string and returns the desired type -T = TypeVar("T") -def cast_unit(tp: Any, unit_cls: Callable[[str], T]) -> T | None: - if get_origin(tp) is Annotated: - for arg in get_args(tp): - if isinstance(arg, Unit): - return unit_cls(arg.unit) - return None - - -# using `pint` -import pint -pint_unit = cast_unit(Meters, pint.Unit) - - -# using `astropy.units` -import astropy.units as u -astropy_unit = cast_unit(Meters, u.Unit) -``` - -### Predicate - -`Predicate(func: Callable)` expresses that `func(value)` is truthy for valid values. -Users should prefer the statically inspectable metadata above, but if you need -the full power and flexibility of arbitrary runtime predicates... here it is. - -For some common constraints, we provide generic types: - -* `IsLower = Annotated[T, Predicate(str.islower)]` -* `IsUpper = Annotated[T, Predicate(str.isupper)]` -* `IsDigit = Annotated[T, Predicate(str.isdigit)]` -* `IsFinite = Annotated[T, Predicate(math.isfinite)]` -* `IsNotFinite = Annotated[T, Predicate(Not(math.isfinite))]` -* `IsNan = Annotated[T, Predicate(math.isnan)]` -* `IsNotNan = Annotated[T, Predicate(Not(math.isnan))]` -* `IsInfinite = Annotated[T, Predicate(math.isinf)]` -* `IsNotInfinite = Annotated[T, Predicate(Not(math.isinf))]` - -so that you can write e.g. `x: IsFinite[float] = 2.0` instead of the longer -(but exactly equivalent) `x: Annotated[float, Predicate(math.isfinite)] = 2.0`. - -Some libraries might have special logic to handle known or understandable predicates, -for example by checking for `str.isdigit` and using its presence to both call custom -logic to enforce digit-only strings, and customise some generated external schema. -Users are therefore encouraged to avoid indirection like `lambda s: s.lower()`, in -favor of introspectable methods such as `str.lower` or `re.compile("pattern").search`. - -To enable basic negation of commonly used predicates like `math.isnan` without introducing introspection that makes it impossible for implementers to introspect the predicate we provide a `Not` wrapper that simply negates the predicate in an introspectable manner. Several of the predicates listed above are created in this manner. - -We do not specify what behaviour should be expected for predicates that raise -an exception. For example `Annotated[int, Predicate(str.isdigit)]` might silently -skip invalid constraints, or statically raise an error; or it might try calling it -and then propagate or discard the resulting -`TypeError: descriptor 'isdigit' for 'str' objects doesn't apply to a 'int' object` -exception. We encourage libraries to document the behaviour they choose. - -### Doc - -`doc()` can be used to add documentation information in `Annotated`, for function and method parameters, variables, class attributes, return types, and any place where `Annotated` can be used. - -It expects a value that can be statically analyzed, as the main use case is for static analysis, editors, documentation generators, and similar tools. - -It returns a `DocInfo` class with a single attribute `documentation` containing the value passed to `doc()`. - -This is the early adopter's alternative form of the [`typing-doc` proposal](https://github.com/tiangolo/fastapi/blob/typing-doc/typing_doc.md). - -### Integrating downstream types with `GroupedMetadata` - -Implementers may choose to provide a convenience wrapper that groups multiple pieces of metadata. -This can help reduce verbosity and cognitive overhead for users. -For example, an implementer like Pydantic might provide a `Field` or `Meta` type that accepts keyword arguments and transforms these into low-level metadata: - -```python -from dataclasses import dataclass -from typing import Iterator -from annotated_types import GroupedMetadata, Ge - -@dataclass -class Field(GroupedMetadata): - ge: int | None = None - description: str | None = None - - def __iter__(self) -> Iterator[object]: - # Iterating over a GroupedMetadata object should yield annotated-types - # constraint metadata objects which describe it as fully as possible, - # and may include other unknown objects too. - if self.ge is not None: - yield Ge(self.ge) - if self.description is not None: - yield Description(self.description) -``` - -Libraries consuming annotated-types constraints should check for `GroupedMetadata` and unpack it by iterating over the object and treating the results as if they had been "unpacked" in the `Annotated` type. The same logic should be applied to the [PEP 646 `Unpack` type](https://peps.python.org/pep-0646/), so that `Annotated[T, Field(...)]`, `Annotated[T, Unpack[Field(...)]]` and `Annotated[T, *Field(...)]` are all treated consistently. - -Libraries consuming annotated-types should also ignore any metadata they do not recongize that came from unpacking a `GroupedMetadata`, just like they ignore unrecognized metadata in `Annotated` itself. - -Our own `annotated_types.Interval` class is a `GroupedMetadata` which unpacks itself into `Gt`, `Lt`, etc., so this is not an abstract concern. Similarly, `annotated_types.Len` is a `GroupedMetadata` which unpacks itself into `MinLen` (optionally) and `MaxLen`. - -### Consuming metadata - -We intend to not be prescriptive as to _how_ the metadata and constraints are used, but as an example of how one might parse constraints from types annotations see our [implementation in `test_main.py`](https://github.com/annotated-types/annotated-types/blob/f59cf6d1b5255a0fe359b93896759a180bec30ae/tests/test_main.py#L94-L103). - -It is up to the implementer to determine how this metadata is used. -You could use the metadata for runtime type checking, for generating schemas or to generate example data, amongst other use cases. - -## Design & History - -This package was designed at the PyCon 2022 sprints by the maintainers of Pydantic -and Hypothesis, with the goal of making it as easy as possible for end-users to -provide more informative annotations for use by runtime libraries. - -It is deliberately minimal, and following PEP-593 allows considerable downstream -discretion in what (if anything!) they choose to support. Nonetheless, we expect -that staying simple and covering _only_ the most common use-cases will give users -and maintainers the best experience we can. If you'd like more constraints for your -types - follow our lead, by defining them and documenting them downstream! diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/RECORD deleted file mode 100644 index 7c37220..0000000 --- a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/RECORD +++ /dev/null @@ -1,10 +0,0 @@ -annotated_types-0.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -annotated_types-0.7.0.dist-info/METADATA,sha256=7ltqxksJJ0wCYFGBNIQCWTlWQGeAH0hRFdnK3CB895E,15046 -annotated_types-0.7.0.dist-info/RECORD,, -annotated_types-0.7.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87 -annotated_types-0.7.0.dist-info/licenses/LICENSE,sha256=_hBJiEsaDZNCkB6I4H8ykl0ksxIdmXK2poBfuYJLCV0,1083 -annotated_types/__init__.py,sha256=RynLsRKUEGI0KimXydlD1fZEfEzWwDo0Uon3zOKhG1Q,13819 -annotated_types/__pycache__/__init__.cpython-310.pyc,, -annotated_types/__pycache__/test_cases.cpython-310.pyc,, -annotated_types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -annotated_types/test_cases.py,sha256=zHFX6EpcMbGJ8FzBYDbO56bPwx_DYIVSKbZM-4B3_lg,6421 diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/WHEEL deleted file mode 100644 index 516596c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: hatchling 1.24.2 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE b/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE deleted file mode 100644 index d99323a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2022 the contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types/__init__.py b/write-message/venv/lib/python3.10/site-packages/annotated_types/__init__.py deleted file mode 100644 index 74e0dee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/annotated_types/__init__.py +++ /dev/null @@ -1,432 +0,0 @@ -import math -import sys -import types -from dataclasses import dataclass -from datetime import tzinfo -from typing import TYPE_CHECKING, Any, Callable, Iterator, Optional, SupportsFloat, SupportsIndex, TypeVar, Union - -if sys.version_info < (3, 8): - from typing_extensions import Protocol, runtime_checkable -else: - from typing import Protocol, runtime_checkable - -if sys.version_info < (3, 9): - from typing_extensions import Annotated, Literal -else: - from typing import Annotated, Literal - -if sys.version_info < (3, 10): - EllipsisType = type(Ellipsis) - KW_ONLY = {} - SLOTS = {} -else: - from types import EllipsisType - - KW_ONLY = {"kw_only": True} - SLOTS = {"slots": True} - - -__all__ = ( - 'BaseMetadata', - 'GroupedMetadata', - 'Gt', - 'Ge', - 'Lt', - 'Le', - 'Interval', - 'MultipleOf', - 'MinLen', - 'MaxLen', - 'Len', - 'Timezone', - 'Predicate', - 'LowerCase', - 'UpperCase', - 'IsDigits', - 'IsFinite', - 'IsNotFinite', - 'IsNan', - 'IsNotNan', - 'IsInfinite', - 'IsNotInfinite', - 'doc', - 'DocInfo', - '__version__', -) - -__version__ = '0.7.0' - - -T = TypeVar('T') - - -# arguments that start with __ are considered -# positional only -# see https://peps.python.org/pep-0484/#positional-only-arguments - - -class SupportsGt(Protocol): - def __gt__(self: T, __other: T) -> bool: - ... - - -class SupportsGe(Protocol): - def __ge__(self: T, __other: T) -> bool: - ... - - -class SupportsLt(Protocol): - def __lt__(self: T, __other: T) -> bool: - ... - - -class SupportsLe(Protocol): - def __le__(self: T, __other: T) -> bool: - ... - - -class SupportsMod(Protocol): - def __mod__(self: T, __other: T) -> T: - ... - - -class SupportsDiv(Protocol): - def __div__(self: T, __other: T) -> T: - ... - - -class BaseMetadata: - """Base class for all metadata. - - This exists mainly so that implementers - can do `isinstance(..., BaseMetadata)` while traversing field annotations. - """ - - __slots__ = () - - -@dataclass(frozen=True, **SLOTS) -class Gt(BaseMetadata): - """Gt(gt=x) implies that the value must be greater than x. - - It can be used with any type that supports the ``>`` operator, - including numbers, dates and times, strings, sets, and so on. - """ - - gt: SupportsGt - - -@dataclass(frozen=True, **SLOTS) -class Ge(BaseMetadata): - """Ge(ge=x) implies that the value must be greater than or equal to x. - - It can be used with any type that supports the ``>=`` operator, - including numbers, dates and times, strings, sets, and so on. - """ - - ge: SupportsGe - - -@dataclass(frozen=True, **SLOTS) -class Lt(BaseMetadata): - """Lt(lt=x) implies that the value must be less than x. - - It can be used with any type that supports the ``<`` operator, - including numbers, dates and times, strings, sets, and so on. - """ - - lt: SupportsLt - - -@dataclass(frozen=True, **SLOTS) -class Le(BaseMetadata): - """Le(le=x) implies that the value must be less than or equal to x. - - It can be used with any type that supports the ``<=`` operator, - including numbers, dates and times, strings, sets, and so on. - """ - - le: SupportsLe - - -@runtime_checkable -class GroupedMetadata(Protocol): - """A grouping of multiple objects, like typing.Unpack. - - `GroupedMetadata` on its own is not metadata and has no meaning. - All of the constraints and metadata should be fully expressable - in terms of the `BaseMetadata`'s returned by `GroupedMetadata.__iter__()`. - - Concrete implementations should override `GroupedMetadata.__iter__()` - to add their own metadata. - For example: - - >>> @dataclass - >>> class Field(GroupedMetadata): - >>> gt: float | None = None - >>> description: str | None = None - ... - >>> def __iter__(self) -> Iterable[object]: - >>> if self.gt is not None: - >>> yield Gt(self.gt) - >>> if self.description is not None: - >>> yield Description(self.gt) - - Also see the implementation of `Interval` below for an example. - - Parsers should recognize this and unpack it so that it can be used - both with and without unpacking: - - - `Annotated[int, Field(...)]` (parser must unpack Field) - - `Annotated[int, *Field(...)]` (PEP-646) - """ # noqa: trailing-whitespace - - @property - def __is_annotated_types_grouped_metadata__(self) -> Literal[True]: - return True - - def __iter__(self) -> Iterator[object]: - ... - - if not TYPE_CHECKING: - __slots__ = () # allow subclasses to use slots - - def __init_subclass__(cls, *args: Any, **kwargs: Any) -> None: - # Basic ABC like functionality without the complexity of an ABC - super().__init_subclass__(*args, **kwargs) - if cls.__iter__ is GroupedMetadata.__iter__: - raise TypeError("Can't subclass GroupedMetadata without implementing __iter__") - - def __iter__(self) -> Iterator[object]: # noqa: F811 - raise NotImplementedError # more helpful than "None has no attribute..." type errors - - -@dataclass(frozen=True, **KW_ONLY, **SLOTS) -class Interval(GroupedMetadata): - """Interval can express inclusive or exclusive bounds with a single object. - - It accepts keyword arguments ``gt``, ``ge``, ``lt``, and/or ``le``, which - are interpreted the same way as the single-bound constraints. - """ - - gt: Union[SupportsGt, None] = None - ge: Union[SupportsGe, None] = None - lt: Union[SupportsLt, None] = None - le: Union[SupportsLe, None] = None - - def __iter__(self) -> Iterator[BaseMetadata]: - """Unpack an Interval into zero or more single-bounds.""" - if self.gt is not None: - yield Gt(self.gt) - if self.ge is not None: - yield Ge(self.ge) - if self.lt is not None: - yield Lt(self.lt) - if self.le is not None: - yield Le(self.le) - - -@dataclass(frozen=True, **SLOTS) -class MultipleOf(BaseMetadata): - """MultipleOf(multiple_of=x) might be interpreted in two ways: - - 1. Python semantics, implying ``value % multiple_of == 0``, or - 2. JSONschema semantics, where ``int(value / multiple_of) == value / multiple_of`` - - We encourage users to be aware of these two common interpretations, - and libraries to carefully document which they implement. - """ - - multiple_of: Union[SupportsDiv, SupportsMod] - - -@dataclass(frozen=True, **SLOTS) -class MinLen(BaseMetadata): - """ - MinLen() implies minimum inclusive length, - e.g. ``len(value) >= min_length``. - """ - - min_length: Annotated[int, Ge(0)] - - -@dataclass(frozen=True, **SLOTS) -class MaxLen(BaseMetadata): - """ - MaxLen() implies maximum inclusive length, - e.g. ``len(value) <= max_length``. - """ - - max_length: Annotated[int, Ge(0)] - - -@dataclass(frozen=True, **SLOTS) -class Len(GroupedMetadata): - """ - Len() implies that ``min_length <= len(value) <= max_length``. - - Upper bound may be omitted or ``None`` to indicate no upper length bound. - """ - - min_length: Annotated[int, Ge(0)] = 0 - max_length: Optional[Annotated[int, Ge(0)]] = None - - def __iter__(self) -> Iterator[BaseMetadata]: - """Unpack a Len into zone or more single-bounds.""" - if self.min_length > 0: - yield MinLen(self.min_length) - if self.max_length is not None: - yield MaxLen(self.max_length) - - -@dataclass(frozen=True, **SLOTS) -class Timezone(BaseMetadata): - """Timezone(tz=...) requires a datetime to be aware (or ``tz=None``, naive). - - ``Annotated[datetime, Timezone(None)]`` must be a naive datetime. - ``Timezone[...]`` (the ellipsis literal) expresses that the datetime must be - tz-aware but any timezone is allowed. - - You may also pass a specific timezone string or tzinfo object such as - ``Timezone(timezone.utc)`` or ``Timezone("Africa/Abidjan")`` to express that - you only allow a specific timezone, though we note that this is often - a symptom of poor design. - """ - - tz: Union[str, tzinfo, EllipsisType, None] - - -@dataclass(frozen=True, **SLOTS) -class Unit(BaseMetadata): - """Indicates that the value is a physical quantity with the specified unit. - - It is intended for usage with numeric types, where the value represents the - magnitude of the quantity. For example, ``distance: Annotated[float, Unit('m')]`` - or ``speed: Annotated[float, Unit('m/s')]``. - - Interpretation of the unit string is left to the discretion of the consumer. - It is suggested to follow conventions established by python libraries that work - with physical quantities, such as - - - ``pint`` : - - ``astropy.units``: - - For indicating a quantity with a certain dimensionality but without a specific unit - it is recommended to use square brackets, e.g. `Annotated[float, Unit('[time]')]`. - Note, however, ``annotated_types`` itself makes no use of the unit string. - """ - - unit: str - - -@dataclass(frozen=True, **SLOTS) -class Predicate(BaseMetadata): - """``Predicate(func: Callable)`` implies `func(value)` is truthy for valid values. - - Users should prefer statically inspectable metadata, but if you need the full - power and flexibility of arbitrary runtime predicates... here it is. - - We provide a few predefined predicates for common string constraints: - ``IsLower = Predicate(str.islower)``, ``IsUpper = Predicate(str.isupper)``, and - ``IsDigits = Predicate(str.isdigit)``. Users are encouraged to use methods which - can be given special handling, and avoid indirection like ``lambda s: s.lower()``. - - Some libraries might have special logic to handle certain predicates, e.g. by - checking for `str.isdigit` and using its presence to both call custom logic to - enforce digit-only strings, and customise some generated external schema. - - We do not specify what behaviour should be expected for predicates that raise - an exception. For example `Annotated[int, Predicate(str.isdigit)]` might silently - skip invalid constraints, or statically raise an error; or it might try calling it - and then propagate or discard the resulting exception. - """ - - func: Callable[[Any], bool] - - def __repr__(self) -> str: - if getattr(self.func, "__name__", "") == "": - return f"{self.__class__.__name__}({self.func!r})" - if isinstance(self.func, (types.MethodType, types.BuiltinMethodType)) and ( - namespace := getattr(self.func.__self__, "__name__", None) - ): - return f"{self.__class__.__name__}({namespace}.{self.func.__name__})" - if isinstance(self.func, type(str.isascii)): # method descriptor - return f"{self.__class__.__name__}({self.func.__qualname__})" - return f"{self.__class__.__name__}({self.func.__name__})" - - -@dataclass -class Not: - func: Callable[[Any], bool] - - def __call__(self, __v: Any) -> bool: - return not self.func(__v) - - -_StrType = TypeVar("_StrType", bound=str) - -LowerCase = Annotated[_StrType, Predicate(str.islower)] -""" -Return True if the string is a lowercase string, False otherwise. - -A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string. -""" # noqa: E501 -UpperCase = Annotated[_StrType, Predicate(str.isupper)] -""" -Return True if the string is an uppercase string, False otherwise. - -A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string. -""" # noqa: E501 -IsDigit = Annotated[_StrType, Predicate(str.isdigit)] -IsDigits = IsDigit # type: ignore # plural for backwards compatibility, see #63 -""" -Return True if the string is a digit string, False otherwise. - -A string is a digit string if all characters in the string are digits and there is at least one character in the string. -""" # noqa: E501 -IsAscii = Annotated[_StrType, Predicate(str.isascii)] -""" -Return True if all characters in the string are ASCII, False otherwise. - -ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too. -""" - -_NumericType = TypeVar('_NumericType', bound=Union[SupportsFloat, SupportsIndex]) -IsFinite = Annotated[_NumericType, Predicate(math.isfinite)] -"""Return True if x is neither an infinity nor a NaN, and False otherwise.""" -IsNotFinite = Annotated[_NumericType, Predicate(Not(math.isfinite))] -"""Return True if x is one of infinity or NaN, and False otherwise""" -IsNan = Annotated[_NumericType, Predicate(math.isnan)] -"""Return True if x is a NaN (not a number), and False otherwise.""" -IsNotNan = Annotated[_NumericType, Predicate(Not(math.isnan))] -"""Return True if x is anything but NaN (not a number), and False otherwise.""" -IsInfinite = Annotated[_NumericType, Predicate(math.isinf)] -"""Return True if x is a positive or negative infinity, and False otherwise.""" -IsNotInfinite = Annotated[_NumericType, Predicate(Not(math.isinf))] -"""Return True if x is neither a positive or negative infinity, and False otherwise.""" - -try: - from typing_extensions import DocInfo, doc # type: ignore [attr-defined] -except ImportError: - - @dataclass(frozen=True, **SLOTS) - class DocInfo: # type: ignore [no-redef] - """ " - The return value of doc(), mainly to be used by tools that want to extract the - Annotated documentation at runtime. - """ - - documentation: str - """The documentation string passed to doc().""" - - def doc( - documentation: str, - ) -> DocInfo: - """ - Add documentation to a type annotation inside of Annotated. - - For example: - - >>> def hi(name: Annotated[int, doc("The name of the user")]) -> None: ... - """ - return DocInfo(documentation) diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/annotated_types/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 42840b0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/annotated_types/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types/__pycache__/test_cases.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/annotated_types/__pycache__/test_cases.cpython-310.pyc deleted file mode 100644 index 9fe7375..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/annotated_types/__pycache__/test_cases.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types/py.typed b/write-message/venv/lib/python3.10/site-packages/annotated_types/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/annotated_types/test_cases.py b/write-message/venv/lib/python3.10/site-packages/annotated_types/test_cases.py deleted file mode 100644 index d9164d6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/annotated_types/test_cases.py +++ /dev/null @@ -1,151 +0,0 @@ -import math -import sys -from datetime import date, datetime, timedelta, timezone -from decimal import Decimal -from typing import Any, Dict, Iterable, Iterator, List, NamedTuple, Set, Tuple - -if sys.version_info < (3, 9): - from typing_extensions import Annotated -else: - from typing import Annotated - -import annotated_types as at - - -class Case(NamedTuple): - """ - A test case for `annotated_types`. - """ - - annotation: Any - valid_cases: Iterable[Any] - invalid_cases: Iterable[Any] - - -def cases() -> Iterable[Case]: - # Gt, Ge, Lt, Le - yield Case(Annotated[int, at.Gt(4)], (5, 6, 1000), (4, 0, -1)) - yield Case(Annotated[float, at.Gt(0.5)], (0.6, 0.7, 0.8, 0.9), (0.5, 0.0, -0.1)) - yield Case( - Annotated[datetime, at.Gt(datetime(2000, 1, 1))], - [datetime(2000, 1, 2), datetime(2000, 1, 3)], - [datetime(2000, 1, 1), datetime(1999, 12, 31)], - ) - yield Case( - Annotated[datetime, at.Gt(date(2000, 1, 1))], - [date(2000, 1, 2), date(2000, 1, 3)], - [date(2000, 1, 1), date(1999, 12, 31)], - ) - yield Case( - Annotated[datetime, at.Gt(Decimal('1.123'))], - [Decimal('1.1231'), Decimal('123')], - [Decimal('1.123'), Decimal('0')], - ) - - yield Case(Annotated[int, at.Ge(4)], (4, 5, 6, 1000, 4), (0, -1)) - yield Case(Annotated[float, at.Ge(0.5)], (0.5, 0.6, 0.7, 0.8, 0.9), (0.4, 0.0, -0.1)) - yield Case( - Annotated[datetime, at.Ge(datetime(2000, 1, 1))], - [datetime(2000, 1, 2), datetime(2000, 1, 3)], - [datetime(1998, 1, 1), datetime(1999, 12, 31)], - ) - - yield Case(Annotated[int, at.Lt(4)], (0, -1), (4, 5, 6, 1000, 4)) - yield Case(Annotated[float, at.Lt(0.5)], (0.4, 0.0, -0.1), (0.5, 0.6, 0.7, 0.8, 0.9)) - yield Case( - Annotated[datetime, at.Lt(datetime(2000, 1, 1))], - [datetime(1999, 12, 31), datetime(1999, 12, 31)], - [datetime(2000, 1, 2), datetime(2000, 1, 3)], - ) - - yield Case(Annotated[int, at.Le(4)], (4, 0, -1), (5, 6, 1000)) - yield Case(Annotated[float, at.Le(0.5)], (0.5, 0.0, -0.1), (0.6, 0.7, 0.8, 0.9)) - yield Case( - Annotated[datetime, at.Le(datetime(2000, 1, 1))], - [datetime(2000, 1, 1), datetime(1999, 12, 31)], - [datetime(2000, 1, 2), datetime(2000, 1, 3)], - ) - - # Interval - yield Case(Annotated[int, at.Interval(gt=4)], (5, 6, 1000), (4, 0, -1)) - yield Case(Annotated[int, at.Interval(gt=4, lt=10)], (5, 6), (4, 10, 1000, 0, -1)) - yield Case(Annotated[float, at.Interval(ge=0.5, le=1)], (0.5, 0.9, 1), (0.49, 1.1)) - yield Case( - Annotated[datetime, at.Interval(gt=datetime(2000, 1, 1), le=datetime(2000, 1, 3))], - [datetime(2000, 1, 2), datetime(2000, 1, 3)], - [datetime(2000, 1, 1), datetime(2000, 1, 4)], - ) - - yield Case(Annotated[int, at.MultipleOf(multiple_of=3)], (0, 3, 9), (1, 2, 4)) - yield Case(Annotated[float, at.MultipleOf(multiple_of=0.5)], (0, 0.5, 1, 1.5), (0.4, 1.1)) - - # lengths - - yield Case(Annotated[str, at.MinLen(3)], ('123', '1234', 'x' * 10), ('', '1', '12')) - yield Case(Annotated[str, at.Len(3)], ('123', '1234', 'x' * 10), ('', '1', '12')) - yield Case(Annotated[List[int], at.MinLen(3)], ([1, 2, 3], [1, 2, 3, 4], [1] * 10), ([], [1], [1, 2])) - yield Case(Annotated[List[int], at.Len(3)], ([1, 2, 3], [1, 2, 3, 4], [1] * 10), ([], [1], [1, 2])) - - yield Case(Annotated[str, at.MaxLen(4)], ('', '1234'), ('12345', 'x' * 10)) - yield Case(Annotated[str, at.Len(0, 4)], ('', '1234'), ('12345', 'x' * 10)) - yield Case(Annotated[List[str], at.MaxLen(4)], ([], ['a', 'bcdef'], ['a', 'b', 'c']), (['a'] * 5, ['b'] * 10)) - yield Case(Annotated[List[str], at.Len(0, 4)], ([], ['a', 'bcdef'], ['a', 'b', 'c']), (['a'] * 5, ['b'] * 10)) - - yield Case(Annotated[str, at.Len(3, 5)], ('123', '12345'), ('', '1', '12', '123456', 'x' * 10)) - yield Case(Annotated[str, at.Len(3, 3)], ('123',), ('12', '1234')) - - yield Case(Annotated[Dict[int, int], at.Len(2, 3)], [{1: 1, 2: 2}], [{}, {1: 1}, {1: 1, 2: 2, 3: 3, 4: 4}]) - yield Case(Annotated[Set[int], at.Len(2, 3)], ({1, 2}, {1, 2, 3}), (set(), {1}, {1, 2, 3, 4})) - yield Case(Annotated[Tuple[int, ...], at.Len(2, 3)], ((1, 2), (1, 2, 3)), ((), (1,), (1, 2, 3, 4))) - - # Timezone - - yield Case( - Annotated[datetime, at.Timezone(None)], [datetime(2000, 1, 1)], [datetime(2000, 1, 1, tzinfo=timezone.utc)] - ) - yield Case( - Annotated[datetime, at.Timezone(...)], [datetime(2000, 1, 1, tzinfo=timezone.utc)], [datetime(2000, 1, 1)] - ) - yield Case( - Annotated[datetime, at.Timezone(timezone.utc)], - [datetime(2000, 1, 1, tzinfo=timezone.utc)], - [datetime(2000, 1, 1), datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=6)))], - ) - yield Case( - Annotated[datetime, at.Timezone('Europe/London')], - [datetime(2000, 1, 1, tzinfo=timezone(timedelta(0), name='Europe/London'))], - [datetime(2000, 1, 1), datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=6)))], - ) - - # Quantity - - yield Case(Annotated[float, at.Unit(unit='m')], (5, 4.2), ('5m', '4.2m')) - - # predicate types - - yield Case(at.LowerCase[str], ['abc', 'foobar'], ['', 'A', 'Boom']) - yield Case(at.UpperCase[str], ['ABC', 'DEFO'], ['', 'a', 'abc', 'AbC']) - yield Case(at.IsDigit[str], ['123'], ['', 'ab', 'a1b2']) - yield Case(at.IsAscii[str], ['123', 'foo bar'], ['£100', '😊', 'whatever 👀']) - - yield Case(Annotated[int, at.Predicate(lambda x: x % 2 == 0)], [0, 2, 4], [1, 3, 5]) - - yield Case(at.IsFinite[float], [1.23], [math.nan, math.inf, -math.inf]) - yield Case(at.IsNotFinite[float], [math.nan, math.inf], [1.23]) - yield Case(at.IsNan[float], [math.nan], [1.23, math.inf]) - yield Case(at.IsNotNan[float], [1.23, math.inf], [math.nan]) - yield Case(at.IsInfinite[float], [math.inf], [math.nan, 1.23]) - yield Case(at.IsNotInfinite[float], [math.nan, 1.23], [math.inf]) - - # check stacked predicates - yield Case(at.IsInfinite[Annotated[float, at.Predicate(lambda x: x > 0)]], [math.inf], [-math.inf, 1.23, math.nan]) - - # doc - yield Case(Annotated[int, at.doc("A number")], [1, 2], []) - - # custom GroupedMetadata - class MyCustomGroupedMetadata(at.GroupedMetadata): - def __iter__(self) -> Iterator[at.Predicate]: - yield at.Predicate(lambda x: float(x).is_integer()) - - yield Case(Annotated[float, MyCustomGroupedMetadata()], [0, 2.0], [0.01, 1.5]) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/METADATA deleted file mode 100644 index 0670bdd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/METADATA +++ /dev/null @@ -1,93 +0,0 @@ -Metadata-Version: 2.4 -Name: anyio -Version: 4.10.0 -Summary: High-level concurrency and networking framework on top of asyncio or Trio -Author-email: Alex Grönholm -License-Expression: MIT -Project-URL: Documentation, https://anyio.readthedocs.io/en/latest/ -Project-URL: Changelog, https://anyio.readthedocs.io/en/stable/versionhistory.html -Project-URL: Source code, https://github.com/agronholm/anyio -Project-URL: Issue tracker, https://github.com/agronholm/anyio/issues -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Framework :: AnyIO -Classifier: Typing :: Typed -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -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 :: 3.13 -Classifier: Programming Language :: Python :: 3.14 -Requires-Python: >=3.9 -Description-Content-Type: text/x-rst -License-File: LICENSE -Requires-Dist: exceptiongroup>=1.0.2; python_version < "3.11" -Requires-Dist: idna>=2.8 -Requires-Dist: sniffio>=1.1 -Requires-Dist: typing_extensions>=4.5; python_version < "3.13" -Provides-Extra: trio -Requires-Dist: trio>=0.26.1; extra == "trio" -Dynamic: license-file - -.. image:: https://github.com/agronholm/anyio/actions/workflows/test.yml/badge.svg - :target: https://github.com/agronholm/anyio/actions/workflows/test.yml - :alt: Build Status -.. image:: https://coveralls.io/repos/github/agronholm/anyio/badge.svg?branch=master - :target: https://coveralls.io/github/agronholm/anyio?branch=master - :alt: Code Coverage -.. image:: https://readthedocs.org/projects/anyio/badge/?version=latest - :target: https://anyio.readthedocs.io/en/latest/?badge=latest - :alt: Documentation -.. image:: https://badges.gitter.im/gitterHQ/gitter.svg - :target: https://gitter.im/python-trio/AnyIO - :alt: Gitter chat - -AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio_ or -Trio_. It implements Trio-like `structured concurrency`_ (SC) on top of asyncio and works in harmony -with the native SC of Trio itself. - -Applications and libraries written against AnyIO's API will run unmodified on either asyncio_ or -Trio_. AnyIO can also be adopted into a library or application incrementally – bit by bit, no full -refactoring necessary. It will blend in with the native libraries of your chosen backend. - -To find out why you might want to use AnyIO's APIs instead of asyncio's, you can read about it -`here `_. - -Documentation -------------- - -View full documentation at: https://anyio.readthedocs.io/ - -Features --------- - -AnyIO offers the following functionality: - -* Task groups (nurseries_ in trio terminology) -* High-level networking (TCP, UDP and UNIX sockets) - - * `Happy eyeballs`_ algorithm for TCP connections (more robust than that of asyncio on Python - 3.8) - * async/await style UDP sockets (unlike asyncio where you still have to use Transports and - Protocols) - -* A versatile API for byte streams and object streams -* Inter-task synchronization and communication (locks, conditions, events, semaphores, object - streams) -* Worker threads -* Subprocesses -* Asynchronous file I/O (using worker threads) -* Signal handling - -AnyIO also comes with its own pytest_ plugin which also supports asynchronous fixtures. -It even works with the popular Hypothesis_ library. - -.. _asyncio: https://docs.python.org/3/library/asyncio.html -.. _Trio: https://github.com/python-trio/trio -.. _structured concurrency: https://en.wikipedia.org/wiki/Structured_concurrency -.. _nurseries: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning -.. _Happy eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs -.. _pytest: https://docs.pytest.org/en/latest/ -.. _Hypothesis: https://hypothesis.works/ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/RECORD deleted file mode 100644 index fde2326..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/RECORD +++ /dev/null @@ -1,90 +0,0 @@ -anyio-4.10.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -anyio-4.10.0.dist-info/METADATA,sha256=1AD_60gPgqxWKsO54FUTbKDQHyni5j_56_XQinKJ9LQ,4014 -anyio-4.10.0.dist-info/RECORD,, -anyio-4.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 -anyio-4.10.0.dist-info/entry_points.txt,sha256=_d6Yu6uiaZmNe0CydowirE9Cmg7zUL2g08tQpoS3Qvc,39 -anyio-4.10.0.dist-info/licenses/LICENSE,sha256=U2GsncWPLvX9LpsJxoKXwX8ElQkJu8gCO9uC6s8iwrA,1081 -anyio-4.10.0.dist-info/top_level.txt,sha256=QglSMiWX8_5dpoVAEIHdEYzvqFMdSYWmCj6tYw2ITkQ,6 -anyio/__init__.py,sha256=z3IyWgWQuxCi-KUwma-1LSys4WB50mV2N8FvS9_IePE,5955 -anyio/__pycache__/__init__.cpython-310.pyc,, -anyio/__pycache__/from_thread.cpython-310.pyc,, -anyio/__pycache__/lowlevel.cpython-310.pyc,, -anyio/__pycache__/pytest_plugin.cpython-310.pyc,, -anyio/__pycache__/to_interpreter.cpython-310.pyc,, -anyio/__pycache__/to_process.cpython-310.pyc,, -anyio/__pycache__/to_thread.cpython-310.pyc,, -anyio/_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -anyio/_backends/__pycache__/__init__.cpython-310.pyc,, -anyio/_backends/__pycache__/_asyncio.cpython-310.pyc,, -anyio/_backends/__pycache__/_trio.cpython-310.pyc,, -anyio/_backends/_asyncio.py,sha256=YXpQJ0C-tNiYvZdElVa3zGflG_Jdvf7FNDiG9-THhMg,97359 -anyio/_backends/_trio.py,sha256=tRGDtos6xmqmGlstfI8wEjGvhZq0y_SYTaM2m8zatRU,41963 -anyio/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -anyio/_core/__pycache__/__init__.cpython-310.pyc,, -anyio/_core/__pycache__/_asyncio_selector_thread.cpython-310.pyc,, -anyio/_core/__pycache__/_contextmanagers.cpython-310.pyc,, -anyio/_core/__pycache__/_eventloop.cpython-310.pyc,, -anyio/_core/__pycache__/_exceptions.cpython-310.pyc,, -anyio/_core/__pycache__/_fileio.cpython-310.pyc,, -anyio/_core/__pycache__/_resources.cpython-310.pyc,, -anyio/_core/__pycache__/_signals.cpython-310.pyc,, -anyio/_core/__pycache__/_sockets.cpython-310.pyc,, -anyio/_core/__pycache__/_streams.cpython-310.pyc,, -anyio/_core/__pycache__/_subprocesses.cpython-310.pyc,, -anyio/_core/__pycache__/_synchronization.cpython-310.pyc,, -anyio/_core/__pycache__/_tasks.cpython-310.pyc,, -anyio/_core/__pycache__/_tempfile.cpython-310.pyc,, -anyio/_core/__pycache__/_testing.cpython-310.pyc,, -anyio/_core/__pycache__/_typedattr.cpython-310.pyc,, -anyio/_core/_asyncio_selector_thread.py,sha256=2PdxFM3cs02Kp6BSppbvmRT7q7asreTW5FgBxEsflBo,5626 -anyio/_core/_contextmanagers.py,sha256=YInBCabiEeS-UaP_Jdxa1CaFC71ETPW8HZTHIM8Rsc8,7215 -anyio/_core/_eventloop.py,sha256=t_tAwBFPjF8jrZGjlJ6bbYy6KA3bjsbZxV9mvh9t1i0,4695 -anyio/_core/_exceptions.py,sha256=uQ9yXs3gRghZiuxiWtbvVlHB6CvCRtxObKMWF-Mnz18,3683 -anyio/_core/_fileio.py,sha256=KATysDZP7bvwwjpUwEaGAc0xGouJgAPqNVpnBMTsToY,23332 -anyio/_core/_resources.py,sha256=NbmU5O5UX3xEyACnkmYX28Fmwdl-f-ny0tHym26e0w0,435 -anyio/_core/_signals.py,sha256=vulT1M1xdLYtAR-eY5TamIgaf1WTlOwOrMGwswlTTr8,905 -anyio/_core/_sockets.py,sha256=MRo3vVzBLnWwA0DqjWhJ2ICj_XKQ78BtWxdrSAwKcxU,32232 -anyio/_core/_streams.py,sha256=OnaKgoDD-FcMSwLvkoAUGP51sG2ZdRvMpxt9q2w1gYA,1804 -anyio/_core/_subprocesses.py,sha256=EXm5igL7dj55iYkPlbYVAqtbqxJxjU-6OndSTIx9SRg,8047 -anyio/_core/_synchronization.py,sha256=76KyUbGD3A3eCXPrLnOccQfRsNSxIcoR36JeK1P4VFQ,20306 -anyio/_core/_tasks.py,sha256=f3CuWwo06cCZ6jaOv-JHFKWkgpgf2cvaF25Oh4augMA,4757 -anyio/_core/_tempfile.py,sha256=lHb7CW4FyIlpkf5ADAf4VmLHCKwEHF9nxqNyBCFFUiA,19697 -anyio/_core/_testing.py,sha256=YUGwA5cgFFbUTv4WFd7cv_BSVr4ryTtPp8owQA3JdWE,2118 -anyio/_core/_typedattr.py,sha256=P4ozZikn3-DbpoYcvyghS_FOYAgbmUxeoU8-L_07pZM,2508 -anyio/abc/__init__.py,sha256=6mWhcl_pGXhrgZVHP_TCfMvIXIOp9mroEFM90fYCU_U,2869 -anyio/abc/__pycache__/__init__.cpython-310.pyc,, -anyio/abc/__pycache__/_eventloop.cpython-310.pyc,, -anyio/abc/__pycache__/_resources.cpython-310.pyc,, -anyio/abc/__pycache__/_sockets.cpython-310.pyc,, -anyio/abc/__pycache__/_streams.cpython-310.pyc,, -anyio/abc/__pycache__/_subprocesses.cpython-310.pyc,, -anyio/abc/__pycache__/_tasks.cpython-310.pyc,, -anyio/abc/__pycache__/_testing.cpython-310.pyc,, -anyio/abc/_eventloop.py,sha256=_rrVDoNAS9yIFvSE70ewoppYd_9zNbRjPFl5UPMSR8I,10729 -anyio/abc/_resources.py,sha256=DrYvkNN1hH6Uvv5_5uKySvDsnknGVDe8FCKfko0VtN8,783 -anyio/abc/_sockets.py,sha256=ECTY0jLEF18gryANHR3vFzXzGdZ-xPwELq1QdgOb0Jo,13258 -anyio/abc/_streams.py,sha256=005GKSCXGprxnhucILboSqc2JFovECZk9m3p-qqxXVc,7640 -anyio/abc/_subprocesses.py,sha256=cumAPJTktOQtw63IqG0lDpyZqu_l1EElvQHMiwJgL08,2067 -anyio/abc/_tasks.py,sha256=Jh4LXVz1DoRacOnw1rwAS9wujNiEWK9oqdF0cTEhhNA,3604 -anyio/abc/_testing.py,sha256=tBJUzkSfOXJw23fe8qSJ03kJlShOYjjaEyFB6k6MYT8,1821 -anyio/from_thread.py,sha256=t8B_amqFBqlJy8X18mhvpYkhzeSXmRsI-ep6Yg04H4M,17678 -anyio/lowlevel.py,sha256=IisVkje5kwqOCpe-RgBjGCvlr-JBFGBrkobR7iZ3Fv4,4153 -anyio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -anyio/pytest_plugin.py,sha256=qXNwk9Pa7hPQKWocgLl9qijqKGMkGzdH2wJa-jPkGUM,9375 -anyio/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -anyio/streams/__pycache__/__init__.cpython-310.pyc,, -anyio/streams/__pycache__/buffered.cpython-310.pyc,, -anyio/streams/__pycache__/file.cpython-310.pyc,, -anyio/streams/__pycache__/memory.cpython-310.pyc,, -anyio/streams/__pycache__/stapled.cpython-310.pyc,, -anyio/streams/__pycache__/text.cpython-310.pyc,, -anyio/streams/__pycache__/tls.cpython-310.pyc,, -anyio/streams/buffered.py,sha256=joUPdz0OoRfKgGmMpHI9vZyMNm6ly9iFlofrZUPs9cQ,6162 -anyio/streams/file.py,sha256=6uoTNb5KbMoj-6gS3_xrrL8uZN8Q4iIvOS1WtGyFfKw,4383 -anyio/streams/memory.py,sha256=GcbF3cahdsdFZtcTZaIKpZXPDZKogj18wWPPmE0OmGU,10620 -anyio/streams/stapled.py,sha256=U09pCrmOw9kkNhe6tKopsm1QIMT1lFTFvtb-A7SIe4k,4302 -anyio/streams/text.py,sha256=tCJ8ljavGM-HY0aL-5Twxv-Kyw1BfR0B4OtVIB6kZ9w,5662 -anyio/streams/tls.py,sha256=siSaaRyX-XnfC7Jbn9VjtIdVzJkDsvIW_2pSEVheDFQ,15275 -anyio/to_interpreter.py,sha256=Z0-kLCxlITjFG_RM_TNdUlEnog94l48GXVDZ80w0URc,6986 -anyio/to_process.py,sha256=ZvruelRM-HNmqDaql4sdNODg2QD_uSlwSCxnV4OhsfQ,9595 -anyio/to_thread.py,sha256=WM2JQ2MbVsd5D5CM08bQiTwzZIvpsGjfH1Fy247KoDQ,2396 diff --git a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/WHEEL deleted file mode 100644 index e7fa31b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (80.9.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/entry_points.txt b/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/entry_points.txt deleted file mode 100644 index 44dd9bd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[pytest11] -anyio = anyio.pytest_plugin diff --git a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/licenses/LICENSE b/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/licenses/LICENSE deleted file mode 100644 index 104eebf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/licenses/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Alex Grönholm - -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/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/top_level.txt deleted file mode 100644 index c77c069..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio-4.10.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -anyio diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__init__.py b/write-message/venv/lib/python3.10/site-packages/anyio/__init__.py deleted file mode 100644 index 791a390..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/__init__.py +++ /dev/null @@ -1,108 +0,0 @@ -from __future__ import annotations - -from ._core._contextmanagers import AsyncContextManagerMixin as AsyncContextManagerMixin -from ._core._contextmanagers import ContextManagerMixin as ContextManagerMixin -from ._core._eventloop import current_time as current_time -from ._core._eventloop import get_all_backends as get_all_backends -from ._core._eventloop import get_cancelled_exc_class as get_cancelled_exc_class -from ._core._eventloop import run as run -from ._core._eventloop import sleep as sleep -from ._core._eventloop import sleep_forever as sleep_forever -from ._core._eventloop import sleep_until as sleep_until -from ._core._exceptions import BrokenResourceError as BrokenResourceError -from ._core._exceptions import BrokenWorkerInterpreter as BrokenWorkerInterpreter -from ._core._exceptions import BrokenWorkerProcess as BrokenWorkerProcess -from ._core._exceptions import BusyResourceError as BusyResourceError -from ._core._exceptions import ClosedResourceError as ClosedResourceError -from ._core._exceptions import ConnectionFailed as ConnectionFailed -from ._core._exceptions import DelimiterNotFound as DelimiterNotFound -from ._core._exceptions import EndOfStream as EndOfStream -from ._core._exceptions import IncompleteRead as IncompleteRead -from ._core._exceptions import TypedAttributeLookupError as TypedAttributeLookupError -from ._core._exceptions import WouldBlock as WouldBlock -from ._core._fileio import AsyncFile as AsyncFile -from ._core._fileio import Path as Path -from ._core._fileio import open_file as open_file -from ._core._fileio import wrap_file as wrap_file -from ._core._resources import aclose_forcefully as aclose_forcefully -from ._core._signals import open_signal_receiver as open_signal_receiver -from ._core._sockets import TCPConnectable as TCPConnectable -from ._core._sockets import UNIXConnectable as UNIXConnectable -from ._core._sockets import as_connectable as as_connectable -from ._core._sockets import connect_tcp as connect_tcp -from ._core._sockets import connect_unix as connect_unix -from ._core._sockets import create_connected_udp_socket as create_connected_udp_socket -from ._core._sockets import ( - create_connected_unix_datagram_socket as create_connected_unix_datagram_socket, -) -from ._core._sockets import create_tcp_listener as create_tcp_listener -from ._core._sockets import create_udp_socket as create_udp_socket -from ._core._sockets import create_unix_datagram_socket as create_unix_datagram_socket -from ._core._sockets import create_unix_listener as create_unix_listener -from ._core._sockets import getaddrinfo as getaddrinfo -from ._core._sockets import getnameinfo as getnameinfo -from ._core._sockets import notify_closing as notify_closing -from ._core._sockets import wait_readable as wait_readable -from ._core._sockets import wait_socket_readable as wait_socket_readable -from ._core._sockets import wait_socket_writable as wait_socket_writable -from ._core._sockets import wait_writable as wait_writable -from ._core._streams import create_memory_object_stream as create_memory_object_stream -from ._core._subprocesses import open_process as open_process -from ._core._subprocesses import run_process as run_process -from ._core._synchronization import CapacityLimiter as CapacityLimiter -from ._core._synchronization import ( - CapacityLimiterStatistics as CapacityLimiterStatistics, -) -from ._core._synchronization import Condition as Condition -from ._core._synchronization import ConditionStatistics as ConditionStatistics -from ._core._synchronization import Event as Event -from ._core._synchronization import EventStatistics as EventStatistics -from ._core._synchronization import Lock as Lock -from ._core._synchronization import LockStatistics as LockStatistics -from ._core._synchronization import ResourceGuard as ResourceGuard -from ._core._synchronization import Semaphore as Semaphore -from ._core._synchronization import SemaphoreStatistics as SemaphoreStatistics -from ._core._tasks import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED -from ._core._tasks import CancelScope as CancelScope -from ._core._tasks import create_task_group as create_task_group -from ._core._tasks import current_effective_deadline as current_effective_deadline -from ._core._tasks import fail_after as fail_after -from ._core._tasks import move_on_after as move_on_after -from ._core._tempfile import NamedTemporaryFile as NamedTemporaryFile -from ._core._tempfile import SpooledTemporaryFile as SpooledTemporaryFile -from ._core._tempfile import TemporaryDirectory as TemporaryDirectory -from ._core._tempfile import TemporaryFile as TemporaryFile -from ._core._tempfile import gettempdir as gettempdir -from ._core._tempfile import gettempdirb as gettempdirb -from ._core._tempfile import mkdtemp as mkdtemp -from ._core._tempfile import mkstemp as mkstemp -from ._core._testing import TaskInfo as TaskInfo -from ._core._testing import get_current_task as get_current_task -from ._core._testing import get_running_tasks as get_running_tasks -from ._core._testing import wait_all_tasks_blocked as wait_all_tasks_blocked -from ._core._typedattr import TypedAttributeProvider as TypedAttributeProvider -from ._core._typedattr import TypedAttributeSet as TypedAttributeSet -from ._core._typedattr import typed_attribute as typed_attribute - -# Re-export imports so they look like they live directly in this package -for __value in list(locals().values()): - if getattr(__value, "__module__", "").startswith("anyio."): - __value.__module__ = __name__ - - -del __value - - -def __getattr__(attr: str) -> type[BrokenWorkerInterpreter]: - """Support deprecated aliases.""" - if attr == "BrokenWorkerIntepreter": - import warnings - - warnings.warn( - "The 'BrokenWorkerIntepreter' alias is deprecated, use 'BrokenWorkerInterpreter' instead.", - DeprecationWarning, - stacklevel=2, - ) - return BrokenWorkerInterpreter - - raise AttributeError(f"module {__name__!r} has no attribute {attr!r}") diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 3fdc23d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/from_thread.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/from_thread.cpython-310.pyc deleted file mode 100644 index d361303..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/from_thread.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/lowlevel.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/lowlevel.cpython-310.pyc deleted file mode 100644 index 5bd92e6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/lowlevel.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/pytest_plugin.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/pytest_plugin.cpython-310.pyc deleted file mode 100644 index 99cfb63..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/pytest_plugin.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_interpreter.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_interpreter.cpython-310.pyc deleted file mode 100644 index 3dc1738..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_interpreter.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_process.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_process.cpython-310.pyc deleted file mode 100644 index 6cd18f3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_process.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_thread.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_thread.cpython-310.pyc deleted file mode 100644 index ed46853..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/__pycache__/to_thread.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__init__.py b/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index c7374f2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-310.pyc deleted file mode 100644 index 9ee312b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/_asyncio.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/_trio.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/_trio.cpython-310.pyc deleted file mode 100644 index 3f042ce..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/__pycache__/_trio.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py b/write-message/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py deleted file mode 100644 index 9bb742b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py +++ /dev/null @@ -1,2946 +0,0 @@ -from __future__ import annotations - -import array -import asyncio -import concurrent.futures -import contextvars -import math -import os -import socket -import sys -import threading -import weakref -from asyncio import ( - AbstractEventLoop, - CancelledError, - all_tasks, - create_task, - current_task, - get_running_loop, - sleep, -) -from asyncio.base_events import _run_until_complete_cb # type: ignore[attr-defined] -from collections import OrderedDict, deque -from collections.abc import ( - AsyncGenerator, - AsyncIterator, - Awaitable, - Callable, - Collection, - Coroutine, - Iterable, - Sequence, -) -from concurrent.futures import Future -from contextlib import AbstractContextManager, suppress -from contextvars import Context, copy_context -from dataclasses import dataclass -from functools import partial, wraps -from inspect import ( - CORO_RUNNING, - CORO_SUSPENDED, - getcoroutinestate, - iscoroutine, -) -from io import IOBase -from os import PathLike -from queue import Queue -from signal import Signals -from socket import AddressFamily, SocketKind -from threading import Thread -from types import CodeType, TracebackType -from typing import ( - IO, - TYPE_CHECKING, - Any, - Optional, - TypeVar, - cast, -) -from weakref import WeakKeyDictionary - -import sniffio - -from .. import ( - CapacityLimiterStatistics, - EventStatistics, - LockStatistics, - TaskInfo, - abc, -) -from .._core._eventloop import claim_worker_thread, threadlocals -from .._core._exceptions import ( - BrokenResourceError, - BusyResourceError, - ClosedResourceError, - EndOfStream, - WouldBlock, - iterate_exceptions, -) -from .._core._sockets import convert_ipv6_sockaddr -from .._core._streams import create_memory_object_stream -from .._core._synchronization import ( - CapacityLimiter as BaseCapacityLimiter, -) -from .._core._synchronization import Event as BaseEvent -from .._core._synchronization import Lock as BaseLock -from .._core._synchronization import ( - ResourceGuard, - SemaphoreStatistics, -) -from .._core._synchronization import Semaphore as BaseSemaphore -from .._core._tasks import CancelScope as BaseCancelScope -from ..abc import ( - AsyncBackend, - IPSockAddrType, - SocketListener, - UDPPacketType, - UNIXDatagramPacketType, -) -from ..abc._eventloop import StrOrBytesPath -from ..lowlevel import RunVar -from ..streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream - -if TYPE_CHECKING: - from _typeshed import FileDescriptorLike -else: - FileDescriptorLike = object - -if sys.version_info >= (3, 10): - from typing import ParamSpec -else: - from typing_extensions import ParamSpec - -if sys.version_info >= (3, 11): - from asyncio import Runner - from typing import TypeVarTuple, Unpack -else: - import contextvars - import enum - import signal - from asyncio import coroutines, events, exceptions, tasks - - from exceptiongroup import BaseExceptionGroup - from typing_extensions import TypeVarTuple, Unpack - - class _State(enum.Enum): - CREATED = "created" - INITIALIZED = "initialized" - CLOSED = "closed" - - class Runner: - # Copied from CPython 3.11 - def __init__( - self, - *, - debug: bool | None = None, - loop_factory: Callable[[], AbstractEventLoop] | None = None, - ): - self._state = _State.CREATED - self._debug = debug - self._loop_factory = loop_factory - self._loop: AbstractEventLoop | None = None - self._context = None - self._interrupt_count = 0 - self._set_event_loop = False - - def __enter__(self) -> Runner: - self._lazy_init() - return self - - def __exit__( - self, - exc_type: type[BaseException], - exc_val: BaseException, - exc_tb: TracebackType, - ) -> None: - self.close() - - def close(self) -> None: - """Shutdown and close event loop.""" - if self._state is not _State.INITIALIZED: - return - try: - loop = self._loop - _cancel_all_tasks(loop) - loop.run_until_complete(loop.shutdown_asyncgens()) - if hasattr(loop, "shutdown_default_executor"): - loop.run_until_complete(loop.shutdown_default_executor()) - else: - loop.run_until_complete(_shutdown_default_executor(loop)) - finally: - if self._set_event_loop: - events.set_event_loop(None) - loop.close() - self._loop = None - self._state = _State.CLOSED - - def get_loop(self) -> AbstractEventLoop: - """Return embedded event loop.""" - self._lazy_init() - return self._loop - - def run(self, coro: Coroutine[T_Retval], *, context=None) -> T_Retval: - """Run a coroutine inside the embedded event loop.""" - if not coroutines.iscoroutine(coro): - raise ValueError(f"a coroutine was expected, got {coro!r}") - - if events._get_running_loop() is not None: - # fail fast with short traceback - raise RuntimeError( - "Runner.run() cannot be called from a running event loop" - ) - - self._lazy_init() - - if context is None: - context = self._context - task = context.run(self._loop.create_task, coro) - - if ( - threading.current_thread() is threading.main_thread() - and signal.getsignal(signal.SIGINT) is signal.default_int_handler - ): - sigint_handler = partial(self._on_sigint, main_task=task) - try: - signal.signal(signal.SIGINT, sigint_handler) - except ValueError: - # `signal.signal` may throw if `threading.main_thread` does - # not support signals (e.g. embedded interpreter with signals - # not registered - see gh-91880) - sigint_handler = None - else: - sigint_handler = None - - self._interrupt_count = 0 - try: - return self._loop.run_until_complete(task) - except exceptions.CancelledError: - if self._interrupt_count > 0: - uncancel = getattr(task, "uncancel", None) - if uncancel is not None and uncancel() == 0: - raise KeyboardInterrupt # noqa: B904 - raise # CancelledError - finally: - if ( - sigint_handler is not None - and signal.getsignal(signal.SIGINT) is sigint_handler - ): - signal.signal(signal.SIGINT, signal.default_int_handler) - - def _lazy_init(self) -> None: - if self._state is _State.CLOSED: - raise RuntimeError("Runner is closed") - if self._state is _State.INITIALIZED: - return - if self._loop_factory is None: - self._loop = events.new_event_loop() - if not self._set_event_loop: - # Call set_event_loop only once to avoid calling - # attach_loop multiple times on child watchers - events.set_event_loop(self._loop) - self._set_event_loop = True - else: - self._loop = self._loop_factory() - if self._debug is not None: - self._loop.set_debug(self._debug) - self._context = contextvars.copy_context() - self._state = _State.INITIALIZED - - def _on_sigint(self, signum, frame, main_task: asyncio.Task) -> None: - self._interrupt_count += 1 - if self._interrupt_count == 1 and not main_task.done(): - main_task.cancel() - # wakeup loop if it is blocked by select() with long timeout - self._loop.call_soon_threadsafe(lambda: None) - return - raise KeyboardInterrupt() - - def _cancel_all_tasks(loop: AbstractEventLoop) -> None: - to_cancel = tasks.all_tasks(loop) - if not to_cancel: - return - - for task in to_cancel: - task.cancel() - - loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True)) - - for task in to_cancel: - if task.cancelled(): - continue - if task.exception() is not None: - loop.call_exception_handler( - { - "message": "unhandled exception during asyncio.run() shutdown", - "exception": task.exception(), - "task": task, - } - ) - - async def _shutdown_default_executor(loop: AbstractEventLoop) -> None: - """Schedule the shutdown of the default executor.""" - - def _do_shutdown(future: asyncio.futures.Future) -> None: - try: - loop._default_executor.shutdown(wait=True) # type: ignore[attr-defined] - loop.call_soon_threadsafe(future.set_result, None) - except Exception as ex: - loop.call_soon_threadsafe(future.set_exception, ex) - - loop._executor_shutdown_called = True - if loop._default_executor is None: - return - future = loop.create_future() - thread = threading.Thread(target=_do_shutdown, args=(future,)) - thread.start() - try: - await future - finally: - thread.join() - - -T_Retval = TypeVar("T_Retval") -T_contra = TypeVar("T_contra", contravariant=True) -PosArgsT = TypeVarTuple("PosArgsT") -P = ParamSpec("P") - -_root_task: RunVar[asyncio.Task | None] = RunVar("_root_task") - - -def find_root_task() -> asyncio.Task: - root_task = _root_task.get(None) - if root_task is not None and not root_task.done(): - return root_task - - # Look for a task that has been started via run_until_complete() - for task in all_tasks(): - if task._callbacks and not task.done(): - callbacks = [cb for cb, context in task._callbacks] - for cb in callbacks: - if ( - cb is _run_until_complete_cb - or getattr(cb, "__module__", None) == "uvloop.loop" - ): - _root_task.set(task) - return task - - # Look up the topmost task in the AnyIO task tree, if possible - task = cast(asyncio.Task, current_task()) - state = _task_states.get(task) - if state: - cancel_scope = state.cancel_scope - while cancel_scope and cancel_scope._parent_scope is not None: - cancel_scope = cancel_scope._parent_scope - - if cancel_scope is not None: - return cast(asyncio.Task, cancel_scope._host_task) - - return task - - -def get_callable_name(func: Callable) -> str: - module = getattr(func, "__module__", None) - qualname = getattr(func, "__qualname__", None) - return ".".join([x for x in (module, qualname) if x]) - - -# -# Event loop -# - -_run_vars: WeakKeyDictionary[asyncio.AbstractEventLoop, Any] = WeakKeyDictionary() - - -def _task_started(task: asyncio.Task) -> bool: - """Return ``True`` if the task has been started and has not finished.""" - # The task coro should never be None here, as we never add finished tasks to the - # task list - coro = task.get_coro() - assert coro is not None - try: - return getcoroutinestate(coro) in (CORO_RUNNING, CORO_SUSPENDED) - except AttributeError: - # task coro is async_genenerator_asend https://bugs.python.org/issue37771 - raise Exception(f"Cannot determine if task {task} has started or not") from None - - -# -# Timeouts and cancellation -# - - -def is_anyio_cancellation(exc: CancelledError) -> bool: - # Sometimes third party frameworks catch a CancelledError and raise a new one, so as - # a workaround we have to look at the previous ones in __context__ too for a - # matching cancel message - while True: - if ( - exc.args - and isinstance(exc.args[0], str) - and exc.args[0].startswith("Cancelled by cancel scope ") - ): - return True - - if isinstance(exc.__context__, CancelledError): - exc = exc.__context__ - continue - - return False - - -class CancelScope(BaseCancelScope): - def __new__( - cls, *, deadline: float = math.inf, shield: bool = False - ) -> CancelScope: - return object.__new__(cls) - - def __init__(self, deadline: float = math.inf, shield: bool = False): - self._deadline = deadline - self._shield = shield - self._parent_scope: CancelScope | None = None - self._child_scopes: set[CancelScope] = set() - self._cancel_called = False - self._cancelled_caught = False - self._active = False - self._timeout_handle: asyncio.TimerHandle | None = None - self._cancel_handle: asyncio.Handle | None = None - self._tasks: set[asyncio.Task] = set() - self._host_task: asyncio.Task | None = None - if sys.version_info >= (3, 11): - self._pending_uncancellations: int | None = 0 - else: - self._pending_uncancellations = None - - def __enter__(self) -> CancelScope: - if self._active: - raise RuntimeError( - "Each CancelScope may only be used for a single 'with' block" - ) - - self._host_task = host_task = cast(asyncio.Task, current_task()) - self._tasks.add(host_task) - try: - task_state = _task_states[host_task] - except KeyError: - task_state = TaskState(None, self) - _task_states[host_task] = task_state - else: - self._parent_scope = task_state.cancel_scope - task_state.cancel_scope = self - if self._parent_scope is not None: - # If using an eager task factory, the parent scope may not even contain - # the host task - self._parent_scope._child_scopes.add(self) - self._parent_scope._tasks.discard(host_task) - - self._timeout() - self._active = True - - # Start cancelling the host task if the scope was cancelled before entering - if self._cancel_called: - self._deliver_cancellation(self) - - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool: - del exc_tb - - if not self._active: - raise RuntimeError("This cancel scope is not active") - if current_task() is not self._host_task: - raise RuntimeError( - "Attempted to exit cancel scope in a different task than it was " - "entered in" - ) - - assert self._host_task is not None - host_task_state = _task_states.get(self._host_task) - if host_task_state is None or host_task_state.cancel_scope is not self: - raise RuntimeError( - "Attempted to exit a cancel scope that isn't the current tasks's " - "current cancel scope" - ) - - try: - self._active = False - if self._timeout_handle: - self._timeout_handle.cancel() - self._timeout_handle = None - - self._tasks.remove(self._host_task) - if self._parent_scope is not None: - self._parent_scope._child_scopes.remove(self) - self._parent_scope._tasks.add(self._host_task) - - host_task_state.cancel_scope = self._parent_scope - - # Restart the cancellation effort in the closest visible, cancelled parent - # scope if necessary - self._restart_cancellation_in_parent() - - # We only swallow the exception iff it was an AnyIO CancelledError, either - # directly as exc_val or inside an exception group and there are no cancelled - # parent cancel scopes visible to us here - if self._cancel_called and not self._parent_cancellation_is_visible_to_us: - # For each level-cancel() call made on the host task, call uncancel() - while self._pending_uncancellations: - self._host_task.uncancel() - self._pending_uncancellations -= 1 - - # Update cancelled_caught and check for exceptions we must not swallow - cannot_swallow_exc_val = False - if exc_val is not None: - for exc in iterate_exceptions(exc_val): - if isinstance(exc, CancelledError) and is_anyio_cancellation( - exc - ): - self._cancelled_caught = True - else: - cannot_swallow_exc_val = True - - return self._cancelled_caught and not cannot_swallow_exc_val - else: - if self._pending_uncancellations: - assert self._parent_scope is not None - assert self._parent_scope._pending_uncancellations is not None - self._parent_scope._pending_uncancellations += ( - self._pending_uncancellations - ) - self._pending_uncancellations = 0 - - return False - finally: - self._host_task = None - del exc_val - - @property - def _effectively_cancelled(self) -> bool: - cancel_scope: CancelScope | None = self - while cancel_scope is not None: - if cancel_scope._cancel_called: - return True - - if cancel_scope.shield: - return False - - cancel_scope = cancel_scope._parent_scope - - return False - - @property - def _parent_cancellation_is_visible_to_us(self) -> bool: - return ( - self._parent_scope is not None - and not self.shield - and self._parent_scope._effectively_cancelled - ) - - def _timeout(self) -> None: - if self._deadline != math.inf: - loop = get_running_loop() - if loop.time() >= self._deadline: - self.cancel() - else: - self._timeout_handle = loop.call_at(self._deadline, self._timeout) - - def _deliver_cancellation(self, origin: CancelScope) -> bool: - """ - Deliver cancellation to directly contained tasks and nested cancel scopes. - - Schedule another run at the end if we still have tasks eligible for - cancellation. - - :param origin: the cancel scope that originated the cancellation - :return: ``True`` if the delivery needs to be retried on the next cycle - - """ - should_retry = False - current = current_task() - for task in self._tasks: - should_retry = True - if task._must_cancel: # type: ignore[attr-defined] - continue - - # The task is eligible for cancellation if it has started - if task is not current and (task is self._host_task or _task_started(task)): - waiter = task._fut_waiter # type: ignore[attr-defined] - if not isinstance(waiter, asyncio.Future) or not waiter.done(): - task.cancel(f"Cancelled by cancel scope {id(origin):x}") - if ( - task is origin._host_task - and origin._pending_uncancellations is not None - ): - origin._pending_uncancellations += 1 - - # Deliver cancellation to child scopes that aren't shielded or running their own - # cancellation callbacks - for scope in self._child_scopes: - if not scope._shield and not scope.cancel_called: - should_retry = scope._deliver_cancellation(origin) or should_retry - - # Schedule another callback if there are still tasks left - if origin is self: - if should_retry: - self._cancel_handle = get_running_loop().call_soon( - self._deliver_cancellation, origin - ) - else: - self._cancel_handle = None - - return should_retry - - def _restart_cancellation_in_parent(self) -> None: - """ - Restart the cancellation effort in the closest directly cancelled parent scope. - - """ - scope = self._parent_scope - while scope is not None: - if scope._cancel_called: - if scope._cancel_handle is None: - scope._deliver_cancellation(scope) - - break - - # No point in looking beyond any shielded scope - if scope._shield: - break - - scope = scope._parent_scope - - def cancel(self) -> None: - if not self._cancel_called: - if self._timeout_handle: - self._timeout_handle.cancel() - self._timeout_handle = None - - self._cancel_called = True - if self._host_task is not None: - self._deliver_cancellation(self) - - @property - def deadline(self) -> float: - return self._deadline - - @deadline.setter - def deadline(self, value: float) -> None: - self._deadline = float(value) - if self._timeout_handle is not None: - self._timeout_handle.cancel() - self._timeout_handle = None - - if self._active and not self._cancel_called: - self._timeout() - - @property - def cancel_called(self) -> bool: - return self._cancel_called - - @property - def cancelled_caught(self) -> bool: - return self._cancelled_caught - - @property - def shield(self) -> bool: - return self._shield - - @shield.setter - def shield(self, value: bool) -> None: - if self._shield != value: - self._shield = value - if not value: - self._restart_cancellation_in_parent() - - -# -# Task states -# - - -class TaskState: - """ - Encapsulates auxiliary task information that cannot be added to the Task instance - itself because there are no guarantees about its implementation. - """ - - __slots__ = "parent_id", "cancel_scope", "__weakref__" - - def __init__(self, parent_id: int | None, cancel_scope: CancelScope | None): - self.parent_id = parent_id - self.cancel_scope = cancel_scope - - -_task_states: WeakKeyDictionary[asyncio.Task, TaskState] = WeakKeyDictionary() - - -# -# Task groups -# - - -class _AsyncioTaskStatus(abc.TaskStatus): - def __init__(self, future: asyncio.Future, parent_id: int): - self._future = future - self._parent_id = parent_id - - def started(self, value: T_contra | None = None) -> None: - try: - self._future.set_result(value) - except asyncio.InvalidStateError: - if not self._future.cancelled(): - raise RuntimeError( - "called 'started' twice on the same task status" - ) from None - - task = cast(asyncio.Task, current_task()) - _task_states[task].parent_id = self._parent_id - - -if sys.version_info >= (3, 12): - _eager_task_factory_code: CodeType | None = asyncio.eager_task_factory.__code__ -else: - _eager_task_factory_code = None - - -class TaskGroup(abc.TaskGroup): - def __init__(self) -> None: - self.cancel_scope: CancelScope = CancelScope() - self._active = False - self._exceptions: list[BaseException] = [] - self._tasks: set[asyncio.Task] = set() - self._on_completed_fut: asyncio.Future[None] | None = None - - async def __aenter__(self) -> TaskGroup: - self.cancel_scope.__enter__() - self._active = True - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool: - try: - if exc_val is not None: - self.cancel_scope.cancel() - if not isinstance(exc_val, CancelledError): - self._exceptions.append(exc_val) - - loop = get_running_loop() - try: - if self._tasks: - with CancelScope() as wait_scope: - while self._tasks: - self._on_completed_fut = loop.create_future() - - try: - await self._on_completed_fut - except CancelledError as exc: - # Shield the scope against further cancellation attempts, - # as they're not productive (#695) - wait_scope.shield = True - self.cancel_scope.cancel() - - # Set exc_val from the cancellation exception if it was - # previously unset. However, we should not replace a native - # cancellation exception with one raise by a cancel scope. - if exc_val is None or ( - isinstance(exc_val, CancelledError) - and not is_anyio_cancellation(exc) - ): - exc_val = exc - - self._on_completed_fut = None - else: - # If there are no child tasks to wait on, run at least one checkpoint - # anyway - await AsyncIOBackend.cancel_shielded_checkpoint() - - self._active = False - if self._exceptions: - # The exception that got us here should already have been - # added to self._exceptions so it's ok to break exception - # chaining and avoid adding a "During handling of above..." - # for each nesting level. - raise BaseExceptionGroup( - "unhandled errors in a TaskGroup", self._exceptions - ) from None - elif exc_val: - raise exc_val - except BaseException as exc: - if self.cancel_scope.__exit__(type(exc), exc, exc.__traceback__): - return True - - raise - - return self.cancel_scope.__exit__(exc_type, exc_val, exc_tb) - finally: - del exc_val, exc_tb, self._exceptions - - def _spawn( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[Any]], - args: tuple[Unpack[PosArgsT]], - name: object, - task_status_future: asyncio.Future | None = None, - ) -> asyncio.Task: - def task_done(_task: asyncio.Task) -> None: - task_state = _task_states[_task] - assert task_state.cancel_scope is not None - assert _task in task_state.cancel_scope._tasks - task_state.cancel_scope._tasks.remove(_task) - self._tasks.remove(task) - del _task_states[_task] - - if self._on_completed_fut is not None and not self._tasks: - try: - self._on_completed_fut.set_result(None) - except asyncio.InvalidStateError: - pass - - try: - exc = _task.exception() - except CancelledError as e: - while isinstance(e.__context__, CancelledError): - e = e.__context__ - - exc = e - - if exc is not None: - # The future can only be in the cancelled state if the host task was - # cancelled, so return immediately instead of adding one more - # CancelledError to the exceptions list - if task_status_future is not None and task_status_future.cancelled(): - return - - if task_status_future is None or task_status_future.done(): - if not isinstance(exc, CancelledError): - self._exceptions.append(exc) - - if not self.cancel_scope._effectively_cancelled: - self.cancel_scope.cancel() - else: - task_status_future.set_exception(exc) - elif task_status_future is not None and not task_status_future.done(): - task_status_future.set_exception( - RuntimeError("Child exited without calling task_status.started()") - ) - - if not self._active: - raise RuntimeError( - "This task group is not active; no new tasks can be started." - ) - - kwargs = {} - if task_status_future: - parent_id = id(current_task()) - kwargs["task_status"] = _AsyncioTaskStatus( - task_status_future, id(self.cancel_scope._host_task) - ) - else: - parent_id = id(self.cancel_scope._host_task) - - coro = func(*args, **kwargs) - if not iscoroutine(coro): - prefix = f"{func.__module__}." if hasattr(func, "__module__") else "" - raise TypeError( - f"Expected {prefix}{func.__qualname__}() to return a coroutine, but " - f"the return value ({coro!r}) is not a coroutine object" - ) - - name = get_callable_name(func) if name is None else str(name) - loop = asyncio.get_running_loop() - if ( - (factory := loop.get_task_factory()) - and getattr(factory, "__code__", None) is _eager_task_factory_code - and (closure := getattr(factory, "__closure__", None)) - ): - custom_task_constructor = closure[0].cell_contents - task = custom_task_constructor(coro, loop=loop, name=name) - else: - task = create_task(coro, name=name) - - # Make the spawned task inherit the task group's cancel scope - _task_states[task] = TaskState( - parent_id=parent_id, cancel_scope=self.cancel_scope - ) - self.cancel_scope._tasks.add(task) - self._tasks.add(task) - task.add_done_callback(task_done) - return task - - def start_soon( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[Any]], - *args: Unpack[PosArgsT], - name: object = None, - ) -> None: - self._spawn(func, args, name) - - async def start( - self, func: Callable[..., Awaitable[Any]], *args: object, name: object = None - ) -> Any: - future: asyncio.Future = asyncio.Future() - task = self._spawn(func, args, name, future) - - # If the task raises an exception after sending a start value without a switch - # point between, the task group is cancelled and this method never proceeds to - # process the completed future. That's why we have to have a shielded cancel - # scope here. - try: - return await future - except CancelledError: - # Cancel the task and wait for it to exit before returning - task.cancel() - with CancelScope(shield=True), suppress(CancelledError): - await task - - raise - - -# -# Threads -# - -_Retval_Queue_Type = tuple[Optional[T_Retval], Optional[BaseException]] - - -class WorkerThread(Thread): - MAX_IDLE_TIME = 10 # seconds - - def __init__( - self, - root_task: asyncio.Task, - workers: set[WorkerThread], - idle_workers: deque[WorkerThread], - ): - super().__init__(name="AnyIO worker thread") - self.root_task = root_task - self.workers = workers - self.idle_workers = idle_workers - self.loop = root_task._loop - self.queue: Queue[ - tuple[Context, Callable, tuple, asyncio.Future, CancelScope] | None - ] = Queue(2) - self.idle_since = AsyncIOBackend.current_time() - self.stopping = False - - def _report_result( - self, future: asyncio.Future, result: Any, exc: BaseException | None - ) -> None: - self.idle_since = AsyncIOBackend.current_time() - if not self.stopping: - self.idle_workers.append(self) - - if not future.cancelled(): - if exc is not None: - if isinstance(exc, StopIteration): - new_exc = RuntimeError("coroutine raised StopIteration") - new_exc.__cause__ = exc - exc = new_exc - - future.set_exception(exc) - else: - future.set_result(result) - - def run(self) -> None: - with claim_worker_thread(AsyncIOBackend, self.loop): - while True: - item = self.queue.get() - if item is None: - # Shutdown command received - return - - context, func, args, future, cancel_scope = item - if not future.cancelled(): - result = None - exception: BaseException | None = None - threadlocals.current_cancel_scope = cancel_scope - try: - result = context.run(func, *args) - except BaseException as exc: - exception = exc - finally: - del threadlocals.current_cancel_scope - - if not self.loop.is_closed(): - self.loop.call_soon_threadsafe( - self._report_result, future, result, exception - ) - - del result, exception - - self.queue.task_done() - del item, context, func, args, future, cancel_scope - - def stop(self, f: asyncio.Task | None = None) -> None: - self.stopping = True - self.queue.put_nowait(None) - self.workers.discard(self) - try: - self.idle_workers.remove(self) - except ValueError: - pass - - -_threadpool_idle_workers: RunVar[deque[WorkerThread]] = RunVar( - "_threadpool_idle_workers" -) -_threadpool_workers: RunVar[set[WorkerThread]] = RunVar("_threadpool_workers") - - -class BlockingPortal(abc.BlockingPortal): - def __new__(cls) -> BlockingPortal: - return object.__new__(cls) - - def __init__(self) -> None: - super().__init__() - self._loop = get_running_loop() - - def _spawn_task_from_thread( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval], - args: tuple[Unpack[PosArgsT]], - kwargs: dict[str, Any], - name: object, - future: Future[T_Retval], - ) -> None: - AsyncIOBackend.run_sync_from_thread( - partial(self._task_group.start_soon, name=name), - (self._call_func, func, args, kwargs, future), - self._loop, - ) - - -# -# Subprocesses -# - - -@dataclass(eq=False) -class StreamReaderWrapper(abc.ByteReceiveStream): - _stream: asyncio.StreamReader - - async def receive(self, max_bytes: int = 65536) -> bytes: - data = await self._stream.read(max_bytes) - if data: - return data - else: - raise EndOfStream - - async def aclose(self) -> None: - self._stream.set_exception(ClosedResourceError()) - await AsyncIOBackend.checkpoint() - - -@dataclass(eq=False) -class StreamWriterWrapper(abc.ByteSendStream): - _stream: asyncio.StreamWriter - - async def send(self, item: bytes) -> None: - self._stream.write(item) - await self._stream.drain() - - async def aclose(self) -> None: - self._stream.close() - await AsyncIOBackend.checkpoint() - - -@dataclass(eq=False) -class Process(abc.Process): - _process: asyncio.subprocess.Process - _stdin: StreamWriterWrapper | None - _stdout: StreamReaderWrapper | None - _stderr: StreamReaderWrapper | None - - async def aclose(self) -> None: - with CancelScope(shield=True) as scope: - if self._stdin: - await self._stdin.aclose() - if self._stdout: - await self._stdout.aclose() - if self._stderr: - await self._stderr.aclose() - - scope.shield = False - try: - await self.wait() - except BaseException: - scope.shield = True - self.kill() - await self.wait() - raise - - async def wait(self) -> int: - return await self._process.wait() - - def terminate(self) -> None: - self._process.terminate() - - def kill(self) -> None: - self._process.kill() - - def send_signal(self, signal: int) -> None: - self._process.send_signal(signal) - - @property - def pid(self) -> int: - return self._process.pid - - @property - def returncode(self) -> int | None: - return self._process.returncode - - @property - def stdin(self) -> abc.ByteSendStream | None: - return self._stdin - - @property - def stdout(self) -> abc.ByteReceiveStream | None: - return self._stdout - - @property - def stderr(self) -> abc.ByteReceiveStream | None: - return self._stderr - - -def _forcibly_shutdown_process_pool_on_exit( - workers: set[Process], _task: object -) -> None: - """ - Forcibly shuts down worker processes belonging to this event loop.""" - child_watcher: asyncio.AbstractChildWatcher | None = None - if sys.version_info < (3, 12): - try: - child_watcher = asyncio.get_event_loop_policy().get_child_watcher() - except NotImplementedError: - pass - - # Close as much as possible (w/o async/await) to avoid warnings - for process in workers: - if process.returncode is None: - continue - - process._stdin._stream._transport.close() # type: ignore[union-attr] - process._stdout._stream._transport.close() # type: ignore[union-attr] - process._stderr._stream._transport.close() # type: ignore[union-attr] - process.kill() - if child_watcher: - child_watcher.remove_child_handler(process.pid) - - -async def _shutdown_process_pool_on_exit(workers: set[abc.Process]) -> None: - """ - Shuts down worker processes belonging to this event loop. - - NOTE: this only works when the event loop was started using asyncio.run() or - anyio.run(). - - """ - process: abc.Process - try: - await sleep(math.inf) - except asyncio.CancelledError: - for process in workers: - if process.returncode is None: - process.kill() - - for process in workers: - await process.aclose() - - -# -# Sockets and networking -# - - -class StreamProtocol(asyncio.Protocol): - read_queue: deque[bytes] - read_event: asyncio.Event - write_event: asyncio.Event - exception: Exception | None = None - is_at_eof: bool = False - - def connection_made(self, transport: asyncio.BaseTransport) -> None: - self.read_queue = deque() - self.read_event = asyncio.Event() - self.write_event = asyncio.Event() - self.write_event.set() - cast(asyncio.Transport, transport).set_write_buffer_limits(0) - - def connection_lost(self, exc: Exception | None) -> None: - if exc: - self.exception = BrokenResourceError() - self.exception.__cause__ = exc - - self.read_event.set() - self.write_event.set() - - def data_received(self, data: bytes) -> None: - # ProactorEventloop sometimes sends bytearray instead of bytes - self.read_queue.append(bytes(data)) - self.read_event.set() - - def eof_received(self) -> bool | None: - self.is_at_eof = True - self.read_event.set() - return True - - def pause_writing(self) -> None: - self.write_event = asyncio.Event() - - def resume_writing(self) -> None: - self.write_event.set() - - -class DatagramProtocol(asyncio.DatagramProtocol): - read_queue: deque[tuple[bytes, IPSockAddrType]] - read_event: asyncio.Event - write_event: asyncio.Event - exception: Exception | None = None - - def connection_made(self, transport: asyncio.BaseTransport) -> None: - self.read_queue = deque(maxlen=100) # arbitrary value - self.read_event = asyncio.Event() - self.write_event = asyncio.Event() - self.write_event.set() - - def connection_lost(self, exc: Exception | None) -> None: - self.read_event.set() - self.write_event.set() - - def datagram_received(self, data: bytes, addr: IPSockAddrType) -> None: - addr = convert_ipv6_sockaddr(addr) - self.read_queue.append((data, addr)) - self.read_event.set() - - def error_received(self, exc: Exception) -> None: - self.exception = exc - - def pause_writing(self) -> None: - self.write_event.clear() - - def resume_writing(self) -> None: - self.write_event.set() - - -class SocketStream(abc.SocketStream): - def __init__(self, transport: asyncio.Transport, protocol: StreamProtocol): - self._transport = transport - self._protocol = protocol - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - self._closed = False - - @property - def _raw_socket(self) -> socket.socket: - return self._transport.get_extra_info("socket") - - async def receive(self, max_bytes: int = 65536) -> bytes: - with self._receive_guard: - if ( - not self._protocol.read_event.is_set() - and not self._transport.is_closing() - and not self._protocol.is_at_eof - ): - self._transport.resume_reading() - await self._protocol.read_event.wait() - self._transport.pause_reading() - else: - await AsyncIOBackend.checkpoint() - - try: - chunk = self._protocol.read_queue.popleft() - except IndexError: - if self._closed: - raise ClosedResourceError from None - elif self._protocol.exception: - raise self._protocol.exception from None - else: - raise EndOfStream from None - - if len(chunk) > max_bytes: - # Split the oversized chunk - chunk, leftover = chunk[:max_bytes], chunk[max_bytes:] - self._protocol.read_queue.appendleft(leftover) - - # If the read queue is empty, clear the flag so that the next call will - # block until data is available - if not self._protocol.read_queue: - self._protocol.read_event.clear() - - return chunk - - async def send(self, item: bytes) -> None: - with self._send_guard: - await AsyncIOBackend.checkpoint() - - if self._closed: - raise ClosedResourceError - elif self._protocol.exception is not None: - raise self._protocol.exception - - try: - self._transport.write(item) - except RuntimeError as exc: - if self._transport.is_closing(): - raise BrokenResourceError from exc - else: - raise - - await self._protocol.write_event.wait() - - async def send_eof(self) -> None: - try: - self._transport.write_eof() - except OSError: - pass - - async def aclose(self) -> None: - if not self._transport.is_closing(): - self._closed = True - try: - self._transport.write_eof() - except OSError: - pass - - self._transport.close() - await sleep(0) - self._transport.abort() - - -class _RawSocketMixin: - _receive_future: asyncio.Future | None = None - _send_future: asyncio.Future | None = None - _closing = False - - def __init__(self, raw_socket: socket.socket): - self.__raw_socket = raw_socket - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - - @property - def _raw_socket(self) -> socket.socket: - return self.__raw_socket - - def _wait_until_readable(self, loop: asyncio.AbstractEventLoop) -> asyncio.Future: - def callback(f: object) -> None: - del self._receive_future - loop.remove_reader(self.__raw_socket) - - f = self._receive_future = asyncio.Future() - loop.add_reader(self.__raw_socket, f.set_result, None) - f.add_done_callback(callback) - return f - - def _wait_until_writable(self, loop: asyncio.AbstractEventLoop) -> asyncio.Future: - def callback(f: object) -> None: - del self._send_future - loop.remove_writer(self.__raw_socket) - - f = self._send_future = asyncio.Future() - loop.add_writer(self.__raw_socket, f.set_result, None) - f.add_done_callback(callback) - return f - - async def aclose(self) -> None: - if not self._closing: - self._closing = True - if self.__raw_socket.fileno() != -1: - self.__raw_socket.close() - - if self._receive_future: - self._receive_future.set_result(None) - if self._send_future: - self._send_future.set_result(None) - - -class UNIXSocketStream(_RawSocketMixin, abc.UNIXSocketStream): - async def send_eof(self) -> None: - with self._send_guard: - self._raw_socket.shutdown(socket.SHUT_WR) - - async def receive(self, max_bytes: int = 65536) -> bytes: - loop = get_running_loop() - await AsyncIOBackend.checkpoint() - with self._receive_guard: - while True: - try: - data = self._raw_socket.recv(max_bytes) - except BlockingIOError: - await self._wait_until_readable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - else: - if not data: - raise EndOfStream - - return data - - async def send(self, item: bytes) -> None: - loop = get_running_loop() - await AsyncIOBackend.checkpoint() - with self._send_guard: - view = memoryview(item) - while view: - try: - bytes_sent = self._raw_socket.send(view) - except BlockingIOError: - await self._wait_until_writable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - else: - view = view[bytes_sent:] - - async def receive_fds(self, msglen: int, maxfds: int) -> tuple[bytes, list[int]]: - if not isinstance(msglen, int) or msglen < 0: - raise ValueError("msglen must be a non-negative integer") - if not isinstance(maxfds, int) or maxfds < 1: - raise ValueError("maxfds must be a positive integer") - - loop = get_running_loop() - fds = array.array("i") - await AsyncIOBackend.checkpoint() - with self._receive_guard: - while True: - try: - message, ancdata, flags, addr = self._raw_socket.recvmsg( - msglen, socket.CMSG_LEN(maxfds * fds.itemsize) - ) - except BlockingIOError: - await self._wait_until_readable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - else: - if not message and not ancdata: - raise EndOfStream - - break - - for cmsg_level, cmsg_type, cmsg_data in ancdata: - if cmsg_level != socket.SOL_SOCKET or cmsg_type != socket.SCM_RIGHTS: - raise RuntimeError( - f"Received unexpected ancillary data; message = {message!r}, " - f"cmsg_level = {cmsg_level}, cmsg_type = {cmsg_type}" - ) - - fds.frombytes(cmsg_data[: len(cmsg_data) - (len(cmsg_data) % fds.itemsize)]) - - return message, list(fds) - - async def send_fds(self, message: bytes, fds: Collection[int | IOBase]) -> None: - if not message: - raise ValueError("message must not be empty") - if not fds: - raise ValueError("fds must not be empty") - - loop = get_running_loop() - filenos: list[int] = [] - for fd in fds: - if isinstance(fd, int): - filenos.append(fd) - elif isinstance(fd, IOBase): - filenos.append(fd.fileno()) - - fdarray = array.array("i", filenos) - await AsyncIOBackend.checkpoint() - with self._send_guard: - while True: - try: - # The ignore can be removed after mypy picks up - # https://github.com/python/typeshed/pull/5545 - self._raw_socket.sendmsg( - [message], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, fdarray)] - ) - break - except BlockingIOError: - await self._wait_until_writable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - - -class TCPSocketListener(abc.SocketListener): - _accept_scope: CancelScope | None = None - _closed = False - - def __init__(self, raw_socket: socket.socket): - self.__raw_socket = raw_socket - self._loop = cast(asyncio.BaseEventLoop, get_running_loop()) - self._accept_guard = ResourceGuard("accepting connections from") - - @property - def _raw_socket(self) -> socket.socket: - return self.__raw_socket - - async def accept(self) -> abc.SocketStream: - if self._closed: - raise ClosedResourceError - - with self._accept_guard: - await AsyncIOBackend.checkpoint() - with CancelScope() as self._accept_scope: - try: - client_sock, _addr = await self._loop.sock_accept(self._raw_socket) - except asyncio.CancelledError: - # Workaround for https://bugs.python.org/issue41317 - try: - self._loop.remove_reader(self._raw_socket) - except (ValueError, NotImplementedError): - pass - - if self._closed: - raise ClosedResourceError from None - - raise - finally: - self._accept_scope = None - - client_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - transport, protocol = await self._loop.connect_accepted_socket( - StreamProtocol, client_sock - ) - return SocketStream(transport, protocol) - - async def aclose(self) -> None: - if self._closed: - return - - self._closed = True - if self._accept_scope: - # Workaround for https://bugs.python.org/issue41317 - try: - self._loop.remove_reader(self._raw_socket) - except (ValueError, NotImplementedError): - pass - - self._accept_scope.cancel() - await sleep(0) - - self._raw_socket.close() - - -class UNIXSocketListener(abc.SocketListener): - def __init__(self, raw_socket: socket.socket): - self.__raw_socket = raw_socket - self._loop = get_running_loop() - self._accept_guard = ResourceGuard("accepting connections from") - self._closed = False - - async def accept(self) -> abc.SocketStream: - await AsyncIOBackend.checkpoint() - with self._accept_guard: - while True: - try: - client_sock, _ = self.__raw_socket.accept() - client_sock.setblocking(False) - return UNIXSocketStream(client_sock) - except BlockingIOError: - f: asyncio.Future = asyncio.Future() - self._loop.add_reader(self.__raw_socket, f.set_result, None) - f.add_done_callback( - lambda _: self._loop.remove_reader(self.__raw_socket) - ) - await f - except OSError as exc: - if self._closed: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - - async def aclose(self) -> None: - self._closed = True - self.__raw_socket.close() - - @property - def _raw_socket(self) -> socket.socket: - return self.__raw_socket - - -class UDPSocket(abc.UDPSocket): - def __init__( - self, transport: asyncio.DatagramTransport, protocol: DatagramProtocol - ): - self._transport = transport - self._protocol = protocol - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - self._closed = False - - @property - def _raw_socket(self) -> socket.socket: - return self._transport.get_extra_info("socket") - - async def aclose(self) -> None: - if not self._transport.is_closing(): - self._closed = True - self._transport.close() - - async def receive(self) -> tuple[bytes, IPSockAddrType]: - with self._receive_guard: - await AsyncIOBackend.checkpoint() - - # If the buffer is empty, ask for more data - if not self._protocol.read_queue and not self._transport.is_closing(): - self._protocol.read_event.clear() - await self._protocol.read_event.wait() - - try: - return self._protocol.read_queue.popleft() - except IndexError: - if self._closed: - raise ClosedResourceError from None - else: - raise BrokenResourceError from None - - async def send(self, item: UDPPacketType) -> None: - with self._send_guard: - await AsyncIOBackend.checkpoint() - await self._protocol.write_event.wait() - if self._closed: - raise ClosedResourceError - elif self._transport.is_closing(): - raise BrokenResourceError - else: - self._transport.sendto(*item) - - -class ConnectedUDPSocket(abc.ConnectedUDPSocket): - def __init__( - self, transport: asyncio.DatagramTransport, protocol: DatagramProtocol - ): - self._transport = transport - self._protocol = protocol - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - self._closed = False - - @property - def _raw_socket(self) -> socket.socket: - return self._transport.get_extra_info("socket") - - async def aclose(self) -> None: - if not self._transport.is_closing(): - self._closed = True - self._transport.close() - - async def receive(self) -> bytes: - with self._receive_guard: - await AsyncIOBackend.checkpoint() - - # If the buffer is empty, ask for more data - if not self._protocol.read_queue and not self._transport.is_closing(): - self._protocol.read_event.clear() - await self._protocol.read_event.wait() - - try: - packet = self._protocol.read_queue.popleft() - except IndexError: - if self._closed: - raise ClosedResourceError from None - else: - raise BrokenResourceError from None - - return packet[0] - - async def send(self, item: bytes) -> None: - with self._send_guard: - await AsyncIOBackend.checkpoint() - await self._protocol.write_event.wait() - if self._closed: - raise ClosedResourceError - elif self._transport.is_closing(): - raise BrokenResourceError - else: - self._transport.sendto(item) - - -class UNIXDatagramSocket(_RawSocketMixin, abc.UNIXDatagramSocket): - async def receive(self) -> UNIXDatagramPacketType: - loop = get_running_loop() - await AsyncIOBackend.checkpoint() - with self._receive_guard: - while True: - try: - data = self._raw_socket.recvfrom(65536) - except BlockingIOError: - await self._wait_until_readable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - else: - return data - - async def send(self, item: UNIXDatagramPacketType) -> None: - loop = get_running_loop() - await AsyncIOBackend.checkpoint() - with self._send_guard: - while True: - try: - self._raw_socket.sendto(*item) - except BlockingIOError: - await self._wait_until_writable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - else: - return - - -class ConnectedUNIXDatagramSocket(_RawSocketMixin, abc.ConnectedUNIXDatagramSocket): - async def receive(self) -> bytes: - loop = get_running_loop() - await AsyncIOBackend.checkpoint() - with self._receive_guard: - while True: - try: - data = self._raw_socket.recv(65536) - except BlockingIOError: - await self._wait_until_readable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - else: - return data - - async def send(self, item: bytes) -> None: - loop = get_running_loop() - await AsyncIOBackend.checkpoint() - with self._send_guard: - while True: - try: - self._raw_socket.send(item) - except BlockingIOError: - await self._wait_until_writable(loop) - except OSError as exc: - if self._closing: - raise ClosedResourceError from None - else: - raise BrokenResourceError from exc - else: - return - - -_read_events: RunVar[dict[int, asyncio.Future[bool]]] = RunVar("read_events") -_write_events: RunVar[dict[int, asyncio.Future[bool]]] = RunVar("write_events") - - -# -# Synchronization -# - - -class Event(BaseEvent): - def __new__(cls) -> Event: - return object.__new__(cls) - - def __init__(self) -> None: - self._event = asyncio.Event() - - def set(self) -> None: - self._event.set() - - def is_set(self) -> bool: - return self._event.is_set() - - async def wait(self) -> None: - if self.is_set(): - await AsyncIOBackend.checkpoint() - else: - await self._event.wait() - - def statistics(self) -> EventStatistics: - return EventStatistics(len(self._event._waiters)) - - -class Lock(BaseLock): - def __new__(cls, *, fast_acquire: bool = False) -> Lock: - return object.__new__(cls) - - def __init__(self, *, fast_acquire: bool = False) -> None: - self._fast_acquire = fast_acquire - self._owner_task: asyncio.Task | None = None - self._waiters: deque[tuple[asyncio.Task, asyncio.Future]] = deque() - - async def acquire(self) -> None: - task = cast(asyncio.Task, current_task()) - if self._owner_task is None and not self._waiters: - await AsyncIOBackend.checkpoint_if_cancelled() - self._owner_task = task - - # Unless on the "fast path", yield control of the event loop so that other - # tasks can run too - if not self._fast_acquire: - try: - await AsyncIOBackend.cancel_shielded_checkpoint() - except CancelledError: - self.release() - raise - - return - - if self._owner_task == task: - raise RuntimeError("Attempted to acquire an already held Lock") - - fut: asyncio.Future[None] = asyncio.Future() - item = task, fut - self._waiters.append(item) - try: - await fut - except CancelledError: - self._waiters.remove(item) - if self._owner_task is task: - self.release() - - raise - - self._waiters.remove(item) - - def acquire_nowait(self) -> None: - task = cast(asyncio.Task, current_task()) - if self._owner_task is None and not self._waiters: - self._owner_task = task - return - - if self._owner_task is task: - raise RuntimeError("Attempted to acquire an already held Lock") - - raise WouldBlock - - def locked(self) -> bool: - return self._owner_task is not None - - def release(self) -> None: - if self._owner_task != current_task(): - raise RuntimeError("The current task is not holding this lock") - - for task, fut in self._waiters: - if not fut.cancelled(): - self._owner_task = task - fut.set_result(None) - return - - self._owner_task = None - - def statistics(self) -> LockStatistics: - task_info = AsyncIOTaskInfo(self._owner_task) if self._owner_task else None - return LockStatistics(self.locked(), task_info, len(self._waiters)) - - -class Semaphore(BaseSemaphore): - def __new__( - cls, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> Semaphore: - return object.__new__(cls) - - def __init__( - self, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ): - super().__init__(initial_value, max_value=max_value) - self._value = initial_value - self._max_value = max_value - self._fast_acquire = fast_acquire - self._waiters: deque[asyncio.Future[None]] = deque() - - async def acquire(self) -> None: - if self._value > 0 and not self._waiters: - await AsyncIOBackend.checkpoint_if_cancelled() - self._value -= 1 - - # Unless on the "fast path", yield control of the event loop so that other - # tasks can run too - if not self._fast_acquire: - try: - await AsyncIOBackend.cancel_shielded_checkpoint() - except CancelledError: - self.release() - raise - - return - - fut: asyncio.Future[None] = asyncio.Future() - self._waiters.append(fut) - try: - await fut - except CancelledError: - try: - self._waiters.remove(fut) - except ValueError: - self.release() - - raise - - def acquire_nowait(self) -> None: - if self._value == 0: - raise WouldBlock - - self._value -= 1 - - def release(self) -> None: - if self._max_value is not None and self._value == self._max_value: - raise ValueError("semaphore released too many times") - - for fut in self._waiters: - if not fut.cancelled(): - fut.set_result(None) - self._waiters.remove(fut) - return - - self._value += 1 - - @property - def value(self) -> int: - return self._value - - @property - def max_value(self) -> int | None: - return self._max_value - - def statistics(self) -> SemaphoreStatistics: - return SemaphoreStatistics(len(self._waiters)) - - -class CapacityLimiter(BaseCapacityLimiter): - _total_tokens: float = 0 - - def __new__(cls, total_tokens: float) -> CapacityLimiter: - return object.__new__(cls) - - def __init__(self, total_tokens: float): - self._borrowers: set[Any] = set() - self._wait_queue: OrderedDict[Any, asyncio.Event] = OrderedDict() - self.total_tokens = total_tokens - - async def __aenter__(self) -> None: - await self.acquire() - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self.release() - - @property - def total_tokens(self) -> float: - return self._total_tokens - - @total_tokens.setter - def total_tokens(self, value: float) -> None: - if not isinstance(value, int) and not math.isinf(value): - raise TypeError("total_tokens must be an int or math.inf") - if value < 1: - raise ValueError("total_tokens must be >= 1") - - waiters_to_notify = max(value - self._total_tokens, 0) - self._total_tokens = value - - # Notify waiting tasks that they have acquired the limiter - while self._wait_queue and waiters_to_notify: - event = self._wait_queue.popitem(last=False)[1] - event.set() - waiters_to_notify -= 1 - - @property - def borrowed_tokens(self) -> int: - return len(self._borrowers) - - @property - def available_tokens(self) -> float: - return self._total_tokens - len(self._borrowers) - - def _notify_next_waiter(self) -> None: - """Notify the next task in line if this limiter has free capacity now.""" - if self._wait_queue and len(self._borrowers) < self._total_tokens: - event = self._wait_queue.popitem(last=False)[1] - event.set() - - def acquire_nowait(self) -> None: - self.acquire_on_behalf_of_nowait(current_task()) - - def acquire_on_behalf_of_nowait(self, borrower: object) -> None: - if borrower in self._borrowers: - raise RuntimeError( - "this borrower is already holding one of this CapacityLimiter's tokens" - ) - - if self._wait_queue or len(self._borrowers) >= self._total_tokens: - raise WouldBlock - - self._borrowers.add(borrower) - - async def acquire(self) -> None: - return await self.acquire_on_behalf_of(current_task()) - - async def acquire_on_behalf_of(self, borrower: object) -> None: - await AsyncIOBackend.checkpoint_if_cancelled() - try: - self.acquire_on_behalf_of_nowait(borrower) - except WouldBlock: - event = asyncio.Event() - self._wait_queue[borrower] = event - try: - await event.wait() - except BaseException: - self._wait_queue.pop(borrower, None) - if event.is_set(): - self._notify_next_waiter() - - raise - - self._borrowers.add(borrower) - else: - try: - await AsyncIOBackend.cancel_shielded_checkpoint() - except BaseException: - self.release() - raise - - def release(self) -> None: - self.release_on_behalf_of(current_task()) - - def release_on_behalf_of(self, borrower: object) -> None: - try: - self._borrowers.remove(borrower) - except KeyError: - raise RuntimeError( - "this borrower isn't holding any of this CapacityLimiter's tokens" - ) from None - - self._notify_next_waiter() - - def statistics(self) -> CapacityLimiterStatistics: - return CapacityLimiterStatistics( - self.borrowed_tokens, - self.total_tokens, - tuple(self._borrowers), - len(self._wait_queue), - ) - - -_default_thread_limiter: RunVar[CapacityLimiter] = RunVar("_default_thread_limiter") - - -# -# Operating system signals -# - - -class _SignalReceiver: - def __init__(self, signals: tuple[Signals, ...]): - self._signals = signals - self._loop = get_running_loop() - self._signal_queue: deque[Signals] = deque() - self._future: asyncio.Future = asyncio.Future() - self._handled_signals: set[Signals] = set() - - def _deliver(self, signum: Signals) -> None: - self._signal_queue.append(signum) - if not self._future.done(): - self._future.set_result(None) - - def __enter__(self) -> _SignalReceiver: - for sig in set(self._signals): - self._loop.add_signal_handler(sig, self._deliver, sig) - self._handled_signals.add(sig) - - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - for sig in self._handled_signals: - self._loop.remove_signal_handler(sig) - - def __aiter__(self) -> _SignalReceiver: - return self - - async def __anext__(self) -> Signals: - await AsyncIOBackend.checkpoint() - if not self._signal_queue: - self._future = asyncio.Future() - await self._future - - return self._signal_queue.popleft() - - -# -# Testing and debugging -# - - -class AsyncIOTaskInfo(TaskInfo): - def __init__(self, task: asyncio.Task): - task_state = _task_states.get(task) - if task_state is None: - parent_id = None - else: - parent_id = task_state.parent_id - - coro = task.get_coro() - assert coro is not None, "created TaskInfo from a completed Task" - super().__init__(id(task), parent_id, task.get_name(), coro) - self._task = weakref.ref(task) - - def has_pending_cancellation(self) -> bool: - if not (task := self._task()): - # If the task isn't around anymore, it won't have a pending cancellation - return False - - if task._must_cancel: # type: ignore[attr-defined] - return True - elif ( - isinstance(task._fut_waiter, asyncio.Future) # type: ignore[attr-defined] - and task._fut_waiter.cancelled() # type: ignore[attr-defined] - ): - return True - - if task_state := _task_states.get(task): - if cancel_scope := task_state.cancel_scope: - return cancel_scope._effectively_cancelled - - return False - - -class TestRunner(abc.TestRunner): - _send_stream: MemoryObjectSendStream[tuple[Awaitable[Any], asyncio.Future[Any]]] - - def __init__( - self, - *, - debug: bool | None = None, - use_uvloop: bool = False, - loop_factory: Callable[[], AbstractEventLoop] | None = None, - ) -> None: - if use_uvloop and loop_factory is None: - import uvloop - - loop_factory = uvloop.new_event_loop - - self._runner = Runner(debug=debug, loop_factory=loop_factory) - self._exceptions: list[BaseException] = [] - self._runner_task: asyncio.Task | None = None - - def __enter__(self) -> TestRunner: - self._runner.__enter__() - self.get_loop().set_exception_handler(self._exception_handler) - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self._runner.__exit__(exc_type, exc_val, exc_tb) - - def get_loop(self) -> AbstractEventLoop: - return self._runner.get_loop() - - def _exception_handler( - self, loop: asyncio.AbstractEventLoop, context: dict[str, Any] - ) -> None: - if isinstance(context.get("exception"), Exception): - self._exceptions.append(context["exception"]) - else: - loop.default_exception_handler(context) - - def _raise_async_exceptions(self) -> None: - # Re-raise any exceptions raised in asynchronous callbacks - if self._exceptions: - exceptions, self._exceptions = self._exceptions, [] - if len(exceptions) == 1: - raise exceptions[0] - elif exceptions: - raise BaseExceptionGroup( - "Multiple exceptions occurred in asynchronous callbacks", exceptions - ) - - async def _run_tests_and_fixtures( - self, - receive_stream: MemoryObjectReceiveStream[ - tuple[Awaitable[T_Retval], asyncio.Future[T_Retval]] - ], - ) -> None: - from _pytest.outcomes import OutcomeException - - with receive_stream, self._send_stream: - async for coro, future in receive_stream: - try: - retval = await coro - except CancelledError as exc: - if not future.cancelled(): - future.cancel(*exc.args) - - raise - except BaseException as exc: - if not future.cancelled(): - future.set_exception(exc) - - if not isinstance(exc, (Exception, OutcomeException)): - raise - else: - if not future.cancelled(): - future.set_result(retval) - - async def _call_in_runner_task( - self, - func: Callable[P, Awaitable[T_Retval]], - *args: P.args, - **kwargs: P.kwargs, - ) -> T_Retval: - if not self._runner_task: - self._send_stream, receive_stream = create_memory_object_stream[ - tuple[Awaitable[Any], asyncio.Future] - ](1) - self._runner_task = self.get_loop().create_task( - self._run_tests_and_fixtures(receive_stream) - ) - - coro = func(*args, **kwargs) - future: asyncio.Future[T_Retval] = self.get_loop().create_future() - self._send_stream.send_nowait((coro, future)) - return await future - - def run_asyncgen_fixture( - self, - fixture_func: Callable[..., AsyncGenerator[T_Retval, Any]], - kwargs: dict[str, Any], - ) -> Iterable[T_Retval]: - asyncgen = fixture_func(**kwargs) - fixturevalue: T_Retval = self.get_loop().run_until_complete( - self._call_in_runner_task(asyncgen.asend, None) - ) - self._raise_async_exceptions() - - yield fixturevalue - - try: - self.get_loop().run_until_complete( - self._call_in_runner_task(asyncgen.asend, None) - ) - except StopAsyncIteration: - self._raise_async_exceptions() - else: - self.get_loop().run_until_complete(asyncgen.aclose()) - raise RuntimeError("Async generator fixture did not stop") - - def run_fixture( - self, - fixture_func: Callable[..., Coroutine[Any, Any, T_Retval]], - kwargs: dict[str, Any], - ) -> T_Retval: - retval = self.get_loop().run_until_complete( - self._call_in_runner_task(fixture_func, **kwargs) - ) - self._raise_async_exceptions() - return retval - - def run_test( - self, test_func: Callable[..., Coroutine[Any, Any, Any]], kwargs: dict[str, Any] - ) -> None: - try: - self.get_loop().run_until_complete( - self._call_in_runner_task(test_func, **kwargs) - ) - except Exception as exc: - self._exceptions.append(exc) - - self._raise_async_exceptions() - - -class AsyncIOBackend(AsyncBackend): - @classmethod - def run( - cls, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - args: tuple[Unpack[PosArgsT]], - kwargs: dict[str, Any], - options: dict[str, Any], - ) -> T_Retval: - @wraps(func) - async def wrapper() -> T_Retval: - task = cast(asyncio.Task, current_task()) - task.set_name(get_callable_name(func)) - _task_states[task] = TaskState(None, None) - - try: - return await func(*args) - finally: - del _task_states[task] - - debug = options.get("debug", None) - loop_factory = options.get("loop_factory", None) - if loop_factory is None and options.get("use_uvloop", False): - import uvloop - - loop_factory = uvloop.new_event_loop - - with Runner(debug=debug, loop_factory=loop_factory) as runner: - return runner.run(wrapper()) - - @classmethod - def current_token(cls) -> object: - return get_running_loop() - - @classmethod - def current_time(cls) -> float: - return get_running_loop().time() - - @classmethod - def cancelled_exception_class(cls) -> type[BaseException]: - return CancelledError - - @classmethod - async def checkpoint(cls) -> None: - await sleep(0) - - @classmethod - async def checkpoint_if_cancelled(cls) -> None: - task = current_task() - if task is None: - return - - try: - cancel_scope = _task_states[task].cancel_scope - except KeyError: - return - - while cancel_scope: - if cancel_scope.cancel_called: - await sleep(0) - elif cancel_scope.shield: - break - else: - cancel_scope = cancel_scope._parent_scope - - @classmethod - async def cancel_shielded_checkpoint(cls) -> None: - with CancelScope(shield=True): - await sleep(0) - - @classmethod - async def sleep(cls, delay: float) -> None: - await sleep(delay) - - @classmethod - def create_cancel_scope( - cls, *, deadline: float = math.inf, shield: bool = False - ) -> CancelScope: - return CancelScope(deadline=deadline, shield=shield) - - @classmethod - def current_effective_deadline(cls) -> float: - if (task := current_task()) is None: - return math.inf - - try: - cancel_scope = _task_states[task].cancel_scope - except KeyError: - return math.inf - - deadline = math.inf - while cancel_scope: - deadline = min(deadline, cancel_scope.deadline) - if cancel_scope._cancel_called: - deadline = -math.inf - break - elif cancel_scope.shield: - break - else: - cancel_scope = cancel_scope._parent_scope - - return deadline - - @classmethod - def create_task_group(cls) -> abc.TaskGroup: - return TaskGroup() - - @classmethod - def create_event(cls) -> abc.Event: - return Event() - - @classmethod - def create_lock(cls, *, fast_acquire: bool) -> abc.Lock: - return Lock(fast_acquire=fast_acquire) - - @classmethod - def create_semaphore( - cls, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> abc.Semaphore: - return Semaphore(initial_value, max_value=max_value, fast_acquire=fast_acquire) - - @classmethod - def create_capacity_limiter(cls, total_tokens: float) -> abc.CapacityLimiter: - return CapacityLimiter(total_tokens) - - @classmethod - async def run_sync_in_worker_thread( # type: ignore[return] - cls, - func: Callable[[Unpack[PosArgsT]], T_Retval], - args: tuple[Unpack[PosArgsT]], - abandon_on_cancel: bool = False, - limiter: abc.CapacityLimiter | None = None, - ) -> T_Retval: - await cls.checkpoint() - - # If this is the first run in this event loop thread, set up the necessary - # variables - try: - idle_workers = _threadpool_idle_workers.get() - workers = _threadpool_workers.get() - except LookupError: - idle_workers = deque() - workers = set() - _threadpool_idle_workers.set(idle_workers) - _threadpool_workers.set(workers) - - async with limiter or cls.current_default_thread_limiter(): - with CancelScope(shield=not abandon_on_cancel) as scope: - future = asyncio.Future[T_Retval]() - root_task = find_root_task() - if not idle_workers: - worker = WorkerThread(root_task, workers, idle_workers) - worker.start() - workers.add(worker) - root_task.add_done_callback( - worker.stop, context=contextvars.Context() - ) - else: - worker = idle_workers.pop() - - # Prune any other workers that have been idle for MAX_IDLE_TIME - # seconds or longer - now = cls.current_time() - while idle_workers: - if ( - now - idle_workers[0].idle_since - < WorkerThread.MAX_IDLE_TIME - ): - break - - expired_worker = idle_workers.popleft() - expired_worker.root_task.remove_done_callback( - expired_worker.stop - ) - expired_worker.stop() - - context = copy_context() - context.run(sniffio.current_async_library_cvar.set, None) - if abandon_on_cancel or scope._parent_scope is None: - worker_scope = scope - else: - worker_scope = scope._parent_scope - - worker.queue.put_nowait((context, func, args, future, worker_scope)) - return await future - - @classmethod - def check_cancelled(cls) -> None: - scope: CancelScope | None = threadlocals.current_cancel_scope - while scope is not None: - if scope.cancel_called: - raise CancelledError(f"Cancelled by cancel scope {id(scope):x}") - - if scope.shield: - return - - scope = scope._parent_scope - - @classmethod - def run_async_from_thread( - cls, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - args: tuple[Unpack[PosArgsT]], - token: object, - ) -> T_Retval: - async def task_wrapper(scope: CancelScope) -> T_Retval: - __tracebackhide__ = True - task = cast(asyncio.Task, current_task()) - _task_states[task] = TaskState(None, scope) - scope._tasks.add(task) - try: - return await func(*args) - except CancelledError as exc: - raise concurrent.futures.CancelledError(str(exc)) from None - finally: - scope._tasks.discard(task) - - loop = cast(AbstractEventLoop, token) - context = copy_context() - context.run(sniffio.current_async_library_cvar.set, "asyncio") - wrapper = task_wrapper(threadlocals.current_cancel_scope) - f: concurrent.futures.Future[T_Retval] = context.run( - asyncio.run_coroutine_threadsafe, wrapper, loop - ) - return f.result() - - @classmethod - def run_sync_from_thread( - cls, - func: Callable[[Unpack[PosArgsT]], T_Retval], - args: tuple[Unpack[PosArgsT]], - token: object, - ) -> T_Retval: - @wraps(func) - def wrapper() -> None: - try: - sniffio.current_async_library_cvar.set("asyncio") - f.set_result(func(*args)) - except BaseException as exc: - f.set_exception(exc) - if not isinstance(exc, Exception): - raise - - f: concurrent.futures.Future[T_Retval] = Future() - loop = cast(AbstractEventLoop, token) - loop.call_soon_threadsafe(wrapper) - return f.result() - - @classmethod - def create_blocking_portal(cls) -> abc.BlockingPortal: - return BlockingPortal() - - @classmethod - async def open_process( - cls, - command: StrOrBytesPath | Sequence[StrOrBytesPath], - *, - stdin: int | IO[Any] | None, - stdout: int | IO[Any] | None, - stderr: int | IO[Any] | None, - **kwargs: Any, - ) -> Process: - await cls.checkpoint() - if isinstance(command, PathLike): - command = os.fspath(command) - - if isinstance(command, (str, bytes)): - process = await asyncio.create_subprocess_shell( - command, - stdin=stdin, - stdout=stdout, - stderr=stderr, - **kwargs, - ) - else: - process = await asyncio.create_subprocess_exec( - *command, - stdin=stdin, - stdout=stdout, - stderr=stderr, - **kwargs, - ) - - stdin_stream = StreamWriterWrapper(process.stdin) if process.stdin else None - stdout_stream = StreamReaderWrapper(process.stdout) if process.stdout else None - stderr_stream = StreamReaderWrapper(process.stderr) if process.stderr else None - return Process(process, stdin_stream, stdout_stream, stderr_stream) - - @classmethod - def setup_process_pool_exit_at_shutdown(cls, workers: set[abc.Process]) -> None: - create_task( - _shutdown_process_pool_on_exit(workers), - name="AnyIO process pool shutdown task", - ) - find_root_task().add_done_callback( - partial(_forcibly_shutdown_process_pool_on_exit, workers) # type:ignore[arg-type] - ) - - @classmethod - async def connect_tcp( - cls, host: str, port: int, local_address: IPSockAddrType | None = None - ) -> abc.SocketStream: - transport, protocol = cast( - tuple[asyncio.Transport, StreamProtocol], - await get_running_loop().create_connection( - StreamProtocol, host, port, local_addr=local_address - ), - ) - transport.pause_reading() - return SocketStream(transport, protocol) - - @classmethod - async def connect_unix(cls, path: str | bytes) -> abc.UNIXSocketStream: - await cls.checkpoint() - loop = get_running_loop() - raw_socket = socket.socket(socket.AF_UNIX) - raw_socket.setblocking(False) - while True: - try: - raw_socket.connect(path) - except BlockingIOError: - f: asyncio.Future = asyncio.Future() - loop.add_writer(raw_socket, f.set_result, None) - f.add_done_callback(lambda _: loop.remove_writer(raw_socket)) - await f - except BaseException: - raw_socket.close() - raise - else: - return UNIXSocketStream(raw_socket) - - @classmethod - def create_tcp_listener(cls, sock: socket.socket) -> SocketListener: - return TCPSocketListener(sock) - - @classmethod - def create_unix_listener(cls, sock: socket.socket) -> SocketListener: - return UNIXSocketListener(sock) - - @classmethod - async def create_udp_socket( - cls, - family: AddressFamily, - local_address: IPSockAddrType | None, - remote_address: IPSockAddrType | None, - reuse_port: bool, - ) -> UDPSocket | ConnectedUDPSocket: - transport, protocol = await get_running_loop().create_datagram_endpoint( - DatagramProtocol, - local_addr=local_address, - remote_addr=remote_address, - family=family, - reuse_port=reuse_port, - ) - if protocol.exception: - transport.close() - raise protocol.exception - - if not remote_address: - return UDPSocket(transport, protocol) - else: - return ConnectedUDPSocket(transport, protocol) - - @classmethod - async def create_unix_datagram_socket( # type: ignore[override] - cls, raw_socket: socket.socket, remote_path: str | bytes | None - ) -> abc.UNIXDatagramSocket | abc.ConnectedUNIXDatagramSocket: - await cls.checkpoint() - loop = get_running_loop() - - if remote_path: - while True: - try: - raw_socket.connect(remote_path) - except BlockingIOError: - f: asyncio.Future = asyncio.Future() - loop.add_writer(raw_socket, f.set_result, None) - f.add_done_callback(lambda _: loop.remove_writer(raw_socket)) - await f - except BaseException: - raw_socket.close() - raise - else: - return ConnectedUNIXDatagramSocket(raw_socket) - else: - return UNIXDatagramSocket(raw_socket) - - @classmethod - async def getaddrinfo( - cls, - host: bytes | str | None, - port: str | int | None, - *, - family: int | AddressFamily = 0, - type: int | SocketKind = 0, - proto: int = 0, - flags: int = 0, - ) -> Sequence[ - tuple[ - AddressFamily, - SocketKind, - int, - str, - tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes], - ] - ]: - return await get_running_loop().getaddrinfo( - host, port, family=family, type=type, proto=proto, flags=flags - ) - - @classmethod - async def getnameinfo( - cls, sockaddr: IPSockAddrType, flags: int = 0 - ) -> tuple[str, str]: - return await get_running_loop().getnameinfo(sockaddr, flags) - - @classmethod - async def wait_readable(cls, obj: FileDescriptorLike) -> None: - try: - read_events = _read_events.get() - except LookupError: - read_events = {} - _read_events.set(read_events) - - fd = obj if isinstance(obj, int) else obj.fileno() - if read_events.get(fd): - raise BusyResourceError("reading from") - - loop = get_running_loop() - fut: asyncio.Future[bool] = loop.create_future() - - def cb() -> None: - try: - del read_events[fd] - except KeyError: - pass - else: - remove_reader(fd) - - try: - fut.set_result(True) - except asyncio.InvalidStateError: - pass - - try: - loop.add_reader(fd, cb) - except NotImplementedError: - from anyio._core._asyncio_selector_thread import get_selector - - selector = get_selector() - selector.add_reader(fd, cb) - remove_reader = selector.remove_reader - else: - remove_reader = loop.remove_reader - - read_events[fd] = fut - try: - success = await fut - finally: - try: - del read_events[fd] - except KeyError: - pass - else: - remove_reader(fd) - - if not success: - raise ClosedResourceError - - @classmethod - async def wait_writable(cls, obj: FileDescriptorLike) -> None: - try: - write_events = _write_events.get() - except LookupError: - write_events = {} - _write_events.set(write_events) - - fd = obj if isinstance(obj, int) else obj.fileno() - if write_events.get(fd): - raise BusyResourceError("writing to") - - loop = get_running_loop() - fut: asyncio.Future[bool] = loop.create_future() - - def cb() -> None: - try: - del write_events[fd] - except KeyError: - pass - else: - remove_writer(fd) - - try: - fut.set_result(True) - except asyncio.InvalidStateError: - pass - - try: - loop.add_writer(fd, cb) - except NotImplementedError: - from anyio._core._asyncio_selector_thread import get_selector - - selector = get_selector() - selector.add_writer(fd, cb) - remove_writer = selector.remove_writer - else: - remove_writer = loop.remove_writer - - write_events[fd] = fut - try: - success = await fut - finally: - try: - del write_events[fd] - except KeyError: - pass - else: - remove_writer(fd) - - if not success: - raise ClosedResourceError - - @classmethod - def notify_closing(cls, obj: FileDescriptorLike) -> None: - fd = obj if isinstance(obj, int) else obj.fileno() - loop = get_running_loop() - - try: - write_events = _write_events.get() - except LookupError: - pass - else: - try: - fut = write_events.pop(fd) - except KeyError: - pass - else: - try: - fut.set_result(False) - except asyncio.InvalidStateError: - pass - - try: - loop.remove_writer(fd) - except NotImplementedError: - from anyio._core._asyncio_selector_thread import get_selector - - get_selector().remove_writer(fd) - - try: - read_events = _read_events.get() - except LookupError: - pass - else: - try: - fut = read_events.pop(fd) - except KeyError: - pass - else: - try: - fut.set_result(False) - except asyncio.InvalidStateError: - pass - - try: - loop.remove_reader(fd) - except NotImplementedError: - from anyio._core._asyncio_selector_thread import get_selector - - get_selector().remove_reader(fd) - - @classmethod - async def wrap_listener_socket(cls, sock: socket.socket) -> SocketListener: - return TCPSocketListener(sock) - - @classmethod - async def wrap_stream_socket(cls, sock: socket.socket) -> SocketStream: - transport, protocol = await get_running_loop().create_connection( - StreamProtocol, sock=sock - ) - return SocketStream(transport, protocol) - - @classmethod - async def wrap_unix_stream_socket(cls, sock: socket.socket) -> UNIXSocketStream: - return UNIXSocketStream(sock) - - @classmethod - async def wrap_udp_socket(cls, sock: socket.socket) -> UDPSocket: - transport, protocol = await get_running_loop().create_datagram_endpoint( - DatagramProtocol, sock=sock - ) - return UDPSocket(transport, protocol) - - @classmethod - async def wrap_connected_udp_socket(cls, sock: socket.socket) -> ConnectedUDPSocket: - transport, protocol = await get_running_loop().create_datagram_endpoint( - DatagramProtocol, sock=sock - ) - return ConnectedUDPSocket(transport, protocol) - - @classmethod - async def wrap_unix_datagram_socket(cls, sock: socket.socket) -> UNIXDatagramSocket: - return UNIXDatagramSocket(sock) - - @classmethod - async def wrap_connected_unix_datagram_socket( - cls, sock: socket.socket - ) -> ConnectedUNIXDatagramSocket: - return ConnectedUNIXDatagramSocket(sock) - - @classmethod - def current_default_thread_limiter(cls) -> CapacityLimiter: - try: - return _default_thread_limiter.get() - except LookupError: - limiter = CapacityLimiter(40) - _default_thread_limiter.set(limiter) - return limiter - - @classmethod - def open_signal_receiver( - cls, *signals: Signals - ) -> AbstractContextManager[AsyncIterator[Signals]]: - return _SignalReceiver(signals) - - @classmethod - def get_current_task(cls) -> TaskInfo: - return AsyncIOTaskInfo(current_task()) # type: ignore[arg-type] - - @classmethod - def get_running_tasks(cls) -> Sequence[TaskInfo]: - return [AsyncIOTaskInfo(task) for task in all_tasks() if not task.done()] - - @classmethod - async def wait_all_tasks_blocked(cls) -> None: - await cls.checkpoint() - this_task = current_task() - while True: - for task in all_tasks(): - if task is this_task: - continue - - waiter = task._fut_waiter # type: ignore[attr-defined] - if waiter is None or waiter.done(): - await sleep(0.1) - break - else: - return - - @classmethod - def create_test_runner(cls, options: dict[str, Any]) -> TestRunner: - return TestRunner(**options) - - -backend_class = AsyncIOBackend diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/_trio.py b/write-message/venv/lib/python3.10/site-packages/anyio/_backends/_trio.py deleted file mode 100644 index 021f111..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_backends/_trio.py +++ /dev/null @@ -1,1375 +0,0 @@ -from __future__ import annotations - -import array -import math -import os -import socket -import sys -import types -import weakref -from collections.abc import ( - AsyncGenerator, - AsyncIterator, - Awaitable, - Callable, - Collection, - Coroutine, - Iterable, - Sequence, -) -from concurrent.futures import Future -from contextlib import AbstractContextManager -from dataclasses import dataclass -from functools import partial -from io import IOBase -from os import PathLike -from signal import Signals -from socket import AddressFamily, SocketKind -from types import TracebackType -from typing import ( - IO, - TYPE_CHECKING, - Any, - Generic, - NoReturn, - TypeVar, - cast, - overload, -) - -import trio.from_thread -import trio.lowlevel -from outcome import Error, Outcome, Value -from trio.lowlevel import ( - current_root_task, - current_task, - notify_closing, - wait_readable, - wait_writable, -) -from trio.socket import SocketType as TrioSocketType -from trio.to_thread import run_sync - -from .. import ( - CapacityLimiterStatistics, - EventStatistics, - LockStatistics, - TaskInfo, - WouldBlock, - abc, -) -from .._core._eventloop import claim_worker_thread -from .._core._exceptions import ( - BrokenResourceError, - BusyResourceError, - ClosedResourceError, - EndOfStream, -) -from .._core._sockets import convert_ipv6_sockaddr -from .._core._streams import create_memory_object_stream -from .._core._synchronization import ( - CapacityLimiter as BaseCapacityLimiter, -) -from .._core._synchronization import Event as BaseEvent -from .._core._synchronization import Lock as BaseLock -from .._core._synchronization import ( - ResourceGuard, - SemaphoreStatistics, -) -from .._core._synchronization import Semaphore as BaseSemaphore -from .._core._tasks import CancelScope as BaseCancelScope -from ..abc import IPSockAddrType, UDPPacketType, UNIXDatagramPacketType -from ..abc._eventloop import AsyncBackend, StrOrBytesPath -from ..streams.memory import MemoryObjectSendStream - -if TYPE_CHECKING: - from _typeshed import FileDescriptorLike - -if sys.version_info >= (3, 10): - from typing import ParamSpec -else: - from typing_extensions import ParamSpec - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from exceptiongroup import BaseExceptionGroup - from typing_extensions import TypeVarTuple, Unpack - -T = TypeVar("T") -T_Retval = TypeVar("T_Retval") -T_SockAddr = TypeVar("T_SockAddr", str, IPSockAddrType) -PosArgsT = TypeVarTuple("PosArgsT") -P = ParamSpec("P") - - -# -# Event loop -# - -RunVar = trio.lowlevel.RunVar - - -# -# Timeouts and cancellation -# - - -class CancelScope(BaseCancelScope): - def __new__( - cls, original: trio.CancelScope | None = None, **kwargs: object - ) -> CancelScope: - return object.__new__(cls) - - def __init__(self, original: trio.CancelScope | None = None, **kwargs: Any) -> None: - self.__original = original or trio.CancelScope(**kwargs) - - def __enter__(self) -> CancelScope: - self.__original.__enter__() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool: - return self.__original.__exit__(exc_type, exc_val, exc_tb) - - def cancel(self) -> None: - self.__original.cancel() - - @property - def deadline(self) -> float: - return self.__original.deadline - - @deadline.setter - def deadline(self, value: float) -> None: - self.__original.deadline = value - - @property - def cancel_called(self) -> bool: - return self.__original.cancel_called - - @property - def cancelled_caught(self) -> bool: - return self.__original.cancelled_caught - - @property - def shield(self) -> bool: - return self.__original.shield - - @shield.setter - def shield(self, value: bool) -> None: - self.__original.shield = value - - -# -# Task groups -# - - -class TaskGroup(abc.TaskGroup): - def __init__(self) -> None: - self._active = False - self._nursery_manager = trio.open_nursery(strict_exception_groups=True) - self.cancel_scope = None # type: ignore[assignment] - - async def __aenter__(self) -> TaskGroup: - self._active = True - self._nursery = await self._nursery_manager.__aenter__() - self.cancel_scope = CancelScope(self._nursery.cancel_scope) - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool: - try: - # trio.Nursery.__exit__ returns bool; .open_nursery has wrong type - return await self._nursery_manager.__aexit__(exc_type, exc_val, exc_tb) # type: ignore[return-value] - except BaseExceptionGroup as exc: - if not exc.split(trio.Cancelled)[1]: - raise trio.Cancelled._create() from exc - - raise - finally: - del exc_val, exc_tb - self._active = False - - def start_soon( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[Any]], - *args: Unpack[PosArgsT], - name: object = None, - ) -> None: - if not self._active: - raise RuntimeError( - "This task group is not active; no new tasks can be started." - ) - - self._nursery.start_soon(func, *args, name=name) - - async def start( - self, func: Callable[..., Awaitable[Any]], *args: object, name: object = None - ) -> Any: - if not self._active: - raise RuntimeError( - "This task group is not active; no new tasks can be started." - ) - - return await self._nursery.start(func, *args, name=name) - - -# -# Threads -# - - -class BlockingPortal(abc.BlockingPortal): - def __new__(cls) -> BlockingPortal: - return object.__new__(cls) - - def __init__(self) -> None: - super().__init__() - self._token = trio.lowlevel.current_trio_token() - - def _spawn_task_from_thread( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval], - args: tuple[Unpack[PosArgsT]], - kwargs: dict[str, Any], - name: object, - future: Future[T_Retval], - ) -> None: - trio.from_thread.run_sync( - partial(self._task_group.start_soon, name=name), - self._call_func, - func, - args, - kwargs, - future, - trio_token=self._token, - ) - - -# -# Subprocesses -# - - -@dataclass(eq=False) -class ReceiveStreamWrapper(abc.ByteReceiveStream): - _stream: trio.abc.ReceiveStream - - async def receive(self, max_bytes: int | None = None) -> bytes: - try: - data = await self._stream.receive_some(max_bytes) - except trio.ClosedResourceError as exc: - raise ClosedResourceError from exc.__cause__ - except trio.BrokenResourceError as exc: - raise BrokenResourceError from exc.__cause__ - - if data: - return bytes(data) - else: - raise EndOfStream - - async def aclose(self) -> None: - await self._stream.aclose() - - -@dataclass(eq=False) -class SendStreamWrapper(abc.ByteSendStream): - _stream: trio.abc.SendStream - - async def send(self, item: bytes) -> None: - try: - await self._stream.send_all(item) - except trio.ClosedResourceError as exc: - raise ClosedResourceError from exc.__cause__ - except trio.BrokenResourceError as exc: - raise BrokenResourceError from exc.__cause__ - - async def aclose(self) -> None: - await self._stream.aclose() - - -@dataclass(eq=False) -class Process(abc.Process): - _process: trio.Process - _stdin: abc.ByteSendStream | None - _stdout: abc.ByteReceiveStream | None - _stderr: abc.ByteReceiveStream | None - - async def aclose(self) -> None: - with CancelScope(shield=True): - if self._stdin: - await self._stdin.aclose() - if self._stdout: - await self._stdout.aclose() - if self._stderr: - await self._stderr.aclose() - - try: - await self.wait() - except BaseException: - self.kill() - with CancelScope(shield=True): - await self.wait() - raise - - async def wait(self) -> int: - return await self._process.wait() - - def terminate(self) -> None: - self._process.terminate() - - def kill(self) -> None: - self._process.kill() - - def send_signal(self, signal: Signals) -> None: - self._process.send_signal(signal) - - @property - def pid(self) -> int: - return self._process.pid - - @property - def returncode(self) -> int | None: - return self._process.returncode - - @property - def stdin(self) -> abc.ByteSendStream | None: - return self._stdin - - @property - def stdout(self) -> abc.ByteReceiveStream | None: - return self._stdout - - @property - def stderr(self) -> abc.ByteReceiveStream | None: - return self._stderr - - -class _ProcessPoolShutdownInstrument(trio.abc.Instrument): - def after_run(self) -> None: - super().after_run() - - -current_default_worker_process_limiter: trio.lowlevel.RunVar = RunVar( - "current_default_worker_process_limiter" -) - - -async def _shutdown_process_pool(workers: set[abc.Process]) -> None: - try: - await trio.sleep(math.inf) - except trio.Cancelled: - for process in workers: - if process.returncode is None: - process.kill() - - with CancelScope(shield=True): - for process in workers: - await process.aclose() - - -# -# Sockets and networking -# - - -class _TrioSocketMixin(Generic[T_SockAddr]): - def __init__(self, trio_socket: TrioSocketType) -> None: - self._trio_socket = trio_socket - self._closed = False - - def _check_closed(self) -> None: - if self._closed: - raise ClosedResourceError - if self._trio_socket.fileno() < 0: - raise BrokenResourceError - - @property - def _raw_socket(self) -> socket.socket: - return self._trio_socket._sock # type: ignore[attr-defined] - - async def aclose(self) -> None: - if self._trio_socket.fileno() >= 0: - self._closed = True - self._trio_socket.close() - - def _convert_socket_error(self, exc: BaseException) -> NoReturn: - if isinstance(exc, trio.ClosedResourceError): - raise ClosedResourceError from exc - elif self._trio_socket.fileno() < 0 and self._closed: - raise ClosedResourceError from None - elif isinstance(exc, OSError): - raise BrokenResourceError from exc - else: - raise exc - - -class SocketStream(_TrioSocketMixin, abc.SocketStream): - def __init__(self, trio_socket: TrioSocketType) -> None: - super().__init__(trio_socket) - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - - async def receive(self, max_bytes: int = 65536) -> bytes: - with self._receive_guard: - try: - data = await self._trio_socket.recv(max_bytes) - except BaseException as exc: - self._convert_socket_error(exc) - - if data: - return data - else: - raise EndOfStream - - async def send(self, item: bytes) -> None: - with self._send_guard: - view = memoryview(item) - while view: - try: - bytes_sent = await self._trio_socket.send(view) - except BaseException as exc: - self._convert_socket_error(exc) - - view = view[bytes_sent:] - - async def send_eof(self) -> None: - self._trio_socket.shutdown(socket.SHUT_WR) - - -class UNIXSocketStream(SocketStream, abc.UNIXSocketStream): - async def receive_fds(self, msglen: int, maxfds: int) -> tuple[bytes, list[int]]: - if not isinstance(msglen, int) or msglen < 0: - raise ValueError("msglen must be a non-negative integer") - if not isinstance(maxfds, int) or maxfds < 1: - raise ValueError("maxfds must be a positive integer") - - fds = array.array("i") - await trio.lowlevel.checkpoint() - with self._receive_guard: - while True: - try: - message, ancdata, flags, addr = await self._trio_socket.recvmsg( - msglen, socket.CMSG_LEN(maxfds * fds.itemsize) - ) - except BaseException as exc: - self._convert_socket_error(exc) - else: - if not message and not ancdata: - raise EndOfStream - - break - - for cmsg_level, cmsg_type, cmsg_data in ancdata: - if cmsg_level != socket.SOL_SOCKET or cmsg_type != socket.SCM_RIGHTS: - raise RuntimeError( - f"Received unexpected ancillary data; message = {message!r}, " - f"cmsg_level = {cmsg_level}, cmsg_type = {cmsg_type}" - ) - - fds.frombytes(cmsg_data[: len(cmsg_data) - (len(cmsg_data) % fds.itemsize)]) - - return message, list(fds) - - async def send_fds(self, message: bytes, fds: Collection[int | IOBase]) -> None: - if not message: - raise ValueError("message must not be empty") - if not fds: - raise ValueError("fds must not be empty") - - filenos: list[int] = [] - for fd in fds: - if isinstance(fd, int): - filenos.append(fd) - elif isinstance(fd, IOBase): - filenos.append(fd.fileno()) - - fdarray = array.array("i", filenos) - await trio.lowlevel.checkpoint() - with self._send_guard: - while True: - try: - await self._trio_socket.sendmsg( - [message], - [ - ( - socket.SOL_SOCKET, - socket.SCM_RIGHTS, - fdarray, - ) - ], - ) - break - except BaseException as exc: - self._convert_socket_error(exc) - - -class TCPSocketListener(_TrioSocketMixin, abc.SocketListener): - def __init__(self, raw_socket: socket.socket): - super().__init__(trio.socket.from_stdlib_socket(raw_socket)) - self._accept_guard = ResourceGuard("accepting connections from") - - async def accept(self) -> SocketStream: - with self._accept_guard: - try: - trio_socket, _addr = await self._trio_socket.accept() - except BaseException as exc: - self._convert_socket_error(exc) - - trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - return SocketStream(trio_socket) - - -class UNIXSocketListener(_TrioSocketMixin, abc.SocketListener): - def __init__(self, raw_socket: socket.socket): - super().__init__(trio.socket.from_stdlib_socket(raw_socket)) - self._accept_guard = ResourceGuard("accepting connections from") - - async def accept(self) -> UNIXSocketStream: - with self._accept_guard: - try: - trio_socket, _addr = await self._trio_socket.accept() - except BaseException as exc: - self._convert_socket_error(exc) - - return UNIXSocketStream(trio_socket) - - -class UDPSocket(_TrioSocketMixin[IPSockAddrType], abc.UDPSocket): - def __init__(self, trio_socket: TrioSocketType) -> None: - super().__init__(trio_socket) - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - - async def receive(self) -> tuple[bytes, IPSockAddrType]: - with self._receive_guard: - try: - data, addr = await self._trio_socket.recvfrom(65536) - return data, convert_ipv6_sockaddr(addr) - except BaseException as exc: - self._convert_socket_error(exc) - - async def send(self, item: UDPPacketType) -> None: - with self._send_guard: - try: - await self._trio_socket.sendto(*item) - except BaseException as exc: - self._convert_socket_error(exc) - - -class ConnectedUDPSocket(_TrioSocketMixin[IPSockAddrType], abc.ConnectedUDPSocket): - def __init__(self, trio_socket: TrioSocketType) -> None: - super().__init__(trio_socket) - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - - async def receive(self) -> bytes: - with self._receive_guard: - try: - return await self._trio_socket.recv(65536) - except BaseException as exc: - self._convert_socket_error(exc) - - async def send(self, item: bytes) -> None: - with self._send_guard: - try: - await self._trio_socket.send(item) - except BaseException as exc: - self._convert_socket_error(exc) - - -class UNIXDatagramSocket(_TrioSocketMixin[str], abc.UNIXDatagramSocket): - def __init__(self, trio_socket: TrioSocketType) -> None: - super().__init__(trio_socket) - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - - async def receive(self) -> UNIXDatagramPacketType: - with self._receive_guard: - try: - data, addr = await self._trio_socket.recvfrom(65536) - return data, addr - except BaseException as exc: - self._convert_socket_error(exc) - - async def send(self, item: UNIXDatagramPacketType) -> None: - with self._send_guard: - try: - await self._trio_socket.sendto(*item) - except BaseException as exc: - self._convert_socket_error(exc) - - -class ConnectedUNIXDatagramSocket( - _TrioSocketMixin[str], abc.ConnectedUNIXDatagramSocket -): - def __init__(self, trio_socket: TrioSocketType) -> None: - super().__init__(trio_socket) - self._receive_guard = ResourceGuard("reading from") - self._send_guard = ResourceGuard("writing to") - - async def receive(self) -> bytes: - with self._receive_guard: - try: - return await self._trio_socket.recv(65536) - except BaseException as exc: - self._convert_socket_error(exc) - - async def send(self, item: bytes) -> None: - with self._send_guard: - try: - await self._trio_socket.send(item) - except BaseException as exc: - self._convert_socket_error(exc) - - -# -# Synchronization -# - - -class Event(BaseEvent): - def __new__(cls) -> Event: - return object.__new__(cls) - - def __init__(self) -> None: - self.__original = trio.Event() - - def is_set(self) -> bool: - return self.__original.is_set() - - async def wait(self) -> None: - return await self.__original.wait() - - def statistics(self) -> EventStatistics: - orig_statistics = self.__original.statistics() - return EventStatistics(tasks_waiting=orig_statistics.tasks_waiting) - - def set(self) -> None: - self.__original.set() - - -class Lock(BaseLock): - def __new__(cls, *, fast_acquire: bool = False) -> Lock: - return object.__new__(cls) - - def __init__(self, *, fast_acquire: bool = False) -> None: - self._fast_acquire = fast_acquire - self.__original = trio.Lock() - - @staticmethod - def _convert_runtime_error_msg(exc: RuntimeError) -> None: - if exc.args == ("attempt to re-acquire an already held Lock",): - exc.args = ("Attempted to acquire an already held Lock",) - - async def acquire(self) -> None: - if not self._fast_acquire: - try: - await self.__original.acquire() - except RuntimeError as exc: - self._convert_runtime_error_msg(exc) - raise - - return - - # This is the "fast path" where we don't let other tasks run - await trio.lowlevel.checkpoint_if_cancelled() - try: - self.__original.acquire_nowait() - except trio.WouldBlock: - await self.__original._lot.park() - except RuntimeError as exc: - self._convert_runtime_error_msg(exc) - raise - - def acquire_nowait(self) -> None: - try: - self.__original.acquire_nowait() - except trio.WouldBlock: - raise WouldBlock from None - except RuntimeError as exc: - self._convert_runtime_error_msg(exc) - raise - - def locked(self) -> bool: - return self.__original.locked() - - def release(self) -> None: - self.__original.release() - - def statistics(self) -> LockStatistics: - orig_statistics = self.__original.statistics() - owner = TrioTaskInfo(orig_statistics.owner) if orig_statistics.owner else None - return LockStatistics( - orig_statistics.locked, owner, orig_statistics.tasks_waiting - ) - - -class Semaphore(BaseSemaphore): - def __new__( - cls, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> Semaphore: - return object.__new__(cls) - - def __init__( - self, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> None: - super().__init__(initial_value, max_value=max_value, fast_acquire=fast_acquire) - self.__original = trio.Semaphore(initial_value, max_value=max_value) - - async def acquire(self) -> None: - if not self._fast_acquire: - await self.__original.acquire() - return - - # This is the "fast path" where we don't let other tasks run - await trio.lowlevel.checkpoint_if_cancelled() - try: - self.__original.acquire_nowait() - except trio.WouldBlock: - await self.__original._lot.park() - - def acquire_nowait(self) -> None: - try: - self.__original.acquire_nowait() - except trio.WouldBlock: - raise WouldBlock from None - - @property - def max_value(self) -> int | None: - return self.__original.max_value - - @property - def value(self) -> int: - return self.__original.value - - def release(self) -> None: - self.__original.release() - - def statistics(self) -> SemaphoreStatistics: - orig_statistics = self.__original.statistics() - return SemaphoreStatistics(orig_statistics.tasks_waiting) - - -class CapacityLimiter(BaseCapacityLimiter): - def __new__( - cls, - total_tokens: float | None = None, - *, - original: trio.CapacityLimiter | None = None, - ) -> CapacityLimiter: - return object.__new__(cls) - - def __init__( - self, - total_tokens: float | None = None, - *, - original: trio.CapacityLimiter | None = None, - ) -> None: - if original is not None: - self.__original = original - else: - assert total_tokens is not None - self.__original = trio.CapacityLimiter(total_tokens) - - async def __aenter__(self) -> None: - return await self.__original.__aenter__() - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - await self.__original.__aexit__(exc_type, exc_val, exc_tb) - - @property - def total_tokens(self) -> float: - return self.__original.total_tokens - - @total_tokens.setter - def total_tokens(self, value: float) -> None: - self.__original.total_tokens = value - - @property - def borrowed_tokens(self) -> int: - return self.__original.borrowed_tokens - - @property - def available_tokens(self) -> float: - return self.__original.available_tokens - - def acquire_nowait(self) -> None: - self.__original.acquire_nowait() - - def acquire_on_behalf_of_nowait(self, borrower: object) -> None: - self.__original.acquire_on_behalf_of_nowait(borrower) - - async def acquire(self) -> None: - await self.__original.acquire() - - async def acquire_on_behalf_of(self, borrower: object) -> None: - await self.__original.acquire_on_behalf_of(borrower) - - def release(self) -> None: - return self.__original.release() - - def release_on_behalf_of(self, borrower: object) -> None: - return self.__original.release_on_behalf_of(borrower) - - def statistics(self) -> CapacityLimiterStatistics: - orig = self.__original.statistics() - return CapacityLimiterStatistics( - borrowed_tokens=orig.borrowed_tokens, - total_tokens=orig.total_tokens, - borrowers=tuple(orig.borrowers), - tasks_waiting=orig.tasks_waiting, - ) - - -_capacity_limiter_wrapper: trio.lowlevel.RunVar = RunVar("_capacity_limiter_wrapper") - - -# -# Signal handling -# - - -class _SignalReceiver: - _iterator: AsyncIterator[int] - - def __init__(self, signals: tuple[Signals, ...]): - self._signals = signals - - def __enter__(self) -> _SignalReceiver: - self._cm = trio.open_signal_receiver(*self._signals) - self._iterator = self._cm.__enter__() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool | None: - return self._cm.__exit__(exc_type, exc_val, exc_tb) - - def __aiter__(self) -> _SignalReceiver: - return self - - async def __anext__(self) -> Signals: - signum = await self._iterator.__anext__() - return Signals(signum) - - -# -# Testing and debugging -# - - -class TestRunner(abc.TestRunner): - def __init__(self, **options: Any) -> None: - from queue import Queue - - self._call_queue: Queue[Callable[[], object]] = Queue() - self._send_stream: MemoryObjectSendStream | None = None - self._options = options - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: types.TracebackType | None, - ) -> None: - if self._send_stream: - self._send_stream.close() - while self._send_stream is not None: - self._call_queue.get()() - - async def _run_tests_and_fixtures(self) -> None: - self._send_stream, receive_stream = create_memory_object_stream(1) - with receive_stream: - async for coro, outcome_holder in receive_stream: - try: - retval = await coro - except BaseException as exc: - outcome_holder.append(Error(exc)) - else: - outcome_holder.append(Value(retval)) - - def _main_task_finished(self, outcome: object) -> None: - self._send_stream = None - - def _call_in_runner_task( - self, - func: Callable[P, Awaitable[T_Retval]], - *args: P.args, - **kwargs: P.kwargs, - ) -> T_Retval: - if self._send_stream is None: - trio.lowlevel.start_guest_run( - self._run_tests_and_fixtures, - run_sync_soon_threadsafe=self._call_queue.put, - done_callback=self._main_task_finished, - **self._options, - ) - while self._send_stream is None: - self._call_queue.get()() - - outcome_holder: list[Outcome] = [] - self._send_stream.send_nowait((func(*args, **kwargs), outcome_holder)) - while not outcome_holder: - self._call_queue.get()() - - return outcome_holder[0].unwrap() - - def run_asyncgen_fixture( - self, - fixture_func: Callable[..., AsyncGenerator[T_Retval, Any]], - kwargs: dict[str, Any], - ) -> Iterable[T_Retval]: - asyncgen = fixture_func(**kwargs) - fixturevalue: T_Retval = self._call_in_runner_task(asyncgen.asend, None) - - yield fixturevalue - - try: - self._call_in_runner_task(asyncgen.asend, None) - except StopAsyncIteration: - pass - else: - self._call_in_runner_task(asyncgen.aclose) - raise RuntimeError("Async generator fixture did not stop") - - def run_fixture( - self, - fixture_func: Callable[..., Coroutine[Any, Any, T_Retval]], - kwargs: dict[str, Any], - ) -> T_Retval: - return self._call_in_runner_task(fixture_func, **kwargs) - - def run_test( - self, test_func: Callable[..., Coroutine[Any, Any, Any]], kwargs: dict[str, Any] - ) -> None: - self._call_in_runner_task(test_func, **kwargs) - - -class TrioTaskInfo(TaskInfo): - def __init__(self, task: trio.lowlevel.Task): - parent_id = None - if task.parent_nursery and task.parent_nursery.parent_task: - parent_id = id(task.parent_nursery.parent_task) - - super().__init__(id(task), parent_id, task.name, task.coro) - self._task = weakref.proxy(task) - - def has_pending_cancellation(self) -> bool: - try: - return self._task._cancel_status.effectively_cancelled - except ReferenceError: - # If the task is no longer around, it surely doesn't have a cancellation - # pending - return False - - -class TrioBackend(AsyncBackend): - @classmethod - def run( - cls, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - args: tuple[Unpack[PosArgsT]], - kwargs: dict[str, Any], - options: dict[str, Any], - ) -> T_Retval: - return trio.run(func, *args) - - @classmethod - def current_token(cls) -> object: - return trio.lowlevel.current_trio_token() - - @classmethod - def current_time(cls) -> float: - return trio.current_time() - - @classmethod - def cancelled_exception_class(cls) -> type[BaseException]: - return trio.Cancelled - - @classmethod - async def checkpoint(cls) -> None: - await trio.lowlevel.checkpoint() - - @classmethod - async def checkpoint_if_cancelled(cls) -> None: - await trio.lowlevel.checkpoint_if_cancelled() - - @classmethod - async def cancel_shielded_checkpoint(cls) -> None: - await trio.lowlevel.cancel_shielded_checkpoint() - - @classmethod - async def sleep(cls, delay: float) -> None: - await trio.sleep(delay) - - @classmethod - def create_cancel_scope( - cls, *, deadline: float = math.inf, shield: bool = False - ) -> abc.CancelScope: - return CancelScope(deadline=deadline, shield=shield) - - @classmethod - def current_effective_deadline(cls) -> float: - return trio.current_effective_deadline() - - @classmethod - def create_task_group(cls) -> abc.TaskGroup: - return TaskGroup() - - @classmethod - def create_event(cls) -> abc.Event: - return Event() - - @classmethod - def create_lock(cls, *, fast_acquire: bool) -> Lock: - return Lock(fast_acquire=fast_acquire) - - @classmethod - def create_semaphore( - cls, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> abc.Semaphore: - return Semaphore(initial_value, max_value=max_value, fast_acquire=fast_acquire) - - @classmethod - def create_capacity_limiter(cls, total_tokens: float) -> CapacityLimiter: - return CapacityLimiter(total_tokens) - - @classmethod - async def run_sync_in_worker_thread( - cls, - func: Callable[[Unpack[PosArgsT]], T_Retval], - args: tuple[Unpack[PosArgsT]], - abandon_on_cancel: bool = False, - limiter: abc.CapacityLimiter | None = None, - ) -> T_Retval: - def wrapper() -> T_Retval: - with claim_worker_thread(TrioBackend, token): - return func(*args) - - token = TrioBackend.current_token() - return await run_sync( - wrapper, - abandon_on_cancel=abandon_on_cancel, - limiter=cast(trio.CapacityLimiter, limiter), - ) - - @classmethod - def check_cancelled(cls) -> None: - trio.from_thread.check_cancelled() - - @classmethod - def run_async_from_thread( - cls, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - args: tuple[Unpack[PosArgsT]], - token: object, - ) -> T_Retval: - return trio.from_thread.run(func, *args) - - @classmethod - def run_sync_from_thread( - cls, - func: Callable[[Unpack[PosArgsT]], T_Retval], - args: tuple[Unpack[PosArgsT]], - token: object, - ) -> T_Retval: - return trio.from_thread.run_sync(func, *args) - - @classmethod - def create_blocking_portal(cls) -> abc.BlockingPortal: - return BlockingPortal() - - @classmethod - async def open_process( - cls, - command: StrOrBytesPath | Sequence[StrOrBytesPath], - *, - stdin: int | IO[Any] | None, - stdout: int | IO[Any] | None, - stderr: int | IO[Any] | None, - **kwargs: Any, - ) -> Process: - def convert_item(item: StrOrBytesPath) -> str: - str_or_bytes = os.fspath(item) - if isinstance(str_or_bytes, str): - return str_or_bytes - else: - return os.fsdecode(str_or_bytes) - - if isinstance(command, (str, bytes, PathLike)): - process = await trio.lowlevel.open_process( - convert_item(command), - stdin=stdin, - stdout=stdout, - stderr=stderr, - shell=True, - **kwargs, - ) - else: - process = await trio.lowlevel.open_process( - [convert_item(item) for item in command], - stdin=stdin, - stdout=stdout, - stderr=stderr, - shell=False, - **kwargs, - ) - - stdin_stream = SendStreamWrapper(process.stdin) if process.stdin else None - stdout_stream = ReceiveStreamWrapper(process.stdout) if process.stdout else None - stderr_stream = ReceiveStreamWrapper(process.stderr) if process.stderr else None - return Process(process, stdin_stream, stdout_stream, stderr_stream) - - @classmethod - def setup_process_pool_exit_at_shutdown(cls, workers: set[abc.Process]) -> None: - trio.lowlevel.spawn_system_task(_shutdown_process_pool, workers) - - @classmethod - async def connect_tcp( - cls, host: str, port: int, local_address: IPSockAddrType | None = None - ) -> SocketStream: - family = socket.AF_INET6 if ":" in host else socket.AF_INET - trio_socket = trio.socket.socket(family) - trio_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - if local_address: - await trio_socket.bind(local_address) - - try: - await trio_socket.connect((host, port)) - except BaseException: - trio_socket.close() - raise - - return SocketStream(trio_socket) - - @classmethod - async def connect_unix(cls, path: str | bytes) -> abc.UNIXSocketStream: - trio_socket = trio.socket.socket(socket.AF_UNIX) - try: - await trio_socket.connect(path) - except BaseException: - trio_socket.close() - raise - - return UNIXSocketStream(trio_socket) - - @classmethod - def create_tcp_listener(cls, sock: socket.socket) -> abc.SocketListener: - return TCPSocketListener(sock) - - @classmethod - def create_unix_listener(cls, sock: socket.socket) -> abc.SocketListener: - return UNIXSocketListener(sock) - - @classmethod - async def create_udp_socket( - cls, - family: socket.AddressFamily, - local_address: IPSockAddrType | None, - remote_address: IPSockAddrType | None, - reuse_port: bool, - ) -> UDPSocket | ConnectedUDPSocket: - trio_socket = trio.socket.socket(family=family, type=socket.SOCK_DGRAM) - - if reuse_port: - trio_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) - - if local_address: - await trio_socket.bind(local_address) - - if remote_address: - await trio_socket.connect(remote_address) - return ConnectedUDPSocket(trio_socket) - else: - return UDPSocket(trio_socket) - - @classmethod - @overload - async def create_unix_datagram_socket( - cls, raw_socket: socket.socket, remote_path: None - ) -> abc.UNIXDatagramSocket: ... - - @classmethod - @overload - async def create_unix_datagram_socket( - cls, raw_socket: socket.socket, remote_path: str | bytes - ) -> abc.ConnectedUNIXDatagramSocket: ... - - @classmethod - async def create_unix_datagram_socket( - cls, raw_socket: socket.socket, remote_path: str | bytes | None - ) -> abc.UNIXDatagramSocket | abc.ConnectedUNIXDatagramSocket: - trio_socket = trio.socket.from_stdlib_socket(raw_socket) - - if remote_path: - await trio_socket.connect(remote_path) - return ConnectedUNIXDatagramSocket(trio_socket) - else: - return UNIXDatagramSocket(trio_socket) - - @classmethod - async def getaddrinfo( - cls, - host: bytes | str | None, - port: str | int | None, - *, - family: int | AddressFamily = 0, - type: int | SocketKind = 0, - proto: int = 0, - flags: int = 0, - ) -> Sequence[ - tuple[ - AddressFamily, - SocketKind, - int, - str, - tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes], - ] - ]: - return await trio.socket.getaddrinfo(host, port, family, type, proto, flags) - - @classmethod - async def getnameinfo( - cls, sockaddr: IPSockAddrType, flags: int = 0 - ) -> tuple[str, str]: - return await trio.socket.getnameinfo(sockaddr, flags) - - @classmethod - async def wait_readable(cls, obj: FileDescriptorLike) -> None: - try: - await wait_readable(obj) - except trio.ClosedResourceError as exc: - raise ClosedResourceError().with_traceback(exc.__traceback__) from None - except trio.BusyResourceError: - raise BusyResourceError("reading from") from None - - @classmethod - async def wait_writable(cls, obj: FileDescriptorLike) -> None: - try: - await wait_writable(obj) - except trio.ClosedResourceError as exc: - raise ClosedResourceError().with_traceback(exc.__traceback__) from None - except trio.BusyResourceError: - raise BusyResourceError("writing to") from None - - @classmethod - def notify_closing(cls, obj: FileDescriptorLike) -> None: - notify_closing(obj) - - @classmethod - async def wrap_listener_socket(cls, sock: socket.socket) -> abc.SocketListener: - return TCPSocketListener(sock) - - @classmethod - async def wrap_stream_socket(cls, sock: socket.socket) -> SocketStream: - trio_sock = trio.socket.from_stdlib_socket(sock) - return SocketStream(trio_sock) - - @classmethod - async def wrap_unix_stream_socket(cls, sock: socket.socket) -> UNIXSocketStream: - trio_sock = trio.socket.from_stdlib_socket(sock) - return UNIXSocketStream(trio_sock) - - @classmethod - async def wrap_udp_socket(cls, sock: socket.socket) -> UDPSocket: - trio_sock = trio.socket.from_stdlib_socket(sock) - return UDPSocket(trio_sock) - - @classmethod - async def wrap_connected_udp_socket(cls, sock: socket.socket) -> ConnectedUDPSocket: - trio_sock = trio.socket.from_stdlib_socket(sock) - return ConnectedUDPSocket(trio_sock) - - @classmethod - async def wrap_unix_datagram_socket(cls, sock: socket.socket) -> UNIXDatagramSocket: - trio_sock = trio.socket.from_stdlib_socket(sock) - return UNIXDatagramSocket(trio_sock) - - @classmethod - async def wrap_connected_unix_datagram_socket( - cls, sock: socket.socket - ) -> ConnectedUNIXDatagramSocket: - trio_sock = trio.socket.from_stdlib_socket(sock) - return ConnectedUNIXDatagramSocket(trio_sock) - - @classmethod - def current_default_thread_limiter(cls) -> CapacityLimiter: - try: - return _capacity_limiter_wrapper.get() - except LookupError: - limiter = CapacityLimiter( - original=trio.to_thread.current_default_thread_limiter() - ) - _capacity_limiter_wrapper.set(limiter) - return limiter - - @classmethod - def open_signal_receiver( - cls, *signals: Signals - ) -> AbstractContextManager[AsyncIterator[Signals]]: - return _SignalReceiver(signals) - - @classmethod - def get_current_task(cls) -> TaskInfo: - task = current_task() - return TrioTaskInfo(task) - - @classmethod - def get_running_tasks(cls) -> Sequence[TaskInfo]: - root_task = current_root_task() - assert root_task - task_infos = [TrioTaskInfo(root_task)] - nurseries = root_task.child_nurseries - while nurseries: - new_nurseries: list[trio.Nursery] = [] - for nursery in nurseries: - for task in nursery.child_tasks: - task_infos.append(TrioTaskInfo(task)) - new_nurseries.extend(task.child_nurseries) - - nurseries = new_nurseries - - return task_infos - - @classmethod - async def wait_all_tasks_blocked(cls) -> None: - from trio.testing import wait_all_tasks_blocked - - await wait_all_tasks_blocked() - - @classmethod - def create_test_runner(cls, options: dict[str, Any]) -> TestRunner: - return TestRunner(**options) - - -backend_class = TrioBackend diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__init__.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index a6e02e6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-310.pyc deleted file mode 100644 index 93eb5a4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_asyncio_selector_thread.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_contextmanagers.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_contextmanagers.cpython-310.pyc deleted file mode 100644 index b900e60..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_contextmanagers.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_eventloop.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_eventloop.cpython-310.pyc deleted file mode 100644 index 5493d8a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_eventloop.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_exceptions.cpython-310.pyc deleted file mode 100644 index a035881..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_fileio.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_fileio.cpython-310.pyc deleted file mode 100644 index e841f97..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_fileio.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_resources.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_resources.cpython-310.pyc deleted file mode 100644 index 8cf285d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_resources.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_signals.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_signals.cpython-310.pyc deleted file mode 100644 index ef477df..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_signals.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_sockets.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_sockets.cpython-310.pyc deleted file mode 100644 index 4a426fb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_sockets.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_streams.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_streams.cpython-310.pyc deleted file mode 100644 index 0e55ca3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_streams.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_subprocesses.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_subprocesses.cpython-310.pyc deleted file mode 100644 index 17a00d1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_subprocesses.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_synchronization.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_synchronization.cpython-310.pyc deleted file mode 100644 index ca621aa..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_synchronization.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_tasks.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_tasks.cpython-310.pyc deleted file mode 100644 index a5a4317..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_tasks.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_tempfile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_tempfile.cpython-310.pyc deleted file mode 100644 index 557c32a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_tempfile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_testing.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_testing.cpython-310.pyc deleted file mode 100644 index cee2cfb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_testing.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_typedattr.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_typedattr.cpython-310.pyc deleted file mode 100644 index 39b23a4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/_core/__pycache__/_typedattr.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_asyncio_selector_thread.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_asyncio_selector_thread.py deleted file mode 100644 index 9f35bae..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_asyncio_selector_thread.py +++ /dev/null @@ -1,167 +0,0 @@ -from __future__ import annotations - -import asyncio -import socket -import threading -from collections.abc import Callable -from selectors import EVENT_READ, EVENT_WRITE, DefaultSelector -from typing import TYPE_CHECKING, Any - -if TYPE_CHECKING: - from _typeshed import FileDescriptorLike - -_selector_lock = threading.Lock() -_selector: Selector | None = None - - -class Selector: - def __init__(self) -> None: - self._thread = threading.Thread(target=self.run, name="AnyIO socket selector") - self._selector = DefaultSelector() - self._send, self._receive = socket.socketpair() - self._send.setblocking(False) - self._receive.setblocking(False) - # This somewhat reduces the amount of memory wasted queueing up data - # for wakeups. With these settings, maximum number of 1-byte sends - # before getting BlockingIOError: - # Linux 4.8: 6 - # macOS (darwin 15.5): 1 - # Windows 10: 525347 - # Windows you're weird. (And on Windows setting SNDBUF to 0 makes send - # blocking, even on non-blocking sockets, so don't do that.) - self._receive.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 1) - self._send.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 1) - # On Windows this is a TCP socket so this might matter. On other - # platforms this fails b/c AF_UNIX sockets aren't actually TCP. - try: - self._send.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - except OSError: - pass - - self._selector.register(self._receive, EVENT_READ) - self._closed = False - - def start(self) -> None: - self._thread.start() - threading._register_atexit(self._stop) # type: ignore[attr-defined] - - def _stop(self) -> None: - global _selector - self._closed = True - self._notify_self() - self._send.close() - self._thread.join() - self._selector.unregister(self._receive) - self._receive.close() - self._selector.close() - _selector = None - assert not self._selector.get_map(), ( - "selector still has registered file descriptors after shutdown" - ) - - def _notify_self(self) -> None: - try: - self._send.send(b"\x00") - except BlockingIOError: - pass - - def add_reader(self, fd: FileDescriptorLike, callback: Callable[[], Any]) -> None: - loop = asyncio.get_running_loop() - try: - key = self._selector.get_key(fd) - except KeyError: - self._selector.register(fd, EVENT_READ, {EVENT_READ: (loop, callback)}) - else: - if EVENT_READ in key.data: - raise ValueError( - "this file descriptor is already registered for reading" - ) - - key.data[EVENT_READ] = loop, callback - self._selector.modify(fd, key.events | EVENT_READ, key.data) - - self._notify_self() - - def add_writer(self, fd: FileDescriptorLike, callback: Callable[[], Any]) -> None: - loop = asyncio.get_running_loop() - try: - key = self._selector.get_key(fd) - except KeyError: - self._selector.register(fd, EVENT_WRITE, {EVENT_WRITE: (loop, callback)}) - else: - if EVENT_WRITE in key.data: - raise ValueError( - "this file descriptor is already registered for writing" - ) - - key.data[EVENT_WRITE] = loop, callback - self._selector.modify(fd, key.events | EVENT_WRITE, key.data) - - self._notify_self() - - def remove_reader(self, fd: FileDescriptorLike) -> bool: - try: - key = self._selector.get_key(fd) - except KeyError: - return False - - if new_events := key.events ^ EVENT_READ: - del key.data[EVENT_READ] - self._selector.modify(fd, new_events, key.data) - else: - self._selector.unregister(fd) - - return True - - def remove_writer(self, fd: FileDescriptorLike) -> bool: - try: - key = self._selector.get_key(fd) - except KeyError: - return False - - if new_events := key.events ^ EVENT_WRITE: - del key.data[EVENT_WRITE] - self._selector.modify(fd, new_events, key.data) - else: - self._selector.unregister(fd) - - return True - - def run(self) -> None: - while not self._closed: - for key, events in self._selector.select(): - if key.fileobj is self._receive: - try: - while self._receive.recv(4096): - pass - except BlockingIOError: - pass - - continue - - if events & EVENT_READ: - loop, callback = key.data[EVENT_READ] - self.remove_reader(key.fd) - try: - loop.call_soon_threadsafe(callback) - except RuntimeError: - pass # the loop was already closed - - if events & EVENT_WRITE: - loop, callback = key.data[EVENT_WRITE] - self.remove_writer(key.fd) - try: - loop.call_soon_threadsafe(callback) - except RuntimeError: - pass # the loop was already closed - - -def get_selector() -> Selector: - global _selector - - with _selector_lock: - if _selector is None: - _selector = Selector() - _selector.start() - - return _selector diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_contextmanagers.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_contextmanagers.py deleted file mode 100644 index 302f32b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_contextmanagers.py +++ /dev/null @@ -1,200 +0,0 @@ -from __future__ import annotations - -from abc import abstractmethod -from contextlib import AbstractAsyncContextManager, AbstractContextManager -from inspect import isasyncgen, iscoroutine, isgenerator -from types import TracebackType -from typing import Protocol, TypeVar, cast, final - -_T_co = TypeVar("_T_co", covariant=True) -_ExitT_co = TypeVar("_ExitT_co", covariant=True, bound="bool | None") - - -class _SupportsCtxMgr(Protocol[_T_co, _ExitT_co]): - def __contextmanager__(self) -> AbstractContextManager[_T_co, _ExitT_co]: ... - - -class _SupportsAsyncCtxMgr(Protocol[_T_co, _ExitT_co]): - def __asynccontextmanager__( - self, - ) -> AbstractAsyncContextManager[_T_co, _ExitT_co]: ... - - -class ContextManagerMixin: - """ - Mixin class providing context manager functionality via a generator-based - implementation. - - This class allows you to implement a context manager via :meth:`__contextmanager__` - which should return a generator. The mechanics are meant to mirror those of - :func:`@contextmanager `. - - .. note:: Classes using this mix-in are not reentrant as context managers, meaning - that once you enter it, you can't re-enter before first exiting it. - - .. seealso:: :doc:`contextmanagers` - """ - - __cm: AbstractContextManager[object, bool | None] | None = None - - @final - def __enter__(self: _SupportsCtxMgr[_T_co, bool | None]) -> _T_co: - # Needed for mypy to assume self still has the __cm member - assert isinstance(self, ContextManagerMixin) - if self.__cm is not None: - raise RuntimeError( - f"this {self.__class__.__qualname__} has already been entered" - ) - - cm = self.__contextmanager__() - if not isinstance(cm, AbstractContextManager): - if isgenerator(cm): - raise TypeError( - "__contextmanager__() returned a generator object instead of " - "a context manager. Did you forget to add the @contextmanager " - "decorator?" - ) - - raise TypeError( - f"__contextmanager__() did not return a context manager object, " - f"but {cm.__class__!r}" - ) - - if cm is self: - raise TypeError( - f"{self.__class__.__qualname__}.__contextmanager__() returned " - f"self. Did you forget to add the @contextmanager decorator and a " - f"'yield' statement?" - ) - - value = cm.__enter__() - self.__cm = cm - return value - - @final - def __exit__( - self: _SupportsCtxMgr[object, _ExitT_co], - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> _ExitT_co: - # Needed for mypy to assume self still has the __cm member - assert isinstance(self, ContextManagerMixin) - if self.__cm is None: - raise RuntimeError( - f"this {self.__class__.__qualname__} has not been entered yet" - ) - - # Prevent circular references - cm = self.__cm - del self.__cm - - return cast(_ExitT_co, cm.__exit__(exc_type, exc_val, exc_tb)) - - @abstractmethod - def __contextmanager__(self) -> AbstractContextManager[object, bool | None]: - """ - Implement your context manager logic here. - - This method **must** be decorated with - :func:`@contextmanager `. - - .. note:: Remember that the ``yield`` will raise any exception raised in the - enclosed context block, so use a ``finally:`` block to clean up resources! - - :return: a context manager object - """ - - -class AsyncContextManagerMixin: - """ - Mixin class providing async context manager functionality via a generator-based - implementation. - - This class allows you to implement a context manager via - :meth:`__asynccontextmanager__`. The mechanics are meant to mirror those of - :func:`@asynccontextmanager `. - - .. note:: Classes using this mix-in are not reentrant as context managers, meaning - that once you enter it, you can't re-enter before first exiting it. - - .. seealso:: :doc:`contextmanagers` - """ - - __cm: AbstractAsyncContextManager[object, bool | None] | None = None - - @final - async def __aenter__(self: _SupportsAsyncCtxMgr[_T_co, bool | None]) -> _T_co: - # Needed for mypy to assume self still has the __cm member - assert isinstance(self, AsyncContextManagerMixin) - if self.__cm is not None: - raise RuntimeError( - f"this {self.__class__.__qualname__} has already been entered" - ) - - cm = self.__asynccontextmanager__() - if not isinstance(cm, AbstractAsyncContextManager): - if isasyncgen(cm): - raise TypeError( - "__asynccontextmanager__() returned an async generator instead of " - "an async context manager. Did you forget to add the " - "@asynccontextmanager decorator?" - ) - elif iscoroutine(cm): - cm.close() - raise TypeError( - "__asynccontextmanager__() returned a coroutine object instead of " - "an async context manager. Did you forget to add the " - "@asynccontextmanager decorator and a 'yield' statement?" - ) - - raise TypeError( - f"__asynccontextmanager__() did not return an async context manager, " - f"but {cm.__class__!r}" - ) - - if cm is self: - raise TypeError( - f"{self.__class__.__qualname__}.__asynccontextmanager__() returned " - f"self. Did you forget to add the @asynccontextmanager decorator and a " - f"'yield' statement?" - ) - - value = await cm.__aenter__() - self.__cm = cm - return value - - @final - async def __aexit__( - self: _SupportsAsyncCtxMgr[object, _ExitT_co], - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> _ExitT_co: - assert isinstance(self, AsyncContextManagerMixin) - if self.__cm is None: - raise RuntimeError( - f"this {self.__class__.__qualname__} has not been entered yet" - ) - - # Prevent circular references - cm = self.__cm - del self.__cm - - return cast(_ExitT_co, await cm.__aexit__(exc_type, exc_val, exc_tb)) - - @abstractmethod - def __asynccontextmanager__( - self, - ) -> AbstractAsyncContextManager[object, bool | None]: - """ - Implement your async context manager logic here. - - This method **must** be decorated with - :func:`@asynccontextmanager `. - - .. note:: Remember that the ``yield`` will raise any exception raised in the - enclosed context block, so use a ``finally:`` block to clean up resources! - - :return: an async context manager object - """ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_eventloop.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_eventloop.py deleted file mode 100644 index 6dcb458..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_eventloop.py +++ /dev/null @@ -1,166 +0,0 @@ -from __future__ import annotations - -import math -import sys -import threading -from collections.abc import Awaitable, Callable, Generator -from contextlib import contextmanager -from importlib import import_module -from typing import TYPE_CHECKING, Any, TypeVar - -import sniffio - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -if TYPE_CHECKING: - from ..abc import AsyncBackend - -# This must be updated when new backends are introduced -BACKENDS = "asyncio", "trio" - -T_Retval = TypeVar("T_Retval") -PosArgsT = TypeVarTuple("PosArgsT") - -threadlocals = threading.local() -loaded_backends: dict[str, type[AsyncBackend]] = {} - - -def run( - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - *args: Unpack[PosArgsT], - backend: str = "asyncio", - backend_options: dict[str, Any] | None = None, -) -> T_Retval: - """ - Run the given coroutine function in an asynchronous event loop. - - The current thread must not be already running an event loop. - - :param func: a coroutine function - :param args: positional arguments to ``func`` - :param backend: name of the asynchronous event loop implementation – currently - either ``asyncio`` or ``trio`` - :param backend_options: keyword arguments to call the backend ``run()`` - implementation with (documented :ref:`here `) - :return: the return value of the coroutine function - :raises RuntimeError: if an asynchronous event loop is already running in this - thread - :raises LookupError: if the named backend is not found - - """ - try: - asynclib_name = sniffio.current_async_library() - except sniffio.AsyncLibraryNotFoundError: - pass - else: - raise RuntimeError(f"Already running {asynclib_name} in this thread") - - try: - async_backend = get_async_backend(backend) - except ImportError as exc: - raise LookupError(f"No such backend: {backend}") from exc - - token = None - if sniffio.current_async_library_cvar.get(None) is None: - # Since we're in control of the event loop, we can cache the name of the async - # library - token = sniffio.current_async_library_cvar.set(backend) - - try: - backend_options = backend_options or {} - return async_backend.run(func, args, {}, backend_options) - finally: - if token: - sniffio.current_async_library_cvar.reset(token) - - -async def sleep(delay: float) -> None: - """ - Pause the current task for the specified duration. - - :param delay: the duration, in seconds - - """ - return await get_async_backend().sleep(delay) - - -async def sleep_forever() -> None: - """ - Pause the current task until it's cancelled. - - This is a shortcut for ``sleep(math.inf)``. - - .. versionadded:: 3.1 - - """ - await sleep(math.inf) - - -async def sleep_until(deadline: float) -> None: - """ - Pause the current task until the given time. - - :param deadline: the absolute time to wake up at (according to the internal - monotonic clock of the event loop) - - .. versionadded:: 3.1 - - """ - now = current_time() - await sleep(max(deadline - now, 0)) - - -def current_time() -> float: - """ - Return the current value of the event loop's internal clock. - - :return: the clock value (seconds) - - """ - return get_async_backend().current_time() - - -def get_all_backends() -> tuple[str, ...]: - """Return a tuple of the names of all built-in backends.""" - return BACKENDS - - -def get_cancelled_exc_class() -> type[BaseException]: - """Return the current async library's cancellation exception class.""" - return get_async_backend().cancelled_exception_class() - - -# -# Private API -# - - -@contextmanager -def claim_worker_thread( - backend_class: type[AsyncBackend], token: object -) -> Generator[Any, None, None]: - threadlocals.current_async_backend = backend_class - threadlocals.current_token = token - try: - yield - finally: - del threadlocals.current_async_backend - del threadlocals.current_token - - -def get_async_backend(asynclib_name: str | None = None) -> type[AsyncBackend]: - if asynclib_name is None: - asynclib_name = sniffio.current_async_library() - - # We use our own dict instead of sys.modules to get the already imported back-end - # class because the appropriate modules in sys.modules could potentially be only - # partially initialized - try: - return loaded_backends[asynclib_name] - except KeyError: - module = import_module(f"anyio._backends._{asynclib_name}") - loaded_backends[asynclib_name] = module.backend_class - return module.backend_class diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_exceptions.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_exceptions.py deleted file mode 100644 index daa0677..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_exceptions.py +++ /dev/null @@ -1,134 +0,0 @@ -from __future__ import annotations - -import sys -from collections.abc import Generator -from textwrap import dedent -from typing import Any - -if sys.version_info < (3, 11): - from exceptiongroup import BaseExceptionGroup - - -class BrokenResourceError(Exception): - """ - Raised when trying to use a resource that has been rendered unusable due to external - causes (e.g. a send stream whose peer has disconnected). - """ - - -class BrokenWorkerProcess(Exception): - """ - Raised by :meth:`~anyio.to_process.run_sync` if the worker process terminates abruptly or - otherwise misbehaves. - """ - - -class BrokenWorkerInterpreter(Exception): - """ - Raised by :meth:`~anyio.to_interpreter.run_sync` if an unexpected exception is - raised in the subinterpreter. - """ - - def __init__(self, excinfo: Any): - # This was adapted from concurrent.futures.interpreter.ExecutionFailed - msg = excinfo.formatted - if not msg: - if excinfo.type and excinfo.msg: - msg = f"{excinfo.type.__name__}: {excinfo.msg}" - else: - msg = excinfo.type.__name__ or excinfo.msg - - super().__init__(msg) - self.excinfo = excinfo - - def __str__(self) -> str: - try: - formatted = self.excinfo.errdisplay - except Exception: - return super().__str__() - else: - return dedent( - f""" - {super().__str__()} - - Uncaught in the interpreter: - - {formatted} - """.strip() - ) - - -class BusyResourceError(Exception): - """ - Raised when two tasks are trying to read from or write to the same resource - concurrently. - """ - - def __init__(self, action: str): - super().__init__(f"Another task is already {action} this resource") - - -class ClosedResourceError(Exception): - """Raised when trying to use a resource that has been closed.""" - - -class ConnectionFailed(OSError): - """ - Raised when a connection attempt fails. - - .. note:: This class inherits from :exc:`OSError` for backwards compatibility. - """ - - -def iterate_exceptions( - exception: BaseException, -) -> Generator[BaseException, None, None]: - if isinstance(exception, BaseExceptionGroup): - for exc in exception.exceptions: - yield from iterate_exceptions(exc) - else: - yield exception - - -class DelimiterNotFound(Exception): - """ - Raised during - :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the - maximum number of bytes has been read without the delimiter being found. - """ - - def __init__(self, max_bytes: int) -> None: - super().__init__( - f"The delimiter was not found among the first {max_bytes} bytes" - ) - - -class EndOfStream(Exception): - """ - Raised when trying to read from a stream that has been closed from the other end. - """ - - -class IncompleteRead(Exception): - """ - Raised during - :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_exactly` or - :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the - connection is closed before the requested amount of bytes has been read. - """ - - def __init__(self) -> None: - super().__init__( - "The stream was closed before the read operation could be completed" - ) - - -class TypedAttributeLookupError(LookupError): - """ - Raised by :meth:`~anyio.TypedAttributeProvider.extra` when the given typed attribute - is not found and no default value has been given. - """ - - -class WouldBlock(Exception): - """Raised by ``X_nowait`` functions if ``X()`` would block.""" diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_fileio.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_fileio.py deleted file mode 100644 index 2eae029..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_fileio.py +++ /dev/null @@ -1,740 +0,0 @@ -from __future__ import annotations - -import os -import pathlib -import sys -from collections.abc import ( - AsyncIterator, - Callable, - Iterable, - Iterator, - Sequence, -) -from dataclasses import dataclass -from functools import partial -from os import PathLike -from typing import ( - IO, - TYPE_CHECKING, - Any, - AnyStr, - ClassVar, - Final, - Generic, - overload, -) - -from .. import to_thread -from ..abc import AsyncResource - -if TYPE_CHECKING: - from types import ModuleType - - from _typeshed import OpenBinaryMode, OpenTextMode, ReadableBuffer, WriteableBuffer -else: - ReadableBuffer = OpenBinaryMode = OpenTextMode = WriteableBuffer = object - - -class AsyncFile(AsyncResource, Generic[AnyStr]): - """ - An asynchronous file object. - - This class wraps a standard file object and provides async friendly versions of the - following blocking methods (where available on the original file object): - - * read - * read1 - * readline - * readlines - * readinto - * readinto1 - * write - * writelines - * truncate - * seek - * tell - * flush - - All other methods are directly passed through. - - This class supports the asynchronous context manager protocol which closes the - underlying file at the end of the context block. - - This class also supports asynchronous iteration:: - - async with await open_file(...) as f: - async for line in f: - print(line) - """ - - def __init__(self, fp: IO[AnyStr]) -> None: - self._fp: Any = fp - - def __getattr__(self, name: str) -> object: - return getattr(self._fp, name) - - @property - def wrapped(self) -> IO[AnyStr]: - """The wrapped file object.""" - return self._fp - - async def __aiter__(self) -> AsyncIterator[AnyStr]: - while True: - line = await self.readline() - if line: - yield line - else: - break - - async def aclose(self) -> None: - return await to_thread.run_sync(self._fp.close) - - async def read(self, size: int = -1) -> AnyStr: - return await to_thread.run_sync(self._fp.read, size) - - async def read1(self: AsyncFile[bytes], size: int = -1) -> bytes: - return await to_thread.run_sync(self._fp.read1, size) - - async def readline(self) -> AnyStr: - return await to_thread.run_sync(self._fp.readline) - - async def readlines(self) -> list[AnyStr]: - return await to_thread.run_sync(self._fp.readlines) - - async def readinto(self: AsyncFile[bytes], b: WriteableBuffer) -> int: - return await to_thread.run_sync(self._fp.readinto, b) - - async def readinto1(self: AsyncFile[bytes], b: WriteableBuffer) -> int: - return await to_thread.run_sync(self._fp.readinto1, b) - - @overload - async def write(self: AsyncFile[bytes], b: ReadableBuffer) -> int: ... - - @overload - async def write(self: AsyncFile[str], b: str) -> int: ... - - async def write(self, b: ReadableBuffer | str) -> int: - return await to_thread.run_sync(self._fp.write, b) - - @overload - async def writelines( - self: AsyncFile[bytes], lines: Iterable[ReadableBuffer] - ) -> None: ... - - @overload - async def writelines(self: AsyncFile[str], lines: Iterable[str]) -> None: ... - - async def writelines(self, lines: Iterable[ReadableBuffer] | Iterable[str]) -> None: - return await to_thread.run_sync(self._fp.writelines, lines) - - async def truncate(self, size: int | None = None) -> int: - return await to_thread.run_sync(self._fp.truncate, size) - - async def seek(self, offset: int, whence: int | None = os.SEEK_SET) -> int: - return await to_thread.run_sync(self._fp.seek, offset, whence) - - async def tell(self) -> int: - return await to_thread.run_sync(self._fp.tell) - - async def flush(self) -> None: - return await to_thread.run_sync(self._fp.flush) - - -@overload -async def open_file( - file: str | PathLike[str] | int, - mode: OpenBinaryMode, - buffering: int = ..., - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., - closefd: bool = ..., - opener: Callable[[str, int], int] | None = ..., -) -> AsyncFile[bytes]: ... - - -@overload -async def open_file( - file: str | PathLike[str] | int, - mode: OpenTextMode = ..., - buffering: int = ..., - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., - closefd: bool = ..., - opener: Callable[[str, int], int] | None = ..., -) -> AsyncFile[str]: ... - - -async def open_file( - file: str | PathLike[str] | int, - mode: str = "r", - buffering: int = -1, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - closefd: bool = True, - opener: Callable[[str, int], int] | None = None, -) -> AsyncFile[Any]: - """ - Open a file asynchronously. - - The arguments are exactly the same as for the builtin :func:`open`. - - :return: an asynchronous file object - - """ - fp = await to_thread.run_sync( - open, file, mode, buffering, encoding, errors, newline, closefd, opener - ) - return AsyncFile(fp) - - -def wrap_file(file: IO[AnyStr]) -> AsyncFile[AnyStr]: - """ - Wrap an existing file as an asynchronous file. - - :param file: an existing file-like object - :return: an asynchronous file object - - """ - return AsyncFile(file) - - -@dataclass(eq=False) -class _PathIterator(AsyncIterator["Path"]): - iterator: Iterator[PathLike[str]] - - async def __anext__(self) -> Path: - nextval = await to_thread.run_sync( - next, self.iterator, None, abandon_on_cancel=True - ) - if nextval is None: - raise StopAsyncIteration from None - - return Path(nextval) - - -class Path: - """ - An asynchronous version of :class:`pathlib.Path`. - - This class cannot be substituted for :class:`pathlib.Path` or - :class:`pathlib.PurePath`, but it is compatible with the :class:`os.PathLike` - interface. - - It implements the Python 3.10 version of :class:`pathlib.Path` interface, except for - the deprecated :meth:`~pathlib.Path.link_to` method. - - Some methods may be unavailable or have limited functionality, based on the Python - version: - - * :meth:`~pathlib.Path.copy` (available on Python 3.14 or later) - * :meth:`~pathlib.Path.copy_into` (available on Python 3.14 or later) - * :meth:`~pathlib.Path.from_uri` (available on Python 3.13 or later) - * :meth:`~pathlib.PurePath.full_match` (available on Python 3.13 or later) - * :attr:`~pathlib.Path.info` (available on Python 3.14 or later) - * :meth:`~pathlib.Path.is_junction` (available on Python 3.12 or later) - * :meth:`~pathlib.PurePath.match` (the ``case_sensitive`` parameter is only - available on Python 3.13 or later) - * :meth:`~pathlib.Path.move` (available on Python 3.14 or later) - * :meth:`~pathlib.Path.move_into` (available on Python 3.14 or later) - * :meth:`~pathlib.PurePath.relative_to` (the ``walk_up`` parameter is only available - on Python 3.12 or later) - * :meth:`~pathlib.Path.walk` (available on Python 3.12 or later) - - Any methods that do disk I/O need to be awaited on. These methods are: - - * :meth:`~pathlib.Path.absolute` - * :meth:`~pathlib.Path.chmod` - * :meth:`~pathlib.Path.cwd` - * :meth:`~pathlib.Path.exists` - * :meth:`~pathlib.Path.expanduser` - * :meth:`~pathlib.Path.group` - * :meth:`~pathlib.Path.hardlink_to` - * :meth:`~pathlib.Path.home` - * :meth:`~pathlib.Path.is_block_device` - * :meth:`~pathlib.Path.is_char_device` - * :meth:`~pathlib.Path.is_dir` - * :meth:`~pathlib.Path.is_fifo` - * :meth:`~pathlib.Path.is_file` - * :meth:`~pathlib.Path.is_junction` - * :meth:`~pathlib.Path.is_mount` - * :meth:`~pathlib.Path.is_socket` - * :meth:`~pathlib.Path.is_symlink` - * :meth:`~pathlib.Path.lchmod` - * :meth:`~pathlib.Path.lstat` - * :meth:`~pathlib.Path.mkdir` - * :meth:`~pathlib.Path.open` - * :meth:`~pathlib.Path.owner` - * :meth:`~pathlib.Path.read_bytes` - * :meth:`~pathlib.Path.read_text` - * :meth:`~pathlib.Path.readlink` - * :meth:`~pathlib.Path.rename` - * :meth:`~pathlib.Path.replace` - * :meth:`~pathlib.Path.resolve` - * :meth:`~pathlib.Path.rmdir` - * :meth:`~pathlib.Path.samefile` - * :meth:`~pathlib.Path.stat` - * :meth:`~pathlib.Path.symlink_to` - * :meth:`~pathlib.Path.touch` - * :meth:`~pathlib.Path.unlink` - * :meth:`~pathlib.Path.walk` - * :meth:`~pathlib.Path.write_bytes` - * :meth:`~pathlib.Path.write_text` - - Additionally, the following methods return an async iterator yielding - :class:`~.Path` objects: - - * :meth:`~pathlib.Path.glob` - * :meth:`~pathlib.Path.iterdir` - * :meth:`~pathlib.Path.rglob` - """ - - __slots__ = "_path", "__weakref__" - - __weakref__: Any - - def __init__(self, *args: str | PathLike[str]) -> None: - self._path: Final[pathlib.Path] = pathlib.Path(*args) - - def __fspath__(self) -> str: - return self._path.__fspath__() - - def __str__(self) -> str: - return self._path.__str__() - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({self.as_posix()!r})" - - def __bytes__(self) -> bytes: - return self._path.__bytes__() - - def __hash__(self) -> int: - return self._path.__hash__() - - def __eq__(self, other: object) -> bool: - target = other._path if isinstance(other, Path) else other - return self._path.__eq__(target) - - def __lt__(self, other: pathlib.PurePath | Path) -> bool: - target = other._path if isinstance(other, Path) else other - return self._path.__lt__(target) - - def __le__(self, other: pathlib.PurePath | Path) -> bool: - target = other._path if isinstance(other, Path) else other - return self._path.__le__(target) - - def __gt__(self, other: pathlib.PurePath | Path) -> bool: - target = other._path if isinstance(other, Path) else other - return self._path.__gt__(target) - - def __ge__(self, other: pathlib.PurePath | Path) -> bool: - target = other._path if isinstance(other, Path) else other - return self._path.__ge__(target) - - def __truediv__(self, other: str | PathLike[str]) -> Path: - return Path(self._path / other) - - def __rtruediv__(self, other: str | PathLike[str]) -> Path: - return Path(other) / self - - @property - def parts(self) -> tuple[str, ...]: - return self._path.parts - - @property - def drive(self) -> str: - return self._path.drive - - @property - def root(self) -> str: - return self._path.root - - @property - def anchor(self) -> str: - return self._path.anchor - - @property - def parents(self) -> Sequence[Path]: - return tuple(Path(p) for p in self._path.parents) - - @property - def parent(self) -> Path: - return Path(self._path.parent) - - @property - def name(self) -> str: - return self._path.name - - @property - def suffix(self) -> str: - return self._path.suffix - - @property - def suffixes(self) -> list[str]: - return self._path.suffixes - - @property - def stem(self) -> str: - return self._path.stem - - async def absolute(self) -> Path: - path = await to_thread.run_sync(self._path.absolute) - return Path(path) - - def as_posix(self) -> str: - return self._path.as_posix() - - def as_uri(self) -> str: - return self._path.as_uri() - - if sys.version_info >= (3, 13): - parser: ClassVar[ModuleType] = pathlib.Path.parser - - @classmethod - def from_uri(cls, uri: str) -> Path: - return Path(pathlib.Path.from_uri(uri)) - - def full_match( - self, path_pattern: str, *, case_sensitive: bool | None = None - ) -> bool: - return self._path.full_match(path_pattern, case_sensitive=case_sensitive) - - def match( - self, path_pattern: str, *, case_sensitive: bool | None = None - ) -> bool: - return self._path.match(path_pattern, case_sensitive=case_sensitive) - else: - - def match(self, path_pattern: str) -> bool: - return self._path.match(path_pattern) - - if sys.version_info >= (3, 14): - - @property - def info(self) -> Any: # TODO: add return type annotation when Typeshed gets it - return self._path.info - - async def copy( - self, - target: str | os.PathLike[str], - *, - follow_symlinks: bool = True, - preserve_metadata: bool = False, - ) -> Path: - func = partial( - self._path.copy, - follow_symlinks=follow_symlinks, - preserve_metadata=preserve_metadata, - ) - return Path(await to_thread.run_sync(func, pathlib.Path(target))) - - async def copy_into( - self, - target_dir: str | os.PathLike[str], - *, - follow_symlinks: bool = True, - preserve_metadata: bool = False, - ) -> Path: - func = partial( - self._path.copy_into, - follow_symlinks=follow_symlinks, - preserve_metadata=preserve_metadata, - ) - return Path(await to_thread.run_sync(func, pathlib.Path(target_dir))) - - async def move(self, target: str | os.PathLike[str]) -> Path: - # Upstream does not handle anyio.Path properly as a PathLike - target = pathlib.Path(target) - return Path(await to_thread.run_sync(self._path.move, target)) - - async def move_into( - self, - target_dir: str | os.PathLike[str], - ) -> Path: - return Path(await to_thread.run_sync(self._path.move_into, target_dir)) - - def is_relative_to(self, other: str | PathLike[str]) -> bool: - try: - self.relative_to(other) - return True - except ValueError: - return False - - async def chmod(self, mode: int, *, follow_symlinks: bool = True) -> None: - func = partial(os.chmod, follow_symlinks=follow_symlinks) - return await to_thread.run_sync(func, self._path, mode) - - @classmethod - async def cwd(cls) -> Path: - path = await to_thread.run_sync(pathlib.Path.cwd) - return cls(path) - - async def exists(self) -> bool: - return await to_thread.run_sync(self._path.exists, abandon_on_cancel=True) - - async def expanduser(self) -> Path: - return Path( - await to_thread.run_sync(self._path.expanduser, abandon_on_cancel=True) - ) - - def glob(self, pattern: str) -> AsyncIterator[Path]: - gen = self._path.glob(pattern) - return _PathIterator(gen) - - async def group(self) -> str: - return await to_thread.run_sync(self._path.group, abandon_on_cancel=True) - - async def hardlink_to( - self, target: str | bytes | PathLike[str] | PathLike[bytes] - ) -> None: - if isinstance(target, Path): - target = target._path - - await to_thread.run_sync(os.link, target, self) - - @classmethod - async def home(cls) -> Path: - home_path = await to_thread.run_sync(pathlib.Path.home) - return cls(home_path) - - def is_absolute(self) -> bool: - return self._path.is_absolute() - - async def is_block_device(self) -> bool: - return await to_thread.run_sync( - self._path.is_block_device, abandon_on_cancel=True - ) - - async def is_char_device(self) -> bool: - return await to_thread.run_sync( - self._path.is_char_device, abandon_on_cancel=True - ) - - async def is_dir(self) -> bool: - return await to_thread.run_sync(self._path.is_dir, abandon_on_cancel=True) - - async def is_fifo(self) -> bool: - return await to_thread.run_sync(self._path.is_fifo, abandon_on_cancel=True) - - async def is_file(self) -> bool: - return await to_thread.run_sync(self._path.is_file, abandon_on_cancel=True) - - if sys.version_info >= (3, 12): - - async def is_junction(self) -> bool: - return await to_thread.run_sync(self._path.is_junction) - - async def is_mount(self) -> bool: - return await to_thread.run_sync( - os.path.ismount, self._path, abandon_on_cancel=True - ) - - def is_reserved(self) -> bool: - return self._path.is_reserved() - - async def is_socket(self) -> bool: - return await to_thread.run_sync(self._path.is_socket, abandon_on_cancel=True) - - async def is_symlink(self) -> bool: - return await to_thread.run_sync(self._path.is_symlink, abandon_on_cancel=True) - - async def iterdir(self) -> AsyncIterator[Path]: - gen = ( - self._path.iterdir() - if sys.version_info < (3, 13) - else await to_thread.run_sync(self._path.iterdir, abandon_on_cancel=True) - ) - async for path in _PathIterator(gen): - yield path - - def joinpath(self, *args: str | PathLike[str]) -> Path: - return Path(self._path.joinpath(*args)) - - async def lchmod(self, mode: int) -> None: - await to_thread.run_sync(self._path.lchmod, mode) - - async def lstat(self) -> os.stat_result: - return await to_thread.run_sync(self._path.lstat, abandon_on_cancel=True) - - async def mkdir( - self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False - ) -> None: - await to_thread.run_sync(self._path.mkdir, mode, parents, exist_ok) - - @overload - async def open( - self, - mode: OpenBinaryMode, - buffering: int = ..., - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., - ) -> AsyncFile[bytes]: ... - - @overload - async def open( - self, - mode: OpenTextMode = ..., - buffering: int = ..., - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., - ) -> AsyncFile[str]: ... - - async def open( - self, - mode: str = "r", - buffering: int = -1, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> AsyncFile[Any]: - fp = await to_thread.run_sync( - self._path.open, mode, buffering, encoding, errors, newline - ) - return AsyncFile(fp) - - async def owner(self) -> str: - return await to_thread.run_sync(self._path.owner, abandon_on_cancel=True) - - async def read_bytes(self) -> bytes: - return await to_thread.run_sync(self._path.read_bytes) - - async def read_text( - self, encoding: str | None = None, errors: str | None = None - ) -> str: - return await to_thread.run_sync(self._path.read_text, encoding, errors) - - if sys.version_info >= (3, 12): - - def relative_to( - self, *other: str | PathLike[str], walk_up: bool = False - ) -> Path: - # relative_to() should work with any PathLike but it doesn't - others = [pathlib.Path(other) for other in other] - return Path(self._path.relative_to(*others, walk_up=walk_up)) - - else: - - def relative_to(self, *other: str | PathLike[str]) -> Path: - return Path(self._path.relative_to(*other)) - - async def readlink(self) -> Path: - target = await to_thread.run_sync(os.readlink, self._path) - return Path(target) - - async def rename(self, target: str | pathlib.PurePath | Path) -> Path: - if isinstance(target, Path): - target = target._path - - await to_thread.run_sync(self._path.rename, target) - return Path(target) - - async def replace(self, target: str | pathlib.PurePath | Path) -> Path: - if isinstance(target, Path): - target = target._path - - await to_thread.run_sync(self._path.replace, target) - return Path(target) - - async def resolve(self, strict: bool = False) -> Path: - func = partial(self._path.resolve, strict=strict) - return Path(await to_thread.run_sync(func, abandon_on_cancel=True)) - - def rglob(self, pattern: str) -> AsyncIterator[Path]: - gen = self._path.rglob(pattern) - return _PathIterator(gen) - - async def rmdir(self) -> None: - await to_thread.run_sync(self._path.rmdir) - - async def samefile(self, other_path: str | PathLike[str]) -> bool: - if isinstance(other_path, Path): - other_path = other_path._path - - return await to_thread.run_sync( - self._path.samefile, other_path, abandon_on_cancel=True - ) - - async def stat(self, *, follow_symlinks: bool = True) -> os.stat_result: - func = partial(os.stat, follow_symlinks=follow_symlinks) - return await to_thread.run_sync(func, self._path, abandon_on_cancel=True) - - async def symlink_to( - self, - target: str | bytes | PathLike[str] | PathLike[bytes], - target_is_directory: bool = False, - ) -> None: - if isinstance(target, Path): - target = target._path - - await to_thread.run_sync(self._path.symlink_to, target, target_is_directory) - - async def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None: - await to_thread.run_sync(self._path.touch, mode, exist_ok) - - async def unlink(self, missing_ok: bool = False) -> None: - try: - await to_thread.run_sync(self._path.unlink) - except FileNotFoundError: - if not missing_ok: - raise - - if sys.version_info >= (3, 12): - - async def walk( - self, - top_down: bool = True, - on_error: Callable[[OSError], object] | None = None, - follow_symlinks: bool = False, - ) -> AsyncIterator[tuple[Path, list[str], list[str]]]: - def get_next_value() -> tuple[pathlib.Path, list[str], list[str]] | None: - try: - return next(gen) - except StopIteration: - return None - - gen = self._path.walk(top_down, on_error, follow_symlinks) - while True: - value = await to_thread.run_sync(get_next_value) - if value is None: - return - - root, dirs, paths = value - yield Path(root), dirs, paths - - def with_name(self, name: str) -> Path: - return Path(self._path.with_name(name)) - - def with_stem(self, stem: str) -> Path: - return Path(self._path.with_name(stem + self._path.suffix)) - - def with_suffix(self, suffix: str) -> Path: - return Path(self._path.with_suffix(suffix)) - - def with_segments(self, *pathsegments: str | PathLike[str]) -> Path: - return Path(*pathsegments) - - async def write_bytes(self, data: bytes) -> int: - return await to_thread.run_sync(self._path.write_bytes, data) - - async def write_text( - self, - data: str, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, - ) -> int: - # Path.write_text() does not support the "newline" parameter before Python 3.10 - def sync_write_text() -> int: - with self._path.open( - "w", encoding=encoding, errors=errors, newline=newline - ) as fp: - return fp.write(data) - - return await to_thread.run_sync(sync_write_text) - - -PathLike.register(Path) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_resources.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_resources.py deleted file mode 100644 index b9a5344..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_resources.py +++ /dev/null @@ -1,18 +0,0 @@ -from __future__ import annotations - -from ..abc import AsyncResource -from ._tasks import CancelScope - - -async def aclose_forcefully(resource: AsyncResource) -> None: - """ - Close an asynchronous resource in a cancelled scope. - - Doing this closes the resource without waiting on anything. - - :param resource: the resource to close - - """ - with CancelScope() as scope: - scope.cancel() - await resource.aclose() diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_signals.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_signals.py deleted file mode 100644 index f3451d3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_signals.py +++ /dev/null @@ -1,27 +0,0 @@ -from __future__ import annotations - -from collections.abc import AsyncIterator -from contextlib import AbstractContextManager -from signal import Signals - -from ._eventloop import get_async_backend - - -def open_signal_receiver( - *signals: Signals, -) -> AbstractContextManager[AsyncIterator[Signals]]: - """ - Start receiving operating system signals. - - :param signals: signals to receive (e.g. ``signal.SIGINT``) - :return: an asynchronous context manager for an asynchronous iterator which yields - signal numbers - - .. warning:: Windows does not support signals natively so it is best to avoid - relying on this in cross-platform applications. - - .. warning:: On asyncio, this permanently replaces any previous signal handler for - the given signals, as set via :meth:`~asyncio.loop.add_signal_handler`. - - """ - return get_async_backend().open_signal_receiver(*signals) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_sockets.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_sockets.py deleted file mode 100644 index 9781c60..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_sockets.py +++ /dev/null @@ -1,934 +0,0 @@ -from __future__ import annotations - -import errno -import os -import socket -import ssl -import stat -import sys -from collections.abc import Awaitable -from dataclasses import dataclass -from ipaddress import IPv4Address, IPv6Address, ip_address -from os import PathLike, chmod -from socket import AddressFamily, SocketKind -from typing import TYPE_CHECKING, Any, Literal, cast, overload - -from .. import ConnectionFailed, to_thread -from ..abc import ( - ByteStreamConnectable, - ConnectedUDPSocket, - ConnectedUNIXDatagramSocket, - IPAddressType, - IPSockAddrType, - SocketListener, - SocketStream, - UDPSocket, - UNIXDatagramSocket, - UNIXSocketStream, -) -from ..streams.stapled import MultiListener -from ..streams.tls import TLSConnectable, TLSStream -from ._eventloop import get_async_backend -from ._resources import aclose_forcefully -from ._synchronization import Event -from ._tasks import create_task_group, move_on_after - -if TYPE_CHECKING: - from _typeshed import FileDescriptorLike -else: - FileDescriptorLike = object - -if sys.version_info < (3, 11): - from exceptiongroup import ExceptionGroup - -if sys.version_info >= (3, 12): - from typing import override -else: - from typing_extensions import override - -if sys.version_info < (3, 13): - from typing_extensions import deprecated -else: - from warnings import deprecated - -IPPROTO_IPV6 = getattr(socket, "IPPROTO_IPV6", 41) # https://bugs.python.org/issue29515 - -AnyIPAddressFamily = Literal[ - AddressFamily.AF_UNSPEC, AddressFamily.AF_INET, AddressFamily.AF_INET6 -] -IPAddressFamily = Literal[AddressFamily.AF_INET, AddressFamily.AF_INET6] - - -# tls_hostname given -@overload -async def connect_tcp( - remote_host: IPAddressType, - remote_port: int, - *, - local_host: IPAddressType | None = ..., - ssl_context: ssl.SSLContext | None = ..., - tls_standard_compatible: bool = ..., - tls_hostname: str, - happy_eyeballs_delay: float = ..., -) -> TLSStream: ... - - -# ssl_context given -@overload -async def connect_tcp( - remote_host: IPAddressType, - remote_port: int, - *, - local_host: IPAddressType | None = ..., - ssl_context: ssl.SSLContext, - tls_standard_compatible: bool = ..., - tls_hostname: str | None = ..., - happy_eyeballs_delay: float = ..., -) -> TLSStream: ... - - -# tls=True -@overload -async def connect_tcp( - remote_host: IPAddressType, - remote_port: int, - *, - local_host: IPAddressType | None = ..., - tls: Literal[True], - ssl_context: ssl.SSLContext | None = ..., - tls_standard_compatible: bool = ..., - tls_hostname: str | None = ..., - happy_eyeballs_delay: float = ..., -) -> TLSStream: ... - - -# tls=False -@overload -async def connect_tcp( - remote_host: IPAddressType, - remote_port: int, - *, - local_host: IPAddressType | None = ..., - tls: Literal[False], - ssl_context: ssl.SSLContext | None = ..., - tls_standard_compatible: bool = ..., - tls_hostname: str | None = ..., - happy_eyeballs_delay: float = ..., -) -> SocketStream: ... - - -# No TLS arguments -@overload -async def connect_tcp( - remote_host: IPAddressType, - remote_port: int, - *, - local_host: IPAddressType | None = ..., - happy_eyeballs_delay: float = ..., -) -> SocketStream: ... - - -async def connect_tcp( - remote_host: IPAddressType, - remote_port: int, - *, - local_host: IPAddressType | None = None, - tls: bool = False, - ssl_context: ssl.SSLContext | None = None, - tls_standard_compatible: bool = True, - tls_hostname: str | None = None, - happy_eyeballs_delay: float = 0.25, -) -> SocketStream | TLSStream: - """ - Connect to a host using the TCP protocol. - - This function implements the stateless version of the Happy Eyeballs algorithm (RFC - 6555). If ``remote_host`` is a host name that resolves to multiple IP addresses, - each one is tried until one connection attempt succeeds. If the first attempt does - not connected within 250 milliseconds, a second attempt is started using the next - address in the list, and so on. On IPv6 enabled systems, an IPv6 address (if - available) is tried first. - - When the connection has been established, a TLS handshake will be done if either - ``ssl_context`` or ``tls_hostname`` is not ``None``, or if ``tls`` is ``True``. - - :param remote_host: the IP address or host name to connect to - :param remote_port: port on the target host to connect to - :param local_host: the interface address or name to bind the socket to before - connecting - :param tls: ``True`` to do a TLS handshake with the connected stream and return a - :class:`~anyio.streams.tls.TLSStream` instead - :param ssl_context: the SSL context object to use (if omitted, a default context is - created) - :param tls_standard_compatible: If ``True``, performs the TLS shutdown handshake - before closing the stream and requires that the server does this as well. - Otherwise, :exc:`~ssl.SSLEOFError` may be raised during reads from the stream. - Some protocols, such as HTTP, require this option to be ``False``. - See :meth:`~ssl.SSLContext.wrap_socket` for details. - :param tls_hostname: host name to check the server certificate against (defaults to - the value of ``remote_host``) - :param happy_eyeballs_delay: delay (in seconds) before starting the next connection - attempt - :return: a socket stream object if no TLS handshake was done, otherwise a TLS stream - :raises ConnectionFailed: if the connection fails - - """ - # Placed here due to https://github.com/python/mypy/issues/7057 - connected_stream: SocketStream | None = None - - async def try_connect(remote_host: str, event: Event) -> None: - nonlocal connected_stream - try: - stream = await asynclib.connect_tcp(remote_host, remote_port, local_address) - except OSError as exc: - oserrors.append(exc) - return - else: - if connected_stream is None: - connected_stream = stream - tg.cancel_scope.cancel() - else: - await stream.aclose() - finally: - event.set() - - asynclib = get_async_backend() - local_address: IPSockAddrType | None = None - family = socket.AF_UNSPEC - if local_host: - gai_res = await getaddrinfo(str(local_host), None) - family, *_, local_address = gai_res[0] - - target_host = str(remote_host) - try: - addr_obj = ip_address(remote_host) - except ValueError: - addr_obj = None - - if addr_obj is not None: - if isinstance(addr_obj, IPv6Address): - target_addrs = [(socket.AF_INET6, addr_obj.compressed)] - else: - target_addrs = [(socket.AF_INET, addr_obj.compressed)] - else: - # getaddrinfo() will raise an exception if name resolution fails - gai_res = await getaddrinfo( - target_host, remote_port, family=family, type=socket.SOCK_STREAM - ) - - # Organize the list so that the first address is an IPv6 address (if available) - # and the second one is an IPv4 addresses. The rest can be in whatever order. - v6_found = v4_found = False - target_addrs = [] - for af, *_, sa in gai_res: - if af == socket.AF_INET6 and not v6_found: - v6_found = True - target_addrs.insert(0, (af, sa[0])) - elif af == socket.AF_INET and not v4_found and v6_found: - v4_found = True - target_addrs.insert(1, (af, sa[0])) - else: - target_addrs.append((af, sa[0])) - - oserrors: list[OSError] = [] - try: - async with create_task_group() as tg: - for _af, addr in target_addrs: - event = Event() - tg.start_soon(try_connect, addr, event) - with move_on_after(happy_eyeballs_delay): - await event.wait() - - if connected_stream is None: - cause = ( - oserrors[0] - if len(oserrors) == 1 - else ExceptionGroup("multiple connection attempts failed", oserrors) - ) - raise OSError("All connection attempts failed") from cause - finally: - oserrors.clear() - - if tls or tls_hostname or ssl_context: - try: - return await TLSStream.wrap( - connected_stream, - server_side=False, - hostname=tls_hostname or str(remote_host), - ssl_context=ssl_context, - standard_compatible=tls_standard_compatible, - ) - except BaseException: - await aclose_forcefully(connected_stream) - raise - - return connected_stream - - -async def connect_unix(path: str | bytes | PathLike[Any]) -> UNIXSocketStream: - """ - Connect to the given UNIX socket. - - Not available on Windows. - - :param path: path to the socket - :return: a socket stream object - :raises ConnectionFailed: if the connection fails - - """ - path = os.fspath(path) - return await get_async_backend().connect_unix(path) - - -async def create_tcp_listener( - *, - local_host: IPAddressType | None = None, - local_port: int = 0, - family: AnyIPAddressFamily = socket.AddressFamily.AF_UNSPEC, - backlog: int = 65536, - reuse_port: bool = False, -) -> MultiListener[SocketStream]: - """ - Create a TCP socket listener. - - :param local_port: port number to listen on - :param local_host: IP address of the interface to listen on. If omitted, listen on - all IPv4 and IPv6 interfaces. To listen on all interfaces on a specific address - family, use ``0.0.0.0`` for IPv4 or ``::`` for IPv6. - :param family: address family (used if ``local_host`` was omitted) - :param backlog: maximum number of queued incoming connections (up to a maximum of - 2**16, or 65536) - :param reuse_port: ``True`` to allow multiple sockets to bind to the same - address/port (not supported on Windows) - :return: a multi-listener object containing one or more socket listeners - - """ - asynclib = get_async_backend() - backlog = min(backlog, 65536) - local_host = str(local_host) if local_host is not None else None - gai_res = await getaddrinfo( - local_host, - local_port, - family=family, - type=socket.SocketKind.SOCK_STREAM if sys.platform == "win32" else 0, - flags=socket.AI_PASSIVE | socket.AI_ADDRCONFIG, - ) - listeners: list[SocketListener] = [] - try: - # The set() is here to work around a glibc bug: - # https://sourceware.org/bugzilla/show_bug.cgi?id=14969 - sockaddr: tuple[str, int] | tuple[str, int, int, int] - for fam, kind, *_, sockaddr in sorted(set(gai_res)): - # Workaround for an uvloop bug where we don't get the correct scope ID for - # IPv6 link-local addresses when passing type=socket.SOCK_STREAM to - # getaddrinfo(): https://github.com/MagicStack/uvloop/issues/539 - if sys.platform != "win32" and kind is not SocketKind.SOCK_STREAM: - continue - - raw_socket = socket.socket(fam) - raw_socket.setblocking(False) - - # For Windows, enable exclusive address use. For others, enable address - # reuse. - if sys.platform == "win32": - raw_socket.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1) - else: - raw_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - - if reuse_port: - raw_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) - - # If only IPv6 was requested, disable dual stack operation - if fam == socket.AF_INET6: - raw_socket.setsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY, 1) - - # Workaround for #554 - if "%" in sockaddr[0]: - addr, scope_id = sockaddr[0].split("%", 1) - sockaddr = (addr, sockaddr[1], 0, int(scope_id)) - - raw_socket.bind(sockaddr) - raw_socket.listen(backlog) - listener = asynclib.create_tcp_listener(raw_socket) - listeners.append(listener) - except BaseException: - for listener in listeners: - await listener.aclose() - - raise - - return MultiListener(listeners) - - -async def create_unix_listener( - path: str | bytes | PathLike[Any], - *, - mode: int | None = None, - backlog: int = 65536, -) -> SocketListener: - """ - Create a UNIX socket listener. - - Not available on Windows. - - :param path: path of the socket - :param mode: permissions to set on the socket - :param backlog: maximum number of queued incoming connections (up to a maximum of - 2**16, or 65536) - :return: a listener object - - .. versionchanged:: 3.0 - If a socket already exists on the file system in the given path, it will be - removed first. - - """ - backlog = min(backlog, 65536) - raw_socket = await setup_unix_local_socket(path, mode, socket.SOCK_STREAM) - try: - raw_socket.listen(backlog) - return get_async_backend().create_unix_listener(raw_socket) - except BaseException: - raw_socket.close() - raise - - -async def create_udp_socket( - family: AnyIPAddressFamily = AddressFamily.AF_UNSPEC, - *, - local_host: IPAddressType | None = None, - local_port: int = 0, - reuse_port: bool = False, -) -> UDPSocket: - """ - Create a UDP socket. - - If ``port`` has been given, the socket will be bound to this port on the local - machine, making this socket suitable for providing UDP based services. - - :param family: address family (``AF_INET`` or ``AF_INET6``) – automatically - determined from ``local_host`` if omitted - :param local_host: IP address or host name of the local interface to bind to - :param local_port: local port to bind to - :param reuse_port: ``True`` to allow multiple sockets to bind to the same - address/port (not supported on Windows) - :return: a UDP socket - - """ - if family is AddressFamily.AF_UNSPEC and not local_host: - raise ValueError('Either "family" or "local_host" must be given') - - if local_host: - gai_res = await getaddrinfo( - str(local_host), - local_port, - family=family, - type=socket.SOCK_DGRAM, - flags=socket.AI_PASSIVE | socket.AI_ADDRCONFIG, - ) - family = cast(AnyIPAddressFamily, gai_res[0][0]) - local_address = gai_res[0][-1] - elif family is AddressFamily.AF_INET6: - local_address = ("::", 0) - else: - local_address = ("0.0.0.0", 0) - - sock = await get_async_backend().create_udp_socket( - family, local_address, None, reuse_port - ) - return cast(UDPSocket, sock) - - -async def create_connected_udp_socket( - remote_host: IPAddressType, - remote_port: int, - *, - family: AnyIPAddressFamily = AddressFamily.AF_UNSPEC, - local_host: IPAddressType | None = None, - local_port: int = 0, - reuse_port: bool = False, -) -> ConnectedUDPSocket: - """ - Create a connected UDP socket. - - Connected UDP sockets can only communicate with the specified remote host/port, an - any packets sent from other sources are dropped. - - :param remote_host: remote host to set as the default target - :param remote_port: port on the remote host to set as the default target - :param family: address family (``AF_INET`` or ``AF_INET6``) – automatically - determined from ``local_host`` or ``remote_host`` if omitted - :param local_host: IP address or host name of the local interface to bind to - :param local_port: local port to bind to - :param reuse_port: ``True`` to allow multiple sockets to bind to the same - address/port (not supported on Windows) - :return: a connected UDP socket - - """ - local_address = None - if local_host: - gai_res = await getaddrinfo( - str(local_host), - local_port, - family=family, - type=socket.SOCK_DGRAM, - flags=socket.AI_PASSIVE | socket.AI_ADDRCONFIG, - ) - family = cast(AnyIPAddressFamily, gai_res[0][0]) - local_address = gai_res[0][-1] - - gai_res = await getaddrinfo( - str(remote_host), remote_port, family=family, type=socket.SOCK_DGRAM - ) - family = cast(AnyIPAddressFamily, gai_res[0][0]) - remote_address = gai_res[0][-1] - - sock = await get_async_backend().create_udp_socket( - family, local_address, remote_address, reuse_port - ) - return cast(ConnectedUDPSocket, sock) - - -async def create_unix_datagram_socket( - *, - local_path: None | str | bytes | PathLike[Any] = None, - local_mode: int | None = None, -) -> UNIXDatagramSocket: - """ - Create a UNIX datagram socket. - - Not available on Windows. - - If ``local_path`` has been given, the socket will be bound to this path, making this - socket suitable for receiving datagrams from other processes. Other processes can - send datagrams to this socket only if ``local_path`` is set. - - If a socket already exists on the file system in the ``local_path``, it will be - removed first. - - :param local_path: the path on which to bind to - :param local_mode: permissions to set on the local socket - :return: a UNIX datagram socket - - """ - raw_socket = await setup_unix_local_socket( - local_path, local_mode, socket.SOCK_DGRAM - ) - return await get_async_backend().create_unix_datagram_socket(raw_socket, None) - - -async def create_connected_unix_datagram_socket( - remote_path: str | bytes | PathLike[Any], - *, - local_path: None | str | bytes | PathLike[Any] = None, - local_mode: int | None = None, -) -> ConnectedUNIXDatagramSocket: - """ - Create a connected UNIX datagram socket. - - Connected datagram sockets can only communicate with the specified remote path. - - If ``local_path`` has been given, the socket will be bound to this path, making - this socket suitable for receiving datagrams from other processes. Other processes - can send datagrams to this socket only if ``local_path`` is set. - - If a socket already exists on the file system in the ``local_path``, it will be - removed first. - - :param remote_path: the path to set as the default target - :param local_path: the path on which to bind to - :param local_mode: permissions to set on the local socket - :return: a connected UNIX datagram socket - - """ - remote_path = os.fspath(remote_path) - raw_socket = await setup_unix_local_socket( - local_path, local_mode, socket.SOCK_DGRAM - ) - return await get_async_backend().create_unix_datagram_socket( - raw_socket, remote_path - ) - - -async def getaddrinfo( - host: bytes | str | None, - port: str | int | None, - *, - family: int | AddressFamily = 0, - type: int | SocketKind = 0, - proto: int = 0, - flags: int = 0, -) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int]]]: - """ - Look up a numeric IP address given a host name. - - Internationalized domain names are translated according to the (non-transitional) - IDNA 2008 standard. - - .. note:: 4-tuple IPv6 socket addresses are automatically converted to 2-tuples of - (host, port), unlike what :func:`socket.getaddrinfo` does. - - :param host: host name - :param port: port number - :param family: socket family (`'AF_INET``, ...) - :param type: socket type (``SOCK_STREAM``, ...) - :param proto: protocol number - :param flags: flags to pass to upstream ``getaddrinfo()`` - :return: list of tuples containing (family, type, proto, canonname, sockaddr) - - .. seealso:: :func:`socket.getaddrinfo` - - """ - # Handle unicode hostnames - if isinstance(host, str): - try: - encoded_host: bytes | None = host.encode("ascii") - except UnicodeEncodeError: - import idna - - encoded_host = idna.encode(host, uts46=True) - else: - encoded_host = host - - gai_res = await get_async_backend().getaddrinfo( - encoded_host, port, family=family, type=type, proto=proto, flags=flags - ) - return [ - (family, type, proto, canonname, convert_ipv6_sockaddr(sockaddr)) - for family, type, proto, canonname, sockaddr in gai_res - # filter out IPv6 results when IPv6 is disabled - if not isinstance(sockaddr[0], int) - ] - - -def getnameinfo(sockaddr: IPSockAddrType, flags: int = 0) -> Awaitable[tuple[str, str]]: - """ - Look up the host name of an IP address. - - :param sockaddr: socket address (e.g. (ipaddress, port) for IPv4) - :param flags: flags to pass to upstream ``getnameinfo()`` - :return: a tuple of (host name, service name) - - .. seealso:: :func:`socket.getnameinfo` - - """ - return get_async_backend().getnameinfo(sockaddr, flags) - - -@deprecated("This function is deprecated; use `wait_readable` instead") -def wait_socket_readable(sock: socket.socket) -> Awaitable[None]: - """ - .. deprecated:: 4.7.0 - Use :func:`wait_readable` instead. - - Wait until the given socket has data to be read. - - .. warning:: Only use this on raw sockets that have not been wrapped by any higher - level constructs like socket streams! - - :param sock: a socket object - :raises ~anyio.ClosedResourceError: if the socket was closed while waiting for the - socket to become readable - :raises ~anyio.BusyResourceError: if another task is already waiting for the socket - to become readable - - """ - return get_async_backend().wait_readable(sock.fileno()) - - -@deprecated("This function is deprecated; use `wait_writable` instead") -def wait_socket_writable(sock: socket.socket) -> Awaitable[None]: - """ - .. deprecated:: 4.7.0 - Use :func:`wait_writable` instead. - - Wait until the given socket can be written to. - - This does **NOT** work on Windows when using the asyncio backend with a proactor - event loop (default on py3.8+). - - .. warning:: Only use this on raw sockets that have not been wrapped by any higher - level constructs like socket streams! - - :param sock: a socket object - :raises ~anyio.ClosedResourceError: if the socket was closed while waiting for the - socket to become writable - :raises ~anyio.BusyResourceError: if another task is already waiting for the socket - to become writable - - """ - return get_async_backend().wait_writable(sock.fileno()) - - -def wait_readable(obj: FileDescriptorLike) -> Awaitable[None]: - """ - Wait until the given object has data to be read. - - On Unix systems, ``obj`` must either be an integer file descriptor, or else an - object with a ``.fileno()`` method which returns an integer file descriptor. Any - kind of file descriptor can be passed, though the exact semantics will depend on - your kernel. For example, this probably won't do anything useful for on-disk files. - - On Windows systems, ``obj`` must either be an integer ``SOCKET`` handle, or else an - object with a ``.fileno()`` method which returns an integer ``SOCKET`` handle. File - descriptors aren't supported, and neither are handles that refer to anything besides - a ``SOCKET``. - - On backends where this functionality is not natively provided (asyncio - ``ProactorEventLoop`` on Windows), it is provided using a separate selector thread - which is set to shut down when the interpreter shuts down. - - .. warning:: Don't use this on raw sockets that have been wrapped by any higher - level constructs like socket streams! - - :param obj: an object with a ``.fileno()`` method or an integer handle - :raises ~anyio.ClosedResourceError: if the object was closed while waiting for the - object to become readable - :raises ~anyio.BusyResourceError: if another task is already waiting for the object - to become readable - - """ - return get_async_backend().wait_readable(obj) - - -def wait_writable(obj: FileDescriptorLike) -> Awaitable[None]: - """ - Wait until the given object can be written to. - - :param obj: an object with a ``.fileno()`` method or an integer handle - :raises ~anyio.ClosedResourceError: if the object was closed while waiting for the - object to become writable - :raises ~anyio.BusyResourceError: if another task is already waiting for the object - to become writable - - .. seealso:: See the documentation of :func:`wait_readable` for the definition of - ``obj`` and notes on backend compatibility. - - .. warning:: Don't use this on raw sockets that have been wrapped by any higher - level constructs like socket streams! - - """ - return get_async_backend().wait_writable(obj) - - -def notify_closing(obj: FileDescriptorLike) -> None: - """ - Call this before closing a file descriptor (on Unix) or socket (on - Windows). This will cause any `wait_readable` or `wait_writable` - calls on the given object to immediately wake up and raise - `~anyio.ClosedResourceError`. - - This doesn't actually close the object – you still have to do that - yourself afterwards. Also, you want to be careful to make sure no - new tasks start waiting on the object in between when you call this - and when it's actually closed. So to close something properly, you - usually want to do these steps in order: - - 1. Explicitly mark the object as closed, so that any new attempts - to use it will abort before they start. - 2. Call `notify_closing` to wake up any already-existing users. - 3. Actually close the object. - - It's also possible to do them in a different order if that's more - convenient, *but only if* you make sure not to have any checkpoints in - between the steps. This way they all happen in a single atomic - step, so other tasks won't be able to tell what order they happened - in anyway. - - :param obj: an object with a ``.fileno()`` method or an integer handle - - """ - get_async_backend().notify_closing(obj) - - -# -# Private API -# - - -def convert_ipv6_sockaddr( - sockaddr: tuple[str, int, int, int] | tuple[str, int], -) -> tuple[str, int]: - """ - Convert a 4-tuple IPv6 socket address to a 2-tuple (address, port) format. - - If the scope ID is nonzero, it is added to the address, separated with ``%``. - Otherwise the flow id and scope id are simply cut off from the tuple. - Any other kinds of socket addresses are returned as-is. - - :param sockaddr: the result of :meth:`~socket.socket.getsockname` - :return: the converted socket address - - """ - # This is more complicated than it should be because of MyPy - if isinstance(sockaddr, tuple) and len(sockaddr) == 4: - host, port, flowinfo, scope_id = sockaddr - if scope_id: - # PyPy (as of v7.3.11) leaves the interface name in the result, so - # we discard it and only get the scope ID from the end - # (https://foss.heptapod.net/pypy/pypy/-/issues/3938) - host = host.split("%")[0] - - # Add scope_id to the address - return f"{host}%{scope_id}", port - else: - return host, port - else: - return sockaddr - - -async def setup_unix_local_socket( - path: None | str | bytes | PathLike[Any], - mode: int | None, - socktype: int, -) -> socket.socket: - """ - Create a UNIX local socket object, deleting the socket at the given path if it - exists. - - Not available on Windows. - - :param path: path of the socket - :param mode: permissions to set on the socket - :param socktype: socket.SOCK_STREAM or socket.SOCK_DGRAM - - """ - path_str: str | None - if path is not None: - path_str = os.fsdecode(path) - - # Linux abstract namespace sockets aren't backed by a concrete file so skip stat call - if not path_str.startswith("\0"): - # Copied from pathlib... - try: - stat_result = os.stat(path) - except OSError as e: - if e.errno not in ( - errno.ENOENT, - errno.ENOTDIR, - errno.EBADF, - errno.ELOOP, - ): - raise - else: - if stat.S_ISSOCK(stat_result.st_mode): - os.unlink(path) - else: - path_str = None - - raw_socket = socket.socket(socket.AF_UNIX, socktype) - raw_socket.setblocking(False) - - if path_str is not None: - try: - await to_thread.run_sync(raw_socket.bind, path_str, abandon_on_cancel=True) - if mode is not None: - await to_thread.run_sync(chmod, path_str, mode, abandon_on_cancel=True) - except BaseException: - raw_socket.close() - raise - - return raw_socket - - -@dataclass -class TCPConnectable(ByteStreamConnectable): - """ - Connects to a TCP server at the given host and port. - - :param host: host name or IP address of the server - :param port: TCP port number of the server - """ - - host: str | IPv4Address | IPv6Address - port: int - - def __post_init__(self) -> None: - if self.port < 1 or self.port > 65535: - raise ValueError("TCP port number out of range") - - @override - async def connect(self) -> SocketStream: - try: - return await connect_tcp(self.host, self.port) - except OSError as exc: - raise ConnectionFailed( - f"error connecting to {self.host}:{self.port}: {exc}" - ) from exc - - -@dataclass -class UNIXConnectable(ByteStreamConnectable): - """ - Connects to a UNIX domain socket at the given path. - - :param path: the file system path of the socket - """ - - path: str | bytes | PathLike[str] | PathLike[bytes] - - @override - async def connect(self) -> UNIXSocketStream: - try: - return await connect_unix(self.path) - except OSError as exc: - raise ConnectionFailed(f"error connecting to {self.path!r}: {exc}") from exc - - -def as_connectable( - remote: ByteStreamConnectable - | tuple[str | IPv4Address | IPv6Address, int] - | str - | bytes - | PathLike[str], - /, - *, - tls: bool = False, - ssl_context: ssl.SSLContext | None = None, - tls_hostname: str | None = None, - tls_standard_compatible: bool = True, -) -> ByteStreamConnectable: - """ - Return a byte stream connectable from the given object. - - If a bytestream connectable is given, it is returned unchanged. - If a tuple of (host, port) is given, a TCP connectable is returned. - If a string or bytes path is given, a UNIX connectable is returned. - - If ``tls=True``, the connectable will be wrapped in a - :class:`~.streams.tls.TLSConnectable`. - - :param remote: a connectable, a tuple of (host, port) or a path to a UNIX socket - :param tls: if ``True``, wrap the plaintext connectable in a - :class:`~.streams.tls.TLSConnectable`, using the provided TLS settings) - :param ssl_context: if ``tls=True``, the SSLContext object to use (if not provided, - a secure default will be created) - :param tls_hostname: if ``tls=True``, host name of the server to use for checking - the server certificate (defaults to the host portion of the address for TCP - connectables) - :param tls_standard_compatible: if ``False`` and ``tls=True``, makes the TLS stream - skip the closing handshake when closing the connection, so it won't raise an - exception if the server does the same - - """ - connectable: TCPConnectable | UNIXConnectable | TLSConnectable - if isinstance(remote, ByteStreamConnectable): - return remote - elif isinstance(remote, tuple) and len(remote) == 2: - connectable = TCPConnectable(*remote) - elif isinstance(remote, (str, bytes, PathLike)): - connectable = UNIXConnectable(remote) - else: - raise TypeError(f"cannot convert {remote!r} to a connectable") - - if tls: - if not tls_hostname and isinstance(connectable, TCPConnectable): - tls_hostname = str(connectable.host) - - connectable = TLSConnectable( - connectable, - ssl_context=ssl_context, - hostname=tls_hostname, - standard_compatible=tls_standard_compatible, - ) - - return connectable diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_streams.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_streams.py deleted file mode 100644 index 6a9814e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_streams.py +++ /dev/null @@ -1,52 +0,0 @@ -from __future__ import annotations - -import math -from typing import TypeVar -from warnings import warn - -from ..streams.memory import ( - MemoryObjectReceiveStream, - MemoryObjectSendStream, - MemoryObjectStreamState, -) - -T_Item = TypeVar("T_Item") - - -class create_memory_object_stream( - tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]], -): - """ - Create a memory object stream. - - The stream's item type can be annotated like - :func:`create_memory_object_stream[T_Item]`. - - :param max_buffer_size: number of items held in the buffer until ``send()`` starts - blocking - :param item_type: old way of marking the streams with the right generic type for - static typing (does nothing on AnyIO 4) - - .. deprecated:: 4.0 - Use ``create_memory_object_stream[YourItemType](...)`` instead. - :return: a tuple of (send stream, receive stream) - - """ - - def __new__( # type: ignore[misc] - cls, max_buffer_size: float = 0, item_type: object = None - ) -> tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]]: - if max_buffer_size != math.inf and not isinstance(max_buffer_size, int): - raise ValueError("max_buffer_size must be either an integer or math.inf") - if max_buffer_size < 0: - raise ValueError("max_buffer_size cannot be negative") - if item_type is not None: - warn( - "The item_type argument has been deprecated in AnyIO 4.0. " - "Use create_memory_object_stream[YourItemType](...) instead.", - DeprecationWarning, - stacklevel=2, - ) - - state = MemoryObjectStreamState[T_Item](max_buffer_size) - return (MemoryObjectSendStream(state), MemoryObjectReceiveStream(state)) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_subprocesses.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_subprocesses.py deleted file mode 100644 index 36d9b30..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_subprocesses.py +++ /dev/null @@ -1,202 +0,0 @@ -from __future__ import annotations - -import sys -from collections.abc import AsyncIterable, Iterable, Mapping, Sequence -from io import BytesIO -from os import PathLike -from subprocess import PIPE, CalledProcessError, CompletedProcess -from typing import IO, Any, Union, cast - -from ..abc import Process -from ._eventloop import get_async_backend -from ._tasks import create_task_group - -if sys.version_info >= (3, 10): - from typing import TypeAlias -else: - from typing_extensions import TypeAlias - -StrOrBytesPath: TypeAlias = Union[str, bytes, "PathLike[str]", "PathLike[bytes]"] - - -async def run_process( - command: StrOrBytesPath | Sequence[StrOrBytesPath], - *, - input: bytes | None = None, - stdin: int | IO[Any] | None = None, - stdout: int | IO[Any] | None = PIPE, - stderr: int | IO[Any] | None = PIPE, - check: bool = True, - cwd: StrOrBytesPath | None = None, - env: Mapping[str, str] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - start_new_session: bool = False, - pass_fds: Sequence[int] = (), - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, -) -> CompletedProcess[bytes]: - """ - Run an external command in a subprocess and wait until it completes. - - .. seealso:: :func:`subprocess.run` - - :param command: either a string to pass to the shell, or an iterable of strings - containing the executable name or path and its arguments - :param input: bytes passed to the standard input of the subprocess - :param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, - a file-like object, or `None`; ``input`` overrides this - :param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, - a file-like object, or `None` - :param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, - :data:`subprocess.STDOUT`, a file-like object, or `None` - :param check: if ``True``, raise :exc:`~subprocess.CalledProcessError` if the - process terminates with a return code other than 0 - :param cwd: If not ``None``, change the working directory to this before running the - command - :param env: if not ``None``, this mapping replaces the inherited environment - variables from the parent process - :param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used - to specify process startup parameters (Windows only) - :param creationflags: flags that can be used to control the creation of the - subprocess (see :class:`subprocess.Popen` for the specifics) - :param start_new_session: if ``true`` the setsid() system call will be made in the - child process prior to the execution of the subprocess. (POSIX only) - :param pass_fds: sequence of file descriptors to keep open between the parent and - child processes. (POSIX only) - :param user: effective user to run the process as (Python >= 3.9, POSIX only) - :param group: effective group to run the process as (Python >= 3.9, POSIX only) - :param extra_groups: supplementary groups to set in the subprocess (Python >= 3.9, - POSIX only) - :param umask: if not negative, this umask is applied in the child process before - running the given command (Python >= 3.9, POSIX only) - :return: an object representing the completed process - :raises ~subprocess.CalledProcessError: if ``check`` is ``True`` and the process - exits with a nonzero return code - - """ - - async def drain_stream(stream: AsyncIterable[bytes], index: int) -> None: - buffer = BytesIO() - async for chunk in stream: - buffer.write(chunk) - - stream_contents[index] = buffer.getvalue() - - if stdin is not None and input is not None: - raise ValueError("only one of stdin and input is allowed") - - async with await open_process( - command, - stdin=PIPE if input else stdin, - stdout=stdout, - stderr=stderr, - cwd=cwd, - env=env, - startupinfo=startupinfo, - creationflags=creationflags, - start_new_session=start_new_session, - pass_fds=pass_fds, - user=user, - group=group, - extra_groups=extra_groups, - umask=umask, - ) as process: - stream_contents: list[bytes | None] = [None, None] - async with create_task_group() as tg: - if process.stdout: - tg.start_soon(drain_stream, process.stdout, 0) - - if process.stderr: - tg.start_soon(drain_stream, process.stderr, 1) - - if process.stdin and input: - await process.stdin.send(input) - await process.stdin.aclose() - - await process.wait() - - output, errors = stream_contents - if check and process.returncode != 0: - raise CalledProcessError(cast(int, process.returncode), command, output, errors) - - return CompletedProcess(command, cast(int, process.returncode), output, errors) - - -async def open_process( - command: StrOrBytesPath | Sequence[StrOrBytesPath], - *, - stdin: int | IO[Any] | None = PIPE, - stdout: int | IO[Any] | None = PIPE, - stderr: int | IO[Any] | None = PIPE, - cwd: StrOrBytesPath | None = None, - env: Mapping[str, str] | None = None, - startupinfo: Any = None, - creationflags: int = 0, - start_new_session: bool = False, - pass_fds: Sequence[int] = (), - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, -) -> Process: - """ - Start an external command in a subprocess. - - .. seealso:: :class:`subprocess.Popen` - - :param command: either a string to pass to the shell, or an iterable of strings - containing the executable name or path and its arguments - :param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, a - file-like object, or ``None`` - :param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, - a file-like object, or ``None`` - :param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, - :data:`subprocess.STDOUT`, a file-like object, or ``None`` - :param cwd: If not ``None``, the working directory is changed before executing - :param env: If env is not ``None``, it must be a mapping that defines the - environment variables for the new process - :param creationflags: flags that can be used to control the creation of the - subprocess (see :class:`subprocess.Popen` for the specifics) - :param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used - to specify process startup parameters (Windows only) - :param start_new_session: if ``true`` the setsid() system call will be made in the - child process prior to the execution of the subprocess. (POSIX only) - :param pass_fds: sequence of file descriptors to keep open between the parent and - child processes. (POSIX only) - :param user: effective user to run the process as (POSIX only) - :param group: effective group to run the process as (POSIX only) - :param extra_groups: supplementary groups to set in the subprocess (POSIX only) - :param umask: if not negative, this umask is applied in the child process before - running the given command (POSIX only) - :return: an asynchronous process object - - """ - kwargs: dict[str, Any] = {} - if user is not None: - kwargs["user"] = user - - if group is not None: - kwargs["group"] = group - - if extra_groups is not None: - kwargs["extra_groups"] = group - - if umask >= 0: - kwargs["umask"] = umask - - return await get_async_backend().open_process( - command, - stdin=stdin, - stdout=stdout, - stderr=stderr, - cwd=cwd, - env=env, - startupinfo=startupinfo, - creationflags=creationflags, - start_new_session=start_new_session, - pass_fds=pass_fds, - **kwargs, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_synchronization.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_synchronization.py deleted file mode 100644 index caa6efc..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_synchronization.py +++ /dev/null @@ -1,732 +0,0 @@ -from __future__ import annotations - -import math -from collections import deque -from dataclasses import dataclass -from types import TracebackType - -from sniffio import AsyncLibraryNotFoundError - -from ..lowlevel import checkpoint -from ._eventloop import get_async_backend -from ._exceptions import BusyResourceError -from ._tasks import CancelScope -from ._testing import TaskInfo, get_current_task - - -@dataclass(frozen=True) -class EventStatistics: - """ - :ivar int tasks_waiting: number of tasks waiting on :meth:`~.Event.wait` - """ - - tasks_waiting: int - - -@dataclass(frozen=True) -class CapacityLimiterStatistics: - """ - :ivar int borrowed_tokens: number of tokens currently borrowed by tasks - :ivar float total_tokens: total number of available tokens - :ivar tuple borrowers: tasks or other objects currently holding tokens borrowed from - this limiter - :ivar int tasks_waiting: number of tasks waiting on - :meth:`~.CapacityLimiter.acquire` or - :meth:`~.CapacityLimiter.acquire_on_behalf_of` - """ - - borrowed_tokens: int - total_tokens: float - borrowers: tuple[object, ...] - tasks_waiting: int - - -@dataclass(frozen=True) -class LockStatistics: - """ - :ivar bool locked: flag indicating if this lock is locked or not - :ivar ~anyio.TaskInfo owner: task currently holding the lock (or ``None`` if the - lock is not held by any task) - :ivar int tasks_waiting: number of tasks waiting on :meth:`~.Lock.acquire` - """ - - locked: bool - owner: TaskInfo | None - tasks_waiting: int - - -@dataclass(frozen=True) -class ConditionStatistics: - """ - :ivar int tasks_waiting: number of tasks blocked on :meth:`~.Condition.wait` - :ivar ~anyio.LockStatistics lock_statistics: statistics of the underlying - :class:`~.Lock` - """ - - tasks_waiting: int - lock_statistics: LockStatistics - - -@dataclass(frozen=True) -class SemaphoreStatistics: - """ - :ivar int tasks_waiting: number of tasks waiting on :meth:`~.Semaphore.acquire` - - """ - - tasks_waiting: int - - -class Event: - def __new__(cls) -> Event: - try: - return get_async_backend().create_event() - except AsyncLibraryNotFoundError: - return EventAdapter() - - def set(self) -> None: - """Set the flag, notifying all listeners.""" - raise NotImplementedError - - def is_set(self) -> bool: - """Return ``True`` if the flag is set, ``False`` if not.""" - raise NotImplementedError - - async def wait(self) -> None: - """ - Wait until the flag has been set. - - If the flag has already been set when this method is called, it returns - immediately. - - """ - raise NotImplementedError - - def statistics(self) -> EventStatistics: - """Return statistics about the current state of this event.""" - raise NotImplementedError - - -class EventAdapter(Event): - _internal_event: Event | None = None - _is_set: bool = False - - def __new__(cls) -> EventAdapter: - return object.__new__(cls) - - @property - def _event(self) -> Event: - if self._internal_event is None: - self._internal_event = get_async_backend().create_event() - if self._is_set: - self._internal_event.set() - - return self._internal_event - - def set(self) -> None: - if self._internal_event is None: - self._is_set = True - else: - self._event.set() - - def is_set(self) -> bool: - if self._internal_event is None: - return self._is_set - - return self._internal_event.is_set() - - async def wait(self) -> None: - await self._event.wait() - - def statistics(self) -> EventStatistics: - if self._internal_event is None: - return EventStatistics(tasks_waiting=0) - - return self._internal_event.statistics() - - -class Lock: - def __new__(cls, *, fast_acquire: bool = False) -> Lock: - try: - return get_async_backend().create_lock(fast_acquire=fast_acquire) - except AsyncLibraryNotFoundError: - return LockAdapter(fast_acquire=fast_acquire) - - async def __aenter__(self) -> None: - await self.acquire() - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self.release() - - async def acquire(self) -> None: - """Acquire the lock.""" - raise NotImplementedError - - def acquire_nowait(self) -> None: - """ - Acquire the lock, without blocking. - - :raises ~anyio.WouldBlock: if the operation would block - - """ - raise NotImplementedError - - def release(self) -> None: - """Release the lock.""" - raise NotImplementedError - - def locked(self) -> bool: - """Return True if the lock is currently held.""" - raise NotImplementedError - - def statistics(self) -> LockStatistics: - """ - Return statistics about the current state of this lock. - - .. versionadded:: 3.0 - """ - raise NotImplementedError - - -class LockAdapter(Lock): - _internal_lock: Lock | None = None - - def __new__(cls, *, fast_acquire: bool = False) -> LockAdapter: - return object.__new__(cls) - - def __init__(self, *, fast_acquire: bool = False): - self._fast_acquire = fast_acquire - - @property - def _lock(self) -> Lock: - if self._internal_lock is None: - self._internal_lock = get_async_backend().create_lock( - fast_acquire=self._fast_acquire - ) - - return self._internal_lock - - async def __aenter__(self) -> None: - await self._lock.acquire() - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - if self._internal_lock is not None: - self._internal_lock.release() - - async def acquire(self) -> None: - """Acquire the lock.""" - await self._lock.acquire() - - def acquire_nowait(self) -> None: - """ - Acquire the lock, without blocking. - - :raises ~anyio.WouldBlock: if the operation would block - - """ - self._lock.acquire_nowait() - - def release(self) -> None: - """Release the lock.""" - self._lock.release() - - def locked(self) -> bool: - """Return True if the lock is currently held.""" - return self._lock.locked() - - def statistics(self) -> LockStatistics: - """ - Return statistics about the current state of this lock. - - .. versionadded:: 3.0 - - """ - if self._internal_lock is None: - return LockStatistics(False, None, 0) - - return self._internal_lock.statistics() - - -class Condition: - _owner_task: TaskInfo | None = None - - def __init__(self, lock: Lock | None = None): - self._lock = lock or Lock() - self._waiters: deque[Event] = deque() - - async def __aenter__(self) -> None: - await self.acquire() - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self.release() - - def _check_acquired(self) -> None: - if self._owner_task != get_current_task(): - raise RuntimeError("The current task is not holding the underlying lock") - - async def acquire(self) -> None: - """Acquire the underlying lock.""" - await self._lock.acquire() - self._owner_task = get_current_task() - - def acquire_nowait(self) -> None: - """ - Acquire the underlying lock, without blocking. - - :raises ~anyio.WouldBlock: if the operation would block - - """ - self._lock.acquire_nowait() - self._owner_task = get_current_task() - - def release(self) -> None: - """Release the underlying lock.""" - self._lock.release() - - def locked(self) -> bool: - """Return True if the lock is set.""" - return self._lock.locked() - - def notify(self, n: int = 1) -> None: - """Notify exactly n listeners.""" - self._check_acquired() - for _ in range(n): - try: - event = self._waiters.popleft() - except IndexError: - break - - event.set() - - def notify_all(self) -> None: - """Notify all the listeners.""" - self._check_acquired() - for event in self._waiters: - event.set() - - self._waiters.clear() - - async def wait(self) -> None: - """Wait for a notification.""" - await checkpoint() - event = Event() - self._waiters.append(event) - self.release() - try: - await event.wait() - except BaseException: - if not event.is_set(): - self._waiters.remove(event) - - raise - finally: - with CancelScope(shield=True): - await self.acquire() - - def statistics(self) -> ConditionStatistics: - """ - Return statistics about the current state of this condition. - - .. versionadded:: 3.0 - """ - return ConditionStatistics(len(self._waiters), self._lock.statistics()) - - -class Semaphore: - def __new__( - cls, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> Semaphore: - try: - return get_async_backend().create_semaphore( - initial_value, max_value=max_value, fast_acquire=fast_acquire - ) - except AsyncLibraryNotFoundError: - return SemaphoreAdapter(initial_value, max_value=max_value) - - def __init__( - self, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ): - if not isinstance(initial_value, int): - raise TypeError("initial_value must be an integer") - if initial_value < 0: - raise ValueError("initial_value must be >= 0") - if max_value is not None: - if not isinstance(max_value, int): - raise TypeError("max_value must be an integer or None") - if max_value < initial_value: - raise ValueError( - "max_value must be equal to or higher than initial_value" - ) - - self._fast_acquire = fast_acquire - - async def __aenter__(self) -> Semaphore: - await self.acquire() - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self.release() - - async def acquire(self) -> None: - """Decrement the semaphore value, blocking if necessary.""" - raise NotImplementedError - - def acquire_nowait(self) -> None: - """ - Acquire the underlying lock, without blocking. - - :raises ~anyio.WouldBlock: if the operation would block - - """ - raise NotImplementedError - - def release(self) -> None: - """Increment the semaphore value.""" - raise NotImplementedError - - @property - def value(self) -> int: - """The current value of the semaphore.""" - raise NotImplementedError - - @property - def max_value(self) -> int | None: - """The maximum value of the semaphore.""" - raise NotImplementedError - - def statistics(self) -> SemaphoreStatistics: - """ - Return statistics about the current state of this semaphore. - - .. versionadded:: 3.0 - """ - raise NotImplementedError - - -class SemaphoreAdapter(Semaphore): - _internal_semaphore: Semaphore | None = None - - def __new__( - cls, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> SemaphoreAdapter: - return object.__new__(cls) - - def __init__( - self, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> None: - super().__init__(initial_value, max_value=max_value, fast_acquire=fast_acquire) - self._initial_value = initial_value - self._max_value = max_value - - @property - def _semaphore(self) -> Semaphore: - if self._internal_semaphore is None: - self._internal_semaphore = get_async_backend().create_semaphore( - self._initial_value, max_value=self._max_value - ) - - return self._internal_semaphore - - async def acquire(self) -> None: - await self._semaphore.acquire() - - def acquire_nowait(self) -> None: - self._semaphore.acquire_nowait() - - def release(self) -> None: - self._semaphore.release() - - @property - def value(self) -> int: - if self._internal_semaphore is None: - return self._initial_value - - return self._semaphore.value - - @property - def max_value(self) -> int | None: - return self._max_value - - def statistics(self) -> SemaphoreStatistics: - if self._internal_semaphore is None: - return SemaphoreStatistics(tasks_waiting=0) - - return self._semaphore.statistics() - - -class CapacityLimiter: - def __new__(cls, total_tokens: float) -> CapacityLimiter: - try: - return get_async_backend().create_capacity_limiter(total_tokens) - except AsyncLibraryNotFoundError: - return CapacityLimiterAdapter(total_tokens) - - async def __aenter__(self) -> None: - raise NotImplementedError - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - raise NotImplementedError - - @property - def total_tokens(self) -> float: - """ - The total number of tokens available for borrowing. - - This is a read-write property. If the total number of tokens is increased, the - proportionate number of tasks waiting on this limiter will be granted their - tokens. - - .. versionchanged:: 3.0 - The property is now writable. - - """ - raise NotImplementedError - - @total_tokens.setter - def total_tokens(self, value: float) -> None: - raise NotImplementedError - - @property - def borrowed_tokens(self) -> int: - """The number of tokens that have currently been borrowed.""" - raise NotImplementedError - - @property - def available_tokens(self) -> float: - """The number of tokens currently available to be borrowed""" - raise NotImplementedError - - def acquire_nowait(self) -> None: - """ - Acquire a token for the current task without waiting for one to become - available. - - :raises ~anyio.WouldBlock: if there are no tokens available for borrowing - - """ - raise NotImplementedError - - def acquire_on_behalf_of_nowait(self, borrower: object) -> None: - """ - Acquire a token without waiting for one to become available. - - :param borrower: the entity borrowing a token - :raises ~anyio.WouldBlock: if there are no tokens available for borrowing - - """ - raise NotImplementedError - - async def acquire(self) -> None: - """ - Acquire a token for the current task, waiting if necessary for one to become - available. - - """ - raise NotImplementedError - - async def acquire_on_behalf_of(self, borrower: object) -> None: - """ - Acquire a token, waiting if necessary for one to become available. - - :param borrower: the entity borrowing a token - - """ - raise NotImplementedError - - def release(self) -> None: - """ - Release the token held by the current task. - - :raises RuntimeError: if the current task has not borrowed a token from this - limiter. - - """ - raise NotImplementedError - - def release_on_behalf_of(self, borrower: object) -> None: - """ - Release the token held by the given borrower. - - :raises RuntimeError: if the borrower has not borrowed a token from this - limiter. - - """ - raise NotImplementedError - - def statistics(self) -> CapacityLimiterStatistics: - """ - Return statistics about the current state of this limiter. - - .. versionadded:: 3.0 - - """ - raise NotImplementedError - - -class CapacityLimiterAdapter(CapacityLimiter): - _internal_limiter: CapacityLimiter | None = None - - def __new__(cls, total_tokens: float) -> CapacityLimiterAdapter: - return object.__new__(cls) - - def __init__(self, total_tokens: float) -> None: - self.total_tokens = total_tokens - - @property - def _limiter(self) -> CapacityLimiter: - if self._internal_limiter is None: - self._internal_limiter = get_async_backend().create_capacity_limiter( - self._total_tokens - ) - - return self._internal_limiter - - async def __aenter__(self) -> None: - await self._limiter.__aenter__() - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - return await self._limiter.__aexit__(exc_type, exc_val, exc_tb) - - @property - def total_tokens(self) -> float: - if self._internal_limiter is None: - return self._total_tokens - - return self._internal_limiter.total_tokens - - @total_tokens.setter - def total_tokens(self, value: float) -> None: - if not isinstance(value, int) and value is not math.inf: - raise TypeError("total_tokens must be an int or math.inf") - elif value < 1: - raise ValueError("total_tokens must be >= 1") - - if self._internal_limiter is None: - self._total_tokens = value - return - - self._limiter.total_tokens = value - - @property - def borrowed_tokens(self) -> int: - if self._internal_limiter is None: - return 0 - - return self._internal_limiter.borrowed_tokens - - @property - def available_tokens(self) -> float: - if self._internal_limiter is None: - return self._total_tokens - - return self._internal_limiter.available_tokens - - def acquire_nowait(self) -> None: - self._limiter.acquire_nowait() - - def acquire_on_behalf_of_nowait(self, borrower: object) -> None: - self._limiter.acquire_on_behalf_of_nowait(borrower) - - async def acquire(self) -> None: - await self._limiter.acquire() - - async def acquire_on_behalf_of(self, borrower: object) -> None: - await self._limiter.acquire_on_behalf_of(borrower) - - def release(self) -> None: - self._limiter.release() - - def release_on_behalf_of(self, borrower: object) -> None: - self._limiter.release_on_behalf_of(borrower) - - def statistics(self) -> CapacityLimiterStatistics: - if self._internal_limiter is None: - return CapacityLimiterStatistics( - borrowed_tokens=0, - total_tokens=self.total_tokens, - borrowers=(), - tasks_waiting=0, - ) - - return self._internal_limiter.statistics() - - -class ResourceGuard: - """ - A context manager for ensuring that a resource is only used by a single task at a - time. - - Entering this context manager while the previous has not exited it yet will trigger - :exc:`BusyResourceError`. - - :param action: the action to guard against (visible in the :exc:`BusyResourceError` - when triggered, e.g. "Another task is already {action} this resource") - - .. versionadded:: 4.1 - """ - - __slots__ = "action", "_guarded" - - def __init__(self, action: str = "using"): - self.action: str = action - self._guarded = False - - def __enter__(self) -> None: - if self._guarded: - raise BusyResourceError(self.action) - - self._guarded = True - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self._guarded = False diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_tasks.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_tasks.py deleted file mode 100644 index fe49015..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_tasks.py +++ /dev/null @@ -1,158 +0,0 @@ -from __future__ import annotations - -import math -from collections.abc import Generator -from contextlib import contextmanager -from types import TracebackType - -from ..abc._tasks import TaskGroup, TaskStatus -from ._eventloop import get_async_backend - - -class _IgnoredTaskStatus(TaskStatus[object]): - def started(self, value: object = None) -> None: - pass - - -TASK_STATUS_IGNORED = _IgnoredTaskStatus() - - -class CancelScope: - """ - Wraps a unit of work that can be made separately cancellable. - - :param deadline: The time (clock value) when this scope is cancelled automatically - :param shield: ``True`` to shield the cancel scope from external cancellation - """ - - def __new__( - cls, *, deadline: float = math.inf, shield: bool = False - ) -> CancelScope: - return get_async_backend().create_cancel_scope(shield=shield, deadline=deadline) - - def cancel(self) -> None: - """Cancel this scope immediately.""" - raise NotImplementedError - - @property - def deadline(self) -> float: - """ - The time (clock value) when this scope is cancelled automatically. - - Will be ``float('inf')`` if no timeout has been set. - - """ - raise NotImplementedError - - @deadline.setter - def deadline(self, value: float) -> None: - raise NotImplementedError - - @property - def cancel_called(self) -> bool: - """``True`` if :meth:`cancel` has been called.""" - raise NotImplementedError - - @property - def cancelled_caught(self) -> bool: - """ - ``True`` if this scope suppressed a cancellation exception it itself raised. - - This is typically used to check if any work was interrupted, or to see if the - scope was cancelled due to its deadline being reached. The value will, however, - only be ``True`` if the cancellation was triggered by the scope itself (and not - an outer scope). - - """ - raise NotImplementedError - - @property - def shield(self) -> bool: - """ - ``True`` if this scope is shielded from external cancellation. - - While a scope is shielded, it will not receive cancellations from outside. - - """ - raise NotImplementedError - - @shield.setter - def shield(self, value: bool) -> None: - raise NotImplementedError - - def __enter__(self) -> CancelScope: - raise NotImplementedError - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool: - raise NotImplementedError - - -@contextmanager -def fail_after( - delay: float | None, shield: bool = False -) -> Generator[CancelScope, None, None]: - """ - Create a context manager which raises a :class:`TimeoutError` if does not finish in - time. - - :param delay: maximum allowed time (in seconds) before raising the exception, or - ``None`` to disable the timeout - :param shield: ``True`` to shield the cancel scope from external cancellation - :return: a context manager that yields a cancel scope - :rtype: :class:`~typing.ContextManager`\\[:class:`~anyio.CancelScope`\\] - - """ - current_time = get_async_backend().current_time - deadline = (current_time() + delay) if delay is not None else math.inf - with get_async_backend().create_cancel_scope( - deadline=deadline, shield=shield - ) as cancel_scope: - yield cancel_scope - - if cancel_scope.cancelled_caught and current_time() >= cancel_scope.deadline: - raise TimeoutError - - -def move_on_after(delay: float | None, shield: bool = False) -> CancelScope: - """ - Create a cancel scope with a deadline that expires after the given delay. - - :param delay: maximum allowed time (in seconds) before exiting the context block, or - ``None`` to disable the timeout - :param shield: ``True`` to shield the cancel scope from external cancellation - :return: a cancel scope - - """ - deadline = ( - (get_async_backend().current_time() + delay) if delay is not None else math.inf - ) - return get_async_backend().create_cancel_scope(deadline=deadline, shield=shield) - - -def current_effective_deadline() -> float: - """ - Return the nearest deadline among all the cancel scopes effective for the current - task. - - :return: a clock value from the event loop's internal clock (or ``float('inf')`` if - there is no deadline in effect, or ``float('-inf')`` if the current scope has - been cancelled) - :rtype: float - - """ - return get_async_backend().current_effective_deadline() - - -def create_task_group() -> TaskGroup: - """ - Create a task group. - - :return: a task group - - """ - return get_async_backend().create_task_group() diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_tempfile.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_tempfile.py deleted file mode 100644 index fbb6b14..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_tempfile.py +++ /dev/null @@ -1,616 +0,0 @@ -from __future__ import annotations - -import os -import sys -import tempfile -from collections.abc import Iterable -from io import BytesIO, TextIOWrapper -from types import TracebackType -from typing import ( - TYPE_CHECKING, - Any, - AnyStr, - Generic, - overload, -) - -from .. import to_thread -from .._core._fileio import AsyncFile -from ..lowlevel import checkpoint_if_cancelled - -if TYPE_CHECKING: - from _typeshed import OpenBinaryMode, OpenTextMode, ReadableBuffer, WriteableBuffer - - -class TemporaryFile(Generic[AnyStr]): - """ - An asynchronous temporary file that is automatically created and cleaned up. - - This class provides an asynchronous context manager interface to a temporary file. - The file is created using Python's standard `tempfile.TemporaryFile` function in a - background thread, and is wrapped as an asynchronous file using `AsyncFile`. - - :param mode: The mode in which the file is opened. Defaults to "w+b". - :param buffering: The buffering policy (-1 means the default buffering). - :param encoding: The encoding used to decode or encode the file. Only applicable in - text mode. - :param newline: Controls how universal newlines mode works (only applicable in text - mode). - :param suffix: The suffix for the temporary file name. - :param prefix: The prefix for the temporary file name. - :param dir: The directory in which the temporary file is created. - :param errors: The error handling scheme used for encoding/decoding errors. - """ - - _async_file: AsyncFile[AnyStr] - - @overload - def __init__( - self: TemporaryFile[bytes], - mode: OpenBinaryMode = ..., - buffering: int = ..., - encoding: str | None = ..., - newline: str | None = ..., - suffix: str | None = ..., - prefix: str | None = ..., - dir: str | None = ..., - *, - errors: str | None = ..., - ): ... - @overload - def __init__( - self: TemporaryFile[str], - mode: OpenTextMode, - buffering: int = ..., - encoding: str | None = ..., - newline: str | None = ..., - suffix: str | None = ..., - prefix: str | None = ..., - dir: str | None = ..., - *, - errors: str | None = ..., - ): ... - - def __init__( - self, - mode: OpenTextMode | OpenBinaryMode = "w+b", - buffering: int = -1, - encoding: str | None = None, - newline: str | None = None, - suffix: str | None = None, - prefix: str | None = None, - dir: str | None = None, - *, - errors: str | None = None, - ) -> None: - self.mode = mode - self.buffering = buffering - self.encoding = encoding - self.newline = newline - self.suffix: str | None = suffix - self.prefix: str | None = prefix - self.dir: str | None = dir - self.errors = errors - - async def __aenter__(self) -> AsyncFile[AnyStr]: - fp = await to_thread.run_sync( - lambda: tempfile.TemporaryFile( - self.mode, - self.buffering, - self.encoding, - self.newline, - self.suffix, - self.prefix, - self.dir, - errors=self.errors, - ) - ) - self._async_file = AsyncFile(fp) - return self._async_file - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> None: - await self._async_file.aclose() - - -class NamedTemporaryFile(Generic[AnyStr]): - """ - An asynchronous named temporary file that is automatically created and cleaned up. - - This class provides an asynchronous context manager for a temporary file with a - visible name in the file system. It uses Python's standard - :func:`~tempfile.NamedTemporaryFile` function and wraps the file object with - :class:`AsyncFile` for asynchronous operations. - - :param mode: The mode in which the file is opened. Defaults to "w+b". - :param buffering: The buffering policy (-1 means the default buffering). - :param encoding: The encoding used to decode or encode the file. Only applicable in - text mode. - :param newline: Controls how universal newlines mode works (only applicable in text - mode). - :param suffix: The suffix for the temporary file name. - :param prefix: The prefix for the temporary file name. - :param dir: The directory in which the temporary file is created. - :param delete: Whether to delete the file when it is closed. - :param errors: The error handling scheme used for encoding/decoding errors. - :param delete_on_close: (Python 3.12+) Whether to delete the file on close. - """ - - _async_file: AsyncFile[AnyStr] - - @overload - def __init__( - self: NamedTemporaryFile[bytes], - mode: OpenBinaryMode = ..., - buffering: int = ..., - encoding: str | None = ..., - newline: str | None = ..., - suffix: str | None = ..., - prefix: str | None = ..., - dir: str | None = ..., - delete: bool = ..., - *, - errors: str | None = ..., - delete_on_close: bool = ..., - ): ... - @overload - def __init__( - self: NamedTemporaryFile[str], - mode: OpenTextMode, - buffering: int = ..., - encoding: str | None = ..., - newline: str | None = ..., - suffix: str | None = ..., - prefix: str | None = ..., - dir: str | None = ..., - delete: bool = ..., - *, - errors: str | None = ..., - delete_on_close: bool = ..., - ): ... - - def __init__( - self, - mode: OpenBinaryMode | OpenTextMode = "w+b", - buffering: int = -1, - encoding: str | None = None, - newline: str | None = None, - suffix: str | None = None, - prefix: str | None = None, - dir: str | None = None, - delete: bool = True, - *, - errors: str | None = None, - delete_on_close: bool = True, - ) -> None: - self._params: dict[str, Any] = { - "mode": mode, - "buffering": buffering, - "encoding": encoding, - "newline": newline, - "suffix": suffix, - "prefix": prefix, - "dir": dir, - "delete": delete, - "errors": errors, - } - if sys.version_info >= (3, 12): - self._params["delete_on_close"] = delete_on_close - - async def __aenter__(self) -> AsyncFile[AnyStr]: - fp = await to_thread.run_sync( - lambda: tempfile.NamedTemporaryFile(**self._params) - ) - self._async_file = AsyncFile(fp) - return self._async_file - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> None: - await self._async_file.aclose() - - -class SpooledTemporaryFile(AsyncFile[AnyStr]): - """ - An asynchronous spooled temporary file that starts in memory and is spooled to disk. - - This class provides an asynchronous interface to a spooled temporary file, much like - Python's standard :class:`~tempfile.SpooledTemporaryFile`. It supports asynchronous - write operations and provides a method to force a rollover to disk. - - :param max_size: Maximum size in bytes before the file is rolled over to disk. - :param mode: The mode in which the file is opened. Defaults to "w+b". - :param buffering: The buffering policy (-1 means the default buffering). - :param encoding: The encoding used to decode or encode the file (text mode only). - :param newline: Controls how universal newlines mode works (text mode only). - :param suffix: The suffix for the temporary file name. - :param prefix: The prefix for the temporary file name. - :param dir: The directory in which the temporary file is created. - :param errors: The error handling scheme used for encoding/decoding errors. - """ - - _rolled: bool = False - - @overload - def __init__( - self: SpooledTemporaryFile[bytes], - max_size: int = ..., - mode: OpenBinaryMode = ..., - buffering: int = ..., - encoding: str | None = ..., - newline: str | None = ..., - suffix: str | None = ..., - prefix: str | None = ..., - dir: str | None = ..., - *, - errors: str | None = ..., - ): ... - @overload - def __init__( - self: SpooledTemporaryFile[str], - max_size: int = ..., - mode: OpenTextMode = ..., - buffering: int = ..., - encoding: str | None = ..., - newline: str | None = ..., - suffix: str | None = ..., - prefix: str | None = ..., - dir: str | None = ..., - *, - errors: str | None = ..., - ): ... - - def __init__( - self, - max_size: int = 0, - mode: OpenBinaryMode | OpenTextMode = "w+b", - buffering: int = -1, - encoding: str | None = None, - newline: str | None = None, - suffix: str | None = None, - prefix: str | None = None, - dir: str | None = None, - *, - errors: str | None = None, - ) -> None: - self._tempfile_params: dict[str, Any] = { - "mode": mode, - "buffering": buffering, - "encoding": encoding, - "newline": newline, - "suffix": suffix, - "prefix": prefix, - "dir": dir, - "errors": errors, - } - self._max_size = max_size - if "b" in mode: - super().__init__(BytesIO()) # type: ignore[arg-type] - else: - super().__init__( - TextIOWrapper( # type: ignore[arg-type] - BytesIO(), - encoding=encoding, - errors=errors, - newline=newline, - write_through=True, - ) - ) - - async def aclose(self) -> None: - if not self._rolled: - self._fp.close() - return - - await super().aclose() - - async def _check(self) -> None: - if self._rolled or self._fp.tell() <= self._max_size: - return - - await self.rollover() - - async def rollover(self) -> None: - if self._rolled: - return - - self._rolled = True - buffer = self._fp - buffer.seek(0) - self._fp = await to_thread.run_sync( - lambda: tempfile.TemporaryFile(**self._tempfile_params) - ) - await self.write(buffer.read()) - buffer.close() - - @property - def closed(self) -> bool: - return self._fp.closed - - async def read(self, size: int = -1) -> AnyStr: - if not self._rolled: - await checkpoint_if_cancelled() - return self._fp.read(size) - - return await super().read(size) # type: ignore[return-value] - - async def read1(self: SpooledTemporaryFile[bytes], size: int = -1) -> bytes: - if not self._rolled: - await checkpoint_if_cancelled() - return self._fp.read1(size) - - return await super().read1(size) - - async def readline(self) -> AnyStr: - if not self._rolled: - await checkpoint_if_cancelled() - return self._fp.readline() - - return await super().readline() # type: ignore[return-value] - - async def readlines(self) -> list[AnyStr]: - if not self._rolled: - await checkpoint_if_cancelled() - return self._fp.readlines() - - return await super().readlines() # type: ignore[return-value] - - async def readinto(self: SpooledTemporaryFile[bytes], b: WriteableBuffer) -> int: - if not self._rolled: - await checkpoint_if_cancelled() - self._fp.readinto(b) - - return await super().readinto(b) - - async def readinto1(self: SpooledTemporaryFile[bytes], b: WriteableBuffer) -> int: - if not self._rolled: - await checkpoint_if_cancelled() - self._fp.readinto(b) - - return await super().readinto1(b) - - async def seek(self, offset: int, whence: int | None = os.SEEK_SET) -> int: - if not self._rolled: - await checkpoint_if_cancelled() - return self._fp.seek(offset, whence) - - return await super().seek(offset, whence) - - async def tell(self) -> int: - if not self._rolled: - await checkpoint_if_cancelled() - return self._fp.tell() - - return await super().tell() - - async def truncate(self, size: int | None = None) -> int: - if not self._rolled: - await checkpoint_if_cancelled() - return self._fp.truncate(size) - - return await super().truncate(size) - - @overload - async def write(self: SpooledTemporaryFile[bytes], b: ReadableBuffer) -> int: ... - @overload - async def write(self: SpooledTemporaryFile[str], b: str) -> int: ... - - async def write(self, b: ReadableBuffer | str) -> int: - """ - Asynchronously write data to the spooled temporary file. - - If the file has not yet been rolled over, the data is written synchronously, - and a rollover is triggered if the size exceeds the maximum size. - - :param s: The data to write. - :return: The number of bytes written. - :raises RuntimeError: If the underlying file is not initialized. - - """ - if not self._rolled: - await checkpoint_if_cancelled() - result = self._fp.write(b) - await self._check() - return result - - return await super().write(b) # type: ignore[misc] - - @overload - async def writelines( - self: SpooledTemporaryFile[bytes], lines: Iterable[ReadableBuffer] - ) -> None: ... - @overload - async def writelines( - self: SpooledTemporaryFile[str], lines: Iterable[str] - ) -> None: ... - - async def writelines(self, lines: Iterable[str] | Iterable[ReadableBuffer]) -> None: - """ - Asynchronously write a list of lines to the spooled temporary file. - - If the file has not yet been rolled over, the lines are written synchronously, - and a rollover is triggered if the size exceeds the maximum size. - - :param lines: An iterable of lines to write. - :raises RuntimeError: If the underlying file is not initialized. - - """ - if not self._rolled: - await checkpoint_if_cancelled() - result = self._fp.writelines(lines) - await self._check() - return result - - return await super().writelines(lines) # type: ignore[misc] - - -class TemporaryDirectory(Generic[AnyStr]): - """ - An asynchronous temporary directory that is created and cleaned up automatically. - - This class provides an asynchronous context manager for creating a temporary - directory. It wraps Python's standard :class:`~tempfile.TemporaryDirectory` to - perform directory creation and cleanup operations in a background thread. - - :param suffix: Suffix to be added to the temporary directory name. - :param prefix: Prefix to be added to the temporary directory name. - :param dir: The parent directory where the temporary directory is created. - :param ignore_cleanup_errors: Whether to ignore errors during cleanup - (Python 3.10+). - :param delete: Whether to delete the directory upon closing (Python 3.12+). - """ - - def __init__( - self, - suffix: AnyStr | None = None, - prefix: AnyStr | None = None, - dir: AnyStr | None = None, - *, - ignore_cleanup_errors: bool = False, - delete: bool = True, - ) -> None: - self.suffix: AnyStr | None = suffix - self.prefix: AnyStr | None = prefix - self.dir: AnyStr | None = dir - self.ignore_cleanup_errors = ignore_cleanup_errors - self.delete = delete - - self._tempdir: tempfile.TemporaryDirectory | None = None - - async def __aenter__(self) -> str: - params: dict[str, Any] = { - "suffix": self.suffix, - "prefix": self.prefix, - "dir": self.dir, - } - if sys.version_info >= (3, 10): - params["ignore_cleanup_errors"] = self.ignore_cleanup_errors - - if sys.version_info >= (3, 12): - params["delete"] = self.delete - - self._tempdir = await to_thread.run_sync( - lambda: tempfile.TemporaryDirectory(**params) - ) - return await to_thread.run_sync(self._tempdir.__enter__) - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> None: - if self._tempdir is not None: - await to_thread.run_sync( - self._tempdir.__exit__, exc_type, exc_value, traceback - ) - - async def cleanup(self) -> None: - if self._tempdir is not None: - await to_thread.run_sync(self._tempdir.cleanup) - - -@overload -async def mkstemp( - suffix: str | None = None, - prefix: str | None = None, - dir: str | None = None, - text: bool = False, -) -> tuple[int, str]: ... - - -@overload -async def mkstemp( - suffix: bytes | None = None, - prefix: bytes | None = None, - dir: bytes | None = None, - text: bool = False, -) -> tuple[int, bytes]: ... - - -async def mkstemp( - suffix: AnyStr | None = None, - prefix: AnyStr | None = None, - dir: AnyStr | None = None, - text: bool = False, -) -> tuple[int, str | bytes]: - """ - Asynchronously create a temporary file and return an OS-level handle and the file - name. - - This function wraps `tempfile.mkstemp` and executes it in a background thread. - - :param suffix: Suffix to be added to the file name. - :param prefix: Prefix to be added to the file name. - :param dir: Directory in which the temporary file is created. - :param text: Whether the file is opened in text mode. - :return: A tuple containing the file descriptor and the file name. - - """ - return await to_thread.run_sync(tempfile.mkstemp, suffix, prefix, dir, text) - - -@overload -async def mkdtemp( - suffix: str | None = None, - prefix: str | None = None, - dir: str | None = None, -) -> str: ... - - -@overload -async def mkdtemp( - suffix: bytes | None = None, - prefix: bytes | None = None, - dir: bytes | None = None, -) -> bytes: ... - - -async def mkdtemp( - suffix: AnyStr | None = None, - prefix: AnyStr | None = None, - dir: AnyStr | None = None, -) -> str | bytes: - """ - Asynchronously create a temporary directory and return its path. - - This function wraps `tempfile.mkdtemp` and executes it in a background thread. - - :param suffix: Suffix to be added to the directory name. - :param prefix: Prefix to be added to the directory name. - :param dir: Parent directory where the temporary directory is created. - :return: The path of the created temporary directory. - - """ - return await to_thread.run_sync(tempfile.mkdtemp, suffix, prefix, dir) - - -async def gettempdir() -> str: - """ - Asynchronously return the name of the directory used for temporary files. - - This function wraps `tempfile.gettempdir` and executes it in a background thread. - - :return: The path of the temporary directory as a string. - - """ - return await to_thread.run_sync(tempfile.gettempdir) - - -async def gettempdirb() -> bytes: - """ - Asynchronously return the name of the directory used for temporary files in bytes. - - This function wraps `tempfile.gettempdirb` and executes it in a background thread. - - :return: The path of the temporary directory as bytes. - - """ - return await to_thread.run_sync(tempfile.gettempdirb) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_testing.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_testing.py deleted file mode 100644 index 9e28b22..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_testing.py +++ /dev/null @@ -1,78 +0,0 @@ -from __future__ import annotations - -from collections.abc import Awaitable, Generator -from typing import Any, cast - -from ._eventloop import get_async_backend - - -class TaskInfo: - """ - Represents an asynchronous task. - - :ivar int id: the unique identifier of the task - :ivar parent_id: the identifier of the parent task, if any - :vartype parent_id: Optional[int] - :ivar str name: the description of the task (if any) - :ivar ~collections.abc.Coroutine coro: the coroutine object of the task - """ - - __slots__ = "_name", "id", "parent_id", "name", "coro" - - def __init__( - self, - id: int, - parent_id: int | None, - name: str | None, - coro: Generator[Any, Any, Any] | Awaitable[Any], - ): - func = get_current_task - self._name = f"{func.__module__}.{func.__qualname__}" - self.id: int = id - self.parent_id: int | None = parent_id - self.name: str | None = name - self.coro: Generator[Any, Any, Any] | Awaitable[Any] = coro - - def __eq__(self, other: object) -> bool: - if isinstance(other, TaskInfo): - return self.id == other.id - - return NotImplemented - - def __hash__(self) -> int: - return hash(self.id) - - def __repr__(self) -> str: - return f"{self.__class__.__name__}(id={self.id!r}, name={self.name!r})" - - def has_pending_cancellation(self) -> bool: - """ - Return ``True`` if the task has a cancellation pending, ``False`` otherwise. - - """ - return False - - -def get_current_task() -> TaskInfo: - """ - Return the current task. - - :return: a representation of the current task - - """ - return get_async_backend().get_current_task() - - -def get_running_tasks() -> list[TaskInfo]: - """ - Return a list of running tasks in the current event loop. - - :return: a list of task info objects - - """ - return cast("list[TaskInfo]", get_async_backend().get_running_tasks()) - - -async def wait_all_tasks_blocked() -> None: - """Wait until all other tasks are waiting for something.""" - await get_async_backend().wait_all_tasks_blocked() diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_typedattr.py b/write-message/venv/lib/python3.10/site-packages/anyio/_core/_typedattr.py deleted file mode 100644 index f358a44..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/_core/_typedattr.py +++ /dev/null @@ -1,81 +0,0 @@ -from __future__ import annotations - -from collections.abc import Callable, Mapping -from typing import Any, TypeVar, final, overload - -from ._exceptions import TypedAttributeLookupError - -T_Attr = TypeVar("T_Attr") -T_Default = TypeVar("T_Default") -undefined = object() - - -def typed_attribute() -> Any: - """Return a unique object, used to mark typed attributes.""" - return object() - - -class TypedAttributeSet: - """ - Superclass for typed attribute collections. - - Checks that every public attribute of every subclass has a type annotation. - """ - - def __init_subclass__(cls) -> None: - annotations: dict[str, Any] = getattr(cls, "__annotations__", {}) - for attrname in dir(cls): - if not attrname.startswith("_") and attrname not in annotations: - raise TypeError( - f"Attribute {attrname!r} is missing its type annotation" - ) - - super().__init_subclass__() - - -class TypedAttributeProvider: - """Base class for classes that wish to provide typed extra attributes.""" - - @property - def extra_attributes(self) -> Mapping[T_Attr, Callable[[], T_Attr]]: - """ - A mapping of the extra attributes to callables that return the corresponding - values. - - If the provider wraps another provider, the attributes from that wrapper should - also be included in the returned mapping (but the wrapper may override the - callables from the wrapped instance). - - """ - return {} - - @overload - def extra(self, attribute: T_Attr) -> T_Attr: ... - - @overload - def extra(self, attribute: T_Attr, default: T_Default) -> T_Attr | T_Default: ... - - @final - def extra(self, attribute: Any, default: object = undefined) -> object: - """ - extra(attribute, default=undefined) - - Return the value of the given typed extra attribute. - - :param attribute: the attribute (member of a :class:`~TypedAttributeSet`) to - look for - :param default: the value that should be returned if no value is found for the - attribute - :raises ~anyio.TypedAttributeLookupError: if the search failed and no default - value was given - - """ - try: - getter = self.extra_attributes[attribute] - except KeyError: - if default is undefined: - raise TypedAttributeLookupError("Attribute not found") from None - else: - return default - - return getter() diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__init__.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__init__.py deleted file mode 100644 index d560ce3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__init__.py +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import annotations - -from ._eventloop import AsyncBackend as AsyncBackend -from ._resources import AsyncResource as AsyncResource -from ._sockets import ConnectedUDPSocket as ConnectedUDPSocket -from ._sockets import ConnectedUNIXDatagramSocket as ConnectedUNIXDatagramSocket -from ._sockets import IPAddressType as IPAddressType -from ._sockets import IPSockAddrType as IPSockAddrType -from ._sockets import SocketAttribute as SocketAttribute -from ._sockets import SocketListener as SocketListener -from ._sockets import SocketStream as SocketStream -from ._sockets import UDPPacketType as UDPPacketType -from ._sockets import UDPSocket as UDPSocket -from ._sockets import UNIXDatagramPacketType as UNIXDatagramPacketType -from ._sockets import UNIXDatagramSocket as UNIXDatagramSocket -from ._sockets import UNIXSocketStream as UNIXSocketStream -from ._streams import AnyByteReceiveStream as AnyByteReceiveStream -from ._streams import AnyByteSendStream as AnyByteSendStream -from ._streams import AnyByteStream as AnyByteStream -from ._streams import AnyByteStreamConnectable as AnyByteStreamConnectable -from ._streams import AnyUnreliableByteReceiveStream as AnyUnreliableByteReceiveStream -from ._streams import AnyUnreliableByteSendStream as AnyUnreliableByteSendStream -from ._streams import AnyUnreliableByteStream as AnyUnreliableByteStream -from ._streams import ByteReceiveStream as ByteReceiveStream -from ._streams import ByteSendStream as ByteSendStream -from ._streams import ByteStream as ByteStream -from ._streams import ByteStreamConnectable as ByteStreamConnectable -from ._streams import Listener as Listener -from ._streams import ObjectReceiveStream as ObjectReceiveStream -from ._streams import ObjectSendStream as ObjectSendStream -from ._streams import ObjectStream as ObjectStream -from ._streams import ObjectStreamConnectable as ObjectStreamConnectable -from ._streams import UnreliableObjectReceiveStream as UnreliableObjectReceiveStream -from ._streams import UnreliableObjectSendStream as UnreliableObjectSendStream -from ._streams import UnreliableObjectStream as UnreliableObjectStream -from ._subprocesses import Process as Process -from ._tasks import TaskGroup as TaskGroup -from ._tasks import TaskStatus as TaskStatus -from ._testing import TestRunner as TestRunner - -# Re-exported here, for backwards compatibility -# isort: off -from .._core._synchronization import ( - CapacityLimiter as CapacityLimiter, - Condition as Condition, - Event as Event, - Lock as Lock, - Semaphore as Semaphore, -) -from .._core._tasks import CancelScope as CancelScope -from ..from_thread import BlockingPortal as BlockingPortal - -# Re-export imports so they look like they live directly in this package -for __value in list(locals().values()): - if getattr(__value, "__module__", "").startswith("anyio.abc."): - __value.__module__ = __name__ - -del __value diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 063f16f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_eventloop.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_eventloop.cpython-310.pyc deleted file mode 100644 index 5f895c7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_eventloop.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_resources.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_resources.cpython-310.pyc deleted file mode 100644 index 30f107b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_resources.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_sockets.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_sockets.cpython-310.pyc deleted file mode 100644 index eb80282..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_sockets.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_streams.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_streams.cpython-310.pyc deleted file mode 100644 index 2fc882f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_streams.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_subprocesses.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_subprocesses.cpython-310.pyc deleted file mode 100644 index c8d8cfe..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_subprocesses.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_tasks.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_tasks.cpython-310.pyc deleted file mode 100644 index 0b0e9c0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_tasks.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_testing.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_testing.cpython-310.pyc deleted file mode 100644 index 7973de5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/abc/__pycache__/_testing.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_eventloop.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/_eventloop.py deleted file mode 100644 index 5bd9e08..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_eventloop.py +++ /dev/null @@ -1,418 +0,0 @@ -from __future__ import annotations - -import math -import sys -from abc import ABCMeta, abstractmethod -from collections.abc import AsyncIterator, Awaitable, Callable, Sequence -from contextlib import AbstractContextManager -from os import PathLike -from signal import Signals -from socket import AddressFamily, SocketKind, socket -from typing import ( - IO, - TYPE_CHECKING, - Any, - TypeVar, - Union, - overload, -) - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -if sys.version_info >= (3, 10): - from typing import TypeAlias -else: - from typing_extensions import TypeAlias - -if TYPE_CHECKING: - from _typeshed import FileDescriptorLike - - from .._core._synchronization import CapacityLimiter, Event, Lock, Semaphore - from .._core._tasks import CancelScope - from .._core._testing import TaskInfo - from ..from_thread import BlockingPortal - from ._sockets import ( - ConnectedUDPSocket, - ConnectedUNIXDatagramSocket, - IPSockAddrType, - SocketListener, - SocketStream, - UDPSocket, - UNIXDatagramSocket, - UNIXSocketStream, - ) - from ._subprocesses import Process - from ._tasks import TaskGroup - from ._testing import TestRunner - -T_Retval = TypeVar("T_Retval") -PosArgsT = TypeVarTuple("PosArgsT") -StrOrBytesPath: TypeAlias = Union[str, bytes, "PathLike[str]", "PathLike[bytes]"] - - -class AsyncBackend(metaclass=ABCMeta): - @classmethod - @abstractmethod - def run( - cls, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - args: tuple[Unpack[PosArgsT]], - kwargs: dict[str, Any], - options: dict[str, Any], - ) -> T_Retval: - """ - Run the given coroutine function in an asynchronous event loop. - - The current thread must not be already running an event loop. - - :param func: a coroutine function - :param args: positional arguments to ``func`` - :param kwargs: positional arguments to ``func`` - :param options: keyword arguments to call the backend ``run()`` implementation - with - :return: the return value of the coroutine function - """ - - @classmethod - @abstractmethod - def current_token(cls) -> object: - """ - - :return: - """ - - @classmethod - @abstractmethod - def current_time(cls) -> float: - """ - Return the current value of the event loop's internal clock. - - :return: the clock value (seconds) - """ - - @classmethod - @abstractmethod - def cancelled_exception_class(cls) -> type[BaseException]: - """Return the exception class that is raised in a task if it's cancelled.""" - - @classmethod - @abstractmethod - async def checkpoint(cls) -> None: - """ - Check if the task has been cancelled, and allow rescheduling of other tasks. - - This is effectively the same as running :meth:`checkpoint_if_cancelled` and then - :meth:`cancel_shielded_checkpoint`. - """ - - @classmethod - async def checkpoint_if_cancelled(cls) -> None: - """ - Check if the current task group has been cancelled. - - This will check if the task has been cancelled, but will not allow other tasks - to be scheduled if not. - - """ - if cls.current_effective_deadline() == -math.inf: - await cls.checkpoint() - - @classmethod - async def cancel_shielded_checkpoint(cls) -> None: - """ - Allow the rescheduling of other tasks. - - This will give other tasks the opportunity to run, but without checking if the - current task group has been cancelled, unlike with :meth:`checkpoint`. - - """ - with cls.create_cancel_scope(shield=True): - await cls.sleep(0) - - @classmethod - @abstractmethod - async def sleep(cls, delay: float) -> None: - """ - Pause the current task for the specified duration. - - :param delay: the duration, in seconds - """ - - @classmethod - @abstractmethod - def create_cancel_scope( - cls, *, deadline: float = math.inf, shield: bool = False - ) -> CancelScope: - pass - - @classmethod - @abstractmethod - def current_effective_deadline(cls) -> float: - """ - Return the nearest deadline among all the cancel scopes effective for the - current task. - - :return: - - a clock value from the event loop's internal clock - - ``inf`` if there is no deadline in effect - - ``-inf`` if the current scope has been cancelled - :rtype: float - """ - - @classmethod - @abstractmethod - def create_task_group(cls) -> TaskGroup: - pass - - @classmethod - @abstractmethod - def create_event(cls) -> Event: - pass - - @classmethod - @abstractmethod - def create_lock(cls, *, fast_acquire: bool) -> Lock: - pass - - @classmethod - @abstractmethod - def create_semaphore( - cls, - initial_value: int, - *, - max_value: int | None = None, - fast_acquire: bool = False, - ) -> Semaphore: - pass - - @classmethod - @abstractmethod - def create_capacity_limiter(cls, total_tokens: float) -> CapacityLimiter: - pass - - @classmethod - @abstractmethod - async def run_sync_in_worker_thread( - cls, - func: Callable[[Unpack[PosArgsT]], T_Retval], - args: tuple[Unpack[PosArgsT]], - abandon_on_cancel: bool = False, - limiter: CapacityLimiter | None = None, - ) -> T_Retval: - pass - - @classmethod - @abstractmethod - def check_cancelled(cls) -> None: - pass - - @classmethod - @abstractmethod - def run_async_from_thread( - cls, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - args: tuple[Unpack[PosArgsT]], - token: object, - ) -> T_Retval: - pass - - @classmethod - @abstractmethod - def run_sync_from_thread( - cls, - func: Callable[[Unpack[PosArgsT]], T_Retval], - args: tuple[Unpack[PosArgsT]], - token: object, - ) -> T_Retval: - pass - - @classmethod - @abstractmethod - def create_blocking_portal(cls) -> BlockingPortal: - pass - - @classmethod - @abstractmethod - async def open_process( - cls, - command: StrOrBytesPath | Sequence[StrOrBytesPath], - *, - stdin: int | IO[Any] | None, - stdout: int | IO[Any] | None, - stderr: int | IO[Any] | None, - **kwargs: Any, - ) -> Process: - pass - - @classmethod - @abstractmethod - def setup_process_pool_exit_at_shutdown(cls, workers: set[Process]) -> None: - pass - - @classmethod - @abstractmethod - async def connect_tcp( - cls, host: str, port: int, local_address: IPSockAddrType | None = None - ) -> SocketStream: - pass - - @classmethod - @abstractmethod - async def connect_unix(cls, path: str | bytes) -> UNIXSocketStream: - pass - - @classmethod - @abstractmethod - def create_tcp_listener(cls, sock: socket) -> SocketListener: - pass - - @classmethod - @abstractmethod - def create_unix_listener(cls, sock: socket) -> SocketListener: - pass - - @classmethod - @abstractmethod - async def create_udp_socket( - cls, - family: AddressFamily, - local_address: IPSockAddrType | None, - remote_address: IPSockAddrType | None, - reuse_port: bool, - ) -> UDPSocket | ConnectedUDPSocket: - pass - - @classmethod - @overload - async def create_unix_datagram_socket( - cls, raw_socket: socket, remote_path: None - ) -> UNIXDatagramSocket: ... - - @classmethod - @overload - async def create_unix_datagram_socket( - cls, raw_socket: socket, remote_path: str | bytes - ) -> ConnectedUNIXDatagramSocket: ... - - @classmethod - @abstractmethod - async def create_unix_datagram_socket( - cls, raw_socket: socket, remote_path: str | bytes | None - ) -> UNIXDatagramSocket | ConnectedUNIXDatagramSocket: - pass - - @classmethod - @abstractmethod - async def getaddrinfo( - cls, - host: bytes | str | None, - port: str | int | None, - *, - family: int | AddressFamily = 0, - type: int | SocketKind = 0, - proto: int = 0, - flags: int = 0, - ) -> Sequence[ - tuple[ - AddressFamily, - SocketKind, - int, - str, - tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes], - ] - ]: - pass - - @classmethod - @abstractmethod - async def getnameinfo( - cls, sockaddr: IPSockAddrType, flags: int = 0 - ) -> tuple[str, str]: - pass - - @classmethod - @abstractmethod - async def wait_readable(cls, obj: FileDescriptorLike) -> None: - pass - - @classmethod - @abstractmethod - async def wait_writable(cls, obj: FileDescriptorLike) -> None: - pass - - @classmethod - @abstractmethod - def notify_closing(cls, obj: FileDescriptorLike) -> None: - pass - - @classmethod - @abstractmethod - async def wrap_listener_socket(cls, sock: socket) -> SocketListener: - pass - - @classmethod - @abstractmethod - async def wrap_stream_socket(cls, sock: socket) -> SocketStream: - pass - - @classmethod - @abstractmethod - async def wrap_unix_stream_socket(cls, sock: socket) -> UNIXSocketStream: - pass - - @classmethod - @abstractmethod - async def wrap_udp_socket(cls, sock: socket) -> UDPSocket: - pass - - @classmethod - @abstractmethod - async def wrap_connected_udp_socket(cls, sock: socket) -> ConnectedUDPSocket: - pass - - @classmethod - @abstractmethod - async def wrap_unix_datagram_socket(cls, sock: socket) -> UNIXDatagramSocket: - pass - - @classmethod - @abstractmethod - async def wrap_connected_unix_datagram_socket( - cls, sock: socket - ) -> ConnectedUNIXDatagramSocket: - pass - - @classmethod - @abstractmethod - def current_default_thread_limiter(cls) -> CapacityLimiter: - pass - - @classmethod - @abstractmethod - def open_signal_receiver( - cls, *signals: Signals - ) -> AbstractContextManager[AsyncIterator[Signals]]: - pass - - @classmethod - @abstractmethod - def get_current_task(cls) -> TaskInfo: - pass - - @classmethod - @abstractmethod - def get_running_tasks(cls) -> Sequence[TaskInfo]: - pass - - @classmethod - @abstractmethod - async def wait_all_tasks_blocked(cls) -> None: - pass - - @classmethod - @abstractmethod - def create_test_runner(cls, options: dict[str, Any]) -> TestRunner: - pass diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_resources.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/_resources.py deleted file mode 100644 index 10df115..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_resources.py +++ /dev/null @@ -1,33 +0,0 @@ -from __future__ import annotations - -from abc import ABCMeta, abstractmethod -from types import TracebackType -from typing import TypeVar - -T = TypeVar("T") - - -class AsyncResource(metaclass=ABCMeta): - """ - Abstract base class for all closeable asynchronous resources. - - Works as an asynchronous context manager which returns the instance itself on enter, - and calls :meth:`aclose` on exit. - """ - - __slots__ = () - - async def __aenter__(self: T) -> T: - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - await self.aclose() - - @abstractmethod - async def aclose(self) -> None: - """Close the resource.""" diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_sockets.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/_sockets.py deleted file mode 100644 index 3ff60d4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_sockets.py +++ /dev/null @@ -1,405 +0,0 @@ -from __future__ import annotations - -import errno -import socket -import sys -from abc import abstractmethod -from collections.abc import Callable, Collection, Mapping -from contextlib import AsyncExitStack -from io import IOBase -from ipaddress import IPv4Address, IPv6Address -from socket import AddressFamily -from typing import Any, TypeVar, Union - -from .._core._eventloop import get_async_backend -from .._core._typedattr import ( - TypedAttributeProvider, - TypedAttributeSet, - typed_attribute, -) -from ._streams import ByteStream, Listener, UnreliableObjectStream -from ._tasks import TaskGroup - -if sys.version_info >= (3, 10): - from typing import TypeAlias -else: - from typing_extensions import TypeAlias - -IPAddressType: TypeAlias = Union[str, IPv4Address, IPv6Address] -IPSockAddrType: TypeAlias = tuple[str, int] -SockAddrType: TypeAlias = Union[IPSockAddrType, str] -UDPPacketType: TypeAlias = tuple[bytes, IPSockAddrType] -UNIXDatagramPacketType: TypeAlias = tuple[bytes, str] -T_Retval = TypeVar("T_Retval") - - -def _validate_socket( - sock_or_fd: socket.socket | int, - sock_type: socket.SocketKind, - addr_family: socket.AddressFamily = socket.AF_UNSPEC, - *, - require_connected: bool = False, - require_bound: bool = False, -) -> socket.socket: - if isinstance(sock_or_fd, int): - try: - sock = socket.socket(fileno=sock_or_fd) - except OSError as exc: - if exc.errno == errno.ENOTSOCK: - raise ValueError( - "the file descriptor does not refer to a socket" - ) from exc - elif require_connected: - raise ValueError("the socket must be connected") from exc - elif require_bound: - raise ValueError("the socket must be bound to a local address") from exc - else: - raise - elif isinstance(sock_or_fd, socket.socket): - sock = sock_or_fd - else: - raise TypeError( - f"expected an int or socket, got {type(sock_or_fd).__qualname__} instead" - ) - - try: - if require_connected: - try: - sock.getpeername() - except OSError as exc: - raise ValueError("the socket must be connected") from exc - - if require_bound: - try: - if sock.family in (socket.AF_INET, socket.AF_INET6): - bound_addr = sock.getsockname()[1] - else: - bound_addr = sock.getsockname() - except OSError: - bound_addr = None - - if not bound_addr: - raise ValueError("the socket must be bound to a local address") - - if addr_family != socket.AF_UNSPEC and sock.family != addr_family: - raise ValueError( - f"address family mismatch: expected {addr_family.name}, got " - f"{sock.family.name}" - ) - - if sock.type != sock_type: - raise ValueError( - f"socket type mismatch: expected {sock_type.name}, got {sock.type.name}" - ) - except BaseException: - # Avoid ResourceWarning from the locally constructed socket object - if isinstance(sock_or_fd, int): - sock.detach() - - raise - - sock.setblocking(False) - return sock - - -class SocketAttribute(TypedAttributeSet): - """ - .. attribute:: family - :type: socket.AddressFamily - - the address family of the underlying socket - - .. attribute:: local_address - :type: tuple[str, int] | str - - the local address the underlying socket is connected to - - .. attribute:: local_port - :type: int - - for IP based sockets, the local port the underlying socket is bound to - - .. attribute:: raw_socket - :type: socket.socket - - the underlying stdlib socket object - - .. attribute:: remote_address - :type: tuple[str, int] | str - - the remote address the underlying socket is connected to - - .. attribute:: remote_port - :type: int - - for IP based sockets, the remote port the underlying socket is connected to - """ - - family: AddressFamily = typed_attribute() - local_address: SockAddrType = typed_attribute() - local_port: int = typed_attribute() - raw_socket: socket.socket = typed_attribute() - remote_address: SockAddrType = typed_attribute() - remote_port: int = typed_attribute() - - -class _SocketProvider(TypedAttributeProvider): - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - from .._core._sockets import convert_ipv6_sockaddr as convert - - attributes: dict[Any, Callable[[], Any]] = { - SocketAttribute.family: lambda: self._raw_socket.family, - SocketAttribute.local_address: lambda: convert( - self._raw_socket.getsockname() - ), - SocketAttribute.raw_socket: lambda: self._raw_socket, - } - try: - peername: tuple[str, int] | None = convert(self._raw_socket.getpeername()) - except OSError: - peername = None - - # Provide the remote address for connected sockets - if peername is not None: - attributes[SocketAttribute.remote_address] = lambda: peername - - # Provide local and remote ports for IP based sockets - if self._raw_socket.family in (AddressFamily.AF_INET, AddressFamily.AF_INET6): - attributes[SocketAttribute.local_port] = ( - lambda: self._raw_socket.getsockname()[1] - ) - if peername is not None: - remote_port = peername[1] - attributes[SocketAttribute.remote_port] = lambda: remote_port - - return attributes - - @property - @abstractmethod - def _raw_socket(self) -> socket.socket: - pass - - -class SocketStream(ByteStream, _SocketProvider): - """ - Transports bytes over a socket. - - Supports all relevant extra attributes from :class:`~SocketAttribute`. - """ - - @classmethod - async def from_socket(cls, sock_or_fd: socket.socket | int) -> SocketStream: - """ - Wrap an existing socket object or file descriptor as a socket stream. - - The newly created socket wrapper takes ownership of the socket being passed in. - The existing socket must already be connected. - - :param sock_or_fd: a socket object or file descriptor - :return: a socket stream - - """ - sock = _validate_socket(sock_or_fd, socket.SOCK_STREAM, require_connected=True) - return await get_async_backend().wrap_stream_socket(sock) - - -class UNIXSocketStream(SocketStream): - @classmethod - async def from_socket(cls, sock_or_fd: socket.socket | int) -> UNIXSocketStream: - """ - Wrap an existing socket object or file descriptor as a UNIX socket stream. - - The newly created socket wrapper takes ownership of the socket being passed in. - The existing socket must already be connected. - - :param sock_or_fd: a socket object or file descriptor - :return: a UNIX socket stream - - """ - sock = _validate_socket( - sock_or_fd, socket.SOCK_STREAM, socket.AF_UNIX, require_connected=True - ) - return await get_async_backend().wrap_unix_stream_socket(sock) - - @abstractmethod - async def send_fds(self, message: bytes, fds: Collection[int | IOBase]) -> None: - """ - Send file descriptors along with a message to the peer. - - :param message: a non-empty bytestring - :param fds: a collection of files (either numeric file descriptors or open file - or socket objects) - """ - - @abstractmethod - async def receive_fds(self, msglen: int, maxfds: int) -> tuple[bytes, list[int]]: - """ - Receive file descriptors along with a message from the peer. - - :param msglen: length of the message to expect from the peer - :param maxfds: maximum number of file descriptors to expect from the peer - :return: a tuple of (message, file descriptors) - """ - - -class SocketListener(Listener[SocketStream], _SocketProvider): - """ - Listens to incoming socket connections. - - Supports all relevant extra attributes from :class:`~SocketAttribute`. - """ - - @classmethod - async def from_socket( - cls, - sock_or_fd: socket.socket | int, - ) -> SocketListener: - """ - Wrap an existing socket object or file descriptor as a socket listener. - - The newly created listener takes ownership of the socket being passed in. - - :param sock_or_fd: a socket object or file descriptor - :return: a socket listener - - """ - sock = _validate_socket(sock_or_fd, socket.SOCK_STREAM, require_bound=True) - return await get_async_backend().wrap_listener_socket(sock) - - @abstractmethod - async def accept(self) -> SocketStream: - """Accept an incoming connection.""" - - async def serve( - self, - handler: Callable[[SocketStream], Any], - task_group: TaskGroup | None = None, - ) -> None: - from .. import create_task_group - - async with AsyncExitStack() as stack: - if task_group is None: - task_group = await stack.enter_async_context(create_task_group()) - - while True: - stream = await self.accept() - task_group.start_soon(handler, stream) - - -class UDPSocket(UnreliableObjectStream[UDPPacketType], _SocketProvider): - """ - Represents an unconnected UDP socket. - - Supports all relevant extra attributes from :class:`~SocketAttribute`. - """ - - @classmethod - async def from_socket(cls, sock_or_fd: socket.socket | int) -> UDPSocket: - """ - Wrap an existing socket object or file descriptor as a UDP socket. - - The newly created socket wrapper takes ownership of the socket being passed in. - The existing socket must be bound to a local address. - - :param sock_or_fd: a socket object or file descriptor - :return: a UDP socket - - """ - sock = _validate_socket(sock_or_fd, socket.SOCK_DGRAM, require_bound=True) - return await get_async_backend().wrap_udp_socket(sock) - - async def sendto(self, data: bytes, host: str, port: int) -> None: - """ - Alias for :meth:`~.UnreliableObjectSendStream.send` ((data, (host, port))). - - """ - return await self.send((data, (host, port))) - - -class ConnectedUDPSocket(UnreliableObjectStream[bytes], _SocketProvider): - """ - Represents an connected UDP socket. - - Supports all relevant extra attributes from :class:`~SocketAttribute`. - """ - - @classmethod - async def from_socket(cls, sock_or_fd: socket.socket | int) -> ConnectedUDPSocket: - """ - Wrap an existing socket object or file descriptor as a connected UDP socket. - - The newly created socket wrapper takes ownership of the socket being passed in. - The existing socket must already be connected. - - :param sock_or_fd: a socket object or file descriptor - :return: a connected UDP socket - - """ - sock = _validate_socket( - sock_or_fd, - socket.SOCK_DGRAM, - require_connected=True, - ) - return await get_async_backend().wrap_connected_udp_socket(sock) - - -class UNIXDatagramSocket( - UnreliableObjectStream[UNIXDatagramPacketType], _SocketProvider -): - """ - Represents an unconnected Unix datagram socket. - - Supports all relevant extra attributes from :class:`~SocketAttribute`. - """ - - @classmethod - async def from_socket( - cls, - sock_or_fd: socket.socket | int, - ) -> UNIXDatagramSocket: - """ - Wrap an existing socket object or file descriptor as a UNIX datagram - socket. - - The newly created socket wrapper takes ownership of the socket being passed in. - - :param sock_or_fd: a socket object or file descriptor - :return: a UNIX datagram socket - - """ - sock = _validate_socket(sock_or_fd, socket.SOCK_DGRAM, socket.AF_UNIX) - return await get_async_backend().wrap_unix_datagram_socket(sock) - - async def sendto(self, data: bytes, path: str) -> None: - """Alias for :meth:`~.UnreliableObjectSendStream.send` ((data, path)).""" - return await self.send((data, path)) - - -class ConnectedUNIXDatagramSocket(UnreliableObjectStream[bytes], _SocketProvider): - """ - Represents a connected Unix datagram socket. - - Supports all relevant extra attributes from :class:`~SocketAttribute`. - """ - - @classmethod - async def from_socket( - cls, - sock_or_fd: socket.socket | int, - ) -> ConnectedUNIXDatagramSocket: - """ - Wrap an existing socket object or file descriptor as a connected UNIX datagram - socket. - - The newly created socket wrapper takes ownership of the socket being passed in. - The existing socket must already be connected. - - :param sock_or_fd: a socket object or file descriptor - :return: a connected UNIX datagram socket - - """ - sock = _validate_socket( - sock_or_fd, socket.SOCK_DGRAM, socket.AF_UNIX, require_connected=True - ) - return await get_async_backend().wrap_connected_unix_datagram_socket(sock) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_streams.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/_streams.py deleted file mode 100644 index 369df3f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_streams.py +++ /dev/null @@ -1,239 +0,0 @@ -from __future__ import annotations - -import sys -from abc import ABCMeta, abstractmethod -from collections.abc import Callable -from typing import Any, Generic, TypeVar, Union - -from .._core._exceptions import EndOfStream -from .._core._typedattr import TypedAttributeProvider -from ._resources import AsyncResource -from ._tasks import TaskGroup - -if sys.version_info >= (3, 10): - from typing import TypeAlias -else: - from typing_extensions import TypeAlias - -T_Item = TypeVar("T_Item") -T_co = TypeVar("T_co", covariant=True) -T_contra = TypeVar("T_contra", contravariant=True) - - -class UnreliableObjectReceiveStream( - Generic[T_co], AsyncResource, TypedAttributeProvider -): - """ - An interface for receiving objects. - - This interface makes no guarantees that the received messages arrive in the order in - which they were sent, or that no messages are missed. - - Asynchronously iterating over objects of this type will yield objects matching the - given type parameter. - """ - - def __aiter__(self) -> UnreliableObjectReceiveStream[T_co]: - return self - - async def __anext__(self) -> T_co: - try: - return await self.receive() - except EndOfStream: - raise StopAsyncIteration from None - - @abstractmethod - async def receive(self) -> T_co: - """ - Receive the next item. - - :raises ~anyio.ClosedResourceError: if the receive stream has been explicitly - closed - :raises ~anyio.EndOfStream: if this stream has been closed from the other end - :raises ~anyio.BrokenResourceError: if this stream has been rendered unusable - due to external causes - """ - - -class UnreliableObjectSendStream( - Generic[T_contra], AsyncResource, TypedAttributeProvider -): - """ - An interface for sending objects. - - This interface makes no guarantees that the messages sent will reach the - recipient(s) in the same order in which they were sent, or at all. - """ - - @abstractmethod - async def send(self, item: T_contra) -> None: - """ - Send an item to the peer(s). - - :param item: the item to send - :raises ~anyio.ClosedResourceError: if the send stream has been explicitly - closed - :raises ~anyio.BrokenResourceError: if this stream has been rendered unusable - due to external causes - """ - - -class UnreliableObjectStream( - UnreliableObjectReceiveStream[T_Item], UnreliableObjectSendStream[T_Item] -): - """ - A bidirectional message stream which does not guarantee the order or reliability of - message delivery. - """ - - -class ObjectReceiveStream(UnreliableObjectReceiveStream[T_co]): - """ - A receive message stream which guarantees that messages are received in the same - order in which they were sent, and that no messages are missed. - """ - - -class ObjectSendStream(UnreliableObjectSendStream[T_contra]): - """ - A send message stream which guarantees that messages are delivered in the same order - in which they were sent, without missing any messages in the middle. - """ - - -class ObjectStream( - ObjectReceiveStream[T_Item], - ObjectSendStream[T_Item], - UnreliableObjectStream[T_Item], -): - """ - A bidirectional message stream which guarantees the order and reliability of message - delivery. - """ - - @abstractmethod - async def send_eof(self) -> None: - """ - Send an end-of-file indication to the peer. - - You should not try to send any further data to this stream after calling this - method. This method is idempotent (does nothing on successive calls). - """ - - -class ByteReceiveStream(AsyncResource, TypedAttributeProvider): - """ - An interface for receiving bytes from a single peer. - - Iterating this byte stream will yield a byte string of arbitrary length, but no more - than 65536 bytes. - """ - - def __aiter__(self) -> ByteReceiveStream: - return self - - async def __anext__(self) -> bytes: - try: - return await self.receive() - except EndOfStream: - raise StopAsyncIteration from None - - @abstractmethod - async def receive(self, max_bytes: int = 65536) -> bytes: - """ - Receive at most ``max_bytes`` bytes from the peer. - - .. note:: Implementers of this interface should not return an empty - :class:`bytes` object, and users should ignore them. - - :param max_bytes: maximum number of bytes to receive - :return: the received bytes - :raises ~anyio.EndOfStream: if this stream has been closed from the other end - """ - - -class ByteSendStream(AsyncResource, TypedAttributeProvider): - """An interface for sending bytes to a single peer.""" - - @abstractmethod - async def send(self, item: bytes) -> None: - """ - Send the given bytes to the peer. - - :param item: the bytes to send - """ - - -class ByteStream(ByteReceiveStream, ByteSendStream): - """A bidirectional byte stream.""" - - @abstractmethod - async def send_eof(self) -> None: - """ - Send an end-of-file indication to the peer. - - You should not try to send any further data to this stream after calling this - method. This method is idempotent (does nothing on successive calls). - """ - - -#: Type alias for all unreliable bytes-oriented receive streams. -AnyUnreliableByteReceiveStream: TypeAlias = Union[ - UnreliableObjectReceiveStream[bytes], ByteReceiveStream -] -#: Type alias for all unreliable bytes-oriented send streams. -AnyUnreliableByteSendStream: TypeAlias = Union[ - UnreliableObjectSendStream[bytes], ByteSendStream -] -#: Type alias for all unreliable bytes-oriented streams. -AnyUnreliableByteStream: TypeAlias = Union[UnreliableObjectStream[bytes], ByteStream] -#: Type alias for all bytes-oriented receive streams. -AnyByteReceiveStream: TypeAlias = Union[ObjectReceiveStream[bytes], ByteReceiveStream] -#: Type alias for all bytes-oriented send streams. -AnyByteSendStream: TypeAlias = Union[ObjectSendStream[bytes], ByteSendStream] -#: Type alias for all bytes-oriented streams. -AnyByteStream: TypeAlias = Union[ObjectStream[bytes], ByteStream] - - -class Listener(Generic[T_co], AsyncResource, TypedAttributeProvider): - """An interface for objects that let you accept incoming connections.""" - - @abstractmethod - async def serve( - self, handler: Callable[[T_co], Any], task_group: TaskGroup | None = None - ) -> None: - """ - Accept incoming connections as they come in and start tasks to handle them. - - :param handler: a callable that will be used to handle each accepted connection - :param task_group: the task group that will be used to start tasks for handling - each accepted connection (if omitted, an ad-hoc task group will be created) - """ - - -class ObjectStreamConnectable(Generic[T_co], metaclass=ABCMeta): - @abstractmethod - async def connect(self) -> ObjectStream[T_co]: - """ - Connect to the remote endpoint. - - :return: an object stream connected to the remote end - :raises ConnectionFailed: if the connection fails - """ - - -class ByteStreamConnectable(metaclass=ABCMeta): - @abstractmethod - async def connect(self) -> ByteStream: - """ - Connect to the remote endpoint. - - :return: a bytestream connected to the remote end - :raises ConnectionFailed: if the connection fails - """ - - -#: Type alias for all connectables returning bytestreams or bytes-oriented object streams -AnyByteStreamConnectable: TypeAlias = Union[ - ObjectStreamConnectable[bytes], ByteStreamConnectable -] diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_subprocesses.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/_subprocesses.py deleted file mode 100644 index ce0564c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_subprocesses.py +++ /dev/null @@ -1,79 +0,0 @@ -from __future__ import annotations - -from abc import abstractmethod -from signal import Signals - -from ._resources import AsyncResource -from ._streams import ByteReceiveStream, ByteSendStream - - -class Process(AsyncResource): - """An asynchronous version of :class:`subprocess.Popen`.""" - - @abstractmethod - async def wait(self) -> int: - """ - Wait until the process exits. - - :return: the exit code of the process - """ - - @abstractmethod - def terminate(self) -> None: - """ - Terminates the process, gracefully if possible. - - On Windows, this calls ``TerminateProcess()``. - On POSIX systems, this sends ``SIGTERM`` to the process. - - .. seealso:: :meth:`subprocess.Popen.terminate` - """ - - @abstractmethod - def kill(self) -> None: - """ - Kills the process. - - On Windows, this calls ``TerminateProcess()``. - On POSIX systems, this sends ``SIGKILL`` to the process. - - .. seealso:: :meth:`subprocess.Popen.kill` - """ - - @abstractmethod - def send_signal(self, signal: Signals) -> None: - """ - Send a signal to the subprocess. - - .. seealso:: :meth:`subprocess.Popen.send_signal` - - :param signal: the signal number (e.g. :data:`signal.SIGHUP`) - """ - - @property - @abstractmethod - def pid(self) -> int: - """The process ID of the process.""" - - @property - @abstractmethod - def returncode(self) -> int | None: - """ - The return code of the process. If the process has not yet terminated, this will - be ``None``. - """ - - @property - @abstractmethod - def stdin(self) -> ByteSendStream | None: - """The stream for the standard input of the process.""" - - @property - @abstractmethod - def stdout(self) -> ByteReceiveStream | None: - """The stream for the standard output of the process.""" - - @property - @abstractmethod - def stderr(self) -> ByteReceiveStream | None: - """The stream for the standard error output of the process.""" diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_tasks.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/_tasks.py deleted file mode 100644 index b4ebff9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_tasks.py +++ /dev/null @@ -1,112 +0,0 @@ -from __future__ import annotations - -import sys -from abc import ABCMeta, abstractmethod -from collections.abc import Awaitable, Callable -from types import TracebackType -from typing import TYPE_CHECKING, Any, Protocol, TypeVar, overload - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -if TYPE_CHECKING: - from .._core._tasks import CancelScope - -T_Retval = TypeVar("T_Retval") -T_contra = TypeVar("T_contra", contravariant=True) -PosArgsT = TypeVarTuple("PosArgsT") - - -class TaskStatus(Protocol[T_contra]): - @overload - def started(self: TaskStatus[None]) -> None: ... - - @overload - def started(self, value: T_contra) -> None: ... - - def started(self, value: T_contra | None = None) -> None: - """ - Signal that the task has started. - - :param value: object passed back to the starter of the task - """ - - -class TaskGroup(metaclass=ABCMeta): - """ - Groups several asynchronous tasks together. - - :ivar cancel_scope: the cancel scope inherited by all child tasks - :vartype cancel_scope: CancelScope - - .. note:: On asyncio, support for eager task factories is considered to be - **experimental**. In particular, they don't follow the usual semantics of new - tasks being scheduled on the next iteration of the event loop, and may thus - cause unexpected behavior in code that wasn't written with such semantics in - mind. - """ - - cancel_scope: CancelScope - - @abstractmethod - def start_soon( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[Any]], - *args: Unpack[PosArgsT], - name: object = None, - ) -> None: - """ - Start a new task in this task group. - - :param func: a coroutine function - :param args: positional arguments to call the function with - :param name: name of the task, for the purposes of introspection and debugging - - .. versionadded:: 3.0 - """ - - @abstractmethod - async def start( - self, - func: Callable[..., Awaitable[Any]], - *args: object, - name: object = None, - ) -> Any: - """ - Start a new task and wait until it signals for readiness. - - The target callable must accept a keyword argument ``task_status`` (of type - :class:`TaskStatus`). Awaiting on this method will return whatever was passed to - ``task_status.started()`` (``None`` by default). - - .. note:: The :class:`TaskStatus` class is generic, and the type argument should - indicate the type of the value that will be passed to - ``task_status.started()``. - - :param func: a coroutine function that accepts the ``task_status`` keyword - argument - :param args: positional arguments to call the function with - :param name: an optional name for the task, for introspection and debugging - :return: the value passed to ``task_status.started()`` - :raises RuntimeError: if the task finishes without calling - ``task_status.started()`` - - .. seealso:: :ref:`start_initialize` - - .. versionadded:: 3.0 - """ - - @abstractmethod - async def __aenter__(self) -> TaskGroup: - """Enter the task group context and allow starting new tasks.""" - - @abstractmethod - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool: - """Exit the task group context waiting for all tasks to finish.""" diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_testing.py b/write-message/venv/lib/python3.10/site-packages/anyio/abc/_testing.py deleted file mode 100644 index 7c50ed7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/abc/_testing.py +++ /dev/null @@ -1,65 +0,0 @@ -from __future__ import annotations - -import types -from abc import ABCMeta, abstractmethod -from collections.abc import AsyncGenerator, Callable, Coroutine, Iterable -from typing import Any, TypeVar - -_T = TypeVar("_T") - - -class TestRunner(metaclass=ABCMeta): - """ - Encapsulates a running event loop. Every call made through this object will use the - same event loop. - """ - - def __enter__(self) -> TestRunner: - return self - - @abstractmethod - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: types.TracebackType | None, - ) -> bool | None: ... - - @abstractmethod - def run_asyncgen_fixture( - self, - fixture_func: Callable[..., AsyncGenerator[_T, Any]], - kwargs: dict[str, Any], - ) -> Iterable[_T]: - """ - Run an async generator fixture. - - :param fixture_func: the fixture function - :param kwargs: keyword arguments to call the fixture function with - :return: an iterator yielding the value yielded from the async generator - """ - - @abstractmethod - def run_fixture( - self, - fixture_func: Callable[..., Coroutine[Any, Any, _T]], - kwargs: dict[str, Any], - ) -> _T: - """ - Run an async fixture. - - :param fixture_func: the fixture function - :param kwargs: keyword arguments to call the fixture function with - :return: the return value of the fixture function - """ - - @abstractmethod - def run_test( - self, test_func: Callable[..., Coroutine[Any, Any, Any]], kwargs: dict[str, Any] - ) -> None: - """ - Run an async test function. - - :param test_func: the test function - :param kwargs: keyword arguments to call the test function with - """ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/from_thread.py b/write-message/venv/lib/python3.10/site-packages/anyio/from_thread.py deleted file mode 100644 index 288a087..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/from_thread.py +++ /dev/null @@ -1,535 +0,0 @@ -from __future__ import annotations - -import sys -from collections.abc import Awaitable, Callable, Generator -from concurrent.futures import Future -from contextlib import ( - AbstractAsyncContextManager, - AbstractContextManager, - contextmanager, -) -from dataclasses import dataclass, field -from inspect import isawaitable -from threading import Lock, Thread, current_thread, get_ident -from types import TracebackType -from typing import ( - Any, - Generic, - TypeVar, - cast, - overload, -) - -from ._core import _eventloop -from ._core._eventloop import get_async_backend, get_cancelled_exc_class, threadlocals -from ._core._synchronization import Event -from ._core._tasks import CancelScope, create_task_group -from .abc import AsyncBackend -from .abc._tasks import TaskStatus - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -T_Retval = TypeVar("T_Retval") -T_co = TypeVar("T_co", covariant=True) -PosArgsT = TypeVarTuple("PosArgsT") - - -def run( - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], *args: Unpack[PosArgsT] -) -> T_Retval: - """ - Call a coroutine function from a worker thread. - - :param func: a coroutine function - :param args: positional arguments for the callable - :return: the return value of the coroutine function - - """ - try: - async_backend = threadlocals.current_async_backend - token = threadlocals.current_token - except AttributeError: - raise RuntimeError( - "This function can only be run from an AnyIO worker thread" - ) from None - - return async_backend.run_async_from_thread(func, args, token=token) - - -def run_sync( - func: Callable[[Unpack[PosArgsT]], T_Retval], *args: Unpack[PosArgsT] -) -> T_Retval: - """ - Call a function in the event loop thread from a worker thread. - - :param func: a callable - :param args: positional arguments for the callable - :return: the return value of the callable - - """ - try: - async_backend = threadlocals.current_async_backend - token = threadlocals.current_token - except AttributeError: - raise RuntimeError( - "This function can only be run from an AnyIO worker thread" - ) from None - - return async_backend.run_sync_from_thread(func, args, token=token) - - -class _BlockingAsyncContextManager(Generic[T_co], AbstractContextManager): - _enter_future: Future[T_co] - _exit_future: Future[bool | None] - _exit_event: Event - _exit_exc_info: tuple[ - type[BaseException] | None, BaseException | None, TracebackType | None - ] = (None, None, None) - - def __init__( - self, async_cm: AbstractAsyncContextManager[T_co], portal: BlockingPortal - ): - self._async_cm = async_cm - self._portal = portal - - async def run_async_cm(self) -> bool | None: - try: - self._exit_event = Event() - value = await self._async_cm.__aenter__() - except BaseException as exc: - self._enter_future.set_exception(exc) - raise - else: - self._enter_future.set_result(value) - - try: - # Wait for the sync context manager to exit. - # This next statement can raise `get_cancelled_exc_class()` if - # something went wrong in a task group in this async context - # manager. - await self._exit_event.wait() - finally: - # In case of cancellation, it could be that we end up here before - # `_BlockingAsyncContextManager.__exit__` is called, and an - # `_exit_exc_info` has been set. - result = await self._async_cm.__aexit__(*self._exit_exc_info) - - return result - - def __enter__(self) -> T_co: - self._enter_future = Future() - self._exit_future = self._portal.start_task_soon(self.run_async_cm) - return self._enter_future.result() - - def __exit__( - self, - __exc_type: type[BaseException] | None, - __exc_value: BaseException | None, - __traceback: TracebackType | None, - ) -> bool | None: - self._exit_exc_info = __exc_type, __exc_value, __traceback - self._portal.call(self._exit_event.set) - return self._exit_future.result() - - -class _BlockingPortalTaskStatus(TaskStatus): - def __init__(self, future: Future): - self._future = future - - def started(self, value: object = None) -> None: - self._future.set_result(value) - - -class BlockingPortal: - """An object that lets external threads run code in an asynchronous event loop.""" - - def __new__(cls) -> BlockingPortal: - return get_async_backend().create_blocking_portal() - - def __init__(self) -> None: - self._event_loop_thread_id: int | None = get_ident() - self._stop_event = Event() - self._task_group = create_task_group() - self._cancelled_exc_class = get_cancelled_exc_class() - - async def __aenter__(self) -> BlockingPortal: - await self._task_group.__aenter__() - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> bool: - await self.stop() - return await self._task_group.__aexit__(exc_type, exc_val, exc_tb) - - def _check_running(self) -> None: - if self._event_loop_thread_id is None: - raise RuntimeError("This portal is not running") - if self._event_loop_thread_id == get_ident(): - raise RuntimeError( - "This method cannot be called from the event loop thread" - ) - - async def sleep_until_stopped(self) -> None: - """Sleep until :meth:`stop` is called.""" - await self._stop_event.wait() - - async def stop(self, cancel_remaining: bool = False) -> None: - """ - Signal the portal to shut down. - - This marks the portal as no longer accepting new calls and exits from - :meth:`sleep_until_stopped`. - - :param cancel_remaining: ``True`` to cancel all the remaining tasks, ``False`` - to let them finish before returning - - """ - self._event_loop_thread_id = None - self._stop_event.set() - if cancel_remaining: - self._task_group.cancel_scope.cancel() - - async def _call_func( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval], - args: tuple[Unpack[PosArgsT]], - kwargs: dict[str, Any], - future: Future[T_Retval], - ) -> None: - def callback(f: Future[T_Retval]) -> None: - if f.cancelled() and self._event_loop_thread_id not in ( - None, - get_ident(), - ): - self.call(scope.cancel) - - try: - retval_or_awaitable = func(*args, **kwargs) - if isawaitable(retval_or_awaitable): - with CancelScope() as scope: - if future.cancelled(): - scope.cancel() - else: - future.add_done_callback(callback) - - retval = await retval_or_awaitable - else: - retval = retval_or_awaitable - except self._cancelled_exc_class: - future.cancel() - future.set_running_or_notify_cancel() - except BaseException as exc: - if not future.cancelled(): - future.set_exception(exc) - - # Let base exceptions fall through - if not isinstance(exc, Exception): - raise - else: - if not future.cancelled(): - future.set_result(retval) - finally: - scope = None # type: ignore[assignment] - - def _spawn_task_from_thread( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval], - args: tuple[Unpack[PosArgsT]], - kwargs: dict[str, Any], - name: object, - future: Future[T_Retval], - ) -> None: - """ - Spawn a new task using the given callable. - - Implementers must ensure that the future is resolved when the task finishes. - - :param func: a callable - :param args: positional arguments to be passed to the callable - :param kwargs: keyword arguments to be passed to the callable - :param name: name of the task (will be coerced to a string if not ``None``) - :param future: a future that will resolve to the return value of the callable, - or the exception raised during its execution - - """ - raise NotImplementedError - - @overload - def call( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - *args: Unpack[PosArgsT], - ) -> T_Retval: ... - - @overload - def call( - self, func: Callable[[Unpack[PosArgsT]], T_Retval], *args: Unpack[PosArgsT] - ) -> T_Retval: ... - - def call( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval], - *args: Unpack[PosArgsT], - ) -> T_Retval: - """ - Call the given function in the event loop thread. - - If the callable returns a coroutine object, it is awaited on. - - :param func: any callable - :raises RuntimeError: if the portal is not running or if this method is called - from within the event loop thread - - """ - return cast(T_Retval, self.start_task_soon(func, *args).result()) - - @overload - def start_task_soon( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]], - *args: Unpack[PosArgsT], - name: object = None, - ) -> Future[T_Retval]: ... - - @overload - def start_task_soon( - self, - func: Callable[[Unpack[PosArgsT]], T_Retval], - *args: Unpack[PosArgsT], - name: object = None, - ) -> Future[T_Retval]: ... - - def start_task_soon( - self, - func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval], - *args: Unpack[PosArgsT], - name: object = None, - ) -> Future[T_Retval]: - """ - Start a task in the portal's task group. - - The task will be run inside a cancel scope which can be cancelled by cancelling - the returned future. - - :param func: the target function - :param args: positional arguments passed to ``func`` - :param name: name of the task (will be coerced to a string if not ``None``) - :return: a future that resolves with the return value of the callable if the - task completes successfully, or with the exception raised in the task - :raises RuntimeError: if the portal is not running or if this method is called - from within the event loop thread - :rtype: concurrent.futures.Future[T_Retval] - - .. versionadded:: 3.0 - - """ - self._check_running() - f: Future[T_Retval] = Future() - self._spawn_task_from_thread(func, args, {}, name, f) - return f - - def start_task( - self, - func: Callable[..., Awaitable[T_Retval]], - *args: object, - name: object = None, - ) -> tuple[Future[T_Retval], Any]: - """ - Start a task in the portal's task group and wait until it signals for readiness. - - This method works the same way as :meth:`.abc.TaskGroup.start`. - - :param func: the target function - :param args: positional arguments passed to ``func`` - :param name: name of the task (will be coerced to a string if not ``None``) - :return: a tuple of (future, task_status_value) where the ``task_status_value`` - is the value passed to ``task_status.started()`` from within the target - function - :rtype: tuple[concurrent.futures.Future[T_Retval], Any] - - .. versionadded:: 3.0 - - """ - - def task_done(future: Future[T_Retval]) -> None: - if not task_status_future.done(): - if future.cancelled(): - task_status_future.cancel() - elif future.exception(): - task_status_future.set_exception(future.exception()) - else: - exc = RuntimeError( - "Task exited without calling task_status.started()" - ) - task_status_future.set_exception(exc) - - self._check_running() - task_status_future: Future = Future() - task_status = _BlockingPortalTaskStatus(task_status_future) - f: Future = Future() - f.add_done_callback(task_done) - self._spawn_task_from_thread(func, args, {"task_status": task_status}, name, f) - return f, task_status_future.result() - - def wrap_async_context_manager( - self, cm: AbstractAsyncContextManager[T_co] - ) -> AbstractContextManager[T_co]: - """ - Wrap an async context manager as a synchronous context manager via this portal. - - Spawns a task that will call both ``__aenter__()`` and ``__aexit__()``, stopping - in the middle until the synchronous context manager exits. - - :param cm: an asynchronous context manager - :return: a synchronous context manager - - .. versionadded:: 2.1 - - """ - return _BlockingAsyncContextManager(cm, self) - - -@dataclass -class BlockingPortalProvider: - """ - A manager for a blocking portal. Used as a context manager. The first thread to - enter this context manager causes a blocking portal to be started with the specific - parameters, and the last thread to exit causes the portal to be shut down. Thus, - there will be exactly one blocking portal running in this context as long as at - least one thread has entered this context manager. - - The parameters are the same as for :func:`~anyio.run`. - - :param backend: name of the backend - :param backend_options: backend options - - .. versionadded:: 4.4 - """ - - backend: str = "asyncio" - backend_options: dict[str, Any] | None = None - _lock: Lock = field(init=False, default_factory=Lock) - _leases: int = field(init=False, default=0) - _portal: BlockingPortal = field(init=False) - _portal_cm: AbstractContextManager[BlockingPortal] | None = field( - init=False, default=None - ) - - def __enter__(self) -> BlockingPortal: - with self._lock: - if self._portal_cm is None: - self._portal_cm = start_blocking_portal( - self.backend, self.backend_options - ) - self._portal = self._portal_cm.__enter__() - - self._leases += 1 - return self._portal - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - portal_cm: AbstractContextManager[BlockingPortal] | None = None - with self._lock: - assert self._portal_cm - assert self._leases > 0 - self._leases -= 1 - if not self._leases: - portal_cm = self._portal_cm - self._portal_cm = None - del self._portal - - if portal_cm: - portal_cm.__exit__(None, None, None) - - -@contextmanager -def start_blocking_portal( - backend: str = "asyncio", - backend_options: dict[str, Any] | None = None, - *, - name: str | None = None, -) -> Generator[BlockingPortal, Any, None]: - """ - Start a new event loop in a new thread and run a blocking portal in its main task. - - The parameters are the same as for :func:`~anyio.run`. - - :param backend: name of the backend - :param backend_options: backend options - :param name: name of the thread - :return: a context manager that yields a blocking portal - - .. versionchanged:: 3.0 - Usage as a context manager is now required. - - """ - - async def run_portal() -> None: - async with BlockingPortal() as portal_: - if name is None: - current_thread().name = f"{backend}-portal-{id(portal_):x}" - - future.set_result(portal_) - await portal_.sleep_until_stopped() - - def run_blocking_portal() -> None: - if future.set_running_or_notify_cancel(): - try: - _eventloop.run( - run_portal, backend=backend, backend_options=backend_options - ) - except BaseException as exc: - if not future.done(): - future.set_exception(exc) - - future: Future[BlockingPortal] = Future() - thread = Thread(target=run_blocking_portal, daemon=True, name=name) - thread.start() - try: - cancel_remaining_tasks = False - portal = future.result() - try: - yield portal - except BaseException: - cancel_remaining_tasks = True - raise - finally: - try: - portal.call(portal.stop, cancel_remaining_tasks) - except RuntimeError: - pass - finally: - thread.join() - - -def check_cancelled() -> None: - """ - Check if the cancel scope of the host task's running the current worker thread has - been cancelled. - - If the host task's current cancel scope has indeed been cancelled, the - backend-specific cancellation exception will be raised. - - :raises RuntimeError: if the current thread was not spawned by - :func:`.to_thread.run_sync` - - """ - try: - async_backend: AsyncBackend = threadlocals.current_async_backend - except AttributeError: - raise RuntimeError( - "This function can only be run from an AnyIO worker thread" - ) from None - - async_backend.check_cancelled() diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/lowlevel.py b/write-message/venv/lib/python3.10/site-packages/anyio/lowlevel.py deleted file mode 100644 index a3f6f01..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/lowlevel.py +++ /dev/null @@ -1,161 +0,0 @@ -from __future__ import annotations - -import enum -from dataclasses import dataclass -from typing import Any, Generic, Literal, TypeVar, overload -from weakref import WeakKeyDictionary - -from ._core._eventloop import get_async_backend - -T = TypeVar("T") -D = TypeVar("D") - - -async def checkpoint() -> None: - """ - Check for cancellation and allow the scheduler to switch to another task. - - Equivalent to (but more efficient than):: - - await checkpoint_if_cancelled() - await cancel_shielded_checkpoint() - - - .. versionadded:: 3.0 - - """ - await get_async_backend().checkpoint() - - -async def checkpoint_if_cancelled() -> None: - """ - Enter a checkpoint if the enclosing cancel scope has been cancelled. - - This does not allow the scheduler to switch to a different task. - - .. versionadded:: 3.0 - - """ - await get_async_backend().checkpoint_if_cancelled() - - -async def cancel_shielded_checkpoint() -> None: - """ - Allow the scheduler to switch to another task but without checking for cancellation. - - Equivalent to (but potentially more efficient than):: - - with CancelScope(shield=True): - await checkpoint() - - - .. versionadded:: 3.0 - - """ - await get_async_backend().cancel_shielded_checkpoint() - - -def current_token() -> object: - """ - Return a backend specific token object that can be used to get back to the event - loop. - - """ - return get_async_backend().current_token() - - -_run_vars: WeakKeyDictionary[Any, dict[RunVar[Any], Any]] = WeakKeyDictionary() -_token_wrappers: dict[Any, _TokenWrapper] = {} - - -@dataclass(frozen=True) -class _TokenWrapper: - __slots__ = "_token", "__weakref__" - _token: object - - -class _NoValueSet(enum.Enum): - NO_VALUE_SET = enum.auto() - - -class RunvarToken(Generic[T]): - __slots__ = "_var", "_value", "_redeemed" - - def __init__(self, var: RunVar[T], value: T | Literal[_NoValueSet.NO_VALUE_SET]): - self._var = var - self._value: T | Literal[_NoValueSet.NO_VALUE_SET] = value - self._redeemed = False - - -class RunVar(Generic[T]): - """ - Like a :class:`~contextvars.ContextVar`, except scoped to the running event loop. - """ - - __slots__ = "_name", "_default" - - NO_VALUE_SET: Literal[_NoValueSet.NO_VALUE_SET] = _NoValueSet.NO_VALUE_SET - - _token_wrappers: set[_TokenWrapper] = set() - - def __init__( - self, name: str, default: T | Literal[_NoValueSet.NO_VALUE_SET] = NO_VALUE_SET - ): - self._name = name - self._default = default - - @property - def _current_vars(self) -> dict[RunVar[T], T]: - token = current_token() - try: - return _run_vars[token] - except KeyError: - run_vars = _run_vars[token] = {} - return run_vars - - @overload - def get(self, default: D) -> T | D: ... - - @overload - def get(self) -> T: ... - - def get( - self, default: D | Literal[_NoValueSet.NO_VALUE_SET] = NO_VALUE_SET - ) -> T | D: - try: - return self._current_vars[self] - except KeyError: - if default is not RunVar.NO_VALUE_SET: - return default - elif self._default is not RunVar.NO_VALUE_SET: - return self._default - - raise LookupError( - f'Run variable "{self._name}" has no value and no default set' - ) - - def set(self, value: T) -> RunvarToken[T]: - current_vars = self._current_vars - token = RunvarToken(self, current_vars.get(self, RunVar.NO_VALUE_SET)) - current_vars[self] = value - return token - - def reset(self, token: RunvarToken[T]) -> None: - if token._var is not self: - raise ValueError("This token does not belong to this RunVar") - - if token._redeemed: - raise ValueError("This token has already been used") - - if token._value is _NoValueSet.NO_VALUE_SET: - try: - del self._current_vars[self] - except KeyError: - pass - else: - self._current_vars[self] = token._value - - token._redeemed = True - - def __repr__(self) -> str: - return f"" diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/py.typed b/write-message/venv/lib/python3.10/site-packages/anyio/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/pytest_plugin.py b/write-message/venv/lib/python3.10/site-packages/anyio/pytest_plugin.py deleted file mode 100644 index 21e4ab2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/pytest_plugin.py +++ /dev/null @@ -1,272 +0,0 @@ -from __future__ import annotations - -import socket -import sys -from collections.abc import Callable, Generator, Iterator -from contextlib import ExitStack, contextmanager -from inspect import isasyncgenfunction, iscoroutinefunction, ismethod -from typing import Any, cast - -import pytest -import sniffio -from _pytest.fixtures import SubRequest -from _pytest.outcomes import Exit - -from ._core._eventloop import get_all_backends, get_async_backend -from ._core._exceptions import iterate_exceptions -from .abc import TestRunner - -if sys.version_info < (3, 11): - from exceptiongroup import ExceptionGroup - -_current_runner: TestRunner | None = None -_runner_stack: ExitStack | None = None -_runner_leases = 0 - - -def extract_backend_and_options(backend: object) -> tuple[str, dict[str, Any]]: - if isinstance(backend, str): - return backend, {} - elif isinstance(backend, tuple) and len(backend) == 2: - if isinstance(backend[0], str) and isinstance(backend[1], dict): - return cast(tuple[str, dict[str, Any]], backend) - - raise TypeError("anyio_backend must be either a string or tuple of (string, dict)") - - -@contextmanager -def get_runner( - backend_name: str, backend_options: dict[str, Any] -) -> Iterator[TestRunner]: - global _current_runner, _runner_leases, _runner_stack - if _current_runner is None: - asynclib = get_async_backend(backend_name) - _runner_stack = ExitStack() - if sniffio.current_async_library_cvar.get(None) is None: - # Since we're in control of the event loop, we can cache the name of the - # async library - token = sniffio.current_async_library_cvar.set(backend_name) - _runner_stack.callback(sniffio.current_async_library_cvar.reset, token) - - backend_options = backend_options or {} - _current_runner = _runner_stack.enter_context( - asynclib.create_test_runner(backend_options) - ) - - _runner_leases += 1 - try: - yield _current_runner - finally: - _runner_leases -= 1 - if not _runner_leases: - assert _runner_stack is not None - _runner_stack.close() - _runner_stack = _current_runner = None - - -def pytest_configure(config: Any) -> None: - config.addinivalue_line( - "markers", - "anyio: mark the (coroutine function) test to be run asynchronously via anyio.", - ) - - -@pytest.hookimpl(hookwrapper=True) -def pytest_fixture_setup(fixturedef: Any, request: Any) -> Generator[Any]: - def wrapper( - *args: Any, anyio_backend: Any, request: SubRequest, **kwargs: Any - ) -> Any: - # Rebind any fixture methods to the request instance - if ( - request.instance - and ismethod(func) - and type(func.__self__) is type(request.instance) - ): - local_func = func.__func__.__get__(request.instance) - else: - local_func = func - - backend_name, backend_options = extract_backend_and_options(anyio_backend) - if has_backend_arg: - kwargs["anyio_backend"] = anyio_backend - - if has_request_arg: - kwargs["request"] = request - - with get_runner(backend_name, backend_options) as runner: - if isasyncgenfunction(local_func): - yield from runner.run_asyncgen_fixture(local_func, kwargs) - else: - yield runner.run_fixture(local_func, kwargs) - - # Only apply this to coroutine functions and async generator functions in requests - # that involve the anyio_backend fixture - func = fixturedef.func - if isasyncgenfunction(func) or iscoroutinefunction(func): - if "anyio_backend" in request.fixturenames: - fixturedef.func = wrapper - original_argname = fixturedef.argnames - - if not (has_backend_arg := "anyio_backend" in fixturedef.argnames): - fixturedef.argnames += ("anyio_backend",) - - if not (has_request_arg := "request" in fixturedef.argnames): - fixturedef.argnames += ("request",) - - try: - return (yield) - finally: - fixturedef.func = func - fixturedef.argnames = original_argname - - return (yield) - - -@pytest.hookimpl(tryfirst=True) -def pytest_pycollect_makeitem(collector: Any, name: Any, obj: Any) -> None: - if collector.istestfunction(obj, name): - inner_func = obj.hypothesis.inner_test if hasattr(obj, "hypothesis") else obj - if iscoroutinefunction(inner_func): - marker = collector.get_closest_marker("anyio") - own_markers = getattr(obj, "pytestmark", ()) - if marker or any(marker.name == "anyio" for marker in own_markers): - pytest.mark.usefixtures("anyio_backend")(obj) - - -@pytest.hookimpl(tryfirst=True) -def pytest_pyfunc_call(pyfuncitem: Any) -> bool | None: - def run_with_hypothesis(**kwargs: Any) -> None: - with get_runner(backend_name, backend_options) as runner: - runner.run_test(original_func, kwargs) - - backend = pyfuncitem.funcargs.get("anyio_backend") - if backend: - backend_name, backend_options = extract_backend_and_options(backend) - - if hasattr(pyfuncitem.obj, "hypothesis"): - # Wrap the inner test function unless it's already wrapped - original_func = pyfuncitem.obj.hypothesis.inner_test - if original_func.__qualname__ != run_with_hypothesis.__qualname__: - if iscoroutinefunction(original_func): - pyfuncitem.obj.hypothesis.inner_test = run_with_hypothesis - - return None - - if iscoroutinefunction(pyfuncitem.obj): - funcargs = pyfuncitem.funcargs - testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames} - with get_runner(backend_name, backend_options) as runner: - try: - runner.run_test(pyfuncitem.obj, testargs) - except ExceptionGroup as excgrp: - for exc in iterate_exceptions(excgrp): - if isinstance(exc, (Exit, KeyboardInterrupt, SystemExit)): - raise exc from excgrp - - raise - - return True - - return None - - -@pytest.fixture(scope="module", params=get_all_backends()) -def anyio_backend(request: Any) -> Any: - return request.param - - -@pytest.fixture -def anyio_backend_name(anyio_backend: Any) -> str: - if isinstance(anyio_backend, str): - return anyio_backend - else: - return anyio_backend[0] - - -@pytest.fixture -def anyio_backend_options(anyio_backend: Any) -> dict[str, Any]: - if isinstance(anyio_backend, str): - return {} - else: - return anyio_backend[1] - - -class FreePortFactory: - """ - Manages port generation based on specified socket kind, ensuring no duplicate - ports are generated. - - This class provides functionality for generating available free ports on the - system. It is initialized with a specific socket kind and can generate ports - for given address families while avoiding reuse of previously generated ports. - - Users should not instantiate this class directly, but use the - ``free_tcp_port_factory`` and ``free_udp_port_factory`` fixtures instead. For simple - uses cases, ``free_tcp_port`` and ``free_udp_port`` can be used instead. - """ - - def __init__(self, kind: socket.SocketKind) -> None: - self._kind = kind - self._generated = set[int]() - - @property - def kind(self) -> socket.SocketKind: - """ - The type of socket connection (e.g., :data:`~socket.SOCK_STREAM` or - :data:`~socket.SOCK_DGRAM`) used to bind for checking port availability - - """ - return self._kind - - def __call__(self, family: socket.AddressFamily | None = None) -> int: - """ - Return an unbound port for the given address family. - - :param family: if omitted, both IPv4 and IPv6 addresses will be tried - :return: a port number - - """ - if family is not None: - families = [family] - else: - families = [socket.AF_INET] - if socket.has_ipv6: - families.append(socket.AF_INET6) - - while True: - port = 0 - with ExitStack() as stack: - for family in families: - sock = stack.enter_context(socket.socket(family, self._kind)) - addr = "::1" if family == socket.AF_INET6 else "127.0.0.1" - try: - sock.bind((addr, port)) - except OSError: - break - - if not port: - port = sock.getsockname()[1] - else: - if port not in self._generated: - self._generated.add(port) - return port - - -@pytest.fixture(scope="session") -def free_tcp_port_factory() -> FreePortFactory: - return FreePortFactory(socket.SOCK_STREAM) - - -@pytest.fixture(scope="session") -def free_udp_port_factory() -> FreePortFactory: - return FreePortFactory(socket.SOCK_DGRAM) - - -@pytest.fixture -def free_tcp_port(free_tcp_port_factory: Callable[[], int]) -> int: - return free_tcp_port_factory() - - -@pytest.fixture -def free_udp_port(free_udp_port_factory: Callable[[], int]) -> int: - return free_udp_port_factory() diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__init__.py b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 1d67c54..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/buffered.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/buffered.cpython-310.pyc deleted file mode 100644 index 1c5bdd8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/buffered.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/file.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/file.cpython-310.pyc deleted file mode 100644 index e0c22c9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/file.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/memory.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/memory.cpython-310.pyc deleted file mode 100644 index 1670332..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/memory.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/stapled.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/stapled.cpython-310.pyc deleted file mode 100644 index 3122355..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/stapled.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/text.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/text.cpython-310.pyc deleted file mode 100644 index 567c1c5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/text.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/tls.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/tls.cpython-310.pyc deleted file mode 100644 index a1f586c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/anyio/streams/__pycache__/tls.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/buffered.py b/write-message/venv/lib/python3.10/site-packages/anyio/streams/buffered.py deleted file mode 100644 index ca40eae..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/streams/buffered.py +++ /dev/null @@ -1,182 +0,0 @@ -from __future__ import annotations - -import sys -from collections.abc import Callable, Iterable, Mapping -from dataclasses import dataclass, field -from typing import Any, SupportsIndex - -from .. import ClosedResourceError, DelimiterNotFound, EndOfStream, IncompleteRead -from ..abc import ( - AnyByteReceiveStream, - AnyByteStream, - AnyByteStreamConnectable, - ByteReceiveStream, - ByteStream, - ByteStreamConnectable, -) - -if sys.version_info >= (3, 12): - from typing import override -else: - from typing_extensions import override - - -@dataclass(eq=False) -class BufferedByteReceiveStream(ByteReceiveStream): - """ - Wraps any bytes-based receive stream and uses a buffer to provide sophisticated - receiving capabilities in the form of a byte stream. - """ - - receive_stream: AnyByteReceiveStream - _buffer: bytearray = field(init=False, default_factory=bytearray) - _closed: bool = field(init=False, default=False) - - async def aclose(self) -> None: - await self.receive_stream.aclose() - self._closed = True - - @property - def buffer(self) -> bytes: - """The bytes currently in the buffer.""" - return bytes(self._buffer) - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return self.receive_stream.extra_attributes - - def feed_data(self, data: Iterable[SupportsIndex], /) -> None: - """ - Append data directly into the buffer. - - Any data in the buffer will be consumed by receive operations before receiving - anything from the wrapped stream. - - :param data: the data to append to the buffer (can be bytes or anything else - that supports ``__index__()``) - - """ - self._buffer.extend(data) - - async def receive(self, max_bytes: int = 65536) -> bytes: - if self._closed: - raise ClosedResourceError - - if self._buffer: - chunk = bytes(self._buffer[:max_bytes]) - del self._buffer[:max_bytes] - return chunk - elif isinstance(self.receive_stream, ByteReceiveStream): - return await self.receive_stream.receive(max_bytes) - else: - # With a bytes-oriented object stream, we need to handle any surplus bytes - # we get from the receive() call - chunk = await self.receive_stream.receive() - if len(chunk) > max_bytes: - # Save the surplus bytes in the buffer - self._buffer.extend(chunk[max_bytes:]) - return chunk[:max_bytes] - else: - return chunk - - async def receive_exactly(self, nbytes: int) -> bytes: - """ - Read exactly the given amount of bytes from the stream. - - :param nbytes: the number of bytes to read - :return: the bytes read - :raises ~anyio.IncompleteRead: if the stream was closed before the requested - amount of bytes could be read from the stream - - """ - while True: - remaining = nbytes - len(self._buffer) - if remaining <= 0: - retval = self._buffer[:nbytes] - del self._buffer[:nbytes] - return bytes(retval) - - try: - if isinstance(self.receive_stream, ByteReceiveStream): - chunk = await self.receive_stream.receive(remaining) - else: - chunk = await self.receive_stream.receive() - except EndOfStream as exc: - raise IncompleteRead from exc - - self._buffer.extend(chunk) - - async def receive_until(self, delimiter: bytes, max_bytes: int) -> bytes: - """ - Read from the stream until the delimiter is found or max_bytes have been read. - - :param delimiter: the marker to look for in the stream - :param max_bytes: maximum number of bytes that will be read before raising - :exc:`~anyio.DelimiterNotFound` - :return: the bytes read (not including the delimiter) - :raises ~anyio.IncompleteRead: if the stream was closed before the delimiter - was found - :raises ~anyio.DelimiterNotFound: if the delimiter is not found within the - bytes read up to the maximum allowed - - """ - delimiter_size = len(delimiter) - offset = 0 - while True: - # Check if the delimiter can be found in the current buffer - index = self._buffer.find(delimiter, offset) - if index >= 0: - found = self._buffer[:index] - del self._buffer[: index + len(delimiter) :] - return bytes(found) - - # Check if the buffer is already at or over the limit - if len(self._buffer) >= max_bytes: - raise DelimiterNotFound(max_bytes) - - # Read more data into the buffer from the socket - try: - data = await self.receive_stream.receive() - except EndOfStream as exc: - raise IncompleteRead from exc - - # Move the offset forward and add the new data to the buffer - offset = max(len(self._buffer) - delimiter_size + 1, 0) - self._buffer.extend(data) - - -class BufferedByteStream(BufferedByteReceiveStream, ByteStream): - """ - A full-duplex variant of :class:`BufferedByteReceiveStream`. All writes are passed - through to the wrapped stream as-is. - """ - - def __init__(self, stream: AnyByteStream): - """ - :param stream: the stream to be wrapped - - """ - super().__init__(stream) - self._stream = stream - - @override - async def send_eof(self) -> None: - await self._stream.send_eof() - - @override - async def send(self, item: bytes) -> None: - await self._stream.send(item) - - -class BufferedConnectable(ByteStreamConnectable): - def __init__(self, connectable: AnyByteStreamConnectable): - """ - :param connectable: the connectable to wrap - - """ - self.connectable = connectable - - @override - async def connect(self) -> BufferedByteStream: - stream = await self.connectable.connect() - return BufferedByteStream(stream) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/file.py b/write-message/venv/lib/python3.10/site-packages/anyio/streams/file.py deleted file mode 100644 index f492464..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/streams/file.py +++ /dev/null @@ -1,148 +0,0 @@ -from __future__ import annotations - -from collections.abc import Callable, Mapping -from io import SEEK_SET, UnsupportedOperation -from os import PathLike -from pathlib import Path -from typing import Any, BinaryIO, cast - -from .. import ( - BrokenResourceError, - ClosedResourceError, - EndOfStream, - TypedAttributeSet, - to_thread, - typed_attribute, -) -from ..abc import ByteReceiveStream, ByteSendStream - - -class FileStreamAttribute(TypedAttributeSet): - #: the open file descriptor - file: BinaryIO = typed_attribute() - #: the path of the file on the file system, if available (file must be a real file) - path: Path = typed_attribute() - #: the file number, if available (file must be a real file or a TTY) - fileno: int = typed_attribute() - - -class _BaseFileStream: - def __init__(self, file: BinaryIO): - self._file = file - - async def aclose(self) -> None: - await to_thread.run_sync(self._file.close) - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - attributes: dict[Any, Callable[[], Any]] = { - FileStreamAttribute.file: lambda: self._file, - } - - if hasattr(self._file, "name"): - attributes[FileStreamAttribute.path] = lambda: Path(self._file.name) - - try: - self._file.fileno() - except UnsupportedOperation: - pass - else: - attributes[FileStreamAttribute.fileno] = lambda: self._file.fileno() - - return attributes - - -class FileReadStream(_BaseFileStream, ByteReceiveStream): - """ - A byte stream that reads from a file in the file system. - - :param file: a file that has been opened for reading in binary mode - - .. versionadded:: 3.0 - """ - - @classmethod - async def from_path(cls, path: str | PathLike[str]) -> FileReadStream: - """ - Create a file read stream by opening the given file. - - :param path: path of the file to read from - - """ - file = await to_thread.run_sync(Path(path).open, "rb") - return cls(cast(BinaryIO, file)) - - async def receive(self, max_bytes: int = 65536) -> bytes: - try: - data = await to_thread.run_sync(self._file.read, max_bytes) - except ValueError: - raise ClosedResourceError from None - except OSError as exc: - raise BrokenResourceError from exc - - if data: - return data - else: - raise EndOfStream - - async def seek(self, position: int, whence: int = SEEK_SET) -> int: - """ - Seek the file to the given position. - - .. seealso:: :meth:`io.IOBase.seek` - - .. note:: Not all file descriptors are seekable. - - :param position: position to seek the file to - :param whence: controls how ``position`` is interpreted - :return: the new absolute position - :raises OSError: if the file is not seekable - - """ - return await to_thread.run_sync(self._file.seek, position, whence) - - async def tell(self) -> int: - """ - Return the current stream position. - - .. note:: Not all file descriptors are seekable. - - :return: the current absolute position - :raises OSError: if the file is not seekable - - """ - return await to_thread.run_sync(self._file.tell) - - -class FileWriteStream(_BaseFileStream, ByteSendStream): - """ - A byte stream that writes to a file in the file system. - - :param file: a file that has been opened for writing in binary mode - - .. versionadded:: 3.0 - """ - - @classmethod - async def from_path( - cls, path: str | PathLike[str], append: bool = False - ) -> FileWriteStream: - """ - Create a file write stream by opening the given file for writing. - - :param path: path of the file to write to - :param append: if ``True``, open the file for appending; if ``False``, any - existing file at the given path will be truncated - - """ - mode = "ab" if append else "wb" - file = await to_thread.run_sync(Path(path).open, mode) - return cls(cast(BinaryIO, file)) - - async def send(self, item: bytes) -> None: - try: - await to_thread.run_sync(self._file.write, item) - except ValueError: - raise ClosedResourceError from None - except OSError as exc: - raise BrokenResourceError from exc diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/memory.py b/write-message/venv/lib/python3.10/site-packages/anyio/streams/memory.py deleted file mode 100644 index 9a3bac4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/streams/memory.py +++ /dev/null @@ -1,319 +0,0 @@ -from __future__ import annotations - -import warnings -from collections import OrderedDict, deque -from dataclasses import dataclass, field -from types import TracebackType -from typing import Generic, NamedTuple, TypeVar - -from .. import ( - BrokenResourceError, - ClosedResourceError, - EndOfStream, - WouldBlock, -) -from .._core._testing import TaskInfo, get_current_task -from ..abc import Event, ObjectReceiveStream, ObjectSendStream -from ..lowlevel import checkpoint - -T_Item = TypeVar("T_Item") -T_co = TypeVar("T_co", covariant=True) -T_contra = TypeVar("T_contra", contravariant=True) - - -class MemoryObjectStreamStatistics(NamedTuple): - current_buffer_used: int #: number of items stored in the buffer - #: maximum number of items that can be stored on this stream (or :data:`math.inf`) - max_buffer_size: float - open_send_streams: int #: number of unclosed clones of the send stream - open_receive_streams: int #: number of unclosed clones of the receive stream - #: number of tasks blocked on :meth:`MemoryObjectSendStream.send` - tasks_waiting_send: int - #: number of tasks blocked on :meth:`MemoryObjectReceiveStream.receive` - tasks_waiting_receive: int - - -@dataclass(eq=False) -class MemoryObjectItemReceiver(Generic[T_Item]): - task_info: TaskInfo = field(init=False, default_factory=get_current_task) - item: T_Item = field(init=False) - - def __repr__(self) -> str: - # When item is not defined, we get following error with default __repr__: - # AttributeError: 'MemoryObjectItemReceiver' object has no attribute 'item' - item = getattr(self, "item", None) - return f"{self.__class__.__name__}(task_info={self.task_info}, item={item!r})" - - -@dataclass(eq=False) -class MemoryObjectStreamState(Generic[T_Item]): - max_buffer_size: float = field() - buffer: deque[T_Item] = field(init=False, default_factory=deque) - open_send_channels: int = field(init=False, default=0) - open_receive_channels: int = field(init=False, default=0) - waiting_receivers: OrderedDict[Event, MemoryObjectItemReceiver[T_Item]] = field( - init=False, default_factory=OrderedDict - ) - waiting_senders: OrderedDict[Event, T_Item] = field( - init=False, default_factory=OrderedDict - ) - - def statistics(self) -> MemoryObjectStreamStatistics: - return MemoryObjectStreamStatistics( - len(self.buffer), - self.max_buffer_size, - self.open_send_channels, - self.open_receive_channels, - len(self.waiting_senders), - len(self.waiting_receivers), - ) - - -@dataclass(eq=False) -class MemoryObjectReceiveStream(Generic[T_co], ObjectReceiveStream[T_co]): - _state: MemoryObjectStreamState[T_co] - _closed: bool = field(init=False, default=False) - - def __post_init__(self) -> None: - self._state.open_receive_channels += 1 - - def receive_nowait(self) -> T_co: - """ - Receive the next item if it can be done without waiting. - - :return: the received item - :raises ~anyio.ClosedResourceError: if this send stream has been closed - :raises ~anyio.EndOfStream: if the buffer is empty and this stream has been - closed from the sending end - :raises ~anyio.WouldBlock: if there are no items in the buffer and no tasks - waiting to send - - """ - if self._closed: - raise ClosedResourceError - - if self._state.waiting_senders: - # Get the item from the next sender - send_event, item = self._state.waiting_senders.popitem(last=False) - self._state.buffer.append(item) - send_event.set() - - if self._state.buffer: - return self._state.buffer.popleft() - elif not self._state.open_send_channels: - raise EndOfStream - - raise WouldBlock - - async def receive(self) -> T_co: - await checkpoint() - try: - return self.receive_nowait() - except WouldBlock: - # Add ourselves in the queue - receive_event = Event() - receiver = MemoryObjectItemReceiver[T_co]() - self._state.waiting_receivers[receive_event] = receiver - - try: - await receive_event.wait() - finally: - self._state.waiting_receivers.pop(receive_event, None) - - try: - return receiver.item - except AttributeError: - raise EndOfStream from None - - def clone(self) -> MemoryObjectReceiveStream[T_co]: - """ - Create a clone of this receive stream. - - Each clone can be closed separately. Only when all clones have been closed will - the receiving end of the memory stream be considered closed by the sending ends. - - :return: the cloned stream - - """ - if self._closed: - raise ClosedResourceError - - return MemoryObjectReceiveStream(_state=self._state) - - def close(self) -> None: - """ - Close the stream. - - This works the exact same way as :meth:`aclose`, but is provided as a special - case for the benefit of synchronous callbacks. - - """ - if not self._closed: - self._closed = True - self._state.open_receive_channels -= 1 - if self._state.open_receive_channels == 0: - send_events = list(self._state.waiting_senders.keys()) - for event in send_events: - event.set() - - async def aclose(self) -> None: - self.close() - - def statistics(self) -> MemoryObjectStreamStatistics: - """ - Return statistics about the current state of this stream. - - .. versionadded:: 3.0 - """ - return self._state.statistics() - - def __enter__(self) -> MemoryObjectReceiveStream[T_co]: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self.close() - - def __del__(self) -> None: - if not self._closed: - warnings.warn( - f"Unclosed <{self.__class__.__name__} at {id(self):x}>", - ResourceWarning, - stacklevel=1, - source=self, - ) - - -@dataclass(eq=False) -class MemoryObjectSendStream(Generic[T_contra], ObjectSendStream[T_contra]): - _state: MemoryObjectStreamState[T_contra] - _closed: bool = field(init=False, default=False) - - def __post_init__(self) -> None: - self._state.open_send_channels += 1 - - def send_nowait(self, item: T_contra) -> None: - """ - Send an item immediately if it can be done without waiting. - - :param item: the item to send - :raises ~anyio.ClosedResourceError: if this send stream has been closed - :raises ~anyio.BrokenResourceError: if the stream has been closed from the - receiving end - :raises ~anyio.WouldBlock: if the buffer is full and there are no tasks waiting - to receive - - """ - if self._closed: - raise ClosedResourceError - if not self._state.open_receive_channels: - raise BrokenResourceError - - while self._state.waiting_receivers: - receive_event, receiver = self._state.waiting_receivers.popitem(last=False) - if not receiver.task_info.has_pending_cancellation(): - receiver.item = item - receive_event.set() - return - - if len(self._state.buffer) < self._state.max_buffer_size: - self._state.buffer.append(item) - else: - raise WouldBlock - - async def send(self, item: T_contra) -> None: - """ - Send an item to the stream. - - If the buffer is full, this method blocks until there is again room in the - buffer or the item can be sent directly to a receiver. - - :param item: the item to send - :raises ~anyio.ClosedResourceError: if this send stream has been closed - :raises ~anyio.BrokenResourceError: if the stream has been closed from the - receiving end - - """ - await checkpoint() - try: - self.send_nowait(item) - except WouldBlock: - # Wait until there's someone on the receiving end - send_event = Event() - self._state.waiting_senders[send_event] = item - try: - await send_event.wait() - except BaseException: - self._state.waiting_senders.pop(send_event, None) - raise - - if send_event in self._state.waiting_senders: - del self._state.waiting_senders[send_event] - raise BrokenResourceError from None - - def clone(self) -> MemoryObjectSendStream[T_contra]: - """ - Create a clone of this send stream. - - Each clone can be closed separately. Only when all clones have been closed will - the sending end of the memory stream be considered closed by the receiving ends. - - :return: the cloned stream - - """ - if self._closed: - raise ClosedResourceError - - return MemoryObjectSendStream(_state=self._state) - - def close(self) -> None: - """ - Close the stream. - - This works the exact same way as :meth:`aclose`, but is provided as a special - case for the benefit of synchronous callbacks. - - """ - if not self._closed: - self._closed = True - self._state.open_send_channels -= 1 - if self._state.open_send_channels == 0: - receive_events = list(self._state.waiting_receivers.keys()) - self._state.waiting_receivers.clear() - for event in receive_events: - event.set() - - async def aclose(self) -> None: - self.close() - - def statistics(self) -> MemoryObjectStreamStatistics: - """ - Return statistics about the current state of this stream. - - .. versionadded:: 3.0 - """ - return self._state.statistics() - - def __enter__(self) -> MemoryObjectSendStream[T_contra]: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_val: BaseException | None, - exc_tb: TracebackType | None, - ) -> None: - self.close() - - def __del__(self) -> None: - if not self._closed: - warnings.warn( - f"Unclosed <{self.__class__.__name__} at {id(self):x}>", - ResourceWarning, - stacklevel=1, - source=self, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/stapled.py b/write-message/venv/lib/python3.10/site-packages/anyio/streams/stapled.py deleted file mode 100644 index 80f64a2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/streams/stapled.py +++ /dev/null @@ -1,141 +0,0 @@ -from __future__ import annotations - -from collections.abc import Callable, Mapping, Sequence -from dataclasses import dataclass -from typing import Any, Generic, TypeVar - -from ..abc import ( - ByteReceiveStream, - ByteSendStream, - ByteStream, - Listener, - ObjectReceiveStream, - ObjectSendStream, - ObjectStream, - TaskGroup, -) - -T_Item = TypeVar("T_Item") -T_Stream = TypeVar("T_Stream") - - -@dataclass(eq=False) -class StapledByteStream(ByteStream): - """ - Combines two byte streams into a single, bidirectional byte stream. - - Extra attributes will be provided from both streams, with the receive stream - providing the values in case of a conflict. - - :param ByteSendStream send_stream: the sending byte stream - :param ByteReceiveStream receive_stream: the receiving byte stream - """ - - send_stream: ByteSendStream - receive_stream: ByteReceiveStream - - async def receive(self, max_bytes: int = 65536) -> bytes: - return await self.receive_stream.receive(max_bytes) - - async def send(self, item: bytes) -> None: - await self.send_stream.send(item) - - async def send_eof(self) -> None: - await self.send_stream.aclose() - - async def aclose(self) -> None: - await self.send_stream.aclose() - await self.receive_stream.aclose() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return { - **self.send_stream.extra_attributes, - **self.receive_stream.extra_attributes, - } - - -@dataclass(eq=False) -class StapledObjectStream(Generic[T_Item], ObjectStream[T_Item]): - """ - Combines two object streams into a single, bidirectional object stream. - - Extra attributes will be provided from both streams, with the receive stream - providing the values in case of a conflict. - - :param ObjectSendStream send_stream: the sending object stream - :param ObjectReceiveStream receive_stream: the receiving object stream - """ - - send_stream: ObjectSendStream[T_Item] - receive_stream: ObjectReceiveStream[T_Item] - - async def receive(self) -> T_Item: - return await self.receive_stream.receive() - - async def send(self, item: T_Item) -> None: - await self.send_stream.send(item) - - async def send_eof(self) -> None: - await self.send_stream.aclose() - - async def aclose(self) -> None: - await self.send_stream.aclose() - await self.receive_stream.aclose() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return { - **self.send_stream.extra_attributes, - **self.receive_stream.extra_attributes, - } - - -@dataclass(eq=False) -class MultiListener(Generic[T_Stream], Listener[T_Stream]): - """ - Combines multiple listeners into one, serving connections from all of them at once. - - Any MultiListeners in the given collection of listeners will have their listeners - moved into this one. - - Extra attributes are provided from each listener, with each successive listener - overriding any conflicting attributes from the previous one. - - :param listeners: listeners to serve - :type listeners: Sequence[Listener[T_Stream]] - """ - - listeners: Sequence[Listener[T_Stream]] - - def __post_init__(self) -> None: - listeners: list[Listener[T_Stream]] = [] - for listener in self.listeners: - if isinstance(listener, MultiListener): - listeners.extend(listener.listeners) - del listener.listeners[:] # type: ignore[attr-defined] - else: - listeners.append(listener) - - self.listeners = listeners - - async def serve( - self, handler: Callable[[T_Stream], Any], task_group: TaskGroup | None = None - ) -> None: - from .. import create_task_group - - async with create_task_group() as tg: - for listener in self.listeners: - tg.start_soon(listener.serve, handler, task_group) - - async def aclose(self) -> None: - for listener in self.listeners: - await listener.aclose() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - attributes: dict = {} - for listener in self.listeners: - attributes.update(listener.extra_attributes) - - return attributes diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/text.py b/write-message/venv/lib/python3.10/site-packages/anyio/streams/text.py deleted file mode 100644 index dfd8e7a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/streams/text.py +++ /dev/null @@ -1,169 +0,0 @@ -from __future__ import annotations - -import codecs -import sys -from collections.abc import Callable, Mapping -from dataclasses import InitVar, dataclass, field -from typing import Any - -from ..abc import ( - AnyByteReceiveStream, - AnyByteSendStream, - AnyByteStream, - AnyByteStreamConnectable, - ObjectReceiveStream, - ObjectSendStream, - ObjectStream, - ObjectStreamConnectable, -) - -if sys.version_info >= (3, 12): - from typing import override -else: - from typing_extensions import override - - -@dataclass(eq=False) -class TextReceiveStream(ObjectReceiveStream[str]): - """ - Stream wrapper that decodes bytes to strings using the given encoding. - - Decoding is done using :class:`~codecs.IncrementalDecoder` which returns any - completely received unicode characters as soon as they come in. - - :param transport_stream: any bytes-based receive stream - :param encoding: character encoding to use for decoding bytes to strings (defaults - to ``utf-8``) - :param errors: handling scheme for decoding errors (defaults to ``strict``; see the - `codecs module documentation`_ for a comprehensive list of options) - - .. _codecs module documentation: - https://docs.python.org/3/library/codecs.html#codec-objects - """ - - transport_stream: AnyByteReceiveStream - encoding: InitVar[str] = "utf-8" - errors: InitVar[str] = "strict" - _decoder: codecs.IncrementalDecoder = field(init=False) - - def __post_init__(self, encoding: str, errors: str) -> None: - decoder_class = codecs.getincrementaldecoder(encoding) - self._decoder = decoder_class(errors=errors) - - async def receive(self) -> str: - while True: - chunk = await self.transport_stream.receive() - decoded = self._decoder.decode(chunk) - if decoded: - return decoded - - async def aclose(self) -> None: - await self.transport_stream.aclose() - self._decoder.reset() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return self.transport_stream.extra_attributes - - -@dataclass(eq=False) -class TextSendStream(ObjectSendStream[str]): - """ - Sends strings to the wrapped stream as bytes using the given encoding. - - :param AnyByteSendStream transport_stream: any bytes-based send stream - :param str encoding: character encoding to use for encoding strings to bytes - (defaults to ``utf-8``) - :param str errors: handling scheme for encoding errors (defaults to ``strict``; see - the `codecs module documentation`_ for a comprehensive list of options) - - .. _codecs module documentation: - https://docs.python.org/3/library/codecs.html#codec-objects - """ - - transport_stream: AnyByteSendStream - encoding: InitVar[str] = "utf-8" - errors: str = "strict" - _encoder: Callable[..., tuple[bytes, int]] = field(init=False) - - def __post_init__(self, encoding: str) -> None: - self._encoder = codecs.getencoder(encoding) - - async def send(self, item: str) -> None: - encoded = self._encoder(item, self.errors)[0] - await self.transport_stream.send(encoded) - - async def aclose(self) -> None: - await self.transport_stream.aclose() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return self.transport_stream.extra_attributes - - -@dataclass(eq=False) -class TextStream(ObjectStream[str]): - """ - A bidirectional stream that decodes bytes to strings on receive and encodes strings - to bytes on send. - - Extra attributes will be provided from both streams, with the receive stream - providing the values in case of a conflict. - - :param AnyByteStream transport_stream: any bytes-based stream - :param str encoding: character encoding to use for encoding/decoding strings to/from - bytes (defaults to ``utf-8``) - :param str errors: handling scheme for encoding errors (defaults to ``strict``; see - the `codecs module documentation`_ for a comprehensive list of options) - - .. _codecs module documentation: - https://docs.python.org/3/library/codecs.html#codec-objects - """ - - transport_stream: AnyByteStream - encoding: InitVar[str] = "utf-8" - errors: InitVar[str] = "strict" - _receive_stream: TextReceiveStream = field(init=False) - _send_stream: TextSendStream = field(init=False) - - def __post_init__(self, encoding: str, errors: str) -> None: - self._receive_stream = TextReceiveStream( - self.transport_stream, encoding=encoding, errors=errors - ) - self._send_stream = TextSendStream( - self.transport_stream, encoding=encoding, errors=errors - ) - - async def receive(self) -> str: - return await self._receive_stream.receive() - - async def send(self, item: str) -> None: - await self._send_stream.send(item) - - async def send_eof(self) -> None: - await self.transport_stream.send_eof() - - async def aclose(self) -> None: - await self._send_stream.aclose() - await self._receive_stream.aclose() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return { - **self._send_stream.extra_attributes, - **self._receive_stream.extra_attributes, - } - - -class TextConnectable(ObjectStreamConnectable[str]): - def __init__(self, connectable: AnyByteStreamConnectable): - """ - :param connectable: the bytestream endpoint to wrap - - """ - self.connectable = connectable - - @override - async def connect(self) -> TextStream: - stream = await self.connectable.connect() - return TextStream(stream) diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/streams/tls.py b/write-message/venv/lib/python3.10/site-packages/anyio/streams/tls.py deleted file mode 100644 index 17fa200..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/streams/tls.py +++ /dev/null @@ -1,417 +0,0 @@ -from __future__ import annotations - -import logging -import re -import ssl -import sys -from collections.abc import Callable, Mapping -from dataclasses import dataclass -from functools import wraps -from ssl import SSLContext -from typing import Any, TypeVar - -from .. import ( - BrokenResourceError, - EndOfStream, - aclose_forcefully, - get_cancelled_exc_class, - to_thread, -) -from .._core._typedattr import TypedAttributeSet, typed_attribute -from ..abc import ( - AnyByteStream, - AnyByteStreamConnectable, - ByteStream, - ByteStreamConnectable, - Listener, - TaskGroup, -) - -if sys.version_info >= (3, 10): - from typing import TypeAlias -else: - from typing_extensions import TypeAlias - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -if sys.version_info >= (3, 12): - from typing import override -else: - from typing_extensions import override - -T_Retval = TypeVar("T_Retval") -PosArgsT = TypeVarTuple("PosArgsT") -_PCTRTT: TypeAlias = tuple[tuple[str, str], ...] -_PCTRTTT: TypeAlias = tuple[_PCTRTT, ...] - - -class TLSAttribute(TypedAttributeSet): - """Contains Transport Layer Security related attributes.""" - - #: the selected ALPN protocol - alpn_protocol: str | None = typed_attribute() - #: the channel binding for type ``tls-unique`` - channel_binding_tls_unique: bytes = typed_attribute() - #: the selected cipher - cipher: tuple[str, str, int] = typed_attribute() - #: the peer certificate in dictionary form (see :meth:`ssl.SSLSocket.getpeercert` - # for more information) - peer_certificate: None | (dict[str, str | _PCTRTTT | _PCTRTT]) = typed_attribute() - #: the peer certificate in binary form - peer_certificate_binary: bytes | None = typed_attribute() - #: ``True`` if this is the server side of the connection - server_side: bool = typed_attribute() - #: ciphers shared by the client during the TLS handshake (``None`` if this is the - #: client side) - shared_ciphers: list[tuple[str, str, int]] | None = typed_attribute() - #: the :class:`~ssl.SSLObject` used for encryption - ssl_object: ssl.SSLObject = typed_attribute() - #: ``True`` if this stream does (and expects) a closing TLS handshake when the - #: stream is being closed - standard_compatible: bool = typed_attribute() - #: the TLS protocol version (e.g. ``TLSv1.2``) - tls_version: str = typed_attribute() - - -@dataclass(eq=False) -class TLSStream(ByteStream): - """ - A stream wrapper that encrypts all sent data and decrypts received data. - - This class has no public initializer; use :meth:`wrap` instead. - All extra attributes from :class:`~TLSAttribute` are supported. - - :var AnyByteStream transport_stream: the wrapped stream - - """ - - transport_stream: AnyByteStream - standard_compatible: bool - _ssl_object: ssl.SSLObject - _read_bio: ssl.MemoryBIO - _write_bio: ssl.MemoryBIO - - @classmethod - async def wrap( - cls, - transport_stream: AnyByteStream, - *, - server_side: bool | None = None, - hostname: str | None = None, - ssl_context: ssl.SSLContext | None = None, - standard_compatible: bool = True, - ) -> TLSStream: - """ - Wrap an existing stream with Transport Layer Security. - - This performs a TLS handshake with the peer. - - :param transport_stream: a bytes-transporting stream to wrap - :param server_side: ``True`` if this is the server side of the connection, - ``False`` if this is the client side (if omitted, will be set to ``False`` - if ``hostname`` has been provided, ``False`` otherwise). Used only to create - a default context when an explicit context has not been provided. - :param hostname: host name of the peer (if host name checking is desired) - :param ssl_context: the SSLContext object to use (if not provided, a secure - default will be created) - :param standard_compatible: if ``False``, skip the closing handshake when - closing the connection, and don't raise an exception if the peer does the - same - :raises ~ssl.SSLError: if the TLS handshake fails - - """ - if server_side is None: - server_side = not hostname - - if not ssl_context: - purpose = ( - ssl.Purpose.CLIENT_AUTH if server_side else ssl.Purpose.SERVER_AUTH - ) - ssl_context = ssl.create_default_context(purpose) - - # Re-enable detection of unexpected EOFs if it was disabled by Python - if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"): - ssl_context.options &= ~ssl.OP_IGNORE_UNEXPECTED_EOF - - bio_in = ssl.MemoryBIO() - bio_out = ssl.MemoryBIO() - - # External SSLContext implementations may do blocking I/O in wrap_bio(), - # but the standard library implementation won't - if type(ssl_context) is ssl.SSLContext: - ssl_object = ssl_context.wrap_bio( - bio_in, bio_out, server_side=server_side, server_hostname=hostname - ) - else: - ssl_object = await to_thread.run_sync( - ssl_context.wrap_bio, - bio_in, - bio_out, - server_side, - hostname, - None, - ) - - wrapper = cls( - transport_stream=transport_stream, - standard_compatible=standard_compatible, - _ssl_object=ssl_object, - _read_bio=bio_in, - _write_bio=bio_out, - ) - await wrapper._call_sslobject_method(ssl_object.do_handshake) - return wrapper - - async def _call_sslobject_method( - self, func: Callable[[Unpack[PosArgsT]], T_Retval], *args: Unpack[PosArgsT] - ) -> T_Retval: - while True: - try: - result = func(*args) - except ssl.SSLWantReadError: - try: - # Flush any pending writes first - if self._write_bio.pending: - await self.transport_stream.send(self._write_bio.read()) - - data = await self.transport_stream.receive() - except EndOfStream: - self._read_bio.write_eof() - except OSError as exc: - self._read_bio.write_eof() - self._write_bio.write_eof() - raise BrokenResourceError from exc - else: - self._read_bio.write(data) - except ssl.SSLWantWriteError: - await self.transport_stream.send(self._write_bio.read()) - except ssl.SSLSyscallError as exc: - self._read_bio.write_eof() - self._write_bio.write_eof() - raise BrokenResourceError from exc - except ssl.SSLError as exc: - self._read_bio.write_eof() - self._write_bio.write_eof() - if isinstance(exc, ssl.SSLEOFError) or ( - exc.strerror and "UNEXPECTED_EOF_WHILE_READING" in exc.strerror - ): - if self.standard_compatible: - raise BrokenResourceError from exc - else: - raise EndOfStream from None - - raise - else: - # Flush any pending writes first - if self._write_bio.pending: - await self.transport_stream.send(self._write_bio.read()) - - return result - - async def unwrap(self) -> tuple[AnyByteStream, bytes]: - """ - Does the TLS closing handshake. - - :return: a tuple of (wrapped byte stream, bytes left in the read buffer) - - """ - await self._call_sslobject_method(self._ssl_object.unwrap) - self._read_bio.write_eof() - self._write_bio.write_eof() - return self.transport_stream, self._read_bio.read() - - async def aclose(self) -> None: - if self.standard_compatible: - try: - await self.unwrap() - except BaseException: - await aclose_forcefully(self.transport_stream) - raise - - await self.transport_stream.aclose() - - async def receive(self, max_bytes: int = 65536) -> bytes: - data = await self._call_sslobject_method(self._ssl_object.read, max_bytes) - if not data: - raise EndOfStream - - return data - - async def send(self, item: bytes) -> None: - await self._call_sslobject_method(self._ssl_object.write, item) - - async def send_eof(self) -> None: - tls_version = self.extra(TLSAttribute.tls_version) - match = re.match(r"TLSv(\d+)(?:\.(\d+))?", tls_version) - if match: - major, minor = int(match.group(1)), int(match.group(2) or 0) - if (major, minor) < (1, 3): - raise NotImplementedError( - f"send_eof() requires at least TLSv1.3; current " - f"session uses {tls_version}" - ) - - raise NotImplementedError( - "send_eof() has not yet been implemented for TLS streams" - ) - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return { - **self.transport_stream.extra_attributes, - TLSAttribute.alpn_protocol: self._ssl_object.selected_alpn_protocol, - TLSAttribute.channel_binding_tls_unique: ( - self._ssl_object.get_channel_binding - ), - TLSAttribute.cipher: self._ssl_object.cipher, - TLSAttribute.peer_certificate: lambda: self._ssl_object.getpeercert(False), - TLSAttribute.peer_certificate_binary: lambda: self._ssl_object.getpeercert( - True - ), - TLSAttribute.server_side: lambda: self._ssl_object.server_side, - TLSAttribute.shared_ciphers: lambda: self._ssl_object.shared_ciphers() - if self._ssl_object.server_side - else None, - TLSAttribute.standard_compatible: lambda: self.standard_compatible, - TLSAttribute.ssl_object: lambda: self._ssl_object, - TLSAttribute.tls_version: self._ssl_object.version, - } - - -@dataclass(eq=False) -class TLSListener(Listener[TLSStream]): - """ - A convenience listener that wraps another listener and auto-negotiates a TLS session - on every accepted connection. - - If the TLS handshake times out or raises an exception, - :meth:`handle_handshake_error` is called to do whatever post-mortem processing is - deemed necessary. - - Supports only the :attr:`~TLSAttribute.standard_compatible` extra attribute. - - :param Listener listener: the listener to wrap - :param ssl_context: the SSL context object - :param standard_compatible: a flag passed through to :meth:`TLSStream.wrap` - :param handshake_timeout: time limit for the TLS handshake - (passed to :func:`~anyio.fail_after`) - """ - - listener: Listener[Any] - ssl_context: ssl.SSLContext - standard_compatible: bool = True - handshake_timeout: float = 30 - - @staticmethod - async def handle_handshake_error(exc: BaseException, stream: AnyByteStream) -> None: - """ - Handle an exception raised during the TLS handshake. - - This method does 3 things: - - #. Forcefully closes the original stream - #. Logs the exception (unless it was a cancellation exception) using the - ``anyio.streams.tls`` logger - #. Reraises the exception if it was a base exception or a cancellation exception - - :param exc: the exception - :param stream: the original stream - - """ - await aclose_forcefully(stream) - - # Log all except cancellation exceptions - if not isinstance(exc, get_cancelled_exc_class()): - # CPython (as of 3.11.5) returns incorrect `sys.exc_info()` here when using - # any asyncio implementation, so we explicitly pass the exception to log - # (https://github.com/python/cpython/issues/108668). Trio does not have this - # issue because it works around the CPython bug. - logging.getLogger(__name__).exception( - "Error during TLS handshake", exc_info=exc - ) - - # Only reraise base exceptions and cancellation exceptions - if not isinstance(exc, Exception) or isinstance(exc, get_cancelled_exc_class()): - raise - - async def serve( - self, - handler: Callable[[TLSStream], Any], - task_group: TaskGroup | None = None, - ) -> None: - @wraps(handler) - async def handler_wrapper(stream: AnyByteStream) -> None: - from .. import fail_after - - try: - with fail_after(self.handshake_timeout): - wrapped_stream = await TLSStream.wrap( - stream, - ssl_context=self.ssl_context, - standard_compatible=self.standard_compatible, - ) - except BaseException as exc: - await self.handle_handshake_error(exc, stream) - else: - await handler(wrapped_stream) - - await self.listener.serve(handler_wrapper, task_group) - - async def aclose(self) -> None: - await self.listener.aclose() - - @property - def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]: - return { - TLSAttribute.standard_compatible: lambda: self.standard_compatible, - } - - -class TLSConnectable(ByteStreamConnectable): - """ - Wraps another connectable and does TLS negotiation after a successful connection. - - :param connectable: the connectable to wrap - :param hostname: host name of the server (if host name checking is desired) - :param ssl_context: the SSLContext object to use (if not provided, a secure default - will be created) - :param standard_compatible: if ``False``, skip the closing handshake when closing - the connection, and don't raise an exception if the server does the same - """ - - def __init__( - self, - connectable: AnyByteStreamConnectable, - *, - hostname: str | None = None, - ssl_context: ssl.SSLContext | None = None, - standard_compatible: bool = True, - ) -> None: - self.connectable = connectable - self.ssl_context: SSLContext = ssl_context or ssl.create_default_context( - ssl.Purpose.SERVER_AUTH - ) - if not isinstance(self.ssl_context, ssl.SSLContext): - raise TypeError( - "ssl_context must be an instance of ssl.SSLContext, not " - f"{type(self.ssl_context).__name__}" - ) - self.hostname = hostname - self.standard_compatible = standard_compatible - - @override - async def connect(self) -> TLSStream: - stream = await self.connectable.connect() - try: - return await TLSStream.wrap( - stream, - hostname=self.hostname, - ssl_context=self.ssl_context, - standard_compatible=self.standard_compatible, - ) - except BaseException: - await aclose_forcefully(stream) - raise diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/to_interpreter.py b/write-message/venv/lib/python3.10/site-packages/anyio/to_interpreter.py deleted file mode 100644 index bafd221..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/to_interpreter.py +++ /dev/null @@ -1,239 +0,0 @@ -from __future__ import annotations - -import atexit -import os -import sys -from collections import deque -from collections.abc import Callable -from typing import Any, Final, TypeVar - -from . import current_time, to_thread -from ._core._exceptions import BrokenWorkerInterpreter -from ._core._synchronization import CapacityLimiter -from .lowlevel import RunVar - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -if sys.version_info >= (3, 14): - from concurrent.interpreters import ExecutionFailed, create - - def _interp_call(func: Callable[..., Any], args: tuple[Any, ...]): - try: - retval = func(*args) - except BaseException as exc: - return exc, True - else: - return retval, False - - class Worker: - last_used: float = 0 - - def __init__(self) -> None: - self._interpreter = create() - - def destroy(self) -> None: - self._interpreter.close() - - def call( - self, - func: Callable[..., T_Retval], - args: tuple[Any, ...], - ) -> T_Retval: - try: - res, is_exception = self._interpreter.call(_interp_call, func, args) - except ExecutionFailed as exc: - raise BrokenWorkerInterpreter(exc.excinfo) from exc - - if is_exception: - raise res - - return res -elif sys.version_info >= (3, 13): - import _interpqueues - import _interpreters - - UNBOUND: Final = 2 # I have no clue how this works, but it was used in the stdlib - FMT_UNPICKLED: Final = 0 - FMT_PICKLED: Final = 1 - QUEUE_PICKLE_ARGS: Final = (FMT_PICKLED, UNBOUND) - QUEUE_UNPICKLE_ARGS: Final = (FMT_UNPICKLED, UNBOUND) - - _run_func = compile( - """ -import _interpqueues -from _interpreters import NotShareableError -from pickle import loads, dumps, HIGHEST_PROTOCOL - -QUEUE_PICKLE_ARGS = (1, 2) -QUEUE_UNPICKLE_ARGS = (0, 2) - -item = _interpqueues.get(queue_id)[0] -try: - func, args = loads(item) - retval = func(*args) -except BaseException as exc: - is_exception = True - retval = exc -else: - is_exception = False - -try: - _interpqueues.put(queue_id, (retval, is_exception), *QUEUE_UNPICKLE_ARGS) -except NotShareableError: - retval = dumps(retval, HIGHEST_PROTOCOL) - _interpqueues.put(queue_id, (retval, is_exception), *QUEUE_PICKLE_ARGS) - """, - "", - "exec", - ) - - class Worker: - last_used: float = 0 - - def __init__(self) -> None: - self._interpreter_id = _interpreters.create() - self._queue_id = _interpqueues.create(1, *QUEUE_UNPICKLE_ARGS) - _interpreters.set___main___attrs( - self._interpreter_id, {"queue_id": self._queue_id} - ) - - def destroy(self) -> None: - _interpqueues.destroy(self._queue_id) - _interpreters.destroy(self._interpreter_id) - - def call( - self, - func: Callable[..., T_Retval], - args: tuple[Any, ...], - ) -> T_Retval: - import pickle - - item = pickle.dumps((func, args), pickle.HIGHEST_PROTOCOL) - _interpqueues.put(self._queue_id, item, *QUEUE_PICKLE_ARGS) - exc_info = _interpreters.exec(self._interpreter_id, _run_func) - if exc_info: - raise BrokenWorkerInterpreter(exc_info) - - res = _interpqueues.get(self._queue_id) - (res, is_exception), fmt = res[:2] - if fmt == FMT_PICKLED: - res = pickle.loads(res) - - if is_exception: - raise res - - return res -else: - - class Worker: - last_used: float = 0 - - def __init__(self) -> None: - raise RuntimeError("subinterpreters require at least Python 3.13") - - def call( - self, - func: Callable[..., T_Retval], - args: tuple[Any, ...], - ) -> T_Retval: - raise NotImplementedError - - def destroy(self) -> None: - pass - - -DEFAULT_CPU_COUNT: Final = 8 # this is just an arbitrarily selected value -MAX_WORKER_IDLE_TIME = ( - 30 # seconds a subinterpreter can be idle before becoming eligible for pruning -) - -T_Retval = TypeVar("T_Retval") -PosArgsT = TypeVarTuple("PosArgsT") - -_idle_workers = RunVar[deque[Worker]]("_available_workers") -_default_interpreter_limiter = RunVar[CapacityLimiter]("_default_interpreter_limiter") - - -def _stop_workers(workers: deque[Worker]) -> None: - for worker in workers: - worker.destroy() - - workers.clear() - - -async def run_sync( - func: Callable[[Unpack[PosArgsT]], T_Retval], - *args: Unpack[PosArgsT], - limiter: CapacityLimiter | None = None, -) -> T_Retval: - """ - Call the given function with the given arguments in a subinterpreter. - - .. warning:: On Python 3.13, the :mod:`concurrent.interpreters` module was not yet - available, so the code path for that Python version relies on an undocumented, - private API. As such, it is recommended to not rely on this function for anything - mission-critical on Python 3.13. - - :param func: a callable - :param args: the positional arguments for the callable - :param limiter: capacity limiter to use to limit the total number of subinterpreters - running (if omitted, the default limiter is used) - :return: the result of the call - :raises BrokenWorkerInterpreter: if there's an internal error in a subinterpreter - - """ - if limiter is None: - limiter = current_default_interpreter_limiter() - - try: - idle_workers = _idle_workers.get() - except LookupError: - idle_workers = deque() - _idle_workers.set(idle_workers) - atexit.register(_stop_workers, idle_workers) - - async with limiter: - try: - worker = idle_workers.pop() - except IndexError: - worker = Worker() - - try: - return await to_thread.run_sync( - worker.call, - func, - args, - limiter=limiter, - ) - finally: - # Prune workers that have been idle for too long - now = current_time() - while idle_workers: - if now - idle_workers[0].last_used <= MAX_WORKER_IDLE_TIME: - break - - await to_thread.run_sync(idle_workers.popleft().destroy, limiter=limiter) - - worker.last_used = current_time() - idle_workers.append(worker) - - -def current_default_interpreter_limiter() -> CapacityLimiter: - """ - Return the capacity limiter used by default to limit the number of concurrently - running subinterpreters. - - Defaults to the number of CPU cores. - - :return: a capacity limiter object - - """ - try: - return _default_interpreter_limiter.get() - except LookupError: - limiter = CapacityLimiter(os.cpu_count() or DEFAULT_CPU_COUNT) - _default_interpreter_limiter.set(limiter) - return limiter diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/to_process.py b/write-message/venv/lib/python3.10/site-packages/anyio/to_process.py deleted file mode 100644 index 495de2a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/to_process.py +++ /dev/null @@ -1,258 +0,0 @@ -from __future__ import annotations - -import os -import pickle -import subprocess -import sys -from collections import deque -from collections.abc import Callable -from importlib.util import module_from_spec, spec_from_file_location -from typing import TypeVar, cast - -from ._core._eventloop import current_time, get_async_backend, get_cancelled_exc_class -from ._core._exceptions import BrokenWorkerProcess -from ._core._subprocesses import open_process -from ._core._synchronization import CapacityLimiter -from ._core._tasks import CancelScope, fail_after -from .abc import ByteReceiveStream, ByteSendStream, Process -from .lowlevel import RunVar, checkpoint_if_cancelled -from .streams.buffered import BufferedByteReceiveStream - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -WORKER_MAX_IDLE_TIME = 300 # 5 minutes - -T_Retval = TypeVar("T_Retval") -PosArgsT = TypeVarTuple("PosArgsT") - -_process_pool_workers: RunVar[set[Process]] = RunVar("_process_pool_workers") -_process_pool_idle_workers: RunVar[deque[tuple[Process, float]]] = RunVar( - "_process_pool_idle_workers" -) -_default_process_limiter: RunVar[CapacityLimiter] = RunVar("_default_process_limiter") - - -async def run_sync( # type: ignore[return] - func: Callable[[Unpack[PosArgsT]], T_Retval], - *args: Unpack[PosArgsT], - cancellable: bool = False, - limiter: CapacityLimiter | None = None, -) -> T_Retval: - """ - Call the given function with the given arguments in a worker process. - - If the ``cancellable`` option is enabled and the task waiting for its completion is - cancelled, the worker process running it will be abruptly terminated using SIGKILL - (or ``terminateProcess()`` on Windows). - - :param func: a callable - :param args: positional arguments for the callable - :param cancellable: ``True`` to allow cancellation of the operation while it's - running - :param limiter: capacity limiter to use to limit the total amount of processes - running (if omitted, the default limiter is used) - :return: an awaitable that yields the return value of the function. - - """ - - async def send_raw_command(pickled_cmd: bytes) -> object: - try: - await stdin.send(pickled_cmd) - response = await buffered.receive_until(b"\n", 50) - status, length = response.split(b" ") - if status not in (b"RETURN", b"EXCEPTION"): - raise RuntimeError( - f"Worker process returned unexpected response: {response!r}" - ) - - pickled_response = await buffered.receive_exactly(int(length)) - except BaseException as exc: - workers.discard(process) - try: - process.kill() - with CancelScope(shield=True): - await process.aclose() - except ProcessLookupError: - pass - - if isinstance(exc, get_cancelled_exc_class()): - raise - else: - raise BrokenWorkerProcess from exc - - retval = pickle.loads(pickled_response) - if status == b"EXCEPTION": - assert isinstance(retval, BaseException) - raise retval - else: - return retval - - # First pickle the request before trying to reserve a worker process - await checkpoint_if_cancelled() - request = pickle.dumps(("run", func, args), protocol=pickle.HIGHEST_PROTOCOL) - - # If this is the first run in this event loop thread, set up the necessary variables - try: - workers = _process_pool_workers.get() - idle_workers = _process_pool_idle_workers.get() - except LookupError: - workers = set() - idle_workers = deque() - _process_pool_workers.set(workers) - _process_pool_idle_workers.set(idle_workers) - get_async_backend().setup_process_pool_exit_at_shutdown(workers) - - async with limiter or current_default_process_limiter(): - # Pop processes from the pool (starting from the most recently used) until we - # find one that hasn't exited yet - process: Process - while idle_workers: - process, idle_since = idle_workers.pop() - if process.returncode is None: - stdin = cast(ByteSendStream, process.stdin) - buffered = BufferedByteReceiveStream( - cast(ByteReceiveStream, process.stdout) - ) - - # Prune any other workers that have been idle for WORKER_MAX_IDLE_TIME - # seconds or longer - now = current_time() - killed_processes: list[Process] = [] - while idle_workers: - if now - idle_workers[0][1] < WORKER_MAX_IDLE_TIME: - break - - process_to_kill, idle_since = idle_workers.popleft() - process_to_kill.kill() - workers.remove(process_to_kill) - killed_processes.append(process_to_kill) - - with CancelScope(shield=True): - for killed_process in killed_processes: - await killed_process.aclose() - - break - - workers.remove(process) - else: - command = [sys.executable, "-u", "-m", __name__] - process = await open_process( - command, stdin=subprocess.PIPE, stdout=subprocess.PIPE - ) - try: - stdin = cast(ByteSendStream, process.stdin) - buffered = BufferedByteReceiveStream( - cast(ByteReceiveStream, process.stdout) - ) - with fail_after(20): - message = await buffered.receive(6) - - if message != b"READY\n": - raise BrokenWorkerProcess( - f"Worker process returned unexpected response: {message!r}" - ) - - main_module_path = getattr(sys.modules["__main__"], "__file__", None) - pickled = pickle.dumps( - ("init", sys.path, main_module_path), - protocol=pickle.HIGHEST_PROTOCOL, - ) - await send_raw_command(pickled) - except (BrokenWorkerProcess, get_cancelled_exc_class()): - raise - except BaseException as exc: - process.kill() - raise BrokenWorkerProcess( - "Error during worker process initialization" - ) from exc - - workers.add(process) - - with CancelScope(shield=not cancellable): - try: - return cast(T_Retval, await send_raw_command(request)) - finally: - if process in workers: - idle_workers.append((process, current_time())) - - -def current_default_process_limiter() -> CapacityLimiter: - """ - Return the capacity limiter that is used by default to limit the number of worker - processes. - - :return: a capacity limiter object - - """ - try: - return _default_process_limiter.get() - except LookupError: - limiter = CapacityLimiter(os.cpu_count() or 2) - _default_process_limiter.set(limiter) - return limiter - - -def process_worker() -> None: - # Redirect standard streams to os.devnull so that user code won't interfere with the - # parent-worker communication - stdin = sys.stdin - stdout = sys.stdout - sys.stdin = open(os.devnull) - sys.stdout = open(os.devnull, "w") - - stdout.buffer.write(b"READY\n") - while True: - retval = exception = None - try: - command, *args = pickle.load(stdin.buffer) - except EOFError: - return - except BaseException as exc: - exception = exc - else: - if command == "run": - func, args = args - try: - retval = func(*args) - except BaseException as exc: - exception = exc - elif command == "init": - main_module_path: str | None - sys.path, main_module_path = args - del sys.modules["__main__"] - if main_module_path and os.path.isfile(main_module_path): - # Load the parent's main module but as __mp_main__ instead of - # __main__ (like multiprocessing does) to avoid infinite recursion - try: - spec = spec_from_file_location("__mp_main__", main_module_path) - if spec and spec.loader: - main = module_from_spec(spec) - spec.loader.exec_module(main) - sys.modules["__main__"] = main - except BaseException as exc: - exception = exc - try: - if exception is not None: - status = b"EXCEPTION" - pickled = pickle.dumps(exception, pickle.HIGHEST_PROTOCOL) - else: - status = b"RETURN" - pickled = pickle.dumps(retval, pickle.HIGHEST_PROTOCOL) - except BaseException as exc: - exception = exc - status = b"EXCEPTION" - pickled = pickle.dumps(exc, pickle.HIGHEST_PROTOCOL) - - stdout.buffer.write(b"%s %d\n" % (status, len(pickled))) - stdout.buffer.write(pickled) - - # Respect SIGTERM - if isinstance(exception, SystemExit): - raise exception - - -if __name__ == "__main__": - process_worker() diff --git a/write-message/venv/lib/python3.10/site-packages/anyio/to_thread.py b/write-message/venv/lib/python3.10/site-packages/anyio/to_thread.py deleted file mode 100644 index 5070516..0000000 --- a/write-message/venv/lib/python3.10/site-packages/anyio/to_thread.py +++ /dev/null @@ -1,69 +0,0 @@ -from __future__ import annotations - -import sys -from collections.abc import Callable -from typing import TypeVar -from warnings import warn - -from ._core._eventloop import get_async_backend -from .abc import CapacityLimiter - -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack - -T_Retval = TypeVar("T_Retval") -PosArgsT = TypeVarTuple("PosArgsT") - - -async def run_sync( - func: Callable[[Unpack[PosArgsT]], T_Retval], - *args: Unpack[PosArgsT], - abandon_on_cancel: bool = False, - cancellable: bool | None = None, - limiter: CapacityLimiter | None = None, -) -> T_Retval: - """ - Call the given function with the given arguments in a worker thread. - - If the ``cancellable`` option is enabled and the task waiting for its completion is - cancelled, the thread will still run its course but its return value (or any raised - exception) will be ignored. - - :param func: a callable - :param args: positional arguments for the callable - :param abandon_on_cancel: ``True`` to abandon the thread (leaving it to run - unchecked on own) if the host task is cancelled, ``False`` to ignore - cancellations in the host task until the operation has completed in the worker - thread - :param cancellable: deprecated alias of ``abandon_on_cancel``; will override - ``abandon_on_cancel`` if both parameters are passed - :param limiter: capacity limiter to use to limit the total amount of threads running - (if omitted, the default limiter is used) - :return: an awaitable that yields the return value of the function. - - """ - if cancellable is not None: - abandon_on_cancel = cancellable - warn( - "The `cancellable=` keyword argument to `anyio.to_thread.run_sync` is " - "deprecated since AnyIO 4.1.0; use `abandon_on_cancel=` instead", - DeprecationWarning, - stacklevel=2, - ) - - return await get_async_backend().run_sync_in_worker_thread( - func, args, abandon_on_cancel=abandon_on_cancel, limiter=limiter - ) - - -def current_default_thread_limiter() -> CapacityLimiter: - """ - Return the capacity limiter that is used by default to limit the number of - concurrent threads. - - :return: a capacity limiter object - - """ - return get_async_backend().current_default_thread_limiter() diff --git a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/METADATA deleted file mode 100644 index 3a7ea22..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/METADATA +++ /dev/null @@ -1,77 +0,0 @@ -Metadata-Version: 2.4 -Name: certifi -Version: 2025.8.3 -Summary: Python package for providing Mozilla's CA Bundle. -Home-page: https://github.com/certifi/python-certifi -Author: Kenneth Reitz -Author-email: me@kennethreitz.com -License: MPL-2.0 -Project-URL: Source, https://github.com/certifi/python-certifi -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) -Classifier: Natural Language :: English -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Programming Language :: Python :: 3.13 -Requires-Python: >=3.7 -License-File: LICENSE -Dynamic: author -Dynamic: author-email -Dynamic: classifier -Dynamic: description -Dynamic: home-page -Dynamic: license -Dynamic: license-file -Dynamic: project-url -Dynamic: requires-python -Dynamic: summary - -Certifi: Python SSL Certificates -================================ - -Certifi provides Mozilla's carefully curated collection of Root Certificates for -validating the trustworthiness of SSL certificates while verifying the identity -of TLS hosts. It has been extracted from the `Requests`_ project. - -Installation ------------- - -``certifi`` is available on PyPI. Simply install it with ``pip``:: - - $ pip install certifi - -Usage ------ - -To reference the installed certificate authority (CA) bundle, you can use the -built-in function:: - - >>> import certifi - - >>> certifi.where() - '/usr/local/lib/python3.7/site-packages/certifi/cacert.pem' - -Or from the command line:: - - $ python -m certifi - /usr/local/lib/python3.7/site-packages/certifi/cacert.pem - -Enjoy! - -.. _`Requests`: https://requests.readthedocs.io/en/master/ - -Addition/Removal of Certificates --------------------------------- - -Certifi does not support any addition/removal or other modification of the -CA trust store content. This project is intended to provide a reliable and -highly portable root of trust to python deployments. Look to upstream projects -for methods to use alternate trust. diff --git a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/RECORD deleted file mode 100644 index 9a2729c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/RECORD +++ /dev/null @@ -1,14 +0,0 @@ -certifi-2025.8.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -certifi-2025.8.3.dist-info/METADATA,sha256=z4sG3fosbP3nviub_TUpSb71z0bPmsp3Xa6ZIatGUe4,2422 -certifi-2025.8.3.dist-info/RECORD,, -certifi-2025.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 -certifi-2025.8.3.dist-info/licenses/LICENSE,sha256=6TcW2mucDVpKHfYP5pWzcPBpVgPSH2-D8FPkLPwQyvc,989 -certifi-2025.8.3.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8 -certifi/__init__.py,sha256=0a5ro4KTYep37Oo0Z8TycCPXaDlOEtvuj2pNWZ_1t8Y,94 -certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243 -certifi/__pycache__/__init__.cpython-310.pyc,, -certifi/__pycache__/__main__.cpython-310.pyc,, -certifi/__pycache__/core.cpython-310.pyc,, -certifi/cacert.pem,sha256=kQLmo2RKBxumzb1KU2mPKRxKZLGEUKCLwEZUi221zIs,287634 -certifi/core.py,sha256=XFXycndG5pf37ayeF8N32HUuDafsyhkVMbO4BAPWHa0,3394 -certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/WHEEL deleted file mode 100644 index e7fa31b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (80.9.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/licenses/LICENSE b/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/licenses/LICENSE deleted file mode 100644 index 62b076c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/licenses/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -This package contains a modified version of ca-bundle.crt: - -ca-bundle.crt -- Bundle of CA Root Certificates - -This is a bundle of X.509 certificates of public Certificate Authorities -(CA). These were automatically extracted from Mozilla's root certificates -file (certdata.txt). This file can be found in the mozilla source tree: -https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt -It contains the certificates in PEM format and therefore -can be directly used with curl / libcurl / php_curl, or with -an Apache+mod_ssl webserver for SSL client authentication. -Just configure this file as the SSLCACertificateFile.# - -***** BEGIN LICENSE BLOCK ***** -This Source Code Form is subject to the terms of the Mozilla Public License, -v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain -one at http://mozilla.org/MPL/2.0/. - -***** END LICENSE BLOCK ***** -@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ diff --git a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/top_level.txt deleted file mode 100644 index 963eac5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi-2025.8.3.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -certifi diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/__init__.py b/write-message/venv/lib/python3.10/site-packages/certifi/__init__.py deleted file mode 100644 index fe2a891..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .core import contents, where - -__all__ = ["contents", "where"] -__version__ = "2025.08.03" diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/__main__.py b/write-message/venv/lib/python3.10/site-packages/certifi/__main__.py deleted file mode 100644 index 8945b5d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi/__main__.py +++ /dev/null @@ -1,12 +0,0 @@ -import argparse - -from certifi import contents, where - -parser = argparse.ArgumentParser() -parser.add_argument("-c", "--contents", action="store_true") -args = parser.parse_args() - -if args.contents: - print(contents()) -else: - print(where()) diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index ce8fcf0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/__main__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/__main__.cpython-310.pyc deleted file mode 100644 index 579ba36..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/__main__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/core.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/core.cpython-310.pyc deleted file mode 100644 index 3a05d66..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/certifi/__pycache__/core.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/cacert.pem b/write-message/venv/lib/python3.10/site-packages/certifi/cacert.pem deleted file mode 100644 index 2077a1e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi/cacert.pem +++ /dev/null @@ -1,4738 +0,0 @@ - -# Issuer: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. -# Subject: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. -# Label: "Entrust Root Certification Authority" -# Serial: 1164660820 -# MD5 Fingerprint: d6:a5:c3:ed:5d:dd:3e:00:c1:3d:87:92:1f:1d:3f:e4 -# SHA1 Fingerprint: b3:1e:b1:b7:40:e3:6c:84:02:da:dc:37:d4:4d:f5:d4:67:49:52:f9 -# SHA256 Fingerprint: 73:c1:76:43:4f:1b:c6:d5:ad:f4:5b:0e:76:e7:27:28:7c:8d:e5:76:16:c1:e6:e6:14:1a:2b:2c:bc:7d:8e:4c ------BEGIN CERTIFICATE----- -MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 -Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW -KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl -cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw -NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw -NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy -ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV -BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo -Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 -4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 -KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI -rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi -94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB -sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi -gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo -kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE -vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA -A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t -O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua -AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP -9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ -eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m -0vdXcDazv/wor3ElhVsT/h5/WrQ8 ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 2 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 2 O=QuoVadis Limited -# Label: "QuoVadis Root CA 2" -# Serial: 1289 -# MD5 Fingerprint: 5e:39:7b:dd:f8:ba:ec:82:e9:ac:62:ba:0c:54:00:2b -# SHA1 Fingerprint: ca:3a:fb:cf:12:40:36:4b:44:b2:16:20:88:80:48:39:19:93:7c:f7 -# SHA256 Fingerprint: 85:a0:dd:7d:d7:20:ad:b7:ff:05:f8:3d:54:2b:20:9d:c7:ff:45:28:f7:d6:77:b1:83:89:fe:a5:e5:c4:9e:86 ------BEGIN CERTIFICATE----- -MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa -GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg -Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J -WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB -rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp -+ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 -ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i -Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz -PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og -/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH -oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI -yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud -EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 -A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL -MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT -ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f -BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn -g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl -fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K -WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha -B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc -hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR -TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD -mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z -ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y -4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza -8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 3" -# Serial: 1478 -# MD5 Fingerprint: 31:85:3c:62:94:97:63:b9:aa:fd:89:4e:af:6f:e0:cf -# SHA1 Fingerprint: 1f:49:14:f7:d8:74:95:1d:dd:ae:02:c0:be:fd:3a:2d:82:75:51:85 -# SHA256 Fingerprint: 18:f1:fc:7f:20:5d:f8:ad:dd:eb:7f:e0:07:dd:57:e3:af:37:5a:9c:4d:8d:73:54:6b:f4:f1:fe:d1:e1:8d:35 ------BEGIN CERTIFICATE----- -MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM -V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB -4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr -H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd -8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv -vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT -mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe -btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc -T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt -WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ -c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A -4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD -VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG -CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 -aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 -aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu -dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw -czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G -A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC -TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg -Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 -7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem -d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd -+LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B -4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN -t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x -DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 -k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s -zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j -Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT -mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK -4SVhM7JZG+Ju1zdXtg2pEto= ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Assured ID Root CA" -# Serial: 17154717934120587862167794914071425081 -# MD5 Fingerprint: 87:ce:0b:7b:2a:0e:49:00:e1:58:71:9b:37:a8:93:72 -# SHA1 Fingerprint: 05:63:b8:63:0d:62:d7:5a:bb:c8:ab:1e:4b:df:b5:a8:99:b2:4d:43 -# SHA256 Fingerprint: 3e:90:99:b5:01:5e:8f:48:6c:00:bc:ea:9d:11:1e:e7:21:fa:ba:35:5a:89:bc:f1:df:69:56:1e:3d:c6:32:5c ------BEGIN CERTIFICATE----- -MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c -JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP -mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ -wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 -VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ -AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB -AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun -pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC -dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf -fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm -NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx -H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe -+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Global Root CA" -# Serial: 10944719598952040374951832963794454346 -# MD5 Fingerprint: 79:e4:a9:84:0d:7d:3a:96:d7:c0:4f:e2:43:4c:89:2e -# SHA1 Fingerprint: a8:98:5d:3a:65:e5:e5:c4:b2:d7:d6:6d:40:c6:dd:2f:b1:9c:54:36 -# SHA256 Fingerprint: 43:48:a0:e9:44:4c:78:cb:26:5e:05:8d:5e:89:44:b4:d8:4f:96:62:bd:26:db:25:7f:89:34:a4:43:c7:01:61 ------BEGIN CERTIFICATE----- -MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD -QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB -CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 -nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt -43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P -T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 -gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO -BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR -TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw -DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr -hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg -06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF -PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls -YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk -CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= ------END CERTIFICATE----- - -# Issuer: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert High Assurance EV Root CA" -# Serial: 3553400076410547919724730734378100087 -# MD5 Fingerprint: d4:74:de:57:5c:39:b2:d3:9c:85:83:c5:c0:65:49:8a -# SHA1 Fingerprint: 5f:b7:ee:06:33:e2:59:db:ad:0c:4c:9a:e6:d3:8f:1a:61:c7:dc:25 -# SHA256 Fingerprint: 74:31:e5:f4:c3:c1:ce:46:90:77:4f:0b:61:e0:54:40:88:3b:a9:a0:1e:d0:0b:a6:ab:d7:80:6e:d3:b1:18:cf ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j -ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL -MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 -LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug -RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm -+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW -PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM -xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB -Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 -hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg -EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA -FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec -nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z -eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF -hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 -Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe -vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep -+OkuE6N36B9K ------END CERTIFICATE----- - -# Issuer: CN=SwissSign Gold CA - G2 O=SwissSign AG -# Subject: CN=SwissSign Gold CA - G2 O=SwissSign AG -# Label: "SwissSign Gold CA - G2" -# Serial: 13492815561806991280 -# MD5 Fingerprint: 24:77:d9:a8:91:d1:3b:fa:88:2d:c2:ff:f8:cd:33:93 -# SHA1 Fingerprint: d8:c5:38:8a:b7:30:1b:1b:6e:d4:7a:e6:45:25:3a:6f:9f:1a:27:61 -# SHA256 Fingerprint: 62:dd:0b:e9:b9:f5:0a:16:3e:a0:f8:e7:5c:05:3b:1e:ca:57:ea:55:c8:68:8f:64:7c:68:81:f2:c8:35:7b:95 ------BEGIN CERTIFICATE----- -MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln -biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF -MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT -d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC -CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 -76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ -bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c -6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE -emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd -MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt -MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y -MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y -FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi -aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM -gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB -qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 -lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn -8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov -L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 -45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO -UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 -O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC -bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv -GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a -77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC -hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 -92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp -Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w -ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt -Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ ------END CERTIFICATE----- - -# Issuer: CN=SecureTrust CA O=SecureTrust Corporation -# Subject: CN=SecureTrust CA O=SecureTrust Corporation -# Label: "SecureTrust CA" -# Serial: 17199774589125277788362757014266862032 -# MD5 Fingerprint: dc:32:c3:a7:6d:25:57:c7:68:09:9d:ea:2d:a9:a2:d1 -# SHA1 Fingerprint: 87:82:c6:c3:04:35:3b:cf:d2:96:92:d2:59:3e:7d:44:d9:34:ff:11 -# SHA256 Fingerprint: f1:c1:b5:0a:e5:a2:0d:d8:03:0e:c9:f6:bc:24:82:3d:d3:67:b5:25:57:59:b4:e7:1b:61:fc:e9:f7:37:5d:73 ------BEGIN CERTIFICATE----- -MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz -MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv -cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN -AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz -Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO -0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao -wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj -7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS -8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT -BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB -/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg -JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC -NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 -6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ -3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm -D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS -CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR -3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= ------END CERTIFICATE----- - -# Issuer: CN=Secure Global CA O=SecureTrust Corporation -# Subject: CN=Secure Global CA O=SecureTrust Corporation -# Label: "Secure Global CA" -# Serial: 9751836167731051554232119481456978597 -# MD5 Fingerprint: cf:f4:27:0d:d4:ed:dc:65:16:49:6d:3d:da:bf:6e:de -# SHA1 Fingerprint: 3a:44:73:5a:e5:81:90:1f:24:86:61:46:1e:3b:9c:c4:5f:f5:3a:1b -# SHA256 Fingerprint: 42:00:f5:04:3a:c8:59:0e:bb:52:7d:20:9e:d1:50:30:29:fb:cb:d4:1c:a1:b5:06:ec:27:f1:5a:de:7d:ac:69 ------BEGIN CERTIFICATE----- -MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx -MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg -Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ -iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa -/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ -jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI -HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 -sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w -gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw -KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG -AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L -URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO -H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm -I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY -iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc -f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW ------END CERTIFICATE----- - -# Issuer: CN=COMODO Certification Authority O=COMODO CA Limited -# Subject: CN=COMODO Certification Authority O=COMODO CA Limited -# Label: "COMODO Certification Authority" -# Serial: 104350513648249232941998508985834464573 -# MD5 Fingerprint: 5c:48:dc:f7:42:72:ec:56:94:6d:1c:cc:71:35:80:75 -# SHA1 Fingerprint: 66:31:bf:9e:f7:4f:9e:b6:c9:d5:a6:0c:ba:6a:be:d1:f7:bd:ef:7b -# SHA256 Fingerprint: 0c:2c:d6:3d:f7:80:6f:a3:99:ed:e8:09:11:6b:57:5b:f8:79:89:f0:65:18:f9:80:8c:86:05:03:17:8b:af:66 ------BEGIN CERTIFICATE----- -MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB -gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV -BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw -MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl -YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P -RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 -UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI -2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 -Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp -+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ -DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O -nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW -/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g -PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u -QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY -SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv -IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ -RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 -zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd -BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB -ZQ== ------END CERTIFICATE----- - -# Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited -# Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited -# Label: "COMODO ECC Certification Authority" -# Serial: 41578283867086692638256921589707938090 -# MD5 Fingerprint: 7c:62:ff:74:9d:31:53:5e:68:4a:d5:78:aa:1e:bf:23 -# SHA1 Fingerprint: 9f:74:4e:9f:2b:4d:ba:ec:0f:31:2c:50:b6:56:3b:8e:2d:93:c3:11 -# SHA256 Fingerprint: 17:93:92:7a:06:14:54:97:89:ad:ce:2f:8f:34:f7:f0:b6:6d:0f:3a:e3:a3:b8:4d:21:ec:15:db:ba:4f:ad:c7 ------BEGIN CERTIFICATE----- -MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL -MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE -BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT -IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwMzA2MDAw -MDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy -ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N -T0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlv -biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSR -FtSrYpn1PlILBs5BAH+X4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0J -cfRK9ChQtP6IHG4/bC8vCVlbpVsLM5niwz2J+Wos77LTBumjQjBAMB0GA1UdDgQW -BBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VGFAkK+qDm -fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv -GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= ------END CERTIFICATE----- - -# Issuer: CN=Certigna O=Dhimyotis -# Subject: CN=Certigna O=Dhimyotis -# Label: "Certigna" -# Serial: 18364802974209362175 -# MD5 Fingerprint: ab:57:a6:5b:7d:42:82:19:b5:d8:58:26:28:5e:fd:ff -# SHA1 Fingerprint: b1:2e:13:63:45:86:a4:6f:1a:b2:60:68:37:58:2d:c4:ac:fd:94:97 -# SHA256 Fingerprint: e3:b6:a2:db:2e:d7:ce:48:84:2f:7a:c5:32:41:c7:b7:1d:54:14:4b:fb:40:c1:1f:3f:1d:0b:42:f5:ee:a1:2d ------BEGIN CERTIFICATE----- -MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV -BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X -DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ -BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 -QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny -gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw -zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q -130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 -JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw -ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT -AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj -AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG -9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h -bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc -fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu -HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w -t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw -WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== ------END CERTIFICATE----- - -# Issuer: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority -# Subject: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority -# Label: "ePKI Root Certification Authority" -# Serial: 28956088682735189655030529057352760477 -# MD5 Fingerprint: 1b:2e:00:ca:26:06:90:3d:ad:fe:6f:15:68:d3:6b:b3 -# SHA1 Fingerprint: 67:65:0d:f1:7e:8e:7e:5b:82:40:a4:f4:56:4b:cf:e2:3d:69:c6:f0 -# SHA256 Fingerprint: c0:a6:f4:dc:63:a2:4b:fd:cf:54:ef:2a:6a:08:2a:0a:72:de:35:80:3e:2f:f5:ff:52:7a:e5:d8:72:06:df:d5 ------BEGIN CERTIFICATE----- -MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe -MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 -ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe -Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw -IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL -SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH -SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh -ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X -DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 -TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ -fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA -sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU -WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS -nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH -dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip -NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC -AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF -MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH -ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB -uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl -PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP -JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ -gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 -j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 -5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB -o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS -/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z -Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE -W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D -hNQ+IIX3Sj0rnP0qCglN6oH4EZw= ------END CERTIFICATE----- - -# Issuer: O=certSIGN OU=certSIGN ROOT CA -# Subject: O=certSIGN OU=certSIGN ROOT CA -# Label: "certSIGN ROOT CA" -# Serial: 35210227249154 -# MD5 Fingerprint: 18:98:c0:d6:e9:3a:fc:f9:b0:f5:0c:f7:4b:01:44:17 -# SHA1 Fingerprint: fa:b7:ee:36:97:26:62:fb:2d:b0:2a:f6:bf:03:fd:e8:7c:4b:2f:9b -# SHA256 Fingerprint: ea:a9:62:c4:fa:4a:6b:af:eb:e4:15:19:6d:35:1c:cd:88:8d:4f:53:f3:fa:8a:e6:d7:c4:66:a9:4e:60:42:bb ------BEGIN CERTIFICATE----- -MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT -AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD -QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP -MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do -0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ -UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d -RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ -OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv -JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C -AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O -BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ -LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY -MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ -44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I -Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw -i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN -9u6wWk5JRFRYX0KD ------END CERTIFICATE----- - -# Issuer: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) -# Subject: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) -# Label: "NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny" -# Serial: 80544274841616 -# MD5 Fingerprint: c5:a1:b7:ff:73:dd:d6:d7:34:32:18:df:fc:3c:ad:88 -# SHA1 Fingerprint: 06:08:3f:59:3f:15:a1:04:a0:69:a4:6b:a9:03:d0:06:b7:97:09:91 -# SHA256 Fingerprint: 6c:61:da:c3:a2:de:f0:31:50:6b:e0:36:d2:a6:fe:40:19:94:fb:d1:3d:f9:c8:d4:66:59:92:74:c4:46:ec:98 ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG -EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 -MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl -cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR -dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB -pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM -b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm -aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz -IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT -lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz -AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 -VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG -ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 -BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG -AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M -U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh -bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C -+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC -bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F -uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 -XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= ------END CERTIFICATE----- - -# Issuer: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. -# Subject: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. -# Label: "Microsec e-Szigno Root CA 2009" -# Serial: 14014712776195784473 -# MD5 Fingerprint: f8:49:f4:03:bc:44:2d:83:be:48:69:7d:29:64:fc:b1 -# SHA1 Fingerprint: 89:df:74:fe:5c:f4:0f:4a:80:f9:e3:37:7d:54:da:91:e1:01:31:8e -# SHA256 Fingerprint: 3c:5f:81:fe:a5:fa:b8:2c:64:bf:a2:ea:ec:af:cd:e8:e0:77:fc:86:20:a7:ca:e5:37:16:3d:f3:6e:db:f3:78 ------BEGIN CERTIFICATE----- -MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD -VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 -ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G -CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y -OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx -FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp -Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o -dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP -kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc -cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U -fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 -N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC -xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 -+rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM -Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG -SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h -mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk -ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 -tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c -2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t -HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 -# Label: "GlobalSign Root CA - R3" -# Serial: 4835703278459759426209954 -# MD5 Fingerprint: c5:df:b8:49:ca:05:13:55:ee:2d:ba:1a:c3:3e:b0:28 -# SHA1 Fingerprint: d6:9b:56:11:48:f0:1c:77:c5:45:78:c1:09:26:df:5b:85:69:76:ad -# SHA256 Fingerprint: cb:b5:22:d7:b7:f1:27:ad:6a:01:13:86:5b:df:1c:d4:10:2e:7d:07:59:af:63:5a:7c:f4:72:0d:c9:63:c5:3b ------BEGIN CERTIFICATE----- -MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G -A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp -Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 -MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG -A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 -RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT -gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm -KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd -QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ -XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw -DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o -LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU -RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp -jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK -6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX -mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs -Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH -WD9f ------END CERTIFICATE----- - -# Issuer: CN=Izenpe.com O=IZENPE S.A. -# Subject: CN=Izenpe.com O=IZENPE S.A. -# Label: "Izenpe.com" -# Serial: 917563065490389241595536686991402621 -# MD5 Fingerprint: a6:b0:cd:85:80:da:5c:50:34:a3:39:90:2f:55:67:73 -# SHA1 Fingerprint: 2f:78:3d:25:52:18:a7:4a:65:39:71:b5:2c:a2:9c:45:15:6f:e9:19 -# SHA256 Fingerprint: 25:30:cc:8e:98:32:15:02:ba:d9:6f:9b:1f:ba:1b:09:9e:2d:29:9e:0f:45:48:bb:91:4f:36:3b:c0:d4:53:1f ------BEGIN CERTIFICATE----- -MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 -MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 -ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD -VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j -b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq -scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO -xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H -LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX -uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD -yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ -JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q -rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN -BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L -hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB -QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ -HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu -Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg -QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB -BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx -MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA -A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb -laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 -awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo -JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw -LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT -VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk -LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb -UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ -QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ -naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls -QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== ------END CERTIFICATE----- - -# Issuer: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. -# Subject: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. -# Label: "Go Daddy Root Certificate Authority - G2" -# Serial: 0 -# MD5 Fingerprint: 80:3a:bc:22:c1:e6:fb:8d:9b:3b:27:4a:32:1b:9a:01 -# SHA1 Fingerprint: 47:be:ab:c9:22:ea:e8:0e:78:78:34:62:a7:9f:45:c2:54:fd:e6:8b -# SHA256 Fingerprint: 45:14:0b:32:47:eb:9c:c8:c5:b4:f0:d7:b5:30:91:f7:32:92:08:9e:6e:5a:63:e2:74:9d:d3:ac:a9:19:8e:da ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT -EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp -ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz -NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH -EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE -AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD -E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH -/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy -DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh -GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR -tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA -AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE -FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX -WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu -9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr -gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo -2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO -LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI -4uJEvlz36hz1 ------END CERTIFICATE----- - -# Issuer: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Subject: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Label: "Starfield Root Certificate Authority - G2" -# Serial: 0 -# MD5 Fingerprint: d6:39:81:c6:52:7e:96:69:fc:fc:ca:66:ed:05:f2:96 -# SHA1 Fingerprint: b5:1c:06:7c:ee:2b:0c:3d:f8:55:ab:2d:92:f4:fe:39:d4:e7:0f:0e -# SHA256 Fingerprint: 2c:e1:cb:0b:f9:d2:f9:e1:02:99:3f:be:21:51:52:c3:b2:dd:0c:ab:de:1c:68:e5:31:9b:83:91:54:db:b7:f5 ------BEGIN CERTIFICATE----- -MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs -ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw -MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 -b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj -aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp -Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg -nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 -HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N -Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN -dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 -HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G -CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU -sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 -4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg -8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K -pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 -mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 ------END CERTIFICATE----- - -# Issuer: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Subject: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. -# Label: "Starfield Services Root Certificate Authority - G2" -# Serial: 0 -# MD5 Fingerprint: 17:35:74:af:7b:61:1c:eb:f4:f9:3c:e2:ee:40:f9:a2 -# SHA1 Fingerprint: 92:5a:8f:8d:2c:6d:04:e0:66:5f:59:6a:ff:22:d8:63:e8:25:6f:3f -# SHA256 Fingerprint: 56:8d:69:05:a2:c8:87:08:a4:b3:02:51:90:ed:cf:ed:b1:97:4a:60:6a:13:c6:e5:29:0f:cb:2a:e6:3e:da:b5 ------BEGIN CERTIFICATE----- -MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs -ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 -MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy -ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy -dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p -OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 -8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K -Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe -hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk -6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw -DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q -AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI -bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB -ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z -qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd -iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn -0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN -sSi6 ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Commercial O=AffirmTrust -# Subject: CN=AffirmTrust Commercial O=AffirmTrust -# Label: "AffirmTrust Commercial" -# Serial: 8608355977964138876 -# MD5 Fingerprint: 82:92:ba:5b:ef:cd:8a:6f:a6:3d:55:f9:84:f6:d6:b7 -# SHA1 Fingerprint: f9:b5:b6:32:45:5f:9c:be:ec:57:5f:80:dc:e9:6e:2c:c7:b2:78:b7 -# SHA256 Fingerprint: 03:76:ab:1d:54:c5:f9:80:3c:e4:b2:e2:01:a0:ee:7e:ef:7b:57:b6:36:e8:a9:3c:9b:8d:48:60:c9:6f:5f:a7 ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP -Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr -ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL -MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1 -yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr -VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/ -nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG -XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj -vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt -Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g -N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC -nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Networking O=AffirmTrust -# Subject: CN=AffirmTrust Networking O=AffirmTrust -# Label: "AffirmTrust Networking" -# Serial: 8957382827206547757 -# MD5 Fingerprint: 42:65:ca:be:01:9a:9a:4c:a9:8c:41:49:cd:c0:d5:7f -# SHA1 Fingerprint: 29:36:21:02:8b:20:ed:02:f5:66:c5:32:d1:d6:ed:90:9f:45:00:2f -# SHA256 Fingerprint: 0a:81:ec:5a:92:97:77:f1:45:90:4a:f3:8d:5d:50:9f:66:b5:e2:c5:8f:cd:b5:31:05:8b:0e:17:f3:f0:b4:1b ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y -YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua -kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL -QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp -6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG -yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i -QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO -tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu -QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ -Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u -olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 -x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Premium O=AffirmTrust -# Subject: CN=AffirmTrust Premium O=AffirmTrust -# Label: "AffirmTrust Premium" -# Serial: 7893706540734352110 -# MD5 Fingerprint: c4:5d:0e:48:b6:ac:28:30:4e:0a:bc:f9:38:16:87:57 -# SHA1 Fingerprint: d8:a6:33:2c:e0:03:6f:b1:85:f6:63:4f:7d:6a:06:65:26:32:28:27 -# SHA256 Fingerprint: 70:a7:3f:7f:37:6b:60:07:42:48:90:45:34:b1:14:82:d5:bf:0e:69:8e:cc:49:8d:f5:25:77:eb:f2:e9:3b:9a ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz -dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG -A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U -cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf -qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ -JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ -+jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS -s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5 -HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7 -70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG -V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S -qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S -5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia -C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX -OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE -FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2 -KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg -Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B -8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ -MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc -0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ -u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF -u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH -YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 -GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO -RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e -KeC2uAloGRwYQw== ------END CERTIFICATE----- - -# Issuer: CN=AffirmTrust Premium ECC O=AffirmTrust -# Subject: CN=AffirmTrust Premium ECC O=AffirmTrust -# Label: "AffirmTrust Premium ECC" -# Serial: 8401224907861490260 -# MD5 Fingerprint: 64:b0:09:55:cf:b1:d5:99:e2:be:13:ab:a6:5d:ea:4d -# SHA1 Fingerprint: b8:23:6b:00:2f:1d:16:86:53:01:55:6c:11:a4:37:ca:eb:ff:c3:bb -# SHA256 Fingerprint: bd:71:fd:f6:da:97:e4:cf:62:d1:64:7a:dd:25:81:b0:7d:79:ad:f8:39:7e:b4:ec:ba:9c:5e:84:88:82:14:23 ------BEGIN CERTIFICATE----- -MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC -VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ -cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ -BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt -VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D -0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 -ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G -A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs -aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I -flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== ------END CERTIFICATE----- - -# Issuer: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Subject: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Label: "Certum Trusted Network CA" -# Serial: 279744 -# MD5 Fingerprint: d5:e9:81:40:c5:18:69:fc:46:2c:89:75:62:0f:aa:78 -# SHA1 Fingerprint: 07:e0:32:e0:20:b7:2c:3f:19:2f:06:28:a2:59:3a:19:a7:0f:06:9e -# SHA256 Fingerprint: 5c:58:46:8d:55:f5:8e:49:7e:74:39:82:d2:b5:00:10:b6:d1:65:37:4a:cf:83:a7:d4:a3:2d:b7:68:c4:40:8e ------BEGIN CERTIFICATE----- -MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM -MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D -ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU -cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 -WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg -Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw -IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH -UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM -TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU -BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM -kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x -AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV -HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y -sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL -I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 -J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY -VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI -03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= ------END CERTIFICATE----- - -# Issuer: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA -# Subject: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA -# Label: "TWCA Root Certification Authority" -# Serial: 1 -# MD5 Fingerprint: aa:08:8f:f6:f9:7b:b7:f2:b1:a7:1e:9b:ea:ea:bd:79 -# SHA1 Fingerprint: cf:9e:87:6d:d3:eb:fc:42:26:97:a3:b5:a3:7a:a0:76:a9:06:23:48 -# SHA256 Fingerprint: bf:d8:8f:e1:10:1c:41:ae:3e:80:1b:f8:be:56:35:0e:e9:ba:d1:a6:b9:bd:51:5e:dc:5c:6d:5b:87:11:ac:44 ------BEGIN CERTIFICATE----- -MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES -MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU -V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz -WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO -LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE -AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH -K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX -RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z -rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx -3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq -hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC -MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls -XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D -lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn -aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ -YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== ------END CERTIFICATE----- - -# Issuer: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 -# Subject: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 -# Label: "Security Communication RootCA2" -# Serial: 0 -# MD5 Fingerprint: 6c:39:7d:a4:0e:55:59:b2:3f:d6:41:b1:12:50:de:43 -# SHA1 Fingerprint: 5f:3b:8c:f2:f8:10:b3:7d:78:b4:ce:ec:19:19:c3:73:34:b9:c7:74 -# SHA256 Fingerprint: 51:3b:2c:ec:b8:10:d4:cd:e5:dd:85:39:1a:df:c6:c2:dd:60:d8:7b:b7:36:d2:b5:21:48:4a:a4:7a:0e:be:f6 ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl -MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe -U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX -DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy -dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj -YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV -OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr -zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM -VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ -hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO -ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw -awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs -OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 -DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF -coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc -okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 -t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy -1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ -SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 ------END CERTIFICATE----- - -# Issuer: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 -# Subject: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 -# Label: "Actalis Authentication Root CA" -# Serial: 6271844772424770508 -# MD5 Fingerprint: 69:c1:0d:4f:07:a3:1b:c3:fe:56:3d:04:bc:11:f6:a6 -# SHA1 Fingerprint: f3:73:b3:87:06:5a:28:84:8a:f2:f3:4a:ce:19:2b:dd:c7:8e:9c:ac -# SHA256 Fingerprint: 55:92:60:84:ec:96:3a:64:b9:6e:2a:be:01:ce:0b:a8:6a:64:fb:fe:bc:c7:aa:b5:af:c1:55:b3:7f:d7:60:66 ------BEGIN CERTIFICATE----- -MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE -BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w -MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 -IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC -SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 -ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv -UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX -4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 -KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ -gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb -rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ -51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F -be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe -KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F -v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn -fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 -jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz -ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt -ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL -e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 -jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz -WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V -SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j -pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX -X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok -fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R -K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU -ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU -LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT -LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== ------END CERTIFICATE----- - -# Issuer: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 -# Subject: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 -# Label: "Buypass Class 2 Root CA" -# Serial: 2 -# MD5 Fingerprint: 46:a7:d2:fe:45:fb:64:5a:a8:59:90:9b:78:44:9b:29 -# SHA1 Fingerprint: 49:0a:75:74:de:87:0a:47:fe:58:ee:f6:c7:6b:eb:c6:0b:12:40:99 -# SHA256 Fingerprint: 9a:11:40:25:19:7c:5b:b9:5d:94:e6:3d:55:cd:43:79:08:47:b6:46:b2:3c:df:11:ad:a4:a0:0e:ff:15:fb:48 ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr -6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV -L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 -1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx -MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ -QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB -arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr -Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi -FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS -P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN -9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz -uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h -9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s -A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t -OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo -+fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 -KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 -DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us -H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ -I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 -5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h -3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz -Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= ------END CERTIFICATE----- - -# Issuer: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 -# Subject: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 -# Label: "Buypass Class 3 Root CA" -# Serial: 2 -# MD5 Fingerprint: 3d:3b:18:9e:2c:64:5a:e8:d5:88:ce:0e:f9:37:c2:ec -# SHA1 Fingerprint: da:fa:f7:fa:66:84:ec:06:8f:14:50:bd:c7:c2:81:a5:bc:a9:64:57 -# SHA256 Fingerprint: ed:f7:eb:bc:a2:7a:2a:38:4d:38:7b:7d:40:10:c6:66:e2:ed:b4:84:3e:4c:29:b4:ae:1d:5b:93:32:e6:b2:4d ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y -ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E -N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 -tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX -0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c -/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X -KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY -zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS -O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D -34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP -K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv -Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj -QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV -cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS -IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 -HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa -O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv -033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u -dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE -kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 -3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD -u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq -4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= ------END CERTIFICATE----- - -# Issuer: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Subject: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Label: "T-TeleSec GlobalRoot Class 3" -# Serial: 1 -# MD5 Fingerprint: ca:fb:40:a8:4e:39:92:8a:1d:fe:8e:2f:c4:27:ea:ef -# SHA1 Fingerprint: 55:a6:72:3e:cb:f2:ec:cd:c3:23:74:70:19:9d:2a:be:11:e3:81:d1 -# SHA256 Fingerprint: fd:73:da:d3:1c:64:4f:f1:b4:3b:ef:0c:cd:da:96:71:0b:9c:d9:87:5e:ca:7e:31:70:7a:f3:e9:6d:52:2b:bd ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN -8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ -RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 -hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 -ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM -EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 -A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy -WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ -1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 -6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT -91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml -e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p -TpPDpFQUWw== ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH -# Subject: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH -# Label: "D-TRUST Root Class 3 CA 2 2009" -# Serial: 623603 -# MD5 Fingerprint: cd:e0:25:69:8d:47:ac:9c:89:35:90:f7:fd:51:3d:2f -# SHA1 Fingerprint: 58:e8:ab:b0:36:15:33:fb:80:f7:9b:1b:6d:29:d3:ff:8d:5f:00:f0 -# SHA256 Fingerprint: 49:e7:a4:42:ac:f0:ea:62:87:05:00:54:b5:25:64:b6:50:e4:f4:9e:42:e3:48:d6:aa:38:e0:39:e9:57:b1:c1 ------BEGIN CERTIFICATE----- -MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha -ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM -HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 -UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 -tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R -ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM -lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp -/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G -A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G -A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj -dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy -MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl -cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js -L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL -BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni -acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 -o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K -zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 -PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y -Johw1+qRzT65ysCQblrGXnRl11z+o+I= ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH -# Subject: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH -# Label: "D-TRUST Root Class 3 CA 2 EV 2009" -# Serial: 623604 -# MD5 Fingerprint: aa:c6:43:2c:5e:2d:cd:c4:34:c0:50:4f:11:02:4f:b6 -# SHA1 Fingerprint: 96:c9:1b:0b:95:b4:10:98:42:fa:d0:d8:22:79:fe:60:fa:b9:16:83 -# SHA256 Fingerprint: ee:c5:49:6b:98:8c:e9:86:25:b9:34:09:2e:ec:29:08:be:d0:b0:f3:16:c2:d4:73:0c:84:ea:f1:f3:d3:48:81 ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw -NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV -BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn -ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 -3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z -qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR -p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 -HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw -ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea -HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw -Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh -c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E -RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt -dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku -Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp -3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 -nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF -CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na -xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX -KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 ------END CERTIFICATE----- - -# Issuer: CN=CA Disig Root R2 O=Disig a.s. -# Subject: CN=CA Disig Root R2 O=Disig a.s. -# Label: "CA Disig Root R2" -# Serial: 10572350602393338211 -# MD5 Fingerprint: 26:01:fb:d8:27:a7:17:9a:45:54:38:1a:43:01:3b:03 -# SHA1 Fingerprint: b5:61:eb:ea:a4:de:e4:25:4b:69:1a:98:a5:57:47:c2:34:c7:d9:71 -# SHA256 Fingerprint: e2:3d:4a:03:6d:7b:70:e9:f5:95:b1:42:20:79:d2:b9:1e:df:bb:1f:b6:51:a0:63:3e:aa:8a:9d:c5:f8:07:03 ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV -BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu -MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy -MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx -EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw -ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe -NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH -PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I -x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe -QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR -yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO -QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 -H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ -QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD -i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs -nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 -rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud -DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI -hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM -tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf -GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb -lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka -+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal -TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i -nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 -gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr -G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os -zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x -L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL ------END CERTIFICATE----- - -# Issuer: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV -# Subject: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV -# Label: "ACCVRAIZ1" -# Serial: 6828503384748696800 -# MD5 Fingerprint: d0:a0:5a:ee:05:b6:09:94:21:a1:7d:f1:b2:29:82:02 -# SHA1 Fingerprint: 93:05:7a:88:15:c6:4f:ce:88:2f:fa:91:16:52:28:78:bc:53:64:17 -# SHA256 Fingerprint: 9a:6e:c0:12:e1:a7:da:9d:be:34:19:4d:47:8a:d7:c0:db:18:22:fb:07:1d:f1:29:81:49:6e:d1:04:38:41:13 ------BEGIN CERTIFICATE----- -MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE -AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw -CQYDVQQGEwJFUzAeFw0xMTA1MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQ -BgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwHUEtJQUNDVjENMAsGA1UECgwEQUND -VjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCb -qau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gMjmoY -HtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWo -G2ioPej0RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpA -lHPrzg5XPAOBOp0KoVdDaaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhr -IA8wKFSVf+DuzgpmndFALW4ir50awQUZ0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/ -0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDGWuzndN9wrqODJerWx5eH -k6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs78yM2x/47 -4KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMO -m3WR5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpa -cXpkatcnYGMN285J9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPl -uUsXQA+xtrn13k/c4LOsOxFwYIRKQ26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYI -KwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRwOi8vd3d3LmFjY3YuZXMvZmls -ZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEuY3J0MB8GCCsG -AQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 -VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeT -VfZW6oHlNsyMHj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIG -CCsGAQUFBwICMIIBFB6CARAAQQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUA -cgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBhAO0AegAgAGQAZQAgAGwAYQAgAEEA -QwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUAYwBuAG8AbABvAGcA -7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBjAHQA -cgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAA -QwBQAFMAIABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUA -czAwBggrBgEFBQcCARYkaHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2Mu -aHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRt -aW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2MV9kZXIuY3JsMA4GA1Ud -DwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZIhvcNAQEF -BQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdp -D70ER9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gU -JyCpZET/LtZ1qmxNYEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+m -AM/EKXMRNt6GGT6d7hmKG9Ww7Y49nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepD -vV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJTS+xJlsndQAJxGJ3KQhfnlms -tn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3sCPdK6jT2iWH -7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h -I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szA -h1xA2syVP1XgNce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xF -d3+YJ5oyXSrjhO7FmGYvliAd3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2H -pPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3pEfbRD0tVNEYqi4Y7 ------END CERTIFICATE----- - -# Issuer: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA -# Subject: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA -# Label: "TWCA Global Root CA" -# Serial: 3262 -# MD5 Fingerprint: f9:03:7e:cf:e6:9e:3c:73:7a:2a:90:07:69:ff:2b:96 -# SHA1 Fingerprint: 9c:bb:48:53:f6:a4:f6:d3:52:a4:e8:32:52:55:60:13:f5:ad:af:65 -# SHA256 Fingerprint: 59:76:90:07:f7:68:5d:0f:cd:50:87:2f:9f:95:d5:75:5a:5b:2b:45:7d:81:f3:69:2b:61:0a:98:67:2f:0e:1b ------BEGIN CERTIFICATE----- -MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx -EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT -VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 -NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT -B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF -10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz -0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh -MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH -zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc -46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 -yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi -laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP -oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA -BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE -qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm -4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL -1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn -LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF -H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo -RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ -nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh -15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW -6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW -nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j -wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz -aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy -KwbQBM0= ------END CERTIFICATE----- - -# Issuer: CN=TeliaSonera Root CA v1 O=TeliaSonera -# Subject: CN=TeliaSonera Root CA v1 O=TeliaSonera -# Label: "TeliaSonera Root CA v1" -# Serial: 199041966741090107964904287217786801558 -# MD5 Fingerprint: 37:41:49:1b:18:56:9a:26:f5:ad:c2:66:fb:40:a5:4c -# SHA1 Fingerprint: 43:13:bb:96:f1:d5:86:9b:c1:4e:6a:92:f6:cf:f6:34:69:87:82:37 -# SHA256 Fingerprint: dd:69:36:fe:21:f8:f0:77:c1:23:a1:a5:21:c1:22:24:f7:22:55:b7:3e:03:a7:26:06:93:e8:a2:4b:0f:a3:89 ------BEGIN CERTIFICATE----- -MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw -NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv -b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD -VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F -VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 -7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X -Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ -/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs -81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm -dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe -Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu -sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 -pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs -slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ -arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD -VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG -9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl -dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx -0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj -TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed -Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 -Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI -OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 -vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW -t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn -HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx -SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= ------END CERTIFICATE----- - -# Issuer: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Subject: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center -# Label: "T-TeleSec GlobalRoot Class 2" -# Serial: 1 -# MD5 Fingerprint: 2b:9b:9e:e4:7b:6c:1f:00:72:1a:cc:c1:77:79:df:6a -# SHA1 Fingerprint: 59:0d:2d:7d:88:4f:40:2e:61:7e:a5:62:32:17:65:cf:17:d8:94:e9 -# SHA256 Fingerprint: 91:e2:f5:78:8d:58:10:eb:a7:ba:58:73:7d:e1:54:8a:8e:ca:cd:01:45:98:bc:0b:14:3e:04:1b:17:05:25:52 ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd -AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC -FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi -1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq -jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ -wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ -WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy -NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC -uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw -IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 -g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN -9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP -BSeOE6Fuwg== ------END CERTIFICATE----- - -# Issuer: CN=Atos TrustedRoot 2011 O=Atos -# Subject: CN=Atos TrustedRoot 2011 O=Atos -# Label: "Atos TrustedRoot 2011" -# Serial: 6643877497813316402 -# MD5 Fingerprint: ae:b9:c4:32:4b:ac:7f:5d:66:cc:77:94:bb:2a:77:56 -# SHA1 Fingerprint: 2b:b1:f5:3e:55:0c:1d:c5:f1:d4:e6:b7:6a:46:4b:55:06:02:ac:21 -# SHA256 Fingerprint: f3:56:be:a2:44:b7:a9:1e:b3:5d:53:ca:9a:d7:86:4a:ce:01:8e:2d:35:d5:f8:f9:6d:df:68:a6:f4:1a:a4:74 ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE -AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG -EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM -FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC -REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp -Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM -VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+ -SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ -4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L -cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi -eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV -HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG -A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3 -DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j -vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP -DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc -maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D -lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv -KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 1 G3" -# Serial: 687049649626669250736271037606554624078720034195 -# MD5 Fingerprint: a4:bc:5b:3f:fe:37:9a:fa:64:f0:e2:fa:05:3d:0b:ab -# SHA1 Fingerprint: 1b:8e:ea:57:96:29:1a:c9:39:ea:b8:0a:81:1a:73:73:c0:93:79:67 -# SHA256 Fingerprint: 8a:86:6f:d1:b2:76:b5:7e:57:8e:92:1c:65:82:8a:2b:ed:58:e9:f2:f2:88:05:41:34:b7:f1:f4:bf:c9:cc:74 ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00 -MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakEPBtV -wedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWe -rNrwU8lmPNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF341 -68Xfuw6cwI2H44g4hWf6Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh -4Pw5qlPafX7PGglTvF0FBM+hSo+LdoINofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXp -UhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/lg6AnhF4EwfWQvTA9xO+o -abw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV7qJZjqlc -3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/G -KubX9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSt -hfbZxbGL0eUQMk1fiyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KO -Tk0k+17kBL5yG6YnLUlamXrXXAkgt3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOt -zCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZIhvcNAQELBQAD -ggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC -MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2 -cDMT/uFPpiN3GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUN -qXsCHKnQO18LwIE6PWThv6ctTr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5 -YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP+V04ikkwj+3x6xn0dxoxGE1nVGwv -b2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh3jRJjehZrJ3ydlo2 -8hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fawx/k -NSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNj -ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp -q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt -nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 2 G3" -# Serial: 390156079458959257446133169266079962026824725800 -# MD5 Fingerprint: af:0c:86:6e:bf:40:2d:7f:0b:3e:12:50:ba:12:3d:06 -# SHA1 Fingerprint: 09:3c:61:f3:8b:8b:dc:7d:55:df:75:38:02:05:00:e1:25:f5:c8:36 -# SHA256 Fingerprint: 8f:e4:fb:0a:f9:3a:4d:0d:67:db:0b:eb:b2:3e:37:c7:1b:f3:25:dc:bc:dd:24:0e:a0:4d:af:58:b4:7e:18:40 ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00 -MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFhZiFf -qq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMW -n4rjyduYNM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ym -c5GQYaYDFCDy54ejiK2toIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+ -O7q414AB+6XrW7PFXmAqMaCvN+ggOp+oMiwMzAkd056OXbxMmO7FGmh77FOm6RQ1 -o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+lV0POKa2Mq1W/xPtbAd0j -IaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZoL1NesNKq -IcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz -8eQQsSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43eh -vNURG3YBZwjgQQvD6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l -7ZizlWNof/k19N+IxWA1ksB8aRxhlRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALG -cC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZIhvcNAQELBQAD -ggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 -AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RC -roijQ1h5fq7KpVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0Ga -W/ZZGYjeVYg3UQt4XAoeo0L9x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4n -lv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgzdWqTHBLmYF5vHX/JHyPLhGGfHoJE -+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6XU/IyAgkwo1jwDQHV -csaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+NwmNtd -dbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNg -KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM -HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 -WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M ------END CERTIFICATE----- - -# Issuer: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited -# Subject: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited -# Label: "QuoVadis Root CA 3 G3" -# Serial: 268090761170461462463995952157327242137089239581 -# MD5 Fingerprint: df:7d:b9:ad:54:6f:68:a1:df:89:57:03:97:43:b0:d7 -# SHA1 Fingerprint: 48:12:bd:92:3c:a8:c4:39:06:e7:30:6d:27:96:e6:a4:cf:22:2e:7d -# SHA256 Fingerprint: 88:ef:81:de:20:2e:b0:18:45:2e:43:f8:64:72:5c:ea:5f:bd:1f:c2:d9:d2:05:73:07:09:c5:d8:b8:69:0f:46 ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQEL -BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc -BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00 -MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM -aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMgRzMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286IxSR -/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNu -FoM7pmRLMon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXR -U7Ox7sWTaYI+FrUoRqHe6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+c -ra1AdHkrAj80//ogaX3T7mH1urPnMNA3I4ZyYUUpSFlob3emLoG+B01vr87ERROR -FHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3UVDmrJqMz6nWB2i3ND0/k -A9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f75li59wzw -eyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634Ryl -sSqiMd5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBp -VzgeAVuNVejH38DMdyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0Q -A4XN8f+MFrXBsj6IbGB/kE+V9/YtrQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ -ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZIhvcNAQELBQAD -ggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px -KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnI -FUBhynLWcKzSt/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5Wvv -oxXqA/4Ti2Tk08HS6IT7SdEQTXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFg -u/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9DuDcpmvJRPpq3t/O5jrFc/ZSXPsoaP -0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGibIh6BJpsQBJFxwAYf -3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmDhPbl -8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+ -DhcI00iX0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HN -PlopNLk9hM6xZdRZkZFWdSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ -ywaZWWDYWGWVjUTR939+J399roD1B0y2PpxxVJkES/1Y+Zj0 ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Assured ID Root G2" -# Serial: 15385348160840213938643033620894905419 -# MD5 Fingerprint: 92:38:b9:f8:63:24:82:65:2c:57:33:e6:fe:81:8f:9d -# SHA1 Fingerprint: a1:4b:48:d9:43:ee:0a:0e:40:90:4f:3c:e0:a4:c0:91:93:51:5d:3f -# SHA256 Fingerprint: 7d:05:eb:b6:82:33:9f:8c:94:51:ee:09:4e:eb:fe:fa:79:53:a1:14:ed:b2:f4:49:49:45:2f:ab:7d:2f:c1:85 ------BEGIN CERTIFICATE----- -MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA -n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc -biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp -EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA -bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu -YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB -AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW -BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI -QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I -0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni -lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 -B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv -ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo -IhNzbM8m9Yop5w== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Assured ID Root G3" -# Serial: 15459312981008553731928384953135426796 -# MD5 Fingerprint: 7c:7f:65:31:0c:81:df:8d:ba:3e:99:e2:5c:ad:6e:fb -# SHA1 Fingerprint: f5:17:a2:4f:9a:48:c6:c9:f8:a2:00:26:9f:dc:0f:48:2c:ab:30:89 -# SHA256 Fingerprint: 7e:37:cb:8b:4c:47:09:0c:ab:36:55:1b:a6:f4:5d:b8:40:68:0f:ba:16:6a:95:2d:b1:00:71:7f:43:05:3f:c2 ------BEGIN CERTIFICATE----- -MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg -RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf -Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q -RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD -AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY -JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv -6pZjamVFkpUBtA== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Global Root G2" -# Serial: 4293743540046975378534879503202253541 -# MD5 Fingerprint: e4:a6:8a:c8:54:ac:52:42:46:0a:fd:72:48:1b:2a:44 -# SHA1 Fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4 -# SHA256 Fingerprint: cb:3c:cb:b7:60:31:e5:e0:13:8f:8d:d3:9a:23:f9:de:47:ff:c3:5e:43:c1:14:4c:ea:27:d4:6a:5a:b1:cb:5f ------BEGIN CERTIFICATE----- -MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH -MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI -2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx -1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ -q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz -tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ -vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV -5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY -1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 -NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG -Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 -8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe -pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl -MrY= ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Global Root G3" -# Serial: 7089244469030293291760083333884364146 -# MD5 Fingerprint: f5:5d:a4:50:a5:fb:28:7e:1e:0f:0d:cc:96:57:56:ca -# SHA1 Fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e -# SHA256 Fingerprint: 31:ad:66:48:f8:10:41:38:c7:38:f3:9e:a4:32:01:33:39:3e:3a:18:cc:02:29:6e:f9:7c:2a:c9:ef:67:31:d0 ------BEGIN CERTIFICATE----- -MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe -Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw -EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x -IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF -K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG -fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO -Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd -BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx -AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ -oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 -sycX ------END CERTIFICATE----- - -# Issuer: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com -# Subject: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com -# Label: "DigiCert Trusted Root G4" -# Serial: 7451500558977370777930084869016614236 -# MD5 Fingerprint: 78:f2:fc:aa:60:1f:2f:b4:eb:c9:37:ba:53:2e:75:49 -# SHA1 Fingerprint: dd:fb:16:cd:49:31:c9:73:a2:03:7d:3f:c8:3a:4d:7d:77:5d:05:e4 -# SHA256 Fingerprint: 55:2f:7b:dc:f1:a7:af:9e:6c:e6:72:01:7f:4f:12:ab:f7:72:40:c7:8e:76:1a:c2:03:d1:d9:d2:0a:c8:99:88 ------BEGIN CERTIFICATE----- -MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg -RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y -ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If -xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV -ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO -DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ -jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ -CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi -EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM -fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY -uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK -chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t -9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD -ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 -SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd -+SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc -fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa -sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N -cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N -0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie -4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI -r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 -/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm -gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ ------END CERTIFICATE----- - -# Issuer: CN=COMODO RSA Certification Authority O=COMODO CA Limited -# Subject: CN=COMODO RSA Certification Authority O=COMODO CA Limited -# Label: "COMODO RSA Certification Authority" -# Serial: 101909084537582093308941363524873193117 -# MD5 Fingerprint: 1b:31:b0:71:40:36:cc:14:36:91:ad:c4:3e:fd:ec:18 -# SHA1 Fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 -# SHA256 Fingerprint: 52:f0:e1:c4:e5:8e:c6:29:29:1b:60:31:7f:07:46:71:b8:5d:7e:a8:0d:5b:07:27:34:63:53:4b:32:b4:02:34 ------BEGIN CERTIFICATE----- -MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB -hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV -BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5 -MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT -EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR -Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR -6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X -pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC -9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV -/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf -Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z -+pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w -qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah -SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC -u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf -Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq -crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E -FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB -/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl -wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM -4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV -2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna -FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ -CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK -boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke -jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL -S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb -QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl -0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB -NVOFBkpdn627G190 ------END CERTIFICATE----- - -# Issuer: CN=USERTrust RSA Certification Authority O=The USERTRUST Network -# Subject: CN=USERTrust RSA Certification Authority O=The USERTRUST Network -# Label: "USERTrust RSA Certification Authority" -# Serial: 2645093764781058787591871645665788717 -# MD5 Fingerprint: 1b:fe:69:d1:91:b7:19:33:a3:72:a8:0f:e1:55:e5:b5 -# SHA1 Fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e -# SHA256 Fingerprint: e7:93:c9:b0:2f:d8:aa:13:e2:1c:31:22:8a:cc:b0:81:19:64:3b:74:9c:89:89:64:b1:74:6d:46:c3:d4:cb:d2 ------BEGIN CERTIFICATE----- -MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB -iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl -cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV -BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw -MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV -BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU -aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy -dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK -AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B -3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY -tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/ -Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2 -VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT -79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6 -c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT -Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l -c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee -UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE -Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd -BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G -A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF -Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO -VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3 -ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs -8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR -iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze -Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ -XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/ -qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB -VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB -L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG -jjxDah2nGN59PRbxYvnKkKj9 ------END CERTIFICATE----- - -# Issuer: CN=USERTrust ECC Certification Authority O=The USERTRUST Network -# Subject: CN=USERTrust ECC Certification Authority O=The USERTRUST Network -# Label: "USERTrust ECC Certification Authority" -# Serial: 123013823720199481456569720443997572134 -# MD5 Fingerprint: fa:68:bc:d9:b5:7f:ad:fd:c9:1d:06:83:28:cc:24:c1 -# SHA1 Fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e5:f0:5a:1d:0c:95:7d:f0 -# SHA256 Fingerprint: 4f:f4:60:d5:4b:9c:86:da:bf:bc:fc:57:12:e0:40:0d:2b:ed:3f:bc:4d:4f:bd:aa:86:e0:6a:dc:d2:a9:ad:7a ------BEGIN CERTIFICATE----- -MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl -eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT -JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx -MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT -Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg -VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo -I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng -o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G -A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB -zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW -RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 -# Label: "GlobalSign ECC Root CA - R5" -# Serial: 32785792099990507226680698011560947931244 -# MD5 Fingerprint: 9f:ad:3b:1c:02:1e:8a:ba:17:74:38:81:0c:a2:bc:08 -# SHA1 Fingerprint: 1f:24:c6:30:cd:a4:18:ef:20:69:ff:ad:4f:dd:5f:46:3a:1b:69:aa -# SHA256 Fingerprint: 17:9f:bc:14:8a:3d:d0:0f:d2:4e:a1:34:58:cc:43:bf:a7:f5:9c:81:82:d7:83:a5:13:f6:eb:ec:10:0c:89:24 ------BEGIN CERTIFICATE----- -MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk -MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH -bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX -DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD -QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu -MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc -8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke -hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI -KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg -515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO -xwy8p2Fp8fc74SrL+SvzZpA3 ------END CERTIFICATE----- - -# Issuer: CN=IdenTrust Commercial Root CA 1 O=IdenTrust -# Subject: CN=IdenTrust Commercial Root CA 1 O=IdenTrust -# Label: "IdenTrust Commercial Root CA 1" -# Serial: 13298821034946342390520003877796839426 -# MD5 Fingerprint: b3:3e:77:73:75:ee:a0:d3:e3:7e:49:63:49:59:bb:c7 -# SHA1 Fingerprint: df:71:7e:aa:4a:d9:4e:c9:55:84:99:60:2d:48:de:5f:bc:f0:3a:25 -# SHA256 Fingerprint: 5d:56:49:9b:e4:d2:e0:8b:cf:ca:d0:8a:3e:38:72:3d:50:50:3b:de:70:69:48:e4:2f:55:60:30:19:e5:28:ae ------BEGIN CERTIFICATE----- -MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBK -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVu -VHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQw -MTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScw -JQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ldhNlT -3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU -+ehcCuz/mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gp -S0l4PJNgiCL8mdo2yMKi1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1 -bVoE/c40yiTcdCMbXTMTEl3EASX2MN0CXZ/g1Ue9tOsbobtJSdifWwLziuQkkORi -T0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl3ZBWzvurpWCdxJ35UrCL -vYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzyNeVJSQjK -Vsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZK -dHzVWYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHT -c+XvvqDtMwt0viAgxGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hv -l7yTmvmcEpB4eoCHFddydJxVdHixuuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5N -iGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB -/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZIhvcNAQELBQAD -ggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH -6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwt -LRvM7Kqas6pgghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93 -nAbowacYXVKV7cndJZ5t+qntozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3 -+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmVYjzlVYA211QC//G5Xc7UI2/YRYRK -W2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUXfeu+h1sXIFRRk0pT -AwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/rokTLq -l1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG -4iZZRHUe2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZ -mUlO+KWA2yUPHGNiiskzZ2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A -7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7RcGzM7vRX+Bi6hG6H ------END CERTIFICATE----- - -# Issuer: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust -# Subject: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust -# Label: "IdenTrust Public Sector Root CA 1" -# Serial: 13298821034946342390521976156843933698 -# MD5 Fingerprint: 37:06:a5:b0:fc:89:9d:ba:f4:6b:8c:1a:64:cd:d5:ba -# SHA1 Fingerprint: ba:29:41:60:77:98:3f:f4:f3:ef:f2:31:05:3b:2e:ea:6d:4d:45:fd -# SHA256 Fingerprint: 30:d0:89:5a:9a:44:8a:26:20:91:63:55:22:d1:f5:20:10:b5:86:7a:ca:e1:2c:78:ef:95:8f:d4:f4:38:9f:2f ------BEGIN CERTIFICATE----- -MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBN -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVu -VHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcN -MzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0 -MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTyP4o7 -ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGy -RBb06tD6Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlS -bdsHyo+1W/CD80/HLaXIrcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF -/YTLNiCBWS2ab21ISGHKTN9T0a9SvESfqy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R -3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoSmJxZZoY+rfGwyj4GD3vw -EUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFnol57plzy -9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9V -GxyhLrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ -2fjXctscvG29ZV/viDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsV -WaFHVCkugyhfHMKiq3IXAAaOReyL4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gD -W/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMwDQYJKoZIhvcN -AQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj -t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHV -DRDtfULAj+7AmgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9 -TaDKQGXSc3z1i9kKlT/YPyNtGtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8G -lwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFtm6/n6J91eEyrRjuazr8FGF1NFTwW -mhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMxNRF4eKLg6TCMf4Df -WN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4Mhn5 -+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJ -tshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA -GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv -8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c ------END CERTIFICATE----- - -# Issuer: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only -# Subject: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only -# Label: "Entrust Root Certification Authority - G2" -# Serial: 1246989352 -# MD5 Fingerprint: 4b:e2:c9:91:96:65:0c:f4:0e:5a:93:92:a0:0a:fe:b2 -# SHA1 Fingerprint: 8c:f4:27:fd:79:0c:3a:d1:66:06:8d:e8:1e:57:ef:bb:93:22:72:d4 -# SHA256 Fingerprint: 43:df:57:74:b0:3e:7f:ef:5f:e4:0d:93:1a:7b:ed:f1:bb:2e:6b:42:73:8c:4e:6d:38:41:10:3d:3a:a7:f3:39 ------BEGIN CERTIFICATE----- -MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 -cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs -IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz -dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy -NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu -dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt -dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 -aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T -RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN -cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW -wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 -U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 -jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN -BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ -jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ -Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v -1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R -nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH -VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== ------END CERTIFICATE----- - -# Issuer: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only -# Subject: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only -# Label: "Entrust Root Certification Authority - EC1" -# Serial: 51543124481930649114116133369 -# MD5 Fingerprint: b6:7e:1d:f0:58:c5:49:6c:24:3b:3d:ed:98:18:ed:bc -# SHA1 Fingerprint: 20:d8:06:40:df:9b:25:f5:12:25:3a:11:ea:f7:59:8a:eb:14:b5:47 -# SHA256 Fingerprint: 02:ed:0e:b2:8c:14:da:45:16:5c:56:67:91:70:0d:64:51:d7:fb:56:f0:b2:ab:1d:3b:8e:b0:70:e5:6e:df:f5 ------BEGIN CERTIFICATE----- -MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG -A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 -d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu -dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq -RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy -MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD -VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 -L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g -Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi -A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt -ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH -Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O -BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC -R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX -hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G ------END CERTIFICATE----- - -# Issuer: CN=CFCA EV ROOT O=China Financial Certification Authority -# Subject: CN=CFCA EV ROOT O=China Financial Certification Authority -# Label: "CFCA EV ROOT" -# Serial: 407555286 -# MD5 Fingerprint: 74:e1:b6:ed:26:7a:7a:44:30:33:94:ab:7b:27:81:30 -# SHA1 Fingerprint: e2:b8:29:4b:55:84:ab:6b:58:c2:90:46:6c:ac:3f:b8:39:8f:84:83 -# SHA256 Fingerprint: 5c:c3:d7:8e:4e:1d:5e:45:54:7a:04:e6:87:3e:64:f9:0c:f9:53:6d:1c:cc:2e:f8:00:f3:55:c4:c5:fd:70:fd ------BEGIN CERTIFICATE----- -MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD -TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y -aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx -MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j -aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP -T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03 -sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL -TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5 -/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp -7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz -EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt -hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP -a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot -aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg -TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV -PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv -cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL -tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd -BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB -ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT -ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL -jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS -ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy -P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19 -xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d -Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN -5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe -/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z -AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ -5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su ------END CERTIFICATE----- - -# Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed -# Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed -# Label: "OISTE WISeKey Global Root GB CA" -# Serial: 157768595616588414422159278966750757568 -# MD5 Fingerprint: a4:eb:b9:61:28:2e:b7:2f:98:b0:35:26:90:99:51:1d -# SHA1 Fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed -# SHA256 Fingerprint: 6b:9c:08:e8:6e:b0:f7:67:cf:ad:65:cd:98:b6:21:49:e5:49:4a:67:f5:84:5e:7b:d1:ed:01:9f:27:b8:6b:d6 ------BEGIN CERTIFICATE----- -MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBt -MQswCQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUg -Rm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9i -YWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAwMzJaFw0zOTEyMDExNTEwMzFaMG0x -CzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBG -b3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh -bCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3 -HEokKtaXscriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGx -WuR51jIjK+FTzJlFXHtPrby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX -1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNk -u7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4oQnc/nSMbsrY9gBQHTC5P -99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvgGUpuuy9r -M2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUB -BAMCAQAwDQYJKoZIhvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrgh -cViXfa43FK8+5/ea4n32cZiZBKpDdHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5 -gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0VQreUGdNZtGn//3ZwLWoo4rO -ZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEuiHZeeevJuQHHf -aPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic -Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= ------END CERTIFICATE----- - -# Issuer: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. -# Subject: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. -# Label: "SZAFIR ROOT CA2" -# Serial: 357043034767186914217277344587386743377558296292 -# MD5 Fingerprint: 11:64:c1:89:b0:24:b1:8c:b1:07:7e:89:9e:51:9e:99 -# SHA1 Fingerprint: e2:52:fa:95:3f:ed:db:24:60:bd:6e:28:f3:9c:cc:cf:5e:b3:3f:de -# SHA256 Fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe ------BEGIN CERTIFICATE----- -MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQEL -BQAwUTELMAkGA1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6 -ZW5pb3dhIFMuQS4xGDAWBgNVBAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkw -NzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9L -cmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYDVQQDDA9TWkFGSVIg -Uk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5QqEvN -QLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT -3PSQ1hNKDJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw -3gAeqDRHu5rr/gsUvTaE2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr6 -3fE9biCloBK0TXC5ztdyO4mTp4CEHCdJckm1/zuVnsHMyAHs6A6KCpbns6aH5db5 -BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwiieDhZNRnvDF5YTy7ykHN -XGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD -AgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsF -AAOCAQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw -8PRBEew/R40/cof5O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOG -nXkZ7/e7DDWQw4rtTw/1zBLZpD67oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCP -oky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul4+vJhaAlIDf7js4MNIThPIGy -d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg -LvWpCz/UXeHPhJ/iGcJfitYgHuNztw== ------END CERTIFICATE----- - -# Issuer: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Subject: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority -# Label: "Certum Trusted Network CA 2" -# Serial: 44979900017204383099463764357512596969 -# MD5 Fingerprint: 6d:46:9e:d9:25:6d:08:23:5b:5e:74:7d:1e:27:db:f2 -# SHA1 Fingerprint: d3:dd:48:3e:2b:bf:4c:05:e8:af:10:f5:fa:76:26:cf:d3:dc:30:92 -# SHA256 Fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 ------BEGIN CERTIFICATE----- -MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCB -gDELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu -QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIG -A1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQSAyMCIYDzIwMTExMDA2MDgz -OTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQTDEiMCAGA1UEChMZ -VW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3 -b3JrIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWA -DGSdhhuWZGc/IjoedQF97/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn -0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+oCgCXhVqqndwpyeI1B+twTUrWwbNWuKFB -OJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40bRr5HMNUuctHFY9rnY3lE -fktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2puTRZCr+E -Sv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1m -o130GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02i -sx7QBlrd9pPPV3WZ9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOW -OZV7bIBaTxNyxtd9KXpEulKkKtVBRgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgez -Tv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pyehizKV/Ma5ciSixqClnrDvFAS -adgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vMBhBgu4M1t15n -3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD -AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMC -AQYwDQYJKoZIhvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQ -F/xlhMcQSZDe28cmk4gmb3DWAl45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTf -CVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuAL55MYIR4PSFk1vtBHxgP58l1cb29 -XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMoclm2q8KMZiYcdywm -djWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tMpkT/ -WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jb -AoJnwTnbw3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksq -P/ujmv5zMnHCnsZy4YpoJ/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Ko -b7a6bINDd82Kkhehnlt4Fj1F4jNy3eFmypnTycUm/Q1oBEauttmbjL4ZvrHG8hnj -XALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLXis7VmFxWlgPF7ncGNf/P -5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7zAYspsbi -DrW5viSP ------END CERTIFICATE----- - -# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Subject: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Label: "Hellenic Academic and Research Institutions RootCA 2015" -# Serial: 0 -# MD5 Fingerprint: ca:ff:e2:db:03:d9:cb:4b:e9:0f:ad:84:fd:7b:18:ce -# SHA1 Fingerprint: 01:0c:06:95:a6:98:19:14:ff:bf:5f:c6:b0:b6:95:ea:29:e9:12:a6 -# SHA256 Fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 ------BEGIN CERTIFICATE----- -MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1Ix -DzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5k -IFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMT -N0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9v -dENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAxMTIxWjCBpjELMAkG -A1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNh -ZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkx -QDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 -dGlvbnMgUm9vdENBIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC -AQDC+Kk/G4n8PDwEXT2QNrCROnk8ZlrvbTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA -4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+ehiGsxr/CL0BgzuNtFajT0 -AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+6PAQZe10 -4S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06C -ojXdFPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV -9Cz82XBST3i4vTwri5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrD -gfgXy5I2XdGj2HUb4Ysn6npIQf1FGQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6 -Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2fu/Z8VFRfS0myGlZYeCsargq -NhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9muiNX6hME6wGko -LfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc -Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVd -ctA4GGqd83EkVAswDQYJKoZIhvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0I -XtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+D1hYc2Ryx+hFjtyp8iY/xnmMsVMI -M4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrMd/K4kPFox/la/vot -9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+yd+2V -Z5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/ea -j8GsGsVn82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnh -X9izjFk0WaSrT2y7HxjbdavYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQ -l033DlZdwJVqwjbDG2jJ9SrcR5q+ss7FJej6A7na+RZukYT1HCjI/CbM1xyQVqdf -bzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVtJ94Cj8rDtSvK6evIIVM4 -pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGaJI7ZjnHK -e7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0 -vm9qp/UsQu0yrbYhnr68 ------END CERTIFICATE----- - -# Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority -# Label: "Hellenic Academic and Research Institutions ECC RootCA 2015" -# Serial: 0 -# MD5 Fingerprint: 81:e5:b4:17:eb:c2:f5:e1:4b:0d:41:7b:49:92:fe:ef -# SHA1 Fingerprint: 9f:f1:71:8d:92:d5:9a:f3:7d:74:97:b4:bc:6f:84:68:0b:ba:b6:66 -# SHA256 Fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b1:15:82:dc:48:7b:48:33 ------BEGIN CERTIFICATE----- -MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzAN -BgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl -c2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hl -bGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgRUNDIFJv -b3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEwMzcxMlowgaoxCzAJ -BgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmljIEFj -YWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5 -MUQwQgYDVQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0 -dXRpb25zIEVDQyBSb290Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKg -QehLgoRc4vgxEZmGZE4JJS+dQS8KrjVPdJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJa -jq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoKVlp8aQuqgAkkbH7BRqNC -MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLQi -C4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaep -lSTAGiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7Sof -TUwJCA3sS61kFyjndc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR ------END CERTIFICATE----- - -# Issuer: CN=ISRG Root X1 O=Internet Security Research Group -# Subject: CN=ISRG Root X1 O=Internet Security Research Group -# Label: "ISRG Root X1" -# Serial: 172886928669790476064670243504169061120 -# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e -# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8 -# SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 ------BEGIN CERTIFICATE----- -MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw -TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh -cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 -WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu -ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc -h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ -0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U -A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW -T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH -B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC -B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv -KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn -OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn -jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw -qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI -rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq -hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL -ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ -3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK -NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 -ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur -TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC -jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc -oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq -4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA -mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d -emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= ------END CERTIFICATE----- - -# Issuer: O=FNMT-RCM OU=AC RAIZ FNMT-RCM -# Subject: O=FNMT-RCM OU=AC RAIZ FNMT-RCM -# Label: "AC RAIZ FNMT-RCM" -# Serial: 485876308206448804701554682760554759 -# MD5 Fingerprint: e2:09:04:b4:d3:bd:d1:a0:14:fd:1a:d2:47:c4:57:1d -# SHA1 Fingerprint: ec:50:35:07:b2:15:c4:95:62:19:e2:a8:9a:5b:42:99:2c:4c:2c:20 -# SHA256 Fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa ------BEGIN CERTIFICATE----- -MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsx -CzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJ -WiBGTk1ULVJDTTAeFw0wODEwMjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJ -BgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBG -Tk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALpxgHpMhm5/ -yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcfqQgf -BBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAz -WHFctPVrbtQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxF -tBDXaEAUwED653cXeuYLj2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z -374jNUUeAlz+taibmSXaXvMiwzn15Cou08YfxGyqxRxqAQVKL9LFwag0Jl1mpdIC -IfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mwWsXmo8RZZUc1g16p6DUL -mbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnTtOmlcYF7 -wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peS -MKGJ47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2 -ZSysV4999AeU14ECll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMet -UqIJ5G+GR4of6ygnXYMgrwTJbFaai0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUw -AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPd9xf3E6Jobd2Sn9R2gzL+H -YJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwOi8vd3d3 -LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD -nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1 -RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYM -LVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf -77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2N -JpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jm -fZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp -6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp -1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B -9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wok -RqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYv -uu8wd+RU4riEmViAqhOLUTpPSPaLtrM= ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 1 O=Amazon -# Subject: CN=Amazon Root CA 1 O=Amazon -# Label: "Amazon Root CA 1" -# Serial: 143266978916655856878034712317230054538369994 -# MD5 Fingerprint: 43:c6:bf:ae:ec:fe:ad:2f:18:c6:88:68:30:fc:c8:e6 -# SHA1 Fingerprint: 8d:a7:f9:65:ec:5e:fc:37:91:0f:1c:6e:59:fd:c1:cc:6a:6e:de:16 -# SHA256 Fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e ------BEGIN CERTIFICATE----- -MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF -ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 -b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL -MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv -b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj -ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM -9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw -IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6 -VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L -93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm -jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA -A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI -U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs -N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv -o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU -5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy -rqXRfboQnoZsG4q5WTP468SQvvG5 ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 2 O=Amazon -# Subject: CN=Amazon Root CA 2 O=Amazon -# Label: "Amazon Root CA 2" -# Serial: 143266982885963551818349160658925006970653239 -# MD5 Fingerprint: c8:e5:8d:ce:a8:42:e2:7a:c0:2a:5c:7c:9e:26:bf:66 -# SHA1 Fingerprint: 5a:8c:ef:45:d7:a6:98:59:76:7a:8c:8b:44:96:b5:78:cf:47:4b:1a -# SHA256 Fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 ------BEGIN CERTIFICATE----- -MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF -ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 -b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL -MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv -b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK -gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ -W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg -1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K -8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r -2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me -z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR -8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj -mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz -7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6 -+XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI -0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB -Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm -UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2 -LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY -+gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS -k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl -7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm -btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl -urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+ -fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63 -n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE -76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H -9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT -4PsJYGw= ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 3 O=Amazon -# Subject: CN=Amazon Root CA 3 O=Amazon -# Label: "Amazon Root CA 3" -# Serial: 143266986699090766294700635381230934788665930 -# MD5 Fingerprint: a0:d4:ef:0b:f7:b5:d8:49:95:2a:ec:f5:c4:fc:81:87 -# SHA1 Fingerprint: 0d:44:dd:8c:3c:8c:1a:1a:58:75:64:81:e9:0f:2e:2a:ff:b3:d2:6e -# SHA256 Fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:69:f5:03:43:b4:6d:b3:a4 ------BEGIN CERTIFICATE----- -MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5 -MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g -Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG -A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg -Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl -ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr -ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr -BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM -YyRIHN8wfdVoOw== ------END CERTIFICATE----- - -# Issuer: CN=Amazon Root CA 4 O=Amazon -# Subject: CN=Amazon Root CA 4 O=Amazon -# Label: "Amazon Root CA 4" -# Serial: 143266989758080763974105200630763877849284878 -# MD5 Fingerprint: 89:bc:27:d5:eb:17:8d:06:6a:69:d5:fd:89:47:b4:cd -# SHA1 Fingerprint: f6:10:84:07:d6:f8:bb:67:98:0c:c2:e2:44:c2:eb:ae:1c:ef:63:be -# SHA256 Fingerprint: e3:5d:28:41:9e:d0:20:25:cf:a6:90:38:cd:62:39:62:45:8d:a5:c6:95:fb:de:a3:c2:2b:0b:fb:25:89:70:92 ------BEGIN CERTIFICATE----- -MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5 -MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g -Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG -A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg -Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi -9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk -M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB -/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB -MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw -CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW -1KyLa2tJElMzrdfkviT8tQp21KW8EA== ------END CERTIFICATE----- - -# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM -# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM -# Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1" -# Serial: 1 -# MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49 -# SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca -# SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 ------BEGIN CERTIFICATE----- -MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx -GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp -bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w -KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0 -BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy -dW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYDVQQG -EwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXll -IEJpbGltc2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklU -QUsxLTArBgNVBAsTJEthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBT -TTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11IFNNIFNTTCBLb2sgU2VydGlmaWthc2kg -LSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr3UwM6q7 -a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y86Ij5iySr -LqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INr -N3wcwv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2X -YacQuFWQfw4tJzh03+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/ -iSIzL+aFCr2lqBs23tPcLG07xxO9WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4f -AJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQUZT/HiobGPN08VFw1+DrtUgxH -V8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL -BQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh -AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPf -IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4 -lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c -8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf -lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= ------END CERTIFICATE----- - -# Issuer: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. -# Subject: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. -# Label: "GDCA TrustAUTH R5 ROOT" -# Serial: 9009899650740120186 -# MD5 Fingerprint: 63:cc:d9:3d:34:35:5c:6f:53:a3:e2:08:70:48:1f:b4 -# SHA1 Fingerprint: 0f:36:38:5b:81:1a:25:c3:9b:31:4e:83:ca:e9:34:66:70:cc:74:b4 -# SHA256 Fingerprint: bf:ff:8f:d0:44:33:48:7d:6a:8a:a6:0c:1a:29:76:7a:9f:c2:bb:b0:5e:42:0f:71:3a:13:b9:92:89:1d:38:93 ------BEGIN CERTIFICATE----- -MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UE -BhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ -IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0 -MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVowYjELMAkGA1UEBhMCQ04xMjAwBgNV -BAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8w -HQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJj -Dp6L3TQsAlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBj -TnnEt1u9ol2x8kECK62pOqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+u -KU49tm7srsHwJ5uu4/Ts765/94Y9cnrrpftZTqfrlYwiOXnhLQiPzLyRuEH3FMEj -qcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ9Cy5WmYqsBebnh52nUpm -MUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQxXABZG12 -ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloP -zgsMR6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3Gk -L30SgLdTMEZeS1SZD2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeC -jGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4oR24qoAATILnsn8JuLwwoC8N9VKejveSswoA -HQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx9hoh49pwBiFYFIeFd3mqgnkC -AwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlRMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg -p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZm -DRd9FBUb1Ov9H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5 -COmSdI31R9KrO9b7eGZONn356ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ry -L3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd+PwyvzeG5LuOmCd+uh8W4XAR8gPf -JWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQHtZa37dG/OaG+svg -IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io -2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV -09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ -XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq -T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe -MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g== ------END CERTIFICATE----- - -# Issuer: CN=SSL.com Root Certification Authority RSA O=SSL Corporation -# Subject: CN=SSL.com Root Certification Authority RSA O=SSL Corporation -# Label: "SSL.com Root Certification Authority RSA" -# Serial: 8875640296558310041 -# MD5 Fingerprint: 86:69:12:c0:70:f1:ec:ac:ac:c2:d5:bc:a5:5b:a1:29 -# SHA1 Fingerprint: b7:ab:33:08:d1:ea:44:77:ba:14:80:12:5a:6f:bd:a9:36:49:0c:bb -# SHA256 Fingerprint: 85:66:6a:56:2e:e0:be:5c:e9:25:c1:d8:89:0a:6f:76:a8:7e:c1:6d:4d:7d:5f:29:ea:74:19:cf:20:12:3b:69 ------BEGIN CERTIFICATE----- -MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UE -BhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQK -DA9TU0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYwMjEyMTczOTM5WhcNNDEwMjEyMTcz -OTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv -dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv -bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcN -AQEBBQADggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2R -xFdHaxh3a3by/ZPkPQ/CFp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aX -qhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcC -C52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/geoeOy3ZExqysdBP+lSgQ3 -6YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkpk8zruFvh -/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrF -YD3ZfBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93E -JNyAKoFBbZQ+yODJgUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVc -US4cK38acijnALXRdMbX5J+tB5O2UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8 -ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi81xtZPCvM8hnIk2snYxnP/Okm -+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4sbE6x/c+cCbqi -M+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV -HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4G -A1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGV -cpNxJK1ok1iOMq8bs3AD/CUrdIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBc -Hadm47GUBwwyOabqG7B52B2ccETjit3E+ZUfijhDPwGFpUenPUayvOUiaPd7nNgs -PgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAslu1OJD7OAUN5F7kR/ -q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjqerQ0 -cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jr -a6x+3uxjMxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90I -H37hVZkLId6Tngr75qNJvTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/Y -K9f1JmzJBjSWFupwWRoyeXkLtoh/D1JIPb9s2KJELtFOt3JY04kTlf5Eq/jXixtu -nLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktuf -oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY -Ic2wBlX7Jz9TkHCpBB5XJ7k= ------END CERTIFICATE----- - -# Issuer: CN=SSL.com Root Certification Authority ECC O=SSL Corporation -# Subject: CN=SSL.com Root Certification Authority ECC O=SSL Corporation -# Label: "SSL.com Root Certification Authority ECC" -# Serial: 8495723813297216424 -# MD5 Fingerprint: 2e:da:e4:39:7f:9c:8f:37:d1:70:9f:26:17:51:3a:8e -# SHA1 Fingerprint: c3:19:7c:39:24:e6:54:af:1b:c4:ab:20:95:7a:e2:c3:0e:13:02:6a -# SHA256 Fingerprint: 34:17:bb:06:cc:60:07:da:1b:96:1c:92:0b:8a:b4:ce:3f:ad:82:0e:4a:a3:0b:9a:cb:c4:a7:4e:bd:ce:bc:65 ------BEGIN CERTIFICATE----- -MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMC -VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T -U0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNDAzWhcNNDEwMjEyMTgxNDAz -WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0 -b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNvbSBS -b290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB -BAAiA2IABEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI -7Z4INcgn64mMU1jrYor+8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPg -CemB+vNH06NjMGEwHQYDVR0OBBYEFILRhXMw5zUE044CkvvlpNHEIejNMA8GA1Ud -EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTTjgKS++Wk0cQh6M0wDgYD -VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T -kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+ -gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl ------END CERTIFICATE----- - -# Issuer: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation -# Subject: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation -# Label: "SSL.com EV Root Certification Authority RSA R2" -# Serial: 6248227494352943350 -# MD5 Fingerprint: e1:1e:31:58:1a:ae:54:53:02:f6:17:6a:11:7b:4d:95 -# SHA1 Fingerprint: 74:3a:f0:52:9b:d0:32:a0:f4:4a:83:cd:d4:ba:a9:7b:7c:2e:c4:9a -# SHA256 Fingerprint: 2e:7b:f1:6c:c2:24:85:a7:bb:e2:aa:86:96:75:07:61:b0:ae:39:be:3b:2f:e9:d0:cc:6d:4e:f7:34:91:42:5c ------BEGIN CERTIFICATE----- -MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNV -BAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UE -CgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2Vy -dGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMB4XDTE3MDUzMTE4MTQzN1oXDTQy -MDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4G -A1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQD -DC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvq -M0fNTPl9fb69LT3w23jhhqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssuf -OePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7wcXHswxzpY6IXFJ3vG2fThVUCAtZJycxa -4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTOZw+oz12WGQvE43LrrdF9 -HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+B6KjBSYR -aZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcA -b9ZhCBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQ -Gp8hLH94t2S42Oim9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQV -PWKchjgGAGYS5Fl2WlPAApiiECtoRHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMO -pgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+SlmJuwgUHfbSguPvuUCYHBBXtSu -UDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48+qvWBkofZ6aY -MBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV -HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa4 -9QaAJadz20ZpqJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBW -s47LCp1Jjr+kxJG7ZhcFUZh1++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5 -Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nxY/hoLVUE0fKNsKTPvDxeH3jnpaAg -cLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2GguDKBAdRUNf/ktUM -79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDzOFSz -/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXt -ll9ldDz7CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEm -Kf7GUmG6sXP/wwyc5WxqlD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKK -QbNmC1r7fSOl8hqw/96bg5Qu0T/fkreRrwU7ZcegbLHNYhLDkBvjJc40vG93drEQ -w/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooi -S9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07 -mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== ------END CERTIFICATE----- - -# Issuer: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation -# Subject: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation -# Label: "SSL.com EV Root Certification Authority ECC" -# Serial: 3182246526754555285 -# MD5 Fingerprint: 59:53:22:65:83:42:01:54:c0:ce:42:b9:5a:7c:f2:90 -# SHA1 Fingerprint: 4c:dd:51:a3:d1:f5:20:32:14:b0:c6:c5:32:23:03:91:c7:46:42:6d -# SHA256 Fingerprint: 22:a2:c1:f7:bd:ed:70:4c:c1:e7:01:b5:f4:08:c3:10:88:0f:e9:56:b5:de:2a:4a:44:f9:9c:87:3a:25:a7:c8 ------BEGIN CERTIFICATE----- -MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMC -VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T -U0wgQ29ycG9yYXRpb24xNDAyBgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNTIzWhcNNDEwMjEyMTgx -NTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv -dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NMLmNv -bSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49 -AgEGBSuBBAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMA -VIbc/R/fALhBYlzccBYy3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1Kthku -WnBaBu2+8KGwytAJKaNjMGEwHQYDVR0OBBYEFFvKXuXe0oGqzagtZFG22XKbl+ZP -MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe5d7SgarNqC1kUbbZcpuX -5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJN+vp1RPZ -ytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZg -h5Mmm7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 -# Label: "GlobalSign Root CA - R6" -# Serial: 1417766617973444989252670301619537 -# MD5 Fingerprint: 4f:dd:07:e4:d4:22:64:39:1e:0c:37:42:ea:d1:c6:ae -# SHA1 Fingerprint: 80:94:64:0e:b5:a7:a1:ca:11:9c:1f:dd:d5:9f:81:02:63:a7:fb:d1 -# SHA256 Fingerprint: 2c:ab:ea:fe:37:d0:6c:a2:2a:ba:73:91:c0:03:3d:25:98:29:52:c4:53:64:73:49:76:3a:3a:b5:ad:6c:cf:69 ------BEGIN CERTIFICATE----- -MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEg -MB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2Jh -bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQx -MjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjET -MBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQssgrRI -xutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1k -ZguSgMpE3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxD -aNc9PIrFsmbVkJq3MQbFvuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJw -LnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqMPKq0pPbzlUoSB239jLKJz9CgYXfIWHSw -1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+azayOeSsJDa38O+2HBNX -k7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05OWgtH8wY2 -SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/h -bguyCLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4n -WUx2OVvq+aWh2IMP0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpY -rZxCRXluDocZXFSxZba/jJvcE+kNb7gu3GduyYsRtYQUigAZcIN5kZeR1Bonvzce -MgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTAD -AQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNVHSMEGDAWgBSu -bAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN -nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGt -Ixg93eFyRJa0lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr61 -55wsTLxDKZmOMNOsIeDjHfrYBzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLj -vUYAGm0CuiVdjaExUd1URhxN25mW7xocBFymFe944Hn+Xds+qkxV/ZoVqW/hpvvf -cDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr3TsTjxKM4kEaSHpz -oHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB10jZp -nOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfs -pA9MRf/TuTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+v -JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R -8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW4 -5hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA= ------END CERTIFICATE----- - -# Issuer: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed -# Subject: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed -# Label: "OISTE WISeKey Global Root GC CA" -# Serial: 44084345621038548146064804565436152554 -# MD5 Fingerprint: a9:d6:b9:2d:2f:93:64:f8:a5:69:ca:91:e9:68:07:23 -# SHA1 Fingerprint: e0:11:84:5e:34:de:be:88:81:b9:9c:f6:16:26:d1:96:1f:c3:b9:31 -# SHA256 Fingerprint: 85:60:f9:1c:36:24:da:ba:95:70:b5:fe:a0:db:e3:6f:f1:1a:83:23:be:94:86:85:4f:b3:f3:4a:55:71:19:8d ------BEGIN CERTIFICATE----- -MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQsw -CQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91 -bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwg -Um9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRaFw00MjA1MDkwOTU4MzNaMG0xCzAJ -BgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBGb3Vu -ZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2JhbCBS -b290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4ni -eUqjFqdrVCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4W -p2OQ0jnUsYd4XxiWD1AbNTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7T -rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV -57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtkAjEA2zQg -Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 ------END CERTIFICATE----- - -# Issuer: CN=UCA Global G2 Root O=UniTrust -# Subject: CN=UCA Global G2 Root O=UniTrust -# Label: "UCA Global G2 Root" -# Serial: 124779693093741543919145257850076631279 -# MD5 Fingerprint: 80:fe:f0:c4:4a:f0:5c:62:32:9f:1c:ba:78:a9:50:f8 -# SHA1 Fingerprint: 28:f9:78:16:19:7a:ff:18:25:18:aa:44:fe:c1:a0:ce:5c:b6:4c:8a -# SHA256 Fingerprint: 9b:ea:11:c9:76:fe:01:47:64:c1:be:56:a6:f9:14:b5:a5:60:31:7a:bd:99:88:39:33:82:e5:16:1a:a0:49:3c ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9 -MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBH -bG9iYWwgRzIgUm9vdDAeFw0xNjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0x -CzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlUcnVzdDEbMBkGA1UEAwwSVUNBIEds -b2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxeYr -b3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmToni9 -kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzm -VHqUwCoV8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/R -VogvGjqNO7uCEeBHANBSh6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDc -C/Vkw85DvG1xudLeJ1uK6NjGruFZfc8oLTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIj -tm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/R+zvWr9LesGtOxdQXGLY -D0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBeKW4bHAyv -j5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6Dl -NaBa4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6 -iIis7nCs+dwp4wwcOxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznP -O6Q0ibd5Ei9Hxeepl2n8pndntd978XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/ -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIHEjMz15DD/pQwIX4wV -ZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj -L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5 -1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl -1qnN3e92mI0ADs0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oU -b3n09tDh05S60FdRvScFDcH9yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LV -PtateJLbXDzz2K36uGt/xDYotgIVilQsnLAXc47QN6MUPJiVAAwpBVueSUmxX8fj -y88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHojhJi6IjMtX9Gl8Cb -EGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZkbxqg -DMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI -+Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy -YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bX -UB+K+wb1whnw0A== ------END CERTIFICATE----- - -# Issuer: CN=UCA Extended Validation Root O=UniTrust -# Subject: CN=UCA Extended Validation Root O=UniTrust -# Label: "UCA Extended Validation Root" -# Serial: 106100277556486529736699587978573607008 -# MD5 Fingerprint: a1:f3:5f:43:c6:34:9b:da:bf:8c:7e:05:53:ad:96:e2 -# SHA1 Fingerprint: a3:a1:b0:6f:24:61:23:4a:e3:36:a5:c2:37:fc:a6:ff:dd:f0:d7:3a -# SHA256 Fingerprint: d4:3a:f9:b3:54:73:75:5c:96:84:fc:06:d7:d8:cb:70:ee:5c:28:e7:73:fb:29:4e:b4:1e:e7:17:22:92:4d:24 ------BEGIN CERTIFICATE----- -MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBH -MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBF -eHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMx -MDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNV -BAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrsiWog -D4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvS -sPGP2KxFRv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aop -O2z6+I9tTcg1367r3CTueUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dk -sHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR59mzLC52LqGj3n5qiAno8geK+LLNEOfi -c0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH0mK1lTnj8/FtDw5lhIpj -VMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KRel7sFsLz -KuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/ -TuDvB0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41G -sx2VYVdWf6/wFlthWG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs -1+lvK9JKBZP8nm9rZ/+I8U6laUpSNwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQD -fwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS3H5aBZ8eNJr34RQwDwYDVR0T -AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADaN -l8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR -ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQ -VBcZEhrxH9cMaVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5 -c6sq1WnIeJEmMX3ixzDx/BR4dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp -4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb+7lsq+KePRXBOy5nAliRn+/4Qh8s -t2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOWF3sGPjLtx7dCvHaj -2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwiGpWO -vpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2C -xR9GUeOcGMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmx -cmtpzyKEC2IPrNkZAJSidjzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbM -fjKaiJUINlK73nZfdklJrX+9ZSCyycErdhh2n1ax ------END CERTIFICATE----- - -# Issuer: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 -# Subject: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 -# Label: "Certigna Root CA" -# Serial: 269714418870597844693661054334862075617 -# MD5 Fingerprint: 0e:5c:30:62:27:eb:5b:bc:d7:ae:62:ba:e9:d5:df:77 -# SHA1 Fingerprint: 2d:0d:52:14:ff:9e:ad:99:24:01:74:20:47:6e:6c:85:27:27:f5:43 -# SHA256 Fingerprint: d4:8d:3d:23:ee:db:50:a4:59:e5:51:97:60:1c:27:77:4b:9d:7b:18:c9:4d:5a:05:95:11:a1:02:50:b9:31:68 ------BEGIN CERTIFICATE----- -MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAw -WjELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAw -MiA0ODE0NjMwODEwMDAzNjEZMBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0x -MzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjdaMFoxCzAJBgNVBAYTAkZSMRIwEAYD -VQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYzMDgxMDAwMzYxGTAX -BgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sO -ty3tRQgXstmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9M -CiBtnyN6tMbaLOQdLNyzKNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPu -I9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8JXrJhFwLrN1CTivngqIkicuQstDuI7pm -TLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16XdG+RCYyKfHx9WzMfgIh -C59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq4NYKpkDf -ePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3Yz -IoejwpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWT -Co/1VTp2lc5ZmIoJlXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1k -JWumIWmbat10TWuXekG9qxf5kBdIjzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5 -hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp//TBt2dzhauH8XwIDAQABo4IB -GjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE -FBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of -1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczov -L3d3d3cuY2VydGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilo -dHRwOi8vY3JsLmNlcnRpZ25hLmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYr -aHR0cDovL2NybC5kaGlteW90aXMuY29tL2NlcnRpZ25hcm9vdGNhLmNybDANBgkq -hkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOItOoldaDgvUSILSo3L -6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxPTGRG -HVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH6 -0BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB -lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdi -o2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1 -gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/v -faci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63 -Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayh -jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw -3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0= ------END CERTIFICATE----- - -# Issuer: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI -# Subject: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI -# Label: "emSign Root CA - G1" -# Serial: 235931866688319308814040 -# MD5 Fingerprint: 9c:42:84:57:dd:cb:0b:a7:2e:95:ad:b6:f3:da:bc:ac -# SHA1 Fingerprint: 8a:c7:ad:8f:73:ac:4e:c1:b5:75:4d:a5:40:f4:fc:cf:7c:b5:8e:8c -# SHA256 Fingerprint: 40:f6:af:03:46:a9:9a:a1:cd:1d:55:5a:4e:9c:ce:62:c7:f9:63:46:03:ee:40:66:15:83:3d:c8:c8:d0:03:67 ------BEGIN CERTIFICATE----- -MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYD -VQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBU -ZWNobm9sb2dpZXMgTGltaXRlZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBH -MTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgxODMwMDBaMGcxCzAJBgNVBAYTAklO -MRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVkaHJhIFRlY2hub2xv -Z2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQz -f2N4aLTNLnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO -8oG0x5ZOrRkVUkr+PHB1cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aq -d7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHWDV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhM -tTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ6DqS0hdW5TUaQBw+jSzt -Od9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrHhQIDAQAB -o0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQD -AgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31x -PaOfG1vR2vjTnGs2vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjM -wiI/aTvFthUvozXGaCocV685743QNcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6d -GNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q+Mri/Tm3R7nrft8EI6/6nAYH -6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeihU80Bv2noWgby -RQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx -iN66zB+Afko= ------END CERTIFICATE----- - -# Issuer: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI -# Subject: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI -# Label: "emSign ECC Root CA - G3" -# Serial: 287880440101571086945156 -# MD5 Fingerprint: ce:0b:72:d1:9f:88:8e:d0:50:03:e8:e3:b8:8b:67:40 -# SHA1 Fingerprint: 30:43:fa:4f:f2:57:dc:a0:c3:80:ee:2e:58:ea:78:b2:3f:e6:bb:c1 -# SHA256 Fingerprint: 86:a1:ec:ba:08:9c:4a:8d:3b:be:27:34:c6:12:ba:34:1d:81:3e:04:3c:f9:e8:a8:62:cd:5c:57:a3:6b:be:6b ------BEGIN CERTIFICATE----- -MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG -EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo -bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g -RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ -TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s -b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw -djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 -WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS -fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB -zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq -hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB -CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD -+JbNR6iC8hZVdyR+EhCVBCyj ------END CERTIFICATE----- - -# Issuer: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI -# Subject: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI -# Label: "emSign Root CA - C1" -# Serial: 825510296613316004955058 -# MD5 Fingerprint: d8:e3:5d:01:21:fa:78:5a:b0:df:ba:d2:ee:2a:5f:68 -# SHA1 Fingerprint: e7:2e:f1:df:fc:b2:09:28:cf:5d:d4:d5:67:37:b1:51:cb:86:4f:01 -# SHA256 Fingerprint: 12:56:09:aa:30:1d:a0:a2:49:b9:7a:82:39:cb:6a:34:21:6f:44:dc:ac:9f:39:54:b1:42:92:f2:e8:c8:60:8f ------BEGIN CERTIFICATE----- -MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkG -A1UEBhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEg -SW5jMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAw -MFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln -biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNpZ24gUm9v -dCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+upufGZ -BczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZ -HdPIWoU/Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH -3DspVpNqs8FqOp099cGXOFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvH -GPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4VI5b2P/AgNBbeCsbEBEV5f6f9vtKppa+c -xSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleoomslMuoaJuvimUnzYnu3Yy1 -aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+XJGFehiq -TbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL -BQADggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87 -/kOXSTKZEhVb3xEp/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4 -kqNPEjE2NuLe/gDEo2APJ62gsIq1NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrG -YQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9wC68AivTxEDkigcxHpvOJpkT -+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQBmIMMMAVSKeo -WXzhriKi4gp6D/piq1JM4fHfyr6DDUI= ------END CERTIFICATE----- - -# Issuer: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI -# Subject: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI -# Label: "emSign ECC Root CA - C3" -# Serial: 582948710642506000014504 -# MD5 Fingerprint: 3e:53:b3:a3:81:ee:d7:10:f8:d3:b0:1d:17:92:f5:d5 -# SHA1 Fingerprint: b6:af:43:c2:9b:81:53:7d:f6:ef:6b:c3:1f:1f:60:15:0c:ee:48:66 -# SHA256 Fingerprint: bc:4d:80:9b:15:18:9d:78:db:3e:1d:8c:f4:f9:72:6a:79:5d:a1:64:3c:a5:f1:35:8e:1d:db:0e:dc:0d:7e:b3 ------BEGIN CERTIFICATE----- -MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQG -EwJVUzETMBEGA1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMx -IDAeBgNVBAMTF2VtU2lnbiBFQ0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAw -MFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln -biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQDExdlbVNpZ24gRUND -IFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd6bci -MK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4Ojavti -sIGJAnB9SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0O -BBYEFPtaSNCAIEDyqOkAB2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB -Af8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQC02C8Cif22TGK6Q04ThHK1rt0c -3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwUZOR8loMRnLDRWmFLpg9J -0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== ------END CERTIFICATE----- - -# Issuer: CN=Hongkong Post Root CA 3 O=Hongkong Post -# Subject: CN=Hongkong Post Root CA 3 O=Hongkong Post -# Label: "Hongkong Post Root CA 3" -# Serial: 46170865288971385588281144162979347873371282084 -# MD5 Fingerprint: 11:fc:9f:bd:73:30:02:8a:fd:3f:f3:58:b9:cb:20:f0 -# SHA1 Fingerprint: 58:a2:d0:ec:20:52:81:5b:c1:f3:f8:64:02:24:4e:c2:8e:02:4b:02 -# SHA256 Fingerprint: 5a:2f:c0:3f:0c:83:b0:90:bb:fa:40:60:4b:09:88:44:6c:76:36:18:3d:f9:84:6e:17:10:1a:44:7f:b8:ef:d6 ------BEGIN CERTIFICATE----- -MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQEL -BQAwbzELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJ -SG9uZyBLb25nMRYwFAYDVQQKEw1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25n -a29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2MDMwMjI5NDZaFw00MjA2MDMwMjI5 -NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcxEjAQBgNVBAcT -CUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMXSG9u -Z2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK -AoICAQCziNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFO -dem1p+/l6TWZ5Mwc50tfjTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mI -VoBc+L0sPOFMV4i707mV78vH9toxdCim5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV -9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOesL4jpNrcyCse2m5FHomY -2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj0mRiikKY -vLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+Tt -bNe/JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZb -x39ri1UbSsUgYT2uy1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+ -l2oBlKN8W4UdKjk60FSh0Tlxnf0h+bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YK -TE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsGxVd7GYYKecsAyVKvQv83j+Gj -Hno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwIDAQABo2MwYTAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e -i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEw -DQYJKoZIhvcNAQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG -7BJ8dNVI0lkUmcDrudHr9EgwW62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCk -MpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWldy8joRTnU+kLBEUx3XZL7av9YROXr -gZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov+BS5gLNdTaqX4fnk -GMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDceqFS -3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJm -Ozj/2ZQw9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+ -l6mc1X5VTMbeRRAc6uk7nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6c -JfTzPV4e0hz5sy229zdcxsshTrD3mUcYhcErulWuBurQB7Lcq9CClnXO0lD+mefP -L5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB60PZ2Pierc+xYw5F9KBa -LJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fqdBb9HxEG -mpv0 ------END CERTIFICATE----- - -# Issuer: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation -# Subject: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation -# Label: "Microsoft ECC Root Certificate Authority 2017" -# Serial: 136839042543790627607696632466672567020 -# MD5 Fingerprint: dd:a1:03:e6:4a:93:10:d1:bf:f0:19:42:cb:fe:ed:67 -# SHA1 Fingerprint: 99:9a:64:c3:7f:f4:7d:9f:ab:95:f1:47:69:89:14:60:ee:c4:c3:c5 -# SHA256 Fingerprint: 35:8d:f3:9d:76:4a:f9:e1:b7:66:e9:c9:72:df:35:2e:e1:5c:fa:c2:27:af:6a:d1:d7:0e:8e:4a:6e:dc:ba:02 ------BEGIN CERTIFICATE----- -MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQsw -CQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYD -VQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIw -MTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJV -UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy -b3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZR -ogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYb -hGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3 -FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zV -L8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUB -iudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M= ------END CERTIFICATE----- - -# Issuer: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation -# Subject: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation -# Label: "Microsoft RSA Root Certificate Authority 2017" -# Serial: 40975477897264996090493496164228220339 -# MD5 Fingerprint: 10:ff:00:ff:cf:c9:f8:c7:7a:c0:ee:35:8e:c9:0f:47 -# SHA1 Fingerprint: 73:a5:e6:4a:3b:ff:83:16:ff:0e:dc:cc:61:8a:90:6e:4e:ae:4d:74 -# SHA256 Fingerprint: c7:41:f7:0f:4b:2a:8d:88:bf:2e:71:c1:41:22:ef:53:ef:10:eb:a0:cf:a5:e6:4c:fa:20:f4:18:85:30:73:e0 ------BEGIN CERTIFICATE----- -MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBl -MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw -NAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIwNzE4MjMwMDIzWjBlMQswCQYDVQQG -EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1N -aWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZ -Nt9GkMml7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0 -ZdDMbRnMlfl7rEqUrQ7eS0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1 -HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw71VdyvD/IybLeS2v4I2wDwAW9lcfNcztm -gGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+dkC0zVJhUXAoP8XFWvLJ -jEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49FyGcohJUc -aDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaG -YaRSMLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6 -W6IYZVcSn2i51BVrlMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4K -UGsTuqwPN1q3ErWQgR5WrlcihtnJ0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH -+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJClTUFLkqqNfs+avNJVgyeY+Q -W5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC -NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZC -LgLNFgVZJ8og6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OC -gMNPOsduET/m4xaRhPtthH80dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6 -tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk+ONVFT24bcMKpBLBaYVu32TxU5nh -SnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex/2kskZGT4d9Mozd2 -TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDyAmH3 -pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGR -xpl/j8nWZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiApp -GWSZI1b7rCoucL5mxAyE7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9 -dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKTc0QWbej09+CVgI+WXTik9KveCjCHk9hN -AHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZB -RA+GsCyRxj3qrg+E ------END CERTIFICATE----- - -# Issuer: CN=e-Szigno Root CA 2017 O=Microsec Ltd. -# Subject: CN=e-Szigno Root CA 2017 O=Microsec Ltd. -# Label: "e-Szigno Root CA 2017" -# Serial: 411379200276854331539784714 -# MD5 Fingerprint: de:1f:f6:9e:84:ae:a7:b4:21:ce:1e:58:7d:d1:84:98 -# SHA1 Fingerprint: 89:d4:83:03:4f:9e:9a:48:80:5f:72:37:d4:a9:a6:ef:cb:7c:1f:d1 -# SHA256 Fingerprint: be:b0:0b:30:83:9b:9b:c3:2c:32:e4:44:79:05:95:06:41:f2:64:21:b1:5e:d0:89:19:8b:51:8a:e2:ea:1b:99 ------BEGIN CERTIFICATE----- -MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNV -BAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRk -LjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJv -b3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZaFw00MjA4MjIxMjA3MDZaMHExCzAJ -BgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMg -THRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25v -IFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtv -xie+RJCxs1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+H -Wyx7xf58etqjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBSHERUI0arBeAyxr87GyZDvvzAEwDAfBgNVHSMEGDAWgBSHERUI0arB -eAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEAtVfd14pVCzbhhkT61Nlo -jbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxOsvxyqltZ -+efcMQ== ------END CERTIFICATE----- - -# Issuer: O=CERTSIGN SA OU=certSIGN ROOT CA G2 -# Subject: O=CERTSIGN SA OU=certSIGN ROOT CA G2 -# Label: "certSIGN Root CA G2" -# Serial: 313609486401300475190 -# MD5 Fingerprint: 8c:f1:75:8a:c6:19:cf:94:b7:f7:65:20:87:c3:97:c7 -# SHA1 Fingerprint: 26:f9:93:b4:ed:3d:28:27:b0:b9:4b:a7:e9:15:1d:a3:8d:92:e5:32 -# SHA256 Fingerprint: 65:7c:fe:2f:a7:3f:aa:38:46:25:71:f3:32:a2:36:3a:46:fc:e7:02:09:51:71:07:02:cd:fb:b6:ee:da:33:05 ------BEGIN CERTIFICATE----- -MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNV -BAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04g -Uk9PVCBDQSBHMjAeFw0xNzAyMDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJ -BgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJ -R04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDF -dRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05N0Iw -vlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZ -uIt4ImfkabBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhp -n+Sc8CnTXPnGFiWeI8MgwT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKs -cpc/I1mbySKEwQdPzH/iV8oScLumZfNpdWO9lfsbl83kqK/20U6o2YpxJM02PbyW -xPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91QqhngLjYl/rNUssuHLoPj1P -rCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732jcZZroiF -DsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fx -DTvf95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgy -LcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6C -eWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB -/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg4BXrzkwJ -d8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq -kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC -b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQl -qiCA2ClV9+BB/AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0 -OJD7uNGzcgbJceaBxXntC6Z58hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+c -NywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXk -ltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklWatKcsWMy5WHgUyIO -pwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tUSxfj -03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZk -PuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE -1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MX -QRBdJ3NghVdJIgc= ------END CERTIFICATE----- - -# Issuer: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. -# Subject: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. -# Label: "Trustwave Global Certification Authority" -# Serial: 1846098327275375458322922162 -# MD5 Fingerprint: f8:1c:18:2d:2f:ba:5f:6d:a1:6c:bc:c7:ab:91:c7:0e -# SHA1 Fingerprint: 2f:8f:36:4f:e1:58:97:44:21:59:87:a5:2a:9a:d0:69:95:26:7f:b5 -# SHA256 Fingerprint: 97:55:20:15:f5:dd:fc:3c:87:88:c0:06:94:45:55:40:88:94:45:00:84:f1:00:86:70:86:bc:1a:2b:b5:8d:c8 ------BEGIN CERTIFICATE----- -MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQsw -CQYDVQQGEwJVUzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28x -ITAfBgNVBAoMGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1 -c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMx -OTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJVUzERMA8GA1UECAwI -SWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2ZSBI -b2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB -ALldUShLPDeS0YLOvR29zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0Xzn -swuvCAAJWX/NKSqIk4cXGIDtiLK0thAfLdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu -7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4BqstTnoApTAbqOl5F2brz8 -1Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9oWN0EACyW -80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotP -JqX+OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1l -RtzuzWniTY+HKE40Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfw -hI0Vcnyh78zyiGG69Gm7DIwLdVcEuE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10 -coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm+9jaJXLE9gCxInm943xZYkqc -BW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqjifLJS3tBEW1n -twiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud -EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1Ud -DwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W -0OhUKDtkLSGm+J1WE2pIPU/HPinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfe -uyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0HZJDmHvUqoai7PF35owgLEQzxPy0Q -lG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla4gt5kNdXElE1GYhB -aCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5RvbbE -sLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPT -MaCm/zjdzyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qe -qu5AvzSxnI9O4fKSTx+O856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxh -VicGaeVyQYHTtgGJoC86cnn+OjC/QezHYj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8 -h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu3R3y4G5OBVixwJAWKqQ9 -EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP29FpHOTK -yeC2nOnOcXHebD8WpHk= ------END CERTIFICATE----- - -# Issuer: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. -# Subject: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. -# Label: "Trustwave Global ECC P256 Certification Authority" -# Serial: 4151900041497450638097112925 -# MD5 Fingerprint: 5b:44:e3:8d:5d:36:86:26:e8:0d:05:d2:59:a7:83:54 -# SHA1 Fingerprint: b4:90:82:dd:45:0c:be:8b:5b:b1:66:d3:e2:a4:08:26:cd:ed:42:cf -# SHA256 Fingerprint: 94:5b:bc:82:5e:a5:54:f4:89:d1:fd:51:a7:3d:df:2e:a6:24:ac:70:19:a0:52:05:22:5c:22:a7:8c:cf:a8:b4 ------BEGIN CERTIFICATE----- -MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYD -VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf -BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 -YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x -NzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYDVQQGEwJVUzERMA8G -A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 -d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF -Q0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqG -SM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN -FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8w -DwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcw -CgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wgh -DDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7 ------END CERTIFICATE----- - -# Issuer: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. -# Subject: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. -# Label: "Trustwave Global ECC P384 Certification Authority" -# Serial: 2704997926503831671788816187 -# MD5 Fingerprint: ea:cf:60:c4:3b:b9:15:29:40:a1:97:ed:78:27:93:d6 -# SHA1 Fingerprint: e7:f3:a3:c8:cf:6f:c3:04:2e:6d:0e:67:32:c5:9e:68:95:0d:5e:d2 -# SHA256 Fingerprint: 55:90:38:59:c8:c0:c3:eb:b8:75:9e:ce:4e:25:57:22:5f:f5:75:8b:bd:38:eb:d4:82:76:60:1e:1b:d5:80:97 ------BEGIN CERTIFICATE----- -MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYD -VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf -BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 -YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x -NzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYDVQQGEwJVUzERMA8G -A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 -d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF -Q0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuB -BAAiA2IABGvaDXU1CDFHBa5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJ -j9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr/TklZvFe/oyujUF5nQlgziip04pt89ZF -1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwYAMB0G -A1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNnADBkAjA3 -AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC -MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu -Sw== ------END CERTIFICATE----- - -# Issuer: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. -# Subject: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. -# Label: "NAVER Global Root Certification Authority" -# Serial: 9013692873798656336226253319739695165984492813 -# MD5 Fingerprint: c8:7e:41:f6:25:3b:f5:09:b3:17:e8:46:3d:bf:d0:9b -# SHA1 Fingerprint: 8f:6b:f2:a9:27:4a:da:14:a0:c4:f4:8e:61:27:f9:c0:1e:78:5d:d1 -# SHA256 Fingerprint: 88:f4:38:dc:f8:ff:d1:fa:8f:42:91:15:ff:e5:f8:2a:e1:e0:6e:0c:70:c3:75:fa:ad:71:7b:34:a4:9e:72:65 ------BEGIN CERTIFICATE----- -MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEM -BQAwaTELMAkGA1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRG -T1JNIENvcnAuMTIwMAYDVQQDDClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4NDJaFw0zNzA4MTgyMzU5NTlaMGkx -CzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVTUyBQTEFURk9STSBD -b3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlvbiBB -dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVA -iQqrDZBbUGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH -38dq6SZeWYp34+hInDEW+j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lE -HoSTGEq0n+USZGnQJoViAbbJAh2+g1G7XNr4rRVqmfeSVPc0W+m/6imBEtRTkZaz -kVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2aacp+yPOiNgSnABIqKYP -szuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4Yb8Obtoq -vC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHf -nZ3zVHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaG -YQ5fG8Ir4ozVu53BA0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo -0es+nPxdGoMuK8u180SdOqcXYZaicdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3a -CJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejyYhbLgGvtPe31HzClrkvJE+2K -AQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNVHQ4EFgQU0p+I -36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB -Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoN -qo0hV4/GPnrK21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatj -cu3cvuzHV+YwIHHW1xDBE1UBjCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm -+LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bxhYTeodoS76TiEJd6eN4MUZeoIUCL -hr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTgE34h5prCy8VCZLQe -lHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTHD8z7 -p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8 -piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR -LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX -5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO -dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul -9XXeifdy ------END CERTIFICATE----- - -# Issuer: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres -# Subject: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres -# Label: "AC RAIZ FNMT-RCM SERVIDORES SEGUROS" -# Serial: 131542671362353147877283741781055151509 -# MD5 Fingerprint: 19:36:9c:52:03:2f:d2:d1:bb:23:cc:dd:1e:12:55:bb -# SHA1 Fingerprint: 62:ff:d9:9e:c0:65:0d:03:ce:75:93:d2:ed:3f:2d:32:c9:e3:e5:4a -# SHA256 Fingerprint: 55:41:53:b1:3d:2c:f9:dd:b7:53:bf:be:1a:4e:0a:e0:8d:0a:a4:18:70:58:fe:60:a2:b8:62:b2:e4:b8:7b:cb ------BEGIN CERTIFICATE----- -MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw -CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw -FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S -Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 -MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL -DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS -QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB -BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH -sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK -Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu -SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC -MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy -v+c= ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign Root R46 O=GlobalSign nv-sa -# Subject: CN=GlobalSign Root R46 O=GlobalSign nv-sa -# Label: "GlobalSign Root R46" -# Serial: 1552617688466950547958867513931858518042577 -# MD5 Fingerprint: c4:14:30:e4:fa:66:43:94:2a:6a:1b:24:5f:19:d0:ef -# SHA1 Fingerprint: 53:a2:b0:4b:ca:6b:d6:45:e6:39:8a:8e:c4:0d:d2:bf:77:c3:a2:90 -# SHA256 Fingerprint: 4f:a3:12:6d:8d:3a:11:d1:c4:85:5a:4f:80:7c:ba:d6:cf:91:9d:3a:5a:88:b0:3b:ea:2c:63:72:d9:3c:40:c9 ------BEGIN CERTIFICATE----- -MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUA -MEYxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYD -VQQDExNHbG9iYWxTaWduIFJvb3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMy -MDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYt -c2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08EsCVeJ -OaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQG -vGIFAha/r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud -316HCkD7rRlr+/fKYIje2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo -0q3v84RLHIf8E6M6cqJaESvWJ3En7YEtbWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSE -y132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvjK8Cd+RTyG/FWaha/LIWF -zXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD412lPFzYE -+cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCN -I/onccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzs -x2sZy/N78CsHpdlseVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqa -ByFrgY/bxFn63iLABJzjqls2k+g9vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC -4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEMBQADggIBAHx4 -7PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg -JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti -2kM3S+LGteWygxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIk -pnnpHs6i58FZFZ8d4kuaPp92CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRF -FRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZmOUdkLG5NrmJ7v2B0GbhWrJKsFjLt -rWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qqJZ4d16GLuc1CLgSk -ZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwyeqiv5 -u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP -4vkYxboznxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6 -N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 -vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign Root E46 O=GlobalSign nv-sa -# Subject: CN=GlobalSign Root E46 O=GlobalSign nv-sa -# Label: "GlobalSign Root E46" -# Serial: 1552617690338932563915843282459653771421763 -# MD5 Fingerprint: b5:b8:66:ed:de:08:83:e3:c9:e2:01:34:06:ac:51:6f -# SHA1 Fingerprint: 39:b4:6c:d5:fe:80:06:eb:e2:2f:4a:bb:08:33:a0:af:db:b9:dd:84 -# SHA256 Fingerprint: cb:b9:c4:4d:84:b8:04:3e:10:50:ea:31:a6:9f:51:49:55:d7:bf:d2:e2:c6:b4:93:01:01:9a:d6:1d:9f:50:58 ------BEGIN CERTIFICATE----- -MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYx -CzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQD -ExNHbG9iYWxTaWduIFJvb3QgRTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAw -MDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2Ex -HDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkBjtjq -R+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGdd -yXqBPCCjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud -DgQWBBQxCpCPtsad0kRLgLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ -7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZkvLtoURMMA/cVi4RguYv/Uo7njLwcAjA8 -+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+CAezNIm8BZ/3Hobui3A= ------END CERTIFICATE----- - -# Issuer: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz -# Subject: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz -# Label: "ANF Secure Server Root CA" -# Serial: 996390341000653745 -# MD5 Fingerprint: 26:a6:44:5a:d9:af:4e:2f:b2:1d:b6:65:b0:4e:e8:96 -# SHA1 Fingerprint: 5b:6e:68:d0:cc:15:b6:a0:5f:1e:c1:5f:ae:02:fc:6b:2f:5d:6f:74 -# SHA256 Fingerprint: fb:8f:ec:75:91:69:b9:10:6b:1e:51:16:44:c6:18:c5:13:04:37:3f:6c:06:43:08:8d:8b:ef:fd:1b:99:75:99 ------BEGIN CERTIFICATE----- -MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV -BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk -YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV -BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN -MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF -UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD -VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v -dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj -cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q -yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH -2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX -H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL -zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR -p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz -W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ -SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn -LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 -n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B -u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj -o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO -BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC -AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L -9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej -rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK -pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 -vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq -OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ -/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 -2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI -+PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 -MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo -tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= ------END CERTIFICATE----- - -# Issuer: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Subject: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Label: "Certum EC-384 CA" -# Serial: 160250656287871593594747141429395092468 -# MD5 Fingerprint: b6:65:b3:96:60:97:12:a1:ec:4e:e1:3d:a3:c6:c9:f1 -# SHA1 Fingerprint: f3:3e:78:3c:ac:df:f4:a2:cc:ac:67:55:69:56:d7:e5:16:3c:e1:ed -# SHA256 Fingerprint: 6b:32:80:85:62:53:18:aa:50:d1:73:c9:8d:8b:da:09:d5:7e:27:41:3d:11:4c:f7:87:a0:f5:d0:6c:03:0c:f6 ------BEGIN CERTIFICATE----- -MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw -CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw -JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT -EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0 -WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT -LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX -BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE -KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm -Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI0GZnQkdjrzife81r1HfS+8 -EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjADVS2m5hjEfO/J -UG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0QoSZ/6vn -nvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k= ------END CERTIFICATE----- - -# Issuer: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Subject: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority -# Label: "Certum Trusted Root CA" -# Serial: 40870380103424195783807378461123655149 -# MD5 Fingerprint: 51:e1:c2:e7:fe:4c:84:af:59:0e:2f:f4:54:6f:ea:29 -# SHA1 Fingerprint: c8:83:44:c0:18:ae:9f:cc:f1:87:b7:8f:22:d1:c5:d7:45:84:ba:e5 -# SHA256 Fingerprint: fe:76:96:57:38:55:77:3e:37:a9:5e:7a:d4:d9:cc:96:c3:01:57:c1:5d:31:76:5b:a9:b1:57:04:e1:ae:78:fd ------BEGIN CERTIFICATE----- -MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6 -MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEu -MScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNV -BAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwHhcNMTgwMzE2MTIxMDEzWhcNNDMw -MzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEg -U3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRo -b3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZ -n0EGze2jusDbCSzBfN8pfktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/q -p1x4EaTByIVcJdPTsuclzxFUl6s1wB52HO8AU5853BSlLCIls3Jy/I2z5T4IHhQq -NwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2fJmItdUDmj0VDT06qKhF -8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGtg/BKEiJ3 -HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGa -mqi4NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi -7VdNIuJGmj8PkTQkfVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSF -ytKAQd8FqKPVhJBPC/PgP5sZ0jeJP/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0P -qafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSYnjYJdmZm/Bo/6khUHL4wvYBQ -v3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHKHRzQ+8S1h9E6 -Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1 -vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQAD -ggIBAEii1QALLtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4 -WxmB82M+w85bj/UvXgF2Ez8sALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvo -zMrnadyHncI013nR03e4qllY/p0m+jiGPp2Kh2RX5Rc64vmNueMzeMGQ2Ljdt4NR -5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8CYyqOhNf6DR5UMEQ -GfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA4kZf -5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq -0Uc9NneoWWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7D -P78v3DSk+yshzWePS/Tj6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTM -qJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmTOPQD8rv7gmsHINFSH5pkAnuYZttcTVoP -0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZckbxJF0WddCajJFdr60qZf -E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb ------END CERTIFICATE----- - -# Issuer: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique -# Subject: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique -# Label: "TunTrust Root CA" -# Serial: 108534058042236574382096126452369648152337120275 -# MD5 Fingerprint: 85:13:b9:90:5b:36:5c:b6:5e:b8:5a:f8:e0:31:57:b4 -# SHA1 Fingerprint: cf:e9:70:84:0f:e0:73:0f:9d:f6:0c:7f:2c:4b:ee:20:46:34:9c:bb -# SHA256 Fingerprint: 2e:44:10:2a:b5:8c:b8:54:19:45:1c:8e:19:d9:ac:f3:66:2c:af:bc:61:4b:6a:53:96:0a:30:f7:d0:e2:eb:41 ------BEGIN CERTIFICATE----- -MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUg -Q2VydGlmaWNhdGlvbiBFbGVjdHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJv -b3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQwNDI2MDg1NzU2WjBhMQswCQYDVQQG -EwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBDZXJ0aWZpY2F0aW9u -IEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZ -n56eY+hz2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd -2JQDoOw05TDENX37Jk0bbjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgF -VwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZ -GoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAdgjH8KcwAWJeRTIAAHDOF -li/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViWVSHbhlnU -r8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2 -eY8fTpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIb -MlEsPvLfe/ZdeikZjuXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISg -jwBUFfyRbVinljvrS5YnzWuioYasDXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB -7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwSVXAkPcvCFDVDXSdOvsC9qnyW -5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI04Y+oXNZtPdE -ITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0 -90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+z -xiD2BkewhpMl0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYu -QEkHDVneixCwSQXi/5E/S7fdAo74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4 -FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRYYdZ2vyJ/0Adqp2RT8JeNnYA/u8EH -22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJpadbGNjHh/PqAulxP -xOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65xxBzn -dFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5 -Xc0yGYuPjCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7b -nV2UqL1g52KAdoGDDIzMMEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQ -CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH -u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj -d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o= ------END CERTIFICATE----- - -# Issuer: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Subject: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Label: "HARICA TLS RSA Root CA 2021" -# Serial: 76817823531813593706434026085292783742 -# MD5 Fingerprint: 65:47:9b:58:86:dd:2c:f0:fc:a2:84:1f:1e:96:c4:91 -# SHA1 Fingerprint: 02:2d:05:82:fa:88:ce:14:0c:06:79:de:7f:14:10:e9:45:d7:a5:6d -# SHA256 Fingerprint: d9:5d:0e:8e:da:79:52:5b:f9:be:b1:1b:14:d2:10:0d:32:94:98:5f:0c:62:d9:fa:bd:9c:d9:99:ec:cb:7b:1d ------BEGIN CERTIFICATE----- -MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBs -MQswCQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl -c2VhcmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0Eg -Um9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUzOFoXDTQ1MDIxMzEwNTUzN1owbDEL -MAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl -YXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNBIFJv -b3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569l -mwVnlskNJLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE -4VGC/6zStGndLuwRo0Xua2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uv -a9of08WRiFukiZLRgeaMOVig1mlDqa2YUlhu2wr7a89o+uOkXjpFc5gH6l8Cct4M -pbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K5FrZx40d/JiZ+yykgmvw -Kh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEvdmn8kN3b -LW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcY -AuUR0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqB -AGMUuTNe3QvboEUHGjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYq -E613TBoYm5EPWNgGVMWX+Ko/IIqmhaZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHr -W2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQCPxrvrNQKlr9qEgYRtaQQJKQ -CoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE -AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAU -X15QvWiWkKQUEapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3 -f5Z2EMVGpdAgS1D0NTsY9FVqQRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxaja -H6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxDQpSbIPDRzbLrLFPCU3hKTwSUQZqP -JzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcRj88YxeMn/ibvBZ3P -zzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5vZSt -jBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0 -/L5H9MG0qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pT -BGIBnfHAT+7hOtSLIBD6Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79 -aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW -xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU -63ZTGI0RmLo= ------END CERTIFICATE----- - -# Issuer: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Subject: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA -# Label: "HARICA TLS ECC Root CA 2021" -# Serial: 137515985548005187474074462014555733966 -# MD5 Fingerprint: ae:f7:4c:e5:66:35:d1:b7:9b:8c:22:93:74:d3:4b:b0 -# SHA1 Fingerprint: bc:b0:c1:9d:e9:98:92:70:19:38:57:e9:8d:a7:b4:5d:6e:ee:01:48 -# SHA256 Fingerprint: 3f:99:cc:47:4a:cf:ce:4d:fe:d5:87:94:66:5e:47:8d:15:47:73:9f:2e:78:0f:1b:b4:ca:9b:13:30:97:d4:01 ------BEGIN CERTIFICATE----- -MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQsw -CQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2Vh -cmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9v -dCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoXDTQ1MDIxMzExMDEwOVowbDELMAkG -A1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj -aCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJvb3Qg -Q0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7 -KKrxcm1lAEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9Y -STHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQD -AgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNw -SaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygN -nxS2PFOiTAZpffpskcYqSUXm7LcT4Tps ------END CERTIFICATE----- - -# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 -# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 -# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" -# Serial: 1977337328857672817 -# MD5 Fingerprint: 4e:6e:9b:54:4c:ca:b7:fa:48:e4:90:b1:15:4b:1c:a3 -# SHA1 Fingerprint: 0b:be:c2:27:22:49:cb:39:aa:db:35:5c:53:e3:8c:ae:78:ff:b6:fe -# SHA256 Fingerprint: 57:de:05:83:ef:d2:b2:6e:03:61:da:99:da:9d:f4:64:8d:ef:7e:e8:44:1c:3b:72:8a:fa:9b:cd:e0:f9:b2:6a ------BEGIN CERTIFICATE----- -MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UE -BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h -cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1 -MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg -Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 -thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM -cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG -L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i -NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h -X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b -m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy -Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja -EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T -KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF -6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh -OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1UdDgQWBBRlzeurNR4APn7VdMAc -tHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4wgZswgZgGBFUd -IAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j -b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABC -AG8AbgBhAG4AbwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAw -ADEANzAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9m -iWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL4QjbEwj4KKE1soCzC1HA01aajTNF -Sa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDbLIpgD7dvlAceHabJ -hfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1ilI45P -Vf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZE -EAEeiGaPcjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV -1aUsIC+nmCjuRfzxuIgALI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2t -CsvMo2ebKHTEm9caPARYpoKdrcd7b/+Alun4jWq9GJAd/0kakFI3ky88Al2CdgtR -5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH9IBk9W6VULgRfhVwOEqw -f9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpfNIbnYrX9 -ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNK -GbqEZycPvEJdvSRUDewdcAZfpLz6IHxV ------END CERTIFICATE----- - -# Issuer: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. -# Subject: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. -# Label: "vTrus ECC Root CA" -# Serial: 630369271402956006249506845124680065938238527194 -# MD5 Fingerprint: de:4b:c1:f5:52:8c:9b:43:e1:3e:8f:55:54:17:8d:85 -# SHA1 Fingerprint: f6:9c:db:b0:fc:f6:02:13:b6:52:32:a6:a3:91:3f:16:70:da:c3:e1 -# SHA256 Fingerprint: 30:fb:ba:2c:32:23:8e:2a:98:54:7a:f9:79:31:e5:50:42:8b:9b:3f:1c:8e:eb:66:33:dc:fa:86:c5:b2:7d:d3 ------BEGIN CERTIFICATE----- -MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMw -RzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAY -BgNVBAMTEXZUcnVzIEVDQyBSb290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDcz -MTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28u -LEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYwEAYHKoZIzj0CAQYF -K4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+cToL0 -v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUd -e4BdS49nTPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYD -VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIw -V53dVvHH4+m4SVBrm2nDb+zDfSXkV5UTQJtS0zvzQBm8JsctBp61ezaf9SXUY2sA -AjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQLYgmRWAD5Tfs0aNoJrSEG -GJTO ------END CERTIFICATE----- - -# Issuer: CN=vTrus Root CA O=iTrusChina Co.,Ltd. -# Subject: CN=vTrus Root CA O=iTrusChina Co.,Ltd. -# Label: "vTrus Root CA" -# Serial: 387574501246983434957692974888460947164905180485 -# MD5 Fingerprint: b8:c9:37:df:fa:6b:31:84:64:c5:ea:11:6a:1b:75:fc -# SHA1 Fingerprint: 84:1a:69:fb:f5:cd:1a:25:34:13:3d:e3:f8:fc:b8:99:d0:c9:14:b7 -# SHA256 Fingerprint: 8a:71:de:65:59:33:6f:42:6c:26:e5:38:80:d0:0d:88:a1:8d:a4:c6:a9:1f:0d:cb:61:94:e2:06:c5:c9:63:87 ------BEGIN CERTIFICATE----- -MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL -BQAwQzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4x -FjAUBgNVBAMTDXZUcnVzIFJvb3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMx -MDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoGA1UEChMTaVRydXNDaGluYSBDby4s -THRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZotsSKYc -IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU -AyyNJJrIZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+ -GrPSbcKvdmaVayqwlHeFXgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z9 -8Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KAYPxMvDVTAWqXcoKv8R1w6Jz1717CbMdH -flqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70kLJrxLT5ZOrpGgrIDajt -J8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2AXPKBlim -0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZN -pGvu/9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQ -UqqzApVg+QxMaPnu1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHW -OXSuTEGC2/KmSNGzm/MzqvOmwMVO9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMB -AAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYgscasGrz2iTAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAKbqSSaet -8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd -nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1j -bhd47F18iMjrjld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvM -Kar5CKXiNxTKsbhm7xqC5PD48acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIiv -TDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJnxDHO2zTlJQNgJXtxmOTAGytfdELS -S8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554WgicEFOwE30z9J4nfr -I8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4sEb9 -b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNB -UvupLnKWnyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1P -Ti07NEPhmg4NpGaXutIcSkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929ven -sBxXVsFy6K2ir40zSbofitzmdHxghm+Hl3s= ------END CERTIFICATE----- - -# Issuer: CN=ISRG Root X2 O=Internet Security Research Group -# Subject: CN=ISRG Root X2 O=Internet Security Research Group -# Label: "ISRG Root X2" -# Serial: 87493402998870891108772069816698636114 -# MD5 Fingerprint: d3:9e:c4:1e:23:3c:a6:df:cf:a3:7e:6d:e0:14:e6:e5 -# SHA1 Fingerprint: bd:b1:b9:3c:d5:97:8d:45:c6:26:14:55:f8:db:95:c7:5a:d1:53:af -# SHA256 Fingerprint: 69:72:9b:8e:15:a8:6e:fc:17:7a:57:af:b7:17:1d:fc:64:ad:d2:8c:2f:ca:8c:f1:50:7e:34:45:3c:cb:14:70 ------BEGIN CERTIFICATE----- -MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw -CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg -R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 -MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT -ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw -EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW -+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 -ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T -AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI -zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW -tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 -/q4AaOeMSQ+2b1tbFfLn ------END CERTIFICATE----- - -# Issuer: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. -# Subject: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. -# Label: "HiPKI Root CA - G1" -# Serial: 60966262342023497858655262305426234976 -# MD5 Fingerprint: 69:45:df:16:65:4b:e8:68:9a:8f:76:5f:ff:80:9e:d3 -# SHA1 Fingerprint: 6a:92:e4:a8:ee:1b:ec:96:45:37:e3:29:57:49:cd:96:e3:e5:d2:60 -# SHA256 Fingerprint: f0:15:ce:3c:c2:39:bf:ef:06:4b:e9:f1:d2:c4:17:e1:a0:26:4a:0a:94:be:1f:0c:8d:12:18:64:eb:69:49:cc ------BEGIN CERTIFICATE----- -MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBP -MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 -ZC4xGzAZBgNVBAMMEkhpUEtJIFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRa -Fw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3 -YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kgUm9vdCBDQSAtIEcx -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0o9Qw -qNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twv -Vcg3Px+kwJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6 -lZgRZq2XNdZ1AYDgr/SEYYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnz -Qs7ZngyzsHeXZJzA9KMuH5UHsBffMNsAGJZMoYFL3QRtU6M9/Aes1MU3guvklQgZ -KILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfdhSi8MEyr48KxRURHH+CK -FgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj1jOXTyFj -HluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDr -y+K49a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ -/W3c1pzAtH2lsN0/Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgM -a/aOEmem8rJY5AIJEzypuxC00jBF8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6 -fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQDAgGGMA0GCSqG -SIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi -7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqc -SE5XCV0vrPSltJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6Fza -ZsT0pPBWGTMpWmWSBUdGSquEwx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9Tc -XzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07QJNBAsNB1CI69aO4I1258EHBGG3zg -iLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv5wiZqAxeJoBF1Pho -L5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+GpzjLrF -Ne85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wr -kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+ -vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU -YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ== ------END CERTIFICATE----- - -# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 -# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 -# Label: "GlobalSign ECC Root CA - R4" -# Serial: 159662223612894884239637590694 -# MD5 Fingerprint: 26:29:f8:6d:e1:88:bf:a2:65:7f:aa:c4:cd:0f:7f:fc -# SHA1 Fingerprint: 6b:a0:b0:98:e1:71:ef:5a:ad:fe:48:15:80:77:10:f4:bd:6f:0b:28 -# SHA256 Fingerprint: b0:85:d7:0b:96:4f:19:1a:73:e4:af:0d:54:ae:7a:0e:07:aa:fd:af:9b:71:dd:08:62:13:8a:b7:32:5a:24:a2 ------BEGIN CERTIFICATE----- -MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYD -VQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2Jh -bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgw -MTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0g -UjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wWTAT -BgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkWymOx -uYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNV -HQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/ -+wpu+74zyTyjhNUwCgYIKoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147 -bmF0774BxL4YSFlhgjICICadVGNA3jdgUM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R1 O=Google Trust Services LLC -# Subject: CN=GTS Root R1 O=Google Trust Services LLC -# Label: "GTS Root R1" -# Serial: 159662320309726417404178440727 -# MD5 Fingerprint: 05:fe:d0:bf:71:a8:a3:76:63:da:01:e0:d8:52:dc:40 -# SHA1 Fingerprint: e5:8c:1c:c4:91:3b:38:63:4b:e9:10:6e:e3:ad:8e:6b:9d:d9:81:4a -# SHA256 Fingerprint: d9:47:43:2a:bd:e7:b7:fa:90:fc:2e:6b:59:10:1b:12:80:e0:e1:c7:e4:e4:0f:a3:c6:88:7f:ff:57:a7:f4:cf ------BEGIN CERTIFICATE----- -MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw -CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU -MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw -MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp -Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo -27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w -Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw -TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl -qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH -szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8 -Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk -MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92 -wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p -aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN -VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID -AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E -FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb -C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe -QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy -h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4 -7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J -ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef -MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/ -Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT -6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ -0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm -2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb -bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R2 O=Google Trust Services LLC -# Subject: CN=GTS Root R2 O=Google Trust Services LLC -# Label: "GTS Root R2" -# Serial: 159662449406622349769042896298 -# MD5 Fingerprint: 1e:39:c0:53:e6:1e:29:82:0b:ca:52:55:36:5d:57:dc -# SHA1 Fingerprint: 9a:44:49:76:32:db:de:fa:d0:bc:fb:5a:7b:17:bd:9e:56:09:24:94 -# SHA256 Fingerprint: 8d:25:cd:97:22:9d:bf:70:35:6b:da:4e:b3:cc:73:40:31:e2:4c:f0:0f:af:cf:d3:2d:c7:6e:b5:84:1c:7e:a8 ------BEGIN CERTIFICATE----- -MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw -CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU -MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw -MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp -Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt -nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY -6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu -MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k -RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg -f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV -+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo -dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW -Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa -G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq -gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID -AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E -FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H -vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8 -0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC -B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u -NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg -yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev -HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6 -xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR -TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg -JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV -7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl -6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R3 O=Google Trust Services LLC -# Subject: CN=GTS Root R3 O=Google Trust Services LLC -# Label: "GTS Root R3" -# Serial: 159662495401136852707857743206 -# MD5 Fingerprint: 3e:e7:9d:58:02:94:46:51:94:e5:e0:22:4a:8b:e7:73 -# SHA1 Fingerprint: ed:e5:71:80:2b:c8:92:b9:5b:83:3c:d2:32:68:3f:09:cd:a0:1e:46 -# SHA256 Fingerprint: 34:d8:a7:3e:e2:08:d9:bc:db:0d:95:65:20:93:4b:4e:40:e6:94:82:59:6e:8b:6f:73:c8:42:6b:01:0a:6f:48 ------BEGIN CERTIFICATE----- -MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYD -VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG -A1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw -WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz -IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNi -AAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout736G -jOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL2 -4CejQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7 -VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azTL818+FsuVbu/3ZL3pAzcMeGiAjEA/Jdm -ZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV11RZt+cRLInUue4X ------END CERTIFICATE----- - -# Issuer: CN=GTS Root R4 O=Google Trust Services LLC -# Subject: CN=GTS Root R4 O=Google Trust Services LLC -# Label: "GTS Root R4" -# Serial: 159662532700760215368942768210 -# MD5 Fingerprint: 43:96:83:77:19:4d:76:b3:9d:65:52:e4:1d:22:a5:e8 -# SHA1 Fingerprint: 77:d3:03:67:b5:e0:0c:15:f6:0c:38:61:df:7c:e1:3b:92:46:4d:47 -# SHA256 Fingerprint: 34:9d:fa:40:58:c5:e2:63:12:3b:39:8a:e7:95:57:3c:4e:13:13:c8:3f:e6:8f:93:55:6c:d5:e8:03:1b:3c:7d ------BEGIN CERTIFICATE----- -MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD -VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG -A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw -WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz -IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi -AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi -QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR -HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D -9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8 -p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD ------END CERTIFICATE----- - -# Issuer: CN=Telia Root CA v2 O=Telia Finland Oyj -# Subject: CN=Telia Root CA v2 O=Telia Finland Oyj -# Label: "Telia Root CA v2" -# Serial: 7288924052977061235122729490515358 -# MD5 Fingerprint: 0e:8f:ac:aa:82:df:85:b1:f4:dc:10:1c:fc:99:d9:48 -# SHA1 Fingerprint: b9:99:cd:d1:73:50:8a:c4:47:05:08:9c:8c:88:fb:be:a0:2b:40:cd -# SHA256 Fingerprint: 24:2b:69:74:2f:cb:1e:5b:2a:bf:98:89:8b:94:57:21:87:54:4e:5b:4d:99:11:78:65:73:62:1f:6a:74:b8:2c ------BEGIN CERTIFICATE----- -MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQx -CzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UE -AwwQVGVsaWEgUm9vdCBDQSB2MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1 -NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZ -MBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ76zBq -AMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9 -vVYiQJ3q9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9 -lRdU2HhE8Qx3FZLgmEKnpNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTOD -n3WhUidhOPFZPY5Q4L15POdslv5e2QJltI5c0BE0312/UqeBAMN/mUWZFdUXyApT -7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW5olWK8jjfN7j/4nlNW4o -6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNrRBH0pUPC -TEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6 -WT0EBXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63R -DolUK5X6wK0dmBR4M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZI -pEYslOqodmJHixBTB0hXbOKSTbauBcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGj -YzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7Wxy+G2CQ5MB0GA1UdDgQWBBRy -rOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw -AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ -8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi -0f6X+J8wfBj5tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMM -A8iZGok1GTzTyVR8qPAs5m4HeW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBS -SRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+Cy748fdHif64W1lZYudogsYMVoe+K -TTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygCQMez2P2ccGrGKMOF -6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15h2Er -3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMt -Ty3EHD70sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pT -VmBds9hCG1xLEooc6+t9xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAW -ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA -rBPuUBQemMc= ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH -# Subject: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH -# Label: "D-TRUST BR Root CA 1 2020" -# Serial: 165870826978392376648679885835942448534 -# MD5 Fingerprint: b5:aa:4b:d5:ed:f7:e3:55:2e:8f:72:0a:f3:75:b8:ed -# SHA1 Fingerprint: 1f:5b:98:f0:e3:b5:f7:74:3c:ed:e6:b0:36:7d:32:cd:f4:09:41:67 -# SHA256 Fingerprint: e5:9a:aa:81:60:09:c2:2b:ff:5b:25:ba:d3:7d:f3:06:f0:49:79:7c:1f:81:d8:5a:b0:89:e6:57:bd:8f:00:44 ------BEGIN CERTIFICATE----- -MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQsw -CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS -VVNUIEJSIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5 -NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG -A1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB -BAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7dPYS -zuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0 -QVK5buXuQqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/ -VbNafAkl1bK6CKBrqx9tMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g -PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2JyX3Jvb3Rf -Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l -dC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 -c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO -PQQDAwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFW -wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV -dWNbFJWcHwHP2NVypw87 ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH -# Subject: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH -# Label: "D-TRUST EV Root CA 1 2020" -# Serial: 126288379621884218666039612629459926992 -# MD5 Fingerprint: 8c:2d:9d:70:9f:48:99:11:06:11:fb:e9:cb:30:c0:6e -# SHA1 Fingerprint: 61:db:8c:21:59:69:03:90:d8:7c:9c:12:86:54:cf:9d:3d:f4:dd:07 -# SHA256 Fingerprint: 08:17:0d:1a:a3:64:53:90:1a:2f:95:92:45:e3:47:db:0c:8d:37:ab:aa:bc:56:b8:1a:a1:00:dc:95:89:70:db ------BEGIN CERTIFICATE----- -MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw -CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS -VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5 -NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG -A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB -BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC -/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD -wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3 -OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g -PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf -Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l -dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 -c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO -PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA -y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb -gfM0agPnIjhQW+0ZT0MW ------END CERTIFICATE----- - -# Issuer: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. -# Subject: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. -# Label: "DigiCert TLS ECC P384 Root G5" -# Serial: 13129116028163249804115411775095713523 -# MD5 Fingerprint: d3:71:04:6a:43:1c:db:a6:59:e1:a8:a3:aa:c5:71:ed -# SHA1 Fingerprint: 17:f3:de:5e:9f:0f:19:e9:8e:f6:1f:32:26:6e:20:c4:07:ae:30:ee -# SHA256 Fingerprint: 01:8e:13:f0:77:25:32:cf:80:9b:d1:b1:72:81:86:72:83:fc:48:c6:e1:3b:e9:c6:98:12:85:4a:49:0c:1b:05 ------BEGIN CERTIFICATE----- -MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQsw -CQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURp -Z2lDZXJ0IFRMUyBFQ0MgUDM4NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2 -MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJ -bmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQgUm9vdCBHNTB2MBAG -ByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1TzvdlHJS -7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp -0zVozptjn4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICIS -B4CIfBFqMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49 -BAMDA2gAMGUCMQCJao1H5+z8blUD2WdsJk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQ -LgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIxAJSdYsiJvRmEFOml+wG4 -DXZDjC5Ty3zfDBeWUA== ------END CERTIFICATE----- - -# Issuer: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. -# Subject: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. -# Label: "DigiCert TLS RSA4096 Root G5" -# Serial: 11930366277458970227240571539258396554 -# MD5 Fingerprint: ac:fe:f7:34:96:a9:f2:b3:b4:12:4b:e4:27:41:6f:e1 -# SHA1 Fingerprint: a7:88:49:dc:5d:7c:75:8c:8c:de:39:98:56:b3:aa:d0:b2:a5:71:35 -# SHA256 Fingerprint: 37:1a:00:dc:05:33:b3:72:1a:7e:eb:40:e8:41:9e:70:79:9d:2b:0a:0f:2c:1d:80:69:31:65:f7:ce:c4:ad:75 ------BEGIN CERTIFICATE----- -MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBN -MQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMT -HERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcN -NDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQs -IEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS87IE+ -ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG0 -2C+JFvuUAT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgp -wgscONyfMXdcvyej/Cestyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZM -pG2T6T867jp8nVid9E6P/DsjyG244gXazOvswzH016cpVIDPRFtMbzCe88zdH5RD -nU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnVDdXifBBiqmvwPXbzP6Po -sMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9qTXeXAaDx -Zre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cd -Lvvyz6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvX -KyY//SovcfXWJL5/MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNe -XoVPzthwiHvOAbWWl9fNff2C+MIkwcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPL -tgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4EFgQUUTMc7TZArxfTJc1paPKv -TiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN -AQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw -GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7H -PNtQOa27PShNlnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLF -O4uJ+DQtpBflF+aZfTCIITfNMBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQ -REtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/u4cnYiWB39yhL/btp/96j1EuMPik -AdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9GOUrYU9DzLjtxpdRv -/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh47a+ -p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilw -MUc/dNAUFvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WF -qUITVuwhd4GTWgzqltlJyqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCK -ovfepEWFJqgejF0pW8hL2JpqA15w8oVPbEtoL8pU9ozaMv7Da4M/OMZ+ ------END CERTIFICATE----- - -# Issuer: CN=Certainly Root R1 O=Certainly -# Subject: CN=Certainly Root R1 O=Certainly -# Label: "Certainly Root R1" -# Serial: 188833316161142517227353805653483829216 -# MD5 Fingerprint: 07:70:d4:3e:82:87:a0:fa:33:36:13:f4:fa:33:e7:12 -# SHA1 Fingerprint: a0:50:ee:0f:28:71:f4:27:b2:12:6d:6f:50:96:25:ba:cc:86:42:af -# SHA256 Fingerprint: 77:b8:2c:d8:64:4c:43:05:f7:ac:c5:cb:15:6b:45:67:50:04:03:3d:51:c6:0c:62:02:a8:e0:c3:34:67:d3:a0 ------BEGIN CERTIFICATE----- -MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAw -PTELMAkGA1UEBhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2Vy -dGFpbmx5IFJvb3QgUjEwHhcNMjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9 -MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0 -YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANA2 -1B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O5MQT -vqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbed -aFySpvXl8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b0 -1C7jcvk2xusVtyWMOvwlDbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5 -r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGIXsXwClTNSaa/ApzSRKft43jvRl5tcdF5 -cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkNKPl6I7ENPT2a/Z2B7yyQ -wHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQAjeZjOVJ -6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA -2CnbrlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyH -Wyf5QBGenDPBt+U1VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMR -eiFPCyEQtkA6qyI6BJyLm4SGcprSp6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB -/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTgqj8ljZ9EXME66C6u -d0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAszHQNTVfSVcOQr -PbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d -8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi -1wrykXprOQ4vMMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrd -rRT90+7iIgXr0PK3aBLXWopBGsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9di -taY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+gjwN/KUD+nsa2UUeYNrEjvn8K8l7 -lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgHJBu6haEaBQmAupVj -yTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7fpYn -Kx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLy -yCwzk5Iwx06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5n -wXARPbv0+Em34yaXOp/SX3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6 -OV+KmalBWQewLK8= ------END CERTIFICATE----- - -# Issuer: CN=Certainly Root E1 O=Certainly -# Subject: CN=Certainly Root E1 O=Certainly -# Label: "Certainly Root E1" -# Serial: 8168531406727139161245376702891150584 -# MD5 Fingerprint: 0a:9e:ca:cd:3e:52:50:c6:36:f3:4b:a3:ed:a7:53:e9 -# SHA1 Fingerprint: f9:e1:6d:dc:01:89:cf:d5:82:45:63:3e:c5:37:7d:c2:eb:93:6f:2b -# SHA256 Fingerprint: b4:58:5f:22:e4:ac:75:6a:4e:86:12:a1:36:1c:5d:9d:03:1a:93:fd:84:fe:bb:77:8f:a3:06:8b:0f:c4:2d:c2 ------BEGIN CERTIFICATE----- -MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQsw -CQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlu -bHkgUm9vdCBFMTAeFw0yMTA0MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJ -BgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlubHkxGjAYBgNVBAMTEUNlcnRhaW5s -eSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4fxzf7flHh4axpMCK -+IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9YBk2 -QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4 -hevIIgcwCgYIKoZIzj0EAwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozm -ut6Dacpps6kFtZaSF4fC0urQe87YQVt8rgIwRt7qy12a7DLCZRawTDBcMPPaTnOG -BtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR ------END CERTIFICATE----- - -# Issuer: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. -# Subject: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. -# Label: "Security Communication ECC RootCA1" -# Serial: 15446673492073852651 -# MD5 Fingerprint: 7e:43:b0:92:68:ec:05:43:4c:98:ab:5d:35:2e:7e:86 -# SHA1 Fingerprint: b8:0e:26:a9:bf:d2:b2:3b:c0:ef:46:c9:ba:c7:bb:f6:1d:0d:41:41 -# SHA256 Fingerprint: e7:4f:bd:a5:5b:d5:64:c4:73:a3:6b:44:1a:a7:99:c8:a6:8e:07:74:40:e8:28:8b:9f:a1:e5:0e:4b:ba:ca:11 ------BEGIN CERTIFICATE----- -MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYT -AkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYD -VQQDEyJTZWN1cml0eSBDb21tdW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYx -NjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTELMAkGA1UEBhMCSlAxJTAjBgNVBAoT -HFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNVBAMTIlNlY3VyaXR5 -IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQAIgNi -AASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+Cnnfdl -dB9sELLo5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpK -ULGjQjBAMB0GA1UdDgQWBBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu -9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O -be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k= ------END CERTIFICATE----- - -# Issuer: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY -# Subject: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY -# Label: "BJCA Global Root CA1" -# Serial: 113562791157148395269083148143378328608 -# MD5 Fingerprint: 42:32:99:76:43:33:36:24:35:07:82:9b:28:f9:d0:90 -# SHA1 Fingerprint: d5:ec:8d:7b:4c:ba:79:f4:e7:e8:cb:9d:6b:ae:77:83:10:03:21:6a -# SHA256 Fingerprint: f3:89:6f:88:fe:7c:0a:88:27:66:a7:fa:6a:d2:74:9f:b5:7a:7f:3e:98:fb:76:9c:1f:a7:b0:9c:2c:44:d5:ae ------BEGIN CERTIFICATE----- -MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBU -MQswCQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRI -T1JJVFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAz -MTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJF -SUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2Jh -bCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFmCL3Z -xRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZ -spDyRhySsTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O5 -58dnJCNPYwpj9mZ9S1WnP3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgR -at7GGPZHOiJBhyL8xIkoVNiMpTAK+BcWyqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll -5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRjeulumijWML3mG90Vr4Tq -nMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNnMoH1V6XK -V0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/ -pj+bOT0CFqMYs2esWz8sgytnOYFcuX6U1WTdno9uruh8W7TXakdI136z1C2OVnZO -z2nxbkRs1CTqjSShGL+9V/6pmTW12xB3uD1IutbB5/EjPtffhZ0nPNRAvQoMvfXn -jSXWgXSHRtQpdaJCbPdzied9v3pKH9MiyRVVz99vfFXQpIsHETdfg6YmV6YBW37+ -WGgHqel62bno/1Afq8K0wM7o6v0PvY1NuLxxAgMBAAGjQjBAMB0GA1UdDgQWBBTF -7+3M2I0hxkjk49cULqcWk+WYATAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE -AwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAUoKsITQfI/Ki2Pm4rzc2IInRNwPWaZ+4 -YRC6ojGYWUfo0Q0lHhVBDOAqVdVXUsv45Mdpox1NcQJeXyFFYEhcCY5JEMEE3Kli -awLwQ8hOnThJdMkycFRtwUf8jrQ2ntScvd0g1lPJGKm1Vrl2i5VnZu69mP6u775u -+2D2/VnGKhs/I0qUJDAnyIm860Qkmss9vk/Ves6OF8tiwdneHg56/0OGNFK8YT88 -X7vZdrRTvJez/opMEi4r89fO4aL/3Xtw+zuhTaRjAv04l5U/BXCga99igUOLtFkN -SoxUnMW7gZ/NfaXvCyUeOiDbHPwfmGcCCtRzRBPbUYQaVQNW4AB+dAb/OMRyHdOo -P2gxXdMJxy6MW2Pg6Nwe0uxhHvLe5e/2mXZgLR6UcnHGCyoyx5JO1UbXHfmpGQrI -+pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRz -znfSxqxx4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9 -eVzYH6Eze9mCUAyTF6ps3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2 -YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4SSPfSKcOYKMryMguTjClPPGAyzQWWYezy -r/6zcCwupvI= ------END CERTIFICATE----- - -# Issuer: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY -# Subject: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY -# Label: "BJCA Global Root CA2" -# Serial: 58605626836079930195615843123109055211 -# MD5 Fingerprint: 5e:0a:f6:47:5f:a6:14:e8:11:01:95:3f:4d:01:eb:3c -# SHA1 Fingerprint: f4:27:86:eb:6e:b8:6d:88:31:67:02:fb:ba:66:a4:53:00:aa:7a:a6 -# SHA256 Fingerprint: 57:4d:f6:93:1e:27:80:39:66:7b:72:0a:fd:c1:60:0f:c2:7e:b6:6d:d3:09:29:79:fb:73:85:64:87:21:28:82 ------BEGIN CERTIFICATE----- -MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQsw -CQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJ -VFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgy -MVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJ -TkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2JhbCBS -b290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jlSR9B -IgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK+ -+kpRuDCK/eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJK -sVF/BvDRgh9Obl+rg/xI1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD -AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA -94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8gUXOQwKhbYdDFUDn9hf7B -43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== ------END CERTIFICATE----- - -# Issuer: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited -# Subject: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited -# Label: "Sectigo Public Server Authentication Root E46" -# Serial: 88989738453351742415770396670917916916 -# MD5 Fingerprint: 28:23:f8:b2:98:5c:37:16:3b:3e:46:13:4e:b0:b3:01 -# SHA1 Fingerprint: ec:8a:39:6c:40:f0:2e:bc:42:75:d4:9f:ab:1c:1a:5b:67:be:d2:9a -# SHA256 Fingerprint: c9:0f:26:f0:fb:1b:40:18:b2:22:27:51:9b:5c:a2:b5:3e:2c:a5:b3:be:5c:f1:8e:fe:1b:ef:47:38:0c:53:83 ------BEGIN CERTIFICATE----- -MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQsw -CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T -ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcN -MjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYG -A1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT -ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccC -WvkEN/U0NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+ -6xnOQ6OjQjBAMB0GA1UdDgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8B -Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjAn7qRa -qCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RHlAFWovgzJQxC36oCMB3q -4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21USAGKcw== ------END CERTIFICATE----- - -# Issuer: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited -# Subject: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited -# Label: "Sectigo Public Server Authentication Root R46" -# Serial: 156256931880233212765902055439220583700 -# MD5 Fingerprint: 32:10:09:52:00:d5:7e:6c:43:df:15:c0:b1:16:93:e5 -# SHA1 Fingerprint: ad:98:f9:f3:e4:7d:75:3b:65:d4:82:b3:a4:52:17:bb:6e:f5:e4:38 -# SHA256 Fingerprint: 7b:b6:47:a6:2a:ee:ac:88:bf:25:7a:a5:22:d0:1f:fe:a3:95:e0:ab:45:c7:3f:93:f6:56:54:ec:38:f2:5a:06 ------BEGIN CERTIFICATE----- -MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBf -MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQD -Ey1TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYw -HhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEY -MBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1Ymxp -YyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDa -ef0rty2k1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnz -SDBh+oF8HqcIStw+KxwfGExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xf -iOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMPFF1bFOdLvt30yNoDN9HWOaEhUTCDsG3X -ME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vuZDCQOc2TZYEhMbUjUDM3 -IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5QazYw6A3OAS -VYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgE -SJ/AwSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu -+Zd4KKTIRJLpfSYFplhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt -8uaZFURww3y8nDnAtOFr94MlI1fZEoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+L -HaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW6aWWrL3DkJiy4Pmi1KZHQ3xt -zwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWIIUkwDgYDVR0P -AQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c -mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQ -YKlJfp/imTYpE0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52 -gDY9hAaLMyZlbcp+nv4fjFg4exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZA -Fv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M0ejf5lG5Nkc/kLnHvALcWxxPDkjB -JYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI84HxZmduTILA7rpX -DhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9mpFui -TdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5 -dHn5HrwdVw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65 -LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp -0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmmJ1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAY -QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL ------END CERTIFICATE----- - -# Issuer: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation -# Subject: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation -# Label: "SSL.com TLS RSA Root CA 2022" -# Serial: 148535279242832292258835760425842727825 -# MD5 Fingerprint: d8:4e:c6:59:30:d8:fe:a0:d6:7a:5a:2c:2c:69:78:da -# SHA1 Fingerprint: ec:2c:83:40:72:af:26:95:10:ff:0e:f2:03:ee:31:70:f6:78:9d:ca -# SHA256 Fingerprint: 8f:af:7d:2e:2c:b4:70:9b:b8:e0:b3:36:66:bf:75:a5:dd:45:b5:de:48:0f:8e:a8:d4:bf:e6:be:bc:17:f2:ed ------BEGIN CERTIFICATE----- -MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBO -MQswCQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQD -DBxTU0wuY29tIFRMUyBSU0EgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloX -DTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jw -b3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJvb3QgQ0EgMjAyMjCC -AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u9nTP -L3tYPc48DRAokC+X94xI2KDYJbFMsBFMF3NQ0CJKY7uB0ylu1bUJPiYYf7ISf5OY -t6/wNr/y7hienDtSxUcZXXTzZGbVXcdotL8bHAajvI9AI7YexoS9UcQbOcGV0ins -S657Lb85/bRi3pZ7QcacoOAGcvvwB5cJOYF0r/c0WRFXCsJbwST0MXMwgsadugL3 -PnxEX4MN8/HdIGkWCVDi1FW24IBydm5MR7d1VVm0U3TZlMZBrViKMWYPHqIbKUBO -L9975hYsLfy/7PO0+r4Y9ptJ1O4Fbtk085zx7AGL0SDGD6C1vBdOSHtRwvzpXGk3 -R2azaPgVKPC506QVzFpPulJwoxJF3ca6TvvC0PeoUidtbnm1jPx7jMEWTO6Af77w -dr5BUxIzrlo4QqvXDz5BjXYHMtWrifZOZ9mxQnUjbvPNQrL8VfVThxc7wDNY8VLS -+YCk8OjwO4s4zKTGkH8PnP2L0aPP2oOnaclQNtVcBdIKQXTbYxE3waWglksejBYS -d66UNHsef8JmAOSqg+qKkK3ONkRN0VHpvB/zagX9wHQfJRlAUW7qglFA35u5CCoG -AtUjHBPW6dvbxrB6y3snm/vg1UYk7RBLY0ulBY+6uB0rpvqR4pJSvezrZ5dtmi2f -gTIFZzL7SAg/2SW4BCUvAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j -BBgwFoAU+y437uOEeicuzRk1sTN8/9REQrkwHQYDVR0OBBYEFPsuN+7jhHonLs0Z -NbEzfP/UREK5MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAjYlt -hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsM -QtfhWsSWTVTNj8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvf -R4iyrT7gJ4eLSYwfqUdYe5byiB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJ -DPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjUo3KUQyxi4U5cMj29TH0ZR6LDSeeW -P4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqoENjwuSfr98t67wVy -lrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7EgkaibMOlq -bLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2w -AgDHbICivRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3q -r5nsLFR+jM4uElZI7xc7P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sji -Mho6/4UIyYOf8kpIEFR3N+2ivEC+5BB09+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU -98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA= ------END CERTIFICATE----- - -# Issuer: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation -# Subject: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation -# Label: "SSL.com TLS ECC Root CA 2022" -# Serial: 26605119622390491762507526719404364228 -# MD5 Fingerprint: 99:d7:5c:f1:51:36:cc:e9:ce:d9:19:2e:77:71:56:c5 -# SHA1 Fingerprint: 9f:5f:d9:1a:54:6d:f5:0c:71:f0:ee:7a:bd:17:49:98:84:73:e2:39 -# SHA256 Fingerprint: c3:2f:fd:9f:46:f9:36:d1:6c:36:73:99:09:59:43:4b:9a:d6:0a:af:bb:9e:7c:f3:36:54:f1:44:cc:1b:a1:43 ------BEGIN CERTIFICATE----- -MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw -CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT -U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2 -MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh -dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG -ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm -acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN -SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME -GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW -uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp -15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN -b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g== ------END CERTIFICATE----- - -# Issuer: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos -# Subject: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos -# Label: "Atos TrustedRoot Root CA ECC TLS 2021" -# Serial: 81873346711060652204712539181482831616 -# MD5 Fingerprint: 16:9f:ad:f1:70:ad:79:d6:ed:29:b4:d1:c5:79:70:a8 -# SHA1 Fingerprint: 9e:bc:75:10:42:b3:02:f3:81:f4:f7:30:62:d4:8f:c3:a7:51:b2:dd -# SHA256 Fingerprint: b2:fa:e5:3e:14:cc:d7:ab:92:12:06:47:01:ae:27:9c:1d:89:88:fa:cb:77:5f:a8:a0:08:91:4e:66:39:88:a8 ------BEGIN CERTIFICATE----- -MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4w -LAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0w -CwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0 -MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBF -Q0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMHYwEAYHKoZI -zj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6KDP/X -tXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4 -AjJn8ZQSb+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2 -KCXWfeBmmnoJsmo7jjPXNtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMD -aAAwZQIwW5kp85wxtolrbNa9d+F851F+uDrNozZffPc8dz7kUK2o59JZDCaOMDtu -CCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGYa3cpetskz2VAv9LcjBHo -9H1/IISpQuQo ------END CERTIFICATE----- - -# Issuer: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos -# Subject: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos -# Label: "Atos TrustedRoot Root CA RSA TLS 2021" -# Serial: 111436099570196163832749341232207667876 -# MD5 Fingerprint: d4:d3:46:b8:9a:c0:9c:76:5d:9e:3a:c3:b9:99:31:d2 -# SHA1 Fingerprint: 18:52:3b:0d:06:37:e4:d6:3a:df:23:e4:98:fb:5b:16:fb:86:74:48 -# SHA256 Fingerprint: 81:a9:08:8e:a5:9f:b3:64:c5:48:a6:f8:55:59:09:9b:6f:04:05:ef:bf:18:e5:32:4e:c9:f4:57:ba:00:11:2f ------BEGIN CERTIFICATE----- -MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBM -MS4wLAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIx -MQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00 -MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBD -QSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BBl01Z -4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYv -Ye+W/CBGvevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZ -kmGbzSoXfduP9LVq6hdKZChmFSlsAvFr1bqjM9xaZ6cF4r9lthawEO3NUDPJcFDs -GY6wx/J0W2tExn2WuZgIWWbeKQGb9Cpt0xU6kGpn8bRrZtkh68rZYnxGEFzedUln -nkL5/nWpo63/dgpnQOPF943HhZpZnmKaau1Fh5hnstVKPNe0OwANwI8f4UDErmwh -3El+fsqyjW22v5MvoVw+j8rtgI5Y4dtXz4U2OLJxpAmMkokIiEjxQGMYsluMWuPD -0xeqqxmjLBvk1cbiZnrXghmmOxYsL3GHX0WelXOTwkKBIROW1527k2gV+p2kHYzy -geBYBr3JtuP2iV2J+axEoctr+hbxx1A9JNr3w+SH1VbxT5Aw+kUJWdo0zuATHAR8 -ANSbhqRAvNncTFd+rrcztl524WWLZt+NyteYr842mIycg5kDcPOvdO3GDjbnvezB -c6eUWsuSZIKmAMFwoW4sKeFYV+xafJlrJaSQOoD0IJ2azsct+bJLKZWD6TWNp0lI -pw9MGZHQ9b8Q4HECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU -dEmZ0f+0emhFdcN+tNzMzjkz2ggwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB -DAUAA4ICAQAjQ1MkYlxt/T7Cz1UAbMVWiLkO3TriJQ2VSpfKgInuKs1l+NsW4AmS -4BjHeJi78+xCUvuppILXTdiK/ORO/auQxDh1MoSf/7OwKwIzNsAQkG8dnK/haZPs -o0UvFJ/1TCplQ3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJ -qM7F78PRreBrAwA0JrRUITWXAdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuyw -xfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9GslA9hGCZcbUztVdF5kJHdWoOsAgM -rr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2VktafcxBPTy+av5EzH4 -AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9qTFsR -0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuY -o7Ey7Nmj1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5 -dDTedk+SKlOxJTnbPP/lPqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcE -oji2jbDwN/zIIX8/syQbPYtuzE2wFg2WHYMfRsCbvUOZ58SWLs5fyQ== ------END CERTIFICATE----- - -# Issuer: CN=TrustAsia Global Root CA G3 O=TrustAsia Technologies, Inc. -# Subject: CN=TrustAsia Global Root CA G3 O=TrustAsia Technologies, Inc. -# Label: "TrustAsia Global Root CA G3" -# Serial: 576386314500428537169965010905813481816650257167 -# MD5 Fingerprint: 30:42:1b:b7:bb:81:75:35:e4:16:4f:53:d2:94:de:04 -# SHA1 Fingerprint: 63:cf:b6:c1:27:2b:56:e4:88:8e:1c:23:9a:b6:2e:81:47:24:c3:c7 -# SHA256 Fingerprint: e0:d3:22:6a:eb:11:63:c2:e4:8f:f9:be:3b:50:b4:c6:43:1b:e7:bb:1e:ac:c5:c3:6b:5d:5e:c5:09:03:9a:08 ------BEGIN CERTIFICATE----- -MIIFpTCCA42gAwIBAgIUZPYOZXdhaqs7tOqFhLuxibhxkw8wDQYJKoZIhvcNAQEM -BQAwWjELMAkGA1UEBhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dp -ZXMsIEluYy4xJDAiBgNVBAMMG1RydXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHMzAe -Fw0yMTA1MjAwMjEwMTlaFw00NjA1MTkwMjEwMTlaMFoxCzAJBgNVBAYTAkNOMSUw -IwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMSQwIgYDVQQDDBtU -cnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzMwggIiMA0GCSqGSIb3DQEBAQUAA4IC -DwAwggIKAoICAQDAMYJhkuSUGwoqZdC+BqmHO1ES6nBBruL7dOoKjbmzTNyPtxNS -T1QY4SxzlZHFZjtqz6xjbYdT8PfxObegQ2OwxANdV6nnRM7EoYNl9lA+sX4WuDqK -AtCWHwDNBSHvBm3dIZwZQ0WhxeiAysKtQGIXBsaqvPPW5vxQfmZCHzyLpnl5hkA1 -nyDvP+uLRx+PjsXUjrYsyUQE49RDdT/VP68czH5GX6zfZBCK70bwkPAPLfSIC7Ep -qq+FqklYqL9joDiR5rPmd2jE+SoZhLsO4fWvieylL1AgdB4SQXMeJNnKziyhWTXA -yB1GJ2Faj/lN03J5Zh6fFZAhLf3ti1ZwA0pJPn9pMRJpxx5cynoTi+jm9WAPzJMs -hH/x/Gr8m0ed262IPfN2dTPXS6TIi/n1Q1hPy8gDVI+lhXgEGvNz8teHHUGf59gX -zhqcD0r83ERoVGjiQTz+LISGNzzNPy+i2+f3VANfWdP3kXjHi3dqFuVJhZBFcnAv -kV34PmVACxmZySYgWmjBNb9Pp1Hx2BErW+Canig7CjoKH8GB5S7wprlppYiU5msT -f9FkPz2ccEblooV7WIQn3MSAPmeamseaMQ4w7OYXQJXZRe0Blqq/DPNL0WP3E1jA -uPP6Z92bfW1K/zJMtSU7/xxnD4UiWQWRkUF3gdCFTIcQcf+eQxuulXUtgQIDAQAB -o2MwYTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEDk5PIj7zjKsK5Xf/Ih -MBY027ySMB0GA1UdDgQWBBRA5OTyI+84yrCuV3/yITAWNNu8kjAOBgNVHQ8BAf8E -BAMCAQYwDQYJKoZIhvcNAQEMBQADggIBACY7UeFNOPMyGLS0XuFlXsSUT9SnYaP4 -wM8zAQLpw6o1D/GUE3d3NZ4tVlFEbuHGLige/9rsR82XRBf34EzC4Xx8MnpmyFq2 -XFNFV1pF1AWZLy4jVe5jaN/TG3inEpQGAHUNcoTpLrxaatXeL1nHo+zSh2bbt1S1 -JKv0Q3jbSwTEb93mPmY+KfJLaHEih6D4sTNjduMNhXJEIlU/HHzp/LgV6FL6qj6j -ITk1dImmasI5+njPtqzn59ZW/yOSLlALqbUHM/Q4X6RJpstlcHboCoWASzY9M/eV -VHUl2qzEc4Jl6VL1XP04lQJqaTDFHApXB64ipCz5xUG3uOyfT0gA+QEEVcys+TIx -xHWVBqB/0Y0n3bOppHKH/lmLmnp0Ft0WpWIp6zqW3IunaFnT63eROfjXy9mPX1on -AX1daBli2MjN9LdyR75bl87yraKZk62Uy5P2EgmVtqvXO9A/EcswFi55gORngS1d -7XB4tmBZrOFdRWOPyN9yaFvqHbgB8X7754qz41SgOAngPN5C8sLtLpvzHzW2Ntjj -gKGLzZlkD8Kqq7HK9W+eQ42EVJmzbsASZthwEPEGNTNDqJwuuhQxzhB/HIbjj9LV -+Hfsm6vxL2PZQl/gZ4FkkfGXL/xuJvYz+NO1+MRiqzFRJQJ6+N1rZdVtTTDIZbpo -FGWsJwt0ivKH ------END CERTIFICATE----- - -# Issuer: CN=TrustAsia Global Root CA G4 O=TrustAsia Technologies, Inc. -# Subject: CN=TrustAsia Global Root CA G4 O=TrustAsia Technologies, Inc. -# Label: "TrustAsia Global Root CA G4" -# Serial: 451799571007117016466790293371524403291602933463 -# MD5 Fingerprint: 54:dd:b2:d7:5f:d8:3e:ed:7c:e0:0b:2e:cc:ed:eb:eb -# SHA1 Fingerprint: 57:73:a5:61:5d:80:b2:e6:ac:38:82:fc:68:07:31:ac:9f:b5:92:5a -# SHA256 Fingerprint: be:4b:56:cb:50:56:c0:13:6a:52:6d:f4:44:50:8d:aa:36:a0:b5:4f:42:e4:ac:38:f7:2a:f4:70:e4:79:65:4c ------BEGIN CERTIFICATE----- -MIICVTCCAdygAwIBAgIUTyNkuI6XY57GU4HBdk7LKnQV1tcwCgYIKoZIzj0EAwMw -WjELMAkGA1UEBhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs -IEluYy4xJDAiBgNVBAMMG1RydXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHNDAeFw0y -MTA1MjAwMjEwMjJaFw00NjA1MTkwMjEwMjJaMFoxCzAJBgNVBAYTAkNOMSUwIwYD -VQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMSQwIgYDVQQDDBtUcnVz -dEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATx -s8045CVD5d4ZCbuBeaIVXxVjAd7Cq92zphtnS4CDr5nLrBfbK5bKfFJV4hrhPVbw -LxYI+hW8m7tH5j/uqOFMjPXTNvk4XatwmkcN4oFBButJ+bAp3TPsUKV/eSm4IJij -YzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUpbtKl86zK3+kMd6Xg1mD -pm9xy94wHQYDVR0OBBYEFKW7SpfOsyt/pDHel4NZg6ZvccveMA4GA1UdDwEB/wQE -AwIBBjAKBggqhkjOPQQDAwNnADBkAjBe8usGzEkxn0AAbbd+NvBNEU/zy4k6LHiR -UKNbwMp1JvK/kF0LgoxgKJ/GcJpo5PECMFxYDlZ2z1jD1xCMuo6u47xkdUfFVZDj -/bpV6wfEU6s3qe4hsiFbYI89MvHVI5TWWA== ------END CERTIFICATE----- - -# Issuer: CN=CommScope Public Trust ECC Root-01 O=CommScope -# Subject: CN=CommScope Public Trust ECC Root-01 O=CommScope -# Label: "CommScope Public Trust ECC Root-01" -# Serial: 385011430473757362783587124273108818652468453534 -# MD5 Fingerprint: 3a:40:a7:fc:03:8c:9c:38:79:2f:3a:a2:6c:b6:0a:16 -# SHA1 Fingerprint: 07:86:c0:d8:dd:8e:c0:80:98:06:98:d0:58:7a:ef:de:a6:cc:a2:5d -# SHA256 Fingerprint: 11:43:7c:da:7b:b4:5e:41:36:5f:45:b3:9a:38:98:6b:0d:e0:0d:ef:34:8e:0c:7b:b0:87:36:33:80:0b:c3:8b ------BEGIN CERTIFICATE----- -MIICHTCCAaOgAwIBAgIUQ3CCd89NXTTxyq4yLzf39H91oJ4wCgYIKoZIzj0EAwMw -TjELMAkGA1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29t -bVNjb3BlIFB1YmxpYyBUcnVzdCBFQ0MgUm9vdC0wMTAeFw0yMTA0MjgxNzM1NDNa -Fw00NjA0MjgxNzM1NDJaME4xCzAJBgNVBAYTAlVTMRIwEAYDVQQKDAlDb21tU2Nv -cGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3QgRUNDIFJvb3QtMDEw -djAQBgcqhkjOPQIBBgUrgQQAIgNiAARLNumuV16ocNfQj3Rid8NeeqrltqLxeP0C -flfdkXmcbLlSiFS8LwS+uM32ENEp7LXQoMPwiXAZu1FlxUOcw5tjnSCDPgYLpkJE -hRGnSjot6dZoL0hOUysHP029uax3OVejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD -VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSOB2LAUN3GGQYARnQE9/OufXVNMDAKBggq -hkjOPQQDAwNoADBlAjEAnDPfQeMjqEI2Jpc1XHvr20v4qotzVRVcrHgpD7oh2MSg -2NED3W3ROT3Ek2DS43KyAjB8xX6I01D1HiXo+k515liWpDVfG2XqYZpwI7UNo5uS -Um9poIyNStDuiw7LR47QjRE= ------END CERTIFICATE----- - -# Issuer: CN=CommScope Public Trust ECC Root-02 O=CommScope -# Subject: CN=CommScope Public Trust ECC Root-02 O=CommScope -# Label: "CommScope Public Trust ECC Root-02" -# Serial: 234015080301808452132356021271193974922492992893 -# MD5 Fingerprint: 59:b0:44:d5:65:4d:b8:5c:55:19:92:02:b6:d1:94:b2 -# SHA1 Fingerprint: 3c:3f:ef:57:0f:fe:65:93:86:9e:a0:fe:b0:f6:ed:8e:d1:13:c7:e5 -# SHA256 Fingerprint: 2f:fb:7f:81:3b:bb:b3:c8:9a:b4:e8:16:2d:0f:16:d7:15:09:a8:30:cc:9d:73:c2:62:e5:14:08:75:d1:ad:4a ------BEGIN CERTIFICATE----- -MIICHDCCAaOgAwIBAgIUKP2ZYEFHpgE6yhR7H+/5aAiDXX0wCgYIKoZIzj0EAwMw -TjELMAkGA1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29t -bVNjb3BlIFB1YmxpYyBUcnVzdCBFQ0MgUm9vdC0wMjAeFw0yMTA0MjgxNzQ0NTRa -Fw00NjA0MjgxNzQ0NTNaME4xCzAJBgNVBAYTAlVTMRIwEAYDVQQKDAlDb21tU2Nv -cGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3QgRUNDIFJvb3QtMDIw -djAQBgcqhkjOPQIBBgUrgQQAIgNiAAR4MIHoYx7l63FRD/cHB8o5mXxO1Q/MMDAL -j2aTPs+9xYa9+bG3tD60B8jzljHz7aRP+KNOjSkVWLjVb3/ubCK1sK9IRQq9qEmU -v4RDsNuESgMjGWdqb8FuvAY5N9GIIvejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD -VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTmGHX/72DehKT1RsfeSlXjMjZ59TAKBggq -hkjOPQQDAwNnADBkAjAmc0l6tqvmSfR9Uj/UQQSugEODZXW5hYA4O9Zv5JOGq4/n -ich/m35rChJVYaoR4HkCMHfoMXGsPHED1oQmHhS48zs73u1Z/GtMMH9ZzkXpc2AV -mkzw5l4lIhVtwodZ0LKOag== ------END CERTIFICATE----- - -# Issuer: CN=CommScope Public Trust RSA Root-01 O=CommScope -# Subject: CN=CommScope Public Trust RSA Root-01 O=CommScope -# Label: "CommScope Public Trust RSA Root-01" -# Serial: 354030733275608256394402989253558293562031411421 -# MD5 Fingerprint: 0e:b4:15:bc:87:63:5d:5d:02:73:d4:26:38:68:73:d8 -# SHA1 Fingerprint: 6d:0a:5f:f7:b4:23:06:b4:85:b3:b7:97:64:fc:ac:75:f5:33:f2:93 -# SHA256 Fingerprint: 02:bd:f9:6e:2a:45:dd:9b:f1:8f:c7:e1:db:df:21:a0:37:9b:a3:c9:c2:61:03:44:cf:d8:d6:06:fe:c1:ed:81 ------BEGIN CERTIFICATE----- -MIIFbDCCA1SgAwIBAgIUPgNJgXUWdDGOTKvVxZAplsU5EN0wDQYJKoZIhvcNAQEL -BQAwTjELMAkGA1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwi -Q29tbVNjb3BlIFB1YmxpYyBUcnVzdCBSU0EgUm9vdC0wMTAeFw0yMTA0MjgxNjQ1 -NTRaFw00NjA0MjgxNjQ1NTNaME4xCzAJBgNVBAYTAlVTMRIwEAYDVQQKDAlDb21t -U2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3QgUlNBIFJvb3Qt -MDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwSGWjDR1C45FtnYSk -YZYSwu3D2iM0GXb26v1VWvZVAVMP8syMl0+5UMuzAURWlv2bKOx7dAvnQmtVzslh -suitQDy6uUEKBU8bJoWPQ7VAtYXR1HHcg0Hz9kXHgKKEUJdGzqAMxGBWBB0HW0al -DrJLpA6lfO741GIDuZNqihS4cPgugkY4Iw50x2tBt9Apo52AsH53k2NC+zSDO3Oj -WiE260f6GBfZumbCk6SP/F2krfxQapWsvCQz0b2If4b19bJzKo98rwjyGpg/qYFl -P8GMicWWMJoKz/TUyDTtnS+8jTiGU+6Xn6myY5QXjQ/cZip8UlF1y5mO6D1cv547 -KI2DAg+pn3LiLCuz3GaXAEDQpFSOm117RTYm1nJD68/A6g3czhLmfTifBSeolz7p -UcZsBSjBAg/pGG3svZwG1KdJ9FQFa2ww8esD1eo9anbCyxooSU1/ZOD6K9pzg4H/ -kQO9lLvkuI6cMmPNn7togbGEW682v3fuHX/3SZtS7NJ3Wn2RnU3COS3kuoL4b/JO -Hg9O5j9ZpSPcPYeoKFgo0fEbNttPxP/hjFtyjMcmAyejOQoBqsCyMWCDIqFPEgkB -Ea801M/XrmLTBQe0MXXgDW1XT2mH+VepuhX2yFJtocucH+X8eKg1mp9BFM6ltM6U -CBwJrVbl2rZJmkrqYxhTnCwuwwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUN12mmnQywsL5x6YVEFm45P3luG0wDQYJ -KoZIhvcNAQELBQADggIBAK+nz97/4L1CjU3lIpbfaOp9TSp90K09FlxD533Ahuh6 -NWPxzIHIxgvoLlI1pKZJkGNRrDSsBTtXAOnTYtPZKdVUvhwQkZyybf5Z/Xn36lbQ -nmhUQo8mUuJM3y+Xpi/SB5io82BdS5pYV4jvguX6r2yBS5KPQJqTRlnLX3gWsWc+ -QgvfKNmwrZggvkN80V4aCRckjXtdlemrwWCrWxhkgPut4AZ9HcpZuPN4KWfGVh2v -trV0KnahP/t1MJ+UXjulYPPLXAziDslg+MkfFoom3ecnf+slpoq9uC02EJqxWE2a -aE9gVOX2RhOOiKy8IUISrcZKiX2bwdgt6ZYD9KJ0DLwAHb/WNyVntHKLr4W96ioD -j8z7PEQkguIBpQtZtjSNMgsSDesnwv1B10A8ckYpwIzqug/xBpMu95yo9GA+o/E4 -Xo4TwbM6l4c/ksp4qRyv0LAbJh6+cOx69TOY6lz/KwsETkPdY34Op054A5U+1C0w -lREQKC6/oAI+/15Z0wUOlV9TRe9rh9VIzRamloPh37MG88EU26fsHItdkJANclHn -YfkUyq+Dj7+vsQpZXdxc1+SWrVtgHdqul7I52Qb1dgAT+GhMIbA1xNxVssnBQVoc -icCMb3SgazNNtQEo/a2tiRc7ppqEvOuM6sRxJKi6KfkIsidWNTJf6jn7MZrVGczw ------END CERTIFICATE----- - -# Issuer: CN=CommScope Public Trust RSA Root-02 O=CommScope -# Subject: CN=CommScope Public Trust RSA Root-02 O=CommScope -# Label: "CommScope Public Trust RSA Root-02" -# Serial: 480062499834624527752716769107743131258796508494 -# MD5 Fingerprint: e1:29:f9:62:7b:76:e2:96:6d:f3:d4:d7:0f:ae:1f:aa -# SHA1 Fingerprint: ea:b0:e2:52:1b:89:93:4c:11:68:f2:d8:9a:ac:22:4c:a3:8a:57:ae -# SHA256 Fingerprint: ff:e9:43:d7:93:42:4b:4f:7c:44:0c:1c:3d:64:8d:53:63:f3:4b:82:dc:87:aa:7a:9f:11:8f:c5:de:e1:01:f1 ------BEGIN CERTIFICATE----- -MIIFbDCCA1SgAwIBAgIUVBa/O345lXGN0aoApYYNK496BU4wDQYJKoZIhvcNAQEL -BQAwTjELMAkGA1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwi -Q29tbVNjb3BlIFB1YmxpYyBUcnVzdCBSU0EgUm9vdC0wMjAeFw0yMTA0MjgxNzE2 -NDNaFw00NjA0MjgxNzE2NDJaME4xCzAJBgNVBAYTAlVTMRIwEAYDVQQKDAlDb21t -U2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3QgUlNBIFJvb3Qt -MDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDh+g77aAASyE3VrCLE -NQE7xVTlWXZjpX/rwcRqmL0yjReA61260WI9JSMZNRTpf4mnG2I81lDnNJUDMrG0 -kyI9p+Kx7eZ7Ti6Hmw0zdQreqjXnfuU2mKKuJZ6VszKWpCtYHu8//mI0SFHRtI1C -rWDaSWqVcN3SAOLMV2MCe5bdSZdbkk6V0/nLKR8YSvgBKtJjCW4k6YnS5cciTNxz -hkcAqg2Ijq6FfUrpuzNPDlJwnZXjfG2WWy09X6GDRl224yW4fKcZgBzqZUPckXk2 -LHR88mcGyYnJ27/aaL8j7dxrrSiDeS/sOKUNNwFnJ5rpM9kzXzehxfCrPfp4sOcs -n/Y+n2Dg70jpkEUeBVF4GiwSLFworA2iI540jwXmojPOEXcT1A6kHkIfhs1w/tku -FT0du7jyU1fbzMZ0KZwYszZ1OC4PVKH4kh+Jlk+71O6d6Ts2QrUKOyrUZHk2EOH5 -kQMreyBUzQ0ZGshBMjTRsJnhkB4BQDa1t/qp5Xd1pCKBXbCL5CcSD1SIxtuFdOa3 -wNemKfrb3vOTlycEVS8KbzfFPROvCgCpLIscgSjX74Yxqa7ybrjKaixUR9gqiC6v -wQcQeKwRoi9C8DfF8rhW3Q5iLc4tVn5V8qdE9isy9COoR+jUKgF4z2rDN6ieZdIs -5fq6M8EGRPbmz6UNp2YINIos8wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUR9DnsSL/nSz12Vdgs7GxcJXvYXowDQYJ -KoZIhvcNAQELBQADggIBAIZpsU0v6Z9PIpNojuQhmaPORVMbc0RTAIFhzTHjCLqB -KCh6krm2qMhDnscTJk3C2OVVnJJdUNjCK9v+5qiXz1I6JMNlZFxHMaNlNRPDk7n3 -+VGXu6TwYofF1gbTl4MgqX67tiHCpQ2EAOHyJxCDut0DgdXdaMNmEMjRdrSzbyme -APnCKfWxkxlSaRosTKCL4BWaMS/TiJVZbuXEs1DIFAhKm4sTg7GkcrI7djNB3Nyq -pgdvHSQSn8h2vS/ZjvQs7rfSOBAkNlEv41xdgSGn2rtO/+YHqP65DSdsu3BaVXoT -6fEqSWnHX4dXTEN5bTpl6TBcQe7rd6VzEojov32u5cSoHw2OHG1QAk8mGEPej1WF -sQs3BWDJVTkSBKEqz3EWnzZRSb9wO55nnPt7eck5HHisd5FUmrh1CoFSl+NmYWvt -PjgelmFV4ZFUjO2MJB+ByRCac5krFk5yAD9UG/iNuovnFNa2RU9g7Jauwy8CTl2d -lklyALKrdVwPaFsdZcJfMw8eD/A7hvWwTruc9+olBdytoptLFwG+Qt81IR2tq670 -v64fG9PiO/yzcnMcmyiQiRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17O -rg3bhzjlP1v9mxnhMUF6cKojawHhRUzNlM47ni3niAIi9G7oyOzWPPO5std3eqx7 ------END CERTIFICATE----- - -# Issuer: CN=Telekom Security TLS ECC Root 2020 O=Deutsche Telekom Security GmbH -# Subject: CN=Telekom Security TLS ECC Root 2020 O=Deutsche Telekom Security GmbH -# Label: "Telekom Security TLS ECC Root 2020" -# Serial: 72082518505882327255703894282316633856 -# MD5 Fingerprint: c1:ab:fe:6a:10:2c:03:8d:bc:1c:22:32:c0:85:a7:fd -# SHA1 Fingerprint: c0:f8:96:c5:a9:3b:01:06:21:07:da:18:42:48:bc:e9:9d:88:d5:ec -# SHA256 Fingerprint: 57:8a:f4:de:d0:85:3f:4e:59:98:db:4a:ea:f9:cb:ea:8d:94:5f:60:b6:20:a3:8d:1a:3c:13:b2:bc:7b:a8:e1 ------BEGIN CERTIFICATE----- -MIICQjCCAcmgAwIBAgIQNjqWjMlcsljN0AFdxeVXADAKBggqhkjOPQQDAzBjMQsw -CQYDVQQGEwJERTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0eSBH -bWJIMSswKQYDVQQDDCJUZWxla29tIFNlY3VyaXR5IFRMUyBFQ0MgUm9vdCAyMDIw -MB4XDTIwMDgyNTA3NDgyMFoXDTQ1MDgyNTIzNTk1OVowYzELMAkGA1UEBhMCREUx -JzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJpdHkgR21iSDErMCkGA1UE -AwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgRUNDIFJvb3QgMjAyMDB2MBAGByqGSM49 -AgEGBSuBBAAiA2IABM6//leov9Wq9xCazbzREaK9Z0LMkOsVGJDZos0MKiXrPk/O -tdKPD/M12kOLAoC+b1EkHQ9rK8qfwm9QMuU3ILYg/4gND21Ju9sGpIeQkpT0CdDP -f8iAC8GXs7s1J8nCG6NCMEAwHQYDVR0OBBYEFONyzG6VmUex5rNhTNHLq+O6zd6f -MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2cA -MGQCMHVSi7ekEE+uShCLsoRbQuHmKjYC2qBuGT8lv9pZMo7k+5Dck2TOrbRBR2Di -z6fLHgIwN0GMZt9Ba9aDAEH9L1r3ULRn0SyocddDypwnJJGDSA3PzfdUga/sf+Rn -27iQ7t0l ------END CERTIFICATE----- - -# Issuer: CN=Telekom Security TLS RSA Root 2023 O=Deutsche Telekom Security GmbH -# Subject: CN=Telekom Security TLS RSA Root 2023 O=Deutsche Telekom Security GmbH -# Label: "Telekom Security TLS RSA Root 2023" -# Serial: 44676229530606711399881795178081572759 -# MD5 Fingerprint: bf:5b:eb:54:40:cd:48:71:c4:20:8d:7d:de:0a:42:f2 -# SHA1 Fingerprint: 54:d3:ac:b3:bd:57:56:f6:85:9d:ce:e5:c3:21:e2:d4:ad:83:d0:93 -# SHA256 Fingerprint: ef:c6:5c:ad:bb:59:ad:b6:ef:e8:4d:a2:23:11:b3:56:24:b7:1b:3b:1e:a0:da:8b:66:55:17:4e:c8:97:86:46 ------BEGIN CERTIFICATE----- -MIIFszCCA5ugAwIBAgIQIZxULej27HF3+k7ow3BXlzANBgkqhkiG9w0BAQwFADBj -MQswCQYDVQQGEwJERTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0 -eSBHbWJIMSswKQYDVQQDDCJUZWxla29tIFNlY3VyaXR5IFRMUyBSU0EgUm9vdCAy -MDIzMB4XDTIzMDMyODEyMTY0NVoXDTQ4MDMyNzIzNTk1OVowYzELMAkGA1UEBhMC -REUxJzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJpdHkgR21iSDErMCkG -A1UEAwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgUlNBIFJvb3QgMjAyMzCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAO01oYGA88tKaVvC+1GDrib94W7zgRJ9 -cUD/h3VCKSHtgVIs3xLBGYSJwb3FKNXVS2xE1kzbB5ZKVXrKNoIENqil/Cf2SfHV -cp6R+SPWcHu79ZvB7JPPGeplfohwoHP89v+1VmLhc2o0mD6CuKyVU/QBoCcHcqMA -U6DksquDOFczJZSfvkgdmOGjup5czQRxUX11eKvzWarE4GC+j4NSuHUaQTXtvPM6 -Y+mpFEXX5lLRbtLevOP1Czvm4MS9Q2QTps70mDdsipWol8hHD/BeEIvnHRz+sTug -BTNoBUGCwQMrAcjnj02r6LX2zWtEtefdi+zqJbQAIldNsLGyMcEWzv/9FIS3R/qy -8XDe24tsNlikfLMR0cN3f1+2JeANxdKz+bi4d9s3cXFH42AYTyS2dTd4uaNir73J -co4vzLuu2+QVUhkHM/tqty1LkCiCc/4YizWN26cEar7qwU02OxY2kTLvtkCJkUPg -8qKrBC7m8kwOFjQgrIfBLX7JZkcXFBGk8/ehJImr2BrIoVyxo/eMbcgByU/J7MT8 -rFEz0ciD0cmfHdRHNCk+y7AO+oMLKFjlKdw/fKifybYKu6boRhYPluV75Gp6SG12 -mAWl3G0eQh5C2hrgUve1g8Aae3g1LDj1H/1Joy7SWWO/gLCMk3PLNaaZlSJhZQNg -+y+TS/qanIA7AgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtqeX -gj10hZv3PJ+TmpV5dVKMbUcwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS2 -p5eCPXSFm/c8n5OalXl1UoxtRzANBgkqhkiG9w0BAQwFAAOCAgEAqMxhpr51nhVQ -pGv7qHBFfLp+sVr8WyP6Cnf4mHGCDG3gXkaqk/QeoMPhk9tLrbKmXauw1GLLXrtm -9S3ul0A8Yute1hTWjOKWi0FpkzXmuZlrYrShF2Y0pmtjxrlO8iLpWA1WQdH6DErw -M807u20hOq6OcrXDSvvpfeWxm4bu4uB9tPcy/SKE8YXJN3nptT+/XOR0so8RYgDd -GGah2XsjX/GO1WfoVNpbOms2b/mBsTNHM3dA+VKq3dSDz4V4mZqTuXNnQkYRIer+ -CqkbGmVps4+uFrb2S1ayLfmlyOw7YqPta9BO1UAJpB+Y1zqlklkg5LB9zVtzaL1t -xKITDmcZuI1CfmwMmm6gJC3VRRvcxAIU/oVbZZfKTpBQCHpCNfnqwmbU+AGuHrS+ -w6jv/naaoqYfRvaE7fzbzsQCzndILIyy7MMAo+wsVRjBfhnu4S/yrYObnqsZ38aK -L4x35bcF7DvB7L6Gs4a8wPfc5+pbrrLMtTWGS9DiP7bY+A4A7l3j941Y/8+LN+lj -X273CXE2whJdV/LItM3z7gLfEdxquVeEHVlNjM7IDiPCtyaaEBRx/pOyiriA8A4Q -ntOoUAw3gi/q4Iqd4Sw5/7W0cwDk90imc6y/st53BIe0o82bNSQ3+pCTE4FCxpgm -dTdmQRCsu/WU48IxK63nI1bMNSWSs1A= ------END CERTIFICATE----- - -# Issuer: CN=FIRMAPROFESIONAL CA ROOT-A WEB O=Firmaprofesional SA -# Subject: CN=FIRMAPROFESIONAL CA ROOT-A WEB O=Firmaprofesional SA -# Label: "FIRMAPROFESIONAL CA ROOT-A WEB" -# Serial: 65916896770016886708751106294915943533 -# MD5 Fingerprint: 82:b2:ad:45:00:82:b0:66:63:f8:5f:c3:67:4e:ce:a3 -# SHA1 Fingerprint: a8:31:11:74:a6:14:15:0d:ca:77:dd:0e:e4:0c:5d:58:fc:a0:72:a5 -# SHA256 Fingerprint: be:f2:56:da:f2:6e:9c:69:bd:ec:16:02:35:97:98:f3:ca:f7:18:21:a0:3e:01:82:57:c5:3c:65:61:7f:3d:4a ------BEGIN CERTIFICATE----- -MIICejCCAgCgAwIBAgIQMZch7a+JQn81QYehZ1ZMbTAKBggqhkjOPQQDAzBuMQsw -CQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UE -YQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENB -IFJPT1QtQSBXRUIwHhcNMjIwNDA2MDkwMTM2WhcNNDcwMzMxMDkwMTM2WjBuMQsw -CQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UE -YQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENB -IFJPT1QtQSBXRUIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARHU+osEaR3xyrq89Zf -e9MEkVz6iMYiuYMQYneEMy3pA4jU4DP37XcsSmDq5G+tbbT4TIqk5B/K6k84Si6C -cyvHZpsKjECcfIr28jlgst7L7Ljkb+qbXbdTkBgyVcUgt5SjYzBhMA8GA1UdEwEB -/wQFMAMBAf8wHwYDVR0jBBgwFoAUk+FDY1w8ndYn81LsF7Kpryz3dvgwHQYDVR0O -BBYEFJPhQ2NcPJ3WJ/NS7Beyqa8s93b4MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjO -PQQDAwNoADBlAjAdfKR7w4l1M+E7qUW/Runpod3JIha3RxEL2Jq68cgLcFBTApFw -hVmpHqTm6iMxoAACMQD94vizrxa5HnPEluPBMBnYfubDl94cT7iJLzPrSA8Z94dG -XSaQpYXFuXqUPoeovQA= ------END CERTIFICATE----- - -# Issuer: CN=TWCA CYBER Root CA O=TAIWAN-CA OU=Root CA -# Subject: CN=TWCA CYBER Root CA O=TAIWAN-CA OU=Root CA -# Label: "TWCA CYBER Root CA" -# Serial: 85076849864375384482682434040119489222 -# MD5 Fingerprint: 0b:33:a0:97:52:95:d4:a9:fd:bb:db:6e:a3:55:5b:51 -# SHA1 Fingerprint: f6:b1:1c:1a:83:38:e9:7b:db:b3:a8:c8:33:24:e0:2d:9c:7f:26:66 -# SHA256 Fingerprint: 3f:63:bb:28:14:be:17:4e:c8:b6:43:9c:f0:8d:6d:56:f0:b7:c4:05:88:3a:56:48:a3:34:42:4d:6b:3e:c5:58 ------BEGIN CERTIFICATE----- -MIIFjTCCA3WgAwIBAgIQQAE0jMIAAAAAAAAAATzyxjANBgkqhkiG9w0BAQwFADBQ -MQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRAwDgYDVQQLEwdSb290 -IENBMRswGQYDVQQDExJUV0NBIENZQkVSIFJvb3QgQ0EwHhcNMjIxMTIyMDY1NDI5 -WhcNNDcxMTIyMTU1OTU5WjBQMQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FO -LUNBMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJUV0NBIENZQkVSIFJvb3Qg -Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDG+Moe2Qkgfh1sTs6P -40czRJzHyWmqOlt47nDSkvgEs1JSHWdyKKHfi12VCv7qze33Kc7wb3+szT3vsxxF -avcokPFhV8UMxKNQXd7UtcsZyoC5dc4pztKFIuwCY8xEMCDa6pFbVuYdHNWdZsc/ -34bKS1PE2Y2yHer43CdTo0fhYcx9tbD47nORxc5zb87uEB8aBs/pJ2DFTxnk684i -JkXXYJndzk834H/nY62wuFm40AZoNWDTNq5xQwTxaWV4fPMf88oon1oglWa0zbfu -j3ikRRjpJi+NmykosaS3Om251Bw4ckVYsV7r8Cibt4LK/c/WMw+f+5eesRycnupf -Xtuq3VTpMCEobY5583WSjCb+3MX2w7DfRFlDo7YDKPYIMKoNM+HvnKkHIuNZW0CP -2oi3aQiotyMuRAlZN1vH4xfyIutuOVLF3lSnmMlLIJXcRolftBL5hSmO68gnFSDA -S9TMfAxsNAwmmyYxpjyn9tnQS6Jk/zuZQXLB4HCX8SS7K8R0IrGsayIyJNN4KsDA -oS/xUgXJP+92ZuJF2A09rZXIx4kmyA+upwMu+8Ff+iDhcK2wZSA3M2Cw1a/XDBzC -kHDXShi8fgGwsOsVHkQGzaRP6AzRwyAQ4VRlnrZR0Bp2a0JaWHY06rc3Ga4udfmW -5cFZ95RXKSWNOkyrTZpB0F8mAwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSdhWEUfMFib5do5E83QOGt4A1WNzAd -BgNVHQ4EFgQUnYVhFHzBYm+XaORPN0DhreANVjcwDQYJKoZIhvcNAQEMBQADggIB -AGSPesRiDrWIzLjHhg6hShbNcAu3p4ULs3a2D6f/CIsLJc+o1IN1KriWiLb73y0t -tGlTITVX1olNc79pj3CjYcya2x6a4CD4bLubIp1dhDGaLIrdaqHXKGnK/nZVekZn -68xDiBaiA9a5F/gZbG0jAn/xX9AKKSM70aoK7akXJlQKTcKlTfjF/biBzysseKNn -TKkHmvPfXvt89YnNdJdhEGoHK4Fa0o635yDRIG4kqIQnoVesqlVYL9zZyvpoBJ7t -RCT5dEA7IzOrg1oYJkK2bVS1FmAwbLGg+LhBoF1JSdJlBTrq/p1hvIbZv97Tujqx -f36SNI7JAG7cmL3c7IAFrQI932XtCwP39xaEBDG6k5TY8hL4iuO/Qq+n1M0RFxbI -Qh0UqEL20kCGoE8jypZFVmAGzbdVAaYBlGX+bgUJurSkquLvWL69J1bY73NxW0Qz -8ppy6rBePm6pUlvscG21h483XjyMnM7k8M4MZ0HMzvaAq07MTFb1wWFZk7Q+ptq4 -NxKfKjLji7gh7MMrZQzvIt6IKTtM1/r+t+FHvpw+PoP7UV31aPcuIYXcv/Fa4nzX -xeSDwWrruoBa3lwtcHb4yOWHh8qgnaHlIhInD0Q9HWzq1MKLL295q39QpsQZp6F6 -t5b5wR9iWqJDB0BeJsas7a5wFsWqynKKTbDPAYsDP27X ------END CERTIFICATE----- - -# Issuer: CN=SecureSign Root CA12 O=Cybertrust Japan Co., Ltd. -# Subject: CN=SecureSign Root CA12 O=Cybertrust Japan Co., Ltd. -# Label: "SecureSign Root CA12" -# Serial: 587887345431707215246142177076162061960426065942 -# MD5 Fingerprint: c6:89:ca:64:42:9b:62:08:49:0b:1e:7f:e9:07:3d:e8 -# SHA1 Fingerprint: 7a:22:1e:3d:de:1b:06:ac:9e:c8:47:70:16:8e:3c:e5:f7:6b:06:f4 -# SHA256 Fingerprint: 3f:03:4b:b5:70:4d:44:b2:d0:85:45:a0:20:57:de:93:eb:f3:90:5f:ce:72:1a:cb:c7:30:c0:6d:da:ee:90:4e ------BEGIN CERTIFICATE----- -MIIDcjCCAlqgAwIBAgIUZvnHwa/swlG07VOX5uaCwysckBYwDQYJKoZIhvcNAQEL -BQAwUTELMAkGA1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28u -LCBMdGQuMR0wGwYDVQQDExRTZWN1cmVTaWduIFJvb3QgQ0ExMjAeFw0yMDA0MDgw -NTM2NDZaFw00MDA0MDgwNTM2NDZaMFExCzAJBgNVBAYTAkpQMSMwIQYDVQQKExpD -eWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2VjdXJlU2lnbiBS -b290IENBMTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6OcE3emhF -KxS06+QT61d1I02PJC0W6K6OyX2kVzsqdiUzg2zqMoqUm048luT9Ub+ZyZN+v/mt -p7JIKwccJ/VMvHASd6SFVLX9kHrko+RRWAPNEHl57muTH2SOa2SroxPjcf59q5zd -J1M3s6oYwlkm7Fsf0uZlfO+TvdhYXAvA42VvPMfKWeP+bl+sg779XSVOKik71gur -FzJ4pOE+lEa+Ym6b3kaosRbnhW70CEBFEaCeVESE99g2zvVQR9wsMJvuwPWW0v4J -hscGWa5Pro4RmHvzC1KqYiaqId+OJTN5lxZJjfU+1UefNzFJM3IFTQy2VYzxV4+K -h9GtxRESOaCtAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD -AgEGMB0GA1UdDgQWBBRXNPN0zwRL1SXm8UC2LEzZLemgrTANBgkqhkiG9w0BAQsF -AAOCAQEAPrvbFxbS8hQBICw4g0utvsqFepq2m2um4fylOqyttCg6r9cBg0krY6Ld -mmQOmFxv3Y67ilQiLUoT865AQ9tPkbeGGuwAtEGBpE/6aouIs3YIcipJQMPTw4WJ -mBClnW8Zt7vPemVV2zfrPIpyMpcemik+rY3moxtt9XUa5rBouVui7mlHJzWhhpmA -8zNL4WukJsPvdFlseqJkth5Ew1DgDzk9qTPxpfPSvWKErI4cqc1avTc7bgoitPQV -55FYxTpE05Uo2cBl6XLK0A+9H7MV2anjpEcJnuDLN/v9vZfVvhgaaaI5gdka9at/ -yOPiZwud9AzqVN/Ssq+xIvEg37xEHA== ------END CERTIFICATE----- - -# Issuer: CN=SecureSign Root CA14 O=Cybertrust Japan Co., Ltd. -# Subject: CN=SecureSign Root CA14 O=Cybertrust Japan Co., Ltd. -# Label: "SecureSign Root CA14" -# Serial: 575790784512929437950770173562378038616896959179 -# MD5 Fingerprint: 71:0d:72:fa:92:19:65:5e:89:04:ac:16:33:f0:bc:d5 -# SHA1 Fingerprint: dd:50:c0:f7:79:b3:64:2e:74:a2:b8:9d:9f:d3:40:dd:bb:f0:f2:4f -# SHA256 Fingerprint: 4b:00:9c:10:34:49:4f:9a:b5:6b:ba:3b:a1:d6:27:31:fc:4d:20:d8:95:5a:dc:ec:10:a9:25:60:72:61:e3:38 ------BEGIN CERTIFICATE----- -MIIFcjCCA1qgAwIBAgIUZNtaDCBO6Ncpd8hQJ6JaJ90t8sswDQYJKoZIhvcNAQEM -BQAwUTELMAkGA1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28u -LCBMdGQuMR0wGwYDVQQDExRTZWN1cmVTaWduIFJvb3QgQ0ExNDAeFw0yMDA0MDgw -NzA2MTlaFw00NTA0MDgwNzA2MTlaMFExCzAJBgNVBAYTAkpQMSMwIQYDVQQKExpD -eWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2VjdXJlU2lnbiBS -b290IENBMTQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDF0nqh1oq/ -FjHQmNE6lPxauG4iwWL3pwon71D2LrGeaBLwbCRjOfHw3xDG3rdSINVSW0KZnvOg -vlIfX8xnbacuUKLBl422+JX1sLrcneC+y9/3OPJH9aaakpUqYllQC6KxNedlsmGy -6pJxaeQp8E+BgQQ8sqVb1MWoWWd7VRxJq3qdwudzTe/NCcLEVxLbAQ4jeQkHO6Lo -/IrPj8BGJJw4J+CDnRugv3gVEOuGTgpa/d/aLIJ+7sr2KeH6caH3iGicnPCNvg9J -kdjqOvn90Ghx2+m1K06Ckm9mH+Dw3EzsytHqunQG+bOEkJTRX45zGRBdAuVwpcAQ -0BB8b8VYSbSwbprafZX1zNoCr7gsfXmPvkPx+SgojQlD+Ajda8iLLCSxjVIHvXib -y8posqTdDEx5YMaZ0ZPxMBoH064iwurO8YQJzOAUbn8/ftKChazcqRZOhaBgy/ac -18izju3Gm5h1DVXoX+WViwKkrkMpKBGk5hIwAUt1ax5mnXkvpXYvHUC0bcl9eQjs -0Wq2XSqypWa9a4X0dFbD9ed1Uigspf9mR6XU/v6eVL9lfgHWMI+lNpyiUBzuOIAB -SMbHdPTGrMNASRZhdCyvjG817XsYAFs2PJxQDcqSMxDxJklt33UkN4Ii1+iW/RVL -ApY+B3KVfqs9TC7XyvDf4Fg/LS8EmjijAQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD -AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUBpOjCl4oaTeqYR3r6/wtbyPk -86AwDQYJKoZIhvcNAQEMBQADggIBAJaAcgkGfpzMkwQWu6A6jZJOtxEaCnFxEM0E -rX+lRVAQZk5KQaID2RFPeje5S+LGjzJmdSX7684/AykmjbgWHfYfM25I5uj4V7Ib -ed87hwriZLoAymzvftAj63iP/2SbNDefNWWipAA9EiOWWF3KY4fGoweITedpdopT -zfFP7ELyk+OZpDc8h7hi2/DsHzc/N19DzFGdtfCXwreFamgLRB7lUe6TzktuhsHS -DCRZNhqfLJGP4xjblJUK7ZGqDpncllPjYYPGFrojutzdfhrGe0K22VoF3Jpf1d+4 -2kd92jjbrDnVHmtsKheMYc2xbXIBw8MgAGJoFjHVdqqGuw6qnsb58Nn4DSEC5MUo -FlkRudlpcyqSeLiSV5sI8jrlL5WwWLdrIBRtFO8KvH7YVdiI2i/6GaX7i+B/OfVy -K4XELKzvGUWSTLNhB9xNH27SgRNcmvMSZ4PPmz+Ln52kuaiWA3rF7iDeM9ovnhp6 -dB7h7sxaOgTdsxoEqBRjrLdHEoOabPXm6RUVkRqEGQ6UROcSjiVbgGcZ3GOTEAtl -Lor6CZpO2oYofaphNdgOpygau1LgePhsumywbrmHXumZNTfxPWQrqaA0k89jL9WB -365jJ6UeTo3cKXhZ+PmhIIynJkBugnLNeLLIjzwec+fBH7/PzqUqm9tEZDKgu39c -JRNItX+S ------END CERTIFICATE----- - -# Issuer: CN=SecureSign Root CA15 O=Cybertrust Japan Co., Ltd. -# Subject: CN=SecureSign Root CA15 O=Cybertrust Japan Co., Ltd. -# Label: "SecureSign Root CA15" -# Serial: 126083514594751269499665114766174399806381178503 -# MD5 Fingerprint: 13:30:fc:c4:62:a6:a9:de:b5:c1:68:af:b5:d2:31:47 -# SHA1 Fingerprint: cb:ba:83:c8:c1:5a:5d:f1:f9:73:6f:ca:d7:ef:28:13:06:4a:07:7d -# SHA256 Fingerprint: e7:78:f0:f0:95:fe:84:37:29:cd:1a:00:82:17:9e:53:14:a9:c2:91:44:28:05:e1:fb:1d:8f:b6:b8:88:6c:3a ------BEGIN CERTIFICATE----- -MIICIzCCAamgAwIBAgIUFhXHw9hJp75pDIqI7fBw+d23PocwCgYIKoZIzj0EAwMw -UTELMAkGA1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28uLCBM -dGQuMR0wGwYDVQQDExRTZWN1cmVTaWduIFJvb3QgQ0ExNTAeFw0yMDA0MDgwODMy -NTZaFw00NTA0MDgwODMyNTZaMFExCzAJBgNVBAYTAkpQMSMwIQYDVQQKExpDeWJl -cnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2VjdXJlU2lnbiBSb290 -IENBMTUwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQLUHSNZDKZmbPSYAi4Io5GdCx4 -wCtELW1fHcmuS1Iggz24FG1Th2CeX2yF2wYUleDHKP+dX+Sq8bOLbe1PL0vJSpSR -ZHX+AezB2Ot6lHhWGENfa4HL9rzatAy2KZMIaY+jQjBAMA8GA1UdEwEB/wQFMAMB -Af8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTrQciu/NWeUUj1vYv0hyCTQSvT -9DAKBggqhkjOPQQDAwNoADBlAjEA2S6Jfl5OpBEHvVnCB96rMjhTKkZEBhd6zlHp -4P9mLQlO4E/0BdGF9jVg3PVys0Z9AjBEmEYagoUeYWmJSwdLZrWeqrqgHkHZAXQ6 -bkU6iYAZezKYVWOr62Nuk22rGwlgMU4= ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST BR Root CA 2 2023 O=D-Trust GmbH -# Subject: CN=D-TRUST BR Root CA 2 2023 O=D-Trust GmbH -# Label: "D-TRUST BR Root CA 2 2023" -# Serial: 153168538924886464690566649552453098598 -# MD5 Fingerprint: e1:09:ed:d3:60:d4:56:1b:47:1f:b7:0c:5f:1b:5f:85 -# SHA1 Fingerprint: 2d:b0:70:ee:71:94:af:69:68:17:db:79:ce:58:9f:a0:6b:96:f7:87 -# SHA256 Fingerprint: 05:52:e6:f8:3f:df:65:e8:fa:96:70:e6:66:df:28:a4:e2:13:40:b5:10:cb:e5:25:66:f9:7c:4f:b9:4b:2b:d1 ------BEGIN CERTIFICATE----- -MIIFqTCCA5GgAwIBAgIQczswBEhb2U14LnNLyaHcZjANBgkqhkiG9w0BAQ0FADBI -MQswCQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlE -LVRSVVNUIEJSIFJvb3QgQ0EgMiAyMDIzMB4XDTIzMDUwOTA4NTYzMVoXDTM4MDUw -OTA4NTYzMFowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEi -MCAGA1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDIgMjAyMzCCAiIwDQYJKoZIhvcN -AQEBBQADggIPADCCAgoCggIBAK7/CVmRgApKaOYkP7in5Mg6CjoWzckjYaCTcfKr -i3OPoGdlYNJUa2NRb0kz4HIHE304zQaSBylSa053bATTlfrdTIzZXcFhfUvnKLNE -gXtRr90zsWh81k5M/itoucpmacTsXld/9w3HnDY25QdgrMBM6ghs7wZ8T1soegj8 -k12b9py0i4a6Ibn08OhZWiihNIQaJZG2tY/vsvmA+vk9PBFy2OMvhnbFeSzBqZCT -Rphny4NqoFAjpzv2gTng7fC5v2Xx2Mt6++9zA84A9H3X4F07ZrjcjrqDy4d2A/wl -2ecjbwb9Z/Pg/4S8R7+1FhhGaRTMBffb00msa8yr5LULQyReS2tNZ9/WtT5PeB+U -cSTq3nD88ZP+npNa5JRal1QMNXtfbO4AHyTsA7oC9Xb0n9Sa7YUsOCIvx9gvdhFP -/Wxc6PWOJ4d/GUohR5AdeY0cW/jPSoXk7bNbjb7EZChdQcRurDhaTyN0dKkSw/bS -uREVMweR2Ds3OmMwBtHFIjYoYiMQ4EbMl6zWK11kJNXuHA7e+whadSr2Y23OC0K+ -0bpwHJwh5Q8xaRfX/Aq03u2AnMuStIv13lmiWAmlY0cL4UEyNEHZmrHZqLAbWt4N -DfTisl01gLmB1IRpkQLLddCNxbU9CZEJjxShFHR5PtbJFR2kWVki3PaKRT08EtY+ -XTIvAgMBAAGjgY4wgYswDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUZ5Dw1t61 -GNVGKX5cq/ieCLxklRAwDgYDVR0PAQH/BAQDAgEGMEkGA1UdHwRCMEAwPqA8oDqG -OGh0dHA6Ly9jcmwuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3RfYnJfcm9vdF9jYV8y -XzIwMjMuY3JsMA0GCSqGSIb3DQEBDQUAA4ICAQA097N3U9swFrktpSHxQCF16+tI -FoE9c+CeJyrrd6kTpGoKWloUMz1oH4Guaf2Mn2VsNELZLdB/eBaxOqwjMa1ef67n -riv6uvw8l5VAk1/DLQOj7aRvU9f6QA4w9QAgLABMjDu0ox+2v5Eyq6+SmNMW5tTR -VFxDWy6u71cqqLRvpO8NVhTaIasgdp4D/Ca4nj8+AybmTNudX0KEPUUDAxxZiMrc -LmEkWqTqJwtzEr5SswrPMhfiHocaFpVIbVrg0M8JkiZmkdijYQ6qgYF/6FKC0ULn -4B0Y+qSFNueG4A3rvNTJ1jxD8V1Jbn6Bm2m1iWKPiFLY1/4nwSPFyysCu7Ff/vtD -hQNGvl3GyiEm/9cCnnRK3PgTFbGBVzbLZVzRHTF36SXDw7IyN9XxmAnkbWOACKsG -koHU6XCPpz+y7YaMgmo1yEJagtFSGkUPFaUA8JR7ZSdXOUPPfH/mvTWze/EZTN46 -ls/pdu4D58JDUjxqgejBWoC9EV2Ta/vH5mQ/u2kc6d0li690yVRAysuTEwrt+2aS -Ecr1wPrYg1UDfNPFIkZ1cGt5SAYqgpq/5usWDiJFAbzdNpQ0qTUmiteXue4Icr80 -knCDgKs4qllo3UCkGJCy89UDyibK79XH4I9TjvAA46jtn/mtd+ArY0+ew+43u3gJ -hJ65bvspmZDogNOfJA== ------END CERTIFICATE----- - -# Issuer: CN=TrustAsia TLS ECC Root CA O=TrustAsia Technologies, Inc. -# Subject: CN=TrustAsia TLS ECC Root CA O=TrustAsia Technologies, Inc. -# Label: "TrustAsia TLS ECC Root CA" -# Serial: 310892014698942880364840003424242768478804666567 -# MD5 Fingerprint: 09:48:04:77:d2:fc:65:93:71:66:b1:11:95:4f:06:8c -# SHA1 Fingerprint: b5:ec:39:f3:a1:66:37:ae:c3:05:94:57:e2:be:11:be:b7:a1:7f:36 -# SHA256 Fingerprint: c0:07:6b:9e:f0:53:1f:b1:a6:56:d6:7c:4e:be:97:cd:5d:ba:a4:1e:f4:45:98:ac:c2:48:98:78:c9:2d:87:11 ------BEGIN CERTIFICATE----- -MIICMTCCAbegAwIBAgIUNnThTXxlE8msg1UloD5Sfi9QaMcwCgYIKoZIzj0EAwMw -WDELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs -IEluYy4xIjAgBgNVBAMTGVRydXN0QXNpYSBUTFMgRUNDIFJvb3QgQ0EwHhcNMjQw -NTE1MDU0MTU2WhcNNDQwNTE1MDU0MTU1WjBYMQswCQYDVQQGEwJDTjElMCMGA1UE -ChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5jLjEiMCAGA1UEAxMZVHJ1c3RB -c2lhIFRMUyBFQ0MgUm9vdCBDQTB2MBAGByqGSM49AgEGBSuBBAAiA2IABLh/pVs/ -AT598IhtrimY4ZtcU5nb9wj/1WrgjstEpvDBjL1P1M7UiFPoXlfXTr4sP/MSpwDp -guMqWzJ8S5sUKZ74LYO1644xST0mYekdcouJtgq7nDM1D9rs3qlKH8kzsaNCMEAw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQULIVTu7FDzTLqnqOH/qKYqKaT6RAw -DgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gAMGUCMFRH18MtYYZI9HlaVQ01 -L18N9mdsd0AaRuf4aFtOJx24mH1/k78ITcTaRTChD15KeAIxAKORh/IRM4PDwYqR -OkwrULG9IpRdNYlzg8WbGf60oenUoWa2AaU2+dhoYSi3dOGiMQ== ------END CERTIFICATE----- - -# Issuer: CN=TrustAsia TLS RSA Root CA O=TrustAsia Technologies, Inc. -# Subject: CN=TrustAsia TLS RSA Root CA O=TrustAsia Technologies, Inc. -# Label: "TrustAsia TLS RSA Root CA" -# Serial: 160405846464868906657516898462547310235378010780 -# MD5 Fingerprint: 3b:9e:c3:86:0f:34:3c:6b:c5:46:c4:8e:1d:e7:19:12 -# SHA1 Fingerprint: a5:46:50:c5:62:ea:95:9a:1a:a7:04:6f:17:58:c7:29:53:3d:03:fa -# SHA256 Fingerprint: 06:c0:8d:7d:af:d8:76:97:1e:b1:12:4f:e6:7f:84:7e:c0:c7:a1:58:d3:ea:53:cb:e9:40:e2:ea:97:91:f4:c3 ------BEGIN CERTIFICATE----- -MIIFgDCCA2igAwIBAgIUHBjYz+VTPyI1RlNUJDxsR9FcSpwwDQYJKoZIhvcNAQEM -BQAwWDELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dp -ZXMsIEluYy4xIjAgBgNVBAMTGVRydXN0QXNpYSBUTFMgUlNBIFJvb3QgQ0EwHhcN -MjQwNTE1MDU0MTU3WhcNNDQwNTE1MDU0MTU2WjBYMQswCQYDVQQGEwJDTjElMCMG -A1UEChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5jLjEiMCAGA1UEAxMZVHJ1 -c3RBc2lhIFRMUyBSU0EgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC -AgoCggIBAMMWuBtqpERz5dZO9LnPWwvB0ZqB9WOwj0PBuwhaGnrhB3YmH49pVr7+ -NmDQDIPNlOrnxS1cLwUWAp4KqC/lYCZUlviYQB2srp10Zy9U+5RjmOMmSoPGlbYJ -Q1DNDX3eRA5gEk9bNb2/mThtfWza4mhzH/kxpRkQcwUqwzIZheo0qt1CHjCNP561 -HmHVb70AcnKtEj+qpklz8oYVlQwQX1Fkzv93uMltrOXVmPGZLmzjyUT5tUMnCE32 -ft5EebuyjBza00tsLtbDeLdM1aTk2tyKjg7/D8OmYCYozza/+lcK7Fs/6TAWe8Tb -xNRkoDD75f0dcZLdKY9BWN4ArTr9PXwaqLEX8E40eFgl1oUh63kd0Nyrz2I8sMeX -i9bQn9P+PN7F4/w6g3CEIR0JwqH8uyghZVNgepBtljhb//HXeltt08lwSUq6HTrQ -UNoyIBnkiz/r1RYmNzz7dZ6wB3C4FGB33PYPXFIKvF1tjVEK2sUYyJtt3LCDs3+j -TnhMmCWr8n4uIF6CFabW2I+s5c0yhsj55NqJ4js+k8UTav/H9xj8Z7XvGCxUq0DT -bE3txci3OE9kxJRMT6DNrqXGJyV1J23G2pyOsAWZ1SgRxSHUuPzHlqtKZFlhaxP8 -S8ySpg+kUb8OWJDZgoM5pl+z+m6Ss80zDoWo8SnTq1mt1tve1CuBAgMBAAGjQjBA -MA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFLgHkXlcBvRG/XtZylomkadFK/hT -MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQwFAAOCAgEAIZtqBSBdGBanEqT3 -Rz/NyjuujsCCztxIJXgXbODgcMTWltnZ9r96nBO7U5WS/8+S4PPFJzVXqDuiGev4 -iqME3mmL5Dw8veWv0BIb5Ylrc5tvJQJLkIKvQMKtuppgJFqBTQUYo+IzeXoLH5Pt -7DlK9RME7I10nYEKqG/odv6LTytpEoYKNDbdgptvT+Bz3Ul/KD7JO6NXBNiT2Twp -2xIQaOHEibgGIOcberyxk2GaGUARtWqFVwHxtlotJnMnlvm5P1vQiJ3koP26TpUJ -g3933FEFlJ0gcXax7PqJtZwuhfG5WyRasQmr2soaB82G39tp27RIGAAtvKLEiUUj -pQ7hRGU+isFqMB3iYPg6qocJQrmBktwliJiJ8Xw18WLK7nn4GS/+X/jbh87qqA8M -pugLoDzga5SYnH+tBuYc6kIQX+ImFTw3OffXvO645e8D7r0i+yiGNFjEWn9hongP -XvPKnbwbPKfILfanIhHKA9jnZwqKDss1jjQ52MjqjZ9k4DewbNfFj8GQYSbbJIwe -SsCI3zWQzj8C9GRh3sfIB5XeMhg6j6JCQCTl1jNdfK7vsU1P1FeQNWrcrgSXSYk0 -ly4wBOeY99sLAZDBHwo/+ML+TvrbmnNzFrwFuHnYWa8G5z9nODmxfKuU4CkUpijy -323imttUQ/hHWKNddBWcwauwxzQ= ------END CERTIFICATE----- - -# Issuer: CN=D-TRUST EV Root CA 2 2023 O=D-Trust GmbH -# Subject: CN=D-TRUST EV Root CA 2 2023 O=D-Trust GmbH -# Label: "D-TRUST EV Root CA 2 2023" -# Serial: 139766439402180512324132425437959641711 -# MD5 Fingerprint: 96:b4:78:09:f0:09:cb:77:eb:bb:1b:4d:6f:36:bc:b6 -# SHA1 Fingerprint: a5:5b:d8:47:6c:8f:19:f7:4c:f4:6d:6b:b6:c2:79:82:22:df:54:8b -# SHA256 Fingerprint: 8e:82:21:b2:e7:d4:00:78:36:a1:67:2f:0d:cc:29:9c:33:bc:07:d3:16:f1:32:fa:1a:20:6d:58:71:50:f1:ce ------BEGIN CERTIFICATE----- -MIIFqTCCA5GgAwIBAgIQaSYJfoBLTKCnjHhiU19abzANBgkqhkiG9w0BAQ0FADBI -MQswCQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlE -LVRSVVNUIEVWIFJvb3QgQ0EgMiAyMDIzMB4XDTIzMDUwOTA5MTAzM1oXDTM4MDUw -OTA5MTAzMlowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEi -MCAGA1UEAxMZRC1UUlVTVCBFViBSb290IENBIDIgMjAyMzCCAiIwDQYJKoZIhvcN -AQEBBQADggIPADCCAgoCggIBANiOo4mAC7JXUtypU0w3uX9jFxPvp1sjW2l1sJkK -F8GLxNuo4MwxusLyzV3pt/gdr2rElYfXR8mV2IIEUD2BCP/kPbOx1sWy/YgJ25yE -7CUXFId/MHibaljJtnMoPDT3mfd/06b4HEV8rSyMlD/YZxBTfiLNTiVR8CUkNRFe -EMbsh2aJgWi6zCudR3Mfvc2RpHJqnKIbGKBv7FD0fUDCqDDPvXPIEysQEx6Lmqg6 -lHPTGGkKSv/BAQP/eX+1SH977ugpbzZMlWGG2Pmic4ruri+W7mjNPU0oQvlFKzIb -RlUWaqZLKfm7lVa/Rh3sHZMdwGWyH6FDrlaeoLGPaxK3YG14C8qKXO0elg6DpkiV -jTujIcSuWMYAsoS0I6SWhjW42J7YrDRJmGOVxcttSEfi8i4YHtAxq9107PncjLgc -jmgjutDzUNzPZY9zOjLHfP7KgiJPvo5iR2blzYfi6NUPGJ/lBHJLRjwQ8kTCZFZx -TnXonMkmdMV9WdEKWw9t/p51HBjGGjp82A0EzM23RWV6sY+4roRIPrN6TagD4uJ+ -ARZZaBhDM7DS3LAaQzXupdqpRlyuhoFBAUp0JuyfBr/CBTdkdXgpaP3F9ev+R/nk -hbDhezGdpn9yo7nELC7MmVcOIQxFAZRl62UJxmMiCzNJkkg8/M3OsD6Onov4/knF -NXJHAgMBAAGjgY4wgYswDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqvyREBuH -kV8Wub9PS5FeAByxMoAwDgYDVR0PAQH/BAQDAgEGMEkGA1UdHwRCMEAwPqA8oDqG -OGh0dHA6Ly9jcmwuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3RfZXZfcm9vdF9jYV8y -XzIwMjMuY3JsMA0GCSqGSIb3DQEBDQUAA4ICAQCTy6UfmRHsmg1fLBWTxj++EI14 -QvBukEdHjqOSMo1wj/Zbjb6JzkcBahsgIIlbyIIQbODnmaprxiqgYzWRaoUlrRc4 -pZt+UPJ26oUFKidBK7GB0aL2QHWpDsvxVUjY7NHss+jOFKE17MJeNRqrphYBBo7q -3C+jisosketSjl8MmxfPy3MHGcRqwnNU73xDUmPBEcrCRbH0O1P1aa4846XerOhU -t7KR/aypH/KH5BfGSah82ApB9PI+53c0BFLd6IHyTS9URZ0V4U/M5d40VxDJI3IX -cI1QcB9WbMy5/zpaT2N6w25lBx2Eof+pDGOJbbJAiDnXH3dotfyc1dZnaVuodNv8 -ifYbMvekJKZ2t0dT741Jj6m2g1qllpBFYfXeA08mD6iL8AOWsKwV0HFaanuU5nCT -2vFp4LJiTZ6P/4mdm13NRemUAiKN4DV/6PEEeXFsVIP4M7kFMhtYVRFP0OUnR3Hs -7dpn1mKmS00PaaLJvOwiS5THaJQXfuKOKD62xur1NGyfN4gHONuGcfrNlUhDbqNP -gofXNJhuS5N5YHVpD/Aa1VP6IQzCP+k/HxiMkl14p3ZnGbuy6n/pcAlWVqOwDAst -Nl7F6cTVg8uGF5csbBNvh1qvSaYd2804BC5f4ko1Di1L+KIkBI3Y4WNeApI02phh -XBxvWHZks/wCuPWdCg== ------END CERTIFICATE----- - -# Issuer: CN=SwissSign RSA TLS Root CA 2022 - 1 O=SwissSign AG -# Subject: CN=SwissSign RSA TLS Root CA 2022 - 1 O=SwissSign AG -# Label: "SwissSign RSA TLS Root CA 2022 - 1" -# Serial: 388078645722908516278762308316089881486363258315 -# MD5 Fingerprint: 16:2e:e4:19:76:81:85:ba:8e:91:58:f1:15:ef:72:39 -# SHA1 Fingerprint: 81:34:0a:be:4c:cd:ce:cc:e7:7d:cc:8a:d4:57:e2:45:a0:77:5d:ce -# SHA256 Fingerprint: 19:31:44:f4:31:e0:fd:db:74:07:17:d4:de:92:6a:57:11:33:88:4b:43:60:d3:0e:27:29:13:cb:e6:60:ce:41 ------BEGIN CERTIFICATE----- -MIIFkzCCA3ugAwIBAgIUQ/oMX04bgBhE79G0TzUfRPSA7cswDQYJKoZIhvcNAQEL -BQAwUTELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzErMCkGA1UE -AxMiU3dpc3NTaWduIFJTQSBUTFMgUm9vdCBDQSAyMDIyIC0gMTAeFw0yMjA2MDgx -MTA4MjJaFw00NzA2MDgxMTA4MjJaMFExCzAJBgNVBAYTAkNIMRUwEwYDVQQKEwxT -d2lzc1NpZ24gQUcxKzApBgNVBAMTIlN3aXNzU2lnbiBSU0EgVExTIFJvb3QgQ0Eg -MjAyMiAtIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDLKmjiC8NX -vDVjvHClO/OMPE5Xlm7DTjak9gLKHqquuN6orx122ro10JFwB9+zBvKK8i5VUXu7 -LCTLf5ImgKO0lPaCoaTo+nUdWfMHamFk4saMla+ju45vVs9xzF6BYQ1t8qsCLqSX -5XH8irCRIFucdFJtrhUnWXjyCcplDn/L9Ovn3KlMd/YrFgSVrpxxpT8q2kFC5zyE -EPThPYxr4iuRR1VPuFa+Rd4iUU1OKNlfGUEGjw5NBuBwQCMBauTLE5tzrE0USJIt -/m2n+IdreXXhvhCxqohAWVTXz8TQm0SzOGlkjIHRI36qOTw7D59Ke4LKa2/KIj4x -0LDQKhySio/YGZxH5D4MucLNvkEM+KRHBdvBFzA4OmnczcNpI/2aDwLOEGrOyvi5 -KaM2iYauC8BPY7kGWUleDsFpswrzd34unYyzJ5jSmY0lpx+Gs6ZUcDj8fV3oT4MM -0ZPlEuRU2j7yrTrePjxF8CgPBrnh25d7mUWe3f6VWQQvdT/TromZhqwUtKiE+shd -OxtYk8EXlFXIC+OCeYSf8wCENO7cMdWP8vpPlkwGqnj73mSiI80fPsWMvDdUDrta -clXvyFu1cvh43zcgTFeRc5JzrBh3Q4IgaezprClG5QtO+DdziZaKHG29777YtvTK -wP1H8K4LWCDFyB02rpeNUIMmJCn3nTsPBQIDAQABo2MwYTAPBgNVHRMBAf8EBTAD -AQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBRvjmKLk0Ow4UD2p8P98Q+4 -DxU4pTAdBgNVHQ4EFgQUb45ii5NDsOFA9qfD/fEPuA8VOKUwDQYJKoZIhvcNAQEL -BQADggIBAKwsKUF9+lz1GpUYvyypiqkkVHX1uECry6gkUSsYP2OprphWKwVDIqO3 -10aewCoSPY6WlkDfDDOLazeROpW7OSltwAJsipQLBwJNGD77+3v1dj2b9l4wBlgz -Hqp41eZUBDqyggmNzhYzWUUo8aWjlw5DI/0LIICQ/+Mmz7hkkeUFjxOgdg3XNwwQ -iJb0Pr6VvfHDffCjw3lHC1ySFWPtUnWK50Zpy1FVCypM9fJkT6lc/2cyjlUtMoIc -gC9qkfjLvH4YoiaoLqNTKIftV+Vlek4ASltOU8liNr3CjlvrzG4ngRhZi0Rjn9UM -ZfQpZX+RLOV/fuiJz48gy20HQhFRJjKKLjpHE7iNvUcNCfAWpO2Whi4Z2L6MOuhF -LhG6rlrnub+xzI/goP+4s9GFe3lmozm1O2bYQL7Pt2eLSMkZJVX8vY3PXtpOpvJp -zv1/THfQwUY1mFwjmwJFQ5Ra3bxHrSL+ul4vkSkphnsh3m5kt8sNjzdbowhq6/Td -Ao9QAwKxuDdollDruF/UKIqlIgyKhPBZLtU30WHlQnNYKoH3dtvi4k0NX/a3vgW0 -rk4N3hY9A4GzJl5LuEsAz/+MF7psYC0nhzck5npgL7XTgwSqT0N1osGDsieYK7EO -gLrAhV5Cud+xYJHT6xh+cHiudoO+cVrQkOPKwRYlZ0rwtnu64ZzZ ------END CERTIFICATE----- diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/core.py b/write-message/venv/lib/python3.10/site-packages/certifi/core.py deleted file mode 100644 index 1c9661c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/certifi/core.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -certifi.py -~~~~~~~~~~ - -This module returns the installation location of cacert.pem or its contents. -""" -import sys -import atexit - -def exit_cacert_ctx() -> None: - _CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr] - - -if sys.version_info >= (3, 11): - - from importlib.resources import as_file, files - - _CACERT_CTX = None - _CACERT_PATH = None - - def where() -> str: - # This is slightly terrible, but we want to delay extracting the file - # in cases where we're inside of a zipimport situation until someone - # actually calls where(), but we don't want to re-extract the file - # on every call of where(), so we'll do it once then store it in a - # global variable. - global _CACERT_CTX - global _CACERT_PATH - if _CACERT_PATH is None: - # This is slightly janky, the importlib.resources API wants you to - # manage the cleanup of this file, so it doesn't actually return a - # path, it returns a context manager that will give you the path - # when you enter it and will do any cleanup when you leave it. In - # the common case of not needing a temporary file, it will just - # return the file system location and the __exit__() is a no-op. - # - # We also have to hold onto the actual context manager, because - # it will do the cleanup whenever it gets garbage collected, so - # we will also store that at the global level as well. - _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem")) - _CACERT_PATH = str(_CACERT_CTX.__enter__()) - atexit.register(exit_cacert_ctx) - - return _CACERT_PATH - - def contents() -> str: - return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii") - -else: - - from importlib.resources import path as get_path, read_text - - _CACERT_CTX = None - _CACERT_PATH = None - - def where() -> str: - # This is slightly terrible, but we want to delay extracting the - # file in cases where we're inside of a zipimport situation until - # someone actually calls where(), but we don't want to re-extract - # the file on every call of where(), so we'll do it once then store - # it in a global variable. - global _CACERT_CTX - global _CACERT_PATH - if _CACERT_PATH is None: - # This is slightly janky, the importlib.resources API wants you - # to manage the cleanup of this file, so it doesn't actually - # return a path, it returns a context manager that will give - # you the path when you enter it and will do any cleanup when - # you leave it. In the common case of not needing a temporary - # file, it will just return the file system location and the - # __exit__() is a no-op. - # - # We also have to hold onto the actual context manager, because - # it will do the cleanup whenever it gets garbage collected, so - # we will also store that at the global level as well. - _CACERT_CTX = get_path("certifi", "cacert.pem") - _CACERT_PATH = str(_CACERT_CTX.__enter__()) - atexit.register(exit_cacert_ctx) - - return _CACERT_PATH - - def contents() -> str: - return read_text("certifi", "cacert.pem", encoding="ascii") diff --git a/write-message/venv/lib/python3.10/site-packages/certifi/py.typed b/write-message/venv/lib/python3.10/site-packages/certifi/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/METADATA deleted file mode 100644 index e6c05af..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/METADATA +++ /dev/null @@ -1,82 +0,0 @@ -Metadata-Version: 2.4 -Name: click -Version: 8.2.1 -Summary: Composable command line interface toolkit -Maintainer-email: Pallets -Requires-Python: >=3.10 -Description-Content-Type: text/markdown -License-Expression: BSD-3-Clause -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Typing :: Typed -License-File: LICENSE.txt -Requires-Dist: colorama; platform_system == 'Windows' -Project-URL: Changes, https://click.palletsprojects.com/page/changes/ -Project-URL: Chat, https://discord.gg/pallets -Project-URL: Documentation, https://click.palletsprojects.com/ -Project-URL: Donate, https://palletsprojects.com/donate -Project-URL: Source, https://github.com/pallets/click/ - -# $ click_ - -Click is a Python package for creating beautiful command line interfaces -in a composable way with as little code as necessary. It's the "Command -Line Interface Creation Kit". It's highly configurable but comes with -sensible defaults out of the box. - -It aims to make the process of writing command line tools quick and fun -while also preventing any frustration caused by the inability to -implement an intended CLI API. - -Click in three points: - -- Arbitrary nesting of commands -- Automatic help page generation -- Supports lazy loading of subcommands at runtime - - -## A Simple Example - -```python -import click - -@click.command() -@click.option("--count", default=1, help="Number of greetings.") -@click.option("--name", prompt="Your name", help="The person to greet.") -def hello(count, name): - """Simple program that greets NAME for a total of COUNT times.""" - for _ in range(count): - click.echo(f"Hello, {name}!") - -if __name__ == '__main__': - hello() -``` - -``` -$ python hello.py --count=3 -Your name: Click -Hello, Click! -Hello, Click! -Hello, Click! -``` - - -## Donate - -The Pallets organization develops and supports Click and other popular -packages. In order to grow the community of contributors and users, and -allow the maintainers to devote more time to the projects, [please -donate today][]. - -[please donate today]: https://palletsprojects.com/donate - -## Contributing - -See our [detailed contributing documentation][contrib] for many ways to -contribute, including reporting issues, requesting features, asking or answering -questions, and making PRs. - -[contrib]: https://palletsprojects.com/contributing/ - diff --git a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/RECORD deleted file mode 100644 index 621f456..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/RECORD +++ /dev/null @@ -1,38 +0,0 @@ -click-8.2.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -click-8.2.1.dist-info/METADATA,sha256=dI1MbhHTLoKD2tNCCGnx9rK2gok23HDNylFeLKdLSik,2471 -click-8.2.1.dist-info/RECORD,, -click-8.2.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 -click-8.2.1.dist-info/licenses/LICENSE.txt,sha256=morRBqOU6FO_4h9C9OctWSgZoigF2ZG18ydQKSkrZY0,1475 -click/__init__.py,sha256=6YyS1aeyknZ0LYweWozNZy0A9nZ_11wmYIhv3cbQrYo,4473 -click/__pycache__/__init__.cpython-310.pyc,, -click/__pycache__/_compat.cpython-310.pyc,, -click/__pycache__/_termui_impl.cpython-310.pyc,, -click/__pycache__/_textwrap.cpython-310.pyc,, -click/__pycache__/_winconsole.cpython-310.pyc,, -click/__pycache__/core.cpython-310.pyc,, -click/__pycache__/decorators.cpython-310.pyc,, -click/__pycache__/exceptions.cpython-310.pyc,, -click/__pycache__/formatting.cpython-310.pyc,, -click/__pycache__/globals.cpython-310.pyc,, -click/__pycache__/parser.cpython-310.pyc,, -click/__pycache__/shell_completion.cpython-310.pyc,, -click/__pycache__/termui.cpython-310.pyc,, -click/__pycache__/testing.cpython-310.pyc,, -click/__pycache__/types.cpython-310.pyc,, -click/__pycache__/utils.cpython-310.pyc,, -click/_compat.py,sha256=v3xBZkFbvA1BXPRkFfBJc6-pIwPI7345m-kQEnpVAs4,18693 -click/_termui_impl.py,sha256=ASXhLi9IQIc0Js9KQSS-3-SLZcPet3VqysBf9WgbbpI,26712 -click/_textwrap.py,sha256=BOae0RQ6vg3FkNgSJyOoGzG1meGMxJ_ukWVZKx_v-0o,1400 -click/_winconsole.py,sha256=_vxUuUaxwBhoR0vUWCNuHY8VUefiMdCIyU2SXPqoF-A,8465 -click/core.py,sha256=gUhpNS9cFBGdEXXdisGVG-eRvGf49RTyFagxulqwdFw,117343 -click/decorators.py,sha256=5P7abhJtAQYp_KHgjUvhMv464ERwOzrv2enNknlwHyQ,18461 -click/exceptions.py,sha256=1rdtXgHJ1b3OjGkN-UpXB9t_HCBihJvh_DtpmLmwn9s,9891 -click/formatting.py,sha256=Bhqx4QXdKQ9W4WKknIwj5KPKFmtduGOuGq1yw_THLZ8,9726 -click/globals.py,sha256=gM-Nh6A4M0HB_SgkaF5M4ncGGMDHc_flHXu9_oh4GEU,1923 -click/parser.py,sha256=nU1Ah2p11q29ul1vNdU9swPo_PUuKrxU6YXToi71q1c,18979 -click/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -click/shell_completion.py,sha256=CQSGdjgun4ORbOZrXP0CVhEtPx4knsufOkRsDiK64cM,19857 -click/termui.py,sha256=vAYrKC2a7f_NfEIhAThEVYfa__ib5XQbTSCGtJlABRA,30847 -click/testing.py,sha256=2eLdAaCJCGToP5Tw-XN8JjrDb3wbJIfARxg3d0crW5M,18702 -click/types.py,sha256=KBTRxN28cR1VZ5mb9iJX98MQSw_p9SGzljqfEI8z5Tw,38389 -click/utils.py,sha256=b1Mm-usEDBHtEwcPltPIn3zSK4nw2KTp5GC7_oSTlLo,20245 diff --git a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/WHEEL deleted file mode 100644 index d8b9936..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.12.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/licenses/LICENSE.txt b/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/licenses/LICENSE.txt deleted file mode 100644 index d12a849..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click-8.2.1.dist-info/licenses/LICENSE.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2014 Pallets - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/write-message/venv/lib/python3.10/site-packages/click/__init__.py b/write-message/venv/lib/python3.10/site-packages/click/__init__.py deleted file mode 100644 index 1aa547c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/__init__.py +++ /dev/null @@ -1,123 +0,0 @@ -""" -Click is a simple Python module inspired by the stdlib optparse to make -writing command line scripts fun. Unlike other modules, it's based -around a simple API that does not come with too much magic and is -composable. -""" - -from __future__ import annotations - -from .core import Argument as Argument -from .core import Command as Command -from .core import CommandCollection as CommandCollection -from .core import Context as Context -from .core import Group as Group -from .core import Option as Option -from .core import Parameter as Parameter -from .decorators import argument as argument -from .decorators import command as command -from .decorators import confirmation_option as confirmation_option -from .decorators import group as group -from .decorators import help_option as help_option -from .decorators import make_pass_decorator as make_pass_decorator -from .decorators import option as option -from .decorators import pass_context as pass_context -from .decorators import pass_obj as pass_obj -from .decorators import password_option as password_option -from .decorators import version_option as version_option -from .exceptions import Abort as Abort -from .exceptions import BadArgumentUsage as BadArgumentUsage -from .exceptions import BadOptionUsage as BadOptionUsage -from .exceptions import BadParameter as BadParameter -from .exceptions import ClickException as ClickException -from .exceptions import FileError as FileError -from .exceptions import MissingParameter as MissingParameter -from .exceptions import NoSuchOption as NoSuchOption -from .exceptions import UsageError as UsageError -from .formatting import HelpFormatter as HelpFormatter -from .formatting import wrap_text as wrap_text -from .globals import get_current_context as get_current_context -from .termui import clear as clear -from .termui import confirm as confirm -from .termui import echo_via_pager as echo_via_pager -from .termui import edit as edit -from .termui import getchar as getchar -from .termui import launch as launch -from .termui import pause as pause -from .termui import progressbar as progressbar -from .termui import prompt as prompt -from .termui import secho as secho -from .termui import style as style -from .termui import unstyle as unstyle -from .types import BOOL as BOOL -from .types import Choice as Choice -from .types import DateTime as DateTime -from .types import File as File -from .types import FLOAT as FLOAT -from .types import FloatRange as FloatRange -from .types import INT as INT -from .types import IntRange as IntRange -from .types import ParamType as ParamType -from .types import Path as Path -from .types import STRING as STRING -from .types import Tuple as Tuple -from .types import UNPROCESSED as UNPROCESSED -from .types import UUID as UUID -from .utils import echo as echo -from .utils import format_filename as format_filename -from .utils import get_app_dir as get_app_dir -from .utils import get_binary_stream as get_binary_stream -from .utils import get_text_stream as get_text_stream -from .utils import open_file as open_file - - -def __getattr__(name: str) -> object: - import warnings - - if name == "BaseCommand": - from .core import _BaseCommand - - warnings.warn( - "'BaseCommand' is deprecated and will be removed in Click 9.0. Use" - " 'Command' instead.", - DeprecationWarning, - stacklevel=2, - ) - return _BaseCommand - - if name == "MultiCommand": - from .core import _MultiCommand - - warnings.warn( - "'MultiCommand' is deprecated and will be removed in Click 9.0. Use" - " 'Group' instead.", - DeprecationWarning, - stacklevel=2, - ) - return _MultiCommand - - if name == "OptionParser": - from .parser import _OptionParser - - warnings.warn( - "'OptionParser' is deprecated and will be removed in Click 9.0. The" - " old parser is available in 'optparse'.", - DeprecationWarning, - stacklevel=2, - ) - return _OptionParser - - if name == "__version__": - import importlib.metadata - import warnings - - warnings.warn( - "The '__version__' attribute is deprecated and will be removed in" - " Click 9.1. Use feature detection or" - " 'importlib.metadata.version(\"click\")' instead.", - DeprecationWarning, - stacklevel=2, - ) - return importlib.metadata.version("click") - - raise AttributeError(name) diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 4c22a02..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_compat.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_compat.cpython-310.pyc deleted file mode 100644 index dc6f4dd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_compat.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_termui_impl.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_termui_impl.cpython-310.pyc deleted file mode 100644 index 0b88d0d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_termui_impl.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_textwrap.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_textwrap.cpython-310.pyc deleted file mode 100644 index 828a253..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_textwrap.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_winconsole.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_winconsole.cpython-310.pyc deleted file mode 100644 index bb095ac..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/_winconsole.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/core.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/core.cpython-310.pyc deleted file mode 100644 index b69954f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/core.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/decorators.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/decorators.cpython-310.pyc deleted file mode 100644 index ee50efb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/decorators.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/exceptions.cpython-310.pyc deleted file mode 100644 index e974ff7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/formatting.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/formatting.cpython-310.pyc deleted file mode 100644 index 425965d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/formatting.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/globals.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/globals.cpython-310.pyc deleted file mode 100644 index 1d6b58b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/globals.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/parser.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/parser.cpython-310.pyc deleted file mode 100644 index 8ebfedc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/parser.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/shell_completion.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/shell_completion.cpython-310.pyc deleted file mode 100644 index 6421165..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/shell_completion.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/termui.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/termui.cpython-310.pyc deleted file mode 100644 index 6f5787f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/termui.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/testing.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/testing.cpython-310.pyc deleted file mode 100644 index 8f4ef2d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/testing.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/types.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/types.cpython-310.pyc deleted file mode 100644 index 22076ec..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/types.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/click/__pycache__/utils.cpython-310.pyc deleted file mode 100644 index 97968ac..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/click/__pycache__/utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/click/_compat.py b/write-message/venv/lib/python3.10/site-packages/click/_compat.py deleted file mode 100644 index f2726b9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/_compat.py +++ /dev/null @@ -1,622 +0,0 @@ -from __future__ import annotations - -import codecs -import collections.abc as cabc -import io -import os -import re -import sys -import typing as t -from types import TracebackType -from weakref import WeakKeyDictionary - -CYGWIN = sys.platform.startswith("cygwin") -WIN = sys.platform.startswith("win") -auto_wrap_for_ansi: t.Callable[[t.TextIO], t.TextIO] | None = None -_ansi_re = re.compile(r"\033\[[;?0-9]*[a-zA-Z]") - - -def _make_text_stream( - stream: t.BinaryIO, - encoding: str | None, - errors: str | None, - force_readable: bool = False, - force_writable: bool = False, -) -> t.TextIO: - if encoding is None: - encoding = get_best_encoding(stream) - if errors is None: - errors = "replace" - return _NonClosingTextIOWrapper( - stream, - encoding, - errors, - line_buffering=True, - force_readable=force_readable, - force_writable=force_writable, - ) - - -def is_ascii_encoding(encoding: str) -> bool: - """Checks if a given encoding is ascii.""" - try: - return codecs.lookup(encoding).name == "ascii" - except LookupError: - return False - - -def get_best_encoding(stream: t.IO[t.Any]) -> str: - """Returns the default stream encoding if not found.""" - rv = getattr(stream, "encoding", None) or sys.getdefaultencoding() - if is_ascii_encoding(rv): - return "utf-8" - return rv - - -class _NonClosingTextIOWrapper(io.TextIOWrapper): - def __init__( - self, - stream: t.BinaryIO, - encoding: str | None, - errors: str | None, - force_readable: bool = False, - force_writable: bool = False, - **extra: t.Any, - ) -> None: - self._stream = stream = t.cast( - t.BinaryIO, _FixupStream(stream, force_readable, force_writable) - ) - super().__init__(stream, encoding, errors, **extra) - - def __del__(self) -> None: - try: - self.detach() - except Exception: - pass - - def isatty(self) -> bool: - # https://bitbucket.org/pypy/pypy/issue/1803 - return self._stream.isatty() - - -class _FixupStream: - """The new io interface needs more from streams than streams - traditionally implement. As such, this fix-up code is necessary in - some circumstances. - - The forcing of readable and writable flags are there because some tools - put badly patched objects on sys (one such offender are certain version - of jupyter notebook). - """ - - def __init__( - self, - stream: t.BinaryIO, - force_readable: bool = False, - force_writable: bool = False, - ): - self._stream = stream - self._force_readable = force_readable - self._force_writable = force_writable - - def __getattr__(self, name: str) -> t.Any: - return getattr(self._stream, name) - - def read1(self, size: int) -> bytes: - f = getattr(self._stream, "read1", None) - - if f is not None: - return t.cast(bytes, f(size)) - - return self._stream.read(size) - - def readable(self) -> bool: - if self._force_readable: - return True - x = getattr(self._stream, "readable", None) - if x is not None: - return t.cast(bool, x()) - try: - self._stream.read(0) - except Exception: - return False - return True - - def writable(self) -> bool: - if self._force_writable: - return True - x = getattr(self._stream, "writable", None) - if x is not None: - return t.cast(bool, x()) - try: - self._stream.write(b"") - except Exception: - try: - self._stream.write(b"") - except Exception: - return False - return True - - def seekable(self) -> bool: - x = getattr(self._stream, "seekable", None) - if x is not None: - return t.cast(bool, x()) - try: - self._stream.seek(self._stream.tell()) - except Exception: - return False - return True - - -def _is_binary_reader(stream: t.IO[t.Any], default: bool = False) -> bool: - try: - return isinstance(stream.read(0), bytes) - except Exception: - return default - # This happens in some cases where the stream was already - # closed. In this case, we assume the default. - - -def _is_binary_writer(stream: t.IO[t.Any], default: bool = False) -> bool: - try: - stream.write(b"") - except Exception: - try: - stream.write("") - return False - except Exception: - pass - return default - return True - - -def _find_binary_reader(stream: t.IO[t.Any]) -> t.BinaryIO | None: - # We need to figure out if the given stream is already binary. - # This can happen because the official docs recommend detaching - # the streams to get binary streams. Some code might do this, so - # we need to deal with this case explicitly. - if _is_binary_reader(stream, False): - return t.cast(t.BinaryIO, stream) - - buf = getattr(stream, "buffer", None) - - # Same situation here; this time we assume that the buffer is - # actually binary in case it's closed. - if buf is not None and _is_binary_reader(buf, True): - return t.cast(t.BinaryIO, buf) - - return None - - -def _find_binary_writer(stream: t.IO[t.Any]) -> t.BinaryIO | None: - # We need to figure out if the given stream is already binary. - # This can happen because the official docs recommend detaching - # the streams to get binary streams. Some code might do this, so - # we need to deal with this case explicitly. - if _is_binary_writer(stream, False): - return t.cast(t.BinaryIO, stream) - - buf = getattr(stream, "buffer", None) - - # Same situation here; this time we assume that the buffer is - # actually binary in case it's closed. - if buf is not None and _is_binary_writer(buf, True): - return t.cast(t.BinaryIO, buf) - - return None - - -def _stream_is_misconfigured(stream: t.TextIO) -> bool: - """A stream is misconfigured if its encoding is ASCII.""" - # If the stream does not have an encoding set, we assume it's set - # to ASCII. This appears to happen in certain unittest - # environments. It's not quite clear what the correct behavior is - # but this at least will force Click to recover somehow. - return is_ascii_encoding(getattr(stream, "encoding", None) or "ascii") - - -def _is_compat_stream_attr(stream: t.TextIO, attr: str, value: str | None) -> bool: - """A stream attribute is compatible if it is equal to the - desired value or the desired value is unset and the attribute - has a value. - """ - stream_value = getattr(stream, attr, None) - return stream_value == value or (value is None and stream_value is not None) - - -def _is_compatible_text_stream( - stream: t.TextIO, encoding: str | None, errors: str | None -) -> bool: - """Check if a stream's encoding and errors attributes are - compatible with the desired values. - """ - return _is_compat_stream_attr( - stream, "encoding", encoding - ) and _is_compat_stream_attr(stream, "errors", errors) - - -def _force_correct_text_stream( - text_stream: t.IO[t.Any], - encoding: str | None, - errors: str | None, - is_binary: t.Callable[[t.IO[t.Any], bool], bool], - find_binary: t.Callable[[t.IO[t.Any]], t.BinaryIO | None], - force_readable: bool = False, - force_writable: bool = False, -) -> t.TextIO: - if is_binary(text_stream, False): - binary_reader = t.cast(t.BinaryIO, text_stream) - else: - text_stream = t.cast(t.TextIO, text_stream) - # If the stream looks compatible, and won't default to a - # misconfigured ascii encoding, return it as-is. - if _is_compatible_text_stream(text_stream, encoding, errors) and not ( - encoding is None and _stream_is_misconfigured(text_stream) - ): - return text_stream - - # Otherwise, get the underlying binary reader. - possible_binary_reader = find_binary(text_stream) - - # If that's not possible, silently use the original reader - # and get mojibake instead of exceptions. - if possible_binary_reader is None: - return text_stream - - binary_reader = possible_binary_reader - - # Default errors to replace instead of strict in order to get - # something that works. - if errors is None: - errors = "replace" - - # Wrap the binary stream in a text stream with the correct - # encoding parameters. - return _make_text_stream( - binary_reader, - encoding, - errors, - force_readable=force_readable, - force_writable=force_writable, - ) - - -def _force_correct_text_reader( - text_reader: t.IO[t.Any], - encoding: str | None, - errors: str | None, - force_readable: bool = False, -) -> t.TextIO: - return _force_correct_text_stream( - text_reader, - encoding, - errors, - _is_binary_reader, - _find_binary_reader, - force_readable=force_readable, - ) - - -def _force_correct_text_writer( - text_writer: t.IO[t.Any], - encoding: str | None, - errors: str | None, - force_writable: bool = False, -) -> t.TextIO: - return _force_correct_text_stream( - text_writer, - encoding, - errors, - _is_binary_writer, - _find_binary_writer, - force_writable=force_writable, - ) - - -def get_binary_stdin() -> t.BinaryIO: - reader = _find_binary_reader(sys.stdin) - if reader is None: - raise RuntimeError("Was not able to determine binary stream for sys.stdin.") - return reader - - -def get_binary_stdout() -> t.BinaryIO: - writer = _find_binary_writer(sys.stdout) - if writer is None: - raise RuntimeError("Was not able to determine binary stream for sys.stdout.") - return writer - - -def get_binary_stderr() -> t.BinaryIO: - writer = _find_binary_writer(sys.stderr) - if writer is None: - raise RuntimeError("Was not able to determine binary stream for sys.stderr.") - return writer - - -def get_text_stdin(encoding: str | None = None, errors: str | None = None) -> t.TextIO: - rv = _get_windows_console_stream(sys.stdin, encoding, errors) - if rv is not None: - return rv - return _force_correct_text_reader(sys.stdin, encoding, errors, force_readable=True) - - -def get_text_stdout(encoding: str | None = None, errors: str | None = None) -> t.TextIO: - rv = _get_windows_console_stream(sys.stdout, encoding, errors) - if rv is not None: - return rv - return _force_correct_text_writer(sys.stdout, encoding, errors, force_writable=True) - - -def get_text_stderr(encoding: str | None = None, errors: str | None = None) -> t.TextIO: - rv = _get_windows_console_stream(sys.stderr, encoding, errors) - if rv is not None: - return rv - return _force_correct_text_writer(sys.stderr, encoding, errors, force_writable=True) - - -def _wrap_io_open( - file: str | os.PathLike[str] | int, - mode: str, - encoding: str | None, - errors: str | None, -) -> t.IO[t.Any]: - """Handles not passing ``encoding`` and ``errors`` in binary mode.""" - if "b" in mode: - return open(file, mode) - - return open(file, mode, encoding=encoding, errors=errors) - - -def open_stream( - filename: str | os.PathLike[str], - mode: str = "r", - encoding: str | None = None, - errors: str | None = "strict", - atomic: bool = False, -) -> tuple[t.IO[t.Any], bool]: - binary = "b" in mode - filename = os.fspath(filename) - - # Standard streams first. These are simple because they ignore the - # atomic flag. Use fsdecode to handle Path("-"). - if os.fsdecode(filename) == "-": - if any(m in mode for m in ["w", "a", "x"]): - if binary: - return get_binary_stdout(), False - return get_text_stdout(encoding=encoding, errors=errors), False - if binary: - return get_binary_stdin(), False - return get_text_stdin(encoding=encoding, errors=errors), False - - # Non-atomic writes directly go out through the regular open functions. - if not atomic: - return _wrap_io_open(filename, mode, encoding, errors), True - - # Some usability stuff for atomic writes - if "a" in mode: - raise ValueError( - "Appending to an existing file is not supported, because that" - " would involve an expensive `copy`-operation to a temporary" - " file. Open the file in normal `w`-mode and copy explicitly" - " if that's what you're after." - ) - if "x" in mode: - raise ValueError("Use the `overwrite`-parameter instead.") - if "w" not in mode: - raise ValueError("Atomic writes only make sense with `w`-mode.") - - # Atomic writes are more complicated. They work by opening a file - # as a proxy in the same folder and then using the fdopen - # functionality to wrap it in a Python file. Then we wrap it in an - # atomic file that moves the file over on close. - import errno - import random - - try: - perm: int | None = os.stat(filename).st_mode - except OSError: - perm = None - - flags = os.O_RDWR | os.O_CREAT | os.O_EXCL - - if binary: - flags |= getattr(os, "O_BINARY", 0) - - while True: - tmp_filename = os.path.join( - os.path.dirname(filename), - f".__atomic-write{random.randrange(1 << 32):08x}", - ) - try: - fd = os.open(tmp_filename, flags, 0o666 if perm is None else perm) - break - except OSError as e: - if e.errno == errno.EEXIST or ( - os.name == "nt" - and e.errno == errno.EACCES - and os.path.isdir(e.filename) - and os.access(e.filename, os.W_OK) - ): - continue - raise - - if perm is not None: - os.chmod(tmp_filename, perm) # in case perm includes bits in umask - - f = _wrap_io_open(fd, mode, encoding, errors) - af = _AtomicFile(f, tmp_filename, os.path.realpath(filename)) - return t.cast(t.IO[t.Any], af), True - - -class _AtomicFile: - def __init__(self, f: t.IO[t.Any], tmp_filename: str, real_filename: str) -> None: - self._f = f - self._tmp_filename = tmp_filename - self._real_filename = real_filename - self.closed = False - - @property - def name(self) -> str: - return self._real_filename - - def close(self, delete: bool = False) -> None: - if self.closed: - return - self._f.close() - os.replace(self._tmp_filename, self._real_filename) - self.closed = True - - def __getattr__(self, name: str) -> t.Any: - return getattr(self._f, name) - - def __enter__(self) -> _AtomicFile: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - tb: TracebackType | None, - ) -> None: - self.close(delete=exc_type is not None) - - def __repr__(self) -> str: - return repr(self._f) - - -def strip_ansi(value: str) -> str: - return _ansi_re.sub("", value) - - -def _is_jupyter_kernel_output(stream: t.IO[t.Any]) -> bool: - while isinstance(stream, (_FixupStream, _NonClosingTextIOWrapper)): - stream = stream._stream - - return stream.__class__.__module__.startswith("ipykernel.") - - -def should_strip_ansi( - stream: t.IO[t.Any] | None = None, color: bool | None = None -) -> bool: - if color is None: - if stream is None: - stream = sys.stdin - return not isatty(stream) and not _is_jupyter_kernel_output(stream) - return not color - - -# On Windows, wrap the output streams with colorama to support ANSI -# color codes. -# NOTE: double check is needed so mypy does not analyze this on Linux -if sys.platform.startswith("win") and WIN: - from ._winconsole import _get_windows_console_stream - - def _get_argv_encoding() -> str: - import locale - - return locale.getpreferredencoding() - - _ansi_stream_wrappers: cabc.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary() - - def auto_wrap_for_ansi(stream: t.TextIO, color: bool | None = None) -> t.TextIO: - """Support ANSI color and style codes on Windows by wrapping a - stream with colorama. - """ - try: - cached = _ansi_stream_wrappers.get(stream) - except Exception: - cached = None - - if cached is not None: - return cached - - import colorama - - strip = should_strip_ansi(stream, color) - ansi_wrapper = colorama.AnsiToWin32(stream, strip=strip) - rv = t.cast(t.TextIO, ansi_wrapper.stream) - _write = rv.write - - def _safe_write(s: str) -> int: - try: - return _write(s) - except BaseException: - ansi_wrapper.reset_all() - raise - - rv.write = _safe_write # type: ignore[method-assign] - - try: - _ansi_stream_wrappers[stream] = rv - except Exception: - pass - - return rv - -else: - - def _get_argv_encoding() -> str: - return getattr(sys.stdin, "encoding", None) or sys.getfilesystemencoding() - - def _get_windows_console_stream( - f: t.TextIO, encoding: str | None, errors: str | None - ) -> t.TextIO | None: - return None - - -def term_len(x: str) -> int: - return len(strip_ansi(x)) - - -def isatty(stream: t.IO[t.Any]) -> bool: - try: - return stream.isatty() - except Exception: - return False - - -def _make_cached_stream_func( - src_func: t.Callable[[], t.TextIO | None], - wrapper_func: t.Callable[[], t.TextIO], -) -> t.Callable[[], t.TextIO | None]: - cache: cabc.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary() - - def func() -> t.TextIO | None: - stream = src_func() - - if stream is None: - return None - - try: - rv = cache.get(stream) - except Exception: - rv = None - if rv is not None: - return rv - rv = wrapper_func() - try: - cache[stream] = rv - except Exception: - pass - return rv - - return func - - -_default_text_stdin = _make_cached_stream_func(lambda: sys.stdin, get_text_stdin) -_default_text_stdout = _make_cached_stream_func(lambda: sys.stdout, get_text_stdout) -_default_text_stderr = _make_cached_stream_func(lambda: sys.stderr, get_text_stderr) - - -binary_streams: cabc.Mapping[str, t.Callable[[], t.BinaryIO]] = { - "stdin": get_binary_stdin, - "stdout": get_binary_stdout, - "stderr": get_binary_stderr, -} - -text_streams: cabc.Mapping[str, t.Callable[[str | None, str | None], t.TextIO]] = { - "stdin": get_text_stdin, - "stdout": get_text_stdout, - "stderr": get_text_stderr, -} diff --git a/write-message/venv/lib/python3.10/site-packages/click/_termui_impl.py b/write-message/venv/lib/python3.10/site-packages/click/_termui_impl.py deleted file mode 100644 index 51fd9bf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/_termui_impl.py +++ /dev/null @@ -1,839 +0,0 @@ -""" -This module contains implementations for the termui module. To keep the -import time of Click down, some infrequently used functionality is -placed in this module and only imported as needed. -""" - -from __future__ import annotations - -import collections.abc as cabc -import contextlib -import math -import os -import shlex -import sys -import time -import typing as t -from gettext import gettext as _ -from io import StringIO -from pathlib import Path -from shutil import which -from types import TracebackType - -from ._compat import _default_text_stdout -from ._compat import CYGWIN -from ._compat import get_best_encoding -from ._compat import isatty -from ._compat import open_stream -from ._compat import strip_ansi -from ._compat import term_len -from ._compat import WIN -from .exceptions import ClickException -from .utils import echo - -V = t.TypeVar("V") - -if os.name == "nt": - BEFORE_BAR = "\r" - AFTER_BAR = "\n" -else: - BEFORE_BAR = "\r\033[?25l" - AFTER_BAR = "\033[?25h\n" - - -class ProgressBar(t.Generic[V]): - def __init__( - self, - iterable: cabc.Iterable[V] | None, - length: int | None = None, - fill_char: str = "#", - empty_char: str = " ", - bar_template: str = "%(bar)s", - info_sep: str = " ", - hidden: bool = False, - show_eta: bool = True, - show_percent: bool | None = None, - show_pos: bool = False, - item_show_func: t.Callable[[V | None], str | None] | None = None, - label: str | None = None, - file: t.TextIO | None = None, - color: bool | None = None, - update_min_steps: int = 1, - width: int = 30, - ) -> None: - self.fill_char = fill_char - self.empty_char = empty_char - self.bar_template = bar_template - self.info_sep = info_sep - self.hidden = hidden - self.show_eta = show_eta - self.show_percent = show_percent - self.show_pos = show_pos - self.item_show_func = item_show_func - self.label: str = label or "" - - if file is None: - file = _default_text_stdout() - - # There are no standard streams attached to write to. For example, - # pythonw on Windows. - if file is None: - file = StringIO() - - self.file = file - self.color = color - self.update_min_steps = update_min_steps - self._completed_intervals = 0 - self.width: int = width - self.autowidth: bool = width == 0 - - if length is None: - from operator import length_hint - - length = length_hint(iterable, -1) - - if length == -1: - length = None - if iterable is None: - if length is None: - raise TypeError("iterable or length is required") - iterable = t.cast("cabc.Iterable[V]", range(length)) - self.iter: cabc.Iterable[V] = iter(iterable) - self.length = length - self.pos: int = 0 - self.avg: list[float] = [] - self.last_eta: float - self.start: float - self.start = self.last_eta = time.time() - self.eta_known: bool = False - self.finished: bool = False - self.max_width: int | None = None - self.entered: bool = False - self.current_item: V | None = None - self._is_atty = isatty(self.file) - self._last_line: str | None = None - - def __enter__(self) -> ProgressBar[V]: - self.entered = True - self.render_progress() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - tb: TracebackType | None, - ) -> None: - self.render_finish() - - def __iter__(self) -> cabc.Iterator[V]: - if not self.entered: - raise RuntimeError("You need to use progress bars in a with block.") - self.render_progress() - return self.generator() - - def __next__(self) -> V: - # Iteration is defined in terms of a generator function, - # returned by iter(self); use that to define next(). This works - # because `self.iter` is an iterable consumed by that generator, - # so it is re-entry safe. Calling `next(self.generator())` - # twice works and does "what you want". - return next(iter(self)) - - def render_finish(self) -> None: - if self.hidden or not self._is_atty: - return - self.file.write(AFTER_BAR) - self.file.flush() - - @property - def pct(self) -> float: - if self.finished: - return 1.0 - return min(self.pos / (float(self.length or 1) or 1), 1.0) - - @property - def time_per_iteration(self) -> float: - if not self.avg: - return 0.0 - return sum(self.avg) / float(len(self.avg)) - - @property - def eta(self) -> float: - if self.length is not None and not self.finished: - return self.time_per_iteration * (self.length - self.pos) - return 0.0 - - def format_eta(self) -> str: - if self.eta_known: - t = int(self.eta) - seconds = t % 60 - t //= 60 - minutes = t % 60 - t //= 60 - hours = t % 24 - t //= 24 - if t > 0: - return f"{t}d {hours:02}:{minutes:02}:{seconds:02}" - else: - return f"{hours:02}:{minutes:02}:{seconds:02}" - return "" - - def format_pos(self) -> str: - pos = str(self.pos) - if self.length is not None: - pos += f"/{self.length}" - return pos - - def format_pct(self) -> str: - return f"{int(self.pct * 100): 4}%"[1:] - - def format_bar(self) -> str: - if self.length is not None: - bar_length = int(self.pct * self.width) - bar = self.fill_char * bar_length - bar += self.empty_char * (self.width - bar_length) - elif self.finished: - bar = self.fill_char * self.width - else: - chars = list(self.empty_char * (self.width or 1)) - if self.time_per_iteration != 0: - chars[ - int( - (math.cos(self.pos * self.time_per_iteration) / 2.0 + 0.5) - * self.width - ) - ] = self.fill_char - bar = "".join(chars) - return bar - - def format_progress_line(self) -> str: - show_percent = self.show_percent - - info_bits = [] - if self.length is not None and show_percent is None: - show_percent = not self.show_pos - - if self.show_pos: - info_bits.append(self.format_pos()) - if show_percent: - info_bits.append(self.format_pct()) - if self.show_eta and self.eta_known and not self.finished: - info_bits.append(self.format_eta()) - if self.item_show_func is not None: - item_info = self.item_show_func(self.current_item) - if item_info is not None: - info_bits.append(item_info) - - return ( - self.bar_template - % { - "label": self.label, - "bar": self.format_bar(), - "info": self.info_sep.join(info_bits), - } - ).rstrip() - - def render_progress(self) -> None: - import shutil - - if self.hidden: - return - - if not self._is_atty: - # Only output the label once if the output is not a TTY. - if self._last_line != self.label: - self._last_line = self.label - echo(self.label, file=self.file, color=self.color) - return - - buf = [] - # Update width in case the terminal has been resized - if self.autowidth: - old_width = self.width - self.width = 0 - clutter_length = term_len(self.format_progress_line()) - new_width = max(0, shutil.get_terminal_size().columns - clutter_length) - if new_width < old_width and self.max_width is not None: - buf.append(BEFORE_BAR) - buf.append(" " * self.max_width) - self.max_width = new_width - self.width = new_width - - clear_width = self.width - if self.max_width is not None: - clear_width = self.max_width - - buf.append(BEFORE_BAR) - line = self.format_progress_line() - line_len = term_len(line) - if self.max_width is None or self.max_width < line_len: - self.max_width = line_len - - buf.append(line) - buf.append(" " * (clear_width - line_len)) - line = "".join(buf) - # Render the line only if it changed. - - if line != self._last_line: - self._last_line = line - echo(line, file=self.file, color=self.color, nl=False) - self.file.flush() - - def make_step(self, n_steps: int) -> None: - self.pos += n_steps - if self.length is not None and self.pos >= self.length: - self.finished = True - - if (time.time() - self.last_eta) < 1.0: - return - - self.last_eta = time.time() - - # self.avg is a rolling list of length <= 7 of steps where steps are - # defined as time elapsed divided by the total progress through - # self.length. - if self.pos: - step = (time.time() - self.start) / self.pos - else: - step = time.time() - self.start - - self.avg = self.avg[-6:] + [step] - - self.eta_known = self.length is not None - - def update(self, n_steps: int, current_item: V | None = None) -> None: - """Update the progress bar by advancing a specified number of - steps, and optionally set the ``current_item`` for this new - position. - - :param n_steps: Number of steps to advance. - :param current_item: Optional item to set as ``current_item`` - for the updated position. - - .. versionchanged:: 8.0 - Added the ``current_item`` optional parameter. - - .. versionchanged:: 8.0 - Only render when the number of steps meets the - ``update_min_steps`` threshold. - """ - if current_item is not None: - self.current_item = current_item - - self._completed_intervals += n_steps - - if self._completed_intervals >= self.update_min_steps: - self.make_step(self._completed_intervals) - self.render_progress() - self._completed_intervals = 0 - - def finish(self) -> None: - self.eta_known = False - self.current_item = None - self.finished = True - - def generator(self) -> cabc.Iterator[V]: - """Return a generator which yields the items added to the bar - during construction, and updates the progress bar *after* the - yielded block returns. - """ - # WARNING: the iterator interface for `ProgressBar` relies on - # this and only works because this is a simple generator which - # doesn't create or manage additional state. If this function - # changes, the impact should be evaluated both against - # `iter(bar)` and `next(bar)`. `next()` in particular may call - # `self.generator()` repeatedly, and this must remain safe in - # order for that interface to work. - if not self.entered: - raise RuntimeError("You need to use progress bars in a with block.") - - if not self._is_atty: - yield from self.iter - else: - for rv in self.iter: - self.current_item = rv - - # This allows show_item_func to be updated before the - # item is processed. Only trigger at the beginning of - # the update interval. - if self._completed_intervals == 0: - self.render_progress() - - yield rv - self.update(1) - - self.finish() - self.render_progress() - - -def pager(generator: cabc.Iterable[str], color: bool | None = None) -> None: - """Decide what method to use for paging through text.""" - stdout = _default_text_stdout() - - # There are no standard streams attached to write to. For example, - # pythonw on Windows. - if stdout is None: - stdout = StringIO() - - if not isatty(sys.stdin) or not isatty(stdout): - return _nullpager(stdout, generator, color) - - # Split and normalize the pager command into parts. - pager_cmd_parts = shlex.split(os.environ.get("PAGER", ""), posix=False) - if pager_cmd_parts: - if WIN: - if _tempfilepager(generator, pager_cmd_parts, color): - return - elif _pipepager(generator, pager_cmd_parts, color): - return - - if os.environ.get("TERM") in ("dumb", "emacs"): - return _nullpager(stdout, generator, color) - if (WIN or sys.platform.startswith("os2")) and _tempfilepager( - generator, ["more"], color - ): - return - if _pipepager(generator, ["less"], color): - return - - import tempfile - - fd, filename = tempfile.mkstemp() - os.close(fd) - try: - if _pipepager(generator, ["more"], color): - return - return _nullpager(stdout, generator, color) - finally: - os.unlink(filename) - - -def _pipepager( - generator: cabc.Iterable[str], cmd_parts: list[str], color: bool | None -) -> bool: - """Page through text by feeding it to another program. Invoking a - pager through this might support colors. - - Returns `True` if the command was found, `False` otherwise and thus another - pager should be attempted. - """ - # Split the command into the invoked CLI and its parameters. - if not cmd_parts: - return False - cmd = cmd_parts[0] - cmd_params = cmd_parts[1:] - - cmd_filepath = which(cmd) - if not cmd_filepath: - return False - # Resolves symlinks and produces a normalized absolute path string. - cmd_path = Path(cmd_filepath).resolve() - cmd_name = cmd_path.name - - import subprocess - - # Make a local copy of the environment to not affect the global one. - env = dict(os.environ) - - # If we're piping to less and the user hasn't decided on colors, we enable - # them by default we find the -R flag in the command line arguments. - if color is None and cmd_name == "less": - less_flags = f"{os.environ.get('LESS', '')}{' '.join(cmd_params)}" - if not less_flags: - env["LESS"] = "-R" - color = True - elif "r" in less_flags or "R" in less_flags: - color = True - - c = subprocess.Popen( - [str(cmd_path)] + cmd_params, - shell=True, - stdin=subprocess.PIPE, - env=env, - errors="replace", - text=True, - ) - assert c.stdin is not None - try: - for text in generator: - if not color: - text = strip_ansi(text) - - c.stdin.write(text) - except BrokenPipeError: - # In case the pager exited unexpectedly, ignore the broken pipe error. - pass - except Exception as e: - # In case there is an exception we want to close the pager immediately - # and let the caller handle it. - # Otherwise the pager will keep running, and the user may not notice - # the error message, or worse yet it may leave the terminal in a broken state. - c.terminate() - raise e - finally: - # We must close stdin and wait for the pager to exit before we continue - try: - c.stdin.close() - # Close implies flush, so it might throw a BrokenPipeError if the pager - # process exited already. - except BrokenPipeError: - pass - - # Less doesn't respect ^C, but catches it for its own UI purposes (aborting - # search or other commands inside less). - # - # That means when the user hits ^C, the parent process (click) terminates, - # but less is still alive, paging the output and messing up the terminal. - # - # If the user wants to make the pager exit on ^C, they should set - # `LESS='-K'`. It's not our decision to make. - while True: - try: - c.wait() - except KeyboardInterrupt: - pass - else: - break - - return True - - -def _tempfilepager( - generator: cabc.Iterable[str], cmd_parts: list[str], color: bool | None -) -> bool: - """Page through text by invoking a program on a temporary file. - - Returns `True` if the command was found, `False` otherwise and thus another - pager should be attempted. - """ - # Split the command into the invoked CLI and its parameters. - if not cmd_parts: - return False - cmd = cmd_parts[0] - - cmd_filepath = which(cmd) - if not cmd_filepath: - return False - # Resolves symlinks and produces a normalized absolute path string. - cmd_path = Path(cmd_filepath).resolve() - - import subprocess - import tempfile - - fd, filename = tempfile.mkstemp() - # TODO: This never terminates if the passed generator never terminates. - text = "".join(generator) - if not color: - text = strip_ansi(text) - encoding = get_best_encoding(sys.stdout) - with open_stream(filename, "wb")[0] as f: - f.write(text.encode(encoding)) - try: - subprocess.call([str(cmd_path), filename]) - except OSError: - # Command not found - pass - finally: - os.close(fd) - os.unlink(filename) - - return True - - -def _nullpager( - stream: t.TextIO, generator: cabc.Iterable[str], color: bool | None -) -> None: - """Simply print unformatted text. This is the ultimate fallback.""" - for text in generator: - if not color: - text = strip_ansi(text) - stream.write(text) - - -class Editor: - def __init__( - self, - editor: str | None = None, - env: cabc.Mapping[str, str] | None = None, - require_save: bool = True, - extension: str = ".txt", - ) -> None: - self.editor = editor - self.env = env - self.require_save = require_save - self.extension = extension - - def get_editor(self) -> str: - if self.editor is not None: - return self.editor - for key in "VISUAL", "EDITOR": - rv = os.environ.get(key) - if rv: - return rv - if WIN: - return "notepad" - for editor in "sensible-editor", "vim", "nano": - if which(editor) is not None: - return editor - return "vi" - - def edit_files(self, filenames: cabc.Iterable[str]) -> None: - import subprocess - - editor = self.get_editor() - environ: dict[str, str] | None = None - - if self.env: - environ = os.environ.copy() - environ.update(self.env) - - exc_filename = " ".join(f'"{filename}"' for filename in filenames) - - try: - c = subprocess.Popen( - args=f"{editor} {exc_filename}", env=environ, shell=True - ) - exit_code = c.wait() - if exit_code != 0: - raise ClickException( - _("{editor}: Editing failed").format(editor=editor) - ) - except OSError as e: - raise ClickException( - _("{editor}: Editing failed: {e}").format(editor=editor, e=e) - ) from e - - @t.overload - def edit(self, text: bytes | bytearray) -> bytes | None: ... - - # We cannot know whether or not the type expected is str or bytes when None - # is passed, so str is returned as that was what was done before. - @t.overload - def edit(self, text: str | None) -> str | None: ... - - def edit(self, text: str | bytes | bytearray | None) -> str | bytes | None: - import tempfile - - if text is None: - data = b"" - elif isinstance(text, (bytes, bytearray)): - data = text - else: - if text and not text.endswith("\n"): - text += "\n" - - if WIN: - data = text.replace("\n", "\r\n").encode("utf-8-sig") - else: - data = text.encode("utf-8") - - fd, name = tempfile.mkstemp(prefix="editor-", suffix=self.extension) - f: t.BinaryIO - - try: - with os.fdopen(fd, "wb") as f: - f.write(data) - - # If the filesystem resolution is 1 second, like Mac OS - # 10.12 Extended, or 2 seconds, like FAT32, and the editor - # closes very fast, require_save can fail. Set the modified - # time to be 2 seconds in the past to work around this. - os.utime(name, (os.path.getatime(name), os.path.getmtime(name) - 2)) - # Depending on the resolution, the exact value might not be - # recorded, so get the new recorded value. - timestamp = os.path.getmtime(name) - - self.edit_files((name,)) - - if self.require_save and os.path.getmtime(name) == timestamp: - return None - - with open(name, "rb") as f: - rv = f.read() - - if isinstance(text, (bytes, bytearray)): - return rv - - return rv.decode("utf-8-sig").replace("\r\n", "\n") - finally: - os.unlink(name) - - -def open_url(url: str, wait: bool = False, locate: bool = False) -> int: - import subprocess - - def _unquote_file(url: str) -> str: - from urllib.parse import unquote - - if url.startswith("file://"): - url = unquote(url[7:]) - - return url - - if sys.platform == "darwin": - args = ["open"] - if wait: - args.append("-W") - if locate: - args.append("-R") - args.append(_unquote_file(url)) - null = open("/dev/null", "w") - try: - return subprocess.Popen(args, stderr=null).wait() - finally: - null.close() - elif WIN: - if locate: - url = _unquote_file(url) - args = ["explorer", f"/select,{url}"] - else: - args = ["start"] - if wait: - args.append("/WAIT") - args.append("") - args.append(url) - try: - return subprocess.call(args) - except OSError: - # Command not found - return 127 - elif CYGWIN: - if locate: - url = _unquote_file(url) - args = ["cygstart", os.path.dirname(url)] - else: - args = ["cygstart"] - if wait: - args.append("-w") - args.append(url) - try: - return subprocess.call(args) - except OSError: - # Command not found - return 127 - - try: - if locate: - url = os.path.dirname(_unquote_file(url)) or "." - else: - url = _unquote_file(url) - c = subprocess.Popen(["xdg-open", url]) - if wait: - return c.wait() - return 0 - except OSError: - if url.startswith(("http://", "https://")) and not locate and not wait: - import webbrowser - - webbrowser.open(url) - return 0 - return 1 - - -def _translate_ch_to_exc(ch: str) -> None: - if ch == "\x03": - raise KeyboardInterrupt() - - if ch == "\x04" and not WIN: # Unix-like, Ctrl+D - raise EOFError() - - if ch == "\x1a" and WIN: # Windows, Ctrl+Z - raise EOFError() - - return None - - -if sys.platform == "win32": - import msvcrt - - @contextlib.contextmanager - def raw_terminal() -> cabc.Iterator[int]: - yield -1 - - def getchar(echo: bool) -> str: - # The function `getch` will return a bytes object corresponding to - # the pressed character. Since Windows 10 build 1803, it will also - # return \x00 when called a second time after pressing a regular key. - # - # `getwch` does not share this probably-bugged behavior. Moreover, it - # returns a Unicode object by default, which is what we want. - # - # Either of these functions will return \x00 or \xe0 to indicate - # a special key, and you need to call the same function again to get - # the "rest" of the code. The fun part is that \u00e0 is - # "latin small letter a with grave", so if you type that on a French - # keyboard, you _also_ get a \xe0. - # E.g., consider the Up arrow. This returns \xe0 and then \x48. The - # resulting Unicode string reads as "a with grave" + "capital H". - # This is indistinguishable from when the user actually types - # "a with grave" and then "capital H". - # - # When \xe0 is returned, we assume it's part of a special-key sequence - # and call `getwch` again, but that means that when the user types - # the \u00e0 character, `getchar` doesn't return until a second - # character is typed. - # The alternative is returning immediately, but that would mess up - # cross-platform handling of arrow keys and others that start with - # \xe0. Another option is using `getch`, but then we can't reliably - # read non-ASCII characters, because return values of `getch` are - # limited to the current 8-bit codepage. - # - # Anyway, Click doesn't claim to do this Right(tm), and using `getwch` - # is doing the right thing in more situations than with `getch`. - - if echo: - func = t.cast(t.Callable[[], str], msvcrt.getwche) - else: - func = t.cast(t.Callable[[], str], msvcrt.getwch) - - rv = func() - - if rv in ("\x00", "\xe0"): - # \x00 and \xe0 are control characters that indicate special key, - # see above. - rv += func() - - _translate_ch_to_exc(rv) - return rv - -else: - import termios - import tty - - @contextlib.contextmanager - def raw_terminal() -> cabc.Iterator[int]: - f: t.TextIO | None - fd: int - - if not isatty(sys.stdin): - f = open("/dev/tty") - fd = f.fileno() - else: - fd = sys.stdin.fileno() - f = None - - try: - old_settings = termios.tcgetattr(fd) - - try: - tty.setraw(fd) - yield fd - finally: - termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) - sys.stdout.flush() - - if f is not None: - f.close() - except termios.error: - pass - - def getchar(echo: bool) -> str: - with raw_terminal() as fd: - ch = os.read(fd, 32).decode(get_best_encoding(sys.stdin), "replace") - - if echo and isatty(sys.stdout): - sys.stdout.write(ch) - - _translate_ch_to_exc(ch) - return ch diff --git a/write-message/venv/lib/python3.10/site-packages/click/_textwrap.py b/write-message/venv/lib/python3.10/site-packages/click/_textwrap.py deleted file mode 100644 index 97fbee3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/_textwrap.py +++ /dev/null @@ -1,51 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import textwrap -from contextlib import contextmanager - - -class TextWrapper(textwrap.TextWrapper): - def _handle_long_word( - self, - reversed_chunks: list[str], - cur_line: list[str], - cur_len: int, - width: int, - ) -> None: - space_left = max(width - cur_len, 1) - - if self.break_long_words: - last = reversed_chunks[-1] - cut = last[:space_left] - res = last[space_left:] - cur_line.append(cut) - reversed_chunks[-1] = res - elif not cur_line: - cur_line.append(reversed_chunks.pop()) - - @contextmanager - def extra_indent(self, indent: str) -> cabc.Iterator[None]: - old_initial_indent = self.initial_indent - old_subsequent_indent = self.subsequent_indent - self.initial_indent += indent - self.subsequent_indent += indent - - try: - yield - finally: - self.initial_indent = old_initial_indent - self.subsequent_indent = old_subsequent_indent - - def indent_only(self, text: str) -> str: - rv = [] - - for idx, line in enumerate(text.splitlines()): - indent = self.initial_indent - - if idx > 0: - indent = self.subsequent_indent - - rv.append(f"{indent}{line}") - - return "\n".join(rv) diff --git a/write-message/venv/lib/python3.10/site-packages/click/_winconsole.py b/write-message/venv/lib/python3.10/site-packages/click/_winconsole.py deleted file mode 100644 index e56c7c6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/_winconsole.py +++ /dev/null @@ -1,296 +0,0 @@ -# This module is based on the excellent work by Adam Bartoš who -# provided a lot of what went into the implementation here in -# the discussion to issue1602 in the Python bug tracker. -# -# There are some general differences in regards to how this works -# compared to the original patches as we do not need to patch -# the entire interpreter but just work in our little world of -# echo and prompt. -from __future__ import annotations - -import collections.abc as cabc -import io -import sys -import time -import typing as t -from ctypes import Array -from ctypes import byref -from ctypes import c_char -from ctypes import c_char_p -from ctypes import c_int -from ctypes import c_ssize_t -from ctypes import c_ulong -from ctypes import c_void_p -from ctypes import POINTER -from ctypes import py_object -from ctypes import Structure -from ctypes.wintypes import DWORD -from ctypes.wintypes import HANDLE -from ctypes.wintypes import LPCWSTR -from ctypes.wintypes import LPWSTR - -from ._compat import _NonClosingTextIOWrapper - -assert sys.platform == "win32" -import msvcrt # noqa: E402 -from ctypes import windll # noqa: E402 -from ctypes import WINFUNCTYPE # noqa: E402 - -c_ssize_p = POINTER(c_ssize_t) - -kernel32 = windll.kernel32 -GetStdHandle = kernel32.GetStdHandle -ReadConsoleW = kernel32.ReadConsoleW -WriteConsoleW = kernel32.WriteConsoleW -GetConsoleMode = kernel32.GetConsoleMode -GetLastError = kernel32.GetLastError -GetCommandLineW = WINFUNCTYPE(LPWSTR)(("GetCommandLineW", windll.kernel32)) -CommandLineToArgvW = WINFUNCTYPE(POINTER(LPWSTR), LPCWSTR, POINTER(c_int))( - ("CommandLineToArgvW", windll.shell32) -) -LocalFree = WINFUNCTYPE(c_void_p, c_void_p)(("LocalFree", windll.kernel32)) - -STDIN_HANDLE = GetStdHandle(-10) -STDOUT_HANDLE = GetStdHandle(-11) -STDERR_HANDLE = GetStdHandle(-12) - -PyBUF_SIMPLE = 0 -PyBUF_WRITABLE = 1 - -ERROR_SUCCESS = 0 -ERROR_NOT_ENOUGH_MEMORY = 8 -ERROR_OPERATION_ABORTED = 995 - -STDIN_FILENO = 0 -STDOUT_FILENO = 1 -STDERR_FILENO = 2 - -EOF = b"\x1a" -MAX_BYTES_WRITTEN = 32767 - -if t.TYPE_CHECKING: - try: - # Using `typing_extensions.Buffer` instead of `collections.abc` - # on Windows for some reason does not have `Sized` implemented. - from collections.abc import Buffer # type: ignore - except ImportError: - from typing_extensions import Buffer - -try: - from ctypes import pythonapi -except ImportError: - # On PyPy we cannot get buffers so our ability to operate here is - # severely limited. - get_buffer = None -else: - - class Py_buffer(Structure): - _fields_ = [ # noqa: RUF012 - ("buf", c_void_p), - ("obj", py_object), - ("len", c_ssize_t), - ("itemsize", c_ssize_t), - ("readonly", c_int), - ("ndim", c_int), - ("format", c_char_p), - ("shape", c_ssize_p), - ("strides", c_ssize_p), - ("suboffsets", c_ssize_p), - ("internal", c_void_p), - ] - - PyObject_GetBuffer = pythonapi.PyObject_GetBuffer - PyBuffer_Release = pythonapi.PyBuffer_Release - - def get_buffer(obj: Buffer, writable: bool = False) -> Array[c_char]: - buf = Py_buffer() - flags: int = PyBUF_WRITABLE if writable else PyBUF_SIMPLE - PyObject_GetBuffer(py_object(obj), byref(buf), flags) - - try: - buffer_type = c_char * buf.len - out: Array[c_char] = buffer_type.from_address(buf.buf) - return out - finally: - PyBuffer_Release(byref(buf)) - - -class _WindowsConsoleRawIOBase(io.RawIOBase): - def __init__(self, handle: int | None) -> None: - self.handle = handle - - def isatty(self) -> t.Literal[True]: - super().isatty() - return True - - -class _WindowsConsoleReader(_WindowsConsoleRawIOBase): - def readable(self) -> t.Literal[True]: - return True - - def readinto(self, b: Buffer) -> int: - bytes_to_be_read = len(b) - if not bytes_to_be_read: - return 0 - elif bytes_to_be_read % 2: - raise ValueError( - "cannot read odd number of bytes from UTF-16-LE encoded console" - ) - - buffer = get_buffer(b, writable=True) - code_units_to_be_read = bytes_to_be_read // 2 - code_units_read = c_ulong() - - rv = ReadConsoleW( - HANDLE(self.handle), - buffer, - code_units_to_be_read, - byref(code_units_read), - None, - ) - if GetLastError() == ERROR_OPERATION_ABORTED: - # wait for KeyboardInterrupt - time.sleep(0.1) - if not rv: - raise OSError(f"Windows error: {GetLastError()}") - - if buffer[0] == EOF: - return 0 - return 2 * code_units_read.value - - -class _WindowsConsoleWriter(_WindowsConsoleRawIOBase): - def writable(self) -> t.Literal[True]: - return True - - @staticmethod - def _get_error_message(errno: int) -> str: - if errno == ERROR_SUCCESS: - return "ERROR_SUCCESS" - elif errno == ERROR_NOT_ENOUGH_MEMORY: - return "ERROR_NOT_ENOUGH_MEMORY" - return f"Windows error {errno}" - - def write(self, b: Buffer) -> int: - bytes_to_be_written = len(b) - buf = get_buffer(b) - code_units_to_be_written = min(bytes_to_be_written, MAX_BYTES_WRITTEN) // 2 - code_units_written = c_ulong() - - WriteConsoleW( - HANDLE(self.handle), - buf, - code_units_to_be_written, - byref(code_units_written), - None, - ) - bytes_written = 2 * code_units_written.value - - if bytes_written == 0 and bytes_to_be_written > 0: - raise OSError(self._get_error_message(GetLastError())) - return bytes_written - - -class ConsoleStream: - def __init__(self, text_stream: t.TextIO, byte_stream: t.BinaryIO) -> None: - self._text_stream = text_stream - self.buffer = byte_stream - - @property - def name(self) -> str: - return self.buffer.name - - def write(self, x: t.AnyStr) -> int: - if isinstance(x, str): - return self._text_stream.write(x) - try: - self.flush() - except Exception: - pass - return self.buffer.write(x) - - def writelines(self, lines: cabc.Iterable[t.AnyStr]) -> None: - for line in lines: - self.write(line) - - def __getattr__(self, name: str) -> t.Any: - return getattr(self._text_stream, name) - - def isatty(self) -> bool: - return self.buffer.isatty() - - def __repr__(self) -> str: - return f"" - - -def _get_text_stdin(buffer_stream: t.BinaryIO) -> t.TextIO: - text_stream = _NonClosingTextIOWrapper( - io.BufferedReader(_WindowsConsoleReader(STDIN_HANDLE)), - "utf-16-le", - "strict", - line_buffering=True, - ) - return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) - - -def _get_text_stdout(buffer_stream: t.BinaryIO) -> t.TextIO: - text_stream = _NonClosingTextIOWrapper( - io.BufferedWriter(_WindowsConsoleWriter(STDOUT_HANDLE)), - "utf-16-le", - "strict", - line_buffering=True, - ) - return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) - - -def _get_text_stderr(buffer_stream: t.BinaryIO) -> t.TextIO: - text_stream = _NonClosingTextIOWrapper( - io.BufferedWriter(_WindowsConsoleWriter(STDERR_HANDLE)), - "utf-16-le", - "strict", - line_buffering=True, - ) - return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) - - -_stream_factories: cabc.Mapping[int, t.Callable[[t.BinaryIO], t.TextIO]] = { - 0: _get_text_stdin, - 1: _get_text_stdout, - 2: _get_text_stderr, -} - - -def _is_console(f: t.TextIO) -> bool: - if not hasattr(f, "fileno"): - return False - - try: - fileno = f.fileno() - except (OSError, io.UnsupportedOperation): - return False - - handle = msvcrt.get_osfhandle(fileno) - return bool(GetConsoleMode(handle, byref(DWORD()))) - - -def _get_windows_console_stream( - f: t.TextIO, encoding: str | None, errors: str | None -) -> t.TextIO | None: - if ( - get_buffer is None - or encoding not in {"utf-16-le", None} - or errors not in {"strict", None} - or not _is_console(f) - ): - return None - - func = _stream_factories.get(f.fileno()) - if func is None: - return None - - b = getattr(f, "buffer", None) - - if b is None: - return None - - return func(b) diff --git a/write-message/venv/lib/python3.10/site-packages/click/core.py b/write-message/venv/lib/python3.10/site-packages/click/core.py deleted file mode 100644 index f57ada6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/core.py +++ /dev/null @@ -1,3135 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import enum -import errno -import inspect -import os -import sys -import typing as t -from collections import abc -from collections import Counter -from contextlib import AbstractContextManager -from contextlib import contextmanager -from contextlib import ExitStack -from functools import update_wrapper -from gettext import gettext as _ -from gettext import ngettext -from itertools import repeat -from types import TracebackType - -from . import types -from .exceptions import Abort -from .exceptions import BadParameter -from .exceptions import ClickException -from .exceptions import Exit -from .exceptions import MissingParameter -from .exceptions import NoArgsIsHelpError -from .exceptions import UsageError -from .formatting import HelpFormatter -from .formatting import join_options -from .globals import pop_context -from .globals import push_context -from .parser import _flag_needs_value -from .parser import _OptionParser -from .parser import _split_opt -from .termui import confirm -from .termui import prompt -from .termui import style -from .utils import _detect_program_name -from .utils import _expand_args -from .utils import echo -from .utils import make_default_short_help -from .utils import make_str -from .utils import PacifyFlushWrapper - -if t.TYPE_CHECKING: - from .shell_completion import CompletionItem - -F = t.TypeVar("F", bound="t.Callable[..., t.Any]") -V = t.TypeVar("V") - - -def _complete_visible_commands( - ctx: Context, incomplete: str -) -> cabc.Iterator[tuple[str, Command]]: - """List all the subcommands of a group that start with the - incomplete value and aren't hidden. - - :param ctx: Invocation context for the group. - :param incomplete: Value being completed. May be empty. - """ - multi = t.cast(Group, ctx.command) - - for name in multi.list_commands(ctx): - if name.startswith(incomplete): - command = multi.get_command(ctx, name) - - if command is not None and not command.hidden: - yield name, command - - -def _check_nested_chain( - base_command: Group, cmd_name: str, cmd: Command, register: bool = False -) -> None: - if not base_command.chain or not isinstance(cmd, Group): - return - - if register: - message = ( - f"It is not possible to add the group {cmd_name!r} to another" - f" group {base_command.name!r} that is in chain mode." - ) - else: - message = ( - f"Found the group {cmd_name!r} as subcommand to another group " - f" {base_command.name!r} that is in chain mode. This is not supported." - ) - - raise RuntimeError(message) - - -def batch(iterable: cabc.Iterable[V], batch_size: int) -> list[tuple[V, ...]]: - return list(zip(*repeat(iter(iterable), batch_size), strict=False)) - - -@contextmanager -def augment_usage_errors( - ctx: Context, param: Parameter | None = None -) -> cabc.Iterator[None]: - """Context manager that attaches extra information to exceptions.""" - try: - yield - except BadParameter as e: - if e.ctx is None: - e.ctx = ctx - if param is not None and e.param is None: - e.param = param - raise - except UsageError as e: - if e.ctx is None: - e.ctx = ctx - raise - - -def iter_params_for_processing( - invocation_order: cabc.Sequence[Parameter], - declaration_order: cabc.Sequence[Parameter], -) -> list[Parameter]: - """Returns all declared parameters in the order they should be processed. - - The declared parameters are re-shuffled depending on the order in which - they were invoked, as well as the eagerness of each parameters. - - The invocation order takes precedence over the declaration order. I.e. the - order in which the user provided them to the CLI is respected. - - This behavior and its effect on callback evaluation is detailed at: - https://click.palletsprojects.com/en/stable/advanced/#callback-evaluation-order - """ - - def sort_key(item: Parameter) -> tuple[bool, float]: - try: - idx: float = invocation_order.index(item) - except ValueError: - idx = float("inf") - - return not item.is_eager, idx - - return sorted(declaration_order, key=sort_key) - - -class ParameterSource(enum.Enum): - """This is an :class:`~enum.Enum` that indicates the source of a - parameter's value. - - Use :meth:`click.Context.get_parameter_source` to get the - source for a parameter by name. - - .. versionchanged:: 8.0 - Use :class:`~enum.Enum` and drop the ``validate`` method. - - .. versionchanged:: 8.0 - Added the ``PROMPT`` value. - """ - - COMMANDLINE = enum.auto() - """The value was provided by the command line args.""" - ENVIRONMENT = enum.auto() - """The value was provided with an environment variable.""" - DEFAULT = enum.auto() - """Used the default specified by the parameter.""" - DEFAULT_MAP = enum.auto() - """Used a default provided by :attr:`Context.default_map`.""" - PROMPT = enum.auto() - """Used a prompt to confirm a default or provide a value.""" - - -class Context: - """The context is a special internal object that holds state relevant - for the script execution at every single level. It's normally invisible - to commands unless they opt-in to getting access to it. - - The context is useful as it can pass internal objects around and can - control special execution features such as reading data from - environment variables. - - A context can be used as context manager in which case it will call - :meth:`close` on teardown. - - :param command: the command class for this context. - :param parent: the parent context. - :param info_name: the info name for this invocation. Generally this - is the most descriptive name for the script or - command. For the toplevel script it is usually - the name of the script, for commands below it it's - the name of the script. - :param obj: an arbitrary object of user data. - :param auto_envvar_prefix: the prefix to use for automatic environment - variables. If this is `None` then reading - from environment variables is disabled. This - does not affect manually set environment - variables which are always read. - :param default_map: a dictionary (like object) with default values - for parameters. - :param terminal_width: the width of the terminal. The default is - inherit from parent context. If no context - defines the terminal width then auto - detection will be applied. - :param max_content_width: the maximum width for content rendered by - Click (this currently only affects help - pages). This defaults to 80 characters if - not overridden. In other words: even if the - terminal is larger than that, Click will not - format things wider than 80 characters by - default. In addition to that, formatters might - add some safety mapping on the right. - :param resilient_parsing: if this flag is enabled then Click will - parse without any interactivity or callback - invocation. Default values will also be - ignored. This is useful for implementing - things such as completion support. - :param allow_extra_args: if this is set to `True` then extra arguments - at the end will not raise an error and will be - kept on the context. The default is to inherit - from the command. - :param allow_interspersed_args: if this is set to `False` then options - and arguments cannot be mixed. The - default is to inherit from the command. - :param ignore_unknown_options: instructs click to ignore options it does - not know and keeps them for later - processing. - :param help_option_names: optionally a list of strings that define how - the default help parameter is named. The - default is ``['--help']``. - :param token_normalize_func: an optional function that is used to - normalize tokens (options, choices, - etc.). This for instance can be used to - implement case insensitive behavior. - :param color: controls if the terminal supports ANSI colors or not. The - default is autodetection. This is only needed if ANSI - codes are used in texts that Click prints which is by - default not the case. This for instance would affect - help output. - :param show_default: Show the default value for commands. If this - value is not set, it defaults to the value from the parent - context. ``Command.show_default`` overrides this default for the - specific command. - - .. versionchanged:: 8.2 - The ``protected_args`` attribute is deprecated and will be removed in - Click 9.0. ``args`` will contain remaining unparsed tokens. - - .. versionchanged:: 8.1 - The ``show_default`` parameter is overridden by - ``Command.show_default``, instead of the other way around. - - .. versionchanged:: 8.0 - The ``show_default`` parameter defaults to the value from the - parent context. - - .. versionchanged:: 7.1 - Added the ``show_default`` parameter. - - .. versionchanged:: 4.0 - Added the ``color``, ``ignore_unknown_options``, and - ``max_content_width`` parameters. - - .. versionchanged:: 3.0 - Added the ``allow_extra_args`` and ``allow_interspersed_args`` - parameters. - - .. versionchanged:: 2.0 - Added the ``resilient_parsing``, ``help_option_names``, and - ``token_normalize_func`` parameters. - """ - - #: The formatter class to create with :meth:`make_formatter`. - #: - #: .. versionadded:: 8.0 - formatter_class: type[HelpFormatter] = HelpFormatter - - def __init__( - self, - command: Command, - parent: Context | None = None, - info_name: str | None = None, - obj: t.Any | None = None, - auto_envvar_prefix: str | None = None, - default_map: cabc.MutableMapping[str, t.Any] | None = None, - terminal_width: int | None = None, - max_content_width: int | None = None, - resilient_parsing: bool = False, - allow_extra_args: bool | None = None, - allow_interspersed_args: bool | None = None, - ignore_unknown_options: bool | None = None, - help_option_names: list[str] | None = None, - token_normalize_func: t.Callable[[str], str] | None = None, - color: bool | None = None, - show_default: bool | None = None, - ) -> None: - #: the parent context or `None` if none exists. - self.parent = parent - #: the :class:`Command` for this context. - self.command = command - #: the descriptive information name - self.info_name = info_name - #: Map of parameter names to their parsed values. Parameters - #: with ``expose_value=False`` are not stored. - self.params: dict[str, t.Any] = {} - #: the leftover arguments. - self.args: list[str] = [] - #: protected arguments. These are arguments that are prepended - #: to `args` when certain parsing scenarios are encountered but - #: must be never propagated to another arguments. This is used - #: to implement nested parsing. - self._protected_args: list[str] = [] - #: the collected prefixes of the command's options. - self._opt_prefixes: set[str] = set(parent._opt_prefixes) if parent else set() - - if obj is None and parent is not None: - obj = parent.obj - - #: the user object stored. - self.obj: t.Any = obj - self._meta: dict[str, t.Any] = getattr(parent, "meta", {}) - - #: A dictionary (-like object) with defaults for parameters. - if ( - default_map is None - and info_name is not None - and parent is not None - and parent.default_map is not None - ): - default_map = parent.default_map.get(info_name) - - self.default_map: cabc.MutableMapping[str, t.Any] | None = default_map - - #: This flag indicates if a subcommand is going to be executed. A - #: group callback can use this information to figure out if it's - #: being executed directly or because the execution flow passes - #: onwards to a subcommand. By default it's None, but it can be - #: the name of the subcommand to execute. - #: - #: If chaining is enabled this will be set to ``'*'`` in case - #: any commands are executed. It is however not possible to - #: figure out which ones. If you require this knowledge you - #: should use a :func:`result_callback`. - self.invoked_subcommand: str | None = None - - if terminal_width is None and parent is not None: - terminal_width = parent.terminal_width - - #: The width of the terminal (None is autodetection). - self.terminal_width: int | None = terminal_width - - if max_content_width is None and parent is not None: - max_content_width = parent.max_content_width - - #: The maximum width of formatted content (None implies a sensible - #: default which is 80 for most things). - self.max_content_width: int | None = max_content_width - - if allow_extra_args is None: - allow_extra_args = command.allow_extra_args - - #: Indicates if the context allows extra args or if it should - #: fail on parsing. - #: - #: .. versionadded:: 3.0 - self.allow_extra_args = allow_extra_args - - if allow_interspersed_args is None: - allow_interspersed_args = command.allow_interspersed_args - - #: Indicates if the context allows mixing of arguments and - #: options or not. - #: - #: .. versionadded:: 3.0 - self.allow_interspersed_args: bool = allow_interspersed_args - - if ignore_unknown_options is None: - ignore_unknown_options = command.ignore_unknown_options - - #: Instructs click to ignore options that a command does not - #: understand and will store it on the context for later - #: processing. This is primarily useful for situations where you - #: want to call into external programs. Generally this pattern is - #: strongly discouraged because it's not possibly to losslessly - #: forward all arguments. - #: - #: .. versionadded:: 4.0 - self.ignore_unknown_options: bool = ignore_unknown_options - - if help_option_names is None: - if parent is not None: - help_option_names = parent.help_option_names - else: - help_option_names = ["--help"] - - #: The names for the help options. - self.help_option_names: list[str] = help_option_names - - if token_normalize_func is None and parent is not None: - token_normalize_func = parent.token_normalize_func - - #: An optional normalization function for tokens. This is - #: options, choices, commands etc. - self.token_normalize_func: t.Callable[[str], str] | None = token_normalize_func - - #: Indicates if resilient parsing is enabled. In that case Click - #: will do its best to not cause any failures and default values - #: will be ignored. Useful for completion. - self.resilient_parsing: bool = resilient_parsing - - # If there is no envvar prefix yet, but the parent has one and - # the command on this level has a name, we can expand the envvar - # prefix automatically. - if auto_envvar_prefix is None: - if ( - parent is not None - and parent.auto_envvar_prefix is not None - and self.info_name is not None - ): - auto_envvar_prefix = ( - f"{parent.auto_envvar_prefix}_{self.info_name.upper()}" - ) - else: - auto_envvar_prefix = auto_envvar_prefix.upper() - - if auto_envvar_prefix is not None: - auto_envvar_prefix = auto_envvar_prefix.replace("-", "_") - - self.auto_envvar_prefix: str | None = auto_envvar_prefix - - if color is None and parent is not None: - color = parent.color - - #: Controls if styling output is wanted or not. - self.color: bool | None = color - - if show_default is None and parent is not None: - show_default = parent.show_default - - #: Show option default values when formatting help text. - self.show_default: bool | None = show_default - - self._close_callbacks: list[t.Callable[[], t.Any]] = [] - self._depth = 0 - self._parameter_source: dict[str, ParameterSource] = {} - self._exit_stack = ExitStack() - - @property - def protected_args(self) -> list[str]: - import warnings - - warnings.warn( - "'protected_args' is deprecated and will be removed in Click 9.0." - " 'args' will contain remaining unparsed tokens.", - DeprecationWarning, - stacklevel=2, - ) - return self._protected_args - - def to_info_dict(self) -> dict[str, t.Any]: - """Gather information that could be useful for a tool generating - user-facing documentation. This traverses the entire CLI - structure. - - .. code-block:: python - - with Context(cli) as ctx: - info = ctx.to_info_dict() - - .. versionadded:: 8.0 - """ - return { - "command": self.command.to_info_dict(self), - "info_name": self.info_name, - "allow_extra_args": self.allow_extra_args, - "allow_interspersed_args": self.allow_interspersed_args, - "ignore_unknown_options": self.ignore_unknown_options, - "auto_envvar_prefix": self.auto_envvar_prefix, - } - - def __enter__(self) -> Context: - self._depth += 1 - push_context(self) - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - tb: TracebackType | None, - ) -> None: - self._depth -= 1 - if self._depth == 0: - self.close() - pop_context() - - @contextmanager - def scope(self, cleanup: bool = True) -> cabc.Iterator[Context]: - """This helper method can be used with the context object to promote - it to the current thread local (see :func:`get_current_context`). - The default behavior of this is to invoke the cleanup functions which - can be disabled by setting `cleanup` to `False`. The cleanup - functions are typically used for things such as closing file handles. - - If the cleanup is intended the context object can also be directly - used as a context manager. - - Example usage:: - - with ctx.scope(): - assert get_current_context() is ctx - - This is equivalent:: - - with ctx: - assert get_current_context() is ctx - - .. versionadded:: 5.0 - - :param cleanup: controls if the cleanup functions should be run or - not. The default is to run these functions. In - some situations the context only wants to be - temporarily pushed in which case this can be disabled. - Nested pushes automatically defer the cleanup. - """ - if not cleanup: - self._depth += 1 - try: - with self as rv: - yield rv - finally: - if not cleanup: - self._depth -= 1 - - @property - def meta(self) -> dict[str, t.Any]: - """This is a dictionary which is shared with all the contexts - that are nested. It exists so that click utilities can store some - state here if they need to. It is however the responsibility of - that code to manage this dictionary well. - - The keys are supposed to be unique dotted strings. For instance - module paths are a good choice for it. What is stored in there is - irrelevant for the operation of click. However what is important is - that code that places data here adheres to the general semantics of - the system. - - Example usage:: - - LANG_KEY = f'{__name__}.lang' - - def set_language(value): - ctx = get_current_context() - ctx.meta[LANG_KEY] = value - - def get_language(): - return get_current_context().meta.get(LANG_KEY, 'en_US') - - .. versionadded:: 5.0 - """ - return self._meta - - def make_formatter(self) -> HelpFormatter: - """Creates the :class:`~click.HelpFormatter` for the help and - usage output. - - To quickly customize the formatter class used without overriding - this method, set the :attr:`formatter_class` attribute. - - .. versionchanged:: 8.0 - Added the :attr:`formatter_class` attribute. - """ - return self.formatter_class( - width=self.terminal_width, max_width=self.max_content_width - ) - - def with_resource(self, context_manager: AbstractContextManager[V]) -> V: - """Register a resource as if it were used in a ``with`` - statement. The resource will be cleaned up when the context is - popped. - - Uses :meth:`contextlib.ExitStack.enter_context`. It calls the - resource's ``__enter__()`` method and returns the result. When - the context is popped, it closes the stack, which calls the - resource's ``__exit__()`` method. - - To register a cleanup function for something that isn't a - context manager, use :meth:`call_on_close`. Or use something - from :mod:`contextlib` to turn it into a context manager first. - - .. code-block:: python - - @click.group() - @click.option("--name") - @click.pass_context - def cli(ctx): - ctx.obj = ctx.with_resource(connect_db(name)) - - :param context_manager: The context manager to enter. - :return: Whatever ``context_manager.__enter__()`` returns. - - .. versionadded:: 8.0 - """ - return self._exit_stack.enter_context(context_manager) - - def call_on_close(self, f: t.Callable[..., t.Any]) -> t.Callable[..., t.Any]: - """Register a function to be called when the context tears down. - - This can be used to close resources opened during the script - execution. Resources that support Python's context manager - protocol which would be used in a ``with`` statement should be - registered with :meth:`with_resource` instead. - - :param f: The function to execute on teardown. - """ - return self._exit_stack.callback(f) - - def close(self) -> None: - """Invoke all close callbacks registered with - :meth:`call_on_close`, and exit all context managers entered - with :meth:`with_resource`. - """ - self._exit_stack.close() - # In case the context is reused, create a new exit stack. - self._exit_stack = ExitStack() - - @property - def command_path(self) -> str: - """The computed command path. This is used for the ``usage`` - information on the help page. It's automatically created by - combining the info names of the chain of contexts to the root. - """ - rv = "" - if self.info_name is not None: - rv = self.info_name - if self.parent is not None: - parent_command_path = [self.parent.command_path] - - if isinstance(self.parent.command, Command): - for param in self.parent.command.get_params(self): - parent_command_path.extend(param.get_usage_pieces(self)) - - rv = f"{' '.join(parent_command_path)} {rv}" - return rv.lstrip() - - def find_root(self) -> Context: - """Finds the outermost context.""" - node = self - while node.parent is not None: - node = node.parent - return node - - def find_object(self, object_type: type[V]) -> V | None: - """Finds the closest object of a given type.""" - node: Context | None = self - - while node is not None: - if isinstance(node.obj, object_type): - return node.obj - - node = node.parent - - return None - - def ensure_object(self, object_type: type[V]) -> V: - """Like :meth:`find_object` but sets the innermost object to a - new instance of `object_type` if it does not exist. - """ - rv = self.find_object(object_type) - if rv is None: - self.obj = rv = object_type() - return rv - - @t.overload - def lookup_default( - self, name: str, call: t.Literal[True] = True - ) -> t.Any | None: ... - - @t.overload - def lookup_default( - self, name: str, call: t.Literal[False] = ... - ) -> t.Any | t.Callable[[], t.Any] | None: ... - - def lookup_default(self, name: str, call: bool = True) -> t.Any | None: - """Get the default for a parameter from :attr:`default_map`. - - :param name: Name of the parameter. - :param call: If the default is a callable, call it. Disable to - return the callable instead. - - .. versionchanged:: 8.0 - Added the ``call`` parameter. - """ - if self.default_map is not None: - value = self.default_map.get(name) - - if call and callable(value): - return value() - - return value - - return None - - def fail(self, message: str) -> t.NoReturn: - """Aborts the execution of the program with a specific error - message. - - :param message: the error message to fail with. - """ - raise UsageError(message, self) - - def abort(self) -> t.NoReturn: - """Aborts the script.""" - raise Abort() - - def exit(self, code: int = 0) -> t.NoReturn: - """Exits the application with a given exit code. - - .. versionchanged:: 8.2 - Callbacks and context managers registered with :meth:`call_on_close` - and :meth:`with_resource` are closed before exiting. - """ - self.close() - raise Exit(code) - - def get_usage(self) -> str: - """Helper method to get formatted usage string for the current - context and command. - """ - return self.command.get_usage(self) - - def get_help(self) -> str: - """Helper method to get formatted help page for the current - context and command. - """ - return self.command.get_help(self) - - def _make_sub_context(self, command: Command) -> Context: - """Create a new context of the same type as this context, but - for a new command. - - :meta private: - """ - return type(self)(command, info_name=command.name, parent=self) - - @t.overload - def invoke( - self, callback: t.Callable[..., V], /, *args: t.Any, **kwargs: t.Any - ) -> V: ... - - @t.overload - def invoke(self, callback: Command, /, *args: t.Any, **kwargs: t.Any) -> t.Any: ... - - def invoke( - self, callback: Command | t.Callable[..., V], /, *args: t.Any, **kwargs: t.Any - ) -> t.Any | V: - """Invokes a command callback in exactly the way it expects. There - are two ways to invoke this method: - - 1. the first argument can be a callback and all other arguments and - keyword arguments are forwarded directly to the function. - 2. the first argument is a click command object. In that case all - arguments are forwarded as well but proper click parameters - (options and click arguments) must be keyword arguments and Click - will fill in defaults. - - .. versionchanged:: 8.0 - All ``kwargs`` are tracked in :attr:`params` so they will be - passed if :meth:`forward` is called at multiple levels. - - .. versionchanged:: 3.2 - A new context is created, and missing arguments use default values. - """ - if isinstance(callback, Command): - other_cmd = callback - - if other_cmd.callback is None: - raise TypeError( - "The given command does not have a callback that can be invoked." - ) - else: - callback = t.cast("t.Callable[..., V]", other_cmd.callback) - - ctx = self._make_sub_context(other_cmd) - - for param in other_cmd.params: - if param.name not in kwargs and param.expose_value: - kwargs[param.name] = param.type_cast_value( # type: ignore - ctx, param.get_default(ctx) - ) - - # Track all kwargs as params, so that forward() will pass - # them on in subsequent calls. - ctx.params.update(kwargs) - else: - ctx = self - - with augment_usage_errors(self): - with ctx: - return callback(*args, **kwargs) - - def forward(self, cmd: Command, /, *args: t.Any, **kwargs: t.Any) -> t.Any: - """Similar to :meth:`invoke` but fills in default keyword - arguments from the current context if the other command expects - it. This cannot invoke callbacks directly, only other commands. - - .. versionchanged:: 8.0 - All ``kwargs`` are tracked in :attr:`params` so they will be - passed if ``forward`` is called at multiple levels. - """ - # Can only forward to other commands, not direct callbacks. - if not isinstance(cmd, Command): - raise TypeError("Callback is not a command.") - - for param in self.params: - if param not in kwargs: - kwargs[param] = self.params[param] - - return self.invoke(cmd, *args, **kwargs) - - def set_parameter_source(self, name: str, source: ParameterSource) -> None: - """Set the source of a parameter. This indicates the location - from which the value of the parameter was obtained. - - :param name: The name of the parameter. - :param source: A member of :class:`~click.core.ParameterSource`. - """ - self._parameter_source[name] = source - - def get_parameter_source(self, name: str) -> ParameterSource | None: - """Get the source of a parameter. This indicates the location - from which the value of the parameter was obtained. - - This can be useful for determining when a user specified a value - on the command line that is the same as the default value. It - will be :attr:`~click.core.ParameterSource.DEFAULT` only if the - value was actually taken from the default. - - :param name: The name of the parameter. - :rtype: ParameterSource - - .. versionchanged:: 8.0 - Returns ``None`` if the parameter was not provided from any - source. - """ - return self._parameter_source.get(name) - - -class Command: - """Commands are the basic building block of command line interfaces in - Click. A basic command handles command line parsing and might dispatch - more parsing to commands nested below it. - - :param name: the name of the command to use unless a group overrides it. - :param context_settings: an optional dictionary with defaults that are - passed to the context object. - :param callback: the callback to invoke. This is optional. - :param params: the parameters to register with this command. This can - be either :class:`Option` or :class:`Argument` objects. - :param help: the help string to use for this command. - :param epilog: like the help string but it's printed at the end of the - help page after everything else. - :param short_help: the short help to use for this command. This is - shown on the command listing of the parent command. - :param add_help_option: by default each command registers a ``--help`` - option. This can be disabled by this parameter. - :param no_args_is_help: this controls what happens if no arguments are - provided. This option is disabled by default. - If enabled this will add ``--help`` as argument - if no arguments are passed - :param hidden: hide this command from help outputs. - :param deprecated: If ``True`` or non-empty string, issues a message - indicating that the command is deprecated and highlights - its deprecation in --help. The message can be customized - by using a string as the value. - - .. versionchanged:: 8.2 - This is the base class for all commands, not ``BaseCommand``. - ``deprecated`` can be set to a string as well to customize the - deprecation message. - - .. versionchanged:: 8.1 - ``help``, ``epilog``, and ``short_help`` are stored unprocessed, - all formatting is done when outputting help text, not at init, - and is done even if not using the ``@command`` decorator. - - .. versionchanged:: 8.0 - Added a ``repr`` showing the command name. - - .. versionchanged:: 7.1 - Added the ``no_args_is_help`` parameter. - - .. versionchanged:: 2.0 - Added the ``context_settings`` parameter. - """ - - #: The context class to create with :meth:`make_context`. - #: - #: .. versionadded:: 8.0 - context_class: type[Context] = Context - - #: the default for the :attr:`Context.allow_extra_args` flag. - allow_extra_args = False - - #: the default for the :attr:`Context.allow_interspersed_args` flag. - allow_interspersed_args = True - - #: the default for the :attr:`Context.ignore_unknown_options` flag. - ignore_unknown_options = False - - def __init__( - self, - name: str | None, - context_settings: cabc.MutableMapping[str, t.Any] | None = None, - callback: t.Callable[..., t.Any] | None = None, - params: list[Parameter] | None = None, - help: str | None = None, - epilog: str | None = None, - short_help: str | None = None, - options_metavar: str | None = "[OPTIONS]", - add_help_option: bool = True, - no_args_is_help: bool = False, - hidden: bool = False, - deprecated: bool | str = False, - ) -> None: - #: the name the command thinks it has. Upon registering a command - #: on a :class:`Group` the group will default the command name - #: with this information. You should instead use the - #: :class:`Context`\'s :attr:`~Context.info_name` attribute. - self.name = name - - if context_settings is None: - context_settings = {} - - #: an optional dictionary with defaults passed to the context. - self.context_settings: cabc.MutableMapping[str, t.Any] = context_settings - - #: the callback to execute when the command fires. This might be - #: `None` in which case nothing happens. - self.callback = callback - #: the list of parameters for this command in the order they - #: should show up in the help page and execute. Eager parameters - #: will automatically be handled before non eager ones. - self.params: list[Parameter] = params or [] - self.help = help - self.epilog = epilog - self.options_metavar = options_metavar - self.short_help = short_help - self.add_help_option = add_help_option - self._help_option = None - self.no_args_is_help = no_args_is_help - self.hidden = hidden - self.deprecated = deprecated - - def to_info_dict(self, ctx: Context) -> dict[str, t.Any]: - return { - "name": self.name, - "params": [param.to_info_dict() for param in self.get_params(ctx)], - "help": self.help, - "epilog": self.epilog, - "short_help": self.short_help, - "hidden": self.hidden, - "deprecated": self.deprecated, - } - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.name}>" - - def get_usage(self, ctx: Context) -> str: - """Formats the usage line into a string and returns it. - - Calls :meth:`format_usage` internally. - """ - formatter = ctx.make_formatter() - self.format_usage(ctx, formatter) - return formatter.getvalue().rstrip("\n") - - def get_params(self, ctx: Context) -> list[Parameter]: - params = self.params - help_option = self.get_help_option(ctx) - - if help_option is not None: - params = [*params, help_option] - - if __debug__: - import warnings - - opts = [opt for param in params for opt in param.opts] - opts_counter = Counter(opts) - duplicate_opts = (opt for opt, count in opts_counter.items() if count > 1) - - for duplicate_opt in duplicate_opts: - warnings.warn( - ( - f"The parameter {duplicate_opt} is used more than once. " - "Remove its duplicate as parameters should be unique." - ), - stacklevel=3, - ) - - return params - - def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the usage line into the formatter. - - This is a low-level method called by :meth:`get_usage`. - """ - pieces = self.collect_usage_pieces(ctx) - formatter.write_usage(ctx.command_path, " ".join(pieces)) - - def collect_usage_pieces(self, ctx: Context) -> list[str]: - """Returns all the pieces that go into the usage line and returns - it as a list of strings. - """ - rv = [self.options_metavar] if self.options_metavar else [] - - for param in self.get_params(ctx): - rv.extend(param.get_usage_pieces(ctx)) - - return rv - - def get_help_option_names(self, ctx: Context) -> list[str]: - """Returns the names for the help option.""" - all_names = set(ctx.help_option_names) - for param in self.params: - all_names.difference_update(param.opts) - all_names.difference_update(param.secondary_opts) - return list(all_names) - - def get_help_option(self, ctx: Context) -> Option | None: - """Returns the help option object. - - Skipped if :attr:`add_help_option` is ``False``. - - .. versionchanged:: 8.1.8 - The help option is now cached to avoid creating it multiple times. - """ - help_option_names = self.get_help_option_names(ctx) - - if not help_option_names or not self.add_help_option: - return None - - # Cache the help option object in private _help_option attribute to - # avoid creating it multiple times. Not doing this will break the - # callback odering by iter_params_for_processing(), which relies on - # object comparison. - if self._help_option is None: - # Avoid circular import. - from .decorators import help_option - - # Apply help_option decorator and pop resulting option - help_option(*help_option_names)(self) - self._help_option = self.params.pop() # type: ignore[assignment] - - return self._help_option - - def make_parser(self, ctx: Context) -> _OptionParser: - """Creates the underlying option parser for this command.""" - parser = _OptionParser(ctx) - for param in self.get_params(ctx): - param.add_to_parser(parser, ctx) - return parser - - def get_help(self, ctx: Context) -> str: - """Formats the help into a string and returns it. - - Calls :meth:`format_help` internally. - """ - formatter = ctx.make_formatter() - self.format_help(ctx, formatter) - return formatter.getvalue().rstrip("\n") - - def get_short_help_str(self, limit: int = 45) -> str: - """Gets short help for the command or makes it by shortening the - long help string. - """ - if self.short_help: - text = inspect.cleandoc(self.short_help) - elif self.help: - text = make_default_short_help(self.help, limit) - else: - text = "" - - if self.deprecated: - deprecated_message = ( - f"(DEPRECATED: {self.deprecated})" - if isinstance(self.deprecated, str) - else "(DEPRECATED)" - ) - text = _("{text} {deprecated_message}").format( - text=text, deprecated_message=deprecated_message - ) - - return text.strip() - - def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the help into the formatter if it exists. - - This is a low-level method called by :meth:`get_help`. - - This calls the following methods: - - - :meth:`format_usage` - - :meth:`format_help_text` - - :meth:`format_options` - - :meth:`format_epilog` - """ - self.format_usage(ctx, formatter) - self.format_help_text(ctx, formatter) - self.format_options(ctx, formatter) - self.format_epilog(ctx, formatter) - - def format_help_text(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the help text to the formatter if it exists.""" - if self.help is not None: - # truncate the help text to the first form feed - text = inspect.cleandoc(self.help).partition("\f")[0] - else: - text = "" - - if self.deprecated: - deprecated_message = ( - f"(DEPRECATED: {self.deprecated})" - if isinstance(self.deprecated, str) - else "(DEPRECATED)" - ) - text = _("{text} {deprecated_message}").format( - text=text, deprecated_message=deprecated_message - ) - - if text: - formatter.write_paragraph() - - with formatter.indentation(): - formatter.write_text(text) - - def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes all the options into the formatter if they exist.""" - opts = [] - for param in self.get_params(ctx): - rv = param.get_help_record(ctx) - if rv is not None: - opts.append(rv) - - if opts: - with formatter.section(_("Options")): - formatter.write_dl(opts) - - def format_epilog(self, ctx: Context, formatter: HelpFormatter) -> None: - """Writes the epilog into the formatter if it exists.""" - if self.epilog: - epilog = inspect.cleandoc(self.epilog) - formatter.write_paragraph() - - with formatter.indentation(): - formatter.write_text(epilog) - - def make_context( - self, - info_name: str | None, - args: list[str], - parent: Context | None = None, - **extra: t.Any, - ) -> Context: - """This function when given an info name and arguments will kick - off the parsing and create a new :class:`Context`. It does not - invoke the actual command callback though. - - To quickly customize the context class used without overriding - this method, set the :attr:`context_class` attribute. - - :param info_name: the info name for this invocation. Generally this - is the most descriptive name for the script or - command. For the toplevel script it's usually - the name of the script, for commands below it's - the name of the command. - :param args: the arguments to parse as list of strings. - :param parent: the parent context if available. - :param extra: extra keyword arguments forwarded to the context - constructor. - - .. versionchanged:: 8.0 - Added the :attr:`context_class` attribute. - """ - for key, value in self.context_settings.items(): - if key not in extra: - extra[key] = value - - ctx = self.context_class(self, info_name=info_name, parent=parent, **extra) - - with ctx.scope(cleanup=False): - self.parse_args(ctx, args) - return ctx - - def parse_args(self, ctx: Context, args: list[str]) -> list[str]: - if not args and self.no_args_is_help and not ctx.resilient_parsing: - raise NoArgsIsHelpError(ctx) - - parser = self.make_parser(ctx) - opts, args, param_order = parser.parse_args(args=args) - - for param in iter_params_for_processing(param_order, self.get_params(ctx)): - value, args = param.handle_parse_result(ctx, opts, args) - - if args and not ctx.allow_extra_args and not ctx.resilient_parsing: - ctx.fail( - ngettext( - "Got unexpected extra argument ({args})", - "Got unexpected extra arguments ({args})", - len(args), - ).format(args=" ".join(map(str, args))) - ) - - ctx.args = args - ctx._opt_prefixes.update(parser._opt_prefixes) - return args - - def invoke(self, ctx: Context) -> t.Any: - """Given a context, this invokes the attached callback (if it exists) - in the right way. - """ - if self.deprecated: - extra_message = ( - f" {self.deprecated}" if isinstance(self.deprecated, str) else "" - ) - message = _( - "DeprecationWarning: The command {name!r} is deprecated.{extra_message}" - ).format(name=self.name, extra_message=extra_message) - echo(style(message, fg="red"), err=True) - - if self.callback is not None: - return ctx.invoke(self.callback, **ctx.params) - - def shell_complete(self, ctx: Context, incomplete: str) -> list[CompletionItem]: - """Return a list of completions for the incomplete value. Looks - at the names of options and chained multi-commands. - - Any command could be part of a chained multi-command, so sibling - commands are valid at any point during command completion. - - :param ctx: Invocation context for this command. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - results: list[CompletionItem] = [] - - if incomplete and not incomplete[0].isalnum(): - for param in self.get_params(ctx): - if ( - not isinstance(param, Option) - or param.hidden - or ( - not param.multiple - and ctx.get_parameter_source(param.name) # type: ignore - is ParameterSource.COMMANDLINE - ) - ): - continue - - results.extend( - CompletionItem(name, help=param.help) - for name in [*param.opts, *param.secondary_opts] - if name.startswith(incomplete) - ) - - while ctx.parent is not None: - ctx = ctx.parent - - if isinstance(ctx.command, Group) and ctx.command.chain: - results.extend( - CompletionItem(name, help=command.get_short_help_str()) - for name, command in _complete_visible_commands(ctx, incomplete) - if name not in ctx._protected_args - ) - - return results - - @t.overload - def main( - self, - args: cabc.Sequence[str] | None = None, - prog_name: str | None = None, - complete_var: str | None = None, - standalone_mode: t.Literal[True] = True, - **extra: t.Any, - ) -> t.NoReturn: ... - - @t.overload - def main( - self, - args: cabc.Sequence[str] | None = None, - prog_name: str | None = None, - complete_var: str | None = None, - standalone_mode: bool = ..., - **extra: t.Any, - ) -> t.Any: ... - - def main( - self, - args: cabc.Sequence[str] | None = None, - prog_name: str | None = None, - complete_var: str | None = None, - standalone_mode: bool = True, - windows_expand_args: bool = True, - **extra: t.Any, - ) -> t.Any: - """This is the way to invoke a script with all the bells and - whistles as a command line application. This will always terminate - the application after a call. If this is not wanted, ``SystemExit`` - needs to be caught. - - This method is also available by directly calling the instance of - a :class:`Command`. - - :param args: the arguments that should be used for parsing. If not - provided, ``sys.argv[1:]`` is used. - :param prog_name: the program name that should be used. By default - the program name is constructed by taking the file - name from ``sys.argv[0]``. - :param complete_var: the environment variable that controls the - bash completion support. The default is - ``"__COMPLETE"`` with prog_name in - uppercase. - :param standalone_mode: the default behavior is to invoke the script - in standalone mode. Click will then - handle exceptions and convert them into - error messages and the function will never - return but shut down the interpreter. If - this is set to `False` they will be - propagated to the caller and the return - value of this function is the return value - of :meth:`invoke`. - :param windows_expand_args: Expand glob patterns, user dir, and - env vars in command line args on Windows. - :param extra: extra keyword arguments are forwarded to the context - constructor. See :class:`Context` for more information. - - .. versionchanged:: 8.0.1 - Added the ``windows_expand_args`` parameter to allow - disabling command line arg expansion on Windows. - - .. versionchanged:: 8.0 - When taking arguments from ``sys.argv`` on Windows, glob - patterns, user dir, and env vars are expanded. - - .. versionchanged:: 3.0 - Added the ``standalone_mode`` parameter. - """ - if args is None: - args = sys.argv[1:] - - if os.name == "nt" and windows_expand_args: - args = _expand_args(args) - else: - args = list(args) - - if prog_name is None: - prog_name = _detect_program_name() - - # Process shell completion requests and exit early. - self._main_shell_completion(extra, prog_name, complete_var) - - try: - try: - with self.make_context(prog_name, args, **extra) as ctx: - rv = self.invoke(ctx) - if not standalone_mode: - return rv - # it's not safe to `ctx.exit(rv)` here! - # note that `rv` may actually contain data like "1" which - # has obvious effects - # more subtle case: `rv=[None, None]` can come out of - # chained commands which all returned `None` -- so it's not - # even always obvious that `rv` indicates success/failure - # by its truthiness/falsiness - ctx.exit() - except (EOFError, KeyboardInterrupt) as e: - echo(file=sys.stderr) - raise Abort() from e - except ClickException as e: - if not standalone_mode: - raise - e.show() - sys.exit(e.exit_code) - except OSError as e: - if e.errno == errno.EPIPE: - sys.stdout = t.cast(t.TextIO, PacifyFlushWrapper(sys.stdout)) - sys.stderr = t.cast(t.TextIO, PacifyFlushWrapper(sys.stderr)) - sys.exit(1) - else: - raise - except Exit as e: - if standalone_mode: - sys.exit(e.exit_code) - else: - # in non-standalone mode, return the exit code - # note that this is only reached if `self.invoke` above raises - # an Exit explicitly -- thus bypassing the check there which - # would return its result - # the results of non-standalone execution may therefore be - # somewhat ambiguous: if there are codepaths which lead to - # `ctx.exit(1)` and to `return 1`, the caller won't be able to - # tell the difference between the two - return e.exit_code - except Abort: - if not standalone_mode: - raise - echo(_("Aborted!"), file=sys.stderr) - sys.exit(1) - - def _main_shell_completion( - self, - ctx_args: cabc.MutableMapping[str, t.Any], - prog_name: str, - complete_var: str | None = None, - ) -> None: - """Check if the shell is asking for tab completion, process - that, then exit early. Called from :meth:`main` before the - program is invoked. - - :param prog_name: Name of the executable in the shell. - :param complete_var: Name of the environment variable that holds - the completion instruction. Defaults to - ``_{PROG_NAME}_COMPLETE``. - - .. versionchanged:: 8.2.0 - Dots (``.``) in ``prog_name`` are replaced with underscores (``_``). - """ - if complete_var is None: - complete_name = prog_name.replace("-", "_").replace(".", "_") - complete_var = f"_{complete_name}_COMPLETE".upper() - - instruction = os.environ.get(complete_var) - - if not instruction: - return - - from .shell_completion import shell_complete - - rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction) - sys.exit(rv) - - def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any: - """Alias for :meth:`main`.""" - return self.main(*args, **kwargs) - - -class _FakeSubclassCheck(type): - def __subclasscheck__(cls, subclass: type) -> bool: - return issubclass(subclass, cls.__bases__[0]) - - def __instancecheck__(cls, instance: t.Any) -> bool: - return isinstance(instance, cls.__bases__[0]) - - -class _BaseCommand(Command, metaclass=_FakeSubclassCheck): - """ - .. deprecated:: 8.2 - Will be removed in Click 9.0. Use ``Command`` instead. - """ - - -class Group(Command): - """A group is a command that nests other commands (or more groups). - - :param name: The name of the group command. - :param commands: Map names to :class:`Command` objects. Can be a list, which - will use :attr:`Command.name` as the keys. - :param invoke_without_command: Invoke the group's callback even if a - subcommand is not given. - :param no_args_is_help: If no arguments are given, show the group's help and - exit. Defaults to the opposite of ``invoke_without_command``. - :param subcommand_metavar: How to represent the subcommand argument in help. - The default will represent whether ``chain`` is set or not. - :param chain: Allow passing more than one subcommand argument. After parsing - a command's arguments, if any arguments remain another command will be - matched, and so on. - :param result_callback: A function to call after the group's and - subcommand's callbacks. The value returned by the subcommand is passed. - If ``chain`` is enabled, the value will be a list of values returned by - all the commands. If ``invoke_without_command`` is enabled, the value - will be the value returned by the group's callback, or an empty list if - ``chain`` is enabled. - :param kwargs: Other arguments passed to :class:`Command`. - - .. versionchanged:: 8.0 - The ``commands`` argument can be a list of command objects. - - .. versionchanged:: 8.2 - Merged with and replaces the ``MultiCommand`` base class. - """ - - allow_extra_args = True - allow_interspersed_args = False - - #: If set, this is used by the group's :meth:`command` decorator - #: as the default :class:`Command` class. This is useful to make all - #: subcommands use a custom command class. - #: - #: .. versionadded:: 8.0 - command_class: type[Command] | None = None - - #: If set, this is used by the group's :meth:`group` decorator - #: as the default :class:`Group` class. This is useful to make all - #: subgroups use a custom group class. - #: - #: If set to the special value :class:`type` (literally - #: ``group_class = type``), this group's class will be used as the - #: default class. This makes a custom group class continue to make - #: custom groups. - #: - #: .. versionadded:: 8.0 - group_class: type[Group] | type[type] | None = None - # Literal[type] isn't valid, so use Type[type] - - def __init__( - self, - name: str | None = None, - commands: cabc.MutableMapping[str, Command] - | cabc.Sequence[Command] - | None = None, - invoke_without_command: bool = False, - no_args_is_help: bool | None = None, - subcommand_metavar: str | None = None, - chain: bool = False, - result_callback: t.Callable[..., t.Any] | None = None, - **kwargs: t.Any, - ) -> None: - super().__init__(name, **kwargs) - - if commands is None: - commands = {} - elif isinstance(commands, abc.Sequence): - commands = {c.name: c for c in commands if c.name is not None} - - #: The registered subcommands by their exported names. - self.commands: cabc.MutableMapping[str, Command] = commands - - if no_args_is_help is None: - no_args_is_help = not invoke_without_command - - self.no_args_is_help = no_args_is_help - self.invoke_without_command = invoke_without_command - - if subcommand_metavar is None: - if chain: - subcommand_metavar = "COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]..." - else: - subcommand_metavar = "COMMAND [ARGS]..." - - self.subcommand_metavar = subcommand_metavar - self.chain = chain - # The result callback that is stored. This can be set or - # overridden with the :func:`result_callback` decorator. - self._result_callback = result_callback - - if self.chain: - for param in self.params: - if isinstance(param, Argument) and not param.required: - raise RuntimeError( - "A group in chain mode cannot have optional arguments." - ) - - def to_info_dict(self, ctx: Context) -> dict[str, t.Any]: - info_dict = super().to_info_dict(ctx) - commands = {} - - for name in self.list_commands(ctx): - command = self.get_command(ctx, name) - - if command is None: - continue - - sub_ctx = ctx._make_sub_context(command) - - with sub_ctx.scope(cleanup=False): - commands[name] = command.to_info_dict(sub_ctx) - - info_dict.update(commands=commands, chain=self.chain) - return info_dict - - def add_command(self, cmd: Command, name: str | None = None) -> None: - """Registers another :class:`Command` with this group. If the name - is not provided, the name of the command is used. - """ - name = name or cmd.name - if name is None: - raise TypeError("Command has no name.") - _check_nested_chain(self, name, cmd, register=True) - self.commands[name] = cmd - - @t.overload - def command(self, __func: t.Callable[..., t.Any]) -> Command: ... - - @t.overload - def command( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Callable[[t.Callable[..., t.Any]], Command]: ... - - def command( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Callable[[t.Callable[..., t.Any]], Command] | Command: - """A shortcut decorator for declaring and attaching a command to - the group. This takes the same arguments as :func:`command` and - immediately registers the created command with this group by - calling :meth:`add_command`. - - To customize the command class used, set the - :attr:`command_class` attribute. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - - .. versionchanged:: 8.0 - Added the :attr:`command_class` attribute. - """ - from .decorators import command - - func: t.Callable[..., t.Any] | None = None - - if args and callable(args[0]): - assert len(args) == 1 and not kwargs, ( - "Use 'command(**kwargs)(callable)' to provide arguments." - ) - (func,) = args - args = () - - if self.command_class and kwargs.get("cls") is None: - kwargs["cls"] = self.command_class - - def decorator(f: t.Callable[..., t.Any]) -> Command: - cmd: Command = command(*args, **kwargs)(f) - self.add_command(cmd) - return cmd - - if func is not None: - return decorator(func) - - return decorator - - @t.overload - def group(self, __func: t.Callable[..., t.Any]) -> Group: ... - - @t.overload - def group( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Callable[[t.Callable[..., t.Any]], Group]: ... - - def group( - self, *args: t.Any, **kwargs: t.Any - ) -> t.Callable[[t.Callable[..., t.Any]], Group] | Group: - """A shortcut decorator for declaring and attaching a group to - the group. This takes the same arguments as :func:`group` and - immediately registers the created group with this group by - calling :meth:`add_command`. - - To customize the group class used, set the :attr:`group_class` - attribute. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - - .. versionchanged:: 8.0 - Added the :attr:`group_class` attribute. - """ - from .decorators import group - - func: t.Callable[..., t.Any] | None = None - - if args and callable(args[0]): - assert len(args) == 1 and not kwargs, ( - "Use 'group(**kwargs)(callable)' to provide arguments." - ) - (func,) = args - args = () - - if self.group_class is not None and kwargs.get("cls") is None: - if self.group_class is type: - kwargs["cls"] = type(self) - else: - kwargs["cls"] = self.group_class - - def decorator(f: t.Callable[..., t.Any]) -> Group: - cmd: Group = group(*args, **kwargs)(f) - self.add_command(cmd) - return cmd - - if func is not None: - return decorator(func) - - return decorator - - def result_callback(self, replace: bool = False) -> t.Callable[[F], F]: - """Adds a result callback to the command. By default if a - result callback is already registered this will chain them but - this can be disabled with the `replace` parameter. The result - callback is invoked with the return value of the subcommand - (or the list of return values from all subcommands if chaining - is enabled) as well as the parameters as they would be passed - to the main callback. - - Example:: - - @click.group() - @click.option('-i', '--input', default=23) - def cli(input): - return 42 - - @cli.result_callback() - def process_result(result, input): - return result + input - - :param replace: if set to `True` an already existing result - callback will be removed. - - .. versionchanged:: 8.0 - Renamed from ``resultcallback``. - - .. versionadded:: 3.0 - """ - - def decorator(f: F) -> F: - old_callback = self._result_callback - - if old_callback is None or replace: - self._result_callback = f - return f - - def function(value: t.Any, /, *args: t.Any, **kwargs: t.Any) -> t.Any: - inner = old_callback(value, *args, **kwargs) - return f(inner, *args, **kwargs) - - self._result_callback = rv = update_wrapper(t.cast(F, function), f) - return rv # type: ignore[return-value] - - return decorator - - def get_command(self, ctx: Context, cmd_name: str) -> Command | None: - """Given a context and a command name, this returns a :class:`Command` - object if it exists or returns ``None``. - """ - return self.commands.get(cmd_name) - - def list_commands(self, ctx: Context) -> list[str]: - """Returns a list of subcommand names in the order they should appear.""" - return sorted(self.commands) - - def collect_usage_pieces(self, ctx: Context) -> list[str]: - rv = super().collect_usage_pieces(ctx) - rv.append(self.subcommand_metavar) - return rv - - def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: - super().format_options(ctx, formatter) - self.format_commands(ctx, formatter) - - def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: - """Extra format methods for multi methods that adds all the commands - after the options. - """ - commands = [] - for subcommand in self.list_commands(ctx): - cmd = self.get_command(ctx, subcommand) - # What is this, the tool lied about a command. Ignore it - if cmd is None: - continue - if cmd.hidden: - continue - - commands.append((subcommand, cmd)) - - # allow for 3 times the default spacing - if len(commands): - limit = formatter.width - 6 - max(len(cmd[0]) for cmd in commands) - - rows = [] - for subcommand, cmd in commands: - help = cmd.get_short_help_str(limit) - rows.append((subcommand, help)) - - if rows: - with formatter.section(_("Commands")): - formatter.write_dl(rows) - - def parse_args(self, ctx: Context, args: list[str]) -> list[str]: - if not args and self.no_args_is_help and not ctx.resilient_parsing: - raise NoArgsIsHelpError(ctx) - - rest = super().parse_args(ctx, args) - - if self.chain: - ctx._protected_args = rest - ctx.args = [] - elif rest: - ctx._protected_args, ctx.args = rest[:1], rest[1:] - - return ctx.args - - def invoke(self, ctx: Context) -> t.Any: - def _process_result(value: t.Any) -> t.Any: - if self._result_callback is not None: - value = ctx.invoke(self._result_callback, value, **ctx.params) - return value - - if not ctx._protected_args: - if self.invoke_without_command: - # No subcommand was invoked, so the result callback is - # invoked with the group return value for regular - # groups, or an empty list for chained groups. - with ctx: - rv = super().invoke(ctx) - return _process_result([] if self.chain else rv) - ctx.fail(_("Missing command.")) - - # Fetch args back out - args = [*ctx._protected_args, *ctx.args] - ctx.args = [] - ctx._protected_args = [] - - # If we're not in chain mode, we only allow the invocation of a - # single command but we also inform the current context about the - # name of the command to invoke. - if not self.chain: - # Make sure the context is entered so we do not clean up - # resources until the result processor has worked. - with ctx: - cmd_name, cmd, args = self.resolve_command(ctx, args) - assert cmd is not None - ctx.invoked_subcommand = cmd_name - super().invoke(ctx) - sub_ctx = cmd.make_context(cmd_name, args, parent=ctx) - with sub_ctx: - return _process_result(sub_ctx.command.invoke(sub_ctx)) - - # In chain mode we create the contexts step by step, but after the - # base command has been invoked. Because at that point we do not - # know the subcommands yet, the invoked subcommand attribute is - # set to ``*`` to inform the command that subcommands are executed - # but nothing else. - with ctx: - ctx.invoked_subcommand = "*" if args else None - super().invoke(ctx) - - # Otherwise we make every single context and invoke them in a - # chain. In that case the return value to the result processor - # is the list of all invoked subcommand's results. - contexts = [] - while args: - cmd_name, cmd, args = self.resolve_command(ctx, args) - assert cmd is not None - sub_ctx = cmd.make_context( - cmd_name, - args, - parent=ctx, - allow_extra_args=True, - allow_interspersed_args=False, - ) - contexts.append(sub_ctx) - args, sub_ctx.args = sub_ctx.args, [] - - rv = [] - for sub_ctx in contexts: - with sub_ctx: - rv.append(sub_ctx.command.invoke(sub_ctx)) - return _process_result(rv) - - def resolve_command( - self, ctx: Context, args: list[str] - ) -> tuple[str | None, Command | None, list[str]]: - cmd_name = make_str(args[0]) - original_cmd_name = cmd_name - - # Get the command - cmd = self.get_command(ctx, cmd_name) - - # If we can't find the command but there is a normalization - # function available, we try with that one. - if cmd is None and ctx.token_normalize_func is not None: - cmd_name = ctx.token_normalize_func(cmd_name) - cmd = self.get_command(ctx, cmd_name) - - # If we don't find the command we want to show an error message - # to the user that it was not provided. However, there is - # something else we should do: if the first argument looks like - # an option we want to kick off parsing again for arguments to - # resolve things like --help which now should go to the main - # place. - if cmd is None and not ctx.resilient_parsing: - if _split_opt(cmd_name)[0]: - self.parse_args(ctx, args) - ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) - return cmd_name if cmd else None, cmd, args[1:] - - def shell_complete(self, ctx: Context, incomplete: str) -> list[CompletionItem]: - """Return a list of completions for the incomplete value. Looks - at the names of options, subcommands, and chained - multi-commands. - - :param ctx: Invocation context for this command. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - results = [ - CompletionItem(name, help=command.get_short_help_str()) - for name, command in _complete_visible_commands(ctx, incomplete) - ] - results.extend(super().shell_complete(ctx, incomplete)) - return results - - -class _MultiCommand(Group, metaclass=_FakeSubclassCheck): - """ - .. deprecated:: 8.2 - Will be removed in Click 9.0. Use ``Group`` instead. - """ - - -class CommandCollection(Group): - """A :class:`Group` that looks up subcommands on other groups. If a command - is not found on this group, each registered source is checked in order. - Parameters on a source are not added to this group, and a source's callback - is not invoked when invoking its commands. In other words, this "flattens" - commands in many groups into this one group. - - :param name: The name of the group command. - :param sources: A list of :class:`Group` objects to look up commands from. - :param kwargs: Other arguments passed to :class:`Group`. - - .. versionchanged:: 8.2 - This is a subclass of ``Group``. Commands are looked up first on this - group, then each of its sources. - """ - - def __init__( - self, - name: str | None = None, - sources: list[Group] | None = None, - **kwargs: t.Any, - ) -> None: - super().__init__(name, **kwargs) - #: The list of registered groups. - self.sources: list[Group] = sources or [] - - def add_source(self, group: Group) -> None: - """Add a group as a source of commands.""" - self.sources.append(group) - - def get_command(self, ctx: Context, cmd_name: str) -> Command | None: - rv = super().get_command(ctx, cmd_name) - - if rv is not None: - return rv - - for source in self.sources: - rv = source.get_command(ctx, cmd_name) - - if rv is not None: - if self.chain: - _check_nested_chain(self, cmd_name, rv) - - return rv - - return None - - def list_commands(self, ctx: Context) -> list[str]: - rv: set[str] = set(super().list_commands(ctx)) - - for source in self.sources: - rv.update(source.list_commands(ctx)) - - return sorted(rv) - - -def _check_iter(value: t.Any) -> cabc.Iterator[t.Any]: - """Check if the value is iterable but not a string. Raises a type - error, or return an iterator over the value. - """ - if isinstance(value, str): - raise TypeError - - return iter(value) - - -class Parameter: - r"""A parameter to a command comes in two versions: they are either - :class:`Option`\s or :class:`Argument`\s. Other subclasses are currently - not supported by design as some of the internals for parsing are - intentionally not finalized. - - Some settings are supported by both options and arguments. - - :param param_decls: the parameter declarations for this option or - argument. This is a list of flags or argument - names. - :param type: the type that should be used. Either a :class:`ParamType` - or a Python type. The latter is converted into the former - automatically if supported. - :param required: controls if this is optional or not. - :param default: the default value if omitted. This can also be a callable, - in which case it's invoked when the default is needed - without any arguments. - :param callback: A function to further process or validate the value - after type conversion. It is called as ``f(ctx, param, value)`` - and must return the value. It is called for all sources, - including prompts. - :param nargs: the number of arguments to match. If not ``1`` the return - value is a tuple instead of single value. The default for - nargs is ``1`` (except if the type is a tuple, then it's - the arity of the tuple). If ``nargs=-1``, all remaining - parameters are collected. - :param metavar: how the value is represented in the help page. - :param expose_value: if this is `True` then the value is passed onwards - to the command callback and stored on the context, - otherwise it's skipped. - :param is_eager: eager values are processed before non eager ones. This - should not be set for arguments or it will inverse the - order of processing. - :param envvar: a string or list of strings that are environment variables - that should be checked. - :param shell_complete: A function that returns custom shell - completions. Used instead of the param's type completion if - given. Takes ``ctx, param, incomplete`` and must return a list - of :class:`~click.shell_completion.CompletionItem` or a list of - strings. - :param deprecated: If ``True`` or non-empty string, issues a message - indicating that the argument is deprecated and highlights - its deprecation in --help. The message can be customized - by using a string as the value. A deprecated parameter - cannot be required, a ValueError will be raised otherwise. - - .. versionchanged:: 8.2.0 - Introduction of ``deprecated``. - - .. versionchanged:: 8.2 - Adding duplicate parameter names to a :class:`~click.core.Command` will - result in a ``UserWarning`` being shown. - - .. versionchanged:: 8.2 - Adding duplicate parameter names to a :class:`~click.core.Command` will - result in a ``UserWarning`` being shown. - - .. versionchanged:: 8.0 - ``process_value`` validates required parameters and bounded - ``nargs``, and invokes the parameter callback before returning - the value. This allows the callback to validate prompts. - ``full_process_value`` is removed. - - .. versionchanged:: 8.0 - ``autocompletion`` is renamed to ``shell_complete`` and has new - semantics described above. The old name is deprecated and will - be removed in 8.1, until then it will be wrapped to match the - new requirements. - - .. versionchanged:: 8.0 - For ``multiple=True, nargs>1``, the default must be a list of - tuples. - - .. versionchanged:: 8.0 - Setting a default is no longer required for ``nargs>1``, it will - default to ``None``. ``multiple=True`` or ``nargs=-1`` will - default to ``()``. - - .. versionchanged:: 7.1 - Empty environment variables are ignored rather than taking the - empty string value. This makes it possible for scripts to clear - variables if they can't unset them. - - .. versionchanged:: 2.0 - Changed signature for parameter callback to also be passed the - parameter. The old callback format will still work, but it will - raise a warning to give you a chance to migrate the code easier. - """ - - param_type_name = "parameter" - - def __init__( - self, - param_decls: cabc.Sequence[str] | None = None, - type: types.ParamType | t.Any | None = None, - required: bool = False, - default: t.Any | t.Callable[[], t.Any] | None = None, - callback: t.Callable[[Context, Parameter, t.Any], t.Any] | None = None, - nargs: int | None = None, - multiple: bool = False, - metavar: str | None = None, - expose_value: bool = True, - is_eager: bool = False, - envvar: str | cabc.Sequence[str] | None = None, - shell_complete: t.Callable[ - [Context, Parameter, str], list[CompletionItem] | list[str] - ] - | None = None, - deprecated: bool | str = False, - ) -> None: - self.name: str | None - self.opts: list[str] - self.secondary_opts: list[str] - self.name, self.opts, self.secondary_opts = self._parse_decls( - param_decls or (), expose_value - ) - self.type: types.ParamType = types.convert_type(type, default) - - # Default nargs to what the type tells us if we have that - # information available. - if nargs is None: - if self.type.is_composite: - nargs = self.type.arity - else: - nargs = 1 - - self.required = required - self.callback = callback - self.nargs = nargs - self.multiple = multiple - self.expose_value = expose_value - self.default = default - self.is_eager = is_eager - self.metavar = metavar - self.envvar = envvar - self._custom_shell_complete = shell_complete - self.deprecated = deprecated - - if __debug__: - if self.type.is_composite and nargs != self.type.arity: - raise ValueError( - f"'nargs' must be {self.type.arity} (or None) for" - f" type {self.type!r}, but it was {nargs}." - ) - - # Skip no default or callable default. - check_default = default if not callable(default) else None - - if check_default is not None: - if multiple: - try: - # Only check the first value against nargs. - check_default = next(_check_iter(check_default), None) - except TypeError: - raise ValueError( - "'default' must be a list when 'multiple' is true." - ) from None - - # Can be None for multiple with empty default. - if nargs != 1 and check_default is not None: - try: - _check_iter(check_default) - except TypeError: - if multiple: - message = ( - "'default' must be a list of lists when 'multiple' is" - " true and 'nargs' != 1." - ) - else: - message = "'default' must be a list when 'nargs' != 1." - - raise ValueError(message) from None - - if nargs > 1 and len(check_default) != nargs: - subject = "item length" if multiple else "length" - raise ValueError( - f"'default' {subject} must match nargs={nargs}." - ) - - if required and deprecated: - raise ValueError( - f"The {self.param_type_name} '{self.human_readable_name}' " - "is deprecated and still required. A deprecated " - f"{self.param_type_name} cannot be required." - ) - - def to_info_dict(self) -> dict[str, t.Any]: - """Gather information that could be useful for a tool generating - user-facing documentation. - - Use :meth:`click.Context.to_info_dict` to traverse the entire - CLI structure. - - .. versionadded:: 8.0 - """ - return { - "name": self.name, - "param_type_name": self.param_type_name, - "opts": self.opts, - "secondary_opts": self.secondary_opts, - "type": self.type.to_info_dict(), - "required": self.required, - "nargs": self.nargs, - "multiple": self.multiple, - "default": self.default, - "envvar": self.envvar, - } - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.name}>" - - def _parse_decls( - self, decls: cabc.Sequence[str], expose_value: bool - ) -> tuple[str | None, list[str], list[str]]: - raise NotImplementedError() - - @property - def human_readable_name(self) -> str: - """Returns the human readable name of this parameter. This is the - same as the name for options, but the metavar for arguments. - """ - return self.name # type: ignore - - def make_metavar(self, ctx: Context) -> str: - if self.metavar is not None: - return self.metavar - - metavar = self.type.get_metavar(param=self, ctx=ctx) - - if metavar is None: - metavar = self.type.name.upper() - - if self.nargs != 1: - metavar += "..." - - return metavar - - @t.overload - def get_default( - self, ctx: Context, call: t.Literal[True] = True - ) -> t.Any | None: ... - - @t.overload - def get_default( - self, ctx: Context, call: bool = ... - ) -> t.Any | t.Callable[[], t.Any] | None: ... - - def get_default( - self, ctx: Context, call: bool = True - ) -> t.Any | t.Callable[[], t.Any] | None: - """Get the default for the parameter. Tries - :meth:`Context.lookup_default` first, then the local default. - - :param ctx: Current context. - :param call: If the default is a callable, call it. Disable to - return the callable instead. - - .. versionchanged:: 8.0.2 - Type casting is no longer performed when getting a default. - - .. versionchanged:: 8.0.1 - Type casting can fail in resilient parsing mode. Invalid - defaults will not prevent showing help text. - - .. versionchanged:: 8.0 - Looks at ``ctx.default_map`` first. - - .. versionchanged:: 8.0 - Added the ``call`` parameter. - """ - value = ctx.lookup_default(self.name, call=False) # type: ignore - - if value is None: - value = self.default - - if call and callable(value): - value = value() - - return value - - def add_to_parser(self, parser: _OptionParser, ctx: Context) -> None: - raise NotImplementedError() - - def consume_value( - self, ctx: Context, opts: cabc.Mapping[str, t.Any] - ) -> tuple[t.Any, ParameterSource]: - value = opts.get(self.name) # type: ignore - source = ParameterSource.COMMANDLINE - - if value is None: - value = self.value_from_envvar(ctx) - source = ParameterSource.ENVIRONMENT - - if value is None: - value = ctx.lookup_default(self.name) # type: ignore - source = ParameterSource.DEFAULT_MAP - - if value is None: - value = self.get_default(ctx) - source = ParameterSource.DEFAULT - - return value, source - - def type_cast_value(self, ctx: Context, value: t.Any) -> t.Any: - """Convert and validate a value against the option's - :attr:`type`, :attr:`multiple`, and :attr:`nargs`. - """ - if value is None: - return () if self.multiple or self.nargs == -1 else None - - def check_iter(value: t.Any) -> cabc.Iterator[t.Any]: - try: - return _check_iter(value) - except TypeError: - # This should only happen when passing in args manually, - # the parser should construct an iterable when parsing - # the command line. - raise BadParameter( - _("Value must be an iterable."), ctx=ctx, param=self - ) from None - - if self.nargs == 1 or self.type.is_composite: - - def convert(value: t.Any) -> t.Any: - return self.type(value, param=self, ctx=ctx) - - elif self.nargs == -1: - - def convert(value: t.Any) -> t.Any: # tuple[t.Any, ...] - return tuple(self.type(x, self, ctx) for x in check_iter(value)) - - else: # nargs > 1 - - def convert(value: t.Any) -> t.Any: # tuple[t.Any, ...] - value = tuple(check_iter(value)) - - if len(value) != self.nargs: - raise BadParameter( - ngettext( - "Takes {nargs} values but 1 was given.", - "Takes {nargs} values but {len} were given.", - len(value), - ).format(nargs=self.nargs, len=len(value)), - ctx=ctx, - param=self, - ) - - return tuple(self.type(x, self, ctx) for x in value) - - if self.multiple: - return tuple(convert(x) for x in check_iter(value)) - - return convert(value) - - def value_is_missing(self, value: t.Any) -> bool: - if value is None: - return True - - if (self.nargs != 1 or self.multiple) and value == (): - return True - - return False - - def process_value(self, ctx: Context, value: t.Any) -> t.Any: - value = self.type_cast_value(ctx, value) - - if self.required and self.value_is_missing(value): - raise MissingParameter(ctx=ctx, param=self) - - if self.callback is not None: - value = self.callback(ctx, self, value) - - return value - - def resolve_envvar_value(self, ctx: Context) -> str | None: - if self.envvar is None: - return None - - if isinstance(self.envvar, str): - rv = os.environ.get(self.envvar) - - if rv: - return rv - else: - for envvar in self.envvar: - rv = os.environ.get(envvar) - - if rv: - return rv - - return None - - def value_from_envvar(self, ctx: Context) -> t.Any | None: - rv: t.Any | None = self.resolve_envvar_value(ctx) - - if rv is not None and self.nargs != 1: - rv = self.type.split_envvar_value(rv) - - return rv - - def handle_parse_result( - self, ctx: Context, opts: cabc.Mapping[str, t.Any], args: list[str] - ) -> tuple[t.Any, list[str]]: - with augment_usage_errors(ctx, param=self): - value, source = self.consume_value(ctx, opts) - - if ( - self.deprecated - and value is not None - and source - not in ( - ParameterSource.DEFAULT, - ParameterSource.DEFAULT_MAP, - ) - ): - extra_message = ( - f" {self.deprecated}" if isinstance(self.deprecated, str) else "" - ) - message = _( - "DeprecationWarning: The {param_type} {name!r} is deprecated." - "{extra_message}" - ).format( - param_type=self.param_type_name, - name=self.human_readable_name, - extra_message=extra_message, - ) - echo(style(message, fg="red"), err=True) - - ctx.set_parameter_source(self.name, source) # type: ignore - - try: - value = self.process_value(ctx, value) - except Exception: - if not ctx.resilient_parsing: - raise - - value = None - - if self.expose_value: - ctx.params[self.name] = value # type: ignore - - return value, args - - def get_help_record(self, ctx: Context) -> tuple[str, str] | None: - pass - - def get_usage_pieces(self, ctx: Context) -> list[str]: - return [] - - def get_error_hint(self, ctx: Context) -> str: - """Get a stringified version of the param for use in error messages to - indicate which param caused the error. - """ - hint_list = self.opts or [self.human_readable_name] - return " / ".join(f"'{x}'" for x in hint_list) - - def shell_complete(self, ctx: Context, incomplete: str) -> list[CompletionItem]: - """Return a list of completions for the incomplete value. If a - ``shell_complete`` function was given during init, it is used. - Otherwise, the :attr:`type` - :meth:`~click.types.ParamType.shell_complete` function is used. - - :param ctx: Invocation context for this command. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - if self._custom_shell_complete is not None: - results = self._custom_shell_complete(ctx, self, incomplete) - - if results and isinstance(results[0], str): - from click.shell_completion import CompletionItem - - results = [CompletionItem(c) for c in results] - - return t.cast("list[CompletionItem]", results) - - return self.type.shell_complete(ctx, self, incomplete) - - -class Option(Parameter): - """Options are usually optional values on the command line and - have some extra features that arguments don't have. - - All other parameters are passed onwards to the parameter constructor. - - :param show_default: Show the default value for this option in its - help text. Values are not shown by default, unless - :attr:`Context.show_default` is ``True``. If this value is a - string, it shows that string in parentheses instead of the - actual value. This is particularly useful for dynamic options. - For single option boolean flags, the default remains hidden if - its value is ``False``. - :param show_envvar: Controls if an environment variable should be - shown on the help page and error messages. - Normally, environment variables are not shown. - :param prompt: If set to ``True`` or a non empty string then the - user will be prompted for input. If set to ``True`` the prompt - will be the option name capitalized. A deprecated option cannot be - prompted. - :param confirmation_prompt: Prompt a second time to confirm the - value if it was prompted for. Can be set to a string instead of - ``True`` to customize the message. - :param prompt_required: If set to ``False``, the user will be - prompted for input only when the option was specified as a flag - without a value. - :param hide_input: If this is ``True`` then the input on the prompt - will be hidden from the user. This is useful for password input. - :param is_flag: forces this option to act as a flag. The default is - auto detection. - :param flag_value: which value should be used for this flag if it's - enabled. This is set to a boolean automatically if - the option string contains a slash to mark two options. - :param multiple: if this is set to `True` then the argument is accepted - multiple times and recorded. This is similar to ``nargs`` - in how it works but supports arbitrary number of - arguments. - :param count: this flag makes an option increment an integer. - :param allow_from_autoenv: if this is enabled then the value of this - parameter will be pulled from an environment - variable in case a prefix is defined on the - context. - :param help: the help string. - :param hidden: hide this option from help outputs. - :param attrs: Other command arguments described in :class:`Parameter`. - - .. versionchanged:: 8.2 - ``envvar`` used with ``flag_value`` will always use the ``flag_value``, - previously it would use the value of the environment variable. - - .. versionchanged:: 8.1 - Help text indentation is cleaned here instead of only in the - ``@option`` decorator. - - .. versionchanged:: 8.1 - The ``show_default`` parameter overrides - ``Context.show_default``. - - .. versionchanged:: 8.1 - The default of a single option boolean flag is not shown if the - default value is ``False``. - - .. versionchanged:: 8.0.1 - ``type`` is detected from ``flag_value`` if given. - """ - - param_type_name = "option" - - def __init__( - self, - param_decls: cabc.Sequence[str] | None = None, - show_default: bool | str | None = None, - prompt: bool | str = False, - confirmation_prompt: bool | str = False, - prompt_required: bool = True, - hide_input: bool = False, - is_flag: bool | None = None, - flag_value: t.Any | None = None, - multiple: bool = False, - count: bool = False, - allow_from_autoenv: bool = True, - type: types.ParamType | t.Any | None = None, - help: str | None = None, - hidden: bool = False, - show_choices: bool = True, - show_envvar: bool = False, - deprecated: bool | str = False, - **attrs: t.Any, - ) -> None: - if help: - help = inspect.cleandoc(help) - - default_is_missing = "default" not in attrs - super().__init__( - param_decls, type=type, multiple=multiple, deprecated=deprecated, **attrs - ) - - if prompt is True: - if self.name is None: - raise TypeError("'name' is required with 'prompt=True'.") - - prompt_text: str | None = self.name.replace("_", " ").capitalize() - elif prompt is False: - prompt_text = None - else: - prompt_text = prompt - - if deprecated: - deprecated_message = ( - f"(DEPRECATED: {deprecated})" - if isinstance(deprecated, str) - else "(DEPRECATED)" - ) - help = help + deprecated_message if help is not None else deprecated_message - - self.prompt = prompt_text - self.confirmation_prompt = confirmation_prompt - self.prompt_required = prompt_required - self.hide_input = hide_input - self.hidden = hidden - - # If prompt is enabled but not required, then the option can be - # used as a flag to indicate using prompt or flag_value. - self._flag_needs_value = self.prompt is not None and not self.prompt_required - - if is_flag is None: - if flag_value is not None: - # Implicitly a flag because flag_value was set. - is_flag = True - elif self._flag_needs_value: - # Not a flag, but when used as a flag it shows a prompt. - is_flag = False - else: - # Implicitly a flag because flag options were given. - is_flag = bool(self.secondary_opts) - elif is_flag is False and not self._flag_needs_value: - # Not a flag, and prompt is not enabled, can be used as a - # flag if flag_value is set. - self._flag_needs_value = flag_value is not None - - self.default: t.Any | t.Callable[[], t.Any] - - if is_flag and default_is_missing and not self.required: - if multiple: - self.default = () - else: - self.default = False - - if is_flag and flag_value is None: - flag_value = not self.default - - self.type: types.ParamType - if is_flag and type is None: - # Re-guess the type from the flag value instead of the - # default. - self.type = types.convert_type(None, flag_value) - - self.is_flag: bool = is_flag - self.is_bool_flag: bool = is_flag and isinstance(self.type, types.BoolParamType) - self.flag_value: t.Any = flag_value - - # Counting - self.count = count - if count: - if type is None: - self.type = types.IntRange(min=0) - if default_is_missing: - self.default = 0 - - self.allow_from_autoenv = allow_from_autoenv - self.help = help - self.show_default = show_default - self.show_choices = show_choices - self.show_envvar = show_envvar - - if __debug__: - if deprecated and prompt: - raise ValueError("`deprecated` options cannot use `prompt`.") - - if self.nargs == -1: - raise TypeError("nargs=-1 is not supported for options.") - - if self.prompt and self.is_flag and not self.is_bool_flag: - raise TypeError("'prompt' is not valid for non-boolean flag.") - - if not self.is_bool_flag and self.secondary_opts: - raise TypeError("Secondary flag is not valid for non-boolean flag.") - - if self.is_bool_flag and self.hide_input and self.prompt is not None: - raise TypeError( - "'prompt' with 'hide_input' is not valid for boolean flag." - ) - - if self.count: - if self.multiple: - raise TypeError("'count' is not valid with 'multiple'.") - - if self.is_flag: - raise TypeError("'count' is not valid with 'is_flag'.") - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict.update( - help=self.help, - prompt=self.prompt, - is_flag=self.is_flag, - flag_value=self.flag_value, - count=self.count, - hidden=self.hidden, - ) - return info_dict - - def get_error_hint(self, ctx: Context) -> str: - result = super().get_error_hint(ctx) - if self.show_envvar: - result += f" (env var: '{self.envvar}')" - return result - - def _parse_decls( - self, decls: cabc.Sequence[str], expose_value: bool - ) -> tuple[str | None, list[str], list[str]]: - opts = [] - secondary_opts = [] - name = None - possible_names = [] - - for decl in decls: - if decl.isidentifier(): - if name is not None: - raise TypeError(f"Name '{name}' defined twice") - name = decl - else: - split_char = ";" if decl[:1] == "/" else "/" - if split_char in decl: - first, second = decl.split(split_char, 1) - first = first.rstrip() - if first: - possible_names.append(_split_opt(first)) - opts.append(first) - second = second.lstrip() - if second: - secondary_opts.append(second.lstrip()) - if first == second: - raise ValueError( - f"Boolean option {decl!r} cannot use the" - " same flag for true/false." - ) - else: - possible_names.append(_split_opt(decl)) - opts.append(decl) - - if name is None and possible_names: - possible_names.sort(key=lambda x: -len(x[0])) # group long options first - name = possible_names[0][1].replace("-", "_").lower() - if not name.isidentifier(): - name = None - - if name is None: - if not expose_value: - return None, opts, secondary_opts - raise TypeError( - f"Could not determine name for option with declarations {decls!r}" - ) - - if not opts and not secondary_opts: - raise TypeError( - f"No options defined but a name was passed ({name})." - " Did you mean to declare an argument instead? Did" - f" you mean to pass '--{name}'?" - ) - - return name, opts, secondary_opts - - def add_to_parser(self, parser: _OptionParser, ctx: Context) -> None: - if self.multiple: - action = "append" - elif self.count: - action = "count" - else: - action = "store" - - if self.is_flag: - action = f"{action}_const" - - if self.is_bool_flag and self.secondary_opts: - parser.add_option( - obj=self, opts=self.opts, dest=self.name, action=action, const=True - ) - parser.add_option( - obj=self, - opts=self.secondary_opts, - dest=self.name, - action=action, - const=False, - ) - else: - parser.add_option( - obj=self, - opts=self.opts, - dest=self.name, - action=action, - const=self.flag_value, - ) - else: - parser.add_option( - obj=self, - opts=self.opts, - dest=self.name, - action=action, - nargs=self.nargs, - ) - - def get_help_record(self, ctx: Context) -> tuple[str, str] | None: - if self.hidden: - return None - - any_prefix_is_slash = False - - def _write_opts(opts: cabc.Sequence[str]) -> str: - nonlocal any_prefix_is_slash - - rv, any_slashes = join_options(opts) - - if any_slashes: - any_prefix_is_slash = True - - if not self.is_flag and not self.count: - rv += f" {self.make_metavar(ctx=ctx)}" - - return rv - - rv = [_write_opts(self.opts)] - - if self.secondary_opts: - rv.append(_write_opts(self.secondary_opts)) - - help = self.help or "" - - extra = self.get_help_extra(ctx) - extra_items = [] - if "envvars" in extra: - extra_items.append( - _("env var: {var}").format(var=", ".join(extra["envvars"])) - ) - if "default" in extra: - extra_items.append(_("default: {default}").format(default=extra["default"])) - if "range" in extra: - extra_items.append(extra["range"]) - if "required" in extra: - extra_items.append(_(extra["required"])) - - if extra_items: - extra_str = "; ".join(extra_items) - help = f"{help} [{extra_str}]" if help else f"[{extra_str}]" - - return ("; " if any_prefix_is_slash else " / ").join(rv), help - - def get_help_extra(self, ctx: Context) -> types.OptionHelpExtra: - extra: types.OptionHelpExtra = {} - - if self.show_envvar: - envvar = self.envvar - - if envvar is None: - if ( - self.allow_from_autoenv - and ctx.auto_envvar_prefix is not None - and self.name is not None - ): - envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" - - if envvar is not None: - if isinstance(envvar, str): - extra["envvars"] = (envvar,) - else: - extra["envvars"] = tuple(str(d) for d in envvar) - - # Temporarily enable resilient parsing to avoid type casting - # failing for the default. Might be possible to extend this to - # help formatting in general. - resilient = ctx.resilient_parsing - ctx.resilient_parsing = True - - try: - default_value = self.get_default(ctx, call=False) - finally: - ctx.resilient_parsing = resilient - - show_default = False - show_default_is_str = False - - if self.show_default is not None: - if isinstance(self.show_default, str): - show_default_is_str = show_default = True - else: - show_default = self.show_default - elif ctx.show_default is not None: - show_default = ctx.show_default - - if show_default_is_str or (show_default and (default_value is not None)): - if show_default_is_str: - default_string = f"({self.show_default})" - elif isinstance(default_value, (list, tuple)): - default_string = ", ".join(str(d) for d in default_value) - elif inspect.isfunction(default_value): - default_string = _("(dynamic)") - elif self.is_bool_flag and self.secondary_opts: - # For boolean flags that have distinct True/False opts, - # use the opt without prefix instead of the value. - default_string = _split_opt( - (self.opts if default_value else self.secondary_opts)[0] - )[1] - elif self.is_bool_flag and not self.secondary_opts and not default_value: - default_string = "" - elif default_value == "": - default_string = '""' - else: - default_string = str(default_value) - - if default_string: - extra["default"] = default_string - - if ( - isinstance(self.type, types._NumberRangeBase) - # skip count with default range type - and not (self.count and self.type.min == 0 and self.type.max is None) - ): - range_str = self.type._describe_range() - - if range_str: - extra["range"] = range_str - - if self.required: - extra["required"] = "required" - - return extra - - @t.overload - def get_default( - self, ctx: Context, call: t.Literal[True] = True - ) -> t.Any | None: ... - - @t.overload - def get_default( - self, ctx: Context, call: bool = ... - ) -> t.Any | t.Callable[[], t.Any] | None: ... - - def get_default( - self, ctx: Context, call: bool = True - ) -> t.Any | t.Callable[[], t.Any] | None: - # If we're a non boolean flag our default is more complex because - # we need to look at all flags in the same group to figure out - # if we're the default one in which case we return the flag - # value as default. - if self.is_flag and not self.is_bool_flag: - for param in ctx.command.params: - if param.name == self.name and param.default: - return t.cast(Option, param).flag_value - - return None - - return super().get_default(ctx, call=call) - - def prompt_for_value(self, ctx: Context) -> t.Any: - """This is an alternative flow that can be activated in the full - value processing if a value does not exist. It will prompt the - user until a valid value exists and then returns the processed - value as result. - """ - assert self.prompt is not None - - # Calculate the default before prompting anything to be stable. - default = self.get_default(ctx) - - # If this is a prompt for a flag we need to handle this - # differently. - if self.is_bool_flag: - return confirm(self.prompt, default) - - # If show_default is set to True/False, provide this to `prompt` as well. For - # non-bool values of `show_default`, we use `prompt`'s default behavior - prompt_kwargs: t.Any = {} - if isinstance(self.show_default, bool): - prompt_kwargs["show_default"] = self.show_default - - return prompt( - self.prompt, - default=default, - type=self.type, - hide_input=self.hide_input, - show_choices=self.show_choices, - confirmation_prompt=self.confirmation_prompt, - value_proc=lambda x: self.process_value(ctx, x), - **prompt_kwargs, - ) - - def resolve_envvar_value(self, ctx: Context) -> str | None: - rv = super().resolve_envvar_value(ctx) - - if rv is not None: - if self.is_flag and self.flag_value: - return str(self.flag_value) - return rv - - if ( - self.allow_from_autoenv - and ctx.auto_envvar_prefix is not None - and self.name is not None - ): - envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" - rv = os.environ.get(envvar) - - if rv: - return rv - - return None - - def value_from_envvar(self, ctx: Context) -> t.Any | None: - rv: t.Any | None = self.resolve_envvar_value(ctx) - - if rv is None: - return None - - value_depth = (self.nargs != 1) + bool(self.multiple) - - if value_depth > 0: - rv = self.type.split_envvar_value(rv) - - if self.multiple and self.nargs != 1: - rv = batch(rv, self.nargs) - - return rv - - def consume_value( - self, ctx: Context, opts: cabc.Mapping[str, Parameter] - ) -> tuple[t.Any, ParameterSource]: - value, source = super().consume_value(ctx, opts) - - # The parser will emit a sentinel value if the option can be - # given as a flag without a value. This is different from None - # to distinguish from the flag not being given at all. - if value is _flag_needs_value: - if self.prompt is not None and not ctx.resilient_parsing: - value = self.prompt_for_value(ctx) - source = ParameterSource.PROMPT - else: - value = self.flag_value - source = ParameterSource.COMMANDLINE - - elif ( - self.multiple - and value is not None - and any(v is _flag_needs_value for v in value) - ): - value = [self.flag_value if v is _flag_needs_value else v for v in value] - source = ParameterSource.COMMANDLINE - - # The value wasn't set, or used the param's default, prompt if - # prompting is enabled. - elif ( - source in {None, ParameterSource.DEFAULT} - and self.prompt is not None - and (self.required or self.prompt_required) - and not ctx.resilient_parsing - ): - value = self.prompt_for_value(ctx) - source = ParameterSource.PROMPT - - return value, source - - -class Argument(Parameter): - """Arguments are positional parameters to a command. They generally - provide fewer features than options but can have infinite ``nargs`` - and are required by default. - - All parameters are passed onwards to the constructor of :class:`Parameter`. - """ - - param_type_name = "argument" - - def __init__( - self, - param_decls: cabc.Sequence[str], - required: bool | None = None, - **attrs: t.Any, - ) -> None: - if required is None: - if attrs.get("default") is not None: - required = False - else: - required = attrs.get("nargs", 1) > 0 - - if "multiple" in attrs: - raise TypeError("__init__() got an unexpected keyword argument 'multiple'.") - - super().__init__(param_decls, required=required, **attrs) - - if __debug__: - if self.default is not None and self.nargs == -1: - raise TypeError("'default' is not supported for nargs=-1.") - - @property - def human_readable_name(self) -> str: - if self.metavar is not None: - return self.metavar - return self.name.upper() # type: ignore - - def make_metavar(self, ctx: Context) -> str: - if self.metavar is not None: - return self.metavar - var = self.type.get_metavar(param=self, ctx=ctx) - if not var: - var = self.name.upper() # type: ignore - if self.deprecated: - var += "!" - if not self.required: - var = f"[{var}]" - if self.nargs != 1: - var += "..." - return var - - def _parse_decls( - self, decls: cabc.Sequence[str], expose_value: bool - ) -> tuple[str | None, list[str], list[str]]: - if not decls: - if not expose_value: - return None, [], [] - raise TypeError("Argument is marked as exposed, but does not have a name.") - if len(decls) == 1: - name = arg = decls[0] - name = name.replace("-", "_").lower() - else: - raise TypeError( - "Arguments take exactly one parameter declaration, got" - f" {len(decls)}: {decls}." - ) - return name, [arg], [] - - def get_usage_pieces(self, ctx: Context) -> list[str]: - return [self.make_metavar(ctx)] - - def get_error_hint(self, ctx: Context) -> str: - return f"'{self.make_metavar(ctx)}'" - - def add_to_parser(self, parser: _OptionParser, ctx: Context) -> None: - parser.add_argument(dest=self.name, nargs=self.nargs, obj=self) - - -def __getattr__(name: str) -> object: - import warnings - - if name == "BaseCommand": - warnings.warn( - "'BaseCommand' is deprecated and will be removed in Click 9.0. Use" - " 'Command' instead.", - DeprecationWarning, - stacklevel=2, - ) - return _BaseCommand - - if name == "MultiCommand": - warnings.warn( - "'MultiCommand' is deprecated and will be removed in Click 9.0. Use" - " 'Group' instead.", - DeprecationWarning, - stacklevel=2, - ) - return _MultiCommand - - raise AttributeError(name) diff --git a/write-message/venv/lib/python3.10/site-packages/click/decorators.py b/write-message/venv/lib/python3.10/site-packages/click/decorators.py deleted file mode 100644 index 21f4c34..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/decorators.py +++ /dev/null @@ -1,551 +0,0 @@ -from __future__ import annotations - -import inspect -import typing as t -from functools import update_wrapper -from gettext import gettext as _ - -from .core import Argument -from .core import Command -from .core import Context -from .core import Group -from .core import Option -from .core import Parameter -from .globals import get_current_context -from .utils import echo - -if t.TYPE_CHECKING: - import typing_extensions as te - - P = te.ParamSpec("P") - -R = t.TypeVar("R") -T = t.TypeVar("T") -_AnyCallable = t.Callable[..., t.Any] -FC = t.TypeVar("FC", bound="_AnyCallable | Command") - - -def pass_context(f: t.Callable[te.Concatenate[Context, P], R]) -> t.Callable[P, R]: - """Marks a callback as wanting to receive the current context - object as first argument. - """ - - def new_func(*args: P.args, **kwargs: P.kwargs) -> R: - return f(get_current_context(), *args, **kwargs) - - return update_wrapper(new_func, f) - - -def pass_obj(f: t.Callable[te.Concatenate[T, P], R]) -> t.Callable[P, R]: - """Similar to :func:`pass_context`, but only pass the object on the - context onwards (:attr:`Context.obj`). This is useful if that object - represents the state of a nested system. - """ - - def new_func(*args: P.args, **kwargs: P.kwargs) -> R: - return f(get_current_context().obj, *args, **kwargs) - - return update_wrapper(new_func, f) - - -def make_pass_decorator( - object_type: type[T], ensure: bool = False -) -> t.Callable[[t.Callable[te.Concatenate[T, P], R]], t.Callable[P, R]]: - """Given an object type this creates a decorator that will work - similar to :func:`pass_obj` but instead of passing the object of the - current context, it will find the innermost context of type - :func:`object_type`. - - This generates a decorator that works roughly like this:: - - from functools import update_wrapper - - def decorator(f): - @pass_context - def new_func(ctx, *args, **kwargs): - obj = ctx.find_object(object_type) - return ctx.invoke(f, obj, *args, **kwargs) - return update_wrapper(new_func, f) - return decorator - - :param object_type: the type of the object to pass. - :param ensure: if set to `True`, a new object will be created and - remembered on the context if it's not there yet. - """ - - def decorator(f: t.Callable[te.Concatenate[T, P], R]) -> t.Callable[P, R]: - def new_func(*args: P.args, **kwargs: P.kwargs) -> R: - ctx = get_current_context() - - obj: T | None - if ensure: - obj = ctx.ensure_object(object_type) - else: - obj = ctx.find_object(object_type) - - if obj is None: - raise RuntimeError( - "Managed to invoke callback without a context" - f" object of type {object_type.__name__!r}" - " existing." - ) - - return ctx.invoke(f, obj, *args, **kwargs) - - return update_wrapper(new_func, f) - - return decorator - - -def pass_meta_key( - key: str, *, doc_description: str | None = None -) -> t.Callable[[t.Callable[te.Concatenate[T, P], R]], t.Callable[P, R]]: - """Create a decorator that passes a key from - :attr:`click.Context.meta` as the first argument to the decorated - function. - - :param key: Key in ``Context.meta`` to pass. - :param doc_description: Description of the object being passed, - inserted into the decorator's docstring. Defaults to "the 'key' - key from Context.meta". - - .. versionadded:: 8.0 - """ - - def decorator(f: t.Callable[te.Concatenate[T, P], R]) -> t.Callable[P, R]: - def new_func(*args: P.args, **kwargs: P.kwargs) -> R: - ctx = get_current_context() - obj = ctx.meta[key] - return ctx.invoke(f, obj, *args, **kwargs) - - return update_wrapper(new_func, f) - - if doc_description is None: - doc_description = f"the {key!r} key from :attr:`click.Context.meta`" - - decorator.__doc__ = ( - f"Decorator that passes {doc_description} as the first argument" - " to the decorated function." - ) - return decorator - - -CmdType = t.TypeVar("CmdType", bound=Command) - - -# variant: no call, directly as decorator for a function. -@t.overload -def command(name: _AnyCallable) -> Command: ... - - -# variant: with positional name and with positional or keyword cls argument: -# @command(namearg, CommandCls, ...) or @command(namearg, cls=CommandCls, ...) -@t.overload -def command( - name: str | None, - cls: type[CmdType], - **attrs: t.Any, -) -> t.Callable[[_AnyCallable], CmdType]: ... - - -# variant: name omitted, cls _must_ be a keyword argument, @command(cls=CommandCls, ...) -@t.overload -def command( - name: None = None, - *, - cls: type[CmdType], - **attrs: t.Any, -) -> t.Callable[[_AnyCallable], CmdType]: ... - - -# variant: with optional string name, no cls argument provided. -@t.overload -def command( - name: str | None = ..., cls: None = None, **attrs: t.Any -) -> t.Callable[[_AnyCallable], Command]: ... - - -def command( - name: str | _AnyCallable | None = None, - cls: type[CmdType] | None = None, - **attrs: t.Any, -) -> Command | t.Callable[[_AnyCallable], Command | CmdType]: - r"""Creates a new :class:`Command` and uses the decorated function as - callback. This will also automatically attach all decorated - :func:`option`\s and :func:`argument`\s as parameters to the command. - - The name of the command defaults to the name of the function, converted to - lowercase, with underscores ``_`` replaced by dashes ``-``, and the suffixes - ``_command``, ``_cmd``, ``_group``, and ``_grp`` are removed. For example, - ``init_data_command`` becomes ``init-data``. - - All keyword arguments are forwarded to the underlying command class. - For the ``params`` argument, any decorated params are appended to - the end of the list. - - Once decorated the function turns into a :class:`Command` instance - that can be invoked as a command line utility or be attached to a - command :class:`Group`. - - :param name: The name of the command. Defaults to modifying the function's - name as described above. - :param cls: The command class to create. Defaults to :class:`Command`. - - .. versionchanged:: 8.2 - The suffixes ``_command``, ``_cmd``, ``_group``, and ``_grp`` are - removed when generating the name. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - - .. versionchanged:: 8.1 - The ``params`` argument can be used. Decorated params are - appended to the end of the list. - """ - - func: t.Callable[[_AnyCallable], t.Any] | None = None - - if callable(name): - func = name - name = None - assert cls is None, "Use 'command(cls=cls)(callable)' to specify a class." - assert not attrs, "Use 'command(**kwargs)(callable)' to provide arguments." - - if cls is None: - cls = t.cast("type[CmdType]", Command) - - def decorator(f: _AnyCallable) -> CmdType: - if isinstance(f, Command): - raise TypeError("Attempted to convert a callback into a command twice.") - - attr_params = attrs.pop("params", None) - params = attr_params if attr_params is not None else [] - - try: - decorator_params = f.__click_params__ # type: ignore - except AttributeError: - pass - else: - del f.__click_params__ # type: ignore - params.extend(reversed(decorator_params)) - - if attrs.get("help") is None: - attrs["help"] = f.__doc__ - - if t.TYPE_CHECKING: - assert cls is not None - assert not callable(name) - - if name is not None: - cmd_name = name - else: - cmd_name = f.__name__.lower().replace("_", "-") - cmd_left, sep, suffix = cmd_name.rpartition("-") - - if sep and suffix in {"command", "cmd", "group", "grp"}: - cmd_name = cmd_left - - cmd = cls(name=cmd_name, callback=f, params=params, **attrs) - cmd.__doc__ = f.__doc__ - return cmd - - if func is not None: - return decorator(func) - - return decorator - - -GrpType = t.TypeVar("GrpType", bound=Group) - - -# variant: no call, directly as decorator for a function. -@t.overload -def group(name: _AnyCallable) -> Group: ... - - -# variant: with positional name and with positional or keyword cls argument: -# @group(namearg, GroupCls, ...) or @group(namearg, cls=GroupCls, ...) -@t.overload -def group( - name: str | None, - cls: type[GrpType], - **attrs: t.Any, -) -> t.Callable[[_AnyCallable], GrpType]: ... - - -# variant: name omitted, cls _must_ be a keyword argument, @group(cmd=GroupCls, ...) -@t.overload -def group( - name: None = None, - *, - cls: type[GrpType], - **attrs: t.Any, -) -> t.Callable[[_AnyCallable], GrpType]: ... - - -# variant: with optional string name, no cls argument provided. -@t.overload -def group( - name: str | None = ..., cls: None = None, **attrs: t.Any -) -> t.Callable[[_AnyCallable], Group]: ... - - -def group( - name: str | _AnyCallable | None = None, - cls: type[GrpType] | None = None, - **attrs: t.Any, -) -> Group | t.Callable[[_AnyCallable], Group | GrpType]: - """Creates a new :class:`Group` with a function as callback. This - works otherwise the same as :func:`command` just that the `cls` - parameter is set to :class:`Group`. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - """ - if cls is None: - cls = t.cast("type[GrpType]", Group) - - if callable(name): - return command(cls=cls, **attrs)(name) - - return command(name, cls, **attrs) - - -def _param_memo(f: t.Callable[..., t.Any], param: Parameter) -> None: - if isinstance(f, Command): - f.params.append(param) - else: - if not hasattr(f, "__click_params__"): - f.__click_params__ = [] # type: ignore - - f.__click_params__.append(param) # type: ignore - - -def argument( - *param_decls: str, cls: type[Argument] | None = None, **attrs: t.Any -) -> t.Callable[[FC], FC]: - """Attaches an argument to the command. All positional arguments are - passed as parameter declarations to :class:`Argument`; all keyword - arguments are forwarded unchanged (except ``cls``). - This is equivalent to creating an :class:`Argument` instance manually - and attaching it to the :attr:`Command.params` list. - - For the default argument class, refer to :class:`Argument` and - :class:`Parameter` for descriptions of parameters. - - :param cls: the argument class to instantiate. This defaults to - :class:`Argument`. - :param param_decls: Passed as positional arguments to the constructor of - ``cls``. - :param attrs: Passed as keyword arguments to the constructor of ``cls``. - """ - if cls is None: - cls = Argument - - def decorator(f: FC) -> FC: - _param_memo(f, cls(param_decls, **attrs)) - return f - - return decorator - - -def option( - *param_decls: str, cls: type[Option] | None = None, **attrs: t.Any -) -> t.Callable[[FC], FC]: - """Attaches an option to the command. All positional arguments are - passed as parameter declarations to :class:`Option`; all keyword - arguments are forwarded unchanged (except ``cls``). - This is equivalent to creating an :class:`Option` instance manually - and attaching it to the :attr:`Command.params` list. - - For the default option class, refer to :class:`Option` and - :class:`Parameter` for descriptions of parameters. - - :param cls: the option class to instantiate. This defaults to - :class:`Option`. - :param param_decls: Passed as positional arguments to the constructor of - ``cls``. - :param attrs: Passed as keyword arguments to the constructor of ``cls``. - """ - if cls is None: - cls = Option - - def decorator(f: FC) -> FC: - _param_memo(f, cls(param_decls, **attrs)) - return f - - return decorator - - -def confirmation_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: - """Add a ``--yes`` option which shows a prompt before continuing if - not passed. If the prompt is declined, the program will exit. - - :param param_decls: One or more option names. Defaults to the single - value ``"--yes"``. - :param kwargs: Extra arguments are passed to :func:`option`. - """ - - def callback(ctx: Context, param: Parameter, value: bool) -> None: - if not value: - ctx.abort() - - if not param_decls: - param_decls = ("--yes",) - - kwargs.setdefault("is_flag", True) - kwargs.setdefault("callback", callback) - kwargs.setdefault("expose_value", False) - kwargs.setdefault("prompt", "Do you want to continue?") - kwargs.setdefault("help", "Confirm the action without prompting.") - return option(*param_decls, **kwargs) - - -def password_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: - """Add a ``--password`` option which prompts for a password, hiding - input and asking to enter the value again for confirmation. - - :param param_decls: One or more option names. Defaults to the single - value ``"--password"``. - :param kwargs: Extra arguments are passed to :func:`option`. - """ - if not param_decls: - param_decls = ("--password",) - - kwargs.setdefault("prompt", True) - kwargs.setdefault("confirmation_prompt", True) - kwargs.setdefault("hide_input", True) - return option(*param_decls, **kwargs) - - -def version_option( - version: str | None = None, - *param_decls: str, - package_name: str | None = None, - prog_name: str | None = None, - message: str | None = None, - **kwargs: t.Any, -) -> t.Callable[[FC], FC]: - """Add a ``--version`` option which immediately prints the version - number and exits the program. - - If ``version`` is not provided, Click will try to detect it using - :func:`importlib.metadata.version` to get the version for the - ``package_name``. - - If ``package_name`` is not provided, Click will try to detect it by - inspecting the stack frames. This will be used to detect the - version, so it must match the name of the installed package. - - :param version: The version number to show. If not provided, Click - will try to detect it. - :param param_decls: One or more option names. Defaults to the single - value ``"--version"``. - :param package_name: The package name to detect the version from. If - not provided, Click will try to detect it. - :param prog_name: The name of the CLI to show in the message. If not - provided, it will be detected from the command. - :param message: The message to show. The values ``%(prog)s``, - ``%(package)s``, and ``%(version)s`` are available. Defaults to - ``"%(prog)s, version %(version)s"``. - :param kwargs: Extra arguments are passed to :func:`option`. - :raise RuntimeError: ``version`` could not be detected. - - .. versionchanged:: 8.0 - Add the ``package_name`` parameter, and the ``%(package)s`` - value for messages. - - .. versionchanged:: 8.0 - Use :mod:`importlib.metadata` instead of ``pkg_resources``. The - version is detected based on the package name, not the entry - point name. The Python package name must match the installed - package name, or be passed with ``package_name=``. - """ - if message is None: - message = _("%(prog)s, version %(version)s") - - if version is None and package_name is None: - frame = inspect.currentframe() - f_back = frame.f_back if frame is not None else None - f_globals = f_back.f_globals if f_back is not None else None - # break reference cycle - # https://docs.python.org/3/library/inspect.html#the-interpreter-stack - del frame - - if f_globals is not None: - package_name = f_globals.get("__name__") - - if package_name == "__main__": - package_name = f_globals.get("__package__") - - if package_name: - package_name = package_name.partition(".")[0] - - def callback(ctx: Context, param: Parameter, value: bool) -> None: - if not value or ctx.resilient_parsing: - return - - nonlocal prog_name - nonlocal version - - if prog_name is None: - prog_name = ctx.find_root().info_name - - if version is None and package_name is not None: - import importlib.metadata - - try: - version = importlib.metadata.version(package_name) - except importlib.metadata.PackageNotFoundError: - raise RuntimeError( - f"{package_name!r} is not installed. Try passing" - " 'package_name' instead." - ) from None - - if version is None: - raise RuntimeError( - f"Could not determine the version for {package_name!r} automatically." - ) - - echo( - message % {"prog": prog_name, "package": package_name, "version": version}, - color=ctx.color, - ) - ctx.exit() - - if not param_decls: - param_decls = ("--version",) - - kwargs.setdefault("is_flag", True) - kwargs.setdefault("expose_value", False) - kwargs.setdefault("is_eager", True) - kwargs.setdefault("help", _("Show the version and exit.")) - kwargs["callback"] = callback - return option(*param_decls, **kwargs) - - -def help_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: - """Pre-configured ``--help`` option which immediately prints the help page - and exits the program. - - :param param_decls: One or more option names. Defaults to the single - value ``"--help"``. - :param kwargs: Extra arguments are passed to :func:`option`. - """ - - def show_help(ctx: Context, param: Parameter, value: bool) -> None: - """Callback that print the help page on ```` and exits.""" - if value and not ctx.resilient_parsing: - echo(ctx.get_help(), color=ctx.color) - ctx.exit() - - if not param_decls: - param_decls = ("--help",) - - kwargs.setdefault("is_flag", True) - kwargs.setdefault("expose_value", False) - kwargs.setdefault("is_eager", True) - kwargs.setdefault("help", _("Show this message and exit.")) - kwargs.setdefault("callback", show_help) - - return option(*param_decls, **kwargs) diff --git a/write-message/venv/lib/python3.10/site-packages/click/exceptions.py b/write-message/venv/lib/python3.10/site-packages/click/exceptions.py deleted file mode 100644 index f141a83..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/exceptions.py +++ /dev/null @@ -1,308 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import typing as t -from gettext import gettext as _ -from gettext import ngettext - -from ._compat import get_text_stderr -from .globals import resolve_color_default -from .utils import echo -from .utils import format_filename - -if t.TYPE_CHECKING: - from .core import Command - from .core import Context - from .core import Parameter - - -def _join_param_hints(param_hint: cabc.Sequence[str] | str | None) -> str | None: - if param_hint is not None and not isinstance(param_hint, str): - return " / ".join(repr(x) for x in param_hint) - - return param_hint - - -class ClickException(Exception): - """An exception that Click can handle and show to the user.""" - - #: The exit code for this exception. - exit_code = 1 - - def __init__(self, message: str) -> None: - super().__init__(message) - # The context will be removed by the time we print the message, so cache - # the color settings here to be used later on (in `show`) - self.show_color: bool | None = resolve_color_default() - self.message = message - - def format_message(self) -> str: - return self.message - - def __str__(self) -> str: - return self.message - - def show(self, file: t.IO[t.Any] | None = None) -> None: - if file is None: - file = get_text_stderr() - - echo( - _("Error: {message}").format(message=self.format_message()), - file=file, - color=self.show_color, - ) - - -class UsageError(ClickException): - """An internal exception that signals a usage error. This typically - aborts any further handling. - - :param message: the error message to display. - :param ctx: optionally the context that caused this error. Click will - fill in the context automatically in some situations. - """ - - exit_code = 2 - - def __init__(self, message: str, ctx: Context | None = None) -> None: - super().__init__(message) - self.ctx = ctx - self.cmd: Command | None = self.ctx.command if self.ctx else None - - def show(self, file: t.IO[t.Any] | None = None) -> None: - if file is None: - file = get_text_stderr() - color = None - hint = "" - if ( - self.ctx is not None - and self.ctx.command.get_help_option(self.ctx) is not None - ): - hint = _("Try '{command} {option}' for help.").format( - command=self.ctx.command_path, option=self.ctx.help_option_names[0] - ) - hint = f"{hint}\n" - if self.ctx is not None: - color = self.ctx.color - echo(f"{self.ctx.get_usage()}\n{hint}", file=file, color=color) - echo( - _("Error: {message}").format(message=self.format_message()), - file=file, - color=color, - ) - - -class BadParameter(UsageError): - """An exception that formats out a standardized error message for a - bad parameter. This is useful when thrown from a callback or type as - Click will attach contextual information to it (for instance, which - parameter it is). - - .. versionadded:: 2.0 - - :param param: the parameter object that caused this error. This can - be left out, and Click will attach this info itself - if possible. - :param param_hint: a string that shows up as parameter name. This - can be used as alternative to `param` in cases - where custom validation should happen. If it is - a string it's used as such, if it's a list then - each item is quoted and separated. - """ - - def __init__( - self, - message: str, - ctx: Context | None = None, - param: Parameter | None = None, - param_hint: str | None = None, - ) -> None: - super().__init__(message, ctx) - self.param = param - self.param_hint = param_hint - - def format_message(self) -> str: - if self.param_hint is not None: - param_hint = self.param_hint - elif self.param is not None: - param_hint = self.param.get_error_hint(self.ctx) # type: ignore - else: - return _("Invalid value: {message}").format(message=self.message) - - return _("Invalid value for {param_hint}: {message}").format( - param_hint=_join_param_hints(param_hint), message=self.message - ) - - -class MissingParameter(BadParameter): - """Raised if click required an option or argument but it was not - provided when invoking the script. - - .. versionadded:: 4.0 - - :param param_type: a string that indicates the type of the parameter. - The default is to inherit the parameter type from - the given `param`. Valid values are ``'parameter'``, - ``'option'`` or ``'argument'``. - """ - - def __init__( - self, - message: str | None = None, - ctx: Context | None = None, - param: Parameter | None = None, - param_hint: str | None = None, - param_type: str | None = None, - ) -> None: - super().__init__(message or "", ctx, param, param_hint) - self.param_type = param_type - - def format_message(self) -> str: - if self.param_hint is not None: - param_hint: str | None = self.param_hint - elif self.param is not None: - param_hint = self.param.get_error_hint(self.ctx) # type: ignore - else: - param_hint = None - - param_hint = _join_param_hints(param_hint) - param_hint = f" {param_hint}" if param_hint else "" - - param_type = self.param_type - if param_type is None and self.param is not None: - param_type = self.param.param_type_name - - msg = self.message - if self.param is not None: - msg_extra = self.param.type.get_missing_message( - param=self.param, ctx=self.ctx - ) - if msg_extra: - if msg: - msg += f". {msg_extra}" - else: - msg = msg_extra - - msg = f" {msg}" if msg else "" - - # Translate param_type for known types. - if param_type == "argument": - missing = _("Missing argument") - elif param_type == "option": - missing = _("Missing option") - elif param_type == "parameter": - missing = _("Missing parameter") - else: - missing = _("Missing {param_type}").format(param_type=param_type) - - return f"{missing}{param_hint}.{msg}" - - def __str__(self) -> str: - if not self.message: - param_name = self.param.name if self.param else None - return _("Missing parameter: {param_name}").format(param_name=param_name) - else: - return self.message - - -class NoSuchOption(UsageError): - """Raised if click attempted to handle an option that does not - exist. - - .. versionadded:: 4.0 - """ - - def __init__( - self, - option_name: str, - message: str | None = None, - possibilities: cabc.Sequence[str] | None = None, - ctx: Context | None = None, - ) -> None: - if message is None: - message = _("No such option: {name}").format(name=option_name) - - super().__init__(message, ctx) - self.option_name = option_name - self.possibilities = possibilities - - def format_message(self) -> str: - if not self.possibilities: - return self.message - - possibility_str = ", ".join(sorted(self.possibilities)) - suggest = ngettext( - "Did you mean {possibility}?", - "(Possible options: {possibilities})", - len(self.possibilities), - ).format(possibility=possibility_str, possibilities=possibility_str) - return f"{self.message} {suggest}" - - -class BadOptionUsage(UsageError): - """Raised if an option is generally supplied but the use of the option - was incorrect. This is for instance raised if the number of arguments - for an option is not correct. - - .. versionadded:: 4.0 - - :param option_name: the name of the option being used incorrectly. - """ - - def __init__( - self, option_name: str, message: str, ctx: Context | None = None - ) -> None: - super().__init__(message, ctx) - self.option_name = option_name - - -class BadArgumentUsage(UsageError): - """Raised if an argument is generally supplied but the use of the argument - was incorrect. This is for instance raised if the number of values - for an argument is not correct. - - .. versionadded:: 6.0 - """ - - -class NoArgsIsHelpError(UsageError): - def __init__(self, ctx: Context) -> None: - self.ctx: Context - super().__init__(ctx.get_help(), ctx=ctx) - - def show(self, file: t.IO[t.Any] | None = None) -> None: - echo(self.format_message(), file=file, err=True, color=self.ctx.color) - - -class FileError(ClickException): - """Raised if a file cannot be opened.""" - - def __init__(self, filename: str, hint: str | None = None) -> None: - if hint is None: - hint = _("unknown error") - - super().__init__(hint) - self.ui_filename: str = format_filename(filename) - self.filename = filename - - def format_message(self) -> str: - return _("Could not open file {filename!r}: {message}").format( - filename=self.ui_filename, message=self.message - ) - - -class Abort(RuntimeError): - """An internal signalling exception that signals Click to abort.""" - - -class Exit(RuntimeError): - """An exception that indicates that the application should exit with some - status code. - - :param code: the status code to exit with. - """ - - __slots__ = ("exit_code",) - - def __init__(self, code: int = 0) -> None: - self.exit_code: int = code diff --git a/write-message/venv/lib/python3.10/site-packages/click/formatting.py b/write-message/venv/lib/python3.10/site-packages/click/formatting.py deleted file mode 100644 index 9891f88..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/formatting.py +++ /dev/null @@ -1,301 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -from contextlib import contextmanager -from gettext import gettext as _ - -from ._compat import term_len -from .parser import _split_opt - -# Can force a width. This is used by the test system -FORCED_WIDTH: int | None = None - - -def measure_table(rows: cabc.Iterable[tuple[str, str]]) -> tuple[int, ...]: - widths: dict[int, int] = {} - - for row in rows: - for idx, col in enumerate(row): - widths[idx] = max(widths.get(idx, 0), term_len(col)) - - return tuple(y for x, y in sorted(widths.items())) - - -def iter_rows( - rows: cabc.Iterable[tuple[str, str]], col_count: int -) -> cabc.Iterator[tuple[str, ...]]: - for row in rows: - yield row + ("",) * (col_count - len(row)) - - -def wrap_text( - text: str, - width: int = 78, - initial_indent: str = "", - subsequent_indent: str = "", - preserve_paragraphs: bool = False, -) -> str: - """A helper function that intelligently wraps text. By default, it - assumes that it operates on a single paragraph of text but if the - `preserve_paragraphs` parameter is provided it will intelligently - handle paragraphs (defined by two empty lines). - - If paragraphs are handled, a paragraph can be prefixed with an empty - line containing the ``\\b`` character (``\\x08``) to indicate that - no rewrapping should happen in that block. - - :param text: the text that should be rewrapped. - :param width: the maximum width for the text. - :param initial_indent: the initial indent that should be placed on the - first line as a string. - :param subsequent_indent: the indent string that should be placed on - each consecutive line. - :param preserve_paragraphs: if this flag is set then the wrapping will - intelligently handle paragraphs. - """ - from ._textwrap import TextWrapper - - text = text.expandtabs() - wrapper = TextWrapper( - width, - initial_indent=initial_indent, - subsequent_indent=subsequent_indent, - replace_whitespace=False, - ) - if not preserve_paragraphs: - return wrapper.fill(text) - - p: list[tuple[int, bool, str]] = [] - buf: list[str] = [] - indent = None - - def _flush_par() -> None: - if not buf: - return - if buf[0].strip() == "\b": - p.append((indent or 0, True, "\n".join(buf[1:]))) - else: - p.append((indent or 0, False, " ".join(buf))) - del buf[:] - - for line in text.splitlines(): - if not line: - _flush_par() - indent = None - else: - if indent is None: - orig_len = term_len(line) - line = line.lstrip() - indent = orig_len - term_len(line) - buf.append(line) - _flush_par() - - rv = [] - for indent, raw, text in p: - with wrapper.extra_indent(" " * indent): - if raw: - rv.append(wrapper.indent_only(text)) - else: - rv.append(wrapper.fill(text)) - - return "\n\n".join(rv) - - -class HelpFormatter: - """This class helps with formatting text-based help pages. It's - usually just needed for very special internal cases, but it's also - exposed so that developers can write their own fancy outputs. - - At present, it always writes into memory. - - :param indent_increment: the additional increment for each level. - :param width: the width for the text. This defaults to the terminal - width clamped to a maximum of 78. - """ - - def __init__( - self, - indent_increment: int = 2, - width: int | None = None, - max_width: int | None = None, - ) -> None: - import shutil - - self.indent_increment = indent_increment - if max_width is None: - max_width = 80 - if width is None: - width = FORCED_WIDTH - if width is None: - width = max(min(shutil.get_terminal_size().columns, max_width) - 2, 50) - self.width = width - self.current_indent: int = 0 - self.buffer: list[str] = [] - - def write(self, string: str) -> None: - """Writes a unicode string into the internal buffer.""" - self.buffer.append(string) - - def indent(self) -> None: - """Increases the indentation.""" - self.current_indent += self.indent_increment - - def dedent(self) -> None: - """Decreases the indentation.""" - self.current_indent -= self.indent_increment - - def write_usage(self, prog: str, args: str = "", prefix: str | None = None) -> None: - """Writes a usage line into the buffer. - - :param prog: the program name. - :param args: whitespace separated list of arguments. - :param prefix: The prefix for the first line. Defaults to - ``"Usage: "``. - """ - if prefix is None: - prefix = f"{_('Usage:')} " - - usage_prefix = f"{prefix:>{self.current_indent}}{prog} " - text_width = self.width - self.current_indent - - if text_width >= (term_len(usage_prefix) + 20): - # The arguments will fit to the right of the prefix. - indent = " " * term_len(usage_prefix) - self.write( - wrap_text( - args, - text_width, - initial_indent=usage_prefix, - subsequent_indent=indent, - ) - ) - else: - # The prefix is too long, put the arguments on the next line. - self.write(usage_prefix) - self.write("\n") - indent = " " * (max(self.current_indent, term_len(prefix)) + 4) - self.write( - wrap_text( - args, text_width, initial_indent=indent, subsequent_indent=indent - ) - ) - - self.write("\n") - - def write_heading(self, heading: str) -> None: - """Writes a heading into the buffer.""" - self.write(f"{'':>{self.current_indent}}{heading}:\n") - - def write_paragraph(self) -> None: - """Writes a paragraph into the buffer.""" - if self.buffer: - self.write("\n") - - def write_text(self, text: str) -> None: - """Writes re-indented text into the buffer. This rewraps and - preserves paragraphs. - """ - indent = " " * self.current_indent - self.write( - wrap_text( - text, - self.width, - initial_indent=indent, - subsequent_indent=indent, - preserve_paragraphs=True, - ) - ) - self.write("\n") - - def write_dl( - self, - rows: cabc.Sequence[tuple[str, str]], - col_max: int = 30, - col_spacing: int = 2, - ) -> None: - """Writes a definition list into the buffer. This is how options - and commands are usually formatted. - - :param rows: a list of two item tuples for the terms and values. - :param col_max: the maximum width of the first column. - :param col_spacing: the number of spaces between the first and - second column. - """ - rows = list(rows) - widths = measure_table(rows) - if len(widths) != 2: - raise TypeError("Expected two columns for definition list") - - first_col = min(widths[0], col_max) + col_spacing - - for first, second in iter_rows(rows, len(widths)): - self.write(f"{'':>{self.current_indent}}{first}") - if not second: - self.write("\n") - continue - if term_len(first) <= first_col - col_spacing: - self.write(" " * (first_col - term_len(first))) - else: - self.write("\n") - self.write(" " * (first_col + self.current_indent)) - - text_width = max(self.width - first_col - 2, 10) - wrapped_text = wrap_text(second, text_width, preserve_paragraphs=True) - lines = wrapped_text.splitlines() - - if lines: - self.write(f"{lines[0]}\n") - - for line in lines[1:]: - self.write(f"{'':>{first_col + self.current_indent}}{line}\n") - else: - self.write("\n") - - @contextmanager - def section(self, name: str) -> cabc.Iterator[None]: - """Helpful context manager that writes a paragraph, a heading, - and the indents. - - :param name: the section name that is written as heading. - """ - self.write_paragraph() - self.write_heading(name) - self.indent() - try: - yield - finally: - self.dedent() - - @contextmanager - def indentation(self) -> cabc.Iterator[None]: - """A context manager that increases the indentation.""" - self.indent() - try: - yield - finally: - self.dedent() - - def getvalue(self) -> str: - """Returns the buffer contents.""" - return "".join(self.buffer) - - -def join_options(options: cabc.Sequence[str]) -> tuple[str, bool]: - """Given a list of option strings this joins them in the most appropriate - way and returns them in the form ``(formatted_string, - any_prefix_is_slash)`` where the second item in the tuple is a flag that - indicates if any of the option prefixes was a slash. - """ - rv = [] - any_prefix_is_slash = False - - for opt in options: - prefix = _split_opt(opt)[0] - - if prefix == "/": - any_prefix_is_slash = True - - rv.append((len(prefix), opt)) - - rv.sort(key=lambda x: x[0]) - return ", ".join(x[1] for x in rv), any_prefix_is_slash diff --git a/write-message/venv/lib/python3.10/site-packages/click/globals.py b/write-message/venv/lib/python3.10/site-packages/click/globals.py deleted file mode 100644 index a2f9172..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/globals.py +++ /dev/null @@ -1,67 +0,0 @@ -from __future__ import annotations - -import typing as t -from threading import local - -if t.TYPE_CHECKING: - from .core import Context - -_local = local() - - -@t.overload -def get_current_context(silent: t.Literal[False] = False) -> Context: ... - - -@t.overload -def get_current_context(silent: bool = ...) -> Context | None: ... - - -def get_current_context(silent: bool = False) -> Context | None: - """Returns the current click context. This can be used as a way to - access the current context object from anywhere. This is a more implicit - alternative to the :func:`pass_context` decorator. This function is - primarily useful for helpers such as :func:`echo` which might be - interested in changing its behavior based on the current context. - - To push the current context, :meth:`Context.scope` can be used. - - .. versionadded:: 5.0 - - :param silent: if set to `True` the return value is `None` if no context - is available. The default behavior is to raise a - :exc:`RuntimeError`. - """ - try: - return t.cast("Context", _local.stack[-1]) - except (AttributeError, IndexError) as e: - if not silent: - raise RuntimeError("There is no active click context.") from e - - return None - - -def push_context(ctx: Context) -> None: - """Pushes a new context to the current stack.""" - _local.__dict__.setdefault("stack", []).append(ctx) - - -def pop_context() -> None: - """Removes the top level from the stack.""" - _local.stack.pop() - - -def resolve_color_default(color: bool | None = None) -> bool | None: - """Internal helper to get the default value of the color flag. If a - value is passed it's returned unchanged, otherwise it's looked up from - the current context. - """ - if color is not None: - return color - - ctx = get_current_context(silent=True) - - if ctx is not None: - return ctx.color - - return None diff --git a/write-message/venv/lib/python3.10/site-packages/click/parser.py b/write-message/venv/lib/python3.10/site-packages/click/parser.py deleted file mode 100644 index a8b7d26..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/parser.py +++ /dev/null @@ -1,532 +0,0 @@ -""" -This module started out as largely a copy paste from the stdlib's -optparse module with the features removed that we do not need from -optparse because we implement them in Click on a higher level (for -instance type handling, help formatting and a lot more). - -The plan is to remove more and more from here over time. - -The reason this is a different module and not optparse from the stdlib -is that there are differences in 2.x and 3.x about the error messages -generated and optparse in the stdlib uses gettext for no good reason -and might cause us issues. - -Click uses parts of optparse written by Gregory P. Ward and maintained -by the Python Software Foundation. This is limited to code in parser.py. - -Copyright 2001-2006 Gregory P. Ward. All rights reserved. -Copyright 2002-2006 Python Software Foundation. All rights reserved. -""" - -# This code uses parts of optparse written by Gregory P. Ward and -# maintained by the Python Software Foundation. -# Copyright 2001-2006 Gregory P. Ward -# Copyright 2002-2006 Python Software Foundation -from __future__ import annotations - -import collections.abc as cabc -import typing as t -from collections import deque -from gettext import gettext as _ -from gettext import ngettext - -from .exceptions import BadArgumentUsage -from .exceptions import BadOptionUsage -from .exceptions import NoSuchOption -from .exceptions import UsageError - -if t.TYPE_CHECKING: - from .core import Argument as CoreArgument - from .core import Context - from .core import Option as CoreOption - from .core import Parameter as CoreParameter - -V = t.TypeVar("V") - -# Sentinel value that indicates an option was passed as a flag without a -# value but is not a flag option. Option.consume_value uses this to -# prompt or use the flag_value. -_flag_needs_value = object() - - -def _unpack_args( - args: cabc.Sequence[str], nargs_spec: cabc.Sequence[int] -) -> tuple[cabc.Sequence[str | cabc.Sequence[str | None] | None], list[str]]: - """Given an iterable of arguments and an iterable of nargs specifications, - it returns a tuple with all the unpacked arguments at the first index - and all remaining arguments as the second. - - The nargs specification is the number of arguments that should be consumed - or `-1` to indicate that this position should eat up all the remainders. - - Missing items are filled with `None`. - """ - args = deque(args) - nargs_spec = deque(nargs_spec) - rv: list[str | tuple[str | None, ...] | None] = [] - spos: int | None = None - - def _fetch(c: deque[V]) -> V | None: - try: - if spos is None: - return c.popleft() - else: - return c.pop() - except IndexError: - return None - - while nargs_spec: - nargs = _fetch(nargs_spec) - - if nargs is None: - continue - - if nargs == 1: - rv.append(_fetch(args)) - elif nargs > 1: - x = [_fetch(args) for _ in range(nargs)] - - # If we're reversed, we're pulling in the arguments in reverse, - # so we need to turn them around. - if spos is not None: - x.reverse() - - rv.append(tuple(x)) - elif nargs < 0: - if spos is not None: - raise TypeError("Cannot have two nargs < 0") - - spos = len(rv) - rv.append(None) - - # spos is the position of the wildcard (star). If it's not `None`, - # we fill it with the remainder. - if spos is not None: - rv[spos] = tuple(args) - args = [] - rv[spos + 1 :] = reversed(rv[spos + 1 :]) - - return tuple(rv), list(args) - - -def _split_opt(opt: str) -> tuple[str, str]: - first = opt[:1] - if first.isalnum(): - return "", opt - if opt[1:2] == first: - return opt[:2], opt[2:] - return first, opt[1:] - - -def _normalize_opt(opt: str, ctx: Context | None) -> str: - if ctx is None or ctx.token_normalize_func is None: - return opt - prefix, opt = _split_opt(opt) - return f"{prefix}{ctx.token_normalize_func(opt)}" - - -class _Option: - def __init__( - self, - obj: CoreOption, - opts: cabc.Sequence[str], - dest: str | None, - action: str | None = None, - nargs: int = 1, - const: t.Any | None = None, - ): - self._short_opts = [] - self._long_opts = [] - self.prefixes: set[str] = set() - - for opt in opts: - prefix, value = _split_opt(opt) - if not prefix: - raise ValueError(f"Invalid start character for option ({opt})") - self.prefixes.add(prefix[0]) - if len(prefix) == 1 and len(value) == 1: - self._short_opts.append(opt) - else: - self._long_opts.append(opt) - self.prefixes.add(prefix) - - if action is None: - action = "store" - - self.dest = dest - self.action = action - self.nargs = nargs - self.const = const - self.obj = obj - - @property - def takes_value(self) -> bool: - return self.action in ("store", "append") - - def process(self, value: t.Any, state: _ParsingState) -> None: - if self.action == "store": - state.opts[self.dest] = value # type: ignore - elif self.action == "store_const": - state.opts[self.dest] = self.const # type: ignore - elif self.action == "append": - state.opts.setdefault(self.dest, []).append(value) # type: ignore - elif self.action == "append_const": - state.opts.setdefault(self.dest, []).append(self.const) # type: ignore - elif self.action == "count": - state.opts[self.dest] = state.opts.get(self.dest, 0) + 1 # type: ignore - else: - raise ValueError(f"unknown action '{self.action}'") - state.order.append(self.obj) - - -class _Argument: - def __init__(self, obj: CoreArgument, dest: str | None, nargs: int = 1): - self.dest = dest - self.nargs = nargs - self.obj = obj - - def process( - self, - value: str | cabc.Sequence[str | None] | None, - state: _ParsingState, - ) -> None: - if self.nargs > 1: - assert value is not None - holes = sum(1 for x in value if x is None) - if holes == len(value): - value = None - elif holes != 0: - raise BadArgumentUsage( - _("Argument {name!r} takes {nargs} values.").format( - name=self.dest, nargs=self.nargs - ) - ) - - if self.nargs == -1 and self.obj.envvar is not None and value == (): - # Replace empty tuple with None so that a value from the - # environment may be tried. - value = None - - state.opts[self.dest] = value # type: ignore - state.order.append(self.obj) - - -class _ParsingState: - def __init__(self, rargs: list[str]) -> None: - self.opts: dict[str, t.Any] = {} - self.largs: list[str] = [] - self.rargs = rargs - self.order: list[CoreParameter] = [] - - -class _OptionParser: - """The option parser is an internal class that is ultimately used to - parse options and arguments. It's modelled after optparse and brings - a similar but vastly simplified API. It should generally not be used - directly as the high level Click classes wrap it for you. - - It's not nearly as extensible as optparse or argparse as it does not - implement features that are implemented on a higher level (such as - types or defaults). - - :param ctx: optionally the :class:`~click.Context` where this parser - should go with. - - .. deprecated:: 8.2 - Will be removed in Click 9.0. - """ - - def __init__(self, ctx: Context | None = None) -> None: - #: The :class:`~click.Context` for this parser. This might be - #: `None` for some advanced use cases. - self.ctx = ctx - #: This controls how the parser deals with interspersed arguments. - #: If this is set to `False`, the parser will stop on the first - #: non-option. Click uses this to implement nested subcommands - #: safely. - self.allow_interspersed_args: bool = True - #: This tells the parser how to deal with unknown options. By - #: default it will error out (which is sensible), but there is a - #: second mode where it will ignore it and continue processing - #: after shifting all the unknown options into the resulting args. - self.ignore_unknown_options: bool = False - - if ctx is not None: - self.allow_interspersed_args = ctx.allow_interspersed_args - self.ignore_unknown_options = ctx.ignore_unknown_options - - self._short_opt: dict[str, _Option] = {} - self._long_opt: dict[str, _Option] = {} - self._opt_prefixes = {"-", "--"} - self._args: list[_Argument] = [] - - def add_option( - self, - obj: CoreOption, - opts: cabc.Sequence[str], - dest: str | None, - action: str | None = None, - nargs: int = 1, - const: t.Any | None = None, - ) -> None: - """Adds a new option named `dest` to the parser. The destination - is not inferred (unlike with optparse) and needs to be explicitly - provided. Action can be any of ``store``, ``store_const``, - ``append``, ``append_const`` or ``count``. - - The `obj` can be used to identify the option in the order list - that is returned from the parser. - """ - opts = [_normalize_opt(opt, self.ctx) for opt in opts] - option = _Option(obj, opts, dest, action=action, nargs=nargs, const=const) - self._opt_prefixes.update(option.prefixes) - for opt in option._short_opts: - self._short_opt[opt] = option - for opt in option._long_opts: - self._long_opt[opt] = option - - def add_argument(self, obj: CoreArgument, dest: str | None, nargs: int = 1) -> None: - """Adds a positional argument named `dest` to the parser. - - The `obj` can be used to identify the option in the order list - that is returned from the parser. - """ - self._args.append(_Argument(obj, dest=dest, nargs=nargs)) - - def parse_args( - self, args: list[str] - ) -> tuple[dict[str, t.Any], list[str], list[CoreParameter]]: - """Parses positional arguments and returns ``(values, args, order)`` - for the parsed options and arguments as well as the leftover - arguments if there are any. The order is a list of objects as they - appear on the command line. If arguments appear multiple times they - will be memorized multiple times as well. - """ - state = _ParsingState(args) - try: - self._process_args_for_options(state) - self._process_args_for_args(state) - except UsageError: - if self.ctx is None or not self.ctx.resilient_parsing: - raise - return state.opts, state.largs, state.order - - def _process_args_for_args(self, state: _ParsingState) -> None: - pargs, args = _unpack_args( - state.largs + state.rargs, [x.nargs for x in self._args] - ) - - for idx, arg in enumerate(self._args): - arg.process(pargs[idx], state) - - state.largs = args - state.rargs = [] - - def _process_args_for_options(self, state: _ParsingState) -> None: - while state.rargs: - arg = state.rargs.pop(0) - arglen = len(arg) - # Double dashes always handled explicitly regardless of what - # prefixes are valid. - if arg == "--": - return - elif arg[:1] in self._opt_prefixes and arglen > 1: - self._process_opts(arg, state) - elif self.allow_interspersed_args: - state.largs.append(arg) - else: - state.rargs.insert(0, arg) - return - - # Say this is the original argument list: - # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)] - # ^ - # (we are about to process arg(i)). - # - # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of - # [arg0, ..., arg(i-1)] (any options and their arguments will have - # been removed from largs). - # - # The while loop will usually consume 1 or more arguments per pass. - # If it consumes 1 (eg. arg is an option that takes no arguments), - # then after _process_arg() is done the situation is: - # - # largs = subset of [arg0, ..., arg(i)] - # rargs = [arg(i+1), ..., arg(N-1)] - # - # If allow_interspersed_args is false, largs will always be - # *empty* -- still a subset of [arg0, ..., arg(i-1)], but - # not a very interesting subset! - - def _match_long_opt( - self, opt: str, explicit_value: str | None, state: _ParsingState - ) -> None: - if opt not in self._long_opt: - from difflib import get_close_matches - - possibilities = get_close_matches(opt, self._long_opt) - raise NoSuchOption(opt, possibilities=possibilities, ctx=self.ctx) - - option = self._long_opt[opt] - if option.takes_value: - # At this point it's safe to modify rargs by injecting the - # explicit value, because no exception is raised in this - # branch. This means that the inserted value will be fully - # consumed. - if explicit_value is not None: - state.rargs.insert(0, explicit_value) - - value = self._get_value_from_state(opt, option, state) - - elif explicit_value is not None: - raise BadOptionUsage( - opt, _("Option {name!r} does not take a value.").format(name=opt) - ) - - else: - value = None - - option.process(value, state) - - def _match_short_opt(self, arg: str, state: _ParsingState) -> None: - stop = False - i = 1 - prefix = arg[0] - unknown_options = [] - - for ch in arg[1:]: - opt = _normalize_opt(f"{prefix}{ch}", self.ctx) - option = self._short_opt.get(opt) - i += 1 - - if not option: - if self.ignore_unknown_options: - unknown_options.append(ch) - continue - raise NoSuchOption(opt, ctx=self.ctx) - if option.takes_value: - # Any characters left in arg? Pretend they're the - # next arg, and stop consuming characters of arg. - if i < len(arg): - state.rargs.insert(0, arg[i:]) - stop = True - - value = self._get_value_from_state(opt, option, state) - - else: - value = None - - option.process(value, state) - - if stop: - break - - # If we got any unknown options we recombine the string of the - # remaining options and re-attach the prefix, then report that - # to the state as new larg. This way there is basic combinatorics - # that can be achieved while still ignoring unknown arguments. - if self.ignore_unknown_options and unknown_options: - state.largs.append(f"{prefix}{''.join(unknown_options)}") - - def _get_value_from_state( - self, option_name: str, option: _Option, state: _ParsingState - ) -> t.Any: - nargs = option.nargs - - if len(state.rargs) < nargs: - if option.obj._flag_needs_value: - # Option allows omitting the value. - value = _flag_needs_value - else: - raise BadOptionUsage( - option_name, - ngettext( - "Option {name!r} requires an argument.", - "Option {name!r} requires {nargs} arguments.", - nargs, - ).format(name=option_name, nargs=nargs), - ) - elif nargs == 1: - next_rarg = state.rargs[0] - - if ( - option.obj._flag_needs_value - and isinstance(next_rarg, str) - and next_rarg[:1] in self._opt_prefixes - and len(next_rarg) > 1 - ): - # The next arg looks like the start of an option, don't - # use it as the value if omitting the value is allowed. - value = _flag_needs_value - else: - value = state.rargs.pop(0) - else: - value = tuple(state.rargs[:nargs]) - del state.rargs[:nargs] - - return value - - def _process_opts(self, arg: str, state: _ParsingState) -> None: - explicit_value = None - # Long option handling happens in two parts. The first part is - # supporting explicitly attached values. In any case, we will try - # to long match the option first. - if "=" in arg: - long_opt, explicit_value = arg.split("=", 1) - else: - long_opt = arg - norm_long_opt = _normalize_opt(long_opt, self.ctx) - - # At this point we will match the (assumed) long option through - # the long option matching code. Note that this allows options - # like "-foo" to be matched as long options. - try: - self._match_long_opt(norm_long_opt, explicit_value, state) - except NoSuchOption: - # At this point the long option matching failed, and we need - # to try with short options. However there is a special rule - # which says, that if we have a two character options prefix - # (applies to "--foo" for instance), we do not dispatch to the - # short option code and will instead raise the no option - # error. - if arg[:2] not in self._opt_prefixes: - self._match_short_opt(arg, state) - return - - if not self.ignore_unknown_options: - raise - - state.largs.append(arg) - - -def __getattr__(name: str) -> object: - import warnings - - if name in { - "OptionParser", - "Argument", - "Option", - "split_opt", - "normalize_opt", - "ParsingState", - }: - warnings.warn( - f"'parser.{name}' is deprecated and will be removed in Click 9.0." - " The old parser is available in 'optparse'.", - DeprecationWarning, - stacklevel=2, - ) - return globals()[f"_{name}"] - - if name == "split_arg_string": - from .shell_completion import split_arg_string - - warnings.warn( - "Importing 'parser.split_arg_string' is deprecated, it will only be" - " available in 'shell_completion' in Click 9.0.", - DeprecationWarning, - stacklevel=2, - ) - return split_arg_string - - raise AttributeError(name) diff --git a/write-message/venv/lib/python3.10/site-packages/click/py.typed b/write-message/venv/lib/python3.10/site-packages/click/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/click/shell_completion.py b/write-message/venv/lib/python3.10/site-packages/click/shell_completion.py deleted file mode 100644 index 6c39d5e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/shell_completion.py +++ /dev/null @@ -1,644 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import os -import re -import typing as t -from gettext import gettext as _ - -from .core import Argument -from .core import Command -from .core import Context -from .core import Group -from .core import Option -from .core import Parameter -from .core import ParameterSource -from .utils import echo - - -def shell_complete( - cli: Command, - ctx_args: cabc.MutableMapping[str, t.Any], - prog_name: str, - complete_var: str, - instruction: str, -) -> int: - """Perform shell completion for the given CLI program. - - :param cli: Command being called. - :param ctx_args: Extra arguments to pass to - ``cli.make_context``. - :param prog_name: Name of the executable in the shell. - :param complete_var: Name of the environment variable that holds - the completion instruction. - :param instruction: Value of ``complete_var`` with the completion - instruction and shell, in the form ``instruction_shell``. - :return: Status code to exit with. - """ - shell, _, instruction = instruction.partition("_") - comp_cls = get_completion_class(shell) - - if comp_cls is None: - return 1 - - comp = comp_cls(cli, ctx_args, prog_name, complete_var) - - if instruction == "source": - echo(comp.source()) - return 0 - - if instruction == "complete": - echo(comp.complete()) - return 0 - - return 1 - - -class CompletionItem: - """Represents a completion value and metadata about the value. The - default metadata is ``type`` to indicate special shell handling, - and ``help`` if a shell supports showing a help string next to the - value. - - Arbitrary parameters can be passed when creating the object, and - accessed using ``item.attr``. If an attribute wasn't passed, - accessing it returns ``None``. - - :param value: The completion suggestion. - :param type: Tells the shell script to provide special completion - support for the type. Click uses ``"dir"`` and ``"file"``. - :param help: String shown next to the value if supported. - :param kwargs: Arbitrary metadata. The built-in implementations - don't use this, but custom type completions paired with custom - shell support could use it. - """ - - __slots__ = ("value", "type", "help", "_info") - - def __init__( - self, - value: t.Any, - type: str = "plain", - help: str | None = None, - **kwargs: t.Any, - ) -> None: - self.value: t.Any = value - self.type: str = type - self.help: str | None = help - self._info = kwargs - - def __getattr__(self, name: str) -> t.Any: - return self._info.get(name) - - -# Only Bash >= 4.4 has the nosort option. -_SOURCE_BASH = """\ -%(complete_func)s() { - local IFS=$'\\n' - local response - - response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD \ -%(complete_var)s=bash_complete $1) - - for completion in $response; do - IFS=',' read type value <<< "$completion" - - if [[ $type == 'dir' ]]; then - COMPREPLY=() - compopt -o dirnames - elif [[ $type == 'file' ]]; then - COMPREPLY=() - compopt -o default - elif [[ $type == 'plain' ]]; then - COMPREPLY+=($value) - fi - done - - return 0 -} - -%(complete_func)s_setup() { - complete -o nosort -F %(complete_func)s %(prog_name)s -} - -%(complete_func)s_setup; -""" - -_SOURCE_ZSH = """\ -#compdef %(prog_name)s - -%(complete_func)s() { - local -a completions - local -a completions_with_descriptions - local -a response - (( ! $+commands[%(prog_name)s] )) && return 1 - - response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) \ -%(complete_var)s=zsh_complete %(prog_name)s)}") - - for type key descr in ${response}; do - if [[ "$type" == "plain" ]]; then - if [[ "$descr" == "_" ]]; then - completions+=("$key") - else - completions_with_descriptions+=("$key":"$descr") - fi - elif [[ "$type" == "dir" ]]; then - _path_files -/ - elif [[ "$type" == "file" ]]; then - _path_files -f - fi - done - - if [ -n "$completions_with_descriptions" ]; then - _describe -V unsorted completions_with_descriptions -U - fi - - if [ -n "$completions" ]; then - compadd -U -V unsorted -a completions - fi -} - -if [[ $zsh_eval_context[-1] == loadautofunc ]]; then - # autoload from fpath, call function directly - %(complete_func)s "$@" -else - # eval/source/. command, register function for later - compdef %(complete_func)s %(prog_name)s -fi -""" - -_SOURCE_FISH = """\ -function %(complete_func)s; - set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) \ -COMP_CWORD=(commandline -t) %(prog_name)s); - - for completion in $response; - set -l metadata (string split "," $completion); - - if test $metadata[1] = "dir"; - __fish_complete_directories $metadata[2]; - else if test $metadata[1] = "file"; - __fish_complete_path $metadata[2]; - else if test $metadata[1] = "plain"; - echo $metadata[2]; - end; - end; -end; - -complete --no-files --command %(prog_name)s --arguments \ -"(%(complete_func)s)"; -""" - - -class ShellComplete: - """Base class for providing shell completion support. A subclass for - a given shell will override attributes and methods to implement the - completion instructions (``source`` and ``complete``). - - :param cli: Command being called. - :param prog_name: Name of the executable in the shell. - :param complete_var: Name of the environment variable that holds - the completion instruction. - - .. versionadded:: 8.0 - """ - - name: t.ClassVar[str] - """Name to register the shell as with :func:`add_completion_class`. - This is used in completion instructions (``{name}_source`` and - ``{name}_complete``). - """ - - source_template: t.ClassVar[str] - """Completion script template formatted by :meth:`source`. This must - be provided by subclasses. - """ - - def __init__( - self, - cli: Command, - ctx_args: cabc.MutableMapping[str, t.Any], - prog_name: str, - complete_var: str, - ) -> None: - self.cli = cli - self.ctx_args = ctx_args - self.prog_name = prog_name - self.complete_var = complete_var - - @property - def func_name(self) -> str: - """The name of the shell function defined by the completion - script. - """ - safe_name = re.sub(r"\W*", "", self.prog_name.replace("-", "_"), flags=re.ASCII) - return f"_{safe_name}_completion" - - def source_vars(self) -> dict[str, t.Any]: - """Vars for formatting :attr:`source_template`. - - By default this provides ``complete_func``, ``complete_var``, - and ``prog_name``. - """ - return { - "complete_func": self.func_name, - "complete_var": self.complete_var, - "prog_name": self.prog_name, - } - - def source(self) -> str: - """Produce the shell script that defines the completion - function. By default this ``%``-style formats - :attr:`source_template` with the dict returned by - :meth:`source_vars`. - """ - return self.source_template % self.source_vars() - - def get_completion_args(self) -> tuple[list[str], str]: - """Use the env vars defined by the shell script to return a - tuple of ``args, incomplete``. This must be implemented by - subclasses. - """ - raise NotImplementedError - - def get_completions(self, args: list[str], incomplete: str) -> list[CompletionItem]: - """Determine the context and last complete command or parameter - from the complete args. Call that object's ``shell_complete`` - method to get the completions for the incomplete value. - - :param args: List of complete args before the incomplete value. - :param incomplete: Value being completed. May be empty. - """ - ctx = _resolve_context(self.cli, self.ctx_args, self.prog_name, args) - obj, incomplete = _resolve_incomplete(ctx, args, incomplete) - return obj.shell_complete(ctx, incomplete) - - def format_completion(self, item: CompletionItem) -> str: - """Format a completion item into the form recognized by the - shell script. This must be implemented by subclasses. - - :param item: Completion item to format. - """ - raise NotImplementedError - - def complete(self) -> str: - """Produce the completion data to send back to the shell. - - By default this calls :meth:`get_completion_args`, gets the - completions, then calls :meth:`format_completion` for each - completion. - """ - args, incomplete = self.get_completion_args() - completions = self.get_completions(args, incomplete) - out = [self.format_completion(item) for item in completions] - return "\n".join(out) - - -class BashComplete(ShellComplete): - """Shell completion for Bash.""" - - name = "bash" - source_template = _SOURCE_BASH - - @staticmethod - def _check_version() -> None: - import shutil - import subprocess - - bash_exe = shutil.which("bash") - - if bash_exe is None: - match = None - else: - output = subprocess.run( - [bash_exe, "--norc", "-c", 'echo "${BASH_VERSION}"'], - stdout=subprocess.PIPE, - ) - match = re.search(r"^(\d+)\.(\d+)\.\d+", output.stdout.decode()) - - if match is not None: - major, minor = match.groups() - - if major < "4" or major == "4" and minor < "4": - echo( - _( - "Shell completion is not supported for Bash" - " versions older than 4.4." - ), - err=True, - ) - else: - echo( - _("Couldn't detect Bash version, shell completion is not supported."), - err=True, - ) - - def source(self) -> str: - self._check_version() - return super().source() - - def get_completion_args(self) -> tuple[list[str], str]: - cwords = split_arg_string(os.environ["COMP_WORDS"]) - cword = int(os.environ["COMP_CWORD"]) - args = cwords[1:cword] - - try: - incomplete = cwords[cword] - except IndexError: - incomplete = "" - - return args, incomplete - - def format_completion(self, item: CompletionItem) -> str: - return f"{item.type},{item.value}" - - -class ZshComplete(ShellComplete): - """Shell completion for Zsh.""" - - name = "zsh" - source_template = _SOURCE_ZSH - - def get_completion_args(self) -> tuple[list[str], str]: - cwords = split_arg_string(os.environ["COMP_WORDS"]) - cword = int(os.environ["COMP_CWORD"]) - args = cwords[1:cword] - - try: - incomplete = cwords[cword] - except IndexError: - incomplete = "" - - return args, incomplete - - def format_completion(self, item: CompletionItem) -> str: - return f"{item.type}\n{item.value}\n{item.help if item.help else '_'}" - - -class FishComplete(ShellComplete): - """Shell completion for Fish.""" - - name = "fish" - source_template = _SOURCE_FISH - - def get_completion_args(self) -> tuple[list[str], str]: - cwords = split_arg_string(os.environ["COMP_WORDS"]) - incomplete = os.environ["COMP_CWORD"] - args = cwords[1:] - - # Fish stores the partial word in both COMP_WORDS and - # COMP_CWORD, remove it from complete args. - if incomplete and args and args[-1] == incomplete: - args.pop() - - return args, incomplete - - def format_completion(self, item: CompletionItem) -> str: - if item.help: - return f"{item.type},{item.value}\t{item.help}" - - return f"{item.type},{item.value}" - - -ShellCompleteType = t.TypeVar("ShellCompleteType", bound="type[ShellComplete]") - - -_available_shells: dict[str, type[ShellComplete]] = { - "bash": BashComplete, - "fish": FishComplete, - "zsh": ZshComplete, -} - - -def add_completion_class( - cls: ShellCompleteType, name: str | None = None -) -> ShellCompleteType: - """Register a :class:`ShellComplete` subclass under the given name. - The name will be provided by the completion instruction environment - variable during completion. - - :param cls: The completion class that will handle completion for the - shell. - :param name: Name to register the class under. Defaults to the - class's ``name`` attribute. - """ - if name is None: - name = cls.name - - _available_shells[name] = cls - - return cls - - -def get_completion_class(shell: str) -> type[ShellComplete] | None: - """Look up a registered :class:`ShellComplete` subclass by the name - provided by the completion instruction environment variable. If the - name isn't registered, returns ``None``. - - :param shell: Name the class is registered under. - """ - return _available_shells.get(shell) - - -def split_arg_string(string: str) -> list[str]: - """Split an argument string as with :func:`shlex.split`, but don't - fail if the string is incomplete. Ignores a missing closing quote or - incomplete escape sequence and uses the partial token as-is. - - .. code-block:: python - - split_arg_string("example 'my file") - ["example", "my file"] - - split_arg_string("example my\\") - ["example", "my"] - - :param string: String to split. - - .. versionchanged:: 8.2 - Moved to ``shell_completion`` from ``parser``. - """ - import shlex - - lex = shlex.shlex(string, posix=True) - lex.whitespace_split = True - lex.commenters = "" - out = [] - - try: - for token in lex: - out.append(token) - except ValueError: - # Raised when end-of-string is reached in an invalid state. Use - # the partial token as-is. The quote or escape character is in - # lex.state, not lex.token. - out.append(lex.token) - - return out - - -def _is_incomplete_argument(ctx: Context, param: Parameter) -> bool: - """Determine if the given parameter is an argument that can still - accept values. - - :param ctx: Invocation context for the command represented by the - parsed complete args. - :param param: Argument object being checked. - """ - if not isinstance(param, Argument): - return False - - assert param.name is not None - # Will be None if expose_value is False. - value = ctx.params.get(param.name) - return ( - param.nargs == -1 - or ctx.get_parameter_source(param.name) is not ParameterSource.COMMANDLINE - or ( - param.nargs > 1 - and isinstance(value, (tuple, list)) - and len(value) < param.nargs - ) - ) - - -def _start_of_option(ctx: Context, value: str) -> bool: - """Check if the value looks like the start of an option.""" - if not value: - return False - - c = value[0] - return c in ctx._opt_prefixes - - -def _is_incomplete_option(ctx: Context, args: list[str], param: Parameter) -> bool: - """Determine if the given parameter is an option that needs a value. - - :param args: List of complete args before the incomplete value. - :param param: Option object being checked. - """ - if not isinstance(param, Option): - return False - - if param.is_flag or param.count: - return False - - last_option = None - - for index, arg in enumerate(reversed(args)): - if index + 1 > param.nargs: - break - - if _start_of_option(ctx, arg): - last_option = arg - - return last_option is not None and last_option in param.opts - - -def _resolve_context( - cli: Command, - ctx_args: cabc.MutableMapping[str, t.Any], - prog_name: str, - args: list[str], -) -> Context: - """Produce the context hierarchy starting with the command and - traversing the complete arguments. This only follows the commands, - it doesn't trigger input prompts or callbacks. - - :param cli: Command being called. - :param prog_name: Name of the executable in the shell. - :param args: List of complete args before the incomplete value. - """ - ctx_args["resilient_parsing"] = True - with cli.make_context(prog_name, args.copy(), **ctx_args) as ctx: - args = ctx._protected_args + ctx.args - - while args: - command = ctx.command - - if isinstance(command, Group): - if not command.chain: - name, cmd, args = command.resolve_command(ctx, args) - - if cmd is None: - return ctx - - with cmd.make_context( - name, args, parent=ctx, resilient_parsing=True - ) as sub_ctx: - ctx = sub_ctx - args = ctx._protected_args + ctx.args - else: - sub_ctx = ctx - - while args: - name, cmd, args = command.resolve_command(ctx, args) - - if cmd is None: - return ctx - - with cmd.make_context( - name, - args, - parent=ctx, - allow_extra_args=True, - allow_interspersed_args=False, - resilient_parsing=True, - ) as sub_sub_ctx: - sub_ctx = sub_sub_ctx - args = sub_ctx.args - - ctx = sub_ctx - args = [*sub_ctx._protected_args, *sub_ctx.args] - else: - break - - return ctx - - -def _resolve_incomplete( - ctx: Context, args: list[str], incomplete: str -) -> tuple[Command | Parameter, str]: - """Find the Click object that will handle the completion of the - incomplete value. Return the object and the incomplete value. - - :param ctx: Invocation context for the command represented by - the parsed complete args. - :param args: List of complete args before the incomplete value. - :param incomplete: Value being completed. May be empty. - """ - # Different shells treat an "=" between a long option name and - # value differently. Might keep the value joined, return the "=" - # as a separate item, or return the split name and value. Always - # split and discard the "=" to make completion easier. - if incomplete == "=": - incomplete = "" - elif "=" in incomplete and _start_of_option(ctx, incomplete): - name, _, incomplete = incomplete.partition("=") - args.append(name) - - # The "--" marker tells Click to stop treating values as options - # even if they start with the option character. If it hasn't been - # given and the incomplete arg looks like an option, the current - # command will provide option name completions. - if "--" not in args and _start_of_option(ctx, incomplete): - return ctx.command, incomplete - - params = ctx.command.get_params(ctx) - - # If the last complete arg is an option name with an incomplete - # value, the option will provide value completions. - for param in params: - if _is_incomplete_option(ctx, args, param): - return param, incomplete - - # It's not an option name or value. The first argument without a - # parsed value will provide value completions. - for param in params: - if _is_incomplete_argument(ctx, param): - return param, incomplete - - # There were no unparsed arguments, the command may be a group that - # will provide command name completions. - return ctx.command, incomplete diff --git a/write-message/venv/lib/python3.10/site-packages/click/termui.py b/write-message/venv/lib/python3.10/site-packages/click/termui.py deleted file mode 100644 index dcbb222..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/termui.py +++ /dev/null @@ -1,877 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import inspect -import io -import itertools -import sys -import typing as t -from contextlib import AbstractContextManager -from gettext import gettext as _ - -from ._compat import isatty -from ._compat import strip_ansi -from .exceptions import Abort -from .exceptions import UsageError -from .globals import resolve_color_default -from .types import Choice -from .types import convert_type -from .types import ParamType -from .utils import echo -from .utils import LazyFile - -if t.TYPE_CHECKING: - from ._termui_impl import ProgressBar - -V = t.TypeVar("V") - -# The prompt functions to use. The doc tools currently override these -# functions to customize how they work. -visible_prompt_func: t.Callable[[str], str] = input - -_ansi_colors = { - "black": 30, - "red": 31, - "green": 32, - "yellow": 33, - "blue": 34, - "magenta": 35, - "cyan": 36, - "white": 37, - "reset": 39, - "bright_black": 90, - "bright_red": 91, - "bright_green": 92, - "bright_yellow": 93, - "bright_blue": 94, - "bright_magenta": 95, - "bright_cyan": 96, - "bright_white": 97, -} -_ansi_reset_all = "\033[0m" - - -def hidden_prompt_func(prompt: str) -> str: - import getpass - - return getpass.getpass(prompt) - - -def _build_prompt( - text: str, - suffix: str, - show_default: bool = False, - default: t.Any | None = None, - show_choices: bool = True, - type: ParamType | None = None, -) -> str: - prompt = text - if type is not None and show_choices and isinstance(type, Choice): - prompt += f" ({', '.join(map(str, type.choices))})" - if default is not None and show_default: - prompt = f"{prompt} [{_format_default(default)}]" - return f"{prompt}{suffix}" - - -def _format_default(default: t.Any) -> t.Any: - if isinstance(default, (io.IOBase, LazyFile)) and hasattr(default, "name"): - return default.name - - return default - - -def prompt( - text: str, - default: t.Any | None = None, - hide_input: bool = False, - confirmation_prompt: bool | str = False, - type: ParamType | t.Any | None = None, - value_proc: t.Callable[[str], t.Any] | None = None, - prompt_suffix: str = ": ", - show_default: bool = True, - err: bool = False, - show_choices: bool = True, -) -> t.Any: - """Prompts a user for input. This is a convenience function that can - be used to prompt a user for input later. - - If the user aborts the input by sending an interrupt signal, this - function will catch it and raise a :exc:`Abort` exception. - - :param text: the text to show for the prompt. - :param default: the default value to use if no input happens. If this - is not given it will prompt until it's aborted. - :param hide_input: if this is set to true then the input value will - be hidden. - :param confirmation_prompt: Prompt a second time to confirm the - value. Can be set to a string instead of ``True`` to customize - the message. - :param type: the type to use to check the value against. - :param value_proc: if this parameter is provided it's a function that - is invoked instead of the type conversion to - convert a value. - :param prompt_suffix: a suffix that should be added to the prompt. - :param show_default: shows or hides the default value in the prompt. - :param err: if set to true the file defaults to ``stderr`` instead of - ``stdout``, the same as with echo. - :param show_choices: Show or hide choices if the passed type is a Choice. - For example if type is a Choice of either day or week, - show_choices is true and text is "Group by" then the - prompt will be "Group by (day, week): ". - - .. versionadded:: 8.0 - ``confirmation_prompt`` can be a custom string. - - .. versionadded:: 7.0 - Added the ``show_choices`` parameter. - - .. versionadded:: 6.0 - Added unicode support for cmd.exe on Windows. - - .. versionadded:: 4.0 - Added the `err` parameter. - - """ - - def prompt_func(text: str) -> str: - f = hidden_prompt_func if hide_input else visible_prompt_func - try: - # Write the prompt separately so that we get nice - # coloring through colorama on Windows - echo(text.rstrip(" "), nl=False, err=err) - # Echo a space to stdout to work around an issue where - # readline causes backspace to clear the whole line. - return f(" ") - except (KeyboardInterrupt, EOFError): - # getpass doesn't print a newline if the user aborts input with ^C. - # Allegedly this behavior is inherited from getpass(3). - # A doc bug has been filed at https://bugs.python.org/issue24711 - if hide_input: - echo(None, err=err) - raise Abort() from None - - if value_proc is None: - value_proc = convert_type(type, default) - - prompt = _build_prompt( - text, prompt_suffix, show_default, default, show_choices, type - ) - - if confirmation_prompt: - if confirmation_prompt is True: - confirmation_prompt = _("Repeat for confirmation") - - confirmation_prompt = _build_prompt(confirmation_prompt, prompt_suffix) - - while True: - while True: - value = prompt_func(prompt) - if value: - break - elif default is not None: - value = default - break - try: - result = value_proc(value) - except UsageError as e: - if hide_input: - echo(_("Error: The value you entered was invalid."), err=err) - else: - echo(_("Error: {e.message}").format(e=e), err=err) - continue - if not confirmation_prompt: - return result - while True: - value2 = prompt_func(confirmation_prompt) - is_empty = not value and not value2 - if value2 or is_empty: - break - if value == value2: - return result - echo(_("Error: The two entered values do not match."), err=err) - - -def confirm( - text: str, - default: bool | None = False, - abort: bool = False, - prompt_suffix: str = ": ", - show_default: bool = True, - err: bool = False, -) -> bool: - """Prompts for confirmation (yes/no question). - - If the user aborts the input by sending a interrupt signal this - function will catch it and raise a :exc:`Abort` exception. - - :param text: the question to ask. - :param default: The default value to use when no input is given. If - ``None``, repeat until input is given. - :param abort: if this is set to `True` a negative answer aborts the - exception by raising :exc:`Abort`. - :param prompt_suffix: a suffix that should be added to the prompt. - :param show_default: shows or hides the default value in the prompt. - :param err: if set to true the file defaults to ``stderr`` instead of - ``stdout``, the same as with echo. - - .. versionchanged:: 8.0 - Repeat until input is given if ``default`` is ``None``. - - .. versionadded:: 4.0 - Added the ``err`` parameter. - """ - prompt = _build_prompt( - text, - prompt_suffix, - show_default, - "y/n" if default is None else ("Y/n" if default else "y/N"), - ) - - while True: - try: - # Write the prompt separately so that we get nice - # coloring through colorama on Windows - echo(prompt.rstrip(" "), nl=False, err=err) - # Echo a space to stdout to work around an issue where - # readline causes backspace to clear the whole line. - value = visible_prompt_func(" ").lower().strip() - except (KeyboardInterrupt, EOFError): - raise Abort() from None - if value in ("y", "yes"): - rv = True - elif value in ("n", "no"): - rv = False - elif default is not None and value == "": - rv = default - else: - echo(_("Error: invalid input"), err=err) - continue - break - if abort and not rv: - raise Abort() - return rv - - -def echo_via_pager( - text_or_generator: cabc.Iterable[str] | t.Callable[[], cabc.Iterable[str]] | str, - color: bool | None = None, -) -> None: - """This function takes a text and shows it via an environment specific - pager on stdout. - - .. versionchanged:: 3.0 - Added the `color` flag. - - :param text_or_generator: the text to page, or alternatively, a - generator emitting the text to page. - :param color: controls if the pager supports ANSI colors or not. The - default is autodetection. - """ - color = resolve_color_default(color) - - if inspect.isgeneratorfunction(text_or_generator): - i = t.cast("t.Callable[[], cabc.Iterable[str]]", text_or_generator)() - elif isinstance(text_or_generator, str): - i = [text_or_generator] - else: - i = iter(t.cast("cabc.Iterable[str]", text_or_generator)) - - # convert every element of i to a text type if necessary - text_generator = (el if isinstance(el, str) else str(el) for el in i) - - from ._termui_impl import pager - - return pager(itertools.chain(text_generator, "\n"), color) - - -@t.overload -def progressbar( - *, - length: int, - label: str | None = None, - hidden: bool = False, - show_eta: bool = True, - show_percent: bool | None = None, - show_pos: bool = False, - fill_char: str = "#", - empty_char: str = "-", - bar_template: str = "%(label)s [%(bar)s] %(info)s", - info_sep: str = " ", - width: int = 36, - file: t.TextIO | None = None, - color: bool | None = None, - update_min_steps: int = 1, -) -> ProgressBar[int]: ... - - -@t.overload -def progressbar( - iterable: cabc.Iterable[V] | None = None, - length: int | None = None, - label: str | None = None, - hidden: bool = False, - show_eta: bool = True, - show_percent: bool | None = None, - show_pos: bool = False, - item_show_func: t.Callable[[V | None], str | None] | None = None, - fill_char: str = "#", - empty_char: str = "-", - bar_template: str = "%(label)s [%(bar)s] %(info)s", - info_sep: str = " ", - width: int = 36, - file: t.TextIO | None = None, - color: bool | None = None, - update_min_steps: int = 1, -) -> ProgressBar[V]: ... - - -def progressbar( - iterable: cabc.Iterable[V] | None = None, - length: int | None = None, - label: str | None = None, - hidden: bool = False, - show_eta: bool = True, - show_percent: bool | None = None, - show_pos: bool = False, - item_show_func: t.Callable[[V | None], str | None] | None = None, - fill_char: str = "#", - empty_char: str = "-", - bar_template: str = "%(label)s [%(bar)s] %(info)s", - info_sep: str = " ", - width: int = 36, - file: t.TextIO | None = None, - color: bool | None = None, - update_min_steps: int = 1, -) -> ProgressBar[V]: - """This function creates an iterable context manager that can be used - to iterate over something while showing a progress bar. It will - either iterate over the `iterable` or `length` items (that are counted - up). While iteration happens, this function will print a rendered - progress bar to the given `file` (defaults to stdout) and will attempt - to calculate remaining time and more. By default, this progress bar - will not be rendered if the file is not a terminal. - - The context manager creates the progress bar. When the context - manager is entered the progress bar is already created. With every - iteration over the progress bar, the iterable passed to the bar is - advanced and the bar is updated. When the context manager exits, - a newline is printed and the progress bar is finalized on screen. - - Note: The progress bar is currently designed for use cases where the - total progress can be expected to take at least several seconds. - Because of this, the ProgressBar class object won't display - progress that is considered too fast, and progress where the time - between steps is less than a second. - - No printing must happen or the progress bar will be unintentionally - destroyed. - - Example usage:: - - with progressbar(items) as bar: - for item in bar: - do_something_with(item) - - Alternatively, if no iterable is specified, one can manually update the - progress bar through the `update()` method instead of directly - iterating over the progress bar. The update method accepts the number - of steps to increment the bar with:: - - with progressbar(length=chunks.total_bytes) as bar: - for chunk in chunks: - process_chunk(chunk) - bar.update(chunks.bytes) - - The ``update()`` method also takes an optional value specifying the - ``current_item`` at the new position. This is useful when used - together with ``item_show_func`` to customize the output for each - manual step:: - - with click.progressbar( - length=total_size, - label='Unzipping archive', - item_show_func=lambda a: a.filename - ) as bar: - for archive in zip_file: - archive.extract() - bar.update(archive.size, archive) - - :param iterable: an iterable to iterate over. If not provided the length - is required. - :param length: the number of items to iterate over. By default the - progressbar will attempt to ask the iterator about its - length, which might or might not work. If an iterable is - also provided this parameter can be used to override the - length. If an iterable is not provided the progress bar - will iterate over a range of that length. - :param label: the label to show next to the progress bar. - :param hidden: hide the progressbar. Defaults to ``False``. When no tty is - detected, it will only print the progressbar label. Setting this to - ``False`` also disables that. - :param show_eta: enables or disables the estimated time display. This is - automatically disabled if the length cannot be - determined. - :param show_percent: enables or disables the percentage display. The - default is `True` if the iterable has a length or - `False` if not. - :param show_pos: enables or disables the absolute position display. The - default is `False`. - :param item_show_func: A function called with the current item which - can return a string to show next to the progress bar. If the - function returns ``None`` nothing is shown. The current item can - be ``None``, such as when entering and exiting the bar. - :param fill_char: the character to use to show the filled part of the - progress bar. - :param empty_char: the character to use to show the non-filled part of - the progress bar. - :param bar_template: the format string to use as template for the bar. - The parameters in it are ``label`` for the label, - ``bar`` for the progress bar and ``info`` for the - info section. - :param info_sep: the separator between multiple info items (eta etc.) - :param width: the width of the progress bar in characters, 0 means full - terminal width - :param file: The file to write to. If this is not a terminal then - only the label is printed. - :param color: controls if the terminal supports ANSI colors or not. The - default is autodetection. This is only needed if ANSI - codes are included anywhere in the progress bar output - which is not the case by default. - :param update_min_steps: Render only when this many updates have - completed. This allows tuning for very fast iterators. - - .. versionadded:: 8.2 - The ``hidden`` argument. - - .. versionchanged:: 8.0 - Output is shown even if execution time is less than 0.5 seconds. - - .. versionchanged:: 8.0 - ``item_show_func`` shows the current item, not the previous one. - - .. versionchanged:: 8.0 - Labels are echoed if the output is not a TTY. Reverts a change - in 7.0 that removed all output. - - .. versionadded:: 8.0 - The ``update_min_steps`` parameter. - - .. versionadded:: 4.0 - The ``color`` parameter and ``update`` method. - - .. versionadded:: 2.0 - """ - from ._termui_impl import ProgressBar - - color = resolve_color_default(color) - return ProgressBar( - iterable=iterable, - length=length, - hidden=hidden, - show_eta=show_eta, - show_percent=show_percent, - show_pos=show_pos, - item_show_func=item_show_func, - fill_char=fill_char, - empty_char=empty_char, - bar_template=bar_template, - info_sep=info_sep, - file=file, - label=label, - width=width, - color=color, - update_min_steps=update_min_steps, - ) - - -def clear() -> None: - """Clears the terminal screen. This will have the effect of clearing - the whole visible space of the terminal and moving the cursor to the - top left. This does not do anything if not connected to a terminal. - - .. versionadded:: 2.0 - """ - if not isatty(sys.stdout): - return - - # ANSI escape \033[2J clears the screen, \033[1;1H moves the cursor - echo("\033[2J\033[1;1H", nl=False) - - -def _interpret_color(color: int | tuple[int, int, int] | str, offset: int = 0) -> str: - if isinstance(color, int): - return f"{38 + offset};5;{color:d}" - - if isinstance(color, (tuple, list)): - r, g, b = color - return f"{38 + offset};2;{r:d};{g:d};{b:d}" - - return str(_ansi_colors[color] + offset) - - -def style( - text: t.Any, - fg: int | tuple[int, int, int] | str | None = None, - bg: int | tuple[int, int, int] | str | None = None, - bold: bool | None = None, - dim: bool | None = None, - underline: bool | None = None, - overline: bool | None = None, - italic: bool | None = None, - blink: bool | None = None, - reverse: bool | None = None, - strikethrough: bool | None = None, - reset: bool = True, -) -> str: - """Styles a text with ANSI styles and returns the new string. By - default the styling is self contained which means that at the end - of the string a reset code is issued. This can be prevented by - passing ``reset=False``. - - Examples:: - - click.echo(click.style('Hello World!', fg='green')) - click.echo(click.style('ATTENTION!', blink=True)) - click.echo(click.style('Some things', reverse=True, fg='cyan')) - click.echo(click.style('More colors', fg=(255, 12, 128), bg=117)) - - Supported color names: - - * ``black`` (might be a gray) - * ``red`` - * ``green`` - * ``yellow`` (might be an orange) - * ``blue`` - * ``magenta`` - * ``cyan`` - * ``white`` (might be light gray) - * ``bright_black`` - * ``bright_red`` - * ``bright_green`` - * ``bright_yellow`` - * ``bright_blue`` - * ``bright_magenta`` - * ``bright_cyan`` - * ``bright_white`` - * ``reset`` (reset the color code only) - - If the terminal supports it, color may also be specified as: - - - An integer in the interval [0, 255]. The terminal must support - 8-bit/256-color mode. - - An RGB tuple of three integers in [0, 255]. The terminal must - support 24-bit/true-color mode. - - See https://en.wikipedia.org/wiki/ANSI_color and - https://gist.github.com/XVilka/8346728 for more information. - - :param text: the string to style with ansi codes. - :param fg: if provided this will become the foreground color. - :param bg: if provided this will become the background color. - :param bold: if provided this will enable or disable bold mode. - :param dim: if provided this will enable or disable dim mode. This is - badly supported. - :param underline: if provided this will enable or disable underline. - :param overline: if provided this will enable or disable overline. - :param italic: if provided this will enable or disable italic. - :param blink: if provided this will enable or disable blinking. - :param reverse: if provided this will enable or disable inverse - rendering (foreground becomes background and the - other way round). - :param strikethrough: if provided this will enable or disable - striking through text. - :param reset: by default a reset-all code is added at the end of the - string which means that styles do not carry over. This - can be disabled to compose styles. - - .. versionchanged:: 8.0 - A non-string ``message`` is converted to a string. - - .. versionchanged:: 8.0 - Added support for 256 and RGB color codes. - - .. versionchanged:: 8.0 - Added the ``strikethrough``, ``italic``, and ``overline`` - parameters. - - .. versionchanged:: 7.0 - Added support for bright colors. - - .. versionadded:: 2.0 - """ - if not isinstance(text, str): - text = str(text) - - bits = [] - - if fg: - try: - bits.append(f"\033[{_interpret_color(fg)}m") - except KeyError: - raise TypeError(f"Unknown color {fg!r}") from None - - if bg: - try: - bits.append(f"\033[{_interpret_color(bg, 10)}m") - except KeyError: - raise TypeError(f"Unknown color {bg!r}") from None - - if bold is not None: - bits.append(f"\033[{1 if bold else 22}m") - if dim is not None: - bits.append(f"\033[{2 if dim else 22}m") - if underline is not None: - bits.append(f"\033[{4 if underline else 24}m") - if overline is not None: - bits.append(f"\033[{53 if overline else 55}m") - if italic is not None: - bits.append(f"\033[{3 if italic else 23}m") - if blink is not None: - bits.append(f"\033[{5 if blink else 25}m") - if reverse is not None: - bits.append(f"\033[{7 if reverse else 27}m") - if strikethrough is not None: - bits.append(f"\033[{9 if strikethrough else 29}m") - bits.append(text) - if reset: - bits.append(_ansi_reset_all) - return "".join(bits) - - -def unstyle(text: str) -> str: - """Removes ANSI styling information from a string. Usually it's not - necessary to use this function as Click's echo function will - automatically remove styling if necessary. - - .. versionadded:: 2.0 - - :param text: the text to remove style information from. - """ - return strip_ansi(text) - - -def secho( - message: t.Any | None = None, - file: t.IO[t.AnyStr] | None = None, - nl: bool = True, - err: bool = False, - color: bool | None = None, - **styles: t.Any, -) -> None: - """This function combines :func:`echo` and :func:`style` into one - call. As such the following two calls are the same:: - - click.secho('Hello World!', fg='green') - click.echo(click.style('Hello World!', fg='green')) - - All keyword arguments are forwarded to the underlying functions - depending on which one they go with. - - Non-string types will be converted to :class:`str`. However, - :class:`bytes` are passed directly to :meth:`echo` without applying - style. If you want to style bytes that represent text, call - :meth:`bytes.decode` first. - - .. versionchanged:: 8.0 - A non-string ``message`` is converted to a string. Bytes are - passed through without style applied. - - .. versionadded:: 2.0 - """ - if message is not None and not isinstance(message, (bytes, bytearray)): - message = style(message, **styles) - - return echo(message, file=file, nl=nl, err=err, color=color) - - -@t.overload -def edit( - text: bytes | bytearray, - editor: str | None = None, - env: cabc.Mapping[str, str] | None = None, - require_save: bool = False, - extension: str = ".txt", -) -> bytes | None: ... - - -@t.overload -def edit( - text: str, - editor: str | None = None, - env: cabc.Mapping[str, str] | None = None, - require_save: bool = True, - extension: str = ".txt", -) -> str | None: ... - - -@t.overload -def edit( - text: None = None, - editor: str | None = None, - env: cabc.Mapping[str, str] | None = None, - require_save: bool = True, - extension: str = ".txt", - filename: str | cabc.Iterable[str] | None = None, -) -> None: ... - - -def edit( - text: str | bytes | bytearray | None = None, - editor: str | None = None, - env: cabc.Mapping[str, str] | None = None, - require_save: bool = True, - extension: str = ".txt", - filename: str | cabc.Iterable[str] | None = None, -) -> str | bytes | bytearray | None: - r"""Edits the given text in the defined editor. If an editor is given - (should be the full path to the executable but the regular operating - system search path is used for finding the executable) it overrides - the detected editor. Optionally, some environment variables can be - used. If the editor is closed without changes, `None` is returned. In - case a file is edited directly the return value is always `None` and - `require_save` and `extension` are ignored. - - If the editor cannot be opened a :exc:`UsageError` is raised. - - Note for Windows: to simplify cross-platform usage, the newlines are - automatically converted from POSIX to Windows and vice versa. As such, - the message here will have ``\n`` as newline markers. - - :param text: the text to edit. - :param editor: optionally the editor to use. Defaults to automatic - detection. - :param env: environment variables to forward to the editor. - :param require_save: if this is true, then not saving in the editor - will make the return value become `None`. - :param extension: the extension to tell the editor about. This defaults - to `.txt` but changing this might change syntax - highlighting. - :param filename: if provided it will edit this file instead of the - provided text contents. It will not use a temporary - file as an indirection in that case. If the editor supports - editing multiple files at once, a sequence of files may be - passed as well. Invoke `click.file` once per file instead - if multiple files cannot be managed at once or editing the - files serially is desired. - - .. versionchanged:: 8.2.0 - ``filename`` now accepts any ``Iterable[str]`` in addition to a ``str`` - if the ``editor`` supports editing multiple files at once. - - """ - from ._termui_impl import Editor - - ed = Editor(editor=editor, env=env, require_save=require_save, extension=extension) - - if filename is None: - return ed.edit(text) - - if isinstance(filename, str): - filename = (filename,) - - ed.edit_files(filenames=filename) - return None - - -def launch(url: str, wait: bool = False, locate: bool = False) -> int: - """This function launches the given URL (or filename) in the default - viewer application for this file type. If this is an executable, it - might launch the executable in a new session. The return value is - the exit code of the launched application. Usually, ``0`` indicates - success. - - Examples:: - - click.launch('https://click.palletsprojects.com/') - click.launch('/my/downloaded/file', locate=True) - - .. versionadded:: 2.0 - - :param url: URL or filename of the thing to launch. - :param wait: Wait for the program to exit before returning. This - only works if the launched program blocks. In particular, - ``xdg-open`` on Linux does not block. - :param locate: if this is set to `True` then instead of launching the - application associated with the URL it will attempt to - launch a file manager with the file located. This - might have weird effects if the URL does not point to - the filesystem. - """ - from ._termui_impl import open_url - - return open_url(url, wait=wait, locate=locate) - - -# If this is provided, getchar() calls into this instead. This is used -# for unittesting purposes. -_getchar: t.Callable[[bool], str] | None = None - - -def getchar(echo: bool = False) -> str: - """Fetches a single character from the terminal and returns it. This - will always return a unicode character and under certain rare - circumstances this might return more than one character. The - situations which more than one character is returned is when for - whatever reason multiple characters end up in the terminal buffer or - standard input was not actually a terminal. - - Note that this will always read from the terminal, even if something - is piped into the standard input. - - Note for Windows: in rare cases when typing non-ASCII characters, this - function might wait for a second character and then return both at once. - This is because certain Unicode characters look like special-key markers. - - .. versionadded:: 2.0 - - :param echo: if set to `True`, the character read will also show up on - the terminal. The default is to not show it. - """ - global _getchar - - if _getchar is None: - from ._termui_impl import getchar as f - - _getchar = f - - return _getchar(echo) - - -def raw_terminal() -> AbstractContextManager[int]: - from ._termui_impl import raw_terminal as f - - return f() - - -def pause(info: str | None = None, err: bool = False) -> None: - """This command stops execution and waits for the user to press any - key to continue. This is similar to the Windows batch "pause" - command. If the program is not run through a terminal, this command - will instead do nothing. - - .. versionadded:: 2.0 - - .. versionadded:: 4.0 - Added the `err` parameter. - - :param info: The message to print before pausing. Defaults to - ``"Press any key to continue..."``. - :param err: if set to message goes to ``stderr`` instead of - ``stdout``, the same as with echo. - """ - if not isatty(sys.stdin) or not isatty(sys.stdout): - return - - if info is None: - info = _("Press any key to continue...") - - try: - if info: - echo(info, nl=False, err=err) - try: - getchar() - except (KeyboardInterrupt, EOFError): - pass - finally: - if info: - echo(err=err) diff --git a/write-message/venv/lib/python3.10/site-packages/click/testing.py b/write-message/venv/lib/python3.10/site-packages/click/testing.py deleted file mode 100644 index 7c0e874..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/testing.py +++ /dev/null @@ -1,565 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import contextlib -import io -import os -import shlex -import shutil -import sys -import tempfile -import typing as t -from types import TracebackType - -from . import _compat -from . import formatting -from . import termui -from . import utils -from ._compat import _find_binary_reader - -if t.TYPE_CHECKING: - from _typeshed import ReadableBuffer - - from .core import Command - - -class EchoingStdin: - def __init__(self, input: t.BinaryIO, output: t.BinaryIO) -> None: - self._input = input - self._output = output - self._paused = False - - def __getattr__(self, x: str) -> t.Any: - return getattr(self._input, x) - - def _echo(self, rv: bytes) -> bytes: - if not self._paused: - self._output.write(rv) - - return rv - - def read(self, n: int = -1) -> bytes: - return self._echo(self._input.read(n)) - - def read1(self, n: int = -1) -> bytes: - return self._echo(self._input.read1(n)) # type: ignore - - def readline(self, n: int = -1) -> bytes: - return self._echo(self._input.readline(n)) - - def readlines(self) -> list[bytes]: - return [self._echo(x) for x in self._input.readlines()] - - def __iter__(self) -> cabc.Iterator[bytes]: - return iter(self._echo(x) for x in self._input) - - def __repr__(self) -> str: - return repr(self._input) - - -@contextlib.contextmanager -def _pause_echo(stream: EchoingStdin | None) -> cabc.Iterator[None]: - if stream is None: - yield - else: - stream._paused = True - yield - stream._paused = False - - -class BytesIOCopy(io.BytesIO): - """Patch ``io.BytesIO`` to let the written stream be copied to another. - - .. versionadded:: 8.2 - """ - - def __init__(self, copy_to: io.BytesIO) -> None: - super().__init__() - self.copy_to = copy_to - - def flush(self) -> None: - super().flush() - self.copy_to.flush() - - def write(self, b: ReadableBuffer) -> int: - self.copy_to.write(b) - return super().write(b) - - -class StreamMixer: - """Mixes `` and `` streams. - - The result is available in the ``output`` attribute. - - .. versionadded:: 8.2 - """ - - def __init__(self) -> None: - self.output: io.BytesIO = io.BytesIO() - self.stdout: io.BytesIO = BytesIOCopy(copy_to=self.output) - self.stderr: io.BytesIO = BytesIOCopy(copy_to=self.output) - - -class _NamedTextIOWrapper(io.TextIOWrapper): - def __init__( - self, buffer: t.BinaryIO, name: str, mode: str, **kwargs: t.Any - ) -> None: - super().__init__(buffer, **kwargs) - self._name = name - self._mode = mode - - @property - def name(self) -> str: - return self._name - - @property - def mode(self) -> str: - return self._mode - - def __next__(self) -> str: # type: ignore - try: - line = super().__next__() - except StopIteration as e: - raise EOFError() from e - return line - - -def make_input_stream( - input: str | bytes | t.IO[t.Any] | None, charset: str -) -> t.BinaryIO: - # Is already an input stream. - if hasattr(input, "read"): - rv = _find_binary_reader(t.cast("t.IO[t.Any]", input)) - - if rv is not None: - return rv - - raise TypeError("Could not find binary reader for input stream.") - - if input is None: - input = b"" - elif isinstance(input, str): - input = input.encode(charset) - - return io.BytesIO(input) - - -class Result: - """Holds the captured result of an invoked CLI script. - - :param runner: The runner that created the result - :param stdout_bytes: The standard output as bytes. - :param stderr_bytes: The standard error as bytes. - :param output_bytes: A mix of ``stdout_bytes`` and ``stderr_bytes``, as the - user would see it in its terminal. - :param return_value: The value returned from the invoked command. - :param exit_code: The exit code as integer. - :param exception: The exception that happened if one did. - :param exc_info: Exception information (exception type, exception instance, - traceback type). - - .. versionchanged:: 8.2 - ``stderr_bytes`` no longer optional, ``output_bytes`` introduced and - ``mix_stderr`` has been removed. - - .. versionadded:: 8.0 - Added ``return_value``. - """ - - def __init__( - self, - runner: CliRunner, - stdout_bytes: bytes, - stderr_bytes: bytes, - output_bytes: bytes, - return_value: t.Any, - exit_code: int, - exception: BaseException | None, - exc_info: tuple[type[BaseException], BaseException, TracebackType] - | None = None, - ): - self.runner = runner - self.stdout_bytes = stdout_bytes - self.stderr_bytes = stderr_bytes - self.output_bytes = output_bytes - self.return_value = return_value - self.exit_code = exit_code - self.exception = exception - self.exc_info = exc_info - - @property - def output(self) -> str: - """The terminal output as unicode string, as the user would see it. - - .. versionchanged:: 8.2 - No longer a proxy for ``self.stdout``. Now has its own independent stream - that is mixing `` and ``, in the order they were written. - """ - return self.output_bytes.decode(self.runner.charset, "replace").replace( - "\r\n", "\n" - ) - - @property - def stdout(self) -> str: - """The standard output as unicode string.""" - return self.stdout_bytes.decode(self.runner.charset, "replace").replace( - "\r\n", "\n" - ) - - @property - def stderr(self) -> str: - """The standard error as unicode string. - - .. versionchanged:: 8.2 - No longer raise an exception, always returns the `` string. - """ - return self.stderr_bytes.decode(self.runner.charset, "replace").replace( - "\r\n", "\n" - ) - - def __repr__(self) -> str: - exc_str = repr(self.exception) if self.exception else "okay" - return f"<{type(self).__name__} {exc_str}>" - - -class CliRunner: - """The CLI runner provides functionality to invoke a Click command line - script for unittesting purposes in a isolated environment. This only - works in single-threaded systems without any concurrency as it changes the - global interpreter state. - - :param charset: the character set for the input and output data. - :param env: a dictionary with environment variables for overriding. - :param echo_stdin: if this is set to `True`, then reading from `` writes - to ``. This is useful for showing examples in - some circumstances. Note that regular prompts - will automatically echo the input. - :param catch_exceptions: Whether to catch any exceptions other than - ``SystemExit`` when running :meth:`~CliRunner.invoke`. - - .. versionchanged:: 8.2 - Added the ``catch_exceptions`` parameter. - - .. versionchanged:: 8.2 - ``mix_stderr`` parameter has been removed. - """ - - def __init__( - self, - charset: str = "utf-8", - env: cabc.Mapping[str, str | None] | None = None, - echo_stdin: bool = False, - catch_exceptions: bool = True, - ) -> None: - self.charset = charset - self.env: cabc.Mapping[str, str | None] = env or {} - self.echo_stdin = echo_stdin - self.catch_exceptions = catch_exceptions - - def get_default_prog_name(self, cli: Command) -> str: - """Given a command object it will return the default program name - for it. The default is the `name` attribute or ``"root"`` if not - set. - """ - return cli.name or "root" - - def make_env( - self, overrides: cabc.Mapping[str, str | None] | None = None - ) -> cabc.Mapping[str, str | None]: - """Returns the environment overrides for invoking a script.""" - rv = dict(self.env) - if overrides: - rv.update(overrides) - return rv - - @contextlib.contextmanager - def isolation( - self, - input: str | bytes | t.IO[t.Any] | None = None, - env: cabc.Mapping[str, str | None] | None = None, - color: bool = False, - ) -> cabc.Iterator[tuple[io.BytesIO, io.BytesIO, io.BytesIO]]: - """A context manager that sets up the isolation for invoking of a - command line tool. This sets up `` with the given input data - and `os.environ` with the overrides from the given dictionary. - This also rebinds some internals in Click to be mocked (like the - prompt functionality). - - This is automatically done in the :meth:`invoke` method. - - :param input: the input stream to put into `sys.stdin`. - :param env: the environment overrides as dictionary. - :param color: whether the output should contain color codes. The - application can still override this explicitly. - - .. versionadded:: 8.2 - An additional output stream is returned, which is a mix of - `` and `` streams. - - .. versionchanged:: 8.2 - Always returns the `` stream. - - .. versionchanged:: 8.0 - `` is opened with ``errors="backslashreplace"`` - instead of the default ``"strict"``. - - .. versionchanged:: 4.0 - Added the ``color`` parameter. - """ - bytes_input = make_input_stream(input, self.charset) - echo_input = None - - old_stdin = sys.stdin - old_stdout = sys.stdout - old_stderr = sys.stderr - old_forced_width = formatting.FORCED_WIDTH - formatting.FORCED_WIDTH = 80 - - env = self.make_env(env) - - stream_mixer = StreamMixer() - - if self.echo_stdin: - bytes_input = echo_input = t.cast( - t.BinaryIO, EchoingStdin(bytes_input, stream_mixer.stdout) - ) - - sys.stdin = text_input = _NamedTextIOWrapper( - bytes_input, encoding=self.charset, name="", mode="r" - ) - - if self.echo_stdin: - # Force unbuffered reads, otherwise TextIOWrapper reads a - # large chunk which is echoed early. - text_input._CHUNK_SIZE = 1 # type: ignore - - sys.stdout = _NamedTextIOWrapper( - stream_mixer.stdout, encoding=self.charset, name="", mode="w" - ) - - sys.stderr = _NamedTextIOWrapper( - stream_mixer.stderr, - encoding=self.charset, - name="", - mode="w", - errors="backslashreplace", - ) - - @_pause_echo(echo_input) # type: ignore - def visible_input(prompt: str | None = None) -> str: - sys.stdout.write(prompt or "") - val = next(text_input).rstrip("\r\n") - sys.stdout.write(f"{val}\n") - sys.stdout.flush() - return val - - @_pause_echo(echo_input) # type: ignore - def hidden_input(prompt: str | None = None) -> str: - sys.stdout.write(f"{prompt or ''}\n") - sys.stdout.flush() - return next(text_input).rstrip("\r\n") - - @_pause_echo(echo_input) # type: ignore - def _getchar(echo: bool) -> str: - char = sys.stdin.read(1) - - if echo: - sys.stdout.write(char) - - sys.stdout.flush() - return char - - default_color = color - - def should_strip_ansi( - stream: t.IO[t.Any] | None = None, color: bool | None = None - ) -> bool: - if color is None: - return not default_color - return not color - - old_visible_prompt_func = termui.visible_prompt_func - old_hidden_prompt_func = termui.hidden_prompt_func - old__getchar_func = termui._getchar - old_should_strip_ansi = utils.should_strip_ansi # type: ignore - old__compat_should_strip_ansi = _compat.should_strip_ansi - termui.visible_prompt_func = visible_input - termui.hidden_prompt_func = hidden_input - termui._getchar = _getchar - utils.should_strip_ansi = should_strip_ansi # type: ignore - _compat.should_strip_ansi = should_strip_ansi - - old_env = {} - try: - for key, value in env.items(): - old_env[key] = os.environ.get(key) - if value is None: - try: - del os.environ[key] - except Exception: - pass - else: - os.environ[key] = value - yield (stream_mixer.stdout, stream_mixer.stderr, stream_mixer.output) - finally: - for key, value in old_env.items(): - if value is None: - try: - del os.environ[key] - except Exception: - pass - else: - os.environ[key] = value - sys.stdout = old_stdout - sys.stderr = old_stderr - sys.stdin = old_stdin - termui.visible_prompt_func = old_visible_prompt_func - termui.hidden_prompt_func = old_hidden_prompt_func - termui._getchar = old__getchar_func - utils.should_strip_ansi = old_should_strip_ansi # type: ignore - _compat.should_strip_ansi = old__compat_should_strip_ansi - formatting.FORCED_WIDTH = old_forced_width - - def invoke( - self, - cli: Command, - args: str | cabc.Sequence[str] | None = None, - input: str | bytes | t.IO[t.Any] | None = None, - env: cabc.Mapping[str, str | None] | None = None, - catch_exceptions: bool | None = None, - color: bool = False, - **extra: t.Any, - ) -> Result: - """Invokes a command in an isolated environment. The arguments are - forwarded directly to the command line script, the `extra` keyword - arguments are passed to the :meth:`~clickpkg.Command.main` function of - the command. - - This returns a :class:`Result` object. - - :param cli: the command to invoke - :param args: the arguments to invoke. It may be given as an iterable - or a string. When given as string it will be interpreted - as a Unix shell command. More details at - :func:`shlex.split`. - :param input: the input data for `sys.stdin`. - :param env: the environment overrides. - :param catch_exceptions: Whether to catch any other exceptions than - ``SystemExit``. If :data:`None`, the value - from :class:`CliRunner` is used. - :param extra: the keyword arguments to pass to :meth:`main`. - :param color: whether the output should contain color codes. The - application can still override this explicitly. - - .. versionadded:: 8.2 - The result object has the ``output_bytes`` attribute with - the mix of ``stdout_bytes`` and ``stderr_bytes``, as the user would - see it in its terminal. - - .. versionchanged:: 8.2 - The result object always returns the ``stderr_bytes`` stream. - - .. versionchanged:: 8.0 - The result object has the ``return_value`` attribute with - the value returned from the invoked command. - - .. versionchanged:: 4.0 - Added the ``color`` parameter. - - .. versionchanged:: 3.0 - Added the ``catch_exceptions`` parameter. - - .. versionchanged:: 3.0 - The result object has the ``exc_info`` attribute with the - traceback if available. - """ - exc_info = None - if catch_exceptions is None: - catch_exceptions = self.catch_exceptions - - with self.isolation(input=input, env=env, color=color) as outstreams: - return_value = None - exception: BaseException | None = None - exit_code = 0 - - if isinstance(args, str): - args = shlex.split(args) - - try: - prog_name = extra.pop("prog_name") - except KeyError: - prog_name = self.get_default_prog_name(cli) - - try: - return_value = cli.main(args=args or (), prog_name=prog_name, **extra) - except SystemExit as e: - exc_info = sys.exc_info() - e_code = t.cast("int | t.Any | None", e.code) - - if e_code is None: - e_code = 0 - - if e_code != 0: - exception = e - - if not isinstance(e_code, int): - sys.stdout.write(str(e_code)) - sys.stdout.write("\n") - e_code = 1 - - exit_code = e_code - - except Exception as e: - if not catch_exceptions: - raise - exception = e - exit_code = 1 - exc_info = sys.exc_info() - finally: - sys.stdout.flush() - sys.stderr.flush() - stdout = outstreams[0].getvalue() - stderr = outstreams[1].getvalue() - output = outstreams[2].getvalue() - - return Result( - runner=self, - stdout_bytes=stdout, - stderr_bytes=stderr, - output_bytes=output, - return_value=return_value, - exit_code=exit_code, - exception=exception, - exc_info=exc_info, # type: ignore - ) - - @contextlib.contextmanager - def isolated_filesystem( - self, temp_dir: str | os.PathLike[str] | None = None - ) -> cabc.Iterator[str]: - """A context manager that creates a temporary directory and - changes the current working directory to it. This isolates tests - that affect the contents of the CWD to prevent them from - interfering with each other. - - :param temp_dir: Create the temporary directory under this - directory. If given, the created directory is not removed - when exiting. - - .. versionchanged:: 8.0 - Added the ``temp_dir`` parameter. - """ - cwd = os.getcwd() - dt = tempfile.mkdtemp(dir=temp_dir) - os.chdir(dt) - - try: - yield dt - finally: - os.chdir(cwd) - - if temp_dir is None: - try: - shutil.rmtree(dt) - except OSError: - pass diff --git a/write-message/venv/lib/python3.10/site-packages/click/types.py b/write-message/venv/lib/python3.10/site-packages/click/types.py deleted file mode 100644 index 684cb3b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/types.py +++ /dev/null @@ -1,1165 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import enum -import os -import stat -import sys -import typing as t -from datetime import datetime -from gettext import gettext as _ -from gettext import ngettext - -from ._compat import _get_argv_encoding -from ._compat import open_stream -from .exceptions import BadParameter -from .utils import format_filename -from .utils import LazyFile -from .utils import safecall - -if t.TYPE_CHECKING: - import typing_extensions as te - - from .core import Context - from .core import Parameter - from .shell_completion import CompletionItem - -ParamTypeValue = t.TypeVar("ParamTypeValue") - - -class ParamType: - """Represents the type of a parameter. Validates and converts values - from the command line or Python into the correct type. - - To implement a custom type, subclass and implement at least the - following: - - - The :attr:`name` class attribute must be set. - - Calling an instance of the type with ``None`` must return - ``None``. This is already implemented by default. - - :meth:`convert` must convert string values to the correct type. - - :meth:`convert` must accept values that are already the correct - type. - - It must be able to convert a value if the ``ctx`` and ``param`` - arguments are ``None``. This can occur when converting prompt - input. - """ - - is_composite: t.ClassVar[bool] = False - arity: t.ClassVar[int] = 1 - - #: the descriptive name of this type - name: str - - #: if a list of this type is expected and the value is pulled from a - #: string environment variable, this is what splits it up. `None` - #: means any whitespace. For all parameters the general rule is that - #: whitespace splits them up. The exception are paths and files which - #: are split by ``os.path.pathsep`` by default (":" on Unix and ";" on - #: Windows). - envvar_list_splitter: t.ClassVar[str | None] = None - - def to_info_dict(self) -> dict[str, t.Any]: - """Gather information that could be useful for a tool generating - user-facing documentation. - - Use :meth:`click.Context.to_info_dict` to traverse the entire - CLI structure. - - .. versionadded:: 8.0 - """ - # The class name without the "ParamType" suffix. - param_type = type(self).__name__.partition("ParamType")[0] - param_type = param_type.partition("ParameterType")[0] - - # Custom subclasses might not remember to set a name. - if hasattr(self, "name"): - name = self.name - else: - name = param_type - - return {"param_type": param_type, "name": name} - - def __call__( - self, - value: t.Any, - param: Parameter | None = None, - ctx: Context | None = None, - ) -> t.Any: - if value is not None: - return self.convert(value, param, ctx) - - def get_metavar(self, param: Parameter, ctx: Context) -> str | None: - """Returns the metavar default for this param if it provides one.""" - - def get_missing_message(self, param: Parameter, ctx: Context | None) -> str | None: - """Optionally might return extra information about a missing - parameter. - - .. versionadded:: 2.0 - """ - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - """Convert the value to the correct type. This is not called if - the value is ``None`` (the missing value). - - This must accept string values from the command line, as well as - values that are already the correct type. It may also convert - other compatible types. - - The ``param`` and ``ctx`` arguments may be ``None`` in certain - situations, such as when converting prompt input. - - If the value cannot be converted, call :meth:`fail` with a - descriptive message. - - :param value: The value to convert. - :param param: The parameter that is using this type to convert - its value. May be ``None``. - :param ctx: The current context that arrived at this value. May - be ``None``. - """ - return value - - def split_envvar_value(self, rv: str) -> cabc.Sequence[str]: - """Given a value from an environment variable this splits it up - into small chunks depending on the defined envvar list splitter. - - If the splitter is set to `None`, which means that whitespace splits, - then leading and trailing whitespace is ignored. Otherwise, leading - and trailing splitters usually lead to empty items being included. - """ - return (rv or "").split(self.envvar_list_splitter) - - def fail( - self, - message: str, - param: Parameter | None = None, - ctx: Context | None = None, - ) -> t.NoReturn: - """Helper method to fail with an invalid value message.""" - raise BadParameter(message, ctx=ctx, param=param) - - def shell_complete( - self, ctx: Context, param: Parameter, incomplete: str - ) -> list[CompletionItem]: - """Return a list of - :class:`~click.shell_completion.CompletionItem` objects for the - incomplete value. Most types do not provide completions, but - some do, and this allows custom types to provide custom - completions as well. - - :param ctx: Invocation context for this command. - :param param: The parameter that is requesting completion. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - return [] - - -class CompositeParamType(ParamType): - is_composite = True - - @property - def arity(self) -> int: # type: ignore - raise NotImplementedError() - - -class FuncParamType(ParamType): - def __init__(self, func: t.Callable[[t.Any], t.Any]) -> None: - self.name: str = func.__name__ - self.func = func - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict["func"] = self.func - return info_dict - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - try: - return self.func(value) - except ValueError: - try: - value = str(value) - except UnicodeError: - value = value.decode("utf-8", "replace") - - self.fail(value, param, ctx) - - -class UnprocessedParamType(ParamType): - name = "text" - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - return value - - def __repr__(self) -> str: - return "UNPROCESSED" - - -class StringParamType(ParamType): - name = "text" - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - if isinstance(value, bytes): - enc = _get_argv_encoding() - try: - value = value.decode(enc) - except UnicodeError: - fs_enc = sys.getfilesystemencoding() - if fs_enc != enc: - try: - value = value.decode(fs_enc) - except UnicodeError: - value = value.decode("utf-8", "replace") - else: - value = value.decode("utf-8", "replace") - return value - return str(value) - - def __repr__(self) -> str: - return "STRING" - - -class Choice(ParamType, t.Generic[ParamTypeValue]): - """The choice type allows a value to be checked against a fixed set - of supported values. - - You may pass any iterable value which will be converted to a tuple - and thus will only be iterated once. - - The resulting value will always be one of the originally passed choices. - See :meth:`normalize_choice` for more info on the mapping of strings - to choices. See :ref:`choice-opts` for an example. - - :param case_sensitive: Set to false to make choices case - insensitive. Defaults to true. - - .. versionchanged:: 8.2.0 - Non-``str`` ``choices`` are now supported. It can additionally be any - iterable. Before you were not recommended to pass anything but a list or - tuple. - - .. versionadded:: 8.2.0 - Choice normalization can be overridden via :meth:`normalize_choice`. - """ - - name = "choice" - - def __init__( - self, choices: cabc.Iterable[ParamTypeValue], case_sensitive: bool = True - ) -> None: - self.choices: cabc.Sequence[ParamTypeValue] = tuple(choices) - self.case_sensitive = case_sensitive - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict["choices"] = self.choices - info_dict["case_sensitive"] = self.case_sensitive - return info_dict - - def _normalized_mapping( - self, ctx: Context | None = None - ) -> cabc.Mapping[ParamTypeValue, str]: - """ - Returns mapping where keys are the original choices and the values are - the normalized values that are accepted via the command line. - - This is a simple wrapper around :meth:`normalize_choice`, use that - instead which is supported. - """ - return { - choice: self.normalize_choice( - choice=choice, - ctx=ctx, - ) - for choice in self.choices - } - - def normalize_choice(self, choice: ParamTypeValue, ctx: Context | None) -> str: - """ - Normalize a choice value, used to map a passed string to a choice. - Each choice must have a unique normalized value. - - By default uses :meth:`Context.token_normalize_func` and if not case - sensitive, convert it to a casefolded value. - - .. versionadded:: 8.2.0 - """ - normed_value = choice.name if isinstance(choice, enum.Enum) else str(choice) - - if ctx is not None and ctx.token_normalize_func is not None: - normed_value = ctx.token_normalize_func(normed_value) - - if not self.case_sensitive: - normed_value = normed_value.casefold() - - return normed_value - - def get_metavar(self, param: Parameter, ctx: Context) -> str | None: - if param.param_type_name == "option" and not param.show_choices: # type: ignore - choice_metavars = [ - convert_type(type(choice)).name.upper() for choice in self.choices - ] - choices_str = "|".join([*dict.fromkeys(choice_metavars)]) - else: - choices_str = "|".join( - [str(i) for i in self._normalized_mapping(ctx=ctx).values()] - ) - - # Use curly braces to indicate a required argument. - if param.required and param.param_type_name == "argument": - return f"{{{choices_str}}}" - - # Use square braces to indicate an option or optional argument. - return f"[{choices_str}]" - - def get_missing_message(self, param: Parameter, ctx: Context | None) -> str: - """ - Message shown when no choice is passed. - - .. versionchanged:: 8.2.0 Added ``ctx`` argument. - """ - return _("Choose from:\n\t{choices}").format( - choices=",\n\t".join(self._normalized_mapping(ctx=ctx).values()) - ) - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> ParamTypeValue: - """ - For a given value from the parser, normalize it and find its - matching normalized value in the list of choices. Then return the - matched "original" choice. - """ - normed_value = self.normalize_choice(choice=value, ctx=ctx) - normalized_mapping = self._normalized_mapping(ctx=ctx) - - try: - return next( - original - for original, normalized in normalized_mapping.items() - if normalized == normed_value - ) - except StopIteration: - self.fail( - self.get_invalid_choice_message(value=value, ctx=ctx), - param=param, - ctx=ctx, - ) - - def get_invalid_choice_message(self, value: t.Any, ctx: Context | None) -> str: - """Get the error message when the given choice is invalid. - - :param value: The invalid value. - - .. versionadded:: 8.2 - """ - choices_str = ", ".join(map(repr, self._normalized_mapping(ctx=ctx).values())) - return ngettext( - "{value!r} is not {choice}.", - "{value!r} is not one of {choices}.", - len(self.choices), - ).format(value=value, choice=choices_str, choices=choices_str) - - def __repr__(self) -> str: - return f"Choice({list(self.choices)})" - - def shell_complete( - self, ctx: Context, param: Parameter, incomplete: str - ) -> list[CompletionItem]: - """Complete choices that start with the incomplete value. - - :param ctx: Invocation context for this command. - :param param: The parameter that is requesting completion. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - str_choices = map(str, self.choices) - - if self.case_sensitive: - matched = (c for c in str_choices if c.startswith(incomplete)) - else: - incomplete = incomplete.lower() - matched = (c for c in str_choices if c.lower().startswith(incomplete)) - - return [CompletionItem(c) for c in matched] - - -class DateTime(ParamType): - """The DateTime type converts date strings into `datetime` objects. - - The format strings which are checked are configurable, but default to some - common (non-timezone aware) ISO 8601 formats. - - When specifying *DateTime* formats, you should only pass a list or a tuple. - Other iterables, like generators, may lead to surprising results. - - The format strings are processed using ``datetime.strptime``, and this - consequently defines the format strings which are allowed. - - Parsing is tried using each format, in order, and the first format which - parses successfully is used. - - :param formats: A list or tuple of date format strings, in the order in - which they should be tried. Defaults to - ``'%Y-%m-%d'``, ``'%Y-%m-%dT%H:%M:%S'``, - ``'%Y-%m-%d %H:%M:%S'``. - """ - - name = "datetime" - - def __init__(self, formats: cabc.Sequence[str] | None = None): - self.formats: cabc.Sequence[str] = formats or [ - "%Y-%m-%d", - "%Y-%m-%dT%H:%M:%S", - "%Y-%m-%d %H:%M:%S", - ] - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict["formats"] = self.formats - return info_dict - - def get_metavar(self, param: Parameter, ctx: Context) -> str | None: - return f"[{'|'.join(self.formats)}]" - - def _try_to_convert_date(self, value: t.Any, format: str) -> datetime | None: - try: - return datetime.strptime(value, format) - except ValueError: - return None - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - if isinstance(value, datetime): - return value - - for format in self.formats: - converted = self._try_to_convert_date(value, format) - - if converted is not None: - return converted - - formats_str = ", ".join(map(repr, self.formats)) - self.fail( - ngettext( - "{value!r} does not match the format {format}.", - "{value!r} does not match the formats {formats}.", - len(self.formats), - ).format(value=value, format=formats_str, formats=formats_str), - param, - ctx, - ) - - def __repr__(self) -> str: - return "DateTime" - - -class _NumberParamTypeBase(ParamType): - _number_class: t.ClassVar[type[t.Any]] - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - try: - return self._number_class(value) - except ValueError: - self.fail( - _("{value!r} is not a valid {number_type}.").format( - value=value, number_type=self.name - ), - param, - ctx, - ) - - -class _NumberRangeBase(_NumberParamTypeBase): - def __init__( - self, - min: float | None = None, - max: float | None = None, - min_open: bool = False, - max_open: bool = False, - clamp: bool = False, - ) -> None: - self.min = min - self.max = max - self.min_open = min_open - self.max_open = max_open - self.clamp = clamp - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict.update( - min=self.min, - max=self.max, - min_open=self.min_open, - max_open=self.max_open, - clamp=self.clamp, - ) - return info_dict - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - import operator - - rv = super().convert(value, param, ctx) - lt_min: bool = self.min is not None and ( - operator.le if self.min_open else operator.lt - )(rv, self.min) - gt_max: bool = self.max is not None and ( - operator.ge if self.max_open else operator.gt - )(rv, self.max) - - if self.clamp: - if lt_min: - return self._clamp(self.min, 1, self.min_open) # type: ignore - - if gt_max: - return self._clamp(self.max, -1, self.max_open) # type: ignore - - if lt_min or gt_max: - self.fail( - _("{value} is not in the range {range}.").format( - value=rv, range=self._describe_range() - ), - param, - ctx, - ) - - return rv - - def _clamp(self, bound: float, dir: t.Literal[1, -1], open: bool) -> float: - """Find the valid value to clamp to bound in the given - direction. - - :param bound: The boundary value. - :param dir: 1 or -1 indicating the direction to move. - :param open: If true, the range does not include the bound. - """ - raise NotImplementedError - - def _describe_range(self) -> str: - """Describe the range for use in help text.""" - if self.min is None: - op = "<" if self.max_open else "<=" - return f"x{op}{self.max}" - - if self.max is None: - op = ">" if self.min_open else ">=" - return f"x{op}{self.min}" - - lop = "<" if self.min_open else "<=" - rop = "<" if self.max_open else "<=" - return f"{self.min}{lop}x{rop}{self.max}" - - def __repr__(self) -> str: - clamp = " clamped" if self.clamp else "" - return f"<{type(self).__name__} {self._describe_range()}{clamp}>" - - -class IntParamType(_NumberParamTypeBase): - name = "integer" - _number_class = int - - def __repr__(self) -> str: - return "INT" - - -class IntRange(_NumberRangeBase, IntParamType): - """Restrict an :data:`click.INT` value to a range of accepted - values. See :ref:`ranges`. - - If ``min`` or ``max`` are not passed, any value is accepted in that - direction. If ``min_open`` or ``max_open`` are enabled, the - corresponding boundary is not included in the range. - - If ``clamp`` is enabled, a value outside the range is clamped to the - boundary instead of failing. - - .. versionchanged:: 8.0 - Added the ``min_open`` and ``max_open`` parameters. - """ - - name = "integer range" - - def _clamp( # type: ignore - self, bound: int, dir: t.Literal[1, -1], open: bool - ) -> int: - if not open: - return bound - - return bound + dir - - -class FloatParamType(_NumberParamTypeBase): - name = "float" - _number_class = float - - def __repr__(self) -> str: - return "FLOAT" - - -class FloatRange(_NumberRangeBase, FloatParamType): - """Restrict a :data:`click.FLOAT` value to a range of accepted - values. See :ref:`ranges`. - - If ``min`` or ``max`` are not passed, any value is accepted in that - direction. If ``min_open`` or ``max_open`` are enabled, the - corresponding boundary is not included in the range. - - If ``clamp`` is enabled, a value outside the range is clamped to the - boundary instead of failing. This is not supported if either - boundary is marked ``open``. - - .. versionchanged:: 8.0 - Added the ``min_open`` and ``max_open`` parameters. - """ - - name = "float range" - - def __init__( - self, - min: float | None = None, - max: float | None = None, - min_open: bool = False, - max_open: bool = False, - clamp: bool = False, - ) -> None: - super().__init__( - min=min, max=max, min_open=min_open, max_open=max_open, clamp=clamp - ) - - if (min_open or max_open) and clamp: - raise TypeError("Clamping is not supported for open bounds.") - - def _clamp(self, bound: float, dir: t.Literal[1, -1], open: bool) -> float: - if not open: - return bound - - # Could use math.nextafter here, but clamping an - # open float range doesn't seem to be particularly useful. It's - # left up to the user to write a callback to do it if needed. - raise RuntimeError("Clamping is not supported for open bounds.") - - -class BoolParamType(ParamType): - name = "boolean" - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - if value in {False, True}: - return bool(value) - - norm = value.strip().lower() - - if norm in {"1", "true", "t", "yes", "y", "on"}: - return True - - if norm in {"0", "false", "f", "no", "n", "off"}: - return False - - self.fail( - _("{value!r} is not a valid boolean.").format(value=value), param, ctx - ) - - def __repr__(self) -> str: - return "BOOL" - - -class UUIDParameterType(ParamType): - name = "uuid" - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - import uuid - - if isinstance(value, uuid.UUID): - return value - - value = value.strip() - - try: - return uuid.UUID(value) - except ValueError: - self.fail( - _("{value!r} is not a valid UUID.").format(value=value), param, ctx - ) - - def __repr__(self) -> str: - return "UUID" - - -class File(ParamType): - """Declares a parameter to be a file for reading or writing. The file - is automatically closed once the context tears down (after the command - finished working). - - Files can be opened for reading or writing. The special value ``-`` - indicates stdin or stdout depending on the mode. - - By default, the file is opened for reading text data, but it can also be - opened in binary mode or for writing. The encoding parameter can be used - to force a specific encoding. - - The `lazy` flag controls if the file should be opened immediately or upon - first IO. The default is to be non-lazy for standard input and output - streams as well as files opened for reading, `lazy` otherwise. When opening a - file lazily for reading, it is still opened temporarily for validation, but - will not be held open until first IO. lazy is mainly useful when opening - for writing to avoid creating the file until it is needed. - - Files can also be opened atomically in which case all writes go into a - separate file in the same folder and upon completion the file will - be moved over to the original location. This is useful if a file - regularly read by other users is modified. - - See :ref:`file-args` for more information. - - .. versionchanged:: 2.0 - Added the ``atomic`` parameter. - """ - - name = "filename" - envvar_list_splitter: t.ClassVar[str] = os.path.pathsep - - def __init__( - self, - mode: str = "r", - encoding: str | None = None, - errors: str | None = "strict", - lazy: bool | None = None, - atomic: bool = False, - ) -> None: - self.mode = mode - self.encoding = encoding - self.errors = errors - self.lazy = lazy - self.atomic = atomic - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict.update(mode=self.mode, encoding=self.encoding) - return info_dict - - def resolve_lazy_flag(self, value: str | os.PathLike[str]) -> bool: - if self.lazy is not None: - return self.lazy - if os.fspath(value) == "-": - return False - elif "w" in self.mode: - return True - return False - - def convert( - self, - value: str | os.PathLike[str] | t.IO[t.Any], - param: Parameter | None, - ctx: Context | None, - ) -> t.IO[t.Any]: - if _is_file_like(value): - return value - - value = t.cast("str | os.PathLike[str]", value) - - try: - lazy = self.resolve_lazy_flag(value) - - if lazy: - lf = LazyFile( - value, self.mode, self.encoding, self.errors, atomic=self.atomic - ) - - if ctx is not None: - ctx.call_on_close(lf.close_intelligently) - - return t.cast("t.IO[t.Any]", lf) - - f, should_close = open_stream( - value, self.mode, self.encoding, self.errors, atomic=self.atomic - ) - - # If a context is provided, we automatically close the file - # at the end of the context execution (or flush out). If a - # context does not exist, it's the caller's responsibility to - # properly close the file. This for instance happens when the - # type is used with prompts. - if ctx is not None: - if should_close: - ctx.call_on_close(safecall(f.close)) - else: - ctx.call_on_close(safecall(f.flush)) - - return f - except OSError as e: - self.fail(f"'{format_filename(value)}': {e.strerror}", param, ctx) - - def shell_complete( - self, ctx: Context, param: Parameter, incomplete: str - ) -> list[CompletionItem]: - """Return a special completion marker that tells the completion - system to use the shell to provide file path completions. - - :param ctx: Invocation context for this command. - :param param: The parameter that is requesting completion. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - return [CompletionItem(incomplete, type="file")] - - -def _is_file_like(value: t.Any) -> te.TypeGuard[t.IO[t.Any]]: - return hasattr(value, "read") or hasattr(value, "write") - - -class Path(ParamType): - """The ``Path`` type is similar to the :class:`File` type, but - returns the filename instead of an open file. Various checks can be - enabled to validate the type of file and permissions. - - :param exists: The file or directory needs to exist for the value to - be valid. If this is not set to ``True``, and the file does not - exist, then all further checks are silently skipped. - :param file_okay: Allow a file as a value. - :param dir_okay: Allow a directory as a value. - :param readable: if true, a readable check is performed. - :param writable: if true, a writable check is performed. - :param executable: if true, an executable check is performed. - :param resolve_path: Make the value absolute and resolve any - symlinks. A ``~`` is not expanded, as this is supposed to be - done by the shell only. - :param allow_dash: Allow a single dash as a value, which indicates - a standard stream (but does not open it). Use - :func:`~click.open_file` to handle opening this value. - :param path_type: Convert the incoming path value to this type. If - ``None``, keep Python's default, which is ``str``. Useful to - convert to :class:`pathlib.Path`. - - .. versionchanged:: 8.1 - Added the ``executable`` parameter. - - .. versionchanged:: 8.0 - Allow passing ``path_type=pathlib.Path``. - - .. versionchanged:: 6.0 - Added the ``allow_dash`` parameter. - """ - - envvar_list_splitter: t.ClassVar[str] = os.path.pathsep - - def __init__( - self, - exists: bool = False, - file_okay: bool = True, - dir_okay: bool = True, - writable: bool = False, - readable: bool = True, - resolve_path: bool = False, - allow_dash: bool = False, - path_type: type[t.Any] | None = None, - executable: bool = False, - ): - self.exists = exists - self.file_okay = file_okay - self.dir_okay = dir_okay - self.readable = readable - self.writable = writable - self.executable = executable - self.resolve_path = resolve_path - self.allow_dash = allow_dash - self.type = path_type - - if self.file_okay and not self.dir_okay: - self.name: str = _("file") - elif self.dir_okay and not self.file_okay: - self.name = _("directory") - else: - self.name = _("path") - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict.update( - exists=self.exists, - file_okay=self.file_okay, - dir_okay=self.dir_okay, - writable=self.writable, - readable=self.readable, - allow_dash=self.allow_dash, - ) - return info_dict - - def coerce_path_result( - self, value: str | os.PathLike[str] - ) -> str | bytes | os.PathLike[str]: - if self.type is not None and not isinstance(value, self.type): - if self.type is str: - return os.fsdecode(value) - elif self.type is bytes: - return os.fsencode(value) - else: - return t.cast("os.PathLike[str]", self.type(value)) - - return value - - def convert( - self, - value: str | os.PathLike[str], - param: Parameter | None, - ctx: Context | None, - ) -> str | bytes | os.PathLike[str]: - rv = value - - is_dash = self.file_okay and self.allow_dash and rv in (b"-", "-") - - if not is_dash: - if self.resolve_path: - rv = os.path.realpath(rv) - - try: - st = os.stat(rv) - except OSError: - if not self.exists: - return self.coerce_path_result(rv) - self.fail( - _("{name} {filename!r} does not exist.").format( - name=self.name.title(), filename=format_filename(value) - ), - param, - ctx, - ) - - if not self.file_okay and stat.S_ISREG(st.st_mode): - self.fail( - _("{name} {filename!r} is a file.").format( - name=self.name.title(), filename=format_filename(value) - ), - param, - ctx, - ) - if not self.dir_okay and stat.S_ISDIR(st.st_mode): - self.fail( - _("{name} {filename!r} is a directory.").format( - name=self.name.title(), filename=format_filename(value) - ), - param, - ctx, - ) - - if self.readable and not os.access(rv, os.R_OK): - self.fail( - _("{name} {filename!r} is not readable.").format( - name=self.name.title(), filename=format_filename(value) - ), - param, - ctx, - ) - - if self.writable and not os.access(rv, os.W_OK): - self.fail( - _("{name} {filename!r} is not writable.").format( - name=self.name.title(), filename=format_filename(value) - ), - param, - ctx, - ) - - if self.executable and not os.access(value, os.X_OK): - self.fail( - _("{name} {filename!r} is not executable.").format( - name=self.name.title(), filename=format_filename(value) - ), - param, - ctx, - ) - - return self.coerce_path_result(rv) - - def shell_complete( - self, ctx: Context, param: Parameter, incomplete: str - ) -> list[CompletionItem]: - """Return a special completion marker that tells the completion - system to use the shell to provide path completions for only - directories or any paths. - - :param ctx: Invocation context for this command. - :param param: The parameter that is requesting completion. - :param incomplete: Value being completed. May be empty. - - .. versionadded:: 8.0 - """ - from click.shell_completion import CompletionItem - - type = "dir" if self.dir_okay and not self.file_okay else "file" - return [CompletionItem(incomplete, type=type)] - - -class Tuple(CompositeParamType): - """The default behavior of Click is to apply a type on a value directly. - This works well in most cases, except for when `nargs` is set to a fixed - count and different types should be used for different items. In this - case the :class:`Tuple` type can be used. This type can only be used - if `nargs` is set to a fixed number. - - For more information see :ref:`tuple-type`. - - This can be selected by using a Python tuple literal as a type. - - :param types: a list of types that should be used for the tuple items. - """ - - def __init__(self, types: cabc.Sequence[type[t.Any] | ParamType]) -> None: - self.types: cabc.Sequence[ParamType] = [convert_type(ty) for ty in types] - - def to_info_dict(self) -> dict[str, t.Any]: - info_dict = super().to_info_dict() - info_dict["types"] = [t.to_info_dict() for t in self.types] - return info_dict - - @property - def name(self) -> str: # type: ignore - return f"<{' '.join(ty.name for ty in self.types)}>" - - @property - def arity(self) -> int: # type: ignore - return len(self.types) - - def convert( - self, value: t.Any, param: Parameter | None, ctx: Context | None - ) -> t.Any: - len_type = len(self.types) - len_value = len(value) - - if len_value != len_type: - self.fail( - ngettext( - "{len_type} values are required, but {len_value} was given.", - "{len_type} values are required, but {len_value} were given.", - len_value, - ).format(len_type=len_type, len_value=len_value), - param=param, - ctx=ctx, - ) - - return tuple( - ty(x, param, ctx) for ty, x in zip(self.types, value, strict=False) - ) - - -def convert_type(ty: t.Any | None, default: t.Any | None = None) -> ParamType: - """Find the most appropriate :class:`ParamType` for the given Python - type. If the type isn't provided, it can be inferred from a default - value. - """ - guessed_type = False - - if ty is None and default is not None: - if isinstance(default, (tuple, list)): - # If the default is empty, ty will remain None and will - # return STRING. - if default: - item = default[0] - - # A tuple of tuples needs to detect the inner types. - # Can't call convert recursively because that would - # incorrectly unwind the tuple to a single type. - if isinstance(item, (tuple, list)): - ty = tuple(map(type, item)) - else: - ty = type(item) - else: - ty = type(default) - - guessed_type = True - - if isinstance(ty, tuple): - return Tuple(ty) - - if isinstance(ty, ParamType): - return ty - - if ty is str or ty is None: - return STRING - - if ty is int: - return INT - - if ty is float: - return FLOAT - - if ty is bool: - return BOOL - - if guessed_type: - return STRING - - if __debug__: - try: - if issubclass(ty, ParamType): - raise AssertionError( - f"Attempted to use an uninstantiated parameter type ({ty})." - ) - except TypeError: - # ty is an instance (correct), so issubclass fails. - pass - - return FuncParamType(ty) - - -#: A dummy parameter type that just does nothing. From a user's -#: perspective this appears to just be the same as `STRING` but -#: internally no string conversion takes place if the input was bytes. -#: This is usually useful when working with file paths as they can -#: appear in bytes and unicode. -#: -#: For path related uses the :class:`Path` type is a better choice but -#: there are situations where an unprocessed type is useful which is why -#: it is is provided. -#: -#: .. versionadded:: 4.0 -UNPROCESSED = UnprocessedParamType() - -#: A unicode string parameter type which is the implicit default. This -#: can also be selected by using ``str`` as type. -STRING = StringParamType() - -#: An integer parameter. This can also be selected by using ``int`` as -#: type. -INT = IntParamType() - -#: A floating point value parameter. This can also be selected by using -#: ``float`` as type. -FLOAT = FloatParamType() - -#: A boolean parameter. This is the default for boolean flags. This can -#: also be selected by using ``bool`` as a type. -BOOL = BoolParamType() - -#: A UUID parameter. -UUID = UUIDParameterType() - - -class OptionHelpExtra(t.TypedDict, total=False): - envvars: tuple[str, ...] - default: str - range: str - required: str diff --git a/write-message/venv/lib/python3.10/site-packages/click/utils.py b/write-message/venv/lib/python3.10/site-packages/click/utils.py deleted file mode 100644 index ab2fe58..0000000 --- a/write-message/venv/lib/python3.10/site-packages/click/utils.py +++ /dev/null @@ -1,627 +0,0 @@ -from __future__ import annotations - -import collections.abc as cabc -import os -import re -import sys -import typing as t -from functools import update_wrapper -from types import ModuleType -from types import TracebackType - -from ._compat import _default_text_stderr -from ._compat import _default_text_stdout -from ._compat import _find_binary_writer -from ._compat import auto_wrap_for_ansi -from ._compat import binary_streams -from ._compat import open_stream -from ._compat import should_strip_ansi -from ._compat import strip_ansi -from ._compat import text_streams -from ._compat import WIN -from .globals import resolve_color_default - -if t.TYPE_CHECKING: - import typing_extensions as te - - P = te.ParamSpec("P") - -R = t.TypeVar("R") - - -def _posixify(name: str) -> str: - return "-".join(name.split()).lower() - - -def safecall(func: t.Callable[P, R]) -> t.Callable[P, R | None]: - """Wraps a function so that it swallows exceptions.""" - - def wrapper(*args: P.args, **kwargs: P.kwargs) -> R | None: - try: - return func(*args, **kwargs) - except Exception: - pass - return None - - return update_wrapper(wrapper, func) - - -def make_str(value: t.Any) -> str: - """Converts a value into a valid string.""" - if isinstance(value, bytes): - try: - return value.decode(sys.getfilesystemencoding()) - except UnicodeError: - return value.decode("utf-8", "replace") - return str(value) - - -def make_default_short_help(help: str, max_length: int = 45) -> str: - """Returns a condensed version of help string.""" - # Consider only the first paragraph. - paragraph_end = help.find("\n\n") - - if paragraph_end != -1: - help = help[:paragraph_end] - - # Collapse newlines, tabs, and spaces. - words = help.split() - - if not words: - return "" - - # The first paragraph started with a "no rewrap" marker, ignore it. - if words[0] == "\b": - words = words[1:] - - total_length = 0 - last_index = len(words) - 1 - - for i, word in enumerate(words): - total_length += len(word) + (i > 0) - - if total_length > max_length: # too long, truncate - break - - if word[-1] == ".": # sentence end, truncate without "..." - return " ".join(words[: i + 1]) - - if total_length == max_length and i != last_index: - break # not at sentence end, truncate with "..." - else: - return " ".join(words) # no truncation needed - - # Account for the length of the suffix. - total_length += len("...") - - # remove words until the length is short enough - while i > 0: - total_length -= len(words[i]) + (i > 0) - - if total_length <= max_length: - break - - i -= 1 - - return " ".join(words[:i]) + "..." - - -class LazyFile: - """A lazy file works like a regular file but it does not fully open - the file but it does perform some basic checks early to see if the - filename parameter does make sense. This is useful for safely opening - files for writing. - """ - - def __init__( - self, - filename: str | os.PathLike[str], - mode: str = "r", - encoding: str | None = None, - errors: str | None = "strict", - atomic: bool = False, - ): - self.name: str = os.fspath(filename) - self.mode = mode - self.encoding = encoding - self.errors = errors - self.atomic = atomic - self._f: t.IO[t.Any] | None - self.should_close: bool - - if self.name == "-": - self._f, self.should_close = open_stream(filename, mode, encoding, errors) - else: - if "r" in mode: - # Open and close the file in case we're opening it for - # reading so that we can catch at least some errors in - # some cases early. - open(filename, mode).close() - self._f = None - self.should_close = True - - def __getattr__(self, name: str) -> t.Any: - return getattr(self.open(), name) - - def __repr__(self) -> str: - if self._f is not None: - return repr(self._f) - return f"" - - def open(self) -> t.IO[t.Any]: - """Opens the file if it's not yet open. This call might fail with - a :exc:`FileError`. Not handling this error will produce an error - that Click shows. - """ - if self._f is not None: - return self._f - try: - rv, self.should_close = open_stream( - self.name, self.mode, self.encoding, self.errors, atomic=self.atomic - ) - except OSError as e: - from .exceptions import FileError - - raise FileError(self.name, hint=e.strerror) from e - self._f = rv - return rv - - def close(self) -> None: - """Closes the underlying file, no matter what.""" - if self._f is not None: - self._f.close() - - def close_intelligently(self) -> None: - """This function only closes the file if it was opened by the lazy - file wrapper. For instance this will never close stdin. - """ - if self.should_close: - self.close() - - def __enter__(self) -> LazyFile: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - tb: TracebackType | None, - ) -> None: - self.close_intelligently() - - def __iter__(self) -> cabc.Iterator[t.AnyStr]: - self.open() - return iter(self._f) # type: ignore - - -class KeepOpenFile: - def __init__(self, file: t.IO[t.Any]) -> None: - self._file: t.IO[t.Any] = file - - def __getattr__(self, name: str) -> t.Any: - return getattr(self._file, name) - - def __enter__(self) -> KeepOpenFile: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - tb: TracebackType | None, - ) -> None: - pass - - def __repr__(self) -> str: - return repr(self._file) - - def __iter__(self) -> cabc.Iterator[t.AnyStr]: - return iter(self._file) - - -def echo( - message: t.Any | None = None, - file: t.IO[t.Any] | None = None, - nl: bool = True, - err: bool = False, - color: bool | None = None, -) -> None: - """Print a message and newline to stdout or a file. This should be - used instead of :func:`print` because it provides better support - for different data, files, and environments. - - Compared to :func:`print`, this does the following: - - - Ensures that the output encoding is not misconfigured on Linux. - - Supports Unicode in the Windows console. - - Supports writing to binary outputs, and supports writing bytes - to text outputs. - - Supports colors and styles on Windows. - - Removes ANSI color and style codes if the output does not look - like an interactive terminal. - - Always flushes the output. - - :param message: The string or bytes to output. Other objects are - converted to strings. - :param file: The file to write to. Defaults to ``stdout``. - :param err: Write to ``stderr`` instead of ``stdout``. - :param nl: Print a newline after the message. Enabled by default. - :param color: Force showing or hiding colors and other styles. By - default Click will remove color if the output does not look like - an interactive terminal. - - .. versionchanged:: 6.0 - Support Unicode output on the Windows console. Click does not - modify ``sys.stdout``, so ``sys.stdout.write()`` and ``print()`` - will still not support Unicode. - - .. versionchanged:: 4.0 - Added the ``color`` parameter. - - .. versionadded:: 3.0 - Added the ``err`` parameter. - - .. versionchanged:: 2.0 - Support colors on Windows if colorama is installed. - """ - if file is None: - if err: - file = _default_text_stderr() - else: - file = _default_text_stdout() - - # There are no standard streams attached to write to. For example, - # pythonw on Windows. - if file is None: - return - - # Convert non bytes/text into the native string type. - if message is not None and not isinstance(message, (str, bytes, bytearray)): - out: str | bytes | None = str(message) - else: - out = message - - if nl: - out = out or "" - if isinstance(out, str): - out += "\n" - else: - out += b"\n" - - if not out: - file.flush() - return - - # If there is a message and the value looks like bytes, we manually - # need to find the binary stream and write the message in there. - # This is done separately so that most stream types will work as you - # would expect. Eg: you can write to StringIO for other cases. - if isinstance(out, (bytes, bytearray)): - binary_file = _find_binary_writer(file) - - if binary_file is not None: - file.flush() - binary_file.write(out) - binary_file.flush() - return - - # ANSI style code support. For no message or bytes, nothing happens. - # When outputting to a file instead of a terminal, strip codes. - else: - color = resolve_color_default(color) - - if should_strip_ansi(file, color): - out = strip_ansi(out) - elif WIN: - if auto_wrap_for_ansi is not None: - file = auto_wrap_for_ansi(file, color) # type: ignore - elif not color: - out = strip_ansi(out) - - file.write(out) # type: ignore - file.flush() - - -def get_binary_stream(name: t.Literal["stdin", "stdout", "stderr"]) -> t.BinaryIO: - """Returns a system stream for byte processing. - - :param name: the name of the stream to open. Valid names are ``'stdin'``, - ``'stdout'`` and ``'stderr'`` - """ - opener = binary_streams.get(name) - if opener is None: - raise TypeError(f"Unknown standard stream '{name}'") - return opener() - - -def get_text_stream( - name: t.Literal["stdin", "stdout", "stderr"], - encoding: str | None = None, - errors: str | None = "strict", -) -> t.TextIO: - """Returns a system stream for text processing. This usually returns - a wrapped stream around a binary stream returned from - :func:`get_binary_stream` but it also can take shortcuts for already - correctly configured streams. - - :param name: the name of the stream to open. Valid names are ``'stdin'``, - ``'stdout'`` and ``'stderr'`` - :param encoding: overrides the detected default encoding. - :param errors: overrides the default error mode. - """ - opener = text_streams.get(name) - if opener is None: - raise TypeError(f"Unknown standard stream '{name}'") - return opener(encoding, errors) - - -def open_file( - filename: str | os.PathLike[str], - mode: str = "r", - encoding: str | None = None, - errors: str | None = "strict", - lazy: bool = False, - atomic: bool = False, -) -> t.IO[t.Any]: - """Open a file, with extra behavior to handle ``'-'`` to indicate - a standard stream, lazy open on write, and atomic write. Similar to - the behavior of the :class:`~click.File` param type. - - If ``'-'`` is given to open ``stdout`` or ``stdin``, the stream is - wrapped so that using it in a context manager will not close it. - This makes it possible to use the function without accidentally - closing a standard stream: - - .. code-block:: python - - with open_file(filename) as f: - ... - - :param filename: The name or Path of the file to open, or ``'-'`` for - ``stdin``/``stdout``. - :param mode: The mode in which to open the file. - :param encoding: The encoding to decode or encode a file opened in - text mode. - :param errors: The error handling mode. - :param lazy: Wait to open the file until it is accessed. For read - mode, the file is temporarily opened to raise access errors - early, then closed until it is read again. - :param atomic: Write to a temporary file and replace the given file - on close. - - .. versionadded:: 3.0 - """ - if lazy: - return t.cast( - "t.IO[t.Any]", LazyFile(filename, mode, encoding, errors, atomic=atomic) - ) - - f, should_close = open_stream(filename, mode, encoding, errors, atomic=atomic) - - if not should_close: - f = t.cast("t.IO[t.Any]", KeepOpenFile(f)) - - return f - - -def format_filename( - filename: str | bytes | os.PathLike[str] | os.PathLike[bytes], - shorten: bool = False, -) -> str: - """Format a filename as a string for display. Ensures the filename can be - displayed by replacing any invalid bytes or surrogate escapes in the name - with the replacement character ``�``. - - Invalid bytes or surrogate escapes will raise an error when written to a - stream with ``errors="strict"``. This will typically happen with ``stdout`` - when the locale is something like ``en_GB.UTF-8``. - - Many scenarios *are* safe to write surrogates though, due to PEP 538 and - PEP 540, including: - - - Writing to ``stderr``, which uses ``errors="backslashreplace"``. - - The system has ``LANG=C.UTF-8``, ``C``, or ``POSIX``. Python opens - stdout and stderr with ``errors="surrogateescape"``. - - None of ``LANG/LC_*`` are set. Python assumes ``LANG=C.UTF-8``. - - Python is started in UTF-8 mode with ``PYTHONUTF8=1`` or ``-X utf8``. - Python opens stdout and stderr with ``errors="surrogateescape"``. - - :param filename: formats a filename for UI display. This will also convert - the filename into unicode without failing. - :param shorten: this optionally shortens the filename to strip of the - path that leads up to it. - """ - if shorten: - filename = os.path.basename(filename) - else: - filename = os.fspath(filename) - - if isinstance(filename, bytes): - filename = filename.decode(sys.getfilesystemencoding(), "replace") - else: - filename = filename.encode("utf-8", "surrogateescape").decode( - "utf-8", "replace" - ) - - return filename - - -def get_app_dir(app_name: str, roaming: bool = True, force_posix: bool = False) -> str: - r"""Returns the config folder for the application. The default behavior - is to return whatever is most appropriate for the operating system. - - To give you an idea, for an app called ``"Foo Bar"``, something like - the following folders could be returned: - - Mac OS X: - ``~/Library/Application Support/Foo Bar`` - Mac OS X (POSIX): - ``~/.foo-bar`` - Unix: - ``~/.config/foo-bar`` - Unix (POSIX): - ``~/.foo-bar`` - Windows (roaming): - ``C:\Users\\AppData\Roaming\Foo Bar`` - Windows (not roaming): - ``C:\Users\\AppData\Local\Foo Bar`` - - .. versionadded:: 2.0 - - :param app_name: the application name. This should be properly capitalized - and can contain whitespace. - :param roaming: controls if the folder should be roaming or not on Windows. - Has no effect otherwise. - :param force_posix: if this is set to `True` then on any POSIX system the - folder will be stored in the home folder with a leading - dot instead of the XDG config home or darwin's - application support folder. - """ - if WIN: - key = "APPDATA" if roaming else "LOCALAPPDATA" - folder = os.environ.get(key) - if folder is None: - folder = os.path.expanduser("~") - return os.path.join(folder, app_name) - if force_posix: - return os.path.join(os.path.expanduser(f"~/.{_posixify(app_name)}")) - if sys.platform == "darwin": - return os.path.join( - os.path.expanduser("~/Library/Application Support"), app_name - ) - return os.path.join( - os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), - _posixify(app_name), - ) - - -class PacifyFlushWrapper: - """This wrapper is used to catch and suppress BrokenPipeErrors resulting - from ``.flush()`` being called on broken pipe during the shutdown/final-GC - of the Python interpreter. Notably ``.flush()`` is always called on - ``sys.stdout`` and ``sys.stderr``. So as to have minimal impact on any - other cleanup code, and the case where the underlying file is not a broken - pipe, all calls and attributes are proxied. - """ - - def __init__(self, wrapped: t.IO[t.Any]) -> None: - self.wrapped = wrapped - - def flush(self) -> None: - try: - self.wrapped.flush() - except OSError as e: - import errno - - if e.errno != errno.EPIPE: - raise - - def __getattr__(self, attr: str) -> t.Any: - return getattr(self.wrapped, attr) - - -def _detect_program_name( - path: str | None = None, _main: ModuleType | None = None -) -> str: - """Determine the command used to run the program, for use in help - text. If a file or entry point was executed, the file name is - returned. If ``python -m`` was used to execute a module or package, - ``python -m name`` is returned. - - This doesn't try to be too precise, the goal is to give a concise - name for help text. Files are only shown as their name without the - path. ``python`` is only shown for modules, and the full path to - ``sys.executable`` is not shown. - - :param path: The Python file being executed. Python puts this in - ``sys.argv[0]``, which is used by default. - :param _main: The ``__main__`` module. This should only be passed - during internal testing. - - .. versionadded:: 8.0 - Based on command args detection in the Werkzeug reloader. - - :meta private: - """ - if _main is None: - _main = sys.modules["__main__"] - - if not path: - path = sys.argv[0] - - # The value of __package__ indicates how Python was called. It may - # not exist if a setuptools script is installed as an egg. It may be - # set incorrectly for entry points created with pip on Windows. - # It is set to "" inside a Shiv or PEX zipapp. - if getattr(_main, "__package__", None) in {None, ""} or ( - os.name == "nt" - and _main.__package__ == "" - and not os.path.exists(path) - and os.path.exists(f"{path}.exe") - ): - # Executed a file, like "python app.py". - return os.path.basename(path) - - # Executed a module, like "python -m example". - # Rewritten by Python from "-m script" to "/path/to/script.py". - # Need to look at main module to determine how it was executed. - py_module = t.cast(str, _main.__package__) - name = os.path.splitext(os.path.basename(path))[0] - - # A submodule like "example.cli". - if name != "__main__": - py_module = f"{py_module}.{name}" - - return f"python -m {py_module.lstrip('.')}" - - -def _expand_args( - args: cabc.Iterable[str], - *, - user: bool = True, - env: bool = True, - glob_recursive: bool = True, -) -> list[str]: - """Simulate Unix shell expansion with Python functions. - - See :func:`glob.glob`, :func:`os.path.expanduser`, and - :func:`os.path.expandvars`. - - This is intended for use on Windows, where the shell does not do any - expansion. It may not exactly match what a Unix shell would do. - - :param args: List of command line arguments to expand. - :param user: Expand user home directory. - :param env: Expand environment variables. - :param glob_recursive: ``**`` matches directories recursively. - - .. versionchanged:: 8.1 - Invalid glob patterns are treated as empty expansions rather - than raising an error. - - .. versionadded:: 8.0 - - :meta private: - """ - from glob import glob - - out = [] - - for arg in args: - if user: - arg = os.path.expanduser(arg) - - if env: - arg = os.path.expandvars(arg) - - try: - matches = glob(arg, recursive=glob_recursive) - except re.error: - matches = [] - - if not matches: - out.append(arg) - else: - out.extend(matches) - - return out diff --git a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/LICENSE b/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/LICENSE deleted file mode 100644 index e06d208..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/METADATA deleted file mode 100644 index 9312e8e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/METADATA +++ /dev/null @@ -1,184 +0,0 @@ -Metadata-Version: 2.1 -Name: distro -Version: 1.9.0 -Summary: Distro - an OS platform information API -Home-page: https://github.com/python-distro/distro -Author: Nir Cohen -Author-email: nir36g@gmail.com -License: Apache License, Version 2.0 -Platform: All -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Operating System :: POSIX :: Linux -Classifier: Operating System :: POSIX :: BSD -Classifier: Operating System :: POSIX :: BSD :: FreeBSD -Classifier: Operating System :: POSIX :: BSD :: NetBSD -Classifier: Operating System :: POSIX :: BSD :: OpenBSD -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: Programming Language :: Python :: 3.12 -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: System :: Operating System -Requires-Python: >=3.6 -Description-Content-Type: text/markdown -License-File: LICENSE - -Distro - an OS platform information API -======================================= - -[![CI Status](https://github.com/python-distro/distro/workflows/CI/badge.svg)](https://github.com/python-distro/distro/actions/workflows/ci.yaml) -[![PyPI version](http://img.shields.io/pypi/v/distro.svg)](https://pypi.python.org/pypi/distro) -[![Supported Python Versions](https://img.shields.io/pypi/pyversions/distro.svg)](https://img.shields.io/pypi/pyversions/distro.svg) -[![Code Coverage](https://codecov.io/github/python-distro/distro/coverage.svg?branch=master)](https://codecov.io/github/python-distro/distro?branch=master) -[![Is Wheel](https://img.shields.io/pypi/wheel/distro.svg?style=flat)](https://pypi.python.org/pypi/distro) -[![Latest Github Release](https://readthedocs.org/projects/distro/badge/?version=stable)](http://distro.readthedocs.io/en/latest/) - -`distro` provides information about the -OS distribution it runs on, such as a reliable machine-readable ID, or -version information. - -It is the recommended replacement for Python's original -[`platform.linux_distribution`](https://docs.python.org/3.7/library/platform.html#platform.linux_distribution) -function (removed in Python 3.8). It also provides much more functionality -which isn't necessarily Python bound, like a command-line interface. - -Distro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/python-distro/distro/issues/177) is also planned. - -For Python 2.6 support, see https://github.com/python-distro/distro/tree/python2.6-support - -## Installation - -Installation of the latest released version from PyPI: - -```shell -pip install distro -``` - -Installation of the latest development version: - -```shell -pip install https://github.com/python-distro/distro/archive/master.tar.gz -``` - -To use as a standalone script, download `distro.py` directly: - -```shell -curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py -python distro.py -``` - -``distro`` is safe to vendor within projects that do not wish to add -dependencies. - -```shell -cd myproject -curl -O https://raw.githubusercontent.com/python-distro/distro/master/src/distro/distro.py -``` - -## Usage - -```bash -$ distro -Name: Antergos Linux -Version: 2015.10 (ISO-Rolling) -Codename: ISO-Rolling - -$ distro -j -{ - "codename": "ISO-Rolling", - "id": "antergos", - "like": "arch", - "version": "16.9", - "version_parts": { - "build_number": "", - "major": "16", - "minor": "9" - } -} - - -$ python ->>> import distro ->>> distro.name(pretty=True) -'CentOS Linux 8' ->>> distro.id() -'centos' ->>> distro.version(best=True) -'8.4.2105' -``` - - -## Documentation - -On top of the aforementioned API, several more functions are available. For a complete description of the -API, see the [latest API documentation](http://distro.readthedocs.org/en/latest/). - -## Background - -An alternative implementation became necessary because Python 3.5 deprecated -this function, and Python 3.8 removed it altogether. Its predecessor function -[`platform.dist`](https://docs.python.org/3.7/library/platform.html#platform.dist) -was already deprecated since Python 2.6 and removed in Python 3.8. Still, there -are many cases in which access to that information is needed. See [Python issue -1322](https://bugs.python.org/issue1322) for more information. - -The `distro` package implements a robust and inclusive way of retrieving the -information about a distribution based on new standards and old methods, -namely from these data sources (from high to low precedence): - -* The os-release file `/etc/os-release` if present, with a fall-back on `/usr/lib/os-release` if needed. -* The output of the `lsb_release` command, if available. -* The distro release file (`/etc/*(-|_)(release|version)`), if present. -* The `uname` command for BSD based distrubtions. - - -## Python and Distribution Support - -`distro` is supported and tested on Python 3.6+ and PyPy and on any -distribution that provides one or more of the data sources covered. - -This package is tested with test data that mimics the exact behavior of the data sources of [a number of Linux distributions](https://github.com/python-distro/distro/tree/master/tests/resources/distros). - - -## Testing - -```shell -git clone git@github.com:python-distro/distro.git -cd distro -pip install tox -tox -``` - - -## Contributions - -Pull requests are always welcome to deal with specific distributions or just -for general merriment. - -See [CONTRIBUTIONS](https://github.com/python-distro/distro/blob/master/CONTRIBUTING.md) for contribution info. - -Reference implementations for supporting additional distributions and file -formats can be found here: - -* https://github.com/saltstack/salt/blob/develop/salt/grains/core.py#L1172 -* https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb -* https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py -* https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/os_linux.cc - -## Package manager distributions - -* https://src.fedoraproject.org/rpms/python-distro -* https://www.archlinux.org/packages/community/any/python-distro/ -* https://launchpad.net/ubuntu/+source/python-distro -* https://packages.debian.org/stable/python3-distro -* https://packages.gentoo.org/packages/dev-python/distro -* https://pkgs.org/download/python3-distro -* https://slackbuilds.org/repository/14.2/python/python-distro/ diff --git a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/RECORD deleted file mode 100644 index b350455..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/RECORD +++ /dev/null @@ -1,15 +0,0 @@ -../../../bin/distro,sha256=V3P2LCExCp6gdebqDA6FHgOevNNirGWOVE_m8Kz1WT4,273 -distro-1.9.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -distro-1.9.0.dist-info/LICENSE,sha256=y16Ofl9KOYjhBjwULGDcLfdWBfTEZRXnduOspt-XbhQ,11325 -distro-1.9.0.dist-info/METADATA,sha256=MWMqst5VkRMQkbM5e9zfeXcYV52Fp1GG8Gg53QwJ6B0,6791 -distro-1.9.0.dist-info/RECORD,, -distro-1.9.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92 -distro-1.9.0.dist-info/entry_points.txt,sha256=3ObjqQMbh1xeQQwsWtgbfDNDMDD-EbggR1Oj_z8s9hc,46 -distro-1.9.0.dist-info/top_level.txt,sha256=ikde_V_XEdSBqaGd5tEriN_wzYHLgTX_zVtlsGLHvwQ,7 -distro/__init__.py,sha256=2fHjF-SfgPvjyNZ1iHh_wjqWdR_Yo5ODHwZC0jLBPhc,981 -distro/__main__.py,sha256=bu9d3TifoKciZFcqRBuygV3GSuThnVD_m2IK4cz96Vs,64 -distro/__pycache__/__init__.cpython-310.pyc,, -distro/__pycache__/__main__.cpython-310.pyc,, -distro/__pycache__/distro.cpython-310.pyc,, -distro/distro.py,sha256=XqbefacAhDT4zr_trnbA15eY8vdK4GTghgmvUGrEM_4,49430 -distro/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/WHEEL deleted file mode 100644 index 98c0d20..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.42.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/entry_points.txt b/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/entry_points.txt deleted file mode 100644 index 08d29c5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -distro = distro.distro:main diff --git a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/top_level.txt deleted file mode 100644 index 0e09331..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro-1.9.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -distro diff --git a/write-message/venv/lib/python3.10/site-packages/distro/__init__.py b/write-message/venv/lib/python3.10/site-packages/distro/__init__.py deleted file mode 100644 index 7686fe8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro/__init__.py +++ /dev/null @@ -1,54 +0,0 @@ -from .distro import ( - NORMALIZED_DISTRO_ID, - NORMALIZED_LSB_ID, - NORMALIZED_OS_ID, - LinuxDistribution, - __version__, - build_number, - codename, - distro_release_attr, - distro_release_info, - id, - info, - like, - linux_distribution, - lsb_release_attr, - lsb_release_info, - major_version, - minor_version, - name, - os_release_attr, - os_release_info, - uname_attr, - uname_info, - version, - version_parts, -) - -__all__ = [ - "NORMALIZED_DISTRO_ID", - "NORMALIZED_LSB_ID", - "NORMALIZED_OS_ID", - "LinuxDistribution", - "build_number", - "codename", - "distro_release_attr", - "distro_release_info", - "id", - "info", - "like", - "linux_distribution", - "lsb_release_attr", - "lsb_release_info", - "major_version", - "minor_version", - "name", - "os_release_attr", - "os_release_info", - "uname_attr", - "uname_info", - "version", - "version_parts", -] - -__version__ = __version__ diff --git a/write-message/venv/lib/python3.10/site-packages/distro/__main__.py b/write-message/venv/lib/python3.10/site-packages/distro/__main__.py deleted file mode 100644 index 0c01d5b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .distro import main - -if __name__ == "__main__": - main() diff --git a/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index a3b0d1b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/__main__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/__main__.cpython-310.pyc deleted file mode 100644 index 63ade80..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/__main__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/distro.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/distro.cpython-310.pyc deleted file mode 100644 index bee5c4d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/distro/__pycache__/distro.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/distro/distro.py b/write-message/venv/lib/python3.10/site-packages/distro/distro.py deleted file mode 100644 index 78ccdfa..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distro/distro.py +++ /dev/null @@ -1,1403 +0,0 @@ -#!/usr/bin/env python -# Copyright 2015-2021 Nir Cohen -# -# 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 ``distro`` package (``distro`` stands for Linux Distribution) provides -information about the Linux distribution it runs on, such as a reliable -machine-readable distro ID, or version information. - -It is the recommended replacement for Python's original -:py:func:`platform.linux_distribution` function, but it provides much more -functionality. An alternative implementation became necessary because Python -3.5 deprecated this function, and Python 3.8 removed it altogether. Its -predecessor function :py:func:`platform.dist` was already deprecated since -Python 2.6 and removed in Python 3.8. Still, there are many cases in which -access to OS distribution information is needed. See `Python issue 1322 -`_ for more information. -""" - -import argparse -import json -import logging -import os -import re -import shlex -import subprocess -import sys -import warnings -from typing import ( - Any, - Callable, - Dict, - Iterable, - Optional, - Sequence, - TextIO, - Tuple, - Type, -) - -try: - from typing import TypedDict -except ImportError: - # Python 3.7 - TypedDict = dict - -__version__ = "1.9.0" - - -class VersionDict(TypedDict): - major: str - minor: str - build_number: str - - -class InfoDict(TypedDict): - id: str - version: str - version_parts: VersionDict - like: str - codename: str - - -_UNIXCONFDIR = os.environ.get("UNIXCONFDIR", "/etc") -_UNIXUSRLIBDIR = os.environ.get("UNIXUSRLIBDIR", "/usr/lib") -_OS_RELEASE_BASENAME = "os-release" - -#: Translation table for normalizing the "ID" attribute defined in os-release -#: files, for use by the :func:`distro.id` method. -#: -#: * Key: Value as defined in the os-release file, translated to lower case, -#: with blanks translated to underscores. -#: -#: * Value: Normalized value. -NORMALIZED_OS_ID = { - "ol": "oracle", # Oracle Linux - "opensuse-leap": "opensuse", # Newer versions of OpenSuSE report as opensuse-leap -} - -#: Translation table for normalizing the "Distributor ID" attribute returned by -#: the lsb_release command, for use by the :func:`distro.id` method. -#: -#: * Key: Value as returned by the lsb_release command, translated to lower -#: case, with blanks translated to underscores. -#: -#: * Value: Normalized value. -NORMALIZED_LSB_ID = { - "enterpriseenterpriseas": "oracle", # Oracle Enterprise Linux 4 - "enterpriseenterpriseserver": "oracle", # Oracle Linux 5 - "redhatenterpriseworkstation": "rhel", # RHEL 6, 7 Workstation - "redhatenterpriseserver": "rhel", # RHEL 6, 7 Server - "redhatenterprisecomputenode": "rhel", # RHEL 6 ComputeNode -} - -#: Translation table for normalizing the distro ID derived from the file name -#: of distro release files, for use by the :func:`distro.id` method. -#: -#: * Key: Value as derived from the file name of a distro release file, -#: translated to lower case, with blanks translated to underscores. -#: -#: * Value: Normalized value. -NORMALIZED_DISTRO_ID = { - "redhat": "rhel", # RHEL 6.x, 7.x -} - -# Pattern for content of distro release file (reversed) -_DISTRO_RELEASE_CONTENT_REVERSED_PATTERN = re.compile( - r"(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)" -) - -# Pattern for base file name of distro release file -_DISTRO_RELEASE_BASENAME_PATTERN = re.compile(r"(\w+)[-_](release|version)$") - -# Base file names to be looked up for if _UNIXCONFDIR is not readable. -_DISTRO_RELEASE_BASENAMES = [ - "SuSE-release", - "altlinux-release", - "arch-release", - "base-release", - "centos-release", - "fedora-release", - "gentoo-release", - "mageia-release", - "mandrake-release", - "mandriva-release", - "mandrivalinux-release", - "manjaro-release", - "oracle-release", - "redhat-release", - "rocky-release", - "sl-release", - "slackware-version", -] - -# Base file names to be ignored when searching for distro release file -_DISTRO_RELEASE_IGNORE_BASENAMES = ( - "debian_version", - "lsb-release", - "oem-release", - _OS_RELEASE_BASENAME, - "system-release", - "plesk-release", - "iredmail-release", - "board-release", - "ec2_version", -) - - -def linux_distribution(full_distribution_name: bool = True) -> Tuple[str, str, str]: - """ - .. deprecated:: 1.6.0 - - :func:`distro.linux_distribution()` is deprecated. It should only be - used as a compatibility shim with Python's - :py:func:`platform.linux_distribution()`. Please use :func:`distro.id`, - :func:`distro.version` and :func:`distro.name` instead. - - Return information about the current OS distribution as a tuple - ``(id_name, version, codename)`` with items as follows: - - * ``id_name``: If *full_distribution_name* is false, the result of - :func:`distro.id`. Otherwise, the result of :func:`distro.name`. - - * ``version``: The result of :func:`distro.version`. - - * ``codename``: The extra item (usually in parentheses) after the - os-release version number, or the result of :func:`distro.codename`. - - The interface of this function is compatible with the original - :py:func:`platform.linux_distribution` function, supporting a subset of - its parameters. - - The data it returns may not exactly be the same, because it uses more data - sources than the original function, and that may lead to different data if - the OS distribution is not consistent across multiple data sources it - provides (there are indeed such distributions ...). - - Another reason for differences is the fact that the :func:`distro.id` - method normalizes the distro ID string to a reliable machine-readable value - for a number of popular OS distributions. - """ - warnings.warn( - "distro.linux_distribution() is deprecated. It should only be used as a " - "compatibility shim with Python's platform.linux_distribution(). Please use " - "distro.id(), distro.version() and distro.name() instead.", - DeprecationWarning, - stacklevel=2, - ) - return _distro.linux_distribution(full_distribution_name) - - -def id() -> str: - """ - Return the distro ID of the current distribution, as a - machine-readable string. - - For a number of OS distributions, the returned distro ID value is - *reliable*, in the sense that it is documented and that it does not change - across releases of the distribution. - - This package maintains the following reliable distro ID values: - - ============== ========================================= - Distro ID Distribution - ============== ========================================= - "ubuntu" Ubuntu - "debian" Debian - "rhel" RedHat Enterprise Linux - "centos" CentOS - "fedora" Fedora - "sles" SUSE Linux Enterprise Server - "opensuse" openSUSE - "amzn" Amazon Linux - "arch" Arch Linux - "buildroot" Buildroot - "cloudlinux" CloudLinux OS - "exherbo" Exherbo Linux - "gentoo" GenToo Linux - "ibm_powerkvm" IBM PowerKVM - "kvmibm" KVM for IBM z Systems - "linuxmint" Linux Mint - "mageia" Mageia - "mandriva" Mandriva Linux - "parallels" Parallels - "pidora" Pidora - "raspbian" Raspbian - "oracle" Oracle Linux (and Oracle Enterprise Linux) - "scientific" Scientific Linux - "slackware" Slackware - "xenserver" XenServer - "openbsd" OpenBSD - "netbsd" NetBSD - "freebsd" FreeBSD - "midnightbsd" MidnightBSD - "rocky" Rocky Linux - "aix" AIX - "guix" Guix System - "altlinux" ALT Linux - ============== ========================================= - - If you have a need to get distros for reliable IDs added into this set, - or if you find that the :func:`distro.id` function returns a different - distro ID for one of the listed distros, please create an issue in the - `distro issue tracker`_. - - **Lookup hierarchy and transformations:** - - First, the ID is obtained from the following sources, in the specified - order. The first available and non-empty value is used: - - * the value of the "ID" attribute of the os-release file, - - * the value of the "Distributor ID" attribute returned by the lsb_release - command, - - * the first part of the file name of the distro release file, - - The so determined ID value then passes the following transformations, - before it is returned by this method: - - * it is translated to lower case, - - * blanks (which should not be there anyway) are translated to underscores, - - * a normalization of the ID is performed, based upon - `normalization tables`_. The purpose of this normalization is to ensure - that the ID is as reliable as possible, even across incompatible changes - in the OS distributions. A common reason for an incompatible change is - the addition of an os-release file, or the addition of the lsb_release - command, with ID values that differ from what was previously determined - from the distro release file name. - """ - return _distro.id() - - -def name(pretty: bool = False) -> str: - """ - Return the name of the current OS distribution, as a human-readable - string. - - If *pretty* is false, the name is returned without version or codename. - (e.g. "CentOS Linux") - - If *pretty* is true, the version and codename are appended. - (e.g. "CentOS Linux 7.1.1503 (Core)") - - **Lookup hierarchy:** - - The name is obtained from the following sources, in the specified order. - The first available and non-empty value is used: - - * If *pretty* is false: - - - the value of the "NAME" attribute of the os-release file, - - - the value of the "Distributor ID" attribute returned by the lsb_release - command, - - - the value of the "" field of the distro release file. - - * If *pretty* is true: - - - the value of the "PRETTY_NAME" attribute of the os-release file, - - - the value of the "Description" attribute returned by the lsb_release - command, - - - the value of the "" field of the distro release file, appended - with the value of the pretty version ("" and "" - fields) of the distro release file, if available. - """ - return _distro.name(pretty) - - -def version(pretty: bool = False, best: bool = False) -> str: - """ - Return the version of the current OS distribution, as a human-readable - string. - - If *pretty* is false, the version is returned without codename (e.g. - "7.0"). - - If *pretty* is true, the codename in parenthesis is appended, if the - codename is non-empty (e.g. "7.0 (Maipo)"). - - Some distributions provide version numbers with different precisions in - the different sources of distribution information. Examining the different - sources in a fixed priority order does not always yield the most precise - version (e.g. for Debian 8.2, or CentOS 7.1). - - Some other distributions may not provide this kind of information. In these - cases, an empty string would be returned. This behavior can be observed - with rolling releases distributions (e.g. Arch Linux). - - The *best* parameter can be used to control the approach for the returned - version: - - If *best* is false, the first non-empty version number in priority order of - the examined sources is returned. - - If *best* is true, the most precise version number out of all examined - sources is returned. - - **Lookup hierarchy:** - - In all cases, the version number is obtained from the following sources. - If *best* is false, this order represents the priority order: - - * the value of the "VERSION_ID" attribute of the os-release file, - * the value of the "Release" attribute returned by the lsb_release - command, - * the version number parsed from the "" field of the first line - of the distro release file, - * the version number parsed from the "PRETTY_NAME" attribute of the - os-release file, if it follows the format of the distro release files. - * the version number parsed from the "Description" attribute returned by - the lsb_release command, if it follows the format of the distro release - files. - """ - return _distro.version(pretty, best) - - -def version_parts(best: bool = False) -> Tuple[str, str, str]: - """ - Return the version of the current OS distribution as a tuple - ``(major, minor, build_number)`` with items as follows: - - * ``major``: The result of :func:`distro.major_version`. - - * ``minor``: The result of :func:`distro.minor_version`. - - * ``build_number``: The result of :func:`distro.build_number`. - - For a description of the *best* parameter, see the :func:`distro.version` - method. - """ - return _distro.version_parts(best) - - -def major_version(best: bool = False) -> str: - """ - Return the major version of the current OS distribution, as a string, - if provided. - Otherwise, the empty string is returned. The major version is the first - part of the dot-separated version string. - - For a description of the *best* parameter, see the :func:`distro.version` - method. - """ - return _distro.major_version(best) - - -def minor_version(best: bool = False) -> str: - """ - Return the minor version of the current OS distribution, as a string, - if provided. - Otherwise, the empty string is returned. The minor version is the second - part of the dot-separated version string. - - For a description of the *best* parameter, see the :func:`distro.version` - method. - """ - return _distro.minor_version(best) - - -def build_number(best: bool = False) -> str: - """ - Return the build number of the current OS distribution, as a string, - if provided. - Otherwise, the empty string is returned. The build number is the third part - of the dot-separated version string. - - For a description of the *best* parameter, see the :func:`distro.version` - method. - """ - return _distro.build_number(best) - - -def like() -> str: - """ - Return a space-separated list of distro IDs of distributions that are - closely related to the current OS distribution in regards to packaging - and programming interfaces, for example distributions the current - distribution is a derivative from. - - **Lookup hierarchy:** - - This information item is only provided by the os-release file. - For details, see the description of the "ID_LIKE" attribute in the - `os-release man page - `_. - """ - return _distro.like() - - -def codename() -> str: - """ - Return the codename for the release of the current OS distribution, - as a string. - - If the distribution does not have a codename, an empty string is returned. - - Note that the returned codename is not always really a codename. For - example, openSUSE returns "x86_64". This function does not handle such - cases in any special way and just returns the string it finds, if any. - - **Lookup hierarchy:** - - * the codename within the "VERSION" attribute of the os-release file, if - provided, - - * the value of the "Codename" attribute returned by the lsb_release - command, - - * the value of the "" field of the distro release file. - """ - return _distro.codename() - - -def info(pretty: bool = False, best: bool = False) -> InfoDict: - """ - Return certain machine-readable information items about the current OS - distribution in a dictionary, as shown in the following example: - - .. sourcecode:: python - - { - 'id': 'rhel', - 'version': '7.0', - 'version_parts': { - 'major': '7', - 'minor': '0', - 'build_number': '' - }, - 'like': 'fedora', - 'codename': 'Maipo' - } - - The dictionary structure and keys are always the same, regardless of which - information items are available in the underlying data sources. The values - for the various keys are as follows: - - * ``id``: The result of :func:`distro.id`. - - * ``version``: The result of :func:`distro.version`. - - * ``version_parts -> major``: The result of :func:`distro.major_version`. - - * ``version_parts -> minor``: The result of :func:`distro.minor_version`. - - * ``version_parts -> build_number``: The result of - :func:`distro.build_number`. - - * ``like``: The result of :func:`distro.like`. - - * ``codename``: The result of :func:`distro.codename`. - - For a description of the *pretty* and *best* parameters, see the - :func:`distro.version` method. - """ - return _distro.info(pretty, best) - - -def os_release_info() -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information items - from the os-release file data source of the current OS distribution. - - See `os-release file`_ for details about these information items. - """ - return _distro.os_release_info() - - -def lsb_release_info() -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information items - from the lsb_release command data source of the current OS distribution. - - See `lsb_release command output`_ for details about these information - items. - """ - return _distro.lsb_release_info() - - -def distro_release_info() -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information items - from the distro release file data source of the current OS distribution. - - See `distro release file`_ for details about these information items. - """ - return _distro.distro_release_info() - - -def uname_info() -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information items - from the distro release file data source of the current OS distribution. - """ - return _distro.uname_info() - - -def os_release_attr(attribute: str) -> str: - """ - Return a single named information item from the os-release file data source - of the current OS distribution. - - Parameters: - - * ``attribute`` (string): Key of the information item. - - Returns: - - * (string): Value of the information item, if the item exists. - The empty string, if the item does not exist. - - See `os-release file`_ for details about these information items. - """ - return _distro.os_release_attr(attribute) - - -def lsb_release_attr(attribute: str) -> str: - """ - Return a single named information item from the lsb_release command output - data source of the current OS distribution. - - Parameters: - - * ``attribute`` (string): Key of the information item. - - Returns: - - * (string): Value of the information item, if the item exists. - The empty string, if the item does not exist. - - See `lsb_release command output`_ for details about these information - items. - """ - return _distro.lsb_release_attr(attribute) - - -def distro_release_attr(attribute: str) -> str: - """ - Return a single named information item from the distro release file - data source of the current OS distribution. - - Parameters: - - * ``attribute`` (string): Key of the information item. - - Returns: - - * (string): Value of the information item, if the item exists. - The empty string, if the item does not exist. - - See `distro release file`_ for details about these information items. - """ - return _distro.distro_release_attr(attribute) - - -def uname_attr(attribute: str) -> str: - """ - Return a single named information item from the distro release file - data source of the current OS distribution. - - Parameters: - - * ``attribute`` (string): Key of the information item. - - Returns: - - * (string): Value of the information item, if the item exists. - The empty string, if the item does not exist. - """ - return _distro.uname_attr(attribute) - - -try: - from functools import cached_property -except ImportError: - # Python < 3.8 - class cached_property: # type: ignore - """A version of @property which caches the value. On access, it calls the - underlying function and sets the value in `__dict__` so future accesses - will not re-call the property. - """ - - def __init__(self, f: Callable[[Any], Any]) -> None: - self._fname = f.__name__ - self._f = f - - def __get__(self, obj: Any, owner: Type[Any]) -> Any: - assert obj is not None, f"call {self._fname} on an instance" - ret = obj.__dict__[self._fname] = self._f(obj) - return ret - - -class LinuxDistribution: - """ - Provides information about a OS distribution. - - This package creates a private module-global instance of this class with - default initialization arguments, that is used by the - `consolidated accessor functions`_ and `single source accessor functions`_. - By using default initialization arguments, that module-global instance - returns data about the current OS distribution (i.e. the distro this - package runs on). - - Normally, it is not necessary to create additional instances of this class. - However, in situations where control is needed over the exact data sources - that are used, instances of this class can be created with a specific - distro release file, or a specific os-release file, or without invoking the - lsb_release command. - """ - - def __init__( - self, - include_lsb: Optional[bool] = None, - os_release_file: str = "", - distro_release_file: str = "", - include_uname: Optional[bool] = None, - root_dir: Optional[str] = None, - include_oslevel: Optional[bool] = None, - ) -> None: - """ - The initialization method of this class gathers information from the - available data sources, and stores that in private instance attributes. - Subsequent access to the information items uses these private instance - attributes, so that the data sources are read only once. - - Parameters: - - * ``include_lsb`` (bool): Controls whether the - `lsb_release command output`_ is included as a data source. - - If the lsb_release command is not available in the program execution - path, the data source for the lsb_release command will be empty. - - * ``os_release_file`` (string): The path name of the - `os-release file`_ that is to be used as a data source. - - An empty string (the default) will cause the default path name to - be used (see `os-release file`_ for details). - - If the specified or defaulted os-release file does not exist, the - data source for the os-release file will be empty. - - * ``distro_release_file`` (string): The path name of the - `distro release file`_ that is to be used as a data source. - - An empty string (the default) will cause a default search algorithm - to be used (see `distro release file`_ for details). - - If the specified distro release file does not exist, or if no default - distro release file can be found, the data source for the distro - release file will be empty. - - * ``include_uname`` (bool): Controls whether uname command output is - included as a data source. If the uname command is not available in - the program execution path the data source for the uname command will - be empty. - - * ``root_dir`` (string): The absolute path to the root directory to use - to find distro-related information files. Note that ``include_*`` - parameters must not be enabled in combination with ``root_dir``. - - * ``include_oslevel`` (bool): Controls whether (AIX) oslevel command - output is included as a data source. If the oslevel command is not - available in the program execution path the data source will be - empty. - - Public instance attributes: - - * ``os_release_file`` (string): The path name of the - `os-release file`_ that is actually used as a data source. The - empty string if no distro release file is used as a data source. - - * ``distro_release_file`` (string): The path name of the - `distro release file`_ that is actually used as a data source. The - empty string if no distro release file is used as a data source. - - * ``include_lsb`` (bool): The result of the ``include_lsb`` parameter. - This controls whether the lsb information will be loaded. - - * ``include_uname`` (bool): The result of the ``include_uname`` - parameter. This controls whether the uname information will - be loaded. - - * ``include_oslevel`` (bool): The result of the ``include_oslevel`` - parameter. This controls whether (AIX) oslevel information will be - loaded. - - * ``root_dir`` (string): The result of the ``root_dir`` parameter. - The absolute path to the root directory to use to find distro-related - information files. - - Raises: - - * :py:exc:`ValueError`: Initialization parameters combination is not - supported. - - * :py:exc:`OSError`: Some I/O issue with an os-release file or distro - release file. - - * :py:exc:`UnicodeError`: A data source has unexpected characters or - uses an unexpected encoding. - """ - self.root_dir = root_dir - self.etc_dir = os.path.join(root_dir, "etc") if root_dir else _UNIXCONFDIR - self.usr_lib_dir = ( - os.path.join(root_dir, "usr/lib") if root_dir else _UNIXUSRLIBDIR - ) - - if os_release_file: - self.os_release_file = os_release_file - else: - etc_dir_os_release_file = os.path.join(self.etc_dir, _OS_RELEASE_BASENAME) - usr_lib_os_release_file = os.path.join( - self.usr_lib_dir, _OS_RELEASE_BASENAME - ) - - # NOTE: The idea is to respect order **and** have it set - # at all times for API backwards compatibility. - if os.path.isfile(etc_dir_os_release_file) or not os.path.isfile( - usr_lib_os_release_file - ): - self.os_release_file = etc_dir_os_release_file - else: - self.os_release_file = usr_lib_os_release_file - - self.distro_release_file = distro_release_file or "" # updated later - - is_root_dir_defined = root_dir is not None - if is_root_dir_defined and (include_lsb or include_uname or include_oslevel): - raise ValueError( - "Including subprocess data sources from specific root_dir is disallowed" - " to prevent false information" - ) - self.include_lsb = ( - include_lsb if include_lsb is not None else not is_root_dir_defined - ) - self.include_uname = ( - include_uname if include_uname is not None else not is_root_dir_defined - ) - self.include_oslevel = ( - include_oslevel if include_oslevel is not None else not is_root_dir_defined - ) - - def __repr__(self) -> str: - """Return repr of all info""" - return ( - "LinuxDistribution(" - "os_release_file={self.os_release_file!r}, " - "distro_release_file={self.distro_release_file!r}, " - "include_lsb={self.include_lsb!r}, " - "include_uname={self.include_uname!r}, " - "include_oslevel={self.include_oslevel!r}, " - "root_dir={self.root_dir!r}, " - "_os_release_info={self._os_release_info!r}, " - "_lsb_release_info={self._lsb_release_info!r}, " - "_distro_release_info={self._distro_release_info!r}, " - "_uname_info={self._uname_info!r}, " - "_oslevel_info={self._oslevel_info!r})".format(self=self) - ) - - def linux_distribution( - self, full_distribution_name: bool = True - ) -> Tuple[str, str, str]: - """ - Return information about the OS distribution that is compatible - with Python's :func:`platform.linux_distribution`, supporting a subset - of its parameters. - - For details, see :func:`distro.linux_distribution`. - """ - return ( - self.name() if full_distribution_name else self.id(), - self.version(), - self._os_release_info.get("release_codename") or self.codename(), - ) - - def id(self) -> str: - """Return the distro ID of the OS distribution, as a string. - - For details, see :func:`distro.id`. - """ - - def normalize(distro_id: str, table: Dict[str, str]) -> str: - distro_id = distro_id.lower().replace(" ", "_") - return table.get(distro_id, distro_id) - - distro_id = self.os_release_attr("id") - if distro_id: - return normalize(distro_id, NORMALIZED_OS_ID) - - distro_id = self.lsb_release_attr("distributor_id") - if distro_id: - return normalize(distro_id, NORMALIZED_LSB_ID) - - distro_id = self.distro_release_attr("id") - if distro_id: - return normalize(distro_id, NORMALIZED_DISTRO_ID) - - distro_id = self.uname_attr("id") - if distro_id: - return normalize(distro_id, NORMALIZED_DISTRO_ID) - - return "" - - def name(self, pretty: bool = False) -> str: - """ - Return the name of the OS distribution, as a string. - - For details, see :func:`distro.name`. - """ - name = ( - self.os_release_attr("name") - or self.lsb_release_attr("distributor_id") - or self.distro_release_attr("name") - or self.uname_attr("name") - ) - if pretty: - name = self.os_release_attr("pretty_name") or self.lsb_release_attr( - "description" - ) - if not name: - name = self.distro_release_attr("name") or self.uname_attr("name") - version = self.version(pretty=True) - if version: - name = f"{name} {version}" - return name or "" - - def version(self, pretty: bool = False, best: bool = False) -> str: - """ - Return the version of the OS distribution, as a string. - - For details, see :func:`distro.version`. - """ - versions = [ - self.os_release_attr("version_id"), - self.lsb_release_attr("release"), - self.distro_release_attr("version_id"), - self._parse_distro_release_content(self.os_release_attr("pretty_name")).get( - "version_id", "" - ), - self._parse_distro_release_content( - self.lsb_release_attr("description") - ).get("version_id", ""), - self.uname_attr("release"), - ] - if self.uname_attr("id").startswith("aix"): - # On AIX platforms, prefer oslevel command output. - versions.insert(0, self.oslevel_info()) - elif self.id() == "debian" or "debian" in self.like().split(): - # On Debian-like, add debian_version file content to candidates list. - versions.append(self._debian_version) - version = "" - if best: - # This algorithm uses the last version in priority order that has - # the best precision. If the versions are not in conflict, that - # does not matter; otherwise, using the last one instead of the - # first one might be considered a surprise. - for v in versions: - if v.count(".") > version.count(".") or version == "": - version = v - else: - for v in versions: - if v != "": - version = v - break - if pretty and version and self.codename(): - version = f"{version} ({self.codename()})" - return version - - def version_parts(self, best: bool = False) -> Tuple[str, str, str]: - """ - Return the version of the OS distribution, as a tuple of version - numbers. - - For details, see :func:`distro.version_parts`. - """ - version_str = self.version(best=best) - if version_str: - version_regex = re.compile(r"(\d+)\.?(\d+)?\.?(\d+)?") - matches = version_regex.match(version_str) - if matches: - major, minor, build_number = matches.groups() - return major, minor or "", build_number or "" - return "", "", "" - - def major_version(self, best: bool = False) -> str: - """ - Return the major version number of the current distribution. - - For details, see :func:`distro.major_version`. - """ - return self.version_parts(best)[0] - - def minor_version(self, best: bool = False) -> str: - """ - Return the minor version number of the current distribution. - - For details, see :func:`distro.minor_version`. - """ - return self.version_parts(best)[1] - - def build_number(self, best: bool = False) -> str: - """ - Return the build number of the current distribution. - - For details, see :func:`distro.build_number`. - """ - return self.version_parts(best)[2] - - def like(self) -> str: - """ - Return the IDs of distributions that are like the OS distribution. - - For details, see :func:`distro.like`. - """ - return self.os_release_attr("id_like") or "" - - def codename(self) -> str: - """ - Return the codename of the OS distribution. - - For details, see :func:`distro.codename`. - """ - try: - # Handle os_release specially since distros might purposefully set - # this to empty string to have no codename - return self._os_release_info["codename"] - except KeyError: - return ( - self.lsb_release_attr("codename") - or self.distro_release_attr("codename") - or "" - ) - - def info(self, pretty: bool = False, best: bool = False) -> InfoDict: - """ - Return certain machine-readable information about the OS - distribution. - - For details, see :func:`distro.info`. - """ - return InfoDict( - id=self.id(), - version=self.version(pretty, best), - version_parts=VersionDict( - major=self.major_version(best), - minor=self.minor_version(best), - build_number=self.build_number(best), - ), - like=self.like(), - codename=self.codename(), - ) - - def os_release_info(self) -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information - items from the os-release file data source of the OS distribution. - - For details, see :func:`distro.os_release_info`. - """ - return self._os_release_info - - def lsb_release_info(self) -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information - items from the lsb_release command data source of the OS - distribution. - - For details, see :func:`distro.lsb_release_info`. - """ - return self._lsb_release_info - - def distro_release_info(self) -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information - items from the distro release file data source of the OS - distribution. - - For details, see :func:`distro.distro_release_info`. - """ - return self._distro_release_info - - def uname_info(self) -> Dict[str, str]: - """ - Return a dictionary containing key-value pairs for the information - items from the uname command data source of the OS distribution. - - For details, see :func:`distro.uname_info`. - """ - return self._uname_info - - def oslevel_info(self) -> str: - """ - Return AIX' oslevel command output. - """ - return self._oslevel_info - - def os_release_attr(self, attribute: str) -> str: - """ - Return a single named information item from the os-release file data - source of the OS distribution. - - For details, see :func:`distro.os_release_attr`. - """ - return self._os_release_info.get(attribute, "") - - def lsb_release_attr(self, attribute: str) -> str: - """ - Return a single named information item from the lsb_release command - output data source of the OS distribution. - - For details, see :func:`distro.lsb_release_attr`. - """ - return self._lsb_release_info.get(attribute, "") - - def distro_release_attr(self, attribute: str) -> str: - """ - Return a single named information item from the distro release file - data source of the OS distribution. - - For details, see :func:`distro.distro_release_attr`. - """ - return self._distro_release_info.get(attribute, "") - - def uname_attr(self, attribute: str) -> str: - """ - Return a single named information item from the uname command - output data source of the OS distribution. - - For details, see :func:`distro.uname_attr`. - """ - return self._uname_info.get(attribute, "") - - @cached_property - def _os_release_info(self) -> Dict[str, str]: - """ - Get the information items from the specified os-release file. - - Returns: - A dictionary containing all information items. - """ - if os.path.isfile(self.os_release_file): - with open(self.os_release_file, encoding="utf-8") as release_file: - return self._parse_os_release_content(release_file) - return {} - - @staticmethod - def _parse_os_release_content(lines: TextIO) -> Dict[str, str]: - """ - Parse the lines of an os-release file. - - Parameters: - - * lines: Iterable through the lines in the os-release file. - Each line must be a unicode string or a UTF-8 encoded byte - string. - - Returns: - A dictionary containing all information items. - """ - props = {} - lexer = shlex.shlex(lines, posix=True) - lexer.whitespace_split = True - - tokens = list(lexer) - for token in tokens: - # At this point, all shell-like parsing has been done (i.e. - # comments processed, quotes and backslash escape sequences - # processed, multi-line values assembled, trailing newlines - # stripped, etc.), so the tokens are now either: - # * variable assignments: var=value - # * commands or their arguments (not allowed in os-release) - # Ignore any tokens that are not variable assignments - if "=" in token: - k, v = token.split("=", 1) - props[k.lower()] = v - - if "version" in props: - # extract release codename (if any) from version attribute - match = re.search(r"\((\D+)\)|,\s*(\D+)", props["version"]) - if match: - release_codename = match.group(1) or match.group(2) - props["codename"] = props["release_codename"] = release_codename - - if "version_codename" in props: - # os-release added a version_codename field. Use that in - # preference to anything else Note that some distros purposefully - # do not have code names. They should be setting - # version_codename="" - props["codename"] = props["version_codename"] - elif "ubuntu_codename" in props: - # Same as above but a non-standard field name used on older Ubuntus - props["codename"] = props["ubuntu_codename"] - - return props - - @cached_property - def _lsb_release_info(self) -> Dict[str, str]: - """ - Get the information items from the lsb_release command output. - - Returns: - A dictionary containing all information items. - """ - if not self.include_lsb: - return {} - try: - cmd = ("lsb_release", "-a") - stdout = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) - # Command not found or lsb_release returned error - except (OSError, subprocess.CalledProcessError): - return {} - content = self._to_str(stdout).splitlines() - return self._parse_lsb_release_content(content) - - @staticmethod - def _parse_lsb_release_content(lines: Iterable[str]) -> Dict[str, str]: - """ - Parse the output of the lsb_release command. - - Parameters: - - * lines: Iterable through the lines of the lsb_release output. - Each line must be a unicode string or a UTF-8 encoded byte - string. - - Returns: - A dictionary containing all information items. - """ - props = {} - for line in lines: - kv = line.strip("\n").split(":", 1) - if len(kv) != 2: - # Ignore lines without colon. - continue - k, v = kv - props.update({k.replace(" ", "_").lower(): v.strip()}) - return props - - @cached_property - def _uname_info(self) -> Dict[str, str]: - if not self.include_uname: - return {} - try: - cmd = ("uname", "-rs") - stdout = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) - except OSError: - return {} - content = self._to_str(stdout).splitlines() - return self._parse_uname_content(content) - - @cached_property - def _oslevel_info(self) -> str: - if not self.include_oslevel: - return "" - try: - stdout = subprocess.check_output("oslevel", stderr=subprocess.DEVNULL) - except (OSError, subprocess.CalledProcessError): - return "" - return self._to_str(stdout).strip() - - @cached_property - def _debian_version(self) -> str: - try: - with open( - os.path.join(self.etc_dir, "debian_version"), encoding="ascii" - ) as fp: - return fp.readline().rstrip() - except FileNotFoundError: - return "" - - @staticmethod - def _parse_uname_content(lines: Sequence[str]) -> Dict[str, str]: - if not lines: - return {} - props = {} - match = re.search(r"^([^\s]+)\s+([\d\.]+)", lines[0].strip()) - if match: - name, version = match.groups() - - # This is to prevent the Linux kernel version from - # appearing as the 'best' version on otherwise - # identifiable distributions. - if name == "Linux": - return {} - props["id"] = name.lower() - props["name"] = name - props["release"] = version - return props - - @staticmethod - def _to_str(bytestring: bytes) -> str: - encoding = sys.getfilesystemencoding() - return bytestring.decode(encoding) - - @cached_property - def _distro_release_info(self) -> Dict[str, str]: - """ - Get the information items from the specified distro release file. - - Returns: - A dictionary containing all information items. - """ - if self.distro_release_file: - # If it was specified, we use it and parse what we can, even if - # its file name or content does not match the expected pattern. - distro_info = self._parse_distro_release_file(self.distro_release_file) - basename = os.path.basename(self.distro_release_file) - # The file name pattern for user-specified distro release files - # is somewhat more tolerant (compared to when searching for the - # file), because we want to use what was specified as best as - # possible. - match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) - else: - try: - basenames = [ - basename - for basename in os.listdir(self.etc_dir) - if basename not in _DISTRO_RELEASE_IGNORE_BASENAMES - and os.path.isfile(os.path.join(self.etc_dir, basename)) - ] - # We sort for repeatability in cases where there are multiple - # distro specific files; e.g. CentOS, Oracle, Enterprise all - # containing `redhat-release` on top of their own. - basenames.sort() - except OSError: - # This may occur when /etc is not readable but we can't be - # sure about the *-release files. Check common entries of - # /etc for information. If they turn out to not be there the - # error is handled in `_parse_distro_release_file()`. - basenames = _DISTRO_RELEASE_BASENAMES - for basename in basenames: - match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) - if match is None: - continue - filepath = os.path.join(self.etc_dir, basename) - distro_info = self._parse_distro_release_file(filepath) - # The name is always present if the pattern matches. - if "name" not in distro_info: - continue - self.distro_release_file = filepath - break - else: # the loop didn't "break": no candidate. - return {} - - if match is not None: - distro_info["id"] = match.group(1) - - # CloudLinux < 7: manually enrich info with proper id. - if "cloudlinux" in distro_info.get("name", "").lower(): - distro_info["id"] = "cloudlinux" - - return distro_info - - def _parse_distro_release_file(self, filepath: str) -> Dict[str, str]: - """ - Parse a distro release file. - - Parameters: - - * filepath: Path name of the distro release file. - - Returns: - A dictionary containing all information items. - """ - try: - with open(filepath, encoding="utf-8") as fp: - # Only parse the first line. For instance, on SLES there - # are multiple lines. We don't want them... - return self._parse_distro_release_content(fp.readline()) - except OSError: - # Ignore not being able to read a specific, seemingly version - # related file. - # See https://github.com/python-distro/distro/issues/162 - return {} - - @staticmethod - def _parse_distro_release_content(line: str) -> Dict[str, str]: - """ - Parse a line from a distro release file. - - Parameters: - * line: Line from the distro release file. Must be a unicode string - or a UTF-8 encoded byte string. - - Returns: - A dictionary containing all information items. - """ - matches = _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN.match(line.strip()[::-1]) - distro_info = {} - if matches: - # regexp ensures non-None - distro_info["name"] = matches.group(3)[::-1] - if matches.group(2): - distro_info["version_id"] = matches.group(2)[::-1] - if matches.group(1): - distro_info["codename"] = matches.group(1)[::-1] - elif line: - distro_info["name"] = line.strip() - return distro_info - - -_distro = LinuxDistribution() - - -def main() -> None: - logger = logging.getLogger(__name__) - logger.setLevel(logging.DEBUG) - logger.addHandler(logging.StreamHandler(sys.stdout)) - - parser = argparse.ArgumentParser(description="OS distro info tool") - parser.add_argument( - "--json", "-j", help="Output in machine readable format", action="store_true" - ) - - parser.add_argument( - "--root-dir", - "-r", - type=str, - dest="root_dir", - help="Path to the root filesystem directory (defaults to /)", - ) - - args = parser.parse_args() - - if args.root_dir: - dist = LinuxDistribution( - include_lsb=False, - include_uname=False, - include_oslevel=False, - root_dir=args.root_dir, - ) - else: - dist = _distro - - if args.json: - logger.info(json.dumps(dist.info(), indent=4, sort_keys=True)) - else: - logger.info("Name: %s", dist.name(pretty=True)) - distribution_version = dist.version(pretty=True) - logger.info("Version: %s", distribution_version) - distribution_codename = dist.codename() - logger.info("Codename: %s", distribution_codename) - - -if __name__ == "__main__": - main() diff --git a/write-message/venv/lib/python3.10/site-packages/distro/py.typed b/write-message/venv/lib/python3.10/site-packages/distro/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/distutils-precedence.pth b/write-message/venv/lib/python3.10/site-packages/distutils-precedence.pth deleted file mode 100644 index 7f009fe..0000000 --- a/write-message/venv/lib/python3.10/site-packages/distutils-precedence.pth +++ /dev/null @@ -1 +0,0 @@ -import os; var = 'SETUPTOOLS_USE_DISTUTILS'; enabled = os.environ.get(var, 'local') == 'local'; enabled and __import__('_distutils_hack').add_shim(); diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__init__.py b/write-message/venv/lib/python3.10/site-packages/dns/__init__.py deleted file mode 100644 index a4249b9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/__init__.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009, 2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""dnspython DNS toolkit""" - -__all__ = [ - "asyncbackend", - "asyncquery", - "asyncresolver", - "dnssec", - "dnssecalgs", - "dnssectypes", - "e164", - "edns", - "entropy", - "exception", - "flags", - "immutable", - "inet", - "ipv4", - "ipv6", - "message", - "name", - "namedict", - "node", - "opcode", - "query", - "quic", - "rcode", - "rdata", - "rdataclass", - "rdataset", - "rdatatype", - "renderer", - "resolver", - "reversename", - "rrset", - "serial", - "set", - "tokenizer", - "transaction", - "tsig", - "tsigkeyring", - "ttl", - "rdtypes", - "update", - "version", - "versioned", - "wire", - "xfr", - "zone", - "zonetypes", - "zonefile", -] - -from dns.version import version as __version__ # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 947559a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_asyncbackend.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_asyncbackend.cpython-310.pyc deleted file mode 100644 index 9429838..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_asyncbackend.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_asyncio_backend.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_asyncio_backend.cpython-310.pyc deleted file mode 100644 index 72aa4e6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_asyncio_backend.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_ddr.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_ddr.cpython-310.pyc deleted file mode 100644 index 5ba4c19..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_ddr.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_features.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_features.cpython-310.pyc deleted file mode 100644 index 2b81407..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_features.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_immutable_ctx.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_immutable_ctx.cpython-310.pyc deleted file mode 100644 index 38ebdd2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_immutable_ctx.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_trio_backend.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_trio_backend.cpython-310.pyc deleted file mode 100644 index 9dc0c6d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/_trio_backend.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncbackend.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncbackend.cpython-310.pyc deleted file mode 100644 index 8b4db56..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncbackend.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncquery.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncquery.cpython-310.pyc deleted file mode 100644 index 77ba275..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncquery.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncresolver.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncresolver.cpython-310.pyc deleted file mode 100644 index 1806748..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/asyncresolver.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/dnssec.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/dnssec.cpython-310.pyc deleted file mode 100644 index 33c2f39..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/dnssec.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/dnssectypes.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/dnssectypes.cpython-310.pyc deleted file mode 100644 index 36fb43b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/dnssectypes.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/e164.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/e164.cpython-310.pyc deleted file mode 100644 index 7029d1a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/e164.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/edns.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/edns.cpython-310.pyc deleted file mode 100644 index 0cdbe77..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/edns.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/entropy.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/entropy.cpython-310.pyc deleted file mode 100644 index 81b0728..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/entropy.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/enum.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/enum.cpython-310.pyc deleted file mode 100644 index 84a6768..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/enum.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/exception.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/exception.cpython-310.pyc deleted file mode 100644 index 48ba735..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/exception.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/flags.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/flags.cpython-310.pyc deleted file mode 100644 index 09eb0e9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/flags.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/grange.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/grange.cpython-310.pyc deleted file mode 100644 index db07cd4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/grange.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/immutable.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/immutable.cpython-310.pyc deleted file mode 100644 index f8059e0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/immutable.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/inet.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/inet.cpython-310.pyc deleted file mode 100644 index b2a7806..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/inet.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ipv4.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ipv4.cpython-310.pyc deleted file mode 100644 index 93ad8f5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ipv4.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ipv6.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ipv6.cpython-310.pyc deleted file mode 100644 index 3483add..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ipv6.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/message.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/message.cpython-310.pyc deleted file mode 100644 index c411da2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/message.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/name.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/name.cpython-310.pyc deleted file mode 100644 index 60f3360..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/name.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/namedict.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/namedict.cpython-310.pyc deleted file mode 100644 index 5b4ed75..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/namedict.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/nameserver.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/nameserver.cpython-310.pyc deleted file mode 100644 index 5740518..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/nameserver.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/node.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/node.cpython-310.pyc deleted file mode 100644 index e46c4ba..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/node.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/opcode.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/opcode.cpython-310.pyc deleted file mode 100644 index 11dfe57..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/opcode.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/query.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/query.cpython-310.pyc deleted file mode 100644 index 27a4a84..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/query.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rcode.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rcode.cpython-310.pyc deleted file mode 100644 index 0d66b8b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rcode.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdata.cpython-310.pyc deleted file mode 100644 index 4cd07d3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdataclass.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdataclass.cpython-310.pyc deleted file mode 100644 index 944a154..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdataclass.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdataset.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdataset.cpython-310.pyc deleted file mode 100644 index 9c73faf..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdataset.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdatatype.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdatatype.cpython-310.pyc deleted file mode 100644 index f0482da..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rdatatype.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/renderer.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/renderer.cpython-310.pyc deleted file mode 100644 index 025f1a7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/renderer.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/resolver.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/resolver.cpython-310.pyc deleted file mode 100644 index 7746a15..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/resolver.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/reversename.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/reversename.cpython-310.pyc deleted file mode 100644 index 5e52e4a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/reversename.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rrset.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rrset.cpython-310.pyc deleted file mode 100644 index 325734a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/rrset.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/serial.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/serial.cpython-310.pyc deleted file mode 100644 index 2edd564..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/serial.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/set.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/set.cpython-310.pyc deleted file mode 100644 index 9619b19..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/set.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tokenizer.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tokenizer.cpython-310.pyc deleted file mode 100644 index 58afc63..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tokenizer.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/transaction.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/transaction.cpython-310.pyc deleted file mode 100644 index 99a4365..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/transaction.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tsig.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tsig.cpython-310.pyc deleted file mode 100644 index ed1b37b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tsig.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tsigkeyring.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tsigkeyring.cpython-310.pyc deleted file mode 100644 index a0ea5e1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/tsigkeyring.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ttl.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ttl.cpython-310.pyc deleted file mode 100644 index e248f73..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/ttl.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/update.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/update.cpython-310.pyc deleted file mode 100644 index 7856ba4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/update.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/version.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/version.cpython-310.pyc deleted file mode 100644 index b49f660..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/version.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/versioned.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/versioned.cpython-310.pyc deleted file mode 100644 index 9e47ee3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/versioned.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/win32util.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/win32util.cpython-310.pyc deleted file mode 100644 index f330555..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/win32util.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/wire.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/wire.cpython-310.pyc deleted file mode 100644 index 3debd98..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/wire.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/xfr.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/xfr.cpython-310.pyc deleted file mode 100644 index ef49b5f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/xfr.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zone.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zone.cpython-310.pyc deleted file mode 100644 index 606fbc1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zone.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zonefile.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zonefile.cpython-310.pyc deleted file mode 100644 index 0d6a055..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zonefile.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zonetypes.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zonetypes.cpython-310.pyc deleted file mode 100644 index 635fcbc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/__pycache__/zonetypes.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/_asyncbackend.py b/write-message/venv/lib/python3.10/site-packages/dns/_asyncbackend.py deleted file mode 100644 index f6760fd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/_asyncbackend.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# This is a nullcontext for both sync and async. 3.7 has a nullcontext, -# but it is only for sync use. - - -class NullContext: - def __init__(self, enter_result=None): - self.enter_result = enter_result - - def __enter__(self): - return self.enter_result - - def __exit__(self, exc_type, exc_value, traceback): - pass - - async def __aenter__(self): - return self.enter_result - - async def __aexit__(self, exc_type, exc_value, traceback): - pass - - -# These are declared here so backends can import them without creating -# circular dependencies with dns.asyncbackend. - - -class Socket: # pragma: no cover - def __init__(self, family: int, type: int): - self.family = family - self.type = type - - async def close(self): - pass - - async def getpeername(self): - raise NotImplementedError - - async def getsockname(self): - raise NotImplementedError - - async def getpeercert(self, timeout): - raise NotImplementedError - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_value, traceback): - await self.close() - - -class DatagramSocket(Socket): # pragma: no cover - async def sendto(self, what, destination, timeout): - raise NotImplementedError - - async def recvfrom(self, size, timeout): - raise NotImplementedError - - -class StreamSocket(Socket): # pragma: no cover - async def sendall(self, what, timeout): - raise NotImplementedError - - async def recv(self, size, timeout): - raise NotImplementedError - - -class NullTransport: - async def connect_tcp(self, host, port, timeout, local_address): - raise NotImplementedError - - -class Backend: # pragma: no cover - def name(self): - return "unknown" - - async def make_socket( - self, - af, - socktype, - proto=0, - source=None, - destination=None, - timeout=None, - ssl_context=None, - server_hostname=None, - ): - raise NotImplementedError - - def datagram_connection_required(self): - return False - - async def sleep(self, interval): - raise NotImplementedError - - def get_transport_class(self): - raise NotImplementedError - - async def wait_for(self, awaitable, timeout): - raise NotImplementedError diff --git a/write-message/venv/lib/python3.10/site-packages/dns/_asyncio_backend.py b/write-message/venv/lib/python3.10/site-packages/dns/_asyncio_backend.py deleted file mode 100644 index 6ab168d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/_asyncio_backend.py +++ /dev/null @@ -1,275 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -"""asyncio library query support""" - -import asyncio -import socket -import sys - -import dns._asyncbackend -import dns._features -import dns.exception -import dns.inet - -_is_win32 = sys.platform == "win32" - - -def _get_running_loop(): - try: - return asyncio.get_running_loop() - except AttributeError: # pragma: no cover - return asyncio.get_event_loop() - - -class _DatagramProtocol: - def __init__(self): - self.transport = None - self.recvfrom = None - - def connection_made(self, transport): - self.transport = transport - - def datagram_received(self, data, addr): - if self.recvfrom and not self.recvfrom.done(): - self.recvfrom.set_result((data, addr)) - - def error_received(self, exc): # pragma: no cover - if self.recvfrom and not self.recvfrom.done(): - self.recvfrom.set_exception(exc) - - def connection_lost(self, exc): - if self.recvfrom and not self.recvfrom.done(): - if exc is None: - # EOF we triggered. Is there a better way to do this? - try: - raise EOFError("EOF") - except EOFError as e: - self.recvfrom.set_exception(e) - else: - self.recvfrom.set_exception(exc) - - def close(self): - self.transport.close() - - -async def _maybe_wait_for(awaitable, timeout): - if timeout is not None: - try: - return await asyncio.wait_for(awaitable, timeout) - except asyncio.TimeoutError: - raise dns.exception.Timeout(timeout=timeout) - else: - return await awaitable - - -class DatagramSocket(dns._asyncbackend.DatagramSocket): - def __init__(self, family, transport, protocol): - super().__init__(family, socket.SOCK_DGRAM) - self.transport = transport - self.protocol = protocol - - async def sendto(self, what, destination, timeout): # pragma: no cover - # no timeout for asyncio sendto - self.transport.sendto(what, destination) - return len(what) - - async def recvfrom(self, size, timeout): - # ignore size as there's no way I know to tell protocol about it - done = _get_running_loop().create_future() - try: - assert self.protocol.recvfrom is None - self.protocol.recvfrom = done - await _maybe_wait_for(done, timeout) - return done.result() - finally: - self.protocol.recvfrom = None - - async def close(self): - self.protocol.close() - - async def getpeername(self): - return self.transport.get_extra_info("peername") - - async def getsockname(self): - return self.transport.get_extra_info("sockname") - - async def getpeercert(self, timeout): - raise NotImplementedError - - -class StreamSocket(dns._asyncbackend.StreamSocket): - def __init__(self, af, reader, writer): - super().__init__(af, socket.SOCK_STREAM) - self.reader = reader - self.writer = writer - - async def sendall(self, what, timeout): - self.writer.write(what) - return await _maybe_wait_for(self.writer.drain(), timeout) - - async def recv(self, size, timeout): - return await _maybe_wait_for(self.reader.read(size), timeout) - - async def close(self): - self.writer.close() - - async def getpeername(self): - return self.writer.get_extra_info("peername") - - async def getsockname(self): - return self.writer.get_extra_info("sockname") - - async def getpeercert(self, timeout): - return self.writer.get_extra_info("peercert") - - -if dns._features.have("doh"): - import anyio - import httpcore - import httpcore._backends.anyio - import httpx - - _CoreAsyncNetworkBackend = httpcore.AsyncNetworkBackend - _CoreAnyIOStream = httpcore._backends.anyio.AnyIOStream - - from dns.query import _compute_times, _expiration_for_this_attempt, _remaining - - class _NetworkBackend(_CoreAsyncNetworkBackend): - def __init__(self, resolver, local_port, bootstrap_address, family): - super().__init__() - self._local_port = local_port - self._resolver = resolver - self._bootstrap_address = bootstrap_address - self._family = family - if local_port != 0: - raise NotImplementedError( - "the asyncio transport for HTTPX cannot set the local port" - ) - - async def connect_tcp( - self, host, port, timeout, local_address, socket_options=None - ): # pylint: disable=signature-differs - addresses = [] - _, expiration = _compute_times(timeout) - if dns.inet.is_address(host): - addresses.append(host) - elif self._bootstrap_address is not None: - addresses.append(self._bootstrap_address) - else: - timeout = _remaining(expiration) - family = self._family - if local_address: - family = dns.inet.af_for_address(local_address) - answers = await self._resolver.resolve_name( - host, family=family, lifetime=timeout - ) - addresses = answers.addresses() - for address in addresses: - try: - attempt_expiration = _expiration_for_this_attempt(2.0, expiration) - timeout = _remaining(attempt_expiration) - with anyio.fail_after(timeout): - stream = await anyio.connect_tcp( - remote_host=address, - remote_port=port, - local_host=local_address, - ) - return _CoreAnyIOStream(stream) - except Exception: - pass - raise httpcore.ConnectError - - async def connect_unix_socket( - self, path, timeout, socket_options=None - ): # pylint: disable=signature-differs - raise NotImplementedError - - async def sleep(self, seconds): # pylint: disable=signature-differs - await anyio.sleep(seconds) - - class _HTTPTransport(httpx.AsyncHTTPTransport): - def __init__( - self, - *args, - local_port=0, - bootstrap_address=None, - resolver=None, - family=socket.AF_UNSPEC, - **kwargs, - ): - if resolver is None and bootstrap_address is None: - # pylint: disable=import-outside-toplevel,redefined-outer-name - import dns.asyncresolver - - resolver = dns.asyncresolver.Resolver() - super().__init__(*args, **kwargs) - self._pool._network_backend = _NetworkBackend( - resolver, local_port, bootstrap_address, family - ) - -else: - _HTTPTransport = dns._asyncbackend.NullTransport # type: ignore - - -class Backend(dns._asyncbackend.Backend): - def name(self): - return "asyncio" - - async def make_socket( - self, - af, - socktype, - proto=0, - source=None, - destination=None, - timeout=None, - ssl_context=None, - server_hostname=None, - ): - loop = _get_running_loop() - if socktype == socket.SOCK_DGRAM: - if _is_win32 and source is None: - # Win32 wants explicit binding before recvfrom(). This is the - # proper fix for [#637]. - source = (dns.inet.any_for_af(af), 0) - transport, protocol = await loop.create_datagram_endpoint( - _DatagramProtocol, - source, - family=af, - proto=proto, - remote_addr=destination, - ) - return DatagramSocket(af, transport, protocol) - elif socktype == socket.SOCK_STREAM: - if destination is None: - # This shouldn't happen, but we check to make code analysis software - # happier. - raise ValueError("destination required for stream sockets") - (r, w) = await _maybe_wait_for( - asyncio.open_connection( - destination[0], - destination[1], - ssl=ssl_context, - family=af, - proto=proto, - local_addr=source, - server_hostname=server_hostname, - ), - timeout, - ) - return StreamSocket(af, r, w) - raise NotImplementedError( - "unsupported socket " + f"type {socktype}" - ) # pragma: no cover - - async def sleep(self, interval): - await asyncio.sleep(interval) - - def datagram_connection_required(self): - return False - - def get_transport_class(self): - return _HTTPTransport - - async def wait_for(self, awaitable, timeout): - return await _maybe_wait_for(awaitable, timeout) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/_ddr.py b/write-message/venv/lib/python3.10/site-packages/dns/_ddr.py deleted file mode 100644 index bf5c11e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/_ddr.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license -# -# Support for Discovery of Designated Resolvers - -import socket -import time -from urllib.parse import urlparse - -import dns.asyncbackend -import dns.inet -import dns.name -import dns.nameserver -import dns.query -import dns.rdtypes.svcbbase - -# The special name of the local resolver when using DDR -_local_resolver_name = dns.name.from_text("_dns.resolver.arpa") - - -# -# Processing is split up into I/O independent and I/O dependent parts to -# make supporting sync and async versions easy. -# - - -class _SVCBInfo: - def __init__(self, bootstrap_address, port, hostname, nameservers): - self.bootstrap_address = bootstrap_address - self.port = port - self.hostname = hostname - self.nameservers = nameservers - - def ddr_check_certificate(self, cert): - """Verify that the _SVCBInfo's address is in the cert's subjectAltName (SAN)""" - for name, value in cert["subjectAltName"]: - if name == "IP Address" and value == self.bootstrap_address: - return True - return False - - def make_tls_context(self): - ssl = dns.query.ssl - ctx = ssl.create_default_context() - ctx.minimum_version = ssl.TLSVersion.TLSv1_2 - return ctx - - def ddr_tls_check_sync(self, lifetime): - ctx = self.make_tls_context() - expiration = time.time() + lifetime - with socket.create_connection( - (self.bootstrap_address, self.port), lifetime - ) as s: - with ctx.wrap_socket(s, server_hostname=self.hostname) as ts: - ts.settimeout(dns.query._remaining(expiration)) - ts.do_handshake() - cert = ts.getpeercert() - return self.ddr_check_certificate(cert) - - async def ddr_tls_check_async(self, lifetime, backend=None): - if backend is None: - backend = dns.asyncbackend.get_default_backend() - ctx = self.make_tls_context() - expiration = time.time() + lifetime - async with await backend.make_socket( - dns.inet.af_for_address(self.bootstrap_address), - socket.SOCK_STREAM, - 0, - None, - (self.bootstrap_address, self.port), - lifetime, - ctx, - self.hostname, - ) as ts: - cert = await ts.getpeercert(dns.query._remaining(expiration)) - return self.ddr_check_certificate(cert) - - -def _extract_nameservers_from_svcb(answer): - bootstrap_address = answer.nameserver - if not dns.inet.is_address(bootstrap_address): - return [] - infos = [] - for rr in answer.rrset.processing_order(): - nameservers = [] - param = rr.params.get(dns.rdtypes.svcbbase.ParamKey.ALPN) - if param is None: - continue - alpns = set(param.ids) - host = rr.target.to_text(omit_final_dot=True) - port = None - param = rr.params.get(dns.rdtypes.svcbbase.ParamKey.PORT) - if param is not None: - port = param.port - # For now we ignore address hints and address resolution and always use the - # bootstrap address - if b"h2" in alpns: - param = rr.params.get(dns.rdtypes.svcbbase.ParamKey.DOHPATH) - if param is None or not param.value.endswith(b"{?dns}"): - continue - path = param.value[:-6].decode() - if not path.startswith("/"): - path = "/" + path - if port is None: - port = 443 - url = f"https://{host}:{port}{path}" - # check the URL - try: - urlparse(url) - nameservers.append(dns.nameserver.DoHNameserver(url, bootstrap_address)) - except Exception: - # continue processing other ALPN types - pass - if b"dot" in alpns: - if port is None: - port = 853 - nameservers.append( - dns.nameserver.DoTNameserver(bootstrap_address, port, host) - ) - if b"doq" in alpns: - if port is None: - port = 853 - nameservers.append( - dns.nameserver.DoQNameserver(bootstrap_address, port, True, host) - ) - if len(nameservers) > 0: - infos.append(_SVCBInfo(bootstrap_address, port, host, nameservers)) - return infos - - -def _get_nameservers_sync(answer, lifetime): - """Return a list of TLS-validated resolver nameservers extracted from an SVCB - answer.""" - nameservers = [] - infos = _extract_nameservers_from_svcb(answer) - for info in infos: - try: - if info.ddr_tls_check_sync(lifetime): - nameservers.extend(info.nameservers) - except Exception: - pass - return nameservers - - -async def _get_nameservers_async(answer, lifetime): - """Return a list of TLS-validated resolver nameservers extracted from an SVCB - answer.""" - nameservers = [] - infos = _extract_nameservers_from_svcb(answer) - for info in infos: - try: - if await info.ddr_tls_check_async(lifetime): - nameservers.extend(info.nameservers) - except Exception: - pass - return nameservers diff --git a/write-message/venv/lib/python3.10/site-packages/dns/_features.py b/write-message/venv/lib/python3.10/site-packages/dns/_features.py deleted file mode 100644 index fa6d495..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/_features.py +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import importlib.metadata -import itertools -import string -from typing import Dict, List, Tuple - - -def _tuple_from_text(version: str) -> Tuple: - text_parts = version.split(".") - int_parts = [] - for text_part in text_parts: - digit_prefix = "".join( - itertools.takewhile(lambda x: x in string.digits, text_part) - ) - try: - int_parts.append(int(digit_prefix)) - except Exception: - break - return tuple(int_parts) - - -def _version_check( - requirement: str, -) -> bool: - """Is the requirement fulfilled? - - The requirement must be of the form - - package>=version - """ - package, minimum = requirement.split(">=") - try: - version = importlib.metadata.version(package) - # This shouldn't happen, but it apparently can. - if version is None: - return False - except Exception: - return False - t_version = _tuple_from_text(version) - t_minimum = _tuple_from_text(minimum) - if t_version < t_minimum: - return False - return True - - -_cache: Dict[str, bool] = {} - - -def have(feature: str) -> bool: - """Is *feature* available? - - This tests if all optional packages needed for the - feature are available and recent enough. - - Returns ``True`` if the feature is available, - and ``False`` if it is not or if metadata is - missing. - """ - value = _cache.get(feature) - if value is not None: - return value - requirements = _requirements.get(feature) - if requirements is None: - # we make a cache entry here for consistency not performance - _cache[feature] = False - return False - ok = True - for requirement in requirements: - if not _version_check(requirement): - ok = False - break - _cache[feature] = ok - return ok - - -def force(feature: str, enabled: bool) -> None: - """Force the status of *feature* to be *enabled*. - - This method is provided as a workaround for any cases - where importlib.metadata is ineffective, or for testing. - """ - _cache[feature] = enabled - - -_requirements: Dict[str, List[str]] = { - ### BEGIN generated requirements - "dnssec": ["cryptography>=43"], - "doh": ["httpcore>=1.0.0", "httpx>=0.26.0", "h2>=4.1.0"], - "doq": ["aioquic>=1.0.0"], - "idna": ["idna>=3.7"], - "trio": ["trio>=0.23"], - "wmi": ["wmi>=1.5.1"], - ### END generated requirements -} diff --git a/write-message/venv/lib/python3.10/site-packages/dns/_immutable_ctx.py b/write-message/venv/lib/python3.10/site-packages/dns/_immutable_ctx.py deleted file mode 100644 index ae7a33b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/_immutable_ctx.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# This implementation of the immutable decorator requires python >= -# 3.7, and is significantly more storage efficient when making classes -# with slots immutable. It's also faster. - -import contextvars -import inspect - -_in__init__ = contextvars.ContextVar("_immutable_in__init__", default=False) - - -class _Immutable: - """Immutable mixin class""" - - # We set slots to the empty list to say "we don't have any attributes". - # We do this so that if we're mixed in with a class with __slots__, we - # don't cause a __dict__ to be added which would waste space. - - __slots__ = () - - def __setattr__(self, name, value): - if _in__init__.get() is not self: - raise TypeError("object doesn't support attribute assignment") - else: - super().__setattr__(name, value) - - def __delattr__(self, name): - if _in__init__.get() is not self: - raise TypeError("object doesn't support attribute assignment") - else: - super().__delattr__(name) - - -def _immutable_init(f): - def nf(*args, **kwargs): - previous = _in__init__.set(args[0]) - try: - # call the actual __init__ - f(*args, **kwargs) - finally: - _in__init__.reset(previous) - - nf.__signature__ = inspect.signature(f) - return nf - - -def immutable(cls): - if _Immutable in cls.__mro__: - # Some ancestor already has the mixin, so just make sure we keep - # following the __init__ protocol. - cls.__init__ = _immutable_init(cls.__init__) - if hasattr(cls, "__setstate__"): - cls.__setstate__ = _immutable_init(cls.__setstate__) - ncls = cls - else: - # Mixin the Immutable class and follow the __init__ protocol. - class ncls(_Immutable, cls): - # We have to do the __slots__ declaration here too! - __slots__ = () - - @_immutable_init - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - if hasattr(cls, "__setstate__"): - - @_immutable_init - def __setstate__(self, *args, **kwargs): - super().__setstate__(*args, **kwargs) - - # make ncls have the same name and module as cls - ncls.__name__ = cls.__name__ - ncls.__qualname__ = cls.__qualname__ - ncls.__module__ = cls.__module__ - return ncls diff --git a/write-message/venv/lib/python3.10/site-packages/dns/_trio_backend.py b/write-message/venv/lib/python3.10/site-packages/dns/_trio_backend.py deleted file mode 100644 index 0ed904d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/_trio_backend.py +++ /dev/null @@ -1,253 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -"""trio async I/O library query support""" - -import socket - -import trio -import trio.socket # type: ignore - -import dns._asyncbackend -import dns._features -import dns.exception -import dns.inet - -if not dns._features.have("trio"): - raise ImportError("trio not found or too old") - - -def _maybe_timeout(timeout): - if timeout is not None: - return trio.move_on_after(timeout) - else: - return dns._asyncbackend.NullContext() - - -# for brevity -_lltuple = dns.inet.low_level_address_tuple - -# pylint: disable=redefined-outer-name - - -class DatagramSocket(dns._asyncbackend.DatagramSocket): - def __init__(self, sock): - super().__init__(sock.family, socket.SOCK_DGRAM) - self.socket = sock - - async def sendto(self, what, destination, timeout): - with _maybe_timeout(timeout): - if destination is None: - return await self.socket.send(what) - else: - return await self.socket.sendto(what, destination) - raise dns.exception.Timeout( - timeout=timeout - ) # pragma: no cover lgtm[py/unreachable-statement] - - async def recvfrom(self, size, timeout): - with _maybe_timeout(timeout): - return await self.socket.recvfrom(size) - raise dns.exception.Timeout(timeout=timeout) # lgtm[py/unreachable-statement] - - async def close(self): - self.socket.close() - - async def getpeername(self): - return self.socket.getpeername() - - async def getsockname(self): - return self.socket.getsockname() - - async def getpeercert(self, timeout): - raise NotImplementedError - - -class StreamSocket(dns._asyncbackend.StreamSocket): - def __init__(self, family, stream, tls=False): - super().__init__(family, socket.SOCK_STREAM) - self.stream = stream - self.tls = tls - - async def sendall(self, what, timeout): - with _maybe_timeout(timeout): - return await self.stream.send_all(what) - raise dns.exception.Timeout(timeout=timeout) # lgtm[py/unreachable-statement] - - async def recv(self, size, timeout): - with _maybe_timeout(timeout): - return await self.stream.receive_some(size) - raise dns.exception.Timeout(timeout=timeout) # lgtm[py/unreachable-statement] - - async def close(self): - await self.stream.aclose() - - async def getpeername(self): - if self.tls: - return self.stream.transport_stream.socket.getpeername() - else: - return self.stream.socket.getpeername() - - async def getsockname(self): - if self.tls: - return self.stream.transport_stream.socket.getsockname() - else: - return self.stream.socket.getsockname() - - async def getpeercert(self, timeout): - if self.tls: - with _maybe_timeout(timeout): - await self.stream.do_handshake() - return self.stream.getpeercert() - else: - raise NotImplementedError - - -if dns._features.have("doh"): - import httpcore - import httpcore._backends.trio - import httpx - - _CoreAsyncNetworkBackend = httpcore.AsyncNetworkBackend - _CoreTrioStream = httpcore._backends.trio.TrioStream - - from dns.query import _compute_times, _expiration_for_this_attempt, _remaining - - class _NetworkBackend(_CoreAsyncNetworkBackend): - def __init__(self, resolver, local_port, bootstrap_address, family): - super().__init__() - self._local_port = local_port - self._resolver = resolver - self._bootstrap_address = bootstrap_address - self._family = family - - async def connect_tcp( - self, host, port, timeout, local_address, socket_options=None - ): # pylint: disable=signature-differs - addresses = [] - _, expiration = _compute_times(timeout) - if dns.inet.is_address(host): - addresses.append(host) - elif self._bootstrap_address is not None: - addresses.append(self._bootstrap_address) - else: - timeout = _remaining(expiration) - family = self._family - if local_address: - family = dns.inet.af_for_address(local_address) - answers = await self._resolver.resolve_name( - host, family=family, lifetime=timeout - ) - addresses = answers.addresses() - for address in addresses: - try: - af = dns.inet.af_for_address(address) - if local_address is not None or self._local_port != 0: - source = (local_address, self._local_port) - else: - source = None - destination = (address, port) - attempt_expiration = _expiration_for_this_attempt(2.0, expiration) - timeout = _remaining(attempt_expiration) - sock = await Backend().make_socket( - af, socket.SOCK_STREAM, 0, source, destination, timeout - ) - return _CoreTrioStream(sock.stream) - except Exception: - continue - raise httpcore.ConnectError - - async def connect_unix_socket( - self, path, timeout, socket_options=None - ): # pylint: disable=signature-differs - raise NotImplementedError - - async def sleep(self, seconds): # pylint: disable=signature-differs - await trio.sleep(seconds) - - class _HTTPTransport(httpx.AsyncHTTPTransport): - def __init__( - self, - *args, - local_port=0, - bootstrap_address=None, - resolver=None, - family=socket.AF_UNSPEC, - **kwargs, - ): - if resolver is None and bootstrap_address is None: - # pylint: disable=import-outside-toplevel,redefined-outer-name - import dns.asyncresolver - - resolver = dns.asyncresolver.Resolver() - super().__init__(*args, **kwargs) - self._pool._network_backend = _NetworkBackend( - resolver, local_port, bootstrap_address, family - ) - -else: - _HTTPTransport = dns._asyncbackend.NullTransport # type: ignore - - -class Backend(dns._asyncbackend.Backend): - def name(self): - return "trio" - - async def make_socket( - self, - af, - socktype, - proto=0, - source=None, - destination=None, - timeout=None, - ssl_context=None, - server_hostname=None, - ): - s = trio.socket.socket(af, socktype, proto) - stream = None - try: - if source: - await s.bind(_lltuple(source, af)) - if socktype == socket.SOCK_STREAM or destination is not None: - connected = False - with _maybe_timeout(timeout): - await s.connect(_lltuple(destination, af)) - connected = True - if not connected: - raise dns.exception.Timeout( - timeout=timeout - ) # lgtm[py/unreachable-statement] - except Exception: # pragma: no cover - s.close() - raise - if socktype == socket.SOCK_DGRAM: - return DatagramSocket(s) - elif socktype == socket.SOCK_STREAM: - stream = trio.SocketStream(s) - tls = False - if ssl_context: - tls = True - try: - stream = trio.SSLStream( - stream, ssl_context, server_hostname=server_hostname - ) - except Exception: # pragma: no cover - await stream.aclose() - raise - return StreamSocket(af, stream, tls) - raise NotImplementedError( - "unsupported socket " + f"type {socktype}" - ) # pragma: no cover - - async def sleep(self, interval): - await trio.sleep(interval) - - def get_transport_class(self): - return _HTTPTransport - - async def wait_for(self, awaitable, timeout): - with _maybe_timeout(timeout): - return await awaitable - raise dns.exception.Timeout( - timeout=timeout - ) # pragma: no cover lgtm[py/unreachable-statement] diff --git a/write-message/venv/lib/python3.10/site-packages/dns/asyncbackend.py b/write-message/venv/lib/python3.10/site-packages/dns/asyncbackend.py deleted file mode 100644 index 0ec58b0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/asyncbackend.py +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -from typing import Dict - -import dns.exception - -# pylint: disable=unused-import -from dns._asyncbackend import ( # noqa: F401 lgtm[py/unused-import] - Backend, - DatagramSocket, - Socket, - StreamSocket, -) - -# pylint: enable=unused-import - -_default_backend = None - -_backends: Dict[str, Backend] = {} - -# Allow sniffio import to be disabled for testing purposes -_no_sniffio = False - - -class AsyncLibraryNotFoundError(dns.exception.DNSException): - pass - - -def get_backend(name: str) -> Backend: - """Get the specified asynchronous backend. - - *name*, a ``str``, the name of the backend. Currently the "trio" - and "asyncio" backends are available. - - Raises NotImplementedError if an unknown backend name is specified. - """ - # pylint: disable=import-outside-toplevel,redefined-outer-name - backend = _backends.get(name) - if backend: - return backend - if name == "trio": - import dns._trio_backend - - backend = dns._trio_backend.Backend() - elif name == "asyncio": - import dns._asyncio_backend - - backend = dns._asyncio_backend.Backend() - else: - raise NotImplementedError(f"unimplemented async backend {name}") - _backends[name] = backend - return backend - - -def sniff() -> str: - """Attempt to determine the in-use asynchronous I/O library by using - the ``sniffio`` module if it is available. - - Returns the name of the library, or raises AsyncLibraryNotFoundError - if the library cannot be determined. - """ - # pylint: disable=import-outside-toplevel - try: - if _no_sniffio: - raise ImportError - import sniffio - - try: - return sniffio.current_async_library() - except sniffio.AsyncLibraryNotFoundError: - raise AsyncLibraryNotFoundError("sniffio cannot determine async library") - except ImportError: - import asyncio - - try: - asyncio.get_running_loop() - return "asyncio" - except RuntimeError: - raise AsyncLibraryNotFoundError("no async library detected") - - -def get_default_backend() -> Backend: - """Get the default backend, initializing it if necessary.""" - if _default_backend: - return _default_backend - - return set_default_backend(sniff()) - - -def set_default_backend(name: str) -> Backend: - """Set the default backend. - - It's not normally necessary to call this method, as - ``get_default_backend()`` will initialize the backend - appropriately in many cases. If ``sniffio`` is not installed, or - in testing situations, this function allows the backend to be set - explicitly. - """ - global _default_backend - _default_backend = get_backend(name) - return _default_backend diff --git a/write-message/venv/lib/python3.10/site-packages/dns/asyncquery.py b/write-message/venv/lib/python3.10/site-packages/dns/asyncquery.py deleted file mode 100644 index efad0fd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/asyncquery.py +++ /dev/null @@ -1,913 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Talk to a DNS server.""" - -import base64 -import contextlib -import random -import socket -import struct -import time -import urllib.parse -from typing import Any, Dict, Optional, Tuple, Union, cast - -import dns.asyncbackend -import dns.exception -import dns.inet -import dns.message -import dns.name -import dns.quic -import dns.rcode -import dns.rdataclass -import dns.rdatatype -import dns.transaction -from dns._asyncbackend import NullContext -from dns.query import ( - BadResponse, - HTTPVersion, - NoDOH, - NoDOQ, - UDPMode, - _check_status, - _compute_times, - _make_dot_ssl_context, - _matches_destination, - _remaining, - have_doh, - ssl, -) - -if have_doh: - import httpx - -# for brevity -_lltuple = dns.inet.low_level_address_tuple - - -def _source_tuple(af, address, port): - # Make a high level source tuple, or return None if address and port - # are both None - if address or port: - if address is None: - if af == socket.AF_INET: - address = "0.0.0.0" - elif af == socket.AF_INET6: - address = "::" - else: - raise NotImplementedError(f"unknown address family {af}") - return (address, port) - else: - return None - - -def _timeout(expiration, now=None): - if expiration is not None: - if not now: - now = time.time() - return max(expiration - now, 0) - else: - return None - - -async def send_udp( - sock: dns.asyncbackend.DatagramSocket, - what: Union[dns.message.Message, bytes], - destination: Any, - expiration: Optional[float] = None, -) -> Tuple[int, float]: - """Send a DNS message to the specified UDP socket. - - *sock*, a ``dns.asyncbackend.DatagramSocket``. - - *what*, a ``bytes`` or ``dns.message.Message``, the message to send. - - *destination*, a destination tuple appropriate for the address family - of the socket, specifying where to send the query. - - *expiration*, a ``float`` or ``None``, the absolute time at which - a timeout exception should be raised. If ``None``, no timeout will - occur. The expiration value is meaningless for the asyncio backend, as - asyncio's transport sendto() never blocks. - - Returns an ``(int, float)`` tuple of bytes sent and the sent time. - """ - - if isinstance(what, dns.message.Message): - what = what.to_wire() - sent_time = time.time() - n = await sock.sendto(what, destination, _timeout(expiration, sent_time)) - return (n, sent_time) - - -async def receive_udp( - sock: dns.asyncbackend.DatagramSocket, - destination: Optional[Any] = None, - expiration: Optional[float] = None, - ignore_unexpected: bool = False, - one_rr_per_rrset: bool = False, - keyring: Optional[Dict[dns.name.Name, dns.tsig.Key]] = None, - request_mac: Optional[bytes] = b"", - ignore_trailing: bool = False, - raise_on_truncation: bool = False, - ignore_errors: bool = False, - query: Optional[dns.message.Message] = None, -) -> Any: - """Read a DNS message from a UDP socket. - - *sock*, a ``dns.asyncbackend.DatagramSocket``. - - See :py:func:`dns.query.receive_udp()` for the documentation of the other - parameters, and exceptions. - - Returns a ``(dns.message.Message, float, tuple)`` tuple of the received message, the - received time, and the address where the message arrived from. - """ - - wire = b"" - while True: - (wire, from_address) = await sock.recvfrom(65535, _timeout(expiration)) - if not _matches_destination( - sock.family, from_address, destination, ignore_unexpected - ): - continue - received_time = time.time() - try: - r = dns.message.from_wire( - wire, - keyring=keyring, - request_mac=request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - raise_on_truncation=raise_on_truncation, - ) - except dns.message.Truncated as e: - # See the comment in query.py for details. - if ( - ignore_errors - and query is not None - and not query.is_response(e.message()) - ): - continue - else: - raise - except Exception: - if ignore_errors: - continue - else: - raise - if ignore_errors and query is not None and not query.is_response(r): - continue - return (r, received_time, from_address) - - -async def udp( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 53, - source: Optional[str] = None, - source_port: int = 0, - ignore_unexpected: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - raise_on_truncation: bool = False, - sock: Optional[dns.asyncbackend.DatagramSocket] = None, - backend: Optional[dns.asyncbackend.Backend] = None, - ignore_errors: bool = False, -) -> dns.message.Message: - """Return the response obtained after sending a query via UDP. - - *sock*, a ``dns.asyncbackend.DatagramSocket``, or ``None``, - the socket to use for the query. If ``None``, the default, a - socket is created. Note that if a socket is provided, the - *source*, *source_port*, and *backend* are ignored. - - *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, - the default, then dnspython will use the default backend. - - See :py:func:`dns.query.udp()` for the documentation of the other - parameters, exceptions, and return type of this method. - """ - wire = q.to_wire() - (begin_time, expiration) = _compute_times(timeout) - af = dns.inet.af_for_address(where) - destination = _lltuple((where, port), af) - if sock: - cm: contextlib.AbstractAsyncContextManager = NullContext(sock) - else: - if not backend: - backend = dns.asyncbackend.get_default_backend() - stuple = _source_tuple(af, source, source_port) - if backend.datagram_connection_required(): - dtuple = (where, port) - else: - dtuple = None - cm = await backend.make_socket(af, socket.SOCK_DGRAM, 0, stuple, dtuple) - async with cm as s: - await send_udp(s, wire, destination, expiration) - (r, received_time, _) = await receive_udp( - s, - destination, - expiration, - ignore_unexpected, - one_rr_per_rrset, - q.keyring, - q.mac, - ignore_trailing, - raise_on_truncation, - ignore_errors, - q, - ) - r.time = received_time - begin_time - # We don't need to check q.is_response() if we are in ignore_errors mode - # as receive_udp() will have checked it. - if not (ignore_errors or q.is_response(r)): - raise BadResponse - return r - - -async def udp_with_fallback( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 53, - source: Optional[str] = None, - source_port: int = 0, - ignore_unexpected: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - udp_sock: Optional[dns.asyncbackend.DatagramSocket] = None, - tcp_sock: Optional[dns.asyncbackend.StreamSocket] = None, - backend: Optional[dns.asyncbackend.Backend] = None, - ignore_errors: bool = False, -) -> Tuple[dns.message.Message, bool]: - """Return the response to the query, trying UDP first and falling back - to TCP if UDP results in a truncated response. - - *udp_sock*, a ``dns.asyncbackend.DatagramSocket``, or ``None``, - the socket to use for the UDP query. If ``None``, the default, a - socket is created. Note that if a socket is provided the *source*, - *source_port*, and *backend* are ignored for the UDP query. - - *tcp_sock*, a ``dns.asyncbackend.StreamSocket``, or ``None``, the - socket to use for the TCP query. If ``None``, the default, a - socket is created. Note that if a socket is provided *where*, - *source*, *source_port*, and *backend* are ignored for the TCP query. - - *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, - the default, then dnspython will use the default backend. - - See :py:func:`dns.query.udp_with_fallback()` for the documentation - of the other parameters, exceptions, and return type of this - method. - """ - try: - response = await udp( - q, - where, - timeout, - port, - source, - source_port, - ignore_unexpected, - one_rr_per_rrset, - ignore_trailing, - True, - udp_sock, - backend, - ignore_errors, - ) - return (response, False) - except dns.message.Truncated: - response = await tcp( - q, - where, - timeout, - port, - source, - source_port, - one_rr_per_rrset, - ignore_trailing, - tcp_sock, - backend, - ) - return (response, True) - - -async def send_tcp( - sock: dns.asyncbackend.StreamSocket, - what: Union[dns.message.Message, bytes], - expiration: Optional[float] = None, -) -> Tuple[int, float]: - """Send a DNS message to the specified TCP socket. - - *sock*, a ``dns.asyncbackend.StreamSocket``. - - See :py:func:`dns.query.send_tcp()` for the documentation of the other - parameters, exceptions, and return type of this method. - """ - - if isinstance(what, dns.message.Message): - tcpmsg = what.to_wire(prepend_length=True) - else: - # copying the wire into tcpmsg is inefficient, but lets us - # avoid writev() or doing a short write that would get pushed - # onto the net - tcpmsg = len(what).to_bytes(2, "big") + what - sent_time = time.time() - await sock.sendall(tcpmsg, _timeout(expiration, sent_time)) - return (len(tcpmsg), sent_time) - - -async def _read_exactly(sock, count, expiration): - """Read the specified number of bytes from stream. Keep trying until we - either get the desired amount, or we hit EOF. - """ - s = b"" - while count > 0: - n = await sock.recv(count, _timeout(expiration)) - if n == b"": - raise EOFError("EOF") - count = count - len(n) - s = s + n - return s - - -async def receive_tcp( - sock: dns.asyncbackend.StreamSocket, - expiration: Optional[float] = None, - one_rr_per_rrset: bool = False, - keyring: Optional[Dict[dns.name.Name, dns.tsig.Key]] = None, - request_mac: Optional[bytes] = b"", - ignore_trailing: bool = False, -) -> Tuple[dns.message.Message, float]: - """Read a DNS message from a TCP socket. - - *sock*, a ``dns.asyncbackend.StreamSocket``. - - See :py:func:`dns.query.receive_tcp()` for the documentation of the other - parameters, exceptions, and return type of this method. - """ - - ldata = await _read_exactly(sock, 2, expiration) - (l,) = struct.unpack("!H", ldata) - wire = await _read_exactly(sock, l, expiration) - received_time = time.time() - r = dns.message.from_wire( - wire, - keyring=keyring, - request_mac=request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - return (r, received_time) - - -async def tcp( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 53, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - sock: Optional[dns.asyncbackend.StreamSocket] = None, - backend: Optional[dns.asyncbackend.Backend] = None, -) -> dns.message.Message: - """Return the response obtained after sending a query via TCP. - - *sock*, a ``dns.asyncbacket.StreamSocket``, or ``None``, the - socket to use for the query. If ``None``, the default, a socket - is created. Note that if a socket is provided - *where*, *port*, *source*, *source_port*, and *backend* are ignored. - - *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, - the default, then dnspython will use the default backend. - - See :py:func:`dns.query.tcp()` for the documentation of the other - parameters, exceptions, and return type of this method. - """ - - wire = q.to_wire() - (begin_time, expiration) = _compute_times(timeout) - if sock: - # Verify that the socket is connected, as if it's not connected, - # it's not writable, and the polling in send_tcp() will time out or - # hang forever. - await sock.getpeername() - cm: contextlib.AbstractAsyncContextManager = NullContext(sock) - else: - # These are simple (address, port) pairs, not family-dependent tuples - # you pass to low-level socket code. - af = dns.inet.af_for_address(where) - stuple = _source_tuple(af, source, source_port) - dtuple = (where, port) - if not backend: - backend = dns.asyncbackend.get_default_backend() - cm = await backend.make_socket( - af, socket.SOCK_STREAM, 0, stuple, dtuple, timeout - ) - async with cm as s: - await send_tcp(s, wire, expiration) - (r, received_time) = await receive_tcp( - s, expiration, one_rr_per_rrset, q.keyring, q.mac, ignore_trailing - ) - r.time = received_time - begin_time - if not q.is_response(r): - raise BadResponse - return r - - -async def tls( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 853, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - sock: Optional[dns.asyncbackend.StreamSocket] = None, - backend: Optional[dns.asyncbackend.Backend] = None, - ssl_context: Optional[ssl.SSLContext] = None, - server_hostname: Optional[str] = None, - verify: Union[bool, str] = True, -) -> dns.message.Message: - """Return the response obtained after sending a query via TLS. - - *sock*, an ``asyncbackend.StreamSocket``, or ``None``, the socket - to use for the query. If ``None``, the default, a socket is - created. Note that if a socket is provided, it must be a - connected SSL stream socket, and *where*, *port*, - *source*, *source_port*, *backend*, *ssl_context*, and *server_hostname* - are ignored. - - *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, - the default, then dnspython will use the default backend. - - See :py:func:`dns.query.tls()` for the documentation of the other - parameters, exceptions, and return type of this method. - """ - (begin_time, expiration) = _compute_times(timeout) - if sock: - cm: contextlib.AbstractAsyncContextManager = NullContext(sock) - else: - if ssl_context is None: - ssl_context = _make_dot_ssl_context(server_hostname, verify) - af = dns.inet.af_for_address(where) - stuple = _source_tuple(af, source, source_port) - dtuple = (where, port) - if not backend: - backend = dns.asyncbackend.get_default_backend() - cm = await backend.make_socket( - af, - socket.SOCK_STREAM, - 0, - stuple, - dtuple, - timeout, - ssl_context, - server_hostname, - ) - async with cm as s: - timeout = _timeout(expiration) - response = await tcp( - q, - where, - timeout, - port, - source, - source_port, - one_rr_per_rrset, - ignore_trailing, - s, - backend, - ) - end_time = time.time() - response.time = end_time - begin_time - return response - - -def _maybe_get_resolver( - resolver: Optional["dns.asyncresolver.Resolver"], -) -> "dns.asyncresolver.Resolver": - # We need a separate method for this to avoid overriding the global - # variable "dns" with the as-yet undefined local variable "dns" - # in https(). - if resolver is None: - # pylint: disable=import-outside-toplevel,redefined-outer-name - import dns.asyncresolver - - resolver = dns.asyncresolver.Resolver() - return resolver - - -async def https( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 443, - source: Optional[str] = None, - source_port: int = 0, # pylint: disable=W0613 - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - client: Optional["httpx.AsyncClient"] = None, - path: str = "/dns-query", - post: bool = True, - verify: Union[bool, str] = True, - bootstrap_address: Optional[str] = None, - resolver: Optional["dns.asyncresolver.Resolver"] = None, - family: int = socket.AF_UNSPEC, - http_version: HTTPVersion = HTTPVersion.DEFAULT, -) -> dns.message.Message: - """Return the response obtained after sending a query via DNS-over-HTTPS. - - *client*, a ``httpx.AsyncClient``. If provided, the client to use for - the query. - - Unlike the other dnspython async functions, a backend cannot be provided - in this function because httpx always auto-detects the async backend. - - See :py:func:`dns.query.https()` for the documentation of the other - parameters, exceptions, and return type of this method. - """ - - try: - af = dns.inet.af_for_address(where) - except ValueError: - af = None - if af is not None and dns.inet.is_address(where): - if af == socket.AF_INET: - url = f"https://{where}:{port}{path}" - elif af == socket.AF_INET6: - url = f"https://[{where}]:{port}{path}" - else: - url = where - - extensions = {} - if bootstrap_address is None: - # pylint: disable=possibly-used-before-assignment - parsed = urllib.parse.urlparse(url) - if parsed.hostname is None: - raise ValueError("no hostname in URL") - if dns.inet.is_address(parsed.hostname): - bootstrap_address = parsed.hostname - extensions["sni_hostname"] = parsed.hostname - if parsed.port is not None: - port = parsed.port - - if http_version == HTTPVersion.H3 or ( - http_version == HTTPVersion.DEFAULT and not have_doh - ): - if bootstrap_address is None: - resolver = _maybe_get_resolver(resolver) - assert parsed.hostname is not None # for mypy - answers = await resolver.resolve_name(parsed.hostname, family) - bootstrap_address = random.choice(list(answers.addresses())) - return await _http3( - q, - bootstrap_address, - url, - timeout, - port, - source, - source_port, - one_rr_per_rrset, - ignore_trailing, - verify=verify, - post=post, - ) - - if not have_doh: - raise NoDOH # pragma: no cover - # pylint: disable=possibly-used-before-assignment - if client and not isinstance(client, httpx.AsyncClient): - raise ValueError("session parameter must be an httpx.AsyncClient") - # pylint: enable=possibly-used-before-assignment - - wire = q.to_wire() - headers = {"accept": "application/dns-message"} - - h1 = http_version in (HTTPVersion.H1, HTTPVersion.DEFAULT) - h2 = http_version in (HTTPVersion.H2, HTTPVersion.DEFAULT) - - backend = dns.asyncbackend.get_default_backend() - - if source is None: - local_address = None - local_port = 0 - else: - local_address = source - local_port = source_port - - if client: - cm: contextlib.AbstractAsyncContextManager = NullContext(client) - else: - transport = backend.get_transport_class()( - local_address=local_address, - http1=h1, - http2=h2, - verify=verify, - local_port=local_port, - bootstrap_address=bootstrap_address, - resolver=resolver, - family=family, - ) - - cm = httpx.AsyncClient(http1=h1, http2=h2, verify=verify, transport=transport) - - async with cm as the_client: - # see https://tools.ietf.org/html/rfc8484#section-4.1.1 for DoH - # GET and POST examples - if post: - headers.update( - { - "content-type": "application/dns-message", - "content-length": str(len(wire)), - } - ) - response = await backend.wait_for( - the_client.post( - url, - headers=headers, - content=wire, - extensions=extensions, - ), - timeout, - ) - else: - wire = base64.urlsafe_b64encode(wire).rstrip(b"=") - twire = wire.decode() # httpx does a repr() if we give it bytes - response = await backend.wait_for( - the_client.get( - url, - headers=headers, - params={"dns": twire}, - extensions=extensions, - ), - timeout, - ) - - # see https://tools.ietf.org/html/rfc8484#section-4.2.1 for info about DoH - # status codes - if response.status_code < 200 or response.status_code > 299: - raise ValueError( - f"{where} responded with status code {response.status_code}" - f"\nResponse body: {response.content!r}" - ) - r = dns.message.from_wire( - response.content, - keyring=q.keyring, - request_mac=q.request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - r.time = response.elapsed.total_seconds() - if not q.is_response(r): - raise BadResponse - return r - - -async def _http3( - q: dns.message.Message, - where: str, - url: str, - timeout: Optional[float] = None, - port: int = 853, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - verify: Union[bool, str] = True, - backend: Optional[dns.asyncbackend.Backend] = None, - hostname: Optional[str] = None, - post: bool = True, -) -> dns.message.Message: - if not dns.quic.have_quic: - raise NoDOH("DNS-over-HTTP3 is not available.") # pragma: no cover - - url_parts = urllib.parse.urlparse(url) - hostname = url_parts.hostname - if url_parts.port is not None: - port = url_parts.port - - q.id = 0 - wire = q.to_wire() - (cfactory, mfactory) = dns.quic.factories_for_backend(backend) - - async with cfactory() as context: - async with mfactory( - context, verify_mode=verify, server_name=hostname, h3=True - ) as the_manager: - the_connection = the_manager.connect(where, port, source, source_port) - (start, expiration) = _compute_times(timeout) - stream = await the_connection.make_stream(timeout) - async with stream: - # note that send_h3() does not need await - stream.send_h3(url, wire, post) - wire = await stream.receive(_remaining(expiration)) - _check_status(stream.headers(), where, wire) - finish = time.time() - r = dns.message.from_wire( - wire, - keyring=q.keyring, - request_mac=q.request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - r.time = max(finish - start, 0.0) - if not q.is_response(r): - raise BadResponse - return r - - -async def quic( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 853, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - connection: Optional[dns.quic.AsyncQuicConnection] = None, - verify: Union[bool, str] = True, - backend: Optional[dns.asyncbackend.Backend] = None, - hostname: Optional[str] = None, - server_hostname: Optional[str] = None, -) -> dns.message.Message: - """Return the response obtained after sending an asynchronous query via - DNS-over-QUIC. - - *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, - the default, then dnspython will use the default backend. - - See :py:func:`dns.query.quic()` for the documentation of the other - parameters, exceptions, and return type of this method. - """ - - if not dns.quic.have_quic: - raise NoDOQ("DNS-over-QUIC is not available.") # pragma: no cover - - if server_hostname is not None and hostname is None: - hostname = server_hostname - - q.id = 0 - wire = q.to_wire() - the_connection: dns.quic.AsyncQuicConnection - if connection: - cfactory = dns.quic.null_factory - mfactory = dns.quic.null_factory - the_connection = connection - else: - (cfactory, mfactory) = dns.quic.factories_for_backend(backend) - - async with cfactory() as context: - async with mfactory( - context, - verify_mode=verify, - server_name=server_hostname, - ) as the_manager: - if not connection: - the_connection = the_manager.connect(where, port, source, source_port) - (start, expiration) = _compute_times(timeout) - stream = await the_connection.make_stream(timeout) - async with stream: - await stream.send(wire, True) - wire = await stream.receive(_remaining(expiration)) - finish = time.time() - r = dns.message.from_wire( - wire, - keyring=q.keyring, - request_mac=q.request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - r.time = max(finish - start, 0.0) - if not q.is_response(r): - raise BadResponse - return r - - -async def _inbound_xfr( - txn_manager: dns.transaction.TransactionManager, - s: dns.asyncbackend.Socket, - query: dns.message.Message, - serial: Optional[int], - timeout: Optional[float], - expiration: float, -) -> Any: - """Given a socket, does the zone transfer.""" - rdtype = query.question[0].rdtype - is_ixfr = rdtype == dns.rdatatype.IXFR - origin = txn_manager.from_wire_origin() - wire = query.to_wire() - is_udp = s.type == socket.SOCK_DGRAM - if is_udp: - udp_sock = cast(dns.asyncbackend.DatagramSocket, s) - await udp_sock.sendto(wire, None, _timeout(expiration)) - else: - tcp_sock = cast(dns.asyncbackend.StreamSocket, s) - tcpmsg = struct.pack("!H", len(wire)) + wire - await tcp_sock.sendall(tcpmsg, expiration) - with dns.xfr.Inbound(txn_manager, rdtype, serial, is_udp) as inbound: - done = False - tsig_ctx = None - while not done: - (_, mexpiration) = _compute_times(timeout) - if mexpiration is None or ( - expiration is not None and mexpiration > expiration - ): - mexpiration = expiration - if is_udp: - timeout = _timeout(mexpiration) - (rwire, _) = await udp_sock.recvfrom(65535, timeout) - else: - ldata = await _read_exactly(tcp_sock, 2, mexpiration) - (l,) = struct.unpack("!H", ldata) - rwire = await _read_exactly(tcp_sock, l, mexpiration) - r = dns.message.from_wire( - rwire, - keyring=query.keyring, - request_mac=query.mac, - xfr=True, - origin=origin, - tsig_ctx=tsig_ctx, - multi=(not is_udp), - one_rr_per_rrset=is_ixfr, - ) - done = inbound.process_message(r) - yield r - tsig_ctx = r.tsig_ctx - if query.keyring and not r.had_tsig: - raise dns.exception.FormError("missing TSIG") - - -async def inbound_xfr( - where: str, - txn_manager: dns.transaction.TransactionManager, - query: Optional[dns.message.Message] = None, - port: int = 53, - timeout: Optional[float] = None, - lifetime: Optional[float] = None, - source: Optional[str] = None, - source_port: int = 0, - udp_mode: UDPMode = UDPMode.NEVER, - backend: Optional[dns.asyncbackend.Backend] = None, -) -> None: - """Conduct an inbound transfer and apply it via a transaction from the - txn_manager. - - *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, - the default, then dnspython will use the default backend. - - See :py:func:`dns.query.inbound_xfr()` for the documentation of - the other parameters, exceptions, and return type of this method. - """ - if query is None: - (query, serial) = dns.xfr.make_query(txn_manager) - else: - serial = dns.xfr.extract_serial_from_query(query) - af = dns.inet.af_for_address(where) - stuple = _source_tuple(af, source, source_port) - dtuple = (where, port) - if not backend: - backend = dns.asyncbackend.get_default_backend() - (_, expiration) = _compute_times(lifetime) - if query.question[0].rdtype == dns.rdatatype.IXFR and udp_mode != UDPMode.NEVER: - s = await backend.make_socket( - af, socket.SOCK_DGRAM, 0, stuple, dtuple, _timeout(expiration) - ) - async with s: - try: - async for _ in _inbound_xfr( - txn_manager, s, query, serial, timeout, expiration - ): - pass - return - except dns.xfr.UseTCP: - if udp_mode == UDPMode.ONLY: - raise - - s = await backend.make_socket( - af, socket.SOCK_STREAM, 0, stuple, dtuple, _timeout(expiration) - ) - async with s: - async for _ in _inbound_xfr(txn_manager, s, query, serial, timeout, expiration): - pass diff --git a/write-message/venv/lib/python3.10/site-packages/dns/asyncresolver.py b/write-message/venv/lib/python3.10/site-packages/dns/asyncresolver.py deleted file mode 100644 index 8f5e062..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/asyncresolver.py +++ /dev/null @@ -1,475 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Asynchronous DNS stub resolver.""" - -import socket -import time -from typing import Any, Dict, List, Optional, Union - -import dns._ddr -import dns.asyncbackend -import dns.asyncquery -import dns.exception -import dns.name -import dns.query -import dns.rdataclass -import dns.rdatatype -import dns.resolver # lgtm[py/import-and-import-from] - -# import some resolver symbols for brevity -from dns.resolver import NXDOMAIN, NoAnswer, NoRootSOA, NotAbsolute - -# for indentation purposes below -_udp = dns.asyncquery.udp -_tcp = dns.asyncquery.tcp - - -class Resolver(dns.resolver.BaseResolver): - """Asynchronous DNS stub resolver.""" - - async def resolve( - self, - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, - search: Optional[bool] = None, - backend: Optional[dns.asyncbackend.Backend] = None, - ) -> dns.resolver.Answer: - """Query nameservers asynchronously to find the answer to the question. - - *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, - the default, then dnspython will use the default backend. - - See :py:func:`dns.resolver.Resolver.resolve()` for the - documentation of the other parameters, exceptions, and return - type of this method. - """ - - resolution = dns.resolver._Resolution( - self, qname, rdtype, rdclass, tcp, raise_on_no_answer, search - ) - if not backend: - backend = dns.asyncbackend.get_default_backend() - start = time.time() - while True: - (request, answer) = resolution.next_request() - # Note we need to say "if answer is not None" and not just - # "if answer" because answer implements __len__, and python - # will call that. We want to return if we have an answer - # object, including in cases where its length is 0. - if answer is not None: - # cache hit! - return answer - assert request is not None # needed for type checking - done = False - while not done: - (nameserver, tcp, backoff) = resolution.next_nameserver() - if backoff: - await backend.sleep(backoff) - timeout = self._compute_timeout(start, lifetime, resolution.errors) - try: - response = await nameserver.async_query( - request, - timeout=timeout, - source=source, - source_port=source_port, - max_size=tcp, - backend=backend, - ) - except Exception as ex: - (_, done) = resolution.query_result(None, ex) - continue - (answer, done) = resolution.query_result(response, None) - # Note we need to say "if answer is not None" and not just - # "if answer" because answer implements __len__, and python - # will call that. We want to return if we have an answer - # object, including in cases where its length is 0. - if answer is not None: - return answer - - async def resolve_address( - self, ipaddr: str, *args: Any, **kwargs: Any - ) -> dns.resolver.Answer: - """Use an asynchronous resolver to run a reverse query for PTR - records. - - This utilizes the resolve() method to perform a PTR lookup on the - specified IP address. - - *ipaddr*, a ``str``, the IPv4 or IPv6 address you want to get - the PTR record for. - - All other arguments that can be passed to the resolve() function - except for rdtype and rdclass are also supported by this - function. - - """ - # We make a modified kwargs for type checking happiness, as otherwise - # we get a legit warning about possibly having rdtype and rdclass - # in the kwargs more than once. - modified_kwargs: Dict[str, Any] = {} - modified_kwargs.update(kwargs) - modified_kwargs["rdtype"] = dns.rdatatype.PTR - modified_kwargs["rdclass"] = dns.rdataclass.IN - return await self.resolve( - dns.reversename.from_address(ipaddr), *args, **modified_kwargs - ) - - async def resolve_name( - self, - name: Union[dns.name.Name, str], - family: int = socket.AF_UNSPEC, - **kwargs: Any, - ) -> dns.resolver.HostAnswers: - """Use an asynchronous resolver to query for address records. - - This utilizes the resolve() method to perform A and/or AAAA lookups on - the specified name. - - *qname*, a ``dns.name.Name`` or ``str``, the name to resolve. - - *family*, an ``int``, the address family. If socket.AF_UNSPEC - (the default), both A and AAAA records will be retrieved. - - All other arguments that can be passed to the resolve() function - except for rdtype and rdclass are also supported by this - function. - """ - # We make a modified kwargs for type checking happiness, as otherwise - # we get a legit warning about possibly having rdtype and rdclass - # in the kwargs more than once. - modified_kwargs: Dict[str, Any] = {} - modified_kwargs.update(kwargs) - modified_kwargs.pop("rdtype", None) - modified_kwargs["rdclass"] = dns.rdataclass.IN - - if family == socket.AF_INET: - v4 = await self.resolve(name, dns.rdatatype.A, **modified_kwargs) - return dns.resolver.HostAnswers.make(v4=v4) - elif family == socket.AF_INET6: - v6 = await self.resolve(name, dns.rdatatype.AAAA, **modified_kwargs) - return dns.resolver.HostAnswers.make(v6=v6) - elif family != socket.AF_UNSPEC: - raise NotImplementedError(f"unknown address family {family}") - - raise_on_no_answer = modified_kwargs.pop("raise_on_no_answer", True) - lifetime = modified_kwargs.pop("lifetime", None) - start = time.time() - v6 = await self.resolve( - name, - dns.rdatatype.AAAA, - raise_on_no_answer=False, - lifetime=self._compute_timeout(start, lifetime), - **modified_kwargs, - ) - # Note that setting name ensures we query the same name - # for A as we did for AAAA. (This is just in case search lists - # are active by default in the resolver configuration and - # we might be talking to a server that says NXDOMAIN when it - # wants to say NOERROR no data. - name = v6.qname - v4 = await self.resolve( - name, - dns.rdatatype.A, - raise_on_no_answer=False, - lifetime=self._compute_timeout(start, lifetime), - **modified_kwargs, - ) - answers = dns.resolver.HostAnswers.make( - v6=v6, v4=v4, add_empty=not raise_on_no_answer - ) - if not answers: - raise NoAnswer(response=v6.response) - return answers - - # pylint: disable=redefined-outer-name - - async def canonical_name(self, name: Union[dns.name.Name, str]) -> dns.name.Name: - """Determine the canonical name of *name*. - - The canonical name is the name the resolver uses for queries - after all CNAME and DNAME renamings have been applied. - - *name*, a ``dns.name.Name`` or ``str``, the query name. - - This method can raise any exception that ``resolve()`` can - raise, other than ``dns.resolver.NoAnswer`` and - ``dns.resolver.NXDOMAIN``. - - Returns a ``dns.name.Name``. - """ - try: - answer = await self.resolve(name, raise_on_no_answer=False) - canonical_name = answer.canonical_name - except dns.resolver.NXDOMAIN as e: - canonical_name = e.canonical_name - return canonical_name - - async def try_ddr(self, lifetime: float = 5.0) -> None: - """Try to update the resolver's nameservers using Discovery of Designated - Resolvers (DDR). If successful, the resolver will subsequently use - DNS-over-HTTPS or DNS-over-TLS for future queries. - - *lifetime*, a float, is the maximum time to spend attempting DDR. The default - is 5 seconds. - - If the SVCB query is successful and results in a non-empty list of nameservers, - then the resolver's nameservers are set to the returned servers in priority - order. - - The current implementation does not use any address hints from the SVCB record, - nor does it resolve addresses for the SCVB target name, rather it assumes that - the bootstrap nameserver will always be one of the addresses and uses it. - A future revision to the code may offer fuller support. The code verifies that - the bootstrap nameserver is in the Subject Alternative Name field of the - TLS certficate. - """ - try: - expiration = time.time() + lifetime - answer = await self.resolve( - dns._ddr._local_resolver_name, "svcb", lifetime=lifetime - ) - timeout = dns.query._remaining(expiration) - nameservers = await dns._ddr._get_nameservers_async(answer, timeout) - if len(nameservers) > 0: - self.nameservers = nameservers - except Exception: - pass - - -default_resolver = None - - -def get_default_resolver() -> Resolver: - """Get the default asynchronous resolver, initializing it if necessary.""" - if default_resolver is None: - reset_default_resolver() - assert default_resolver is not None - return default_resolver - - -def reset_default_resolver() -> None: - """Re-initialize default asynchronous resolver. - - Note that the resolver configuration (i.e. /etc/resolv.conf on UNIX - systems) will be re-read immediately. - """ - - global default_resolver - default_resolver = Resolver() - - -async def resolve( - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, - search: Optional[bool] = None, - backend: Optional[dns.asyncbackend.Backend] = None, -) -> dns.resolver.Answer: - """Query nameservers asynchronously to find the answer to the question. - - This is a convenience function that uses the default resolver - object to make the query. - - See :py:func:`dns.asyncresolver.Resolver.resolve` for more - information on the parameters. - """ - - return await get_default_resolver().resolve( - qname, - rdtype, - rdclass, - tcp, - source, - raise_on_no_answer, - source_port, - lifetime, - search, - backend, - ) - - -async def resolve_address( - ipaddr: str, *args: Any, **kwargs: Any -) -> dns.resolver.Answer: - """Use a resolver to run a reverse query for PTR records. - - See :py:func:`dns.asyncresolver.Resolver.resolve_address` for more - information on the parameters. - """ - - return await get_default_resolver().resolve_address(ipaddr, *args, **kwargs) - - -async def resolve_name( - name: Union[dns.name.Name, str], family: int = socket.AF_UNSPEC, **kwargs: Any -) -> dns.resolver.HostAnswers: - """Use a resolver to asynchronously query for address records. - - See :py:func:`dns.asyncresolver.Resolver.resolve_name` for more - information on the parameters. - """ - - return await get_default_resolver().resolve_name(name, family, **kwargs) - - -async def canonical_name(name: Union[dns.name.Name, str]) -> dns.name.Name: - """Determine the canonical name of *name*. - - See :py:func:`dns.resolver.Resolver.canonical_name` for more - information on the parameters and possible exceptions. - """ - - return await get_default_resolver().canonical_name(name) - - -async def try_ddr(timeout: float = 5.0) -> None: - """Try to update the default resolver's nameservers using Discovery of Designated - Resolvers (DDR). If successful, the resolver will subsequently use - DNS-over-HTTPS or DNS-over-TLS for future queries. - - See :py:func:`dns.resolver.Resolver.try_ddr` for more information. - """ - return await get_default_resolver().try_ddr(timeout) - - -async def zone_for_name( - name: Union[dns.name.Name, str], - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - tcp: bool = False, - resolver: Optional[Resolver] = None, - backend: Optional[dns.asyncbackend.Backend] = None, -) -> dns.name.Name: - """Find the name of the zone which contains the specified name. - - See :py:func:`dns.resolver.Resolver.zone_for_name` for more - information on the parameters and possible exceptions. - """ - - if isinstance(name, str): - name = dns.name.from_text(name, dns.name.root) - if resolver is None: - resolver = get_default_resolver() - if not name.is_absolute(): - raise NotAbsolute(name) - while True: - try: - answer = await resolver.resolve( - name, dns.rdatatype.SOA, rdclass, tcp, backend=backend - ) - assert answer.rrset is not None - if answer.rrset.name == name: - return name - # otherwise we were CNAMEd or DNAMEd and need to look higher - except (NXDOMAIN, NoAnswer): - pass - try: - name = name.parent() - except dns.name.NoParent: # pragma: no cover - raise NoRootSOA - - -async def make_resolver_at( - where: Union[dns.name.Name, str], - port: int = 53, - family: int = socket.AF_UNSPEC, - resolver: Optional[Resolver] = None, -) -> Resolver: - """Make a stub resolver using the specified destination as the full resolver. - - *where*, a ``dns.name.Name`` or ``str`` the domain name or IP address of the - full resolver. - - *port*, an ``int``, the port to use. If not specified, the default is 53. - - *family*, an ``int``, the address family to use. This parameter is used if - *where* is not an address. The default is ``socket.AF_UNSPEC`` in which case - the first address returned by ``resolve_name()`` will be used, otherwise the - first address of the specified family will be used. - - *resolver*, a ``dns.asyncresolver.Resolver`` or ``None``, the resolver to use for - resolution of hostnames. If not specified, the default resolver will be used. - - Returns a ``dns.resolver.Resolver`` or raises an exception. - """ - if resolver is None: - resolver = get_default_resolver() - nameservers: List[Union[str, dns.nameserver.Nameserver]] = [] - if isinstance(where, str) and dns.inet.is_address(where): - nameservers.append(dns.nameserver.Do53Nameserver(where, port)) - else: - answers = await resolver.resolve_name(where, family) - for address in answers.addresses(): - nameservers.append(dns.nameserver.Do53Nameserver(address, port)) - res = dns.asyncresolver.Resolver(configure=False) - res.nameservers = nameservers - return res - - -async def resolve_at( - where: Union[dns.name.Name, str], - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, - search: Optional[bool] = None, - backend: Optional[dns.asyncbackend.Backend] = None, - port: int = 53, - family: int = socket.AF_UNSPEC, - resolver: Optional[Resolver] = None, -) -> dns.resolver.Answer: - """Query nameservers to find the answer to the question. - - This is a convenience function that calls ``dns.asyncresolver.make_resolver_at()`` - to make a resolver, and then uses it to resolve the query. - - See ``dns.asyncresolver.Resolver.resolve`` for more information on the resolution - parameters, and ``dns.asyncresolver.make_resolver_at`` for information about the - resolver parameters *where*, *port*, *family*, and *resolver*. - - If making more than one query, it is more efficient to call - ``dns.asyncresolver.make_resolver_at()`` and then use that resolver for the queries - instead of calling ``resolve_at()`` multiple times. - """ - res = await make_resolver_at(where, port, family, resolver) - return await res.resolve( - qname, - rdtype, - rdclass, - tcp, - source, - raise_on_no_answer, - source_port, - lifetime, - search, - backend, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssec.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssec.py deleted file mode 100644 index b69d0a1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssec.py +++ /dev/null @@ -1,1247 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Common DNSSEC-related functions and constants.""" - - -import base64 -import contextlib -import functools -import hashlib -import struct -import time -from datetime import datetime -from typing import Callable, Dict, List, Optional, Set, Tuple, Union, cast - -import dns._features -import dns.exception -import dns.name -import dns.node -import dns.rdata -import dns.rdataclass -import dns.rdataset -import dns.rdatatype -import dns.rrset -import dns.transaction -import dns.zone -from dns.dnssectypes import Algorithm, DSDigest, NSEC3Hash -from dns.exception import ( # pylint: disable=W0611 - AlgorithmKeyMismatch, - DeniedByPolicy, - UnsupportedAlgorithm, - ValidationFailure, -) -from dns.rdtypes.ANY.CDNSKEY import CDNSKEY -from dns.rdtypes.ANY.CDS import CDS -from dns.rdtypes.ANY.DNSKEY import DNSKEY -from dns.rdtypes.ANY.DS import DS -from dns.rdtypes.ANY.NSEC import NSEC, Bitmap -from dns.rdtypes.ANY.NSEC3PARAM import NSEC3PARAM -from dns.rdtypes.ANY.RRSIG import RRSIG, sigtime_to_posixtime -from dns.rdtypes.dnskeybase import Flag - -PublicKey = Union[ - "GenericPublicKey", - "rsa.RSAPublicKey", - "ec.EllipticCurvePublicKey", - "ed25519.Ed25519PublicKey", - "ed448.Ed448PublicKey", -] - -PrivateKey = Union[ - "GenericPrivateKey", - "rsa.RSAPrivateKey", - "ec.EllipticCurvePrivateKey", - "ed25519.Ed25519PrivateKey", - "ed448.Ed448PrivateKey", -] - -RRsetSigner = Callable[[dns.transaction.Transaction, dns.rrset.RRset], None] - - -def algorithm_from_text(text: str) -> Algorithm: - """Convert text into a DNSSEC algorithm value. - - *text*, a ``str``, the text to convert to into an algorithm value. - - Returns an ``int``. - """ - - return Algorithm.from_text(text) - - -def algorithm_to_text(value: Union[Algorithm, int]) -> str: - """Convert a DNSSEC algorithm value to text - - *value*, a ``dns.dnssec.Algorithm``. - - Returns a ``str``, the name of a DNSSEC algorithm. - """ - - return Algorithm.to_text(value) - - -def to_timestamp(value: Union[datetime, str, float, int]) -> int: - """Convert various format to a timestamp""" - if isinstance(value, datetime): - return int(value.timestamp()) - elif isinstance(value, str): - return sigtime_to_posixtime(value) - elif isinstance(value, float): - return int(value) - elif isinstance(value, int): - return value - else: - raise TypeError("Unsupported timestamp type") - - -def key_id(key: Union[DNSKEY, CDNSKEY]) -> int: - """Return the key id (a 16-bit number) for the specified key. - - *key*, a ``dns.rdtypes.ANY.DNSKEY.DNSKEY`` - - Returns an ``int`` between 0 and 65535 - """ - - rdata = key.to_wire() - assert rdata is not None # for mypy - if key.algorithm == Algorithm.RSAMD5: - return (rdata[-3] << 8) + rdata[-2] - else: - total = 0 - for i in range(len(rdata) // 2): - total += (rdata[2 * i] << 8) + rdata[2 * i + 1] - if len(rdata) % 2 != 0: - total += rdata[len(rdata) - 1] << 8 - total += (total >> 16) & 0xFFFF - return total & 0xFFFF - - -class Policy: - def __init__(self): - pass - - def ok_to_sign(self, _: DNSKEY) -> bool: # pragma: no cover - return False - - def ok_to_validate(self, _: DNSKEY) -> bool: # pragma: no cover - return False - - def ok_to_create_ds(self, _: DSDigest) -> bool: # pragma: no cover - return False - - def ok_to_validate_ds(self, _: DSDigest) -> bool: # pragma: no cover - return False - - -class SimpleDeny(Policy): - def __init__(self, deny_sign, deny_validate, deny_create_ds, deny_validate_ds): - super().__init__() - self._deny_sign = deny_sign - self._deny_validate = deny_validate - self._deny_create_ds = deny_create_ds - self._deny_validate_ds = deny_validate_ds - - def ok_to_sign(self, key: DNSKEY) -> bool: - return key.algorithm not in self._deny_sign - - def ok_to_validate(self, key: DNSKEY) -> bool: - return key.algorithm not in self._deny_validate - - def ok_to_create_ds(self, algorithm: DSDigest) -> bool: - return algorithm not in self._deny_create_ds - - def ok_to_validate_ds(self, algorithm: DSDigest) -> bool: - return algorithm not in self._deny_validate_ds - - -rfc_8624_policy = SimpleDeny( - {Algorithm.RSAMD5, Algorithm.DSA, Algorithm.DSANSEC3SHA1, Algorithm.ECCGOST}, - {Algorithm.RSAMD5, Algorithm.DSA, Algorithm.DSANSEC3SHA1}, - {DSDigest.NULL, DSDigest.SHA1, DSDigest.GOST}, - {DSDigest.NULL}, -) - -allow_all_policy = SimpleDeny(set(), set(), set(), set()) - - -default_policy = rfc_8624_policy - - -def make_ds( - name: Union[dns.name.Name, str], - key: dns.rdata.Rdata, - algorithm: Union[DSDigest, str], - origin: Optional[dns.name.Name] = None, - policy: Optional[Policy] = None, - validating: bool = False, -) -> DS: - """Create a DS record for a DNSSEC key. - - *name*, a ``dns.name.Name`` or ``str``, the owner name of the DS record. - - *key*, a ``dns.rdtypes.ANY.DNSKEY.DNSKEY`` or ``dns.rdtypes.ANY.DNSKEY.CDNSKEY``, - the key the DS is about. - - *algorithm*, a ``str`` or ``int`` specifying the hash algorithm. - The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case - does not matter for these strings. - - *origin*, a ``dns.name.Name`` or ``None``. If *key* is a relative name, - then it will be made absolute using the specified origin. - - *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, - ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. - - *validating*, a ``bool``. If ``True``, then policy is checked in - validating mode, i.e. "Is it ok to validate using this digest algorithm?". - Otherwise the policy is checked in creating mode, i.e. "Is it ok to create a DS with - this digest algorithm?". - - Raises ``UnsupportedAlgorithm`` if the algorithm is unknown. - - Raises ``DeniedByPolicy`` if the algorithm is denied by policy. - - Returns a ``dns.rdtypes.ANY.DS.DS`` - """ - - if policy is None: - policy = default_policy - try: - if isinstance(algorithm, str): - algorithm = DSDigest[algorithm.upper()] - except Exception: - raise UnsupportedAlgorithm(f'unsupported algorithm "{algorithm}"') - if validating: - check = policy.ok_to_validate_ds - else: - check = policy.ok_to_create_ds - if not check(algorithm): - raise DeniedByPolicy - if not isinstance(key, (DNSKEY, CDNSKEY)): - raise ValueError("key is not a DNSKEY/CDNSKEY") - if algorithm == DSDigest.SHA1: - dshash = hashlib.sha1() - elif algorithm == DSDigest.SHA256: - dshash = hashlib.sha256() - elif algorithm == DSDigest.SHA384: - dshash = hashlib.sha384() - else: - raise UnsupportedAlgorithm(f'unsupported algorithm "{algorithm}"') - - if isinstance(name, str): - name = dns.name.from_text(name, origin) - wire = name.canonicalize().to_wire() - kwire = key.to_wire(origin=origin) - assert wire is not None and kwire is not None # for mypy - dshash.update(wire) - dshash.update(kwire) - digest = dshash.digest() - - dsrdata = struct.pack("!HBB", key_id(key), key.algorithm, algorithm) + digest - ds = dns.rdata.from_wire( - dns.rdataclass.IN, dns.rdatatype.DS, dsrdata, 0, len(dsrdata) - ) - return cast(DS, ds) - - -def make_cds( - name: Union[dns.name.Name, str], - key: dns.rdata.Rdata, - algorithm: Union[DSDigest, str], - origin: Optional[dns.name.Name] = None, -) -> CDS: - """Create a CDS record for a DNSSEC key. - - *name*, a ``dns.name.Name`` or ``str``, the owner name of the DS record. - - *key*, a ``dns.rdtypes.ANY.DNSKEY.DNSKEY`` or ``dns.rdtypes.ANY.DNSKEY.CDNSKEY``, - the key the DS is about. - - *algorithm*, a ``str`` or ``int`` specifying the hash algorithm. - The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case - does not matter for these strings. - - *origin*, a ``dns.name.Name`` or ``None``. If *key* is a relative name, - then it will be made absolute using the specified origin. - - Raises ``UnsupportedAlgorithm`` if the algorithm is unknown. - - Returns a ``dns.rdtypes.ANY.DS.CDS`` - """ - - ds = make_ds(name, key, algorithm, origin) - return CDS( - rdclass=ds.rdclass, - rdtype=dns.rdatatype.CDS, - key_tag=ds.key_tag, - algorithm=ds.algorithm, - digest_type=ds.digest_type, - digest=ds.digest, - ) - - -def _find_candidate_keys( - keys: Dict[dns.name.Name, Union[dns.rdataset.Rdataset, dns.node.Node]], rrsig: RRSIG -) -> Optional[List[DNSKEY]]: - value = keys.get(rrsig.signer) - if isinstance(value, dns.node.Node): - rdataset = value.get_rdataset(dns.rdataclass.IN, dns.rdatatype.DNSKEY) - else: - rdataset = value - if rdataset is None: - return None - return [ - cast(DNSKEY, rd) - for rd in rdataset - if rd.algorithm == rrsig.algorithm - and key_id(rd) == rrsig.key_tag - and (rd.flags & Flag.ZONE) == Flag.ZONE # RFC 4034 2.1.1 - and rd.protocol == 3 # RFC 4034 2.1.2 - ] - - -def _get_rrname_rdataset( - rrset: Union[dns.rrset.RRset, Tuple[dns.name.Name, dns.rdataset.Rdataset]], -) -> Tuple[dns.name.Name, dns.rdataset.Rdataset]: - if isinstance(rrset, tuple): - return rrset[0], rrset[1] - else: - return rrset.name, rrset - - -def _validate_signature(sig: bytes, data: bytes, key: DNSKEY) -> None: - # pylint: disable=possibly-used-before-assignment - public_cls = get_algorithm_cls_from_dnskey(key).public_cls - try: - public_key = public_cls.from_dnskey(key) - except ValueError: - raise ValidationFailure("invalid public key") - public_key.verify(sig, data) - - -def _validate_rrsig( - rrset: Union[dns.rrset.RRset, Tuple[dns.name.Name, dns.rdataset.Rdataset]], - rrsig: RRSIG, - keys: Dict[dns.name.Name, Union[dns.node.Node, dns.rdataset.Rdataset]], - origin: Optional[dns.name.Name] = None, - now: Optional[float] = None, - policy: Optional[Policy] = None, -) -> None: - """Validate an RRset against a single signature rdata, throwing an - exception if validation is not successful. - - *rrset*, the RRset to validate. This can be a - ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) - tuple. - - *rrsig*, a ``dns.rdata.Rdata``, the signature to validate. - - *keys*, the key dictionary, used to find the DNSKEY associated - with a given name. The dictionary is keyed by a - ``dns.name.Name``, and has ``dns.node.Node`` or - ``dns.rdataset.Rdataset`` values. - - *origin*, a ``dns.name.Name`` or ``None``, the origin to use for relative - names. - - *now*, a ``float`` or ``None``, the time, in seconds since the epoch, to - use as the current time when validating. If ``None``, the actual current - time is used. - - *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, - ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. - - Raises ``ValidationFailure`` if the signature is expired, not yet valid, - the public key is invalid, the algorithm is unknown, the verification - fails, etc. - - Raises ``UnsupportedAlgorithm`` if the algorithm is recognized by - dnspython but not implemented. - """ - - if policy is None: - policy = default_policy - - candidate_keys = _find_candidate_keys(keys, rrsig) - if candidate_keys is None: - raise ValidationFailure("unknown key") - - if now is None: - now = time.time() - if rrsig.expiration < now: - raise ValidationFailure("expired") - if rrsig.inception > now: - raise ValidationFailure("not yet valid") - - data = _make_rrsig_signature_data(rrset, rrsig, origin) - - # pylint: disable=possibly-used-before-assignment - for candidate_key in candidate_keys: - if not policy.ok_to_validate(candidate_key): - continue - try: - _validate_signature(rrsig.signature, data, candidate_key) - return - except (InvalidSignature, ValidationFailure): - # this happens on an individual validation failure - continue - # nothing verified -- raise failure: - raise ValidationFailure("verify failure") - - -def _validate( - rrset: Union[dns.rrset.RRset, Tuple[dns.name.Name, dns.rdataset.Rdataset]], - rrsigset: Union[dns.rrset.RRset, Tuple[dns.name.Name, dns.rdataset.Rdataset]], - keys: Dict[dns.name.Name, Union[dns.node.Node, dns.rdataset.Rdataset]], - origin: Optional[dns.name.Name] = None, - now: Optional[float] = None, - policy: Optional[Policy] = None, -) -> None: - """Validate an RRset against a signature RRset, throwing an exception - if none of the signatures validate. - - *rrset*, the RRset to validate. This can be a - ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) - tuple. - - *rrsigset*, the signature RRset. This can be a - ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) - tuple. - - *keys*, the key dictionary, used to find the DNSKEY associated - with a given name. The dictionary is keyed by a - ``dns.name.Name``, and has ``dns.node.Node`` or - ``dns.rdataset.Rdataset`` values. - - *origin*, a ``dns.name.Name``, the origin to use for relative names; - defaults to None. - - *now*, an ``int`` or ``None``, the time, in seconds since the epoch, to - use as the current time when validating. If ``None``, the actual current - time is used. - - *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, - ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. - - Raises ``ValidationFailure`` if the signature is expired, not yet valid, - the public key is invalid, the algorithm is unknown, the verification - fails, etc. - """ - - if policy is None: - policy = default_policy - - if isinstance(origin, str): - origin = dns.name.from_text(origin, dns.name.root) - - if isinstance(rrset, tuple): - rrname = rrset[0] - else: - rrname = rrset.name - - if isinstance(rrsigset, tuple): - rrsigname = rrsigset[0] - rrsigrdataset = rrsigset[1] - else: - rrsigname = rrsigset.name - rrsigrdataset = rrsigset - - rrname = rrname.choose_relativity(origin) - rrsigname = rrsigname.choose_relativity(origin) - if rrname != rrsigname: - raise ValidationFailure("owner names do not match") - - for rrsig in rrsigrdataset: - if not isinstance(rrsig, RRSIG): - raise ValidationFailure("expected an RRSIG") - try: - _validate_rrsig(rrset, rrsig, keys, origin, now, policy) - return - except (ValidationFailure, UnsupportedAlgorithm): - pass - raise ValidationFailure("no RRSIGs validated") - - -def _sign( - rrset: Union[dns.rrset.RRset, Tuple[dns.name.Name, dns.rdataset.Rdataset]], - private_key: PrivateKey, - signer: dns.name.Name, - dnskey: DNSKEY, - inception: Optional[Union[datetime, str, int, float]] = None, - expiration: Optional[Union[datetime, str, int, float]] = None, - lifetime: Optional[int] = None, - verify: bool = False, - policy: Optional[Policy] = None, - origin: Optional[dns.name.Name] = None, - deterministic: bool = True, -) -> RRSIG: - """Sign RRset using private key. - - *rrset*, the RRset to validate. This can be a - ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) - tuple. - - *private_key*, the private key to use for signing, a - ``cryptography.hazmat.primitives.asymmetric`` private key class applicable - for DNSSEC. - - *signer*, a ``dns.name.Name``, the Signer's name. - - *dnskey*, a ``DNSKEY`` matching ``private_key``. - - *inception*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the - signature inception time. If ``None``, the current time is used. If a ``str``, the - format is "YYYYMMDDHHMMSS" or alternatively the number of seconds since the UNIX - epoch in text form; this is the same the RRSIG rdata's text form. - Values of type `int` or `float` are interpreted as seconds since the UNIX epoch. - - *expiration*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the signature - expiration time. If ``None``, the expiration time will be the inception time plus - the value of the *lifetime* parameter. See the description of *inception* above - for how the various parameter types are interpreted. - - *lifetime*, an ``int`` or ``None``, the signature lifetime in seconds. This - parameter is only meaningful if *expiration* is ``None``. - - *verify*, a ``bool``. If set to ``True``, the signer will verify signatures - after they are created; the default is ``False``. - - *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, - ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. - - *origin*, a ``dns.name.Name`` or ``None``. If ``None``, the default, then all - names in the rrset (including its owner name) must be absolute; otherwise the - specified origin will be used to make names absolute when signing. - - *deterministic*, a ``bool``. If ``True``, the default, use deterministic - (reproducible) signatures when supported by the algorithm used for signing. - Currently, this only affects ECDSA. - - Raises ``DeniedByPolicy`` if the signature is denied by policy. - """ - - if policy is None: - policy = default_policy - if not policy.ok_to_sign(dnskey): - raise DeniedByPolicy - - if isinstance(rrset, tuple): - rdclass = rrset[1].rdclass - rdtype = rrset[1].rdtype - rrname = rrset[0] - original_ttl = rrset[1].ttl - else: - rdclass = rrset.rdclass - rdtype = rrset.rdtype - rrname = rrset.name - original_ttl = rrset.ttl - - if inception is not None: - rrsig_inception = to_timestamp(inception) - else: - rrsig_inception = int(time.time()) - - if expiration is not None: - rrsig_expiration = to_timestamp(expiration) - elif lifetime is not None: - rrsig_expiration = rrsig_inception + lifetime - else: - raise ValueError("expiration or lifetime must be specified") - - # Derelativize now because we need a correct labels length for the - # rrsig_template. - if origin is not None: - rrname = rrname.derelativize(origin) - labels = len(rrname) - 1 - - # Adjust labels appropriately for wildcards. - if rrname.is_wild(): - labels -= 1 - - rrsig_template = RRSIG( - rdclass=rdclass, - rdtype=dns.rdatatype.RRSIG, - type_covered=rdtype, - algorithm=dnskey.algorithm, - labels=labels, - original_ttl=original_ttl, - expiration=rrsig_expiration, - inception=rrsig_inception, - key_tag=key_id(dnskey), - signer=signer, - signature=b"", - ) - - data = dns.dnssec._make_rrsig_signature_data(rrset, rrsig_template, origin) - - # pylint: disable=possibly-used-before-assignment - if isinstance(private_key, GenericPrivateKey): - signing_key = private_key - else: - try: - private_cls = get_algorithm_cls_from_dnskey(dnskey) - signing_key = private_cls(key=private_key) - except UnsupportedAlgorithm: - raise TypeError("Unsupported key algorithm") - - signature = signing_key.sign(data, verify, deterministic) - - return cast(RRSIG, rrsig_template.replace(signature=signature)) - - -def _make_rrsig_signature_data( - rrset: Union[dns.rrset.RRset, Tuple[dns.name.Name, dns.rdataset.Rdataset]], - rrsig: RRSIG, - origin: Optional[dns.name.Name] = None, -) -> bytes: - """Create signature rdata. - - *rrset*, the RRset to sign/validate. This can be a - ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) - tuple. - - *rrsig*, a ``dns.rdata.Rdata``, the signature to validate, or the - signature template used when signing. - - *origin*, a ``dns.name.Name`` or ``None``, the origin to use for relative - names. - - Raises ``UnsupportedAlgorithm`` if the algorithm is recognized by - dnspython but not implemented. - """ - - if isinstance(origin, str): - origin = dns.name.from_text(origin, dns.name.root) - - signer = rrsig.signer - if not signer.is_absolute(): - if origin is None: - raise ValidationFailure("relative RR name without an origin specified") - signer = signer.derelativize(origin) - - # For convenience, allow the rrset to be specified as a (name, - # rdataset) tuple as well as a proper rrset - rrname, rdataset = _get_rrname_rdataset(rrset) - - data = b"" - wire = rrsig.to_wire(origin=signer) - assert wire is not None # for mypy - data += wire[:18] - data += rrsig.signer.to_digestable(signer) - - # Derelativize the name before considering labels. - if not rrname.is_absolute(): - if origin is None: - raise ValidationFailure("relative RR name without an origin specified") - rrname = rrname.derelativize(origin) - - name_len = len(rrname) - if rrname.is_wild() and rrsig.labels != name_len - 2: - raise ValidationFailure("wild owner name has wrong label length") - if name_len - 1 < rrsig.labels: - raise ValidationFailure("owner name longer than RRSIG labels") - elif rrsig.labels < name_len - 1: - suffix = rrname.split(rrsig.labels + 1)[1] - rrname = dns.name.from_text("*", suffix) - rrnamebuf = rrname.to_digestable() - rrfixed = struct.pack("!HHI", rdataset.rdtype, rdataset.rdclass, rrsig.original_ttl) - rdatas = [rdata.to_digestable(origin) for rdata in rdataset] - for rdata in sorted(rdatas): - data += rrnamebuf - data += rrfixed - rrlen = struct.pack("!H", len(rdata)) - data += rrlen - data += rdata - - return data - - -def _make_dnskey( - public_key: PublicKey, - algorithm: Union[int, str], - flags: int = Flag.ZONE, - protocol: int = 3, -) -> DNSKEY: - """Convert a public key to DNSKEY Rdata - - *public_key*, a ``PublicKey`` (``GenericPublicKey`` or - ``cryptography.hazmat.primitives.asymmetric``) to convert. - - *algorithm*, a ``str`` or ``int`` specifying the DNSKEY algorithm. - - *flags*: DNSKEY flags field as an integer. - - *protocol*: DNSKEY protocol field as an integer. - - Raises ``ValueError`` if the specified key algorithm parameters are not - unsupported, ``TypeError`` if the key type is unsupported, - `UnsupportedAlgorithm` if the algorithm is unknown and - `AlgorithmKeyMismatch` if the algorithm does not match the key type. - - Return DNSKEY ``Rdata``. - """ - - algorithm = Algorithm.make(algorithm) - - # pylint: disable=possibly-used-before-assignment - if isinstance(public_key, GenericPublicKey): - return public_key.to_dnskey(flags=flags, protocol=protocol) - else: - public_cls = get_algorithm_cls(algorithm).public_cls - return public_cls(key=public_key).to_dnskey(flags=flags, protocol=protocol) - - -def _make_cdnskey( - public_key: PublicKey, - algorithm: Union[int, str], - flags: int = Flag.ZONE, - protocol: int = 3, -) -> CDNSKEY: - """Convert a public key to CDNSKEY Rdata - - *public_key*, the public key to convert, a - ``cryptography.hazmat.primitives.asymmetric`` public key class applicable - for DNSSEC. - - *algorithm*, a ``str`` or ``int`` specifying the DNSKEY algorithm. - - *flags*: DNSKEY flags field as an integer. - - *protocol*: DNSKEY protocol field as an integer. - - Raises ``ValueError`` if the specified key algorithm parameters are not - unsupported, ``TypeError`` if the key type is unsupported, - `UnsupportedAlgorithm` if the algorithm is unknown and - `AlgorithmKeyMismatch` if the algorithm does not match the key type. - - Return CDNSKEY ``Rdata``. - """ - - dnskey = _make_dnskey(public_key, algorithm, flags, protocol) - - return CDNSKEY( - rdclass=dnskey.rdclass, - rdtype=dns.rdatatype.CDNSKEY, - flags=dnskey.flags, - protocol=dnskey.protocol, - algorithm=dnskey.algorithm, - key=dnskey.key, - ) - - -def nsec3_hash( - domain: Union[dns.name.Name, str], - salt: Optional[Union[str, bytes]], - iterations: int, - algorithm: Union[int, str], -) -> str: - """ - Calculate the NSEC3 hash, according to - https://tools.ietf.org/html/rfc5155#section-5 - - *domain*, a ``dns.name.Name`` or ``str``, the name to hash. - - *salt*, a ``str``, ``bytes``, or ``None``, the hash salt. If a - string, it is decoded as a hex string. - - *iterations*, an ``int``, the number of iterations. - - *algorithm*, a ``str`` or ``int``, the hash algorithm. - The only defined algorithm is SHA1. - - Returns a ``str``, the encoded NSEC3 hash. - """ - - b32_conversion = str.maketrans( - "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", "0123456789ABCDEFGHIJKLMNOPQRSTUV" - ) - - try: - if isinstance(algorithm, str): - algorithm = NSEC3Hash[algorithm.upper()] - except Exception: - raise ValueError("Wrong hash algorithm (only SHA1 is supported)") - - if algorithm != NSEC3Hash.SHA1: - raise ValueError("Wrong hash algorithm (only SHA1 is supported)") - - if salt is None: - salt_encoded = b"" - elif isinstance(salt, str): - if len(salt) % 2 == 0: - salt_encoded = bytes.fromhex(salt) - else: - raise ValueError("Invalid salt length") - else: - salt_encoded = salt - - if not isinstance(domain, dns.name.Name): - domain = dns.name.from_text(domain) - domain_encoded = domain.canonicalize().to_wire() - assert domain_encoded is not None - - digest = hashlib.sha1(domain_encoded + salt_encoded).digest() - for _ in range(iterations): - digest = hashlib.sha1(digest + salt_encoded).digest() - - output = base64.b32encode(digest).decode("utf-8") - output = output.translate(b32_conversion) - - return output - - -def make_ds_rdataset( - rrset: Union[dns.rrset.RRset, Tuple[dns.name.Name, dns.rdataset.Rdataset]], - algorithms: Set[Union[DSDigest, str]], - origin: Optional[dns.name.Name] = None, -) -> dns.rdataset.Rdataset: - """Create a DS record from DNSKEY/CDNSKEY/CDS. - - *rrset*, the RRset to create DS Rdataset for. This can be a - ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) - tuple. - - *algorithms*, a set of ``str`` or ``int`` specifying the hash algorithms. - The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case - does not matter for these strings. If the RRset is a CDS, only digest - algorithms matching algorithms are accepted. - - *origin*, a ``dns.name.Name`` or ``None``. If `key` is a relative name, - then it will be made absolute using the specified origin. - - Raises ``UnsupportedAlgorithm`` if any of the algorithms are unknown and - ``ValueError`` if the given RRset is not usable. - - Returns a ``dns.rdataset.Rdataset`` - """ - - rrname, rdataset = _get_rrname_rdataset(rrset) - - if rdataset.rdtype not in ( - dns.rdatatype.DNSKEY, - dns.rdatatype.CDNSKEY, - dns.rdatatype.CDS, - ): - raise ValueError("rrset not a DNSKEY/CDNSKEY/CDS") - - _algorithms = set() - for algorithm in algorithms: - try: - if isinstance(algorithm, str): - algorithm = DSDigest[algorithm.upper()] - except Exception: - raise UnsupportedAlgorithm(f'unsupported algorithm "{algorithm}"') - _algorithms.add(algorithm) - - if rdataset.rdtype == dns.rdatatype.CDS: - res = [] - for rdata in cds_rdataset_to_ds_rdataset(rdataset): - if rdata.digest_type in _algorithms: - res.append(rdata) - if len(res) == 0: - raise ValueError("no acceptable CDS rdata found") - return dns.rdataset.from_rdata_list(rdataset.ttl, res) - - res = [] - for algorithm in _algorithms: - res.extend(dnskey_rdataset_to_cds_rdataset(rrname, rdataset, algorithm, origin)) - return dns.rdataset.from_rdata_list(rdataset.ttl, res) - - -def cds_rdataset_to_ds_rdataset( - rdataset: dns.rdataset.Rdataset, -) -> dns.rdataset.Rdataset: - """Create a CDS record from DS. - - *rdataset*, a ``dns.rdataset.Rdataset``, to create DS Rdataset for. - - Raises ``ValueError`` if the rdataset is not CDS. - - Returns a ``dns.rdataset.Rdataset`` - """ - - if rdataset.rdtype != dns.rdatatype.CDS: - raise ValueError("rdataset not a CDS") - res = [] - for rdata in rdataset: - res.append( - CDS( - rdclass=rdata.rdclass, - rdtype=dns.rdatatype.DS, - key_tag=rdata.key_tag, - algorithm=rdata.algorithm, - digest_type=rdata.digest_type, - digest=rdata.digest, - ) - ) - return dns.rdataset.from_rdata_list(rdataset.ttl, res) - - -def dnskey_rdataset_to_cds_rdataset( - name: Union[dns.name.Name, str], - rdataset: dns.rdataset.Rdataset, - algorithm: Union[DSDigest, str], - origin: Optional[dns.name.Name] = None, -) -> dns.rdataset.Rdataset: - """Create a CDS record from DNSKEY/CDNSKEY. - - *name*, a ``dns.name.Name`` or ``str``, the owner name of the CDS record. - - *rdataset*, a ``dns.rdataset.Rdataset``, to create DS Rdataset for. - - *algorithm*, a ``str`` or ``int`` specifying the hash algorithm. - The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case - does not matter for these strings. - - *origin*, a ``dns.name.Name`` or ``None``. If `key` is a relative name, - then it will be made absolute using the specified origin. - - Raises ``UnsupportedAlgorithm`` if the algorithm is unknown or - ``ValueError`` if the rdataset is not DNSKEY/CDNSKEY. - - Returns a ``dns.rdataset.Rdataset`` - """ - - if rdataset.rdtype not in (dns.rdatatype.DNSKEY, dns.rdatatype.CDNSKEY): - raise ValueError("rdataset not a DNSKEY/CDNSKEY") - res = [] - for rdata in rdataset: - res.append(make_cds(name, rdata, algorithm, origin)) - return dns.rdataset.from_rdata_list(rdataset.ttl, res) - - -def dnskey_rdataset_to_cdnskey_rdataset( - rdataset: dns.rdataset.Rdataset, -) -> dns.rdataset.Rdataset: - """Create a CDNSKEY record from DNSKEY. - - *rdataset*, a ``dns.rdataset.Rdataset``, to create CDNSKEY Rdataset for. - - Returns a ``dns.rdataset.Rdataset`` - """ - - if rdataset.rdtype != dns.rdatatype.DNSKEY: - raise ValueError("rdataset not a DNSKEY") - res = [] - for rdata in rdataset: - res.append( - CDNSKEY( - rdclass=rdataset.rdclass, - rdtype=rdataset.rdtype, - flags=rdata.flags, - protocol=rdata.protocol, - algorithm=rdata.algorithm, - key=rdata.key, - ) - ) - return dns.rdataset.from_rdata_list(rdataset.ttl, res) - - -def default_rrset_signer( - txn: dns.transaction.Transaction, - rrset: dns.rrset.RRset, - signer: dns.name.Name, - ksks: List[Tuple[PrivateKey, DNSKEY]], - zsks: List[Tuple[PrivateKey, DNSKEY]], - inception: Optional[Union[datetime, str, int, float]] = None, - expiration: Optional[Union[datetime, str, int, float]] = None, - lifetime: Optional[int] = None, - policy: Optional[Policy] = None, - origin: Optional[dns.name.Name] = None, - deterministic: bool = True, -) -> None: - """Default RRset signer""" - - if rrset.rdtype in set( - [ - dns.rdatatype.RdataType.DNSKEY, - dns.rdatatype.RdataType.CDS, - dns.rdatatype.RdataType.CDNSKEY, - ] - ): - keys = ksks - else: - keys = zsks - - for private_key, dnskey in keys: - rrsig = dns.dnssec.sign( - rrset=rrset, - private_key=private_key, - dnskey=dnskey, - inception=inception, - expiration=expiration, - lifetime=lifetime, - signer=signer, - policy=policy, - origin=origin, - deterministic=deterministic, - ) - txn.add(rrset.name, rrset.ttl, rrsig) - - -def sign_zone( - zone: dns.zone.Zone, - txn: Optional[dns.transaction.Transaction] = None, - keys: Optional[List[Tuple[PrivateKey, DNSKEY]]] = None, - add_dnskey: bool = True, - dnskey_ttl: Optional[int] = None, - inception: Optional[Union[datetime, str, int, float]] = None, - expiration: Optional[Union[datetime, str, int, float]] = None, - lifetime: Optional[int] = None, - nsec3: Optional[NSEC3PARAM] = None, - rrset_signer: Optional[RRsetSigner] = None, - policy: Optional[Policy] = None, - deterministic: bool = True, -) -> None: - """Sign zone. - - *zone*, a ``dns.zone.Zone``, the zone to sign. - - *txn*, a ``dns.transaction.Transaction``, an optional transaction to use for - signing. - - *keys*, a list of (``PrivateKey``, ``DNSKEY``) tuples, to use for signing. KSK/ZSK - roles are assigned automatically if the SEP flag is used, otherwise all RRsets are - signed by all keys. - - *add_dnskey*, a ``bool``. If ``True``, the default, all specified DNSKEYs are - automatically added to the zone on signing. - - *dnskey_ttl*, a``int``, specifies the TTL for DNSKEY RRs. If not specified the TTL - of the existing DNSKEY RRset used or the TTL of the SOA RRset. - - *inception*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the signature - inception time. If ``None``, the current time is used. If a ``str``, the format is - "YYYYMMDDHHMMSS" or alternatively the number of seconds since the UNIX epoch in text - form; this is the same the RRSIG rdata's text form. Values of type `int` or `float` - are interpreted as seconds since the UNIX epoch. - - *expiration*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the signature - expiration time. If ``None``, the expiration time will be the inception time plus - the value of the *lifetime* parameter. See the description of *inception* above for - how the various parameter types are interpreted. - - *lifetime*, an ``int`` or ``None``, the signature lifetime in seconds. This - parameter is only meaningful if *expiration* is ``None``. - - *nsec3*, a ``NSEC3PARAM`` Rdata, configures signing using NSEC3. Not yet - implemented. - - *rrset_signer*, a ``Callable``, an optional function for signing RRsets. The - function requires two arguments: transaction and RRset. If the not specified, - ``dns.dnssec.default_rrset_signer`` will be used. - - *deterministic*, a ``bool``. If ``True``, the default, use deterministic - (reproducible) signatures when supported by the algorithm used for signing. - Currently, this only affects ECDSA. - - Returns ``None``. - """ - - ksks = [] - zsks = [] - - # if we have both KSKs and ZSKs, split by SEP flag. if not, sign all - # records with all keys - if keys: - for key in keys: - if key[1].flags & Flag.SEP: - ksks.append(key) - else: - zsks.append(key) - if not ksks: - ksks = keys - if not zsks: - zsks = keys - else: - keys = [] - - if txn: - cm: contextlib.AbstractContextManager = contextlib.nullcontext(txn) - else: - cm = zone.writer() - - if zone.origin is None: - raise ValueError("no zone origin") - - with cm as _txn: - if add_dnskey: - if dnskey_ttl is None: - dnskey = _txn.get(zone.origin, dns.rdatatype.DNSKEY) - if dnskey: - dnskey_ttl = dnskey.ttl - else: - soa = _txn.get(zone.origin, dns.rdatatype.SOA) - dnskey_ttl = soa.ttl - for _, dnskey in keys: - _txn.add(zone.origin, dnskey_ttl, dnskey) - - if nsec3: - raise NotImplementedError("Signing with NSEC3 not yet implemented") - else: - _rrset_signer = rrset_signer or functools.partial( - default_rrset_signer, - signer=zone.origin, - ksks=ksks, - zsks=zsks, - inception=inception, - expiration=expiration, - lifetime=lifetime, - policy=policy, - origin=zone.origin, - deterministic=deterministic, - ) - return _sign_zone_nsec(zone, _txn, _rrset_signer) - - -def _sign_zone_nsec( - zone: dns.zone.Zone, - txn: dns.transaction.Transaction, - rrset_signer: Optional[RRsetSigner] = None, -) -> None: - """NSEC zone signer""" - - def _txn_add_nsec( - txn: dns.transaction.Transaction, - name: dns.name.Name, - next_secure: Optional[dns.name.Name], - rdclass: dns.rdataclass.RdataClass, - ttl: int, - rrset_signer: Optional[RRsetSigner] = None, - ) -> None: - """NSEC zone signer helper""" - mandatory_types = set( - [dns.rdatatype.RdataType.RRSIG, dns.rdatatype.RdataType.NSEC] - ) - node = txn.get_node(name) - if node and next_secure: - types = ( - set([rdataset.rdtype for rdataset in node.rdatasets]) | mandatory_types - ) - windows = Bitmap.from_rdtypes(list(types)) - rrset = dns.rrset.from_rdata( - name, - ttl, - NSEC( - rdclass=rdclass, - rdtype=dns.rdatatype.RdataType.NSEC, - next=next_secure, - windows=windows, - ), - ) - txn.add(rrset) - if rrset_signer: - rrset_signer(txn, rrset) - - rrsig_ttl = zone.get_soa().minimum - delegation = None - last_secure = None - - for name in sorted(txn.iterate_names()): - if delegation and name.is_subdomain(delegation): - # names below delegations are not secure - continue - elif txn.get(name, dns.rdatatype.NS) and name != zone.origin: - # inside delegation - delegation = name - else: - # outside delegation - delegation = None - - if rrset_signer: - node = txn.get_node(name) - if node: - for rdataset in node.rdatasets: - if rdataset.rdtype == dns.rdatatype.RRSIG: - # do not sign RRSIGs - continue - elif delegation and rdataset.rdtype != dns.rdatatype.DS: - # do not sign delegations except DS records - continue - else: - rrset = dns.rrset.from_rdata(name, rdataset.ttl, *rdataset) - rrset_signer(txn, rrset) - - # We need "is not None" as the empty name is False because its length is 0. - if last_secure is not None: - _txn_add_nsec(txn, last_secure, name, zone.rdclass, rrsig_ttl, rrset_signer) - last_secure = name - - if last_secure: - _txn_add_nsec( - txn, last_secure, zone.origin, zone.rdclass, rrsig_ttl, rrset_signer - ) - - -def _need_pyca(*args, **kwargs): - raise ImportError( - "DNSSEC validation requires python cryptography" - ) # pragma: no cover - - -if dns._features.have("dnssec"): - from cryptography.exceptions import InvalidSignature - from cryptography.hazmat.primitives.asymmetric import dsa # pylint: disable=W0611 - from cryptography.hazmat.primitives.asymmetric import ec # pylint: disable=W0611 - from cryptography.hazmat.primitives.asymmetric import ed448 # pylint: disable=W0611 - from cryptography.hazmat.primitives.asymmetric import rsa # pylint: disable=W0611 - from cryptography.hazmat.primitives.asymmetric import ( # pylint: disable=W0611 - ed25519, - ) - - from dns.dnssecalgs import ( # pylint: disable=C0412 - get_algorithm_cls, - get_algorithm_cls_from_dnskey, - ) - from dns.dnssecalgs.base import GenericPrivateKey, GenericPublicKey - - validate = _validate # type: ignore - validate_rrsig = _validate_rrsig # type: ignore - sign = _sign - make_dnskey = _make_dnskey - make_cdnskey = _make_cdnskey - _have_pyca = True -else: # pragma: no cover - validate = _need_pyca - validate_rrsig = _need_pyca - sign = _need_pyca - make_dnskey = _need_pyca - make_cdnskey = _need_pyca - _have_pyca = False - -### BEGIN generated Algorithm constants - -RSAMD5 = Algorithm.RSAMD5 -DH = Algorithm.DH -DSA = Algorithm.DSA -ECC = Algorithm.ECC -RSASHA1 = Algorithm.RSASHA1 -DSANSEC3SHA1 = Algorithm.DSANSEC3SHA1 -RSASHA1NSEC3SHA1 = Algorithm.RSASHA1NSEC3SHA1 -RSASHA256 = Algorithm.RSASHA256 -RSASHA512 = Algorithm.RSASHA512 -ECCGOST = Algorithm.ECCGOST -ECDSAP256SHA256 = Algorithm.ECDSAP256SHA256 -ECDSAP384SHA384 = Algorithm.ECDSAP384SHA384 -ED25519 = Algorithm.ED25519 -ED448 = Algorithm.ED448 -INDIRECT = Algorithm.INDIRECT -PRIVATEDNS = Algorithm.PRIVATEDNS -PRIVATEOID = Algorithm.PRIVATEOID - -### END generated Algorithm constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__init__.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__init__.py deleted file mode 100644 index 602367e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__init__.py +++ /dev/null @@ -1,121 +0,0 @@ -from typing import Dict, Optional, Tuple, Type, Union - -import dns.name -from dns.dnssecalgs.base import GenericPrivateKey -from dns.dnssectypes import Algorithm -from dns.exception import UnsupportedAlgorithm -from dns.rdtypes.ANY.DNSKEY import DNSKEY - -if dns._features.have("dnssec"): - from dns.dnssecalgs.dsa import PrivateDSA, PrivateDSANSEC3SHA1 - from dns.dnssecalgs.ecdsa import PrivateECDSAP256SHA256, PrivateECDSAP384SHA384 - from dns.dnssecalgs.eddsa import PrivateED448, PrivateED25519 - from dns.dnssecalgs.rsa import ( - PrivateRSAMD5, - PrivateRSASHA1, - PrivateRSASHA1NSEC3SHA1, - PrivateRSASHA256, - PrivateRSASHA512, - ) - - _have_cryptography = True -else: - _have_cryptography = False - -AlgorithmPrefix = Optional[Union[bytes, dns.name.Name]] - -algorithms: Dict[Tuple[Algorithm, AlgorithmPrefix], Type[GenericPrivateKey]] = {} -if _have_cryptography: - # pylint: disable=possibly-used-before-assignment - algorithms.update( - { - (Algorithm.RSAMD5, None): PrivateRSAMD5, - (Algorithm.DSA, None): PrivateDSA, - (Algorithm.RSASHA1, None): PrivateRSASHA1, - (Algorithm.DSANSEC3SHA1, None): PrivateDSANSEC3SHA1, - (Algorithm.RSASHA1NSEC3SHA1, None): PrivateRSASHA1NSEC3SHA1, - (Algorithm.RSASHA256, None): PrivateRSASHA256, - (Algorithm.RSASHA512, None): PrivateRSASHA512, - (Algorithm.ECDSAP256SHA256, None): PrivateECDSAP256SHA256, - (Algorithm.ECDSAP384SHA384, None): PrivateECDSAP384SHA384, - (Algorithm.ED25519, None): PrivateED25519, - (Algorithm.ED448, None): PrivateED448, - } - ) - - -def get_algorithm_cls( - algorithm: Union[int, str], prefix: AlgorithmPrefix = None -) -> Type[GenericPrivateKey]: - """Get Private Key class from Algorithm. - - *algorithm*, a ``str`` or ``int`` specifying the DNSKEY algorithm. - - Raises ``UnsupportedAlgorithm`` if the algorithm is unknown. - - Returns a ``dns.dnssecalgs.GenericPrivateKey`` - """ - algorithm = Algorithm.make(algorithm) - cls = algorithms.get((algorithm, prefix)) - if cls: - return cls - raise UnsupportedAlgorithm( - f'algorithm "{Algorithm.to_text(algorithm)}" not supported by dnspython' - ) - - -def get_algorithm_cls_from_dnskey(dnskey: DNSKEY) -> Type[GenericPrivateKey]: - """Get Private Key class from DNSKEY. - - *dnskey*, a ``DNSKEY`` to get Algorithm class for. - - Raises ``UnsupportedAlgorithm`` if the algorithm is unknown. - - Returns a ``dns.dnssecalgs.GenericPrivateKey`` - """ - prefix: AlgorithmPrefix = None - if dnskey.algorithm == Algorithm.PRIVATEDNS: - prefix, _ = dns.name.from_wire(dnskey.key, 0) - elif dnskey.algorithm == Algorithm.PRIVATEOID: - length = int(dnskey.key[0]) - prefix = dnskey.key[0 : length + 1] - return get_algorithm_cls(dnskey.algorithm, prefix) - - -def register_algorithm_cls( - algorithm: Union[int, str], - algorithm_cls: Type[GenericPrivateKey], - name: Optional[Union[dns.name.Name, str]] = None, - oid: Optional[bytes] = None, -) -> None: - """Register Algorithm Private Key class. - - *algorithm*, a ``str`` or ``int`` specifying the DNSKEY algorithm. - - *algorithm_cls*: A `GenericPrivateKey` class. - - *name*, an optional ``dns.name.Name`` or ``str``, for for PRIVATEDNS algorithms. - - *oid*: an optional BER-encoded `bytes` for PRIVATEOID algorithms. - - Raises ``ValueError`` if a name or oid is specified incorrectly. - """ - if not issubclass(algorithm_cls, GenericPrivateKey): - raise TypeError("Invalid algorithm class") - algorithm = Algorithm.make(algorithm) - prefix: AlgorithmPrefix = None - if algorithm == Algorithm.PRIVATEDNS: - if name is None: - raise ValueError("Name required for PRIVATEDNS algorithms") - if isinstance(name, str): - name = dns.name.from_text(name) - prefix = name - elif algorithm == Algorithm.PRIVATEOID: - if oid is None: - raise ValueError("OID required for PRIVATEOID algorithms") - prefix = bytes([len(oid)]) + oid - elif name: - raise ValueError("Name only supported for PRIVATEDNS algorithm") - elif oid: - raise ValueError("OID only supported for PRIVATEOID algorithm") - algorithms[(algorithm, prefix)] = algorithm_cls diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 3b81d2d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/base.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/base.cpython-310.pyc deleted file mode 100644 index 8cbf3a4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/base.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/cryptography.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/cryptography.cpython-310.pyc deleted file mode 100644 index 685eb50..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/cryptography.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/dsa.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/dsa.cpython-310.pyc deleted file mode 100644 index 4964f07..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/dsa.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/ecdsa.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/ecdsa.cpython-310.pyc deleted file mode 100644 index 3f94710..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/ecdsa.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/eddsa.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/eddsa.cpython-310.pyc deleted file mode 100644 index 0ff6b67..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/eddsa.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/rsa.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/rsa.cpython-310.pyc deleted file mode 100644 index e4c5824..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/__pycache__/rsa.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/base.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/base.py deleted file mode 100644 index 752ee48..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/base.py +++ /dev/null @@ -1,89 +0,0 @@ -from abc import ABC, abstractmethod # pylint: disable=no-name-in-module -from typing import Any, Optional, Type - -import dns.rdataclass -import dns.rdatatype -from dns.dnssectypes import Algorithm -from dns.exception import AlgorithmKeyMismatch -from dns.rdtypes.ANY.DNSKEY import DNSKEY -from dns.rdtypes.dnskeybase import Flag - - -class GenericPublicKey(ABC): - algorithm: Algorithm - - @abstractmethod - def __init__(self, key: Any) -> None: - pass - - @abstractmethod - def verify(self, signature: bytes, data: bytes) -> None: - """Verify signed DNSSEC data""" - - @abstractmethod - def encode_key_bytes(self) -> bytes: - """Encode key as bytes for DNSKEY""" - - @classmethod - def _ensure_algorithm_key_combination(cls, key: DNSKEY) -> None: - if key.algorithm != cls.algorithm: - raise AlgorithmKeyMismatch - - def to_dnskey(self, flags: int = Flag.ZONE, protocol: int = 3) -> DNSKEY: - """Return public key as DNSKEY""" - return DNSKEY( - rdclass=dns.rdataclass.IN, - rdtype=dns.rdatatype.DNSKEY, - flags=flags, - protocol=protocol, - algorithm=self.algorithm, - key=self.encode_key_bytes(), - ) - - @classmethod - @abstractmethod - def from_dnskey(cls, key: DNSKEY) -> "GenericPublicKey": - """Create public key from DNSKEY""" - - @classmethod - @abstractmethod - def from_pem(cls, public_pem: bytes) -> "GenericPublicKey": - """Create public key from PEM-encoded SubjectPublicKeyInfo as specified - in RFC 5280""" - - @abstractmethod - def to_pem(self) -> bytes: - """Return public-key as PEM-encoded SubjectPublicKeyInfo as specified - in RFC 5280""" - - -class GenericPrivateKey(ABC): - public_cls: Type[GenericPublicKey] - - @abstractmethod - def __init__(self, key: Any) -> None: - pass - - @abstractmethod - def sign( - self, - data: bytes, - verify: bool = False, - deterministic: bool = True, - ) -> bytes: - """Sign DNSSEC data""" - - @abstractmethod - def public_key(self) -> "GenericPublicKey": - """Return public key instance""" - - @classmethod - @abstractmethod - def from_pem( - cls, private_pem: bytes, password: Optional[bytes] = None - ) -> "GenericPrivateKey": - """Create private key from PEM-encoded PKCS#8""" - - @abstractmethod - def to_pem(self, password: Optional[bytes] = None) -> bytes: - """Return private key as PEM-encoded PKCS#8""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/cryptography.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/cryptography.py deleted file mode 100644 index 5a31a81..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/cryptography.py +++ /dev/null @@ -1,68 +0,0 @@ -from typing import Any, Optional, Type - -from cryptography.hazmat.primitives import serialization - -from dns.dnssecalgs.base import GenericPrivateKey, GenericPublicKey -from dns.exception import AlgorithmKeyMismatch - - -class CryptographyPublicKey(GenericPublicKey): - key: Any = None - key_cls: Any = None - - def __init__(self, key: Any) -> None: # pylint: disable=super-init-not-called - if self.key_cls is None: - raise TypeError("Undefined private key class") - if not isinstance( # pylint: disable=isinstance-second-argument-not-valid-type - key, self.key_cls - ): - raise AlgorithmKeyMismatch - self.key = key - - @classmethod - def from_pem(cls, public_pem: bytes) -> "GenericPublicKey": - key = serialization.load_pem_public_key(public_pem) - return cls(key=key) - - def to_pem(self) -> bytes: - return self.key.public_bytes( - encoding=serialization.Encoding.PEM, - format=serialization.PublicFormat.SubjectPublicKeyInfo, - ) - - -class CryptographyPrivateKey(GenericPrivateKey): - key: Any = None - key_cls: Any = None - public_cls: Type[CryptographyPublicKey] - - def __init__(self, key: Any) -> None: # pylint: disable=super-init-not-called - if self.key_cls is None: - raise TypeError("Undefined private key class") - if not isinstance( # pylint: disable=isinstance-second-argument-not-valid-type - key, self.key_cls - ): - raise AlgorithmKeyMismatch - self.key = key - - def public_key(self) -> "CryptographyPublicKey": - return self.public_cls(key=self.key.public_key()) - - @classmethod - def from_pem( - cls, private_pem: bytes, password: Optional[bytes] = None - ) -> "GenericPrivateKey": - key = serialization.load_pem_private_key(private_pem, password=password) - return cls(key=key) - - def to_pem(self, password: Optional[bytes] = None) -> bytes: - encryption_algorithm: serialization.KeySerializationEncryption - if password: - encryption_algorithm = serialization.BestAvailableEncryption(password) - else: - encryption_algorithm = serialization.NoEncryption() - return self.key.private_bytes( - encoding=serialization.Encoding.PEM, - format=serialization.PrivateFormat.PKCS8, - encryption_algorithm=encryption_algorithm, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/dsa.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/dsa.py deleted file mode 100644 index adca3de..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/dsa.py +++ /dev/null @@ -1,106 +0,0 @@ -import struct - -from cryptography.hazmat.backends import default_backend -from cryptography.hazmat.primitives import hashes -from cryptography.hazmat.primitives.asymmetric import dsa, utils - -from dns.dnssecalgs.cryptography import CryptographyPrivateKey, CryptographyPublicKey -from dns.dnssectypes import Algorithm -from dns.rdtypes.ANY.DNSKEY import DNSKEY - - -class PublicDSA(CryptographyPublicKey): - key: dsa.DSAPublicKey - key_cls = dsa.DSAPublicKey - algorithm = Algorithm.DSA - chosen_hash = hashes.SHA1() - - def verify(self, signature: bytes, data: bytes) -> None: - sig_r = signature[1:21] - sig_s = signature[21:] - sig = utils.encode_dss_signature( - int.from_bytes(sig_r, "big"), int.from_bytes(sig_s, "big") - ) - self.key.verify(sig, data, self.chosen_hash) - - def encode_key_bytes(self) -> bytes: - """Encode a public key per RFC 2536, section 2.""" - pn = self.key.public_numbers() - dsa_t = (self.key.key_size // 8 - 64) // 8 - if dsa_t > 8: - raise ValueError("unsupported DSA key size") - octets = 64 + dsa_t * 8 - res = struct.pack("!B", dsa_t) - res += pn.parameter_numbers.q.to_bytes(20, "big") - res += pn.parameter_numbers.p.to_bytes(octets, "big") - res += pn.parameter_numbers.g.to_bytes(octets, "big") - res += pn.y.to_bytes(octets, "big") - return res - - @classmethod - def from_dnskey(cls, key: DNSKEY) -> "PublicDSA": - cls._ensure_algorithm_key_combination(key) - keyptr = key.key - (t,) = struct.unpack("!B", keyptr[0:1]) - keyptr = keyptr[1:] - octets = 64 + t * 8 - dsa_q = keyptr[0:20] - keyptr = keyptr[20:] - dsa_p = keyptr[0:octets] - keyptr = keyptr[octets:] - dsa_g = keyptr[0:octets] - keyptr = keyptr[octets:] - dsa_y = keyptr[0:octets] - return cls( - key=dsa.DSAPublicNumbers( # type: ignore - int.from_bytes(dsa_y, "big"), - dsa.DSAParameterNumbers( - int.from_bytes(dsa_p, "big"), - int.from_bytes(dsa_q, "big"), - int.from_bytes(dsa_g, "big"), - ), - ).public_key(default_backend()), - ) - - -class PrivateDSA(CryptographyPrivateKey): - key: dsa.DSAPrivateKey - key_cls = dsa.DSAPrivateKey - public_cls = PublicDSA - - def sign( - self, - data: bytes, - verify: bool = False, - deterministic: bool = True, - ) -> bytes: - """Sign using a private key per RFC 2536, section 3.""" - public_dsa_key = self.key.public_key() - if public_dsa_key.key_size > 1024: - raise ValueError("DSA key size overflow") - der_signature = self.key.sign(data, self.public_cls.chosen_hash) - dsa_r, dsa_s = utils.decode_dss_signature(der_signature) - dsa_t = (public_dsa_key.key_size // 8 - 64) // 8 - octets = 20 - signature = ( - struct.pack("!B", dsa_t) - + int.to_bytes(dsa_r, length=octets, byteorder="big") - + int.to_bytes(dsa_s, length=octets, byteorder="big") - ) - if verify: - self.public_key().verify(signature, data) - return signature - - @classmethod - def generate(cls, key_size: int) -> "PrivateDSA": - return cls( - key=dsa.generate_private_key(key_size=key_size), - ) - - -class PublicDSANSEC3SHA1(PublicDSA): - algorithm = Algorithm.DSANSEC3SHA1 - - -class PrivateDSANSEC3SHA1(PrivateDSA): - public_cls = PublicDSANSEC3SHA1 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/ecdsa.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/ecdsa.py deleted file mode 100644 index 86d5764..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/ecdsa.py +++ /dev/null @@ -1,97 +0,0 @@ -from cryptography.hazmat.backends import default_backend -from cryptography.hazmat.primitives import hashes -from cryptography.hazmat.primitives.asymmetric import ec, utils - -from dns.dnssecalgs.cryptography import CryptographyPrivateKey, CryptographyPublicKey -from dns.dnssectypes import Algorithm -from dns.rdtypes.ANY.DNSKEY import DNSKEY - - -class PublicECDSA(CryptographyPublicKey): - key: ec.EllipticCurvePublicKey - key_cls = ec.EllipticCurvePublicKey - algorithm: Algorithm - chosen_hash: hashes.HashAlgorithm - curve: ec.EllipticCurve - octets: int - - def verify(self, signature: bytes, data: bytes) -> None: - sig_r = signature[0 : self.octets] - sig_s = signature[self.octets :] - sig = utils.encode_dss_signature( - int.from_bytes(sig_r, "big"), int.from_bytes(sig_s, "big") - ) - self.key.verify(sig, data, ec.ECDSA(self.chosen_hash)) - - def encode_key_bytes(self) -> bytes: - """Encode a public key per RFC 6605, section 4.""" - pn = self.key.public_numbers() - return pn.x.to_bytes(self.octets, "big") + pn.y.to_bytes(self.octets, "big") - - @classmethod - def from_dnskey(cls, key: DNSKEY) -> "PublicECDSA": - cls._ensure_algorithm_key_combination(key) - ecdsa_x = key.key[0 : cls.octets] - ecdsa_y = key.key[cls.octets : cls.octets * 2] - return cls( - key=ec.EllipticCurvePublicNumbers( - curve=cls.curve, - x=int.from_bytes(ecdsa_x, "big"), - y=int.from_bytes(ecdsa_y, "big"), - ).public_key(default_backend()), - ) - - -class PrivateECDSA(CryptographyPrivateKey): - key: ec.EllipticCurvePrivateKey - key_cls = ec.EllipticCurvePrivateKey - public_cls = PublicECDSA - - def sign( - self, - data: bytes, - verify: bool = False, - deterministic: bool = True, - ) -> bytes: - """Sign using a private key per RFC 6605, section 4.""" - algorithm = ec.ECDSA( - self.public_cls.chosen_hash, deterministic_signing=deterministic - ) - der_signature = self.key.sign(data, algorithm) - dsa_r, dsa_s = utils.decode_dss_signature(der_signature) - signature = int.to_bytes( - dsa_r, length=self.public_cls.octets, byteorder="big" - ) + int.to_bytes(dsa_s, length=self.public_cls.octets, byteorder="big") - if verify: - self.public_key().verify(signature, data) - return signature - - @classmethod - def generate(cls) -> "PrivateECDSA": - return cls( - key=ec.generate_private_key( - curve=cls.public_cls.curve, backend=default_backend() - ), - ) - - -class PublicECDSAP256SHA256(PublicECDSA): - algorithm = Algorithm.ECDSAP256SHA256 - chosen_hash = hashes.SHA256() - curve = ec.SECP256R1() - octets = 32 - - -class PrivateECDSAP256SHA256(PrivateECDSA): - public_cls = PublicECDSAP256SHA256 - - -class PublicECDSAP384SHA384(PublicECDSA): - algorithm = Algorithm.ECDSAP384SHA384 - chosen_hash = hashes.SHA384() - curve = ec.SECP384R1() - octets = 48 - - -class PrivateECDSAP384SHA384(PrivateECDSA): - public_cls = PublicECDSAP384SHA384 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/eddsa.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/eddsa.py deleted file mode 100644 index 604bcbf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/eddsa.py +++ /dev/null @@ -1,70 +0,0 @@ -from typing import Type - -from cryptography.hazmat.primitives import serialization -from cryptography.hazmat.primitives.asymmetric import ed448, ed25519 - -from dns.dnssecalgs.cryptography import CryptographyPrivateKey, CryptographyPublicKey -from dns.dnssectypes import Algorithm -from dns.rdtypes.ANY.DNSKEY import DNSKEY - - -class PublicEDDSA(CryptographyPublicKey): - def verify(self, signature: bytes, data: bytes) -> None: - self.key.verify(signature, data) - - def encode_key_bytes(self) -> bytes: - """Encode a public key per RFC 8080, section 3.""" - return self.key.public_bytes( - encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw - ) - - @classmethod - def from_dnskey(cls, key: DNSKEY) -> "PublicEDDSA": - cls._ensure_algorithm_key_combination(key) - return cls( - key=cls.key_cls.from_public_bytes(key.key), - ) - - -class PrivateEDDSA(CryptographyPrivateKey): - public_cls: Type[PublicEDDSA] - - def sign( - self, - data: bytes, - verify: bool = False, - deterministic: bool = True, - ) -> bytes: - """Sign using a private key per RFC 8080, section 4.""" - signature = self.key.sign(data) - if verify: - self.public_key().verify(signature, data) - return signature - - @classmethod - def generate(cls) -> "PrivateEDDSA": - return cls(key=cls.key_cls.generate()) - - -class PublicED25519(PublicEDDSA): - key: ed25519.Ed25519PublicKey - key_cls = ed25519.Ed25519PublicKey - algorithm = Algorithm.ED25519 - - -class PrivateED25519(PrivateEDDSA): - key: ed25519.Ed25519PrivateKey - key_cls = ed25519.Ed25519PrivateKey - public_cls = PublicED25519 - - -class PublicED448(PublicEDDSA): - key: ed448.Ed448PublicKey - key_cls = ed448.Ed448PublicKey - algorithm = Algorithm.ED448 - - -class PrivateED448(PrivateEDDSA): - key: ed448.Ed448PrivateKey - key_cls = ed448.Ed448PrivateKey - public_cls = PublicED448 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/rsa.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/rsa.py deleted file mode 100644 index 27537aa..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssecalgs/rsa.py +++ /dev/null @@ -1,124 +0,0 @@ -import math -import struct - -from cryptography.hazmat.backends import default_backend -from cryptography.hazmat.primitives import hashes -from cryptography.hazmat.primitives.asymmetric import padding, rsa - -from dns.dnssecalgs.cryptography import CryptographyPrivateKey, CryptographyPublicKey -from dns.dnssectypes import Algorithm -from dns.rdtypes.ANY.DNSKEY import DNSKEY - - -class PublicRSA(CryptographyPublicKey): - key: rsa.RSAPublicKey - key_cls = rsa.RSAPublicKey - algorithm: Algorithm - chosen_hash: hashes.HashAlgorithm - - def verify(self, signature: bytes, data: bytes) -> None: - self.key.verify(signature, data, padding.PKCS1v15(), self.chosen_hash) - - def encode_key_bytes(self) -> bytes: - """Encode a public key per RFC 3110, section 2.""" - pn = self.key.public_numbers() - _exp_len = math.ceil(int.bit_length(pn.e) / 8) - exp = int.to_bytes(pn.e, length=_exp_len, byteorder="big") - if _exp_len > 255: - exp_header = b"\0" + struct.pack("!H", _exp_len) - else: - exp_header = struct.pack("!B", _exp_len) - if pn.n.bit_length() < 512 or pn.n.bit_length() > 4096: - raise ValueError("unsupported RSA key length") - return exp_header + exp + pn.n.to_bytes((pn.n.bit_length() + 7) // 8, "big") - - @classmethod - def from_dnskey(cls, key: DNSKEY) -> "PublicRSA": - cls._ensure_algorithm_key_combination(key) - keyptr = key.key - (bytes_,) = struct.unpack("!B", keyptr[0:1]) - keyptr = keyptr[1:] - if bytes_ == 0: - (bytes_,) = struct.unpack("!H", keyptr[0:2]) - keyptr = keyptr[2:] - rsa_e = keyptr[0:bytes_] - rsa_n = keyptr[bytes_:] - return cls( - key=rsa.RSAPublicNumbers( - int.from_bytes(rsa_e, "big"), int.from_bytes(rsa_n, "big") - ).public_key(default_backend()) - ) - - -class PrivateRSA(CryptographyPrivateKey): - key: rsa.RSAPrivateKey - key_cls = rsa.RSAPrivateKey - public_cls = PublicRSA - default_public_exponent = 65537 - - def sign( - self, - data: bytes, - verify: bool = False, - deterministic: bool = True, - ) -> bytes: - """Sign using a private key per RFC 3110, section 3.""" - signature = self.key.sign(data, padding.PKCS1v15(), self.public_cls.chosen_hash) - if verify: - self.public_key().verify(signature, data) - return signature - - @classmethod - def generate(cls, key_size: int) -> "PrivateRSA": - return cls( - key=rsa.generate_private_key( - public_exponent=cls.default_public_exponent, - key_size=key_size, - backend=default_backend(), - ) - ) - - -class PublicRSAMD5(PublicRSA): - algorithm = Algorithm.RSAMD5 - chosen_hash = hashes.MD5() - - -class PrivateRSAMD5(PrivateRSA): - public_cls = PublicRSAMD5 - - -class PublicRSASHA1(PublicRSA): - algorithm = Algorithm.RSASHA1 - chosen_hash = hashes.SHA1() - - -class PrivateRSASHA1(PrivateRSA): - public_cls = PublicRSASHA1 - - -class PublicRSASHA1NSEC3SHA1(PublicRSA): - algorithm = Algorithm.RSASHA1NSEC3SHA1 - chosen_hash = hashes.SHA1() - - -class PrivateRSASHA1NSEC3SHA1(PrivateRSA): - public_cls = PublicRSASHA1NSEC3SHA1 - - -class PublicRSASHA256(PublicRSA): - algorithm = Algorithm.RSASHA256 - chosen_hash = hashes.SHA256() - - -class PrivateRSASHA256(PrivateRSA): - public_cls = PublicRSASHA256 - - -class PublicRSASHA512(PublicRSA): - algorithm = Algorithm.RSASHA512 - chosen_hash = hashes.SHA512() - - -class PrivateRSASHA512(PrivateRSA): - public_cls = PublicRSASHA512 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/dnssectypes.py b/write-message/venv/lib/python3.10/site-packages/dns/dnssectypes.py deleted file mode 100644 index 02131e0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/dnssectypes.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Common DNSSEC-related types.""" - -# This is a separate file to avoid import circularity between dns.dnssec and -# the implementations of the DS and DNSKEY types. - -import dns.enum - - -class Algorithm(dns.enum.IntEnum): - RSAMD5 = 1 - DH = 2 - DSA = 3 - ECC = 4 - RSASHA1 = 5 - DSANSEC3SHA1 = 6 - RSASHA1NSEC3SHA1 = 7 - RSASHA256 = 8 - RSASHA512 = 10 - ECCGOST = 12 - ECDSAP256SHA256 = 13 - ECDSAP384SHA384 = 14 - ED25519 = 15 - ED448 = 16 - INDIRECT = 252 - PRIVATEDNS = 253 - PRIVATEOID = 254 - - @classmethod - def _maximum(cls): - return 255 - - -class DSDigest(dns.enum.IntEnum): - """DNSSEC Delegation Signer Digest Algorithm""" - - NULL = 0 - SHA1 = 1 - SHA256 = 2 - GOST = 3 - SHA384 = 4 - - @classmethod - def _maximum(cls): - return 255 - - -class NSEC3Hash(dns.enum.IntEnum): - """NSEC3 hash algorithm""" - - SHA1 = 1 - - @classmethod - def _maximum(cls): - return 255 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/e164.py b/write-message/venv/lib/python3.10/site-packages/dns/e164.py deleted file mode 100644 index 453736d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/e164.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS E.164 helpers.""" - -from typing import Iterable, Optional, Union - -import dns.exception -import dns.name -import dns.resolver - -#: The public E.164 domain. -public_enum_domain = dns.name.from_text("e164.arpa.") - - -def from_e164( - text: str, origin: Optional[dns.name.Name] = public_enum_domain -) -> dns.name.Name: - """Convert an E.164 number in textual form into a Name object whose - value is the ENUM domain name for that number. - - Non-digits in the text are ignored, i.e. "16505551212", - "+1.650.555.1212" and "1 (650) 555-1212" are all the same. - - *text*, a ``str``, is an E.164 number in textual form. - - *origin*, a ``dns.name.Name``, the domain in which the number - should be constructed. The default is ``e164.arpa.``. - - Returns a ``dns.name.Name``. - """ - - parts = [d for d in text if d.isdigit()] - parts.reverse() - return dns.name.from_text(".".join(parts), origin=origin) - - -def to_e164( - name: dns.name.Name, - origin: Optional[dns.name.Name] = public_enum_domain, - want_plus_prefix: bool = True, -) -> str: - """Convert an ENUM domain name into an E.164 number. - - Note that dnspython does not have any information about preferred - number formats within national numbering plans, so all numbers are - emitted as a simple string of digits, prefixed by a '+' (unless - *want_plus_prefix* is ``False``). - - *name* is a ``dns.name.Name``, the ENUM domain name. - - *origin* is a ``dns.name.Name``, a domain containing the ENUM - domain name. The name is relativized to this domain before being - converted to text. If ``None``, no relativization is done. - - *want_plus_prefix* is a ``bool``. If True, add a '+' to the beginning of - the returned number. - - Returns a ``str``. - - """ - if origin is not None: - name = name.relativize(origin) - dlabels = [d for d in name.labels if d.isdigit() and len(d) == 1] - if len(dlabels) != len(name.labels): - raise dns.exception.SyntaxError("non-digit labels in ENUM domain name") - dlabels.reverse() - text = b"".join(dlabels) - if want_plus_prefix: - text = b"+" + text - return text.decode() - - -def query( - number: str, - domains: Iterable[Union[dns.name.Name, str]], - resolver: Optional[dns.resolver.Resolver] = None, -) -> dns.resolver.Answer: - """Look for NAPTR RRs for the specified number in the specified domains. - - e.g. lookup('16505551212', ['e164.dnspython.org.', 'e164.arpa.']) - - *number*, a ``str`` is the number to look for. - - *domains* is an iterable containing ``dns.name.Name`` values. - - *resolver*, a ``dns.resolver.Resolver``, is the resolver to use. If - ``None``, the default resolver is used. - """ - - if resolver is None: - resolver = dns.resolver.get_default_resolver() - e_nx = dns.resolver.NXDOMAIN() - for domain in domains: - if isinstance(domain, str): - domain = dns.name.from_text(domain) - qname = dns.e164.from_e164(number, domain) - try: - return resolver.resolve(qname, "NAPTR") - except dns.resolver.NXDOMAIN as e: - e_nx += e - raise e_nx diff --git a/write-message/venv/lib/python3.10/site-packages/dns/edns.py b/write-message/venv/lib/python3.10/site-packages/dns/edns.py deleted file mode 100644 index f7d9ff9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/edns.py +++ /dev/null @@ -1,572 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2009-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""EDNS Options""" - -import binascii -import math -import socket -import struct -from typing import Any, Dict, Optional, Union - -import dns.enum -import dns.inet -import dns.rdata -import dns.wire - - -class OptionType(dns.enum.IntEnum): - #: NSID - NSID = 3 - #: DAU - DAU = 5 - #: DHU - DHU = 6 - #: N3U - N3U = 7 - #: ECS (client-subnet) - ECS = 8 - #: EXPIRE - EXPIRE = 9 - #: COOKIE - COOKIE = 10 - #: KEEPALIVE - KEEPALIVE = 11 - #: PADDING - PADDING = 12 - #: CHAIN - CHAIN = 13 - #: EDE (extended-dns-error) - EDE = 15 - #: REPORTCHANNEL - REPORTCHANNEL = 18 - - @classmethod - def _maximum(cls): - return 65535 - - -class Option: - """Base class for all EDNS option types.""" - - def __init__(self, otype: Union[OptionType, str]): - """Initialize an option. - - *otype*, a ``dns.edns.OptionType``, is the option type. - """ - self.otype = OptionType.make(otype) - - def to_wire(self, file: Optional[Any] = None) -> Optional[bytes]: - """Convert an option to wire format. - - Returns a ``bytes`` or ``None``. - - """ - raise NotImplementedError # pragma: no cover - - def to_text(self) -> str: - raise NotImplementedError # pragma: no cover - - @classmethod - def from_wire_parser(cls, otype: OptionType, parser: "dns.wire.Parser") -> "Option": - """Build an EDNS option object from wire format. - - *otype*, a ``dns.edns.OptionType``, is the option type. - - *parser*, a ``dns.wire.Parser``, the parser, which should be - restructed to the option length. - - Returns a ``dns.edns.Option``. - """ - raise NotImplementedError # pragma: no cover - - def _cmp(self, other): - """Compare an EDNS option with another option of the same type. - - Returns < 0 if < *other*, 0 if == *other*, and > 0 if > *other*. - """ - wire = self.to_wire() - owire = other.to_wire() - if wire == owire: - return 0 - if wire > owire: - return 1 - return -1 - - def __eq__(self, other): - if not isinstance(other, Option): - return False - if self.otype != other.otype: - return False - return self._cmp(other) == 0 - - def __ne__(self, other): - if not isinstance(other, Option): - return True - if self.otype != other.otype: - return True - return self._cmp(other) != 0 - - def __lt__(self, other): - if not isinstance(other, Option) or self.otype != other.otype: - return NotImplemented - return self._cmp(other) < 0 - - def __le__(self, other): - if not isinstance(other, Option) or self.otype != other.otype: - return NotImplemented - return self._cmp(other) <= 0 - - def __ge__(self, other): - if not isinstance(other, Option) or self.otype != other.otype: - return NotImplemented - return self._cmp(other) >= 0 - - def __gt__(self, other): - if not isinstance(other, Option) or self.otype != other.otype: - return NotImplemented - return self._cmp(other) > 0 - - def __str__(self): - return self.to_text() - - -class GenericOption(Option): # lgtm[py/missing-equals] - """Generic Option Class - - This class is used for EDNS option types for which we have no better - implementation. - """ - - def __init__(self, otype: Union[OptionType, str], data: Union[bytes, str]): - super().__init__(otype) - self.data = dns.rdata.Rdata._as_bytes(data, True) - - def to_wire(self, file: Optional[Any] = None) -> Optional[bytes]: - if file: - file.write(self.data) - return None - else: - return self.data - - def to_text(self) -> str: - return "Generic %d" % self.otype - - @classmethod - def from_wire_parser( - cls, otype: Union[OptionType, str], parser: "dns.wire.Parser" - ) -> Option: - return cls(otype, parser.get_remaining()) - - -class ECSOption(Option): # lgtm[py/missing-equals] - """EDNS Client Subnet (ECS, RFC7871)""" - - def __init__(self, address: str, srclen: Optional[int] = None, scopelen: int = 0): - """*address*, a ``str``, is the client address information. - - *srclen*, an ``int``, the source prefix length, which is the - leftmost number of bits of the address to be used for the - lookup. The default is 24 for IPv4 and 56 for IPv6. - - *scopelen*, an ``int``, the scope prefix length. This value - must be 0 in queries, and should be set in responses. - """ - - super().__init__(OptionType.ECS) - af = dns.inet.af_for_address(address) - - if af == socket.AF_INET6: - self.family = 2 - if srclen is None: - srclen = 56 - address = dns.rdata.Rdata._as_ipv6_address(address) - srclen = dns.rdata.Rdata._as_int(srclen, 0, 128) - scopelen = dns.rdata.Rdata._as_int(scopelen, 0, 128) - elif af == socket.AF_INET: - self.family = 1 - if srclen is None: - srclen = 24 - address = dns.rdata.Rdata._as_ipv4_address(address) - srclen = dns.rdata.Rdata._as_int(srclen, 0, 32) - scopelen = dns.rdata.Rdata._as_int(scopelen, 0, 32) - else: # pragma: no cover (this will never happen) - raise ValueError("Bad address family") - - assert srclen is not None - self.address = address - self.srclen = srclen - self.scopelen = scopelen - - addrdata = dns.inet.inet_pton(af, address) - nbytes = int(math.ceil(srclen / 8.0)) - - # Truncate to srclen and pad to the end of the last octet needed - # See RFC section 6 - self.addrdata = addrdata[:nbytes] - nbits = srclen % 8 - if nbits != 0: - last = struct.pack("B", ord(self.addrdata[-1:]) & (0xFF << (8 - nbits))) - self.addrdata = self.addrdata[:-1] + last - - def to_text(self) -> str: - return f"ECS {self.address}/{self.srclen} scope/{self.scopelen}" - - @staticmethod - def from_text(text: str) -> Option: - """Convert a string into a `dns.edns.ECSOption` - - *text*, a `str`, the text form of the option. - - Returns a `dns.edns.ECSOption`. - - Examples: - - >>> import dns.edns - >>> - >>> # basic example - >>> dns.edns.ECSOption.from_text('1.2.3.4/24') - >>> - >>> # also understands scope - >>> dns.edns.ECSOption.from_text('1.2.3.4/24/32') - >>> - >>> # IPv6 - >>> dns.edns.ECSOption.from_text('2001:4b98::1/64/64') - >>> - >>> # it understands results from `dns.edns.ECSOption.to_text()` - >>> dns.edns.ECSOption.from_text('ECS 1.2.3.4/24/32') - """ - optional_prefix = "ECS" - tokens = text.split() - ecs_text = None - if len(tokens) == 1: - ecs_text = tokens[0] - elif len(tokens) == 2: - if tokens[0] != optional_prefix: - raise ValueError(f'could not parse ECS from "{text}"') - ecs_text = tokens[1] - else: - raise ValueError(f'could not parse ECS from "{text}"') - n_slashes = ecs_text.count("/") - if n_slashes == 1: - address, tsrclen = ecs_text.split("/") - tscope = "0" - elif n_slashes == 2: - address, tsrclen, tscope = ecs_text.split("/") - else: - raise ValueError(f'could not parse ECS from "{text}"') - try: - scope = int(tscope) - except ValueError: - raise ValueError("invalid scope " + f'"{tscope}": scope must be an integer') - try: - srclen = int(tsrclen) - except ValueError: - raise ValueError( - "invalid srclen " + f'"{tsrclen}": srclen must be an integer' - ) - return ECSOption(address, srclen, scope) - - def to_wire(self, file: Optional[Any] = None) -> Optional[bytes]: - value = ( - struct.pack("!HBB", self.family, self.srclen, self.scopelen) + self.addrdata - ) - if file: - file.write(value) - return None - else: - return value - - @classmethod - def from_wire_parser( - cls, otype: Union[OptionType, str], parser: "dns.wire.Parser" - ) -> Option: - family, src, scope = parser.get_struct("!HBB") - addrlen = int(math.ceil(src / 8.0)) - prefix = parser.get_bytes(addrlen) - if family == 1: - pad = 4 - addrlen - addr = dns.ipv4.inet_ntoa(prefix + b"\x00" * pad) - elif family == 2: - pad = 16 - addrlen - addr = dns.ipv6.inet_ntoa(prefix + b"\x00" * pad) - else: - raise ValueError("unsupported family") - - return cls(addr, src, scope) - - -class EDECode(dns.enum.IntEnum): - OTHER = 0 - UNSUPPORTED_DNSKEY_ALGORITHM = 1 - UNSUPPORTED_DS_DIGEST_TYPE = 2 - STALE_ANSWER = 3 - FORGED_ANSWER = 4 - DNSSEC_INDETERMINATE = 5 - DNSSEC_BOGUS = 6 - SIGNATURE_EXPIRED = 7 - SIGNATURE_NOT_YET_VALID = 8 - DNSKEY_MISSING = 9 - RRSIGS_MISSING = 10 - NO_ZONE_KEY_BIT_SET = 11 - NSEC_MISSING = 12 - CACHED_ERROR = 13 - NOT_READY = 14 - BLOCKED = 15 - CENSORED = 16 - FILTERED = 17 - PROHIBITED = 18 - STALE_NXDOMAIN_ANSWER = 19 - NOT_AUTHORITATIVE = 20 - NOT_SUPPORTED = 21 - NO_REACHABLE_AUTHORITY = 22 - NETWORK_ERROR = 23 - INVALID_DATA = 24 - - @classmethod - def _maximum(cls): - return 65535 - - -class EDEOption(Option): # lgtm[py/missing-equals] - """Extended DNS Error (EDE, RFC8914)""" - - _preserve_case = {"DNSKEY", "DS", "DNSSEC", "RRSIGs", "NSEC", "NXDOMAIN"} - - def __init__(self, code: Union[EDECode, str], text: Optional[str] = None): - """*code*, a ``dns.edns.EDECode`` or ``str``, the info code of the - extended error. - - *text*, a ``str`` or ``None``, specifying additional information about - the error. - """ - - super().__init__(OptionType.EDE) - - self.code = EDECode.make(code) - if text is not None and not isinstance(text, str): - raise ValueError("text must be string or None") - self.text = text - - def to_text(self) -> str: - output = f"EDE {self.code}" - if self.code in EDECode: - desc = EDECode.to_text(self.code) - desc = " ".join( - word if word in self._preserve_case else word.title() - for word in desc.split("_") - ) - output += f" ({desc})" - if self.text is not None: - output += f": {self.text}" - return output - - def to_wire(self, file: Optional[Any] = None) -> Optional[bytes]: - value = struct.pack("!H", self.code) - if self.text is not None: - value += self.text.encode("utf8") - - if file: - file.write(value) - return None - else: - return value - - @classmethod - def from_wire_parser( - cls, otype: Union[OptionType, str], parser: "dns.wire.Parser" - ) -> Option: - code = EDECode.make(parser.get_uint16()) - text = parser.get_remaining() - - if text: - if text[-1] == 0: # text MAY be null-terminated - text = text[:-1] - btext = text.decode("utf8") - else: - btext = None - - return cls(code, btext) - - -class NSIDOption(Option): - def __init__(self, nsid: bytes): - super().__init__(OptionType.NSID) - self.nsid = nsid - - def to_wire(self, file: Any = None) -> Optional[bytes]: - if file: - file.write(self.nsid) - return None - else: - return self.nsid - - def to_text(self) -> str: - if all(c >= 0x20 and c <= 0x7E for c in self.nsid): - # All ASCII printable, so it's probably a string. - value = self.nsid.decode() - else: - value = binascii.hexlify(self.nsid).decode() - return f"NSID {value}" - - @classmethod - def from_wire_parser( - cls, otype: Union[OptionType, str], parser: dns.wire.Parser - ) -> Option: - return cls(parser.get_remaining()) - - -class CookieOption(Option): - def __init__(self, client: bytes, server: bytes): - super().__init__(dns.edns.OptionType.COOKIE) - self.client = client - self.server = server - if len(client) != 8: - raise ValueError("client cookie must be 8 bytes") - if len(server) != 0 and (len(server) < 8 or len(server) > 32): - raise ValueError("server cookie must be empty or between 8 and 32 bytes") - - def to_wire(self, file: Any = None) -> Optional[bytes]: - if file: - file.write(self.client) - if len(self.server) > 0: - file.write(self.server) - return None - else: - return self.client + self.server - - def to_text(self) -> str: - client = binascii.hexlify(self.client).decode() - if len(self.server) > 0: - server = binascii.hexlify(self.server).decode() - else: - server = "" - return f"COOKIE {client}{server}" - - @classmethod - def from_wire_parser( - cls, otype: Union[OptionType, str], parser: dns.wire.Parser - ) -> Option: - return cls(parser.get_bytes(8), parser.get_remaining()) - - -class ReportChannelOption(Option): - # RFC 9567 - def __init__(self, agent_domain: dns.name.Name): - super().__init__(OptionType.REPORTCHANNEL) - self.agent_domain = agent_domain - - def to_wire(self, file: Any = None) -> Optional[bytes]: - return self.agent_domain.to_wire(file) - - def to_text(self) -> str: - return "REPORTCHANNEL " + self.agent_domain.to_text() - - @classmethod - def from_wire_parser( - cls, otype: Union[OptionType, str], parser: dns.wire.Parser - ) -> Option: - return cls(parser.get_name()) - - -_type_to_class: Dict[OptionType, Any] = { - OptionType.ECS: ECSOption, - OptionType.EDE: EDEOption, - OptionType.NSID: NSIDOption, - OptionType.COOKIE: CookieOption, - OptionType.REPORTCHANNEL: ReportChannelOption, -} - - -def get_option_class(otype: OptionType) -> Any: - """Return the class for the specified option type. - - The GenericOption class is used if a more specific class is not - known. - """ - - cls = _type_to_class.get(otype) - if cls is None: - cls = GenericOption - return cls - - -def option_from_wire_parser( - otype: Union[OptionType, str], parser: "dns.wire.Parser" -) -> Option: - """Build an EDNS option object from wire format. - - *otype*, an ``int``, is the option type. - - *parser*, a ``dns.wire.Parser``, the parser, which should be - restricted to the option length. - - Returns an instance of a subclass of ``dns.edns.Option``. - """ - otype = OptionType.make(otype) - cls = get_option_class(otype) - return cls.from_wire_parser(otype, parser) - - -def option_from_wire( - otype: Union[OptionType, str], wire: bytes, current: int, olen: int -) -> Option: - """Build an EDNS option object from wire format. - - *otype*, an ``int``, is the option type. - - *wire*, a ``bytes``, is the wire-format message. - - *current*, an ``int``, is the offset in *wire* of the beginning - of the rdata. - - *olen*, an ``int``, is the length of the wire-format option data - - Returns an instance of a subclass of ``dns.edns.Option``. - """ - parser = dns.wire.Parser(wire, current) - with parser.restrict_to(olen): - return option_from_wire_parser(otype, parser) - - -def register_type(implementation: Any, otype: OptionType) -> None: - """Register the implementation of an option type. - - *implementation*, a ``class``, is a subclass of ``dns.edns.Option``. - - *otype*, an ``int``, is the option type. - """ - - _type_to_class[otype] = implementation - - -### BEGIN generated OptionType constants - -NSID = OptionType.NSID -DAU = OptionType.DAU -DHU = OptionType.DHU -N3U = OptionType.N3U -ECS = OptionType.ECS -EXPIRE = OptionType.EXPIRE -COOKIE = OptionType.COOKIE -KEEPALIVE = OptionType.KEEPALIVE -PADDING = OptionType.PADDING -CHAIN = OptionType.CHAIN -EDE = OptionType.EDE -REPORTCHANNEL = OptionType.REPORTCHANNEL - -### END generated OptionType constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/entropy.py b/write-message/venv/lib/python3.10/site-packages/dns/entropy.py deleted file mode 100644 index 4dcdc62..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/entropy.py +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2009-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import hashlib -import os -import random -import threading -import time -from typing import Any, Optional - - -class EntropyPool: - # This is an entropy pool for Python implementations that do not - # have a working SystemRandom. I'm not sure there are any, but - # leaving this code doesn't hurt anything as the library code - # is used if present. - - def __init__(self, seed: Optional[bytes] = None): - self.pool_index = 0 - self.digest: Optional[bytearray] = None - self.next_byte = 0 - self.lock = threading.Lock() - self.hash = hashlib.sha1() - self.hash_len = 20 - self.pool = bytearray(b"\0" * self.hash_len) - if seed is not None: - self._stir(seed) - self.seeded = True - self.seed_pid = os.getpid() - else: - self.seeded = False - self.seed_pid = 0 - - def _stir(self, entropy: bytes) -> None: - for c in entropy: - if self.pool_index == self.hash_len: - self.pool_index = 0 - b = c & 0xFF - self.pool[self.pool_index] ^= b - self.pool_index += 1 - - def stir(self, entropy: bytes) -> None: - with self.lock: - self._stir(entropy) - - def _maybe_seed(self) -> None: - if not self.seeded or self.seed_pid != os.getpid(): - try: - seed = os.urandom(16) - except Exception: # pragma: no cover - try: - with open("/dev/urandom", "rb", 0) as r: - seed = r.read(16) - except Exception: - seed = str(time.time()).encode() - self.seeded = True - self.seed_pid = os.getpid() - self.digest = None - seed = bytearray(seed) - self._stir(seed) - - def random_8(self) -> int: - with self.lock: - self._maybe_seed() - if self.digest is None or self.next_byte == self.hash_len: - self.hash.update(bytes(self.pool)) - self.digest = bytearray(self.hash.digest()) - self._stir(self.digest) - self.next_byte = 0 - value = self.digest[self.next_byte] - self.next_byte += 1 - return value - - def random_16(self) -> int: - return self.random_8() * 256 + self.random_8() - - def random_32(self) -> int: - return self.random_16() * 65536 + self.random_16() - - def random_between(self, first: int, last: int) -> int: - size = last - first + 1 - if size > 4294967296: - raise ValueError("too big") - if size > 65536: - rand = self.random_32 - max = 4294967295 - elif size > 256: - rand = self.random_16 - max = 65535 - else: - rand = self.random_8 - max = 255 - return first + size * rand() // (max + 1) - - -pool = EntropyPool() - -system_random: Optional[Any] -try: - system_random = random.SystemRandom() -except Exception: # pragma: no cover - system_random = None - - -def random_16() -> int: - if system_random is not None: - return system_random.randrange(0, 65536) - else: - return pool.random_16() - - -def between(first: int, last: int) -> int: - if system_random is not None: - return system_random.randrange(first, last + 1) - else: - return pool.random_between(first, last) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/enum.py b/write-message/venv/lib/python3.10/site-packages/dns/enum.py deleted file mode 100644 index 71461f1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/enum.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import enum -from typing import Type, TypeVar, Union - -TIntEnum = TypeVar("TIntEnum", bound="IntEnum") - - -class IntEnum(enum.IntEnum): - @classmethod - def _missing_(cls, value): - cls._check_value(value) - val = int.__new__(cls, value) - val._name_ = cls._extra_to_text(value, None) or f"{cls._prefix()}{value}" - val._value_ = value - return val - - @classmethod - def _check_value(cls, value): - max = cls._maximum() - if not isinstance(value, int): - raise TypeError - if value < 0 or value > max: - name = cls._short_name() - raise ValueError(f"{name} must be an int between >= 0 and <= {max}") - - @classmethod - def from_text(cls: Type[TIntEnum], text: str) -> TIntEnum: - text = text.upper() - try: - return cls[text] - except KeyError: - pass - value = cls._extra_from_text(text) - if value: - return value - prefix = cls._prefix() - if text.startswith(prefix) and text[len(prefix) :].isdigit(): - value = int(text[len(prefix) :]) - cls._check_value(value) - try: - return cls(value) - except ValueError: - return value - raise cls._unknown_exception_class() - - @classmethod - def to_text(cls: Type[TIntEnum], value: int) -> str: - cls._check_value(value) - try: - text = cls(value).name - except ValueError: - text = None - text = cls._extra_to_text(value, text) - if text is None: - text = f"{cls._prefix()}{value}" - return text - - @classmethod - def make(cls: Type[TIntEnum], value: Union[int, str]) -> TIntEnum: - """Convert text or a value into an enumerated type, if possible. - - *value*, the ``int`` or ``str`` to convert. - - Raises a class-specific exception if a ``str`` is provided that - cannot be converted. - - Raises ``ValueError`` if the value is out of range. - - Returns an enumeration from the calling class corresponding to the - value, if one is defined, or an ``int`` otherwise. - """ - - if isinstance(value, str): - return cls.from_text(value) - cls._check_value(value) - return cls(value) - - @classmethod - def _maximum(cls): - raise NotImplementedError # pragma: no cover - - @classmethod - def _short_name(cls): - return cls.__name__.lower() - - @classmethod - def _prefix(cls): - return "" - - @classmethod - def _extra_from_text(cls, text): # pylint: disable=W0613 - return None - - @classmethod - def _extra_to_text(cls, value, current_text): # pylint: disable=W0613 - return current_text - - @classmethod - def _unknown_exception_class(cls): - return ValueError diff --git a/write-message/venv/lib/python3.10/site-packages/dns/exception.py b/write-message/venv/lib/python3.10/site-packages/dns/exception.py deleted file mode 100644 index 223f2d6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/exception.py +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Common DNS Exceptions. - -Dnspython modules may also define their own exceptions, which will -always be subclasses of ``DNSException``. -""" - - -from typing import Optional, Set - - -class DNSException(Exception): - """Abstract base class shared by all dnspython exceptions. - - It supports two basic modes of operation: - - a) Old/compatible mode is used if ``__init__`` was called with - empty *kwargs*. In compatible mode all *args* are passed - to the standard Python Exception class as before and all *args* are - printed by the standard ``__str__`` implementation. Class variable - ``msg`` (or doc string if ``msg`` is ``None``) is returned from ``str()`` - if *args* is empty. - - b) New/parametrized mode is used if ``__init__`` was called with - non-empty *kwargs*. - In the new mode *args* must be empty and all kwargs must match - those set in class variable ``supp_kwargs``. All kwargs are stored inside - ``self.kwargs`` and used in a new ``__str__`` implementation to construct - a formatted message based on the ``fmt`` class variable, a ``string``. - - In the simplest case it is enough to override the ``supp_kwargs`` - and ``fmt`` class variables to get nice parametrized messages. - """ - - msg: Optional[str] = None # non-parametrized message - supp_kwargs: Set[str] = set() # accepted parameters for _fmt_kwargs (sanity check) - fmt: Optional[str] = None # message parametrized with results from _fmt_kwargs - - def __init__(self, *args, **kwargs): - self._check_params(*args, **kwargs) - if kwargs: - # This call to a virtual method from __init__ is ok in our usage - self.kwargs = self._check_kwargs(**kwargs) # lgtm[py/init-calls-subclass] - self.msg = str(self) - else: - self.kwargs = dict() # defined but empty for old mode exceptions - if self.msg is None: - # doc string is better implicit message than empty string - self.msg = self.__doc__ - if args: - super().__init__(*args) - else: - super().__init__(self.msg) - - def _check_params(self, *args, **kwargs): - """Old exceptions supported only args and not kwargs. - - For sanity we do not allow to mix old and new behavior.""" - if args or kwargs: - assert bool(args) != bool( - kwargs - ), "keyword arguments are mutually exclusive with positional args" - - def _check_kwargs(self, **kwargs): - if kwargs: - assert ( - set(kwargs.keys()) == self.supp_kwargs - ), f"following set of keyword args is required: {self.supp_kwargs}" - return kwargs - - def _fmt_kwargs(self, **kwargs): - """Format kwargs before printing them. - - Resulting dictionary has to have keys necessary for str.format call - on fmt class variable. - """ - fmtargs = {} - for kw, data in kwargs.items(): - if isinstance(data, (list, set)): - # convert list of to list of str() - fmtargs[kw] = list(map(str, data)) - if len(fmtargs[kw]) == 1: - # remove list brackets [] from single-item lists - fmtargs[kw] = fmtargs[kw].pop() - else: - fmtargs[kw] = data - return fmtargs - - def __str__(self): - if self.kwargs and self.fmt: - # provide custom message constructed from keyword arguments - fmtargs = self._fmt_kwargs(**self.kwargs) - return self.fmt.format(**fmtargs) - else: - # print *args directly in the same way as old DNSException - return super().__str__() - - -class FormError(DNSException): - """DNS message is malformed.""" - - -class SyntaxError(DNSException): - """Text input is malformed.""" - - -class UnexpectedEnd(SyntaxError): - """Text input ended unexpectedly.""" - - -class TooBig(DNSException): - """The DNS message is too big.""" - - -class Timeout(DNSException): - """The DNS operation timed out.""" - - supp_kwargs = {"timeout"} - fmt = "The DNS operation timed out after {timeout:.3f} seconds" - - # We do this as otherwise mypy complains about unexpected keyword argument - # idna_exception - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - -class UnsupportedAlgorithm(DNSException): - """The DNSSEC algorithm is not supported.""" - - -class AlgorithmKeyMismatch(UnsupportedAlgorithm): - """The DNSSEC algorithm is not supported for the given key type.""" - - -class ValidationFailure(DNSException): - """The DNSSEC signature is invalid.""" - - -class DeniedByPolicy(DNSException): - """Denied by DNSSEC policy.""" - - -class ExceptionWrapper: - def __init__(self, exception_class): - self.exception_class = exception_class - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - if exc_type is not None and not isinstance(exc_val, self.exception_class): - raise self.exception_class(str(exc_val)) from exc_val - return False diff --git a/write-message/venv/lib/python3.10/site-packages/dns/flags.py b/write-message/venv/lib/python3.10/site-packages/dns/flags.py deleted file mode 100644 index 4c60be1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/flags.py +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Message Flags.""" - -import enum -from typing import Any - -# Standard DNS flags - - -class Flag(enum.IntFlag): - #: Query Response - QR = 0x8000 - #: Authoritative Answer - AA = 0x0400 - #: Truncated Response - TC = 0x0200 - #: Recursion Desired - RD = 0x0100 - #: Recursion Available - RA = 0x0080 - #: Authentic Data - AD = 0x0020 - #: Checking Disabled - CD = 0x0010 - - -# EDNS flags - - -class EDNSFlag(enum.IntFlag): - #: DNSSEC answer OK - DO = 0x8000 - - -def _from_text(text: str, enum_class: Any) -> int: - flags = 0 - tokens = text.split() - for t in tokens: - flags |= enum_class[t.upper()] - return flags - - -def _to_text(flags: int, enum_class: Any) -> str: - text_flags = [] - for k, v in enum_class.__members__.items(): - if flags & v != 0: - text_flags.append(k) - return " ".join(text_flags) - - -def from_text(text: str) -> int: - """Convert a space-separated list of flag text values into a flags - value. - - Returns an ``int`` - """ - - return _from_text(text, Flag) - - -def to_text(flags: int) -> str: - """Convert a flags value into a space-separated list of flag text - values. - - Returns a ``str``. - """ - - return _to_text(flags, Flag) - - -def edns_from_text(text: str) -> int: - """Convert a space-separated list of EDNS flag text values into a EDNS - flags value. - - Returns an ``int`` - """ - - return _from_text(text, EDNSFlag) - - -def edns_to_text(flags: int) -> str: - """Convert an EDNS flags value into a space-separated list of EDNS flag - text values. - - Returns a ``str``. - """ - - return _to_text(flags, EDNSFlag) - - -### BEGIN generated Flag constants - -QR = Flag.QR -AA = Flag.AA -TC = Flag.TC -RD = Flag.RD -RA = Flag.RA -AD = Flag.AD -CD = Flag.CD - -### END generated Flag constants - -### BEGIN generated EDNSFlag constants - -DO = EDNSFlag.DO - -### END generated EDNSFlag constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/grange.py b/write-message/venv/lib/python3.10/site-packages/dns/grange.py deleted file mode 100644 index a967ca4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/grange.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2012-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS GENERATE range conversion.""" - -from typing import Tuple - -import dns - - -def from_text(text: str) -> Tuple[int, int, int]: - """Convert the text form of a range in a ``$GENERATE`` statement to an - integer. - - *text*, a ``str``, the textual range in ``$GENERATE`` form. - - Returns a tuple of three ``int`` values ``(start, stop, step)``. - """ - - start = -1 - stop = -1 - step = 1 - cur = "" - state = 0 - # state 0 1 2 - # x - y / z - - if text and text[0] == "-": - raise dns.exception.SyntaxError("Start cannot be a negative number") - - for c in text: - if c == "-" and state == 0: - start = int(cur) - cur = "" - state = 1 - elif c == "/": - stop = int(cur) - cur = "" - state = 2 - elif c.isdigit(): - cur += c - else: - raise dns.exception.SyntaxError(f"Could not parse {c}") - - if state == 0: - raise dns.exception.SyntaxError("no stop value specified") - elif state == 1: - stop = int(cur) - else: - assert state == 2 - step = int(cur) - - assert step >= 1 - assert start >= 0 - if start > stop: - raise dns.exception.SyntaxError("start must be <= stop") - - return (start, stop, step) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/immutable.py b/write-message/venv/lib/python3.10/site-packages/dns/immutable.py deleted file mode 100644 index 36b0362..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/immutable.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import collections.abc -from typing import Any, Callable - -from dns._immutable_ctx import immutable - - -@immutable -class Dict(collections.abc.Mapping): # lgtm[py/missing-equals] - def __init__( - self, - dictionary: Any, - no_copy: bool = False, - map_factory: Callable[[], collections.abc.MutableMapping] = dict, - ): - """Make an immutable dictionary from the specified dictionary. - - If *no_copy* is `True`, then *dictionary* will be wrapped instead - of copied. Only set this if you are sure there will be no external - references to the dictionary. - """ - if no_copy and isinstance(dictionary, collections.abc.MutableMapping): - self._odict = dictionary - else: - self._odict = map_factory() - self._odict.update(dictionary) - self._hash = None - - def __getitem__(self, key): - return self._odict.__getitem__(key) - - def __hash__(self): # pylint: disable=invalid-hash-returned - if self._hash is None: - h = 0 - for key in sorted(self._odict.keys()): - h ^= hash(key) - object.__setattr__(self, "_hash", h) - # this does return an int, but pylint doesn't figure that out - return self._hash - - def __len__(self): - return len(self._odict) - - def __iter__(self): - return iter(self._odict) - - -def constify(o: Any) -> Any: - """ - Convert mutable types to immutable types. - """ - if isinstance(o, bytearray): - return bytes(o) - if isinstance(o, tuple): - try: - hash(o) - return o - except Exception: - return tuple(constify(elt) for elt in o) - if isinstance(o, list): - return tuple(constify(elt) for elt in o) - if isinstance(o, dict): - cdict = dict() - for k, v in o.items(): - cdict[k] = constify(v) - return Dict(cdict, True) - return o diff --git a/write-message/venv/lib/python3.10/site-packages/dns/inet.py b/write-message/venv/lib/python3.10/site-packages/dns/inet.py deleted file mode 100644 index 4a03f99..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/inet.py +++ /dev/null @@ -1,197 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Generic Internet address helper functions.""" - -import socket -from typing import Any, Optional, Tuple - -import dns.ipv4 -import dns.ipv6 - -# We assume that AF_INET and AF_INET6 are always defined. We keep -# these here for the benefit of any old code (unlikely though that -# is!). -AF_INET = socket.AF_INET -AF_INET6 = socket.AF_INET6 - - -def inet_pton(family: int, text: str) -> bytes: - """Convert the textual form of a network address into its binary form. - - *family* is an ``int``, the address family. - - *text* is a ``str``, the textual address. - - Raises ``NotImplementedError`` if the address family specified is not - implemented. - - Returns a ``bytes``. - """ - - if family == AF_INET: - return dns.ipv4.inet_aton(text) - elif family == AF_INET6: - return dns.ipv6.inet_aton(text, True) - else: - raise NotImplementedError - - -def inet_ntop(family: int, address: bytes) -> str: - """Convert the binary form of a network address into its textual form. - - *family* is an ``int``, the address family. - - *address* is a ``bytes``, the network address in binary form. - - Raises ``NotImplementedError`` if the address family specified is not - implemented. - - Returns a ``str``. - """ - - if family == AF_INET: - return dns.ipv4.inet_ntoa(address) - elif family == AF_INET6: - return dns.ipv6.inet_ntoa(address) - else: - raise NotImplementedError - - -def af_for_address(text: str) -> int: - """Determine the address family of a textual-form network address. - - *text*, a ``str``, the textual address. - - Raises ``ValueError`` if the address family cannot be determined - from the input. - - Returns an ``int``. - """ - - try: - dns.ipv4.inet_aton(text) - return AF_INET - except Exception: - try: - dns.ipv6.inet_aton(text, True) - return AF_INET6 - except Exception: - raise ValueError - - -def is_multicast(text: str) -> bool: - """Is the textual-form network address a multicast address? - - *text*, a ``str``, the textual address. - - Raises ``ValueError`` if the address family cannot be determined - from the input. - - Returns a ``bool``. - """ - - try: - first = dns.ipv4.inet_aton(text)[0] - return first >= 224 and first <= 239 - except Exception: - try: - first = dns.ipv6.inet_aton(text, True)[0] - return first == 255 - except Exception: - raise ValueError - - -def is_address(text: str) -> bool: - """Is the specified string an IPv4 or IPv6 address? - - *text*, a ``str``, the textual address. - - Returns a ``bool``. - """ - - try: - dns.ipv4.inet_aton(text) - return True - except Exception: - try: - dns.ipv6.inet_aton(text, True) - return True - except Exception: - return False - - -def low_level_address_tuple( - high_tuple: Tuple[str, int], af: Optional[int] = None -) -> Any: - """Given a "high-level" address tuple, i.e. - an (address, port) return the appropriate "low-level" address tuple - suitable for use in socket calls. - - If an *af* other than ``None`` is provided, it is assumed the - address in the high-level tuple is valid and has that af. If af - is ``None``, then af_for_address will be called. - """ - address, port = high_tuple - if af is None: - af = af_for_address(address) - if af == AF_INET: - return (address, port) - elif af == AF_INET6: - i = address.find("%") - if i < 0: - # no scope, shortcut! - return (address, port, 0, 0) - # try to avoid getaddrinfo() - addrpart = address[:i] - scope = address[i + 1 :] - if scope.isdigit(): - return (addrpart, port, 0, int(scope)) - try: - return (addrpart, port, 0, socket.if_nametoindex(scope)) - except AttributeError: # pragma: no cover (we can't really test this) - ai_flags = socket.AI_NUMERICHOST - ((*_, tup), *_) = socket.getaddrinfo(address, port, flags=ai_flags) - return tup - else: - raise NotImplementedError(f"unknown address family {af}") - - -def any_for_af(af): - """Return the 'any' address for the specified address family.""" - if af == socket.AF_INET: - return "0.0.0.0" - elif af == socket.AF_INET6: - return "::" - raise NotImplementedError(f"unknown address family {af}") - - -def canonicalize(text: str) -> str: - """Verify that *address* is a valid text form IPv4 or IPv6 address and return its - canonical text form. IPv6 addresses with scopes are rejected. - - *text*, a ``str``, the address in textual form. - - Raises ``ValueError`` if the text is not valid. - """ - try: - return dns.ipv6.canonicalize(text) - except Exception: - try: - return dns.ipv4.canonicalize(text) - except Exception: - raise ValueError diff --git a/write-message/venv/lib/python3.10/site-packages/dns/ipv4.py b/write-message/venv/lib/python3.10/site-packages/dns/ipv4.py deleted file mode 100644 index 65ee69c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/ipv4.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""IPv4 helper functions.""" - -import struct -from typing import Union - -import dns.exception - - -def inet_ntoa(address: bytes) -> str: - """Convert an IPv4 address in binary form to text form. - - *address*, a ``bytes``, the IPv4 address in binary form. - - Returns a ``str``. - """ - - if len(address) != 4: - raise dns.exception.SyntaxError - return "%u.%u.%u.%u" % (address[0], address[1], address[2], address[3]) - - -def inet_aton(text: Union[str, bytes]) -> bytes: - """Convert an IPv4 address in text form to binary form. - - *text*, a ``str`` or ``bytes``, the IPv4 address in textual form. - - Returns a ``bytes``. - """ - - if not isinstance(text, bytes): - btext = text.encode() - else: - btext = text - parts = btext.split(b".") - if len(parts) != 4: - raise dns.exception.SyntaxError - for part in parts: - if not part.isdigit(): - raise dns.exception.SyntaxError - if len(part) > 1 and part[0] == ord("0"): - # No leading zeros - raise dns.exception.SyntaxError - try: - b = [int(part) for part in parts] - return struct.pack("BBBB", *b) - except Exception: - raise dns.exception.SyntaxError - - -def canonicalize(text: Union[str, bytes]) -> str: - """Verify that *address* is a valid text form IPv4 address and return its - canonical text form. - - *text*, a ``str`` or ``bytes``, the IPv4 address in textual form. - - Raises ``dns.exception.SyntaxError`` if the text is not valid. - """ - # Note that inet_aton() only accepts canonial form, but we still run through - # inet_ntoa() to ensure the output is a str. - return dns.ipv4.inet_ntoa(dns.ipv4.inet_aton(text)) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/ipv6.py b/write-message/venv/lib/python3.10/site-packages/dns/ipv6.py deleted file mode 100644 index 4dd1d1c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/ipv6.py +++ /dev/null @@ -1,217 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""IPv6 helper functions.""" - -import binascii -import re -from typing import List, Union - -import dns.exception -import dns.ipv4 - -_leading_zero = re.compile(r"0+([0-9a-f]+)") - - -def inet_ntoa(address: bytes) -> str: - """Convert an IPv6 address in binary form to text form. - - *address*, a ``bytes``, the IPv6 address in binary form. - - Raises ``ValueError`` if the address isn't 16 bytes long. - Returns a ``str``. - """ - - if len(address) != 16: - raise ValueError("IPv6 addresses are 16 bytes long") - hex = binascii.hexlify(address) - chunks = [] - i = 0 - l = len(hex) - while i < l: - chunk = hex[i : i + 4].decode() - # strip leading zeros. we do this with an re instead of - # with lstrip() because lstrip() didn't support chars until - # python 2.2.2 - m = _leading_zero.match(chunk) - if m is not None: - chunk = m.group(1) - chunks.append(chunk) - i += 4 - # - # Compress the longest subsequence of 0-value chunks to :: - # - best_start = 0 - best_len = 0 - start = -1 - last_was_zero = False - for i in range(8): - if chunks[i] != "0": - if last_was_zero: - end = i - current_len = end - start - if current_len > best_len: - best_start = start - best_len = current_len - last_was_zero = False - elif not last_was_zero: - start = i - last_was_zero = True - if last_was_zero: - end = 8 - current_len = end - start - if current_len > best_len: - best_start = start - best_len = current_len - if best_len > 1: - if best_start == 0 and (best_len == 6 or best_len == 5 and chunks[5] == "ffff"): - # We have an embedded IPv4 address - if best_len == 6: - prefix = "::" - else: - prefix = "::ffff:" - thex = prefix + dns.ipv4.inet_ntoa(address[12:]) - else: - thex = ( - ":".join(chunks[:best_start]) - + "::" - + ":".join(chunks[best_start + best_len :]) - ) - else: - thex = ":".join(chunks) - return thex - - -_v4_ending = re.compile(rb"(.*):(\d+\.\d+\.\d+\.\d+)$") -_colon_colon_start = re.compile(rb"::.*") -_colon_colon_end = re.compile(rb".*::$") - - -def inet_aton(text: Union[str, bytes], ignore_scope: bool = False) -> bytes: - """Convert an IPv6 address in text form to binary form. - - *text*, a ``str`` or ``bytes``, the IPv6 address in textual form. - - *ignore_scope*, a ``bool``. If ``True``, a scope will be ignored. - If ``False``, the default, it is an error for a scope to be present. - - Returns a ``bytes``. - """ - - # - # Our aim here is not something fast; we just want something that works. - # - if not isinstance(text, bytes): - btext = text.encode() - else: - btext = text - - if ignore_scope: - parts = btext.split(b"%") - l = len(parts) - if l == 2: - btext = parts[0] - elif l > 2: - raise dns.exception.SyntaxError - - if btext == b"": - raise dns.exception.SyntaxError - elif btext.endswith(b":") and not btext.endswith(b"::"): - raise dns.exception.SyntaxError - elif btext.startswith(b":") and not btext.startswith(b"::"): - raise dns.exception.SyntaxError - elif btext == b"::": - btext = b"0::" - # - # Get rid of the icky dot-quad syntax if we have it. - # - m = _v4_ending.match(btext) - if m is not None: - b = dns.ipv4.inet_aton(m.group(2)) - btext = ( - f"{m.group(1).decode()}:{b[0]:02x}{b[1]:02x}:{b[2]:02x}{b[3]:02x}" - ).encode() - # - # Try to turn '::' into ':'; if no match try to - # turn '::' into ':' - # - m = _colon_colon_start.match(btext) - if m is not None: - btext = btext[1:] - else: - m = _colon_colon_end.match(btext) - if m is not None: - btext = btext[:-1] - # - # Now canonicalize into 8 chunks of 4 hex digits each - # - chunks = btext.split(b":") - l = len(chunks) - if l > 8: - raise dns.exception.SyntaxError - seen_empty = False - canonical: List[bytes] = [] - for c in chunks: - if c == b"": - if seen_empty: - raise dns.exception.SyntaxError - seen_empty = True - for _ in range(0, 8 - l + 1): - canonical.append(b"0000") - else: - lc = len(c) - if lc > 4: - raise dns.exception.SyntaxError - if lc != 4: - c = (b"0" * (4 - lc)) + c - canonical.append(c) - if l < 8 and not seen_empty: - raise dns.exception.SyntaxError - btext = b"".join(canonical) - - # - # Finally we can go to binary. - # - try: - return binascii.unhexlify(btext) - except (binascii.Error, TypeError): - raise dns.exception.SyntaxError - - -_mapped_prefix = b"\x00" * 10 + b"\xff\xff" - - -def is_mapped(address: bytes) -> bool: - """Is the specified address a mapped IPv4 address? - - *address*, a ``bytes`` is an IPv6 address in binary form. - - Returns a ``bool``. - """ - - return address.startswith(_mapped_prefix) - - -def canonicalize(text: Union[str, bytes]) -> str: - """Verify that *address* is a valid text form IPv6 address and return its - canonical text form. Addresses with scopes are rejected. - - *text*, a ``str`` or ``bytes``, the IPv6 address in textual form. - - Raises ``dns.exception.SyntaxError`` if the text is not valid. - """ - return dns.ipv6.inet_ntoa(dns.ipv6.inet_aton(text)) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/message.py b/write-message/venv/lib/python3.10/site-packages/dns/message.py deleted file mode 100644 index e978a0a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/message.py +++ /dev/null @@ -1,1933 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Messages""" - -import contextlib -import enum -import io -import time -from typing import Any, Dict, List, Optional, Tuple, Union, cast - -import dns.edns -import dns.entropy -import dns.enum -import dns.exception -import dns.flags -import dns.name -import dns.opcode -import dns.rcode -import dns.rdata -import dns.rdataclass -import dns.rdatatype -import dns.rdtypes.ANY.OPT -import dns.rdtypes.ANY.TSIG -import dns.renderer -import dns.rrset -import dns.tsig -import dns.ttl -import dns.wire - - -class ShortHeader(dns.exception.FormError): - """The DNS packet passed to from_wire() is too short.""" - - -class TrailingJunk(dns.exception.FormError): - """The DNS packet passed to from_wire() has extra junk at the end of it.""" - - -class UnknownHeaderField(dns.exception.DNSException): - """The header field name was not recognized when converting from text - into a message.""" - - -class BadEDNS(dns.exception.FormError): - """An OPT record occurred somewhere other than - the additional data section.""" - - -class BadTSIG(dns.exception.FormError): - """A TSIG record occurred somewhere other than the end of - the additional data section.""" - - -class UnknownTSIGKey(dns.exception.DNSException): - """A TSIG with an unknown key was received.""" - - -class Truncated(dns.exception.DNSException): - """The truncated flag is set.""" - - supp_kwargs = {"message"} - - # We do this as otherwise mypy complains about unexpected keyword argument - # idna_exception - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - def message(self): - """As much of the message as could be processed. - - Returns a ``dns.message.Message``. - """ - return self.kwargs["message"] - - -class NotQueryResponse(dns.exception.DNSException): - """Message is not a response to a query.""" - - -class ChainTooLong(dns.exception.DNSException): - """The CNAME chain is too long.""" - - -class AnswerForNXDOMAIN(dns.exception.DNSException): - """The rcode is NXDOMAIN but an answer was found.""" - - -class NoPreviousName(dns.exception.SyntaxError): - """No previous name was known.""" - - -class MessageSection(dns.enum.IntEnum): - """Message sections""" - - QUESTION = 0 - ANSWER = 1 - AUTHORITY = 2 - ADDITIONAL = 3 - - @classmethod - def _maximum(cls): - return 3 - - -class MessageError: - def __init__(self, exception: Exception, offset: int): - self.exception = exception - self.offset = offset - - -DEFAULT_EDNS_PAYLOAD = 1232 -MAX_CHAIN = 16 - -IndexKeyType = Tuple[ - int, - dns.name.Name, - dns.rdataclass.RdataClass, - dns.rdatatype.RdataType, - Optional[dns.rdatatype.RdataType], - Optional[dns.rdataclass.RdataClass], -] -IndexType = Dict[IndexKeyType, dns.rrset.RRset] -SectionType = Union[int, str, List[dns.rrset.RRset]] - - -class Message: - """A DNS message.""" - - _section_enum = MessageSection - - def __init__(self, id: Optional[int] = None): - if id is None: - self.id = dns.entropy.random_16() - else: - self.id = id - self.flags = 0 - self.sections: List[List[dns.rrset.RRset]] = [[], [], [], []] - self.opt: Optional[dns.rrset.RRset] = None - self.request_payload = 0 - self.pad = 0 - self.keyring: Any = None - self.tsig: Optional[dns.rrset.RRset] = None - self.request_mac = b"" - self.xfr = False - self.origin: Optional[dns.name.Name] = None - self.tsig_ctx: Optional[Any] = None - self.index: IndexType = {} - self.errors: List[MessageError] = [] - self.time = 0.0 - self.wire: Optional[bytes] = None - - @property - def question(self) -> List[dns.rrset.RRset]: - """The question section.""" - return self.sections[0] - - @question.setter - def question(self, v): - self.sections[0] = v - - @property - def answer(self) -> List[dns.rrset.RRset]: - """The answer section.""" - return self.sections[1] - - @answer.setter - def answer(self, v): - self.sections[1] = v - - @property - def authority(self) -> List[dns.rrset.RRset]: - """The authority section.""" - return self.sections[2] - - @authority.setter - def authority(self, v): - self.sections[2] = v - - @property - def additional(self) -> List[dns.rrset.RRset]: - """The additional data section.""" - return self.sections[3] - - @additional.setter - def additional(self, v): - self.sections[3] = v - - def __repr__(self): - return "" - - def __str__(self): - return self.to_text() - - def to_text( - self, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - **kw: Dict[str, Any], - ) -> str: - """Convert the message to text. - - The *origin*, *relativize*, and any other keyword - arguments are passed to the RRset ``to_wire()`` method. - - Returns a ``str``. - """ - - s = io.StringIO() - s.write("id %d\n" % self.id) - s.write(f"opcode {dns.opcode.to_text(self.opcode())}\n") - s.write(f"rcode {dns.rcode.to_text(self.rcode())}\n") - s.write(f"flags {dns.flags.to_text(self.flags)}\n") - if self.edns >= 0: - s.write(f"edns {self.edns}\n") - if self.ednsflags != 0: - s.write(f"eflags {dns.flags.edns_to_text(self.ednsflags)}\n") - s.write("payload %d\n" % self.payload) - for opt in self.options: - s.write(f"option {opt.to_text()}\n") - for name, which in self._section_enum.__members__.items(): - s.write(f";{name}\n") - for rrset in self.section_from_number(which): - s.write(rrset.to_text(origin, relativize, **kw)) - s.write("\n") - # - # We strip off the final \n so the caller can print the result without - # doing weird things to get around eccentricities in Python print - # formatting - # - return s.getvalue()[:-1] - - def __eq__(self, other): - """Two messages are equal if they have the same content in the - header, question, answer, and authority sections. - - Returns a ``bool``. - """ - - if not isinstance(other, Message): - return False - if self.id != other.id: - return False - if self.flags != other.flags: - return False - for i, section in enumerate(self.sections): - other_section = other.sections[i] - for n in section: - if n not in other_section: - return False - for n in other_section: - if n not in section: - return False - return True - - def __ne__(self, other): - return not self.__eq__(other) - - def is_response(self, other: "Message") -> bool: - """Is *other*, also a ``dns.message.Message``, a response to this - message? - - Returns a ``bool``. - """ - - if ( - other.flags & dns.flags.QR == 0 - or self.id != other.id - or dns.opcode.from_flags(self.flags) != dns.opcode.from_flags(other.flags) - ): - return False - if other.rcode() in { - dns.rcode.FORMERR, - dns.rcode.SERVFAIL, - dns.rcode.NOTIMP, - dns.rcode.REFUSED, - }: - # We don't check the question section in these cases if - # the other question section is empty, even though they - # still really ought to have a question section. - if len(other.question) == 0: - return True - if dns.opcode.is_update(self.flags): - # This is assuming the "sender doesn't include anything - # from the update", but we don't care to check the other - # case, which is that all the sections are returned and - # identical. - return True - for n in self.question: - if n not in other.question: - return False - for n in other.question: - if n not in self.question: - return False - return True - - def section_number(self, section: List[dns.rrset.RRset]) -> int: - """Return the "section number" of the specified section for use - in indexing. - - *section* is one of the section attributes of this message. - - Raises ``ValueError`` if the section isn't known. - - Returns an ``int``. - """ - - for i, our_section in enumerate(self.sections): - if section is our_section: - return self._section_enum(i) - raise ValueError("unknown section") - - def section_from_number(self, number: int) -> List[dns.rrset.RRset]: - """Return the section list associated with the specified section - number. - - *number* is a section number `int` or the text form of a section - name. - - Raises ``ValueError`` if the section isn't known. - - Returns a ``list``. - """ - - section = self._section_enum.make(number) - return self.sections[section] - - def find_rrset( - self, - section: SectionType, - name: dns.name.Name, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - deleting: Optional[dns.rdataclass.RdataClass] = None, - create: bool = False, - force_unique: bool = False, - idna_codec: Optional[dns.name.IDNACodec] = None, - ) -> dns.rrset.RRset: - """Find the RRset with the given attributes in the specified section. - - *section*, an ``int`` section number, a ``str`` section name, or one of - the section attributes of this message. This specifies the - the section of the message to search. For example:: - - my_message.find_rrset(my_message.answer, name, rdclass, rdtype) - my_message.find_rrset(dns.message.ANSWER, name, rdclass, rdtype) - my_message.find_rrset("ANSWER", name, rdclass, rdtype) - - *name*, a ``dns.name.Name`` or ``str``, the name of the RRset. - - *rdclass*, an ``int`` or ``str``, the class of the RRset. - - *rdtype*, an ``int`` or ``str``, the type of the RRset. - - *covers*, an ``int`` or ``str``, the covers value of the RRset. - The default is ``dns.rdatatype.NONE``. - - *deleting*, an ``int``, ``str``, or ``None``, the deleting value of the - RRset. The default is ``None``. - - *create*, a ``bool``. If ``True``, create the RRset if it is not found. - The created RRset is appended to *section*. - - *force_unique*, a ``bool``. If ``True`` and *create* is also ``True``, - create a new RRset regardless of whether a matching RRset exists - already. The default is ``False``. This is useful when creating - DDNS Update messages, as order matters for them. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - Raises ``KeyError`` if the RRset was not found and create was - ``False``. - - Returns a ``dns.rrset.RRset object``. - """ - - if isinstance(section, int): - section_number = section - section = self.section_from_number(section_number) - elif isinstance(section, str): - section_number = self._section_enum.from_text(section) - section = self.section_from_number(section_number) - else: - section_number = self.section_number(section) - if isinstance(name, str): - name = dns.name.from_text(name, idna_codec=idna_codec) - rdtype = dns.rdatatype.RdataType.make(rdtype) - rdclass = dns.rdataclass.RdataClass.make(rdclass) - covers = dns.rdatatype.RdataType.make(covers) - if deleting is not None: - deleting = dns.rdataclass.RdataClass.make(deleting) - key = (section_number, name, rdclass, rdtype, covers, deleting) - if not force_unique: - if self.index is not None: - rrset = self.index.get(key) - if rrset is not None: - return rrset - else: - for rrset in section: - if rrset.full_match(name, rdclass, rdtype, covers, deleting): - return rrset - if not create: - raise KeyError - rrset = dns.rrset.RRset(name, rdclass, rdtype, covers, deleting) - section.append(rrset) - if self.index is not None: - self.index[key] = rrset - return rrset - - def get_rrset( - self, - section: SectionType, - name: dns.name.Name, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - deleting: Optional[dns.rdataclass.RdataClass] = None, - create: bool = False, - force_unique: bool = False, - idna_codec: Optional[dns.name.IDNACodec] = None, - ) -> Optional[dns.rrset.RRset]: - """Get the RRset with the given attributes in the specified section. - - If the RRset is not found, None is returned. - - *section*, an ``int`` section number, a ``str`` section name, or one of - the section attributes of this message. This specifies the - the section of the message to search. For example:: - - my_message.get_rrset(my_message.answer, name, rdclass, rdtype) - my_message.get_rrset(dns.message.ANSWER, name, rdclass, rdtype) - my_message.get_rrset("ANSWER", name, rdclass, rdtype) - - *name*, a ``dns.name.Name`` or ``str``, the name of the RRset. - - *rdclass*, an ``int`` or ``str``, the class of the RRset. - - *rdtype*, an ``int`` or ``str``, the type of the RRset. - - *covers*, an ``int`` or ``str``, the covers value of the RRset. - The default is ``dns.rdatatype.NONE``. - - *deleting*, an ``int``, ``str``, or ``None``, the deleting value of the - RRset. The default is ``None``. - - *create*, a ``bool``. If ``True``, create the RRset if it is not found. - The created RRset is appended to *section*. - - *force_unique*, a ``bool``. If ``True`` and *create* is also ``True``, - create a new RRset regardless of whether a matching RRset exists - already. The default is ``False``. This is useful when creating - DDNS Update messages, as order matters for them. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - Returns a ``dns.rrset.RRset object`` or ``None``. - """ - - try: - rrset = self.find_rrset( - section, - name, - rdclass, - rdtype, - covers, - deleting, - create, - force_unique, - idna_codec, - ) - except KeyError: - rrset = None - return rrset - - def section_count(self, section: SectionType) -> int: - """Returns the number of records in the specified section. - - *section*, an ``int`` section number, a ``str`` section name, or one of - the section attributes of this message. This specifies the - the section of the message to count. For example:: - - my_message.section_count(my_message.answer) - my_message.section_count(dns.message.ANSWER) - my_message.section_count("ANSWER") - """ - - if isinstance(section, int): - section_number = section - section = self.section_from_number(section_number) - elif isinstance(section, str): - section_number = self._section_enum.from_text(section) - section = self.section_from_number(section_number) - else: - section_number = self.section_number(section) - count = sum(max(1, len(rrs)) for rrs in section) - if section_number == MessageSection.ADDITIONAL: - if self.opt is not None: - count += 1 - if self.tsig is not None: - count += 1 - return count - - def _compute_opt_reserve(self) -> int: - """Compute the size required for the OPT RR, padding excluded""" - if not self.opt: - return 0 - # 1 byte for the root name, 10 for the standard RR fields - size = 11 - # This would be more efficient if options had a size() method, but we won't - # worry about that for now. We also don't worry if there is an existing padding - # option, as it is unlikely and probably harmless, as the worst case is that we - # may add another, and this seems to be legal. - for option in self.opt[0].options: - wire = option.to_wire() - # We add 4 here to account for the option type and length - size += len(wire) + 4 - if self.pad: - # Padding will be added, so again add the option type and length. - size += 4 - return size - - def _compute_tsig_reserve(self) -> int: - """Compute the size required for the TSIG RR""" - # This would be more efficient if TSIGs had a size method, but we won't - # worry about for now. Also, we can't really cope with the potential - # compressibility of the TSIG owner name, so we estimate with the uncompressed - # size. We will disable compression when TSIG and padding are both is active - # so that the padding comes out right. - if not self.tsig: - return 0 - f = io.BytesIO() - self.tsig.to_wire(f) - return len(f.getvalue()) - - def to_wire( - self, - origin: Optional[dns.name.Name] = None, - max_size: int = 0, - multi: bool = False, - tsig_ctx: Optional[Any] = None, - prepend_length: bool = False, - prefer_truncation: bool = False, - **kw: Dict[str, Any], - ) -> bytes: - """Return a string containing the message in DNS compressed wire - format. - - Additional keyword arguments are passed to the RRset ``to_wire()`` - method. - - *origin*, a ``dns.name.Name`` or ``None``, the origin to be appended - to any relative names. If ``None``, and the message has an origin - attribute that is not ``None``, then it will be used. - - *max_size*, an ``int``, the maximum size of the wire format - output; default is 0, which means "the message's request - payload, if nonzero, or 65535". - - *multi*, a ``bool``, should be set to ``True`` if this message is - part of a multiple message sequence. - - *tsig_ctx*, a ``dns.tsig.HMACTSig`` or ``dns.tsig.GSSTSig`` object, the - ongoing TSIG context, used when signing zone transfers. - - *prepend_length*, a ``bool``, should be set to ``True`` if the caller - wants the message length prepended to the message itself. This is - useful for messages sent over TCP, TLS (DoT), or QUIC (DoQ). - - *prefer_truncation*, a ``bool``, should be set to ``True`` if the caller - wants the message to be truncated if it would otherwise exceed the - maximum length. If the truncation occurs before the additional section, - the TC bit will be set. - - Raises ``dns.exception.TooBig`` if *max_size* was exceeded. - - Returns a ``bytes``. - """ - - if origin is None and self.origin is not None: - origin = self.origin - if max_size == 0: - if self.request_payload != 0: - max_size = self.request_payload - else: - max_size = 65535 - if max_size < 512: - max_size = 512 - elif max_size > 65535: - max_size = 65535 - r = dns.renderer.Renderer(self.id, self.flags, max_size, origin) - opt_reserve = self._compute_opt_reserve() - r.reserve(opt_reserve) - tsig_reserve = self._compute_tsig_reserve() - r.reserve(tsig_reserve) - try: - for rrset in self.question: - r.add_question(rrset.name, rrset.rdtype, rrset.rdclass) - for rrset in self.answer: - r.add_rrset(dns.renderer.ANSWER, rrset, **kw) - for rrset in self.authority: - r.add_rrset(dns.renderer.AUTHORITY, rrset, **kw) - for rrset in self.additional: - r.add_rrset(dns.renderer.ADDITIONAL, rrset, **kw) - except dns.exception.TooBig: - if prefer_truncation: - if r.section < dns.renderer.ADDITIONAL: - r.flags |= dns.flags.TC - else: - raise - r.release_reserved() - if self.opt is not None: - r.add_opt(self.opt, self.pad, opt_reserve, tsig_reserve) - r.write_header() - if self.tsig is not None: - (new_tsig, ctx) = dns.tsig.sign( - r.get_wire(), - self.keyring, - self.tsig[0], - int(time.time()), - self.request_mac, - tsig_ctx, - multi, - ) - self.tsig.clear() - self.tsig.add(new_tsig) - r.add_rrset(dns.renderer.ADDITIONAL, self.tsig) - r.write_header() - if multi: - self.tsig_ctx = ctx - wire = r.get_wire() - self.wire = wire - if prepend_length: - wire = len(wire).to_bytes(2, "big") + wire - return wire - - @staticmethod - def _make_tsig( - keyname, algorithm, time_signed, fudge, mac, original_id, error, other - ): - tsig = dns.rdtypes.ANY.TSIG.TSIG( - dns.rdataclass.ANY, - dns.rdatatype.TSIG, - algorithm, - time_signed, - fudge, - mac, - original_id, - error, - other, - ) - return dns.rrset.from_rdata(keyname, 0, tsig) - - def use_tsig( - self, - keyring: Any, - keyname: Optional[Union[dns.name.Name, str]] = None, - fudge: int = 300, - original_id: Optional[int] = None, - tsig_error: int = 0, - other_data: bytes = b"", - algorithm: Union[dns.name.Name, str] = dns.tsig.default_algorithm, - ) -> None: - """When sending, a TSIG signature using the specified key - should be added. - - *key*, a ``dns.tsig.Key`` is the key to use. If a key is specified, - the *keyring* and *algorithm* fields are not used. - - *keyring*, a ``dict``, ``callable`` or ``dns.tsig.Key``, is either - the TSIG keyring or key to use. - - The format of a keyring dict is a mapping from TSIG key name, as - ``dns.name.Name`` to ``dns.tsig.Key`` or a TSIG secret, a ``bytes``. - If a ``dict`` *keyring* is specified but a *keyname* is not, the key - used will be the first key in the *keyring*. Note that the order of - keys in a dictionary is not defined, so applications should supply a - keyname when a ``dict`` keyring is used, unless they know the keyring - contains only one key. If a ``callable`` keyring is specified, the - callable will be called with the message and the keyname, and is - expected to return a key. - - *keyname*, a ``dns.name.Name``, ``str`` or ``None``, the name of - this TSIG key to use; defaults to ``None``. If *keyring* is a - ``dict``, the key must be defined in it. If *keyring* is a - ``dns.tsig.Key``, this is ignored. - - *fudge*, an ``int``, the TSIG time fudge. - - *original_id*, an ``int``, the TSIG original id. If ``None``, - the message's id is used. - - *tsig_error*, an ``int``, the TSIG error code. - - *other_data*, a ``bytes``, the TSIG other data. - - *algorithm*, a ``dns.name.Name`` or ``str``, the TSIG algorithm to use. This is - only used if *keyring* is a ``dict``, and the key entry is a ``bytes``. - """ - - if isinstance(keyring, dns.tsig.Key): - key = keyring - keyname = key.name - elif callable(keyring): - key = keyring(self, keyname) - else: - if isinstance(keyname, str): - keyname = dns.name.from_text(keyname) - if keyname is None: - keyname = next(iter(keyring)) - key = keyring[keyname] - if isinstance(key, bytes): - key = dns.tsig.Key(keyname, key, algorithm) - self.keyring = key - if original_id is None: - original_id = self.id - self.tsig = self._make_tsig( - keyname, - self.keyring.algorithm, - 0, - fudge, - b"\x00" * dns.tsig.mac_sizes[self.keyring.algorithm], - original_id, - tsig_error, - other_data, - ) - - @property - def keyname(self) -> Optional[dns.name.Name]: - if self.tsig: - return self.tsig.name - else: - return None - - @property - def keyalgorithm(self) -> Optional[dns.name.Name]: - if self.tsig: - return self.tsig[0].algorithm - else: - return None - - @property - def mac(self) -> Optional[bytes]: - if self.tsig: - return self.tsig[0].mac - else: - return None - - @property - def tsig_error(self) -> Optional[int]: - if self.tsig: - return self.tsig[0].error - else: - return None - - @property - def had_tsig(self) -> bool: - return bool(self.tsig) - - @staticmethod - def _make_opt(flags=0, payload=DEFAULT_EDNS_PAYLOAD, options=None): - opt = dns.rdtypes.ANY.OPT.OPT(payload, dns.rdatatype.OPT, options or ()) - return dns.rrset.from_rdata(dns.name.root, int(flags), opt) - - def use_edns( - self, - edns: Optional[Union[int, bool]] = 0, - ednsflags: int = 0, - payload: int = DEFAULT_EDNS_PAYLOAD, - request_payload: Optional[int] = None, - options: Optional[List[dns.edns.Option]] = None, - pad: int = 0, - ) -> None: - """Configure EDNS behavior. - - *edns*, an ``int``, is the EDNS level to use. Specifying ``None``, ``False``, - or ``-1`` means "do not use EDNS", and in this case the other parameters are - ignored. Specifying ``True`` is equivalent to specifying 0, i.e. "use EDNS0". - - *ednsflags*, an ``int``, the EDNS flag values. - - *payload*, an ``int``, is the EDNS sender's payload field, which is the maximum - size of UDP datagram the sender can handle. I.e. how big a response to this - message can be. - - *request_payload*, an ``int``, is the EDNS payload size to use when sending this - message. If not specified, defaults to the value of *payload*. - - *options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS options. - - *pad*, a non-negative ``int``. If 0, the default, do not pad; otherwise add - padding bytes to make the message size a multiple of *pad*. Note that if - padding is non-zero, an EDNS PADDING option will always be added to the - message. - """ - - if edns is None or edns is False: - edns = -1 - elif edns is True: - edns = 0 - if edns < 0: - self.opt = None - self.request_payload = 0 - else: - # make sure the EDNS version in ednsflags agrees with edns - ednsflags &= 0xFF00FFFF - ednsflags |= edns << 16 - if options is None: - options = [] - self.opt = self._make_opt(ednsflags, payload, options) - if request_payload is None: - request_payload = payload - self.request_payload = request_payload - if pad < 0: - raise ValueError("pad must be non-negative") - self.pad = pad - - @property - def edns(self) -> int: - if self.opt: - return (self.ednsflags & 0xFF0000) >> 16 - else: - return -1 - - @property - def ednsflags(self) -> int: - if self.opt: - return self.opt.ttl - else: - return 0 - - @ednsflags.setter - def ednsflags(self, v): - if self.opt: - self.opt.ttl = v - elif v: - self.opt = self._make_opt(v) - - @property - def payload(self) -> int: - if self.opt: - return self.opt[0].payload - else: - return 0 - - @property - def options(self) -> Tuple: - if self.opt: - return self.opt[0].options - else: - return () - - def want_dnssec(self, wanted: bool = True) -> None: - """Enable or disable 'DNSSEC desired' flag in requests. - - *wanted*, a ``bool``. If ``True``, then DNSSEC data is - desired in the response, EDNS is enabled if required, and then - the DO bit is set. If ``False``, the DO bit is cleared if - EDNS is enabled. - """ - - if wanted: - self.ednsflags |= dns.flags.DO - elif self.opt: - self.ednsflags &= ~int(dns.flags.DO) - - def rcode(self) -> dns.rcode.Rcode: - """Return the rcode. - - Returns a ``dns.rcode.Rcode``. - """ - return dns.rcode.from_flags(int(self.flags), int(self.ednsflags)) - - def set_rcode(self, rcode: dns.rcode.Rcode) -> None: - """Set the rcode. - - *rcode*, a ``dns.rcode.Rcode``, is the rcode to set. - """ - (value, evalue) = dns.rcode.to_flags(rcode) - self.flags &= 0xFFF0 - self.flags |= value - self.ednsflags &= 0x00FFFFFF - self.ednsflags |= evalue - - def opcode(self) -> dns.opcode.Opcode: - """Return the opcode. - - Returns a ``dns.opcode.Opcode``. - """ - return dns.opcode.from_flags(int(self.flags)) - - def set_opcode(self, opcode: dns.opcode.Opcode) -> None: - """Set the opcode. - - *opcode*, a ``dns.opcode.Opcode``, is the opcode to set. - """ - self.flags &= 0x87FF - self.flags |= dns.opcode.to_flags(opcode) - - def get_options(self, otype: dns.edns.OptionType) -> List[dns.edns.Option]: - """Return the list of options of the specified type.""" - return [option for option in self.options if option.otype == otype] - - def extended_errors(self) -> List[dns.edns.EDEOption]: - """Return the list of Extended DNS Error (EDE) options in the message""" - return cast(List[dns.edns.EDEOption], self.get_options(dns.edns.OptionType.EDE)) - - def _get_one_rr_per_rrset(self, value): - # What the caller picked is fine. - return value - - # pylint: disable=unused-argument - - def _parse_rr_header(self, section, name, rdclass, rdtype): - return (rdclass, rdtype, None, False) - - # pylint: enable=unused-argument - - def _parse_special_rr_header(self, section, count, position, name, rdclass, rdtype): - if rdtype == dns.rdatatype.OPT: - if ( - section != MessageSection.ADDITIONAL - or self.opt - or name != dns.name.root - ): - raise BadEDNS - elif rdtype == dns.rdatatype.TSIG: - if ( - section != MessageSection.ADDITIONAL - or rdclass != dns.rdatatype.ANY - or position != count - 1 - ): - raise BadTSIG - return (rdclass, rdtype, None, False) - - -class ChainingResult: - """The result of a call to dns.message.QueryMessage.resolve_chaining(). - - The ``answer`` attribute is the answer RRSet, or ``None`` if it doesn't - exist. - - The ``canonical_name`` attribute is the canonical name after all - chaining has been applied (this is the same name as ``rrset.name`` in cases - where rrset is not ``None``). - - The ``minimum_ttl`` attribute is the minimum TTL, i.e. the TTL to - use if caching the data. It is the smallest of all the CNAME TTLs - and either the answer TTL if it exists or the SOA TTL and SOA - minimum values for negative answers. - - The ``cnames`` attribute is a list of all the CNAME RRSets followed to - get to the canonical name. - """ - - def __init__( - self, - canonical_name: dns.name.Name, - answer: Optional[dns.rrset.RRset], - minimum_ttl: int, - cnames: List[dns.rrset.RRset], - ): - self.canonical_name = canonical_name - self.answer = answer - self.minimum_ttl = minimum_ttl - self.cnames = cnames - - -class QueryMessage(Message): - def resolve_chaining(self) -> ChainingResult: - """Follow the CNAME chain in the response to determine the answer - RRset. - - Raises ``dns.message.NotQueryResponse`` if the message is not - a response. - - Raises ``dns.message.ChainTooLong`` if the CNAME chain is too long. - - Raises ``dns.message.AnswerForNXDOMAIN`` if the rcode is NXDOMAIN - but an answer was found. - - Raises ``dns.exception.FormError`` if the question count is not 1. - - Returns a ChainingResult object. - """ - if self.flags & dns.flags.QR == 0: - raise NotQueryResponse - if len(self.question) != 1: - raise dns.exception.FormError - question = self.question[0] - qname = question.name - min_ttl = dns.ttl.MAX_TTL - answer = None - count = 0 - cnames = [] - while count < MAX_CHAIN: - try: - answer = self.find_rrset( - self.answer, qname, question.rdclass, question.rdtype - ) - min_ttl = min(min_ttl, answer.ttl) - break - except KeyError: - if question.rdtype != dns.rdatatype.CNAME: - try: - crrset = self.find_rrset( - self.answer, qname, question.rdclass, dns.rdatatype.CNAME - ) - cnames.append(crrset) - min_ttl = min(min_ttl, crrset.ttl) - for rd in crrset: - qname = rd.target - break - count += 1 - continue - except KeyError: - # Exit the chaining loop - break - else: - # Exit the chaining loop - break - if count >= MAX_CHAIN: - raise ChainTooLong - if self.rcode() == dns.rcode.NXDOMAIN and answer is not None: - raise AnswerForNXDOMAIN - if answer is None: - # Further minimize the TTL with NCACHE. - auname = qname - while True: - # Look for an SOA RR whose owner name is a superdomain - # of qname. - try: - srrset = self.find_rrset( - self.authority, auname, question.rdclass, dns.rdatatype.SOA - ) - min_ttl = min(min_ttl, srrset.ttl, srrset[0].minimum) - break - except KeyError: - try: - auname = auname.parent() - except dns.name.NoParent: - break - return ChainingResult(qname, answer, min_ttl, cnames) - - def canonical_name(self) -> dns.name.Name: - """Return the canonical name of the first name in the question - section. - - Raises ``dns.message.NotQueryResponse`` if the message is not - a response. - - Raises ``dns.message.ChainTooLong`` if the CNAME chain is too long. - - Raises ``dns.message.AnswerForNXDOMAIN`` if the rcode is NXDOMAIN - but an answer was found. - - Raises ``dns.exception.FormError`` if the question count is not 1. - """ - return self.resolve_chaining().canonical_name - - -def _maybe_import_update(): - # We avoid circular imports by doing this here. We do it in another - # function as doing it in _message_factory_from_opcode() makes "dns" - # a local symbol, and the first line fails :) - - # pylint: disable=redefined-outer-name,import-outside-toplevel,unused-import - import dns.update # noqa: F401 - - -def _message_factory_from_opcode(opcode): - if opcode == dns.opcode.QUERY: - return QueryMessage - elif opcode == dns.opcode.UPDATE: - _maybe_import_update() - return dns.update.UpdateMessage - else: - return Message - - -class _WireReader: - """Wire format reader. - - parser: the binary parser - message: The message object being built - initialize_message: Callback to set message parsing options - question_only: Are we only reading the question? - one_rr_per_rrset: Put each RR into its own RRset? - keyring: TSIG keyring - ignore_trailing: Ignore trailing junk at end of request? - multi: Is this message part of a multi-message sequence? - DNS dynamic updates. - continue_on_error: try to extract as much information as possible from - the message, accumulating MessageErrors in the *errors* attribute instead of - raising them. - """ - - def __init__( - self, - wire, - initialize_message, - question_only=False, - one_rr_per_rrset=False, - ignore_trailing=False, - keyring=None, - multi=False, - continue_on_error=False, - ): - self.parser = dns.wire.Parser(wire) - self.message = None - self.initialize_message = initialize_message - self.question_only = question_only - self.one_rr_per_rrset = one_rr_per_rrset - self.ignore_trailing = ignore_trailing - self.keyring = keyring - self.multi = multi - self.continue_on_error = continue_on_error - self.errors = [] - - def _get_question(self, section_number, qcount): - """Read the next *qcount* records from the wire data and add them to - the question section. - """ - assert self.message is not None - section = self.message.sections[section_number] - for _ in range(qcount): - qname = self.parser.get_name(self.message.origin) - (rdtype, rdclass) = self.parser.get_struct("!HH") - (rdclass, rdtype, _, _) = self.message._parse_rr_header( - section_number, qname, rdclass, rdtype - ) - self.message.find_rrset( - section, qname, rdclass, rdtype, create=True, force_unique=True - ) - - def _add_error(self, e): - self.errors.append(MessageError(e, self.parser.current)) - - def _get_section(self, section_number, count): - """Read the next I{count} records from the wire data and add them to - the specified section. - - section_number: the section of the message to which to add records - count: the number of records to read - """ - assert self.message is not None - section = self.message.sections[section_number] - force_unique = self.one_rr_per_rrset - for i in range(count): - rr_start = self.parser.current - absolute_name = self.parser.get_name() - if self.message.origin is not None: - name = absolute_name.relativize(self.message.origin) - else: - name = absolute_name - (rdtype, rdclass, ttl, rdlen) = self.parser.get_struct("!HHIH") - if rdtype in (dns.rdatatype.OPT, dns.rdatatype.TSIG): - ( - rdclass, - rdtype, - deleting, - empty, - ) = self.message._parse_special_rr_header( - section_number, count, i, name, rdclass, rdtype - ) - else: - (rdclass, rdtype, deleting, empty) = self.message._parse_rr_header( - section_number, name, rdclass, rdtype - ) - rdata_start = self.parser.current - try: - if empty: - if rdlen > 0: - raise dns.exception.FormError - rd = None - covers = dns.rdatatype.NONE - else: - with self.parser.restrict_to(rdlen): - rd = dns.rdata.from_wire_parser( - rdclass, rdtype, self.parser, self.message.origin - ) - covers = rd.covers() - if self.message.xfr and rdtype == dns.rdatatype.SOA: - force_unique = True - if rdtype == dns.rdatatype.OPT: - self.message.opt = dns.rrset.from_rdata(name, ttl, rd) - elif rdtype == dns.rdatatype.TSIG: - if self.keyring is None or self.keyring is True: - raise UnknownTSIGKey("got signed message without keyring") - elif isinstance(self.keyring, dict): - key = self.keyring.get(absolute_name) - if isinstance(key, bytes): - key = dns.tsig.Key(absolute_name, key, rd.algorithm) - elif callable(self.keyring): - key = self.keyring(self.message, absolute_name) - else: - key = self.keyring - if key is None: - raise UnknownTSIGKey(f"key '{name}' unknown") - if key: - self.message.keyring = key - self.message.tsig_ctx = dns.tsig.validate( - self.parser.wire, - key, - absolute_name, - rd, - int(time.time()), - self.message.request_mac, - rr_start, - self.message.tsig_ctx, - self.multi, - ) - self.message.tsig = dns.rrset.from_rdata(absolute_name, 0, rd) - else: - rrset = self.message.find_rrset( - section, - name, - rdclass, - rdtype, - covers, - deleting, - True, - force_unique, - ) - if rd is not None: - if ttl > 0x7FFFFFFF: - ttl = 0 - rrset.add(rd, ttl) - except Exception as e: - if self.continue_on_error: - self._add_error(e) - self.parser.seek(rdata_start + rdlen) - else: - raise - - def read(self): - """Read a wire format DNS message and build a dns.message.Message - object.""" - - if self.parser.remaining() < 12: - raise ShortHeader - (id, flags, qcount, ancount, aucount, adcount) = self.parser.get_struct( - "!HHHHHH" - ) - factory = _message_factory_from_opcode(dns.opcode.from_flags(flags)) - self.message = factory(id=id) - self.message.flags = dns.flags.Flag(flags) - self.message.wire = self.parser.wire - self.initialize_message(self.message) - self.one_rr_per_rrset = self.message._get_one_rr_per_rrset( - self.one_rr_per_rrset - ) - try: - self._get_question(MessageSection.QUESTION, qcount) - if self.question_only: - return self.message - self._get_section(MessageSection.ANSWER, ancount) - self._get_section(MessageSection.AUTHORITY, aucount) - self._get_section(MessageSection.ADDITIONAL, adcount) - if not self.ignore_trailing and self.parser.remaining() != 0: - raise TrailingJunk - if self.multi and self.message.tsig_ctx and not self.message.had_tsig: - self.message.tsig_ctx.update(self.parser.wire) - except Exception as e: - if self.continue_on_error: - self._add_error(e) - else: - raise - return self.message - - -def from_wire( - wire: bytes, - keyring: Optional[Any] = None, - request_mac: Optional[bytes] = b"", - xfr: bool = False, - origin: Optional[dns.name.Name] = None, - tsig_ctx: Optional[Union[dns.tsig.HMACTSig, dns.tsig.GSSTSig]] = None, - multi: bool = False, - question_only: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - raise_on_truncation: bool = False, - continue_on_error: bool = False, -) -> Message: - """Convert a DNS wire format message into a message object. - - *keyring*, a ``dns.tsig.Key``, ``dict``, ``bool``, or ``None``, the key or keyring - to use if the message is signed. If ``None`` or ``True``, then trying to decode - a message with a TSIG will fail as it cannot be validated. If ``False``, then - TSIG validation is disabled. - - *request_mac*, a ``bytes`` or ``None``. If the message is a response to a - TSIG-signed request, *request_mac* should be set to the MAC of that request. - - *xfr*, a ``bool``, should be set to ``True`` if this message is part of a zone - transfer. - - *origin*, a ``dns.name.Name`` or ``None``. If the message is part of a zone - transfer, *origin* should be the origin name of the zone. If not ``None``, names - will be relativized to the origin. - - *tsig_ctx*, a ``dns.tsig.HMACTSig`` or ``dns.tsig.GSSTSig`` object, the ongoing TSIG - context, used when validating zone transfers. - - *multi*, a ``bool``, should be set to ``True`` if this message is part of a multiple - message sequence. - - *question_only*, a ``bool``. If ``True``, read only up to the end of the question - section. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own RRset. - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing junk at end of the - message. - - *raise_on_truncation*, a ``bool``. If ``True``, raise an exception if the TC bit is - set. - - *continue_on_error*, a ``bool``. If ``True``, try to continue parsing even if - errors occur. Erroneous rdata will be ignored. Errors will be accumulated as a - list of MessageError objects in the message's ``errors`` attribute. This option is - recommended only for DNS analysis tools, or for use in a server as part of an error - handling path. The default is ``False``. - - Raises ``dns.message.ShortHeader`` if the message is less than 12 octets long. - - Raises ``dns.message.TrailingJunk`` if there were octets in the message past the end - of the proper DNS message, and *ignore_trailing* is ``False``. - - Raises ``dns.message.BadEDNS`` if an OPT record was in the wrong section, or - occurred more than once. - - Raises ``dns.message.BadTSIG`` if a TSIG record was not the last record of the - additional data section. - - Raises ``dns.message.Truncated`` if the TC flag is set and *raise_on_truncation* is - ``True``. - - Returns a ``dns.message.Message``. - """ - - # We permit None for request_mac solely for backwards compatibility - if request_mac is None: - request_mac = b"" - - def initialize_message(message): - message.request_mac = request_mac - message.xfr = xfr - message.origin = origin - message.tsig_ctx = tsig_ctx - - reader = _WireReader( - wire, - initialize_message, - question_only, - one_rr_per_rrset, - ignore_trailing, - keyring, - multi, - continue_on_error, - ) - try: - m = reader.read() - except dns.exception.FormError: - if ( - reader.message - and (reader.message.flags & dns.flags.TC) - and raise_on_truncation - ): - raise Truncated(message=reader.message) - else: - raise - # Reading a truncated message might not have any errors, so we - # have to do this check here too. - if m.flags & dns.flags.TC and raise_on_truncation: - raise Truncated(message=m) - if continue_on_error: - m.errors = reader.errors - - return m - - -class _TextReader: - """Text format reader. - - tok: the tokenizer. - message: The message object being built. - DNS dynamic updates. - last_name: The most recently read name when building a message object. - one_rr_per_rrset: Put each RR into its own RRset? - origin: The origin for relative names - relativize: relativize names? - relativize_to: the origin to relativize to. - """ - - def __init__( - self, - text, - idna_codec, - one_rr_per_rrset=False, - origin=None, - relativize=True, - relativize_to=None, - ): - self.message = None - self.tok = dns.tokenizer.Tokenizer(text, idna_codec=idna_codec) - self.last_name = None - self.one_rr_per_rrset = one_rr_per_rrset - self.origin = origin - self.relativize = relativize - self.relativize_to = relativize_to - self.id = None - self.edns = -1 - self.ednsflags = 0 - self.payload = DEFAULT_EDNS_PAYLOAD - self.rcode = None - self.opcode = dns.opcode.QUERY - self.flags = 0 - - def _header_line(self, _): - """Process one line from the text format header section.""" - - token = self.tok.get() - what = token.value - if what == "id": - self.id = self.tok.get_int() - elif what == "flags": - while True: - token = self.tok.get() - if not token.is_identifier(): - self.tok.unget(token) - break - self.flags = self.flags | dns.flags.from_text(token.value) - elif what == "edns": - self.edns = self.tok.get_int() - self.ednsflags = self.ednsflags | (self.edns << 16) - elif what == "eflags": - if self.edns < 0: - self.edns = 0 - while True: - token = self.tok.get() - if not token.is_identifier(): - self.tok.unget(token) - break - self.ednsflags = self.ednsflags | dns.flags.edns_from_text(token.value) - elif what == "payload": - self.payload = self.tok.get_int() - if self.edns < 0: - self.edns = 0 - elif what == "opcode": - text = self.tok.get_string() - self.opcode = dns.opcode.from_text(text) - self.flags = self.flags | dns.opcode.to_flags(self.opcode) - elif what == "rcode": - text = self.tok.get_string() - self.rcode = dns.rcode.from_text(text) - else: - raise UnknownHeaderField - self.tok.get_eol() - - def _question_line(self, section_number): - """Process one line from the text format question section.""" - - section = self.message.sections[section_number] - token = self.tok.get(want_leading=True) - if not token.is_whitespace(): - self.last_name = self.tok.as_name( - token, self.message.origin, self.relativize, self.relativize_to - ) - name = self.last_name - if name is None: - raise NoPreviousName - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - # Class - try: - rdclass = dns.rdataclass.from_text(token.value) - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except dns.exception.SyntaxError: - raise dns.exception.SyntaxError - except Exception: - rdclass = dns.rdataclass.IN - # Type - rdtype = dns.rdatatype.from_text(token.value) - (rdclass, rdtype, _, _) = self.message._parse_rr_header( - section_number, name, rdclass, rdtype - ) - self.message.find_rrset( - section, name, rdclass, rdtype, create=True, force_unique=True - ) - self.tok.get_eol() - - def _rr_line(self, section_number): - """Process one line from the text format answer, authority, or - additional data sections. - """ - - section = self.message.sections[section_number] - # Name - token = self.tok.get(want_leading=True) - if not token.is_whitespace(): - self.last_name = self.tok.as_name( - token, self.message.origin, self.relativize, self.relativize_to - ) - name = self.last_name - if name is None: - raise NoPreviousName - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - # TTL - try: - ttl = int(token.value, 0) - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except dns.exception.SyntaxError: - raise dns.exception.SyntaxError - except Exception: - ttl = 0 - # Class - try: - rdclass = dns.rdataclass.from_text(token.value) - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except dns.exception.SyntaxError: - raise dns.exception.SyntaxError - except Exception: - rdclass = dns.rdataclass.IN - # Type - rdtype = dns.rdatatype.from_text(token.value) - (rdclass, rdtype, deleting, empty) = self.message._parse_rr_header( - section_number, name, rdclass, rdtype - ) - token = self.tok.get() - if empty and not token.is_eol_or_eof(): - raise dns.exception.SyntaxError - if not empty and token.is_eol_or_eof(): - raise dns.exception.UnexpectedEnd - if not token.is_eol_or_eof(): - self.tok.unget(token) - rd = dns.rdata.from_text( - rdclass, - rdtype, - self.tok, - self.message.origin, - self.relativize, - self.relativize_to, - ) - covers = rd.covers() - else: - rd = None - covers = dns.rdatatype.NONE - rrset = self.message.find_rrset( - section, - name, - rdclass, - rdtype, - covers, - deleting, - True, - self.one_rr_per_rrset, - ) - if rd is not None: - rrset.add(rd, ttl) - - def _make_message(self): - factory = _message_factory_from_opcode(self.opcode) - message = factory(id=self.id) - message.flags = self.flags - if self.edns >= 0: - message.use_edns(self.edns, self.ednsflags, self.payload) - if self.rcode: - message.set_rcode(self.rcode) - if self.origin: - message.origin = self.origin - return message - - def read(self): - """Read a text format DNS message and build a dns.message.Message - object.""" - - line_method = self._header_line - section_number = None - while 1: - token = self.tok.get(True, True) - if token.is_eol_or_eof(): - break - if token.is_comment(): - u = token.value.upper() - if u == "HEADER": - line_method = self._header_line - - if self.message: - message = self.message - else: - # If we don't have a message, create one with the current - # opcode, so that we know which section names to parse. - message = self._make_message() - try: - section_number = message._section_enum.from_text(u) - # We found a section name. If we don't have a message, - # use the one we just created. - if not self.message: - self.message = message - self.one_rr_per_rrset = message._get_one_rr_per_rrset( - self.one_rr_per_rrset - ) - if section_number == MessageSection.QUESTION: - line_method = self._question_line - else: - line_method = self._rr_line - except Exception: - # It's just a comment. - pass - self.tok.get_eol() - continue - self.tok.unget(token) - line_method(section_number) - if not self.message: - self.message = self._make_message() - return self.message - - -def from_text( - text: str, - idna_codec: Optional[dns.name.IDNACodec] = None, - one_rr_per_rrset: bool = False, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - relativize_to: Optional[dns.name.Name] = None, -) -> Message: - """Convert the text format message into a message object. - - The reader stops after reading the first blank line in the input to - facilitate reading multiple messages from a single file with - ``dns.message.from_file()``. - - *text*, a ``str``, the text format message. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - *one_rr_per_rrset*, a ``bool``. If ``True``, then each RR is put - into its own rrset. The default is ``False``. - - *origin*, a ``dns.name.Name`` (or ``None``), the - origin to use for relative names. - - *relativize*, a ``bool``. If true, name will be relativized. - - *relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use - when relativizing names. If not set, the *origin* value will be used. - - Raises ``dns.message.UnknownHeaderField`` if a header is unknown. - - Raises ``dns.exception.SyntaxError`` if the text is badly formed. - - Returns a ``dns.message.Message object`` - """ - - # 'text' can also be a file, but we don't publish that fact - # since it's an implementation detail. The official file - # interface is from_file(). - - reader = _TextReader( - text, idna_codec, one_rr_per_rrset, origin, relativize, relativize_to - ) - return reader.read() - - -def from_file( - f: Any, - idna_codec: Optional[dns.name.IDNACodec] = None, - one_rr_per_rrset: bool = False, -) -> Message: - """Read the next text format message from the specified file. - - Message blocks are separated by a single blank line. - - *f*, a ``file`` or ``str``. If *f* is text, it is treated as the - pathname of a file to open. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - *one_rr_per_rrset*, a ``bool``. If ``True``, then each RR is put - into its own rrset. The default is ``False``. - - Raises ``dns.message.UnknownHeaderField`` if a header is unknown. - - Raises ``dns.exception.SyntaxError`` if the text is badly formed. - - Returns a ``dns.message.Message object`` - """ - - if isinstance(f, str): - cm: contextlib.AbstractContextManager = open(f) - else: - cm = contextlib.nullcontext(f) - with cm as f: - return from_text(f, idna_codec, one_rr_per_rrset) - assert False # for mypy lgtm[py/unreachable-statement] - - -def make_query( - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - use_edns: Optional[Union[int, bool]] = None, - want_dnssec: bool = False, - ednsflags: Optional[int] = None, - payload: Optional[int] = None, - request_payload: Optional[int] = None, - options: Optional[List[dns.edns.Option]] = None, - idna_codec: Optional[dns.name.IDNACodec] = None, - id: Optional[int] = None, - flags: int = dns.flags.RD, - pad: int = 0, -) -> QueryMessage: - """Make a query message. - - The query name, type, and class may all be specified either - as objects of the appropriate type, or as strings. - - The query will have a randomly chosen query id, and its DNS flags - will be set to dns.flags.RD. - - qname, a ``dns.name.Name`` or ``str``, the query name. - - *rdtype*, an ``int`` or ``str``, the desired rdata type. - - *rdclass*, an ``int`` or ``str``, the desired rdata class; the default - is class IN. - - *use_edns*, an ``int``, ``bool`` or ``None``. The EDNS level to use; the - default is ``None``. If ``None``, EDNS will be enabled only if other - parameters (*ednsflags*, *payload*, *request_payload*, or *options*) are - set. - See the description of dns.message.Message.use_edns() for the possible - values for use_edns and their meanings. - - *want_dnssec*, a ``bool``. If ``True``, DNSSEC data is desired. - - *ednsflags*, an ``int``, the EDNS flag values. - - *payload*, an ``int``, is the EDNS sender's payload field, which is the - maximum size of UDP datagram the sender can handle. I.e. how big - a response to this message can be. - - *request_payload*, an ``int``, is the EDNS payload size to use when - sending this message. If not specified, defaults to the value of - *payload*. - - *options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS - options. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - *id*, an ``int`` or ``None``, the desired query id. The default is - ``None``, which generates a random query id. - - *flags*, an ``int``, the desired query flags. The default is - ``dns.flags.RD``. - - *pad*, a non-negative ``int``. If 0, the default, do not pad; otherwise add - padding bytes to make the message size a multiple of *pad*. Note that if - padding is non-zero, an EDNS PADDING option will always be added to the - message. - - Returns a ``dns.message.QueryMessage`` - """ - - if isinstance(qname, str): - qname = dns.name.from_text(qname, idna_codec=idna_codec) - rdtype = dns.rdatatype.RdataType.make(rdtype) - rdclass = dns.rdataclass.RdataClass.make(rdclass) - m = QueryMessage(id=id) - m.flags = dns.flags.Flag(flags) - m.find_rrset(m.question, qname, rdclass, rdtype, create=True, force_unique=True) - # only pass keywords on to use_edns if they have been set to a - # non-None value. Setting a field will turn EDNS on if it hasn't - # been configured. - kwargs: Dict[str, Any] = {} - if ednsflags is not None: - kwargs["ednsflags"] = ednsflags - if payload is not None: - kwargs["payload"] = payload - if request_payload is not None: - kwargs["request_payload"] = request_payload - if options is not None: - kwargs["options"] = options - if kwargs and use_edns is None: - use_edns = 0 - kwargs["edns"] = use_edns - kwargs["pad"] = pad - m.use_edns(**kwargs) - m.want_dnssec(want_dnssec) - return m - - -class CopyMode(enum.Enum): - """ - How should sections be copied when making an update response? - """ - - NOTHING = 0 - QUESTION = 1 - EVERYTHING = 2 - - -def make_response( - query: Message, - recursion_available: bool = False, - our_payload: int = 8192, - fudge: int = 300, - tsig_error: int = 0, - pad: Optional[int] = None, - copy_mode: Optional[CopyMode] = None, -) -> Message: - """Make a message which is a response for the specified query. - The message returned is really a response skeleton; it has all of the infrastructure - required of a response, but none of the content. - - Response section(s) which are copied are shallow copies of the matching section(s) - in the query, so the query's RRsets should not be changed. - - *query*, a ``dns.message.Message``, the query to respond to. - - *recursion_available*, a ``bool``, should RA be set in the response? - - *our_payload*, an ``int``, the payload size to advertise in EDNS responses. - - *fudge*, an ``int``, the TSIG time fudge. - - *tsig_error*, an ``int``, the TSIG error. - - *pad*, a non-negative ``int`` or ``None``. If 0, the default, do not pad; otherwise - if not ``None`` add padding bytes to make the message size a multiple of *pad*. Note - that if padding is non-zero, an EDNS PADDING option will always be added to the - message. If ``None``, add padding following RFC 8467, namely if the request is - padded, pad the response to 468 otherwise do not pad. - - *copy_mode*, a ``dns.message.CopyMode`` or ``None``, determines how sections are - copied. The default, ``None`` copies sections according to the default for the - message's opcode, which is currently ``dns.message.CopyMode.QUESTION`` for all - opcodes. ``dns.message.CopyMode.QUESTION`` copies only the question section. - ``dns.message.CopyMode.EVERYTHING`` copies all sections other than OPT or TSIG - records, which are created appropriately if needed. ``dns.message.CopyMode.NOTHING`` - copies no sections; note that this mode is for server testing purposes and is - otherwise not recommended for use. In particular, ``dns.message.is_response()`` - will be ``False`` if you create a response this way and the rcode is not - ``FORMERR``, ``SERVFAIL``, ``NOTIMP``, or ``REFUSED``. - - Returns a ``dns.message.Message`` object whose specific class is appropriate for the - query. For example, if query is a ``dns.update.UpdateMessage``, the response will - be one too. - """ - - if query.flags & dns.flags.QR: - raise dns.exception.FormError("specified query message is not a query") - opcode = query.opcode() - factory = _message_factory_from_opcode(opcode) - response = factory(id=query.id) - response.flags = dns.flags.QR | (query.flags & dns.flags.RD) - if recursion_available: - response.flags |= dns.flags.RA - response.set_opcode(opcode) - if copy_mode is None: - copy_mode = CopyMode.QUESTION - if copy_mode != CopyMode.NOTHING: - response.question = list(query.question) - if copy_mode == CopyMode.EVERYTHING: - response.answer = list(query.answer) - response.authority = list(query.authority) - response.additional = list(query.additional) - if query.edns >= 0: - if pad is None: - # Set response padding per RFC 8467 - pad = 0 - for option in query.options: - if option.otype == dns.edns.OptionType.PADDING: - pad = 468 - response.use_edns(0, 0, our_payload, query.payload, pad=pad) - if query.had_tsig: - response.use_tsig( - query.keyring, - query.keyname, - fudge, - None, - tsig_error, - b"", - query.keyalgorithm, - ) - response.request_mac = query.mac - return response - - -### BEGIN generated MessageSection constants - -QUESTION = MessageSection.QUESTION -ANSWER = MessageSection.ANSWER -AUTHORITY = MessageSection.AUTHORITY -ADDITIONAL = MessageSection.ADDITIONAL - -### END generated MessageSection constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/name.py b/write-message/venv/lib/python3.10/site-packages/dns/name.py deleted file mode 100644 index f79f0d0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/name.py +++ /dev/null @@ -1,1284 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Names. -""" - -import copy -import encodings.idna # type: ignore -import functools -import struct -from typing import Any, Callable, Dict, Iterable, Optional, Tuple, Union - -import dns._features -import dns.enum -import dns.exception -import dns.immutable -import dns.wire - -if dns._features.have("idna"): - import idna # type: ignore - - have_idna_2008 = True -else: # pragma: no cover - have_idna_2008 = False - -CompressType = Dict["Name", int] - - -class NameRelation(dns.enum.IntEnum): - """Name relation result from fullcompare().""" - - # This is an IntEnum for backwards compatibility in case anyone - # has hardwired the constants. - - #: The compared names have no relationship to each other. - NONE = 0 - #: the first name is a superdomain of the second. - SUPERDOMAIN = 1 - #: The first name is a subdomain of the second. - SUBDOMAIN = 2 - #: The compared names are equal. - EQUAL = 3 - #: The compared names have a common ancestor. - COMMONANCESTOR = 4 - - @classmethod - def _maximum(cls): - return cls.COMMONANCESTOR # pragma: no cover - - @classmethod - def _short_name(cls): - return cls.__name__ # pragma: no cover - - -# Backwards compatibility -NAMERELN_NONE = NameRelation.NONE -NAMERELN_SUPERDOMAIN = NameRelation.SUPERDOMAIN -NAMERELN_SUBDOMAIN = NameRelation.SUBDOMAIN -NAMERELN_EQUAL = NameRelation.EQUAL -NAMERELN_COMMONANCESTOR = NameRelation.COMMONANCESTOR - - -class EmptyLabel(dns.exception.SyntaxError): - """A DNS label is empty.""" - - -class BadEscape(dns.exception.SyntaxError): - """An escaped code in a text format of DNS name is invalid.""" - - -class BadPointer(dns.exception.FormError): - """A DNS compression pointer points forward instead of backward.""" - - -class BadLabelType(dns.exception.FormError): - """The label type in DNS name wire format is unknown.""" - - -class NeedAbsoluteNameOrOrigin(dns.exception.DNSException): - """An attempt was made to convert a non-absolute name to - wire when there was also a non-absolute (or missing) origin.""" - - -class NameTooLong(dns.exception.FormError): - """A DNS name is > 255 octets long.""" - - -class LabelTooLong(dns.exception.SyntaxError): - """A DNS label is > 63 octets long.""" - - -class AbsoluteConcatenation(dns.exception.DNSException): - """An attempt was made to append anything other than the - empty name to an absolute DNS name.""" - - -class NoParent(dns.exception.DNSException): - """An attempt was made to get the parent of the root name - or the empty name.""" - - -class NoIDNA2008(dns.exception.DNSException): - """IDNA 2008 processing was requested but the idna module is not - available.""" - - -class IDNAException(dns.exception.DNSException): - """IDNA processing raised an exception.""" - - supp_kwargs = {"idna_exception"} - fmt = "IDNA processing exception: {idna_exception}" - - # We do this as otherwise mypy complains about unexpected keyword argument - # idna_exception - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - -class NeedSubdomainOfOrigin(dns.exception.DNSException): - """An absolute name was provided that is not a subdomain of the specified origin.""" - - -_escaped = b'"().;\\@$' -_escaped_text = '"().;\\@$' - - -def _escapify(label: Union[bytes, str]) -> str: - """Escape the characters in label which need it. - @returns: the escaped string - @rtype: string""" - if isinstance(label, bytes): - # Ordinary DNS label mode. Escape special characters and values - # < 0x20 or > 0x7f. - text = "" - for c in label: - if c in _escaped: - text += "\\" + chr(c) - elif c > 0x20 and c < 0x7F: - text += chr(c) - else: - text += "\\%03d" % c - return text - - # Unicode label mode. Escape only special characters and values < 0x20 - text = "" - for uc in label: - if uc in _escaped_text: - text += "\\" + uc - elif uc <= "\x20": - text += "\\%03d" % ord(uc) - else: - text += uc - return text - - -class IDNACodec: - """Abstract base class for IDNA encoder/decoders.""" - - def __init__(self): - pass - - def is_idna(self, label: bytes) -> bool: - return label.lower().startswith(b"xn--") - - def encode(self, label: str) -> bytes: - raise NotImplementedError # pragma: no cover - - def decode(self, label: bytes) -> str: - # We do not apply any IDNA policy on decode. - if self.is_idna(label): - try: - slabel = label[4:].decode("punycode") - return _escapify(slabel) - except Exception as e: - raise IDNAException(idna_exception=e) - else: - return _escapify(label) - - -class IDNA2003Codec(IDNACodec): - """IDNA 2003 encoder/decoder.""" - - def __init__(self, strict_decode: bool = False): - """Initialize the IDNA 2003 encoder/decoder. - - *strict_decode* is a ``bool``. If `True`, then IDNA2003 checking - is done when decoding. This can cause failures if the name - was encoded with IDNA2008. The default is `False`. - """ - - super().__init__() - self.strict_decode = strict_decode - - def encode(self, label: str) -> bytes: - """Encode *label*.""" - - if label == "": - return b"" - try: - return encodings.idna.ToASCII(label) - except UnicodeError: - raise LabelTooLong - - def decode(self, label: bytes) -> str: - """Decode *label*.""" - if not self.strict_decode: - return super().decode(label) - if label == b"": - return "" - try: - return _escapify(encodings.idna.ToUnicode(label)) - except Exception as e: - raise IDNAException(idna_exception=e) - - -class IDNA2008Codec(IDNACodec): - """IDNA 2008 encoder/decoder.""" - - def __init__( - self, - uts_46: bool = False, - transitional: bool = False, - allow_pure_ascii: bool = False, - strict_decode: bool = False, - ): - """Initialize the IDNA 2008 encoder/decoder. - - *uts_46* is a ``bool``. If True, apply Unicode IDNA - compatibility processing as described in Unicode Technical - Standard #46 (https://unicode.org/reports/tr46/). - If False, do not apply the mapping. The default is False. - - *transitional* is a ``bool``: If True, use the - "transitional" mode described in Unicode Technical Standard - #46. The default is False. - - *allow_pure_ascii* is a ``bool``. If True, then a label which - consists of only ASCII characters is allowed. This is less - strict than regular IDNA 2008, but is also necessary for mixed - names, e.g. a name with starting with "_sip._tcp." and ending - in an IDN suffix which would otherwise be disallowed. The - default is False. - - *strict_decode* is a ``bool``: If True, then IDNA2008 checking - is done when decoding. This can cause failures if the name - was encoded with IDNA2003. The default is False. - """ - super().__init__() - self.uts_46 = uts_46 - self.transitional = transitional - self.allow_pure_ascii = allow_pure_ascii - self.strict_decode = strict_decode - - def encode(self, label: str) -> bytes: - if label == "": - return b"" - if self.allow_pure_ascii and is_all_ascii(label): - encoded = label.encode("ascii") - if len(encoded) > 63: - raise LabelTooLong - return encoded - if not have_idna_2008: - raise NoIDNA2008 - try: - if self.uts_46: - # pylint: disable=possibly-used-before-assignment - label = idna.uts46_remap(label, False, self.transitional) - return idna.alabel(label) - except idna.IDNAError as e: - if e.args[0] == "Label too long": - raise LabelTooLong - else: - raise IDNAException(idna_exception=e) - - def decode(self, label: bytes) -> str: - if not self.strict_decode: - return super().decode(label) - if label == b"": - return "" - if not have_idna_2008: - raise NoIDNA2008 - try: - ulabel = idna.ulabel(label) - if self.uts_46: - ulabel = idna.uts46_remap(ulabel, False, self.transitional) - return _escapify(ulabel) - except (idna.IDNAError, UnicodeError) as e: - raise IDNAException(idna_exception=e) - - -IDNA_2003_Practical = IDNA2003Codec(False) -IDNA_2003_Strict = IDNA2003Codec(True) -IDNA_2003 = IDNA_2003_Practical -IDNA_2008_Practical = IDNA2008Codec(True, False, True, False) -IDNA_2008_UTS_46 = IDNA2008Codec(True, False, False, False) -IDNA_2008_Strict = IDNA2008Codec(False, False, False, True) -IDNA_2008_Transitional = IDNA2008Codec(True, True, False, False) -IDNA_2008 = IDNA_2008_Practical - - -def _validate_labels(labels: Tuple[bytes, ...]) -> None: - """Check for empty labels in the middle of a label sequence, - labels that are too long, and for too many labels. - - Raises ``dns.name.NameTooLong`` if the name as a whole is too long. - - Raises ``dns.name.EmptyLabel`` if a label is empty (i.e. the root - label) and appears in a position other than the end of the label - sequence - - """ - - l = len(labels) - total = 0 - i = -1 - j = 0 - for label in labels: - ll = len(label) - total += ll + 1 - if ll > 63: - raise LabelTooLong - if i < 0 and label == b"": - i = j - j += 1 - if total > 255: - raise NameTooLong - if i >= 0 and i != l - 1: - raise EmptyLabel - - -def _maybe_convert_to_binary(label: Union[bytes, str]) -> bytes: - """If label is ``str``, convert it to ``bytes``. If it is already - ``bytes`` just return it. - - """ - - if isinstance(label, bytes): - return label - if isinstance(label, str): - return label.encode() - raise ValueError # pragma: no cover - - -@dns.immutable.immutable -class Name: - """A DNS name. - - The dns.name.Name class represents a DNS name as a tuple of - labels. Each label is a ``bytes`` in DNS wire format. Instances - of the class are immutable. - """ - - __slots__ = ["labels"] - - def __init__(self, labels: Iterable[Union[bytes, str]]): - """*labels* is any iterable whose values are ``str`` or ``bytes``.""" - - blabels = [_maybe_convert_to_binary(x) for x in labels] - self.labels = tuple(blabels) - _validate_labels(self.labels) - - def __copy__(self): - return Name(self.labels) - - def __deepcopy__(self, memo): - return Name(copy.deepcopy(self.labels, memo)) - - def __getstate__(self): - # Names can be pickled - return {"labels": self.labels} - - def __setstate__(self, state): - super().__setattr__("labels", state["labels"]) - _validate_labels(self.labels) - - def is_absolute(self) -> bool: - """Is the most significant label of this name the root label? - - Returns a ``bool``. - """ - - return len(self.labels) > 0 and self.labels[-1] == b"" - - def is_wild(self) -> bool: - """Is this name wild? (I.e. Is the least significant label '*'?) - - Returns a ``bool``. - """ - - return len(self.labels) > 0 and self.labels[0] == b"*" - - def __hash__(self) -> int: - """Return a case-insensitive hash of the name. - - Returns an ``int``. - """ - - h = 0 - for label in self.labels: - for c in label.lower(): - h += (h << 3) + c - return h - - def fullcompare(self, other: "Name") -> Tuple[NameRelation, int, int]: - """Compare two names, returning a 3-tuple - ``(relation, order, nlabels)``. - - *relation* describes the relation ship between the names, - and is one of: ``dns.name.NameRelation.NONE``, - ``dns.name.NameRelation.SUPERDOMAIN``, ``dns.name.NameRelation.SUBDOMAIN``, - ``dns.name.NameRelation.EQUAL``, or ``dns.name.NameRelation.COMMONANCESTOR``. - - *order* is < 0 if *self* < *other*, > 0 if *self* > *other*, and == - 0 if *self* == *other*. A relative name is always less than an - absolute name. If both names have the same relativity, then - the DNSSEC order relation is used to order them. - - *nlabels* is the number of significant labels that the two names - have in common. - - Here are some examples. Names ending in "." are absolute names, - those not ending in "." are relative names. - - ============= ============= =========== ===== ======= - self other relation order nlabels - ============= ============= =========== ===== ======= - www.example. www.example. equal 0 3 - www.example. example. subdomain > 0 2 - example. www.example. superdomain < 0 2 - example1.com. example2.com. common anc. < 0 2 - example1 example2. none < 0 0 - example1. example2 none > 0 0 - ============= ============= =========== ===== ======= - """ - - sabs = self.is_absolute() - oabs = other.is_absolute() - if sabs != oabs: - if sabs: - return (NameRelation.NONE, 1, 0) - else: - return (NameRelation.NONE, -1, 0) - l1 = len(self.labels) - l2 = len(other.labels) - ldiff = l1 - l2 - if ldiff < 0: - l = l1 - else: - l = l2 - - order = 0 - nlabels = 0 - namereln = NameRelation.NONE - while l > 0: - l -= 1 - l1 -= 1 - l2 -= 1 - label1 = self.labels[l1].lower() - label2 = other.labels[l2].lower() - if label1 < label2: - order = -1 - if nlabels > 0: - namereln = NameRelation.COMMONANCESTOR - return (namereln, order, nlabels) - elif label1 > label2: - order = 1 - if nlabels > 0: - namereln = NameRelation.COMMONANCESTOR - return (namereln, order, nlabels) - nlabels += 1 - order = ldiff - if ldiff < 0: - namereln = NameRelation.SUPERDOMAIN - elif ldiff > 0: - namereln = NameRelation.SUBDOMAIN - else: - namereln = NameRelation.EQUAL - return (namereln, order, nlabels) - - def is_subdomain(self, other: "Name") -> bool: - """Is self a subdomain of other? - - Note that the notion of subdomain includes equality, e.g. - "dnspython.org" is a subdomain of itself. - - Returns a ``bool``. - """ - - (nr, _, _) = self.fullcompare(other) - if nr == NameRelation.SUBDOMAIN or nr == NameRelation.EQUAL: - return True - return False - - def is_superdomain(self, other: "Name") -> bool: - """Is self a superdomain of other? - - Note that the notion of superdomain includes equality, e.g. - "dnspython.org" is a superdomain of itself. - - Returns a ``bool``. - """ - - (nr, _, _) = self.fullcompare(other) - if nr == NameRelation.SUPERDOMAIN or nr == NameRelation.EQUAL: - return True - return False - - def canonicalize(self) -> "Name": - """Return a name which is equal to the current name, but is in - DNSSEC canonical form. - """ - - return Name([x.lower() for x in self.labels]) - - def __eq__(self, other): - if isinstance(other, Name): - return self.fullcompare(other)[1] == 0 - else: - return False - - def __ne__(self, other): - if isinstance(other, Name): - return self.fullcompare(other)[1] != 0 - else: - return True - - def __lt__(self, other): - if isinstance(other, Name): - return self.fullcompare(other)[1] < 0 - else: - return NotImplemented - - def __le__(self, other): - if isinstance(other, Name): - return self.fullcompare(other)[1] <= 0 - else: - return NotImplemented - - def __ge__(self, other): - if isinstance(other, Name): - return self.fullcompare(other)[1] >= 0 - else: - return NotImplemented - - def __gt__(self, other): - if isinstance(other, Name): - return self.fullcompare(other)[1] > 0 - else: - return NotImplemented - - def __repr__(self): - return "" - - def __str__(self): - return self.to_text(False) - - def to_text(self, omit_final_dot: bool = False) -> str: - """Convert name to DNS text format. - - *omit_final_dot* is a ``bool``. If True, don't emit the final - dot (denoting the root label) for absolute names. The default - is False. - - Returns a ``str``. - """ - - if len(self.labels) == 0: - return "@" - if len(self.labels) == 1 and self.labels[0] == b"": - return "." - if omit_final_dot and self.is_absolute(): - l = self.labels[:-1] - else: - l = self.labels - s = ".".join(map(_escapify, l)) - return s - - def to_unicode( - self, omit_final_dot: bool = False, idna_codec: Optional[IDNACodec] = None - ) -> str: - """Convert name to Unicode text format. - - IDN ACE labels are converted to Unicode. - - *omit_final_dot* is a ``bool``. If True, don't emit the final - dot (denoting the root label) for absolute names. The default - is False. - *idna_codec* specifies the IDNA encoder/decoder. If None, the - dns.name.IDNA_2003_Practical encoder/decoder is used. - The IDNA_2003_Practical decoder does - not impose any policy, it just decodes punycode, so if you - don't want checking for compliance, you can use this decoder - for IDNA2008 as well. - - Returns a ``str``. - """ - - if len(self.labels) == 0: - return "@" - if len(self.labels) == 1 and self.labels[0] == b"": - return "." - if omit_final_dot and self.is_absolute(): - l = self.labels[:-1] - else: - l = self.labels - if idna_codec is None: - idna_codec = IDNA_2003_Practical - return ".".join([idna_codec.decode(x) for x in l]) - - def to_digestable(self, origin: Optional["Name"] = None) -> bytes: - """Convert name to a format suitable for digesting in hashes. - - The name is canonicalized and converted to uncompressed wire - format. All names in wire format are absolute. If the name - is a relative name, then an origin must be supplied. - - *origin* is a ``dns.name.Name`` or ``None``. If the name is - relative and origin is not ``None``, then origin will be appended - to the name. - - Raises ``dns.name.NeedAbsoluteNameOrOrigin`` if the name is - relative and no origin was provided. - - Returns a ``bytes``. - """ - - digest = self.to_wire(origin=origin, canonicalize=True) - assert digest is not None - return digest - - def to_wire( - self, - file: Optional[Any] = None, - compress: Optional[CompressType] = None, - origin: Optional["Name"] = None, - canonicalize: bool = False, - ) -> Optional[bytes]: - """Convert name to wire format, possibly compressing it. - - *file* is the file where the name is emitted (typically an - io.BytesIO file). If ``None`` (the default), a ``bytes`` - containing the wire name will be returned. - - *compress*, a ``dict``, is the compression table to use. If - ``None`` (the default), names will not be compressed. Note that - the compression code assumes that compression offset 0 is the - start of *file*, and thus compression will not be correct - if this is not the case. - - *origin* is a ``dns.name.Name`` or ``None``. If the name is - relative and origin is not ``None``, then *origin* will be appended - to it. - - *canonicalize*, a ``bool``, indicates whether the name should - be canonicalized; that is, converted to a format suitable for - digesting in hashes. - - Raises ``dns.name.NeedAbsoluteNameOrOrigin`` if the name is - relative and no origin was provided. - - Returns a ``bytes`` or ``None``. - """ - - if file is None: - out = bytearray() - for label in self.labels: - out.append(len(label)) - if canonicalize: - out += label.lower() - else: - out += label - if not self.is_absolute(): - if origin is None or not origin.is_absolute(): - raise NeedAbsoluteNameOrOrigin - for label in origin.labels: - out.append(len(label)) - if canonicalize: - out += label.lower() - else: - out += label - return bytes(out) - - labels: Iterable[bytes] - if not self.is_absolute(): - if origin is None or not origin.is_absolute(): - raise NeedAbsoluteNameOrOrigin - labels = list(self.labels) - labels.extend(list(origin.labels)) - else: - labels = self.labels - i = 0 - for label in labels: - n = Name(labels[i:]) - i += 1 - if compress is not None: - pos = compress.get(n) - else: - pos = None - if pos is not None: - value = 0xC000 + pos - s = struct.pack("!H", value) - file.write(s) - break - else: - if compress is not None and len(n) > 1: - pos = file.tell() - if pos <= 0x3FFF: - compress[n] = pos - l = len(label) - file.write(struct.pack("!B", l)) - if l > 0: - if canonicalize: - file.write(label.lower()) - else: - file.write(label) - return None - - def __len__(self) -> int: - """The length of the name (in labels). - - Returns an ``int``. - """ - - return len(self.labels) - - def __getitem__(self, index): - return self.labels[index] - - def __add__(self, other): - return self.concatenate(other) - - def __sub__(self, other): - return self.relativize(other) - - def split(self, depth: int) -> Tuple["Name", "Name"]: - """Split a name into a prefix and suffix names at the specified depth. - - *depth* is an ``int`` specifying the number of labels in the suffix - - Raises ``ValueError`` if *depth* was not >= 0 and <= the length of the - name. - - Returns the tuple ``(prefix, suffix)``. - """ - - l = len(self.labels) - if depth == 0: - return (self, dns.name.empty) - elif depth == l: - return (dns.name.empty, self) - elif depth < 0 or depth > l: - raise ValueError("depth must be >= 0 and <= the length of the name") - return (Name(self[:-depth]), Name(self[-depth:])) - - def concatenate(self, other: "Name") -> "Name": - """Return a new name which is the concatenation of self and other. - - Raises ``dns.name.AbsoluteConcatenation`` if the name is - absolute and *other* is not the empty name. - - Returns a ``dns.name.Name``. - """ - - if self.is_absolute() and len(other) > 0: - raise AbsoluteConcatenation - labels = list(self.labels) - labels.extend(list(other.labels)) - return Name(labels) - - def relativize(self, origin: "Name") -> "Name": - """If the name is a subdomain of *origin*, return a new name which is - the name relative to origin. Otherwise return the name. - - For example, relativizing ``www.dnspython.org.`` to origin - ``dnspython.org.`` returns the name ``www``. Relativizing ``example.`` - to origin ``dnspython.org.`` returns ``example.``. - - Returns a ``dns.name.Name``. - """ - - if origin is not None and self.is_subdomain(origin): - return Name(self[: -len(origin)]) - else: - return self - - def derelativize(self, origin: "Name") -> "Name": - """If the name is a relative name, return a new name which is the - concatenation of the name and origin. Otherwise return the name. - - For example, derelativizing ``www`` to origin ``dnspython.org.`` - returns the name ``www.dnspython.org.``. Derelativizing ``example.`` - to origin ``dnspython.org.`` returns ``example.``. - - Returns a ``dns.name.Name``. - """ - - if not self.is_absolute(): - return self.concatenate(origin) - else: - return self - - def choose_relativity( - self, origin: Optional["Name"] = None, relativize: bool = True - ) -> "Name": - """Return a name with the relativity desired by the caller. - - If *origin* is ``None``, then the name is returned. - Otherwise, if *relativize* is ``True`` the name is - relativized, and if *relativize* is ``False`` the name is - derelativized. - - Returns a ``dns.name.Name``. - """ - - if origin: - if relativize: - return self.relativize(origin) - else: - return self.derelativize(origin) - else: - return self - - def parent(self) -> "Name": - """Return the parent of the name. - - For example, the parent of ``www.dnspython.org.`` is ``dnspython.org``. - - Raises ``dns.name.NoParent`` if the name is either the root name or the - empty name, and thus has no parent. - - Returns a ``dns.name.Name``. - """ - - if self == root or self == empty: - raise NoParent - return Name(self.labels[1:]) - - def predecessor(self, origin: "Name", prefix_ok: bool = True) -> "Name": - """Return the maximal predecessor of *name* in the DNSSEC ordering in the zone - whose origin is *origin*, or return the longest name under *origin* if the - name is origin (i.e. wrap around to the longest name, which may still be - *origin* due to length considerations. - - The relativity of the name is preserved, so if this name is relative - then the method will return a relative name, and likewise if this name - is absolute then the predecessor will be absolute. - - *prefix_ok* indicates if prefixing labels is allowed, and - defaults to ``True``. Normally it is good to allow this, but if computing - a maximal predecessor at a zone cut point then ``False`` must be specified. - """ - return _handle_relativity_and_call( - _absolute_predecessor, self, origin, prefix_ok - ) - - def successor(self, origin: "Name", prefix_ok: bool = True) -> "Name": - """Return the minimal successor of *name* in the DNSSEC ordering in the zone - whose origin is *origin*, or return *origin* if the successor cannot be - computed due to name length limitations. - - Note that *origin* is returned in the "too long" cases because wrapping - around to the origin is how NSEC records express "end of the zone". - - The relativity of the name is preserved, so if this name is relative - then the method will return a relative name, and likewise if this name - is absolute then the successor will be absolute. - - *prefix_ok* indicates if prefixing a new minimal label is allowed, and - defaults to ``True``. Normally it is good to allow this, but if computing - a minimal successor at a zone cut point then ``False`` must be specified. - """ - return _handle_relativity_and_call(_absolute_successor, self, origin, prefix_ok) - - -#: The root name, '.' -root = Name([b""]) - -#: The empty name. -empty = Name([]) - - -def from_unicode( - text: str, origin: Optional[Name] = root, idna_codec: Optional[IDNACodec] = None -) -> Name: - """Convert unicode text into a Name object. - - Labels are encoded in IDN ACE form according to rules specified by - the IDNA codec. - - *text*, a ``str``, is the text to convert into a name. - - *origin*, a ``dns.name.Name``, specifies the origin to - append to non-absolute names. The default is the root name. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - Returns a ``dns.name.Name``. - """ - - if not isinstance(text, str): - raise ValueError("input to from_unicode() must be a unicode string") - if not (origin is None or isinstance(origin, Name)): - raise ValueError("origin must be a Name or None") - labels = [] - label = "" - escaping = False - edigits = 0 - total = 0 - if idna_codec is None: - idna_codec = IDNA_2003 - if text == "@": - text = "" - if text: - if text in [".", "\u3002", "\uff0e", "\uff61"]: - return Name([b""]) # no Unicode "u" on this constant! - for c in text: - if escaping: - if edigits == 0: - if c.isdigit(): - total = int(c) - edigits += 1 - else: - label += c - escaping = False - else: - if not c.isdigit(): - raise BadEscape - total *= 10 - total += int(c) - edigits += 1 - if edigits == 3: - escaping = False - label += chr(total) - elif c in [".", "\u3002", "\uff0e", "\uff61"]: - if len(label) == 0: - raise EmptyLabel - labels.append(idna_codec.encode(label)) - label = "" - elif c == "\\": - escaping = True - edigits = 0 - total = 0 - else: - label += c - if escaping: - raise BadEscape - if len(label) > 0: - labels.append(idna_codec.encode(label)) - else: - labels.append(b"") - - if (len(labels) == 0 or labels[-1] != b"") and origin is not None: - labels.extend(list(origin.labels)) - return Name(labels) - - -def is_all_ascii(text: str) -> bool: - for c in text: - if ord(c) > 0x7F: - return False - return True - - -def from_text( - text: Union[bytes, str], - origin: Optional[Name] = root, - idna_codec: Optional[IDNACodec] = None, -) -> Name: - """Convert text into a Name object. - - *text*, a ``bytes`` or ``str``, is the text to convert into a name. - - *origin*, a ``dns.name.Name``, specifies the origin to - append to non-absolute names. The default is the root name. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - Returns a ``dns.name.Name``. - """ - - if isinstance(text, str): - if not is_all_ascii(text): - # Some codepoint in the input text is > 127, so IDNA applies. - return from_unicode(text, origin, idna_codec) - # The input is all ASCII, so treat this like an ordinary non-IDNA - # domain name. Note that "all ASCII" is about the input text, - # not the codepoints in the domain name. E.g. if text has value - # - # r'\150\151\152\153\154\155\156\157\158\159' - # - # then it's still "all ASCII" even though the domain name has - # codepoints > 127. - text = text.encode("ascii") - if not isinstance(text, bytes): - raise ValueError("input to from_text() must be a string") - if not (origin is None or isinstance(origin, Name)): - raise ValueError("origin must be a Name or None") - labels = [] - label = b"" - escaping = False - edigits = 0 - total = 0 - if text == b"@": - text = b"" - if text: - if text == b".": - return Name([b""]) - for c in text: - byte_ = struct.pack("!B", c) - if escaping: - if edigits == 0: - if byte_.isdigit(): - total = int(byte_) - edigits += 1 - else: - label += byte_ - escaping = False - else: - if not byte_.isdigit(): - raise BadEscape - total *= 10 - total += int(byte_) - edigits += 1 - if edigits == 3: - escaping = False - label += struct.pack("!B", total) - elif byte_ == b".": - if len(label) == 0: - raise EmptyLabel - labels.append(label) - label = b"" - elif byte_ == b"\\": - escaping = True - edigits = 0 - total = 0 - else: - label += byte_ - if escaping: - raise BadEscape - if len(label) > 0: - labels.append(label) - else: - labels.append(b"") - if (len(labels) == 0 or labels[-1] != b"") and origin is not None: - labels.extend(list(origin.labels)) - return Name(labels) - - -# we need 'dns.wire.Parser' quoted as dns.name and dns.wire depend on each other. - - -def from_wire_parser(parser: "dns.wire.Parser") -> Name: - """Convert possibly compressed wire format into a Name. - - *parser* is a dns.wire.Parser. - - Raises ``dns.name.BadPointer`` if a compression pointer did not - point backwards in the message. - - Raises ``dns.name.BadLabelType`` if an invalid label type was encountered. - - Returns a ``dns.name.Name`` - """ - - labels = [] - biggest_pointer = parser.current - with parser.restore_furthest(): - count = parser.get_uint8() - while count != 0: - if count < 64: - labels.append(parser.get_bytes(count)) - elif count >= 192: - current = (count & 0x3F) * 256 + parser.get_uint8() - if current >= biggest_pointer: - raise BadPointer - biggest_pointer = current - parser.seek(current) - else: - raise BadLabelType - count = parser.get_uint8() - labels.append(b"") - return Name(labels) - - -def from_wire(message: bytes, current: int) -> Tuple[Name, int]: - """Convert possibly compressed wire format into a Name. - - *message* is a ``bytes`` containing an entire DNS message in DNS - wire form. - - *current*, an ``int``, is the offset of the beginning of the name - from the start of the message - - Raises ``dns.name.BadPointer`` if a compression pointer did not - point backwards in the message. - - Raises ``dns.name.BadLabelType`` if an invalid label type was encountered. - - Returns a ``(dns.name.Name, int)`` tuple consisting of the name - that was read and the number of bytes of the wire format message - which were consumed reading it. - """ - - if not isinstance(message, bytes): - raise ValueError("input to from_wire() must be a byte string") - parser = dns.wire.Parser(message, current) - name = from_wire_parser(parser) - return (name, parser.current - current) - - -# RFC 4471 Support - -_MINIMAL_OCTET = b"\x00" -_MINIMAL_OCTET_VALUE = ord(_MINIMAL_OCTET) -_SUCCESSOR_PREFIX = Name([_MINIMAL_OCTET]) -_MAXIMAL_OCTET = b"\xff" -_MAXIMAL_OCTET_VALUE = ord(_MAXIMAL_OCTET) -_AT_SIGN_VALUE = ord("@") -_LEFT_SQUARE_BRACKET_VALUE = ord("[") - - -def _wire_length(labels): - return functools.reduce(lambda v, x: v + len(x) + 1, labels, 0) - - -def _pad_to_max_name(name): - needed = 255 - _wire_length(name.labels) - new_labels = [] - while needed > 64: - new_labels.append(_MAXIMAL_OCTET * 63) - needed -= 64 - if needed >= 2: - new_labels.append(_MAXIMAL_OCTET * (needed - 1)) - # Note we're already maximal in the needed == 1 case as while we'd like - # to add one more byte as a new label, we can't, as adding a new non-empty - # label requires at least 2 bytes. - new_labels = list(reversed(new_labels)) - new_labels.extend(name.labels) - return Name(new_labels) - - -def _pad_to_max_label(label, suffix_labels): - length = len(label) - # We have to subtract one here to account for the length byte of label. - remaining = 255 - _wire_length(suffix_labels) - length - 1 - if remaining <= 0: - # Shouldn't happen! - return label - needed = min(63 - length, remaining) - return label + _MAXIMAL_OCTET * needed - - -def _absolute_predecessor(name: Name, origin: Name, prefix_ok: bool) -> Name: - # This is the RFC 4471 predecessor algorithm using the "absolute method" of section - # 3.1.1. - # - # Our caller must ensure that the name and origin are absolute, and that name is a - # subdomain of origin. - if name == origin: - return _pad_to_max_name(name) - least_significant_label = name[0] - if least_significant_label == _MINIMAL_OCTET: - return name.parent() - least_octet = least_significant_label[-1] - suffix_labels = name.labels[1:] - if least_octet == _MINIMAL_OCTET_VALUE: - new_labels = [least_significant_label[:-1]] - else: - octets = bytearray(least_significant_label) - octet = octets[-1] - if octet == _LEFT_SQUARE_BRACKET_VALUE: - octet = _AT_SIGN_VALUE - else: - octet -= 1 - octets[-1] = octet - least_significant_label = bytes(octets) - new_labels = [_pad_to_max_label(least_significant_label, suffix_labels)] - new_labels.extend(suffix_labels) - name = Name(new_labels) - if prefix_ok: - return _pad_to_max_name(name) - else: - return name - - -def _absolute_successor(name: Name, origin: Name, prefix_ok: bool) -> Name: - # This is the RFC 4471 successor algorithm using the "absolute method" of section - # 3.1.2. - # - # Our caller must ensure that the name and origin are absolute, and that name is a - # subdomain of origin. - if prefix_ok: - # Try prefixing \000 as new label - try: - return _SUCCESSOR_PREFIX.concatenate(name) - except NameTooLong: - pass - while name != origin: - # Try extending the least significant label. - least_significant_label = name[0] - if len(least_significant_label) < 63: - # We may be able to extend the least label with a minimal additional byte. - # This is only "may" because we could have a maximal length name even though - # the least significant label isn't maximally long. - new_labels = [least_significant_label + _MINIMAL_OCTET] - new_labels.extend(name.labels[1:]) - try: - return dns.name.Name(new_labels) - except dns.name.NameTooLong: - pass - # We can't extend the label either, so we'll try to increment the least - # signficant non-maximal byte in it. - octets = bytearray(least_significant_label) - # We do this reversed iteration with an explicit indexing variable because - # if we find something to increment, we're going to want to truncate everything - # to the right of it. - for i in range(len(octets) - 1, -1, -1): - octet = octets[i] - if octet == _MAXIMAL_OCTET_VALUE: - # We can't increment this, so keep looking. - continue - # Finally, something we can increment. We have to apply a special rule for - # incrementing "@", sending it to "[", because RFC 4034 6.1 says that when - # comparing names, uppercase letters compare as if they were their - # lower-case equivalents. If we increment "@" to "A", then it would compare - # as "a", which is after "[", "\", "]", "^", "_", and "`", so we would have - # skipped the most minimal successor, namely "[". - if octet == _AT_SIGN_VALUE: - octet = _LEFT_SQUARE_BRACKET_VALUE - else: - octet += 1 - octets[i] = octet - # We can now truncate all of the maximal values we skipped (if any) - new_labels = [bytes(octets[: i + 1])] - new_labels.extend(name.labels[1:]) - # We haven't changed the length of the name, so the Name constructor will - # always work. - return Name(new_labels) - # We couldn't increment, so chop off the least significant label and try - # again. - name = name.parent() - - # We couldn't increment at all, so return the origin, as wrapping around is the - # DNSSEC way. - return origin - - -def _handle_relativity_and_call( - function: Callable[[Name, Name, bool], Name], - name: Name, - origin: Name, - prefix_ok: bool, -) -> Name: - # Make "name" absolute if needed, ensure that the origin is absolute, - # call function(), and then relativize the result if needed. - if not origin.is_absolute(): - raise NeedAbsoluteNameOrOrigin - relative = not name.is_absolute() - if relative: - name = name.derelativize(origin) - elif not name.is_subdomain(origin): - raise NeedSubdomainOfOrigin - result_name = function(name, origin, prefix_ok) - if relative: - result_name = result_name.relativize(origin) - return result_name diff --git a/write-message/venv/lib/python3.10/site-packages/dns/namedict.py b/write-message/venv/lib/python3.10/site-packages/dns/namedict.py deleted file mode 100644 index ca8b197..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/namedict.py +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# Copyright (C) 2016 Coresec Systems AB -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND CORESEC SYSTEMS AB DISCLAIMS ALL -# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL CORESEC -# SYSTEMS AB BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR -# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS name dictionary""" - -# pylint seems to be confused about this one! -from collections.abc import MutableMapping # pylint: disable=no-name-in-module - -import dns.name - - -class NameDict(MutableMapping): - """A dictionary whose keys are dns.name.Name objects. - - In addition to being like a regular Python dictionary, this - dictionary can also get the deepest match for a given key. - """ - - __slots__ = ["max_depth", "max_depth_items", "__store"] - - def __init__(self, *args, **kwargs): - super().__init__() - self.__store = dict() - #: the maximum depth of the keys that have ever been added - self.max_depth = 0 - #: the number of items of maximum depth - self.max_depth_items = 0 - self.update(dict(*args, **kwargs)) - - def __update_max_depth(self, key): - if len(key) == self.max_depth: - self.max_depth_items = self.max_depth_items + 1 - elif len(key) > self.max_depth: - self.max_depth = len(key) - self.max_depth_items = 1 - - def __getitem__(self, key): - return self.__store[key] - - def __setitem__(self, key, value): - if not isinstance(key, dns.name.Name): - raise ValueError("NameDict key must be a name") - self.__store[key] = value - self.__update_max_depth(key) - - def __delitem__(self, key): - self.__store.pop(key) - if len(key) == self.max_depth: - self.max_depth_items = self.max_depth_items - 1 - if self.max_depth_items == 0: - self.max_depth = 0 - for k in self.__store: - self.__update_max_depth(k) - - def __iter__(self): - return iter(self.__store) - - def __len__(self): - return len(self.__store) - - def has_key(self, key): - return key in self.__store - - def get_deepest_match(self, name): - """Find the deepest match to *name* in the dictionary. - - The deepest match is the longest name in the dictionary which is - a superdomain of *name*. Note that *superdomain* includes matching - *name* itself. - - *name*, a ``dns.name.Name``, the name to find. - - Returns a ``(key, value)`` where *key* is the deepest - ``dns.name.Name``, and *value* is the value associated with *key*. - """ - - depth = len(name) - if depth > self.max_depth: - depth = self.max_depth - for i in range(-depth, 0): - n = dns.name.Name(name[i:]) - if n in self: - return (n, self[n]) - v = self[dns.name.empty] - return (dns.name.empty, v) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/nameserver.py b/write-message/venv/lib/python3.10/site-packages/dns/nameserver.py deleted file mode 100644 index b02a239..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/nameserver.py +++ /dev/null @@ -1,363 +0,0 @@ -from typing import Optional, Union -from urllib.parse import urlparse - -import dns.asyncbackend -import dns.asyncquery -import dns.inet -import dns.message -import dns.query - - -class Nameserver: - def __init__(self): - pass - - def __str__(self): - raise NotImplementedError - - def kind(self) -> str: - raise NotImplementedError - - def is_always_max_size(self) -> bool: - raise NotImplementedError - - def answer_nameserver(self) -> str: - raise NotImplementedError - - def answer_port(self) -> int: - raise NotImplementedError - - def query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - raise NotImplementedError - - async def async_query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool, - backend: dns.asyncbackend.Backend, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - raise NotImplementedError - - -class AddressAndPortNameserver(Nameserver): - def __init__(self, address: str, port: int): - super().__init__() - self.address = address - self.port = port - - def kind(self) -> str: - raise NotImplementedError - - def is_always_max_size(self) -> bool: - return False - - def __str__(self): - ns_kind = self.kind() - return f"{ns_kind}:{self.address}@{self.port}" - - def answer_nameserver(self) -> str: - return self.address - - def answer_port(self) -> int: - return self.port - - -class Do53Nameserver(AddressAndPortNameserver): - def __init__(self, address: str, port: int = 53): - super().__init__(address, port) - - def kind(self): - return "Do53" - - def query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - if max_size: - response = dns.query.tcp( - request, - self.address, - timeout=timeout, - port=self.port, - source=source, - source_port=source_port, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - else: - response = dns.query.udp( - request, - self.address, - timeout=timeout, - port=self.port, - source=source, - source_port=source_port, - raise_on_truncation=True, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ignore_errors=True, - ignore_unexpected=True, - ) - return response - - async def async_query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool, - backend: dns.asyncbackend.Backend, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - if max_size: - response = await dns.asyncquery.tcp( - request, - self.address, - timeout=timeout, - port=self.port, - source=source, - source_port=source_port, - backend=backend, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - else: - response = await dns.asyncquery.udp( - request, - self.address, - timeout=timeout, - port=self.port, - source=source, - source_port=source_port, - raise_on_truncation=True, - backend=backend, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ignore_errors=True, - ignore_unexpected=True, - ) - return response - - -class DoHNameserver(Nameserver): - def __init__( - self, - url: str, - bootstrap_address: Optional[str] = None, - verify: Union[bool, str] = True, - want_get: bool = False, - http_version: dns.query.HTTPVersion = dns.query.HTTPVersion.DEFAULT, - ): - super().__init__() - self.url = url - self.bootstrap_address = bootstrap_address - self.verify = verify - self.want_get = want_get - self.http_version = http_version - - def kind(self): - return "DoH" - - def is_always_max_size(self) -> bool: - return True - - def __str__(self): - return self.url - - def answer_nameserver(self) -> str: - return self.url - - def answer_port(self) -> int: - port = urlparse(self.url).port - if port is None: - port = 443 - return port - - def query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - return dns.query.https( - request, - self.url, - timeout=timeout, - source=source, - source_port=source_port, - bootstrap_address=self.bootstrap_address, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - verify=self.verify, - post=(not self.want_get), - http_version=self.http_version, - ) - - async def async_query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool, - backend: dns.asyncbackend.Backend, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - return await dns.asyncquery.https( - request, - self.url, - timeout=timeout, - source=source, - source_port=source_port, - bootstrap_address=self.bootstrap_address, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - verify=self.verify, - post=(not self.want_get), - http_version=self.http_version, - ) - - -class DoTNameserver(AddressAndPortNameserver): - def __init__( - self, - address: str, - port: int = 853, - hostname: Optional[str] = None, - verify: Union[bool, str] = True, - ): - super().__init__(address, port) - self.hostname = hostname - self.verify = verify - - def kind(self): - return "DoT" - - def query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - return dns.query.tls( - request, - self.address, - port=self.port, - timeout=timeout, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - server_hostname=self.hostname, - verify=self.verify, - ) - - async def async_query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool, - backend: dns.asyncbackend.Backend, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - return await dns.asyncquery.tls( - request, - self.address, - port=self.port, - timeout=timeout, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - server_hostname=self.hostname, - verify=self.verify, - ) - - -class DoQNameserver(AddressAndPortNameserver): - def __init__( - self, - address: str, - port: int = 853, - verify: Union[bool, str] = True, - server_hostname: Optional[str] = None, - ): - super().__init__(address, port) - self.verify = verify - self.server_hostname = server_hostname - - def kind(self): - return "DoQ" - - def query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - return dns.query.quic( - request, - self.address, - port=self.port, - timeout=timeout, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - verify=self.verify, - server_hostname=self.server_hostname, - ) - - async def async_query( - self, - request: dns.message.QueryMessage, - timeout: float, - source: Optional[str], - source_port: int, - max_size: bool, - backend: dns.asyncbackend.Backend, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - ) -> dns.message.Message: - return await dns.asyncquery.quic( - request, - self.address, - port=self.port, - timeout=timeout, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - verify=self.verify, - server_hostname=self.server_hostname, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/node.py b/write-message/venv/lib/python3.10/site-packages/dns/node.py deleted file mode 100644 index de85a82..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/node.py +++ /dev/null @@ -1,359 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS nodes. A node is a set of rdatasets.""" - -import enum -import io -from typing import Any, Dict, Optional - -import dns.immutable -import dns.name -import dns.rdataclass -import dns.rdataset -import dns.rdatatype -import dns.renderer -import dns.rrset - -_cname_types = { - dns.rdatatype.CNAME, -} - -# "neutral" types can coexist with a CNAME and thus are not "other data" -_neutral_types = { - dns.rdatatype.NSEC, # RFC 4035 section 2.5 - dns.rdatatype.NSEC3, # This is not likely to happen, but not impossible! - dns.rdatatype.KEY, # RFC 4035 section 2.5, RFC 3007 -} - - -def _matches_type_or_its_signature(rdtypes, rdtype, covers): - return rdtype in rdtypes or (rdtype == dns.rdatatype.RRSIG and covers in rdtypes) - - -@enum.unique -class NodeKind(enum.Enum): - """Rdatasets in nodes""" - - REGULAR = 0 # a.k.a "other data" - NEUTRAL = 1 - CNAME = 2 - - @classmethod - def classify( - cls, rdtype: dns.rdatatype.RdataType, covers: dns.rdatatype.RdataType - ) -> "NodeKind": - if _matches_type_or_its_signature(_cname_types, rdtype, covers): - return NodeKind.CNAME - elif _matches_type_or_its_signature(_neutral_types, rdtype, covers): - return NodeKind.NEUTRAL - else: - return NodeKind.REGULAR - - @classmethod - def classify_rdataset(cls, rdataset: dns.rdataset.Rdataset) -> "NodeKind": - return cls.classify(rdataset.rdtype, rdataset.covers) - - -class Node: - """A Node is a set of rdatasets. - - A node is either a CNAME node or an "other data" node. A CNAME - node contains only CNAME, KEY, NSEC, and NSEC3 rdatasets along with their - covering RRSIG rdatasets. An "other data" node contains any - rdataset other than a CNAME or RRSIG(CNAME) rdataset. When - changes are made to a node, the CNAME or "other data" state is - always consistent with the update, i.e. the most recent change - wins. For example, if you have a node which contains a CNAME - rdataset, and then add an MX rdataset to it, then the CNAME - rdataset will be deleted. Likewise if you have a node containing - an MX rdataset and add a CNAME rdataset, the MX rdataset will be - deleted. - """ - - __slots__ = ["rdatasets"] - - def __init__(self): - # the set of rdatasets, represented as a list. - self.rdatasets = [] - - def to_text(self, name: dns.name.Name, **kw: Dict[str, Any]) -> str: - """Convert a node to text format. - - Each rdataset at the node is printed. Any keyword arguments - to this method are passed on to the rdataset's to_text() method. - - *name*, a ``dns.name.Name``, the owner name of the - rdatasets. - - Returns a ``str``. - - """ - - s = io.StringIO() - for rds in self.rdatasets: - if len(rds) > 0: - s.write(rds.to_text(name, **kw)) # type: ignore[arg-type] - s.write("\n") - return s.getvalue()[:-1] - - def __repr__(self): - return "" - - def __eq__(self, other): - # - # This is inefficient. Good thing we don't need to do it much. - # - for rd in self.rdatasets: - if rd not in other.rdatasets: - return False - for rd in other.rdatasets: - if rd not in self.rdatasets: - return False - return True - - def __ne__(self, other): - return not self.__eq__(other) - - def __len__(self): - return len(self.rdatasets) - - def __iter__(self): - return iter(self.rdatasets) - - def _append_rdataset(self, rdataset): - """Append rdataset to the node with special handling for CNAME and - other data conditions. - - Specifically, if the rdataset being appended has ``NodeKind.CNAME``, - then all rdatasets other than KEY, NSEC, NSEC3, and their covering - RRSIGs are deleted. If the rdataset being appended has - ``NodeKind.REGULAR`` then CNAME and RRSIG(CNAME) are deleted. - """ - # Make having just one rdataset at the node fast. - if len(self.rdatasets) > 0: - kind = NodeKind.classify_rdataset(rdataset) - if kind == NodeKind.CNAME: - self.rdatasets = [ - rds - for rds in self.rdatasets - if NodeKind.classify_rdataset(rds) != NodeKind.REGULAR - ] - elif kind == NodeKind.REGULAR: - self.rdatasets = [ - rds - for rds in self.rdatasets - if NodeKind.classify_rdataset(rds) != NodeKind.CNAME - ] - # Otherwise the rdataset is NodeKind.NEUTRAL and we do not need to - # edit self.rdatasets. - self.rdatasets.append(rdataset) - - def find_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - create: bool = False, - ) -> dns.rdataset.Rdataset: - """Find an rdataset matching the specified properties in the - current node. - - *rdclass*, a ``dns.rdataclass.RdataClass``, the class of the rdataset. - - *rdtype*, a ``dns.rdatatype.RdataType``, the type of the rdataset. - - *covers*, a ``dns.rdatatype.RdataType``, the covered type. - Usually this value is ``dns.rdatatype.NONE``, but if the - rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, - then the covers value will be the rdata type the SIG/RRSIG - covers. The library treats the SIG and RRSIG types as if they - were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). - This makes RRSIGs much easier to work with than if RRSIGs - covering different rdata types were aggregated into a single - RRSIG rdataset. - - *create*, a ``bool``. If True, create the rdataset if it is not found. - - Raises ``KeyError`` if an rdataset of the desired type and class does - not exist and *create* is not ``True``. - - Returns a ``dns.rdataset.Rdataset``. - """ - - for rds in self.rdatasets: - if rds.match(rdclass, rdtype, covers): - return rds - if not create: - raise KeyError - rds = dns.rdataset.Rdataset(rdclass, rdtype, covers) - self._append_rdataset(rds) - return rds - - def get_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - create: bool = False, - ) -> Optional[dns.rdataset.Rdataset]: - """Get an rdataset matching the specified properties in the - current node. - - None is returned if an rdataset of the specified type and - class does not exist and *create* is not ``True``. - - *rdclass*, an ``int``, the class of the rdataset. - - *rdtype*, an ``int``, the type of the rdataset. - - *covers*, an ``int``, the covered type. Usually this value is - dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or - dns.rdatatype.RRSIG, then the covers value will be the rdata - type the SIG/RRSIG covers. The library treats the SIG and RRSIG - types as if they were a family of - types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much - easier to work with than if RRSIGs covering different rdata - types were aggregated into a single RRSIG rdataset. - - *create*, a ``bool``. If True, create the rdataset if it is not found. - - Returns a ``dns.rdataset.Rdataset`` or ``None``. - """ - - try: - rds = self.find_rdataset(rdclass, rdtype, covers, create) - except KeyError: - rds = None - return rds - - def delete_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - ) -> None: - """Delete the rdataset matching the specified properties in the - current node. - - If a matching rdataset does not exist, it is not an error. - - *rdclass*, an ``int``, the class of the rdataset. - - *rdtype*, an ``int``, the type of the rdataset. - - *covers*, an ``int``, the covered type. - """ - - rds = self.get_rdataset(rdclass, rdtype, covers) - if rds is not None: - self.rdatasets.remove(rds) - - def replace_rdataset(self, replacement: dns.rdataset.Rdataset) -> None: - """Replace an rdataset. - - It is not an error if there is no rdataset matching *replacement*. - - Ownership of the *replacement* object is transferred to the node; - in other words, this method does not store a copy of *replacement* - at the node, it stores *replacement* itself. - - *replacement*, a ``dns.rdataset.Rdataset``. - - Raises ``ValueError`` if *replacement* is not a - ``dns.rdataset.Rdataset``. - """ - - if not isinstance(replacement, dns.rdataset.Rdataset): - raise ValueError("replacement is not an rdataset") - if isinstance(replacement, dns.rrset.RRset): - # RRsets are not good replacements as the match() method - # is not compatible. - replacement = replacement.to_rdataset() - self.delete_rdataset( - replacement.rdclass, replacement.rdtype, replacement.covers - ) - self._append_rdataset(replacement) - - def classify(self) -> NodeKind: - """Classify a node. - - A node which contains a CNAME or RRSIG(CNAME) is a - ``NodeKind.CNAME`` node. - - A node which contains only "neutral" types, i.e. types allowed to - co-exist with a CNAME, is a ``NodeKind.NEUTRAL`` node. The neutral - types are NSEC, NSEC3, KEY, and their associated RRSIGS. An empty node - is also considered neutral. - - A node which contains some rdataset which is not a CNAME, RRSIG(CNAME), - or a neutral type is a a ``NodeKind.REGULAR`` node. Regular nodes are - also commonly referred to as "other data". - """ - for rdataset in self.rdatasets: - kind = NodeKind.classify(rdataset.rdtype, rdataset.covers) - if kind != NodeKind.NEUTRAL: - return kind - return NodeKind.NEUTRAL - - def is_immutable(self) -> bool: - return False - - -@dns.immutable.immutable -class ImmutableNode(Node): - def __init__(self, node): - super().__init__() - self.rdatasets = tuple( - [dns.rdataset.ImmutableRdataset(rds) for rds in node.rdatasets] - ) - - def find_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - create: bool = False, - ) -> dns.rdataset.Rdataset: - if create: - raise TypeError("immutable") - return super().find_rdataset(rdclass, rdtype, covers, False) - - def get_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - create: bool = False, - ) -> Optional[dns.rdataset.Rdataset]: - if create: - raise TypeError("immutable") - return super().get_rdataset(rdclass, rdtype, covers, False) - - def delete_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - ) -> None: - raise TypeError("immutable") - - def replace_rdataset(self, replacement: dns.rdataset.Rdataset) -> None: - raise TypeError("immutable") - - def is_immutable(self) -> bool: - return True diff --git a/write-message/venv/lib/python3.10/site-packages/dns/opcode.py b/write-message/venv/lib/python3.10/site-packages/dns/opcode.py deleted file mode 100644 index 78b43d2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/opcode.py +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Opcodes.""" - -import dns.enum -import dns.exception - - -class Opcode(dns.enum.IntEnum): - #: Query - QUERY = 0 - #: Inverse Query (historical) - IQUERY = 1 - #: Server Status (unspecified and unimplemented anywhere) - STATUS = 2 - #: Notify - NOTIFY = 4 - #: Dynamic Update - UPDATE = 5 - - @classmethod - def _maximum(cls): - return 15 - - @classmethod - def _unknown_exception_class(cls): - return UnknownOpcode - - -class UnknownOpcode(dns.exception.DNSException): - """An DNS opcode is unknown.""" - - -def from_text(text: str) -> Opcode: - """Convert text into an opcode. - - *text*, a ``str``, the textual opcode - - Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown. - - Returns an ``int``. - """ - - return Opcode.from_text(text) - - -def from_flags(flags: int) -> Opcode: - """Extract an opcode from DNS message flags. - - *flags*, an ``int``, the DNS flags. - - Returns an ``int``. - """ - - return Opcode((flags & 0x7800) >> 11) - - -def to_flags(value: Opcode) -> int: - """Convert an opcode to a value suitable for ORing into DNS message - flags. - - *value*, an ``int``, the DNS opcode value. - - Returns an ``int``. - """ - - return (value << 11) & 0x7800 - - -def to_text(value: Opcode) -> str: - """Convert an opcode to text. - - *value*, an ``int`` the opcode value, - - Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown. - - Returns a ``str``. - """ - - return Opcode.to_text(value) - - -def is_update(flags: int) -> bool: - """Is the opcode in flags UPDATE? - - *flags*, an ``int``, the DNS message flags. - - Returns a ``bool``. - """ - - return from_flags(flags) == Opcode.UPDATE - - -### BEGIN generated Opcode constants - -QUERY = Opcode.QUERY -IQUERY = Opcode.IQUERY -STATUS = Opcode.STATUS -NOTIFY = Opcode.NOTIFY -UPDATE = Opcode.UPDATE - -### END generated Opcode constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/py.typed b/write-message/venv/lib/python3.10/site-packages/dns/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/query.py b/write-message/venv/lib/python3.10/site-packages/dns/query.py deleted file mode 100644 index 0d8a977..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/query.py +++ /dev/null @@ -1,1665 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Talk to a DNS server.""" - -import base64 -import contextlib -import enum -import errno -import os -import os.path -import random -import selectors -import socket -import struct -import time -import urllib.parse -from typing import Any, Dict, Optional, Tuple, Union, cast - -import dns._features -import dns.exception -import dns.inet -import dns.message -import dns.name -import dns.quic -import dns.rcode -import dns.rdataclass -import dns.rdatatype -import dns.serial -import dns.transaction -import dns.tsig -import dns.xfr - - -def _remaining(expiration): - if expiration is None: - return None - timeout = expiration - time.time() - if timeout <= 0.0: - raise dns.exception.Timeout - return timeout - - -def _expiration_for_this_attempt(timeout, expiration): - if expiration is None: - return None - return min(time.time() + timeout, expiration) - - -_have_httpx = dns._features.have("doh") -if _have_httpx: - import httpcore._backends.sync - import httpx - - _CoreNetworkBackend = httpcore.NetworkBackend - _CoreSyncStream = httpcore._backends.sync.SyncStream - - class _NetworkBackend(_CoreNetworkBackend): - def __init__(self, resolver, local_port, bootstrap_address, family): - super().__init__() - self._local_port = local_port - self._resolver = resolver - self._bootstrap_address = bootstrap_address - self._family = family - - def connect_tcp( - self, host, port, timeout, local_address, socket_options=None - ): # pylint: disable=signature-differs - addresses = [] - _, expiration = _compute_times(timeout) - if dns.inet.is_address(host): - addresses.append(host) - elif self._bootstrap_address is not None: - addresses.append(self._bootstrap_address) - else: - timeout = _remaining(expiration) - family = self._family - if local_address: - family = dns.inet.af_for_address(local_address) - answers = self._resolver.resolve_name( - host, family=family, lifetime=timeout - ) - addresses = answers.addresses() - for address in addresses: - af = dns.inet.af_for_address(address) - if local_address is not None or self._local_port != 0: - source = dns.inet.low_level_address_tuple( - (local_address, self._local_port), af - ) - else: - source = None - sock = _make_socket(af, socket.SOCK_STREAM, source) - attempt_expiration = _expiration_for_this_attempt(2.0, expiration) - try: - _connect( - sock, - dns.inet.low_level_address_tuple((address, port), af), - attempt_expiration, - ) - return _CoreSyncStream(sock) - except Exception: - pass - raise httpcore.ConnectError - - def connect_unix_socket( - self, path, timeout, socket_options=None - ): # pylint: disable=signature-differs - raise NotImplementedError - - class _HTTPTransport(httpx.HTTPTransport): - def __init__( - self, - *args, - local_port=0, - bootstrap_address=None, - resolver=None, - family=socket.AF_UNSPEC, - **kwargs, - ): - if resolver is None and bootstrap_address is None: - # pylint: disable=import-outside-toplevel,redefined-outer-name - import dns.resolver - - resolver = dns.resolver.Resolver() - super().__init__(*args, **kwargs) - self._pool._network_backend = _NetworkBackend( - resolver, local_port, bootstrap_address, family - ) - -else: - - class _HTTPTransport: # type: ignore - def connect_tcp(self, host, port, timeout, local_address): - raise NotImplementedError - - -have_doh = _have_httpx - -try: - import ssl -except ImportError: # pragma: no cover - - class ssl: # type: ignore - CERT_NONE = 0 - - class WantReadException(Exception): - pass - - class WantWriteException(Exception): - pass - - class SSLContext: - pass - - class SSLSocket: - pass - - @classmethod - def create_default_context(cls, *args, **kwargs): - raise Exception("no ssl support") # pylint: disable=broad-exception-raised - - -# Function used to create a socket. Can be overridden if needed in special -# situations. -socket_factory = socket.socket - - -class UnexpectedSource(dns.exception.DNSException): - """A DNS query response came from an unexpected address or port.""" - - -class BadResponse(dns.exception.FormError): - """A DNS query response does not respond to the question asked.""" - - -class NoDOH(dns.exception.DNSException): - """DNS over HTTPS (DOH) was requested but the httpx module is not - available.""" - - -class NoDOQ(dns.exception.DNSException): - """DNS over QUIC (DOQ) was requested but the aioquic module is not - available.""" - - -# for backwards compatibility -TransferError = dns.xfr.TransferError - - -def _compute_times(timeout): - now = time.time() - if timeout is None: - return (now, None) - else: - return (now, now + timeout) - - -def _wait_for(fd, readable, writable, _, expiration): - # Use the selected selector class to wait for any of the specified - # events. An "expiration" absolute time is converted into a relative - # timeout. - # - # The unused parameter is 'error', which is always set when - # selecting for read or write, and we have no error-only selects. - - if readable and isinstance(fd, ssl.SSLSocket) and fd.pending() > 0: - return True - sel = selectors.DefaultSelector() - events = 0 - if readable: - events |= selectors.EVENT_READ - if writable: - events |= selectors.EVENT_WRITE - if events: - sel.register(fd, events) - if expiration is None: - timeout = None - else: - timeout = expiration - time.time() - if timeout <= 0.0: - raise dns.exception.Timeout - if not sel.select(timeout): - raise dns.exception.Timeout - - -def _wait_for_readable(s, expiration): - _wait_for(s, True, False, True, expiration) - - -def _wait_for_writable(s, expiration): - _wait_for(s, False, True, True, expiration) - - -def _addresses_equal(af, a1, a2): - # Convert the first value of the tuple, which is a textual format - # address into binary form, so that we are not confused by different - # textual representations of the same address - try: - n1 = dns.inet.inet_pton(af, a1[0]) - n2 = dns.inet.inet_pton(af, a2[0]) - except dns.exception.SyntaxError: - return False - return n1 == n2 and a1[1:] == a2[1:] - - -def _matches_destination(af, from_address, destination, ignore_unexpected): - # Check that from_address is appropriate for a response to a query - # sent to destination. - if not destination: - return True - if _addresses_equal(af, from_address, destination) or ( - dns.inet.is_multicast(destination[0]) and from_address[1:] == destination[1:] - ): - return True - elif ignore_unexpected: - return False - raise UnexpectedSource( - f"got a response from {from_address} instead of " f"{destination}" - ) - - -def _destination_and_source( - where, port, source, source_port, where_must_be_address=True -): - # Apply defaults and compute destination and source tuples - # suitable for use in connect(), sendto(), or bind(). - af = None - destination = None - try: - af = dns.inet.af_for_address(where) - destination = where - except Exception: - if where_must_be_address: - raise - # URLs are ok so eat the exception - if source: - saf = dns.inet.af_for_address(source) - if af: - # We know the destination af, so source had better agree! - if saf != af: - raise ValueError( - "different address families for source and destination" - ) - else: - # We didn't know the destination af, but we know the source, - # so that's our af. - af = saf - if source_port and not source: - # Caller has specified a source_port but not an address, so we - # need to return a source, and we need to use the appropriate - # wildcard address as the address. - try: - source = dns.inet.any_for_af(af) - except Exception: - # we catch this and raise ValueError for backwards compatibility - raise ValueError("source_port specified but address family is unknown") - # Convert high-level (address, port) tuples into low-level address - # tuples. - if destination: - destination = dns.inet.low_level_address_tuple((destination, port), af) - if source: - source = dns.inet.low_level_address_tuple((source, source_port), af) - return (af, destination, source) - - -def _make_socket(af, type, source, ssl_context=None, server_hostname=None): - s = socket_factory(af, type) - try: - s.setblocking(False) - if source is not None: - s.bind(source) - if ssl_context: - # LGTM gets a false positive here, as our default context is OK - return ssl_context.wrap_socket( - s, - do_handshake_on_connect=False, # lgtm[py/insecure-protocol] - server_hostname=server_hostname, - ) - else: - return s - except Exception: - s.close() - raise - - -def _maybe_get_resolver( - resolver: Optional["dns.resolver.Resolver"], -) -> "dns.resolver.Resolver": - # We need a separate method for this to avoid overriding the global - # variable "dns" with the as-yet undefined local variable "dns" - # in https(). - if resolver is None: - # pylint: disable=import-outside-toplevel,redefined-outer-name - import dns.resolver - - resolver = dns.resolver.Resolver() - return resolver - - -class HTTPVersion(enum.IntEnum): - """Which version of HTTP should be used? - - DEFAULT will select the first version from the list [2, 1.1, 3] that - is available. - """ - - DEFAULT = 0 - HTTP_1 = 1 - H1 = 1 - HTTP_2 = 2 - H2 = 2 - HTTP_3 = 3 - H3 = 3 - - -def https( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 443, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - session: Optional[Any] = None, - path: str = "/dns-query", - post: bool = True, - bootstrap_address: Optional[str] = None, - verify: Union[bool, str] = True, - resolver: Optional["dns.resolver.Resolver"] = None, - family: int = socket.AF_UNSPEC, - http_version: HTTPVersion = HTTPVersion.DEFAULT, -) -> dns.message.Message: - """Return the response obtained after sending a query via DNS-over-HTTPS. - - *q*, a ``dns.message.Message``, the query to send. - - *where*, a ``str``, the nameserver IP address or the full URL. If an IP address is - given, the URL will be constructed using the following schema: - https://:/. - - *timeout*, a ``float`` or ``None``, the number of seconds to wait before the query - times out. If ``None``, the default, wait forever. - - *port*, a ``int``, the port to send the query to. The default is 443. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying the source - address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. The default is - 0. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own RRset. - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing junk at end of the - received message. - - *session*, an ``httpx.Client``. If provided, the client session to use to send the - queries. - - *path*, a ``str``. If *where* is an IP address, then *path* will be used to - construct the URL to send the DNS query to. - - *post*, a ``bool``. If ``True``, the default, POST method will be used. - - *bootstrap_address*, a ``str``, the IP address to use to bypass resolution. - - *verify*, a ``bool`` or ``str``. If a ``True``, then TLS certificate verification - of the server is done using the default CA bundle; if ``False``, then no - verification is done; if a `str` then it specifies the path to a certificate file or - directory which will be used for verification. - - *resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use for - resolution of hostnames in URLs. If not specified, a new resolver with a default - configuration will be used; note this is *not* the default resolver as that resolver - might have been configured to use DoH causing a chicken-and-egg problem. This - parameter only has an effect if the HTTP library is httpx. - - *family*, an ``int``, the address family. If socket.AF_UNSPEC (the default), both A - and AAAA records will be retrieved. - - *http_version*, a ``dns.query.HTTPVersion``, indicating which HTTP version to use. - - Returns a ``dns.message.Message``. - """ - - (af, _, the_source) = _destination_and_source( - where, port, source, source_port, False - ) - if af is not None and dns.inet.is_address(where): - if af == socket.AF_INET: - url = f"https://{where}:{port}{path}" - elif af == socket.AF_INET6: - url = f"https://[{where}]:{port}{path}" - else: - url = where - - extensions = {} - if bootstrap_address is None: - # pylint: disable=possibly-used-before-assignment - parsed = urllib.parse.urlparse(url) - if parsed.hostname is None: - raise ValueError("no hostname in URL") - if dns.inet.is_address(parsed.hostname): - bootstrap_address = parsed.hostname - extensions["sni_hostname"] = parsed.hostname - if parsed.port is not None: - port = parsed.port - - if http_version == HTTPVersion.H3 or ( - http_version == HTTPVersion.DEFAULT and not have_doh - ): - if bootstrap_address is None: - resolver = _maybe_get_resolver(resolver) - assert parsed.hostname is not None # for mypy - answers = resolver.resolve_name(parsed.hostname, family) - bootstrap_address = random.choice(list(answers.addresses())) - return _http3( - q, - bootstrap_address, - url, - timeout, - port, - source, - source_port, - one_rr_per_rrset, - ignore_trailing, - verify=verify, - post=post, - ) - - if not have_doh: - raise NoDOH # pragma: no cover - if session and not isinstance(session, httpx.Client): - raise ValueError("session parameter must be an httpx.Client") - - wire = q.to_wire() - headers = {"accept": "application/dns-message"} - - h1 = http_version in (HTTPVersion.H1, HTTPVersion.DEFAULT) - h2 = http_version in (HTTPVersion.H2, HTTPVersion.DEFAULT) - - # set source port and source address - - if the_source is None: - local_address = None - local_port = 0 - else: - local_address = the_source[0] - local_port = the_source[1] - - if session: - cm: contextlib.AbstractContextManager = contextlib.nullcontext(session) - else: - transport = _HTTPTransport( - local_address=local_address, - http1=h1, - http2=h2, - verify=verify, - local_port=local_port, - bootstrap_address=bootstrap_address, - resolver=resolver, - family=family, - ) - - cm = httpx.Client(http1=h1, http2=h2, verify=verify, transport=transport) - with cm as session: - # see https://tools.ietf.org/html/rfc8484#section-4.1.1 for DoH - # GET and POST examples - if post: - headers.update( - { - "content-type": "application/dns-message", - "content-length": str(len(wire)), - } - ) - response = session.post( - url, - headers=headers, - content=wire, - timeout=timeout, - extensions=extensions, - ) - else: - wire = base64.urlsafe_b64encode(wire).rstrip(b"=") - twire = wire.decode() # httpx does a repr() if we give it bytes - response = session.get( - url, - headers=headers, - timeout=timeout, - params={"dns": twire}, - extensions=extensions, - ) - - # see https://tools.ietf.org/html/rfc8484#section-4.2.1 for info about DoH - # status codes - if response.status_code < 200 or response.status_code > 299: - raise ValueError( - f"{where} responded with status code {response.status_code}" - f"\nResponse body: {response.content}" - ) - r = dns.message.from_wire( - response.content, - keyring=q.keyring, - request_mac=q.request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - r.time = response.elapsed.total_seconds() - if not q.is_response(r): - raise BadResponse - return r - - -def _find_header(headers: dns.quic.Headers, name: bytes) -> bytes: - if headers is None: - raise KeyError - for header, value in headers: - if header == name: - return value - raise KeyError - - -def _check_status(headers: dns.quic.Headers, peer: str, wire: bytes) -> None: - value = _find_header(headers, b":status") - if value is None: - raise SyntaxError("no :status header in response") - status = int(value) - if status < 0: - raise SyntaxError("status is negative") - if status < 200 or status > 299: - error = "" - if len(wire) > 0: - try: - error = ": " + wire.decode() - except Exception: - pass - raise ValueError(f"{peer} responded with status code {status}{error}") - - -def _http3( - q: dns.message.Message, - where: str, - url: str, - timeout: Optional[float] = None, - port: int = 853, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - verify: Union[bool, str] = True, - hostname: Optional[str] = None, - post: bool = True, -) -> dns.message.Message: - if not dns.quic.have_quic: - raise NoDOH("DNS-over-HTTP3 is not available.") # pragma: no cover - - url_parts = urllib.parse.urlparse(url) - hostname = url_parts.hostname - if url_parts.port is not None: - port = url_parts.port - - q.id = 0 - wire = q.to_wire() - manager = dns.quic.SyncQuicManager( - verify_mode=verify, server_name=hostname, h3=True - ) - - with manager: - connection = manager.connect(where, port, source, source_port) - (start, expiration) = _compute_times(timeout) - with connection.make_stream(timeout) as stream: - stream.send_h3(url, wire, post) - wire = stream.receive(_remaining(expiration)) - _check_status(stream.headers(), where, wire) - finish = time.time() - r = dns.message.from_wire( - wire, - keyring=q.keyring, - request_mac=q.request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - r.time = max(finish - start, 0.0) - if not q.is_response(r): - raise BadResponse - return r - - -def _udp_recv(sock, max_size, expiration): - """Reads a datagram from the socket. - A Timeout exception will be raised if the operation is not completed - by the expiration time. - """ - while True: - try: - return sock.recvfrom(max_size) - except BlockingIOError: - _wait_for_readable(sock, expiration) - - -def _udp_send(sock, data, destination, expiration): - """Sends the specified datagram to destination over the socket. - A Timeout exception will be raised if the operation is not completed - by the expiration time. - """ - while True: - try: - if destination: - return sock.sendto(data, destination) - else: - return sock.send(data) - except BlockingIOError: # pragma: no cover - _wait_for_writable(sock, expiration) - - -def send_udp( - sock: Any, - what: Union[dns.message.Message, bytes], - destination: Any, - expiration: Optional[float] = None, -) -> Tuple[int, float]: - """Send a DNS message to the specified UDP socket. - - *sock*, a ``socket``. - - *what*, a ``bytes`` or ``dns.message.Message``, the message to send. - - *destination*, a destination tuple appropriate for the address family - of the socket, specifying where to send the query. - - *expiration*, a ``float`` or ``None``, the absolute time at which - a timeout exception should be raised. If ``None``, no timeout will - occur. - - Returns an ``(int, float)`` tuple of bytes sent and the sent time. - """ - - if isinstance(what, dns.message.Message): - what = what.to_wire() - sent_time = time.time() - n = _udp_send(sock, what, destination, expiration) - return (n, sent_time) - - -def receive_udp( - sock: Any, - destination: Optional[Any] = None, - expiration: Optional[float] = None, - ignore_unexpected: bool = False, - one_rr_per_rrset: bool = False, - keyring: Optional[Dict[dns.name.Name, dns.tsig.Key]] = None, - request_mac: Optional[bytes] = b"", - ignore_trailing: bool = False, - raise_on_truncation: bool = False, - ignore_errors: bool = False, - query: Optional[dns.message.Message] = None, -) -> Any: - """Read a DNS message from a UDP socket. - - *sock*, a ``socket``. - - *destination*, a destination tuple appropriate for the address family - of the socket, specifying where the message is expected to arrive from. - When receiving a response, this would be where the associated query was - sent. - - *expiration*, a ``float`` or ``None``, the absolute time at which - a timeout exception should be raised. If ``None``, no timeout will - occur. - - *ignore_unexpected*, a ``bool``. If ``True``, ignore responses from - unexpected sources. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own - RRset. - - *keyring*, a ``dict``, the keyring to use for TSIG. - - *request_mac*, a ``bytes`` or ``None``, the MAC of the request (for TSIG). - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing - junk at end of the received message. - - *raise_on_truncation*, a ``bool``. If ``True``, raise an exception if - the TC bit is set. - - Raises if the message is malformed, if network errors occur, of if - there is a timeout. - - If *destination* is not ``None``, returns a ``(dns.message.Message, float)`` - tuple of the received message and the received time. - - If *destination* is ``None``, returns a - ``(dns.message.Message, float, tuple)`` - tuple of the received message, the received time, and the address where - the message arrived from. - - *ignore_errors*, a ``bool``. If various format errors or response - mismatches occur, ignore them and keep listening for a valid response. - The default is ``False``. - - *query*, a ``dns.message.Message`` or ``None``. If not ``None`` and - *ignore_errors* is ``True``, check that the received message is a response - to this query, and if not keep listening for a valid response. - """ - - wire = b"" - while True: - (wire, from_address) = _udp_recv(sock, 65535, expiration) - if not _matches_destination( - sock.family, from_address, destination, ignore_unexpected - ): - continue - received_time = time.time() - try: - r = dns.message.from_wire( - wire, - keyring=keyring, - request_mac=request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - raise_on_truncation=raise_on_truncation, - ) - except dns.message.Truncated as e: - # If we got Truncated and not FORMERR, we at least got the header with TC - # set, and very likely the question section, so we'll re-raise if the - # message seems to be a response as we need to know when truncation happens. - # We need to check that it seems to be a response as we don't want a random - # injected message with TC set to cause us to bail out. - if ( - ignore_errors - and query is not None - and not query.is_response(e.message()) - ): - continue - else: - raise - except Exception: - if ignore_errors: - continue - else: - raise - if ignore_errors and query is not None and not query.is_response(r): - continue - if destination: - return (r, received_time) - else: - return (r, received_time, from_address) - - -def udp( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 53, - source: Optional[str] = None, - source_port: int = 0, - ignore_unexpected: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - raise_on_truncation: bool = False, - sock: Optional[Any] = None, - ignore_errors: bool = False, -) -> dns.message.Message: - """Return the response obtained after sending a query via UDP. - - *q*, a ``dns.message.Message``, the query to send - - *where*, a ``str`` containing an IPv4 or IPv6 address, where - to send the message. - - *timeout*, a ``float`` or ``None``, the number of seconds to wait before the - query times out. If ``None``, the default, wait forever. - - *port*, an ``int``, the port send the message to. The default is 53. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying - the source address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. - The default is 0. - - *ignore_unexpected*, a ``bool``. If ``True``, ignore responses from - unexpected sources. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own - RRset. - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing - junk at end of the received message. - - *raise_on_truncation*, a ``bool``. If ``True``, raise an exception if - the TC bit is set. - - *sock*, a ``socket.socket``, or ``None``, the socket to use for the - query. If ``None``, the default, a socket is created. Note that - if a socket is provided, it must be a nonblocking datagram socket, - and the *source* and *source_port* are ignored. - - *ignore_errors*, a ``bool``. If various format errors or response - mismatches occur, ignore them and keep listening for a valid response. - The default is ``False``. - - Returns a ``dns.message.Message``. - """ - - wire = q.to_wire() - (af, destination, source) = _destination_and_source( - where, port, source, source_port - ) - (begin_time, expiration) = _compute_times(timeout) - if sock: - cm: contextlib.AbstractContextManager = contextlib.nullcontext(sock) - else: - cm = _make_socket(af, socket.SOCK_DGRAM, source) - with cm as s: - send_udp(s, wire, destination, expiration) - (r, received_time) = receive_udp( - s, - destination, - expiration, - ignore_unexpected, - one_rr_per_rrset, - q.keyring, - q.mac, - ignore_trailing, - raise_on_truncation, - ignore_errors, - q, - ) - r.time = received_time - begin_time - # We don't need to check q.is_response() if we are in ignore_errors mode - # as receive_udp() will have checked it. - if not (ignore_errors or q.is_response(r)): - raise BadResponse - return r - assert ( - False # help mypy figure out we can't get here lgtm[py/unreachable-statement] - ) - - -def udp_with_fallback( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 53, - source: Optional[str] = None, - source_port: int = 0, - ignore_unexpected: bool = False, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - udp_sock: Optional[Any] = None, - tcp_sock: Optional[Any] = None, - ignore_errors: bool = False, -) -> Tuple[dns.message.Message, bool]: - """Return the response to the query, trying UDP first and falling back - to TCP if UDP results in a truncated response. - - *q*, a ``dns.message.Message``, the query to send - - *where*, a ``str`` containing an IPv4 or IPv6 address, where to send the message. - - *timeout*, a ``float`` or ``None``, the number of seconds to wait before the query - times out. If ``None``, the default, wait forever. - - *port*, an ``int``, the port send the message to. The default is 53. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying the source - address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. The default is - 0. - - *ignore_unexpected*, a ``bool``. If ``True``, ignore responses from unexpected - sources. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own RRset. - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing junk at end of the - received message. - - *udp_sock*, a ``socket.socket``, or ``None``, the socket to use for the UDP query. - If ``None``, the default, a socket is created. Note that if a socket is provided, - it must be a nonblocking datagram socket, and the *source* and *source_port* are - ignored for the UDP query. - - *tcp_sock*, a ``socket.socket``, or ``None``, the connected socket to use for the - TCP query. If ``None``, the default, a socket is created. Note that if a socket is - provided, it must be a nonblocking connected stream socket, and *where*, *source* - and *source_port* are ignored for the TCP query. - - *ignore_errors*, a ``bool``. If various format errors or response mismatches occur - while listening for UDP, ignore them and keep listening for a valid response. The - default is ``False``. - - Returns a (``dns.message.Message``, tcp) tuple where tcp is ``True`` if and only if - TCP was used. - """ - try: - response = udp( - q, - where, - timeout, - port, - source, - source_port, - ignore_unexpected, - one_rr_per_rrset, - ignore_trailing, - True, - udp_sock, - ignore_errors, - ) - return (response, False) - except dns.message.Truncated: - response = tcp( - q, - where, - timeout, - port, - source, - source_port, - one_rr_per_rrset, - ignore_trailing, - tcp_sock, - ) - return (response, True) - - -def _net_read(sock, count, expiration): - """Read the specified number of bytes from sock. Keep trying until we - either get the desired amount, or we hit EOF. - A Timeout exception will be raised if the operation is not completed - by the expiration time. - """ - s = b"" - while count > 0: - try: - n = sock.recv(count) - if n == b"": - raise EOFError("EOF") - count -= len(n) - s += n - except (BlockingIOError, ssl.SSLWantReadError): - _wait_for_readable(sock, expiration) - except ssl.SSLWantWriteError: # pragma: no cover - _wait_for_writable(sock, expiration) - return s - - -def _net_write(sock, data, expiration): - """Write the specified data to the socket. - A Timeout exception will be raised if the operation is not completed - by the expiration time. - """ - current = 0 - l = len(data) - while current < l: - try: - current += sock.send(data[current:]) - except (BlockingIOError, ssl.SSLWantWriteError): - _wait_for_writable(sock, expiration) - except ssl.SSLWantReadError: # pragma: no cover - _wait_for_readable(sock, expiration) - - -def send_tcp( - sock: Any, - what: Union[dns.message.Message, bytes], - expiration: Optional[float] = None, -) -> Tuple[int, float]: - """Send a DNS message to the specified TCP socket. - - *sock*, a ``socket``. - - *what*, a ``bytes`` or ``dns.message.Message``, the message to send. - - *expiration*, a ``float`` or ``None``, the absolute time at which - a timeout exception should be raised. If ``None``, no timeout will - occur. - - Returns an ``(int, float)`` tuple of bytes sent and the sent time. - """ - - if isinstance(what, dns.message.Message): - tcpmsg = what.to_wire(prepend_length=True) - else: - # copying the wire into tcpmsg is inefficient, but lets us - # avoid writev() or doing a short write that would get pushed - # onto the net - tcpmsg = len(what).to_bytes(2, "big") + what - sent_time = time.time() - _net_write(sock, tcpmsg, expiration) - return (len(tcpmsg), sent_time) - - -def receive_tcp( - sock: Any, - expiration: Optional[float] = None, - one_rr_per_rrset: bool = False, - keyring: Optional[Dict[dns.name.Name, dns.tsig.Key]] = None, - request_mac: Optional[bytes] = b"", - ignore_trailing: bool = False, -) -> Tuple[dns.message.Message, float]: - """Read a DNS message from a TCP socket. - - *sock*, a ``socket``. - - *expiration*, a ``float`` or ``None``, the absolute time at which - a timeout exception should be raised. If ``None``, no timeout will - occur. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own - RRset. - - *keyring*, a ``dict``, the keyring to use for TSIG. - - *request_mac*, a ``bytes`` or ``None``, the MAC of the request (for TSIG). - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing - junk at end of the received message. - - Raises if the message is malformed, if network errors occur, of if - there is a timeout. - - Returns a ``(dns.message.Message, float)`` tuple of the received message - and the received time. - """ - - ldata = _net_read(sock, 2, expiration) - (l,) = struct.unpack("!H", ldata) - wire = _net_read(sock, l, expiration) - received_time = time.time() - r = dns.message.from_wire( - wire, - keyring=keyring, - request_mac=request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - return (r, received_time) - - -def _connect(s, address, expiration): - err = s.connect_ex(address) - if err == 0: - return - if err in (errno.EINPROGRESS, errno.EWOULDBLOCK, errno.EALREADY): - _wait_for_writable(s, expiration) - err = s.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) - if err != 0: - raise OSError(err, os.strerror(err)) - - -def tcp( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 53, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - sock: Optional[Any] = None, -) -> dns.message.Message: - """Return the response obtained after sending a query via TCP. - - *q*, a ``dns.message.Message``, the query to send - - *where*, a ``str`` containing an IPv4 or IPv6 address, where - to send the message. - - *timeout*, a ``float`` or ``None``, the number of seconds to wait before the - query times out. If ``None``, the default, wait forever. - - *port*, an ``int``, the port send the message to. The default is 53. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying - the source address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. - The default is 0. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own - RRset. - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing - junk at end of the received message. - - *sock*, a ``socket.socket``, or ``None``, the connected socket to use for the - query. If ``None``, the default, a socket is created. Note that - if a socket is provided, it must be a nonblocking connected stream - socket, and *where*, *port*, *source* and *source_port* are ignored. - - Returns a ``dns.message.Message``. - """ - - wire = q.to_wire() - (begin_time, expiration) = _compute_times(timeout) - if sock: - cm: contextlib.AbstractContextManager = contextlib.nullcontext(sock) - else: - (af, destination, source) = _destination_and_source( - where, port, source, source_port - ) - cm = _make_socket(af, socket.SOCK_STREAM, source) - with cm as s: - if not sock: - # pylint: disable=possibly-used-before-assignment - _connect(s, destination, expiration) - send_tcp(s, wire, expiration) - (r, received_time) = receive_tcp( - s, expiration, one_rr_per_rrset, q.keyring, q.mac, ignore_trailing - ) - r.time = received_time - begin_time - if not q.is_response(r): - raise BadResponse - return r - assert ( - False # help mypy figure out we can't get here lgtm[py/unreachable-statement] - ) - - -def _tls_handshake(s, expiration): - while True: - try: - s.do_handshake() - return - except ssl.SSLWantReadError: - _wait_for_readable(s, expiration) - except ssl.SSLWantWriteError: # pragma: no cover - _wait_for_writable(s, expiration) - - -def _make_dot_ssl_context( - server_hostname: Optional[str], verify: Union[bool, str] -) -> ssl.SSLContext: - cafile: Optional[str] = None - capath: Optional[str] = None - if isinstance(verify, str): - if os.path.isfile(verify): - cafile = verify - elif os.path.isdir(verify): - capath = verify - else: - raise ValueError("invalid verify string") - ssl_context = ssl.create_default_context(cafile=cafile, capath=capath) - ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2 - if server_hostname is None: - ssl_context.check_hostname = False - ssl_context.set_alpn_protocols(["dot"]) - if verify is False: - ssl_context.verify_mode = ssl.CERT_NONE - return ssl_context - - -def tls( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 853, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - sock: Optional[ssl.SSLSocket] = None, - ssl_context: Optional[ssl.SSLContext] = None, - server_hostname: Optional[str] = None, - verify: Union[bool, str] = True, -) -> dns.message.Message: - """Return the response obtained after sending a query via TLS. - - *q*, a ``dns.message.Message``, the query to send - - *where*, a ``str`` containing an IPv4 or IPv6 address, where - to send the message. - - *timeout*, a ``float`` or ``None``, the number of seconds to wait before the - query times out. If ``None``, the default, wait forever. - - *port*, an ``int``, the port send the message to. The default is 853. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying - the source address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. - The default is 0. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own - RRset. - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing - junk at end of the received message. - - *sock*, an ``ssl.SSLSocket``, or ``None``, the socket to use for - the query. If ``None``, the default, a socket is created. Note - that if a socket is provided, it must be a nonblocking connected - SSL stream socket, and *where*, *port*, *source*, *source_port*, - and *ssl_context* are ignored. - - *ssl_context*, an ``ssl.SSLContext``, the context to use when establishing - a TLS connection. If ``None``, the default, creates one with the default - configuration. - - *server_hostname*, a ``str`` containing the server's hostname. The - default is ``None``, which means that no hostname is known, and if an - SSL context is created, hostname checking will be disabled. - - *verify*, a ``bool`` or ``str``. If a ``True``, then TLS certificate verification - of the server is done using the default CA bundle; if ``False``, then no - verification is done; if a `str` then it specifies the path to a certificate file or - directory which will be used for verification. - - Returns a ``dns.message.Message``. - - """ - - if sock: - # - # If a socket was provided, there's no special TLS handling needed. - # - return tcp( - q, - where, - timeout, - port, - source, - source_port, - one_rr_per_rrset, - ignore_trailing, - sock, - ) - - wire = q.to_wire() - (begin_time, expiration) = _compute_times(timeout) - (af, destination, source) = _destination_and_source( - where, port, source, source_port - ) - if ssl_context is None and not sock: - ssl_context = _make_dot_ssl_context(server_hostname, verify) - - with _make_socket( - af, - socket.SOCK_STREAM, - source, - ssl_context=ssl_context, - server_hostname=server_hostname, - ) as s: - _connect(s, destination, expiration) - _tls_handshake(s, expiration) - send_tcp(s, wire, expiration) - (r, received_time) = receive_tcp( - s, expiration, one_rr_per_rrset, q.keyring, q.mac, ignore_trailing - ) - r.time = received_time - begin_time - if not q.is_response(r): - raise BadResponse - return r - assert ( - False # help mypy figure out we can't get here lgtm[py/unreachable-statement] - ) - - -def quic( - q: dns.message.Message, - where: str, - timeout: Optional[float] = None, - port: int = 853, - source: Optional[str] = None, - source_port: int = 0, - one_rr_per_rrset: bool = False, - ignore_trailing: bool = False, - connection: Optional[dns.quic.SyncQuicConnection] = None, - verify: Union[bool, str] = True, - hostname: Optional[str] = None, - server_hostname: Optional[str] = None, -) -> dns.message.Message: - """Return the response obtained after sending a query via DNS-over-QUIC. - - *q*, a ``dns.message.Message``, the query to send. - - *where*, a ``str``, the nameserver IP address. - - *timeout*, a ``float`` or ``None``, the number of seconds to wait before the query - times out. If ``None``, the default, wait forever. - - *port*, a ``int``, the port to send the query to. The default is 853. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying the source - address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. The default is - 0. - - *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own RRset. - - *ignore_trailing*, a ``bool``. If ``True``, ignore trailing junk at end of the - received message. - - *connection*, a ``dns.quic.SyncQuicConnection``. If provided, the connection to use - to send the query. - - *verify*, a ``bool`` or ``str``. If a ``True``, then TLS certificate verification - of the server is done using the default CA bundle; if ``False``, then no - verification is done; if a `str` then it specifies the path to a certificate file or - directory which will be used for verification. - - *hostname*, a ``str`` containing the server's hostname or ``None``. The default is - ``None``, which means that no hostname is known, and if an SSL context is created, - hostname checking will be disabled. This value is ignored if *url* is not - ``None``. - - *server_hostname*, a ``str`` or ``None``. This item is for backwards compatibility - only, and has the same meaning as *hostname*. - - Returns a ``dns.message.Message``. - """ - - if not dns.quic.have_quic: - raise NoDOQ("DNS-over-QUIC is not available.") # pragma: no cover - - if server_hostname is not None and hostname is None: - hostname = server_hostname - - q.id = 0 - wire = q.to_wire() - the_connection: dns.quic.SyncQuicConnection - the_manager: dns.quic.SyncQuicManager - if connection: - manager: contextlib.AbstractContextManager = contextlib.nullcontext(None) - the_connection = connection - else: - manager = dns.quic.SyncQuicManager(verify_mode=verify, server_name=hostname) - the_manager = manager # for type checking happiness - - with manager: - if not connection: - the_connection = the_manager.connect(where, port, source, source_port) - (start, expiration) = _compute_times(timeout) - with the_connection.make_stream(timeout) as stream: - stream.send(wire, True) - wire = stream.receive(_remaining(expiration)) - finish = time.time() - r = dns.message.from_wire( - wire, - keyring=q.keyring, - request_mac=q.request_mac, - one_rr_per_rrset=one_rr_per_rrset, - ignore_trailing=ignore_trailing, - ) - r.time = max(finish - start, 0.0) - if not q.is_response(r): - raise BadResponse - return r - - -class UDPMode(enum.IntEnum): - """How should UDP be used in an IXFR from :py:func:`inbound_xfr()`? - - NEVER means "never use UDP; always use TCP" - TRY_FIRST means "try to use UDP but fall back to TCP if needed" - ONLY means "raise ``dns.xfr.UseTCP`` if trying UDP does not succeed" - """ - - NEVER = 0 - TRY_FIRST = 1 - ONLY = 2 - - -def _inbound_xfr( - txn_manager: dns.transaction.TransactionManager, - s: socket.socket, - query: dns.message.Message, - serial: Optional[int], - timeout: Optional[float], - expiration: float, -) -> Any: - """Given a socket, does the zone transfer.""" - rdtype = query.question[0].rdtype - is_ixfr = rdtype == dns.rdatatype.IXFR - origin = txn_manager.from_wire_origin() - wire = query.to_wire() - is_udp = s.type == socket.SOCK_DGRAM - if is_udp: - _udp_send(s, wire, None, expiration) - else: - tcpmsg = struct.pack("!H", len(wire)) + wire - _net_write(s, tcpmsg, expiration) - with dns.xfr.Inbound(txn_manager, rdtype, serial, is_udp) as inbound: - done = False - tsig_ctx = None - while not done: - (_, mexpiration) = _compute_times(timeout) - if mexpiration is None or ( - expiration is not None and mexpiration > expiration - ): - mexpiration = expiration - if is_udp: - (rwire, _) = _udp_recv(s, 65535, mexpiration) - else: - ldata = _net_read(s, 2, mexpiration) - (l,) = struct.unpack("!H", ldata) - rwire = _net_read(s, l, mexpiration) - r = dns.message.from_wire( - rwire, - keyring=query.keyring, - request_mac=query.mac, - xfr=True, - origin=origin, - tsig_ctx=tsig_ctx, - multi=(not is_udp), - one_rr_per_rrset=is_ixfr, - ) - done = inbound.process_message(r) - yield r - tsig_ctx = r.tsig_ctx - if query.keyring and not r.had_tsig: - raise dns.exception.FormError("missing TSIG") - - -def xfr( - where: str, - zone: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.AXFR, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - timeout: Optional[float] = None, - port: int = 53, - keyring: Optional[Dict[dns.name.Name, dns.tsig.Key]] = None, - keyname: Optional[Union[dns.name.Name, str]] = None, - relativize: bool = True, - lifetime: Optional[float] = None, - source: Optional[str] = None, - source_port: int = 0, - serial: int = 0, - use_udp: bool = False, - keyalgorithm: Union[dns.name.Name, str] = dns.tsig.default_algorithm, -) -> Any: - """Return a generator for the responses to a zone transfer. - - *where*, a ``str`` containing an IPv4 or IPv6 address, where - to send the message. - - *zone*, a ``dns.name.Name`` or ``str``, the name of the zone to transfer. - - *rdtype*, an ``int`` or ``str``, the type of zone transfer. The - default is ``dns.rdatatype.AXFR``. ``dns.rdatatype.IXFR`` can be - used to do an incremental transfer instead. - - *rdclass*, an ``int`` or ``str``, the class of the zone transfer. - The default is ``dns.rdataclass.IN``. - - *timeout*, a ``float``, the number of seconds to wait for each - response message. If None, the default, wait forever. - - *port*, an ``int``, the port send the message to. The default is 53. - - *keyring*, a ``dict``, the keyring to use for TSIG. - - *keyname*, a ``dns.name.Name`` or ``str``, the name of the TSIG - key to use. - - *relativize*, a ``bool``. If ``True``, all names in the zone will be - relativized to the zone origin. It is essential that the - relativize setting matches the one specified to - ``dns.zone.from_xfr()`` if using this generator to make a zone. - - *lifetime*, a ``float``, the total number of seconds to spend - doing the transfer. If ``None``, the default, then there is no - limit on the time the transfer may take. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying - the source address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. - The default is 0. - - *serial*, an ``int``, the SOA serial number to use as the base for - an IXFR diff sequence (only meaningful if *rdtype* is - ``dns.rdatatype.IXFR``). - - *use_udp*, a ``bool``. If ``True``, use UDP (only meaningful for IXFR). - - *keyalgorithm*, a ``dns.name.Name`` or ``str``, the TSIG algorithm to use. - - Raises on errors, and so does the generator. - - Returns a generator of ``dns.message.Message`` objects. - """ - - class DummyTransactionManager(dns.transaction.TransactionManager): - def __init__(self, origin, relativize): - self.info = (origin, relativize, dns.name.empty if relativize else origin) - - def origin_information(self): - return self.info - - def get_class(self) -> dns.rdataclass.RdataClass: - raise NotImplementedError # pragma: no cover - - def reader(self): - raise NotImplementedError # pragma: no cover - - def writer(self, replacement: bool = False) -> dns.transaction.Transaction: - class DummyTransaction: - def nop(self, *args, **kw): - pass - - def __getattr__(self, _): - return self.nop - - return cast(dns.transaction.Transaction, DummyTransaction()) - - if isinstance(zone, str): - zone = dns.name.from_text(zone) - rdtype = dns.rdatatype.RdataType.make(rdtype) - q = dns.message.make_query(zone, rdtype, rdclass) - if rdtype == dns.rdatatype.IXFR: - rrset = q.find_rrset( - q.authority, zone, dns.rdataclass.IN, dns.rdatatype.SOA, create=True - ) - soa = dns.rdata.from_text("IN", "SOA", ". . %u 0 0 0 0" % serial) - rrset.add(soa, 0) - if keyring is not None: - q.use_tsig(keyring, keyname, algorithm=keyalgorithm) - (af, destination, source) = _destination_and_source( - where, port, source, source_port - ) - (_, expiration) = _compute_times(lifetime) - tm = DummyTransactionManager(zone, relativize) - if use_udp and rdtype != dns.rdatatype.IXFR: - raise ValueError("cannot do a UDP AXFR") - sock_type = socket.SOCK_DGRAM if use_udp else socket.SOCK_STREAM - with _make_socket(af, sock_type, source) as s: - _connect(s, destination, expiration) - yield from _inbound_xfr(tm, s, q, serial, timeout, expiration) - - -def inbound_xfr( - where: str, - txn_manager: dns.transaction.TransactionManager, - query: Optional[dns.message.Message] = None, - port: int = 53, - timeout: Optional[float] = None, - lifetime: Optional[float] = None, - source: Optional[str] = None, - source_port: int = 0, - udp_mode: UDPMode = UDPMode.NEVER, -) -> None: - """Conduct an inbound transfer and apply it via a transaction from the - txn_manager. - - *where*, a ``str`` containing an IPv4 or IPv6 address, where - to send the message. - - *txn_manager*, a ``dns.transaction.TransactionManager``, the txn_manager - for this transfer (typically a ``dns.zone.Zone``). - - *query*, the query to send. If not supplied, a default query is - constructed using information from the *txn_manager*. - - *port*, an ``int``, the port send the message to. The default is 53. - - *timeout*, a ``float``, the number of seconds to wait for each - response message. If None, the default, wait forever. - - *lifetime*, a ``float``, the total number of seconds to spend - doing the transfer. If ``None``, the default, then there is no - limit on the time the transfer may take. - - *source*, a ``str`` containing an IPv4 or IPv6 address, specifying - the source address. The default is the wildcard address. - - *source_port*, an ``int``, the port from which to send the message. - The default is 0. - - *udp_mode*, a ``dns.query.UDPMode``, determines how UDP is used - for IXFRs. The default is ``dns.UDPMode.NEVER``, i.e. only use - TCP. Other possibilities are ``dns.UDPMode.TRY_FIRST``, which - means "try UDP but fallback to TCP if needed", and - ``dns.UDPMode.ONLY``, which means "try UDP and raise - ``dns.xfr.UseTCP`` if it does not succeed. - - Raises on errors. - """ - if query is None: - (query, serial) = dns.xfr.make_query(txn_manager) - else: - serial = dns.xfr.extract_serial_from_query(query) - - (af, destination, source) = _destination_and_source( - where, port, source, source_port - ) - (_, expiration) = _compute_times(lifetime) - if query.question[0].rdtype == dns.rdatatype.IXFR and udp_mode != UDPMode.NEVER: - with _make_socket(af, socket.SOCK_DGRAM, source) as s: - _connect(s, destination, expiration) - try: - for _ in _inbound_xfr( - txn_manager, s, query, serial, timeout, expiration - ): - pass - return - except dns.xfr.UseTCP: - if udp_mode == UDPMode.ONLY: - raise - - with _make_socket(af, socket.SOCK_STREAM, source) as s: - _connect(s, destination, expiration) - for _ in _inbound_xfr(txn_manager, s, query, serial, timeout, expiration): - pass diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/__init__.py b/write-message/venv/lib/python3.10/site-packages/dns/quic/__init__.py deleted file mode 100644 index 0750e72..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/quic/__init__.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -from typing import List, Tuple - -import dns._features -import dns.asyncbackend - -if dns._features.have("doq"): - import aioquic.quic.configuration # type: ignore - - from dns._asyncbackend import NullContext - from dns.quic._asyncio import ( - AsyncioQuicConnection, - AsyncioQuicManager, - AsyncioQuicStream, - ) - from dns.quic._common import AsyncQuicConnection, AsyncQuicManager - from dns.quic._sync import SyncQuicConnection, SyncQuicManager, SyncQuicStream - - have_quic = True - - def null_factory( - *args, # pylint: disable=unused-argument - **kwargs, # pylint: disable=unused-argument - ): - return NullContext(None) - - def _asyncio_manager_factory( - context, *args, **kwargs # pylint: disable=unused-argument - ): - return AsyncioQuicManager(*args, **kwargs) - - # We have a context factory and a manager factory as for trio we need to have - # a nursery. - - _async_factories = {"asyncio": (null_factory, _asyncio_manager_factory)} - - if dns._features.have("trio"): - import trio - - from dns.quic._trio import ( # pylint: disable=ungrouped-imports - TrioQuicConnection, - TrioQuicManager, - TrioQuicStream, - ) - - def _trio_context_factory(): - return trio.open_nursery() - - def _trio_manager_factory(context, *args, **kwargs): - return TrioQuicManager(context, *args, **kwargs) - - _async_factories["trio"] = (_trio_context_factory, _trio_manager_factory) - - def factories_for_backend(backend=None): - if backend is None: - backend = dns.asyncbackend.get_default_backend() - return _async_factories[backend.name()] - -else: # pragma: no cover - have_quic = False - - from typing import Any - - class AsyncQuicStream: # type: ignore - pass - - class AsyncQuicConnection: # type: ignore - async def make_stream(self) -> Any: - raise NotImplementedError - - class SyncQuicStream: # type: ignore - pass - - class SyncQuicConnection: # type: ignore - def make_stream(self) -> Any: - raise NotImplementedError - - -Headers = List[Tuple[bytes, bytes]] diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index c7d5f99..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_asyncio.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_asyncio.cpython-310.pyc deleted file mode 100644 index b2f732b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_asyncio.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_common.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_common.cpython-310.pyc deleted file mode 100644 index f9c3081..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_common.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_sync.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_sync.cpython-310.pyc deleted file mode 100644 index 8d1aa64..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_sync.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_trio.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_trio.cpython-310.pyc deleted file mode 100644 index cbb93d5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/quic/__pycache__/_trio.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/_asyncio.py b/write-message/venv/lib/python3.10/site-packages/dns/quic/_asyncio.py deleted file mode 100644 index f87515d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/quic/_asyncio.py +++ /dev/null @@ -1,267 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import asyncio -import socket -import ssl -import struct -import time - -import aioquic.quic.configuration # type: ignore -import aioquic.quic.connection # type: ignore -import aioquic.quic.events # type: ignore - -import dns.asyncbackend -import dns.exception -import dns.inet -from dns.quic._common import ( - QUIC_MAX_DATAGRAM, - AsyncQuicConnection, - AsyncQuicManager, - BaseQuicStream, - UnexpectedEOF, -) - - -class AsyncioQuicStream(BaseQuicStream): - def __init__(self, connection, stream_id): - super().__init__(connection, stream_id) - self._wake_up = asyncio.Condition() - - async def _wait_for_wake_up(self): - async with self._wake_up: - await self._wake_up.wait() - - async def wait_for(self, amount, expiration): - while True: - timeout = self._timeout_from_expiration(expiration) - if self._buffer.have(amount): - return - self._expecting = amount - try: - await asyncio.wait_for(self._wait_for_wake_up(), timeout) - except TimeoutError: - raise dns.exception.Timeout - self._expecting = 0 - - async def wait_for_end(self, expiration): - while True: - timeout = self._timeout_from_expiration(expiration) - if self._buffer.seen_end(): - return - try: - await asyncio.wait_for(self._wait_for_wake_up(), timeout) - except TimeoutError: - raise dns.exception.Timeout - - async def receive(self, timeout=None): - expiration = self._expiration_from_timeout(timeout) - if self._connection.is_h3(): - await self.wait_for_end(expiration) - return self._buffer.get_all() - else: - await self.wait_for(2, expiration) - (size,) = struct.unpack("!H", self._buffer.get(2)) - await self.wait_for(size, expiration) - return self._buffer.get(size) - - async def send(self, datagram, is_end=False): - data = self._encapsulate(datagram) - await self._connection.write(self._stream_id, data, is_end) - - async def _add_input(self, data, is_end): - if self._common_add_input(data, is_end): - async with self._wake_up: - self._wake_up.notify() - - async def close(self): - self._close() - - # Streams are async context managers - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_val, exc_tb): - await self.close() - async with self._wake_up: - self._wake_up.notify() - return False - - -class AsyncioQuicConnection(AsyncQuicConnection): - def __init__(self, connection, address, port, source, source_port, manager=None): - super().__init__(connection, address, port, source, source_port, manager) - self._socket = None - self._handshake_complete = asyncio.Event() - self._socket_created = asyncio.Event() - self._wake_timer = asyncio.Condition() - self._receiver_task = None - self._sender_task = None - self._wake_pending = False - - async def _receiver(self): - try: - af = dns.inet.af_for_address(self._address) - backend = dns.asyncbackend.get_backend("asyncio") - # Note that peer is a low-level address tuple, but make_socket() wants - # a high-level address tuple, so we convert. - self._socket = await backend.make_socket( - af, socket.SOCK_DGRAM, 0, self._source, (self._peer[0], self._peer[1]) - ) - self._socket_created.set() - async with self._socket: - while not self._done: - (datagram, address) = await self._socket.recvfrom( - QUIC_MAX_DATAGRAM, None - ) - if address[0] != self._peer[0] or address[1] != self._peer[1]: - continue - self._connection.receive_datagram(datagram, address, time.time()) - # Wake up the timer in case the sender is sleeping, as there may be - # stuff to send now. - await self._wakeup() - except Exception: - pass - finally: - self._done = True - await self._wakeup() - self._handshake_complete.set() - - async def _wakeup(self): - self._wake_pending = True - async with self._wake_timer: - self._wake_timer.notify_all() - - async def _wait_for_wake_timer(self): - async with self._wake_timer: - if not self._wake_pending: - await self._wake_timer.wait() - self._wake_pending = False - - async def _sender(self): - await self._socket_created.wait() - while not self._done: - datagrams = self._connection.datagrams_to_send(time.time()) - for datagram, address in datagrams: - assert address == self._peer - await self._socket.sendto(datagram, self._peer, None) - (expiration, interval) = self._get_timer_values() - try: - await asyncio.wait_for(self._wait_for_wake_timer(), interval) - except Exception: - pass - self._handle_timer(expiration) - await self._handle_events() - - async def _handle_events(self): - count = 0 - while True: - event = self._connection.next_event() - if event is None: - return - if isinstance(event, aioquic.quic.events.StreamDataReceived): - if self.is_h3(): - h3_events = self._h3_conn.handle_event(event) - for h3_event in h3_events: - if isinstance(h3_event, aioquic.h3.events.HeadersReceived): - stream = self._streams.get(event.stream_id) - if stream: - if stream._headers is None: - stream._headers = h3_event.headers - elif stream._trailers is None: - stream._trailers = h3_event.headers - if h3_event.stream_ended: - await stream._add_input(b"", True) - elif isinstance(h3_event, aioquic.h3.events.DataReceived): - stream = self._streams.get(event.stream_id) - if stream: - await stream._add_input( - h3_event.data, h3_event.stream_ended - ) - else: - stream = self._streams.get(event.stream_id) - if stream: - await stream._add_input(event.data, event.end_stream) - elif isinstance(event, aioquic.quic.events.HandshakeCompleted): - self._handshake_complete.set() - elif isinstance(event, aioquic.quic.events.ConnectionTerminated): - self._done = True - self._receiver_task.cancel() - elif isinstance(event, aioquic.quic.events.StreamReset): - stream = self._streams.get(event.stream_id) - if stream: - await stream._add_input(b"", True) - - count += 1 - if count > 10: - # yield - count = 0 - await asyncio.sleep(0) - - async def write(self, stream, data, is_end=False): - self._connection.send_stream_data(stream, data, is_end) - await self._wakeup() - - def run(self): - if self._closed: - return - self._receiver_task = asyncio.Task(self._receiver()) - self._sender_task = asyncio.Task(self._sender()) - - async def make_stream(self, timeout=None): - try: - await asyncio.wait_for(self._handshake_complete.wait(), timeout) - except TimeoutError: - raise dns.exception.Timeout - if self._done: - raise UnexpectedEOF - stream_id = self._connection.get_next_available_stream_id(False) - stream = AsyncioQuicStream(self, stream_id) - self._streams[stream_id] = stream - return stream - - async def close(self): - if not self._closed: - self._manager.closed(self._peer[0], self._peer[1]) - self._closed = True - self._connection.close() - # sender might be blocked on this, so set it - self._socket_created.set() - await self._wakeup() - try: - await self._receiver_task - except asyncio.CancelledError: - pass - try: - await self._sender_task - except asyncio.CancelledError: - pass - await self._socket.close() - - -class AsyncioQuicManager(AsyncQuicManager): - def __init__( - self, conf=None, verify_mode=ssl.CERT_REQUIRED, server_name=None, h3=False - ): - super().__init__(conf, verify_mode, AsyncioQuicConnection, server_name, h3) - - def connect( - self, address, port=853, source=None, source_port=0, want_session_ticket=True - ): - (connection, start) = self._connect( - address, port, source, source_port, want_session_ticket - ) - if start: - connection.run() - return connection - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_val, exc_tb): - # Copy the iterator into a list as exiting things will mutate the connections - # table. - connections = list(self._connections.values()) - for connection in connections: - await connection.close() - return False diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/_common.py b/write-message/venv/lib/python3.10/site-packages/dns/quic/_common.py deleted file mode 100644 index ce575b0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/quic/_common.py +++ /dev/null @@ -1,339 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import base64 -import copy -import functools -import socket -import struct -import time -import urllib -from typing import Any, Optional - -import aioquic.h3.connection # type: ignore -import aioquic.h3.events # type: ignore -import aioquic.quic.configuration # type: ignore -import aioquic.quic.connection # type: ignore - -import dns.inet - -QUIC_MAX_DATAGRAM = 2048 -MAX_SESSION_TICKETS = 8 -# If we hit the max sessions limit we will delete this many of the oldest connections. -# The value must be a integer > 0 and <= MAX_SESSION_TICKETS. -SESSIONS_TO_DELETE = MAX_SESSION_TICKETS // 4 - - -class UnexpectedEOF(Exception): - pass - - -class Buffer: - def __init__(self): - self._buffer = b"" - self._seen_end = False - - def put(self, data, is_end): - if self._seen_end: - return - self._buffer += data - if is_end: - self._seen_end = True - - def have(self, amount): - if len(self._buffer) >= amount: - return True - if self._seen_end: - raise UnexpectedEOF - return False - - def seen_end(self): - return self._seen_end - - def get(self, amount): - assert self.have(amount) - data = self._buffer[:amount] - self._buffer = self._buffer[amount:] - return data - - def get_all(self): - assert self.seen_end() - data = self._buffer - self._buffer = b"" - return data - - -class BaseQuicStream: - def __init__(self, connection, stream_id): - self._connection = connection - self._stream_id = stream_id - self._buffer = Buffer() - self._expecting = 0 - self._headers = None - self._trailers = None - - def id(self): - return self._stream_id - - def headers(self): - return self._headers - - def trailers(self): - return self._trailers - - def _expiration_from_timeout(self, timeout): - if timeout is not None: - expiration = time.time() + timeout - else: - expiration = None - return expiration - - def _timeout_from_expiration(self, expiration): - if expiration is not None: - timeout = max(expiration - time.time(), 0.0) - else: - timeout = None - return timeout - - # Subclass must implement receive() as sync / async and which returns a message - # or raises. - - # Subclass must implement send() as sync / async and which takes a message and - # an EOF indicator. - - def send_h3(self, url, datagram, post=True): - if not self._connection.is_h3(): - raise SyntaxError("cannot send H3 to a non-H3 connection") - url_parts = urllib.parse.urlparse(url) - path = url_parts.path.encode() - if post: - method = b"POST" - else: - method = b"GET" - path += b"?dns=" + base64.urlsafe_b64encode(datagram).rstrip(b"=") - headers = [ - (b":method", method), - (b":scheme", url_parts.scheme.encode()), - (b":authority", url_parts.netloc.encode()), - (b":path", path), - (b"accept", b"application/dns-message"), - ] - if post: - headers.extend( - [ - (b"content-type", b"application/dns-message"), - (b"content-length", str(len(datagram)).encode()), - ] - ) - self._connection.send_headers(self._stream_id, headers, not post) - if post: - self._connection.send_data(self._stream_id, datagram, True) - - def _encapsulate(self, datagram): - if self._connection.is_h3(): - return datagram - l = len(datagram) - return struct.pack("!H", l) + datagram - - def _common_add_input(self, data, is_end): - self._buffer.put(data, is_end) - try: - return ( - self._expecting > 0 and self._buffer.have(self._expecting) - ) or self._buffer.seen_end - except UnexpectedEOF: - return True - - def _close(self): - self._connection.close_stream(self._stream_id) - self._buffer.put(b"", True) # send EOF in case we haven't seen it. - - -class BaseQuicConnection: - def __init__( - self, - connection, - address, - port, - source=None, - source_port=0, - manager=None, - ): - self._done = False - self._connection = connection - self._address = address - self._port = port - self._closed = False - self._manager = manager - self._streams = {} - if manager.is_h3(): - self._h3_conn = aioquic.h3.connection.H3Connection(connection, False) - else: - self._h3_conn = None - self._af = dns.inet.af_for_address(address) - self._peer = dns.inet.low_level_address_tuple((address, port)) - if source is None and source_port != 0: - if self._af == socket.AF_INET: - source = "0.0.0.0" - elif self._af == socket.AF_INET6: - source = "::" - else: - raise NotImplementedError - if source: - self._source = (source, source_port) - else: - self._source = None - - def is_h3(self): - return self._h3_conn is not None - - def close_stream(self, stream_id): - del self._streams[stream_id] - - def send_headers(self, stream_id, headers, is_end=False): - self._h3_conn.send_headers(stream_id, headers, is_end) - - def send_data(self, stream_id, data, is_end=False): - self._h3_conn.send_data(stream_id, data, is_end) - - def _get_timer_values(self, closed_is_special=True): - now = time.time() - expiration = self._connection.get_timer() - if expiration is None: - expiration = now + 3600 # arbitrary "big" value - interval = max(expiration - now, 0) - if self._closed and closed_is_special: - # lower sleep interval to avoid a race in the closing process - # which can lead to higher latency closing due to sleeping when - # we have events. - interval = min(interval, 0.05) - return (expiration, interval) - - def _handle_timer(self, expiration): - now = time.time() - if expiration <= now: - self._connection.handle_timer(now) - - -class AsyncQuicConnection(BaseQuicConnection): - async def make_stream(self, timeout: Optional[float] = None) -> Any: - pass - - -class BaseQuicManager: - def __init__( - self, conf, verify_mode, connection_factory, server_name=None, h3=False - ): - self._connections = {} - self._connection_factory = connection_factory - self._session_tickets = {} - self._tokens = {} - self._h3 = h3 - if conf is None: - verify_path = None - if isinstance(verify_mode, str): - verify_path = verify_mode - verify_mode = True - if h3: - alpn_protocols = ["h3"] - else: - alpn_protocols = ["doq", "doq-i03"] - conf = aioquic.quic.configuration.QuicConfiguration( - alpn_protocols=alpn_protocols, - verify_mode=verify_mode, - server_name=server_name, - ) - if verify_path is not None: - conf.load_verify_locations(verify_path) - self._conf = conf - - def _connect( - self, - address, - port=853, - source=None, - source_port=0, - want_session_ticket=True, - want_token=True, - ): - connection = self._connections.get((address, port)) - if connection is not None: - return (connection, False) - conf = self._conf - if want_session_ticket: - try: - session_ticket = self._session_tickets.pop((address, port)) - # We found a session ticket, so make a configuration that uses it. - conf = copy.copy(conf) - conf.session_ticket = session_ticket - except KeyError: - # No session ticket. - pass - # Whether or not we found a session ticket, we want a handler to save - # one. - session_ticket_handler = functools.partial( - self.save_session_ticket, address, port - ) - else: - session_ticket_handler = None - if want_token: - try: - token = self._tokens.pop((address, port)) - # We found a token, so make a configuration that uses it. - conf = copy.copy(conf) - conf.token = token - except KeyError: - # No token - pass - # Whether or not we found a token, we want a handler to save # one. - token_handler = functools.partial(self.save_token, address, port) - else: - token_handler = None - - qconn = aioquic.quic.connection.QuicConnection( - configuration=conf, - session_ticket_handler=session_ticket_handler, - token_handler=token_handler, - ) - lladdress = dns.inet.low_level_address_tuple((address, port)) - qconn.connect(lladdress, time.time()) - connection = self._connection_factory( - qconn, address, port, source, source_port, self - ) - self._connections[(address, port)] = connection - return (connection, True) - - def closed(self, address, port): - try: - del self._connections[(address, port)] - except KeyError: - pass - - def is_h3(self): - return self._h3 - - def save_session_ticket(self, address, port, ticket): - # We rely on dictionaries keys() being in insertion order here. We - # can't just popitem() as that would be LIFO which is the opposite of - # what we want. - l = len(self._session_tickets) - if l >= MAX_SESSION_TICKETS: - keys_to_delete = list(self._session_tickets.keys())[0:SESSIONS_TO_DELETE] - for key in keys_to_delete: - del self._session_tickets[key] - self._session_tickets[(address, port)] = ticket - - def save_token(self, address, port, token): - # We rely on dictionaries keys() being in insertion order here. We - # can't just popitem() as that would be LIFO which is the opposite of - # what we want. - l = len(self._tokens) - if l >= MAX_SESSION_TICKETS: - keys_to_delete = list(self._tokens.keys())[0:SESSIONS_TO_DELETE] - for key in keys_to_delete: - del self._tokens[key] - self._tokens[(address, port)] = token - - -class AsyncQuicManager(BaseQuicManager): - def connect(self, address, port=853, source=None, source_port=0): - raise NotImplementedError diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/_sync.py b/write-message/venv/lib/python3.10/site-packages/dns/quic/_sync.py deleted file mode 100644 index 473d1f4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/quic/_sync.py +++ /dev/null @@ -1,295 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import selectors -import socket -import ssl -import struct -import threading -import time - -import aioquic.quic.configuration # type: ignore -import aioquic.quic.connection # type: ignore -import aioquic.quic.events # type: ignore - -import dns.exception -import dns.inet -from dns.quic._common import ( - QUIC_MAX_DATAGRAM, - BaseQuicConnection, - BaseQuicManager, - BaseQuicStream, - UnexpectedEOF, -) - -# Function used to create a socket. Can be overridden if needed in special -# situations. -socket_factory = socket.socket - - -class SyncQuicStream(BaseQuicStream): - def __init__(self, connection, stream_id): - super().__init__(connection, stream_id) - self._wake_up = threading.Condition() - self._lock = threading.Lock() - - def wait_for(self, amount, expiration): - while True: - timeout = self._timeout_from_expiration(expiration) - with self._lock: - if self._buffer.have(amount): - return - self._expecting = amount - with self._wake_up: - if not self._wake_up.wait(timeout): - raise dns.exception.Timeout - self._expecting = 0 - - def wait_for_end(self, expiration): - while True: - timeout = self._timeout_from_expiration(expiration) - with self._lock: - if self._buffer.seen_end(): - return - with self._wake_up: - if not self._wake_up.wait(timeout): - raise dns.exception.Timeout - - def receive(self, timeout=None): - expiration = self._expiration_from_timeout(timeout) - if self._connection.is_h3(): - self.wait_for_end(expiration) - with self._lock: - return self._buffer.get_all() - else: - self.wait_for(2, expiration) - with self._lock: - (size,) = struct.unpack("!H", self._buffer.get(2)) - self.wait_for(size, expiration) - with self._lock: - return self._buffer.get(size) - - def send(self, datagram, is_end=False): - data = self._encapsulate(datagram) - self._connection.write(self._stream_id, data, is_end) - - def _add_input(self, data, is_end): - if self._common_add_input(data, is_end): - with self._wake_up: - self._wake_up.notify() - - def close(self): - with self._lock: - self._close() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self.close() - with self._wake_up: - self._wake_up.notify() - return False - - -class SyncQuicConnection(BaseQuicConnection): - def __init__(self, connection, address, port, source, source_port, manager): - super().__init__(connection, address, port, source, source_port, manager) - self._socket = socket_factory(self._af, socket.SOCK_DGRAM, 0) - if self._source is not None: - try: - self._socket.bind( - dns.inet.low_level_address_tuple(self._source, self._af) - ) - except Exception: - self._socket.close() - raise - self._socket.connect(self._peer) - (self._send_wakeup, self._receive_wakeup) = socket.socketpair() - self._receive_wakeup.setblocking(False) - self._socket.setblocking(False) - self._handshake_complete = threading.Event() - self._worker_thread = None - self._lock = threading.Lock() - - def _read(self): - count = 0 - while count < 10: - count += 1 - try: - datagram = self._socket.recv(QUIC_MAX_DATAGRAM) - except BlockingIOError: - return - with self._lock: - self._connection.receive_datagram(datagram, self._peer, time.time()) - - def _drain_wakeup(self): - while True: - try: - self._receive_wakeup.recv(32) - except BlockingIOError: - return - - def _worker(self): - try: - sel = selectors.DefaultSelector() - sel.register(self._socket, selectors.EVENT_READ, self._read) - sel.register(self._receive_wakeup, selectors.EVENT_READ, self._drain_wakeup) - while not self._done: - (expiration, interval) = self._get_timer_values(False) - items = sel.select(interval) - for key, _ in items: - key.data() - with self._lock: - self._handle_timer(expiration) - self._handle_events() - with self._lock: - datagrams = self._connection.datagrams_to_send(time.time()) - for datagram, _ in datagrams: - try: - self._socket.send(datagram) - except BlockingIOError: - # we let QUIC handle any lossage - pass - finally: - with self._lock: - self._done = True - self._socket.close() - # Ensure anyone waiting for this gets woken up. - self._handshake_complete.set() - - def _handle_events(self): - while True: - with self._lock: - event = self._connection.next_event() - if event is None: - return - if isinstance(event, aioquic.quic.events.StreamDataReceived): - if self.is_h3(): - h3_events = self._h3_conn.handle_event(event) - for h3_event in h3_events: - if isinstance(h3_event, aioquic.h3.events.HeadersReceived): - with self._lock: - stream = self._streams.get(event.stream_id) - if stream: - if stream._headers is None: - stream._headers = h3_event.headers - elif stream._trailers is None: - stream._trailers = h3_event.headers - if h3_event.stream_ended: - stream._add_input(b"", True) - elif isinstance(h3_event, aioquic.h3.events.DataReceived): - with self._lock: - stream = self._streams.get(event.stream_id) - if stream: - stream._add_input(h3_event.data, h3_event.stream_ended) - else: - with self._lock: - stream = self._streams.get(event.stream_id) - if stream: - stream._add_input(event.data, event.end_stream) - elif isinstance(event, aioquic.quic.events.HandshakeCompleted): - self._handshake_complete.set() - elif isinstance(event, aioquic.quic.events.ConnectionTerminated): - with self._lock: - self._done = True - elif isinstance(event, aioquic.quic.events.StreamReset): - with self._lock: - stream = self._streams.get(event.stream_id) - if stream: - stream._add_input(b"", True) - - def write(self, stream, data, is_end=False): - with self._lock: - self._connection.send_stream_data(stream, data, is_end) - self._send_wakeup.send(b"\x01") - - def send_headers(self, stream_id, headers, is_end=False): - with self._lock: - super().send_headers(stream_id, headers, is_end) - if is_end: - self._send_wakeup.send(b"\x01") - - def send_data(self, stream_id, data, is_end=False): - with self._lock: - super().send_data(stream_id, data, is_end) - if is_end: - self._send_wakeup.send(b"\x01") - - def run(self): - if self._closed: - return - self._worker_thread = threading.Thread(target=self._worker) - self._worker_thread.start() - - def make_stream(self, timeout=None): - if not self._handshake_complete.wait(timeout): - raise dns.exception.Timeout - with self._lock: - if self._done: - raise UnexpectedEOF - stream_id = self._connection.get_next_available_stream_id(False) - stream = SyncQuicStream(self, stream_id) - self._streams[stream_id] = stream - return stream - - def close_stream(self, stream_id): - with self._lock: - super().close_stream(stream_id) - - def close(self): - with self._lock: - if self._closed: - return - self._manager.closed(self._peer[0], self._peer[1]) - self._closed = True - self._connection.close() - self._send_wakeup.send(b"\x01") - self._worker_thread.join() - - -class SyncQuicManager(BaseQuicManager): - def __init__( - self, conf=None, verify_mode=ssl.CERT_REQUIRED, server_name=None, h3=False - ): - super().__init__(conf, verify_mode, SyncQuicConnection, server_name, h3) - self._lock = threading.Lock() - - def connect( - self, - address, - port=853, - source=None, - source_port=0, - want_session_ticket=True, - want_token=True, - ): - with self._lock: - (connection, start) = self._connect( - address, port, source, source_port, want_session_ticket, want_token - ) - if start: - connection.run() - return connection - - def closed(self, address, port): - with self._lock: - super().closed(address, port) - - def save_session_ticket(self, address, port, ticket): - with self._lock: - super().save_session_ticket(address, port, ticket) - - def save_token(self, address, port, token): - with self._lock: - super().save_token(address, port, token) - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - # Copy the iterator into a list as exiting things will mutate the connections - # table. - connections = list(self._connections.values()) - for connection in connections: - connection.close() - return False diff --git a/write-message/venv/lib/python3.10/site-packages/dns/quic/_trio.py b/write-message/venv/lib/python3.10/site-packages/dns/quic/_trio.py deleted file mode 100644 index ae79f36..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/quic/_trio.py +++ /dev/null @@ -1,246 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import socket -import ssl -import struct -import time - -import aioquic.quic.configuration # type: ignore -import aioquic.quic.connection # type: ignore -import aioquic.quic.events # type: ignore -import trio - -import dns.exception -import dns.inet -from dns._asyncbackend import NullContext -from dns.quic._common import ( - QUIC_MAX_DATAGRAM, - AsyncQuicConnection, - AsyncQuicManager, - BaseQuicStream, - UnexpectedEOF, -) - - -class TrioQuicStream(BaseQuicStream): - def __init__(self, connection, stream_id): - super().__init__(connection, stream_id) - self._wake_up = trio.Condition() - - async def wait_for(self, amount): - while True: - if self._buffer.have(amount): - return - self._expecting = amount - async with self._wake_up: - await self._wake_up.wait() - self._expecting = 0 - - async def wait_for_end(self): - while True: - if self._buffer.seen_end(): - return - async with self._wake_up: - await self._wake_up.wait() - - async def receive(self, timeout=None): - if timeout is None: - context = NullContext(None) - else: - context = trio.move_on_after(timeout) - with context: - if self._connection.is_h3(): - await self.wait_for_end() - return self._buffer.get_all() - else: - await self.wait_for(2) - (size,) = struct.unpack("!H", self._buffer.get(2)) - await self.wait_for(size) - return self._buffer.get(size) - raise dns.exception.Timeout - - async def send(self, datagram, is_end=False): - data = self._encapsulate(datagram) - await self._connection.write(self._stream_id, data, is_end) - - async def _add_input(self, data, is_end): - if self._common_add_input(data, is_end): - async with self._wake_up: - self._wake_up.notify() - - async def close(self): - self._close() - - # Streams are async context managers - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_val, exc_tb): - await self.close() - async with self._wake_up: - self._wake_up.notify() - return False - - -class TrioQuicConnection(AsyncQuicConnection): - def __init__(self, connection, address, port, source, source_port, manager=None): - super().__init__(connection, address, port, source, source_port, manager) - self._socket = trio.socket.socket(self._af, socket.SOCK_DGRAM, 0) - self._handshake_complete = trio.Event() - self._run_done = trio.Event() - self._worker_scope = None - self._send_pending = False - - async def _worker(self): - try: - if self._source: - await self._socket.bind( - dns.inet.low_level_address_tuple(self._source, self._af) - ) - await self._socket.connect(self._peer) - while not self._done: - (expiration, interval) = self._get_timer_values(False) - if self._send_pending: - # Do not block forever if sends are pending. Even though we - # have a wake-up mechanism if we've already started the blocking - # read, the possibility of context switching in send means that - # more writes can happen while we have no wake up context, so - # we need self._send_pending to avoid (effectively) a "lost wakeup" - # race. - interval = 0.0 - with trio.CancelScope( - deadline=trio.current_time() + interval - ) as self._worker_scope: - datagram = await self._socket.recv(QUIC_MAX_DATAGRAM) - self._connection.receive_datagram(datagram, self._peer, time.time()) - self._worker_scope = None - self._handle_timer(expiration) - await self._handle_events() - # We clear this now, before sending anything, as sending can cause - # context switches that do more sends. We want to know if that - # happens so we don't block a long time on the recv() above. - self._send_pending = False - datagrams = self._connection.datagrams_to_send(time.time()) - for datagram, _ in datagrams: - await self._socket.send(datagram) - finally: - self._done = True - self._socket.close() - self._handshake_complete.set() - - async def _handle_events(self): - count = 0 - while True: - event = self._connection.next_event() - if event is None: - return - if isinstance(event, aioquic.quic.events.StreamDataReceived): - if self.is_h3(): - h3_events = self._h3_conn.handle_event(event) - for h3_event in h3_events: - if isinstance(h3_event, aioquic.h3.events.HeadersReceived): - stream = self._streams.get(event.stream_id) - if stream: - if stream._headers is None: - stream._headers = h3_event.headers - elif stream._trailers is None: - stream._trailers = h3_event.headers - if h3_event.stream_ended: - await stream._add_input(b"", True) - elif isinstance(h3_event, aioquic.h3.events.DataReceived): - stream = self._streams.get(event.stream_id) - if stream: - await stream._add_input( - h3_event.data, h3_event.stream_ended - ) - else: - stream = self._streams.get(event.stream_id) - if stream: - await stream._add_input(event.data, event.end_stream) - elif isinstance(event, aioquic.quic.events.HandshakeCompleted): - self._handshake_complete.set() - elif isinstance(event, aioquic.quic.events.ConnectionTerminated): - self._done = True - self._socket.close() - elif isinstance(event, aioquic.quic.events.StreamReset): - stream = self._streams.get(event.stream_id) - if stream: - await stream._add_input(b"", True) - count += 1 - if count > 10: - # yield - count = 0 - await trio.sleep(0) - - async def write(self, stream, data, is_end=False): - self._connection.send_stream_data(stream, data, is_end) - self._send_pending = True - if self._worker_scope is not None: - self._worker_scope.cancel() - - async def run(self): - if self._closed: - return - async with trio.open_nursery() as nursery: - nursery.start_soon(self._worker) - self._run_done.set() - - async def make_stream(self, timeout=None): - if timeout is None: - context = NullContext(None) - else: - context = trio.move_on_after(timeout) - with context: - await self._handshake_complete.wait() - if self._done: - raise UnexpectedEOF - stream_id = self._connection.get_next_available_stream_id(False) - stream = TrioQuicStream(self, stream_id) - self._streams[stream_id] = stream - return stream - raise dns.exception.Timeout - - async def close(self): - if not self._closed: - self._manager.closed(self._peer[0], self._peer[1]) - self._closed = True - self._connection.close() - self._send_pending = True - if self._worker_scope is not None: - self._worker_scope.cancel() - await self._run_done.wait() - - -class TrioQuicManager(AsyncQuicManager): - def __init__( - self, - nursery, - conf=None, - verify_mode=ssl.CERT_REQUIRED, - server_name=None, - h3=False, - ): - super().__init__(conf, verify_mode, TrioQuicConnection, server_name, h3) - self._nursery = nursery - - def connect( - self, address, port=853, source=None, source_port=0, want_session_ticket=True - ): - (connection, start) = self._connect( - address, port, source, source_port, want_session_ticket - ) - if start: - self._nursery.start_soon(connection.run) - return connection - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_val, exc_tb): - # Copy the iterator into a list as exiting things will mutate the connections - # table. - connections = list(self._connections.values()) - for connection in connections: - await connection.close() - return False diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rcode.py b/write-message/venv/lib/python3.10/site-packages/dns/rcode.py deleted file mode 100644 index 8e6386f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rcode.py +++ /dev/null @@ -1,168 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Result Codes.""" - -from typing import Tuple - -import dns.enum -import dns.exception - - -class Rcode(dns.enum.IntEnum): - #: No error - NOERROR = 0 - #: Format error - FORMERR = 1 - #: Server failure - SERVFAIL = 2 - #: Name does not exist ("Name Error" in RFC 1025 terminology). - NXDOMAIN = 3 - #: Not implemented - NOTIMP = 4 - #: Refused - REFUSED = 5 - #: Name exists. - YXDOMAIN = 6 - #: RRset exists. - YXRRSET = 7 - #: RRset does not exist. - NXRRSET = 8 - #: Not authoritative. - NOTAUTH = 9 - #: Name not in zone. - NOTZONE = 10 - #: DSO-TYPE Not Implemented - DSOTYPENI = 11 - #: Bad EDNS version. - BADVERS = 16 - #: TSIG Signature Failure - BADSIG = 16 - #: Key not recognized. - BADKEY = 17 - #: Signature out of time window. - BADTIME = 18 - #: Bad TKEY Mode. - BADMODE = 19 - #: Duplicate key name. - BADNAME = 20 - #: Algorithm not supported. - BADALG = 21 - #: Bad Truncation - BADTRUNC = 22 - #: Bad/missing Server Cookie - BADCOOKIE = 23 - - @classmethod - def _maximum(cls): - return 4095 - - @classmethod - def _unknown_exception_class(cls): - return UnknownRcode - - -class UnknownRcode(dns.exception.DNSException): - """A DNS rcode is unknown.""" - - -def from_text(text: str) -> Rcode: - """Convert text into an rcode. - - *text*, a ``str``, the textual rcode or an integer in textual form. - - Raises ``dns.rcode.UnknownRcode`` if the rcode mnemonic is unknown. - - Returns a ``dns.rcode.Rcode``. - """ - - return Rcode.from_text(text) - - -def from_flags(flags: int, ednsflags: int) -> Rcode: - """Return the rcode value encoded by flags and ednsflags. - - *flags*, an ``int``, the DNS flags field. - - *ednsflags*, an ``int``, the EDNS flags field. - - Raises ``ValueError`` if rcode is < 0 or > 4095 - - Returns a ``dns.rcode.Rcode``. - """ - - value = (flags & 0x000F) | ((ednsflags >> 20) & 0xFF0) - return Rcode.make(value) - - -def to_flags(value: Rcode) -> Tuple[int, int]: - """Return a (flags, ednsflags) tuple which encodes the rcode. - - *value*, a ``dns.rcode.Rcode``, the rcode. - - Raises ``ValueError`` if rcode is < 0 or > 4095. - - Returns an ``(int, int)`` tuple. - """ - - if value < 0 or value > 4095: - raise ValueError("rcode must be >= 0 and <= 4095") - v = value & 0xF - ev = (value & 0xFF0) << 20 - return (v, ev) - - -def to_text(value: Rcode, tsig: bool = False) -> str: - """Convert rcode into text. - - *value*, a ``dns.rcode.Rcode``, the rcode. - - Raises ``ValueError`` if rcode is < 0 or > 4095. - - Returns a ``str``. - """ - - if tsig and value == Rcode.BADVERS: - return "BADSIG" - return Rcode.to_text(value) - - -### BEGIN generated Rcode constants - -NOERROR = Rcode.NOERROR -FORMERR = Rcode.FORMERR -SERVFAIL = Rcode.SERVFAIL -NXDOMAIN = Rcode.NXDOMAIN -NOTIMP = Rcode.NOTIMP -REFUSED = Rcode.REFUSED -YXDOMAIN = Rcode.YXDOMAIN -YXRRSET = Rcode.YXRRSET -NXRRSET = Rcode.NXRRSET -NOTAUTH = Rcode.NOTAUTH -NOTZONE = Rcode.NOTZONE -DSOTYPENI = Rcode.DSOTYPENI -BADVERS = Rcode.BADVERS -BADSIG = Rcode.BADSIG -BADKEY = Rcode.BADKEY -BADTIME = Rcode.BADTIME -BADMODE = Rcode.BADMODE -BADNAME = Rcode.BADNAME -BADALG = Rcode.BADALG -BADTRUNC = Rcode.BADTRUNC -BADCOOKIE = Rcode.BADCOOKIE - -### END generated Rcode constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdata.py b/write-message/venv/lib/python3.10/site-packages/dns/rdata.py deleted file mode 100644 index 8099c26..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdata.py +++ /dev/null @@ -1,911 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS rdata.""" - -import base64 -import binascii -import inspect -import io -import itertools -import random -from importlib import import_module -from typing import Any, Dict, Optional, Tuple, Union - -import dns.exception -import dns.immutable -import dns.ipv4 -import dns.ipv6 -import dns.name -import dns.rdataclass -import dns.rdatatype -import dns.tokenizer -import dns.ttl -import dns.wire - -_chunksize = 32 - -# We currently allow comparisons for rdata with relative names for backwards -# compatibility, but in the future we will not, as these kinds of comparisons -# can lead to subtle bugs if code is not carefully written. -# -# This switch allows the future behavior to be turned on so code can be -# tested with it. -_allow_relative_comparisons = True - - -class NoRelativeRdataOrdering(dns.exception.DNSException): - """An attempt was made to do an ordered comparison of one or more - rdata with relative names. The only reliable way of sorting rdata - is to use non-relativized rdata. - - """ - - -def _wordbreak(data, chunksize=_chunksize, separator=b" "): - """Break a binary string into chunks of chunksize characters separated by - a space. - """ - - if not chunksize: - return data.decode() - return separator.join( - [data[i : i + chunksize] for i in range(0, len(data), chunksize)] - ).decode() - - -# pylint: disable=unused-argument - - -def _hexify(data, chunksize=_chunksize, separator=b" ", **kw): - """Convert a binary string into its hex encoding, broken up into chunks - of chunksize characters separated by a separator. - """ - - return _wordbreak(binascii.hexlify(data), chunksize, separator) - - -def _base64ify(data, chunksize=_chunksize, separator=b" ", **kw): - """Convert a binary string into its base64 encoding, broken up into chunks - of chunksize characters separated by a separator. - """ - - return _wordbreak(base64.b64encode(data), chunksize, separator) - - -# pylint: enable=unused-argument - -__escaped = b'"\\' - - -def _escapify(qstring): - """Escape the characters in a quoted string which need it.""" - - if isinstance(qstring, str): - qstring = qstring.encode() - if not isinstance(qstring, bytearray): - qstring = bytearray(qstring) - - text = "" - for c in qstring: - if c in __escaped: - text += "\\" + chr(c) - elif c >= 0x20 and c < 0x7F: - text += chr(c) - else: - text += "\\%03d" % c - return text - - -def _truncate_bitmap(what): - """Determine the index of greatest byte that isn't all zeros, and - return the bitmap that contains all the bytes less than that index. - """ - - for i in range(len(what) - 1, -1, -1): - if what[i] != 0: - return what[0 : i + 1] - return what[0:1] - - -# So we don't have to edit all the rdata classes... -_constify = dns.immutable.constify - - -@dns.immutable.immutable -class Rdata: - """Base class for all DNS rdata types.""" - - __slots__ = ["rdclass", "rdtype", "rdcomment"] - - def __init__(self, rdclass, rdtype): - """Initialize an rdata. - - *rdclass*, an ``int`` is the rdataclass of the Rdata. - - *rdtype*, an ``int`` is the rdatatype of the Rdata. - """ - - self.rdclass = self._as_rdataclass(rdclass) - self.rdtype = self._as_rdatatype(rdtype) - self.rdcomment = None - - def _get_all_slots(self): - return itertools.chain.from_iterable( - getattr(cls, "__slots__", []) for cls in self.__class__.__mro__ - ) - - def __getstate__(self): - # We used to try to do a tuple of all slots here, but it - # doesn't work as self._all_slots isn't available at - # __setstate__() time. Before that we tried to store a tuple - # of __slots__, but that didn't work as it didn't store the - # slots defined by ancestors. This older way didn't fail - # outright, but ended up with partially broken objects, e.g. - # if you unpickled an A RR it wouldn't have rdclass and rdtype - # attributes, and would compare badly. - state = {} - for slot in self._get_all_slots(): - state[slot] = getattr(self, slot) - return state - - def __setstate__(self, state): - for slot, val in state.items(): - object.__setattr__(self, slot, val) - if not hasattr(self, "rdcomment"): - # Pickled rdata from 2.0.x might not have a rdcomment, so add - # it if needed. - object.__setattr__(self, "rdcomment", None) - - def covers(self) -> dns.rdatatype.RdataType: - """Return the type a Rdata covers. - - DNS SIG/RRSIG rdatas apply to a specific type; this type is - returned by the covers() function. If the rdata type is not - SIG or RRSIG, dns.rdatatype.NONE is returned. This is useful when - creating rdatasets, allowing the rdataset to contain only RRSIGs - of a particular type, e.g. RRSIG(NS). - - Returns a ``dns.rdatatype.RdataType``. - """ - - return dns.rdatatype.NONE - - def extended_rdatatype(self) -> int: - """Return a 32-bit type value, the least significant 16 bits of - which are the ordinary DNS type, and the upper 16 bits of which are - the "covered" type, if any. - - Returns an ``int``. - """ - - return self.covers() << 16 | self.rdtype - - def to_text( - self, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - **kw: Dict[str, Any], - ) -> str: - """Convert an rdata to text format. - - Returns a ``str``. - """ - - raise NotImplementedError # pragma: no cover - - def _to_wire( - self, - file: Optional[Any], - compress: Optional[dns.name.CompressType] = None, - origin: Optional[dns.name.Name] = None, - canonicalize: bool = False, - ) -> None: - raise NotImplementedError # pragma: no cover - - def to_wire( - self, - file: Optional[Any] = None, - compress: Optional[dns.name.CompressType] = None, - origin: Optional[dns.name.Name] = None, - canonicalize: bool = False, - ) -> Optional[bytes]: - """Convert an rdata to wire format. - - Returns a ``bytes`` if no output file was specified, or ``None`` otherwise. - """ - - if file: - # We call _to_wire() and then return None explicitly instead of - # of just returning the None from _to_wire() as mypy's func-returns-value - # unhelpfully errors out with "error: "_to_wire" of "Rdata" does not return - # a value (it only ever returns None)" - self._to_wire(file, compress, origin, canonicalize) - return None - else: - f = io.BytesIO() - self._to_wire(f, compress, origin, canonicalize) - return f.getvalue() - - def to_generic( - self, origin: Optional[dns.name.Name] = None - ) -> "dns.rdata.GenericRdata": - """Creates a dns.rdata.GenericRdata equivalent of this rdata. - - Returns a ``dns.rdata.GenericRdata``. - """ - return dns.rdata.GenericRdata( - self.rdclass, self.rdtype, self.to_wire(origin=origin) - ) - - def to_digestable(self, origin: Optional[dns.name.Name] = None) -> bytes: - """Convert rdata to a format suitable for digesting in hashes. This - is also the DNSSEC canonical form. - - Returns a ``bytes``. - """ - wire = self.to_wire(origin=origin, canonicalize=True) - assert wire is not None # for mypy - return wire - - def __repr__(self): - covers = self.covers() - if covers == dns.rdatatype.NONE: - ctext = "" - else: - ctext = "(" + dns.rdatatype.to_text(covers) + ")" - return ( - "" - ) - - def __str__(self): - return self.to_text() - - def _cmp(self, other): - """Compare an rdata with another rdata of the same rdtype and - rdclass. - - For rdata with only absolute names: - Return < 0 if self < other in the DNSSEC ordering, 0 if self - == other, and > 0 if self > other. - For rdata with at least one relative names: - The rdata sorts before any rdata with only absolute names. - When compared with another relative rdata, all names are - made absolute as if they were relative to the root, as the - proper origin is not available. While this creates a stable - ordering, it is NOT guaranteed to be the DNSSEC ordering. - In the future, all ordering comparisons for rdata with - relative names will be disallowed. - """ - try: - our = self.to_digestable() - our_relative = False - except dns.name.NeedAbsoluteNameOrOrigin: - if _allow_relative_comparisons: - our = self.to_digestable(dns.name.root) - our_relative = True - try: - their = other.to_digestable() - their_relative = False - except dns.name.NeedAbsoluteNameOrOrigin: - if _allow_relative_comparisons: - their = other.to_digestable(dns.name.root) - their_relative = True - if _allow_relative_comparisons: - if our_relative != their_relative: - # For the purpose of comparison, all rdata with at least one - # relative name is less than an rdata with only absolute names. - if our_relative: - return -1 - else: - return 1 - elif our_relative or their_relative: - raise NoRelativeRdataOrdering - if our == their: - return 0 - elif our > their: - return 1 - else: - return -1 - - def __eq__(self, other): - if not isinstance(other, Rdata): - return False - if self.rdclass != other.rdclass or self.rdtype != other.rdtype: - return False - our_relative = False - their_relative = False - try: - our = self.to_digestable() - except dns.name.NeedAbsoluteNameOrOrigin: - our = self.to_digestable(dns.name.root) - our_relative = True - try: - their = other.to_digestable() - except dns.name.NeedAbsoluteNameOrOrigin: - their = other.to_digestable(dns.name.root) - their_relative = True - if our_relative != their_relative: - return False - return our == their - - def __ne__(self, other): - if not isinstance(other, Rdata): - return True - if self.rdclass != other.rdclass or self.rdtype != other.rdtype: - return True - return not self.__eq__(other) - - def __lt__(self, other): - if ( - not isinstance(other, Rdata) - or self.rdclass != other.rdclass - or self.rdtype != other.rdtype - ): - return NotImplemented - return self._cmp(other) < 0 - - def __le__(self, other): - if ( - not isinstance(other, Rdata) - or self.rdclass != other.rdclass - or self.rdtype != other.rdtype - ): - return NotImplemented - return self._cmp(other) <= 0 - - def __ge__(self, other): - if ( - not isinstance(other, Rdata) - or self.rdclass != other.rdclass - or self.rdtype != other.rdtype - ): - return NotImplemented - return self._cmp(other) >= 0 - - def __gt__(self, other): - if ( - not isinstance(other, Rdata) - or self.rdclass != other.rdclass - or self.rdtype != other.rdtype - ): - return NotImplemented - return self._cmp(other) > 0 - - def __hash__(self): - return hash(self.to_digestable(dns.name.root)) - - @classmethod - def from_text( - cls, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - tok: dns.tokenizer.Tokenizer, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - relativize_to: Optional[dns.name.Name] = None, - ) -> "Rdata": - raise NotImplementedError # pragma: no cover - - @classmethod - def from_wire_parser( - cls, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - parser: dns.wire.Parser, - origin: Optional[dns.name.Name] = None, - ) -> "Rdata": - raise NotImplementedError # pragma: no cover - - def replace(self, **kwargs: Any) -> "Rdata": - """ - Create a new Rdata instance based on the instance replace was - invoked on. It is possible to pass different parameters to - override the corresponding properties of the base Rdata. - - Any field specific to the Rdata type can be replaced, but the - *rdtype* and *rdclass* fields cannot. - - Returns an instance of the same Rdata subclass as *self*. - """ - - # Get the constructor parameters. - parameters = inspect.signature(self.__init__).parameters # type: ignore - - # Ensure that all of the arguments correspond to valid fields. - # Don't allow rdclass or rdtype to be changed, though. - for key in kwargs: - if key == "rdcomment": - continue - if key not in parameters: - raise AttributeError( - f"'{self.__class__.__name__}' object has no attribute '{key}'" - ) - if key in ("rdclass", "rdtype"): - raise AttributeError( - f"Cannot overwrite '{self.__class__.__name__}' attribute '{key}'" - ) - - # Construct the parameter list. For each field, use the value in - # kwargs if present, and the current value otherwise. - args = (kwargs.get(key, getattr(self, key)) for key in parameters) - - # Create, validate, and return the new object. - rd = self.__class__(*args) - # The comment is not set in the constructor, so give it special - # handling. - rdcomment = kwargs.get("rdcomment", self.rdcomment) - if rdcomment is not None: - object.__setattr__(rd, "rdcomment", rdcomment) - return rd - - # Type checking and conversion helpers. These are class methods as - # they don't touch object state and may be useful to others. - - @classmethod - def _as_rdataclass(cls, value): - return dns.rdataclass.RdataClass.make(value) - - @classmethod - def _as_rdatatype(cls, value): - return dns.rdatatype.RdataType.make(value) - - @classmethod - def _as_bytes( - cls, - value: Any, - encode: bool = False, - max_length: Optional[int] = None, - empty_ok: bool = True, - ) -> bytes: - if encode and isinstance(value, str): - bvalue = value.encode() - elif isinstance(value, bytearray): - bvalue = bytes(value) - elif isinstance(value, bytes): - bvalue = value - else: - raise ValueError("not bytes") - if max_length is not None and len(bvalue) > max_length: - raise ValueError("too long") - if not empty_ok and len(bvalue) == 0: - raise ValueError("empty bytes not allowed") - return bvalue - - @classmethod - def _as_name(cls, value): - # Note that proper name conversion (e.g. with origin and IDNA - # awareness) is expected to be done via from_text. This is just - # a simple thing for people invoking the constructor directly. - if isinstance(value, str): - return dns.name.from_text(value) - elif not isinstance(value, dns.name.Name): - raise ValueError("not a name") - return value - - @classmethod - def _as_uint8(cls, value): - if not isinstance(value, int): - raise ValueError("not an integer") - if value < 0 or value > 255: - raise ValueError("not a uint8") - return value - - @classmethod - def _as_uint16(cls, value): - if not isinstance(value, int): - raise ValueError("not an integer") - if value < 0 or value > 65535: - raise ValueError("not a uint16") - return value - - @classmethod - def _as_uint32(cls, value): - if not isinstance(value, int): - raise ValueError("not an integer") - if value < 0 or value > 4294967295: - raise ValueError("not a uint32") - return value - - @classmethod - def _as_uint48(cls, value): - if not isinstance(value, int): - raise ValueError("not an integer") - if value < 0 or value > 281474976710655: - raise ValueError("not a uint48") - return value - - @classmethod - def _as_int(cls, value, low=None, high=None): - if not isinstance(value, int): - raise ValueError("not an integer") - if low is not None and value < low: - raise ValueError("value too small") - if high is not None and value > high: - raise ValueError("value too large") - return value - - @classmethod - def _as_ipv4_address(cls, value): - if isinstance(value, str): - return dns.ipv4.canonicalize(value) - elif isinstance(value, bytes): - return dns.ipv4.inet_ntoa(value) - else: - raise ValueError("not an IPv4 address") - - @classmethod - def _as_ipv6_address(cls, value): - if isinstance(value, str): - return dns.ipv6.canonicalize(value) - elif isinstance(value, bytes): - return dns.ipv6.inet_ntoa(value) - else: - raise ValueError("not an IPv6 address") - - @classmethod - def _as_bool(cls, value): - if isinstance(value, bool): - return value - else: - raise ValueError("not a boolean") - - @classmethod - def _as_ttl(cls, value): - if isinstance(value, int): - return cls._as_int(value, 0, dns.ttl.MAX_TTL) - elif isinstance(value, str): - return dns.ttl.from_text(value) - else: - raise ValueError("not a TTL") - - @classmethod - def _as_tuple(cls, value, as_value): - try: - # For user convenience, if value is a singleton of the list - # element type, wrap it in a tuple. - return (as_value(value),) - except Exception: - # Otherwise, check each element of the iterable *value* - # against *as_value*. - return tuple(as_value(v) for v in value) - - # Processing order - - @classmethod - def _processing_order(cls, iterable): - items = list(iterable) - random.shuffle(items) - return items - - -@dns.immutable.immutable -class GenericRdata(Rdata): - """Generic Rdata Class - - This class is used for rdata types for which we have no better - implementation. It implements the DNS "unknown RRs" scheme. - """ - - __slots__ = ["data"] - - def __init__(self, rdclass, rdtype, data): - super().__init__(rdclass, rdtype) - self.data = data - - def to_text( - self, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - **kw: Dict[str, Any], - ) -> str: - return r"\# %d " % len(self.data) + _hexify(self.data, **kw) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - token = tok.get() - if not token.is_identifier() or token.value != r"\#": - raise dns.exception.SyntaxError(r"generic rdata does not start with \#") - length = tok.get_int() - hex = tok.concatenate_remaining_identifiers(True).encode() - data = binascii.unhexlify(hex) - if len(data) != length: - raise dns.exception.SyntaxError("generic rdata hex data has wrong length") - return cls(rdclass, rdtype, data) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(self.data) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - return cls(rdclass, rdtype, parser.get_remaining()) - - -_rdata_classes: Dict[Tuple[dns.rdataclass.RdataClass, dns.rdatatype.RdataType], Any] = ( - {} -) -_module_prefix = "dns.rdtypes" -_dynamic_load_allowed = True - - -def get_rdata_class(rdclass, rdtype, use_generic=True): - cls = _rdata_classes.get((rdclass, rdtype)) - if not cls: - cls = _rdata_classes.get((dns.rdatatype.ANY, rdtype)) - if not cls and _dynamic_load_allowed: - rdclass_text = dns.rdataclass.to_text(rdclass) - rdtype_text = dns.rdatatype.to_text(rdtype) - rdtype_text = rdtype_text.replace("-", "_") - try: - mod = import_module( - ".".join([_module_prefix, rdclass_text, rdtype_text]) - ) - cls = getattr(mod, rdtype_text) - _rdata_classes[(rdclass, rdtype)] = cls - except ImportError: - try: - mod = import_module(".".join([_module_prefix, "ANY", rdtype_text])) - cls = getattr(mod, rdtype_text) - _rdata_classes[(dns.rdataclass.ANY, rdtype)] = cls - _rdata_classes[(rdclass, rdtype)] = cls - except ImportError: - pass - if not cls and use_generic: - cls = GenericRdata - _rdata_classes[(rdclass, rdtype)] = cls - return cls - - -def load_all_types(disable_dynamic_load=True): - """Load all rdata types for which dnspython has a non-generic implementation. - - Normally dnspython loads DNS rdatatype implementations on demand, but in some - specialized cases loading all types at an application-controlled time is preferred. - - If *disable_dynamic_load*, a ``bool``, is ``True`` then dnspython will not attempt - to use its dynamic loading mechanism if an unknown type is subsequently encountered, - and will simply use the ``GenericRdata`` class. - """ - # Load class IN and ANY types. - for rdtype in dns.rdatatype.RdataType: - get_rdata_class(dns.rdataclass.IN, rdtype, False) - # Load the one non-ANY implementation we have in CH. Everything - # else in CH is an ANY type, and we'll discover those on demand but won't - # have to import anything. - get_rdata_class(dns.rdataclass.CH, dns.rdatatype.A, False) - if disable_dynamic_load: - # Now disable dynamic loading so any subsequent unknown type immediately becomes - # GenericRdata without a load attempt. - global _dynamic_load_allowed - _dynamic_load_allowed = False - - -def from_text( - rdclass: Union[dns.rdataclass.RdataClass, str], - rdtype: Union[dns.rdatatype.RdataType, str], - tok: Union[dns.tokenizer.Tokenizer, str], - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - relativize_to: Optional[dns.name.Name] = None, - idna_codec: Optional[dns.name.IDNACodec] = None, -) -> Rdata: - """Build an rdata object from text format. - - This function attempts to dynamically load a class which - implements the specified rdata class and type. If there is no - class-and-type-specific implementation, the GenericRdata class - is used. - - Once a class is chosen, its from_text() class method is called - with the parameters to this function. - - If *tok* is a ``str``, then a tokenizer is created and the string - is used as its input. - - *rdclass*, a ``dns.rdataclass.RdataClass`` or ``str``, the rdataclass. - - *rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdatatype. - - *tok*, a ``dns.tokenizer.Tokenizer`` or a ``str``. - - *origin*, a ``dns.name.Name`` (or ``None``), the - origin to use for relative names. - - *relativize*, a ``bool``. If true, name will be relativized. - - *relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use - when relativizing names. If not set, the *origin* value will be used. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder to use if a tokenizer needs to be created. If - ``None``, the default IDNA 2003 encoder/decoder is used. If a - tokenizer is not created, then the codec associated with the tokenizer - is the one that is used. - - Returns an instance of the chosen Rdata subclass. - - """ - if isinstance(tok, str): - tok = dns.tokenizer.Tokenizer(tok, idna_codec=idna_codec) - rdclass = dns.rdataclass.RdataClass.make(rdclass) - rdtype = dns.rdatatype.RdataType.make(rdtype) - cls = get_rdata_class(rdclass, rdtype) - with dns.exception.ExceptionWrapper(dns.exception.SyntaxError): - rdata = None - if cls != GenericRdata: - # peek at first token - token = tok.get() - tok.unget(token) - if token.is_identifier() and token.value == r"\#": - # - # Known type using the generic syntax. Extract the - # wire form from the generic syntax, and then run - # from_wire on it. - # - grdata = GenericRdata.from_text( - rdclass, rdtype, tok, origin, relativize, relativize_to - ) - rdata = from_wire( - rdclass, rdtype, grdata.data, 0, len(grdata.data), origin - ) - # - # If this comparison isn't equal, then there must have been - # compressed names in the wire format, which is an error, - # there being no reasonable context to decompress with. - # - rwire = rdata.to_wire() - if rwire != grdata.data: - raise dns.exception.SyntaxError( - "compressed data in " - "generic syntax form " - "of known rdatatype" - ) - if rdata is None: - rdata = cls.from_text( - rdclass, rdtype, tok, origin, relativize, relativize_to - ) - token = tok.get_eol_as_token() - if token.comment is not None: - object.__setattr__(rdata, "rdcomment", token.comment) - return rdata - - -def from_wire_parser( - rdclass: Union[dns.rdataclass.RdataClass, str], - rdtype: Union[dns.rdatatype.RdataType, str], - parser: dns.wire.Parser, - origin: Optional[dns.name.Name] = None, -) -> Rdata: - """Build an rdata object from wire format - - This function attempts to dynamically load a class which - implements the specified rdata class and type. If there is no - class-and-type-specific implementation, the GenericRdata class - is used. - - Once a class is chosen, its from_wire() class method is called - with the parameters to this function. - - *rdclass*, a ``dns.rdataclass.RdataClass`` or ``str``, the rdataclass. - - *rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdatatype. - - *parser*, a ``dns.wire.Parser``, the parser, which should be - restricted to the rdata length. - - *origin*, a ``dns.name.Name`` (or ``None``). If not ``None``, - then names will be relativized to this origin. - - Returns an instance of the chosen Rdata subclass. - """ - - rdclass = dns.rdataclass.RdataClass.make(rdclass) - rdtype = dns.rdatatype.RdataType.make(rdtype) - cls = get_rdata_class(rdclass, rdtype) - with dns.exception.ExceptionWrapper(dns.exception.FormError): - return cls.from_wire_parser(rdclass, rdtype, parser, origin) - - -def from_wire( - rdclass: Union[dns.rdataclass.RdataClass, str], - rdtype: Union[dns.rdatatype.RdataType, str], - wire: bytes, - current: int, - rdlen: int, - origin: Optional[dns.name.Name] = None, -) -> Rdata: - """Build an rdata object from wire format - - This function attempts to dynamically load a class which - implements the specified rdata class and type. If there is no - class-and-type-specific implementation, the GenericRdata class - is used. - - Once a class is chosen, its from_wire() class method is called - with the parameters to this function. - - *rdclass*, an ``int``, the rdataclass. - - *rdtype*, an ``int``, the rdatatype. - - *wire*, a ``bytes``, the wire-format message. - - *current*, an ``int``, the offset in wire of the beginning of - the rdata. - - *rdlen*, an ``int``, the length of the wire-format rdata - - *origin*, a ``dns.name.Name`` (or ``None``). If not ``None``, - then names will be relativized to this origin. - - Returns an instance of the chosen Rdata subclass. - """ - parser = dns.wire.Parser(wire, current) - with parser.restrict_to(rdlen): - return from_wire_parser(rdclass, rdtype, parser, origin) - - -class RdatatypeExists(dns.exception.DNSException): - """DNS rdatatype already exists.""" - - supp_kwargs = {"rdclass", "rdtype"} - fmt = ( - "The rdata type with class {rdclass:d} and rdtype {rdtype:d} " - + "already exists." - ) - - -def register_type( - implementation: Any, - rdtype: int, - rdtype_text: str, - is_singleton: bool = False, - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, -) -> None: - """Dynamically register a module to handle an rdatatype. - - *implementation*, a module implementing the type in the usual dnspython - way. - - *rdtype*, an ``int``, the rdatatype to register. - - *rdtype_text*, a ``str``, the textual form of the rdatatype. - - *is_singleton*, a ``bool``, indicating if the type is a singleton (i.e. - RRsets of the type can have only one member.) - - *rdclass*, the rdataclass of the type, or ``dns.rdataclass.ANY`` if - it applies to all classes. - """ - - rdtype = dns.rdatatype.RdataType.make(rdtype) - existing_cls = get_rdata_class(rdclass, rdtype) - if existing_cls != GenericRdata or dns.rdatatype.is_metatype(rdtype): - raise RdatatypeExists(rdclass=rdclass, rdtype=rdtype) - _rdata_classes[(rdclass, rdtype)] = getattr( - implementation, rdtype_text.replace("-", "_") - ) - dns.rdatatype.register_type(rdtype, rdtype_text, is_singleton) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdataclass.py b/write-message/venv/lib/python3.10/site-packages/dns/rdataclass.py deleted file mode 100644 index 89b85a7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdataclass.py +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Rdata Classes.""" - -import dns.enum -import dns.exception - - -class RdataClass(dns.enum.IntEnum): - """DNS Rdata Class""" - - RESERVED0 = 0 - IN = 1 - INTERNET = IN - CH = 3 - CHAOS = CH - HS = 4 - HESIOD = HS - NONE = 254 - ANY = 255 - - @classmethod - def _maximum(cls): - return 65535 - - @classmethod - def _short_name(cls): - return "class" - - @classmethod - def _prefix(cls): - return "CLASS" - - @classmethod - def _unknown_exception_class(cls): - return UnknownRdataclass - - -_metaclasses = {RdataClass.NONE, RdataClass.ANY} - - -class UnknownRdataclass(dns.exception.DNSException): - """A DNS class is unknown.""" - - -def from_text(text: str) -> RdataClass: - """Convert text into a DNS rdata class value. - - The input text can be a defined DNS RR class mnemonic or - instance of the DNS generic class syntax. - - For example, "IN" and "CLASS1" will both result in a value of 1. - - Raises ``dns.rdatatype.UnknownRdataclass`` if the class is unknown. - - Raises ``ValueError`` if the rdata class value is not >= 0 and <= 65535. - - Returns a ``dns.rdataclass.RdataClass``. - """ - - return RdataClass.from_text(text) - - -def to_text(value: RdataClass) -> str: - """Convert a DNS rdata class value to text. - - If the value has a known mnemonic, it will be used, otherwise the - DNS generic class syntax will be used. - - Raises ``ValueError`` if the rdata class value is not >= 0 and <= 65535. - - Returns a ``str``. - """ - - return RdataClass.to_text(value) - - -def is_metaclass(rdclass: RdataClass) -> bool: - """True if the specified class is a metaclass. - - The currently defined metaclasses are ANY and NONE. - - *rdclass* is a ``dns.rdataclass.RdataClass``. - """ - - if rdclass in _metaclasses: - return True - return False - - -### BEGIN generated RdataClass constants - -RESERVED0 = RdataClass.RESERVED0 -IN = RdataClass.IN -INTERNET = RdataClass.INTERNET -CH = RdataClass.CH -CHAOS = RdataClass.CHAOS -HS = RdataClass.HS -HESIOD = RdataClass.HESIOD -NONE = RdataClass.NONE -ANY = RdataClass.ANY - -### END generated RdataClass constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdataset.py b/write-message/venv/lib/python3.10/site-packages/dns/rdataset.py deleted file mode 100644 index 39cab23..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdataset.py +++ /dev/null @@ -1,512 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS rdatasets (an rdataset is a set of rdatas of a given type and class)""" - -import io -import random -import struct -from typing import Any, Collection, Dict, List, Optional, Union, cast - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdataclass -import dns.rdatatype -import dns.renderer -import dns.set -import dns.ttl - -# define SimpleSet here for backwards compatibility -SimpleSet = dns.set.Set - - -class DifferingCovers(dns.exception.DNSException): - """An attempt was made to add a DNS SIG/RRSIG whose covered type - is not the same as that of the other rdatas in the rdataset.""" - - -class IncompatibleTypes(dns.exception.DNSException): - """An attempt was made to add DNS RR data of an incompatible type.""" - - -class Rdataset(dns.set.Set): - """A DNS rdataset.""" - - __slots__ = ["rdclass", "rdtype", "covers", "ttl"] - - def __init__( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - ttl: int = 0, - ): - """Create a new rdataset of the specified class and type. - - *rdclass*, a ``dns.rdataclass.RdataClass``, the rdataclass. - - *rdtype*, an ``dns.rdatatype.RdataType``, the rdatatype. - - *covers*, an ``dns.rdatatype.RdataType``, the covered rdatatype. - - *ttl*, an ``int``, the TTL. - """ - - super().__init__() - self.rdclass = rdclass - self.rdtype: dns.rdatatype.RdataType = rdtype - self.covers: dns.rdatatype.RdataType = covers - self.ttl = ttl - - def _clone(self): - obj = super()._clone() - obj.rdclass = self.rdclass - obj.rdtype = self.rdtype - obj.covers = self.covers - obj.ttl = self.ttl - return obj - - def update_ttl(self, ttl: int) -> None: - """Perform TTL minimization. - - Set the TTL of the rdataset to be the lesser of the set's current - TTL or the specified TTL. If the set contains no rdatas, set the TTL - to the specified TTL. - - *ttl*, an ``int`` or ``str``. - """ - ttl = dns.ttl.make(ttl) - if len(self) == 0: - self.ttl = ttl - elif ttl < self.ttl: - self.ttl = ttl - - def add( # pylint: disable=arguments-differ,arguments-renamed - self, rd: dns.rdata.Rdata, ttl: Optional[int] = None - ) -> None: - """Add the specified rdata to the rdataset. - - If the optional *ttl* parameter is supplied, then - ``self.update_ttl(ttl)`` will be called prior to adding the rdata. - - *rd*, a ``dns.rdata.Rdata``, the rdata - - *ttl*, an ``int``, the TTL. - - Raises ``dns.rdataset.IncompatibleTypes`` if the type and class - do not match the type and class of the rdataset. - - Raises ``dns.rdataset.DifferingCovers`` if the type is a signature - type and the covered type does not match that of the rdataset. - """ - - # - # If we're adding a signature, do some special handling to - # check that the signature covers the same type as the - # other rdatas in this rdataset. If this is the first rdata - # in the set, initialize the covers field. - # - if self.rdclass != rd.rdclass or self.rdtype != rd.rdtype: - raise IncompatibleTypes - if ttl is not None: - self.update_ttl(ttl) - if self.rdtype == dns.rdatatype.RRSIG or self.rdtype == dns.rdatatype.SIG: - covers = rd.covers() - if len(self) == 0 and self.covers == dns.rdatatype.NONE: - self.covers = covers - elif self.covers != covers: - raise DifferingCovers - if dns.rdatatype.is_singleton(rd.rdtype) and len(self) > 0: - self.clear() - super().add(rd) - - def union_update(self, other): - self.update_ttl(other.ttl) - super().union_update(other) - - def intersection_update(self, other): - self.update_ttl(other.ttl) - super().intersection_update(other) - - def update(self, other): - """Add all rdatas in other to self. - - *other*, a ``dns.rdataset.Rdataset``, the rdataset from which - to update. - """ - - self.update_ttl(other.ttl) - super().update(other) - - def _rdata_repr(self): - def maybe_truncate(s): - if len(s) > 100: - return s[:100] + "..." - return s - - return "[" + ", ".join(f"<{maybe_truncate(str(rr))}>" for rr in self) + "]" - - def __repr__(self): - if self.covers == 0: - ctext = "" - else: - ctext = "(" + dns.rdatatype.to_text(self.covers) + ")" - return ( - "" - ) - - def __str__(self): - return self.to_text() - - def __eq__(self, other): - if not isinstance(other, Rdataset): - return False - if ( - self.rdclass != other.rdclass - or self.rdtype != other.rdtype - or self.covers != other.covers - ): - return False - return super().__eq__(other) - - def __ne__(self, other): - return not self.__eq__(other) - - def to_text( - self, - name: Optional[dns.name.Name] = None, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - override_rdclass: Optional[dns.rdataclass.RdataClass] = None, - want_comments: bool = False, - **kw: Dict[str, Any], - ) -> str: - """Convert the rdataset into DNS zone file format. - - See ``dns.name.Name.choose_relativity`` for more information - on how *origin* and *relativize* determine the way names - are emitted. - - Any additional keyword arguments are passed on to the rdata - ``to_text()`` method. - - *name*, a ``dns.name.Name``. If name is not ``None``, emit RRs with - *name* as the owner name. - - *origin*, a ``dns.name.Name`` or ``None``, the origin for relative - names. - - *relativize*, a ``bool``. If ``True``, names will be relativized - to *origin*. - - *override_rdclass*, a ``dns.rdataclass.RdataClass`` or ``None``. - If not ``None``, use this class instead of the Rdataset's class. - - *want_comments*, a ``bool``. If ``True``, emit comments for rdata - which have them. The default is ``False``. - """ - - if name is not None: - name = name.choose_relativity(origin, relativize) - ntext = str(name) - pad = " " - else: - ntext = "" - pad = "" - s = io.StringIO() - if override_rdclass is not None: - rdclass = override_rdclass - else: - rdclass = self.rdclass - if len(self) == 0: - # - # Empty rdatasets are used for the question section, and in - # some dynamic updates, so we don't need to print out the TTL - # (which is meaningless anyway). - # - s.write( - f"{ntext}{pad}{dns.rdataclass.to_text(rdclass)} " - f"{dns.rdatatype.to_text(self.rdtype)}\n" - ) - else: - for rd in self: - extra = "" - if want_comments: - if rd.rdcomment: - extra = f" ;{rd.rdcomment}" - s.write( - "%s%s%d %s %s %s%s\n" - % ( - ntext, - pad, - self.ttl, - dns.rdataclass.to_text(rdclass), - dns.rdatatype.to_text(self.rdtype), - rd.to_text(origin=origin, relativize=relativize, **kw), - extra, - ) - ) - # - # We strip off the final \n for the caller's convenience in printing - # - return s.getvalue()[:-1] - - def to_wire( - self, - name: dns.name.Name, - file: Any, - compress: Optional[dns.name.CompressType] = None, - origin: Optional[dns.name.Name] = None, - override_rdclass: Optional[dns.rdataclass.RdataClass] = None, - want_shuffle: bool = True, - ) -> int: - """Convert the rdataset to wire format. - - *name*, a ``dns.name.Name`` is the owner name to use. - - *file* is the file where the name is emitted (typically a - BytesIO file). - - *compress*, a ``dict``, is the compression table to use. If - ``None`` (the default), names will not be compressed. - - *origin* is a ``dns.name.Name`` or ``None``. If the name is - relative and origin is not ``None``, then *origin* will be appended - to it. - - *override_rdclass*, an ``int``, is used as the class instead of the - class of the rdataset. This is useful when rendering rdatasets - associated with dynamic updates. - - *want_shuffle*, a ``bool``. If ``True``, then the order of the - Rdatas within the Rdataset will be shuffled before rendering. - - Returns an ``int``, the number of records emitted. - """ - - if override_rdclass is not None: - rdclass = override_rdclass - want_shuffle = False - else: - rdclass = self.rdclass - if len(self) == 0: - name.to_wire(file, compress, origin) - file.write(struct.pack("!HHIH", self.rdtype, rdclass, 0, 0)) - return 1 - else: - l: Union[Rdataset, List[dns.rdata.Rdata]] - if want_shuffle: - l = list(self) - random.shuffle(l) - else: - l = self - for rd in l: - name.to_wire(file, compress, origin) - file.write(struct.pack("!HHI", self.rdtype, rdclass, self.ttl)) - with dns.renderer.prefixed_length(file, 2): - rd.to_wire(file, compress, origin) - return len(self) - - def match( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType, - ) -> bool: - """Returns ``True`` if this rdataset matches the specified class, - type, and covers. - """ - if self.rdclass == rdclass and self.rdtype == rdtype and self.covers == covers: - return True - return False - - def processing_order(self) -> List[dns.rdata.Rdata]: - """Return rdatas in a valid processing order according to the type's - specification. For example, MX records are in preference order from - lowest to highest preferences, with items of the same preference - shuffled. - - For types that do not define a processing order, the rdatas are - simply shuffled. - """ - if len(self) == 0: - return [] - else: - return self[0]._processing_order(iter(self)) - - -@dns.immutable.immutable -class ImmutableRdataset(Rdataset): # lgtm[py/missing-equals] - """An immutable DNS rdataset.""" - - _clone_class = Rdataset - - def __init__(self, rdataset: Rdataset): - """Create an immutable rdataset from the specified rdataset.""" - - super().__init__( - rdataset.rdclass, rdataset.rdtype, rdataset.covers, rdataset.ttl - ) - self.items = dns.immutable.Dict(rdataset.items) - - def update_ttl(self, ttl): - raise TypeError("immutable") - - def add(self, rd, ttl=None): - raise TypeError("immutable") - - def union_update(self, other): - raise TypeError("immutable") - - def intersection_update(self, other): - raise TypeError("immutable") - - def update(self, other): - raise TypeError("immutable") - - def __delitem__(self, i): - raise TypeError("immutable") - - # lgtm complains about these not raising ArithmeticError, but there is - # precedent for overrides of these methods in other classes to raise - # TypeError, and it seems like the better exception. - - def __ior__(self, other): # lgtm[py/unexpected-raise-in-special-method] - raise TypeError("immutable") - - def __iand__(self, other): # lgtm[py/unexpected-raise-in-special-method] - raise TypeError("immutable") - - def __iadd__(self, other): # lgtm[py/unexpected-raise-in-special-method] - raise TypeError("immutable") - - def __isub__(self, other): # lgtm[py/unexpected-raise-in-special-method] - raise TypeError("immutable") - - def clear(self): - raise TypeError("immutable") - - def __copy__(self): - return ImmutableRdataset(super().copy()) - - def copy(self): - return ImmutableRdataset(super().copy()) - - def union(self, other): - return ImmutableRdataset(super().union(other)) - - def intersection(self, other): - return ImmutableRdataset(super().intersection(other)) - - def difference(self, other): - return ImmutableRdataset(super().difference(other)) - - def symmetric_difference(self, other): - return ImmutableRdataset(super().symmetric_difference(other)) - - -def from_text_list( - rdclass: Union[dns.rdataclass.RdataClass, str], - rdtype: Union[dns.rdatatype.RdataType, str], - ttl: int, - text_rdatas: Collection[str], - idna_codec: Optional[dns.name.IDNACodec] = None, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - relativize_to: Optional[dns.name.Name] = None, -) -> Rdataset: - """Create an rdataset with the specified class, type, and TTL, and with - the specified list of rdatas in text format. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder to use; if ``None``, the default IDNA 2003 - encoder/decoder is used. - - *origin*, a ``dns.name.Name`` (or ``None``), the - origin to use for relative names. - - *relativize*, a ``bool``. If true, name will be relativized. - - *relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use - when relativizing names. If not set, the *origin* value will be used. - - Returns a ``dns.rdataset.Rdataset`` object. - """ - - rdclass = dns.rdataclass.RdataClass.make(rdclass) - rdtype = dns.rdatatype.RdataType.make(rdtype) - r = Rdataset(rdclass, rdtype) - r.update_ttl(ttl) - for t in text_rdatas: - rd = dns.rdata.from_text( - r.rdclass, r.rdtype, t, origin, relativize, relativize_to, idna_codec - ) - r.add(rd) - return r - - -def from_text( - rdclass: Union[dns.rdataclass.RdataClass, str], - rdtype: Union[dns.rdatatype.RdataType, str], - ttl: int, - *text_rdatas: Any, -) -> Rdataset: - """Create an rdataset with the specified class, type, and TTL, and with - the specified rdatas in text format. - - Returns a ``dns.rdataset.Rdataset`` object. - """ - - return from_text_list(rdclass, rdtype, ttl, cast(Collection[str], text_rdatas)) - - -def from_rdata_list(ttl: int, rdatas: Collection[dns.rdata.Rdata]) -> Rdataset: - """Create an rdataset with the specified TTL, and with - the specified list of rdata objects. - - Returns a ``dns.rdataset.Rdataset`` object. - """ - - if len(rdatas) == 0: - raise ValueError("rdata list must not be empty") - r = None - for rd in rdatas: - if r is None: - r = Rdataset(rd.rdclass, rd.rdtype) - r.update_ttl(ttl) - r.add(rd) - assert r is not None - return r - - -def from_rdata(ttl: int, *rdatas: Any) -> Rdataset: - """Create an rdataset with the specified TTL, and with - the specified rdata objects. - - Returns a ``dns.rdataset.Rdataset`` object. - """ - - return from_rdata_list(ttl, cast(Collection[dns.rdata.Rdata], rdatas)) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdatatype.py b/write-message/venv/lib/python3.10/site-packages/dns/rdatatype.py deleted file mode 100644 index aa9e561..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdatatype.py +++ /dev/null @@ -1,336 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Rdata Types.""" - -from typing import Dict - -import dns.enum -import dns.exception - - -class RdataType(dns.enum.IntEnum): - """DNS Rdata Type""" - - TYPE0 = 0 - NONE = 0 - A = 1 - NS = 2 - MD = 3 - MF = 4 - CNAME = 5 - SOA = 6 - MB = 7 - MG = 8 - MR = 9 - NULL = 10 - WKS = 11 - PTR = 12 - HINFO = 13 - MINFO = 14 - MX = 15 - TXT = 16 - RP = 17 - AFSDB = 18 - X25 = 19 - ISDN = 20 - RT = 21 - NSAP = 22 - NSAP_PTR = 23 - SIG = 24 - KEY = 25 - PX = 26 - GPOS = 27 - AAAA = 28 - LOC = 29 - NXT = 30 - SRV = 33 - NAPTR = 35 - KX = 36 - CERT = 37 - A6 = 38 - DNAME = 39 - OPT = 41 - APL = 42 - DS = 43 - SSHFP = 44 - IPSECKEY = 45 - RRSIG = 46 - NSEC = 47 - DNSKEY = 48 - DHCID = 49 - NSEC3 = 50 - NSEC3PARAM = 51 - TLSA = 52 - SMIMEA = 53 - HIP = 55 - NINFO = 56 - CDS = 59 - CDNSKEY = 60 - OPENPGPKEY = 61 - CSYNC = 62 - ZONEMD = 63 - SVCB = 64 - HTTPS = 65 - SPF = 99 - UNSPEC = 103 - NID = 104 - L32 = 105 - L64 = 106 - LP = 107 - EUI48 = 108 - EUI64 = 109 - TKEY = 249 - TSIG = 250 - IXFR = 251 - AXFR = 252 - MAILB = 253 - MAILA = 254 - ANY = 255 - URI = 256 - CAA = 257 - AVC = 258 - AMTRELAY = 260 - RESINFO = 261 - WALLET = 262 - TA = 32768 - DLV = 32769 - - @classmethod - def _maximum(cls): - return 65535 - - @classmethod - def _short_name(cls): - return "type" - - @classmethod - def _prefix(cls): - return "TYPE" - - @classmethod - def _extra_from_text(cls, text): - if text.find("-") >= 0: - try: - return cls[text.replace("-", "_")] - except KeyError: # pragma: no cover - pass - return _registered_by_text.get(text) - - @classmethod - def _extra_to_text(cls, value, current_text): - if current_text is None: - return _registered_by_value.get(value) - if current_text.find("_") >= 0: - return current_text.replace("_", "-") - return current_text - - @classmethod - def _unknown_exception_class(cls): - return UnknownRdatatype - - -_registered_by_text: Dict[str, RdataType] = {} -_registered_by_value: Dict[RdataType, str] = {} - -_metatypes = {RdataType.OPT} - -_singletons = { - RdataType.SOA, - RdataType.NXT, - RdataType.DNAME, - RdataType.NSEC, - RdataType.CNAME, -} - - -class UnknownRdatatype(dns.exception.DNSException): - """DNS resource record type is unknown.""" - - -def from_text(text: str) -> RdataType: - """Convert text into a DNS rdata type value. - - The input text can be a defined DNS RR type mnemonic or - instance of the DNS generic type syntax. - - For example, "NS" and "TYPE2" will both result in a value of 2. - - Raises ``dns.rdatatype.UnknownRdatatype`` if the type is unknown. - - Raises ``ValueError`` if the rdata type value is not >= 0 and <= 65535. - - Returns a ``dns.rdatatype.RdataType``. - """ - - return RdataType.from_text(text) - - -def to_text(value: RdataType) -> str: - """Convert a DNS rdata type value to text. - - If the value has a known mnemonic, it will be used, otherwise the - DNS generic type syntax will be used. - - Raises ``ValueError`` if the rdata type value is not >= 0 and <= 65535. - - Returns a ``str``. - """ - - return RdataType.to_text(value) - - -def is_metatype(rdtype: RdataType) -> bool: - """True if the specified type is a metatype. - - *rdtype* is a ``dns.rdatatype.RdataType``. - - The currently defined metatypes are TKEY, TSIG, IXFR, AXFR, MAILA, - MAILB, ANY, and OPT. - - Returns a ``bool``. - """ - - return (256 > rdtype >= 128) or rdtype in _metatypes - - -def is_singleton(rdtype: RdataType) -> bool: - """Is the specified type a singleton type? - - Singleton types can only have a single rdata in an rdataset, or a single - RR in an RRset. - - The currently defined singleton types are CNAME, DNAME, NSEC, NXT, and - SOA. - - *rdtype* is an ``int``. - - Returns a ``bool``. - """ - - if rdtype in _singletons: - return True - return False - - -# pylint: disable=redefined-outer-name -def register_type( - rdtype: RdataType, rdtype_text: str, is_singleton: bool = False -) -> None: - """Dynamically register an rdatatype. - - *rdtype*, a ``dns.rdatatype.RdataType``, the rdatatype to register. - - *rdtype_text*, a ``str``, the textual form of the rdatatype. - - *is_singleton*, a ``bool``, indicating if the type is a singleton (i.e. - RRsets of the type can have only one member.) - """ - - _registered_by_text[rdtype_text] = rdtype - _registered_by_value[rdtype] = rdtype_text - if is_singleton: - _singletons.add(rdtype) - - -### BEGIN generated RdataType constants - -TYPE0 = RdataType.TYPE0 -NONE = RdataType.NONE -A = RdataType.A -NS = RdataType.NS -MD = RdataType.MD -MF = RdataType.MF -CNAME = RdataType.CNAME -SOA = RdataType.SOA -MB = RdataType.MB -MG = RdataType.MG -MR = RdataType.MR -NULL = RdataType.NULL -WKS = RdataType.WKS -PTR = RdataType.PTR -HINFO = RdataType.HINFO -MINFO = RdataType.MINFO -MX = RdataType.MX -TXT = RdataType.TXT -RP = RdataType.RP -AFSDB = RdataType.AFSDB -X25 = RdataType.X25 -ISDN = RdataType.ISDN -RT = RdataType.RT -NSAP = RdataType.NSAP -NSAP_PTR = RdataType.NSAP_PTR -SIG = RdataType.SIG -KEY = RdataType.KEY -PX = RdataType.PX -GPOS = RdataType.GPOS -AAAA = RdataType.AAAA -LOC = RdataType.LOC -NXT = RdataType.NXT -SRV = RdataType.SRV -NAPTR = RdataType.NAPTR -KX = RdataType.KX -CERT = RdataType.CERT -A6 = RdataType.A6 -DNAME = RdataType.DNAME -OPT = RdataType.OPT -APL = RdataType.APL -DS = RdataType.DS -SSHFP = RdataType.SSHFP -IPSECKEY = RdataType.IPSECKEY -RRSIG = RdataType.RRSIG -NSEC = RdataType.NSEC -DNSKEY = RdataType.DNSKEY -DHCID = RdataType.DHCID -NSEC3 = RdataType.NSEC3 -NSEC3PARAM = RdataType.NSEC3PARAM -TLSA = RdataType.TLSA -SMIMEA = RdataType.SMIMEA -HIP = RdataType.HIP -NINFO = RdataType.NINFO -CDS = RdataType.CDS -CDNSKEY = RdataType.CDNSKEY -OPENPGPKEY = RdataType.OPENPGPKEY -CSYNC = RdataType.CSYNC -ZONEMD = RdataType.ZONEMD -SVCB = RdataType.SVCB -HTTPS = RdataType.HTTPS -SPF = RdataType.SPF -UNSPEC = RdataType.UNSPEC -NID = RdataType.NID -L32 = RdataType.L32 -L64 = RdataType.L64 -LP = RdataType.LP -EUI48 = RdataType.EUI48 -EUI64 = RdataType.EUI64 -TKEY = RdataType.TKEY -TSIG = RdataType.TSIG -IXFR = RdataType.IXFR -AXFR = RdataType.AXFR -MAILB = RdataType.MAILB -MAILA = RdataType.MAILA -ANY = RdataType.ANY -URI = RdataType.URI -CAA = RdataType.CAA -AVC = RdataType.AVC -AMTRELAY = RdataType.AMTRELAY -RESINFO = RdataType.RESINFO -WALLET = RdataType.WALLET -TA = RdataType.TA -DLV = RdataType.DLV - -### END generated RdataType constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AFSDB.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AFSDB.py deleted file mode 100644 index 06a3b97..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AFSDB.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.mxbase - - -@dns.immutable.immutable -class AFSDB(dns.rdtypes.mxbase.UncompressedDowncasingMX): - """AFSDB record""" - - # Use the property mechanism to make "subtype" an alias for the - # "preference" attribute, and "hostname" an alias for the "exchange" - # attribute. - # - # This lets us inherit the UncompressedMX implementation but lets - # the caller use appropriate attribute names for the rdata type. - # - # We probably lose some performance vs. a cut-and-paste - # implementation, but this way we don't copy code, and that's - # good. - - @property - def subtype(self): - "the AFSDB subtype" - return self.preference - - @property - def hostname(self): - "the AFSDB hostname" - return self.exchange diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AMTRELAY.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AMTRELAY.py deleted file mode 100644 index ed2b072..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AMTRELAY.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.rdtypes.util - - -class Relay(dns.rdtypes.util.Gateway): - name = "AMTRELAY relay" - - @property - def relay(self): - return self.gateway - - -@dns.immutable.immutable -class AMTRELAY(dns.rdata.Rdata): - """AMTRELAY record""" - - # see: RFC 8777 - - __slots__ = ["precedence", "discovery_optional", "relay_type", "relay"] - - def __init__( - self, rdclass, rdtype, precedence, discovery_optional, relay_type, relay - ): - super().__init__(rdclass, rdtype) - relay = Relay(relay_type, relay) - self.precedence = self._as_uint8(precedence) - self.discovery_optional = self._as_bool(discovery_optional) - self.relay_type = relay.type - self.relay = relay.relay - - def to_text(self, origin=None, relativize=True, **kw): - relay = Relay(self.relay_type, self.relay).to_text(origin, relativize) - return "%d %d %d %s" % ( - self.precedence, - self.discovery_optional, - self.relay_type, - relay, - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - precedence = tok.get_uint8() - discovery_optional = tok.get_uint8() - if discovery_optional > 1: - raise dns.exception.SyntaxError("expecting 0 or 1") - discovery_optional = bool(discovery_optional) - relay_type = tok.get_uint8() - if relay_type > 0x7F: - raise dns.exception.SyntaxError("expecting an integer <= 127") - relay = Relay.from_text(relay_type, tok, origin, relativize, relativize_to) - return cls( - rdclass, rdtype, precedence, discovery_optional, relay_type, relay.relay - ) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - relay_type = self.relay_type | (self.discovery_optional << 7) - header = struct.pack("!BB", self.precedence, relay_type) - file.write(header) - Relay(self.relay_type, self.relay).to_wire(file, compress, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (precedence, relay_type) = parser.get_struct("!BB") - discovery_optional = bool(relay_type >> 7) - relay_type &= 0x7F - relay = Relay.from_wire_parser(relay_type, parser, origin) - return cls( - rdclass, rdtype, precedence, discovery_optional, relay_type, relay.relay - ) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AVC.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AVC.py deleted file mode 100644 index a27ae2d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/AVC.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2016 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.txtbase - - -@dns.immutable.immutable -class AVC(dns.rdtypes.txtbase.TXTBase): - """AVC record""" - - # See: IANA dns parameters for AVC diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CAA.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CAA.py deleted file mode 100644 index 2e6a7e7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CAA.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class CAA(dns.rdata.Rdata): - """CAA (Certification Authority Authorization) record""" - - # see: RFC 6844 - - __slots__ = ["flags", "tag", "value"] - - def __init__(self, rdclass, rdtype, flags, tag, value): - super().__init__(rdclass, rdtype) - self.flags = self._as_uint8(flags) - self.tag = self._as_bytes(tag, True, 255) - if not tag.isalnum(): - raise ValueError("tag is not alphanumeric") - self.value = self._as_bytes(value) - - def to_text(self, origin=None, relativize=True, **kw): - return '%u %s "%s"' % ( - self.flags, - dns.rdata._escapify(self.tag), - dns.rdata._escapify(self.value), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - flags = tok.get_uint8() - tag = tok.get_string().encode() - value = tok.get_string().encode() - return cls(rdclass, rdtype, flags, tag, value) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(struct.pack("!B", self.flags)) - l = len(self.tag) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.tag) - file.write(self.value) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - flags = parser.get_uint8() - tag = parser.get_counted_bytes() - value = parser.get_remaining() - return cls(rdclass, rdtype, flags, tag, value) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CDNSKEY.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CDNSKEY.py deleted file mode 100644 index b613409..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CDNSKEY.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.dnskeybase # lgtm[py/import-and-import-from] - -# pylint: disable=unused-import -from dns.rdtypes.dnskeybase import ( # noqa: F401 lgtm[py/unused-import] - REVOKE, - SEP, - ZONE, -) - -# pylint: enable=unused-import - - -@dns.immutable.immutable -class CDNSKEY(dns.rdtypes.dnskeybase.DNSKEYBase): - """CDNSKEY record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CDS.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CDS.py deleted file mode 100644 index 8312b97..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CDS.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.dsbase - - -@dns.immutable.immutable -class CDS(dns.rdtypes.dsbase.DSBase): - """CDS record""" - - _digest_length_by_type = { - **dns.rdtypes.dsbase.DSBase._digest_length_by_type, - 0: 1, # delete, RFC 8078 Sec. 4 (including Errata ID 5049) - } diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CERT.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CERT.py deleted file mode 100644 index f369cc8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CERT.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import struct - -import dns.dnssectypes -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - -_ctype_by_value = { - 1: "PKIX", - 2: "SPKI", - 3: "PGP", - 4: "IPKIX", - 5: "ISPKI", - 6: "IPGP", - 7: "ACPKIX", - 8: "IACPKIX", - 253: "URI", - 254: "OID", -} - -_ctype_by_name = { - "PKIX": 1, - "SPKI": 2, - "PGP": 3, - "IPKIX": 4, - "ISPKI": 5, - "IPGP": 6, - "ACPKIX": 7, - "IACPKIX": 8, - "URI": 253, - "OID": 254, -} - - -def _ctype_from_text(what): - v = _ctype_by_name.get(what) - if v is not None: - return v - return int(what) - - -def _ctype_to_text(what): - v = _ctype_by_value.get(what) - if v is not None: - return v - return str(what) - - -@dns.immutable.immutable -class CERT(dns.rdata.Rdata): - """CERT record""" - - # see RFC 4398 - - __slots__ = ["certificate_type", "key_tag", "algorithm", "certificate"] - - def __init__( - self, rdclass, rdtype, certificate_type, key_tag, algorithm, certificate - ): - super().__init__(rdclass, rdtype) - self.certificate_type = self._as_uint16(certificate_type) - self.key_tag = self._as_uint16(key_tag) - self.algorithm = self._as_uint8(algorithm) - self.certificate = self._as_bytes(certificate) - - def to_text(self, origin=None, relativize=True, **kw): - certificate_type = _ctype_to_text(self.certificate_type) - return "%s %d %s %s" % ( - certificate_type, - self.key_tag, - dns.dnssectypes.Algorithm.to_text(self.algorithm), - dns.rdata._base64ify(self.certificate, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - certificate_type = _ctype_from_text(tok.get_string()) - key_tag = tok.get_uint16() - algorithm = dns.dnssectypes.Algorithm.from_text(tok.get_string()) - b64 = tok.concatenate_remaining_identifiers().encode() - certificate = base64.b64decode(b64) - return cls(rdclass, rdtype, certificate_type, key_tag, algorithm, certificate) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - prefix = struct.pack( - "!HHB", self.certificate_type, self.key_tag, self.algorithm - ) - file.write(prefix) - file.write(self.certificate) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (certificate_type, key_tag, algorithm) = parser.get_struct("!HHB") - certificate = parser.get_remaining() - return cls(rdclass, rdtype, certificate_type, key_tag, algorithm, certificate) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CNAME.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CNAME.py deleted file mode 100644 index 665e407..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CNAME.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.nsbase - - -@dns.immutable.immutable -class CNAME(dns.rdtypes.nsbase.NSBase): - """CNAME record - - Note: although CNAME is officially a singleton type, dnspython allows - non-singleton CNAME rdatasets because such sets have been commonly - used by BIND and other nameservers for load balancing.""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CSYNC.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CSYNC.py deleted file mode 100644 index 2f972f6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/CSYNC.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011, 2016 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdatatype -import dns.rdtypes.util - - -@dns.immutable.immutable -class Bitmap(dns.rdtypes.util.Bitmap): - type_name = "CSYNC" - - -@dns.immutable.immutable -class CSYNC(dns.rdata.Rdata): - """CSYNC record""" - - __slots__ = ["serial", "flags", "windows"] - - def __init__(self, rdclass, rdtype, serial, flags, windows): - super().__init__(rdclass, rdtype) - self.serial = self._as_uint32(serial) - self.flags = self._as_uint16(flags) - if not isinstance(windows, Bitmap): - windows = Bitmap(windows) - self.windows = tuple(windows.windows) - - def to_text(self, origin=None, relativize=True, **kw): - text = Bitmap(self.windows).to_text() - return "%d %d%s" % (self.serial, self.flags, text) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - serial = tok.get_uint32() - flags = tok.get_uint16() - bitmap = Bitmap.from_text(tok) - return cls(rdclass, rdtype, serial, flags, bitmap) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(struct.pack("!IH", self.serial, self.flags)) - Bitmap(self.windows).to_wire(file) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (serial, flags) = parser.get_struct("!IH") - bitmap = Bitmap.from_wire_parser(parser) - return cls(rdclass, rdtype, serial, flags, bitmap) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DLV.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DLV.py deleted file mode 100644 index 6c134f1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DLV.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.dsbase - - -@dns.immutable.immutable -class DLV(dns.rdtypes.dsbase.DSBase): - """DLV record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DNAME.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DNAME.py deleted file mode 100644 index bbf9186..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DNAME.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.nsbase - - -@dns.immutable.immutable -class DNAME(dns.rdtypes.nsbase.UncompressedNS): - """DNAME record""" - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.target.to_wire(file, None, origin, canonicalize) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DNSKEY.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DNSKEY.py deleted file mode 100644 index 6d961a9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DNSKEY.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.dnskeybase # lgtm[py/import-and-import-from] - -# pylint: disable=unused-import -from dns.rdtypes.dnskeybase import ( # noqa: F401 lgtm[py/unused-import] - REVOKE, - SEP, - ZONE, -) - -# pylint: enable=unused-import - - -@dns.immutable.immutable -class DNSKEY(dns.rdtypes.dnskeybase.DNSKEYBase): - """DNSKEY record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DS.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DS.py deleted file mode 100644 index 58b3108..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/DS.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.dsbase - - -@dns.immutable.immutable -class DS(dns.rdtypes.dsbase.DSBase): - """DS record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/EUI48.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/EUI48.py deleted file mode 100644 index c843be5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/EUI48.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2015 Red Hat, Inc. -# Author: Petr Spacek -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED 'AS IS' AND RED HAT DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.euibase - - -@dns.immutable.immutable -class EUI48(dns.rdtypes.euibase.EUIBase): - """EUI48 record""" - - # see: rfc7043.txt - - byte_len = 6 # 0123456789ab (in hex) - text_len = byte_len * 3 - 1 # 01-23-45-67-89-ab diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/EUI64.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/EUI64.py deleted file mode 100644 index f6d7e25..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/EUI64.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2015 Red Hat, Inc. -# Author: Petr Spacek -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED 'AS IS' AND RED HAT DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.euibase - - -@dns.immutable.immutable -class EUI64(dns.rdtypes.euibase.EUIBase): - """EUI64 record""" - - # see: rfc7043.txt - - byte_len = 8 # 0123456789abcdef (in hex) - text_len = byte_len * 3 - 1 # 01-23-45-67-89-ab-cd-ef diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/GPOS.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/GPOS.py deleted file mode 100644 index d79f4a0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/GPOS.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - - -def _validate_float_string(what): - if len(what) == 0: - raise dns.exception.FormError - if what[0] == b"-"[0] or what[0] == b"+"[0]: - what = what[1:] - if what.isdigit(): - return - try: - (left, right) = what.split(b".") - except ValueError: - raise dns.exception.FormError - if left == b"" and right == b"": - raise dns.exception.FormError - if not left == b"" and not left.decode().isdigit(): - raise dns.exception.FormError - if not right == b"" and not right.decode().isdigit(): - raise dns.exception.FormError - - -@dns.immutable.immutable -class GPOS(dns.rdata.Rdata): - """GPOS record""" - - # see: RFC 1712 - - __slots__ = ["latitude", "longitude", "altitude"] - - def __init__(self, rdclass, rdtype, latitude, longitude, altitude): - super().__init__(rdclass, rdtype) - if isinstance(latitude, float) or isinstance(latitude, int): - latitude = str(latitude) - if isinstance(longitude, float) or isinstance(longitude, int): - longitude = str(longitude) - if isinstance(altitude, float) or isinstance(altitude, int): - altitude = str(altitude) - latitude = self._as_bytes(latitude, True, 255) - longitude = self._as_bytes(longitude, True, 255) - altitude = self._as_bytes(altitude, True, 255) - _validate_float_string(latitude) - _validate_float_string(longitude) - _validate_float_string(altitude) - self.latitude = latitude - self.longitude = longitude - self.altitude = altitude - flat = self.float_latitude - if flat < -90.0 or flat > 90.0: - raise dns.exception.FormError("bad latitude") - flong = self.float_longitude - if flong < -180.0 or flong > 180.0: - raise dns.exception.FormError("bad longitude") - - def to_text(self, origin=None, relativize=True, **kw): - return ( - f"{self.latitude.decode()} {self.longitude.decode()} " - f"{self.altitude.decode()}" - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - latitude = tok.get_string() - longitude = tok.get_string() - altitude = tok.get_string() - return cls(rdclass, rdtype, latitude, longitude, altitude) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - l = len(self.latitude) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.latitude) - l = len(self.longitude) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.longitude) - l = len(self.altitude) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.altitude) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - latitude = parser.get_counted_bytes() - longitude = parser.get_counted_bytes() - altitude = parser.get_counted_bytes() - return cls(rdclass, rdtype, latitude, longitude, altitude) - - @property - def float_latitude(self): - "latitude as a floating point value" - return float(self.latitude) - - @property - def float_longitude(self): - "longitude as a floating point value" - return float(self.longitude) - - @property - def float_altitude(self): - "altitude as a floating point value" - return float(self.altitude) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/HINFO.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/HINFO.py deleted file mode 100644 index 06ad348..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/HINFO.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class HINFO(dns.rdata.Rdata): - """HINFO record""" - - # see: RFC 1035 - - __slots__ = ["cpu", "os"] - - def __init__(self, rdclass, rdtype, cpu, os): - super().__init__(rdclass, rdtype) - self.cpu = self._as_bytes(cpu, True, 255) - self.os = self._as_bytes(os, True, 255) - - def to_text(self, origin=None, relativize=True, **kw): - return f'"{dns.rdata._escapify(self.cpu)}" "{dns.rdata._escapify(self.os)}"' - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - cpu = tok.get_string(max_length=255) - os = tok.get_string(max_length=255) - return cls(rdclass, rdtype, cpu, os) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - l = len(self.cpu) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.cpu) - l = len(self.os) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.os) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - cpu = parser.get_counted_bytes() - os = parser.get_counted_bytes() - return cls(rdclass, rdtype, cpu, os) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/HIP.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/HIP.py deleted file mode 100644 index f3157da..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/HIP.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2010, 2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import binascii -import struct - -import dns.exception -import dns.immutable -import dns.rdata -import dns.rdatatype - - -@dns.immutable.immutable -class HIP(dns.rdata.Rdata): - """HIP record""" - - # see: RFC 5205 - - __slots__ = ["hit", "algorithm", "key", "servers"] - - def __init__(self, rdclass, rdtype, hit, algorithm, key, servers): - super().__init__(rdclass, rdtype) - self.hit = self._as_bytes(hit, True, 255) - self.algorithm = self._as_uint8(algorithm) - self.key = self._as_bytes(key, True) - self.servers = self._as_tuple(servers, self._as_name) - - def to_text(self, origin=None, relativize=True, **kw): - hit = binascii.hexlify(self.hit).decode() - key = base64.b64encode(self.key).replace(b"\n", b"").decode() - text = "" - servers = [] - for server in self.servers: - servers.append(server.choose_relativity(origin, relativize)) - if len(servers) > 0: - text += " " + " ".join(x.to_unicode() for x in servers) - return "%u %s %s%s" % (self.algorithm, hit, key, text) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - algorithm = tok.get_uint8() - hit = binascii.unhexlify(tok.get_string().encode()) - key = base64.b64decode(tok.get_string().encode()) - servers = [] - for token in tok.get_remaining(): - server = tok.as_name(token, origin, relativize, relativize_to) - servers.append(server) - return cls(rdclass, rdtype, hit, algorithm, key, servers) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - lh = len(self.hit) - lk = len(self.key) - file.write(struct.pack("!BBH", lh, self.algorithm, lk)) - file.write(self.hit) - file.write(self.key) - for server in self.servers: - server.to_wire(file, None, origin, False) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (lh, algorithm, lk) = parser.get_struct("!BBH") - hit = parser.get_bytes(lh) - key = parser.get_bytes(lk) - servers = [] - while parser.remaining() > 0: - server = parser.get_name(origin) - servers.append(server) - return cls(rdclass, rdtype, hit, algorithm, key, servers) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/ISDN.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/ISDN.py deleted file mode 100644 index 6428a0a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/ISDN.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class ISDN(dns.rdata.Rdata): - """ISDN record""" - - # see: RFC 1183 - - __slots__ = ["address", "subaddress"] - - def __init__(self, rdclass, rdtype, address, subaddress): - super().__init__(rdclass, rdtype) - self.address = self._as_bytes(address, True, 255) - self.subaddress = self._as_bytes(subaddress, True, 255) - - def to_text(self, origin=None, relativize=True, **kw): - if self.subaddress: - return ( - f'"{dns.rdata._escapify(self.address)}" ' - f'"{dns.rdata._escapify(self.subaddress)}"' - ) - else: - return f'"{dns.rdata._escapify(self.address)}"' - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - address = tok.get_string() - tokens = tok.get_remaining(max_tokens=1) - if len(tokens) >= 1: - subaddress = tokens[0].unescape().value - else: - subaddress = "" - return cls(rdclass, rdtype, address, subaddress) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - l = len(self.address) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.address) - l = len(self.subaddress) - if l > 0: - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.subaddress) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - address = parser.get_counted_bytes() - if parser.remaining() > 0: - subaddress = parser.get_counted_bytes() - else: - subaddress = b"" - return cls(rdclass, rdtype, address, subaddress) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/L32.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/L32.py deleted file mode 100644 index 09804c2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/L32.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import struct - -import dns.immutable -import dns.rdata - - -@dns.immutable.immutable -class L32(dns.rdata.Rdata): - """L32 record""" - - # see: rfc6742.txt - - __slots__ = ["preference", "locator32"] - - def __init__(self, rdclass, rdtype, preference, locator32): - super().__init__(rdclass, rdtype) - self.preference = self._as_uint16(preference) - self.locator32 = self._as_ipv4_address(locator32) - - def to_text(self, origin=None, relativize=True, **kw): - return f"{self.preference} {self.locator32}" - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - preference = tok.get_uint16() - nodeid = tok.get_identifier() - return cls(rdclass, rdtype, preference, nodeid) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(struct.pack("!H", self.preference)) - file.write(dns.ipv4.inet_aton(self.locator32)) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - preference = parser.get_uint16() - locator32 = parser.get_remaining() - return cls(rdclass, rdtype, preference, locator32) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/L64.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/L64.py deleted file mode 100644 index fb76808..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/L64.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import struct - -import dns.immutable -import dns.rdtypes.util - - -@dns.immutable.immutable -class L64(dns.rdata.Rdata): - """L64 record""" - - # see: rfc6742.txt - - __slots__ = ["preference", "locator64"] - - def __init__(self, rdclass, rdtype, preference, locator64): - super().__init__(rdclass, rdtype) - self.preference = self._as_uint16(preference) - if isinstance(locator64, bytes): - if len(locator64) != 8: - raise ValueError("invalid locator64") - self.locator64 = dns.rdata._hexify(locator64, 4, b":") - else: - dns.rdtypes.util.parse_formatted_hex(locator64, 4, 4, ":") - self.locator64 = locator64 - - def to_text(self, origin=None, relativize=True, **kw): - return f"{self.preference} {self.locator64}" - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - preference = tok.get_uint16() - locator64 = tok.get_identifier() - return cls(rdclass, rdtype, preference, locator64) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(struct.pack("!H", self.preference)) - file.write(dns.rdtypes.util.parse_formatted_hex(self.locator64, 4, 4, ":")) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - preference = parser.get_uint16() - locator64 = parser.get_remaining() - return cls(rdclass, rdtype, preference, locator64) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/LOC.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/LOC.py deleted file mode 100644 index 1153cf0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/LOC.py +++ /dev/null @@ -1,353 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.rdata - -_pows = tuple(10**i for i in range(0, 11)) - -# default values are in centimeters -_default_size = 100.0 -_default_hprec = 1000000.0 -_default_vprec = 1000.0 - -# for use by from_wire() -_MAX_LATITUDE = 0x80000000 + 90 * 3600000 -_MIN_LATITUDE = 0x80000000 - 90 * 3600000 -_MAX_LONGITUDE = 0x80000000 + 180 * 3600000 -_MIN_LONGITUDE = 0x80000000 - 180 * 3600000 - - -def _exponent_of(what, desc): - if what == 0: - return 0 - exp = None - for i, pow in enumerate(_pows): - if what < pow: - exp = i - 1 - break - if exp is None or exp < 0: - raise dns.exception.SyntaxError(f"{desc} value out of bounds") - return exp - - -def _float_to_tuple(what): - if what < 0: - sign = -1 - what *= -1 - else: - sign = 1 - what = round(what * 3600000) - degrees = int(what // 3600000) - what -= degrees * 3600000 - minutes = int(what // 60000) - what -= minutes * 60000 - seconds = int(what // 1000) - what -= int(seconds * 1000) - what = int(what) - return (degrees, minutes, seconds, what, sign) - - -def _tuple_to_float(what): - value = float(what[0]) - value += float(what[1]) / 60.0 - value += float(what[2]) / 3600.0 - value += float(what[3]) / 3600000.0 - return float(what[4]) * value - - -def _encode_size(what, desc): - what = int(what) - exponent = _exponent_of(what, desc) & 0xF - base = what // pow(10, exponent) & 0xF - return base * 16 + exponent - - -def _decode_size(what, desc): - exponent = what & 0x0F - if exponent > 9: - raise dns.exception.FormError(f"bad {desc} exponent") - base = (what & 0xF0) >> 4 - if base > 9: - raise dns.exception.FormError(f"bad {desc} base") - return base * pow(10, exponent) - - -def _check_coordinate_list(value, low, high): - if value[0] < low or value[0] > high: - raise ValueError(f"not in range [{low}, {high}]") - if value[1] < 0 or value[1] > 59: - raise ValueError("bad minutes value") - if value[2] < 0 or value[2] > 59: - raise ValueError("bad seconds value") - if value[3] < 0 or value[3] > 999: - raise ValueError("bad milliseconds value") - if value[4] != 1 and value[4] != -1: - raise ValueError("bad hemisphere value") - - -@dns.immutable.immutable -class LOC(dns.rdata.Rdata): - """LOC record""" - - # see: RFC 1876 - - __slots__ = [ - "latitude", - "longitude", - "altitude", - "size", - "horizontal_precision", - "vertical_precision", - ] - - def __init__( - self, - rdclass, - rdtype, - latitude, - longitude, - altitude, - size=_default_size, - hprec=_default_hprec, - vprec=_default_vprec, - ): - """Initialize a LOC record instance. - - The parameters I{latitude} and I{longitude} may be either a 4-tuple - of integers specifying (degrees, minutes, seconds, milliseconds), - or they may be floating point values specifying the number of - degrees. The other parameters are floats. Size, horizontal precision, - and vertical precision are specified in centimeters.""" - - super().__init__(rdclass, rdtype) - if isinstance(latitude, int): - latitude = float(latitude) - if isinstance(latitude, float): - latitude = _float_to_tuple(latitude) - _check_coordinate_list(latitude, -90, 90) - self.latitude = tuple(latitude) - if isinstance(longitude, int): - longitude = float(longitude) - if isinstance(longitude, float): - longitude = _float_to_tuple(longitude) - _check_coordinate_list(longitude, -180, 180) - self.longitude = tuple(longitude) - self.altitude = float(altitude) - self.size = float(size) - self.horizontal_precision = float(hprec) - self.vertical_precision = float(vprec) - - def to_text(self, origin=None, relativize=True, **kw): - if self.latitude[4] > 0: - lat_hemisphere = "N" - else: - lat_hemisphere = "S" - if self.longitude[4] > 0: - long_hemisphere = "E" - else: - long_hemisphere = "W" - text = "%d %d %d.%03d %s %d %d %d.%03d %s %0.2fm" % ( - self.latitude[0], - self.latitude[1], - self.latitude[2], - self.latitude[3], - lat_hemisphere, - self.longitude[0], - self.longitude[1], - self.longitude[2], - self.longitude[3], - long_hemisphere, - self.altitude / 100.0, - ) - - # do not print default values - if ( - self.size != _default_size - or self.horizontal_precision != _default_hprec - or self.vertical_precision != _default_vprec - ): - text += ( - f" {self.size / 100.0:0.2f}m {self.horizontal_precision / 100.0:0.2f}m" - f" {self.vertical_precision / 100.0:0.2f}m" - ) - return text - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - latitude = [0, 0, 0, 0, 1] - longitude = [0, 0, 0, 0, 1] - size = _default_size - hprec = _default_hprec - vprec = _default_vprec - - latitude[0] = tok.get_int() - t = tok.get_string() - if t.isdigit(): - latitude[1] = int(t) - t = tok.get_string() - if "." in t: - (seconds, milliseconds) = t.split(".") - if not seconds.isdigit(): - raise dns.exception.SyntaxError("bad latitude seconds value") - latitude[2] = int(seconds) - l = len(milliseconds) - if l == 0 or l > 3 or not milliseconds.isdigit(): - raise dns.exception.SyntaxError("bad latitude milliseconds value") - if l == 1: - m = 100 - elif l == 2: - m = 10 - else: - m = 1 - latitude[3] = m * int(milliseconds) - t = tok.get_string() - elif t.isdigit(): - latitude[2] = int(t) - t = tok.get_string() - if t == "S": - latitude[4] = -1 - elif t != "N": - raise dns.exception.SyntaxError("bad latitude hemisphere value") - - longitude[0] = tok.get_int() - t = tok.get_string() - if t.isdigit(): - longitude[1] = int(t) - t = tok.get_string() - if "." in t: - (seconds, milliseconds) = t.split(".") - if not seconds.isdigit(): - raise dns.exception.SyntaxError("bad longitude seconds value") - longitude[2] = int(seconds) - l = len(milliseconds) - if l == 0 or l > 3 or not milliseconds.isdigit(): - raise dns.exception.SyntaxError("bad longitude milliseconds value") - if l == 1: - m = 100 - elif l == 2: - m = 10 - else: - m = 1 - longitude[3] = m * int(milliseconds) - t = tok.get_string() - elif t.isdigit(): - longitude[2] = int(t) - t = tok.get_string() - if t == "W": - longitude[4] = -1 - elif t != "E": - raise dns.exception.SyntaxError("bad longitude hemisphere value") - - t = tok.get_string() - if t[-1] == "m": - t = t[0:-1] - altitude = float(t) * 100.0 # m -> cm - - tokens = tok.get_remaining(max_tokens=3) - if len(tokens) >= 1: - value = tokens[0].unescape().value - if value[-1] == "m": - value = value[0:-1] - size = float(value) * 100.0 # m -> cm - if len(tokens) >= 2: - value = tokens[1].unescape().value - if value[-1] == "m": - value = value[0:-1] - hprec = float(value) * 100.0 # m -> cm - if len(tokens) >= 3: - value = tokens[2].unescape().value - if value[-1] == "m": - value = value[0:-1] - vprec = float(value) * 100.0 # m -> cm - - # Try encoding these now so we raise if they are bad - _encode_size(size, "size") - _encode_size(hprec, "horizontal precision") - _encode_size(vprec, "vertical precision") - - return cls(rdclass, rdtype, latitude, longitude, altitude, size, hprec, vprec) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - milliseconds = ( - self.latitude[0] * 3600000 - + self.latitude[1] * 60000 - + self.latitude[2] * 1000 - + self.latitude[3] - ) * self.latitude[4] - latitude = 0x80000000 + milliseconds - milliseconds = ( - self.longitude[0] * 3600000 - + self.longitude[1] * 60000 - + self.longitude[2] * 1000 - + self.longitude[3] - ) * self.longitude[4] - longitude = 0x80000000 + milliseconds - altitude = int(self.altitude) + 10000000 - size = _encode_size(self.size, "size") - hprec = _encode_size(self.horizontal_precision, "horizontal precision") - vprec = _encode_size(self.vertical_precision, "vertical precision") - wire = struct.pack( - "!BBBBIII", 0, size, hprec, vprec, latitude, longitude, altitude - ) - file.write(wire) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - ( - version, - size, - hprec, - vprec, - latitude, - longitude, - altitude, - ) = parser.get_struct("!BBBBIII") - if version != 0: - raise dns.exception.FormError("LOC version not zero") - if latitude < _MIN_LATITUDE or latitude > _MAX_LATITUDE: - raise dns.exception.FormError("bad latitude") - if latitude > 0x80000000: - latitude = (latitude - 0x80000000) / 3600000 - else: - latitude = -1 * (0x80000000 - latitude) / 3600000 - if longitude < _MIN_LONGITUDE or longitude > _MAX_LONGITUDE: - raise dns.exception.FormError("bad longitude") - if longitude > 0x80000000: - longitude = (longitude - 0x80000000) / 3600000 - else: - longitude = -1 * (0x80000000 - longitude) / 3600000 - altitude = float(altitude) - 10000000.0 - size = _decode_size(size, "size") - hprec = _decode_size(hprec, "horizontal precision") - vprec = _decode_size(vprec, "vertical precision") - return cls(rdclass, rdtype, latitude, longitude, altitude, size, hprec, vprec) - - @property - def float_latitude(self): - "latitude as a floating point value" - return _tuple_to_float(self.latitude) - - @property - def float_longitude(self): - "longitude as a floating point value" - return _tuple_to_float(self.longitude) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/LP.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/LP.py deleted file mode 100644 index 312663f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/LP.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import struct - -import dns.immutable -import dns.rdata - - -@dns.immutable.immutable -class LP(dns.rdata.Rdata): - """LP record""" - - # see: rfc6742.txt - - __slots__ = ["preference", "fqdn"] - - def __init__(self, rdclass, rdtype, preference, fqdn): - super().__init__(rdclass, rdtype) - self.preference = self._as_uint16(preference) - self.fqdn = self._as_name(fqdn) - - def to_text(self, origin=None, relativize=True, **kw): - fqdn = self.fqdn.choose_relativity(origin, relativize) - return "%d %s" % (self.preference, fqdn) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - preference = tok.get_uint16() - fqdn = tok.get_name(origin, relativize, relativize_to) - return cls(rdclass, rdtype, preference, fqdn) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(struct.pack("!H", self.preference)) - self.fqdn.to_wire(file, compress, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - preference = parser.get_uint16() - fqdn = parser.get_name(origin) - return cls(rdclass, rdtype, preference, fqdn) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/MX.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/MX.py deleted file mode 100644 index 0c300c5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/MX.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.mxbase - - -@dns.immutable.immutable -class MX(dns.rdtypes.mxbase.MXBase): - """MX record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NID.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NID.py deleted file mode 100644 index 2f64917..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NID.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import struct - -import dns.immutable -import dns.rdtypes.util - - -@dns.immutable.immutable -class NID(dns.rdata.Rdata): - """NID record""" - - # see: rfc6742.txt - - __slots__ = ["preference", "nodeid"] - - def __init__(self, rdclass, rdtype, preference, nodeid): - super().__init__(rdclass, rdtype) - self.preference = self._as_uint16(preference) - if isinstance(nodeid, bytes): - if len(nodeid) != 8: - raise ValueError("invalid nodeid") - self.nodeid = dns.rdata._hexify(nodeid, 4, b":") - else: - dns.rdtypes.util.parse_formatted_hex(nodeid, 4, 4, ":") - self.nodeid = nodeid - - def to_text(self, origin=None, relativize=True, **kw): - return f"{self.preference} {self.nodeid}" - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - preference = tok.get_uint16() - nodeid = tok.get_identifier() - return cls(rdclass, rdtype, preference, nodeid) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(struct.pack("!H", self.preference)) - file.write(dns.rdtypes.util.parse_formatted_hex(self.nodeid, 4, 4, ":")) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - preference = parser.get_uint16() - nodeid = parser.get_remaining() - return cls(rdclass, rdtype, preference, nodeid) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NINFO.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NINFO.py deleted file mode 100644 index b177bdd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NINFO.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.txtbase - - -@dns.immutable.immutable -class NINFO(dns.rdtypes.txtbase.TXTBase): - """NINFO record""" - - # see: draft-reid-dnsext-zs-01 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NS.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NS.py deleted file mode 100644 index c3f34ce..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NS.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.nsbase - - -@dns.immutable.immutable -class NS(dns.rdtypes.nsbase.NSBase): - """NS record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC.py deleted file mode 100644 index 3c78b72..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdatatype -import dns.rdtypes.util - - -@dns.immutable.immutable -class Bitmap(dns.rdtypes.util.Bitmap): - type_name = "NSEC" - - -@dns.immutable.immutable -class NSEC(dns.rdata.Rdata): - """NSEC record""" - - __slots__ = ["next", "windows"] - - def __init__(self, rdclass, rdtype, next, windows): - super().__init__(rdclass, rdtype) - self.next = self._as_name(next) - if not isinstance(windows, Bitmap): - windows = Bitmap(windows) - self.windows = tuple(windows.windows) - - def to_text(self, origin=None, relativize=True, **kw): - next = self.next.choose_relativity(origin, relativize) - text = Bitmap(self.windows).to_text() - return f"{next}{text}" - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - next = tok.get_name(origin, relativize, relativize_to) - windows = Bitmap.from_text(tok) - return cls(rdclass, rdtype, next, windows) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - # Note that NSEC downcasing, originally mandated by RFC 4034 - # section 6.2 was removed by RFC 6840 section 5.1. - self.next.to_wire(file, None, origin, False) - Bitmap(self.windows).to_wire(file) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - next = parser.get_name(origin) - bitmap = Bitmap.from_wire_parser(parser) - return cls(rdclass, rdtype, next, bitmap) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC3.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC3.py deleted file mode 100644 index d71302b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC3.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import binascii -import struct - -import dns.exception -import dns.immutable -import dns.rdata -import dns.rdatatype -import dns.rdtypes.util - -b32_hex_to_normal = bytes.maketrans( - b"0123456789ABCDEFGHIJKLMNOPQRSTUV", b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" -) -b32_normal_to_hex = bytes.maketrans( - b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", b"0123456789ABCDEFGHIJKLMNOPQRSTUV" -) - -# hash algorithm constants -SHA1 = 1 - -# flag constants -OPTOUT = 1 - - -@dns.immutable.immutable -class Bitmap(dns.rdtypes.util.Bitmap): - type_name = "NSEC3" - - -@dns.immutable.immutable -class NSEC3(dns.rdata.Rdata): - """NSEC3 record""" - - __slots__ = ["algorithm", "flags", "iterations", "salt", "next", "windows"] - - def __init__( - self, rdclass, rdtype, algorithm, flags, iterations, salt, next, windows - ): - super().__init__(rdclass, rdtype) - self.algorithm = self._as_uint8(algorithm) - self.flags = self._as_uint8(flags) - self.iterations = self._as_uint16(iterations) - self.salt = self._as_bytes(salt, True, 255) - self.next = self._as_bytes(next, True, 255) - if not isinstance(windows, Bitmap): - windows = Bitmap(windows) - self.windows = tuple(windows.windows) - - def _next_text(self): - next = base64.b32encode(self.next).translate(b32_normal_to_hex).lower().decode() - next = next.rstrip("=") - return next - - def to_text(self, origin=None, relativize=True, **kw): - next = self._next_text() - if self.salt == b"": - salt = "-" - else: - salt = binascii.hexlify(self.salt).decode() - text = Bitmap(self.windows).to_text() - return "%u %u %u %s %s%s" % ( - self.algorithm, - self.flags, - self.iterations, - salt, - next, - text, - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - algorithm = tok.get_uint8() - flags = tok.get_uint8() - iterations = tok.get_uint16() - salt = tok.get_string() - if salt == "-": - salt = b"" - else: - salt = binascii.unhexlify(salt.encode("ascii")) - next = tok.get_string().encode("ascii").upper().translate(b32_hex_to_normal) - if next.endswith(b"="): - raise binascii.Error("Incorrect padding") - if len(next) % 8 != 0: - next += b"=" * (8 - len(next) % 8) - next = base64.b32decode(next) - bitmap = Bitmap.from_text(tok) - return cls(rdclass, rdtype, algorithm, flags, iterations, salt, next, bitmap) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - l = len(self.salt) - file.write(struct.pack("!BBHB", self.algorithm, self.flags, self.iterations, l)) - file.write(self.salt) - l = len(self.next) - file.write(struct.pack("!B", l)) - file.write(self.next) - Bitmap(self.windows).to_wire(file) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (algorithm, flags, iterations) = parser.get_struct("!BBH") - salt = parser.get_counted_bytes() - next = parser.get_counted_bytes() - bitmap = Bitmap.from_wire_parser(parser) - return cls(rdclass, rdtype, algorithm, flags, iterations, salt, next, bitmap) - - def next_name(self, origin=None): - return dns.name.from_text(self._next_text(), origin) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC3PARAM.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC3PARAM.py deleted file mode 100644 index d1e62eb..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/NSEC3PARAM.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import binascii -import struct - -import dns.exception -import dns.immutable -import dns.rdata - - -@dns.immutable.immutable -class NSEC3PARAM(dns.rdata.Rdata): - """NSEC3PARAM record""" - - __slots__ = ["algorithm", "flags", "iterations", "salt"] - - def __init__(self, rdclass, rdtype, algorithm, flags, iterations, salt): - super().__init__(rdclass, rdtype) - self.algorithm = self._as_uint8(algorithm) - self.flags = self._as_uint8(flags) - self.iterations = self._as_uint16(iterations) - self.salt = self._as_bytes(salt, True, 255) - - def to_text(self, origin=None, relativize=True, **kw): - if self.salt == b"": - salt = "-" - else: - salt = binascii.hexlify(self.salt).decode() - return "%u %u %u %s" % (self.algorithm, self.flags, self.iterations, salt) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - algorithm = tok.get_uint8() - flags = tok.get_uint8() - iterations = tok.get_uint16() - salt = tok.get_string() - if salt == "-": - salt = "" - else: - salt = binascii.unhexlify(salt.encode()) - return cls(rdclass, rdtype, algorithm, flags, iterations, salt) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - l = len(self.salt) - file.write(struct.pack("!BBHB", self.algorithm, self.flags, self.iterations, l)) - file.write(self.salt) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (algorithm, flags, iterations) = parser.get_struct("!BBH") - salt = parser.get_counted_bytes() - return cls(rdclass, rdtype, algorithm, flags, iterations, salt) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/OPENPGPKEY.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/OPENPGPKEY.py deleted file mode 100644 index 4d7a4b6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/OPENPGPKEY.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2016 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 - -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class OPENPGPKEY(dns.rdata.Rdata): - """OPENPGPKEY record""" - - # see: RFC 7929 - - def __init__(self, rdclass, rdtype, key): - super().__init__(rdclass, rdtype) - self.key = self._as_bytes(key) - - def to_text(self, origin=None, relativize=True, **kw): - return dns.rdata._base64ify(self.key, chunksize=None, **kw) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - b64 = tok.concatenate_remaining_identifiers().encode() - key = base64.b64decode(b64) - return cls(rdclass, rdtype, key) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(self.key) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - key = parser.get_remaining() - return cls(rdclass, rdtype, key) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/OPT.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/OPT.py deleted file mode 100644 index d343dfa..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/OPT.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.edns -import dns.exception -import dns.immutable -import dns.rdata - -# We don't implement from_text, and that's ok. -# pylint: disable=abstract-method - - -@dns.immutable.immutable -class OPT(dns.rdata.Rdata): - """OPT record""" - - __slots__ = ["options"] - - def __init__(self, rdclass, rdtype, options): - """Initialize an OPT rdata. - - *rdclass*, an ``int`` is the rdataclass of the Rdata, - which is also the payload size. - - *rdtype*, an ``int`` is the rdatatype of the Rdata. - - *options*, a tuple of ``bytes`` - """ - - super().__init__(rdclass, rdtype) - - def as_option(option): - if not isinstance(option, dns.edns.Option): - raise ValueError("option is not a dns.edns.option") - return option - - self.options = self._as_tuple(options, as_option) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - for opt in self.options: - owire = opt.to_wire() - file.write(struct.pack("!HH", opt.otype, len(owire))) - file.write(owire) - - def to_text(self, origin=None, relativize=True, **kw): - return " ".join(opt.to_text() for opt in self.options) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - options = [] - while parser.remaining() > 0: - (otype, olen) = parser.get_struct("!HH") - with parser.restrict_to(olen): - opt = dns.edns.option_from_wire_parser(otype, parser) - options.append(opt) - return cls(rdclass, rdtype, options) - - @property - def payload(self): - "payload size" - return self.rdclass diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/PTR.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/PTR.py deleted file mode 100644 index 98c3616..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/PTR.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.nsbase - - -@dns.immutable.immutable -class PTR(dns.rdtypes.nsbase.NSBase): - """PTR record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RESINFO.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RESINFO.py deleted file mode 100644 index 76c8ea2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RESINFO.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.txtbase - - -@dns.immutable.immutable -class RESINFO(dns.rdtypes.txtbase.TXTBase): - """RESINFO record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RP.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RP.py deleted file mode 100644 index a66cfc5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RP.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata - - -@dns.immutable.immutable -class RP(dns.rdata.Rdata): - """RP record""" - - # see: RFC 1183 - - __slots__ = ["mbox", "txt"] - - def __init__(self, rdclass, rdtype, mbox, txt): - super().__init__(rdclass, rdtype) - self.mbox = self._as_name(mbox) - self.txt = self._as_name(txt) - - def to_text(self, origin=None, relativize=True, **kw): - mbox = self.mbox.choose_relativity(origin, relativize) - txt = self.txt.choose_relativity(origin, relativize) - return f"{str(mbox)} {str(txt)}" - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - mbox = tok.get_name(origin, relativize, relativize_to) - txt = tok.get_name(origin, relativize, relativize_to) - return cls(rdclass, rdtype, mbox, txt) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.mbox.to_wire(file, None, origin, canonicalize) - self.txt.to_wire(file, None, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - mbox = parser.get_name(origin) - txt = parser.get_name(origin) - return cls(rdclass, rdtype, mbox, txt) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RRSIG.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RRSIG.py deleted file mode 100644 index 8beb423..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RRSIG.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import calendar -import struct -import time - -import dns.dnssectypes -import dns.exception -import dns.immutable -import dns.rdata -import dns.rdatatype - - -class BadSigTime(dns.exception.DNSException): - """Time in DNS SIG or RRSIG resource record cannot be parsed.""" - - -def sigtime_to_posixtime(what): - if len(what) <= 10 and what.isdigit(): - return int(what) - if len(what) != 14: - raise BadSigTime - year = int(what[0:4]) - month = int(what[4:6]) - day = int(what[6:8]) - hour = int(what[8:10]) - minute = int(what[10:12]) - second = int(what[12:14]) - return calendar.timegm((year, month, day, hour, minute, second, 0, 0, 0)) - - -def posixtime_to_sigtime(what): - return time.strftime("%Y%m%d%H%M%S", time.gmtime(what)) - - -@dns.immutable.immutable -class RRSIG(dns.rdata.Rdata): - """RRSIG record""" - - __slots__ = [ - "type_covered", - "algorithm", - "labels", - "original_ttl", - "expiration", - "inception", - "key_tag", - "signer", - "signature", - ] - - def __init__( - self, - rdclass, - rdtype, - type_covered, - algorithm, - labels, - original_ttl, - expiration, - inception, - key_tag, - signer, - signature, - ): - super().__init__(rdclass, rdtype) - self.type_covered = self._as_rdatatype(type_covered) - self.algorithm = dns.dnssectypes.Algorithm.make(algorithm) - self.labels = self._as_uint8(labels) - self.original_ttl = self._as_ttl(original_ttl) - self.expiration = self._as_uint32(expiration) - self.inception = self._as_uint32(inception) - self.key_tag = self._as_uint16(key_tag) - self.signer = self._as_name(signer) - self.signature = self._as_bytes(signature) - - def covers(self): - return self.type_covered - - def to_text(self, origin=None, relativize=True, **kw): - return "%s %d %d %d %s %s %d %s %s" % ( - dns.rdatatype.to_text(self.type_covered), - self.algorithm, - self.labels, - self.original_ttl, - posixtime_to_sigtime(self.expiration), - posixtime_to_sigtime(self.inception), - self.key_tag, - self.signer.choose_relativity(origin, relativize), - dns.rdata._base64ify(self.signature, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - type_covered = dns.rdatatype.from_text(tok.get_string()) - algorithm = dns.dnssectypes.Algorithm.from_text(tok.get_string()) - labels = tok.get_int() - original_ttl = tok.get_ttl() - expiration = sigtime_to_posixtime(tok.get_string()) - inception = sigtime_to_posixtime(tok.get_string()) - key_tag = tok.get_int() - signer = tok.get_name(origin, relativize, relativize_to) - b64 = tok.concatenate_remaining_identifiers().encode() - signature = base64.b64decode(b64) - return cls( - rdclass, - rdtype, - type_covered, - algorithm, - labels, - original_ttl, - expiration, - inception, - key_tag, - signer, - signature, - ) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - header = struct.pack( - "!HBBIIIH", - self.type_covered, - self.algorithm, - self.labels, - self.original_ttl, - self.expiration, - self.inception, - self.key_tag, - ) - file.write(header) - self.signer.to_wire(file, None, origin, canonicalize) - file.write(self.signature) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - header = parser.get_struct("!HBBIIIH") - signer = parser.get_name(origin) - signature = parser.get_remaining() - return cls(rdclass, rdtype, *header, signer, signature) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RT.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RT.py deleted file mode 100644 index 5a4d45c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/RT.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.mxbase - - -@dns.immutable.immutable -class RT(dns.rdtypes.mxbase.UncompressedDowncasingMX): - """RT record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SMIMEA.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SMIMEA.py deleted file mode 100644 index 55d87bf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SMIMEA.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import dns.immutable -import dns.rdtypes.tlsabase - - -@dns.immutable.immutable -class SMIMEA(dns.rdtypes.tlsabase.TLSABase): - """SMIMEA record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SOA.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SOA.py deleted file mode 100644 index 09aa832..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SOA.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata - - -@dns.immutable.immutable -class SOA(dns.rdata.Rdata): - """SOA record""" - - # see: RFC 1035 - - __slots__ = ["mname", "rname", "serial", "refresh", "retry", "expire", "minimum"] - - def __init__( - self, rdclass, rdtype, mname, rname, serial, refresh, retry, expire, minimum - ): - super().__init__(rdclass, rdtype) - self.mname = self._as_name(mname) - self.rname = self._as_name(rname) - self.serial = self._as_uint32(serial) - self.refresh = self._as_ttl(refresh) - self.retry = self._as_ttl(retry) - self.expire = self._as_ttl(expire) - self.minimum = self._as_ttl(minimum) - - def to_text(self, origin=None, relativize=True, **kw): - mname = self.mname.choose_relativity(origin, relativize) - rname = self.rname.choose_relativity(origin, relativize) - return "%s %s %d %d %d %d %d" % ( - mname, - rname, - self.serial, - self.refresh, - self.retry, - self.expire, - self.minimum, - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - mname = tok.get_name(origin, relativize, relativize_to) - rname = tok.get_name(origin, relativize, relativize_to) - serial = tok.get_uint32() - refresh = tok.get_ttl() - retry = tok.get_ttl() - expire = tok.get_ttl() - minimum = tok.get_ttl() - return cls( - rdclass, rdtype, mname, rname, serial, refresh, retry, expire, minimum - ) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.mname.to_wire(file, compress, origin, canonicalize) - self.rname.to_wire(file, compress, origin, canonicalize) - five_ints = struct.pack( - "!IIIII", self.serial, self.refresh, self.retry, self.expire, self.minimum - ) - file.write(five_ints) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - mname = parser.get_name(origin) - rname = parser.get_name(origin) - return cls(rdclass, rdtype, mname, rname, *parser.get_struct("!IIIII")) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SPF.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SPF.py deleted file mode 100644 index 1df3b70..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SPF.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.txtbase - - -@dns.immutable.immutable -class SPF(dns.rdtypes.txtbase.TXTBase): - """SPF record""" - - # see: RFC 4408 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SSHFP.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SSHFP.py deleted file mode 100644 index d2c4b07..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/SSHFP.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2005-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import binascii -import struct - -import dns.immutable -import dns.rdata -import dns.rdatatype - - -@dns.immutable.immutable -class SSHFP(dns.rdata.Rdata): - """SSHFP record""" - - # See RFC 4255 - - __slots__ = ["algorithm", "fp_type", "fingerprint"] - - def __init__(self, rdclass, rdtype, algorithm, fp_type, fingerprint): - super().__init__(rdclass, rdtype) - self.algorithm = self._as_uint8(algorithm) - self.fp_type = self._as_uint8(fp_type) - self.fingerprint = self._as_bytes(fingerprint, True) - - def to_text(self, origin=None, relativize=True, **kw): - kw = kw.copy() - chunksize = kw.pop("chunksize", 128) - return "%d %d %s" % ( - self.algorithm, - self.fp_type, - dns.rdata._hexify(self.fingerprint, chunksize=chunksize, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - algorithm = tok.get_uint8() - fp_type = tok.get_uint8() - fingerprint = tok.concatenate_remaining_identifiers().encode() - fingerprint = binascii.unhexlify(fingerprint) - return cls(rdclass, rdtype, algorithm, fp_type, fingerprint) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - header = struct.pack("!BB", self.algorithm, self.fp_type) - file.write(header) - file.write(self.fingerprint) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - header = parser.get_struct("BB") - fingerprint = parser.get_remaining() - return cls(rdclass, rdtype, header[0], header[1], fingerprint) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TKEY.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TKEY.py deleted file mode 100644 index 75f6224..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TKEY.py +++ /dev/null @@ -1,142 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import struct - -import dns.exception -import dns.immutable -import dns.rdata - - -@dns.immutable.immutable -class TKEY(dns.rdata.Rdata): - """TKEY Record""" - - __slots__ = [ - "algorithm", - "inception", - "expiration", - "mode", - "error", - "key", - "other", - ] - - def __init__( - self, - rdclass, - rdtype, - algorithm, - inception, - expiration, - mode, - error, - key, - other=b"", - ): - super().__init__(rdclass, rdtype) - self.algorithm = self._as_name(algorithm) - self.inception = self._as_uint32(inception) - self.expiration = self._as_uint32(expiration) - self.mode = self._as_uint16(mode) - self.error = self._as_uint16(error) - self.key = self._as_bytes(key) - self.other = self._as_bytes(other) - - def to_text(self, origin=None, relativize=True, **kw): - _algorithm = self.algorithm.choose_relativity(origin, relativize) - text = "%s %u %u %u %u %s" % ( - str(_algorithm), - self.inception, - self.expiration, - self.mode, - self.error, - dns.rdata._base64ify(self.key, 0), - ) - if len(self.other) > 0: - text += f" {dns.rdata._base64ify(self.other, 0)}" - - return text - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - algorithm = tok.get_name(relativize=False) - inception = tok.get_uint32() - expiration = tok.get_uint32() - mode = tok.get_uint16() - error = tok.get_uint16() - key_b64 = tok.get_string().encode() - key = base64.b64decode(key_b64) - other_b64 = tok.concatenate_remaining_identifiers(True).encode() - other = base64.b64decode(other_b64) - - return cls( - rdclass, rdtype, algorithm, inception, expiration, mode, error, key, other - ) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.algorithm.to_wire(file, compress, origin) - file.write( - struct.pack("!IIHH", self.inception, self.expiration, self.mode, self.error) - ) - file.write(struct.pack("!H", len(self.key))) - file.write(self.key) - file.write(struct.pack("!H", len(self.other))) - if len(self.other) > 0: - file.write(self.other) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - algorithm = parser.get_name(origin) - inception, expiration, mode, error = parser.get_struct("!IIHH") - key = parser.get_counted_bytes(2) - other = parser.get_counted_bytes(2) - - return cls( - rdclass, rdtype, algorithm, inception, expiration, mode, error, key, other - ) - - # Constants for the mode field - from RFC 2930: - # 2.5 The Mode Field - # - # The mode field specifies the general scheme for key agreement or - # the purpose of the TKEY DNS message. Servers and resolvers - # supporting this specification MUST implement the Diffie-Hellman key - # agreement mode and the key deletion mode for queries. All other - # modes are OPTIONAL. A server supporting TKEY that receives a TKEY - # request with a mode it does not support returns the BADMODE error. - # The following values of the Mode octet are defined, available, or - # reserved: - # - # Value Description - # ----- ----------- - # 0 - reserved, see section 7 - # 1 server assignment - # 2 Diffie-Hellman exchange - # 3 GSS-API negotiation - # 4 resolver assignment - # 5 key deletion - # 6-65534 - available, see section 7 - # 65535 - reserved, see section 7 - SERVER_ASSIGNMENT = 1 - DIFFIE_HELLMAN_EXCHANGE = 2 - GSSAPI_NEGOTIATION = 3 - RESOLVER_ASSIGNMENT = 4 - KEY_DELETION = 5 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TLSA.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TLSA.py deleted file mode 100644 index 4dffc55..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TLSA.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import dns.immutable -import dns.rdtypes.tlsabase - - -@dns.immutable.immutable -class TLSA(dns.rdtypes.tlsabase.TLSABase): - """TLSA record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TSIG.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TSIG.py deleted file mode 100644 index 7942382..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TSIG.py +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import struct - -import dns.exception -import dns.immutable -import dns.rcode -import dns.rdata - - -@dns.immutable.immutable -class TSIG(dns.rdata.Rdata): - """TSIG record""" - - __slots__ = [ - "algorithm", - "time_signed", - "fudge", - "mac", - "original_id", - "error", - "other", - ] - - def __init__( - self, - rdclass, - rdtype, - algorithm, - time_signed, - fudge, - mac, - original_id, - error, - other, - ): - """Initialize a TSIG rdata. - - *rdclass*, an ``int`` is the rdataclass of the Rdata. - - *rdtype*, an ``int`` is the rdatatype of the Rdata. - - *algorithm*, a ``dns.name.Name``. - - *time_signed*, an ``int``. - - *fudge*, an ``int`. - - *mac*, a ``bytes`` - - *original_id*, an ``int`` - - *error*, an ``int`` - - *other*, a ``bytes`` - """ - - super().__init__(rdclass, rdtype) - self.algorithm = self._as_name(algorithm) - self.time_signed = self._as_uint48(time_signed) - self.fudge = self._as_uint16(fudge) - self.mac = self._as_bytes(mac) - self.original_id = self._as_uint16(original_id) - self.error = dns.rcode.Rcode.make(error) - self.other = self._as_bytes(other) - - def to_text(self, origin=None, relativize=True, **kw): - algorithm = self.algorithm.choose_relativity(origin, relativize) - error = dns.rcode.to_text(self.error, True) - text = ( - f"{algorithm} {self.time_signed} {self.fudge} " - + f"{len(self.mac)} {dns.rdata._base64ify(self.mac, 0)} " - + f"{self.original_id} {error} {len(self.other)}" - ) - if self.other: - text += f" {dns.rdata._base64ify(self.other, 0)}" - return text - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - algorithm = tok.get_name(relativize=False) - time_signed = tok.get_uint48() - fudge = tok.get_uint16() - mac_len = tok.get_uint16() - mac = base64.b64decode(tok.get_string()) - if len(mac) != mac_len: - raise SyntaxError("invalid MAC") - original_id = tok.get_uint16() - error = dns.rcode.from_text(tok.get_string()) - other_len = tok.get_uint16() - if other_len > 0: - other = base64.b64decode(tok.get_string()) - if len(other) != other_len: - raise SyntaxError("invalid other data") - else: - other = b"" - return cls( - rdclass, - rdtype, - algorithm, - time_signed, - fudge, - mac, - original_id, - error, - other, - ) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.algorithm.to_wire(file, None, origin, False) - file.write( - struct.pack( - "!HIHH", - (self.time_signed >> 32) & 0xFFFF, - self.time_signed & 0xFFFFFFFF, - self.fudge, - len(self.mac), - ) - ) - file.write(self.mac) - file.write(struct.pack("!HHH", self.original_id, self.error, len(self.other))) - file.write(self.other) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - algorithm = parser.get_name() - time_signed = parser.get_uint48() - fudge = parser.get_uint16() - mac = parser.get_counted_bytes(2) - (original_id, error) = parser.get_struct("!HH") - other = parser.get_counted_bytes(2) - return cls( - rdclass, - rdtype, - algorithm, - time_signed, - fudge, - mac, - original_id, - error, - other, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TXT.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TXT.py deleted file mode 100644 index 6d4dae2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/TXT.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.txtbase - - -@dns.immutable.immutable -class TXT(dns.rdtypes.txtbase.TXTBase): - """TXT record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/URI.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/URI.py deleted file mode 100644 index 2efbb30..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/URI.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# Copyright (C) 2015 Red Hat, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdtypes.util - - -@dns.immutable.immutable -class URI(dns.rdata.Rdata): - """URI record""" - - # see RFC 7553 - - __slots__ = ["priority", "weight", "target"] - - def __init__(self, rdclass, rdtype, priority, weight, target): - super().__init__(rdclass, rdtype) - self.priority = self._as_uint16(priority) - self.weight = self._as_uint16(weight) - self.target = self._as_bytes(target, True) - if len(self.target) == 0: - raise dns.exception.SyntaxError("URI target cannot be empty") - - def to_text(self, origin=None, relativize=True, **kw): - return '%d %d "%s"' % (self.priority, self.weight, self.target.decode()) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - priority = tok.get_uint16() - weight = tok.get_uint16() - target = tok.get().unescape() - if not (target.is_quoted_string() or target.is_identifier()): - raise dns.exception.SyntaxError("URI target must be a string") - return cls(rdclass, rdtype, priority, weight, target.value) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - two_ints = struct.pack("!HH", self.priority, self.weight) - file.write(two_ints) - file.write(self.target) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (priority, weight) = parser.get_struct("!HH") - target = parser.get_remaining() - if len(target) == 0: - raise dns.exception.FormError("URI target may not be empty") - return cls(rdclass, rdtype, priority, weight, target) - - def _processing_priority(self): - return self.priority - - def _processing_weight(self): - return self.weight - - @classmethod - def _processing_order(cls, iterable): - return dns.rdtypes.util.weighted_processing_order(iterable) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/WALLET.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/WALLET.py deleted file mode 100644 index ff46476..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/WALLET.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import dns.immutable -import dns.rdtypes.txtbase - - -@dns.immutable.immutable -class WALLET(dns.rdtypes.txtbase.TXTBase): - """WALLET record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/X25.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/X25.py deleted file mode 100644 index 2436ddb..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/X25.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class X25(dns.rdata.Rdata): - """X25 record""" - - # see RFC 1183 - - __slots__ = ["address"] - - def __init__(self, rdclass, rdtype, address): - super().__init__(rdclass, rdtype) - self.address = self._as_bytes(address, True, 255) - - def to_text(self, origin=None, relativize=True, **kw): - return f'"{dns.rdata._escapify(self.address)}"' - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - address = tok.get_string() - return cls(rdclass, rdtype, address) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - l = len(self.address) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(self.address) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - address = parser.get_counted_bytes() - return cls(rdclass, rdtype, address) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/ZONEMD.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/ZONEMD.py deleted file mode 100644 index c90e3ee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/ZONEMD.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import binascii -import struct - -import dns.immutable -import dns.rdata -import dns.rdatatype -import dns.zonetypes - - -@dns.immutable.immutable -class ZONEMD(dns.rdata.Rdata): - """ZONEMD record""" - - # See RFC 8976 - - __slots__ = ["serial", "scheme", "hash_algorithm", "digest"] - - def __init__(self, rdclass, rdtype, serial, scheme, hash_algorithm, digest): - super().__init__(rdclass, rdtype) - self.serial = self._as_uint32(serial) - self.scheme = dns.zonetypes.DigestScheme.make(scheme) - self.hash_algorithm = dns.zonetypes.DigestHashAlgorithm.make(hash_algorithm) - self.digest = self._as_bytes(digest) - - if self.scheme == 0: # reserved, RFC 8976 Sec. 5.2 - raise ValueError("scheme 0 is reserved") - if self.hash_algorithm == 0: # reserved, RFC 8976 Sec. 5.3 - raise ValueError("hash_algorithm 0 is reserved") - - hasher = dns.zonetypes._digest_hashers.get(self.hash_algorithm) - if hasher and hasher().digest_size != len(self.digest): - raise ValueError("digest length inconsistent with hash algorithm") - - def to_text(self, origin=None, relativize=True, **kw): - kw = kw.copy() - chunksize = kw.pop("chunksize", 128) - return "%d %d %d %s" % ( - self.serial, - self.scheme, - self.hash_algorithm, - dns.rdata._hexify(self.digest, chunksize=chunksize, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - serial = tok.get_uint32() - scheme = tok.get_uint8() - hash_algorithm = tok.get_uint8() - digest = tok.concatenate_remaining_identifiers().encode() - digest = binascii.unhexlify(digest) - return cls(rdclass, rdtype, serial, scheme, hash_algorithm, digest) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - header = struct.pack("!IBB", self.serial, self.scheme, self.hash_algorithm) - file.write(header) - file.write(self.digest) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - header = parser.get_struct("!IBB") - digest = parser.get_remaining() - return cls(rdclass, rdtype, header[0], header[1], header[2], digest) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__init__.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__init__.py deleted file mode 100644 index 647b215..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__init__.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Class ANY (generic) rdata type classes.""" - -__all__ = [ - "AFSDB", - "AMTRELAY", - "AVC", - "CAA", - "CDNSKEY", - "CDS", - "CERT", - "CNAME", - "CSYNC", - "DLV", - "DNAME", - "DNSKEY", - "DS", - "EUI48", - "EUI64", - "GPOS", - "HINFO", - "HIP", - "ISDN", - "L32", - "L64", - "LOC", - "LP", - "MX", - "NID", - "NINFO", - "NS", - "NSEC", - "NSEC3", - "NSEC3PARAM", - "OPENPGPKEY", - "OPT", - "PTR", - "RESINFO", - "RP", - "RRSIG", - "RT", - "SMIMEA", - "SOA", - "SPF", - "SSHFP", - "TKEY", - "TLSA", - "TSIG", - "TXT", - "URI", - "WALLET", - "X25", - "ZONEMD", -] diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AFSDB.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AFSDB.cpython-310.pyc deleted file mode 100644 index 3a0e42e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AFSDB.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AMTRELAY.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AMTRELAY.cpython-310.pyc deleted file mode 100644 index 468bd35..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AMTRELAY.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AVC.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AVC.cpython-310.pyc deleted file mode 100644 index 16c240e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/AVC.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CAA.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CAA.cpython-310.pyc deleted file mode 100644 index 7524573..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CAA.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CDNSKEY.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CDNSKEY.cpython-310.pyc deleted file mode 100644 index f3c9e83..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CDNSKEY.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CDS.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CDS.cpython-310.pyc deleted file mode 100644 index e61310c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CDS.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CERT.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CERT.cpython-310.pyc deleted file mode 100644 index 4f49548..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CERT.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CNAME.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CNAME.cpython-310.pyc deleted file mode 100644 index c414d15..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CNAME.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CSYNC.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CSYNC.cpython-310.pyc deleted file mode 100644 index c1f63b3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/CSYNC.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DLV.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DLV.cpython-310.pyc deleted file mode 100644 index 2e1060a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DLV.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DNAME.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DNAME.cpython-310.pyc deleted file mode 100644 index 69ea814..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DNAME.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DNSKEY.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DNSKEY.cpython-310.pyc deleted file mode 100644 index 2dc2488..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DNSKEY.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DS.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DS.cpython-310.pyc deleted file mode 100644 index 1851f3d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/DS.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/EUI48.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/EUI48.cpython-310.pyc deleted file mode 100644 index a37414c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/EUI48.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/EUI64.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/EUI64.cpython-310.pyc deleted file mode 100644 index 3b24126..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/EUI64.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/GPOS.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/GPOS.cpython-310.pyc deleted file mode 100644 index 54f02f2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/GPOS.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/HINFO.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/HINFO.cpython-310.pyc deleted file mode 100644 index 2d05c9a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/HINFO.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/HIP.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/HIP.cpython-310.pyc deleted file mode 100644 index a500459..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/HIP.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/ISDN.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/ISDN.cpython-310.pyc deleted file mode 100644 index 77fc56f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/ISDN.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/L32.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/L32.cpython-310.pyc deleted file mode 100644 index f1d1719..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/L32.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/L64.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/L64.cpython-310.pyc deleted file mode 100644 index 34adf24..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/L64.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/LOC.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/LOC.cpython-310.pyc deleted file mode 100644 index 2432d5c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/LOC.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/LP.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/LP.cpython-310.pyc deleted file mode 100644 index 00974a8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/LP.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/MX.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/MX.cpython-310.pyc deleted file mode 100644 index 20a4a70..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/MX.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NID.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NID.cpython-310.pyc deleted file mode 100644 index f4c1691..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NID.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NINFO.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NINFO.cpython-310.pyc deleted file mode 100644 index 898452f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NINFO.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NS.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NS.cpython-310.pyc deleted file mode 100644 index 9050dea..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NS.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC.cpython-310.pyc deleted file mode 100644 index 74ca49a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC3.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC3.cpython-310.pyc deleted file mode 100644 index 9c21a5e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC3.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC3PARAM.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC3PARAM.cpython-310.pyc deleted file mode 100644 index 3c605ef..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/NSEC3PARAM.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/OPENPGPKEY.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/OPENPGPKEY.cpython-310.pyc deleted file mode 100644 index ea6261a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/OPENPGPKEY.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/OPT.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/OPT.cpython-310.pyc deleted file mode 100644 index f374722..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/OPT.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/PTR.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/PTR.cpython-310.pyc deleted file mode 100644 index b6f4ec6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/PTR.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RESINFO.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RESINFO.cpython-310.pyc deleted file mode 100644 index 16cb812..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RESINFO.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RP.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RP.cpython-310.pyc deleted file mode 100644 index bdb1f19..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RP.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RRSIG.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RRSIG.cpython-310.pyc deleted file mode 100644 index 9ea25ff..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RRSIG.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RT.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RT.cpython-310.pyc deleted file mode 100644 index ca8b2fc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/RT.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SMIMEA.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SMIMEA.cpython-310.pyc deleted file mode 100644 index 7982fd5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SMIMEA.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SOA.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SOA.cpython-310.pyc deleted file mode 100644 index 68a3479..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SOA.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SPF.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SPF.cpython-310.pyc deleted file mode 100644 index 4352e88..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SPF.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SSHFP.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SSHFP.cpython-310.pyc deleted file mode 100644 index e08f22e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/SSHFP.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TKEY.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TKEY.cpython-310.pyc deleted file mode 100644 index 31d3e32..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TKEY.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TLSA.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TLSA.cpython-310.pyc deleted file mode 100644 index dadc01c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TLSA.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TSIG.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TSIG.cpython-310.pyc deleted file mode 100644 index b0e25b3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TSIG.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TXT.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TXT.cpython-310.pyc deleted file mode 100644 index ad42426..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/TXT.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/URI.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/URI.cpython-310.pyc deleted file mode 100644 index d0c6e78..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/URI.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/WALLET.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/WALLET.cpython-310.pyc deleted file mode 100644 index ef82cae..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/WALLET.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/X25.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/X25.cpython-310.pyc deleted file mode 100644 index 182eaae..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/X25.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/ZONEMD.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/ZONEMD.cpython-310.pyc deleted file mode 100644 index e7f0c75..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/ZONEMD.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index d927989..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/ANY/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/A.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/A.py deleted file mode 100644 index 832e8d3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/A.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.immutable -import dns.rdtypes.mxbase - - -@dns.immutable.immutable -class A(dns.rdata.Rdata): - """A record for Chaosnet""" - - # domain: the domain of the address - # address: the 16-bit address - - __slots__ = ["domain", "address"] - - def __init__(self, rdclass, rdtype, domain, address): - super().__init__(rdclass, rdtype) - self.domain = self._as_name(domain) - self.address = self._as_uint16(address) - - def to_text(self, origin=None, relativize=True, **kw): - domain = self.domain.choose_relativity(origin, relativize) - return f"{domain} {self.address:o}" - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - domain = tok.get_name(origin, relativize, relativize_to) - address = tok.get_uint16(base=8) - return cls(rdclass, rdtype, domain, address) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.domain.to_wire(file, compress, origin, canonicalize) - pref = struct.pack("!H", self.address) - file.write(pref) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - domain = parser.get_name(origin) - address = parser.get_uint16() - return cls(rdclass, rdtype, domain, address) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__init__.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__init__.py deleted file mode 100644 index 0760c26..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Class CH rdata type classes.""" - -__all__ = [ - "A", -] diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__pycache__/A.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__pycache__/A.cpython-310.pyc deleted file mode 100644 index 64b75c3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__pycache__/A.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 2fec932..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/CH/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/A.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/A.py deleted file mode 100644 index e09d611..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/A.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.exception -import dns.immutable -import dns.ipv4 -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class A(dns.rdata.Rdata): - """A record.""" - - __slots__ = ["address"] - - def __init__(self, rdclass, rdtype, address): - super().__init__(rdclass, rdtype) - self.address = self._as_ipv4_address(address) - - def to_text(self, origin=None, relativize=True, **kw): - return self.address - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - address = tok.get_identifier() - return cls(rdclass, rdtype, address) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(dns.ipv4.inet_aton(self.address)) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - address = parser.get_remaining() - return cls(rdclass, rdtype, address) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/AAAA.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/AAAA.py deleted file mode 100644 index 0cd139e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/AAAA.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.exception -import dns.immutable -import dns.ipv6 -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class AAAA(dns.rdata.Rdata): - """AAAA record.""" - - __slots__ = ["address"] - - def __init__(self, rdclass, rdtype, address): - super().__init__(rdclass, rdtype) - self.address = self._as_ipv6_address(address) - - def to_text(self, origin=None, relativize=True, **kw): - return self.address - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - address = tok.get_identifier() - return cls(rdclass, rdtype, address) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(dns.ipv6.inet_aton(self.address)) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - address = parser.get_remaining() - return cls(rdclass, rdtype, address) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/APL.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/APL.py deleted file mode 100644 index 44cb3fe..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/APL.py +++ /dev/null @@ -1,150 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import binascii -import codecs -import struct - -import dns.exception -import dns.immutable -import dns.ipv4 -import dns.ipv6 -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class APLItem: - """An APL list item.""" - - __slots__ = ["family", "negation", "address", "prefix"] - - def __init__(self, family, negation, address, prefix): - self.family = dns.rdata.Rdata._as_uint16(family) - self.negation = dns.rdata.Rdata._as_bool(negation) - if self.family == 1: - self.address = dns.rdata.Rdata._as_ipv4_address(address) - self.prefix = dns.rdata.Rdata._as_int(prefix, 0, 32) - elif self.family == 2: - self.address = dns.rdata.Rdata._as_ipv6_address(address) - self.prefix = dns.rdata.Rdata._as_int(prefix, 0, 128) - else: - self.address = dns.rdata.Rdata._as_bytes(address, max_length=127) - self.prefix = dns.rdata.Rdata._as_uint8(prefix) - - def __str__(self): - if self.negation: - return "!%d:%s/%s" % (self.family, self.address, self.prefix) - else: - return "%d:%s/%s" % (self.family, self.address, self.prefix) - - def to_wire(self, file): - if self.family == 1: - address = dns.ipv4.inet_aton(self.address) - elif self.family == 2: - address = dns.ipv6.inet_aton(self.address) - else: - address = binascii.unhexlify(self.address) - # - # Truncate least significant zero bytes. - # - last = 0 - for i in range(len(address) - 1, -1, -1): - if address[i] != 0: - last = i + 1 - break - address = address[0:last] - l = len(address) - assert l < 128 - if self.negation: - l |= 0x80 - header = struct.pack("!HBB", self.family, self.prefix, l) - file.write(header) - file.write(address) - - -@dns.immutable.immutable -class APL(dns.rdata.Rdata): - """APL record.""" - - # see: RFC 3123 - - __slots__ = ["items"] - - def __init__(self, rdclass, rdtype, items): - super().__init__(rdclass, rdtype) - for item in items: - if not isinstance(item, APLItem): - raise ValueError("item not an APLItem") - self.items = tuple(items) - - def to_text(self, origin=None, relativize=True, **kw): - return " ".join(map(str, self.items)) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - items = [] - for token in tok.get_remaining(): - item = token.unescape().value - if item[0] == "!": - negation = True - item = item[1:] - else: - negation = False - (family, rest) = item.split(":", 1) - family = int(family) - (address, prefix) = rest.split("/", 1) - prefix = int(prefix) - item = APLItem(family, negation, address, prefix) - items.append(item) - - return cls(rdclass, rdtype, items) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - for item in self.items: - item.to_wire(file) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - items = [] - while parser.remaining() > 0: - header = parser.get_struct("!HBB") - afdlen = header[2] - if afdlen > 127: - negation = True - afdlen -= 128 - else: - negation = False - address = parser.get_bytes(afdlen) - l = len(address) - if header[0] == 1: - if l < 4: - address += b"\x00" * (4 - l) - elif header[0] == 2: - if l < 16: - address += b"\x00" * (16 - l) - else: - # - # This isn't really right according to the RFC, but it - # seems better than throwing an exception - # - address = codecs.encode(address, "hex_codec") - item = APLItem(header[0], negation, address, header[1]) - items.append(item) - return cls(rdclass, rdtype, items) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/DHCID.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/DHCID.py deleted file mode 100644 index 723492f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/DHCID.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 - -import dns.exception -import dns.immutable -import dns.rdata - - -@dns.immutable.immutable -class DHCID(dns.rdata.Rdata): - """DHCID record""" - - # see: RFC 4701 - - __slots__ = ["data"] - - def __init__(self, rdclass, rdtype, data): - super().__init__(rdclass, rdtype) - self.data = self._as_bytes(data) - - def to_text(self, origin=None, relativize=True, **kw): - return dns.rdata._base64ify(self.data, **kw) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - b64 = tok.concatenate_remaining_identifiers().encode() - data = base64.b64decode(b64) - return cls(rdclass, rdtype, data) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(self.data) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - data = parser.get_remaining() - return cls(rdclass, rdtype, data) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/HTTPS.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/HTTPS.py deleted file mode 100644 index 15464cb..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/HTTPS.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import dns.immutable -import dns.rdtypes.svcbbase - - -@dns.immutable.immutable -class HTTPS(dns.rdtypes.svcbbase.SVCBBase): - """HTTPS record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/IPSECKEY.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/IPSECKEY.py deleted file mode 100644 index e3a6615..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/IPSECKEY.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import struct - -import dns.exception -import dns.immutable -import dns.rdtypes.util - - -class Gateway(dns.rdtypes.util.Gateway): - name = "IPSECKEY gateway" - - -@dns.immutable.immutable -class IPSECKEY(dns.rdata.Rdata): - """IPSECKEY record""" - - # see: RFC 4025 - - __slots__ = ["precedence", "gateway_type", "algorithm", "gateway", "key"] - - def __init__( - self, rdclass, rdtype, precedence, gateway_type, algorithm, gateway, key - ): - super().__init__(rdclass, rdtype) - gateway = Gateway(gateway_type, gateway) - self.precedence = self._as_uint8(precedence) - self.gateway_type = gateway.type - self.algorithm = self._as_uint8(algorithm) - self.gateway = gateway.gateway - self.key = self._as_bytes(key) - - def to_text(self, origin=None, relativize=True, **kw): - gateway = Gateway(self.gateway_type, self.gateway).to_text(origin, relativize) - return "%d %d %d %s %s" % ( - self.precedence, - self.gateway_type, - self.algorithm, - gateway, - dns.rdata._base64ify(self.key, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - precedence = tok.get_uint8() - gateway_type = tok.get_uint8() - algorithm = tok.get_uint8() - gateway = Gateway.from_text( - gateway_type, tok, origin, relativize, relativize_to - ) - b64 = tok.concatenate_remaining_identifiers().encode() - key = base64.b64decode(b64) - return cls( - rdclass, rdtype, precedence, gateway_type, algorithm, gateway.gateway, key - ) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - header = struct.pack("!BBB", self.precedence, self.gateway_type, self.algorithm) - file.write(header) - Gateway(self.gateway_type, self.gateway).to_wire( - file, compress, origin, canonicalize - ) - file.write(self.key) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - header = parser.get_struct("!BBB") - gateway_type = header[1] - gateway = Gateway.from_wire_parser(gateway_type, parser, origin) - key = parser.get_remaining() - return cls( - rdclass, rdtype, header[0], gateway_type, header[2], gateway.gateway, key - ) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/KX.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/KX.py deleted file mode 100644 index 6073df4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/KX.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.mxbase - - -@dns.immutable.immutable -class KX(dns.rdtypes.mxbase.UncompressedDowncasingMX): - """KX record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NAPTR.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NAPTR.py deleted file mode 100644 index 195d1cb..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NAPTR.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdtypes.util - - -def _write_string(file, s): - l = len(s) - assert l < 256 - file.write(struct.pack("!B", l)) - file.write(s) - - -@dns.immutable.immutable -class NAPTR(dns.rdata.Rdata): - """NAPTR record""" - - # see: RFC 3403 - - __slots__ = ["order", "preference", "flags", "service", "regexp", "replacement"] - - def __init__( - self, rdclass, rdtype, order, preference, flags, service, regexp, replacement - ): - super().__init__(rdclass, rdtype) - self.flags = self._as_bytes(flags, True, 255) - self.service = self._as_bytes(service, True, 255) - self.regexp = self._as_bytes(regexp, True, 255) - self.order = self._as_uint16(order) - self.preference = self._as_uint16(preference) - self.replacement = self._as_name(replacement) - - def to_text(self, origin=None, relativize=True, **kw): - replacement = self.replacement.choose_relativity(origin, relativize) - return '%d %d "%s" "%s" "%s" %s' % ( - self.order, - self.preference, - dns.rdata._escapify(self.flags), - dns.rdata._escapify(self.service), - dns.rdata._escapify(self.regexp), - replacement, - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - order = tok.get_uint16() - preference = tok.get_uint16() - flags = tok.get_string() - service = tok.get_string() - regexp = tok.get_string() - replacement = tok.get_name(origin, relativize, relativize_to) - return cls( - rdclass, rdtype, order, preference, flags, service, regexp, replacement - ) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - two_ints = struct.pack("!HH", self.order, self.preference) - file.write(two_ints) - _write_string(file, self.flags) - _write_string(file, self.service) - _write_string(file, self.regexp) - self.replacement.to_wire(file, compress, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (order, preference) = parser.get_struct("!HH") - strings = [] - for _ in range(3): - s = parser.get_counted_bytes() - strings.append(s) - replacement = parser.get_name(origin) - return cls( - rdclass, - rdtype, - order, - preference, - strings[0], - strings[1], - strings[2], - replacement, - ) - - def _processing_priority(self): - return (self.order, self.preference) - - @classmethod - def _processing_order(cls, iterable): - return dns.rdtypes.util.priority_processing_order(iterable) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NSAP.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NSAP.py deleted file mode 100644 index d55edb7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NSAP.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import binascii - -import dns.exception -import dns.immutable -import dns.rdata -import dns.tokenizer - - -@dns.immutable.immutable -class NSAP(dns.rdata.Rdata): - """NSAP record.""" - - # see: RFC 1706 - - __slots__ = ["address"] - - def __init__(self, rdclass, rdtype, address): - super().__init__(rdclass, rdtype) - self.address = self._as_bytes(address) - - def to_text(self, origin=None, relativize=True, **kw): - return f"0x{binascii.hexlify(self.address).decode()}" - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - address = tok.get_string() - if address[0:2] != "0x": - raise dns.exception.SyntaxError("string does not start with 0x") - address = address[2:].replace(".", "") - if len(address) % 2 != 0: - raise dns.exception.SyntaxError("hexstring has odd length") - address = binascii.unhexlify(address.encode()) - return cls(rdclass, rdtype, address) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(self.address) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - address = parser.get_remaining() - return cls(rdclass, rdtype, address) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NSAP_PTR.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NSAP_PTR.py deleted file mode 100644 index ce1c663..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/NSAP_PTR.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import dns.immutable -import dns.rdtypes.nsbase - - -@dns.immutable.immutable -class NSAP_PTR(dns.rdtypes.nsbase.UncompressedNS): - """NSAP-PTR record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/PX.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/PX.py deleted file mode 100644 index cdca153..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/PX.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdtypes.util - - -@dns.immutable.immutable -class PX(dns.rdata.Rdata): - """PX record.""" - - # see: RFC 2163 - - __slots__ = ["preference", "map822", "mapx400"] - - def __init__(self, rdclass, rdtype, preference, map822, mapx400): - super().__init__(rdclass, rdtype) - self.preference = self._as_uint16(preference) - self.map822 = self._as_name(map822) - self.mapx400 = self._as_name(mapx400) - - def to_text(self, origin=None, relativize=True, **kw): - map822 = self.map822.choose_relativity(origin, relativize) - mapx400 = self.mapx400.choose_relativity(origin, relativize) - return "%d %s %s" % (self.preference, map822, mapx400) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - preference = tok.get_uint16() - map822 = tok.get_name(origin, relativize, relativize_to) - mapx400 = tok.get_name(origin, relativize, relativize_to) - return cls(rdclass, rdtype, preference, map822, mapx400) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - pref = struct.pack("!H", self.preference) - file.write(pref) - self.map822.to_wire(file, None, origin, canonicalize) - self.mapx400.to_wire(file, None, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - preference = parser.get_uint16() - map822 = parser.get_name(origin) - mapx400 = parser.get_name(origin) - return cls(rdclass, rdtype, preference, map822, mapx400) - - def _processing_priority(self): - return self.preference - - @classmethod - def _processing_order(cls, iterable): - return dns.rdtypes.util.priority_processing_order(iterable) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/SRV.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/SRV.py deleted file mode 100644 index 5adef98..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/SRV.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import struct - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdtypes.util - - -@dns.immutable.immutable -class SRV(dns.rdata.Rdata): - """SRV record""" - - # see: RFC 2782 - - __slots__ = ["priority", "weight", "port", "target"] - - def __init__(self, rdclass, rdtype, priority, weight, port, target): - super().__init__(rdclass, rdtype) - self.priority = self._as_uint16(priority) - self.weight = self._as_uint16(weight) - self.port = self._as_uint16(port) - self.target = self._as_name(target) - - def to_text(self, origin=None, relativize=True, **kw): - target = self.target.choose_relativity(origin, relativize) - return "%d %d %d %s" % (self.priority, self.weight, self.port, target) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - priority = tok.get_uint16() - weight = tok.get_uint16() - port = tok.get_uint16() - target = tok.get_name(origin, relativize, relativize_to) - return cls(rdclass, rdtype, priority, weight, port, target) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - three_ints = struct.pack("!HHH", self.priority, self.weight, self.port) - file.write(three_ints) - self.target.to_wire(file, compress, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - (priority, weight, port) = parser.get_struct("!HHH") - target = parser.get_name(origin) - return cls(rdclass, rdtype, priority, weight, port, target) - - def _processing_priority(self): - return self.priority - - def _processing_weight(self): - return self.weight - - @classmethod - def _processing_order(cls, iterable): - return dns.rdtypes.util.weighted_processing_order(iterable) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/SVCB.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/SVCB.py deleted file mode 100644 index ff3e932..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/SVCB.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import dns.immutable -import dns.rdtypes.svcbbase - - -@dns.immutable.immutable -class SVCB(dns.rdtypes.svcbbase.SVCBBase): - """SVCB record""" diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/WKS.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/WKS.py deleted file mode 100644 index 881a784..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/WKS.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import socket -import struct - -import dns.immutable -import dns.ipv4 -import dns.rdata - -try: - _proto_tcp = socket.getprotobyname("tcp") - _proto_udp = socket.getprotobyname("udp") -except OSError: - # Fall back to defaults in case /etc/protocols is unavailable. - _proto_tcp = 6 - _proto_udp = 17 - - -@dns.immutable.immutable -class WKS(dns.rdata.Rdata): - """WKS record""" - - # see: RFC 1035 - - __slots__ = ["address", "protocol", "bitmap"] - - def __init__(self, rdclass, rdtype, address, protocol, bitmap): - super().__init__(rdclass, rdtype) - self.address = self._as_ipv4_address(address) - self.protocol = self._as_uint8(protocol) - self.bitmap = self._as_bytes(bitmap) - - def to_text(self, origin=None, relativize=True, **kw): - bits = [] - for i, byte in enumerate(self.bitmap): - for j in range(0, 8): - if byte & (0x80 >> j): - bits.append(str(i * 8 + j)) - text = " ".join(bits) - return "%s %d %s" % (self.address, self.protocol, text) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - address = tok.get_string() - protocol = tok.get_string() - if protocol.isdigit(): - protocol = int(protocol) - else: - protocol = socket.getprotobyname(protocol) - bitmap = bytearray() - for token in tok.get_remaining(): - value = token.unescape().value - if value.isdigit(): - serv = int(value) - else: - if protocol != _proto_udp and protocol != _proto_tcp: - raise NotImplementedError("protocol must be TCP or UDP") - if protocol == _proto_udp: - protocol_text = "udp" - else: - protocol_text = "tcp" - serv = socket.getservbyname(value, protocol_text) - i = serv // 8 - l = len(bitmap) - if l < i + 1: - for _ in range(l, i + 1): - bitmap.append(0) - bitmap[i] = bitmap[i] | (0x80 >> (serv % 8)) - bitmap = dns.rdata._truncate_bitmap(bitmap) - return cls(rdclass, rdtype, address, protocol, bitmap) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(dns.ipv4.inet_aton(self.address)) - protocol = struct.pack("!B", self.protocol) - file.write(protocol) - file.write(self.bitmap) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - address = parser.get_bytes(4) - protocol = parser.get_uint8() - bitmap = parser.get_remaining() - return cls(rdclass, rdtype, address, protocol, bitmap) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__init__.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__init__.py deleted file mode 100644 index dcec4dd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Class IN rdata type classes.""" - -__all__ = [ - "A", - "AAAA", - "APL", - "DHCID", - "HTTPS", - "IPSECKEY", - "KX", - "NAPTR", - "NSAP", - "NSAP_PTR", - "PX", - "SRV", - "SVCB", - "WKS", -] diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/A.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/A.cpython-310.pyc deleted file mode 100644 index b2f7af7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/A.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/AAAA.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/AAAA.cpython-310.pyc deleted file mode 100644 index 0deb17b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/AAAA.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/APL.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/APL.cpython-310.pyc deleted file mode 100644 index cbd8205..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/APL.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/DHCID.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/DHCID.cpython-310.pyc deleted file mode 100644 index 4a5a429..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/DHCID.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/HTTPS.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/HTTPS.cpython-310.pyc deleted file mode 100644 index f80fccf..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/HTTPS.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/IPSECKEY.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/IPSECKEY.cpython-310.pyc deleted file mode 100644 index 45d253e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/IPSECKEY.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/KX.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/KX.cpython-310.pyc deleted file mode 100644 index efd9e78..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/KX.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NAPTR.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NAPTR.cpython-310.pyc deleted file mode 100644 index e00fa37..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NAPTR.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NSAP.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NSAP.cpython-310.pyc deleted file mode 100644 index 06b043a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NSAP.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NSAP_PTR.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NSAP_PTR.cpython-310.pyc deleted file mode 100644 index cfb4764..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/NSAP_PTR.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/PX.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/PX.cpython-310.pyc deleted file mode 100644 index f1c141e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/PX.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/SRV.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/SRV.cpython-310.pyc deleted file mode 100644 index 59ef64f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/SRV.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/SVCB.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/SVCB.cpython-310.pyc deleted file mode 100644 index 3a12839..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/SVCB.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/WKS.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/WKS.cpython-310.pyc deleted file mode 100644 index 8a0fc7c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/WKS.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 91680e4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/IN/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__init__.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__init__.py deleted file mode 100644 index 3997f84..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS rdata type classes""" - -__all__ = [ - "ANY", - "IN", - "CH", - "dnskeybase", - "dsbase", - "euibase", - "mxbase", - "nsbase", - "svcbbase", - "tlsabase", - "txtbase", - "util", -] diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 15fa372..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/dnskeybase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/dnskeybase.cpython-310.pyc deleted file mode 100644 index 3700610..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/dnskeybase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/dsbase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/dsbase.cpython-310.pyc deleted file mode 100644 index 1bc7429..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/dsbase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/euibase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/euibase.cpython-310.pyc deleted file mode 100644 index 625b935..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/euibase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/mxbase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/mxbase.cpython-310.pyc deleted file mode 100644 index f60b52c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/mxbase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/nsbase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/nsbase.cpython-310.pyc deleted file mode 100644 index 3c58ec3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/nsbase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/svcbbase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/svcbbase.cpython-310.pyc deleted file mode 100644 index 4dc1505..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/svcbbase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/tlsabase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/tlsabase.cpython-310.pyc deleted file mode 100644 index 77b1414..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/tlsabase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/txtbase.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/txtbase.cpython-310.pyc deleted file mode 100644 index 1df1dd2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/txtbase.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/util.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/util.cpython-310.pyc deleted file mode 100644 index 5a684aa..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/__pycache__/util.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/dnskeybase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/dnskeybase.py deleted file mode 100644 index db300f8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/dnskeybase.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import base64 -import enum -import struct - -import dns.dnssectypes -import dns.exception -import dns.immutable -import dns.rdata - -# wildcard import -__all__ = ["SEP", "REVOKE", "ZONE"] # noqa: F822 - - -class Flag(enum.IntFlag): - SEP = 0x0001 - REVOKE = 0x0080 - ZONE = 0x0100 - - -@dns.immutable.immutable -class DNSKEYBase(dns.rdata.Rdata): - """Base class for rdata that is like a DNSKEY record""" - - __slots__ = ["flags", "protocol", "algorithm", "key"] - - def __init__(self, rdclass, rdtype, flags, protocol, algorithm, key): - super().__init__(rdclass, rdtype) - self.flags = Flag(self._as_uint16(flags)) - self.protocol = self._as_uint8(protocol) - self.algorithm = dns.dnssectypes.Algorithm.make(algorithm) - self.key = self._as_bytes(key) - - def to_text(self, origin=None, relativize=True, **kw): - return "%d %d %d %s" % ( - self.flags, - self.protocol, - self.algorithm, - dns.rdata._base64ify(self.key, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - flags = tok.get_uint16() - protocol = tok.get_uint8() - algorithm = tok.get_string() - b64 = tok.concatenate_remaining_identifiers().encode() - key = base64.b64decode(b64) - return cls(rdclass, rdtype, flags, protocol, algorithm, key) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - header = struct.pack("!HBB", self.flags, self.protocol, self.algorithm) - file.write(header) - file.write(self.key) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - header = parser.get_struct("!HBB") - key = parser.get_remaining() - return cls(rdclass, rdtype, header[0], header[1], header[2], key) - - -### BEGIN generated Flag constants - -SEP = Flag.SEP -REVOKE = Flag.REVOKE -ZONE = Flag.ZONE - -### END generated Flag constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/dsbase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/dsbase.py deleted file mode 100644 index cd21f02..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/dsbase.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2010, 2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import binascii -import struct - -import dns.dnssectypes -import dns.immutable -import dns.rdata -import dns.rdatatype - - -@dns.immutable.immutable -class DSBase(dns.rdata.Rdata): - """Base class for rdata that is like a DS record""" - - __slots__ = ["key_tag", "algorithm", "digest_type", "digest"] - - # Digest types registry: - # https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml - _digest_length_by_type = { - 1: 20, # SHA-1, RFC 3658 Sec. 2.4 - 2: 32, # SHA-256, RFC 4509 Sec. 2.2 - 3: 32, # GOST R 34.11-94, RFC 5933 Sec. 4 in conjunction with RFC 4490 Sec. 2.1 - 4: 48, # SHA-384, RFC 6605 Sec. 2 - } - - def __init__(self, rdclass, rdtype, key_tag, algorithm, digest_type, digest): - super().__init__(rdclass, rdtype) - self.key_tag = self._as_uint16(key_tag) - self.algorithm = dns.dnssectypes.Algorithm.make(algorithm) - self.digest_type = dns.dnssectypes.DSDigest.make(self._as_uint8(digest_type)) - self.digest = self._as_bytes(digest) - try: - if len(self.digest) != self._digest_length_by_type[self.digest_type]: - raise ValueError("digest length inconsistent with digest type") - except KeyError: - if self.digest_type == 0: # reserved, RFC 3658 Sec. 2.4 - raise ValueError("digest type 0 is reserved") - - def to_text(self, origin=None, relativize=True, **kw): - kw = kw.copy() - chunksize = kw.pop("chunksize", 128) - return "%d %d %d %s" % ( - self.key_tag, - self.algorithm, - self.digest_type, - dns.rdata._hexify(self.digest, chunksize=chunksize, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - key_tag = tok.get_uint16() - algorithm = tok.get_string() - digest_type = tok.get_uint8() - digest = tok.concatenate_remaining_identifiers().encode() - digest = binascii.unhexlify(digest) - return cls(rdclass, rdtype, key_tag, algorithm, digest_type, digest) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - header = struct.pack("!HBB", self.key_tag, self.algorithm, self.digest_type) - file.write(header) - file.write(self.digest) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - header = parser.get_struct("!HBB") - digest = parser.get_remaining() - return cls(rdclass, rdtype, header[0], header[1], header[2], digest) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/euibase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/euibase.py deleted file mode 100644 index a39c166..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/euibase.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (C) 2015 Red Hat, Inc. -# Author: Petr Spacek -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED 'AS IS' AND RED HAT DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import binascii - -import dns.immutable -import dns.rdata - - -@dns.immutable.immutable -class EUIBase(dns.rdata.Rdata): - """EUIxx record""" - - # see: rfc7043.txt - - __slots__ = ["eui"] - # define these in subclasses - # byte_len = 6 # 0123456789ab (in hex) - # text_len = byte_len * 3 - 1 # 01-23-45-67-89-ab - - def __init__(self, rdclass, rdtype, eui): - super().__init__(rdclass, rdtype) - self.eui = self._as_bytes(eui) - if len(self.eui) != self.byte_len: - raise dns.exception.FormError( - f"EUI{self.byte_len * 8} rdata has to have {self.byte_len} bytes" - ) - - def to_text(self, origin=None, relativize=True, **kw): - return dns.rdata._hexify(self.eui, chunksize=2, separator=b"-", **kw) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - text = tok.get_string() - if len(text) != cls.text_len: - raise dns.exception.SyntaxError( - f"Input text must have {cls.text_len} characters" - ) - for i in range(2, cls.byte_len * 3 - 1, 3): - if text[i] != "-": - raise dns.exception.SyntaxError(f"Dash expected at position {i}") - text = text.replace("-", "") - try: - data = binascii.unhexlify(text.encode()) - except (ValueError, TypeError) as ex: - raise dns.exception.SyntaxError(f"Hex decoding error: {str(ex)}") - return cls(rdclass, rdtype, data) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(self.eui) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - eui = parser.get_bytes(cls.byte_len) - return cls(rdclass, rdtype, eui) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/mxbase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/mxbase.py deleted file mode 100644 index 6d5e3d8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/mxbase.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""MX-like base classes.""" - -import struct - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata -import dns.rdtypes.util - - -@dns.immutable.immutable -class MXBase(dns.rdata.Rdata): - """Base class for rdata that is like an MX record.""" - - __slots__ = ["preference", "exchange"] - - def __init__(self, rdclass, rdtype, preference, exchange): - super().__init__(rdclass, rdtype) - self.preference = self._as_uint16(preference) - self.exchange = self._as_name(exchange) - - def to_text(self, origin=None, relativize=True, **kw): - exchange = self.exchange.choose_relativity(origin, relativize) - return "%d %s" % (self.preference, exchange) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - preference = tok.get_uint16() - exchange = tok.get_name(origin, relativize, relativize_to) - return cls(rdclass, rdtype, preference, exchange) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - pref = struct.pack("!H", self.preference) - file.write(pref) - self.exchange.to_wire(file, compress, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - preference = parser.get_uint16() - exchange = parser.get_name(origin) - return cls(rdclass, rdtype, preference, exchange) - - def _processing_priority(self): - return self.preference - - @classmethod - def _processing_order(cls, iterable): - return dns.rdtypes.util.priority_processing_order(iterable) - - -@dns.immutable.immutable -class UncompressedMX(MXBase): - """Base class for rdata that is like an MX record, but whose name - is not compressed when converted to DNS wire format, and whose - digestable form is not downcased.""" - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - super()._to_wire(file, None, origin, False) - - -@dns.immutable.immutable -class UncompressedDowncasingMX(MXBase): - """Base class for rdata that is like an MX record, but whose name - is not compressed when convert to DNS wire format.""" - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - super()._to_wire(file, None, origin, canonicalize) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/nsbase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/nsbase.py deleted file mode 100644 index 904224f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/nsbase.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""NS-like base classes.""" - -import dns.exception -import dns.immutable -import dns.name -import dns.rdata - - -@dns.immutable.immutable -class NSBase(dns.rdata.Rdata): - """Base class for rdata that is like an NS record.""" - - __slots__ = ["target"] - - def __init__(self, rdclass, rdtype, target): - super().__init__(rdclass, rdtype) - self.target = self._as_name(target) - - def to_text(self, origin=None, relativize=True, **kw): - target = self.target.choose_relativity(origin, relativize) - return str(target) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - target = tok.get_name(origin, relativize, relativize_to) - return cls(rdclass, rdtype, target) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.target.to_wire(file, compress, origin, canonicalize) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - target = parser.get_name(origin) - return cls(rdclass, rdtype, target) - - -@dns.immutable.immutable -class UncompressedNS(NSBase): - """Base class for rdata that is like an NS record, but whose name - is not compressed when convert to DNS wire format, and whose - digestable form is not downcased.""" - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - self.target.to_wire(file, None, origin, False) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/svcbbase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/svcbbase.py deleted file mode 100644 index a2b15b9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/svcbbase.py +++ /dev/null @@ -1,585 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import base64 -import enum -import struct - -import dns.enum -import dns.exception -import dns.immutable -import dns.ipv4 -import dns.ipv6 -import dns.name -import dns.rdata -import dns.rdtypes.util -import dns.renderer -import dns.tokenizer -import dns.wire - -# Until there is an RFC, this module is experimental and may be changed in -# incompatible ways. - - -class UnknownParamKey(dns.exception.DNSException): - """Unknown SVCB ParamKey""" - - -class ParamKey(dns.enum.IntEnum): - """SVCB ParamKey""" - - MANDATORY = 0 - ALPN = 1 - NO_DEFAULT_ALPN = 2 - PORT = 3 - IPV4HINT = 4 - ECH = 5 - IPV6HINT = 6 - DOHPATH = 7 - OHTTP = 8 - - @classmethod - def _maximum(cls): - return 65535 - - @classmethod - def _short_name(cls): - return "SVCBParamKey" - - @classmethod - def _prefix(cls): - return "KEY" - - @classmethod - def _unknown_exception_class(cls): - return UnknownParamKey - - -class Emptiness(enum.IntEnum): - NEVER = 0 - ALWAYS = 1 - ALLOWED = 2 - - -def _validate_key(key): - force_generic = False - if isinstance(key, bytes): - # We decode to latin-1 so we get 0-255 as valid and do NOT interpret - # UTF-8 sequences - key = key.decode("latin-1") - if isinstance(key, str): - if key.lower().startswith("key"): - force_generic = True - if key[3:].startswith("0") and len(key) != 4: - # key has leading zeros - raise ValueError("leading zeros in key") - key = key.replace("-", "_") - return (ParamKey.make(key), force_generic) - - -def key_to_text(key): - return ParamKey.to_text(key).replace("_", "-").lower() - - -# Like rdata escapify, but escapes ',' too. - -_escaped = b'",\\' - - -def _escapify(qstring): - text = "" - for c in qstring: - if c in _escaped: - text += "\\" + chr(c) - elif c >= 0x20 and c < 0x7F: - text += chr(c) - else: - text += "\\%03d" % c - return text - - -def _unescape(value): - if value == "": - return value - unescaped = b"" - l = len(value) - i = 0 - while i < l: - c = value[i] - i += 1 - if c == "\\": - if i >= l: # pragma: no cover (can't happen via tokenizer get()) - raise dns.exception.UnexpectedEnd - c = value[i] - i += 1 - if c.isdigit(): - if i >= l: - raise dns.exception.UnexpectedEnd - c2 = value[i] - i += 1 - if i >= l: - raise dns.exception.UnexpectedEnd - c3 = value[i] - i += 1 - if not (c2.isdigit() and c3.isdigit()): - raise dns.exception.SyntaxError - codepoint = int(c) * 100 + int(c2) * 10 + int(c3) - if codepoint > 255: - raise dns.exception.SyntaxError - unescaped += b"%c" % (codepoint) - continue - unescaped += c.encode() - return unescaped - - -def _split(value): - l = len(value) - i = 0 - items = [] - unescaped = b"" - while i < l: - c = value[i] - i += 1 - if c == ord("\\"): - if i >= l: # pragma: no cover (can't happen via tokenizer get()) - raise dns.exception.UnexpectedEnd - c = value[i] - i += 1 - unescaped += b"%c" % (c) - elif c == ord(","): - items.append(unescaped) - unescaped = b"" - else: - unescaped += b"%c" % (c) - items.append(unescaped) - return items - - -@dns.immutable.immutable -class Param: - """Abstract base class for SVCB parameters""" - - @classmethod - def emptiness(cls): - return Emptiness.NEVER - - -@dns.immutable.immutable -class GenericParam(Param): - """Generic SVCB parameter""" - - def __init__(self, value): - self.value = dns.rdata.Rdata._as_bytes(value, True) - - @classmethod - def emptiness(cls): - return Emptiness.ALLOWED - - @classmethod - def from_value(cls, value): - if value is None or len(value) == 0: - return None - else: - return cls(_unescape(value)) - - def to_text(self): - return '"' + dns.rdata._escapify(self.value) + '"' - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - value = parser.get_bytes(parser.remaining()) - if len(value) == 0: - return None - else: - return cls(value) - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - file.write(self.value) - - -@dns.immutable.immutable -class MandatoryParam(Param): - def __init__(self, keys): - # check for duplicates - keys = sorted([_validate_key(key)[0] for key in keys]) - prior_k = None - for k in keys: - if k == prior_k: - raise ValueError(f"duplicate key {k:d}") - prior_k = k - if k == ParamKey.MANDATORY: - raise ValueError("listed the mandatory key as mandatory") - self.keys = tuple(keys) - - @classmethod - def from_value(cls, value): - keys = [k.encode() for k in value.split(",")] - return cls(keys) - - def to_text(self): - return '"' + ",".join([key_to_text(key) for key in self.keys]) + '"' - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - keys = [] - last_key = -1 - while parser.remaining() > 0: - key = parser.get_uint16() - if key < last_key: - raise dns.exception.FormError("manadatory keys not ascending") - last_key = key - keys.append(key) - return cls(keys) - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - for key in self.keys: - file.write(struct.pack("!H", key)) - - -@dns.immutable.immutable -class ALPNParam(Param): - def __init__(self, ids): - self.ids = dns.rdata.Rdata._as_tuple( - ids, lambda x: dns.rdata.Rdata._as_bytes(x, True, 255, False) - ) - - @classmethod - def from_value(cls, value): - return cls(_split(_unescape(value))) - - def to_text(self): - value = ",".join([_escapify(id) for id in self.ids]) - return '"' + dns.rdata._escapify(value.encode()) + '"' - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - ids = [] - while parser.remaining() > 0: - id = parser.get_counted_bytes() - ids.append(id) - return cls(ids) - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - for id in self.ids: - file.write(struct.pack("!B", len(id))) - file.write(id) - - -@dns.immutable.immutable -class NoDefaultALPNParam(Param): - # We don't ever expect to instantiate this class, but we need - # a from_value() and a from_wire_parser(), so we just return None - # from the class methods when things are OK. - - @classmethod - def emptiness(cls): - return Emptiness.ALWAYS - - @classmethod - def from_value(cls, value): - if value is None or value == "": - return None - else: - raise ValueError("no-default-alpn with non-empty value") - - def to_text(self): - raise NotImplementedError # pragma: no cover - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - if parser.remaining() != 0: - raise dns.exception.FormError - return None - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - raise NotImplementedError # pragma: no cover - - -@dns.immutable.immutable -class PortParam(Param): - def __init__(self, port): - self.port = dns.rdata.Rdata._as_uint16(port) - - @classmethod - def from_value(cls, value): - value = int(value) - return cls(value) - - def to_text(self): - return f'"{self.port}"' - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - port = parser.get_uint16() - return cls(port) - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - file.write(struct.pack("!H", self.port)) - - -@dns.immutable.immutable -class IPv4HintParam(Param): - def __init__(self, addresses): - self.addresses = dns.rdata.Rdata._as_tuple( - addresses, dns.rdata.Rdata._as_ipv4_address - ) - - @classmethod - def from_value(cls, value): - addresses = value.split(",") - return cls(addresses) - - def to_text(self): - return '"' + ",".join(self.addresses) + '"' - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - addresses = [] - while parser.remaining() > 0: - ip = parser.get_bytes(4) - addresses.append(dns.ipv4.inet_ntoa(ip)) - return cls(addresses) - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - for address in self.addresses: - file.write(dns.ipv4.inet_aton(address)) - - -@dns.immutable.immutable -class IPv6HintParam(Param): - def __init__(self, addresses): - self.addresses = dns.rdata.Rdata._as_tuple( - addresses, dns.rdata.Rdata._as_ipv6_address - ) - - @classmethod - def from_value(cls, value): - addresses = value.split(",") - return cls(addresses) - - def to_text(self): - return '"' + ",".join(self.addresses) + '"' - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - addresses = [] - while parser.remaining() > 0: - ip = parser.get_bytes(16) - addresses.append(dns.ipv6.inet_ntoa(ip)) - return cls(addresses) - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - for address in self.addresses: - file.write(dns.ipv6.inet_aton(address)) - - -@dns.immutable.immutable -class ECHParam(Param): - def __init__(self, ech): - self.ech = dns.rdata.Rdata._as_bytes(ech, True) - - @classmethod - def from_value(cls, value): - if "\\" in value: - raise ValueError("escape in ECH value") - value = base64.b64decode(value.encode()) - return cls(value) - - def to_text(self): - b64 = base64.b64encode(self.ech).decode("ascii") - return f'"{b64}"' - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - value = parser.get_bytes(parser.remaining()) - return cls(value) - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - file.write(self.ech) - - -@dns.immutable.immutable -class OHTTPParam(Param): - # We don't ever expect to instantiate this class, but we need - # a from_value() and a from_wire_parser(), so we just return None - # from the class methods when things are OK. - - @classmethod - def emptiness(cls): - return Emptiness.ALWAYS - - @classmethod - def from_value(cls, value): - if value is None or value == "": - return None - else: - raise ValueError("ohttp with non-empty value") - - def to_text(self): - raise NotImplementedError # pragma: no cover - - @classmethod - def from_wire_parser(cls, parser, origin=None): # pylint: disable=W0613 - if parser.remaining() != 0: - raise dns.exception.FormError - return None - - def to_wire(self, file, origin=None): # pylint: disable=W0613 - raise NotImplementedError # pragma: no cover - - -_class_for_key = { - ParamKey.MANDATORY: MandatoryParam, - ParamKey.ALPN: ALPNParam, - ParamKey.NO_DEFAULT_ALPN: NoDefaultALPNParam, - ParamKey.PORT: PortParam, - ParamKey.IPV4HINT: IPv4HintParam, - ParamKey.ECH: ECHParam, - ParamKey.IPV6HINT: IPv6HintParam, - ParamKey.OHTTP: OHTTPParam, -} - - -def _validate_and_define(params, key, value): - (key, force_generic) = _validate_key(_unescape(key)) - if key in params: - raise SyntaxError(f'duplicate key "{key:d}"') - cls = _class_for_key.get(key, GenericParam) - emptiness = cls.emptiness() - if value is None: - if emptiness == Emptiness.NEVER: - raise SyntaxError("value cannot be empty") - value = cls.from_value(value) - else: - if force_generic: - value = cls.from_wire_parser(dns.wire.Parser(_unescape(value))) - else: - value = cls.from_value(value) - params[key] = value - - -@dns.immutable.immutable -class SVCBBase(dns.rdata.Rdata): - """Base class for SVCB-like records""" - - # see: draft-ietf-dnsop-svcb-https-11 - - __slots__ = ["priority", "target", "params"] - - def __init__(self, rdclass, rdtype, priority, target, params): - super().__init__(rdclass, rdtype) - self.priority = self._as_uint16(priority) - self.target = self._as_name(target) - for k, v in params.items(): - k = ParamKey.make(k) - if not isinstance(v, Param) and v is not None: - raise ValueError(f"{k:d} not a Param") - self.params = dns.immutable.Dict(params) - # Make sure any parameter listed as mandatory is present in the - # record. - mandatory = params.get(ParamKey.MANDATORY) - if mandatory: - for key in mandatory.keys: - # Note we have to say "not in" as we have None as a value - # so a get() and a not None test would be wrong. - if key not in params: - raise ValueError(f"key {key:d} declared mandatory but not present") - # The no-default-alpn parameter requires the alpn parameter. - if ParamKey.NO_DEFAULT_ALPN in params: - if ParamKey.ALPN not in params: - raise ValueError("no-default-alpn present, but alpn missing") - - def to_text(self, origin=None, relativize=True, **kw): - target = self.target.choose_relativity(origin, relativize) - params = [] - for key in sorted(self.params.keys()): - value = self.params[key] - if value is None: - params.append(key_to_text(key)) - else: - kv = key_to_text(key) + "=" + value.to_text() - params.append(kv) - if len(params) > 0: - space = " " - else: - space = "" - return "%d %s%s%s" % (self.priority, target, space, " ".join(params)) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - priority = tok.get_uint16() - target = tok.get_name(origin, relativize, relativize_to) - if priority == 0: - token = tok.get() - if not token.is_eol_or_eof(): - raise SyntaxError("parameters in AliasMode") - tok.unget(token) - params = {} - while True: - token = tok.get() - if token.is_eol_or_eof(): - tok.unget(token) - break - if token.ttype != dns.tokenizer.IDENTIFIER: - raise SyntaxError("parameter is not an identifier") - equals = token.value.find("=") - if equals == len(token.value) - 1: - # 'key=', so next token should be a quoted string without - # any intervening whitespace. - key = token.value[:-1] - token = tok.get(want_leading=True) - if token.ttype != dns.tokenizer.QUOTED_STRING: - raise SyntaxError("whitespace after =") - value = token.value - elif equals > 0: - # key=value - key = token.value[:equals] - value = token.value[equals + 1 :] - elif equals == 0: - # =key - raise SyntaxError('parameter cannot start with "="') - else: - # key - key = token.value - value = None - _validate_and_define(params, key, value) - return cls(rdclass, rdtype, priority, target, params) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - file.write(struct.pack("!H", self.priority)) - self.target.to_wire(file, None, origin, False) - for key in sorted(self.params): - file.write(struct.pack("!H", key)) - value = self.params[key] - with dns.renderer.prefixed_length(file, 2): - # Note that we're still writing a length of zero if the value is None - if value is not None: - value.to_wire(file, origin) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - priority = parser.get_uint16() - target = parser.get_name(origin) - if priority == 0 and parser.remaining() != 0: - raise dns.exception.FormError("parameters in AliasMode") - params = {} - prior_key = -1 - while parser.remaining() > 0: - key = parser.get_uint16() - if key < prior_key: - raise dns.exception.FormError("keys not in order") - prior_key = key - vlen = parser.get_uint16() - pcls = _class_for_key.get(key, GenericParam) - with parser.restrict_to(vlen): - value = pcls.from_wire_parser(parser, origin) - params[key] = value - return cls(rdclass, rdtype, priority, target, params) - - def _processing_priority(self): - return self.priority - - @classmethod - def _processing_order(cls, iterable): - return dns.rdtypes.util.priority_processing_order(iterable) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/tlsabase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/tlsabase.py deleted file mode 100644 index a059d2c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/tlsabase.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2005-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import binascii -import struct - -import dns.immutable -import dns.rdata -import dns.rdatatype - - -@dns.immutable.immutable -class TLSABase(dns.rdata.Rdata): - """Base class for TLSA and SMIMEA records""" - - # see: RFC 6698 - - __slots__ = ["usage", "selector", "mtype", "cert"] - - def __init__(self, rdclass, rdtype, usage, selector, mtype, cert): - super().__init__(rdclass, rdtype) - self.usage = self._as_uint8(usage) - self.selector = self._as_uint8(selector) - self.mtype = self._as_uint8(mtype) - self.cert = self._as_bytes(cert) - - def to_text(self, origin=None, relativize=True, **kw): - kw = kw.copy() - chunksize = kw.pop("chunksize", 128) - return "%d %d %d %s" % ( - self.usage, - self.selector, - self.mtype, - dns.rdata._hexify(self.cert, chunksize=chunksize, **kw), - ) - - @classmethod - def from_text( - cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None - ): - usage = tok.get_uint8() - selector = tok.get_uint8() - mtype = tok.get_uint8() - cert = tok.concatenate_remaining_identifiers().encode() - cert = binascii.unhexlify(cert) - return cls(rdclass, rdtype, usage, selector, mtype, cert) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - header = struct.pack("!BBB", self.usage, self.selector, self.mtype) - file.write(header) - file.write(self.cert) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - header = parser.get_struct("BBB") - cert = parser.get_remaining() - return cls(rdclass, rdtype, header[0], header[1], header[2], cert) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/txtbase.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/txtbase.py deleted file mode 100644 index 73db6d9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/txtbase.py +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""TXT-like base class.""" - -from typing import Any, Dict, Iterable, Optional, Tuple, Union - -import dns.exception -import dns.immutable -import dns.rdata -import dns.renderer -import dns.tokenizer - - -@dns.immutable.immutable -class TXTBase(dns.rdata.Rdata): - """Base class for rdata that is like a TXT record (see RFC 1035).""" - - __slots__ = ["strings"] - - def __init__( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - strings: Iterable[Union[bytes, str]], - ): - """Initialize a TXT-like rdata. - - *rdclass*, an ``int`` is the rdataclass of the Rdata. - - *rdtype*, an ``int`` is the rdatatype of the Rdata. - - *strings*, a tuple of ``bytes`` - """ - super().__init__(rdclass, rdtype) - self.strings: Tuple[bytes] = self._as_tuple( - strings, lambda x: self._as_bytes(x, True, 255) - ) - if len(self.strings) == 0: - raise ValueError("the list of strings must not be empty") - - def to_text( - self, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - **kw: Dict[str, Any], - ) -> str: - txt = "" - prefix = "" - for s in self.strings: - txt += f'{prefix}"{dns.rdata._escapify(s)}"' - prefix = " " - return txt - - @classmethod - def from_text( - cls, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - tok: dns.tokenizer.Tokenizer, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - relativize_to: Optional[dns.name.Name] = None, - ) -> dns.rdata.Rdata: - strings = [] - for token in tok.get_remaining(): - token = token.unescape_to_bytes() - # The 'if' below is always true in the current code, but we - # are leaving this check in in case things change some day. - if not ( - token.is_quoted_string() or token.is_identifier() - ): # pragma: no cover - raise dns.exception.SyntaxError("expected a string") - if len(token.value) > 255: - raise dns.exception.SyntaxError("string too long") - strings.append(token.value) - if len(strings) == 0: - raise dns.exception.UnexpectedEnd - return cls(rdclass, rdtype, strings) - - def _to_wire(self, file, compress=None, origin=None, canonicalize=False): - for s in self.strings: - with dns.renderer.prefixed_length(file, 1): - file.write(s) - - @classmethod - def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): - strings = [] - while parser.remaining() > 0: - s = parser.get_counted_bytes() - strings.append(s) - return cls(rdclass, rdtype, strings) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/util.py b/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/util.py deleted file mode 100644 index 653a0bf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rdtypes/util.py +++ /dev/null @@ -1,257 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import collections -import random -import struct -from typing import Any, List - -import dns.exception -import dns.ipv4 -import dns.ipv6 -import dns.name -import dns.rdata - - -class Gateway: - """A helper class for the IPSECKEY gateway and AMTRELAY relay fields""" - - name = "" - - def __init__(self, type, gateway=None): - self.type = dns.rdata.Rdata._as_uint8(type) - self.gateway = gateway - self._check() - - @classmethod - def _invalid_type(cls, gateway_type): - return f"invalid {cls.name} type: {gateway_type}" - - def _check(self): - if self.type == 0: - if self.gateway not in (".", None): - raise SyntaxError(f"invalid {self.name} for type 0") - self.gateway = None - elif self.type == 1: - # check that it's OK - dns.ipv4.inet_aton(self.gateway) - elif self.type == 2: - # check that it's OK - dns.ipv6.inet_aton(self.gateway) - elif self.type == 3: - if not isinstance(self.gateway, dns.name.Name): - raise SyntaxError(f"invalid {self.name}; not a name") - else: - raise SyntaxError(self._invalid_type(self.type)) - - def to_text(self, origin=None, relativize=True): - if self.type == 0: - return "." - elif self.type in (1, 2): - return self.gateway - elif self.type == 3: - return str(self.gateway.choose_relativity(origin, relativize)) - else: - raise ValueError(self._invalid_type(self.type)) # pragma: no cover - - @classmethod - def from_text( - cls, gateway_type, tok, origin=None, relativize=True, relativize_to=None - ): - if gateway_type in (0, 1, 2): - gateway = tok.get_string() - elif gateway_type == 3: - gateway = tok.get_name(origin, relativize, relativize_to) - else: - raise dns.exception.SyntaxError( - cls._invalid_type(gateway_type) - ) # pragma: no cover - return cls(gateway_type, gateway) - - # pylint: disable=unused-argument - def to_wire(self, file, compress=None, origin=None, canonicalize=False): - if self.type == 0: - pass - elif self.type == 1: - file.write(dns.ipv4.inet_aton(self.gateway)) - elif self.type == 2: - file.write(dns.ipv6.inet_aton(self.gateway)) - elif self.type == 3: - self.gateway.to_wire(file, None, origin, False) - else: - raise ValueError(self._invalid_type(self.type)) # pragma: no cover - - # pylint: enable=unused-argument - - @classmethod - def from_wire_parser(cls, gateway_type, parser, origin=None): - if gateway_type == 0: - gateway = None - elif gateway_type == 1: - gateway = dns.ipv4.inet_ntoa(parser.get_bytes(4)) - elif gateway_type == 2: - gateway = dns.ipv6.inet_ntoa(parser.get_bytes(16)) - elif gateway_type == 3: - gateway = parser.get_name(origin) - else: - raise dns.exception.FormError(cls._invalid_type(gateway_type)) - return cls(gateway_type, gateway) - - -class Bitmap: - """A helper class for the NSEC/NSEC3/CSYNC type bitmaps""" - - type_name = "" - - def __init__(self, windows=None): - last_window = -1 - self.windows = windows - for window, bitmap in self.windows: - if not isinstance(window, int): - raise ValueError(f"bad {self.type_name} window type") - if window <= last_window: - raise ValueError(f"bad {self.type_name} window order") - if window > 256: - raise ValueError(f"bad {self.type_name} window number") - last_window = window - if not isinstance(bitmap, bytes): - raise ValueError(f"bad {self.type_name} octets type") - if len(bitmap) == 0 or len(bitmap) > 32: - raise ValueError(f"bad {self.type_name} octets") - - def to_text(self) -> str: - text = "" - for window, bitmap in self.windows: - bits = [] - for i, byte in enumerate(bitmap): - for j in range(0, 8): - if byte & (0x80 >> j): - rdtype = window * 256 + i * 8 + j - bits.append(dns.rdatatype.to_text(rdtype)) - text += " " + " ".join(bits) - return text - - @classmethod - def from_text(cls, tok: "dns.tokenizer.Tokenizer") -> "Bitmap": - rdtypes = [] - for token in tok.get_remaining(): - rdtype = dns.rdatatype.from_text(token.unescape().value) - if rdtype == 0: - raise dns.exception.SyntaxError(f"{cls.type_name} with bit 0") - rdtypes.append(rdtype) - return cls.from_rdtypes(rdtypes) - - @classmethod - def from_rdtypes(cls, rdtypes: List[dns.rdatatype.RdataType]) -> "Bitmap": - rdtypes = sorted(rdtypes) - window = 0 - octets = 0 - prior_rdtype = 0 - bitmap = bytearray(b"\0" * 32) - windows = [] - for rdtype in rdtypes: - if rdtype == prior_rdtype: - continue - prior_rdtype = rdtype - new_window = rdtype // 256 - if new_window != window: - if octets != 0: - windows.append((window, bytes(bitmap[0:octets]))) - bitmap = bytearray(b"\0" * 32) - window = new_window - offset = rdtype % 256 - byte = offset // 8 - bit = offset % 8 - octets = byte + 1 - bitmap[byte] = bitmap[byte] | (0x80 >> bit) - if octets != 0: - windows.append((window, bytes(bitmap[0:octets]))) - return cls(windows) - - def to_wire(self, file: Any) -> None: - for window, bitmap in self.windows: - file.write(struct.pack("!BB", window, len(bitmap))) - file.write(bitmap) - - @classmethod - def from_wire_parser(cls, parser: "dns.wire.Parser") -> "Bitmap": - windows = [] - while parser.remaining() > 0: - window = parser.get_uint8() - bitmap = parser.get_counted_bytes() - windows.append((window, bitmap)) - return cls(windows) - - -def _priority_table(items): - by_priority = collections.defaultdict(list) - for rdata in items: - by_priority[rdata._processing_priority()].append(rdata) - return by_priority - - -def priority_processing_order(iterable): - items = list(iterable) - if len(items) == 1: - return items - by_priority = _priority_table(items) - ordered = [] - for k in sorted(by_priority.keys()): - rdatas = by_priority[k] - random.shuffle(rdatas) - ordered.extend(rdatas) - return ordered - - -_no_weight = 0.1 - - -def weighted_processing_order(iterable): - items = list(iterable) - if len(items) == 1: - return items - by_priority = _priority_table(items) - ordered = [] - for k in sorted(by_priority.keys()): - rdatas = by_priority[k] - total = sum(rdata._processing_weight() or _no_weight for rdata in rdatas) - while len(rdatas) > 1: - r = random.uniform(0, total) - for n, rdata in enumerate(rdatas): # noqa: B007 - weight = rdata._processing_weight() or _no_weight - if weight > r: - break - r -= weight - total -= weight - ordered.append(rdata) # pylint: disable=undefined-loop-variable - del rdatas[n] # pylint: disable=undefined-loop-variable - ordered.append(rdatas[0]) - return ordered - - -def parse_formatted_hex(formatted, num_chunks, chunk_size, separator): - if len(formatted) != num_chunks * (chunk_size + 1) - 1: - raise ValueError("invalid formatted hex string") - value = b"" - for _ in range(num_chunks): - chunk = formatted[0:chunk_size] - value += int(chunk, 16).to_bytes(chunk_size // 2, "big") - formatted = formatted[chunk_size:] - if len(formatted) > 0 and formatted[0] != separator: - raise ValueError("invalid formatted hex string") - formatted = formatted[1:] - return value diff --git a/write-message/venv/lib/python3.10/site-packages/dns/renderer.py b/write-message/venv/lib/python3.10/site-packages/dns/renderer.py deleted file mode 100644 index a77481f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/renderer.py +++ /dev/null @@ -1,346 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Help for building DNS wire format messages""" - -import contextlib -import io -import random -import struct -import time - -import dns.exception -import dns.tsig - -QUESTION = 0 -ANSWER = 1 -AUTHORITY = 2 -ADDITIONAL = 3 - - -@contextlib.contextmanager -def prefixed_length(output, length_length): - output.write(b"\00" * length_length) - start = output.tell() - yield - end = output.tell() - length = end - start - if length > 0: - try: - output.seek(start - length_length) - try: - output.write(length.to_bytes(length_length, "big")) - except OverflowError: - raise dns.exception.FormError - finally: - output.seek(end) - - -class Renderer: - """Helper class for building DNS wire-format messages. - - Most applications can use the higher-level L{dns.message.Message} - class and its to_wire() method to generate wire-format messages. - This class is for those applications which need finer control - over the generation of messages. - - Typical use:: - - r = dns.renderer.Renderer(id=1, flags=0x80, max_size=512) - r.add_question(qname, qtype, qclass) - r.add_rrset(dns.renderer.ANSWER, rrset_1) - r.add_rrset(dns.renderer.ANSWER, rrset_2) - r.add_rrset(dns.renderer.AUTHORITY, ns_rrset) - r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_1) - r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_2) - r.add_edns(0, 0, 4096) - r.write_header() - r.add_tsig(keyname, secret, 300, 1, 0, '', request_mac) - wire = r.get_wire() - - If padding is going to be used, then the OPT record MUST be - written after everything else in the additional section except for - the TSIG (if any). - - output, an io.BytesIO, where rendering is written - - id: the message id - - flags: the message flags - - max_size: the maximum size of the message - - origin: the origin to use when rendering relative names - - compress: the compression table - - section: an int, the section currently being rendered - - counts: list of the number of RRs in each section - - mac: the MAC of the rendered message (if TSIG was used) - """ - - def __init__(self, id=None, flags=0, max_size=65535, origin=None): - """Initialize a new renderer.""" - - self.output = io.BytesIO() - if id is None: - self.id = random.randint(0, 65535) - else: - self.id = id - self.flags = flags - self.max_size = max_size - self.origin = origin - self.compress = {} - self.section = QUESTION - self.counts = [0, 0, 0, 0] - self.output.write(b"\x00" * 12) - self.mac = "" - self.reserved = 0 - self.was_padded = False - - def _rollback(self, where): - """Truncate the output buffer at offset *where*, and remove any - compression table entries that pointed beyond the truncation - point. - """ - - self.output.seek(where) - self.output.truncate() - keys_to_delete = [] - for k, v in self.compress.items(): - if v >= where: - keys_to_delete.append(k) - for k in keys_to_delete: - del self.compress[k] - - def _set_section(self, section): - """Set the renderer's current section. - - Sections must be rendered order: QUESTION, ANSWER, AUTHORITY, - ADDITIONAL. Sections may be empty. - - Raises dns.exception.FormError if an attempt was made to set - a section value less than the current section. - """ - - if self.section != section: - if self.section > section: - raise dns.exception.FormError - self.section = section - - @contextlib.contextmanager - def _track_size(self): - start = self.output.tell() - yield start - if self.output.tell() > self.max_size: - self._rollback(start) - raise dns.exception.TooBig - - @contextlib.contextmanager - def _temporarily_seek_to(self, where): - current = self.output.tell() - try: - self.output.seek(where) - yield - finally: - self.output.seek(current) - - def add_question(self, qname, rdtype, rdclass=dns.rdataclass.IN): - """Add a question to the message.""" - - self._set_section(QUESTION) - with self._track_size(): - qname.to_wire(self.output, self.compress, self.origin) - self.output.write(struct.pack("!HH", rdtype, rdclass)) - self.counts[QUESTION] += 1 - - def add_rrset(self, section, rrset, **kw): - """Add the rrset to the specified section. - - Any keyword arguments are passed on to the rdataset's to_wire() - routine. - """ - - self._set_section(section) - with self._track_size(): - n = rrset.to_wire(self.output, self.compress, self.origin, **kw) - self.counts[section] += n - - def add_rdataset(self, section, name, rdataset, **kw): - """Add the rdataset to the specified section, using the specified - name as the owner name. - - Any keyword arguments are passed on to the rdataset's to_wire() - routine. - """ - - self._set_section(section) - with self._track_size(): - n = rdataset.to_wire(name, self.output, self.compress, self.origin, **kw) - self.counts[section] += n - - def add_opt(self, opt, pad=0, opt_size=0, tsig_size=0): - """Add *opt* to the additional section, applying padding if desired. The - padding will take the specified precomputed OPT size and TSIG size into - account. - - Note that we don't have reliable way of knowing how big a GSS-TSIG digest - might be, so we we might not get an even multiple of the pad in that case.""" - if pad: - ttl = opt.ttl - assert opt_size >= 11 - opt_rdata = opt[0] - size_without_padding = self.output.tell() + opt_size + tsig_size - remainder = size_without_padding % pad - if remainder: - pad = b"\x00" * (pad - remainder) - else: - pad = b"" - options = list(opt_rdata.options) - options.append(dns.edns.GenericOption(dns.edns.OptionType.PADDING, pad)) - opt = dns.message.Message._make_opt(ttl, opt_rdata.rdclass, options) - self.was_padded = True - self.add_rrset(ADDITIONAL, opt) - - def add_edns(self, edns, ednsflags, payload, options=None): - """Add an EDNS OPT record to the message.""" - - # make sure the EDNS version in ednsflags agrees with edns - ednsflags &= 0xFF00FFFF - ednsflags |= edns << 16 - opt = dns.message.Message._make_opt(ednsflags, payload, options) - self.add_opt(opt) - - def add_tsig( - self, - keyname, - secret, - fudge, - id, - tsig_error, - other_data, - request_mac, - algorithm=dns.tsig.default_algorithm, - ): - """Add a TSIG signature to the message.""" - - s = self.output.getvalue() - - if isinstance(secret, dns.tsig.Key): - key = secret - else: - key = dns.tsig.Key(keyname, secret, algorithm) - tsig = dns.message.Message._make_tsig( - keyname, algorithm, 0, fudge, b"", id, tsig_error, other_data - ) - (tsig, _) = dns.tsig.sign(s, key, tsig[0], int(time.time()), request_mac) - self._write_tsig(tsig, keyname) - - def add_multi_tsig( - self, - ctx, - keyname, - secret, - fudge, - id, - tsig_error, - other_data, - request_mac, - algorithm=dns.tsig.default_algorithm, - ): - """Add a TSIG signature to the message. Unlike add_tsig(), this can be - used for a series of consecutive DNS envelopes, e.g. for a zone - transfer over TCP [RFC2845, 4.4]. - - For the first message in the sequence, give ctx=None. For each - subsequent message, give the ctx that was returned from the - add_multi_tsig() call for the previous message.""" - - s = self.output.getvalue() - - if isinstance(secret, dns.tsig.Key): - key = secret - else: - key = dns.tsig.Key(keyname, secret, algorithm) - tsig = dns.message.Message._make_tsig( - keyname, algorithm, 0, fudge, b"", id, tsig_error, other_data - ) - (tsig, ctx) = dns.tsig.sign( - s, key, tsig[0], int(time.time()), request_mac, ctx, True - ) - self._write_tsig(tsig, keyname) - return ctx - - def _write_tsig(self, tsig, keyname): - if self.was_padded: - compress = None - else: - compress = self.compress - self._set_section(ADDITIONAL) - with self._track_size(): - keyname.to_wire(self.output, compress, self.origin) - self.output.write( - struct.pack("!HHI", dns.rdatatype.TSIG, dns.rdataclass.ANY, 0) - ) - with prefixed_length(self.output, 2): - tsig.to_wire(self.output) - - self.counts[ADDITIONAL] += 1 - with self._temporarily_seek_to(10): - self.output.write(struct.pack("!H", self.counts[ADDITIONAL])) - - def write_header(self): - """Write the DNS message header. - - Writing the DNS message header is done after all sections - have been rendered, but before the optional TSIG signature - is added. - """ - - with self._temporarily_seek_to(0): - self.output.write( - struct.pack( - "!HHHHHH", - self.id, - self.flags, - self.counts[0], - self.counts[1], - self.counts[2], - self.counts[3], - ) - ) - - def get_wire(self): - """Return the wire format message.""" - - return self.output.getvalue() - - def reserve(self, size: int) -> None: - """Reserve *size* bytes.""" - if size < 0: - raise ValueError("reserved amount must be non-negative") - if size > self.max_size: - raise ValueError("cannot reserve more than the maximum size") - self.reserved += size - self.max_size -= size - - def release_reserved(self) -> None: - """Release the reserved bytes.""" - self.max_size += self.reserved - self.reserved = 0 diff --git a/write-message/venv/lib/python3.10/site-packages/dns/resolver.py b/write-message/venv/lib/python3.10/site-packages/dns/resolver.py deleted file mode 100644 index 3ba76e3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/resolver.py +++ /dev/null @@ -1,2053 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS stub resolver.""" - -import contextlib -import random -import socket -import sys -import threading -import time -import warnings -from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple, Union -from urllib.parse import urlparse - -import dns._ddr -import dns.edns -import dns.exception -import dns.flags -import dns.inet -import dns.ipv4 -import dns.ipv6 -import dns.message -import dns.name -import dns.rdata -import dns.nameserver -import dns.query -import dns.rcode -import dns.rdataclass -import dns.rdatatype -import dns.rdtypes.svcbbase -import dns.reversename -import dns.tsig - -if sys.platform == "win32": # pragma: no cover - import dns.win32util - - -class NXDOMAIN(dns.exception.DNSException): - """The DNS query name does not exist.""" - - supp_kwargs = {"qnames", "responses"} - fmt = None # we have our own __str__ implementation - - # pylint: disable=arguments-differ - - # We do this as otherwise mypy complains about unexpected keyword argument - # idna_exception - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - def _check_kwargs(self, qnames, responses=None): - if not isinstance(qnames, (list, tuple, set)): - raise AttributeError("qnames must be a list, tuple or set") - if len(qnames) == 0: - raise AttributeError("qnames must contain at least one element") - if responses is None: - responses = {} - elif not isinstance(responses, dict): - raise AttributeError("responses must be a dict(qname=response)") - kwargs = dict(qnames=qnames, responses=responses) - return kwargs - - def __str__(self) -> str: - if "qnames" not in self.kwargs: - return super().__str__() - qnames = self.kwargs["qnames"] - if len(qnames) > 1: - msg = "None of DNS query names exist" - else: - msg = "The DNS query name does not exist" - qnames = ", ".join(map(str, qnames)) - return f"{msg}: {qnames}" - - @property - def canonical_name(self): - """Return the unresolved canonical name.""" - if "qnames" not in self.kwargs: - raise TypeError("parametrized exception required") - for qname in self.kwargs["qnames"]: - response = self.kwargs["responses"][qname] - try: - cname = response.canonical_name() - if cname != qname: - return cname - except Exception: # pragma: no cover - # We can just eat this exception as it means there was - # something wrong with the response. - pass - return self.kwargs["qnames"][0] - - def __add__(self, e_nx): - """Augment by results from another NXDOMAIN exception.""" - qnames0 = list(self.kwargs.get("qnames", [])) - responses0 = dict(self.kwargs.get("responses", {})) - responses1 = e_nx.kwargs.get("responses", {}) - for qname1 in e_nx.kwargs.get("qnames", []): - if qname1 not in qnames0: - qnames0.append(qname1) - if qname1 in responses1: - responses0[qname1] = responses1[qname1] - return NXDOMAIN(qnames=qnames0, responses=responses0) - - def qnames(self): - """All of the names that were tried. - - Returns a list of ``dns.name.Name``. - """ - return self.kwargs["qnames"] - - def responses(self): - """A map from queried names to their NXDOMAIN responses. - - Returns a dict mapping a ``dns.name.Name`` to a - ``dns.message.Message``. - """ - return self.kwargs["responses"] - - def response(self, qname): - """The response for query *qname*. - - Returns a ``dns.message.Message``. - """ - return self.kwargs["responses"][qname] - - -class YXDOMAIN(dns.exception.DNSException): - """The DNS query name is too long after DNAME substitution.""" - - -ErrorTuple = Tuple[ - Optional[str], - bool, - int, - Union[Exception, str], - Optional[dns.message.Message], -] - - -def _errors_to_text(errors: List[ErrorTuple]) -> List[str]: - """Turn a resolution errors trace into a list of text.""" - texts = [] - for err in errors: - texts.append(f"Server {err[0]} answered {err[3]}") - return texts - - -class LifetimeTimeout(dns.exception.Timeout): - """The resolution lifetime expired.""" - - msg = "The resolution lifetime expired." - fmt = f"{msg[:-1]} after {{timeout:.3f}} seconds: {{errors}}" - supp_kwargs = {"timeout", "errors"} - - # We do this as otherwise mypy complains about unexpected keyword argument - # idna_exception - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - def _fmt_kwargs(self, **kwargs): - srv_msgs = _errors_to_text(kwargs["errors"]) - return super()._fmt_kwargs( - timeout=kwargs["timeout"], errors="; ".join(srv_msgs) - ) - - -# We added more detail to resolution timeouts, but they are still -# subclasses of dns.exception.Timeout for backwards compatibility. We also -# keep dns.resolver.Timeout defined for backwards compatibility. -Timeout = LifetimeTimeout - - -class NoAnswer(dns.exception.DNSException): - """The DNS response does not contain an answer to the question.""" - - fmt = "The DNS response does not contain an answer to the question: {query}" - supp_kwargs = {"response"} - - # We do this as otherwise mypy complains about unexpected keyword argument - # idna_exception - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - def _fmt_kwargs(self, **kwargs): - return super()._fmt_kwargs(query=kwargs["response"].question) - - def response(self): - return self.kwargs["response"] - - -class NoNameservers(dns.exception.DNSException): - """All nameservers failed to answer the query. - - errors: list of servers and respective errors - The type of errors is - [(server IP address, any object convertible to string)]. - Non-empty errors list will add explanatory message () - """ - - msg = "All nameservers failed to answer the query." - fmt = f"{msg[:-1]} {{query}}: {{errors}}" - supp_kwargs = {"request", "errors"} - - # We do this as otherwise mypy complains about unexpected keyword argument - # idna_exception - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - def _fmt_kwargs(self, **kwargs): - srv_msgs = _errors_to_text(kwargs["errors"]) - return super()._fmt_kwargs( - query=kwargs["request"].question, errors="; ".join(srv_msgs) - ) - - -class NotAbsolute(dns.exception.DNSException): - """An absolute domain name is required but a relative name was provided.""" - - -class NoRootSOA(dns.exception.DNSException): - """There is no SOA RR at the DNS root name. This should never happen!""" - - -class NoMetaqueries(dns.exception.DNSException): - """DNS metaqueries are not allowed.""" - - -class NoResolverConfiguration(dns.exception.DNSException): - """Resolver configuration could not be read or specified no nameservers.""" - - -class Answer: - """DNS stub resolver answer. - - Instances of this class bundle up the result of a successful DNS - resolution. - - For convenience, the answer object implements much of the sequence - protocol, forwarding to its ``rrset`` attribute. E.g. - ``for a in answer`` is equivalent to ``for a in answer.rrset``. - ``answer[i]`` is equivalent to ``answer.rrset[i]``, and - ``answer[i:j]`` is equivalent to ``answer.rrset[i:j]``. - - Note that CNAMEs or DNAMEs in the response may mean that answer - RRset's name might not be the query name. - """ - - def __init__( - self, - qname: dns.name.Name, - rdtype: dns.rdatatype.RdataType, - rdclass: dns.rdataclass.RdataClass, - response: dns.message.QueryMessage, - nameserver: Optional[str] = None, - port: Optional[int] = None, - ) -> None: - self.qname = qname - self.rdtype = rdtype - self.rdclass = rdclass - self.response = response - self.nameserver = nameserver - self.port = port - self.chaining_result = response.resolve_chaining() - # Copy some attributes out of chaining_result for backwards - # compatibility and convenience. - self.canonical_name = self.chaining_result.canonical_name - self.rrset = self.chaining_result.answer - self.expiration = time.time() + self.chaining_result.minimum_ttl - - def __getattr__(self, attr): # pragma: no cover - if attr == "name": - return self.rrset.name - elif attr == "ttl": - return self.rrset.ttl - elif attr == "covers": - return self.rrset.covers - elif attr == "rdclass": - return self.rrset.rdclass - elif attr == "rdtype": - return self.rrset.rdtype - else: - raise AttributeError(attr) - - def __len__(self) -> int: - return self.rrset and len(self.rrset) or 0 - - def __iter__(self) -> Iterator[dns.rdata.Rdata]: - return self.rrset and iter(self.rrset) or iter(tuple()) - - def __getitem__(self, i): - if self.rrset is None: - raise IndexError - return self.rrset[i] - - def __delitem__(self, i): - if self.rrset is None: - raise IndexError - del self.rrset[i] - - -class Answers(dict): - """A dict of DNS stub resolver answers, indexed by type.""" - - -class HostAnswers(Answers): - """A dict of DNS stub resolver answers to a host name lookup, indexed by - type. - """ - - @classmethod - def make( - cls, - v6: Optional[Answer] = None, - v4: Optional[Answer] = None, - add_empty: bool = True, - ) -> "HostAnswers": - answers = HostAnswers() - if v6 is not None and (add_empty or v6.rrset): - answers[dns.rdatatype.AAAA] = v6 - if v4 is not None and (add_empty or v4.rrset): - answers[dns.rdatatype.A] = v4 - return answers - - # Returns pairs of (address, family) from this result, potentially - # filtering by address family. - def addresses_and_families( - self, family: int = socket.AF_UNSPEC - ) -> Iterator[Tuple[str, int]]: - if family == socket.AF_UNSPEC: - yield from self.addresses_and_families(socket.AF_INET6) - yield from self.addresses_and_families(socket.AF_INET) - return - elif family == socket.AF_INET6: - answer = self.get(dns.rdatatype.AAAA) - elif family == socket.AF_INET: - answer = self.get(dns.rdatatype.A) - else: # pragma: no cover - raise NotImplementedError(f"unknown address family {family}") - if answer: - for rdata in answer: - yield (rdata.address, family) - - # Returns addresses from this result, potentially filtering by - # address family. - def addresses(self, family: int = socket.AF_UNSPEC) -> Iterator[str]: - return (pair[0] for pair in self.addresses_and_families(family)) - - # Returns the canonical name from this result. - def canonical_name(self) -> dns.name.Name: - answer = self.get(dns.rdatatype.AAAA, self.get(dns.rdatatype.A)) - return answer.canonical_name - - -class CacheStatistics: - """Cache Statistics""" - - def __init__(self, hits: int = 0, misses: int = 0) -> None: - self.hits = hits - self.misses = misses - - def reset(self) -> None: - self.hits = 0 - self.misses = 0 - - def clone(self) -> "CacheStatistics": - return CacheStatistics(self.hits, self.misses) - - -class CacheBase: - def __init__(self) -> None: - self.lock = threading.Lock() - self.statistics = CacheStatistics() - - def reset_statistics(self) -> None: - """Reset all statistics to zero.""" - with self.lock: - self.statistics.reset() - - def hits(self) -> int: - """How many hits has the cache had?""" - with self.lock: - return self.statistics.hits - - def misses(self) -> int: - """How many misses has the cache had?""" - with self.lock: - return self.statistics.misses - - def get_statistics_snapshot(self) -> CacheStatistics: - """Return a consistent snapshot of all the statistics. - - If running with multiple threads, it's better to take a - snapshot than to call statistics methods such as hits() and - misses() individually. - """ - with self.lock: - return self.statistics.clone() - - -CacheKey = Tuple[dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass] - - -class Cache(CacheBase): - """Simple thread-safe DNS answer cache.""" - - def __init__(self, cleaning_interval: float = 300.0) -> None: - """*cleaning_interval*, a ``float`` is the number of seconds between - periodic cleanings. - """ - - super().__init__() - self.data: Dict[CacheKey, Answer] = {} - self.cleaning_interval = cleaning_interval - self.next_cleaning: float = time.time() + self.cleaning_interval - - def _maybe_clean(self) -> None: - """Clean the cache if it's time to do so.""" - - now = time.time() - if self.next_cleaning <= now: - keys_to_delete = [] - for k, v in self.data.items(): - if v.expiration <= now: - keys_to_delete.append(k) - for k in keys_to_delete: - del self.data[k] - now = time.time() - self.next_cleaning = now + self.cleaning_interval - - def get(self, key: CacheKey) -> Optional[Answer]: - """Get the answer associated with *key*. - - Returns None if no answer is cached for the key. - - *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` - tuple whose values are the query name, rdtype, and rdclass respectively. - - Returns a ``dns.resolver.Answer`` or ``None``. - """ - - with self.lock: - self._maybe_clean() - v = self.data.get(key) - if v is None or v.expiration <= time.time(): - self.statistics.misses += 1 - return None - self.statistics.hits += 1 - return v - - def put(self, key: CacheKey, value: Answer) -> None: - """Associate key and value in the cache. - - *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` - tuple whose values are the query name, rdtype, and rdclass respectively. - - *value*, a ``dns.resolver.Answer``, the answer. - """ - - with self.lock: - self._maybe_clean() - self.data[key] = value - - def flush(self, key: Optional[CacheKey] = None) -> None: - """Flush the cache. - - If *key* is not ``None``, only that item is flushed. Otherwise the entire cache - is flushed. - - *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` - tuple whose values are the query name, rdtype, and rdclass respectively. - """ - - with self.lock: - if key is not None: - if key in self.data: - del self.data[key] - else: - self.data = {} - self.next_cleaning = time.time() + self.cleaning_interval - - -class LRUCacheNode: - """LRUCache node.""" - - def __init__(self, key, value): - self.key = key - self.value = value - self.hits = 0 - self.prev = self - self.next = self - - def link_after(self, node: "LRUCacheNode") -> None: - self.prev = node - self.next = node.next - node.next.prev = self - node.next = self - - def unlink(self) -> None: - self.next.prev = self.prev - self.prev.next = self.next - - -class LRUCache(CacheBase): - """Thread-safe, bounded, least-recently-used DNS answer cache. - - This cache is better than the simple cache (above) if you're - running a web crawler or other process that does a lot of - resolutions. The LRUCache has a maximum number of nodes, and when - it is full, the least-recently used node is removed to make space - for a new one. - """ - - def __init__(self, max_size: int = 100000) -> None: - """*max_size*, an ``int``, is the maximum number of nodes to cache; - it must be greater than 0. - """ - - super().__init__() - self.data: Dict[CacheKey, LRUCacheNode] = {} - self.set_max_size(max_size) - self.sentinel: LRUCacheNode = LRUCacheNode(None, None) - self.sentinel.prev = self.sentinel - self.sentinel.next = self.sentinel - - def set_max_size(self, max_size: int) -> None: - if max_size < 1: - max_size = 1 - self.max_size = max_size - - def get(self, key: CacheKey) -> Optional[Answer]: - """Get the answer associated with *key*. - - Returns None if no answer is cached for the key. - - *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` - tuple whose values are the query name, rdtype, and rdclass respectively. - - Returns a ``dns.resolver.Answer`` or ``None``. - """ - - with self.lock: - node = self.data.get(key) - if node is None: - self.statistics.misses += 1 - return None - # Unlink because we're either going to move the node to the front - # of the LRU list or we're going to free it. - node.unlink() - if node.value.expiration <= time.time(): - del self.data[node.key] - self.statistics.misses += 1 - return None - node.link_after(self.sentinel) - self.statistics.hits += 1 - node.hits += 1 - return node.value - - def get_hits_for_key(self, key: CacheKey) -> int: - """Return the number of cache hits associated with the specified key.""" - with self.lock: - node = self.data.get(key) - if node is None or node.value.expiration <= time.time(): - return 0 - else: - return node.hits - - def put(self, key: CacheKey, value: Answer) -> None: - """Associate key and value in the cache. - - *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` - tuple whose values are the query name, rdtype, and rdclass respectively. - - *value*, a ``dns.resolver.Answer``, the answer. - """ - - with self.lock: - node = self.data.get(key) - if node is not None: - node.unlink() - del self.data[node.key] - while len(self.data) >= self.max_size: - gnode = self.sentinel.prev - gnode.unlink() - del self.data[gnode.key] - node = LRUCacheNode(key, value) - node.link_after(self.sentinel) - self.data[key] = node - - def flush(self, key: Optional[CacheKey] = None) -> None: - """Flush the cache. - - If *key* is not ``None``, only that item is flushed. Otherwise the entire cache - is flushed. - - *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` - tuple whose values are the query name, rdtype, and rdclass respectively. - """ - - with self.lock: - if key is not None: - node = self.data.get(key) - if node is not None: - node.unlink() - del self.data[node.key] - else: - gnode = self.sentinel.next - while gnode != self.sentinel: - next = gnode.next - gnode.unlink() - gnode = next - self.data = {} - - -class _Resolution: - """Helper class for dns.resolver.Resolver.resolve(). - - All of the "business logic" of resolution is encapsulated in this - class, allowing us to have multiple resolve() implementations - using different I/O schemes without copying all of the - complicated logic. - - This class is a "friend" to dns.resolver.Resolver and manipulates - resolver data structures directly. - """ - - def __init__( - self, - resolver: "BaseResolver", - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - rdclass: Union[dns.rdataclass.RdataClass, str], - tcp: bool, - raise_on_no_answer: bool, - search: Optional[bool], - ) -> None: - if isinstance(qname, str): - qname = dns.name.from_text(qname, None) - rdtype = dns.rdatatype.RdataType.make(rdtype) - if dns.rdatatype.is_metatype(rdtype): - raise NoMetaqueries - rdclass = dns.rdataclass.RdataClass.make(rdclass) - if dns.rdataclass.is_metaclass(rdclass): - raise NoMetaqueries - self.resolver = resolver - self.qnames_to_try = resolver._get_qnames_to_try(qname, search) - self.qnames = self.qnames_to_try[:] - self.rdtype = rdtype - self.rdclass = rdclass - self.tcp = tcp - self.raise_on_no_answer = raise_on_no_answer - self.nxdomain_responses: Dict[dns.name.Name, dns.message.QueryMessage] = {} - # Initialize other things to help analysis tools - self.qname = dns.name.empty - self.nameservers: List[dns.nameserver.Nameserver] = [] - self.current_nameservers: List[dns.nameserver.Nameserver] = [] - self.errors: List[ErrorTuple] = [] - self.nameserver: Optional[dns.nameserver.Nameserver] = None - self.tcp_attempt = False - self.retry_with_tcp = False - self.request: Optional[dns.message.QueryMessage] = None - self.backoff = 0.0 - - def next_request( - self, - ) -> Tuple[Optional[dns.message.QueryMessage], Optional[Answer]]: - """Get the next request to send, and check the cache. - - Returns a (request, answer) tuple. At most one of request or - answer will not be None. - """ - - # We return a tuple instead of Union[Message,Answer] as it lets - # the caller avoid isinstance(). - - while len(self.qnames) > 0: - self.qname = self.qnames.pop(0) - - # Do we know the answer? - if self.resolver.cache: - answer = self.resolver.cache.get( - (self.qname, self.rdtype, self.rdclass) - ) - if answer is not None: - if answer.rrset is None and self.raise_on_no_answer: - raise NoAnswer(response=answer.response) - else: - return (None, answer) - answer = self.resolver.cache.get( - (self.qname, dns.rdatatype.ANY, self.rdclass) - ) - if answer is not None and answer.response.rcode() == dns.rcode.NXDOMAIN: - # cached NXDOMAIN; record it and continue to next - # name. - self.nxdomain_responses[self.qname] = answer.response - continue - - # Build the request - request = dns.message.make_query(self.qname, self.rdtype, self.rdclass) - if self.resolver.keyname is not None: - request.use_tsig( - self.resolver.keyring, - self.resolver.keyname, - algorithm=self.resolver.keyalgorithm, - ) - request.use_edns( - self.resolver.edns, - self.resolver.ednsflags, - self.resolver.payload, - options=self.resolver.ednsoptions, - ) - if self.resolver.flags is not None: - request.flags = self.resolver.flags - - self.nameservers = self.resolver._enrich_nameservers( - self.resolver._nameservers, - self.resolver.nameserver_ports, - self.resolver.port, - ) - if self.resolver.rotate: - random.shuffle(self.nameservers) - self.current_nameservers = self.nameservers[:] - self.errors = [] - self.nameserver = None - self.tcp_attempt = False - self.retry_with_tcp = False - self.request = request - self.backoff = 0.10 - - return (request, None) - - # - # We've tried everything and only gotten NXDOMAINs. (We know - # it's only NXDOMAINs as anything else would have returned - # before now.) - # - raise NXDOMAIN(qnames=self.qnames_to_try, responses=self.nxdomain_responses) - - def next_nameserver(self) -> Tuple[dns.nameserver.Nameserver, bool, float]: - if self.retry_with_tcp: - assert self.nameserver is not None - assert not self.nameserver.is_always_max_size() - self.tcp_attempt = True - self.retry_with_tcp = False - return (self.nameserver, True, 0) - - backoff = 0.0 - if not self.current_nameservers: - if len(self.nameservers) == 0: - # Out of things to try! - raise NoNameservers(request=self.request, errors=self.errors) - self.current_nameservers = self.nameservers[:] - backoff = self.backoff - self.backoff = min(self.backoff * 2, 2) - - self.nameserver = self.current_nameservers.pop(0) - self.tcp_attempt = self.tcp or self.nameserver.is_always_max_size() - return (self.nameserver, self.tcp_attempt, backoff) - - def query_result( - self, response: Optional[dns.message.Message], ex: Optional[Exception] - ) -> Tuple[Optional[Answer], bool]: - # - # returns an (answer: Answer, end_loop: bool) tuple. - # - assert self.nameserver is not None - if ex: - # Exception during I/O or from_wire() - assert response is None - self.errors.append( - ( - str(self.nameserver), - self.tcp_attempt, - self.nameserver.answer_port(), - ex, - response, - ) - ) - if ( - isinstance(ex, dns.exception.FormError) - or isinstance(ex, EOFError) - or isinstance(ex, OSError) - or isinstance(ex, NotImplementedError) - ): - # This nameserver is no good, take it out of the mix. - self.nameservers.remove(self.nameserver) - elif isinstance(ex, dns.message.Truncated): - if self.tcp_attempt: - # Truncation with TCP is no good! - self.nameservers.remove(self.nameserver) - else: - self.retry_with_tcp = True - return (None, False) - # We got an answer! - assert response is not None - assert isinstance(response, dns.message.QueryMessage) - rcode = response.rcode() - if rcode == dns.rcode.NOERROR: - try: - answer = Answer( - self.qname, - self.rdtype, - self.rdclass, - response, - self.nameserver.answer_nameserver(), - self.nameserver.answer_port(), - ) - except Exception as e: - self.errors.append( - ( - str(self.nameserver), - self.tcp_attempt, - self.nameserver.answer_port(), - e, - response, - ) - ) - # The nameserver is no good, take it out of the mix. - self.nameservers.remove(self.nameserver) - return (None, False) - if self.resolver.cache: - self.resolver.cache.put((self.qname, self.rdtype, self.rdclass), answer) - if answer.rrset is None and self.raise_on_no_answer: - raise NoAnswer(response=answer.response) - return (answer, True) - elif rcode == dns.rcode.NXDOMAIN: - # Further validate the response by making an Answer, even - # if we aren't going to cache it. - try: - answer = Answer( - self.qname, dns.rdatatype.ANY, dns.rdataclass.IN, response - ) - except Exception as e: - self.errors.append( - ( - str(self.nameserver), - self.tcp_attempt, - self.nameserver.answer_port(), - e, - response, - ) - ) - # The nameserver is no good, take it out of the mix. - self.nameservers.remove(self.nameserver) - return (None, False) - self.nxdomain_responses[self.qname] = response - if self.resolver.cache: - self.resolver.cache.put( - (self.qname, dns.rdatatype.ANY, self.rdclass), answer - ) - # Make next_nameserver() return None, so caller breaks its - # inner loop and calls next_request(). - return (None, True) - elif rcode == dns.rcode.YXDOMAIN: - yex = YXDOMAIN() - self.errors.append( - ( - str(self.nameserver), - self.tcp_attempt, - self.nameserver.answer_port(), - yex, - response, - ) - ) - raise yex - else: - # - # We got a response, but we're not happy with the - # rcode in it. - # - if rcode != dns.rcode.SERVFAIL or not self.resolver.retry_servfail: - self.nameservers.remove(self.nameserver) - self.errors.append( - ( - str(self.nameserver), - self.tcp_attempt, - self.nameserver.answer_port(), - dns.rcode.to_text(rcode), - response, - ) - ) - return (None, False) - - -class BaseResolver: - """DNS stub resolver.""" - - # We initialize in reset() - # - # pylint: disable=attribute-defined-outside-init - - domain: dns.name.Name - nameserver_ports: Dict[str, int] - port: int - search: List[dns.name.Name] - use_search_by_default: bool - timeout: float - lifetime: float - keyring: Optional[Any] - keyname: Optional[Union[dns.name.Name, str]] - keyalgorithm: Union[dns.name.Name, str] - edns: int - ednsflags: int - ednsoptions: Optional[List[dns.edns.Option]] - payload: int - cache: Any - flags: Optional[int] - retry_servfail: bool - rotate: bool - ndots: Optional[int] - _nameservers: Sequence[Union[str, dns.nameserver.Nameserver]] - - def __init__( - self, filename: str = "/etc/resolv.conf", configure: bool = True - ) -> None: - """*filename*, a ``str`` or file object, specifying a file - in standard /etc/resolv.conf format. This parameter is meaningful - only when *configure* is true and the platform is POSIX. - - *configure*, a ``bool``. If True (the default), the resolver - instance is configured in the normal fashion for the operating - system the resolver is running on. (I.e. by reading a - /etc/resolv.conf file on POSIX systems and from the registry - on Windows systems.) - """ - - self.reset() - if configure: - if sys.platform == "win32": # pragma: no cover - self.read_registry() - elif filename: - self.read_resolv_conf(filename) - - def reset(self) -> None: - """Reset all resolver configuration to the defaults.""" - - self.domain = dns.name.Name(dns.name.from_text(socket.gethostname())[1:]) - if len(self.domain) == 0: # pragma: no cover - self.domain = dns.name.root - self._nameservers = [] - self.nameserver_ports = {} - self.port = 53 - self.search = [] - self.use_search_by_default = False - self.timeout = 2.0 - self.lifetime = 5.0 - self.keyring = None - self.keyname = None - self.keyalgorithm = dns.tsig.default_algorithm - self.edns = -1 - self.ednsflags = 0 - self.ednsoptions = None - self.payload = 0 - self.cache = None - self.flags = None - self.retry_servfail = False - self.rotate = False - self.ndots = None - - def read_resolv_conf(self, f: Any) -> None: - """Process *f* as a file in the /etc/resolv.conf format. If f is - a ``str``, it is used as the name of the file to open; otherwise it - is treated as the file itself. - - Interprets the following items: - - - nameserver - name server IP address - - - domain - local domain name - - - search - search list for host-name lookup - - - options - supported options are rotate, timeout, edns0, and ndots - - """ - - nameservers = [] - if isinstance(f, str): - try: - cm: contextlib.AbstractContextManager = open(f) - except OSError: - # /etc/resolv.conf doesn't exist, can't be read, etc. - raise NoResolverConfiguration(f"cannot open {f}") - else: - cm = contextlib.nullcontext(f) - with cm as f: - for l in f: - if len(l) == 0 or l[0] == "#" or l[0] == ";": - continue - tokens = l.split() - - # Any line containing less than 2 tokens is malformed - if len(tokens) < 2: - continue - - if tokens[0] == "nameserver": - nameservers.append(tokens[1]) - elif tokens[0] == "domain": - self.domain = dns.name.from_text(tokens[1]) - # domain and search are exclusive - self.search = [] - elif tokens[0] == "search": - # the last search wins - self.search = [] - for suffix in tokens[1:]: - self.search.append(dns.name.from_text(suffix)) - # We don't set domain as it is not used if - # len(self.search) > 0 - elif tokens[0] == "options": - for opt in tokens[1:]: - if opt == "rotate": - self.rotate = True - elif opt == "edns0": - self.use_edns() - elif "timeout" in opt: - try: - self.timeout = int(opt.split(":")[1]) - except (ValueError, IndexError): - pass - elif "ndots" in opt: - try: - self.ndots = int(opt.split(":")[1]) - except (ValueError, IndexError): - pass - if len(nameservers) == 0: - raise NoResolverConfiguration("no nameservers") - # Assigning directly instead of appending means we invoke the - # setter logic, with additonal checking and enrichment. - self.nameservers = nameservers - - def read_registry(self) -> None: # pragma: no cover - """Extract resolver configuration from the Windows registry.""" - try: - info = dns.win32util.get_dns_info() # type: ignore - if info.domain is not None: - self.domain = info.domain - self.nameservers = info.nameservers - self.search = info.search - except AttributeError: - raise NotImplementedError - - def _compute_timeout( - self, - start: float, - lifetime: Optional[float] = None, - errors: Optional[List[ErrorTuple]] = None, - ) -> float: - lifetime = self.lifetime if lifetime is None else lifetime - now = time.time() - duration = now - start - if errors is None: - errors = [] - if duration < 0: - if duration < -1: - # Time going backwards is bad. Just give up. - raise LifetimeTimeout(timeout=duration, errors=errors) - else: - # Time went backwards, but only a little. This can - # happen, e.g. under vmware with older linux kernels. - # Pretend it didn't happen. - duration = 0 - if duration >= lifetime: - raise LifetimeTimeout(timeout=duration, errors=errors) - return min(lifetime - duration, self.timeout) - - def _get_qnames_to_try( - self, qname: dns.name.Name, search: Optional[bool] - ) -> List[dns.name.Name]: - # This is a separate method so we can unit test the search - # rules without requiring the Internet. - if search is None: - search = self.use_search_by_default - qnames_to_try = [] - if qname.is_absolute(): - qnames_to_try.append(qname) - else: - abs_qname = qname.concatenate(dns.name.root) - if search: - if len(self.search) > 0: - # There is a search list, so use it exclusively - search_list = self.search[:] - elif self.domain != dns.name.root and self.domain is not None: - # We have some notion of a domain that isn't the root, so - # use it as the search list. - search_list = [self.domain] - else: - search_list = [] - # Figure out the effective ndots (default is 1) - if self.ndots is None: - ndots = 1 - else: - ndots = self.ndots - for suffix in search_list: - qnames_to_try.append(qname + suffix) - if len(qname) > ndots: - # The name has at least ndots dots, so we should try an - # absolute query first. - qnames_to_try.insert(0, abs_qname) - else: - # The name has less than ndots dots, so we should search - # first, then try the absolute name. - qnames_to_try.append(abs_qname) - else: - qnames_to_try.append(abs_qname) - return qnames_to_try - - def use_tsig( - self, - keyring: Any, - keyname: Optional[Union[dns.name.Name, str]] = None, - algorithm: Union[dns.name.Name, str] = dns.tsig.default_algorithm, - ) -> None: - """Add a TSIG signature to each query. - - The parameters are passed to ``dns.message.Message.use_tsig()``; - see its documentation for details. - """ - - self.keyring = keyring - self.keyname = keyname - self.keyalgorithm = algorithm - - def use_edns( - self, - edns: Optional[Union[int, bool]] = 0, - ednsflags: int = 0, - payload: int = dns.message.DEFAULT_EDNS_PAYLOAD, - options: Optional[List[dns.edns.Option]] = None, - ) -> None: - """Configure EDNS behavior. - - *edns*, an ``int``, is the EDNS level to use. Specifying - ``None``, ``False``, or ``-1`` means "do not use EDNS", and in this case - the other parameters are ignored. Specifying ``True`` is - equivalent to specifying 0, i.e. "use EDNS0". - - *ednsflags*, an ``int``, the EDNS flag values. - - *payload*, an ``int``, is the EDNS sender's payload field, which is the - maximum size of UDP datagram the sender can handle. I.e. how big - a response to this message can be. - - *options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS - options. - """ - - if edns is None or edns is False: - edns = -1 - elif edns is True: - edns = 0 - self.edns = edns - self.ednsflags = ednsflags - self.payload = payload - self.ednsoptions = options - - def set_flags(self, flags: int) -> None: - """Overrides the default flags with your own. - - *flags*, an ``int``, the message flags to use. - """ - - self.flags = flags - - @classmethod - def _enrich_nameservers( - cls, - nameservers: Sequence[Union[str, dns.nameserver.Nameserver]], - nameserver_ports: Dict[str, int], - default_port: int, - ) -> List[dns.nameserver.Nameserver]: - enriched_nameservers = [] - if isinstance(nameservers, list): - for nameserver in nameservers: - enriched_nameserver: dns.nameserver.Nameserver - if isinstance(nameserver, dns.nameserver.Nameserver): - enriched_nameserver = nameserver - elif dns.inet.is_address(nameserver): - port = nameserver_ports.get(nameserver, default_port) - enriched_nameserver = dns.nameserver.Do53Nameserver( - nameserver, port - ) - else: - try: - if urlparse(nameserver).scheme != "https": - raise NotImplementedError - except Exception: - raise ValueError( - f"nameserver {nameserver} is not a " - "dns.nameserver.Nameserver instance or text form, " - "IP address, nor a valid https URL" - ) - enriched_nameserver = dns.nameserver.DoHNameserver(nameserver) - enriched_nameservers.append(enriched_nameserver) - else: - raise ValueError( - f"nameservers must be a list or tuple (not a {type(nameservers)})" - ) - return enriched_nameservers - - @property - def nameservers( - self, - ) -> Sequence[Union[str, dns.nameserver.Nameserver]]: - return self._nameservers - - @nameservers.setter - def nameservers( - self, nameservers: Sequence[Union[str, dns.nameserver.Nameserver]] - ) -> None: - """ - *nameservers*, a ``list`` of nameservers, where a nameserver is either - a string interpretable as a nameserver, or a ``dns.nameserver.Nameserver`` - instance. - - Raises ``ValueError`` if *nameservers* is not a list of nameservers. - """ - # We just call _enrich_nameservers() for checking - self._enrich_nameservers(nameservers, self.nameserver_ports, self.port) - self._nameservers = nameservers - - -class Resolver(BaseResolver): - """DNS stub resolver.""" - - def resolve( - self, - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, - search: Optional[bool] = None, - ) -> Answer: # pylint: disable=arguments-differ - """Query nameservers to find the answer to the question. - - The *qname*, *rdtype*, and *rdclass* parameters may be objects - of the appropriate type, or strings that can be converted into objects - of the appropriate type. - - *qname*, a ``dns.name.Name`` or ``str``, the query name. - - *rdtype*, an ``int`` or ``str``, the query type. - - *rdclass*, an ``int`` or ``str``, the query class. - - *tcp*, a ``bool``. If ``True``, use TCP to make the query. - - *source*, a ``str`` or ``None``. If not ``None``, bind to this IP - address when making queries. - - *raise_on_no_answer*, a ``bool``. If ``True``, raise - ``dns.resolver.NoAnswer`` if there's no answer to the question. - - *source_port*, an ``int``, the port from which to send the message. - - *lifetime*, a ``float``, how many seconds a query should run - before timing out. - - *search*, a ``bool`` or ``None``, determines whether the - search list configured in the system's resolver configuration - are used for relative names, and whether the resolver's domain - may be added to relative names. The default is ``None``, - which causes the value of the resolver's - ``use_search_by_default`` attribute to be used. - - Raises ``dns.resolver.LifetimeTimeout`` if no answers could be found - in the specified lifetime. - - Raises ``dns.resolver.NXDOMAIN`` if the query name does not exist. - - Raises ``dns.resolver.YXDOMAIN`` if the query name is too long after - DNAME substitution. - - Raises ``dns.resolver.NoAnswer`` if *raise_on_no_answer* is - ``True`` and the query name exists but has no RRset of the - desired type and class. - - Raises ``dns.resolver.NoNameservers`` if no non-broken - nameservers are available to answer the question. - - Returns a ``dns.resolver.Answer`` instance. - - """ - - resolution = _Resolution( - self, qname, rdtype, rdclass, tcp, raise_on_no_answer, search - ) - start = time.time() - while True: - (request, answer) = resolution.next_request() - # Note we need to say "if answer is not None" and not just - # "if answer" because answer implements __len__, and python - # will call that. We want to return if we have an answer - # object, including in cases where its length is 0. - if answer is not None: - # cache hit! - return answer - assert request is not None # needed for type checking - done = False - while not done: - (nameserver, tcp, backoff) = resolution.next_nameserver() - if backoff: - time.sleep(backoff) - timeout = self._compute_timeout(start, lifetime, resolution.errors) - try: - response = nameserver.query( - request, - timeout=timeout, - source=source, - source_port=source_port, - max_size=tcp, - ) - except Exception as ex: - (_, done) = resolution.query_result(None, ex) - continue - (answer, done) = resolution.query_result(response, None) - # Note we need to say "if answer is not None" and not just - # "if answer" because answer implements __len__, and python - # will call that. We want to return if we have an answer - # object, including in cases where its length is 0. - if answer is not None: - return answer - - def query( - self, - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, - ) -> Answer: # pragma: no cover - """Query nameservers to find the answer to the question. - - This method calls resolve() with ``search=True``, and is - provided for backwards compatibility with prior versions of - dnspython. See the documentation for the resolve() method for - further details. - """ - warnings.warn( - "please use dns.resolver.Resolver.resolve() instead", - DeprecationWarning, - stacklevel=2, - ) - return self.resolve( - qname, - rdtype, - rdclass, - tcp, - source, - raise_on_no_answer, - source_port, - lifetime, - True, - ) - - def resolve_address(self, ipaddr: str, *args: Any, **kwargs: Any) -> Answer: - """Use a resolver to run a reverse query for PTR records. - - This utilizes the resolve() method to perform a PTR lookup on the - specified IP address. - - *ipaddr*, a ``str``, the IPv4 or IPv6 address you want to get - the PTR record for. - - All other arguments that can be passed to the resolve() function - except for rdtype and rdclass are also supported by this - function. - """ - # We make a modified kwargs for type checking happiness, as otherwise - # we get a legit warning about possibly having rdtype and rdclass - # in the kwargs more than once. - modified_kwargs: Dict[str, Any] = {} - modified_kwargs.update(kwargs) - modified_kwargs["rdtype"] = dns.rdatatype.PTR - modified_kwargs["rdclass"] = dns.rdataclass.IN - return self.resolve( - dns.reversename.from_address(ipaddr), *args, **modified_kwargs - ) - - def resolve_name( - self, - name: Union[dns.name.Name, str], - family: int = socket.AF_UNSPEC, - **kwargs: Any, - ) -> HostAnswers: - """Use a resolver to query for address records. - - This utilizes the resolve() method to perform A and/or AAAA lookups on - the specified name. - - *qname*, a ``dns.name.Name`` or ``str``, the name to resolve. - - *family*, an ``int``, the address family. If socket.AF_UNSPEC - (the default), both A and AAAA records will be retrieved. - - All other arguments that can be passed to the resolve() function - except for rdtype and rdclass are also supported by this - function. - """ - # We make a modified kwargs for type checking happiness, as otherwise - # we get a legit warning about possibly having rdtype and rdclass - # in the kwargs more than once. - modified_kwargs: Dict[str, Any] = {} - modified_kwargs.update(kwargs) - modified_kwargs.pop("rdtype", None) - modified_kwargs["rdclass"] = dns.rdataclass.IN - - if family == socket.AF_INET: - v4 = self.resolve(name, dns.rdatatype.A, **modified_kwargs) - return HostAnswers.make(v4=v4) - elif family == socket.AF_INET6: - v6 = self.resolve(name, dns.rdatatype.AAAA, **modified_kwargs) - return HostAnswers.make(v6=v6) - elif family != socket.AF_UNSPEC: # pragma: no cover - raise NotImplementedError(f"unknown address family {family}") - - raise_on_no_answer = modified_kwargs.pop("raise_on_no_answer", True) - lifetime = modified_kwargs.pop("lifetime", None) - start = time.time() - v6 = self.resolve( - name, - dns.rdatatype.AAAA, - raise_on_no_answer=False, - lifetime=self._compute_timeout(start, lifetime), - **modified_kwargs, - ) - # Note that setting name ensures we query the same name - # for A as we did for AAAA. (This is just in case search lists - # are active by default in the resolver configuration and - # we might be talking to a server that says NXDOMAIN when it - # wants to say NOERROR no data. - name = v6.qname - v4 = self.resolve( - name, - dns.rdatatype.A, - raise_on_no_answer=False, - lifetime=self._compute_timeout(start, lifetime), - **modified_kwargs, - ) - answers = HostAnswers.make(v6=v6, v4=v4, add_empty=not raise_on_no_answer) - if not answers: - raise NoAnswer(response=v6.response) - return answers - - # pylint: disable=redefined-outer-name - - def canonical_name(self, name: Union[dns.name.Name, str]) -> dns.name.Name: - """Determine the canonical name of *name*. - - The canonical name is the name the resolver uses for queries - after all CNAME and DNAME renamings have been applied. - - *name*, a ``dns.name.Name`` or ``str``, the query name. - - This method can raise any exception that ``resolve()`` can - raise, other than ``dns.resolver.NoAnswer`` and - ``dns.resolver.NXDOMAIN``. - - Returns a ``dns.name.Name``. - """ - try: - answer = self.resolve(name, raise_on_no_answer=False) - canonical_name = answer.canonical_name - except dns.resolver.NXDOMAIN as e: - canonical_name = e.canonical_name - return canonical_name - - # pylint: enable=redefined-outer-name - - def try_ddr(self, lifetime: float = 5.0) -> None: - """Try to update the resolver's nameservers using Discovery of Designated - Resolvers (DDR). If successful, the resolver will subsequently use - DNS-over-HTTPS or DNS-over-TLS for future queries. - - *lifetime*, a float, is the maximum time to spend attempting DDR. The default - is 5 seconds. - - If the SVCB query is successful and results in a non-empty list of nameservers, - then the resolver's nameservers are set to the returned servers in priority - order. - - The current implementation does not use any address hints from the SVCB record, - nor does it resolve addresses for the SCVB target name, rather it assumes that - the bootstrap nameserver will always be one of the addresses and uses it. - A future revision to the code may offer fuller support. The code verifies that - the bootstrap nameserver is in the Subject Alternative Name field of the - TLS certficate. - """ - try: - expiration = time.time() + lifetime - answer = self.resolve( - dns._ddr._local_resolver_name, "SVCB", lifetime=lifetime - ) - timeout = dns.query._remaining(expiration) - nameservers = dns._ddr._get_nameservers_sync(answer, timeout) - if len(nameservers) > 0: - self.nameservers = nameservers - except Exception: # pragma: no cover - pass - - -#: The default resolver. -default_resolver: Optional[Resolver] = None - - -def get_default_resolver() -> Resolver: - """Get the default resolver, initializing it if necessary.""" - if default_resolver is None: - reset_default_resolver() - assert default_resolver is not None - return default_resolver - - -def reset_default_resolver() -> None: - """Re-initialize default resolver. - - Note that the resolver configuration (i.e. /etc/resolv.conf on UNIX - systems) will be re-read immediately. - """ - - global default_resolver - default_resolver = Resolver() - - -def resolve( - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, - search: Optional[bool] = None, -) -> Answer: # pragma: no cover - """Query nameservers to find the answer to the question. - - This is a convenience function that uses the default resolver - object to make the query. - - See ``dns.resolver.Resolver.resolve`` for more information on the - parameters. - """ - - return get_default_resolver().resolve( - qname, - rdtype, - rdclass, - tcp, - source, - raise_on_no_answer, - source_port, - lifetime, - search, - ) - - -def query( - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, -) -> Answer: # pragma: no cover - """Query nameservers to find the answer to the question. - - This method calls resolve() with ``search=True``, and is - provided for backwards compatibility with prior versions of - dnspython. See the documentation for the resolve() method for - further details. - """ - warnings.warn( - "please use dns.resolver.resolve() instead", DeprecationWarning, stacklevel=2 - ) - return resolve( - qname, - rdtype, - rdclass, - tcp, - source, - raise_on_no_answer, - source_port, - lifetime, - True, - ) - - -def resolve_address(ipaddr: str, *args: Any, **kwargs: Any) -> Answer: - """Use a resolver to run a reverse query for PTR records. - - See ``dns.resolver.Resolver.resolve_address`` for more information on the - parameters. - """ - - return get_default_resolver().resolve_address(ipaddr, *args, **kwargs) - - -def resolve_name( - name: Union[dns.name.Name, str], family: int = socket.AF_UNSPEC, **kwargs: Any -) -> HostAnswers: - """Use a resolver to query for address records. - - See ``dns.resolver.Resolver.resolve_name`` for more information on the - parameters. - """ - - return get_default_resolver().resolve_name(name, family, **kwargs) - - -def canonical_name(name: Union[dns.name.Name, str]) -> dns.name.Name: - """Determine the canonical name of *name*. - - See ``dns.resolver.Resolver.canonical_name`` for more information on the - parameters and possible exceptions. - """ - - return get_default_resolver().canonical_name(name) - - -def try_ddr(lifetime: float = 5.0) -> None: # pragma: no cover - """Try to update the default resolver's nameservers using Discovery of Designated - Resolvers (DDR). If successful, the resolver will subsequently use - DNS-over-HTTPS or DNS-over-TLS for future queries. - - See :py:func:`dns.resolver.Resolver.try_ddr` for more information. - """ - return get_default_resolver().try_ddr(lifetime) - - -def zone_for_name( - name: Union[dns.name.Name, str], - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - tcp: bool = False, - resolver: Optional[Resolver] = None, - lifetime: Optional[float] = None, -) -> dns.name.Name: - """Find the name of the zone which contains the specified name. - - *name*, an absolute ``dns.name.Name`` or ``str``, the query name. - - *rdclass*, an ``int``, the query class. - - *tcp*, a ``bool``. If ``True``, use TCP to make the query. - - *resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use. - If ``None``, the default, then the default resolver is used. - - *lifetime*, a ``float``, the total time to allow for the queries needed - to determine the zone. If ``None``, the default, then only the individual - query limits of the resolver apply. - - Raises ``dns.resolver.NoRootSOA`` if there is no SOA RR at the DNS - root. (This is only likely to happen if you're using non-default - root servers in your network and they are misconfigured.) - - Raises ``dns.resolver.LifetimeTimeout`` if the answer could not be - found in the allotted lifetime. - - Returns a ``dns.name.Name``. - """ - - if isinstance(name, str): - name = dns.name.from_text(name, dns.name.root) - if resolver is None: - resolver = get_default_resolver() - if not name.is_absolute(): - raise NotAbsolute(name) - start = time.time() - expiration: Optional[float] - if lifetime is not None: - expiration = start + lifetime - else: - expiration = None - while 1: - try: - rlifetime: Optional[float] - if expiration is not None: - rlifetime = expiration - time.time() - if rlifetime <= 0: - rlifetime = 0 - else: - rlifetime = None - answer = resolver.resolve( - name, dns.rdatatype.SOA, rdclass, tcp, lifetime=rlifetime - ) - assert answer.rrset is not None - if answer.rrset.name == name: - return name - # otherwise we were CNAMEd or DNAMEd and need to look higher - except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer) as e: - if isinstance(e, dns.resolver.NXDOMAIN): - response = e.responses().get(name) - else: - response = e.response() # pylint: disable=no-value-for-parameter - if response: - for rrs in response.authority: - if rrs.rdtype == dns.rdatatype.SOA and rrs.rdclass == rdclass: - (nr, _, _) = rrs.name.fullcompare(name) - if nr == dns.name.NAMERELN_SUPERDOMAIN: - # We're doing a proper superdomain check as - # if the name were equal we ought to have gotten - # it in the answer section! We are ignoring the - # possibility that the authority is insane and - # is including multiple SOA RRs for different - # authorities. - return rrs.name - # we couldn't extract anything useful from the response (e.g. it's - # a type 3 NXDOMAIN) - try: - name = name.parent() - except dns.name.NoParent: - raise NoRootSOA - - -def make_resolver_at( - where: Union[dns.name.Name, str], - port: int = 53, - family: int = socket.AF_UNSPEC, - resolver: Optional[Resolver] = None, -) -> Resolver: - """Make a stub resolver using the specified destination as the full resolver. - - *where*, a ``dns.name.Name`` or ``str`` the domain name or IP address of the - full resolver. - - *port*, an ``int``, the port to use. If not specified, the default is 53. - - *family*, an ``int``, the address family to use. This parameter is used if - *where* is not an address. The default is ``socket.AF_UNSPEC`` in which case - the first address returned by ``resolve_name()`` will be used, otherwise the - first address of the specified family will be used. - - *resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use for - resolution of hostnames. If not specified, the default resolver will be used. - - Returns a ``dns.resolver.Resolver`` or raises an exception. - """ - if resolver is None: - resolver = get_default_resolver() - nameservers: List[Union[str, dns.nameserver.Nameserver]] = [] - if isinstance(where, str) and dns.inet.is_address(where): - nameservers.append(dns.nameserver.Do53Nameserver(where, port)) - else: - for address in resolver.resolve_name(where, family).addresses(): - nameservers.append(dns.nameserver.Do53Nameserver(address, port)) - res = dns.resolver.Resolver(configure=False) - res.nameservers = nameservers - return res - - -def resolve_at( - where: Union[dns.name.Name, str], - qname: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.A, - rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - tcp: bool = False, - source: Optional[str] = None, - raise_on_no_answer: bool = True, - source_port: int = 0, - lifetime: Optional[float] = None, - search: Optional[bool] = None, - port: int = 53, - family: int = socket.AF_UNSPEC, - resolver: Optional[Resolver] = None, -) -> Answer: - """Query nameservers to find the answer to the question. - - This is a convenience function that calls ``dns.resolver.make_resolver_at()`` to - make a resolver, and then uses it to resolve the query. - - See ``dns.resolver.Resolver.resolve`` for more information on the resolution - parameters, and ``dns.resolver.make_resolver_at`` for information about the resolver - parameters *where*, *port*, *family*, and *resolver*. - - If making more than one query, it is more efficient to call - ``dns.resolver.make_resolver_at()`` and then use that resolver for the queries - instead of calling ``resolve_at()`` multiple times. - """ - return make_resolver_at(where, port, family, resolver).resolve( - qname, - rdtype, - rdclass, - tcp, - source, - raise_on_no_answer, - source_port, - lifetime, - search, - ) - - -# -# Support for overriding the system resolver for all python code in the -# running process. -# - -_protocols_for_socktype = { - socket.SOCK_DGRAM: [socket.SOL_UDP], - socket.SOCK_STREAM: [socket.SOL_TCP], -} - -_resolver = None -_original_getaddrinfo = socket.getaddrinfo -_original_getnameinfo = socket.getnameinfo -_original_getfqdn = socket.getfqdn -_original_gethostbyname = socket.gethostbyname -_original_gethostbyname_ex = socket.gethostbyname_ex -_original_gethostbyaddr = socket.gethostbyaddr - - -def _getaddrinfo( - host=None, service=None, family=socket.AF_UNSPEC, socktype=0, proto=0, flags=0 -): - if flags & socket.AI_NUMERICHOST != 0: - # Short circuit directly into the system's getaddrinfo(). We're - # not adding any value in this case, and this avoids infinite loops - # because dns.query.* needs to call getaddrinfo() for IPv6 scoping - # reasons. We will also do this short circuit below if we - # discover that the host is an address literal. - return _original_getaddrinfo(host, service, family, socktype, proto, flags) - if flags & (socket.AI_ADDRCONFIG | socket.AI_V4MAPPED) != 0: - # Not implemented. We raise a gaierror as opposed to a - # NotImplementedError as it helps callers handle errors more - # appropriately. [Issue #316] - # - # We raise EAI_FAIL as opposed to EAI_SYSTEM because there is - # no EAI_SYSTEM on Windows [Issue #416]. We didn't go for - # EAI_BADFLAGS as the flags aren't bad, we just don't - # implement them. - raise socket.gaierror( - socket.EAI_FAIL, "Non-recoverable failure in name resolution" - ) - if host is None and service is None: - raise socket.gaierror(socket.EAI_NONAME, "Name or service not known") - addrs = [] - canonical_name = None # pylint: disable=redefined-outer-name - # Is host None or an address literal? If so, use the system's - # getaddrinfo(). - if host is None: - return _original_getaddrinfo(host, service, family, socktype, proto, flags) - try: - # We don't care about the result of af_for_address(), we're just - # calling it so it raises an exception if host is not an IPv4 or - # IPv6 address. - dns.inet.af_for_address(host) - return _original_getaddrinfo(host, service, family, socktype, proto, flags) - except Exception: - pass - # Something needs resolution! - try: - answers = _resolver.resolve_name(host, family) - addrs = answers.addresses_and_families() - canonical_name = answers.canonical_name().to_text(True) - except dns.resolver.NXDOMAIN: - raise socket.gaierror(socket.EAI_NONAME, "Name or service not known") - except Exception: - # We raise EAI_AGAIN here as the failure may be temporary - # (e.g. a timeout) and EAI_SYSTEM isn't defined on Windows. - # [Issue #416] - raise socket.gaierror(socket.EAI_AGAIN, "Temporary failure in name resolution") - port = None - try: - # Is it a port literal? - if service is None: - port = 0 - else: - port = int(service) - except Exception: - if flags & socket.AI_NUMERICSERV == 0: - try: - port = socket.getservbyname(service) - except Exception: - pass - if port is None: - raise socket.gaierror(socket.EAI_NONAME, "Name or service not known") - tuples = [] - if socktype == 0: - socktypes = [socket.SOCK_DGRAM, socket.SOCK_STREAM] - else: - socktypes = [socktype] - if flags & socket.AI_CANONNAME != 0: - cname = canonical_name - else: - cname = "" - for addr, af in addrs: - for socktype in socktypes: - for proto in _protocols_for_socktype[socktype]: - addr_tuple = dns.inet.low_level_address_tuple((addr, port), af) - tuples.append((af, socktype, proto, cname, addr_tuple)) - if len(tuples) == 0: - raise socket.gaierror(socket.EAI_NONAME, "Name or service not known") - return tuples - - -def _getnameinfo(sockaddr, flags=0): - host = sockaddr[0] - port = sockaddr[1] - if len(sockaddr) == 4: - scope = sockaddr[3] - family = socket.AF_INET6 - else: - scope = None - family = socket.AF_INET - tuples = _getaddrinfo(host, port, family, socket.SOCK_STREAM, socket.SOL_TCP, 0) - if len(tuples) > 1: - raise OSError("sockaddr resolved to multiple addresses") - addr = tuples[0][4][0] - if flags & socket.NI_DGRAM: - pname = "udp" - else: - pname = "tcp" - qname = dns.reversename.from_address(addr) - if flags & socket.NI_NUMERICHOST == 0: - try: - answer = _resolver.resolve(qname, "PTR") - hostname = answer.rrset[0].target.to_text(True) - except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): - if flags & socket.NI_NAMEREQD: - raise socket.gaierror(socket.EAI_NONAME, "Name or service not known") - hostname = addr - if scope is not None: - hostname += "%" + str(scope) - else: - hostname = addr - if scope is not None: - hostname += "%" + str(scope) - if flags & socket.NI_NUMERICSERV: - service = str(port) - else: - service = socket.getservbyport(port, pname) - return (hostname, service) - - -def _getfqdn(name=None): - if name is None: - name = socket.gethostname() - try: - (name, _, _) = _gethostbyaddr(name) - # Python's version checks aliases too, but our gethostbyname - # ignores them, so we do so here as well. - except Exception: # pragma: no cover - pass - return name - - -def _gethostbyname(name): - return _gethostbyname_ex(name)[2][0] - - -def _gethostbyname_ex(name): - aliases = [] - addresses = [] - tuples = _getaddrinfo( - name, 0, socket.AF_INET, socket.SOCK_STREAM, socket.SOL_TCP, socket.AI_CANONNAME - ) - canonical = tuples[0][3] - for item in tuples: - addresses.append(item[4][0]) - # XXX we just ignore aliases - return (canonical, aliases, addresses) - - -def _gethostbyaddr(ip): - try: - dns.ipv6.inet_aton(ip) - sockaddr = (ip, 80, 0, 0) - family = socket.AF_INET6 - except Exception: - try: - dns.ipv4.inet_aton(ip) - except Exception: - raise socket.gaierror(socket.EAI_NONAME, "Name or service not known") - sockaddr = (ip, 80) - family = socket.AF_INET - (name, _) = _getnameinfo(sockaddr, socket.NI_NAMEREQD) - aliases = [] - addresses = [] - tuples = _getaddrinfo( - name, 0, family, socket.SOCK_STREAM, socket.SOL_TCP, socket.AI_CANONNAME - ) - canonical = tuples[0][3] - # We only want to include an address from the tuples if it's the - # same as the one we asked about. We do this comparison in binary - # to avoid any differences in text representations. - bin_ip = dns.inet.inet_pton(family, ip) - for item in tuples: - addr = item[4][0] - bin_addr = dns.inet.inet_pton(family, addr) - if bin_ip == bin_addr: - addresses.append(addr) - # XXX we just ignore aliases - return (canonical, aliases, addresses) - - -def override_system_resolver(resolver: Optional[Resolver] = None) -> None: - """Override the system resolver routines in the socket module with - versions which use dnspython's resolver. - - This can be useful in testing situations where you want to control - the resolution behavior of python code without having to change - the system's resolver settings (e.g. /etc/resolv.conf). - - The resolver to use may be specified; if it's not, the default - resolver will be used. - - resolver, a ``dns.resolver.Resolver`` or ``None``, the resolver to use. - """ - - if resolver is None: - resolver = get_default_resolver() - global _resolver - _resolver = resolver - socket.getaddrinfo = _getaddrinfo - socket.getnameinfo = _getnameinfo - socket.getfqdn = _getfqdn - socket.gethostbyname = _gethostbyname - socket.gethostbyname_ex = _gethostbyname_ex - socket.gethostbyaddr = _gethostbyaddr - - -def restore_system_resolver() -> None: - """Undo the effects of prior override_system_resolver().""" - - global _resolver - _resolver = None - socket.getaddrinfo = _original_getaddrinfo - socket.getnameinfo = _original_getnameinfo - socket.getfqdn = _original_getfqdn - socket.gethostbyname = _original_gethostbyname - socket.gethostbyname_ex = _original_gethostbyname_ex - socket.gethostbyaddr = _original_gethostbyaddr diff --git a/write-message/venv/lib/python3.10/site-packages/dns/reversename.py b/write-message/venv/lib/python3.10/site-packages/dns/reversename.py deleted file mode 100644 index 8236c71..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/reversename.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2006-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Reverse Map Names.""" - -import binascii - -import dns.ipv4 -import dns.ipv6 -import dns.name - -ipv4_reverse_domain = dns.name.from_text("in-addr.arpa.") -ipv6_reverse_domain = dns.name.from_text("ip6.arpa.") - - -def from_address( - text: str, - v4_origin: dns.name.Name = ipv4_reverse_domain, - v6_origin: dns.name.Name = ipv6_reverse_domain, -) -> dns.name.Name: - """Convert an IPv4 or IPv6 address in textual form into a Name object whose - value is the reverse-map domain name of the address. - - *text*, a ``str``, is an IPv4 or IPv6 address in textual form - (e.g. '127.0.0.1', '::1') - - *v4_origin*, a ``dns.name.Name`` to append to the labels corresponding to - the address if the address is an IPv4 address, instead of the default - (in-addr.arpa.) - - *v6_origin*, a ``dns.name.Name`` to append to the labels corresponding to - the address if the address is an IPv6 address, instead of the default - (ip6.arpa.) - - Raises ``dns.exception.SyntaxError`` if the address is badly formed. - - Returns a ``dns.name.Name``. - """ - - try: - v6 = dns.ipv6.inet_aton(text) - if dns.ipv6.is_mapped(v6): - parts = ["%d" % byte for byte in v6[12:]] - origin = v4_origin - else: - parts = [x for x in str(binascii.hexlify(v6).decode())] - origin = v6_origin - except Exception: - parts = ["%d" % byte for byte in dns.ipv4.inet_aton(text)] - origin = v4_origin - return dns.name.from_text(".".join(reversed(parts)), origin=origin) - - -def to_address( - name: dns.name.Name, - v4_origin: dns.name.Name = ipv4_reverse_domain, - v6_origin: dns.name.Name = ipv6_reverse_domain, -) -> str: - """Convert a reverse map domain name into textual address form. - - *name*, a ``dns.name.Name``, an IPv4 or IPv6 address in reverse-map name - form. - - *v4_origin*, a ``dns.name.Name`` representing the top-level domain for - IPv4 addresses, instead of the default (in-addr.arpa.) - - *v6_origin*, a ``dns.name.Name`` representing the top-level domain for - IPv4 addresses, instead of the default (ip6.arpa.) - - Raises ``dns.exception.SyntaxError`` if the name does not have a - reverse-map form. - - Returns a ``str``. - """ - - if name.is_subdomain(v4_origin): - name = name.relativize(v4_origin) - text = b".".join(reversed(name.labels)) - # run through inet_ntoa() to check syntax and make pretty. - return dns.ipv4.inet_ntoa(dns.ipv4.inet_aton(text)) - elif name.is_subdomain(v6_origin): - name = name.relativize(v6_origin) - labels = list(reversed(name.labels)) - parts = [] - for i in range(0, len(labels), 4): - parts.append(b"".join(labels[i : i + 4])) - text = b":".join(parts) - # run through inet_ntoa() to check syntax and make pretty. - return dns.ipv6.inet_ntoa(dns.ipv6.inet_aton(text)) - else: - raise dns.exception.SyntaxError("unknown reverse-map address family") diff --git a/write-message/venv/lib/python3.10/site-packages/dns/rrset.py b/write-message/venv/lib/python3.10/site-packages/dns/rrset.py deleted file mode 100644 index 6f39b10..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/rrset.py +++ /dev/null @@ -1,285 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS RRsets (an RRset is a named rdataset)""" - -from typing import Any, Collection, Dict, Optional, Union, cast - -import dns.name -import dns.rdataclass -import dns.rdataset -import dns.renderer - - -class RRset(dns.rdataset.Rdataset): - """A DNS RRset (named rdataset). - - RRset inherits from Rdataset, and RRsets can be treated as - Rdatasets in most cases. There are, however, a few notable - exceptions. RRsets have different to_wire() and to_text() method - arguments, reflecting the fact that RRsets always have an owner - name. - """ - - __slots__ = ["name", "deleting"] - - def __init__( - self, - name: dns.name.Name, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - deleting: Optional[dns.rdataclass.RdataClass] = None, - ): - """Create a new RRset.""" - - super().__init__(rdclass, rdtype, covers) - self.name = name - self.deleting = deleting - - def _clone(self): - obj = super()._clone() - obj.name = self.name - obj.deleting = self.deleting - return obj - - def __repr__(self): - if self.covers == 0: - ctext = "" - else: - ctext = "(" + dns.rdatatype.to_text(self.covers) + ")" - if self.deleting is not None: - dtext = " delete=" + dns.rdataclass.to_text(self.deleting) - else: - dtext = "" - return ( - "" - ) - - def __str__(self): - return self.to_text() - - def __eq__(self, other): - if isinstance(other, RRset): - if self.name != other.name: - return False - elif not isinstance(other, dns.rdataset.Rdataset): - return False - return super().__eq__(other) - - def match(self, *args: Any, **kwargs: Any) -> bool: # type: ignore[override] - """Does this rrset match the specified attributes? - - Behaves as :py:func:`full_match()` if the first argument is a - ``dns.name.Name``, and as :py:func:`dns.rdataset.Rdataset.match()` - otherwise. - - (This behavior fixes a design mistake where the signature of this - method became incompatible with that of its superclass. The fix - makes RRsets matchable as Rdatasets while preserving backwards - compatibility.) - """ - if isinstance(args[0], dns.name.Name): - return self.full_match(*args, **kwargs) # type: ignore[arg-type] - else: - return super().match(*args, **kwargs) # type: ignore[arg-type] - - def full_match( - self, - name: dns.name.Name, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType, - deleting: Optional[dns.rdataclass.RdataClass] = None, - ) -> bool: - """Returns ``True`` if this rrset matches the specified name, class, - type, covers, and deletion state. - """ - if not super().match(rdclass, rdtype, covers): - return False - if self.name != name or self.deleting != deleting: - return False - return True - - # pylint: disable=arguments-differ - - def to_text( # type: ignore[override] - self, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - **kw: Dict[str, Any], - ) -> str: - """Convert the RRset into DNS zone file format. - - See ``dns.name.Name.choose_relativity`` for more information - on how *origin* and *relativize* determine the way names - are emitted. - - Any additional keyword arguments are passed on to the rdata - ``to_text()`` method. - - *origin*, a ``dns.name.Name`` or ``None``, the origin for relative - names. - - *relativize*, a ``bool``. If ``True``, names will be relativized - to *origin*. - """ - - return super().to_text( - self.name, origin, relativize, self.deleting, **kw # type: ignore - ) - - def to_wire( # type: ignore[override] - self, - file: Any, - compress: Optional[dns.name.CompressType] = None, # type: ignore - origin: Optional[dns.name.Name] = None, - **kw: Dict[str, Any], - ) -> int: - """Convert the RRset to wire format. - - All keyword arguments are passed to ``dns.rdataset.to_wire()``; see - that function for details. - - Returns an ``int``, the number of records emitted. - """ - - return super().to_wire( - self.name, file, compress, origin, self.deleting, **kw # type:ignore - ) - - # pylint: enable=arguments-differ - - def to_rdataset(self) -> dns.rdataset.Rdataset: - """Convert an RRset into an Rdataset. - - Returns a ``dns.rdataset.Rdataset``. - """ - return dns.rdataset.from_rdata_list(self.ttl, list(self)) - - -def from_text_list( - name: Union[dns.name.Name, str], - ttl: int, - rdclass: Union[dns.rdataclass.RdataClass, str], - rdtype: Union[dns.rdatatype.RdataType, str], - text_rdatas: Collection[str], - idna_codec: Optional[dns.name.IDNACodec] = None, - origin: Optional[dns.name.Name] = None, - relativize: bool = True, - relativize_to: Optional[dns.name.Name] = None, -) -> RRset: - """Create an RRset with the specified name, TTL, class, and type, and with - the specified list of rdatas in text format. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder to use; if ``None``, the default IDNA 2003 - encoder/decoder is used. - - *origin*, a ``dns.name.Name`` (or ``None``), the - origin to use for relative names. - - *relativize*, a ``bool``. If true, name will be relativized. - - *relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use - when relativizing names. If not set, the *origin* value will be used. - - Returns a ``dns.rrset.RRset`` object. - """ - - if isinstance(name, str): - name = dns.name.from_text(name, None, idna_codec=idna_codec) - rdclass = dns.rdataclass.RdataClass.make(rdclass) - rdtype = dns.rdatatype.RdataType.make(rdtype) - r = RRset(name, rdclass, rdtype) - r.update_ttl(ttl) - for t in text_rdatas: - rd = dns.rdata.from_text( - r.rdclass, r.rdtype, t, origin, relativize, relativize_to, idna_codec - ) - r.add(rd) - return r - - -def from_text( - name: Union[dns.name.Name, str], - ttl: int, - rdclass: Union[dns.rdataclass.RdataClass, str], - rdtype: Union[dns.rdatatype.RdataType, str], - *text_rdatas: Any, -) -> RRset: - """Create an RRset with the specified name, TTL, class, and type and with - the specified rdatas in text format. - - Returns a ``dns.rrset.RRset`` object. - """ - - return from_text_list( - name, ttl, rdclass, rdtype, cast(Collection[str], text_rdatas) - ) - - -def from_rdata_list( - name: Union[dns.name.Name, str], - ttl: int, - rdatas: Collection[dns.rdata.Rdata], - idna_codec: Optional[dns.name.IDNACodec] = None, -) -> RRset: - """Create an RRset with the specified name and TTL, and with - the specified list of rdata objects. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder to use; if ``None``, the default IDNA 2003 - encoder/decoder is used. - - Returns a ``dns.rrset.RRset`` object. - - """ - - if isinstance(name, str): - name = dns.name.from_text(name, None, idna_codec=idna_codec) - - if len(rdatas) == 0: - raise ValueError("rdata list must not be empty") - r = None - for rd in rdatas: - if r is None: - r = RRset(name, rd.rdclass, rd.rdtype) - r.update_ttl(ttl) - r.add(rd) - assert r is not None - return r - - -def from_rdata(name: Union[dns.name.Name, str], ttl: int, *rdatas: Any) -> RRset: - """Create an RRset with the specified name and TTL, and with - the specified rdata objects. - - Returns a ``dns.rrset.RRset`` object. - """ - - return from_rdata_list(name, ttl, cast(Collection[dns.rdata.Rdata], rdatas)) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/serial.py b/write-message/venv/lib/python3.10/site-packages/dns/serial.py deleted file mode 100644 index 3417299..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/serial.py +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -"""Serial Number Arthimetic from RFC 1982""" - - -class Serial: - def __init__(self, value: int, bits: int = 32): - self.value = value % 2**bits - self.bits = bits - - def __repr__(self): - return f"dns.serial.Serial({self.value}, {self.bits})" - - def __eq__(self, other): - if isinstance(other, int): - other = Serial(other, self.bits) - elif not isinstance(other, Serial) or other.bits != self.bits: - return NotImplemented - return self.value == other.value - - def __ne__(self, other): - if isinstance(other, int): - other = Serial(other, self.bits) - elif not isinstance(other, Serial) or other.bits != self.bits: - return NotImplemented - return self.value != other.value - - def __lt__(self, other): - if isinstance(other, int): - other = Serial(other, self.bits) - elif not isinstance(other, Serial) or other.bits != self.bits: - return NotImplemented - if self.value < other.value and other.value - self.value < 2 ** (self.bits - 1): - return True - elif self.value > other.value and self.value - other.value > 2 ** ( - self.bits - 1 - ): - return True - else: - return False - - def __le__(self, other): - return self == other or self < other - - def __gt__(self, other): - if isinstance(other, int): - other = Serial(other, self.bits) - elif not isinstance(other, Serial) or other.bits != self.bits: - return NotImplemented - if self.value < other.value and other.value - self.value > 2 ** (self.bits - 1): - return True - elif self.value > other.value and self.value - other.value < 2 ** ( - self.bits - 1 - ): - return True - else: - return False - - def __ge__(self, other): - return self == other or self > other - - def __add__(self, other): - v = self.value - if isinstance(other, Serial): - delta = other.value - elif isinstance(other, int): - delta = other - else: - raise ValueError - if abs(delta) > (2 ** (self.bits - 1) - 1): - raise ValueError - v += delta - v = v % 2**self.bits - return Serial(v, self.bits) - - def __iadd__(self, other): - v = self.value - if isinstance(other, Serial): - delta = other.value - elif isinstance(other, int): - delta = other - else: - raise ValueError - if abs(delta) > (2 ** (self.bits - 1) - 1): - raise ValueError - v += delta - v = v % 2**self.bits - self.value = v - return self - - def __sub__(self, other): - v = self.value - if isinstance(other, Serial): - delta = other.value - elif isinstance(other, int): - delta = other - else: - raise ValueError - if abs(delta) > (2 ** (self.bits - 1) - 1): - raise ValueError - v -= delta - v = v % 2**self.bits - return Serial(v, self.bits) - - def __isub__(self, other): - v = self.value - if isinstance(other, Serial): - delta = other.value - elif isinstance(other, int): - delta = other - else: - raise ValueError - if abs(delta) > (2 ** (self.bits - 1) - 1): - raise ValueError - v -= delta - v = v % 2**self.bits - self.value = v - return self diff --git a/write-message/venv/lib/python3.10/site-packages/dns/set.py b/write-message/venv/lib/python3.10/site-packages/dns/set.py deleted file mode 100644 index ae8f0dd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/set.py +++ /dev/null @@ -1,308 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -import itertools - - -class Set: - """A simple set class. - - This class was originally used to deal with python not having a set class, and - originally the class used lists in its implementation. The ordered and indexable - nature of RRsets and Rdatasets is unfortunately widely used in dnspython - applications, so for backwards compatibility sets continue to be a custom class, now - based on an ordered dictionary. - """ - - __slots__ = ["items"] - - def __init__(self, items=None): - """Initialize the set. - - *items*, an iterable or ``None``, the initial set of items. - """ - - self.items = dict() - if items is not None: - for item in items: - # This is safe for how we use set, but if other code - # subclasses it could be a legitimate issue. - self.add(item) # lgtm[py/init-calls-subclass] - - def __repr__(self): - return f"dns.set.Set({repr(list(self.items.keys()))})" # pragma: no cover - - def add(self, item): - """Add an item to the set.""" - - if item not in self.items: - self.items[item] = None - - def remove(self, item): - """Remove an item from the set.""" - - try: - del self.items[item] - except KeyError: - raise ValueError - - def discard(self, item): - """Remove an item from the set if present.""" - - self.items.pop(item, None) - - def pop(self): - """Remove an arbitrary item from the set.""" - (k, _) = self.items.popitem() - return k - - def _clone(self) -> "Set": - """Make a (shallow) copy of the set. - - There is a 'clone protocol' that subclasses of this class - should use. To make a copy, first call your super's _clone() - method, and use the object returned as the new instance. Then - make shallow copies of the attributes defined in the subclass. - - This protocol allows us to write the set algorithms that - return new instances (e.g. union) once, and keep using them in - subclasses. - """ - - if hasattr(self, "_clone_class"): - cls = self._clone_class # type: ignore - else: - cls = self.__class__ - obj = cls.__new__(cls) - obj.items = dict() - obj.items.update(self.items) - return obj - - def __copy__(self): - """Make a (shallow) copy of the set.""" - - return self._clone() - - def copy(self): - """Make a (shallow) copy of the set.""" - - return self._clone() - - def union_update(self, other): - """Update the set, adding any elements from other which are not - already in the set. - """ - - if not isinstance(other, Set): - raise ValueError("other must be a Set instance") - if self is other: # lgtm[py/comparison-using-is] - return - for item in other.items: - self.add(item) - - def intersection_update(self, other): - """Update the set, removing any elements from other which are not - in both sets. - """ - - if not isinstance(other, Set): - raise ValueError("other must be a Set instance") - if self is other: # lgtm[py/comparison-using-is] - return - # we make a copy of the list so that we can remove items from - # the list without breaking the iterator. - for item in list(self.items): - if item not in other.items: - del self.items[item] - - def difference_update(self, other): - """Update the set, removing any elements from other which are in - the set. - """ - - if not isinstance(other, Set): - raise ValueError("other must be a Set instance") - if self is other: # lgtm[py/comparison-using-is] - self.items.clear() - else: - for item in other.items: - self.discard(item) - - def symmetric_difference_update(self, other): - """Update the set, retaining only elements unique to both sets.""" - - if not isinstance(other, Set): - raise ValueError("other must be a Set instance") - if self is other: # lgtm[py/comparison-using-is] - self.items.clear() - else: - overlap = self.intersection(other) - self.union_update(other) - self.difference_update(overlap) - - def union(self, other): - """Return a new set which is the union of ``self`` and ``other``. - - Returns the same Set type as this set. - """ - - obj = self._clone() - obj.union_update(other) - return obj - - def intersection(self, other): - """Return a new set which is the intersection of ``self`` and - ``other``. - - Returns the same Set type as this set. - """ - - obj = self._clone() - obj.intersection_update(other) - return obj - - def difference(self, other): - """Return a new set which ``self`` - ``other``, i.e. the items - in ``self`` which are not also in ``other``. - - Returns the same Set type as this set. - """ - - obj = self._clone() - obj.difference_update(other) - return obj - - def symmetric_difference(self, other): - """Return a new set which (``self`` - ``other``) | (``other`` - - ``self), ie: the items in either ``self`` or ``other`` which - are not contained in their intersection. - - Returns the same Set type as this set. - """ - - obj = self._clone() - obj.symmetric_difference_update(other) - return obj - - def __or__(self, other): - return self.union(other) - - def __and__(self, other): - return self.intersection(other) - - def __add__(self, other): - return self.union(other) - - def __sub__(self, other): - return self.difference(other) - - def __xor__(self, other): - return self.symmetric_difference(other) - - def __ior__(self, other): - self.union_update(other) - return self - - def __iand__(self, other): - self.intersection_update(other) - return self - - def __iadd__(self, other): - self.union_update(other) - return self - - def __isub__(self, other): - self.difference_update(other) - return self - - def __ixor__(self, other): - self.symmetric_difference_update(other) - return self - - def update(self, other): - """Update the set, adding any elements from other which are not - already in the set. - - *other*, the collection of items with which to update the set, which - may be any iterable type. - """ - - for item in other: - self.add(item) - - def clear(self): - """Make the set empty.""" - self.items.clear() - - def __eq__(self, other): - return self.items == other.items - - def __ne__(self, other): - return not self.__eq__(other) - - def __len__(self): - return len(self.items) - - def __iter__(self): - return iter(self.items) - - def __getitem__(self, i): - if isinstance(i, slice): - return list(itertools.islice(self.items, i.start, i.stop, i.step)) - else: - return next(itertools.islice(self.items, i, i + 1)) - - def __delitem__(self, i): - if isinstance(i, slice): - for elt in list(self[i]): - del self.items[elt] - else: - del self.items[self[i]] - - def issubset(self, other): - """Is this set a subset of *other*? - - Returns a ``bool``. - """ - - if not isinstance(other, Set): - raise ValueError("other must be a Set instance") - for item in self.items: - if item not in other.items: - return False - return True - - def issuperset(self, other): - """Is this set a superset of *other*? - - Returns a ``bool``. - """ - - if not isinstance(other, Set): - raise ValueError("other must be a Set instance") - for item in other.items: - if item not in self.items: - return False - return True - - def isdisjoint(self, other): - if not isinstance(other, Set): - raise ValueError("other must be a Set instance") - for item in other.items: - if item in self.items: - return False - return True diff --git a/write-message/venv/lib/python3.10/site-packages/dns/tokenizer.py b/write-message/venv/lib/python3.10/site-packages/dns/tokenizer.py deleted file mode 100644 index ab205bc..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/tokenizer.py +++ /dev/null @@ -1,708 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""Tokenize DNS zone file format""" - -import io -import sys -from typing import Any, List, Optional, Tuple - -import dns.exception -import dns.name -import dns.ttl - -_DELIMITERS = {" ", "\t", "\n", ";", "(", ")", '"'} -_QUOTING_DELIMITERS = {'"'} - -EOF = 0 -EOL = 1 -WHITESPACE = 2 -IDENTIFIER = 3 -QUOTED_STRING = 4 -COMMENT = 5 -DELIMITER = 6 - - -class UngetBufferFull(dns.exception.DNSException): - """An attempt was made to unget a token when the unget buffer was full.""" - - -class Token: - """A DNS zone file format token. - - ttype: The token type - value: The token value - has_escape: Does the token value contain escapes? - """ - - def __init__( - self, - ttype: int, - value: Any = "", - has_escape: bool = False, - comment: Optional[str] = None, - ): - """Initialize a token instance.""" - - self.ttype = ttype - self.value = value - self.has_escape = has_escape - self.comment = comment - - def is_eof(self) -> bool: - return self.ttype == EOF - - def is_eol(self) -> bool: - return self.ttype == EOL - - def is_whitespace(self) -> bool: - return self.ttype == WHITESPACE - - def is_identifier(self) -> bool: - return self.ttype == IDENTIFIER - - def is_quoted_string(self) -> bool: - return self.ttype == QUOTED_STRING - - def is_comment(self) -> bool: - return self.ttype == COMMENT - - def is_delimiter(self) -> bool: # pragma: no cover (we don't return delimiters yet) - return self.ttype == DELIMITER - - def is_eol_or_eof(self) -> bool: - return self.ttype == EOL or self.ttype == EOF - - def __eq__(self, other): - if not isinstance(other, Token): - return False - return self.ttype == other.ttype and self.value == other.value - - def __ne__(self, other): - if not isinstance(other, Token): - return True - return self.ttype != other.ttype or self.value != other.value - - def __str__(self): - return '%d "%s"' % (self.ttype, self.value) - - def unescape(self) -> "Token": - if not self.has_escape: - return self - unescaped = "" - l = len(self.value) - i = 0 - while i < l: - c = self.value[i] - i += 1 - if c == "\\": - if i >= l: # pragma: no cover (can't happen via get()) - raise dns.exception.UnexpectedEnd - c = self.value[i] - i += 1 - if c.isdigit(): - if i >= l: - raise dns.exception.UnexpectedEnd - c2 = self.value[i] - i += 1 - if i >= l: - raise dns.exception.UnexpectedEnd - c3 = self.value[i] - i += 1 - if not (c2.isdigit() and c3.isdigit()): - raise dns.exception.SyntaxError - codepoint = int(c) * 100 + int(c2) * 10 + int(c3) - if codepoint > 255: - raise dns.exception.SyntaxError - c = chr(codepoint) - unescaped += c - return Token(self.ttype, unescaped) - - def unescape_to_bytes(self) -> "Token": - # We used to use unescape() for TXT-like records, but this - # caused problems as we'd process DNS escapes into Unicode code - # points instead of byte values, and then a to_text() of the - # processed data would not equal the original input. For - # example, \226 in the TXT record would have a to_text() of - # \195\162 because we applied UTF-8 encoding to Unicode code - # point 226. - # - # We now apply escapes while converting directly to bytes, - # avoiding this double encoding. - # - # This code also handles cases where the unicode input has - # non-ASCII code-points in it by converting it to UTF-8. TXT - # records aren't defined for Unicode, but this is the best we - # can do to preserve meaning. For example, - # - # foo\u200bbar - # - # (where \u200b is Unicode code point 0x200b) will be treated - # as if the input had been the UTF-8 encoding of that string, - # namely: - # - # foo\226\128\139bar - # - unescaped = b"" - l = len(self.value) - i = 0 - while i < l: - c = self.value[i] - i += 1 - if c == "\\": - if i >= l: # pragma: no cover (can't happen via get()) - raise dns.exception.UnexpectedEnd - c = self.value[i] - i += 1 - if c.isdigit(): - if i >= l: - raise dns.exception.UnexpectedEnd - c2 = self.value[i] - i += 1 - if i >= l: - raise dns.exception.UnexpectedEnd - c3 = self.value[i] - i += 1 - if not (c2.isdigit() and c3.isdigit()): - raise dns.exception.SyntaxError - codepoint = int(c) * 100 + int(c2) * 10 + int(c3) - if codepoint > 255: - raise dns.exception.SyntaxError - unescaped += b"%c" % (codepoint) - else: - # Note that as mentioned above, if c is a Unicode - # code point outside of the ASCII range, then this - # += is converting that code point to its UTF-8 - # encoding and appending multiple bytes to - # unescaped. - unescaped += c.encode() - else: - unescaped += c.encode() - return Token(self.ttype, bytes(unescaped)) - - -class Tokenizer: - """A DNS zone file format tokenizer. - - A token object is basically a (type, value) tuple. The valid - types are EOF, EOL, WHITESPACE, IDENTIFIER, QUOTED_STRING, - COMMENT, and DELIMITER. - - file: The file to tokenize - - ungotten_char: The most recently ungotten character, or None. - - ungotten_token: The most recently ungotten token, or None. - - multiline: The current multiline level. This value is increased - by one every time a '(' delimiter is read, and decreased by one every time - a ')' delimiter is read. - - quoting: This variable is true if the tokenizer is currently - reading a quoted string. - - eof: This variable is true if the tokenizer has encountered EOF. - - delimiters: The current delimiter dictionary. - - line_number: The current line number - - filename: A filename that will be returned by the where() method. - - idna_codec: A dns.name.IDNACodec, specifies the IDNA - encoder/decoder. If None, the default IDNA 2003 - encoder/decoder is used. - """ - - def __init__( - self, - f: Any = sys.stdin, - filename: Optional[str] = None, - idna_codec: Optional[dns.name.IDNACodec] = None, - ): - """Initialize a tokenizer instance. - - f: The file to tokenize. The default is sys.stdin. - This parameter may also be a string, in which case the tokenizer - will take its input from the contents of the string. - - filename: the name of the filename that the where() method - will return. - - idna_codec: A dns.name.IDNACodec, specifies the IDNA - encoder/decoder. If None, the default IDNA 2003 - encoder/decoder is used. - """ - - if isinstance(f, str): - f = io.StringIO(f) - if filename is None: - filename = "" - elif isinstance(f, bytes): - f = io.StringIO(f.decode()) - if filename is None: - filename = "" - else: - if filename is None: - if f is sys.stdin: - filename = "" - else: - filename = "" - self.file = f - self.ungotten_char: Optional[str] = None - self.ungotten_token: Optional[Token] = None - self.multiline = 0 - self.quoting = False - self.eof = False - self.delimiters = _DELIMITERS - self.line_number = 1 - assert filename is not None - self.filename = filename - if idna_codec is None: - self.idna_codec: dns.name.IDNACodec = dns.name.IDNA_2003 - else: - self.idna_codec = idna_codec - - def _get_char(self) -> str: - """Read a character from input.""" - - if self.ungotten_char is None: - if self.eof: - c = "" - else: - c = self.file.read(1) - if c == "": - self.eof = True - elif c == "\n": - self.line_number += 1 - else: - c = self.ungotten_char - self.ungotten_char = None - return c - - def where(self) -> Tuple[str, int]: - """Return the current location in the input. - - Returns a (string, int) tuple. The first item is the filename of - the input, the second is the current line number. - """ - - return (self.filename, self.line_number) - - def _unget_char(self, c: str) -> None: - """Unget a character. - - The unget buffer for characters is only one character large; it is - an error to try to unget a character when the unget buffer is not - empty. - - c: the character to unget - raises UngetBufferFull: there is already an ungotten char - """ - - if self.ungotten_char is not None: - # this should never happen! - raise UngetBufferFull # pragma: no cover - self.ungotten_char = c - - def skip_whitespace(self) -> int: - """Consume input until a non-whitespace character is encountered. - - The non-whitespace character is then ungotten, and the number of - whitespace characters consumed is returned. - - If the tokenizer is in multiline mode, then newlines are whitespace. - - Returns the number of characters skipped. - """ - - skipped = 0 - while True: - c = self._get_char() - if c != " " and c != "\t": - if (c != "\n") or not self.multiline: - self._unget_char(c) - return skipped - skipped += 1 - - def get(self, want_leading: bool = False, want_comment: bool = False) -> Token: - """Get the next token. - - want_leading: If True, return a WHITESPACE token if the - first character read is whitespace. The default is False. - - want_comment: If True, return a COMMENT token if the - first token read is a comment. The default is False. - - Raises dns.exception.UnexpectedEnd: input ended prematurely - - Raises dns.exception.SyntaxError: input was badly formed - - Returns a Token. - """ - - if self.ungotten_token is not None: - utoken = self.ungotten_token - self.ungotten_token = None - if utoken.is_whitespace(): - if want_leading: - return utoken - elif utoken.is_comment(): - if want_comment: - return utoken - else: - return utoken - skipped = self.skip_whitespace() - if want_leading and skipped > 0: - return Token(WHITESPACE, " ") - token = "" - ttype = IDENTIFIER - has_escape = False - while True: - c = self._get_char() - if c == "" or c in self.delimiters: - if c == "" and self.quoting: - raise dns.exception.UnexpectedEnd - if token == "" and ttype != QUOTED_STRING: - if c == "(": - self.multiline += 1 - self.skip_whitespace() - continue - elif c == ")": - if self.multiline <= 0: - raise dns.exception.SyntaxError - self.multiline -= 1 - self.skip_whitespace() - continue - elif c == '"': - if not self.quoting: - self.quoting = True - self.delimiters = _QUOTING_DELIMITERS - ttype = QUOTED_STRING - continue - else: - self.quoting = False - self.delimiters = _DELIMITERS - self.skip_whitespace() - continue - elif c == "\n": - return Token(EOL, "\n") - elif c == ";": - while 1: - c = self._get_char() - if c == "\n" or c == "": - break - token += c - if want_comment: - self._unget_char(c) - return Token(COMMENT, token) - elif c == "": - if self.multiline: - raise dns.exception.SyntaxError( - "unbalanced parentheses" - ) - return Token(EOF, comment=token) - elif self.multiline: - self.skip_whitespace() - token = "" - continue - else: - return Token(EOL, "\n", comment=token) - else: - # This code exists in case we ever want a - # delimiter to be returned. It never produces - # a token currently. - token = c - ttype = DELIMITER - else: - self._unget_char(c) - break - elif self.quoting and c == "\n": - raise dns.exception.SyntaxError("newline in quoted string") - elif c == "\\": - # - # It's an escape. Put it and the next character into - # the token; it will be checked later for goodness. - # - token += c - has_escape = True - c = self._get_char() - if c == "" or (c == "\n" and not self.quoting): - raise dns.exception.UnexpectedEnd - token += c - if token == "" and ttype != QUOTED_STRING: - if self.multiline: - raise dns.exception.SyntaxError("unbalanced parentheses") - ttype = EOF - return Token(ttype, token, has_escape) - - def unget(self, token: Token) -> None: - """Unget a token. - - The unget buffer for tokens is only one token large; it is - an error to try to unget a token when the unget buffer is not - empty. - - token: the token to unget - - Raises UngetBufferFull: there is already an ungotten token - """ - - if self.ungotten_token is not None: - raise UngetBufferFull - self.ungotten_token = token - - def next(self): - """Return the next item in an iteration. - - Returns a Token. - """ - - token = self.get() - if token.is_eof(): - raise StopIteration - return token - - __next__ = next - - def __iter__(self): - return self - - # Helpers - - def get_int(self, base: int = 10) -> int: - """Read the next token and interpret it as an unsigned integer. - - Raises dns.exception.SyntaxError if not an unsigned integer. - - Returns an int. - """ - - token = self.get().unescape() - if not token.is_identifier(): - raise dns.exception.SyntaxError("expecting an identifier") - if not token.value.isdigit(): - raise dns.exception.SyntaxError("expecting an integer") - return int(token.value, base) - - def get_uint8(self) -> int: - """Read the next token and interpret it as an 8-bit unsigned - integer. - - Raises dns.exception.SyntaxError if not an 8-bit unsigned integer. - - Returns an int. - """ - - value = self.get_int() - if value < 0 or value > 255: - raise dns.exception.SyntaxError( - "%d is not an unsigned 8-bit integer" % value - ) - return value - - def get_uint16(self, base: int = 10) -> int: - """Read the next token and interpret it as a 16-bit unsigned - integer. - - Raises dns.exception.SyntaxError if not a 16-bit unsigned integer. - - Returns an int. - """ - - value = self.get_int(base=base) - if value < 0 or value > 65535: - if base == 8: - raise dns.exception.SyntaxError( - f"{value:o} is not an octal unsigned 16-bit integer" - ) - else: - raise dns.exception.SyntaxError( - "%d is not an unsigned 16-bit integer" % value - ) - return value - - def get_uint32(self, base: int = 10) -> int: - """Read the next token and interpret it as a 32-bit unsigned - integer. - - Raises dns.exception.SyntaxError if not a 32-bit unsigned integer. - - Returns an int. - """ - - value = self.get_int(base=base) - if value < 0 or value > 4294967295: - raise dns.exception.SyntaxError( - "%d is not an unsigned 32-bit integer" % value - ) - return value - - def get_uint48(self, base: int = 10) -> int: - """Read the next token and interpret it as a 48-bit unsigned - integer. - - Raises dns.exception.SyntaxError if not a 48-bit unsigned integer. - - Returns an int. - """ - - value = self.get_int(base=base) - if value < 0 or value > 281474976710655: - raise dns.exception.SyntaxError( - "%d is not an unsigned 48-bit integer" % value - ) - return value - - def get_string(self, max_length: Optional[int] = None) -> str: - """Read the next token and interpret it as a string. - - Raises dns.exception.SyntaxError if not a string. - Raises dns.exception.SyntaxError if token value length - exceeds max_length (if specified). - - Returns a string. - """ - - token = self.get().unescape() - if not (token.is_identifier() or token.is_quoted_string()): - raise dns.exception.SyntaxError("expecting a string") - if max_length and len(token.value) > max_length: - raise dns.exception.SyntaxError("string too long") - return token.value - - def get_identifier(self) -> str: - """Read the next token, which should be an identifier. - - Raises dns.exception.SyntaxError if not an identifier. - - Returns a string. - """ - - token = self.get().unescape() - if not token.is_identifier(): - raise dns.exception.SyntaxError("expecting an identifier") - return token.value - - def get_remaining(self, max_tokens: Optional[int] = None) -> List[Token]: - """Return the remaining tokens on the line, until an EOL or EOF is seen. - - max_tokens: If not None, stop after this number of tokens. - - Returns a list of tokens. - """ - - tokens = [] - while True: - token = self.get() - if token.is_eol_or_eof(): - self.unget(token) - break - tokens.append(token) - if len(tokens) == max_tokens: - break - return tokens - - def concatenate_remaining_identifiers(self, allow_empty: bool = False) -> str: - """Read the remaining tokens on the line, which should be identifiers. - - Raises dns.exception.SyntaxError if there are no remaining tokens, - unless `allow_empty=True` is given. - - Raises dns.exception.SyntaxError if a token is seen that is not an - identifier. - - Returns a string containing a concatenation of the remaining - identifiers. - """ - s = "" - while True: - token = self.get().unescape() - if token.is_eol_or_eof(): - self.unget(token) - break - if not token.is_identifier(): - raise dns.exception.SyntaxError - s += token.value - if not (allow_empty or s): - raise dns.exception.SyntaxError("expecting another identifier") - return s - - def as_name( - self, - token: Token, - origin: Optional[dns.name.Name] = None, - relativize: bool = False, - relativize_to: Optional[dns.name.Name] = None, - ) -> dns.name.Name: - """Try to interpret the token as a DNS name. - - Raises dns.exception.SyntaxError if not a name. - - Returns a dns.name.Name. - """ - if not token.is_identifier(): - raise dns.exception.SyntaxError("expecting an identifier") - name = dns.name.from_text(token.value, origin, self.idna_codec) - return name.choose_relativity(relativize_to or origin, relativize) - - def get_name( - self, - origin: Optional[dns.name.Name] = None, - relativize: bool = False, - relativize_to: Optional[dns.name.Name] = None, - ) -> dns.name.Name: - """Read the next token and interpret it as a DNS name. - - Raises dns.exception.SyntaxError if not a name. - - Returns a dns.name.Name. - """ - - token = self.get() - return self.as_name(token, origin, relativize, relativize_to) - - def get_eol_as_token(self) -> Token: - """Read the next token and raise an exception if it isn't EOL or - EOF. - - Returns a string. - """ - - token = self.get() - if not token.is_eol_or_eof(): - raise dns.exception.SyntaxError( - 'expected EOL or EOF, got %d "%s"' % (token.ttype, token.value) - ) - return token - - def get_eol(self) -> str: - return self.get_eol_as_token().value - - def get_ttl(self) -> int: - """Read the next token and interpret it as a DNS TTL. - - Raises dns.exception.SyntaxError or dns.ttl.BadTTL if not an - identifier or badly formed. - - Returns an int. - """ - - token = self.get().unescape() - if not token.is_identifier(): - raise dns.exception.SyntaxError("expecting an identifier") - return dns.ttl.from_text(token.value) diff --git a/write-message/venv/lib/python3.10/site-packages/dns/transaction.py b/write-message/venv/lib/python3.10/site-packages/dns/transaction.py deleted file mode 100644 index aa2e116..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/transaction.py +++ /dev/null @@ -1,649 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import collections -from typing import Any, Callable, Iterator, List, Optional, Tuple, Union - -import dns.exception -import dns.name -import dns.node -import dns.rdataclass -import dns.rdataset -import dns.rdatatype -import dns.rrset -import dns.serial -import dns.ttl - - -class TransactionManager: - def reader(self) -> "Transaction": - """Begin a read-only transaction.""" - raise NotImplementedError # pragma: no cover - - def writer(self, replacement: bool = False) -> "Transaction": - """Begin a writable transaction. - - *replacement*, a ``bool``. If `True`, the content of the - transaction completely replaces any prior content. If False, - the default, then the content of the transaction updates the - existing content. - """ - raise NotImplementedError # pragma: no cover - - def origin_information( - self, - ) -> Tuple[Optional[dns.name.Name], bool, Optional[dns.name.Name]]: - """Returns a tuple - - (absolute_origin, relativize, effective_origin) - - giving the absolute name of the default origin for any - relative domain names, the "effective origin", and whether - names should be relativized. The "effective origin" is the - absolute origin if relativize is False, and the empty name if - relativize is true. (The effective origin is provided even - though it can be computed from the absolute_origin and - relativize setting because it avoids a lot of code - duplication.) - - If the returned names are `None`, then no origin information is - available. - - This information is used by code working with transactions to - allow it to coordinate relativization. The transaction code - itself takes what it gets (i.e. does not change name - relativity). - - """ - raise NotImplementedError # pragma: no cover - - def get_class(self) -> dns.rdataclass.RdataClass: - """The class of the transaction manager.""" - raise NotImplementedError # pragma: no cover - - def from_wire_origin(self) -> Optional[dns.name.Name]: - """Origin to use in from_wire() calls.""" - (absolute_origin, relativize, _) = self.origin_information() - if relativize: - return absolute_origin - else: - return None - - -class DeleteNotExact(dns.exception.DNSException): - """Existing data did not match data specified by an exact delete.""" - - -class ReadOnly(dns.exception.DNSException): - """Tried to write to a read-only transaction.""" - - -class AlreadyEnded(dns.exception.DNSException): - """Tried to use an already-ended transaction.""" - - -def _ensure_immutable_rdataset(rdataset): - if rdataset is None or isinstance(rdataset, dns.rdataset.ImmutableRdataset): - return rdataset - return dns.rdataset.ImmutableRdataset(rdataset) - - -def _ensure_immutable_node(node): - if node is None or node.is_immutable(): - return node - return dns.node.ImmutableNode(node) - - -CheckPutRdatasetType = Callable[ - ["Transaction", dns.name.Name, dns.rdataset.Rdataset], None -] -CheckDeleteRdatasetType = Callable[ - ["Transaction", dns.name.Name, dns.rdatatype.RdataType, dns.rdatatype.RdataType], - None, -] -CheckDeleteNameType = Callable[["Transaction", dns.name.Name], None] - - -class Transaction: - def __init__( - self, - manager: TransactionManager, - replacement: bool = False, - read_only: bool = False, - ): - self.manager = manager - self.replacement = replacement - self.read_only = read_only - self._ended = False - self._check_put_rdataset: List[CheckPutRdatasetType] = [] - self._check_delete_rdataset: List[CheckDeleteRdatasetType] = [] - self._check_delete_name: List[CheckDeleteNameType] = [] - - # - # This is the high level API - # - # Note that we currently use non-immutable types in the return type signature to - # avoid covariance problems, e.g. if the caller has a List[Rdataset], mypy will be - # unhappy if we return an ImmutableRdataset. - - def get( - self, - name: Optional[Union[dns.name.Name, str]], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - ) -> dns.rdataset.Rdataset: - """Return the rdataset associated with *name*, *rdtype*, and *covers*, - or `None` if not found. - - Note that the returned rdataset is immutable. - """ - self._check_ended() - if isinstance(name, str): - name = dns.name.from_text(name, None) - rdtype = dns.rdatatype.RdataType.make(rdtype) - covers = dns.rdatatype.RdataType.make(covers) - rdataset = self._get_rdataset(name, rdtype, covers) - return _ensure_immutable_rdataset(rdataset) - - def get_node(self, name: dns.name.Name) -> Optional[dns.node.Node]: - """Return the node at *name*, if any. - - Returns an immutable node or ``None``. - """ - return _ensure_immutable_node(self._get_node(name)) - - def _check_read_only(self) -> None: - if self.read_only: - raise ReadOnly - - def add(self, *args: Any) -> None: - """Add records. - - The arguments may be: - - - rrset - - - name, rdataset... - - - name, ttl, rdata... - """ - self._check_ended() - self._check_read_only() - self._add(False, args) - - def replace(self, *args: Any) -> None: - """Replace the existing rdataset at the name with the specified - rdataset, or add the specified rdataset if there was no existing - rdataset. - - The arguments may be: - - - rrset - - - name, rdataset... - - - name, ttl, rdata... - - Note that if you want to replace the entire node, you should do - a delete of the name followed by one or more calls to add() or - replace(). - """ - self._check_ended() - self._check_read_only() - self._add(True, args) - - def delete(self, *args: Any) -> None: - """Delete records. - - It is not an error if some of the records are not in the existing - set. - - The arguments may be: - - - rrset - - - name - - - name, rdatatype, [covers] - - - name, rdataset... - - - name, rdata... - """ - self._check_ended() - self._check_read_only() - self._delete(False, args) - - def delete_exact(self, *args: Any) -> None: - """Delete records. - - The arguments may be: - - - rrset - - - name - - - name, rdatatype, [covers] - - - name, rdataset... - - - name, rdata... - - Raises dns.transaction.DeleteNotExact if some of the records - are not in the existing set. - - """ - self._check_ended() - self._check_read_only() - self._delete(True, args) - - def name_exists(self, name: Union[dns.name.Name, str]) -> bool: - """Does the specified name exist?""" - self._check_ended() - if isinstance(name, str): - name = dns.name.from_text(name, None) - return self._name_exists(name) - - def update_serial( - self, - value: int = 1, - relative: bool = True, - name: dns.name.Name = dns.name.empty, - ) -> None: - """Update the serial number. - - *value*, an `int`, is an increment if *relative* is `True`, or the - actual value to set if *relative* is `False`. - - Raises `KeyError` if there is no SOA rdataset at *name*. - - Raises `ValueError` if *value* is negative or if the increment is - so large that it would cause the new serial to be less than the - prior value. - """ - self._check_ended() - if value < 0: - raise ValueError("negative update_serial() value") - if isinstance(name, str): - name = dns.name.from_text(name, None) - rdataset = self._get_rdataset(name, dns.rdatatype.SOA, dns.rdatatype.NONE) - if rdataset is None or len(rdataset) == 0: - raise KeyError - if relative: - serial = dns.serial.Serial(rdataset[0].serial) + value - else: - serial = dns.serial.Serial(value) - serial = serial.value # convert back to int - if serial == 0: - serial = 1 - rdata = rdataset[0].replace(serial=serial) - new_rdataset = dns.rdataset.from_rdata(rdataset.ttl, rdata) - self.replace(name, new_rdataset) - - def __iter__(self): - self._check_ended() - return self._iterate_rdatasets() - - def changed(self) -> bool: - """Has this transaction changed anything? - - For read-only transactions, the result is always `False`. - - For writable transactions, the result is `True` if at some time - during the life of the transaction, the content was changed. - """ - self._check_ended() - return self._changed() - - def commit(self) -> None: - """Commit the transaction. - - Normally transactions are used as context managers and commit - or rollback automatically, but it may be done explicitly if needed. - A ``dns.transaction.Ended`` exception will be raised if you try - to use a transaction after it has been committed or rolled back. - - Raises an exception if the commit fails (in which case the transaction - is also rolled back. - """ - self._end(True) - - def rollback(self) -> None: - """Rollback the transaction. - - Normally transactions are used as context managers and commit - or rollback automatically, but it may be done explicitly if needed. - A ``dns.transaction.AlreadyEnded`` exception will be raised if you try - to use a transaction after it has been committed or rolled back. - - Rollback cannot otherwise fail. - """ - self._end(False) - - def check_put_rdataset(self, check: CheckPutRdatasetType) -> None: - """Call *check* before putting (storing) an rdataset. - - The function is called with the transaction, the name, and the rdataset. - - The check function may safely make non-mutating transaction method - calls, but behavior is undefined if mutating transaction methods are - called. The check function should raise an exception if it objects to - the put, and otherwise should return ``None``. - """ - self._check_put_rdataset.append(check) - - def check_delete_rdataset(self, check: CheckDeleteRdatasetType) -> None: - """Call *check* before deleting an rdataset. - - The function is called with the transaction, the name, the rdatatype, - and the covered rdatatype. - - The check function may safely make non-mutating transaction method - calls, but behavior is undefined if mutating transaction methods are - called. The check function should raise an exception if it objects to - the put, and otherwise should return ``None``. - """ - self._check_delete_rdataset.append(check) - - def check_delete_name(self, check: CheckDeleteNameType) -> None: - """Call *check* before putting (storing) an rdataset. - - The function is called with the transaction and the name. - - The check function may safely make non-mutating transaction method - calls, but behavior is undefined if mutating transaction methods are - called. The check function should raise an exception if it objects to - the put, and otherwise should return ``None``. - """ - self._check_delete_name.append(check) - - def iterate_rdatasets( - self, - ) -> Iterator[Tuple[dns.name.Name, dns.rdataset.Rdataset]]: - """Iterate all the rdatasets in the transaction, returning - (`dns.name.Name`, `dns.rdataset.Rdataset`) tuples. - - Note that as is usual with python iterators, adding or removing items - while iterating will invalidate the iterator and may raise `RuntimeError` - or fail to iterate over all entries.""" - self._check_ended() - return self._iterate_rdatasets() - - def iterate_names(self) -> Iterator[dns.name.Name]: - """Iterate all the names in the transaction. - - Note that as is usual with python iterators, adding or removing names - while iterating will invalidate the iterator and may raise `RuntimeError` - or fail to iterate over all entries.""" - self._check_ended() - return self._iterate_names() - - # - # Helper methods - # - - def _raise_if_not_empty(self, method, args): - if len(args) != 0: - raise TypeError(f"extra parameters to {method}") - - def _rdataset_from_args(self, method, deleting, args): - try: - arg = args.popleft() - if isinstance(arg, dns.rrset.RRset): - rdataset = arg.to_rdataset() - elif isinstance(arg, dns.rdataset.Rdataset): - rdataset = arg - else: - if deleting: - ttl = 0 - else: - if isinstance(arg, int): - ttl = arg - if ttl > dns.ttl.MAX_TTL: - raise ValueError(f"{method}: TTL value too big") - else: - raise TypeError(f"{method}: expected a TTL") - arg = args.popleft() - if isinstance(arg, dns.rdata.Rdata): - rdataset = dns.rdataset.from_rdata(ttl, arg) - else: - raise TypeError(f"{method}: expected an Rdata") - return rdataset - except IndexError: - if deleting: - return None - else: - # reraise - raise TypeError(f"{method}: expected more arguments") - - def _add(self, replace, args): - try: - args = collections.deque(args) - if replace: - method = "replace()" - else: - method = "add()" - arg = args.popleft() - if isinstance(arg, str): - arg = dns.name.from_text(arg, None) - if isinstance(arg, dns.name.Name): - name = arg - rdataset = self._rdataset_from_args(method, False, args) - elif isinstance(arg, dns.rrset.RRset): - rrset = arg - name = rrset.name - # rrsets are also rdatasets, but they don't print the - # same and can't be stored in nodes, so convert. - rdataset = rrset.to_rdataset() - else: - raise TypeError( - f"{method} requires a name or RRset as the first argument" - ) - if rdataset.rdclass != self.manager.get_class(): - raise ValueError(f"{method} has objects of wrong RdataClass") - if rdataset.rdtype == dns.rdatatype.SOA: - (_, _, origin) = self._origin_information() - if name != origin: - raise ValueError(f"{method} has non-origin SOA") - self._raise_if_not_empty(method, args) - if not replace: - existing = self._get_rdataset(name, rdataset.rdtype, rdataset.covers) - if existing is not None: - if isinstance(existing, dns.rdataset.ImmutableRdataset): - trds = dns.rdataset.Rdataset( - existing.rdclass, existing.rdtype, existing.covers - ) - trds.update(existing) - existing = trds - rdataset = existing.union(rdataset) - self._checked_put_rdataset(name, rdataset) - except IndexError: - raise TypeError(f"not enough parameters to {method}") - - def _delete(self, exact, args): - try: - args = collections.deque(args) - if exact: - method = "delete_exact()" - else: - method = "delete()" - arg = args.popleft() - if isinstance(arg, str): - arg = dns.name.from_text(arg, None) - if isinstance(arg, dns.name.Name): - name = arg - if len(args) > 0 and ( - isinstance(args[0], int) or isinstance(args[0], str) - ): - # deleting by type and (optionally) covers - rdtype = dns.rdatatype.RdataType.make(args.popleft()) - if len(args) > 0: - covers = dns.rdatatype.RdataType.make(args.popleft()) - else: - covers = dns.rdatatype.NONE - self._raise_if_not_empty(method, args) - existing = self._get_rdataset(name, rdtype, covers) - if existing is None: - if exact: - raise DeleteNotExact(f"{method}: missing rdataset") - else: - self._checked_delete_rdataset(name, rdtype, covers) - return - else: - rdataset = self._rdataset_from_args(method, True, args) - elif isinstance(arg, dns.rrset.RRset): - rdataset = arg # rrsets are also rdatasets - name = rdataset.name - else: - raise TypeError( - f"{method} requires a name or RRset as the first argument" - ) - self._raise_if_not_empty(method, args) - if rdataset: - if rdataset.rdclass != self.manager.get_class(): - raise ValueError(f"{method} has objects of wrong RdataClass") - existing = self._get_rdataset(name, rdataset.rdtype, rdataset.covers) - if existing is not None: - if exact: - intersection = existing.intersection(rdataset) - if intersection != rdataset: - raise DeleteNotExact(f"{method}: missing rdatas") - rdataset = existing.difference(rdataset) - if len(rdataset) == 0: - self._checked_delete_rdataset( - name, rdataset.rdtype, rdataset.covers - ) - else: - self._checked_put_rdataset(name, rdataset) - elif exact: - raise DeleteNotExact(f"{method}: missing rdataset") - else: - if exact and not self._name_exists(name): - raise DeleteNotExact(f"{method}: name not known") - self._checked_delete_name(name) - except IndexError: - raise TypeError(f"not enough parameters to {method}") - - def _check_ended(self): - if self._ended: - raise AlreadyEnded - - def _end(self, commit): - self._check_ended() - try: - self._end_transaction(commit) - finally: - self._ended = True - - def _checked_put_rdataset(self, name, rdataset): - for check in self._check_put_rdataset: - check(self, name, rdataset) - self._put_rdataset(name, rdataset) - - def _checked_delete_rdataset(self, name, rdtype, covers): - for check in self._check_delete_rdataset: - check(self, name, rdtype, covers) - self._delete_rdataset(name, rdtype, covers) - - def _checked_delete_name(self, name): - for check in self._check_delete_name: - check(self, name) - self._delete_name(name) - - # - # Transactions are context managers. - # - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - if not self._ended: - if exc_type is None: - self.commit() - else: - self.rollback() - return False - - # - # This is the low level API, which must be implemented by subclasses - # of Transaction. - # - - def _get_rdataset(self, name, rdtype, covers): - """Return the rdataset associated with *name*, *rdtype*, and *covers*, - or `None` if not found. - """ - raise NotImplementedError # pragma: no cover - - def _put_rdataset(self, name, rdataset): - """Store the rdataset.""" - raise NotImplementedError # pragma: no cover - - def _delete_name(self, name): - """Delete all data associated with *name*. - - It is not an error if the name does not exist. - """ - raise NotImplementedError # pragma: no cover - - def _delete_rdataset(self, name, rdtype, covers): - """Delete all data associated with *name*, *rdtype*, and *covers*. - - It is not an error if the rdataset does not exist. - """ - raise NotImplementedError # pragma: no cover - - def _name_exists(self, name): - """Does name exist? - - Returns a bool. - """ - raise NotImplementedError # pragma: no cover - - def _changed(self): - """Has this transaction changed anything?""" - raise NotImplementedError # pragma: no cover - - def _end_transaction(self, commit): - """End the transaction. - - *commit*, a bool. If ``True``, commit the transaction, otherwise - roll it back. - - If committing and the commit fails, then roll back and raise an - exception. - """ - raise NotImplementedError # pragma: no cover - - def _set_origin(self, origin): - """Set the origin. - - This method is called when reading a possibly relativized - source, and an origin setting operation occurs (e.g. $ORIGIN - in a zone file). - """ - raise NotImplementedError # pragma: no cover - - def _iterate_rdatasets(self): - """Return an iterator that yields (name, rdataset) tuples.""" - raise NotImplementedError # pragma: no cover - - def _iterate_names(self): - """Return an iterator that yields a name.""" - raise NotImplementedError # pragma: no cover - - def _get_node(self, name): - """Return the node at *name*, if any. - - Returns a node or ``None``. - """ - raise NotImplementedError # pragma: no cover - - # - # Low-level API with a default implementation, in case a subclass needs - # to override. - # - - def _origin_information(self): - # This is only used by _add() - return self.manager.origin_information() diff --git a/write-message/venv/lib/python3.10/site-packages/dns/tsig.py b/write-message/venv/lib/python3.10/site-packages/dns/tsig.py deleted file mode 100644 index 780852e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/tsig.py +++ /dev/null @@ -1,352 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS TSIG support.""" - -import base64 -import hashlib -import hmac -import struct - -import dns.exception -import dns.name -import dns.rcode -import dns.rdataclass - - -class BadTime(dns.exception.DNSException): - """The current time is not within the TSIG's validity time.""" - - -class BadSignature(dns.exception.DNSException): - """The TSIG signature fails to verify.""" - - -class BadKey(dns.exception.DNSException): - """The TSIG record owner name does not match the key.""" - - -class BadAlgorithm(dns.exception.DNSException): - """The TSIG algorithm does not match the key.""" - - -class PeerError(dns.exception.DNSException): - """Base class for all TSIG errors generated by the remote peer""" - - -class PeerBadKey(PeerError): - """The peer didn't know the key we used""" - - -class PeerBadSignature(PeerError): - """The peer didn't like the signature we sent""" - - -class PeerBadTime(PeerError): - """The peer didn't like the time we sent""" - - -class PeerBadTruncation(PeerError): - """The peer didn't like amount of truncation in the TSIG we sent""" - - -# TSIG Algorithms - -HMAC_MD5 = dns.name.from_text("HMAC-MD5.SIG-ALG.REG.INT") -HMAC_SHA1 = dns.name.from_text("hmac-sha1") -HMAC_SHA224 = dns.name.from_text("hmac-sha224") -HMAC_SHA256 = dns.name.from_text("hmac-sha256") -HMAC_SHA256_128 = dns.name.from_text("hmac-sha256-128") -HMAC_SHA384 = dns.name.from_text("hmac-sha384") -HMAC_SHA384_192 = dns.name.from_text("hmac-sha384-192") -HMAC_SHA512 = dns.name.from_text("hmac-sha512") -HMAC_SHA512_256 = dns.name.from_text("hmac-sha512-256") -GSS_TSIG = dns.name.from_text("gss-tsig") - -default_algorithm = HMAC_SHA256 - -mac_sizes = { - HMAC_SHA1: 20, - HMAC_SHA224: 28, - HMAC_SHA256: 32, - HMAC_SHA256_128: 16, - HMAC_SHA384: 48, - HMAC_SHA384_192: 24, - HMAC_SHA512: 64, - HMAC_SHA512_256: 32, - HMAC_MD5: 16, - GSS_TSIG: 128, # This is what we assume to be the worst case! -} - - -class GSSTSig: - """ - GSS-TSIG TSIG implementation. This uses the GSS-API context established - in the TKEY message handshake to sign messages using GSS-API message - integrity codes, per the RFC. - - In order to avoid a direct GSSAPI dependency, the keyring holds a ref - to the GSSAPI object required, rather than the key itself. - """ - - def __init__(self, gssapi_context): - self.gssapi_context = gssapi_context - self.data = b"" - self.name = "gss-tsig" - - def update(self, data): - self.data += data - - def sign(self): - # defer to the GSSAPI function to sign - return self.gssapi_context.get_signature(self.data) - - def verify(self, expected): - try: - # defer to the GSSAPI function to verify - return self.gssapi_context.verify_signature(self.data, expected) - except Exception: - # note the usage of a bare exception - raise BadSignature - - -class GSSTSigAdapter: - def __init__(self, keyring): - self.keyring = keyring - - def __call__(self, message, keyname): - if keyname in self.keyring: - key = self.keyring[keyname] - if isinstance(key, Key) and key.algorithm == GSS_TSIG: - if message: - GSSTSigAdapter.parse_tkey_and_step(key, message, keyname) - return key - else: - return None - - @classmethod - def parse_tkey_and_step(cls, key, message, keyname): - # if the message is a TKEY type, absorb the key material - # into the context using step(); this is used to allow the - # client to complete the GSSAPI negotiation before attempting - # to verify the signed response to a TKEY message exchange - try: - rrset = message.find_rrset( - message.answer, keyname, dns.rdataclass.ANY, dns.rdatatype.TKEY - ) - if rrset: - token = rrset[0].key - gssapi_context = key.secret - return gssapi_context.step(token) - except KeyError: - pass - - -class HMACTSig: - """ - HMAC TSIG implementation. This uses the HMAC python module to handle the - sign/verify operations. - """ - - _hashes = { - HMAC_SHA1: hashlib.sha1, - HMAC_SHA224: hashlib.sha224, - HMAC_SHA256: hashlib.sha256, - HMAC_SHA256_128: (hashlib.sha256, 128), - HMAC_SHA384: hashlib.sha384, - HMAC_SHA384_192: (hashlib.sha384, 192), - HMAC_SHA512: hashlib.sha512, - HMAC_SHA512_256: (hashlib.sha512, 256), - HMAC_MD5: hashlib.md5, - } - - def __init__(self, key, algorithm): - try: - hashinfo = self._hashes[algorithm] - except KeyError: - raise NotImplementedError(f"TSIG algorithm {algorithm} is not supported") - - # create the HMAC context - if isinstance(hashinfo, tuple): - self.hmac_context = hmac.new(key, digestmod=hashinfo[0]) - self.size = hashinfo[1] - else: - self.hmac_context = hmac.new(key, digestmod=hashinfo) - self.size = None - self.name = self.hmac_context.name - if self.size: - self.name += f"-{self.size}" - - def update(self, data): - return self.hmac_context.update(data) - - def sign(self): - # defer to the HMAC digest() function for that digestmod - digest = self.hmac_context.digest() - if self.size: - digest = digest[: (self.size // 8)] - return digest - - def verify(self, expected): - # re-digest and compare the results - mac = self.sign() - if not hmac.compare_digest(mac, expected): - raise BadSignature - - -def _digest(wire, key, rdata, time=None, request_mac=None, ctx=None, multi=None): - """Return a context containing the TSIG rdata for the input parameters - @rtype: dns.tsig.HMACTSig or dns.tsig.GSSTSig object - @raises ValueError: I{other_data} is too long - @raises NotImplementedError: I{algorithm} is not supported - """ - - first = not (ctx and multi) - if first: - ctx = get_context(key) - if request_mac: - ctx.update(struct.pack("!H", len(request_mac))) - ctx.update(request_mac) - ctx.update(struct.pack("!H", rdata.original_id)) - ctx.update(wire[2:]) - if first: - ctx.update(key.name.to_digestable()) - ctx.update(struct.pack("!H", dns.rdataclass.ANY)) - ctx.update(struct.pack("!I", 0)) - if time is None: - time = rdata.time_signed - upper_time = (time >> 32) & 0xFFFF - lower_time = time & 0xFFFFFFFF - time_encoded = struct.pack("!HIH", upper_time, lower_time, rdata.fudge) - other_len = len(rdata.other) - if other_len > 65535: - raise ValueError("TSIG Other Data is > 65535 bytes") - if first: - ctx.update(key.algorithm.to_digestable() + time_encoded) - ctx.update(struct.pack("!HH", rdata.error, other_len) + rdata.other) - else: - ctx.update(time_encoded) - return ctx - - -def _maybe_start_digest(key, mac, multi): - """If this is the first message in a multi-message sequence, - start a new context. - @rtype: dns.tsig.HMACTSig or dns.tsig.GSSTSig object - """ - if multi: - ctx = get_context(key) - ctx.update(struct.pack("!H", len(mac))) - ctx.update(mac) - return ctx - else: - return None - - -def sign(wire, key, rdata, time=None, request_mac=None, ctx=None, multi=False): - """Return a (tsig_rdata, mac, ctx) tuple containing the HMAC TSIG rdata - for the input parameters, the HMAC MAC calculated by applying the - TSIG signature algorithm, and the TSIG digest context. - @rtype: (string, dns.tsig.HMACTSig or dns.tsig.GSSTSig object) - @raises ValueError: I{other_data} is too long - @raises NotImplementedError: I{algorithm} is not supported - """ - - ctx = _digest(wire, key, rdata, time, request_mac, ctx, multi) - mac = ctx.sign() - tsig = rdata.replace(time_signed=time, mac=mac) - - return (tsig, _maybe_start_digest(key, mac, multi)) - - -def validate( - wire, key, owner, rdata, now, request_mac, tsig_start, ctx=None, multi=False -): - """Validate the specified TSIG rdata against the other input parameters. - - @raises FormError: The TSIG is badly formed. - @raises BadTime: There is too much time skew between the client and the - server. - @raises BadSignature: The TSIG signature did not validate - @rtype: dns.tsig.HMACTSig or dns.tsig.GSSTSig object""" - - (adcount,) = struct.unpack("!H", wire[10:12]) - if adcount == 0: - raise dns.exception.FormError - adcount -= 1 - new_wire = wire[0:10] + struct.pack("!H", adcount) + wire[12:tsig_start] - if rdata.error != 0: - if rdata.error == dns.rcode.BADSIG: - raise PeerBadSignature - elif rdata.error == dns.rcode.BADKEY: - raise PeerBadKey - elif rdata.error == dns.rcode.BADTIME: - raise PeerBadTime - elif rdata.error == dns.rcode.BADTRUNC: - raise PeerBadTruncation - else: - raise PeerError("unknown TSIG error code %d" % rdata.error) - if abs(rdata.time_signed - now) > rdata.fudge: - raise BadTime - if key.name != owner: - raise BadKey - if key.algorithm != rdata.algorithm: - raise BadAlgorithm - ctx = _digest(new_wire, key, rdata, None, request_mac, ctx, multi) - ctx.verify(rdata.mac) - return _maybe_start_digest(key, rdata.mac, multi) - - -def get_context(key): - """Returns an HMAC context for the specified key. - - @rtype: HMAC context - @raises NotImplementedError: I{algorithm} is not supported - """ - - if key.algorithm == GSS_TSIG: - return GSSTSig(key.secret) - else: - return HMACTSig(key.secret, key.algorithm) - - -class Key: - def __init__(self, name, secret, algorithm=default_algorithm): - if isinstance(name, str): - name = dns.name.from_text(name) - self.name = name - if isinstance(secret, str): - secret = base64.decodebytes(secret.encode()) - self.secret = secret - if isinstance(algorithm, str): - algorithm = dns.name.from_text(algorithm) - self.algorithm = algorithm - - def __eq__(self, other): - return ( - isinstance(other, Key) - and self.name == other.name - and self.secret == other.secret - and self.algorithm == other.algorithm - ) - - def __repr__(self): - r = f" Dict[dns.name.Name, dns.tsig.Key]: - """Convert a dictionary containing (textual DNS name, base64 secret) - pairs into a binary keyring which has (dns.name.Name, bytes) pairs, or - a dictionary containing (textual DNS name, (algorithm, base64 secret)) - pairs into a binary keyring which has (dns.name.Name, dns.tsig.Key) pairs. - @rtype: dict""" - - keyring = {} - for name, value in textring.items(): - kname = dns.name.from_text(name) - if isinstance(value, str): - keyring[kname] = dns.tsig.Key(kname, value).secret - else: - (algorithm, secret) = value - keyring[kname] = dns.tsig.Key(kname, secret, algorithm) - return keyring - - -def to_text(keyring: Dict[dns.name.Name, Any]) -> Dict[str, Any]: - """Convert a dictionary containing (dns.name.Name, dns.tsig.Key) pairs - into a text keyring which has (textual DNS name, (textual algorithm, - base64 secret)) pairs, or a dictionary containing (dns.name.Name, bytes) - pairs into a text keyring which has (textual DNS name, base64 secret) pairs. - @rtype: dict""" - - textring = {} - - def b64encode(secret): - return base64.encodebytes(secret).decode().rstrip() - - for name, key in keyring.items(): - tname = name.to_text() - if isinstance(key, bytes): - textring[tname] = b64encode(key) - else: - if isinstance(key.secret, bytes): - text_secret = b64encode(key.secret) - else: - text_secret = str(key.secret) - - textring[tname] = (key.algorithm.to_text(), text_secret) - return textring diff --git a/write-message/venv/lib/python3.10/site-packages/dns/ttl.py b/write-message/venv/lib/python3.10/site-packages/dns/ttl.py deleted file mode 100644 index b9a99fe..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/ttl.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS TTL conversion.""" - -from typing import Union - -import dns.exception - -# Technically TTLs are supposed to be between 0 and 2**31 - 1, with values -# greater than that interpreted as 0, but we do not impose this policy here -# as values > 2**31 - 1 occur in real world data. -# -# We leave it to applications to impose tighter bounds if desired. -MAX_TTL = 2**32 - 1 - - -class BadTTL(dns.exception.SyntaxError): - """DNS TTL value is not well-formed.""" - - -def from_text(text: str) -> int: - """Convert the text form of a TTL to an integer. - - The BIND 8 units syntax for TTLs (e.g. '1w6d4h3m10s') is supported. - - *text*, a ``str``, the textual TTL. - - Raises ``dns.ttl.BadTTL`` if the TTL is not well-formed. - - Returns an ``int``. - """ - - if text.isdigit(): - total = int(text) - elif len(text) == 0: - raise BadTTL - else: - total = 0 - current = 0 - need_digit = True - for c in text: - if c.isdigit(): - current *= 10 - current += int(c) - need_digit = False - else: - if need_digit: - raise BadTTL - c = c.lower() - if c == "w": - total += current * 604800 - elif c == "d": - total += current * 86400 - elif c == "h": - total += current * 3600 - elif c == "m": - total += current * 60 - elif c == "s": - total += current - else: - raise BadTTL(f"unknown unit '{c}'") - current = 0 - need_digit = True - if not current == 0: - raise BadTTL("trailing integer") - if total < 0 or total > MAX_TTL: - raise BadTTL("TTL should be between 0 and 2**32 - 1 (inclusive)") - return total - - -def make(value: Union[int, str]) -> int: - if isinstance(value, int): - return value - elif isinstance(value, str): - return dns.ttl.from_text(value) - else: - raise ValueError("cannot convert value to TTL") diff --git a/write-message/venv/lib/python3.10/site-packages/dns/update.py b/write-message/venv/lib/python3.10/site-packages/dns/update.py deleted file mode 100644 index bf1157a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/update.py +++ /dev/null @@ -1,386 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Dynamic Update Support""" - -from typing import Any, List, Optional, Union - -import dns.message -import dns.name -import dns.opcode -import dns.rdata -import dns.rdataclass -import dns.rdataset -import dns.rdatatype -import dns.tsig - - -class UpdateSection(dns.enum.IntEnum): - """Update sections""" - - ZONE = 0 - PREREQ = 1 - UPDATE = 2 - ADDITIONAL = 3 - - @classmethod - def _maximum(cls): - return 3 - - -class UpdateMessage(dns.message.Message): # lgtm[py/missing-equals] - # ignore the mypy error here as we mean to use a different enum - _section_enum = UpdateSection # type: ignore - - def __init__( - self, - zone: Optional[Union[dns.name.Name, str]] = None, - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - keyring: Optional[Any] = None, - keyname: Optional[dns.name.Name] = None, - keyalgorithm: Union[dns.name.Name, str] = dns.tsig.default_algorithm, - id: Optional[int] = None, - ): - """Initialize a new DNS Update object. - - See the documentation of the Message class for a complete - description of the keyring dictionary. - - *zone*, a ``dns.name.Name``, ``str``, or ``None``, the zone - which is being updated. ``None`` should only be used by dnspython's - message constructors, as a zone is required for the convenience - methods like ``add()``, ``replace()``, etc. - - *rdclass*, an ``int`` or ``str``, the class of the zone. - - The *keyring*, *keyname*, and *keyalgorithm* parameters are passed to - ``use_tsig()``; see its documentation for details. - """ - super().__init__(id=id) - self.flags |= dns.opcode.to_flags(dns.opcode.UPDATE) - if isinstance(zone, str): - zone = dns.name.from_text(zone) - self.origin = zone - rdclass = dns.rdataclass.RdataClass.make(rdclass) - self.zone_rdclass = rdclass - if self.origin: - self.find_rrset( - self.zone, - self.origin, - rdclass, - dns.rdatatype.SOA, - create=True, - force_unique=True, - ) - if keyring is not None: - self.use_tsig(keyring, keyname, algorithm=keyalgorithm) - - @property - def zone(self) -> List[dns.rrset.RRset]: - """The zone section.""" - return self.sections[0] - - @zone.setter - def zone(self, v): - self.sections[0] = v - - @property - def prerequisite(self) -> List[dns.rrset.RRset]: - """The prerequisite section.""" - return self.sections[1] - - @prerequisite.setter - def prerequisite(self, v): - self.sections[1] = v - - @property - def update(self) -> List[dns.rrset.RRset]: - """The update section.""" - return self.sections[2] - - @update.setter - def update(self, v): - self.sections[2] = v - - def _add_rr(self, name, ttl, rd, deleting=None, section=None): - """Add a single RR to the update section.""" - - if section is None: - section = self.update - covers = rd.covers() - rrset = self.find_rrset( - section, name, self.zone_rdclass, rd.rdtype, covers, deleting, True, True - ) - rrset.add(rd, ttl) - - def _add(self, replace, section, name, *args): - """Add records. - - *replace* is the replacement mode. If ``False``, - RRs are added to an existing RRset; if ``True``, the RRset - is replaced with the specified contents. The second - argument is the section to add to. The third argument - is always a name. The other arguments can be: - - - rdataset... - - - ttl, rdata... - - - ttl, rdtype, string... - """ - - if isinstance(name, str): - name = dns.name.from_text(name, None) - if isinstance(args[0], dns.rdataset.Rdataset): - for rds in args: - if replace: - self.delete(name, rds.rdtype) - for rd in rds: - self._add_rr(name, rds.ttl, rd, section=section) - else: - args = list(args) - ttl = int(args.pop(0)) - if isinstance(args[0], dns.rdata.Rdata): - if replace: - self.delete(name, args[0].rdtype) - for rd in args: - self._add_rr(name, ttl, rd, section=section) - else: - rdtype = dns.rdatatype.RdataType.make(args.pop(0)) - if replace: - self.delete(name, rdtype) - for s in args: - rd = dns.rdata.from_text(self.zone_rdclass, rdtype, s, self.origin) - self._add_rr(name, ttl, rd, section=section) - - def add(self, name: Union[dns.name.Name, str], *args: Any) -> None: - """Add records. - - The first argument is always a name. The other - arguments can be: - - - rdataset... - - - ttl, rdata... - - - ttl, rdtype, string... - """ - - self._add(False, self.update, name, *args) - - def delete(self, name: Union[dns.name.Name, str], *args: Any) -> None: - """Delete records. - - The first argument is always a name. The other - arguments can be: - - - *empty* - - - rdataset... - - - rdata... - - - rdtype, [string...] - """ - - if isinstance(name, str): - name = dns.name.from_text(name, None) - if len(args) == 0: - self.find_rrset( - self.update, - name, - dns.rdataclass.ANY, - dns.rdatatype.ANY, - dns.rdatatype.NONE, - dns.rdataclass.ANY, - True, - True, - ) - elif isinstance(args[0], dns.rdataset.Rdataset): - for rds in args: - for rd in rds: - self._add_rr(name, 0, rd, dns.rdataclass.NONE) - else: - largs = list(args) - if isinstance(largs[0], dns.rdata.Rdata): - for rd in largs: - self._add_rr(name, 0, rd, dns.rdataclass.NONE) - else: - rdtype = dns.rdatatype.RdataType.make(largs.pop(0)) - if len(largs) == 0: - self.find_rrset( - self.update, - name, - self.zone_rdclass, - rdtype, - dns.rdatatype.NONE, - dns.rdataclass.ANY, - True, - True, - ) - else: - for s in largs: - rd = dns.rdata.from_text( - self.zone_rdclass, - rdtype, - s, # type: ignore[arg-type] - self.origin, - ) - self._add_rr(name, 0, rd, dns.rdataclass.NONE) - - def replace(self, name: Union[dns.name.Name, str], *args: Any) -> None: - """Replace records. - - The first argument is always a name. The other - arguments can be: - - - rdataset... - - - ttl, rdata... - - - ttl, rdtype, string... - - Note that if you want to replace the entire node, you should do - a delete of the name followed by one or more calls to add. - """ - - self._add(True, self.update, name, *args) - - def present(self, name: Union[dns.name.Name, str], *args: Any) -> None: - """Require that an owner name (and optionally an rdata type, - or specific rdataset) exists as a prerequisite to the - execution of the update. - - The first argument is always a name. - The other arguments can be: - - - rdataset... - - - rdata... - - - rdtype, string... - """ - - if isinstance(name, str): - name = dns.name.from_text(name, None) - if len(args) == 0: - self.find_rrset( - self.prerequisite, - name, - dns.rdataclass.ANY, - dns.rdatatype.ANY, - dns.rdatatype.NONE, - None, - True, - True, - ) - elif ( - isinstance(args[0], dns.rdataset.Rdataset) - or isinstance(args[0], dns.rdata.Rdata) - or len(args) > 1 - ): - if not isinstance(args[0], dns.rdataset.Rdataset): - # Add a 0 TTL - largs = list(args) - largs.insert(0, 0) # type: ignore[arg-type] - self._add(False, self.prerequisite, name, *largs) - else: - self._add(False, self.prerequisite, name, *args) - else: - rdtype = dns.rdatatype.RdataType.make(args[0]) - self.find_rrset( - self.prerequisite, - name, - dns.rdataclass.ANY, - rdtype, - dns.rdatatype.NONE, - None, - True, - True, - ) - - def absent( - self, - name: Union[dns.name.Name, str], - rdtype: Optional[Union[dns.rdatatype.RdataType, str]] = None, - ) -> None: - """Require that an owner name (and optionally an rdata type) does - not exist as a prerequisite to the execution of the update.""" - - if isinstance(name, str): - name = dns.name.from_text(name, None) - if rdtype is None: - self.find_rrset( - self.prerequisite, - name, - dns.rdataclass.NONE, - dns.rdatatype.ANY, - dns.rdatatype.NONE, - None, - True, - True, - ) - else: - rdtype = dns.rdatatype.RdataType.make(rdtype) - self.find_rrset( - self.prerequisite, - name, - dns.rdataclass.NONE, - rdtype, - dns.rdatatype.NONE, - None, - True, - True, - ) - - def _get_one_rr_per_rrset(self, value): - # Updates are always one_rr_per_rrset - return True - - def _parse_rr_header(self, section, name, rdclass, rdtype): - deleting = None - empty = False - if section == UpdateSection.ZONE: - if ( - dns.rdataclass.is_metaclass(rdclass) - or rdtype != dns.rdatatype.SOA - or self.zone - ): - raise dns.exception.FormError - else: - if not self.zone: - raise dns.exception.FormError - if rdclass in (dns.rdataclass.ANY, dns.rdataclass.NONE): - deleting = rdclass - rdclass = self.zone[0].rdclass - empty = ( - deleting == dns.rdataclass.ANY or section == UpdateSection.PREREQ - ) - return (rdclass, rdtype, deleting, empty) - - -# backwards compatibility -Update = UpdateMessage - -### BEGIN generated UpdateSection constants - -ZONE = UpdateSection.ZONE -PREREQ = UpdateSection.PREREQ -UPDATE = UpdateSection.UPDATE -ADDITIONAL = UpdateSection.ADDITIONAL - -### END generated UpdateSection constants diff --git a/write-message/venv/lib/python3.10/site-packages/dns/version.py b/write-message/venv/lib/python3.10/site-packages/dns/version.py deleted file mode 100644 index 9ed2ce1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/version.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""dnspython release version information.""" - -#: MAJOR -MAJOR = 2 -#: MINOR -MINOR = 7 -#: MICRO -MICRO = 0 -#: RELEASELEVEL -RELEASELEVEL = 0x0F -#: SERIAL -SERIAL = 0 - -if RELEASELEVEL == 0x0F: # pragma: no cover lgtm[py/unreachable-statement] - #: version - version = "%d.%d.%d" % (MAJOR, MINOR, MICRO) # lgtm[py/unreachable-statement] -elif RELEASELEVEL == 0x00: # pragma: no cover lgtm[py/unreachable-statement] - version = "%d.%d.%ddev%d" % ( - MAJOR, - MINOR, - MICRO, - SERIAL, - ) # lgtm[py/unreachable-statement] -elif RELEASELEVEL == 0x0C: # pragma: no cover lgtm[py/unreachable-statement] - version = "%d.%d.%drc%d" % ( - MAJOR, - MINOR, - MICRO, - SERIAL, - ) # lgtm[py/unreachable-statement] -else: # pragma: no cover lgtm[py/unreachable-statement] - version = "%d.%d.%d%x%d" % ( - MAJOR, - MINOR, - MICRO, - RELEASELEVEL, - SERIAL, - ) # lgtm[py/unreachable-statement] - -#: hexversion -hexversion = MAJOR << 24 | MINOR << 16 | MICRO << 8 | RELEASELEVEL << 4 | SERIAL diff --git a/write-message/venv/lib/python3.10/site-packages/dns/versioned.py b/write-message/venv/lib/python3.10/site-packages/dns/versioned.py deleted file mode 100644 index fd78e67..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/versioned.py +++ /dev/null @@ -1,318 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -"""DNS Versioned Zones.""" - -import collections -import threading -from typing import Callable, Deque, Optional, Set, Union - -import dns.exception -import dns.immutable -import dns.name -import dns.node -import dns.rdataclass -import dns.rdataset -import dns.rdatatype -import dns.rdtypes.ANY.SOA -import dns.zone - - -class UseTransaction(dns.exception.DNSException): - """To alter a versioned zone, use a transaction.""" - - -# Backwards compatibility -Node = dns.zone.VersionedNode -ImmutableNode = dns.zone.ImmutableVersionedNode -Version = dns.zone.Version -WritableVersion = dns.zone.WritableVersion -ImmutableVersion = dns.zone.ImmutableVersion -Transaction = dns.zone.Transaction - - -class Zone(dns.zone.Zone): # lgtm[py/missing-equals] - __slots__ = [ - "_versions", - "_versions_lock", - "_write_txn", - "_write_waiters", - "_write_event", - "_pruning_policy", - "_readers", - ] - - node_factory = Node - - def __init__( - self, - origin: Optional[Union[dns.name.Name, str]], - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - relativize: bool = True, - pruning_policy: Optional[Callable[["Zone", Version], Optional[bool]]] = None, - ): - """Initialize a versioned zone object. - - *origin* is the origin of the zone. It may be a ``dns.name.Name``, - a ``str``, or ``None``. If ``None``, then the zone's origin will - be set by the first ``$ORIGIN`` line in a zone file. - - *rdclass*, an ``int``, the zone's rdata class; the default is class IN. - - *relativize*, a ``bool``, determine's whether domain names are - relativized to the zone's origin. The default is ``True``. - - *pruning policy*, a function taking a ``Zone`` and a ``Version`` and returning - a ``bool``, or ``None``. Should the version be pruned? If ``None``, - the default policy, which retains one version is used. - """ - super().__init__(origin, rdclass, relativize) - self._versions: Deque[Version] = collections.deque() - self._version_lock = threading.Lock() - if pruning_policy is None: - self._pruning_policy = self._default_pruning_policy - else: - self._pruning_policy = pruning_policy - self._write_txn: Optional[Transaction] = None - self._write_event: Optional[threading.Event] = None - self._write_waiters: Deque[threading.Event] = collections.deque() - self._readers: Set[Transaction] = set() - self._commit_version_unlocked( - None, WritableVersion(self, replacement=True), origin - ) - - def reader( - self, id: Optional[int] = None, serial: Optional[int] = None - ) -> Transaction: # pylint: disable=arguments-differ - if id is not None and serial is not None: - raise ValueError("cannot specify both id and serial") - with self._version_lock: - if id is not None: - version = None - for v in reversed(self._versions): - if v.id == id: - version = v - break - if version is None: - raise KeyError("version not found") - elif serial is not None: - if self.relativize: - oname = dns.name.empty - else: - assert self.origin is not None - oname = self.origin - version = None - for v in reversed(self._versions): - n = v.nodes.get(oname) - if n: - rds = n.get_rdataset(self.rdclass, dns.rdatatype.SOA) - if rds and rds[0].serial == serial: - version = v - break - if version is None: - raise KeyError("serial not found") - else: - version = self._versions[-1] - txn = Transaction(self, False, version) - self._readers.add(txn) - return txn - - def writer(self, replacement: bool = False) -> Transaction: - event = None - while True: - with self._version_lock: - # Checking event == self._write_event ensures that either - # no one was waiting before we got lucky and found no write - # txn, or we were the one who was waiting and got woken up. - # This prevents "taking cuts" when creating a write txn. - if self._write_txn is None and event == self._write_event: - # Creating the transaction defers version setup - # (i.e. copying the nodes dictionary) until we - # give up the lock, so that we hold the lock as - # short a time as possible. This is why we call - # _setup_version() below. - self._write_txn = Transaction( - self, replacement, make_immutable=True - ) - # give up our exclusive right to make a Transaction - self._write_event = None - break - # Someone else is writing already, so we will have to - # wait, but we want to do the actual wait outside the - # lock. - event = threading.Event() - self._write_waiters.append(event) - # wait (note we gave up the lock!) - # - # We only wake one sleeper at a time, so it's important - # that no event waiter can exit this method (e.g. via - # cancellation) without returning a transaction or waking - # someone else up. - # - # This is not a problem with Threading module threads as - # they cannot be canceled, but could be an issue with trio - # tasks when we do the async version of writer(). - # I.e. we'd need to do something like: - # - # try: - # event.wait() - # except trio.Cancelled: - # with self._version_lock: - # self._maybe_wakeup_one_waiter_unlocked() - # raise - # - event.wait() - # Do the deferred version setup. - self._write_txn._setup_version() - return self._write_txn - - def _maybe_wakeup_one_waiter_unlocked(self): - if len(self._write_waiters) > 0: - self._write_event = self._write_waiters.popleft() - self._write_event.set() - - # pylint: disable=unused-argument - def _default_pruning_policy(self, zone, version): - return True - - # pylint: enable=unused-argument - - def _prune_versions_unlocked(self): - assert len(self._versions) > 0 - # Don't ever prune a version greater than or equal to one that - # a reader has open. This pins versions in memory while the - # reader is open, and importantly lets the reader open a txn on - # a successor version (e.g. if generating an IXFR). - # - # Note our definition of least_kept also ensures we do not try to - # delete the greatest version. - if len(self._readers) > 0: - least_kept = min(txn.version.id for txn in self._readers) - else: - least_kept = self._versions[-1].id - while self._versions[0].id < least_kept and self._pruning_policy( - self, self._versions[0] - ): - self._versions.popleft() - - def set_max_versions(self, max_versions: Optional[int]) -> None: - """Set a pruning policy that retains up to the specified number - of versions - """ - if max_versions is not None and max_versions < 1: - raise ValueError("max versions must be at least 1") - if max_versions is None: - - def policy(zone, _): # pylint: disable=unused-argument - return False - - else: - - def policy(zone, _): - return len(zone._versions) > max_versions - - self.set_pruning_policy(policy) - - def set_pruning_policy( - self, policy: Optional[Callable[["Zone", Version], Optional[bool]]] - ) -> None: - """Set the pruning policy for the zone. - - The *policy* function takes a `Version` and returns `True` if - the version should be pruned, and `False` otherwise. `None` - may also be specified for policy, in which case the default policy - is used. - - Pruning checking proceeds from the least version and the first - time the function returns `False`, the checking stops. I.e. the - retained versions are always a consecutive sequence. - """ - if policy is None: - policy = self._default_pruning_policy - with self._version_lock: - self._pruning_policy = policy - self._prune_versions_unlocked() - - def _end_read(self, txn): - with self._version_lock: - self._readers.remove(txn) - self._prune_versions_unlocked() - - def _end_write_unlocked(self, txn): - assert self._write_txn == txn - self._write_txn = None - self._maybe_wakeup_one_waiter_unlocked() - - def _end_write(self, txn): - with self._version_lock: - self._end_write_unlocked(txn) - - def _commit_version_unlocked(self, txn, version, origin): - self._versions.append(version) - self._prune_versions_unlocked() - self.nodes = version.nodes - if self.origin is None: - self.origin = origin - # txn can be None in __init__ when we make the empty version. - if txn is not None: - self._end_write_unlocked(txn) - - def _commit_version(self, txn, version, origin): - with self._version_lock: - self._commit_version_unlocked(txn, version, origin) - - def _get_next_version_id(self): - if len(self._versions) > 0: - id = self._versions[-1].id + 1 - else: - id = 1 - return id - - def find_node( - self, name: Union[dns.name.Name, str], create: bool = False - ) -> dns.node.Node: - if create: - raise UseTransaction - return super().find_node(name) - - def delete_node(self, name: Union[dns.name.Name, str]) -> None: - raise UseTransaction - - def find_rdataset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - create: bool = False, - ) -> dns.rdataset.Rdataset: - if create: - raise UseTransaction - rdataset = super().find_rdataset(name, rdtype, covers) - return dns.rdataset.ImmutableRdataset(rdataset) - - def get_rdataset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - create: bool = False, - ) -> Optional[dns.rdataset.Rdataset]: - if create: - raise UseTransaction - rdataset = super().get_rdataset(name, rdtype, covers) - if rdataset is not None: - return dns.rdataset.ImmutableRdataset(rdataset) - else: - return None - - def delete_rdataset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - ) -> None: - raise UseTransaction - - def replace_rdataset( - self, name: Union[dns.name.Name, str], replacement: dns.rdataset.Rdataset - ) -> None: - raise UseTransaction diff --git a/write-message/venv/lib/python3.10/site-packages/dns/win32util.py b/write-message/venv/lib/python3.10/site-packages/dns/win32util.py deleted file mode 100644 index 9ed3f11..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/win32util.py +++ /dev/null @@ -1,242 +0,0 @@ -import sys - -import dns._features - -if sys.platform == "win32": - from typing import Any - - import dns.name - - _prefer_wmi = True - - import winreg # pylint: disable=import-error - - # Keep pylint quiet on non-windows. - try: - _ = WindowsError # pylint: disable=used-before-assignment - except NameError: - WindowsError = Exception - - if dns._features.have("wmi"): - import threading - - import pythoncom # pylint: disable=import-error - import wmi # pylint: disable=import-error - - _have_wmi = True - else: - _have_wmi = False - - def _config_domain(domain): - # Sometimes DHCP servers add a '.' prefix to the default domain, and - # Windows just stores such values in the registry (see #687). - # Check for this and fix it. - if domain.startswith("."): - domain = domain[1:] - return dns.name.from_text(domain) - - class DnsInfo: - def __init__(self): - self.domain = None - self.nameservers = [] - self.search = [] - - if _have_wmi: - - class _WMIGetter(threading.Thread): - # pylint: disable=possibly-used-before-assignment - def __init__(self): - super().__init__() - self.info = DnsInfo() - - def run(self): - pythoncom.CoInitialize() - try: - system = wmi.WMI() - for interface in system.Win32_NetworkAdapterConfiguration(): - if interface.IPEnabled and interface.DNSServerSearchOrder: - self.info.nameservers = list(interface.DNSServerSearchOrder) - if interface.DNSDomain: - self.info.domain = _config_domain(interface.DNSDomain) - if interface.DNSDomainSuffixSearchOrder: - self.info.search = [ - _config_domain(x) - for x in interface.DNSDomainSuffixSearchOrder - ] - break - finally: - pythoncom.CoUninitialize() - - def get(self): - # We always run in a separate thread to avoid any issues with - # the COM threading model. - self.start() - self.join() - return self.info - - else: - - class _WMIGetter: # type: ignore - pass - - class _RegistryGetter: - def __init__(self): - self.info = DnsInfo() - - def _split(self, text): - # The windows registry has used both " " and "," as a delimiter, and while - # it is currently using "," in Windows 10 and later, updates can seemingly - # leave a space in too, e.g. "a, b". So we just convert all commas to - # spaces, and use split() in its default configuration, which splits on - # all whitespace and ignores empty strings. - return text.replace(",", " ").split() - - def _config_nameservers(self, nameservers): - for ns in self._split(nameservers): - if ns not in self.info.nameservers: - self.info.nameservers.append(ns) - - def _config_search(self, search): - for s in self._split(search): - s = _config_domain(s) - if s not in self.info.search: - self.info.search.append(s) - - def _config_fromkey(self, key, always_try_domain): - try: - servers, _ = winreg.QueryValueEx(key, "NameServer") - except WindowsError: - servers = None - if servers: - self._config_nameservers(servers) - if servers or always_try_domain: - try: - dom, _ = winreg.QueryValueEx(key, "Domain") - if dom: - self.info.domain = _config_domain(dom) - except WindowsError: - pass - else: - try: - servers, _ = winreg.QueryValueEx(key, "DhcpNameServer") - except WindowsError: - servers = None - if servers: - self._config_nameservers(servers) - try: - dom, _ = winreg.QueryValueEx(key, "DhcpDomain") - if dom: - self.info.domain = _config_domain(dom) - except WindowsError: - pass - try: - search, _ = winreg.QueryValueEx(key, "SearchList") - except WindowsError: - search = None - if search is None: - try: - search, _ = winreg.QueryValueEx(key, "DhcpSearchList") - except WindowsError: - search = None - if search: - self._config_search(search) - - def _is_nic_enabled(self, lm, guid): - # Look in the Windows Registry to determine whether the network - # interface corresponding to the given guid is enabled. - # - # (Code contributed by Paul Marks, thanks!) - # - try: - # This hard-coded location seems to be consistent, at least - # from Windows 2000 through Vista. - connection_key = winreg.OpenKey( - lm, - r"SYSTEM\CurrentControlSet\Control\Network" - r"\{4D36E972-E325-11CE-BFC1-08002BE10318}" - rf"\{guid}\Connection", - ) - - try: - # The PnpInstanceID points to a key inside Enum - (pnp_id, ttype) = winreg.QueryValueEx( - connection_key, "PnpInstanceID" - ) - - if ttype != winreg.REG_SZ: - raise ValueError # pragma: no cover - - device_key = winreg.OpenKey( - lm, rf"SYSTEM\CurrentControlSet\Enum\{pnp_id}" - ) - - try: - # Get ConfigFlags for this device - (flags, ttype) = winreg.QueryValueEx(device_key, "ConfigFlags") - - if ttype != winreg.REG_DWORD: - raise ValueError # pragma: no cover - - # Based on experimentation, bit 0x1 indicates that the - # device is disabled. - # - # XXXRTH I suspect we really want to & with 0x03 so - # that CONFIGFLAGS_REMOVED devices are also ignored, - # but we're shifting to WMI as ConfigFlags is not - # supposed to be used. - return not flags & 0x1 - - finally: - device_key.Close() - finally: - connection_key.Close() - except Exception: # pragma: no cover - return False - - def get(self): - """Extract resolver configuration from the Windows registry.""" - - lm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) - try: - tcp_params = winreg.OpenKey( - lm, r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" - ) - try: - self._config_fromkey(tcp_params, True) - finally: - tcp_params.Close() - interfaces = winreg.OpenKey( - lm, - r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", - ) - try: - i = 0 - while True: - try: - guid = winreg.EnumKey(interfaces, i) - i += 1 - key = winreg.OpenKey(interfaces, guid) - try: - if not self._is_nic_enabled(lm, guid): - continue - self._config_fromkey(key, False) - finally: - key.Close() - except OSError: - break - finally: - interfaces.Close() - finally: - lm.Close() - return self.info - - _getter_class: Any - if _have_wmi and _prefer_wmi: - _getter_class = _WMIGetter - else: - _getter_class = _RegistryGetter - - def get_dns_info(): - """Extract resolver configuration.""" - getter = _getter_class() - return getter.get() diff --git a/write-message/venv/lib/python3.10/site-packages/dns/wire.py b/write-message/venv/lib/python3.10/site-packages/dns/wire.py deleted file mode 100644 index 9f9b157..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/wire.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -import contextlib -import struct -from typing import Iterator, Optional, Tuple - -import dns.exception -import dns.name - - -class Parser: - def __init__(self, wire: bytes, current: int = 0): - self.wire = wire - self.current = 0 - self.end = len(self.wire) - if current: - self.seek(current) - self.furthest = current - - def remaining(self) -> int: - return self.end - self.current - - def get_bytes(self, size: int) -> bytes: - assert size >= 0 - if size > self.remaining(): - raise dns.exception.FormError - output = self.wire[self.current : self.current + size] - self.current += size - self.furthest = max(self.furthest, self.current) - return output - - def get_counted_bytes(self, length_size: int = 1) -> bytes: - length = int.from_bytes(self.get_bytes(length_size), "big") - return self.get_bytes(length) - - def get_remaining(self) -> bytes: - return self.get_bytes(self.remaining()) - - def get_uint8(self) -> int: - return struct.unpack("!B", self.get_bytes(1))[0] - - def get_uint16(self) -> int: - return struct.unpack("!H", self.get_bytes(2))[0] - - def get_uint32(self) -> int: - return struct.unpack("!I", self.get_bytes(4))[0] - - def get_uint48(self) -> int: - return int.from_bytes(self.get_bytes(6), "big") - - def get_struct(self, format: str) -> Tuple: - return struct.unpack(format, self.get_bytes(struct.calcsize(format))) - - def get_name(self, origin: Optional["dns.name.Name"] = None) -> "dns.name.Name": - name = dns.name.from_wire_parser(self) - if origin: - name = name.relativize(origin) - return name - - def seek(self, where: int) -> None: - # Note that seeking to the end is OK! (If you try to read - # after such a seek, you'll get an exception as expected.) - if where < 0 or where > self.end: - raise dns.exception.FormError - self.current = where - - @contextlib.contextmanager - def restrict_to(self, size: int) -> Iterator: - assert size >= 0 - if size > self.remaining(): - raise dns.exception.FormError - saved_end = self.end - try: - self.end = self.current + size - yield - # We make this check here and not in the finally as we - # don't want to raise if we're already raising for some - # other reason. - if self.current != self.end: - raise dns.exception.FormError - finally: - self.end = saved_end - - @contextlib.contextmanager - def restore_furthest(self) -> Iterator: - try: - yield None - finally: - self.current = self.furthest diff --git a/write-message/venv/lib/python3.10/site-packages/dns/xfr.py b/write-message/venv/lib/python3.10/site-packages/dns/xfr.py deleted file mode 100644 index 520aa32..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/xfr.py +++ /dev/null @@ -1,343 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2017 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -from typing import Any, List, Optional, Tuple, Union - -import dns.exception -import dns.message -import dns.name -import dns.rcode -import dns.rdataset -import dns.rdatatype -import dns.serial -import dns.transaction -import dns.tsig -import dns.zone - - -class TransferError(dns.exception.DNSException): - """A zone transfer response got a non-zero rcode.""" - - def __init__(self, rcode): - message = f"Zone transfer error: {dns.rcode.to_text(rcode)}" - super().__init__(message) - self.rcode = rcode - - -class SerialWentBackwards(dns.exception.FormError): - """The current serial number is less than the serial we know.""" - - -class UseTCP(dns.exception.DNSException): - """This IXFR cannot be completed with UDP.""" - - -class Inbound: - """ - State machine for zone transfers. - """ - - def __init__( - self, - txn_manager: dns.transaction.TransactionManager, - rdtype: dns.rdatatype.RdataType = dns.rdatatype.AXFR, - serial: Optional[int] = None, - is_udp: bool = False, - ): - """Initialize an inbound zone transfer. - - *txn_manager* is a :py:class:`dns.transaction.TransactionManager`. - - *rdtype* can be `dns.rdatatype.AXFR` or `dns.rdatatype.IXFR` - - *serial* is the base serial number for IXFRs, and is required in - that case. - - *is_udp*, a ``bool`` indidicates if UDP is being used for this - XFR. - """ - self.txn_manager = txn_manager - self.txn: Optional[dns.transaction.Transaction] = None - self.rdtype = rdtype - if rdtype == dns.rdatatype.IXFR: - if serial is None: - raise ValueError("a starting serial must be supplied for IXFRs") - elif is_udp: - raise ValueError("is_udp specified for AXFR") - self.serial = serial - self.is_udp = is_udp - (_, _, self.origin) = txn_manager.origin_information() - self.soa_rdataset: Optional[dns.rdataset.Rdataset] = None - self.done = False - self.expecting_SOA = False - self.delete_mode = False - - def process_message(self, message: dns.message.Message) -> bool: - """Process one message in the transfer. - - The message should have the same relativization as was specified when - the `dns.xfr.Inbound` was created. The message should also have been - created with `one_rr_per_rrset=True` because order matters. - - Returns `True` if the transfer is complete, and `False` otherwise. - """ - if self.txn is None: - replacement = self.rdtype == dns.rdatatype.AXFR - self.txn = self.txn_manager.writer(replacement) - rcode = message.rcode() - if rcode != dns.rcode.NOERROR: - raise TransferError(rcode) - # - # We don't require a question section, but if it is present is - # should be correct. - # - if len(message.question) > 0: - if message.question[0].name != self.origin: - raise dns.exception.FormError("wrong question name") - if message.question[0].rdtype != self.rdtype: - raise dns.exception.FormError("wrong question rdatatype") - answer_index = 0 - if self.soa_rdataset is None: - # - # This is the first message. We're expecting an SOA at - # the origin. - # - if not message.answer or message.answer[0].name != self.origin: - raise dns.exception.FormError("No answer or RRset not for zone origin") - rrset = message.answer[0] - rdataset = rrset - if rdataset.rdtype != dns.rdatatype.SOA: - raise dns.exception.FormError("first RRset is not an SOA") - answer_index = 1 - self.soa_rdataset = rdataset.copy() - if self.rdtype == dns.rdatatype.IXFR: - if self.soa_rdataset[0].serial == self.serial: - # - # We're already up-to-date. - # - self.done = True - elif dns.serial.Serial(self.soa_rdataset[0].serial) < self.serial: - # It went backwards! - raise SerialWentBackwards - else: - if self.is_udp and len(message.answer[answer_index:]) == 0: - # - # There are no more records, so this is the - # "truncated" response. Say to use TCP - # - raise UseTCP - # - # Note we're expecting another SOA so we can detect - # if this IXFR response is an AXFR-style response. - # - self.expecting_SOA = True - # - # Process the answer section (other than the initial SOA in - # the first message). - # - for rrset in message.answer[answer_index:]: - name = rrset.name - rdataset = rrset - if self.done: - raise dns.exception.FormError("answers after final SOA") - assert self.txn is not None # for mypy - if rdataset.rdtype == dns.rdatatype.SOA and name == self.origin: - # - # Every time we see an origin SOA delete_mode inverts - # - if self.rdtype == dns.rdatatype.IXFR: - self.delete_mode = not self.delete_mode - # - # If this SOA Rdataset is equal to the first we saw - # then we're finished. If this is an IXFR we also - # check that we're seeing the record in the expected - # part of the response. - # - if rdataset == self.soa_rdataset and ( - self.rdtype == dns.rdatatype.AXFR - or (self.rdtype == dns.rdatatype.IXFR and self.delete_mode) - ): - # - # This is the final SOA - # - if self.expecting_SOA: - # We got an empty IXFR sequence! - raise dns.exception.FormError("empty IXFR sequence") - if ( - self.rdtype == dns.rdatatype.IXFR - and self.serial != rdataset[0].serial - ): - raise dns.exception.FormError("unexpected end of IXFR sequence") - self.txn.replace(name, rdataset) - self.txn.commit() - self.txn = None - self.done = True - else: - # - # This is not the final SOA - # - self.expecting_SOA = False - if self.rdtype == dns.rdatatype.IXFR: - if self.delete_mode: - # This is the start of an IXFR deletion set - if rdataset[0].serial != self.serial: - raise dns.exception.FormError( - "IXFR base serial mismatch" - ) - else: - # This is the start of an IXFR addition set - self.serial = rdataset[0].serial - self.txn.replace(name, rdataset) - else: - # We saw a non-final SOA for the origin in an AXFR. - raise dns.exception.FormError("unexpected origin SOA in AXFR") - continue - if self.expecting_SOA: - # - # We made an IXFR request and are expecting another - # SOA RR, but saw something else, so this must be an - # AXFR response. - # - self.rdtype = dns.rdatatype.AXFR - self.expecting_SOA = False - self.delete_mode = False - self.txn.rollback() - self.txn = self.txn_manager.writer(True) - # - # Note we are falling through into the code below - # so whatever rdataset this was gets written. - # - # Add or remove the data - if self.delete_mode: - self.txn.delete_exact(name, rdataset) - else: - self.txn.add(name, rdataset) - if self.is_udp and not self.done: - # - # This is a UDP IXFR and we didn't get to done, and we didn't - # get the proper "truncated" response - # - raise dns.exception.FormError("unexpected end of UDP IXFR") - return self.done - - # - # Inbounds are context managers. - # - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - if self.txn: - self.txn.rollback() - return False - - -def make_query( - txn_manager: dns.transaction.TransactionManager, - serial: Optional[int] = 0, - use_edns: Optional[Union[int, bool]] = None, - ednsflags: Optional[int] = None, - payload: Optional[int] = None, - request_payload: Optional[int] = None, - options: Optional[List[dns.edns.Option]] = None, - keyring: Any = None, - keyname: Optional[dns.name.Name] = None, - keyalgorithm: Union[dns.name.Name, str] = dns.tsig.default_algorithm, -) -> Tuple[dns.message.QueryMessage, Optional[int]]: - """Make an AXFR or IXFR query. - - *txn_manager* is a ``dns.transaction.TransactionManager``, typically a - ``dns.zone.Zone``. - - *serial* is an ``int`` or ``None``. If 0, then IXFR will be - attempted using the most recent serial number from the - *txn_manager*; it is the caller's responsibility to ensure there - are no write transactions active that could invalidate the - retrieved serial. If a serial cannot be determined, AXFR will be - forced. Other integer values are the starting serial to use. - ``None`` forces an AXFR. - - Please see the documentation for :py:func:`dns.message.make_query` and - :py:func:`dns.message.Message.use_tsig` for details on the other parameters - to this function. - - Returns a `(query, serial)` tuple. - """ - (zone_origin, _, origin) = txn_manager.origin_information() - if zone_origin is None: - raise ValueError("no zone origin") - if serial is None: - rdtype = dns.rdatatype.AXFR - elif not isinstance(serial, int): - raise ValueError("serial is not an integer") - elif serial == 0: - with txn_manager.reader() as txn: - rdataset = txn.get(origin, "SOA") - if rdataset: - serial = rdataset[0].serial - rdtype = dns.rdatatype.IXFR - else: - serial = None - rdtype = dns.rdatatype.AXFR - elif serial > 0 and serial < 4294967296: - rdtype = dns.rdatatype.IXFR - else: - raise ValueError("serial out-of-range") - rdclass = txn_manager.get_class() - q = dns.message.make_query( - zone_origin, - rdtype, - rdclass, - use_edns, - False, - ednsflags, - payload, - request_payload, - options, - ) - if serial is not None: - rdata = dns.rdata.from_text(rdclass, "SOA", f". . {serial} 0 0 0 0") - rrset = q.find_rrset( - q.authority, zone_origin, rdclass, dns.rdatatype.SOA, create=True - ) - rrset.add(rdata, 0) - if keyring is not None: - q.use_tsig(keyring, keyname, algorithm=keyalgorithm) - return (q, serial) - - -def extract_serial_from_query(query: dns.message.Message) -> Optional[int]: - """Extract the SOA serial number from query if it is an IXFR and return - it, otherwise return None. - - *query* is a dns.message.QueryMessage that is an IXFR or AXFR request. - - Raises if the query is not an IXFR or AXFR, or if an IXFR doesn't have - an appropriate SOA RRset in the authority section. - """ - if not isinstance(query, dns.message.QueryMessage): - raise ValueError("query not a QueryMessage") - question = query.question[0] - if question.rdtype == dns.rdatatype.AXFR: - return None - elif question.rdtype != dns.rdatatype.IXFR: - raise ValueError("query is not an AXFR or IXFR") - soa = query.find_rrset( - query.authority, question.name, question.rdclass, dns.rdatatype.SOA - ) - return soa[0].serial diff --git a/write-message/venv/lib/python3.10/site-packages/dns/zone.py b/write-message/venv/lib/python3.10/site-packages/dns/zone.py deleted file mode 100644 index 844919e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/zone.py +++ /dev/null @@ -1,1434 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Zones.""" - -import contextlib -import io -import os -import struct -from typing import ( - Any, - Callable, - Iterable, - Iterator, - List, - MutableMapping, - Optional, - Set, - Tuple, - Union, -) - -import dns.exception -import dns.grange -import dns.immutable -import dns.name -import dns.node -import dns.rdata -import dns.rdataclass -import dns.rdataset -import dns.rdatatype -import dns.rdtypes.ANY.SOA -import dns.rdtypes.ANY.ZONEMD -import dns.rrset -import dns.tokenizer -import dns.transaction -import dns.ttl -import dns.zonefile -from dns.zonetypes import DigestHashAlgorithm, DigestScheme, _digest_hashers - - -class BadZone(dns.exception.DNSException): - """The DNS zone is malformed.""" - - -class NoSOA(BadZone): - """The DNS zone has no SOA RR at its origin.""" - - -class NoNS(BadZone): - """The DNS zone has no NS RRset at its origin.""" - - -class UnknownOrigin(BadZone): - """The DNS zone's origin is unknown.""" - - -class UnsupportedDigestScheme(dns.exception.DNSException): - """The zone digest's scheme is unsupported.""" - - -class UnsupportedDigestHashAlgorithm(dns.exception.DNSException): - """The zone digest's origin is unsupported.""" - - -class NoDigest(dns.exception.DNSException): - """The DNS zone has no ZONEMD RRset at its origin.""" - - -class DigestVerificationFailure(dns.exception.DNSException): - """The ZONEMD digest failed to verify.""" - - -def _validate_name( - name: dns.name.Name, - origin: Optional[dns.name.Name], - relativize: bool, -) -> dns.name.Name: - # This name validation code is shared by Zone and Version - if origin is None: - # This should probably never happen as other code (e.g. - # _rr_line) will notice the lack of an origin before us, but - # we check just in case! - raise KeyError("no zone origin is defined") - if name.is_absolute(): - if not name.is_subdomain(origin): - raise KeyError("name parameter must be a subdomain of the zone origin") - if relativize: - name = name.relativize(origin) - else: - # We have a relative name. Make sure that the derelativized name is - # not too long. - try: - abs_name = name.derelativize(origin) - except dns.name.NameTooLong: - # We map dns.name.NameTooLong to KeyError to be consistent with - # the other exceptions above. - raise KeyError("relative name too long for zone") - if not relativize: - # We have a relative name in a non-relative zone, so use the - # derelativized name. - name = abs_name - return name - - -class Zone(dns.transaction.TransactionManager): - """A DNS zone. - - A ``Zone`` is a mapping from names to nodes. The zone object may be - treated like a Python dictionary, e.g. ``zone[name]`` will retrieve - the node associated with that name. The *name* may be a - ``dns.name.Name object``, or it may be a string. In either case, - if the name is relative it is treated as relative to the origin of - the zone. - """ - - node_factory: Callable[[], dns.node.Node] = dns.node.Node - map_factory: Callable[[], MutableMapping[dns.name.Name, dns.node.Node]] = dict - writable_version_factory: Optional[Callable[[], "WritableVersion"]] = None - immutable_version_factory: Optional[Callable[[], "ImmutableVersion"]] = None - - __slots__ = ["rdclass", "origin", "nodes", "relativize"] - - def __init__( - self, - origin: Optional[Union[dns.name.Name, str]], - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - relativize: bool = True, - ): - """Initialize a zone object. - - *origin* is the origin of the zone. It may be a ``dns.name.Name``, - a ``str``, or ``None``. If ``None``, then the zone's origin will - be set by the first ``$ORIGIN`` line in a zone file. - - *rdclass*, an ``int``, the zone's rdata class; the default is class IN. - - *relativize*, a ``bool``, determine's whether domain names are - relativized to the zone's origin. The default is ``True``. - """ - - if origin is not None: - if isinstance(origin, str): - origin = dns.name.from_text(origin) - elif not isinstance(origin, dns.name.Name): - raise ValueError("origin parameter must be convertible to a DNS name") - if not origin.is_absolute(): - raise ValueError("origin parameter must be an absolute name") - self.origin = origin - self.rdclass = rdclass - self.nodes: MutableMapping[dns.name.Name, dns.node.Node] = self.map_factory() - self.relativize = relativize - - def __eq__(self, other): - """Two zones are equal if they have the same origin, class, and - nodes. - - Returns a ``bool``. - """ - - if not isinstance(other, Zone): - return False - if ( - self.rdclass != other.rdclass - or self.origin != other.origin - or self.nodes != other.nodes - ): - return False - return True - - def __ne__(self, other): - """Are two zones not equal? - - Returns a ``bool``. - """ - - return not self.__eq__(other) - - def _validate_name(self, name: Union[dns.name.Name, str]) -> dns.name.Name: - # Note that any changes in this method should have corresponding changes - # made in the Version _validate_name() method. - if isinstance(name, str): - name = dns.name.from_text(name, None) - elif not isinstance(name, dns.name.Name): - raise KeyError("name parameter must be convertible to a DNS name") - return _validate_name(name, self.origin, self.relativize) - - def __getitem__(self, key): - key = self._validate_name(key) - return self.nodes[key] - - def __setitem__(self, key, value): - key = self._validate_name(key) - self.nodes[key] = value - - def __delitem__(self, key): - key = self._validate_name(key) - del self.nodes[key] - - def __iter__(self): - return self.nodes.__iter__() - - def keys(self): - return self.nodes.keys() - - def values(self): - return self.nodes.values() - - def items(self): - return self.nodes.items() - - def get(self, key): - key = self._validate_name(key) - return self.nodes.get(key) - - def __contains__(self, key): - key = self._validate_name(key) - return key in self.nodes - - def find_node( - self, name: Union[dns.name.Name, str], create: bool = False - ) -> dns.node.Node: - """Find a node in the zone, possibly creating it. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - *create*, a ``bool``. If true, the node will be created if it does - not exist. - - Raises ``KeyError`` if the name is not known and create was - not specified, or if the name was not a subdomain of the origin. - - Returns a ``dns.node.Node``. - """ - - name = self._validate_name(name) - node = self.nodes.get(name) - if node is None: - if not create: - raise KeyError - node = self.node_factory() - self.nodes[name] = node - return node - - def get_node( - self, name: Union[dns.name.Name, str], create: bool = False - ) -> Optional[dns.node.Node]: - """Get a node in the zone, possibly creating it. - - This method is like ``find_node()``, except it returns None instead - of raising an exception if the node does not exist and creation - has not been requested. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - *create*, a ``bool``. If true, the node will be created if it does - not exist. - - Returns a ``dns.node.Node`` or ``None``. - """ - - try: - node = self.find_node(name, create) - except KeyError: - node = None - return node - - def delete_node(self, name: Union[dns.name.Name, str]) -> None: - """Delete the specified node if it exists. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - It is not an error if the node does not exist. - """ - - name = self._validate_name(name) - if name in self.nodes: - del self.nodes[name] - - def find_rdataset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - create: bool = False, - ) -> dns.rdataset.Rdataset: - """Look for an rdataset with the specified name and type in the zone, - and return an rdataset encapsulating it. - - The rdataset returned is not a copy; changes to it will change - the zone. - - KeyError is raised if the name or type are not found. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - *rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired. - - *covers*, a ``dns.rdatatype.RdataType`` or ``str`` the covered type. - Usually this value is ``dns.rdatatype.NONE``, but if the - rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, - then the covers value will be the rdata type the SIG/RRSIG - covers. The library treats the SIG and RRSIG types as if they - were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). - This makes RRSIGs much easier to work with than if RRSIGs - covering different rdata types were aggregated into a single - RRSIG rdataset. - - *create*, a ``bool``. If true, the node will be created if it does - not exist. - - Raises ``KeyError`` if the name is not known and create was - not specified, or if the name was not a subdomain of the origin. - - Returns a ``dns.rdataset.Rdataset``. - """ - - name = self._validate_name(name) - rdtype = dns.rdatatype.RdataType.make(rdtype) - covers = dns.rdatatype.RdataType.make(covers) - node = self.find_node(name, create) - return node.find_rdataset(self.rdclass, rdtype, covers, create) - - def get_rdataset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - create: bool = False, - ) -> Optional[dns.rdataset.Rdataset]: - """Look for an rdataset with the specified name and type in the zone. - - This method is like ``find_rdataset()``, except it returns None instead - of raising an exception if the rdataset does not exist and creation - has not been requested. - - The rdataset returned is not a copy; changes to it will change - the zone. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - *rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired. - - *covers*, a ``dns.rdatatype.RdataType`` or ``str``, the covered type. - Usually this value is ``dns.rdatatype.NONE``, but if the - rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, - then the covers value will be the rdata type the SIG/RRSIG - covers. The library treats the SIG and RRSIG types as if they - were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). - This makes RRSIGs much easier to work with than if RRSIGs - covering different rdata types were aggregated into a single - RRSIG rdataset. - - *create*, a ``bool``. If true, the node will be created if it does - not exist. - - Raises ``KeyError`` if the name is not known and create was - not specified, or if the name was not a subdomain of the origin. - - Returns a ``dns.rdataset.Rdataset`` or ``None``. - """ - - try: - rdataset = self.find_rdataset(name, rdtype, covers, create) - except KeyError: - rdataset = None - return rdataset - - def delete_rdataset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - ) -> None: - """Delete the rdataset matching *rdtype* and *covers*, if it - exists at the node specified by *name*. - - It is not an error if the node does not exist, or if there is no matching - rdataset at the node. - - If the node has no rdatasets after the deletion, it will itself be deleted. - - *name*: the name of the node to find. The value may be a ``dns.name.Name`` or a - ``str``. If absolute, the name must be a subdomain of the zone's origin. If - ``zone.relativize`` is ``True``, then the name will be relativized. - - *rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired. - - *covers*, a ``dns.rdatatype.RdataType`` or ``str`` or ``None``, the covered - type. Usually this value is ``dns.rdatatype.NONE``, but if the rdtype is - ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, then the covers value will be - the rdata type the SIG/RRSIG covers. The library treats the SIG and RRSIG types - as if they were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This - makes RRSIGs much easier to work with than if RRSIGs covering different rdata - types were aggregated into a single RRSIG rdataset. - """ - - name = self._validate_name(name) - rdtype = dns.rdatatype.RdataType.make(rdtype) - covers = dns.rdatatype.RdataType.make(covers) - node = self.get_node(name) - if node is not None: - node.delete_rdataset(self.rdclass, rdtype, covers) - if len(node) == 0: - self.delete_node(name) - - def replace_rdataset( - self, name: Union[dns.name.Name, str], replacement: dns.rdataset.Rdataset - ) -> None: - """Replace an rdataset at name. - - It is not an error if there is no rdataset matching I{replacement}. - - Ownership of the *replacement* object is transferred to the zone; - in other words, this method does not store a copy of *replacement* - at the node, it stores *replacement* itself. - - If the node does not exist, it is created. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - *replacement*, a ``dns.rdataset.Rdataset``, the replacement rdataset. - """ - - if replacement.rdclass != self.rdclass: - raise ValueError("replacement.rdclass != zone.rdclass") - node = self.find_node(name, True) - node.replace_rdataset(replacement) - - def find_rrset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - ) -> dns.rrset.RRset: - """Look for an rdataset with the specified name and type in the zone, - and return an RRset encapsulating it. - - This method is less efficient than the similar - ``find_rdataset()`` because it creates an RRset instead of - returning the matching rdataset. It may be more convenient - for some uses since it returns an object which binds the owner - name to the rdataset. - - This method may not be used to create new nodes or rdatasets; - use ``find_rdataset`` instead. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - *rdtype*, a ``dns.rdatatype.RdataType`` or ``str``, the rdata type desired. - - *covers*, a ``dns.rdatatype.RdataType`` or ``str``, the covered type. - Usually this value is ``dns.rdatatype.NONE``, but if the - rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, - then the covers value will be the rdata type the SIG/RRSIG - covers. The library treats the SIG and RRSIG types as if they - were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). - This makes RRSIGs much easier to work with than if RRSIGs - covering different rdata types were aggregated into a single - RRSIG rdataset. - - *create*, a ``bool``. If true, the node will be created if it does - not exist. - - Raises ``KeyError`` if the name is not known and create was - not specified, or if the name was not a subdomain of the origin. - - Returns a ``dns.rrset.RRset`` or ``None``. - """ - - vname = self._validate_name(name) - rdtype = dns.rdatatype.RdataType.make(rdtype) - covers = dns.rdatatype.RdataType.make(covers) - rdataset = self.nodes[vname].find_rdataset(self.rdclass, rdtype, covers) - rrset = dns.rrset.RRset(vname, self.rdclass, rdtype, covers) - rrset.update(rdataset) - return rrset - - def get_rrset( - self, - name: Union[dns.name.Name, str], - rdtype: Union[dns.rdatatype.RdataType, str], - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - ) -> Optional[dns.rrset.RRset]: - """Look for an rdataset with the specified name and type in the zone, - and return an RRset encapsulating it. - - This method is less efficient than the similar ``get_rdataset()`` - because it creates an RRset instead of returning the matching - rdataset. It may be more convenient for some uses since it - returns an object which binds the owner name to the rdataset. - - This method may not be used to create new nodes or rdatasets; - use ``get_rdataset()`` instead. - - *name*: the name of the node to find. - The value may be a ``dns.name.Name`` or a ``str``. If absolute, the - name must be a subdomain of the zone's origin. If ``zone.relativize`` - is ``True``, then the name will be relativized. - - *rdtype*, a ``dns.rdataset.Rdataset`` or ``str``, the rdata type desired. - - *covers*, a ``dns.rdataset.Rdataset`` or ``str``, the covered type. - Usually this value is ``dns.rdatatype.NONE``, but if the - rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, - then the covers value will be the rdata type the SIG/RRSIG - covers. The library treats the SIG and RRSIG types as if they - were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). - This makes RRSIGs much easier to work with than if RRSIGs - covering different rdata types were aggregated into a single - RRSIG rdataset. - - *create*, a ``bool``. If true, the node will be created if it does - not exist. - - Returns a ``dns.rrset.RRset`` or ``None``. - """ - - try: - rrset = self.find_rrset(name, rdtype, covers) - except KeyError: - rrset = None - return rrset - - def iterate_rdatasets( - self, - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.ANY, - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - ) -> Iterator[Tuple[dns.name.Name, dns.rdataset.Rdataset]]: - """Return a generator which yields (name, rdataset) tuples for - all rdatasets in the zone which have the specified *rdtype* - and *covers*. If *rdtype* is ``dns.rdatatype.ANY``, the default, - then all rdatasets will be matched. - - *rdtype*, a ``dns.rdataset.Rdataset`` or ``str``, the rdata type desired. - - *covers*, a ``dns.rdataset.Rdataset`` or ``str``, the covered type. - Usually this value is ``dns.rdatatype.NONE``, but if the - rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, - then the covers value will be the rdata type the SIG/RRSIG - covers. The library treats the SIG and RRSIG types as if they - were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). - This makes RRSIGs much easier to work with than if RRSIGs - covering different rdata types were aggregated into a single - RRSIG rdataset. - """ - - rdtype = dns.rdatatype.RdataType.make(rdtype) - covers = dns.rdatatype.RdataType.make(covers) - for name, node in self.items(): - for rds in node: - if rdtype == dns.rdatatype.ANY or ( - rds.rdtype == rdtype and rds.covers == covers - ): - yield (name, rds) - - def iterate_rdatas( - self, - rdtype: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.ANY, - covers: Union[dns.rdatatype.RdataType, str] = dns.rdatatype.NONE, - ) -> Iterator[Tuple[dns.name.Name, int, dns.rdata.Rdata]]: - """Return a generator which yields (name, ttl, rdata) tuples for - all rdatas in the zone which have the specified *rdtype* - and *covers*. If *rdtype* is ``dns.rdatatype.ANY``, the default, - then all rdatas will be matched. - - *rdtype*, a ``dns.rdataset.Rdataset`` or ``str``, the rdata type desired. - - *covers*, a ``dns.rdataset.Rdataset`` or ``str``, the covered type. - Usually this value is ``dns.rdatatype.NONE``, but if the - rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, - then the covers value will be the rdata type the SIG/RRSIG - covers. The library treats the SIG and RRSIG types as if they - were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). - This makes RRSIGs much easier to work with than if RRSIGs - covering different rdata types were aggregated into a single - RRSIG rdataset. - """ - - rdtype = dns.rdatatype.RdataType.make(rdtype) - covers = dns.rdatatype.RdataType.make(covers) - for name, node in self.items(): - for rds in node: - if rdtype == dns.rdatatype.ANY or ( - rds.rdtype == rdtype and rds.covers == covers - ): - for rdata in rds: - yield (name, rds.ttl, rdata) - - def to_file( - self, - f: Any, - sorted: bool = True, - relativize: bool = True, - nl: Optional[str] = None, - want_comments: bool = False, - want_origin: bool = False, - ) -> None: - """Write a zone to a file. - - *f*, a file or `str`. If *f* is a string, it is treated - as the name of a file to open. - - *sorted*, a ``bool``. If True, the default, then the file - will be written with the names sorted in DNSSEC order from - least to greatest. Otherwise the names will be written in - whatever order they happen to have in the zone's dictionary. - - *relativize*, a ``bool``. If True, the default, then domain - names in the output will be relativized to the zone's origin - if possible. - - *nl*, a ``str`` or None. The end of line string. If not - ``None``, the output will use the platform's native - end-of-line marker (i.e. LF on POSIX, CRLF on Windows). - - *want_comments*, a ``bool``. If ``True``, emit end-of-line comments - as part of writing the file. If ``False``, the default, do not - emit them. - - *want_origin*, a ``bool``. If ``True``, emit a $ORIGIN line at - the start of the file. If ``False``, the default, do not emit - one. - """ - - if isinstance(f, str): - cm: contextlib.AbstractContextManager = open(f, "wb") - else: - cm = contextlib.nullcontext(f) - with cm as f: - # must be in this way, f.encoding may contain None, or even - # attribute may not be there - file_enc = getattr(f, "encoding", None) - if file_enc is None: - file_enc = "utf-8" - - if nl is None: - # binary mode, '\n' is not enough - nl_b = os.linesep.encode(file_enc) - nl = "\n" - elif isinstance(nl, str): - nl_b = nl.encode(file_enc) - else: - nl_b = nl - nl = nl.decode() - - if want_origin: - assert self.origin is not None - l = "$ORIGIN " + self.origin.to_text() - l_b = l.encode(file_enc) - try: - f.write(l_b) - f.write(nl_b) - except TypeError: # textual mode - f.write(l) - f.write(nl) - - if sorted: - names = list(self.keys()) - names.sort() - else: - names = self.keys() - for n in names: - l = self[n].to_text( - n, - origin=self.origin, - relativize=relativize, - want_comments=want_comments, - ) - l_b = l.encode(file_enc) - - try: - f.write(l_b) - f.write(nl_b) - except TypeError: # textual mode - f.write(l) - f.write(nl) - - def to_text( - self, - sorted: bool = True, - relativize: bool = True, - nl: Optional[str] = None, - want_comments: bool = False, - want_origin: bool = False, - ) -> str: - """Return a zone's text as though it were written to a file. - - *sorted*, a ``bool``. If True, the default, then the file - will be written with the names sorted in DNSSEC order from - least to greatest. Otherwise the names will be written in - whatever order they happen to have in the zone's dictionary. - - *relativize*, a ``bool``. If True, the default, then domain - names in the output will be relativized to the zone's origin - if possible. - - *nl*, a ``str`` or None. The end of line string. If not - ``None``, the output will use the platform's native - end-of-line marker (i.e. LF on POSIX, CRLF on Windows). - - *want_comments*, a ``bool``. If ``True``, emit end-of-line comments - as part of writing the file. If ``False``, the default, do not - emit them. - - *want_origin*, a ``bool``. If ``True``, emit a $ORIGIN line at - the start of the output. If ``False``, the default, do not emit - one. - - Returns a ``str``. - """ - temp_buffer = io.StringIO() - self.to_file(temp_buffer, sorted, relativize, nl, want_comments, want_origin) - return_value = temp_buffer.getvalue() - temp_buffer.close() - return return_value - - def check_origin(self) -> None: - """Do some simple checking of the zone's origin. - - Raises ``dns.zone.NoSOA`` if there is no SOA RRset. - - Raises ``dns.zone.NoNS`` if there is no NS RRset. - - Raises ``KeyError`` if there is no origin node. - """ - if self.relativize: - name = dns.name.empty - else: - assert self.origin is not None - name = self.origin - if self.get_rdataset(name, dns.rdatatype.SOA) is None: - raise NoSOA - if self.get_rdataset(name, dns.rdatatype.NS) is None: - raise NoNS - - def get_soa( - self, txn: Optional[dns.transaction.Transaction] = None - ) -> dns.rdtypes.ANY.SOA.SOA: - """Get the zone SOA rdata. - - Raises ``dns.zone.NoSOA`` if there is no SOA RRset. - - Returns a ``dns.rdtypes.ANY.SOA.SOA`` Rdata. - """ - if self.relativize: - origin_name = dns.name.empty - else: - if self.origin is None: - # get_soa() has been called very early, and there must not be - # an SOA if there is no origin. - raise NoSOA - origin_name = self.origin - soa: Optional[dns.rdataset.Rdataset] - if txn: - soa = txn.get(origin_name, dns.rdatatype.SOA) - else: - soa = self.get_rdataset(origin_name, dns.rdatatype.SOA) - if soa is None: - raise NoSOA - return soa[0] - - def _compute_digest( - self, - hash_algorithm: DigestHashAlgorithm, - scheme: DigestScheme = DigestScheme.SIMPLE, - ) -> bytes: - hashinfo = _digest_hashers.get(hash_algorithm) - if not hashinfo: - raise UnsupportedDigestHashAlgorithm - if scheme != DigestScheme.SIMPLE: - raise UnsupportedDigestScheme - - if self.relativize: - origin_name = dns.name.empty - else: - assert self.origin is not None - origin_name = self.origin - hasher = hashinfo() - for name, node in sorted(self.items()): - rrnamebuf = name.to_digestable(self.origin) - for rdataset in sorted(node, key=lambda rds: (rds.rdtype, rds.covers)): - if name == origin_name and dns.rdatatype.ZONEMD in ( - rdataset.rdtype, - rdataset.covers, - ): - continue - rrfixed = struct.pack( - "!HHI", rdataset.rdtype, rdataset.rdclass, rdataset.ttl - ) - rdatas = [rdata.to_digestable(self.origin) for rdata in rdataset] - for rdata in sorted(rdatas): - rrlen = struct.pack("!H", len(rdata)) - hasher.update(rrnamebuf + rrfixed + rrlen + rdata) - return hasher.digest() - - def compute_digest( - self, - hash_algorithm: DigestHashAlgorithm, - scheme: DigestScheme = DigestScheme.SIMPLE, - ) -> dns.rdtypes.ANY.ZONEMD.ZONEMD: - serial = self.get_soa().serial - digest = self._compute_digest(hash_algorithm, scheme) - return dns.rdtypes.ANY.ZONEMD.ZONEMD( - self.rdclass, dns.rdatatype.ZONEMD, serial, scheme, hash_algorithm, digest - ) - - def verify_digest( - self, zonemd: Optional[dns.rdtypes.ANY.ZONEMD.ZONEMD] = None - ) -> None: - digests: Union[dns.rdataset.Rdataset, List[dns.rdtypes.ANY.ZONEMD.ZONEMD]] - if zonemd: - digests = [zonemd] - else: - assert self.origin is not None - rds = self.get_rdataset(self.origin, dns.rdatatype.ZONEMD) - if rds is None: - raise NoDigest - digests = rds - for digest in digests: - try: - computed = self._compute_digest(digest.hash_algorithm, digest.scheme) - if computed == digest.digest: - return - except Exception: - pass - raise DigestVerificationFailure - - # TransactionManager methods - - def reader(self) -> "Transaction": - return Transaction(self, False, Version(self, 1, self.nodes, self.origin)) - - def writer(self, replacement: bool = False) -> "Transaction": - txn = Transaction(self, replacement) - txn._setup_version() - return txn - - def origin_information( - self, - ) -> Tuple[Optional[dns.name.Name], bool, Optional[dns.name.Name]]: - effective: Optional[dns.name.Name] - if self.relativize: - effective = dns.name.empty - else: - effective = self.origin - return (self.origin, self.relativize, effective) - - def get_class(self): - return self.rdclass - - # Transaction methods - - def _end_read(self, txn): - pass - - def _end_write(self, txn): - pass - - def _commit_version(self, _, version, origin): - self.nodes = version.nodes - if self.origin is None: - self.origin = origin - - def _get_next_version_id(self): - # Versions are ephemeral and all have id 1 - return 1 - - -# These classes used to be in dns.versioned, but have moved here so we can use -# the copy-on-write transaction mechanism for both kinds of zones. In a -# regular zone, the version only exists during the transaction, and the nodes -# are regular dns.node.Nodes. - -# A node with a version id. - - -class VersionedNode(dns.node.Node): # lgtm[py/missing-equals] - __slots__ = ["id"] - - def __init__(self): - super().__init__() - # A proper id will get set by the Version - self.id = 0 - - -@dns.immutable.immutable -class ImmutableVersionedNode(VersionedNode): - def __init__(self, node): - super().__init__() - self.id = node.id - self.rdatasets = tuple( - [dns.rdataset.ImmutableRdataset(rds) for rds in node.rdatasets] - ) - - def find_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - create: bool = False, - ) -> dns.rdataset.Rdataset: - if create: - raise TypeError("immutable") - return super().find_rdataset(rdclass, rdtype, covers, False) - - def get_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - create: bool = False, - ) -> Optional[dns.rdataset.Rdataset]: - if create: - raise TypeError("immutable") - return super().get_rdataset(rdclass, rdtype, covers, False) - - def delete_rdataset( - self, - rdclass: dns.rdataclass.RdataClass, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, - ) -> None: - raise TypeError("immutable") - - def replace_rdataset(self, replacement: dns.rdataset.Rdataset) -> None: - raise TypeError("immutable") - - def is_immutable(self) -> bool: - return True - - -class Version: - def __init__( - self, - zone: Zone, - id: int, - nodes: Optional[MutableMapping[dns.name.Name, dns.node.Node]] = None, - origin: Optional[dns.name.Name] = None, - ): - self.zone = zone - self.id = id - if nodes is not None: - self.nodes = nodes - else: - self.nodes = zone.map_factory() - self.origin = origin - - def _validate_name(self, name: dns.name.Name) -> dns.name.Name: - return _validate_name(name, self.origin, self.zone.relativize) - - def get_node(self, name: dns.name.Name) -> Optional[dns.node.Node]: - name = self._validate_name(name) - return self.nodes.get(name) - - def get_rdataset( - self, - name: dns.name.Name, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType, - ) -> Optional[dns.rdataset.Rdataset]: - node = self.get_node(name) - if node is None: - return None - return node.get_rdataset(self.zone.rdclass, rdtype, covers) - - def keys(self): - return self.nodes.keys() - - def items(self): - return self.nodes.items() - - -class WritableVersion(Version): - def __init__(self, zone: Zone, replacement: bool = False): - # The zone._versions_lock must be held by our caller in a versioned - # zone. - id = zone._get_next_version_id() - super().__init__(zone, id) - if not replacement: - # We copy the map, because that gives us a simple and thread-safe - # way of doing versions, and we have a garbage collector to help - # us. We only make new node objects if we actually change the - # node. - self.nodes.update(zone.nodes) - # We have to copy the zone origin as it may be None in the first - # version, and we don't want to mutate the zone until we commit. - self.origin = zone.origin - self.changed: Set[dns.name.Name] = set() - - def _maybe_cow(self, name: dns.name.Name) -> dns.node.Node: - name = self._validate_name(name) - node = self.nodes.get(name) - if node is None or name not in self.changed: - new_node = self.zone.node_factory() - if hasattr(new_node, "id"): - # We keep doing this for backwards compatibility, as earlier - # code used new_node.id != self.id for the "do we need to CoW?" - # test. Now we use the changed set as this works with both - # regular zones and versioned zones. - # - # We ignore the mypy error as this is safe but it doesn't see it. - new_node.id = self.id # type: ignore - if node is not None: - # moo! copy on write! - new_node.rdatasets.extend(node.rdatasets) - self.nodes[name] = new_node - self.changed.add(name) - return new_node - else: - return node - - def delete_node(self, name: dns.name.Name) -> None: - name = self._validate_name(name) - if name in self.nodes: - del self.nodes[name] - self.changed.add(name) - - def put_rdataset( - self, name: dns.name.Name, rdataset: dns.rdataset.Rdataset - ) -> None: - node = self._maybe_cow(name) - node.replace_rdataset(rdataset) - - def delete_rdataset( - self, - name: dns.name.Name, - rdtype: dns.rdatatype.RdataType, - covers: dns.rdatatype.RdataType, - ) -> None: - node = self._maybe_cow(name) - node.delete_rdataset(self.zone.rdclass, rdtype, covers) - if len(node) == 0: - del self.nodes[name] - - -@dns.immutable.immutable -class ImmutableVersion(Version): - def __init__(self, version: WritableVersion): - # We tell super() that it's a replacement as we don't want it - # to copy the nodes, as we're about to do that with an - # immutable Dict. - super().__init__(version.zone, True) - # set the right id! - self.id = version.id - # keep the origin - self.origin = version.origin - # Make changed nodes immutable - for name in version.changed: - node = version.nodes.get(name) - # it might not exist if we deleted it in the version - if node: - version.nodes[name] = ImmutableVersionedNode(node) - # We're changing the type of the nodes dictionary here on purpose, so - # we ignore the mypy error. - self.nodes = dns.immutable.Dict( - version.nodes, True, self.zone.map_factory - ) # type: ignore - - -class Transaction(dns.transaction.Transaction): - def __init__(self, zone, replacement, version=None, make_immutable=False): - read_only = version is not None - super().__init__(zone, replacement, read_only) - self.version = version - self.make_immutable = make_immutable - - @property - def zone(self): - return self.manager - - def _setup_version(self): - assert self.version is None - factory = self.manager.writable_version_factory - if factory is None: - factory = WritableVersion - self.version = factory(self.zone, self.replacement) - - def _get_rdataset(self, name, rdtype, covers): - return self.version.get_rdataset(name, rdtype, covers) - - def _put_rdataset(self, name, rdataset): - assert not self.read_only - self.version.put_rdataset(name, rdataset) - - def _delete_name(self, name): - assert not self.read_only - self.version.delete_node(name) - - def _delete_rdataset(self, name, rdtype, covers): - assert not self.read_only - self.version.delete_rdataset(name, rdtype, covers) - - def _name_exists(self, name): - return self.version.get_node(name) is not None - - def _changed(self): - if self.read_only: - return False - else: - return len(self.version.changed) > 0 - - def _end_transaction(self, commit): - if self.read_only: - self.zone._end_read(self) - elif commit and len(self.version.changed) > 0: - if self.make_immutable: - factory = self.manager.immutable_version_factory - if factory is None: - factory = ImmutableVersion - version = factory(self.version) - else: - version = self.version - self.zone._commit_version(self, version, self.version.origin) - else: - # rollback - self.zone._end_write(self) - - def _set_origin(self, origin): - if self.version.origin is None: - self.version.origin = origin - - def _iterate_rdatasets(self): - for name, node in self.version.items(): - for rdataset in node: - yield (name, rdataset) - - def _iterate_names(self): - return self.version.keys() - - def _get_node(self, name): - return self.version.get_node(name) - - def _origin_information(self): - (absolute, relativize, effective) = self.manager.origin_information() - if absolute is None and self.version.origin is not None: - # No origin has been committed yet, but we've learned one as part of - # this txn. Use it. - absolute = self.version.origin - if relativize: - effective = dns.name.empty - else: - effective = absolute - return (absolute, relativize, effective) - - -def _from_text( - text: Any, - origin: Optional[Union[dns.name.Name, str]] = None, - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - relativize: bool = True, - zone_factory: Any = Zone, - filename: Optional[str] = None, - allow_include: bool = False, - check_origin: bool = True, - idna_codec: Optional[dns.name.IDNACodec] = None, - allow_directives: Union[bool, Iterable[str]] = True, -) -> Zone: - # See the comments for the public APIs from_text() and from_file() for - # details. - - # 'text' can also be a file, but we don't publish that fact - # since it's an implementation detail. The official file - # interface is from_file(). - - if filename is None: - filename = "" - zone = zone_factory(origin, rdclass, relativize=relativize) - with zone.writer(True) as txn: - tok = dns.tokenizer.Tokenizer(text, filename, idna_codec=idna_codec) - reader = dns.zonefile.Reader( - tok, - rdclass, - txn, - allow_include=allow_include, - allow_directives=allow_directives, - ) - try: - reader.read() - except dns.zonefile.UnknownOrigin: - # for backwards compatibility - raise dns.zone.UnknownOrigin - # Now that we're done reading, do some basic checking of the zone. - if check_origin: - zone.check_origin() - return zone - - -def from_text( - text: str, - origin: Optional[Union[dns.name.Name, str]] = None, - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - relativize: bool = True, - zone_factory: Any = Zone, - filename: Optional[str] = None, - allow_include: bool = False, - check_origin: bool = True, - idna_codec: Optional[dns.name.IDNACodec] = None, - allow_directives: Union[bool, Iterable[str]] = True, -) -> Zone: - """Build a zone object from a zone file format string. - - *text*, a ``str``, the zone file format input. - - *origin*, a ``dns.name.Name``, a ``str``, or ``None``. The origin - of the zone; if not specified, the first ``$ORIGIN`` statement in the - zone file will determine the origin of the zone. - - *rdclass*, a ``dns.rdataclass.RdataClass``, the zone's rdata class; the default is - class IN. - - *relativize*, a ``bool``, determine's whether domain names are - relativized to the zone's origin. The default is ``True``. - - *zone_factory*, the zone factory to use or ``None``. If ``None``, then - ``dns.zone.Zone`` will be used. The value may be any class or callable - that returns a subclass of ``dns.zone.Zone``. - - *filename*, a ``str`` or ``None``, the filename to emit when - describing where an error occurred; the default is ``''``. - - *allow_include*, a ``bool``. If ``True``, the default, then ``$INCLUDE`` - directives are permitted. If ``False``, then encoutering a ``$INCLUDE`` - will raise a ``SyntaxError`` exception. - - *check_origin*, a ``bool``. If ``True``, the default, then sanity - checks of the origin node will be made by calling the zone's - ``check_origin()`` method. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - *allow_directives*, a ``bool`` or an iterable of `str`. If ``True``, the default, - then directives are permitted, and the *allow_include* parameter controls whether - ``$INCLUDE`` is permitted. If ``False`` or an empty iterable, then no directive - processing is done and any directive-like text will be treated as a regular owner - name. If a non-empty iterable, then only the listed directives (including the - ``$``) are allowed. - - Raises ``dns.zone.NoSOA`` if there is no SOA RRset. - - Raises ``dns.zone.NoNS`` if there is no NS RRset. - - Raises ``KeyError`` if there is no origin node. - - Returns a subclass of ``dns.zone.Zone``. - """ - return _from_text( - text, - origin, - rdclass, - relativize, - zone_factory, - filename, - allow_include, - check_origin, - idna_codec, - allow_directives, - ) - - -def from_file( - f: Any, - origin: Optional[Union[dns.name.Name, str]] = None, - rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN, - relativize: bool = True, - zone_factory: Any = Zone, - filename: Optional[str] = None, - allow_include: bool = True, - check_origin: bool = True, - idna_codec: Optional[dns.name.IDNACodec] = None, - allow_directives: Union[bool, Iterable[str]] = True, -) -> Zone: - """Read a zone file and build a zone object. - - *f*, a file or ``str``. If *f* is a string, it is treated - as the name of a file to open. - - *origin*, a ``dns.name.Name``, a ``str``, or ``None``. The origin - of the zone; if not specified, the first ``$ORIGIN`` statement in the - zone file will determine the origin of the zone. - - *rdclass*, an ``int``, the zone's rdata class; the default is class IN. - - *relativize*, a ``bool``, determine's whether domain names are - relativized to the zone's origin. The default is ``True``. - - *zone_factory*, the zone factory to use or ``None``. If ``None``, then - ``dns.zone.Zone`` will be used. The value may be any class or callable - that returns a subclass of ``dns.zone.Zone``. - - *filename*, a ``str`` or ``None``, the filename to emit when - describing where an error occurred; the default is ``''``. - - *allow_include*, a ``bool``. If ``True``, the default, then ``$INCLUDE`` - directives are permitted. If ``False``, then encoutering a ``$INCLUDE`` - will raise a ``SyntaxError`` exception. - - *check_origin*, a ``bool``. If ``True``, the default, then sanity - checks of the origin node will be made by calling the zone's - ``check_origin()`` method. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. - - *allow_directives*, a ``bool`` or an iterable of `str`. If ``True``, the default, - then directives are permitted, and the *allow_include* parameter controls whether - ``$INCLUDE`` is permitted. If ``False`` or an empty iterable, then no directive - processing is done and any directive-like text will be treated as a regular owner - name. If a non-empty iterable, then only the listed directives (including the - ``$``) are allowed. - - Raises ``dns.zone.NoSOA`` if there is no SOA RRset. - - Raises ``dns.zone.NoNS`` if there is no NS RRset. - - Raises ``KeyError`` if there is no origin node. - - Returns a subclass of ``dns.zone.Zone``. - """ - - if isinstance(f, str): - if filename is None: - filename = f - cm: contextlib.AbstractContextManager = open(f) - else: - cm = contextlib.nullcontext(f) - with cm as f: - return _from_text( - f, - origin, - rdclass, - relativize, - zone_factory, - filename, - allow_include, - check_origin, - idna_codec, - allow_directives, - ) - assert False # make mypy happy lgtm[py/unreachable-statement] - - -def from_xfr( - xfr: Any, - zone_factory: Any = Zone, - relativize: bool = True, - check_origin: bool = True, -) -> Zone: - """Convert the output of a zone transfer generator into a zone object. - - *xfr*, a generator of ``dns.message.Message`` objects, typically - ``dns.query.xfr()``. - - *relativize*, a ``bool``, determine's whether domain names are - relativized to the zone's origin. The default is ``True``. - It is essential that the relativize setting matches the one specified - to the generator. - - *check_origin*, a ``bool``. If ``True``, the default, then sanity - checks of the origin node will be made by calling the zone's - ``check_origin()`` method. - - Raises ``dns.zone.NoSOA`` if there is no SOA RRset. - - Raises ``dns.zone.NoNS`` if there is no NS RRset. - - Raises ``KeyError`` if there is no origin node. - - Raises ``ValueError`` if no messages are yielded by the generator. - - Returns a subclass of ``dns.zone.Zone``. - """ - - z = None - for r in xfr: - if z is None: - if relativize: - origin = r.origin - else: - origin = r.answer[0].name - rdclass = r.answer[0].rdclass - z = zone_factory(origin, rdclass, relativize=relativize) - for rrset in r.answer: - znode = z.nodes.get(rrset.name) - if not znode: - znode = z.node_factory() - z.nodes[rrset.name] = znode - zrds = znode.find_rdataset(rrset.rdclass, rrset.rdtype, rrset.covers, True) - zrds.update_ttl(rrset.ttl) - for rd in rrset: - zrds.add(rd) - if z is None: - raise ValueError("empty transfer") - if check_origin: - z.check_origin() - return z diff --git a/write-message/venv/lib/python3.10/site-packages/dns/zonefile.py b/write-message/venv/lib/python3.10/site-packages/dns/zonefile.py deleted file mode 100644 index d74510b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/zonefile.py +++ /dev/null @@ -1,744 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose with or without fee is hereby granted, -# provided that the above copyright notice and this permission notice -# appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -"""DNS Zones.""" - -import re -import sys -from typing import Any, Iterable, List, Optional, Set, Tuple, Union - -import dns.exception -import dns.grange -import dns.name -import dns.node -import dns.rdata -import dns.rdataclass -import dns.rdatatype -import dns.rdtypes.ANY.SOA -import dns.rrset -import dns.tokenizer -import dns.transaction -import dns.ttl - - -class UnknownOrigin(dns.exception.DNSException): - """Unknown origin""" - - -class CNAMEAndOtherData(dns.exception.DNSException): - """A node has a CNAME and other data""" - - -def _check_cname_and_other_data(txn, name, rdataset): - rdataset_kind = dns.node.NodeKind.classify_rdataset(rdataset) - node = txn.get_node(name) - if node is None: - # empty nodes are neutral. - return - node_kind = node.classify() - if ( - node_kind == dns.node.NodeKind.CNAME - and rdataset_kind == dns.node.NodeKind.REGULAR - ): - raise CNAMEAndOtherData("rdataset type is not compatible with a CNAME node") - elif ( - node_kind == dns.node.NodeKind.REGULAR - and rdataset_kind == dns.node.NodeKind.CNAME - ): - raise CNAMEAndOtherData( - "CNAME rdataset is not compatible with a regular data node" - ) - # Otherwise at least one of the node and the rdataset is neutral, so - # adding the rdataset is ok - - -SavedStateType = Tuple[ - dns.tokenizer.Tokenizer, - Optional[dns.name.Name], # current_origin - Optional[dns.name.Name], # last_name - Optional[Any], # current_file - int, # last_ttl - bool, # last_ttl_known - int, # default_ttl - bool, -] # default_ttl_known - - -def _upper_dollarize(s): - s = s.upper() - if not s.startswith("$"): - s = "$" + s - return s - - -class Reader: - """Read a DNS zone file into a transaction.""" - - def __init__( - self, - tok: dns.tokenizer.Tokenizer, - rdclass: dns.rdataclass.RdataClass, - txn: dns.transaction.Transaction, - allow_include: bool = False, - allow_directives: Union[bool, Iterable[str]] = True, - force_name: Optional[dns.name.Name] = None, - force_ttl: Optional[int] = None, - force_rdclass: Optional[dns.rdataclass.RdataClass] = None, - force_rdtype: Optional[dns.rdatatype.RdataType] = None, - default_ttl: Optional[int] = None, - ): - self.tok = tok - (self.zone_origin, self.relativize, _) = txn.manager.origin_information() - self.current_origin = self.zone_origin - self.last_ttl = 0 - self.last_ttl_known = False - if force_ttl is not None: - default_ttl = force_ttl - if default_ttl is None: - self.default_ttl = 0 - self.default_ttl_known = False - else: - self.default_ttl = default_ttl - self.default_ttl_known = True - self.last_name = self.current_origin - self.zone_rdclass = rdclass - self.txn = txn - self.saved_state: List[SavedStateType] = [] - self.current_file: Optional[Any] = None - self.allowed_directives: Set[str] - if allow_directives is True: - self.allowed_directives = {"$GENERATE", "$ORIGIN", "$TTL"} - if allow_include: - self.allowed_directives.add("$INCLUDE") - elif allow_directives is False: - # allow_include was ignored in earlier releases if allow_directives was - # False, so we continue that. - self.allowed_directives = set() - else: - # Note that if directives are explicitly specified, then allow_include - # is ignored. - self.allowed_directives = set(_upper_dollarize(d) for d in allow_directives) - self.force_name = force_name - self.force_ttl = force_ttl - self.force_rdclass = force_rdclass - self.force_rdtype = force_rdtype - self.txn.check_put_rdataset(_check_cname_and_other_data) - - def _eat_line(self): - while 1: - token = self.tok.get() - if token.is_eol_or_eof(): - break - - def _get_identifier(self): - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - return token - - def _rr_line(self): - """Process one line from a DNS zone file.""" - token = None - # Name - if self.force_name is not None: - name = self.force_name - else: - if self.current_origin is None: - raise UnknownOrigin - token = self.tok.get(want_leading=True) - if not token.is_whitespace(): - self.last_name = self.tok.as_name(token, self.current_origin) - else: - token = self.tok.get() - if token.is_eol_or_eof(): - # treat leading WS followed by EOL/EOF as if they were EOL/EOF. - return - self.tok.unget(token) - name = self.last_name - if not name.is_subdomain(self.zone_origin): - self._eat_line() - return - if self.relativize: - name = name.relativize(self.zone_origin) - - # TTL - if self.force_ttl is not None: - ttl = self.force_ttl - self.last_ttl = ttl - self.last_ttl_known = True - else: - token = self._get_identifier() - ttl = None - try: - ttl = dns.ttl.from_text(token.value) - self.last_ttl = ttl - self.last_ttl_known = True - token = None - except dns.ttl.BadTTL: - self.tok.unget(token) - - # Class - if self.force_rdclass is not None: - rdclass = self.force_rdclass - else: - token = self._get_identifier() - try: - rdclass = dns.rdataclass.from_text(token.value) - except dns.exception.SyntaxError: - raise - except Exception: - rdclass = self.zone_rdclass - self.tok.unget(token) - if rdclass != self.zone_rdclass: - raise dns.exception.SyntaxError("RR class is not zone's class") - - if ttl is None: - # support for syntax - token = self._get_identifier() - ttl = None - try: - ttl = dns.ttl.from_text(token.value) - self.last_ttl = ttl - self.last_ttl_known = True - token = None - except dns.ttl.BadTTL: - if self.default_ttl_known: - ttl = self.default_ttl - elif self.last_ttl_known: - ttl = self.last_ttl - self.tok.unget(token) - - # Type - if self.force_rdtype is not None: - rdtype = self.force_rdtype - else: - token = self._get_identifier() - try: - rdtype = dns.rdatatype.from_text(token.value) - except Exception: - raise dns.exception.SyntaxError(f"unknown rdatatype '{token.value}'") - - try: - rd = dns.rdata.from_text( - rdclass, - rdtype, - self.tok, - self.current_origin, - self.relativize, - self.zone_origin, - ) - except dns.exception.SyntaxError: - # Catch and reraise. - raise - except Exception: - # All exceptions that occur in the processing of rdata - # are treated as syntax errors. This is not strictly - # correct, but it is correct almost all of the time. - # We convert them to syntax errors so that we can emit - # helpful filename:line info. - (ty, va) = sys.exc_info()[:2] - raise dns.exception.SyntaxError(f"caught exception {str(ty)}: {str(va)}") - - if not self.default_ttl_known and rdtype == dns.rdatatype.SOA: - # The pre-RFC2308 and pre-BIND9 behavior inherits the zone default - # TTL from the SOA minttl if no $TTL statement is present before the - # SOA is parsed. - self.default_ttl = rd.minimum - self.default_ttl_known = True - if ttl is None: - # if we didn't have a TTL on the SOA, set it! - ttl = rd.minimum - - # TTL check. We had to wait until now to do this as the SOA RR's - # own TTL can be inferred from its minimum. - if ttl is None: - raise dns.exception.SyntaxError("Missing default TTL value") - - self.txn.add(name, ttl, rd) - - def _parse_modify(self, side: str) -> Tuple[str, str, int, int, str]: - # Here we catch everything in '{' '}' in a group so we can replace it - # with ''. - is_generate1 = re.compile(r"^.*\$({(\+|-?)(\d+),(\d+),(.)}).*$") - is_generate2 = re.compile(r"^.*\$({(\+|-?)(\d+)}).*$") - is_generate3 = re.compile(r"^.*\$({(\+|-?)(\d+),(\d+)}).*$") - # Sometimes there are modifiers in the hostname. These come after - # the dollar sign. They are in the form: ${offset[,width[,base]]}. - # Make names - mod = "" - sign = "+" - offset = "0" - width = "0" - base = "d" - g1 = is_generate1.match(side) - if g1: - mod, sign, offset, width, base = g1.groups() - if sign == "": - sign = "+" - else: - g2 = is_generate2.match(side) - if g2: - mod, sign, offset = g2.groups() - if sign == "": - sign = "+" - width = "0" - base = "d" - else: - g3 = is_generate3.match(side) - if g3: - mod, sign, offset, width = g3.groups() - if sign == "": - sign = "+" - base = "d" - - ioffset = int(offset) - iwidth = int(width) - - if sign not in ["+", "-"]: - raise dns.exception.SyntaxError(f"invalid offset sign {sign}") - if base not in ["d", "o", "x", "X", "n", "N"]: - raise dns.exception.SyntaxError(f"invalid type {base}") - - return mod, sign, ioffset, iwidth, base - - def _generate_line(self): - # range lhs [ttl] [class] type rhs [ comment ] - """Process one line containing the GENERATE statement from a DNS - zone file.""" - if self.current_origin is None: - raise UnknownOrigin - - token = self.tok.get() - # Range (required) - try: - start, stop, step = dns.grange.from_text(token.value) - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except Exception: - raise dns.exception.SyntaxError - - # lhs (required) - try: - lhs = token.value - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except Exception: - raise dns.exception.SyntaxError - - # TTL - try: - ttl = dns.ttl.from_text(token.value) - self.last_ttl = ttl - self.last_ttl_known = True - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except dns.ttl.BadTTL: - if not (self.last_ttl_known or self.default_ttl_known): - raise dns.exception.SyntaxError("Missing default TTL value") - if self.default_ttl_known: - ttl = self.default_ttl - elif self.last_ttl_known: - ttl = self.last_ttl - # Class - try: - rdclass = dns.rdataclass.from_text(token.value) - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except dns.exception.SyntaxError: - raise dns.exception.SyntaxError - except Exception: - rdclass = self.zone_rdclass - if rdclass != self.zone_rdclass: - raise dns.exception.SyntaxError("RR class is not zone's class") - # Type - try: - rdtype = dns.rdatatype.from_text(token.value) - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError - except Exception: - raise dns.exception.SyntaxError(f"unknown rdatatype '{token.value}'") - - # rhs (required) - rhs = token.value - - def _calculate_index(counter: int, offset_sign: str, offset: int) -> int: - """Calculate the index from the counter and offset.""" - if offset_sign == "-": - offset *= -1 - return counter + offset - - def _format_index(index: int, base: str, width: int) -> str: - """Format the index with the given base, and zero-fill it - to the given width.""" - if base in ["d", "o", "x", "X"]: - return format(index, base).zfill(width) - - # base can only be n or N here - hexa = _format_index(index, "x", width) - nibbles = ".".join(hexa[::-1])[:width] - if base == "N": - nibbles = nibbles.upper() - return nibbles - - lmod, lsign, loffset, lwidth, lbase = self._parse_modify(lhs) - rmod, rsign, roffset, rwidth, rbase = self._parse_modify(rhs) - for i in range(start, stop + 1, step): - # +1 because bind is inclusive and python is exclusive - - lindex = _calculate_index(i, lsign, loffset) - rindex = _calculate_index(i, rsign, roffset) - - lzfindex = _format_index(lindex, lbase, lwidth) - rzfindex = _format_index(rindex, rbase, rwidth) - - name = lhs.replace(f"${lmod}", lzfindex) - rdata = rhs.replace(f"${rmod}", rzfindex) - - self.last_name = dns.name.from_text( - name, self.current_origin, self.tok.idna_codec - ) - name = self.last_name - if not name.is_subdomain(self.zone_origin): - self._eat_line() - return - if self.relativize: - name = name.relativize(self.zone_origin) - - try: - rd = dns.rdata.from_text( - rdclass, - rdtype, - rdata, - self.current_origin, - self.relativize, - self.zone_origin, - ) - except dns.exception.SyntaxError: - # Catch and reraise. - raise - except Exception: - # All exceptions that occur in the processing of rdata - # are treated as syntax errors. This is not strictly - # correct, but it is correct almost all of the time. - # We convert them to syntax errors so that we can emit - # helpful filename:line info. - (ty, va) = sys.exc_info()[:2] - raise dns.exception.SyntaxError( - f"caught exception {str(ty)}: {str(va)}" - ) - - self.txn.add(name, ttl, rd) - - def read(self) -> None: - """Read a DNS zone file and build a zone object. - - @raises dns.zone.NoSOA: No SOA RR was found at the zone origin - @raises dns.zone.NoNS: No NS RRset was found at the zone origin - """ - - try: - while 1: - token = self.tok.get(True, True) - if token.is_eof(): - if self.current_file is not None: - self.current_file.close() - if len(self.saved_state) > 0: - ( - self.tok, - self.current_origin, - self.last_name, - self.current_file, - self.last_ttl, - self.last_ttl_known, - self.default_ttl, - self.default_ttl_known, - ) = self.saved_state.pop(-1) - continue - break - elif token.is_eol(): - continue - elif token.is_comment(): - self.tok.get_eol() - continue - elif token.value[0] == "$" and len(self.allowed_directives) > 0: - # Note that we only run directive processing code if at least - # one directive is allowed in order to be backwards compatible - c = token.value.upper() - if c not in self.allowed_directives: - raise dns.exception.SyntaxError( - f"zone file directive '{c}' is not allowed" - ) - if c == "$TTL": - token = self.tok.get() - if not token.is_identifier(): - raise dns.exception.SyntaxError("bad $TTL") - self.default_ttl = dns.ttl.from_text(token.value) - self.default_ttl_known = True - self.tok.get_eol() - elif c == "$ORIGIN": - self.current_origin = self.tok.get_name() - self.tok.get_eol() - if self.zone_origin is None: - self.zone_origin = self.current_origin - self.txn._set_origin(self.current_origin) - elif c == "$INCLUDE": - token = self.tok.get() - filename = token.value - token = self.tok.get() - new_origin: Optional[dns.name.Name] - if token.is_identifier(): - new_origin = dns.name.from_text( - token.value, self.current_origin, self.tok.idna_codec - ) - self.tok.get_eol() - elif not token.is_eol_or_eof(): - raise dns.exception.SyntaxError("bad origin in $INCLUDE") - else: - new_origin = self.current_origin - self.saved_state.append( - ( - self.tok, - self.current_origin, - self.last_name, - self.current_file, - self.last_ttl, - self.last_ttl_known, - self.default_ttl, - self.default_ttl_known, - ) - ) - self.current_file = open(filename) - self.tok = dns.tokenizer.Tokenizer(self.current_file, filename) - self.current_origin = new_origin - elif c == "$GENERATE": - self._generate_line() - else: - raise dns.exception.SyntaxError( - f"Unknown zone file directive '{c}'" - ) - continue - self.tok.unget(token) - self._rr_line() - except dns.exception.SyntaxError as detail: - (filename, line_number) = self.tok.where() - if detail is None: - detail = "syntax error" - ex = dns.exception.SyntaxError( - "%s:%d: %s" % (filename, line_number, detail) - ) - tb = sys.exc_info()[2] - raise ex.with_traceback(tb) from None - - -class RRsetsReaderTransaction(dns.transaction.Transaction): - def __init__(self, manager, replacement, read_only): - assert not read_only - super().__init__(manager, replacement, read_only) - self.rdatasets = {} - - def _get_rdataset(self, name, rdtype, covers): - return self.rdatasets.get((name, rdtype, covers)) - - def _get_node(self, name): - rdatasets = [] - for (rdataset_name, _, _), rdataset in self.rdatasets.items(): - if name == rdataset_name: - rdatasets.append(rdataset) - if len(rdatasets) == 0: - return None - node = dns.node.Node() - node.rdatasets = rdatasets - return node - - def _put_rdataset(self, name, rdataset): - self.rdatasets[(name, rdataset.rdtype, rdataset.covers)] = rdataset - - def _delete_name(self, name): - # First remove any changes involving the name - remove = [] - for key in self.rdatasets: - if key[0] == name: - remove.append(key) - if len(remove) > 0: - for key in remove: - del self.rdatasets[key] - - def _delete_rdataset(self, name, rdtype, covers): - try: - del self.rdatasets[(name, rdtype, covers)] - except KeyError: - pass - - def _name_exists(self, name): - for n, _, _ in self.rdatasets: - if n == name: - return True - return False - - def _changed(self): - return len(self.rdatasets) > 0 - - def _end_transaction(self, commit): - if commit and self._changed(): - rrsets = [] - for (name, _, _), rdataset in self.rdatasets.items(): - rrset = dns.rrset.RRset( - name, rdataset.rdclass, rdataset.rdtype, rdataset.covers - ) - rrset.update(rdataset) - rrsets.append(rrset) - self.manager.set_rrsets(rrsets) - - def _set_origin(self, origin): - pass - - def _iterate_rdatasets(self): - raise NotImplementedError # pragma: no cover - - def _iterate_names(self): - raise NotImplementedError # pragma: no cover - - -class RRSetsReaderManager(dns.transaction.TransactionManager): - def __init__( - self, origin=dns.name.root, relativize=False, rdclass=dns.rdataclass.IN - ): - self.origin = origin - self.relativize = relativize - self.rdclass = rdclass - self.rrsets = [] - - def reader(self): # pragma: no cover - raise NotImplementedError - - def writer(self, replacement=False): - assert replacement is True - return RRsetsReaderTransaction(self, True, False) - - def get_class(self): - return self.rdclass - - def origin_information(self): - if self.relativize: - effective = dns.name.empty - else: - effective = self.origin - return (self.origin, self.relativize, effective) - - def set_rrsets(self, rrsets): - self.rrsets = rrsets - - -def read_rrsets( - text: Any, - name: Optional[Union[dns.name.Name, str]] = None, - ttl: Optional[int] = None, - rdclass: Optional[Union[dns.rdataclass.RdataClass, str]] = dns.rdataclass.IN, - default_rdclass: Union[dns.rdataclass.RdataClass, str] = dns.rdataclass.IN, - rdtype: Optional[Union[dns.rdatatype.RdataType, str]] = None, - default_ttl: Optional[Union[int, str]] = None, - idna_codec: Optional[dns.name.IDNACodec] = None, - origin: Optional[Union[dns.name.Name, str]] = dns.name.root, - relativize: bool = False, -) -> List[dns.rrset.RRset]: - """Read one or more rrsets from the specified text, possibly subject - to restrictions. - - *text*, a file object or a string, is the input to process. - - *name*, a string, ``dns.name.Name``, or ``None``, is the owner name of - the rrset. If not ``None``, then the owner name is "forced", and the - input must not specify an owner name. If ``None``, then any owner names - are allowed and must be present in the input. - - *ttl*, an ``int``, string, or None. If not ``None``, the the TTL is - forced to be the specified value and the input must not specify a TTL. - If ``None``, then a TTL may be specified in the input. If it is not - specified, then the *default_ttl* will be used. - - *rdclass*, a ``dns.rdataclass.RdataClass``, string, or ``None``. If - not ``None``, then the class is forced to the specified value, and the - input must not specify a class. If ``None``, then the input may specify - a class that matches *default_rdclass*. Note that it is not possible to - return rrsets with differing classes; specifying ``None`` for the class - simply allows the user to optionally type a class as that may be convenient - when cutting and pasting. - - *default_rdclass*, a ``dns.rdataclass.RdataClass`` or string. The class - of the returned rrsets. - - *rdtype*, a ``dns.rdatatype.RdataType``, string, or ``None``. If not - ``None``, then the type is forced to the specified value, and the - input must not specify a type. If ``None``, then a type must be present - for each RR. - - *default_ttl*, an ``int``, string, or ``None``. If not ``None``, then if - the TTL is not forced and is not specified, then this value will be used. - if ``None``, then if the TTL is not forced an error will occur if the TTL - is not specified. - - *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA - encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder - is used. Note that codecs only apply to the owner name; dnspython does - not do IDNA for names in rdata, as there is no IDNA zonefile format. - - *origin*, a string, ``dns.name.Name``, or ``None``, is the origin for any - relative names in the input, and also the origin to relativize to if - *relativize* is ``True``. - - *relativize*, a bool. If ``True``, names are relativized to the *origin*; - if ``False`` then any relative names in the input are made absolute by - appending the *origin*. - """ - if isinstance(origin, str): - origin = dns.name.from_text(origin, dns.name.root, idna_codec) - if isinstance(name, str): - name = dns.name.from_text(name, origin, idna_codec) - if isinstance(ttl, str): - ttl = dns.ttl.from_text(ttl) - if isinstance(default_ttl, str): - default_ttl = dns.ttl.from_text(default_ttl) - if rdclass is not None: - rdclass = dns.rdataclass.RdataClass.make(rdclass) - else: - rdclass = None - default_rdclass = dns.rdataclass.RdataClass.make(default_rdclass) - if rdtype is not None: - rdtype = dns.rdatatype.RdataType.make(rdtype) - else: - rdtype = None - manager = RRSetsReaderManager(origin, relativize, default_rdclass) - with manager.writer(True) as txn: - tok = dns.tokenizer.Tokenizer(text, "", idna_codec=idna_codec) - reader = Reader( - tok, - default_rdclass, - txn, - allow_directives=False, - force_name=name, - force_ttl=ttl, - force_rdclass=rdclass, - force_rdtype=rdtype, - default_ttl=default_ttl, - ) - reader.read() - return manager.rrsets diff --git a/write-message/venv/lib/python3.10/site-packages/dns/zonetypes.py b/write-message/venv/lib/python3.10/site-packages/dns/zonetypes.py deleted file mode 100644 index 195ee2e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dns/zonetypes.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license - -"""Common zone-related types.""" - -# This is a separate file to avoid import circularity between dns.zone and -# the implementation of the ZONEMD type. - -import hashlib - -import dns.enum - - -class DigestScheme(dns.enum.IntEnum): - """ZONEMD Scheme""" - - SIMPLE = 1 - - @classmethod - def _maximum(cls): - return 255 - - -class DigestHashAlgorithm(dns.enum.IntEnum): - """ZONEMD Hash Algorithm""" - - SHA384 = 1 - SHA512 = 2 - - @classmethod - def _maximum(cls): - return 255 - - -_digest_hashers = { - DigestHashAlgorithm.SHA384: hashlib.sha384, - DigestHashAlgorithm.SHA512: hashlib.sha512, -} diff --git a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/METADATA deleted file mode 100644 index ca4a4f4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/METADATA +++ /dev/null @@ -1,149 +0,0 @@ -Metadata-Version: 2.3 -Name: dnspython -Version: 2.7.0 -Summary: DNS toolkit -Project-URL: homepage, https://www.dnspython.org -Project-URL: repository, https://github.com/rthalley/dnspython.git -Project-URL: documentation, https://dnspython.readthedocs.io/en/stable/ -Project-URL: issues, https://github.com/rthalley/dnspython/issues -Author-email: Bob Halley -License: ISC -License-File: LICENSE -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: ISC License (ISCL) -Classifier: Operating System :: Microsoft :: Windows -Classifier: Operating System :: POSIX -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -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 :: 3.13 -Classifier: Topic :: Internet :: Name Service (DNS) -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Requires-Python: >=3.9 -Provides-Extra: dev -Requires-Dist: black>=23.1.0; extra == 'dev' -Requires-Dist: coverage>=7.0; extra == 'dev' -Requires-Dist: flake8>=7; extra == 'dev' -Requires-Dist: hypercorn>=0.16.0; extra == 'dev' -Requires-Dist: mypy>=1.8; extra == 'dev' -Requires-Dist: pylint>=3; extra == 'dev' -Requires-Dist: pytest-cov>=4.1.0; extra == 'dev' -Requires-Dist: pytest>=7.4; extra == 'dev' -Requires-Dist: quart-trio>=0.11.0; extra == 'dev' -Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == 'dev' -Requires-Dist: sphinx>=7.2.0; extra == 'dev' -Requires-Dist: twine>=4.0.0; extra == 'dev' -Requires-Dist: wheel>=0.42.0; extra == 'dev' -Provides-Extra: dnssec -Requires-Dist: cryptography>=43; extra == 'dnssec' -Provides-Extra: doh -Requires-Dist: h2>=4.1.0; extra == 'doh' -Requires-Dist: httpcore>=1.0.0; extra == 'doh' -Requires-Dist: httpx>=0.26.0; extra == 'doh' -Provides-Extra: doq -Requires-Dist: aioquic>=1.0.0; extra == 'doq' -Provides-Extra: idna -Requires-Dist: idna>=3.7; extra == 'idna' -Provides-Extra: trio -Requires-Dist: trio>=0.23; extra == 'trio' -Provides-Extra: wmi -Requires-Dist: wmi>=1.5.1; extra == 'wmi' -Description-Content-Type: text/markdown - -# dnspython - -[![Build Status](https://github.com/rthalley/dnspython/actions/workflows/ci.yml/badge.svg)](https://github.com/rthalley/dnspython/actions/) -[![Documentation Status](https://readthedocs.org/projects/dnspython/badge/?version=latest)](https://dnspython.readthedocs.io/en/latest/?badge=latest) -[![PyPI version](https://badge.fury.io/py/dnspython.svg)](https://badge.fury.io/py/dnspython) -[![License: ISC](https://img.shields.io/badge/License-ISC-brightgreen.svg)](https://opensource.org/licenses/ISC) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) - -## INTRODUCTION - -dnspython is a DNS toolkit for Python. It supports almost all record types. It -can be used for queries, zone transfers, and dynamic updates. It supports TSIG -authenticated messages and EDNS0. - -dnspython provides both high and low level access to DNS. The high level classes -perform queries for data of a given name, type, and class, and return an answer -set. The low level classes allow direct manipulation of DNS zones, messages, -names, and records. - -To see a few of the ways dnspython can be used, look in the `examples/` -directory. - -dnspython is a utility to work with DNS, `/etc/hosts` is thus not used. For -simple forward DNS lookups, it's better to use `socket.getaddrinfo()` or -`socket.gethostbyname()`. - -dnspython originated at Nominum where it was developed -to facilitate the testing of DNS software. - -## ABOUT THIS RELEASE - -This is dnspython 2.7.0. -Please read -[What's New](https://dnspython.readthedocs.io/en/stable/whatsnew.html) for -information about the changes in this release. - -## INSTALLATION - -* Many distributions have dnspython packaged for you, so you should - check there first. -* To use a wheel downloaded from PyPi, run: - - pip install dnspython - -* To install from the source code, go into the top-level of the source code - and run: - -``` - pip install --upgrade pip build - python -m build - pip install dist/*.whl -``` - -* To install the latest from the main branch, run `pip install git+https://github.com/rthalley/dnspython.git` - -Dnspython's default installation does not depend on any modules other than -those in the Python standard library. To use some features, additional modules -must be installed. For convenience, pip options are defined for the -requirements. - -If you want to use DNS-over-HTTPS, run -`pip install dnspython[doh]`. - -If you want to use DNSSEC functionality, run -`pip install dnspython[dnssec]`. - -If you want to use internationalized domain names (IDNA) -functionality, you must run -`pip install dnspython[idna]` - -If you want to use the Trio asynchronous I/O package, run -`pip install dnspython[trio]`. - -If you want to use WMI on Windows to determine the active DNS settings -instead of the default registry scanning method, run -`pip install dnspython[wmi]`. - -If you want to try the experimental DNS-over-QUIC code, run -`pip install dnspython[doq]`. - -Note that you can install any combination of the above, e.g.: -`pip install dnspython[doh,dnssec,idna]` - -### Notices - -Python 2.x support ended with the release of 1.16.0. Dnspython 2.6.x supports -Python 3.8 and later, though support for 3.8 ends on October 14, 2024. -Dnspython 2.7.x supports Python 3.9 and later. Future support is aligned with the -lifetime of the Python 3 versions. - -Documentation has moved to -[dnspython.readthedocs.io](https://dnspython.readthedocs.io). diff --git a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/RECORD deleted file mode 100644 index fffd335..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/RECORD +++ /dev/null @@ -1,294 +0,0 @@ -dns/__init__.py,sha256=YJZtDG14Idw5ui3h1nWooSwPM9gsxQgB8M0GBZ3aly0,1663 -dns/__pycache__/__init__.cpython-310.pyc,, -dns/__pycache__/_asyncbackend.cpython-310.pyc,, -dns/__pycache__/_asyncio_backend.cpython-310.pyc,, -dns/__pycache__/_ddr.cpython-310.pyc,, -dns/__pycache__/_features.cpython-310.pyc,, -dns/__pycache__/_immutable_ctx.cpython-310.pyc,, -dns/__pycache__/_trio_backend.cpython-310.pyc,, -dns/__pycache__/asyncbackend.cpython-310.pyc,, -dns/__pycache__/asyncquery.cpython-310.pyc,, -dns/__pycache__/asyncresolver.cpython-310.pyc,, -dns/__pycache__/dnssec.cpython-310.pyc,, -dns/__pycache__/dnssectypes.cpython-310.pyc,, -dns/__pycache__/e164.cpython-310.pyc,, -dns/__pycache__/edns.cpython-310.pyc,, -dns/__pycache__/entropy.cpython-310.pyc,, -dns/__pycache__/enum.cpython-310.pyc,, -dns/__pycache__/exception.cpython-310.pyc,, -dns/__pycache__/flags.cpython-310.pyc,, -dns/__pycache__/grange.cpython-310.pyc,, -dns/__pycache__/immutable.cpython-310.pyc,, -dns/__pycache__/inet.cpython-310.pyc,, -dns/__pycache__/ipv4.cpython-310.pyc,, -dns/__pycache__/ipv6.cpython-310.pyc,, -dns/__pycache__/message.cpython-310.pyc,, -dns/__pycache__/name.cpython-310.pyc,, -dns/__pycache__/namedict.cpython-310.pyc,, -dns/__pycache__/nameserver.cpython-310.pyc,, -dns/__pycache__/node.cpython-310.pyc,, -dns/__pycache__/opcode.cpython-310.pyc,, -dns/__pycache__/query.cpython-310.pyc,, -dns/__pycache__/rcode.cpython-310.pyc,, -dns/__pycache__/rdata.cpython-310.pyc,, -dns/__pycache__/rdataclass.cpython-310.pyc,, -dns/__pycache__/rdataset.cpython-310.pyc,, -dns/__pycache__/rdatatype.cpython-310.pyc,, -dns/__pycache__/renderer.cpython-310.pyc,, -dns/__pycache__/resolver.cpython-310.pyc,, -dns/__pycache__/reversename.cpython-310.pyc,, -dns/__pycache__/rrset.cpython-310.pyc,, -dns/__pycache__/serial.cpython-310.pyc,, -dns/__pycache__/set.cpython-310.pyc,, -dns/__pycache__/tokenizer.cpython-310.pyc,, -dns/__pycache__/transaction.cpython-310.pyc,, -dns/__pycache__/tsig.cpython-310.pyc,, -dns/__pycache__/tsigkeyring.cpython-310.pyc,, -dns/__pycache__/ttl.cpython-310.pyc,, -dns/__pycache__/update.cpython-310.pyc,, -dns/__pycache__/version.cpython-310.pyc,, -dns/__pycache__/versioned.cpython-310.pyc,, -dns/__pycache__/win32util.cpython-310.pyc,, -dns/__pycache__/wire.cpython-310.pyc,, -dns/__pycache__/xfr.cpython-310.pyc,, -dns/__pycache__/zone.cpython-310.pyc,, -dns/__pycache__/zonefile.cpython-310.pyc,, -dns/__pycache__/zonetypes.cpython-310.pyc,, -dns/_asyncbackend.py,sha256=pamIAWJ73e7ic2u7Q3RJyG6_6L8t78ccttvi65682MM,2396 -dns/_asyncio_backend.py,sha256=iLqhcUXqnFWC_2tcAp9U00NOGxT5GKPn4qeXS4iKaro,9051 -dns/_ddr.py,sha256=rHXKC8kncCTT9N4KBh1flicl79nyDjQ-DDvq30MJ3B8,5247 -dns/_features.py,sha256=Ig_leAKUT9RDiOVOfA0nXmmqpiPfnOnP9TcxlISUGSk,2492 -dns/_immutable_ctx.py,sha256=gtoCLMmdHXI23zt5lRSIS3A4Ca3jZJngebdoFFOtiwU,2459 -dns/_trio_backend.py,sha256=IXNdUP1MUBPyZRgAFhGH71KHtUCh3Rm5dM8SX4bMj2U,8473 -dns/asyncbackend.py,sha256=82fXTFls_m7F_ekQbgUGOkoBbs4BI-GBLDZAWNGUvJ0,2796 -dns/asyncquery.py,sha256=PMZ_D4Z8vgSioWHftyxNw7eax1IqrPleqY5FIi40hd8,30821 -dns/asyncresolver.py,sha256=GD86dCyW9YGKs6SggWXwBKEXifW7Qdx4cEAGFKY6fA4,17852 -dns/dnssec.py,sha256=gXmIrbKK1t1hE8ht-WlhUc0giy1PpLYj07r6o0pVATY,41717 -dns/dnssecalgs/__init__.py,sha256=OWvTadxZ3oF5PxVGodNimxBt_-3YUNTOSV62HrIb4PQ,4331 -dns/dnssecalgs/__pycache__/__init__.cpython-310.pyc,, -dns/dnssecalgs/__pycache__/base.cpython-310.pyc,, -dns/dnssecalgs/__pycache__/cryptography.cpython-310.pyc,, -dns/dnssecalgs/__pycache__/dsa.cpython-310.pyc,, -dns/dnssecalgs/__pycache__/ecdsa.cpython-310.pyc,, -dns/dnssecalgs/__pycache__/eddsa.cpython-310.pyc,, -dns/dnssecalgs/__pycache__/rsa.cpython-310.pyc,, -dns/dnssecalgs/base.py,sha256=jlTV_nd1Nqkvqyf-FVHIccXKFrE2LL6GVu6AW8QUh2E,2513 -dns/dnssecalgs/cryptography.py,sha256=3uqMfRm-zCkJPOrxUqlu9CmdxIMy71dVor9eAHi0wZM,2425 -dns/dnssecalgs/dsa.py,sha256=DNO68g_lbG7_oKcDN8c2xuzYRPbLaZc9Ns7oQoa0Vbc,3564 -dns/dnssecalgs/ecdsa.py,sha256=RfvFKRNExsYgd5SoXXRxMHkoBeF2Gktkz2rOwObEYAY,3172 -dns/dnssecalgs/eddsa.py,sha256=7VGARpVUzIYRjPh0gFapTPFzmsK8WJDqDZDLw2KLc8w,1981 -dns/dnssecalgs/rsa.py,sha256=_tNABpr6iwd8STBEHYIXfyLrgBpRNCj8K0UQj32_kOU,3622 -dns/dnssectypes.py,sha256=CyeuGTS_rM3zXr8wD9qMT9jkzvVfTY2JWckUcogG83E,1799 -dns/e164.py,sha256=EsK8cnOtOx7kQ0DmSwibcwkzp6efMWjbRiTyHZO8Q-M,3978 -dns/edns.py,sha256=-XDhC2jr7BRLsJrpCAWShxLn-3eG1oI0HhduWhLxdMw,17089 -dns/entropy.py,sha256=qkG8hXDLzrJS6R5My26iA59c0RhPwJNzuOhOCAZU5Bw,4242 -dns/enum.py,sha256=EepaunPKixTSrascy7iAe9UQEXXxP_MB5Gx4jUpHIhg,3691 -dns/exception.py,sha256=8vjxLf4T3T77vfANe_iKVeButAEhSJve6UrPjiBzht4,5953 -dns/flags.py,sha256=cQ3kTFyvcKiWHAxI5AwchNqxVOrsIrgJ6brgrH42Wq8,2750 -dns/grange.py,sha256=D016OrOv3i44G3mb_CzPFjDk61uZ6BMRib3yJnDQvbw,2144 -dns/immutable.py,sha256=InrtpKvPxl-74oYbzsyneZwAuX78hUqeG22f2aniZbk,2017 -dns/inet.py,sha256=j6jQs3K_ehVhDv-i4jwCKePr5HpEiSzvOXQ4uhgn1sU,5772 -dns/ipv4.py,sha256=qEUXtlqWDH_blicj6VMvyQhfX7-BF0gB_lWJliV-2FI,2552 -dns/ipv6.py,sha256=Ww8ayshM6FxtQsRYdXXuKkPFTad5ZcGbBd9lr1nFct4,6554 -dns/message.py,sha256=QOtdFBEAORhTKN0uQg86uSNvthdxJx40HhMQXYCBHng,68185 -dns/name.py,sha256=Bf3170QHhLFLDnMsWeJyik4i9ucBDbIY6Bydcz8H-2o,42778 -dns/namedict.py,sha256=hJRYpKeQv6Bd2LaUOPV0L_a0eXEIuqgggPXaH4c3Tow,4000 -dns/nameserver.py,sha256=hH4LLOkB4jeyO3VDUWK0lNpMJNNt_cFYf23-HdhpSmE,10115 -dns/node.py,sha256=NGZa0AUMq-CNledJ6wn1Rx6TFYc703cH2OraLysoNWM,12663 -dns/opcode.py,sha256=I6JyuFUL0msja_BYm6bzXHfbbfqUod_69Ss4xcv8xWQ,2730 -dns/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -dns/query.py,sha256=_Ev7EivZNEpgrUiPIn4BVnDRFCizcayHHcBXt0Ju3As,56298 -dns/quic/__init__.py,sha256=S5_2UuYzSU_LLtrLAf8DHh3KqNF2YHeKJ_-Wv991WlI,2272 -dns/quic/__pycache__/__init__.cpython-310.pyc,, -dns/quic/__pycache__/_asyncio.cpython-310.pyc,, -dns/quic/__pycache__/_common.cpython-310.pyc,, -dns/quic/__pycache__/_sync.cpython-310.pyc,, -dns/quic/__pycache__/_trio.cpython-310.pyc,, -dns/quic/_asyncio.py,sha256=dnABPz5f-JOJsA7D_BdPfuyzpkL_87AaY4CUcmgNj-g,9870 -dns/quic/_common.py,sha256=koWf6rq9_gUorIOV60QZKAHwZF5MuSgQvBznzA5rGzk,10857 -dns/quic/_sync.py,sha256=QF-dW19NwiDW_BDoJZkSQmHz2uEpfgedsUKTPc0JAio,10436 -dns/quic/_trio.py,sha256=01HH4_hU1VRx-BWXl8bQo4-LZem_eKRBNy6RolTZZXY,9248 -dns/rcode.py,sha256=N6JjrIQjCdJy0boKIp8Hcky5tm__LSDscpDz3rE_sgU,4156 -dns/rdata.py,sha256=uk82eldqpWR8L2zp_CB8JG6wWWfK7zdYowWISfMC2XE,31022 -dns/rdataclass.py,sha256=TK4W4ywB1L_X7EZqk2Gmwnu7vdQpolQF5DtQWyNk5xo,2984 -dns/rdataset.py,sha256=BMNvGAzE4HfYHA-pnhsKwELfpr-saz73BzYwMucoKj0,16664 -dns/rdatatype.py,sha256=wgKWnu4mAbXnmG8wKHpV8dZHkhMqNeSsWWlWFo5HcDY,7448 -dns/rdtypes/ANY/AFSDB.py,sha256=k75wMwreF1DAfDymu4lHh16BUx7ulVP3PLeQBZnkurY,1661 -dns/rdtypes/ANY/AMTRELAY.py,sha256=19jfS61mT1CQT-8vf67ZylhDS9JVRVp4WCbFE-7l0jM,3381 -dns/rdtypes/ANY/AVC.py,sha256=SpsXYzlBirRWN0mGnQe0MdN6H8fvlgXPJX5PjOHnEak,1024 -dns/rdtypes/ANY/CAA.py,sha256=AHh59Is-4WiVWd26yovnPM3hXqKS-yx7IWfXSS0NZhE,2511 -dns/rdtypes/ANY/CDNSKEY.py,sha256=bJAdrBMsFHIJz8TF1AxZoNbdxVWBCRTG-bR_uR_r_G4,1225 -dns/rdtypes/ANY/CDS.py,sha256=Y9nIRUCAabztVLbxm2SXAdYapFemCOUuGh5JqroCDUs,1163 -dns/rdtypes/ANY/CERT.py,sha256=2Cu2LQM6-K4darqhHv1EM_blmpYpnrBIIX1GnL_rxKE,3533 -dns/rdtypes/ANY/CNAME.py,sha256=IHGGq2BDpeKUahTr1pvyBQgm0NGBI_vQ3Vs5mKTXO4w,1206 -dns/rdtypes/ANY/CSYNC.py,sha256=KkZ_rG6PfeL14il97nmJGWWmUGGS5o9nd2EqbJqOuYo,2439 -dns/rdtypes/ANY/DLV.py,sha256=J-pOrw5xXsDoaB9G0r6znlYXJtqtcqhsl1OXs6CPRU4,986 -dns/rdtypes/ANY/DNAME.py,sha256=yqXRtx4dAWwB4YCCv-qW6uaxeGhg2LPQ2uyKwWaMdXs,1150 -dns/rdtypes/ANY/DNSKEY.py,sha256=MD8HUVH5XXeAGOnFWg5aVz_w-2tXYwCeVXmzExhiIeQ,1223 -dns/rdtypes/ANY/DS.py,sha256=_gf8vk1O_uY8QXFjsfUw-bny-fm6e-QpCk3PT0JCyoM,995 -dns/rdtypes/ANY/EUI48.py,sha256=x0BkK0sY_tgzuCwfDYpw6tyuChHjjtbRpAgYhO0Y44o,1151 -dns/rdtypes/ANY/EUI64.py,sha256=1jCff2-SXHJLDnNDnMW8Cd_o-ok0P3x6zKy_bcCU5h4,1161 -dns/rdtypes/ANY/GPOS.py,sha256=u4qwiDBVoC7bsKfxDKGbPjnOKddpdjy2p1AhziDWcPw,4439 -dns/rdtypes/ANY/HINFO.py,sha256=D2WvjTsvD_XqT8BepBIyjPL2iYGMgYqb1VQa9ApO0qE,2217 -dns/rdtypes/ANY/HIP.py,sha256=c32Ewlk88schJ1nPOmT5BVR60ttIM-uH8I8LaRAkFOA,3226 -dns/rdtypes/ANY/ISDN.py,sha256=L4C2Rxrr4JJN17lmJRbZN8RhM_ujjwIskY_4V4Gd3r4,2723 -dns/rdtypes/ANY/L32.py,sha256=TMz2kdGCd0siiQZyiocVDCSnvkOdjhUuYRFyf8o622M,1286 -dns/rdtypes/ANY/L64.py,sha256=sb2BjuPA0PQt67nEyT9rBt759C9e6lH71d3EJHGGnww,1592 -dns/rdtypes/ANY/LOC.py,sha256=NZKIUJULZ3BcK1-gnb2Mk76Pc4UUZry47C5n9VBvhnk,11995 -dns/rdtypes/ANY/LP.py,sha256=wTsKIjtK6vh66qZRLSsiE0k54GO8ieVBGZH8dzVvFnE,1338 -dns/rdtypes/ANY/MX.py,sha256=qQk83idY0-SbRMDmB15JOpJi7cSyiheF-ALUD0Ev19E,995 -dns/rdtypes/ANY/NID.py,sha256=N7Xx4kXf3yVAocTlCXQeJ3BtiQNPFPQVdL1iMuyl5W4,1544 -dns/rdtypes/ANY/NINFO.py,sha256=bdL_-6Bejb2EH-xwR1rfSr_9E3SDXLTAnov7x2924FI,1041 -dns/rdtypes/ANY/NS.py,sha256=ThfaPalUlhbyZyNyvBM3k-7onl3eJKq5wCORrOGtkMM,995 -dns/rdtypes/ANY/NSEC.py,sha256=kicEYxcKaLBpV6C_M8cHdDaqBoiYl6EYtPvjyR6kExI,2465 -dns/rdtypes/ANY/NSEC3.py,sha256=696h-Zz30bmcT0n1rqoEtS5wqE6jIgsVGzaw5TfdGJo,4331 -dns/rdtypes/ANY/NSEC3PARAM.py,sha256=08p6NWS4DiLav1wOuPbxUxB9MtY2IPjfOMCtJwzzMuA,2635 -dns/rdtypes/ANY/OPENPGPKEY.py,sha256=Va0FGo_8vm1OeX62N5iDTWukAdLwrjTXIZeQ6oanE78,1851 -dns/rdtypes/ANY/OPT.py,sha256=W36RslT_Psp95OPUC70knumOYjKpaRHvGT27I-NV2qc,2561 -dns/rdtypes/ANY/PTR.py,sha256=5HcR1D77Otyk91vVY4tmqrfZfSxSXWyWvwIW-rIH5gc,997 -dns/rdtypes/ANY/RESINFO.py,sha256=Kf2NcKbkeI5gFE1bJfQNqQCaitYyXfV_9nQYl1luUZ0,1008 -dns/rdtypes/ANY/RP.py,sha256=8doJlhjYDYiAT6KNF1mAaemJ20YJFUPvit8LOx4-I-U,2174 -dns/rdtypes/ANY/RRSIG.py,sha256=O8vwzS7ldfaj_x8DypvEGFsDSb7al-D7OEnprA3QQoo,4922 -dns/rdtypes/ANY/RT.py,sha256=2t9q3FZQ28iEyceeU25KU2Ur0T5JxELAu8BTwfOUgVw,1013 -dns/rdtypes/ANY/SMIMEA.py,sha256=6yjHuVDfIEodBU9wxbCGCDZ5cWYwyY6FCk-aq2VNU0s,222 -dns/rdtypes/ANY/SOA.py,sha256=Cn8yrag1YvrvwivQgWg-KXmOCaVQVdFHSkFF77w-CE0,3145 -dns/rdtypes/ANY/SPF.py,sha256=rA3Srs9ECQx-37lqm7Zf7aYmMpp_asv4tGS8_fSQ-CU,1022 -dns/rdtypes/ANY/SSHFP.py,sha256=l6TZH2R0kytiZGWez_g-Lq94o5a2xMuwLKwUwsPMx5w,2530 -dns/rdtypes/ANY/TKEY.py,sha256=1ecTuBse2b4QPH2qmx3vn-gfPK0INcKXfxrIyAJxFHA,4927 -dns/rdtypes/ANY/TLSA.py,sha256=cytzebS3W7FFr9qeJ9gFSHq_bOwUk9aRVlXWHfnVrRs,218 -dns/rdtypes/ANY/TSIG.py,sha256=4fNQJSNWZXUKZejCciwQuUJtTw2g-YbPmqHrEj_pitg,4750 -dns/rdtypes/ANY/TXT.py,sha256=F1U9gIAhwXIV4UVT7CwOCEn_su6G1nJIdgWJsLktk20,1000 -dns/rdtypes/ANY/URI.py,sha256=dpcS8KwcJ2WJ7BkOp4CZYaUyRuw7U2S9GzvVwKUihQg,2921 -dns/rdtypes/ANY/WALLET.py,sha256=IaP2g7Nq26jWGKa8MVxvJjWXLQ0wrNR1IWJVyyMG8oU,219 -dns/rdtypes/ANY/X25.py,sha256=BzEM7uOY7CMAm7QN-dSLj-_LvgnnohwJDUjMstzwqYo,1942 -dns/rdtypes/ANY/ZONEMD.py,sha256=JQicv69EvUxh4FCT7eZSLzzU5L5brw_dSM65Um2t5lQ,2393 -dns/rdtypes/ANY/__init__.py,sha256=My5jT8T5bA66zBydmRSxkmDCFxwI81B4DBRA_S36IL8,1526 -dns/rdtypes/ANY/__pycache__/AFSDB.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/AMTRELAY.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/AVC.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/CAA.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/CDNSKEY.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/CDS.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/CERT.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/CNAME.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/CSYNC.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/DLV.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/DNAME.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/DNSKEY.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/DS.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/EUI48.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/EUI64.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/GPOS.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/HINFO.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/HIP.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/ISDN.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/L32.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/L64.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/LOC.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/LP.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/MX.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/NID.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/NINFO.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/NS.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/NSEC.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/NSEC3.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/NSEC3PARAM.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/OPENPGPKEY.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/OPT.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/PTR.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/RESINFO.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/RP.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/RRSIG.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/RT.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/SMIMEA.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/SOA.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/SPF.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/SSHFP.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/TKEY.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/TLSA.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/TSIG.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/TXT.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/URI.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/WALLET.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/X25.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/ZONEMD.cpython-310.pyc,, -dns/rdtypes/ANY/__pycache__/__init__.cpython-310.pyc,, -dns/rdtypes/CH/A.py,sha256=-4G3ASZGj7oUlPfDxADibAB1WfTsZBavUO8ghDWarJ8,2212 -dns/rdtypes/CH/__init__.py,sha256=GD9YeDKb9VBDo-J5rrChX1MWEGyQXuR9Htnbhg_iYLc,923 -dns/rdtypes/CH/__pycache__/A.cpython-310.pyc,, -dns/rdtypes/CH/__pycache__/__init__.cpython-310.pyc,, -dns/rdtypes/IN/A.py,sha256=FfFn3SqbpneL9Ky63COP50V2ZFxqS1ldCKJh39Enwug,1814 -dns/rdtypes/IN/AAAA.py,sha256=AxrOlYy-1TTTWeQypDKeXrDCrdHGor0EKCE4fxzSQGo,1820 -dns/rdtypes/IN/APL.py,sha256=ppyFwn0KYMdyDzphxd0BUhgTmZv0QnDMRLjzQQM793U,5097 -dns/rdtypes/IN/DHCID.py,sha256=zRUh_EOxUPVpJjWY5m7taX8q4Oz5K70785ZtKv5OTCU,1856 -dns/rdtypes/IN/HTTPS.py,sha256=P-IjwcvDQMmtoBgsDHglXF7KgLX73G6jEDqCKsnaGpQ,220 -dns/rdtypes/IN/IPSECKEY.py,sha256=RyIy9K0Yt0uJRjdr6cj5S95ELHHbl--0xV-Qq9O3QQk,3290 -dns/rdtypes/IN/KX.py,sha256=K1JwItL0n5G-YGFCjWeh0C9DyDD8G8VzicsBeQiNAv0,1013 -dns/rdtypes/IN/NAPTR.py,sha256=SaOK-0hIYImwLtb5Hqewi-e49ykJaQiLNvk8ZzNoG7Q,3750 -dns/rdtypes/IN/NSAP.py,sha256=6YfWCVSIPTTBmRAzG8nVBj3LnohncXUhSFJHgp-TRdc,2163 -dns/rdtypes/IN/NSAP_PTR.py,sha256=iTxlV6fr_Y9lqivLLncSHxEhmFqz5UEElDW3HMBtuCU,1015 -dns/rdtypes/IN/PX.py,sha256=vHDNN2rfLObuUKwpYDIvpPB482BqXlHA-ZQpQn9Sb_E,2756 -dns/rdtypes/IN/SRV.py,sha256=a0zGaUwzvih_a4Q9BViUTFs7NZaCqgl7mls3-KRVHm8,2769 -dns/rdtypes/IN/SVCB.py,sha256=HeFmi2v01F00Hott8FlvQ4R7aPxFmT7RF-gt45R5K_M,218 -dns/rdtypes/IN/WKS.py,sha256=kErSG5AO2qIuot_hkMHnQuZB1_uUzUirNdqBoCp97rk,3652 -dns/rdtypes/IN/__init__.py,sha256=HbI8aw9HWroI6SgEvl8Sx6FdkDswCCXMbSRuJy5o8LQ,1083 -dns/rdtypes/IN/__pycache__/A.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/AAAA.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/APL.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/DHCID.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/HTTPS.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/IPSECKEY.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/KX.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/NAPTR.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/NSAP.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/NSAP_PTR.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/PX.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/SRV.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/SVCB.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/WKS.cpython-310.pyc,, -dns/rdtypes/IN/__pycache__/__init__.cpython-310.pyc,, -dns/rdtypes/__init__.py,sha256=NYizfGglJfhqt_GMtSSXf7YQXIEHHCiJ_Y_qaLVeiOI,1073 -dns/rdtypes/__pycache__/__init__.cpython-310.pyc,, -dns/rdtypes/__pycache__/dnskeybase.cpython-310.pyc,, -dns/rdtypes/__pycache__/dsbase.cpython-310.pyc,, -dns/rdtypes/__pycache__/euibase.cpython-310.pyc,, -dns/rdtypes/__pycache__/mxbase.cpython-310.pyc,, -dns/rdtypes/__pycache__/nsbase.cpython-310.pyc,, -dns/rdtypes/__pycache__/svcbbase.cpython-310.pyc,, -dns/rdtypes/__pycache__/tlsabase.cpython-310.pyc,, -dns/rdtypes/__pycache__/txtbase.cpython-310.pyc,, -dns/rdtypes/__pycache__/util.cpython-310.pyc,, -dns/rdtypes/dnskeybase.py,sha256=FoDllfa9Pz2j2rf45VyUUYUsIt3kjjrwDy6LxrlPb5s,2856 -dns/rdtypes/dsbase.py,sha256=I85Aps1lBsiItdqGpsNY1O8icosfPtkWjiUn1J1lLUQ,3427 -dns/rdtypes/euibase.py,sha256=1yKWOM4xBwLLIFFfEj7M9JMankO2l8ljxhG-5OOxXDg,2618 -dns/rdtypes/mxbase.py,sha256=DzjbiKoAAgpqbhwMBIFGA081jR5_doqGAq-kLvy2mns,3196 -dns/rdtypes/nsbase.py,sha256=tueXVV6E8lelebOmrmoOPq47eeRvOpsxHVXH4cOFxcs,2323 -dns/rdtypes/svcbbase.py,sha256=YOH3Wz3fp5GQjdTF7hU-1ys9iDkYEC5p4d0F32ivv5g,17612 -dns/rdtypes/tlsabase.py,sha256=pIiWem6sF4IwyyKmyqx5xg55IG0w3K9r502Yx8PdziA,2596 -dns/rdtypes/txtbase.py,sha256=Dt9ptWSWtnq0Qwlni6IT6YUz_DCixQDDUl5d4P_AfqY,3696 -dns/rdtypes/util.py,sha256=c3eLaucwuxXZjXWuNyCGKzwltgub4AjT4uLVytEuxSk,9017 -dns/renderer.py,sha256=5THf1iKql2JPL2sKZt2-b4zqHKfk_vlx0FEfPtMJysY,11254 -dns/resolver.py,sha256=FH_hiMeCdVYonIYmE3QqEWJKgHOOxlTcHS0dwd_loGY,73730 -dns/reversename.py,sha256=zoqXEbMZXm6R13nXbJHgTsf6L2C6uReODj6mqSHrTiE,3828 -dns/rrset.py,sha256=J-oQPEPJuKueLLiz1FN08P-ys9fjHhPWuwpDdrL4UTQ,9170 -dns/serial.py,sha256=-t5rPW-TcJwzBMfIJo7Tl-uDtaYtpqOfCVYx9dMaDCY,3606 -dns/set.py,sha256=hublMKCIhd9zp5Hz_fvQTwF-Ze28jn7mjqei6vTGWfs,9213 -dns/tokenizer.py,sha256=65vVkEeTuml3l2AT-NePE6Gt6ucDQNvSpeIVgMpP6G0,23583 -dns/transaction.py,sha256=UhwD6CLQI51dguuz__dxJS8V91vKAoqHdQDCBErJWxE,22589 -dns/tsig.py,sha256=I-Y-c3WMBX11bVioy5puFly2BhlpptUz82ikahxuh1c,11413 -dns/tsigkeyring.py,sha256=Z0xZemcU3XjZ9HlxBYv2E2PSuIhaFreqLDlD7HcmZDA,2633 -dns/ttl.py,sha256=Y4inc4bvkfKpogZn5i1n-tpg1CAjDJxH4_HvfeVjVsM,2977 -dns/update.py,sha256=y9d6LOO8xrUaH2UrZhy3ssnx8bJEsxqTArw5V8XqBRs,12243 -dns/version.py,sha256=GTecBDFJx8cKnGiCmxJhSVjk1EkqnuNVt4xailIi3sk,1926 -dns/versioned.py,sha256=3YQj8mzGmZEsjnuVJJjcWopVmDKYLhEj4hEGTLEwzco,11765 -dns/win32util.py,sha256=r9dOvC0Tq288vwPk-ngugsVpwB5YnfW22DaRv6TTPcU,8874 -dns/wire.py,sha256=vy0SolgECbO1UXB4dnhXhDeFKOJT29nQxXvSfKOgA5s,2830 -dns/xfr.py,sha256=aoW0UtvweaE0NV8cmzgMKLYQOa3hwJ3NudRuqjit4SU,13271 -dns/zone.py,sha256=lLAarSxPtpx4Sw29OQ0ifPshD4QauGu8RnPh2dEropA,52086 -dns/zonefile.py,sha256=Y9lm6I7n4eRS35CyclooiQ_jxiOs3pSyH_0uD4FQyag,27926 -dns/zonetypes.py,sha256=HrQNZxZ_gWLWI9dskix71msi9wkYK5pgrBBbPb1T74Y,690 -dnspython-2.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -dnspython-2.7.0.dist-info/METADATA,sha256=1lF6uqZwb6RAQFYVtBkLic6pBCe9t14TQWtkK9U5eyY,5763 -dnspython-2.7.0.dist-info/RECORD,, -dnspython-2.7.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87 -dnspython-2.7.0.dist-info/licenses/LICENSE,sha256=w-o_9WVLMpwZ07xfdIGvYjw93tSmFFWFSZ-EOtPXQc0,1526 diff --git a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/WHEEL deleted file mode 100644 index cdd68a4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: hatchling 1.25.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/licenses/LICENSE b/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/licenses/LICENSE deleted file mode 100644 index 390a726..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dnspython-2.7.0.dist-info/licenses/LICENSE +++ /dev/null @@ -1,35 +0,0 @@ -ISC License - -Copyright (C) Dnspython Contributors - -Permission to use, copy, modify, and/or distribute this software for -any purpose with or without fee is hereby granted, provided that the -above copyright notice and this permission notice appear in all -copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE -AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - - - -Copyright (C) 2001-2017 Nominum, Inc. -Copyright (C) Google Inc. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose with or without fee is hereby granted, -provided that the above copyright notice and this permission notice -appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__init__.py b/write-message/venv/lib/python3.10/site-packages/dotenv/__init__.py deleted file mode 100644 index 7f4c631..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/__init__.py +++ /dev/null @@ -1,49 +0,0 @@ -from typing import Any, Optional - -from .main import (dotenv_values, find_dotenv, get_key, load_dotenv, set_key, - unset_key) - - -def load_ipython_extension(ipython: Any) -> None: - from .ipython import load_ipython_extension - load_ipython_extension(ipython) - - -def get_cli_string( - path: Optional[str] = None, - action: Optional[str] = None, - key: Optional[str] = None, - value: Optional[str] = None, - quote: Optional[str] = None, -): - """Returns a string suitable for running as a shell script. - - Useful for converting a arguments passed to a fabric task - to be passed to a `local` or `run` command. - """ - command = ['dotenv'] - if quote: - command.append(f'-q {quote}') - if path: - command.append(f'-f {path}') - if action: - command.append(action) - if key: - command.append(key) - if value: - if ' ' in value: - command.append(f'"{value}"') - else: - command.append(value) - - return ' '.join(command).strip() - - -__all__ = ['get_cli_string', - 'load_dotenv', - 'dotenv_values', - 'get_key', - 'set_key', - 'unset_key', - 'find_dotenv', - 'load_ipython_extension'] diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__main__.py b/write-message/venv/lib/python3.10/site-packages/dotenv/__main__.py deleted file mode 100644 index 3977f55..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/__main__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Entry point for cli, enables execution with `python -m dotenv`""" - -from .cli import cli - -if __name__ == "__main__": - cli() diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 6ef87e5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/__main__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/__main__.cpython-310.pyc deleted file mode 100644 index 585fd93..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/__main__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/cli.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/cli.cpython-310.pyc deleted file mode 100644 index b3ba875..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/cli.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/ipython.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/ipython.cpython-310.pyc deleted file mode 100644 index d25237d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/ipython.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/main.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/main.cpython-310.pyc deleted file mode 100644 index ededddf..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/main.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/parser.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/parser.cpython-310.pyc deleted file mode 100644 index 8d86890..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/parser.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/variables.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/variables.cpython-310.pyc deleted file mode 100644 index 9d43163..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/variables.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/version.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/version.cpython-310.pyc deleted file mode 100644 index f84990d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/dotenv/__pycache__/version.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/cli.py b/write-message/venv/lib/python3.10/site-packages/dotenv/cli.py deleted file mode 100644 index 075a7af..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/cli.py +++ /dev/null @@ -1,205 +0,0 @@ -import json -import os -import shlex -import sys -from contextlib import contextmanager -from typing import Any, Dict, IO, Iterator, List, Optional - -if sys.platform == 'win32': - from subprocess import Popen - -try: - import click -except ImportError: - sys.stderr.write('It seems python-dotenv is not installed with cli option. \n' - 'Run pip install "python-dotenv[cli]" to fix this.') - sys.exit(1) - -from .main import dotenv_values, set_key, unset_key -from .version import __version__ - - -def enumerate_env() -> Optional[str]: - """ - Return a path for the ${pwd}/.env file. - - If pwd does not exist, return None. - """ - try: - cwd = os.getcwd() - except FileNotFoundError: - return None - path = os.path.join(cwd, '.env') - return path - - -@click.group() -@click.option('-f', '--file', default=enumerate_env(), - type=click.Path(file_okay=True), - help="Location of the .env file, defaults to .env file in current working directory.") -@click.option('-q', '--quote', default='always', - type=click.Choice(['always', 'never', 'auto']), - help="Whether to quote or not the variable values. Default mode is always. This does not affect parsing.") -@click.option('-e', '--export', default=False, - type=click.BOOL, - help="Whether to write the dot file as an executable bash script.") -@click.version_option(version=__version__) -@click.pass_context -def cli(ctx: click.Context, file: Any, quote: Any, export: Any) -> None: - """This script is used to set, get or unset values from a .env file.""" - ctx.obj = {'QUOTE': quote, 'EXPORT': export, 'FILE': file} - - -@contextmanager -def stream_file(path: os.PathLike) -> Iterator[IO[str]]: - """ - Open a file and yield the corresponding (decoded) stream. - - Exits with error code 2 if the file cannot be opened. - """ - - try: - with open(path) as stream: - yield stream - except OSError as exc: - print(f"Error opening env file: {exc}", file=sys.stderr) - exit(2) - - -@cli.command() -@click.pass_context -@click.option('--format', default='simple', - type=click.Choice(['simple', 'json', 'shell', 'export']), - help="The format in which to display the list. Default format is simple, " - "which displays name=value without quotes.") -def list(ctx: click.Context, format: bool) -> None: - """Display all the stored key/value.""" - file = ctx.obj['FILE'] - - with stream_file(file) as stream: - values = dotenv_values(stream=stream) - - if format == 'json': - click.echo(json.dumps(values, indent=2, sort_keys=True)) - else: - prefix = 'export ' if format == 'export' else '' - for k in sorted(values): - v = values[k] - if v is not None: - if format in ('export', 'shell'): - v = shlex.quote(v) - click.echo(f'{prefix}{k}={v}') - - -@cli.command() -@click.pass_context -@click.argument('key', required=True) -@click.argument('value', required=True) -def set(ctx: click.Context, key: Any, value: Any) -> None: - """Store the given key/value.""" - file = ctx.obj['FILE'] - quote = ctx.obj['QUOTE'] - export = ctx.obj['EXPORT'] - success, key, value = set_key(file, key, value, quote, export) - if success: - click.echo(f'{key}={value}') - else: - exit(1) - - -@cli.command() -@click.pass_context -@click.argument('key', required=True) -def get(ctx: click.Context, key: Any) -> None: - """Retrieve the value for the given key.""" - file = ctx.obj['FILE'] - - with stream_file(file) as stream: - values = dotenv_values(stream=stream) - - stored_value = values.get(key) - if stored_value: - click.echo(stored_value) - else: - exit(1) - - -@cli.command() -@click.pass_context -@click.argument('key', required=True) -def unset(ctx: click.Context, key: Any) -> None: - """Removes the given key.""" - file = ctx.obj['FILE'] - quote = ctx.obj['QUOTE'] - success, key = unset_key(file, key, quote) - if success: - click.echo(f"Successfully removed {key}") - else: - exit(1) - - -@cli.command(context_settings={'ignore_unknown_options': True}) -@click.pass_context -@click.option( - "--override/--no-override", - default=True, - help="Override variables from the environment file with those from the .env file.", -) -@click.argument('commandline', nargs=-1, type=click.UNPROCESSED) -def run(ctx: click.Context, override: bool, commandline: List[str]) -> None: - """Run command with environment variables present.""" - file = ctx.obj['FILE'] - if not os.path.isfile(file): - raise click.BadParameter( - f'Invalid value for \'-f\' "{file}" does not exist.', - ctx=ctx - ) - dotenv_as_dict = { - k: v - for (k, v) in dotenv_values(file).items() - if v is not None and (override or k not in os.environ) - } - - if not commandline: - click.echo('No command given.') - exit(1) - run_command(commandline, dotenv_as_dict) - - -def run_command(command: List[str], env: Dict[str, str]) -> None: - """Replace the current process with the specified command. - - Replaces the current process with the specified command and the variables from `env` - added in the current environment variables. - - Parameters - ---------- - command: List[str] - The command and it's parameters - env: Dict - The additional environment variables - - Returns - ------- - None - This function does not return any value. It replaces the current process with the new one. - - """ - # copy the current environment variables and add the vales from - # `env` - cmd_env = os.environ.copy() - cmd_env.update(env) - - if sys.platform == 'win32': - # execvpe on Windows returns control immediately - # rather than once the command has finished. - p = Popen(command, - universal_newlines=True, - bufsize=0, - shell=False, - env=cmd_env) - _, _ = p.communicate() - - exit(p.returncode) - else: - os.execvpe(command[0], args=command, env=cmd_env) diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/ipython.py b/write-message/venv/lib/python3.10/site-packages/dotenv/ipython.py deleted file mode 100644 index 7df727c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/ipython.py +++ /dev/null @@ -1,39 +0,0 @@ -from IPython.core.magic import Magics, line_magic, magics_class # type: ignore -from IPython.core.magic_arguments import (argument, magic_arguments, # type: ignore - parse_argstring) # type: ignore - -from .main import find_dotenv, load_dotenv - - -@magics_class -class IPythonDotEnv(Magics): - - @magic_arguments() - @argument( - '-o', '--override', action='store_true', - help="Indicate to override existing variables" - ) - @argument( - '-v', '--verbose', action='store_true', - help="Indicate function calls to be verbose" - ) - @argument('dotenv_path', nargs='?', type=str, default='.env', - help='Search in increasingly higher folders for the `dotenv_path`') - @line_magic - def dotenv(self, line): - args = parse_argstring(self.dotenv, line) - # Locate the .env file - dotenv_path = args.dotenv_path - try: - dotenv_path = find_dotenv(dotenv_path, True, True) - except IOError: - print("cannot find .env file") - return - - # Load the .env file - load_dotenv(dotenv_path, verbose=args.verbose, override=args.override) - - -def load_ipython_extension(ipython): - """Register the %dotenv magic.""" - ipython.register_magics(IPythonDotEnv) diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/main.py b/write-message/venv/lib/python3.10/site-packages/dotenv/main.py deleted file mode 100644 index 8e6a7cf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/main.py +++ /dev/null @@ -1,400 +0,0 @@ -import io -import logging -import os -import pathlib -import shutil -import sys -import tempfile -from collections import OrderedDict -from contextlib import contextmanager -from typing import IO, Dict, Iterable, Iterator, Mapping, Optional, Tuple, Union - -from .parser import Binding, parse_stream -from .variables import parse_variables - -# A type alias for a string path to be used for the paths in this file. -# These paths may flow to `open()` and `shutil.move()`; `shutil.move()` -# only accepts string paths, not byte paths or file descriptors. See -# https://github.com/python/typeshed/pull/6832. -StrPath = Union[str, "os.PathLike[str]"] - -logger = logging.getLogger(__name__) - - -def with_warn_for_invalid_lines(mappings: Iterator[Binding]) -> Iterator[Binding]: - for mapping in mappings: - if mapping.error: - logger.warning( - "python-dotenv could not parse statement starting at line %s", - mapping.original.line, - ) - yield mapping - - -class DotEnv: - def __init__( - self, - dotenv_path: Optional[StrPath], - stream: Optional[IO[str]] = None, - verbose: bool = False, - encoding: Optional[str] = None, - interpolate: bool = True, - override: bool = True, - ) -> None: - self.dotenv_path: Optional[StrPath] = dotenv_path - self.stream: Optional[IO[str]] = stream - self._dict: Optional[Dict[str, Optional[str]]] = None - self.verbose: bool = verbose - self.encoding: Optional[str] = encoding - self.interpolate: bool = interpolate - self.override: bool = override - - @contextmanager - def _get_stream(self) -> Iterator[IO[str]]: - if self.dotenv_path and os.path.isfile(self.dotenv_path): - with open(self.dotenv_path, encoding=self.encoding) as stream: - yield stream - elif self.stream is not None: - yield self.stream - else: - if self.verbose: - logger.info( - "python-dotenv could not find configuration file %s.", - self.dotenv_path or ".env", - ) - yield io.StringIO("") - - def dict(self) -> Dict[str, Optional[str]]: - """Return dotenv as dict""" - if self._dict: - return self._dict - - raw_values = self.parse() - - if self.interpolate: - self._dict = OrderedDict( - resolve_variables(raw_values, override=self.override) - ) - else: - self._dict = OrderedDict(raw_values) - - return self._dict - - def parse(self) -> Iterator[Tuple[str, Optional[str]]]: - with self._get_stream() as stream: - for mapping in with_warn_for_invalid_lines(parse_stream(stream)): - if mapping.key is not None: - yield mapping.key, mapping.value - - def set_as_environment_variables(self) -> bool: - """ - Load the current dotenv as system environment variable. - """ - if not self.dict(): - return False - - for k, v in self.dict().items(): - if k in os.environ and not self.override: - continue - if v is not None: - os.environ[k] = v - - return True - - def get(self, key: str) -> Optional[str]: - """ """ - data = self.dict() - - if key in data: - return data[key] - - if self.verbose: - logger.warning("Key %s not found in %s.", key, self.dotenv_path) - - return None - - -def get_key( - dotenv_path: StrPath, - key_to_get: str, - encoding: Optional[str] = "utf-8", -) -> Optional[str]: - """ - Get the value of a given key from the given .env. - - Returns `None` if the key isn't found or doesn't have a value. - """ - return DotEnv(dotenv_path, verbose=True, encoding=encoding).get(key_to_get) - - -@contextmanager -def rewrite( - path: StrPath, - encoding: Optional[str], -) -> Iterator[Tuple[IO[str], IO[str]]]: - pathlib.Path(path).touch() - - with tempfile.NamedTemporaryFile(mode="w", encoding=encoding, delete=False) as dest: - error = None - try: - with open(path, encoding=encoding) as source: - yield (source, dest) - except BaseException as err: - error = err - - if error is None: - shutil.move(dest.name, path) - else: - os.unlink(dest.name) - raise error from None - - -def set_key( - dotenv_path: StrPath, - key_to_set: str, - value_to_set: str, - quote_mode: str = "always", - export: bool = False, - encoding: Optional[str] = "utf-8", -) -> Tuple[Optional[bool], str, str]: - """ - Adds or Updates a key/value to the given .env - - If the .env path given doesn't exist, fails instead of risking creating - an orphan .env somewhere in the filesystem - """ - if quote_mode not in ("always", "auto", "never"): - raise ValueError(f"Unknown quote_mode: {quote_mode}") - - quote = quote_mode == "always" or ( - quote_mode == "auto" and not value_to_set.isalnum() - ) - - if quote: - value_out = "'{}'".format(value_to_set.replace("'", "\\'")) - else: - value_out = value_to_set - if export: - line_out = f"export {key_to_set}={value_out}\n" - else: - line_out = f"{key_to_set}={value_out}\n" - - with rewrite(dotenv_path, encoding=encoding) as (source, dest): - replaced = False - missing_newline = False - for mapping in with_warn_for_invalid_lines(parse_stream(source)): - if mapping.key == key_to_set: - dest.write(line_out) - replaced = True - else: - dest.write(mapping.original.string) - missing_newline = not mapping.original.string.endswith("\n") - if not replaced: - if missing_newline: - dest.write("\n") - dest.write(line_out) - - return True, key_to_set, value_to_set - - -def unset_key( - dotenv_path: StrPath, - key_to_unset: str, - quote_mode: str = "always", - encoding: Optional[str] = "utf-8", -) -> Tuple[Optional[bool], str]: - """ - Removes a given key from the given `.env` file. - - If the .env path given doesn't exist, fails. - If the given key doesn't exist in the .env, fails. - """ - if not os.path.exists(dotenv_path): - logger.warning("Can't delete from %s - it doesn't exist.", dotenv_path) - return None, key_to_unset - - removed = False - with rewrite(dotenv_path, encoding=encoding) as (source, dest): - for mapping in with_warn_for_invalid_lines(parse_stream(source)): - if mapping.key == key_to_unset: - removed = True - else: - dest.write(mapping.original.string) - - if not removed: - logger.warning( - "Key %s not removed from %s - key doesn't exist.", key_to_unset, dotenv_path - ) - return None, key_to_unset - - return removed, key_to_unset - - -def resolve_variables( - values: Iterable[Tuple[str, Optional[str]]], - override: bool, -) -> Mapping[str, Optional[str]]: - new_values: Dict[str, Optional[str]] = {} - - for name, value in values: - if value is None: - result = None - else: - atoms = parse_variables(value) - env: Dict[str, Optional[str]] = {} - if override: - env.update(os.environ) # type: ignore - env.update(new_values) - else: - env.update(new_values) - env.update(os.environ) # type: ignore - result = "".join(atom.resolve(env) for atom in atoms) - - new_values[name] = result - - return new_values - - -def _walk_to_root(path: str) -> Iterator[str]: - """ - Yield directories starting from the given directory up to the root - """ - if not os.path.exists(path): - raise IOError("Starting path not found") - - if os.path.isfile(path): - path = os.path.dirname(path) - - last_dir = None - current_dir = os.path.abspath(path) - while last_dir != current_dir: - yield current_dir - parent_dir = os.path.abspath(os.path.join(current_dir, os.path.pardir)) - last_dir, current_dir = current_dir, parent_dir - - -def find_dotenv( - filename: str = ".env", - raise_error_if_not_found: bool = False, - usecwd: bool = False, -) -> str: - """ - Search in increasingly higher folders for the given file - - Returns path to the file if found, or an empty string otherwise - """ - - def _is_interactive(): - """Decide whether this is running in a REPL or IPython notebook""" - if hasattr(sys, "ps1") or hasattr(sys, "ps2"): - return True - try: - main = __import__("__main__", None, None, fromlist=["__file__"]) - except ModuleNotFoundError: - return False - return not hasattr(main, "__file__") - - def _is_debugger(): - return sys.gettrace() is not None - - if usecwd or _is_interactive() or _is_debugger() or getattr(sys, "frozen", False): - # Should work without __file__, e.g. in REPL or IPython notebook. - path = os.getcwd() - else: - # will work for .py files - frame = sys._getframe() - current_file = __file__ - - while frame.f_code.co_filename == current_file or not os.path.exists( - frame.f_code.co_filename - ): - assert frame.f_back is not None - frame = frame.f_back - frame_filename = frame.f_code.co_filename - path = os.path.dirname(os.path.abspath(frame_filename)) - - for dirname in _walk_to_root(path): - check_path = os.path.join(dirname, filename) - if os.path.isfile(check_path): - return check_path - - if raise_error_if_not_found: - raise IOError("File not found") - - return "" - - -def load_dotenv( - dotenv_path: Optional[StrPath] = None, - stream: Optional[IO[str]] = None, - verbose: bool = False, - override: bool = False, - interpolate: bool = True, - encoding: Optional[str] = "utf-8", -) -> bool: - """Parse a .env file and then load all the variables found as environment variables. - - Parameters: - dotenv_path: Absolute or relative path to .env file. - stream: Text stream (such as `io.StringIO`) with .env content, used if - `dotenv_path` is `None`. - verbose: Whether to output a warning the .env file is missing. - override: Whether to override the system environment variables with the variables - from the `.env` file. - encoding: Encoding to be used to read the file. - Returns: - Bool: True if at least one environment variable is set else False - - If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the - .env file with it's default parameters. If you need to change the default parameters - of `find_dotenv()`, you can explicitly call `find_dotenv()` and pass the result - to this function as `dotenv_path`. - """ - if dotenv_path is None and stream is None: - dotenv_path = find_dotenv() - - dotenv = DotEnv( - dotenv_path=dotenv_path, - stream=stream, - verbose=verbose, - interpolate=interpolate, - override=override, - encoding=encoding, - ) - return dotenv.set_as_environment_variables() - - -def dotenv_values( - dotenv_path: Optional[StrPath] = None, - stream: Optional[IO[str]] = None, - verbose: bool = False, - interpolate: bool = True, - encoding: Optional[str] = "utf-8", -) -> Dict[str, Optional[str]]: - """ - Parse a .env file and return its content as a dict. - - The returned dict will have `None` values for keys without values in the .env file. - For example, `foo=bar` results in `{"foo": "bar"}` whereas `foo` alone results in - `{"foo": None}` - - Parameters: - dotenv_path: Absolute or relative path to the .env file. - stream: `StringIO` object with .env content, used if `dotenv_path` is `None`. - verbose: Whether to output a warning if the .env file is missing. - encoding: Encoding to be used to read the file. - - If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the - .env file. - """ - if dotenv_path is None and stream is None: - dotenv_path = find_dotenv() - - return DotEnv( - dotenv_path=dotenv_path, - stream=stream, - verbose=verbose, - interpolate=interpolate, - override=True, - encoding=encoding, - ).dict() diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/parser.py b/write-message/venv/lib/python3.10/site-packages/dotenv/parser.py deleted file mode 100644 index 735f14a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/parser.py +++ /dev/null @@ -1,175 +0,0 @@ -import codecs -import re -from typing import (IO, Iterator, Match, NamedTuple, Optional, # noqa:F401 - Pattern, Sequence, Tuple) - - -def make_regex(string: str, extra_flags: int = 0) -> Pattern[str]: - return re.compile(string, re.UNICODE | extra_flags) - - -_newline = make_regex(r"(\r\n|\n|\r)") -_multiline_whitespace = make_regex(r"\s*", extra_flags=re.MULTILINE) -_whitespace = make_regex(r"[^\S\r\n]*") -_export = make_regex(r"(?:export[^\S\r\n]+)?") -_single_quoted_key = make_regex(r"'([^']+)'") -_unquoted_key = make_regex(r"([^=\#\s]+)") -_equal_sign = make_regex(r"(=[^\S\r\n]*)") -_single_quoted_value = make_regex(r"'((?:\\'|[^'])*)'") -_double_quoted_value = make_regex(r'"((?:\\"|[^"])*)"') -_unquoted_value = make_regex(r"([^\r\n]*)") -_comment = make_regex(r"(?:[^\S\r\n]*#[^\r\n]*)?") -_end_of_line = make_regex(r"[^\S\r\n]*(?:\r\n|\n|\r|$)") -_rest_of_line = make_regex(r"[^\r\n]*(?:\r|\n|\r\n)?") -_double_quote_escapes = make_regex(r"\\[\\'\"abfnrtv]") -_single_quote_escapes = make_regex(r"\\[\\']") - - -class Original(NamedTuple): - string: str - line: int - - -class Binding(NamedTuple): - key: Optional[str] - value: Optional[str] - original: Original - error: bool - - -class Position: - def __init__(self, chars: int, line: int) -> None: - self.chars = chars - self.line = line - - @classmethod - def start(cls) -> "Position": - return cls(chars=0, line=1) - - def set(self, other: "Position") -> None: - self.chars = other.chars - self.line = other.line - - def advance(self, string: str) -> None: - self.chars += len(string) - self.line += len(re.findall(_newline, string)) - - -class Error(Exception): - pass - - -class Reader: - def __init__(self, stream: IO[str]) -> None: - self.string = stream.read() - self.position = Position.start() - self.mark = Position.start() - - def has_next(self) -> bool: - return self.position.chars < len(self.string) - - def set_mark(self) -> None: - self.mark.set(self.position) - - def get_marked(self) -> Original: - return Original( - string=self.string[self.mark.chars:self.position.chars], - line=self.mark.line, - ) - - def peek(self, count: int) -> str: - return self.string[self.position.chars:self.position.chars + count] - - def read(self, count: int) -> str: - result = self.string[self.position.chars:self.position.chars + count] - if len(result) < count: - raise Error("read: End of string") - self.position.advance(result) - return result - - def read_regex(self, regex: Pattern[str]) -> Sequence[str]: - match = regex.match(self.string, self.position.chars) - if match is None: - raise Error("read_regex: Pattern not found") - self.position.advance(self.string[match.start():match.end()]) - return match.groups() - - -def decode_escapes(regex: Pattern[str], string: str) -> str: - def decode_match(match: Match[str]) -> str: - return codecs.decode(match.group(0), 'unicode-escape') # type: ignore - - return regex.sub(decode_match, string) - - -def parse_key(reader: Reader) -> Optional[str]: - char = reader.peek(1) - if char == "#": - return None - elif char == "'": - (key,) = reader.read_regex(_single_quoted_key) - else: - (key,) = reader.read_regex(_unquoted_key) - return key - - -def parse_unquoted_value(reader: Reader) -> str: - (part,) = reader.read_regex(_unquoted_value) - return re.sub(r"\s+#.*", "", part).rstrip() - - -def parse_value(reader: Reader) -> str: - char = reader.peek(1) - if char == u"'": - (value,) = reader.read_regex(_single_quoted_value) - return decode_escapes(_single_quote_escapes, value) - elif char == u'"': - (value,) = reader.read_regex(_double_quoted_value) - return decode_escapes(_double_quote_escapes, value) - elif char in (u"", u"\n", u"\r"): - return u"" - else: - return parse_unquoted_value(reader) - - -def parse_binding(reader: Reader) -> Binding: - reader.set_mark() - try: - reader.read_regex(_multiline_whitespace) - if not reader.has_next(): - return Binding( - key=None, - value=None, - original=reader.get_marked(), - error=False, - ) - reader.read_regex(_export) - key = parse_key(reader) - reader.read_regex(_whitespace) - if reader.peek(1) == "=": - reader.read_regex(_equal_sign) - value: Optional[str] = parse_value(reader) - else: - value = None - reader.read_regex(_comment) - reader.read_regex(_end_of_line) - return Binding( - key=key, - value=value, - original=reader.get_marked(), - error=False, - ) - except Error: - reader.read_regex(_rest_of_line) - return Binding( - key=None, - value=None, - original=reader.get_marked(), - error=True, - ) - - -def parse_stream(stream: IO[str]) -> Iterator[Binding]: - reader = Reader(stream) - while reader.has_next(): - yield parse_binding(reader) diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/py.typed b/write-message/venv/lib/python3.10/site-packages/dotenv/py.typed deleted file mode 100644 index 7632ecf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561 diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/variables.py b/write-message/venv/lib/python3.10/site-packages/dotenv/variables.py deleted file mode 100644 index 667f2f2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/variables.py +++ /dev/null @@ -1,86 +0,0 @@ -import re -from abc import ABCMeta, abstractmethod -from typing import Iterator, Mapping, Optional, Pattern - -_posix_variable: Pattern[str] = re.compile( - r""" - \$\{ - (?P[^\}:]*) - (?::- - (?P[^\}]*) - )? - \} - """, - re.VERBOSE, -) - - -class Atom(metaclass=ABCMeta): - def __ne__(self, other: object) -> bool: - result = self.__eq__(other) - if result is NotImplemented: - return NotImplemented - return not result - - @abstractmethod - def resolve(self, env: Mapping[str, Optional[str]]) -> str: ... - - -class Literal(Atom): - def __init__(self, value: str) -> None: - self.value = value - - def __repr__(self) -> str: - return f"Literal(value={self.value})" - - def __eq__(self, other: object) -> bool: - if not isinstance(other, self.__class__): - return NotImplemented - return self.value == other.value - - def __hash__(self) -> int: - return hash((self.__class__, self.value)) - - def resolve(self, env: Mapping[str, Optional[str]]) -> str: - return self.value - - -class Variable(Atom): - def __init__(self, name: str, default: Optional[str]) -> None: - self.name = name - self.default = default - - def __repr__(self) -> str: - return f"Variable(name={self.name}, default={self.default})" - - def __eq__(self, other: object) -> bool: - if not isinstance(other, self.__class__): - return NotImplemented - return (self.name, self.default) == (other.name, other.default) - - def __hash__(self) -> int: - return hash((self.__class__, self.name, self.default)) - - def resolve(self, env: Mapping[str, Optional[str]]) -> str: - default = self.default if self.default is not None else "" - result = env.get(self.name, default) - return result if result is not None else "" - - -def parse_variables(value: str) -> Iterator[Atom]: - cursor = 0 - - for match in _posix_variable.finditer(value): - (start, end) = match.span() - name = match["name"] - default = match["default"] - - if start > cursor: - yield Literal(value=value[cursor:start]) - - yield Variable(name=name, default=default) - cursor = end - - length = len(value) - if cursor < length: - yield Literal(value=value[cursor:length]) diff --git a/write-message/venv/lib/python3.10/site-packages/dotenv/version.py b/write-message/venv/lib/python3.10/site-packages/dotenv/version.py deleted file mode 100644 index a82b376..0000000 --- a/write-message/venv/lib/python3.10/site-packages/dotenv/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "1.1.1" diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/LICENSE b/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/LICENSE deleted file mode 100644 index 122e7a7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -This is free and unencumbered software released into the public -domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a -compiled binary, for any purpose, commercial or non-commercial, -and by any means. - -In jurisdictions that recognize copyright laws, the author or -authors of this software dedicate any and all copyright -interest in the software to the public domain. We make this -dedication for the benefit of the public at large and to the -detriment of our heirs and successors. We intend this -dedication to be an overt act of relinquishment in perpetuity -of all present and future rights to this software under -copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -For more information, please refer to diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/METADATA deleted file mode 100644 index 7f7350e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/METADATA +++ /dev/null @@ -1,465 +0,0 @@ -Metadata-Version: 2.1 -Name: email_validator -Version: 2.2.0 -Summary: A robust email address syntax and deliverability validation library. -Home-page: https://github.com/JoshData/python-email-validator -Author: Joshua Tauberer -Author-email: jt@occams.info -License: Unlicense -Keywords: email address validator -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: The Unlicense (Unlicense) -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: Topic :: Software Development :: Libraries :: Python Modules -Requires-Python: >=3.8 -Description-Content-Type: text/markdown -License-File: LICENSE -Requires-Dist: dnspython >=2.0.0 -Requires-Dist: idna >=2.0.0 - -email-validator: Validate Email Addresses -========================================= - -A robust email address syntax and deliverability validation library for -Python 3.8+ by [Joshua Tauberer](https://joshdata.me). - -This library validates that a string is of the form `name@example.com` -and optionally checks that the domain name is set up to receive email. -This is the sort of validation you would want when you are identifying -users by their email address like on a registration form. - -Key features: - -* Checks that an email address has the correct syntax --- great for - email-based registration/login forms or validing data. -* Gives friendly English error messages when validation fails that you - can display to end-users. -* Checks deliverability (optional): Does the domain name resolve? - (You can override the default DNS resolver to add query caching.) -* Supports internationalized domain names (like `@ツ.life`), - internationalized local parts (like `ツ@example.com`), - and optionally parses display names (e.g. `"My Name" `). -* Rejects addresses with invalid or unsafe Unicode characters, - obsolete email address syntax that you'd find unexpected, - special use domain names like `@localhost`, - and domains without a dot by default. - This is an opinionated library! -* Normalizes email addresses (important for internationalized - and quoted-string addresses! see below). -* Python type annotations are used. - -This is an opinionated library. You should definitely also consider using -the less-opinionated [pyIsEmail](https://github.com/michaelherold/pyIsEmail) -if it works better for you. - -[![Build Status](https://github.com/JoshData/python-email-validator/actions/workflows/test_and_build.yaml/badge.svg)](https://github.com/JoshData/python-email-validator/actions/workflows/test_and_build.yaml) - -View the [CHANGELOG / Release Notes](CHANGELOG.md) for the version history of changes in the library. Occasionally this README is ahead of the latest published package --- see the CHANGELOG for details. - ---- - -Installation ------------- - -This package [is on PyPI](https://pypi.org/project/email-validator/), so: - -```sh -pip install email-validator -``` - -(You might need to use `pip3` depending on your local environment.) - -Quick Start ------------ - -If you're validating a user's email address before creating a user -account in your application, you might do this: - -```python -from email_validator import validate_email, EmailNotValidError - -email = "my+address@example.org" - -try: - - # Check that the email address is valid. Turn on check_deliverability - # for first-time validations like on account creation pages (but not - # login pages). - emailinfo = validate_email(email, check_deliverability=False) - - # After this point, use only the normalized form of the email address, - # especially before going to a database query. - email = emailinfo.normalized - -except EmailNotValidError as e: - - # The exception message is human-readable explanation of why it's - # not a valid (or deliverable) email address. - print(str(e)) -``` - -This validates the address and gives you its normalized form. You should -**put the normalized form in your database** and always normalize before -checking if an address is in your database. When using this in a login form, -set `check_deliverability` to `False` to avoid unnecessary DNS queries. - -Usage ------ - -### Overview - -The module provides a function `validate_email(email_address)` which -takes an email address and: - -- Raises a `EmailNotValidError` with a helpful, human-readable error - message explaining why the email address is not valid, or -- Returns an object with a normalized form of the email address (which - you should use!) and other information about it. - -When an email address is not valid, `validate_email` raises either an -`EmailSyntaxError` if the form of the address is invalid or an -`EmailUndeliverableError` if the domain name fails DNS checks. Both -exception classes are subclasses of `EmailNotValidError`, which in turn -is a subclass of `ValueError`. - -But when an email address is valid, an object is returned containing -a normalized form of the email address (which you should use!) and -other information. - -The validator doesn't, by default, permit obsoleted forms of email addresses -that no one uses anymore even though they are still valid and deliverable, since -they will probably give you grief if you're using email for login. (See -later in the document about how to allow some obsolete forms.) - -The validator optionally checks that the domain name in the email address has -a DNS MX record indicating that it can receive email. (Except a Null MX record. -If there is no MX record, a fallback A/AAAA-record is permitted, unless -a reject-all SPF record is present.) DNS is slow and sometimes unavailable or -unreliable, so consider whether these checks are useful for your use case and -turn them off if they aren't. -There is nothing to be gained by trying to actually contact an SMTP server, so -that's not done here. For privacy, security, and practicality reasons, servers -are good at not giving away whether an address is -deliverable or not: email addresses that appear to accept mail at first -can bounce mail after a delay, and bounced mail may indicate a temporary -failure of a good email address (sometimes an intentional failure, like -greylisting). - -### Options - -The `validate_email` function also accepts the following keyword arguments -(defaults are as shown below): - -`check_deliverability=True`: If true, DNS queries are made to check that the domain name in the email address (the part after the @-sign) can receive mail, as described above. Set to `False` to skip this DNS-based check. It is recommended to pass `False` when performing validation for login pages (but not account creation pages) since re-validation of a previously validated domain in your database by querying DNS at every login is probably undesirable. You can also set `email_validator.CHECK_DELIVERABILITY` to `False` to turn this off for all calls by default. - -`dns_resolver=None`: Pass an instance of [dns.resolver.Resolver](https://dnspython.readthedocs.io/en/latest/resolver-class.html) to control the DNS resolver including setting a timeout and [a cache](https://dnspython.readthedocs.io/en/latest/resolver-caching.html). The `caching_resolver` function shown below is a helper function to construct a dns.resolver.Resolver with a [LRUCache](https://dnspython.readthedocs.io/en/latest/resolver-caching.html#dns.resolver.LRUCache). Reuse the same resolver instance across calls to `validate_email` to make use of the cache. - -`test_environment=False`: If `True`, DNS-based deliverability checks are disabled and `test` and `**.test` domain names are permitted (see below). You can also set `email_validator.TEST_ENVIRONMENT` to `True` to turn it on for all calls by default. - -`allow_smtputf8=True`: Set to `False` to prohibit internationalized addresses that would - require the - [SMTPUTF8](https://tools.ietf.org/html/rfc6531) extension. You can also set `email_validator.ALLOW_SMTPUTF8` to `False` to turn it off for all calls by default. - -`allow_quoted_local=False`: Set to `True` to allow obscure and potentially problematic email addresses in which the part of the address before the @-sign contains spaces, @-signs, or other surprising characters when the local part is surrounded in quotes (so-called quoted-string local parts). In the object returned by `validate_email`, the normalized local part removes any unnecessary backslash-escaping and even removes the surrounding quotes if the address would be valid without them. You can also set `email_validator.ALLOW_QUOTED_LOCAL` to `True` to turn this on for all calls by default. - -`allow_domain_literal=False`: Set to `True` to allow bracketed IPv4 and "IPv6:"-prefixd IPv6 addresses in the domain part of the email address. No deliverability checks are performed for these addresses. In the object returned by `validate_email`, the normalized domain will use the condensed IPv6 format, if applicable. The object's `domain_address` attribute will hold the parsed `ipaddress.IPv4Address` or `ipaddress.IPv6Address` object if applicable. You can also set `email_validator.ALLOW_DOMAIN_LITERAL` to `True` to turn this on for all calls by default. - -`allow_display_name=False`: Set to `True` to allow a display name and bracketed address in the input string, like `My Name `. It's implemented in the spirit but not the letter of RFC 5322 3.4, so it may be stricter or more relaxed than what you want. The display name, if present, is provided in the returned object's `display_name` field after being unquoted and unescaped. You can also set `email_validator.ALLOW_DISPLAY_NAME` to `True` to turn this on for all calls by default. - -`allow_empty_local=False`: Set to `True` to allow an empty local part (i.e. - `@example.com`), e.g. for validating Postfix aliases. - - -### DNS timeout and cache - -When validating many email addresses or to control the timeout (the default is 15 seconds), create a caching [dns.resolver.Resolver](https://dnspython.readthedocs.io/en/latest/resolver-class.html) to reuse in each call. The `caching_resolver` function returns one easily for you: - -```python -from email_validator import validate_email, caching_resolver - -resolver = caching_resolver(timeout=10) - -while True: - validate_email(email, dns_resolver=resolver) -``` - -### Test addresses - -This library rejects email addresses that use the [Special Use Domain Names](https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml) `invalid`, `localhost`, `test`, and some others by raising `EmailSyntaxError`. This is to protect your system from abuse: You probably don't want a user to be able to cause an email to be sent to `localhost` (although they might be able to still do so via a malicious MX record). However, in your non-production test environments you may want to use `@test` or `@myname.test` email addresses. There are three ways you can allow this: - -1. Add `test_environment=True` to the call to `validate_email` (see above). -2. Set `email_validator.TEST_ENVIRONMENT` to `True` globally. -3. Remove the special-use domain name that you want to use from `email_validator.SPECIAL_USE_DOMAIN_NAMES`, e.g.: - -```python -import email_validator -email_validator.SPECIAL_USE_DOMAIN_NAMES.remove("test") -``` - -It is tempting to use `@example.com/net/org` in tests. They are *not* in this library's `SPECIAL_USE_DOMAIN_NAMES` list so you can, but shouldn't, use them. These domains are reserved to IANA for use in documentation so there is no risk of accidentally emailing someone at those domains. But beware that this library will nevertheless reject these domain names if DNS-based deliverability checks are not disabled because these domains do not resolve to domains that accept email. In tests, consider using your own domain name or `@test` or `@myname.test` instead. - -Internationalized email addresses ---------------------------------- - -The email protocol SMTP and the domain name system DNS have historically -only allowed English (ASCII) characters in email addresses and domain names, -respectively. Each has adapted to internationalization in a separate -way, creating two separate aspects to email address internationalization. - -(If your mail submission library doesn't support Unicode at all, then -immediately prior to mail submission you must replace the email address with -its ASCII-ized form. This library gives you back the ASCII-ized form in the -`ascii_email` field in the returned object.) - -### Internationalized domain names (IDN) - -The first is [internationalized domain names (RFC -5891)](https://tools.ietf.org/html/rfc5891), a.k.a IDNA 2008. The DNS -system has not been updated with Unicode support. Instead, internationalized -domain names are converted into a special IDNA ASCII "[Punycode](https://www.rfc-editor.org/rfc/rfc3492.txt)" -form starting with `xn--`. When an email address has non-ASCII -characters in its domain part, the domain part is replaced with its IDNA -ASCII equivalent form in the process of mail transmission. Your mail -submission library probably does this for you transparently. ([Compliance -around the web is not very good though](http://archives.miloush.net/michkap/archive/2012/02/27/10273315.html).) This library conforms to IDNA 2008 -using the [idna](https://github.com/kjd/idna) module by Kim Davies. - -### Internationalized local parts - -The second sort of internationalization is internationalization in the -*local* part of the address (before the @-sign). In non-internationalized -email addresses, only English letters, numbers, and some punctuation -(`._!#$%&'^``*+-=~/?{|}`) are allowed. In internationalized email address -local parts, a wider range of Unicode characters are allowed. - -Email addresses with these non-ASCII characters require that your mail -submission library and all the mail servers along the route to the destination, -including your own outbound mail server, all support the -[SMTPUTF8 (RFC 6531)](https://tools.ietf.org/html/rfc6531) extension. -Support for SMTPUTF8 varies. If you know ahead of time that SMTPUTF8 is not -supported by your mail submission stack, then you must filter out addresses that -require SMTPUTF8 using the `allow_smtputf8=False` keyword argument (see above). -This will cause the validation function to raise a `EmailSyntaxError` if -delivery would require SMTPUTF8. If you do not set `allow_smtputf8=False`, -you can also check the value of the `smtputf8` field in the returned object. - -### Unsafe Unicode characters are rejected - -A surprisingly large number of Unicode characters are not safe to display, -especially when the email address is concatenated with other text, so this -library tries to protect you by not permitting reserved, non-, private use, -formatting (which can be used to alter the display order of characters), -whitespace, and control characters, and combining characters -as the first character of the local part and the domain name (so that they -cannot combine with something outside of the email address string or with -the @-sign). See https://qntm.org/safe and https://trojansource.codes/ -for relevant prior work. (Other than whitespace, these are checks that -you should be applying to nearly all user inputs in a security-sensitive -context.) This does not guard against the well known problem that many -Unicode characters look alike, which can be used to fool humans reading -displayed text. - - -Normalization -------------- - -### Unicode Normalization - -The use of Unicode in email addresses introduced a normalization -problem. Different Unicode strings can look identical and have the same -semantic meaning to the user. The `normalized` field returned on successful -validation provides the correctly normalized form of the given email -address. - -For example, the CJK fullwidth Latin letters are considered semantically -equivalent in domain names to their ASCII counterparts. This library -normalizes them to their ASCII counterparts (as required by IDNA): - -```python -emailinfo = validate_email("me@Domain.com") -print(emailinfo.normalized) -print(emailinfo.ascii_email) -# prints "me@domain.com" twice -``` - -Because an end-user might type their email address in different (but -equivalent) un-normalized forms at different times, you ought to -replace what they enter with the normalized form immediately prior to -going into your database (during account creation), querying your database -(during login), or sending outbound mail. - -The normalizations include lowercasing the domain part of the email -address (domain names are case-insensitive), [Unicode "NFC" -normalization](https://en.wikipedia.org/wiki/Unicode_equivalence) of the -whole address (which turns characters plus [combining -characters](https://en.wikipedia.org/wiki/Combining_character) into -precomposed characters where possible, replacement of [fullwidth and -halfwidth -characters](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) -in the domain part, possibly other -[UTS46](http://unicode.org/reports/tr46) mappings on the domain part, -and conversion from Punycode to Unicode characters. - -Normalization may change the characters in the email address and the -length of the email address, such that a string might be a valid address -before normalization but invalid after, or vice versa. This library only -permits addresses that are valid both before and after normalization. - -(See [RFC 6532 (internationalized email) section -3.1](https://tools.ietf.org/html/rfc6532#section-3.1) and [RFC 5895 -(IDNA 2008) section 2](http://www.ietf.org/rfc/rfc5895.txt).) - -### Other Normalization - -Normalization is also applied to quoted-string local parts and domain -literal IPv6 addresses if you have allowed them by the `allow_quoted_local` -and `allow_domain_literal` options. In quoted-string local parts, unnecessary -backslash escaping is removed and even the surrounding quotes are removed if -they are unnecessary. For IPv6 domain literals, the IPv6 address is -normalized to condensed form. [RFC 2142](https://datatracker.ietf.org/doc/html/rfc2142) -also requires lowercase normalization for some specific mailbox names like `postmaster@`. - - -Examples --------- - -For the email address `test@joshdata.me`, the returned object is: - -```python -ValidatedEmail( - normalized='test@joshdata.me', - local_part='test', - domain='joshdata.me', - ascii_email='test@joshdata.me', - ascii_local_part='test', - ascii_domain='joshdata.me', - smtputf8=False) -``` - -For the fictitious but valid address `example@ツ.ⓁⒾⒻⒺ`, which has an -internationalized domain but ASCII local part, the returned object is: - -```python -ValidatedEmail( - normalized='example@ツ.life', - local_part='example', - domain='ツ.life', - ascii_email='example@xn--bdk.life', - ascii_local_part='example', - ascii_domain='xn--bdk.life', - smtputf8=False) - -``` - -Note that `normalized` and other fields provide a normalized form of the -email address, domain name, and (in other cases) local part (see earlier -discussion of normalization), which you should use in your database. - -Calling `validate_email` with the ASCII form of the above email address, -`example@xn--bdk.life`, returns the exact same information (i.e., the -`normalized` field always will contain Unicode characters, not Punycode). - -For the fictitious address `ツ-test@joshdata.me`, which has an -internationalized local part, the returned object is: - -```python -ValidatedEmail( - normalized='ツ-test@joshdata.me', - local_part='ツ-test', - domain='joshdata.me', - ascii_email=None, - ascii_local_part=None, - ascii_domain='joshdata.me', - smtputf8=True) -``` - -Now `smtputf8` is `True` and `ascii_email` is `None` because the local -part of the address is internationalized. The `local_part` and `normalized` fields -return the normalized form of the address. - -Return value ------------- - -When an email address passes validation, the fields in the returned object -are: - -| Field | Value | -| -----:|-------| -| `normalized` | The normalized form of the email address that you should put in your database. This combines the `local_part` and `domain` fields (see below). | -| `ascii_email` | If set, an ASCII-only form of the normalized email address by replacing the domain part with [IDNA](https://tools.ietf.org/html/rfc5891) [Punycode](https://www.rfc-editor.org/rfc/rfc3492.txt). This field will be present when an ASCII-only form of the email address exists (including if the email address is already ASCII). If the local part of the email address contains internationalized characters, `ascii_email` will be `None`. If set, it merely combines `ascii_local_part` and `ascii_domain`. | -| `local_part` | The normalized local part of the given email address (before the @-sign). Normalization includes Unicode NFC normalization and removing unnecessary quoted-string quotes and backslashes. If `allow_quoted_local` is True and the surrounding quotes are necessary, the quotes _will_ be present in this field. | -| `ascii_local_part` | If set, the local part, which is composed of ASCII characters only. | -| `domain` | The canonical internationalized Unicode form of the domain part of the email address. If the returned string contains non-ASCII characters, either the [SMTPUTF8](https://tools.ietf.org/html/rfc6531) feature of your mail relay will be required to transmit the message or else the email address's domain part must be converted to IDNA ASCII first: Use `ascii_domain` field instead. | -| `ascii_domain` | The [IDNA](https://tools.ietf.org/html/rfc5891) [Punycode](https://www.rfc-editor.org/rfc/rfc3492.txt)-encoded form of the domain part of the given email address, as it would be transmitted on the wire. | -| `domain_address` | If domain literals are allowed and if the email address contains one, an `ipaddress.IPv4Address` or `ipaddress.IPv6Address` object. | -| `display_name` | If no display name was present and angle brackets do not surround the address, this will be `None`; otherwise, it will be set to the display name, or the empty string if there were angle brackets but no display name. If the display name was quoted, it will be unquoted and unescaped. | -| `smtputf8` | A boolean indicating that the [SMTPUTF8](https://tools.ietf.org/html/rfc6531) feature of your mail relay will be required to transmit messages to this address because the local part of the address has non-ASCII characters (the local part cannot be IDNA-encoded). If `allow_smtputf8=False` is passed as an argument, this flag will always be false because an exception is raised if it would have been true. | -| `mx` | A list of (priority, domain) tuples of MX records specified in the DNS for the domain (see [RFC 5321 section 5](https://tools.ietf.org/html/rfc5321#section-5)). May be `None` if the deliverability check could not be completed because of a temporary issue like a timeout. | -| `mx_fallback_type` | `None` if an `MX` record is found. If no MX records are actually specified in DNS and instead are inferred, through an obsolete mechanism, from A or AAAA records, the value is the type of DNS record used instead (`A` or `AAAA`). May be `None` if the deliverability check could not be completed because of a temporary issue like a timeout. | -| `spf` | Any SPF record found while checking deliverability. Only set if the SPF record is queried. | - -Assumptions ------------ - -By design, this validator does not pass all email addresses that -strictly conform to the standards. Many email address forms are obsolete -or likely to cause trouble: - -* The validator assumes the email address is intended to be - usable on the public Internet. The domain part - of the email address must be a resolvable domain name - (see the deliverability checks described above). - Most [Special Use Domain Names](https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml) - and their subdomains, as well as - domain names without a `.`, are rejected as a syntax error - (except see the `test_environment` parameter above). -* Obsolete email syntaxes are rejected: - The unusual ["(comment)" syntax](https://github.com/JoshData/python-email-validator/issues/77) - is rejected. Extremely old obsolete syntaxes are - rejected. Quoted-string local parts and domain-literal addresses - are rejected by default, but there are options to allow them (see above). - No one uses these forms anymore, and I can't think of any reason why anyone - using this library would need to accept them. - -Testing -------- - -Tests can be run using - -```sh -pip install -r test_requirements.txt -make test -``` - -Tests run with mocked DNS responses. When adding or changing tests, temporarily turn on the `BUILD_MOCKED_DNS_RESPONSE_DATA` flag in `tests/mocked_dns_responses.py` to re-build the database of mocked responses from live queries. - -For Project Maintainers ------------------------ - -The package is distributed as a universal wheel and as a source package. - -To release: - -* Update CHANGELOG.md. -* Update the version number in `email_validator/version.py`. -* Make & push a commit with the new version number and make sure tests pass. -* Make & push a tag (see command below). -* Make a release at https://github.com/JoshData/python-email-validator/releases/new. -* Publish a source and wheel distribution to pypi (see command below). - -```sh -git tag v$(cat email_validator/version.py | sed "s/.* = //" | sed 's/"//g') -git push --tags -./release_to_pypi.sh -``` - -License -------- - -This project is free of any copyright restrictions per the [Unlicense](https://unlicense.org/). (Prior to Feb. 4, 2024, the project was made available under the terms of the [CC0 1.0 Universal public domain dedication](http://creativecommons.org/publicdomain/zero/1.0/).) See [LICENSE](LICENSE) and [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/RECORD deleted file mode 100644 index e38b2ce..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/RECORD +++ /dev/null @@ -1,25 +0,0 @@ -../../../bin/email_validator,sha256=Don1lpIcjIs1a7AQTJyPHYQ1DLOHUk6DP2lVWOg3qW0,284 -email_validator-2.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -email_validator-2.2.0.dist-info/LICENSE,sha256=ZyF5dS4QkTSj-yvdB4Cyn9t6A5dPD1hqE66tUSlWLUw,1212 -email_validator-2.2.0.dist-info/METADATA,sha256=vELkkg-p-qMuqNFX6uzDmMaruT7Pe5PDAQexHLAB4XM,25741 -email_validator-2.2.0.dist-info/RECORD,, -email_validator-2.2.0.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91 -email_validator-2.2.0.dist-info/entry_points.txt,sha256=zRM_6bNIUSHTbNx5u6M3nK1MAguvryrc9hICC6HyrBg,66 -email_validator-2.2.0.dist-info/top_level.txt,sha256=fYDOSWFZke46ut7WqdOAJjjhlpPYAaOwOwIsh3s8oWI,16 -email_validator/__init__.py,sha256=g-TFM6vzpEt4dMG93giGlS343yXXXIy7EOLNFEn6DfA,4360 -email_validator/__main__.py,sha256=TIvjaG_OSFRciH0J2pnEJEdX3uJy3ZgocmasEqh9EEI,2243 -email_validator/__pycache__/__init__.cpython-310.pyc,, -email_validator/__pycache__/__main__.cpython-310.pyc,, -email_validator/__pycache__/deliverability.cpython-310.pyc,, -email_validator/__pycache__/exceptions_types.cpython-310.pyc,, -email_validator/__pycache__/rfc_constants.cpython-310.pyc,, -email_validator/__pycache__/syntax.cpython-310.pyc,, -email_validator/__pycache__/validate_email.cpython-310.pyc,, -email_validator/__pycache__/version.cpython-310.pyc,, -email_validator/deliverability.py,sha256=e6eODNSaLMiM29EZ3bWYDFkQDlMIdicBaykjYQJwYig,7222 -email_validator/exceptions_types.py,sha256=yLxXqwtl5dXa-938K7skLP1pMFgi0oovzCs74mX7TGs,6024 -email_validator/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -email_validator/rfc_constants.py,sha256=KVUshwIu699cle3UzDU2_fFBSQOO7p91Z_hrlNANtGM,2767 -email_validator/syntax.py,sha256=Mo5KLgEsbQcvNzs8zO5QbhzUK4MAjL9yJFDpwsF12lY,36005 -email_validator/validate_email.py,sha256=YUXY5Sv_mQ7Vuu_AmGdISza8v-VaABnNMLrlWv8EIl4,8401 -email_validator/version.py,sha256=DKk-1b-rZsJFxFi1JoJ7TmEvIEQ0rf-C9HAZWwvjuM0,22 diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/WHEEL deleted file mode 100644 index 9086d27..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (70.1.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/entry_points.txt b/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/entry_points.txt deleted file mode 100644 index 03c6e23..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -email_validator = email_validator.__main__:main diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/top_level.txt deleted file mode 100644 index 798fd5e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator-2.2.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -email_validator diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__init__.py b/write-message/venv/lib/python3.10/site-packages/email_validator/__init__.py deleted file mode 100644 index 626aa00..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/__init__.py +++ /dev/null @@ -1,101 +0,0 @@ -from typing import TYPE_CHECKING - -# Export the main method, helper methods, and the public data types. -from .exceptions_types import ValidatedEmail, EmailNotValidError, \ - EmailSyntaxError, EmailUndeliverableError -from .validate_email import validate_email -from .version import __version__ - -__all__ = ["validate_email", - "ValidatedEmail", "EmailNotValidError", - "EmailSyntaxError", "EmailUndeliverableError", - "caching_resolver", "__version__"] - -if TYPE_CHECKING: - from .deliverability import caching_resolver -else: - def caching_resolver(*args, **kwargs): - # Lazy load `deliverability` as it is slow to import (due to dns.resolver) - from .deliverability import caching_resolver - - return caching_resolver(*args, **kwargs) - - -# These global attributes are a part of the library's API and can be -# changed by library users. - -# Default values for keyword arguments. - -ALLOW_SMTPUTF8 = True -ALLOW_QUOTED_LOCAL = False -ALLOW_DOMAIN_LITERAL = False -ALLOW_DISPLAY_NAME = False -GLOBALLY_DELIVERABLE = True -CHECK_DELIVERABILITY = True -TEST_ENVIRONMENT = False -DEFAULT_TIMEOUT = 15 # secs - -# IANA Special Use Domain Names -# Last Updated 2021-09-21 -# https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.txt -# -# The domain names without dots would be caught by the check that the domain -# name in an email address must have a period, but this list will also catch -# subdomains of these domains, which are also reserved. -SPECIAL_USE_DOMAIN_NAMES = [ - # The "arpa" entry here is consolidated from a lot of arpa subdomains - # for private address (i.e. non-routable IP addresses like 172.16.x.x) - # reverse mapping, plus some other subdomains. Although RFC 6761 says - # that application software should not treat these domains as special, - # they are private-use domains and so cannot have globally deliverable - # email addresses, which is an assumption of this library, and probably - # all of arpa is similarly special-use, so we reject it all. - "arpa", - - # RFC 6761 says applications "SHOULD NOT" treat the "example" domains - # as special, i.e. applications should accept these domains. - # - # The domain "example" alone fails our syntax validation because it - # lacks a dot (we assume no one has an email address on a TLD directly). - # "@example.com/net/org" will currently fail DNS-based deliverability - # checks because IANA publishes a NULL MX for these domains, and - # "@mail.example[.com/net/org]" and other subdomains will fail DNS- - # based deliverability checks because IANA does not publish MX or A - # DNS records for these subdomains. - # "example", # i.e. "wwww.example" - # "example.com", - # "example.net", - # "example.org", - - # RFC 6761 says that applications are permitted to treat this domain - # as special and that DNS should return an immediate negative response, - # so we also immediately reject this domain, which also follows the - # purpose of the domain. - "invalid", - - # RFC 6762 says that applications "may" treat ".local" as special and - # that "name resolution APIs and libraries SHOULD recognize these names - # as special," and since ".local" has no global definition, we reject - # it, as we expect email addresses to be gloally routable. - "local", - - # RFC 6761 says that applications (like this library) are permitted - # to treat "localhost" as special, and since it cannot have a globally - # deliverable email address, we reject it. - "localhost", - - # RFC 7686 says "applications that do not implement the Tor protocol - # SHOULD generate an error upon the use of .onion and SHOULD NOT - # perform a DNS lookup. - "onion", - - # Although RFC 6761 says that application software should not treat - # these domains as special, it also warns users that the address may - # resolve differently in different systems, and therefore it cannot - # have a globally routable email address, which is an assumption of - # this library, so we reject "@test" and "@*.test" addresses, unless - # the test_environment keyword argument is given, to allow their use - # in application-level test environments. These domains will generally - # fail deliverability checks because "test" is not an actual TLD. - "test", -] diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__main__.py b/write-message/venv/lib/python3.10/site-packages/email_validator/__main__.py deleted file mode 100644 index 52791c7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/__main__.py +++ /dev/null @@ -1,60 +0,0 @@ -# A command-line tool for testing. -# -# Usage: -# -# python -m email_validator test@example.org -# python -m email_validator < LIST_OF_ADDRESSES.TXT -# -# Provide email addresses to validate either as a command-line argument -# or in STDIN separated by newlines. Validation errors will be printed for -# invalid email addresses. When passing an email address on the command -# line, if the email address is valid, information about it will be printed. -# When using STDIN, no output will be given for valid email addresses. -# -# Keyword arguments to validate_email can be set in environment variables -# of the same name but upprcase (see below). - -import json -import os -import sys -from typing import Any, Dict, Optional - -from .validate_email import validate_email, _Resolver -from .deliverability import caching_resolver -from .exceptions_types import EmailNotValidError - - -def main(dns_resolver: Optional[_Resolver] = None) -> None: - # The dns_resolver argument is for tests. - - # Set options from environment variables. - options: Dict[str, Any] = {} - for varname in ('ALLOW_SMTPUTF8', 'ALLOW_QUOTED_LOCAL', 'ALLOW_DOMAIN_LITERAL', - 'GLOBALLY_DELIVERABLE', 'CHECK_DELIVERABILITY', 'TEST_ENVIRONMENT'): - if varname in os.environ: - options[varname.lower()] = bool(os.environ[varname]) - for varname in ('DEFAULT_TIMEOUT',): - if varname in os.environ: - options[varname.lower()] = float(os.environ[varname]) - - if len(sys.argv) == 1: - # Validate the email addresses pased line-by-line on STDIN. - dns_resolver = dns_resolver or caching_resolver() - for line in sys.stdin: - email = line.strip() - try: - validate_email(email, dns_resolver=dns_resolver, **options) - except EmailNotValidError as e: - print(f"{email} {e}") - else: - # Validate the email address passed on the command line. - email = sys.argv[1] - try: - result = validate_email(email, dns_resolver=dns_resolver, **options) - print(json.dumps(result.as_dict(), indent=2, sort_keys=True, ensure_ascii=False)) - except EmailNotValidError as e: - print(e) - - -if __name__ == "__main__": - main() diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index ceb508a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/__main__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/__main__.cpython-310.pyc deleted file mode 100644 index 2585249..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/__main__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/deliverability.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/deliverability.cpython-310.pyc deleted file mode 100644 index 69f1ef0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/deliverability.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/exceptions_types.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/exceptions_types.cpython-310.pyc deleted file mode 100644 index 8dc6d02..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/exceptions_types.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/rfc_constants.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/rfc_constants.cpython-310.pyc deleted file mode 100644 index 900c5b0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/rfc_constants.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/syntax.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/syntax.cpython-310.pyc deleted file mode 100644 index e9f6c19..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/syntax.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/validate_email.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/validate_email.cpython-310.pyc deleted file mode 100644 index fbe064c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/validate_email.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/version.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/version.cpython-310.pyc deleted file mode 100644 index 2078ac8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/email_validator/__pycache__/version.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/deliverability.py b/write-message/venv/lib/python3.10/site-packages/email_validator/deliverability.py deleted file mode 100644 index 90f5f9a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/deliverability.py +++ /dev/null @@ -1,159 +0,0 @@ -from typing import Any, List, Optional, Tuple, TypedDict - -import ipaddress - -from .exceptions_types import EmailUndeliverableError - -import dns.resolver -import dns.exception - - -def caching_resolver(*, timeout: Optional[int] = None, cache: Any = None, dns_resolver: Optional[dns.resolver.Resolver] = None) -> dns.resolver.Resolver: - if timeout is None: - from . import DEFAULT_TIMEOUT - timeout = DEFAULT_TIMEOUT - resolver = dns_resolver or dns.resolver.Resolver() - resolver.cache = cache or dns.resolver.LRUCache() - resolver.lifetime = timeout # timeout, in seconds - return resolver - - -DeliverabilityInfo = TypedDict("DeliverabilityInfo", { - "mx": List[Tuple[int, str]], - "mx_fallback_type": Optional[str], - "unknown-deliverability": str, -}, total=False) - - -def validate_email_deliverability(domain: str, domain_i18n: str, timeout: Optional[int] = None, dns_resolver: Optional[dns.resolver.Resolver] = None) -> DeliverabilityInfo: - # Check that the domain resolves to an MX record. If there is no MX record, - # try an A or AAAA record which is a deprecated fallback for deliverability. - # Raises an EmailUndeliverableError on failure. On success, returns a dict - # with deliverability information. - - # If no dns.resolver.Resolver was given, get dnspython's default resolver. - # Override the default resolver's timeout. This may affect other uses of - # dnspython in this process. - if dns_resolver is None: - from . import DEFAULT_TIMEOUT - if timeout is None: - timeout = DEFAULT_TIMEOUT - dns_resolver = dns.resolver.get_default_resolver() - dns_resolver.lifetime = timeout - elif timeout is not None: - raise ValueError("It's not valid to pass both timeout and dns_resolver.") - - deliverability_info: DeliverabilityInfo = {} - - try: - try: - # Try resolving for MX records (RFC 5321 Section 5). - response = dns_resolver.resolve(domain, "MX") - - # For reporting, put them in priority order and remove the trailing dot in the qnames. - mtas = sorted([(r.preference, str(r.exchange).rstrip('.')) for r in response]) - - # RFC 7505: Null MX (0, ".") records signify the domain does not accept email. - # Remove null MX records from the mtas list (but we've stripped trailing dots, - # so the 'exchange' is just "") so we can check if there are no non-null MX - # records remaining. - mtas = [(preference, exchange) for preference, exchange in mtas - if exchange != ""] - if len(mtas) == 0: # null MX only, if there were no MX records originally a NoAnswer exception would have occurred - raise EmailUndeliverableError(f"The domain name {domain_i18n} does not accept email.") - - deliverability_info["mx"] = mtas - deliverability_info["mx_fallback_type"] = None - - except dns.resolver.NoAnswer: - # If there was no MX record, fall back to an A or AAA record - # (RFC 5321 Section 5). Check A first since it's more common. - - # If the A/AAAA response has no Globally Reachable IP address, - # treat the response as if it were NoAnswer, i.e., the following - # address types are not allowed fallbacks: Private-Use, Loopback, - # Link-Local, and some other obscure ranges. See - # https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml - # https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml - # (Issue #134.) - def is_global_addr(address: Any) -> bool: - try: - ipaddr = ipaddress.ip_address(address) - except ValueError: - return False - return ipaddr.is_global - - try: - response = dns_resolver.resolve(domain, "A") - - if not any(is_global_addr(r.address) for r in response): - raise dns.resolver.NoAnswer # fall back to AAAA - - deliverability_info["mx"] = [(0, domain)] - deliverability_info["mx_fallback_type"] = "A" - - except dns.resolver.NoAnswer: - - # If there was no A record, fall back to an AAAA record. - # (It's unclear if SMTP servers actually do this.) - try: - response = dns_resolver.resolve(domain, "AAAA") - - if not any(is_global_addr(r.address) for r in response): - raise dns.resolver.NoAnswer - - deliverability_info["mx"] = [(0, domain)] - deliverability_info["mx_fallback_type"] = "AAAA" - - except dns.resolver.NoAnswer as e: - # If there was no MX, A, or AAAA record, then mail to - # this domain is not deliverable, although the domain - # name has other records (otherwise NXDOMAIN would - # have been raised). - raise EmailUndeliverableError(f"The domain name {domain_i18n} does not accept email.") from e - - # Check for a SPF (RFC 7208) reject-all record ("v=spf1 -all") which indicates - # no emails are sent from this domain (similar to a Null MX record - # but for sending rather than receiving). In combination with the - # absence of an MX record, this is probably a good sign that the - # domain is not used for email. - try: - response = dns_resolver.resolve(domain, "TXT") - for rec in response: - value = b"".join(rec.strings) - if value.startswith(b"v=spf1 "): - if value == b"v=spf1 -all": - raise EmailUndeliverableError(f"The domain name {domain_i18n} does not send email.") - except dns.resolver.NoAnswer: - # No TXT records means there is no SPF policy, so we cannot take any action. - pass - - except dns.resolver.NXDOMAIN as e: - # The domain name does not exist --- there are no records of any sort - # for the domain name. - raise EmailUndeliverableError(f"The domain name {domain_i18n} does not exist.") from e - - except dns.resolver.NoNameservers: - # All nameservers failed to answer the query. This might be a problem - # with local nameservers, maybe? We'll allow the domain to go through. - return { - "unknown-deliverability": "no_nameservers", - } - - except dns.exception.Timeout: - # A timeout could occur for various reasons, so don't treat it as a failure. - return { - "unknown-deliverability": "timeout", - } - - except EmailUndeliverableError: - # Don't let these get clobbered by the wider except block below. - raise - - except Exception as e: - # Unhandled conditions should not propagate. - raise EmailUndeliverableError( - "There was an error while checking if the domain name in the email address is deliverable: " + str(e) - ) from e - - return deliverability_info diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/exceptions_types.py b/write-message/venv/lib/python3.10/site-packages/email_validator/exceptions_types.py deleted file mode 100644 index 928a94f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/exceptions_types.py +++ /dev/null @@ -1,141 +0,0 @@ -import warnings -from typing import Any, Dict, List, Optional, Tuple, Union - - -class EmailNotValidError(ValueError): - """Parent class of all exceptions raised by this module.""" - pass - - -class EmailSyntaxError(EmailNotValidError): - """Exception raised when an email address fails validation because of its form.""" - pass - - -class EmailUndeliverableError(EmailNotValidError): - """Exception raised when an email address fails validation because its domain name does not appear deliverable.""" - pass - - -class ValidatedEmail: - """The validate_email function returns objects of this type holding the normalized form of the email address - and other information.""" - - """The email address that was passed to validate_email. (If passed as bytes, this will be a string.)""" - original: str - - """The normalized email address, which should always be used in preference to the original address. - The normalized address converts an IDNA ASCII domain name to Unicode, if possible, and performs - Unicode normalization on the local part and on the domain (if originally Unicode). It is the - concatenation of the local_part and domain attributes, separated by an @-sign.""" - normalized: str - - """The local part of the email address after Unicode normalization.""" - local_part: str - - """The domain part of the email address after Unicode normalization or conversion to - Unicode from IDNA ascii.""" - domain: str - - """If the domain part is a domain literal, the IPv4Address or IPv6Address object.""" - domain_address: object - - """If not None, a form of the email address that uses 7-bit ASCII characters only.""" - ascii_email: Optional[str] - - """If not None, the local part of the email address using 7-bit ASCII characters only.""" - ascii_local_part: Optional[str] - - """A form of the domain name that uses 7-bit ASCII characters only.""" - ascii_domain: str - - """If True, the SMTPUTF8 feature of your mail relay will be required to transmit messages - to this address. This flag is True just when ascii_local_part is missing. Otherwise it - is False.""" - smtputf8: bool - - """If a deliverability check is performed and if it succeeds, a list of (priority, domain) - tuples of MX records specified in the DNS for the domain.""" - mx: List[Tuple[int, str]] - - """If no MX records are actually specified in DNS and instead are inferred, through an obsolete - mechanism, from A or AAAA records, the value is the type of DNS record used instead (`A` or `AAAA`).""" - mx_fallback_type: Optional[str] - - """The display name in the original input text, unquoted and unescaped, or None.""" - display_name: Optional[str] - - def __repr__(self) -> str: - return f"" - - """For backwards compatibility, support old field names.""" - def __getattr__(self, key: str) -> str: - if key == "original_email": - return self.original - if key == "email": - return self.normalized - raise AttributeError(key) - - @property - def email(self) -> str: - warnings.warn("ValidatedEmail.email is deprecated and will be removed, use ValidatedEmail.normalized instead", DeprecationWarning) - return self.normalized - - """For backwards compatibility, some fields are also exposed through a dict-like interface. Note - that some of the names changed when they became attributes.""" - def __getitem__(self, key: str) -> Union[Optional[str], bool, List[Tuple[int, str]]]: - warnings.warn("dict-like access to the return value of validate_email is deprecated and may not be supported in the future.", DeprecationWarning, stacklevel=2) - if key == "email": - return self.normalized - if key == "email_ascii": - return self.ascii_email - if key == "local": - return self.local_part - if key == "domain": - return self.ascii_domain - if key == "domain_i18n": - return self.domain - if key == "smtputf8": - return self.smtputf8 - if key == "mx": - return self.mx - if key == "mx-fallback": - return self.mx_fallback_type - raise KeyError() - - """Tests use this.""" - def __eq__(self, other: object) -> bool: - if not isinstance(other, ValidatedEmail): - return False - return ( - self.normalized == other.normalized - and self.local_part == other.local_part - and self.domain == other.domain - and getattr(self, 'ascii_email', None) == getattr(other, 'ascii_email', None) - and getattr(self, 'ascii_local_part', None) == getattr(other, 'ascii_local_part', None) - and getattr(self, 'ascii_domain', None) == getattr(other, 'ascii_domain', None) - and self.smtputf8 == other.smtputf8 - and repr(sorted(self.mx) if getattr(self, 'mx', None) else None) - == repr(sorted(other.mx) if getattr(other, 'mx', None) else None) - and getattr(self, 'mx_fallback_type', None) == getattr(other, 'mx_fallback_type', None) - and getattr(self, 'display_name', None) == getattr(other, 'display_name', None) - ) - - """This helps producing the README.""" - def as_constructor(self) -> str: - return "ValidatedEmail(" \ - + ",".join(f"\n {key}={repr(getattr(self, key))}" - for key in ('normalized', 'local_part', 'domain', - 'ascii_email', 'ascii_local_part', 'ascii_domain', - 'smtputf8', 'mx', 'mx_fallback_type', - 'display_name') - if hasattr(self, key) - ) \ - + ")" - - """Convenience method for accessing ValidatedEmail as a dict""" - def as_dict(self) -> Dict[str, Any]: - d = self.__dict__ - if d.get('domain_address'): - d['domain_address'] = repr(d['domain_address']) - return d diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/py.typed b/write-message/venv/lib/python3.10/site-packages/email_validator/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/rfc_constants.py b/write-message/venv/lib/python3.10/site-packages/email_validator/rfc_constants.py deleted file mode 100644 index 39d8e31..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/rfc_constants.py +++ /dev/null @@ -1,51 +0,0 @@ -# These constants are defined by the email specifications. - -import re - -# Based on RFC 5322 3.2.3, these characters are permitted in email -# addresses (not taking into account internationalization) separated by dots: -ATEXT = r'a-zA-Z0-9_!#\$%&\'\*\+\-/=\?\^`\{\|\}~' -ATEXT_RE = re.compile('[.' + ATEXT + ']') # ATEXT plus dots -DOT_ATOM_TEXT = re.compile('[' + ATEXT + ']+(?:\\.[' + ATEXT + r']+)*\Z') - -# RFC 6531 3.3 extends the allowed characters in internationalized -# addresses to also include three specific ranges of UTF8 defined in -# RFC 3629 section 4, which appear to be the Unicode code points from -# U+0080 to U+10FFFF. -ATEXT_INTL = ATEXT + "\u0080-\U0010FFFF" -ATEXT_INTL_DOT_RE = re.compile('[.' + ATEXT_INTL + ']') # ATEXT_INTL plus dots -DOT_ATOM_TEXT_INTL = re.compile('[' + ATEXT_INTL + ']+(?:\\.[' + ATEXT_INTL + r']+)*\Z') - -# The domain part of the email address, after IDNA (ASCII) encoding, -# must also satisfy the requirements of RFC 952/RFC 1123 2.1 which -# restrict the allowed characters of hostnames further. -ATEXT_HOSTNAME_INTL = re.compile(r"[a-zA-Z0-9\-\." + "\u0080-\U0010FFFF" + "]") -HOSTNAME_LABEL = r'(?:(?:[a-zA-Z0-9][a-zA-Z0-9\-]*)?[a-zA-Z0-9])' -DOT_ATOM_TEXT_HOSTNAME = re.compile(HOSTNAME_LABEL + r'(?:\.' + HOSTNAME_LABEL + r')*\Z') -DOMAIN_NAME_REGEX = re.compile(r"[A-Za-z]\Z") # all TLDs currently end with a letter - -# Domain literal (RFC 5322 3.4.1) -DOMAIN_LITERAL_CHARS = re.compile(r"[\u0021-\u00FA\u005E-\u007E]") - -# Quoted-string local part (RFC 5321 4.1.2, internationalized by RFC 6531 3.3) -# The permitted characters in a quoted string are the characters in the range -# 32-126, except that quotes and (literal) backslashes can only appear when escaped -# by a backslash. When internationalized, UTF-8 strings are also permitted except -# the ASCII characters that are not previously permitted (see above). -# QUOTED_LOCAL_PART_ADDR = re.compile(r"^\"((?:[\u0020-\u0021\u0023-\u005B\u005D-\u007E]|\\[\u0020-\u007E])*)\"@(.*)") -QTEXT_INTL = re.compile(r"[\u0020-\u007E\u0080-\U0010FFFF]") - -# Length constants -# RFC 3696 + errata 1003 + errata 1690 (https://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690) -# explains the maximum length of an email address is 254 octets. -EMAIL_MAX_LENGTH = 254 -LOCAL_PART_MAX_LENGTH = 64 -DNS_LABEL_LENGTH_LIMIT = 63 # in "octets", RFC 1035 2.3.1 -DOMAIN_MAX_LENGTH = 253 # in "octets" as transmitted, RFC 1035 2.3.4 and RFC 5321 4.5.3.1.2, and see https://stackoverflow.com/questions/32290167/what-is-the-maximum-length-of-a-dns-name - -# RFC 2142 -CASE_INSENSITIVE_MAILBOX_NAMES = [ - 'info', 'marketing', 'sales', 'support', # section 3 - 'abuse', 'noc', 'security', # section 4 - 'postmaster', 'hostmaster', 'usenet', 'news', 'webmaster', 'www', 'uucp', 'ftp', # section 5 -] diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/syntax.py b/write-message/venv/lib/python3.10/site-packages/email_validator/syntax.py deleted file mode 100644 index c655451..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/syntax.py +++ /dev/null @@ -1,761 +0,0 @@ -from .exceptions_types import EmailSyntaxError, ValidatedEmail -from .rfc_constants import EMAIL_MAX_LENGTH, LOCAL_PART_MAX_LENGTH, DOMAIN_MAX_LENGTH, \ - DOT_ATOM_TEXT, DOT_ATOM_TEXT_INTL, ATEXT_RE, ATEXT_INTL_DOT_RE, ATEXT_HOSTNAME_INTL, QTEXT_INTL, \ - DNS_LABEL_LENGTH_LIMIT, DOT_ATOM_TEXT_HOSTNAME, DOMAIN_NAME_REGEX, DOMAIN_LITERAL_CHARS - -import re -import unicodedata -import idna # implements IDNA 2008; Python's codec is only IDNA 2003 -import ipaddress -from typing import Optional, Tuple, TypedDict, Union - - -def split_email(email: str) -> Tuple[Optional[str], str, str, bool]: - # Return the display name, unescaped local part, and domain part - # of the address, and whether the local part was quoted. If no - # display name was present and angle brackets do not surround - # the address, display name will be None; otherwise, it will be - # set to the display name or the empty string if there were - # angle brackets but no display name. - - # Typical email addresses have a single @-sign and no quote - # characters, but the awkward "quoted string" local part form - # (RFC 5321 4.1.2) allows @-signs and escaped quotes to appear - # in the local part if the local part is quoted. - - # A `display name ` format is also present in MIME messages - # (RFC 5322 3.4) and this format is also often recognized in - # mail UIs. It's not allowed in SMTP commands or in typical web - # login forms, but parsing it has been requested, so it's done - # here as a convenience. It's implemented in the spirit but not - # the letter of RFC 5322 3.4 because MIME messages allow newlines - # and comments as a part of the CFWS rule, but this is typically - # not allowed in mail UIs (although comment syntax was requested - # once too). - # - # Display names are either basic characters (the same basic characters - # permitted in email addresses, but periods are not allowed and spaces - # are allowed; see RFC 5322 Appendix A.1.2), or or a quoted string with - # the same rules as a quoted local part. (Multiple quoted strings might - # be allowed? Unclear.) Optional space (RFC 5322 3.4 CFWS) and then the - # email address follows in angle brackets. - # - # An initial quote is ambiguous between starting a display name or - # a quoted local part --- fun. - # - # We assume the input string is already stripped of leading and - # trailing CFWS. - - def split_string_at_unquoted_special(text: str, specials: Tuple[str, ...]) -> Tuple[str, str]: - # Split the string at the first character in specials (an @-sign - # or left angle bracket) that does not occur within quotes and - # is not followed by a Unicode combining character. - # If no special character is found, raise an error. - inside_quote = False - escaped = False - left_part = "" - for i, c in enumerate(text): - # < plus U+0338 (Combining Long Solidus Overlay) normalizes to - # ≮ U+226E (Not Less-Than), and it would be confusing to treat - # the < as the start of "" syntax in that case. Liekwise, - # if anything combines with an @ or ", we should probably not - # treat it as a special character. - if unicodedata.normalize("NFC", text[i:])[0] != c: - left_part += c - - elif inside_quote: - left_part += c - if c == '\\' and not escaped: - escaped = True - elif c == '"' and not escaped: - # The only way to exit the quote is an unescaped quote. - inside_quote = False - escaped = False - else: - escaped = False - elif c == '"': - left_part += c - inside_quote = True - elif c in specials: - # When unquoted, stop before a special character. - break - else: - left_part += c - - if len(left_part) == len(text): - raise EmailSyntaxError("An email address must have an @-sign.") - - # The right part is whatever is left. - right_part = text[len(left_part):] - - return left_part, right_part - - def unquote_quoted_string(text: str) -> Tuple[str, bool]: - # Remove surrounding quotes and unescape escaped backslashes - # and quotes. Escapes are parsed liberally. I think only - # backslashes and quotes can be escaped but we'll allow anything - # to be. - quoted = False - escaped = False - value = "" - for i, c in enumerate(text): - if quoted: - if escaped: - value += c - escaped = False - elif c == '\\': - escaped = True - elif c == '"': - if i != len(text) - 1: - raise EmailSyntaxError("Extra character(s) found after close quote: " - + ", ".join(safe_character_display(c) for c in text[i + 1:])) - break - else: - value += c - elif i == 0 and c == '"': - quoted = True - else: - value += c - - return value, quoted - - # Split the string at the first unquoted @-sign or left angle bracket. - left_part, right_part = split_string_at_unquoted_special(email, ("@", "<")) - - # If the right part starts with an angle bracket, - # then the left part is a display name and the rest - # of the right part up to the final right angle bracket - # is the email address, . - if right_part.startswith("<"): - # Remove space between the display name and angle bracket. - left_part = left_part.rstrip() - - # Unquote and unescape the display name. - display_name, display_name_quoted = unquote_quoted_string(left_part) - - # Check that only basic characters are present in a - # non-quoted display name. - if not display_name_quoted: - bad_chars = { - safe_character_display(c) - for c in display_name - if (not ATEXT_RE.match(c) and c != ' ') or c == '.' - } - if bad_chars: - raise EmailSyntaxError("The display name contains invalid characters when not quoted: " + ", ".join(sorted(bad_chars)) + ".") - - # Check for other unsafe characters. - check_unsafe_chars(display_name, allow_space=True) - - # Check that the right part ends with an angle bracket - # but allow spaces after it, I guess. - if ">" not in right_part: - raise EmailSyntaxError("An open angle bracket at the start of the email address has to be followed by a close angle bracket at the end.") - right_part = right_part.rstrip(" ") - if right_part[-1] != ">": - raise EmailSyntaxError("There can't be anything after the email address.") - - # Remove the initial and trailing angle brackets. - addr_spec = right_part[1:].rstrip(">") - - # Split the email address at the first unquoted @-sign. - local_part, domain_part = split_string_at_unquoted_special(addr_spec, ("@",)) - - # Otherwise there is no display name. The left part is the local - # part and the right part is the domain. - else: - display_name = None - local_part, domain_part = left_part, right_part - - if domain_part.startswith("@"): - domain_part = domain_part[1:] - - # Unquote the local part if it is quoted. - local_part, is_quoted_local_part = unquote_quoted_string(local_part) - - return display_name, local_part, domain_part, is_quoted_local_part - - -def get_length_reason(addr: str, limit: int) -> str: - """Helper function to return an error message related to invalid length.""" - diff = len(addr) - limit - suffix = "s" if diff > 1 else "" - return f"({diff} character{suffix} too many)" - - -def safe_character_display(c: str) -> str: - # Return safely displayable characters in quotes. - if c == '\\': - return f"\"{c}\"" # can't use repr because it escapes it - if unicodedata.category(c)[0] in ("L", "N", "P", "S"): - return repr(c) - - # Construct a hex string in case the unicode name doesn't exist. - if ord(c) < 0xFFFF: - h = f"U+{ord(c):04x}".upper() - else: - h = f"U+{ord(c):08x}".upper() - - # Return the character name or, if it has no name, the hex string. - return unicodedata.name(c, h) - - -class LocalPartValidationResult(TypedDict): - local_part: str - ascii_local_part: Optional[str] - smtputf8: bool - - -def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_empty_local: bool = False, - quoted_local_part: bool = False) -> LocalPartValidationResult: - """Validates the syntax of the local part of an email address.""" - - if len(local) == 0: - if not allow_empty_local: - raise EmailSyntaxError("There must be something before the @-sign.") - - # The caller allows an empty local part. Useful for validating certain - # Postfix aliases. - return { - "local_part": local, - "ascii_local_part": local, - "smtputf8": False, - } - - # Check the length of the local part by counting characters. - # (RFC 5321 4.5.3.1.1) - # We're checking the number of characters here. If the local part - # is ASCII-only, then that's the same as bytes (octets). If it's - # internationalized, then the UTF-8 encoding may be longer, but - # that may not be relevant. We will check the total address length - # instead. - if len(local) > LOCAL_PART_MAX_LENGTH: - reason = get_length_reason(local, limit=LOCAL_PART_MAX_LENGTH) - raise EmailSyntaxError(f"The email address is too long before the @-sign {reason}.") - - # Check the local part against the non-internationalized regular expression. - # Most email addresses match this regex so it's probably fastest to check this first. - # (RFC 5322 3.2.3) - # All local parts matching the dot-atom rule are also valid as a quoted string - # so if it was originally quoted (quoted_local_part is True) and this regex matches, - # it's ok. - # (RFC 5321 4.1.2 / RFC 5322 3.2.4). - if DOT_ATOM_TEXT.match(local): - # It's valid. And since it's just the permitted ASCII characters, - # it's normalized and safe. If the local part was originally quoted, - # the quoting was unnecessary and it'll be returned as normalized to - # non-quoted form. - - # Return the local part and flag that SMTPUTF8 is not needed. - return { - "local_part": local, - "ascii_local_part": local, - "smtputf8": False, - } - - # The local part failed the basic dot-atom check. Try the extended character set - # for internationalized addresses. It's the same pattern but with additional - # characters permitted. - # RFC 6531 section 3.3. - valid: Optional[str] = None - requires_smtputf8 = False - if DOT_ATOM_TEXT_INTL.match(local): - # But international characters in the local part may not be permitted. - if not allow_smtputf8: - # Check for invalid characters against the non-internationalized - # permitted character set. - # (RFC 5322 3.2.3) - bad_chars = { - safe_character_display(c) - for c in local - if not ATEXT_RE.match(c) - } - if bad_chars: - raise EmailSyntaxError("Internationalized characters before the @-sign are not supported: " + ", ".join(sorted(bad_chars)) + ".") - - # Although the check above should always find something, fall back to this just in case. - raise EmailSyntaxError("Internationalized characters before the @-sign are not supported.") - - # It's valid. - valid = "dot-atom" - requires_smtputf8 = True - - # There are no syntactic restrictions on quoted local parts, so if - # it was originally quoted, it is probably valid. More characters - # are allowed, like @-signs, spaces, and quotes, and there are no - # restrictions on the placement of dots, as in dot-atom local parts. - elif quoted_local_part: - # Check for invalid characters in a quoted string local part. - # (RFC 5321 4.1.2. RFC 5322 lists additional permitted *obsolete* - # characters which are *not* allowed here. RFC 6531 section 3.3 - # extends the range to UTF8 strings.) - bad_chars = { - safe_character_display(c) - for c in local - if not QTEXT_INTL.match(c) - } - if bad_chars: - raise EmailSyntaxError("The email address contains invalid characters in quotes before the @-sign: " + ", ".join(sorted(bad_chars)) + ".") - - # See if any characters are outside of the ASCII range. - bad_chars = { - safe_character_display(c) - for c in local - if not (32 <= ord(c) <= 126) - } - if bad_chars: - requires_smtputf8 = True - - # International characters in the local part may not be permitted. - if not allow_smtputf8: - raise EmailSyntaxError("Internationalized characters before the @-sign are not supported: " + ", ".join(sorted(bad_chars)) + ".") - - # It's valid. - valid = "quoted" - - # If the local part matches the internationalized dot-atom form or was quoted, - # perform additional checks for Unicode strings. - if valid: - # Check that the local part is a valid, safe, and sensible Unicode string. - # Some of this may be redundant with the range U+0080 to U+10FFFF that is checked - # by DOT_ATOM_TEXT_INTL and QTEXT_INTL. Other characters may be permitted by the - # email specs, but they may not be valid, safe, or sensible Unicode strings. - # See the function for rationale. - check_unsafe_chars(local, allow_space=(valid == "quoted")) - - # Try encoding to UTF-8. Failure is possible with some characters like - # surrogate code points, but those are checked above. Still, we don't - # want to have an unhandled exception later. - try: - local.encode("utf8") - except ValueError as e: - raise EmailSyntaxError("The email address contains an invalid character.") from e - - # If this address passes only by the quoted string form, re-quote it - # and backslash-escape quotes and backslashes (removing any unnecessary - # escapes). Per RFC 5321 4.1.2, "all quoted forms MUST be treated as equivalent, - # and the sending system SHOULD transmit the form that uses the minimum quoting possible." - if valid == "quoted": - local = '"' + re.sub(r'(["\\])', r'\\\1', local) + '"' - - return { - "local_part": local, - "ascii_local_part": local if not requires_smtputf8 else None, - "smtputf8": requires_smtputf8, - } - - # It's not a valid local part. Let's find out why. - # (Since quoted local parts are all valid or handled above, these checks - # don't apply in those cases.) - - # Check for invalid characters. - # (RFC 5322 3.2.3, plus RFC 6531 3.3) - bad_chars = { - safe_character_display(c) - for c in local - if not ATEXT_INTL_DOT_RE.match(c) - } - if bad_chars: - raise EmailSyntaxError("The email address contains invalid characters before the @-sign: " + ", ".join(sorted(bad_chars)) + ".") - - # Check for dot errors imposted by the dot-atom rule. - # (RFC 5322 3.2.3) - check_dot_atom(local, 'An email address cannot start with a {}.', 'An email address cannot have a {} immediately before the @-sign.', is_hostname=False) - - # All of the reasons should already have been checked, but just in case - # we have a fallback message. - raise EmailSyntaxError("The email address contains invalid characters before the @-sign.") - - -def check_unsafe_chars(s: str, allow_space: bool = False) -> None: - # Check for unsafe characters or characters that would make the string - # invalid or non-sensible Unicode. - bad_chars = set() - for i, c in enumerate(s): - category = unicodedata.category(c) - if category[0] in ("L", "N", "P", "S"): - # Letters, numbers, punctuation, and symbols are permitted. - pass - elif category[0] == "M": - # Combining character in first position would combine with something - # outside of the email address if concatenated, so they are not safe. - # We also check if this occurs after the @-sign, which would not be - # sensible because it would modify the @-sign. - if i == 0: - bad_chars.add(c) - elif category == "Zs": - # Spaces outside of the ASCII range are not specifically disallowed in - # internationalized addresses as far as I can tell, but they violate - # the spirit of the non-internationalized specification that email - # addresses do not contain ASCII spaces when not quoted. Excluding - # ASCII spaces when not quoted is handled directly by the atom regex. - # - # In quoted-string local parts, spaces are explicitly permitted, and - # the ASCII space has category Zs, so we must allow it here, and we'll - # allow all Unicode spaces to be consistent. - if not allow_space: - bad_chars.add(c) - elif category[0] == "Z": - # The two line and paragraph separator characters (in categories Zl and Zp) - # are not specifically disallowed in internationalized addresses - # as far as I can tell, but they violate the spirit of the non-internationalized - # specification that email addresses do not contain line breaks when not quoted. - bad_chars.add(c) - elif category[0] == "C": - # Control, format, surrogate, private use, and unassigned code points (C) - # are all unsafe in various ways. Control and format characters can affect - # text rendering if the email address is concatenated with other text. - # Bidirectional format characters are unsafe, even if used properly, because - # they cause an email address to render as a different email address. - # Private use characters do not make sense for publicly deliverable - # email addresses. - bad_chars.add(c) - else: - # All categories should be handled above, but in case there is something new - # to the Unicode specification in the future, reject all other categories. - bad_chars.add(c) - if bad_chars: - raise EmailSyntaxError("The email address contains unsafe characters: " - + ", ".join(safe_character_display(c) for c in sorted(bad_chars)) + ".") - - -def check_dot_atom(label: str, start_descr: str, end_descr: str, is_hostname: bool) -> None: - # RFC 5322 3.2.3 - if label.endswith("."): - raise EmailSyntaxError(end_descr.format("period")) - if label.startswith("."): - raise EmailSyntaxError(start_descr.format("period")) - if ".." in label: - raise EmailSyntaxError("An email address cannot have two periods in a row.") - - if is_hostname: - # RFC 952 - if label.endswith("-"): - raise EmailSyntaxError(end_descr.format("hyphen")) - if label.startswith("-"): - raise EmailSyntaxError(start_descr.format("hyphen")) - if ".-" in label or "-." in label: - raise EmailSyntaxError("An email address cannot have a period and a hyphen next to each other.") - - -class DomainNameValidationResult(TypedDict): - ascii_domain: str - domain: str - - -def validate_email_domain_name(domain: str, test_environment: bool = False, globally_deliverable: bool = True) -> DomainNameValidationResult: - """Validates the syntax of the domain part of an email address.""" - - # Check for invalid characters. - # (RFC 952 plus RFC 6531 section 3.3 for internationalized addresses) - bad_chars = { - safe_character_display(c) - for c in domain - if not ATEXT_HOSTNAME_INTL.match(c) - } - if bad_chars: - raise EmailSyntaxError("The part after the @-sign contains invalid characters: " + ", ".join(sorted(bad_chars)) + ".") - - # Check for unsafe characters. - # Some of this may be redundant with the range U+0080 to U+10FFFF that is checked - # by DOT_ATOM_TEXT_INTL. Other characters may be permitted by the email specs, but - # they may not be valid, safe, or sensible Unicode strings. - check_unsafe_chars(domain) - - # Perform UTS-46 normalization, which includes casefolding, NFC normalization, - # and converting all label separators (the period/full stop, fullwidth full stop, - # ideographic full stop, and halfwidth ideographic full stop) to regular dots. - # It will also raise an exception if there is an invalid character in the input, - # such as "⒈" which is invalid because it would expand to include a dot and - # U+1FEF which normalizes to a backtick, which is not an allowed hostname character. - # Since several characters *are* normalized to a dot, this has to come before - # checks related to dots, like check_dot_atom which comes next. - original_domain = domain - try: - domain = idna.uts46_remap(domain, std3_rules=False, transitional=False) - except idna.IDNAError as e: - raise EmailSyntaxError(f"The part after the @-sign contains invalid characters ({e}).") from e - - # Check for invalid characters after Unicode normalization which are not caught - # by uts46_remap (see tests for examples). - bad_chars = { - safe_character_display(c) - for c in domain - if not ATEXT_HOSTNAME_INTL.match(c) - } - if bad_chars: - raise EmailSyntaxError("The part after the @-sign contains invalid characters after Unicode normalization: " + ", ".join(sorted(bad_chars)) + ".") - - # The domain part is made up dot-separated "labels." Each label must - # have at least one character and cannot start or end with dashes, which - # means there are some surprising restrictions on periods and dashes. - # Check that before we do IDNA encoding because the IDNA library gives - # unfriendly errors for these cases, but after UTS-46 normalization because - # it can insert periods and hyphens (from fullwidth characters). - # (RFC 952, RFC 1123 2.1, RFC 5322 3.2.3) - check_dot_atom(domain, 'An email address cannot have a {} immediately after the @-sign.', 'An email address cannot end with a {}.', is_hostname=True) - - # Check for RFC 5890's invalid R-LDH labels, which are labels that start - # with two characters other than "xn" and two dashes. - for label in domain.split("."): - if re.match(r"(?!xn)..--", label, re.I): - raise EmailSyntaxError("An email address cannot have two letters followed by two dashes immediately after the @-sign or after a period, except Punycode.") - - if DOT_ATOM_TEXT_HOSTNAME.match(domain): - # This is a valid non-internationalized domain. - ascii_domain = domain - else: - # If international characters are present in the domain name, convert - # the domain to IDNA ASCII. If internationalized characters are present, - # the MTA must either support SMTPUTF8 or the mail client must convert the - # domain name to IDNA before submission. - # - # For ASCII-only domains, the transformation does nothing and is safe to - # apply. However, to ensure we don't rely on the idna library for basic - # syntax checks, we don't use it if it's not needed. - # - # idna.encode also checks the domain name length after encoding but it - # doesn't give a nice error, so we call the underlying idna.alabel method - # directly. idna.alabel checks label length and doesn't give great messages, - # but we can't easily go to lower level methods. - try: - ascii_domain = ".".join( - idna.alabel(label).decode("ascii") - for label in domain.split(".") - ) - except idna.IDNAError as e: - # Some errors would have already been raised by idna.uts46_remap. - raise EmailSyntaxError(f"The part after the @-sign is invalid ({e}).") from e - - # Check the syntax of the string returned by idna.encode. - # It should never fail. - if not DOT_ATOM_TEXT_HOSTNAME.match(ascii_domain): - raise EmailSyntaxError("The email address contains invalid characters after the @-sign after IDNA encoding.") - - # Check the length of the domain name in bytes. - # (RFC 1035 2.3.4 and RFC 5321 4.5.3.1.2) - # We're checking the number of bytes ("octets") here, which can be much - # higher than the number of characters in internationalized domains, - # on the assumption that the domain may be transmitted without SMTPUTF8 - # as IDNA ASCII. (This is also checked by idna.encode, so this exception - # is never reached for internationalized domains.) - if len(ascii_domain) > DOMAIN_MAX_LENGTH: - if ascii_domain == original_domain: - reason = get_length_reason(ascii_domain, limit=DOMAIN_MAX_LENGTH) - raise EmailSyntaxError(f"The email address is too long after the @-sign {reason}.") - else: - diff = len(ascii_domain) - DOMAIN_MAX_LENGTH - s = "" if diff == 1 else "s" - raise EmailSyntaxError(f"The email address is too long after the @-sign ({diff} byte{s} too many after IDNA encoding).") - - # Also check the label length limit. - # (RFC 1035 2.3.1) - for label in ascii_domain.split("."): - if len(label) > DNS_LABEL_LENGTH_LIMIT: - reason = get_length_reason(label, limit=DNS_LABEL_LENGTH_LIMIT) - raise EmailSyntaxError(f"After the @-sign, periods cannot be separated by so many characters {reason}.") - - if globally_deliverable: - # All publicly deliverable addresses have domain names with at least - # one period, at least for gTLDs created since 2013 (per the ICANN Board - # New gTLD Program Committee, https://www.icann.org/en/announcements/details/new-gtld-dotless-domain-names-prohibited-30-8-2013-en). - # We'll consider the lack of a period a syntax error - # since that will match people's sense of what an email address looks - # like. We'll skip this in test environments to allow '@test' email - # addresses. - if "." not in ascii_domain and not (ascii_domain == "test" and test_environment): - raise EmailSyntaxError("The part after the @-sign is not valid. It should have a period.") - - # We also know that all TLDs currently end with a letter. - if not DOMAIN_NAME_REGEX.search(ascii_domain): - raise EmailSyntaxError("The part after the @-sign is not valid. It is not within a valid top-level domain.") - - # Check special-use and reserved domain names. - # Some might fail DNS-based deliverability checks, but that - # can be turned off, so we should fail them all sooner. - # See the references in __init__.py. - from . import SPECIAL_USE_DOMAIN_NAMES - for d in SPECIAL_USE_DOMAIN_NAMES: - # See the note near the definition of SPECIAL_USE_DOMAIN_NAMES. - if d == "test" and test_environment: - continue - - if ascii_domain == d or ascii_domain.endswith("." + d): - raise EmailSyntaxError("The part after the @-sign is a special-use or reserved name that cannot be used with email.") - - # We may have been given an IDNA ASCII domain to begin with. Check - # that the domain actually conforms to IDNA. It could look like IDNA - # but not be actual IDNA. For ASCII-only domains, the conversion out - # of IDNA just gives the same thing back. - # - # This gives us the canonical internationalized form of the domain, - # which we return to the caller as a part of the normalized email - # address. - try: - domain_i18n = idna.decode(ascii_domain.encode('ascii')) - except idna.IDNAError as e: - raise EmailSyntaxError(f"The part after the @-sign is not valid IDNA ({e}).") from e - - # Check that this normalized domain name has not somehow become - # an invalid domain name. All of the checks before this point - # using the idna package probably guarantee that we now have - # a valid international domain name in most respects. But it - # doesn't hurt to re-apply some tests to be sure. See the similar - # tests above. - - # Check for invalid and unsafe characters. We have no test - # case for this. - bad_chars = { - safe_character_display(c) - for c in domain - if not ATEXT_HOSTNAME_INTL.match(c) - } - if bad_chars: - raise EmailSyntaxError("The part after the @-sign contains invalid characters: " + ", ".join(sorted(bad_chars)) + ".") - check_unsafe_chars(domain) - - # Check that it can be encoded back to IDNA ASCII. We have no test - # case for this. - try: - idna.encode(domain_i18n) - except idna.IDNAError as e: - raise EmailSyntaxError(f"The part after the @-sign became invalid after normalizing to international characters ({e}).") from e - - # Return the IDNA ASCII-encoded form of the domain, which is how it - # would be transmitted on the wire (except when used with SMTPUTF8 - # possibly), as well as the canonical Unicode form of the domain, - # which is better for display purposes. This should also take care - # of RFC 6532 section 3.1's suggestion to apply Unicode NFC - # normalization to addresses. - return { - "ascii_domain": ascii_domain, - "domain": domain_i18n, - } - - -def validate_email_length(addrinfo: ValidatedEmail) -> None: - # There are three forms of the email address whose length must be checked: - # - # 1) The original email address string. Since callers may continue to use - # this string, even though we recommend using the normalized form, we - # should not pass validation when the original input is not valid. This - # form is checked first because it is the original input. - # 2) The normalized email address. We perform Unicode NFC normalization of - # the local part, we normalize the domain to internationalized characters - # (if originaly IDNA ASCII) which also includes Unicode normalization, - # and we may remove quotes in quoted local parts. We recommend that - # callers use this string, so it must be valid. - # 3) The email address with the IDNA ASCII representation of the domain - # name, since this string may be used with email stacks that don't - # support UTF-8. Since this is the least likely to be used by callers, - # it is checked last. Note that ascii_email will only be set if the - # local part is ASCII, but conceivably the caller may combine a - # internationalized local part with an ASCII domain, so we check this - # on that combination also. Since we only return the normalized local - # part, we use that (and not the unnormalized local part). - # - # In all cases, the length is checked in UTF-8 because the SMTPUTF8 - # extension to SMTP validates the length in bytes. - - addresses_to_check = [ - (addrinfo.original, None), - (addrinfo.normalized, "after normalization"), - ((addrinfo.ascii_local_part or addrinfo.local_part or "") + "@" + addrinfo.ascii_domain, "when the part after the @-sign is converted to IDNA ASCII"), - ] - - for addr, reason in addresses_to_check: - addr_len = len(addr) - addr_utf8_len = len(addr.encode("utf8")) - diff = addr_utf8_len - EMAIL_MAX_LENGTH - if diff > 0: - if reason is None and addr_len == addr_utf8_len: - # If there is no normalization or transcoding, - # we can give a simple count of the number of - # characters over the limit. - reason = get_length_reason(addr, limit=EMAIL_MAX_LENGTH) - elif reason is None: - # If there is no normalization but there is - # some transcoding to UTF-8, we can compute - # the minimum number of characters over the - # limit by dividing the number of bytes over - # the limit by the maximum number of bytes - # per character. - mbpc = max(len(c.encode("utf8")) for c in addr) - mchars = max(1, diff // mbpc) - suffix = "s" if diff > 1 else "" - if mchars == diff: - reason = f"({diff} character{suffix} too many)" - else: - reason = f"({mchars}-{diff} character{suffix} too many)" - else: - # Since there is normalization, the number of - # characters in the input that need to change is - # impossible to know. - suffix = "s" if diff > 1 else "" - reason += f" ({diff} byte{suffix} too many)" - raise EmailSyntaxError(f"The email address is too long {reason}.") - - -class DomainLiteralValidationResult(TypedDict): - domain_address: Union[ipaddress.IPv4Address, ipaddress.IPv6Address] - domain: str - - -def validate_email_domain_literal(domain_literal: str) -> DomainLiteralValidationResult: - # This is obscure domain-literal syntax. Parse it and return - # a compressed/normalized address. - # RFC 5321 4.1.3 and RFC 5322 3.4.1. - - addr: Union[ipaddress.IPv4Address, ipaddress.IPv6Address] - - # Try to parse the domain literal as an IPv4 address. - # There is no tag for IPv4 addresses, so we can never - # be sure if the user intends an IPv4 address. - if re.match(r"^[0-9\.]+$", domain_literal): - try: - addr = ipaddress.IPv4Address(domain_literal) - except ValueError as e: - raise EmailSyntaxError(f"The address in brackets after the @-sign is not valid: It is not an IPv4 address ({e}) or is missing an address literal tag.") from e - - # Return the IPv4Address object and the domain back unchanged. - return { - "domain_address": addr, - "domain": f"[{addr}]", - } - - # If it begins with "IPv6:" it's an IPv6 address. - if domain_literal.startswith("IPv6:"): - try: - addr = ipaddress.IPv6Address(domain_literal[5:]) - except ValueError as e: - raise EmailSyntaxError(f"The IPv6 address in brackets after the @-sign is not valid ({e}).") from e - - # Return the IPv6Address object and construct a normalized - # domain literal. - return { - "domain_address": addr, - "domain": f"[IPv6:{addr.compressed}]", - } - - # Nothing else is valid. - - if ":" not in domain_literal: - raise EmailSyntaxError("The part after the @-sign in brackets is not an IPv4 address and has no address literal tag.") - - # The tag (the part before the colon) has character restrictions, - # but since it must come from a registry of tags (in which only "IPv6" is defined), - # there's no need to check the syntax of the tag. See RFC 5321 4.1.2. - - # Check for permitted ASCII characters. This actually doesn't matter - # since there will be an exception after anyway. - bad_chars = { - safe_character_display(c) - for c in domain_literal - if not DOMAIN_LITERAL_CHARS.match(c) - } - if bad_chars: - raise EmailSyntaxError("The part after the @-sign contains invalid characters in brackets: " + ", ".join(sorted(bad_chars)) + ".") - - # There are no other domain literal tags. - # https://www.iana.org/assignments/address-literal-tags/address-literal-tags.xhtml - raise EmailSyntaxError("The part after the @-sign contains an invalid address literal tag in brackets.") diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/validate_email.py b/write-message/venv/lib/python3.10/site-packages/email_validator/validate_email.py deleted file mode 100644 index a134c77..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/validate_email.py +++ /dev/null @@ -1,180 +0,0 @@ -from typing import Optional, Union, TYPE_CHECKING -import unicodedata - -from .exceptions_types import EmailSyntaxError, ValidatedEmail -from .syntax import split_email, validate_email_local_part, validate_email_domain_name, validate_email_domain_literal, validate_email_length -from .rfc_constants import CASE_INSENSITIVE_MAILBOX_NAMES - -if TYPE_CHECKING: - import dns.resolver - _Resolver = dns.resolver.Resolver -else: - _Resolver = object - - -def validate_email( - email: Union[str, bytes], - /, # prior arguments are positional-only - *, # subsequent arguments are keyword-only - allow_smtputf8: Optional[bool] = None, - allow_empty_local: bool = False, - allow_quoted_local: Optional[bool] = None, - allow_domain_literal: Optional[bool] = None, - allow_display_name: Optional[bool] = None, - check_deliverability: Optional[bool] = None, - test_environment: Optional[bool] = None, - globally_deliverable: Optional[bool] = None, - timeout: Optional[int] = None, - dns_resolver: Optional[_Resolver] = None -) -> ValidatedEmail: - """ - Given an email address, and some options, returns a ValidatedEmail instance - with information about the address if it is valid or, if the address is not - valid, raises an EmailNotValidError. This is the main function of the module. - """ - - # Fill in default values of arguments. - from . import ALLOW_SMTPUTF8, ALLOW_QUOTED_LOCAL, ALLOW_DOMAIN_LITERAL, ALLOW_DISPLAY_NAME, \ - GLOBALLY_DELIVERABLE, CHECK_DELIVERABILITY, TEST_ENVIRONMENT, DEFAULT_TIMEOUT - if allow_smtputf8 is None: - allow_smtputf8 = ALLOW_SMTPUTF8 - if allow_quoted_local is None: - allow_quoted_local = ALLOW_QUOTED_LOCAL - if allow_domain_literal is None: - allow_domain_literal = ALLOW_DOMAIN_LITERAL - if allow_display_name is None: - allow_display_name = ALLOW_DISPLAY_NAME - if check_deliverability is None: - check_deliverability = CHECK_DELIVERABILITY - if test_environment is None: - test_environment = TEST_ENVIRONMENT - if globally_deliverable is None: - globally_deliverable = GLOBALLY_DELIVERABLE - if timeout is None and dns_resolver is None: - timeout = DEFAULT_TIMEOUT - - # Allow email to be a str or bytes instance. If bytes, - # it must be ASCII because that's how the bytes work - # on the wire with SMTP. - if not isinstance(email, str): - try: - email = email.decode("ascii") - except ValueError as e: - raise EmailSyntaxError("The email address is not valid ASCII.") from e - - # Split the address into the display name (or None), the local part - # (before the @-sign), and the domain part (after the @-sign). - # Normally, there is only one @-sign. But the awkward "quoted string" - # local part form (RFC 5321 4.1.2) allows @-signs in the local - # part if the local part is quoted. - display_name, local_part, domain_part, is_quoted_local_part \ - = split_email(email) - - # Collect return values in this instance. - ret = ValidatedEmail() - ret.original = ((local_part if not is_quoted_local_part - else ('"' + local_part + '"')) - + "@" + domain_part) # drop the display name, if any, for email length tests at the end - ret.display_name = display_name - - # Validate the email address's local part syntax and get a normalized form. - # If the original address was quoted and the decoded local part is a valid - # unquoted local part, then we'll get back a normalized (unescaped) local - # part. - local_part_info = validate_email_local_part(local_part, - allow_smtputf8=allow_smtputf8, - allow_empty_local=allow_empty_local, - quoted_local_part=is_quoted_local_part) - ret.local_part = local_part_info["local_part"] - ret.ascii_local_part = local_part_info["ascii_local_part"] - ret.smtputf8 = local_part_info["smtputf8"] - - # RFC 6532 section 3.1 says that Unicode NFC normalization should be applied, - # so we'll return the NFC-normalized local part. Since the caller may use that - # string in place of the original string, ensure it is also valid. - normalized_local_part = unicodedata.normalize("NFC", ret.local_part) - if normalized_local_part != ret.local_part: - try: - validate_email_local_part(normalized_local_part, - allow_smtputf8=allow_smtputf8, - allow_empty_local=allow_empty_local, - quoted_local_part=is_quoted_local_part) - except EmailSyntaxError as e: - raise EmailSyntaxError("After Unicode normalization: " + str(e)) from e - ret.local_part = normalized_local_part - - # If a quoted local part isn't allowed but is present, now raise an exception. - # This is done after any exceptions raised by validate_email_local_part so - # that mandatory checks have highest precedence. - if is_quoted_local_part and not allow_quoted_local: - raise EmailSyntaxError("Quoting the part before the @-sign is not allowed here.") - - # Some local parts are required to be case-insensitive, so we should normalize - # to lowercase. - # RFC 2142 - if ret.ascii_local_part is not None \ - and ret.ascii_local_part.lower() in CASE_INSENSITIVE_MAILBOX_NAMES \ - and ret.local_part is not None: - ret.ascii_local_part = ret.ascii_local_part.lower() - ret.local_part = ret.local_part.lower() - - # Validate the email address's domain part syntax and get a normalized form. - is_domain_literal = False - if len(domain_part) == 0: - raise EmailSyntaxError("There must be something after the @-sign.") - - elif domain_part.startswith("[") and domain_part.endswith("]"): - # Parse the address in the domain literal and get back a normalized domain. - domain_literal_info = validate_email_domain_literal(domain_part[1:-1]) - if not allow_domain_literal: - raise EmailSyntaxError("A bracketed IP address after the @-sign is not allowed here.") - ret.domain = domain_literal_info["domain"] - ret.ascii_domain = domain_literal_info["domain"] # Domain literals are always ASCII. - ret.domain_address = domain_literal_info["domain_address"] - is_domain_literal = True # Prevent deliverability checks. - - else: - # Check the syntax of the domain and get back a normalized - # internationalized and ASCII form. - domain_name_info = validate_email_domain_name(domain_part, test_environment=test_environment, globally_deliverable=globally_deliverable) - ret.domain = domain_name_info["domain"] - ret.ascii_domain = domain_name_info["ascii_domain"] - - # Construct the complete normalized form. - ret.normalized = ret.local_part + "@" + ret.domain - - # If the email address has an ASCII form, add it. - if not ret.smtputf8: - if not ret.ascii_domain: - raise Exception("Missing ASCII domain.") - ret.ascii_email = (ret.ascii_local_part or "") + "@" + ret.ascii_domain - else: - ret.ascii_email = None - - # Check the length of the address. - validate_email_length(ret) - - # Check that a display name is permitted. It's the last syntax check - # because we always check against optional parsing features last. - if display_name is not None and not allow_display_name: - raise EmailSyntaxError("A display name and angle brackets around the email address are not permitted here.") - - if check_deliverability and not test_environment: - # Validate the email address's deliverability using DNS - # and update the returned ValidatedEmail object with metadata. - - if is_domain_literal: - # There is nothing to check --- skip deliverability checks. - return ret - - # Lazy load `deliverability` as it is slow to import (due to dns.resolver) - from .deliverability import validate_email_deliverability - deliverability_info = validate_email_deliverability( - ret.ascii_domain, ret.domain, timeout, dns_resolver - ) - mx = deliverability_info.get("mx") - if mx is not None: - ret.mx = mx - ret.mx_fallback_type = deliverability_info.get("mx_fallback_type") - - return ret diff --git a/write-message/venv/lib/python3.10/site-packages/email_validator/version.py b/write-message/venv/lib/python3.10/site-packages/email_validator/version.py deleted file mode 100644 index 8a124bf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/email_validator/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "2.2.0" diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/METADATA deleted file mode 100644 index 45df9c8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/METADATA +++ /dev/null @@ -1,159 +0,0 @@ -Metadata-Version: 2.4 -Name: exceptiongroup -Version: 1.3.0 -Summary: Backport of PEP 654 (exception groups) -Author-email: Alex Grönholm -Requires-Python: >=3.7 -Description-Content-Type: text/x-rst -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Typing :: Typed -License-File: LICENSE -Requires-Dist: typing-extensions >= 4.6.0; python_version < '3.13' -Requires-Dist: pytest >= 6 ; extra == "test" -Project-URL: Changelog, https://github.com/agronholm/exceptiongroup/blob/main/CHANGES.rst -Project-URL: Issue Tracker, https://github.com/agronholm/exceptiongroup/issues -Project-URL: Source code, https://github.com/agronholm/exceptiongroup -Provides-Extra: test - -.. image:: https://github.com/agronholm/exceptiongroup/actions/workflows/test.yml/badge.svg - :target: https://github.com/agronholm/exceptiongroup/actions/workflows/test.yml - :alt: Build Status -.. image:: https://coveralls.io/repos/github/agronholm/exceptiongroup/badge.svg?branch=main - :target: https://coveralls.io/github/agronholm/exceptiongroup?branch=main - :alt: Code Coverage - -This is a backport of the ``BaseExceptionGroup`` and ``ExceptionGroup`` classes from -Python 3.11. - -It contains the following: - -* The ``exceptiongroup.BaseExceptionGroup`` and ``exceptiongroup.ExceptionGroup`` - classes -* A utility function (``exceptiongroup.catch()``) for catching exceptions possibly - nested in an exception group -* Patches to the ``TracebackException`` class that properly formats exception groups - (installed on import) -* An exception hook that handles formatting of exception groups through - ``TracebackException`` (installed on import) -* Special versions of some of the functions from the ``traceback`` module, modified to - correctly handle exception groups even when monkey patching is disabled, or blocked by - another custom exception hook: - - * ``traceback.format_exception()`` - * ``traceback.format_exception_only()`` - * ``traceback.print_exception()`` - * ``traceback.print_exc()`` -* A backported version of ``contextlib.suppress()`` from Python 3.12.1 which also - handles suppressing exceptions inside exception groups - -If this package is imported on Python 3.11 or later, the built-in implementations of the -exception group classes are used instead, ``TracebackException`` is not monkey patched -and the exception hook won't be installed. - -See the `standard library documentation`_ for more information on exception groups. - -.. _standard library documentation: https://docs.python.org/3/library/exceptions.html - -Catching exceptions -=================== - -Due to the lack of the ``except*`` syntax introduced by `PEP 654`_ in earlier Python -versions, you need to use ``exceptiongroup.catch()`` to catch exceptions that are -potentially nested inside an exception group. This function returns a context manager -that calls the given handler for any exceptions matching the sole argument. - -The argument to ``catch()`` must be a dict (or any ``Mapping``) where each key is either -an exception class or an iterable of exception classes. Each value must be a callable -that takes a single positional argument. The handler will be called at most once, with -an exception group as an argument which will contain all the exceptions that are any -of the given types, or their subclasses. The exception group may contain nested groups -containing more matching exceptions. - -Thus, the following Python 3.11+ code: - -.. code-block:: python - - try: - ... - except* (ValueError, KeyError) as excgroup: - for exc in excgroup.exceptions: - print('Caught exception:', type(exc)) - except* RuntimeError: - print('Caught runtime error') - -would be written with this backport like this: - -.. code-block:: python - - from exceptiongroup import BaseExceptionGroup, catch - - def value_key_err_handler(excgroup: BaseExceptionGroup) -> None: - for exc in excgroup.exceptions: - print('Caught exception:', type(exc)) - - def runtime_err_handler(exc: BaseExceptionGroup) -> None: - print('Caught runtime error') - - with catch({ - (ValueError, KeyError): value_key_err_handler, - RuntimeError: runtime_err_handler - }): - ... - -**NOTE**: Just like with ``except*``, you cannot handle ``BaseExceptionGroup`` or -``ExceptionGroup`` with ``catch()``. - -Suppressing exceptions -====================== - -This library contains a backport of the ``contextlib.suppress()`` context manager from -Python 3.12.1. It allows you to selectively ignore certain exceptions, even when they're -inside exception groups: - -.. code-block:: python - - from exceptiongroup import suppress - - with suppress(RuntimeError): - raise ExceptionGroup("", [RuntimeError("boo")]) - -Notes on monkey patching -======================== - -To make exception groups render properly when an unhandled exception group is being -printed out, this package does two things when it is imported on any Python version -earlier than 3.11: - -#. The ``traceback.TracebackException`` class is monkey patched to store extra - information about exception groups (in ``__init__()``) and properly format them (in - ``format()``) -#. An exception hook is installed at ``sys.excepthook``, provided that no other hook is - already present. This hook causes the exception to be formatted using - ``traceback.TracebackException`` rather than the built-in rendered. - -If ``sys.exceptionhook`` is found to be set to something else than the default when -``exceptiongroup`` is imported, no monkeypatching is done at all. - -To prevent the exception hook and patches from being installed, set the environment -variable ``EXCEPTIONGROUP_NO_PATCH`` to ``1``. - -Formatting exception groups ---------------------------- - -Normally, the monkey patching applied by this library on import will cause exception -groups to be printed properly in tracebacks. But in cases when the monkey patching is -blocked by a third party exception hook, or monkey patching is explicitly disabled, -you can still manually format exceptions using the special versions of the ``traceback`` -functions, like ``format_exception()``, listed at the top of this page. They work just -like their counterparts in the ``traceback`` module, except that they use a separately -patched subclass of ``TracebackException`` to perform the rendering. - -Particularly in cases where a library installs its own exception hook, it is recommended -to use these special versions to do the actual formatting of exceptions/tracebacks. - -.. _PEP 654: https://www.python.org/dev/peps/pep-0654/ - diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/RECORD deleted file mode 100644 index 715b363..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/RECORD +++ /dev/null @@ -1,18 +0,0 @@ -exceptiongroup-1.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -exceptiongroup-1.3.0.dist-info/METADATA,sha256=oiAq-llXqOaV0B3dJN316SjtCpthQvuQjmVuVObbaeQ,6725 -exceptiongroup-1.3.0.dist-info/RECORD,, -exceptiongroup-1.3.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 -exceptiongroup-1.3.0.dist-info/licenses/LICENSE,sha256=blBw12UDHgrUA6HL-Qrm0ZoCKPgC4yC3rP9GCqcu1Hw,3704 -exceptiongroup/__init__.py,sha256=7DHS0hDk-RIs3IQc3SbZVB0-1MhiSCJ9XgvEyEloL7M,1049 -exceptiongroup/__pycache__/__init__.cpython-310.pyc,, -exceptiongroup/__pycache__/_catch.cpython-310.pyc,, -exceptiongroup/__pycache__/_exceptions.cpython-310.pyc,, -exceptiongroup/__pycache__/_formatting.cpython-310.pyc,, -exceptiongroup/__pycache__/_suppress.cpython-310.pyc,, -exceptiongroup/__pycache__/_version.cpython-310.pyc,, -exceptiongroup/_catch.py,sha256=CaJez3E-Jkr-7B7RT3fzusdLWnuyeekooSFn7KyWt9s,4680 -exceptiongroup/_exceptions.py,sha256=wPwPsZ64SXEptuwb4XrTIa1Mc78uqF5vmCrXTdllLn4,11463 -exceptiongroup/_formatting.py,sha256=4UC6bUN3K-FxEX96_ozzgeX05fCyprl6qCVR-efBmQ0,21032 -exceptiongroup/_suppress.py,sha256=LX11PRNpchwfNWwEMY92nYN1F_5qFenQcS8EjIONXKE,1772 -exceptiongroup/_version.py,sha256=qDtcPZdKzxLpd8vVl6fpIFIMkWt2HK_cO9gLDwaHEdk,511 -exceptiongroup/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/WHEEL deleted file mode 100644 index d8b9936..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.12.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/licenses/LICENSE b/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/licenses/LICENSE deleted file mode 100644 index 50d4fa5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup-1.3.0.dist-info/licenses/LICENSE +++ /dev/null @@ -1,73 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2022 Alex Grönholm - -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. - - -This project contains code copied from the Python standard library. -The following is the required license notice for those parts. - -PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 --------------------------------------------- - -1. This LICENSE AGREEMENT is between the Python Software Foundation -("PSF"), and the Individual or Organization ("Licensee") accessing and -otherwise using this software ("Python") in source or binary form and -its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, PSF hereby -grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, -analyze, test, perform and/or display publicly, prepare derivative works, -distribute, and otherwise use Python alone or in any derivative version, -provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Python Software Foundation; -All Rights Reserved" are retained in Python alone or in any derivative version -prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python. - -4. PSF is making Python available to Licensee on an "AS IS" -basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between PSF and -Licensee. This License Agreement does not grant permission to use PSF -trademarks or trade name in a trademark sense to endorse or promote -products or services of Licensee, or any third party. - -8. By copying, installing or otherwise using Python, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__init__.py b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__init__.py deleted file mode 100644 index d8e36b2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__init__.py +++ /dev/null @@ -1,46 +0,0 @@ -__all__ = [ - "BaseExceptionGroup", - "ExceptionGroup", - "catch", - "format_exception", - "format_exception_only", - "print_exception", - "print_exc", - "suppress", -] - -import os -import sys - -from ._catch import catch -from ._version import version as __version__ # noqa: F401 - -if sys.version_info < (3, 11): - from ._exceptions import BaseExceptionGroup, ExceptionGroup - from ._formatting import ( - format_exception, - format_exception_only, - print_exc, - print_exception, - ) - - if os.getenv("EXCEPTIONGROUP_NO_PATCH") != "1": - from . import _formatting # noqa: F401 - - BaseExceptionGroup.__module__ = __name__ - ExceptionGroup.__module__ = __name__ -else: - from traceback import ( - format_exception, - format_exception_only, - print_exc, - print_exception, - ) - - BaseExceptionGroup = BaseExceptionGroup - ExceptionGroup = ExceptionGroup - -if sys.version_info < (3, 12, 1): - from ._suppress import suppress -else: - from contextlib import suppress diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index b62fcf1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_catch.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_catch.cpython-310.pyc deleted file mode 100644 index 2a0e3fb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_catch.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_exceptions.cpython-310.pyc deleted file mode 100644 index ad2a7a6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_formatting.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_formatting.cpython-310.pyc deleted file mode 100644 index c9f0518..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_formatting.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_suppress.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_suppress.cpython-310.pyc deleted file mode 100644 index 199c8dd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_suppress.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_version.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_version.cpython-310.pyc deleted file mode 100644 index e614294..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/__pycache__/_version.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_catch.py b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_catch.py deleted file mode 100644 index 0246568..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_catch.py +++ /dev/null @@ -1,138 +0,0 @@ -from __future__ import annotations - -import inspect -import sys -from collections.abc import Callable, Iterable, Mapping -from contextlib import AbstractContextManager -from types import TracebackType -from typing import TYPE_CHECKING, Any - -if sys.version_info < (3, 11): - from ._exceptions import BaseExceptionGroup - -if TYPE_CHECKING: - _Handler = Callable[[BaseExceptionGroup[Any]], Any] - - -class _Catcher: - def __init__(self, handler_map: Mapping[tuple[type[BaseException], ...], _Handler]): - self._handler_map = handler_map - - def __enter__(self) -> None: - pass - - def __exit__( - self, - etype: type[BaseException] | None, - exc: BaseException | None, - tb: TracebackType | None, - ) -> bool: - if exc is not None: - unhandled = self.handle_exception(exc) - if unhandled is exc: - return False - elif unhandled is None: - return True - else: - if isinstance(exc, BaseExceptionGroup): - try: - raise unhandled from exc.__cause__ - except BaseExceptionGroup: - # Change __context__ to __cause__ because Python 3.11 does this - # too - unhandled.__context__ = exc.__cause__ - raise - - raise unhandled from exc - - return False - - def handle_exception(self, exc: BaseException) -> BaseException | None: - excgroup: BaseExceptionGroup | None - if isinstance(exc, BaseExceptionGroup): - excgroup = exc - else: - excgroup = BaseExceptionGroup("", [exc]) - - new_exceptions: list[BaseException] = [] - for exc_types, handler in self._handler_map.items(): - matched, excgroup = excgroup.split(exc_types) - if matched: - try: - try: - raise matched - except BaseExceptionGroup: - result = handler(matched) - except BaseExceptionGroup as new_exc: - if new_exc is matched: - new_exceptions.append(new_exc) - else: - new_exceptions.extend(new_exc.exceptions) - except BaseException as new_exc: - new_exceptions.append(new_exc) - else: - if inspect.iscoroutine(result): - raise TypeError( - f"Error trying to handle {matched!r} with {handler!r}. " - "Exception handler must be a sync function." - ) from exc - - if not excgroup: - break - - if new_exceptions: - if len(new_exceptions) == 1: - return new_exceptions[0] - - return BaseExceptionGroup("", new_exceptions) - elif ( - excgroup and len(excgroup.exceptions) == 1 and excgroup.exceptions[0] is exc - ): - return exc - else: - return excgroup - - -def catch( - __handlers: Mapping[type[BaseException] | Iterable[type[BaseException]], _Handler], -) -> AbstractContextManager[None]: - if not isinstance(__handlers, Mapping): - raise TypeError("the argument must be a mapping") - - handler_map: dict[ - tuple[type[BaseException], ...], Callable[[BaseExceptionGroup]] - ] = {} - for type_or_iterable, handler in __handlers.items(): - iterable: tuple[type[BaseException]] - if isinstance(type_or_iterable, type) and issubclass( - type_or_iterable, BaseException - ): - iterable = (type_or_iterable,) - elif isinstance(type_or_iterable, Iterable): - iterable = tuple(type_or_iterable) - else: - raise TypeError( - "each key must be either an exception classes or an iterable thereof" - ) - - if not callable(handler): - raise TypeError("handlers must be callable") - - for exc_type in iterable: - if not isinstance(exc_type, type) or not issubclass( - exc_type, BaseException - ): - raise TypeError( - "each key must be either an exception classes or an iterable " - "thereof" - ) - - if issubclass(exc_type, BaseExceptionGroup): - raise TypeError( - "catching ExceptionGroup with catch() is not allowed. " - "Use except instead." - ) - - handler_map[iterable] = handler - - return _Catcher(handler_map) diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_exceptions.py b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_exceptions.py deleted file mode 100644 index f42c1ad..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_exceptions.py +++ /dev/null @@ -1,336 +0,0 @@ -from __future__ import annotations - -import sys -from collections.abc import Callable, Sequence -from functools import partial -from inspect import getmro, isclass -from typing import TYPE_CHECKING, Generic, Type, TypeVar, cast, overload - -if sys.version_info < (3, 13): - from typing_extensions import TypeVar - -_BaseExceptionT_co = TypeVar( - "_BaseExceptionT_co", bound=BaseException, covariant=True, default=BaseException -) -_BaseExceptionT = TypeVar("_BaseExceptionT", bound=BaseException) -_ExceptionT_co = TypeVar( - "_ExceptionT_co", bound=Exception, covariant=True, default=Exception -) -_ExceptionT = TypeVar("_ExceptionT", bound=Exception) -# using typing.Self would require a typing_extensions dependency on py<3.11 -_ExceptionGroupSelf = TypeVar("_ExceptionGroupSelf", bound="ExceptionGroup") -_BaseExceptionGroupSelf = TypeVar("_BaseExceptionGroupSelf", bound="BaseExceptionGroup") - - -def check_direct_subclass( - exc: BaseException, parents: tuple[type[BaseException]] -) -> bool: - for cls in getmro(exc.__class__)[:-1]: - if cls in parents: - return True - - return False - - -def get_condition_filter( - condition: type[_BaseExceptionT] - | tuple[type[_BaseExceptionT], ...] - | Callable[[_BaseExceptionT_co], bool], -) -> Callable[[_BaseExceptionT_co], bool]: - if isclass(condition) and issubclass( - cast(Type[BaseException], condition), BaseException - ): - return partial(check_direct_subclass, parents=(condition,)) - elif isinstance(condition, tuple): - if all(isclass(x) and issubclass(x, BaseException) for x in condition): - return partial(check_direct_subclass, parents=condition) - elif callable(condition): - return cast("Callable[[BaseException], bool]", condition) - - raise TypeError("expected a function, exception type or tuple of exception types") - - -def _derive_and_copy_attributes(self, excs): - eg = self.derive(excs) - eg.__cause__ = self.__cause__ - eg.__context__ = self.__context__ - eg.__traceback__ = self.__traceback__ - if hasattr(self, "__notes__"): - # Create a new list so that add_note() only affects one exceptiongroup - eg.__notes__ = list(self.__notes__) - return eg - - -class BaseExceptionGroup(BaseException, Generic[_BaseExceptionT_co]): - """A combination of multiple unrelated exceptions.""" - - def __new__( - cls: type[_BaseExceptionGroupSelf], - __message: str, - __exceptions: Sequence[_BaseExceptionT_co], - ) -> _BaseExceptionGroupSelf: - if not isinstance(__message, str): - raise TypeError(f"argument 1 must be str, not {type(__message)}") - if not isinstance(__exceptions, Sequence): - raise TypeError("second argument (exceptions) must be a sequence") - if not __exceptions: - raise ValueError( - "second argument (exceptions) must be a non-empty sequence" - ) - - for i, exc in enumerate(__exceptions): - if not isinstance(exc, BaseException): - raise ValueError( - f"Item {i} of second argument (exceptions) is not an exception" - ) - - if cls is BaseExceptionGroup: - if all(isinstance(exc, Exception) for exc in __exceptions): - cls = ExceptionGroup - - if issubclass(cls, Exception): - for exc in __exceptions: - if not isinstance(exc, Exception): - if cls is ExceptionGroup: - raise TypeError( - "Cannot nest BaseExceptions in an ExceptionGroup" - ) - else: - raise TypeError( - f"Cannot nest BaseExceptions in {cls.__name__!r}" - ) - - instance = super().__new__(cls, __message, __exceptions) - instance._exceptions = tuple(__exceptions) - return instance - - def __init__( - self, - __message: str, - __exceptions: Sequence[_BaseExceptionT_co], - *args: object, - ) -> None: - BaseException.__init__(self, __message, __exceptions, *args) - - def add_note(self, note: str) -> None: - if not isinstance(note, str): - raise TypeError( - f"Expected a string, got note={note!r} (type {type(note).__name__})" - ) - - if not hasattr(self, "__notes__"): - self.__notes__: list[str] = [] - - self.__notes__.append(note) - - @property - def message(self) -> str: - return self.args[0] - - @property - def exceptions( - self, - ) -> tuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]: - return tuple(self._exceptions) - - @overload - def subgroup( - self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...] - ) -> ExceptionGroup[_ExceptionT] | None: ... - - @overload - def subgroup( - self, __condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] - ) -> BaseExceptionGroup[_BaseExceptionT] | None: ... - - @overload - def subgroup( - self, - __condition: Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool], - ) -> BaseExceptionGroup[_BaseExceptionT_co] | None: ... - - def subgroup( - self, - __condition: type[_BaseExceptionT] - | tuple[type[_BaseExceptionT], ...] - | Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool], - ) -> BaseExceptionGroup[_BaseExceptionT] | None: - condition = get_condition_filter(__condition) - modified = False - if condition(self): - return self - - exceptions: list[BaseException] = [] - for exc in self.exceptions: - if isinstance(exc, BaseExceptionGroup): - subgroup = exc.subgroup(__condition) - if subgroup is not None: - exceptions.append(subgroup) - - if subgroup is not exc: - modified = True - elif condition(exc): - exceptions.append(exc) - else: - modified = True - - if not modified: - return self - elif exceptions: - group = _derive_and_copy_attributes(self, exceptions) - return group - else: - return None - - @overload - def split( - self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...] - ) -> tuple[ - ExceptionGroup[_ExceptionT] | None, - BaseExceptionGroup[_BaseExceptionT_co] | None, - ]: ... - - @overload - def split( - self, __condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] - ) -> tuple[ - BaseExceptionGroup[_BaseExceptionT] | None, - BaseExceptionGroup[_BaseExceptionT_co] | None, - ]: ... - - @overload - def split( - self, - __condition: Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool], - ) -> tuple[ - BaseExceptionGroup[_BaseExceptionT_co] | None, - BaseExceptionGroup[_BaseExceptionT_co] | None, - ]: ... - - def split( - self, - __condition: type[_BaseExceptionT] - | tuple[type[_BaseExceptionT], ...] - | Callable[[_BaseExceptionT_co], bool], - ) -> ( - tuple[ - ExceptionGroup[_ExceptionT] | None, - BaseExceptionGroup[_BaseExceptionT_co] | None, - ] - | tuple[ - BaseExceptionGroup[_BaseExceptionT] | None, - BaseExceptionGroup[_BaseExceptionT_co] | None, - ] - | tuple[ - BaseExceptionGroup[_BaseExceptionT_co] | None, - BaseExceptionGroup[_BaseExceptionT_co] | None, - ] - ): - condition = get_condition_filter(__condition) - if condition(self): - return self, None - - matching_exceptions: list[BaseException] = [] - nonmatching_exceptions: list[BaseException] = [] - for exc in self.exceptions: - if isinstance(exc, BaseExceptionGroup): - matching, nonmatching = exc.split(condition) - if matching is not None: - matching_exceptions.append(matching) - - if nonmatching is not None: - nonmatching_exceptions.append(nonmatching) - elif condition(exc): - matching_exceptions.append(exc) - else: - nonmatching_exceptions.append(exc) - - matching_group: _BaseExceptionGroupSelf | None = None - if matching_exceptions: - matching_group = _derive_and_copy_attributes(self, matching_exceptions) - - nonmatching_group: _BaseExceptionGroupSelf | None = None - if nonmatching_exceptions: - nonmatching_group = _derive_and_copy_attributes( - self, nonmatching_exceptions - ) - - return matching_group, nonmatching_group - - @overload - def derive(self, __excs: Sequence[_ExceptionT]) -> ExceptionGroup[_ExceptionT]: ... - - @overload - def derive( - self, __excs: Sequence[_BaseExceptionT] - ) -> BaseExceptionGroup[_BaseExceptionT]: ... - - def derive( - self, __excs: Sequence[_BaseExceptionT] - ) -> BaseExceptionGroup[_BaseExceptionT]: - return BaseExceptionGroup(self.message, __excs) - - def __str__(self) -> str: - suffix = "" if len(self._exceptions) == 1 else "s" - return f"{self.message} ({len(self._exceptions)} sub-exception{suffix})" - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({self.args[0]!r}, {self.args[1]!r})" - - -class ExceptionGroup(BaseExceptionGroup[_ExceptionT_co], Exception): - def __new__( - cls: type[_ExceptionGroupSelf], - __message: str, - __exceptions: Sequence[_ExceptionT_co], - ) -> _ExceptionGroupSelf: - return super().__new__(cls, __message, __exceptions) - - if TYPE_CHECKING: - - @property - def exceptions( - self, - ) -> tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...]: ... - - @overload # type: ignore[override] - def subgroup( - self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...] - ) -> ExceptionGroup[_ExceptionT] | None: ... - - @overload - def subgroup( - self, __condition: Callable[[_ExceptionT_co | _ExceptionGroupSelf], bool] - ) -> ExceptionGroup[_ExceptionT_co] | None: ... - - def subgroup( - self, - __condition: type[_ExceptionT] - | tuple[type[_ExceptionT], ...] - | Callable[[_ExceptionT_co], bool], - ) -> ExceptionGroup[_ExceptionT] | None: - return super().subgroup(__condition) - - @overload - def split( - self, __condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...] - ) -> tuple[ - ExceptionGroup[_ExceptionT] | None, ExceptionGroup[_ExceptionT_co] | None - ]: ... - - @overload - def split( - self, __condition: Callable[[_ExceptionT_co | _ExceptionGroupSelf], bool] - ) -> tuple[ - ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None - ]: ... - - def split( - self: _ExceptionGroupSelf, - __condition: type[_ExceptionT] - | tuple[type[_ExceptionT], ...] - | Callable[[_ExceptionT_co], bool], - ) -> tuple[ - ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None - ]: - return super().split(__condition) diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_formatting.py b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_formatting.py deleted file mode 100644 index c383c50..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_formatting.py +++ /dev/null @@ -1,601 +0,0 @@ -# traceback_exception_init() adapted from trio -# -# _ExceptionPrintContext and traceback_exception_format() copied from the standard -# library -from __future__ import annotations - -import collections.abc -import sys -import textwrap -import traceback -from functools import singledispatch -from types import TracebackType -from typing import Any, List, Optional - -from ._exceptions import BaseExceptionGroup - -max_group_width = 15 -max_group_depth = 10 -_cause_message = ( - "\nThe above exception was the direct cause of the following exception:\n\n" -) - -_context_message = ( - "\nDuring handling of the above exception, another exception occurred:\n\n" -) - - -def _format_final_exc_line(etype, value): - valuestr = _safe_string(value, "exception") - if value is None or not valuestr: - line = f"{etype}\n" - else: - line = f"{etype}: {valuestr}\n" - - return line - - -def _safe_string(value, what, func=str): - try: - return func(value) - except BaseException: - return f"<{what} {func.__name__}() failed>" - - -class _ExceptionPrintContext: - def __init__(self): - self.seen = set() - self.exception_group_depth = 0 - self.need_close = False - - def indent(self): - return " " * (2 * self.exception_group_depth) - - def emit(self, text_gen, margin_char=None): - if margin_char is None: - margin_char = "|" - indent_str = self.indent() - if self.exception_group_depth: - indent_str += margin_char + " " - - if isinstance(text_gen, str): - yield textwrap.indent(text_gen, indent_str, lambda line: True) - else: - for text in text_gen: - yield textwrap.indent(text, indent_str, lambda line: True) - - -def exceptiongroup_excepthook( - etype: type[BaseException], value: BaseException, tb: TracebackType | None -) -> None: - sys.stderr.write("".join(traceback.format_exception(etype, value, tb))) - - -class PatchedTracebackException(traceback.TracebackException): - def __init__( - self, - exc_type: type[BaseException], - exc_value: BaseException, - exc_traceback: TracebackType | None, - *, - limit: int | None = None, - lookup_lines: bool = True, - capture_locals: bool = False, - compact: bool = False, - _seen: set[int] | None = None, - ) -> None: - kwargs: dict[str, Any] = {} - if sys.version_info >= (3, 10): - kwargs["compact"] = compact - - is_recursive_call = _seen is not None - if _seen is None: - _seen = set() - _seen.add(id(exc_value)) - - self.stack = traceback.StackSummary.extract( - traceback.walk_tb(exc_traceback), - limit=limit, - lookup_lines=lookup_lines, - capture_locals=capture_locals, - ) - self.exc_type = exc_type - # Capture now to permit freeing resources: only complication is in the - # unofficial API _format_final_exc_line - self._str = _safe_string(exc_value, "exception") - try: - self.__notes__ = getattr(exc_value, "__notes__", None) - except KeyError: - # Workaround for https://github.com/python/cpython/issues/98778 on Python - # <= 3.9, and some 3.10 and 3.11 patch versions. - HTTPError = getattr(sys.modules.get("urllib.error", None), "HTTPError", ()) - if sys.version_info[:2] <= (3, 11) and isinstance(exc_value, HTTPError): - self.__notes__ = None - else: - raise - - if exc_type and issubclass(exc_type, SyntaxError): - # Handle SyntaxError's specially - self.filename = exc_value.filename - lno = exc_value.lineno - self.lineno = str(lno) if lno is not None else None - self.text = exc_value.text - self.offset = exc_value.offset - self.msg = exc_value.msg - if sys.version_info >= (3, 10): - end_lno = exc_value.end_lineno - self.end_lineno = str(end_lno) if end_lno is not None else None - self.end_offset = exc_value.end_offset - elif ( - exc_type - and issubclass(exc_type, (NameError, AttributeError)) - and getattr(exc_value, "name", None) is not None - ): - suggestion = _compute_suggestion_error(exc_value, exc_traceback) - if suggestion: - self._str += f". Did you mean: '{suggestion}'?" - - if lookup_lines: - # Force all lines in the stack to be loaded - for frame in self.stack: - frame.line - - self.__suppress_context__ = ( - exc_value.__suppress_context__ if exc_value is not None else False - ) - - # Convert __cause__ and __context__ to `TracebackExceptions`s, use a - # queue to avoid recursion (only the top-level call gets _seen == None) - if not is_recursive_call: - queue = [(self, exc_value)] - while queue: - te, e = queue.pop() - - if e and e.__cause__ is not None and id(e.__cause__) not in _seen: - cause = PatchedTracebackException( - type(e.__cause__), - e.__cause__, - e.__cause__.__traceback__, - limit=limit, - lookup_lines=lookup_lines, - capture_locals=capture_locals, - _seen=_seen, - ) - else: - cause = None - - if compact: - need_context = ( - cause is None and e is not None and not e.__suppress_context__ - ) - else: - need_context = True - if ( - e - and e.__context__ is not None - and need_context - and id(e.__context__) not in _seen - ): - context = PatchedTracebackException( - type(e.__context__), - e.__context__, - e.__context__.__traceback__, - limit=limit, - lookup_lines=lookup_lines, - capture_locals=capture_locals, - _seen=_seen, - ) - else: - context = None - - # Capture each of the exceptions in the ExceptionGroup along with each - # of their causes and contexts - if e and isinstance(e, BaseExceptionGroup): - exceptions = [] - for exc in e.exceptions: - texc = PatchedTracebackException( - type(exc), - exc, - exc.__traceback__, - lookup_lines=lookup_lines, - capture_locals=capture_locals, - _seen=_seen, - ) - exceptions.append(texc) - else: - exceptions = None - - te.__cause__ = cause - te.__context__ = context - te.exceptions = exceptions - if cause: - queue.append((te.__cause__, e.__cause__)) - if context: - queue.append((te.__context__, e.__context__)) - if exceptions: - queue.extend(zip(te.exceptions, e.exceptions)) - - def format(self, *, chain=True, _ctx=None, **kwargs): - if _ctx is None: - _ctx = _ExceptionPrintContext() - - output = [] - exc = self - if chain: - while exc: - if exc.__cause__ is not None: - chained_msg = _cause_message - chained_exc = exc.__cause__ - elif exc.__context__ is not None and not exc.__suppress_context__: - chained_msg = _context_message - chained_exc = exc.__context__ - else: - chained_msg = None - chained_exc = None - - output.append((chained_msg, exc)) - exc = chained_exc - else: - output.append((None, exc)) - - for msg, exc in reversed(output): - if msg is not None: - yield from _ctx.emit(msg) - if exc.exceptions is None: - if exc.stack: - yield from _ctx.emit("Traceback (most recent call last):\n") - yield from _ctx.emit(exc.stack.format()) - yield from _ctx.emit(exc.format_exception_only()) - elif _ctx.exception_group_depth > max_group_depth: - # exception group, but depth exceeds limit - yield from _ctx.emit(f"... (max_group_depth is {max_group_depth})\n") - else: - # format exception group - is_toplevel = _ctx.exception_group_depth == 0 - if is_toplevel: - _ctx.exception_group_depth += 1 - - if exc.stack: - yield from _ctx.emit( - "Exception Group Traceback (most recent call last):\n", - margin_char="+" if is_toplevel else None, - ) - yield from _ctx.emit(exc.stack.format()) - - yield from _ctx.emit(exc.format_exception_only()) - num_excs = len(exc.exceptions) - if num_excs <= max_group_width: - n = num_excs - else: - n = max_group_width + 1 - _ctx.need_close = False - for i in range(n): - last_exc = i == n - 1 - if last_exc: - # The closing frame may be added by a recursive call - _ctx.need_close = True - - if max_group_width is not None: - truncated = i >= max_group_width - else: - truncated = False - title = f"{i + 1}" if not truncated else "..." - yield ( - _ctx.indent() - + ("+-" if i == 0 else " ") - + f"+---------------- {title} ----------------\n" - ) - _ctx.exception_group_depth += 1 - if not truncated: - yield from exc.exceptions[i].format(chain=chain, _ctx=_ctx) - else: - remaining = num_excs - max_group_width - plural = "s" if remaining > 1 else "" - yield from _ctx.emit( - f"and {remaining} more exception{plural}\n" - ) - - if last_exc and _ctx.need_close: - yield _ctx.indent() + "+------------------------------------\n" - _ctx.need_close = False - _ctx.exception_group_depth -= 1 - - if is_toplevel: - assert _ctx.exception_group_depth == 1 - _ctx.exception_group_depth = 0 - - def format_exception_only(self, **kwargs): - """Format the exception part of the traceback. - The return value is a generator of strings, each ending in a newline. - Normally, the generator emits a single string; however, for - SyntaxError exceptions, it emits several lines that (when - printed) display detailed information about where the syntax - error occurred. - The message indicating which exception occurred is always the last - string in the output. - """ - if self.exc_type is None: - yield traceback._format_final_exc_line(None, self._str) - return - - stype = self.exc_type.__qualname__ - smod = self.exc_type.__module__ - if smod not in ("__main__", "builtins"): - if not isinstance(smod, str): - smod = "" - stype = smod + "." + stype - - if not issubclass(self.exc_type, SyntaxError): - yield _format_final_exc_line(stype, self._str) - elif traceback_exception_format_syntax_error is not None: - yield from traceback_exception_format_syntax_error(self, stype) - else: - yield from traceback_exception_original_format_exception_only(self) - - if isinstance(self.__notes__, collections.abc.Sequence): - for note in self.__notes__: - note = _safe_string(note, "note") - yield from [line + "\n" for line in note.split("\n")] - elif self.__notes__ is not None: - yield _safe_string(self.__notes__, "__notes__", func=repr) - - -traceback_exception_original_format = traceback.TracebackException.format -traceback_exception_original_format_exception_only = ( - traceback.TracebackException.format_exception_only -) -traceback_exception_format_syntax_error = getattr( - traceback.TracebackException, "_format_syntax_error", None -) -if sys.excepthook is sys.__excepthook__: - traceback.TracebackException.__init__ = ( # type: ignore[assignment] - PatchedTracebackException.__init__ - ) - traceback.TracebackException.format = ( # type: ignore[assignment] - PatchedTracebackException.format - ) - traceback.TracebackException.format_exception_only = ( # type: ignore[assignment] - PatchedTracebackException.format_exception_only - ) - sys.excepthook = exceptiongroup_excepthook - -# Ubuntu's system Python has a sitecustomize.py file that imports -# apport_python_hook and replaces sys.excepthook. -# -# The custom hook captures the error for crash reporting, and then calls -# sys.__excepthook__ to actually print the error. -# -# We don't mind it capturing the error for crash reporting, but we want to -# take over printing the error. So we monkeypatch the apport_python_hook -# module so that instead of calling sys.__excepthook__, it calls our custom -# hook. -# -# More details: https://github.com/python-trio/trio/issues/1065 -if getattr(sys.excepthook, "__name__", None) in ( - "apport_excepthook", - # on ubuntu 22.10 the hook was renamed to partial_apport_excepthook - "partial_apport_excepthook", -): - # patch traceback like above - traceback.TracebackException.__init__ = ( # type: ignore[assignment] - PatchedTracebackException.__init__ - ) - traceback.TracebackException.format = ( # type: ignore[assignment] - PatchedTracebackException.format - ) - traceback.TracebackException.format_exception_only = ( # type: ignore[assignment] - PatchedTracebackException.format_exception_only - ) - - from types import ModuleType - - import apport_python_hook - - # monkeypatch the sys module that apport has imported - fake_sys = ModuleType("exceptiongroup_fake_sys") - fake_sys.__dict__.update(sys.__dict__) - fake_sys.__excepthook__ = exceptiongroup_excepthook - apport_python_hook.sys = fake_sys - - -@singledispatch -def format_exception_only(__exc: BaseException, **kwargs: Any) -> List[str]: - return list( - PatchedTracebackException( - type(__exc), __exc, None, compact=True - ).format_exception_only() - ) - - -@format_exception_only.register -def _(__exc: type, value: BaseException, **kwargs: Any) -> List[str]: - return format_exception_only(value) - - -@singledispatch -def format_exception( - __exc: BaseException, limit: Optional[int] = None, chain: bool = True, **kwargs: Any -) -> List[str]: - return list( - PatchedTracebackException( - type(__exc), __exc, __exc.__traceback__, limit=limit, compact=True - ).format(chain=chain) - ) - - -@format_exception.register -def _( - __exc: type, - value: BaseException, - tb: TracebackType, - limit: Optional[int] = None, - chain: bool = True, - **kwargs: Any, -) -> List[str]: - return format_exception(value, limit, chain) - - -@singledispatch -def print_exception( - __exc: BaseException, - limit: Optional[int] = None, - file: Any = None, - chain: bool = True, - **kwargs: Any, -) -> None: - if file is None: - file = sys.stderr - - for line in PatchedTracebackException( - type(__exc), __exc, __exc.__traceback__, limit=limit - ).format(chain=chain): - print(line, file=file, end="") - - -@print_exception.register -def _( - __exc: type, - value: BaseException, - tb: TracebackType, - limit: Optional[int] = None, - file: Any = None, - chain: bool = True, -) -> None: - print_exception(value, limit, file, chain) - - -def print_exc( - limit: Optional[int] = None, - file: Any | None = None, - chain: bool = True, -) -> None: - value = sys.exc_info()[1] - print_exception(value, limit, file, chain) - - -# Python levenshtein edit distance code for NameError/AttributeError -# suggestions, backported from 3.12 - -_MAX_CANDIDATE_ITEMS = 750 -_MAX_STRING_SIZE = 40 -_MOVE_COST = 2 -_CASE_COST = 1 -_SENTINEL = object() - - -def _substitution_cost(ch_a, ch_b): - if ch_a == ch_b: - return 0 - if ch_a.lower() == ch_b.lower(): - return _CASE_COST - return _MOVE_COST - - -def _compute_suggestion_error(exc_value, tb): - wrong_name = getattr(exc_value, "name", None) - if wrong_name is None or not isinstance(wrong_name, str): - return None - if isinstance(exc_value, AttributeError): - obj = getattr(exc_value, "obj", _SENTINEL) - if obj is _SENTINEL: - return None - obj = exc_value.obj - try: - d = dir(obj) - except Exception: - return None - else: - assert isinstance(exc_value, NameError) - # find most recent frame - if tb is None: - return None - while tb.tb_next is not None: - tb = tb.tb_next - frame = tb.tb_frame - - d = list(frame.f_locals) + list(frame.f_globals) + list(frame.f_builtins) - if len(d) > _MAX_CANDIDATE_ITEMS: - return None - wrong_name_len = len(wrong_name) - if wrong_name_len > _MAX_STRING_SIZE: - return None - best_distance = wrong_name_len - suggestion = None - for possible_name in d: - if possible_name == wrong_name: - # A missing attribute is "found". Don't suggest it (see GH-88821). - continue - # No more than 1/3 of the involved characters should need changed. - max_distance = (len(possible_name) + wrong_name_len + 3) * _MOVE_COST // 6 - # Don't take matches we've already beaten. - max_distance = min(max_distance, best_distance - 1) - current_distance = _levenshtein_distance( - wrong_name, possible_name, max_distance - ) - if current_distance > max_distance: - continue - if not suggestion or current_distance < best_distance: - suggestion = possible_name - best_distance = current_distance - return suggestion - - -def _levenshtein_distance(a, b, max_cost): - # A Python implementation of Python/suggestions.c:levenshtein_distance. - - # Both strings are the same - if a == b: - return 0 - - # Trim away common affixes - pre = 0 - while a[pre:] and b[pre:] and a[pre] == b[pre]: - pre += 1 - a = a[pre:] - b = b[pre:] - post = 0 - while a[: post or None] and b[: post or None] and a[post - 1] == b[post - 1]: - post -= 1 - a = a[: post or None] - b = b[: post or None] - if not a or not b: - return _MOVE_COST * (len(a) + len(b)) - if len(a) > _MAX_STRING_SIZE or len(b) > _MAX_STRING_SIZE: - return max_cost + 1 - - # Prefer shorter buffer - if len(b) < len(a): - a, b = b, a - - # Quick fail when a match is impossible - if (len(b) - len(a)) * _MOVE_COST > max_cost: - return max_cost + 1 - - # Instead of producing the whole traditional len(a)-by-len(b) - # matrix, we can update just one row in place. - # Initialize the buffer row - row = list(range(_MOVE_COST, _MOVE_COST * (len(a) + 1), _MOVE_COST)) - - result = 0 - for bindex in range(len(b)): - bchar = b[bindex] - distance = result = bindex * _MOVE_COST - minimum = sys.maxsize - for index in range(len(a)): - # 1) Previous distance in this row is cost(b[:b_index], a[:index]) - substitute = distance + _substitution_cost(bchar, a[index]) - # 2) cost(b[:b_index], a[:index+1]) from previous row - distance = row[index] - # 3) existing result is cost(b[:b_index+1], a[index]) - - insert_delete = min(result, distance) + _MOVE_COST - result = min(insert_delete, substitute) - - # cost(b[:b_index+1], a[:index+1]) - row[index] = result - if result < minimum: - minimum = result - if minimum > max_cost: - # Everything in this row is too big, so bail early. - return max_cost + 1 - return result diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_suppress.py b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_suppress.py deleted file mode 100644 index 11467ee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_suppress.py +++ /dev/null @@ -1,55 +0,0 @@ -from __future__ import annotations - -import sys -from contextlib import AbstractContextManager -from types import TracebackType -from typing import TYPE_CHECKING, Optional, Type, cast - -if sys.version_info < (3, 11): - from ._exceptions import BaseExceptionGroup - -if TYPE_CHECKING: - # requires python 3.9 - BaseClass = AbstractContextManager[None] -else: - BaseClass = AbstractContextManager - - -class suppress(BaseClass): - """Backport of :class:`contextlib.suppress` from Python 3.12.1.""" - - def __init__(self, *exceptions: type[BaseException]): - self._exceptions = exceptions - - def __enter__(self) -> None: - pass - - def __exit__( - self, - exctype: Optional[Type[BaseException]], - excinst: Optional[BaseException], - exctb: Optional[TracebackType], - ) -> bool: - # Unlike isinstance and issubclass, CPython exception handling - # currently only looks at the concrete type hierarchy (ignoring - # the instance and subclass checking hooks). While Guido considers - # that a bug rather than a feature, it's a fairly hard one to fix - # due to various internal implementation details. suppress provides - # the simpler issubclass based semantics, rather than trying to - # exactly reproduce the limitations of the CPython interpreter. - # - # See http://bugs.python.org/issue12029 for more details - if exctype is None: - return False - - if issubclass(exctype, self._exceptions): - return True - - if issubclass(exctype, BaseExceptionGroup): - match, rest = cast(BaseExceptionGroup, excinst).split(self._exceptions) - if rest is None: - return True - - raise rest - - return False diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_version.py b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_version.py deleted file mode 100644 index 32c340d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/_version.py +++ /dev/null @@ -1,21 +0,0 @@ -# file generated by setuptools-scm -# don't change, don't track in version control - -__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"] - -TYPE_CHECKING = False -if TYPE_CHECKING: - from typing import Tuple - from typing import Union - - VERSION_TUPLE = Tuple[Union[int, str], ...] -else: - VERSION_TUPLE = object - -version: str -__version__: str -__version_tuple__: VERSION_TUPLE -version_tuple: VERSION_TUPLE - -__version__ = version = '1.3.0' -__version_tuple__ = version_tuple = (1, 3, 0) diff --git a/write-message/venv/lib/python3.10/site-packages/exceptiongroup/py.typed b/write-message/venv/lib/python3.10/site-packages/exceptiongroup/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/METADATA deleted file mode 100644 index cceea45..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/METADATA +++ /dev/null @@ -1,554 +0,0 @@ -Metadata-Version: 2.1 -Name: fastapi -Version: 0.111.0 -Summary: FastAPI framework, high performance, easy to learn, fast to code, ready for production -Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= -Classifier: Intended Audience :: Information Technology -Classifier: Intended Audience :: System Administrators -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python -Classifier: Topic :: Internet -Classifier: Topic :: Software Development :: Libraries :: Application Frameworks -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Software Development :: Libraries -Classifier: Topic :: Software Development -Classifier: Typing :: Typed -Classifier: Development Status :: 4 - Beta -Classifier: Environment :: Web Environment -Classifier: Framework :: AsyncIO -Classifier: Framework :: FastAPI -Classifier: Framework :: Pydantic -Classifier: Framework :: Pydantic :: 1 -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers -Classifier: Topic :: Internet :: WWW/HTTP -Project-URL: Homepage, https://github.com/tiangolo/fastapi -Project-URL: Documentation, https://fastapi.tiangolo.com/ -Project-URL: Repository, https://github.com/tiangolo/fastapi -Requires-Python: >=3.8 -Requires-Dist: starlette<0.38.0,>=0.37.2 -Requires-Dist: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4 -Requires-Dist: typing-extensions>=4.8.0 -Requires-Dist: fastapi-cli>=0.0.2 -Requires-Dist: httpx>=0.23.0 -Requires-Dist: jinja2>=2.11.2 -Requires-Dist: python-multipart>=0.0.7 -Requires-Dist: ujson!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,>=4.0.1 -Requires-Dist: orjson>=3.2.1 -Requires-Dist: email_validator>=2.0.0 -Requires-Dist: uvicorn[standard]>=0.12.0 -Requires-Dist: httpx>=0.23.0; extra == "all" -Requires-Dist: jinja2>=2.11.2; extra == "all" -Requires-Dist: python-multipart>=0.0.7; extra == "all" -Requires-Dist: itsdangerous>=1.1.0; extra == "all" -Requires-Dist: pyyaml>=5.3.1; extra == "all" -Requires-Dist: ujson!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,>=4.0.1; extra == "all" -Requires-Dist: orjson>=3.2.1; extra == "all" -Requires-Dist: email_validator>=2.0.0; extra == "all" -Requires-Dist: uvicorn[standard]>=0.12.0; extra == "all" -Requires-Dist: pydantic-settings>=2.0.0; extra == "all" -Requires-Dist: pydantic-extra-types>=2.0.0; extra == "all" -Provides-Extra: all -Description-Content-Type: text/markdown - -

- FastAPI -

-

- FastAPI framework, high performance, easy to learn, fast to code, ready for production -

-

- - Test - - - Coverage - - - Package version - - - Supported Python versions - -

- ---- - -**Documentation**: https://fastapi.tiangolo.com - -**Source Code**: https://github.com/tiangolo/fastapi - ---- - -FastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints. - -The key features are: - -* **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance). -* **Fast to code**: Increase the speed to develop features by about 200% to 300%. * -* **Fewer bugs**: Reduce about 40% of human (developer) induced errors. * -* **Intuitive**: Great editor support. Completion everywhere. Less time debugging. -* **Easy**: Designed to be easy to use and learn. Less time reading docs. -* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs. -* **Robust**: Get production-ready code. With automatic interactive documentation. -* **Standards-based**: Based on (and fully compatible with) the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema. - -* estimation based on tests on an internal development team, building production applications. - -## Sponsors - - - - - - - - - - - - - - - - - - - - - -Other sponsors - -## Opinions - -"_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._" - -
Kabir Khan - Microsoft (ref)
- ---- - -"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_" - -
Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - Uber (ref)
- ---- - -"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_" - -
Kevin Glisson, Marc Vilanova, Forest Monsen - Netflix (ref)
- ---- - -"_I’m over the moon excited about **FastAPI**. It’s so fun!_" - -
Brian Okken - Python Bytes podcast host (ref)
- ---- - -"_Honestly, what you've built looks super solid and polished. In many ways, it's what I wanted **Hug** to be - it's really inspiring to see someone build that._" - -
Timothy Crosley - Hug creator (ref)
- ---- - -"_If you're looking to learn one **modern framework** for building REST APIs, check out **FastAPI** [...] It's fast, easy to use and easy to learn [...]_" - -"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_" - -
Ines Montani - Matthew Honnibal - Explosion AI founders - spaCy creators (ref) - (ref)
- ---- - -"_If anyone is looking to build a production Python API, I would highly recommend **FastAPI**. It is **beautifully designed**, **simple to use** and **highly scalable**, it has become a **key component** in our API first development strategy and is driving many automations and services such as our Virtual TAC Engineer._" - -
Deon Pillsbury - Cisco (ref)
- ---- - -## **Typer**, the FastAPI of CLIs - - - -If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**. - -**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀 - -## Requirements - -FastAPI stands on the shoulders of giants: - -* Starlette for the web parts. -* Pydantic for the data parts. - -## Installation - -
- -```console -$ pip install fastapi - ----> 100% -``` - -
- -## Example - -### Create it - -* Create a file `main.py` with: - -```Python -from typing import Union - -from fastapi import FastAPI - -app = FastAPI() - - -@app.get("/") -def read_root(): - return {"Hello": "World"} - - -@app.get("/items/{item_id}") -def read_item(item_id: int, q: Union[str, None] = None): - return {"item_id": item_id, "q": q} -``` - -
-Or use async def... - -If your code uses `async` / `await`, use `async def`: - -```Python hl_lines="9 14" -from typing import Union - -from fastapi import FastAPI - -app = FastAPI() - - -@app.get("/") -async def read_root(): - return {"Hello": "World"} - - -@app.get("/items/{item_id}") -async def read_item(item_id: int, q: Union[str, None] = None): - return {"item_id": item_id, "q": q} -``` - -**Note**: - -If you don't know, check the _"In a hurry?"_ section about `async` and `await` in the docs. - -
- -### Run it - -Run the server with: - -
- -```console -$ fastapi dev main.py - - ╭────────── FastAPI CLI - Development mode ───────────╮ - │ │ - │ Serving at: http://127.0.0.1:8000 │ - │ │ - │ API docs: http://127.0.0.1:8000/docs │ - │ │ - │ Running in development mode, for production use: │ - │ │ - │ fastapi run │ - │ │ - ╰─────────────────────────────────────────────────────╯ - -INFO: Will watch for changes in these directories: ['/home/user/code/awesomeapp'] -INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) -INFO: Started reloader process [2248755] using WatchFiles -INFO: Started server process [2248757] -INFO: Waiting for application startup. -INFO: Application startup complete. -``` - -
- -
-About the command fastapi dev main.py... - -The command `fastapi dev` reads your `main.py` file, detects the **FastAPI** app in it, and starts a server using Uvicorn. - -By default, `fastapi dev` will start with auto-reload enabled for local development. - -You can read more about it in the FastAPI CLI docs. - -
- -### Check it - -Open your browser at http://127.0.0.1:8000/items/5?q=somequery. - -You will see the JSON response as: - -```JSON -{"item_id": 5, "q": "somequery"} -``` - -You already created an API that: - -* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`. -* Both _paths_ take `GET` operations (also known as HTTP _methods_). -* The _path_ `/items/{item_id}` has a _path parameter_ `item_id` that should be an `int`. -* The _path_ `/items/{item_id}` has an optional `str` _query parameter_ `q`. - -### Interactive API docs - -Now go to http://127.0.0.1:8000/docs. - -You will see the automatic interactive API documentation (provided by Swagger UI): - -![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png) - -### Alternative API docs - -And now, go to http://127.0.0.1:8000/redoc. - -You will see the alternative automatic documentation (provided by ReDoc): - -![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png) - -## Example upgrade - -Now modify the file `main.py` to receive a body from a `PUT` request. - -Declare the body using standard Python types, thanks to Pydantic. - -```Python hl_lines="4 9-12 25-27" -from typing import Union - -from fastapi import FastAPI -from pydantic import BaseModel - -app = FastAPI() - - -class Item(BaseModel): - name: str - price: float - is_offer: Union[bool, None] = None - - -@app.get("/") -def read_root(): - return {"Hello": "World"} - - -@app.get("/items/{item_id}") -def read_item(item_id: int, q: Union[str, None] = None): - return {"item_id": item_id, "q": q} - - -@app.put("/items/{item_id}") -def update_item(item_id: int, item: Item): - return {"item_name": item.name, "item_id": item_id} -``` - -The `fastapi dev` server should reload automatically. - -### Interactive API docs upgrade - -Now go to http://127.0.0.1:8000/docs. - -* The interactive API documentation will be automatically updated, including the new body: - -![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png) - -* Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API: - -![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png) - -* Then click on the "Execute" button, the user interface will communicate with your API, send the parameters, get the results and show them on the screen: - -![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png) - -### Alternative API docs upgrade - -And now, go to http://127.0.0.1:8000/redoc. - -* The alternative documentation will also reflect the new query parameter and body: - -![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png) - -### Recap - -In summary, you declare **once** the types of parameters, body, etc. as function parameters. - -You do that with standard modern Python types. - -You don't have to learn a new syntax, the methods or classes of a specific library, etc. - -Just standard **Python**. - -For example, for an `int`: - -```Python -item_id: int -``` - -or for a more complex `Item` model: - -```Python -item: Item -``` - -...and with that single declaration you get: - -* Editor support, including: - * Completion. - * Type checks. -* Validation of data: - * Automatic and clear errors when the data is invalid. - * Validation even for deeply nested JSON objects. -* Conversion of input data: coming from the network to Python data and types. Reading from: - * JSON. - * Path parameters. - * Query parameters. - * Cookies. - * Headers. - * Forms. - * Files. -* Conversion of output data: converting from Python data and types to network data (as JSON): - * Convert Python types (`str`, `int`, `float`, `bool`, `list`, etc). - * `datetime` objects. - * `UUID` objects. - * Database models. - * ...and many more. -* Automatic interactive API documentation, including 2 alternative user interfaces: - * Swagger UI. - * ReDoc. - ---- - -Coming back to the previous code example, **FastAPI** will: - -* Validate that there is an `item_id` in the path for `GET` and `PUT` requests. -* Validate that the `item_id` is of type `int` for `GET` and `PUT` requests. - * If it is not, the client will see a useful, clear error. -* Check if there is an optional query parameter named `q` (as in `http://127.0.0.1:8000/items/foo?q=somequery`) for `GET` requests. - * As the `q` parameter is declared with `= None`, it is optional. - * Without the `None` it would be required (as is the body in the case with `PUT`). -* For `PUT` requests to `/items/{item_id}`, Read the body as JSON: - * Check that it has a required attribute `name` that should be a `str`. - * Check that it has a required attribute `price` that has to be a `float`. - * Check that it has an optional attribute `is_offer`, that should be a `bool`, if present. - * All this would also work for deeply nested JSON objects. -* Convert from and to JSON automatically. -* Document everything with OpenAPI, that can be used by: - * Interactive documentation systems. - * Automatic client code generation systems, for many languages. -* Provide 2 interactive documentation web interfaces directly. - ---- - -We just scratched the surface, but you already get the idea of how it all works. - -Try changing the line with: - -```Python - return {"item_name": item.name, "item_id": item_id} -``` - -...from: - -```Python - ... "item_name": item.name ... -``` - -...to: - -```Python - ... "item_price": item.price ... -``` - -...and see how your editor will auto-complete the attributes and know their types: - -![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png) - -For a more complete example including more features, see the Tutorial - User Guide. - -**Spoiler alert**: the tutorial - user guide includes: - -* Declaration of **parameters** from other different places as: **headers**, **cookies**, **form fields** and **files**. -* How to set **validation constraints** as `maximum_length` or `regex`. -* A very powerful and easy to use **Dependency Injection** system. -* Security and authentication, including support for **OAuth2** with **JWT tokens** and **HTTP Basic** auth. -* More advanced (but equally easy) techniques for declaring **deeply nested JSON models** (thanks to Pydantic). -* **GraphQL** integration with Strawberry and other libraries. -* Many extra features (thanks to Starlette) as: - * **WebSockets** - * extremely easy tests based on HTTPX and `pytest` - * **CORS** - * **Cookie Sessions** - * ...and more. - -## Performance - -Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as one of the fastest Python frameworks available, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*) - -To understand more about it, see the section Benchmarks. - -## Dependencies - -Used by Pydantic: - -* email_validator - for email validation. -* pydantic-settings - for settings management. -* pydantic-extra-types - for extra types to be used with Pydantic. - -Used by Starlette: - -* httpx - Required if you want to use the `TestClient`. -* jinja2 - Required if you want to use the default template configuration. -* python-multipart - Required if you want to support form "parsing", with `request.form()`. - -Used by FastAPI / Starlette: - -* uvicorn - for the server that loads and serves your application. -* orjson - Required if you want to use `ORJSONResponse`. -* ujson - Required if you want to use `UJSONResponse`. -* `fastapi-cli` - to provide the `fastapi` command. - -When you install `fastapi` it comes these standard dependencies. - -## `fastapi-slim` - -If you don't want the extra standard optional dependencies, install `fastapi-slim` instead. - -When you install with: - -```bash -pip install fastapi -``` - -...it includes the same code and dependencies as: - -```bash -pip install "fastapi-slim[standard]" -``` - -The standard extra dependencies are the ones mentioned above. - -## License - -This project is licensed under the terms of the MIT license. diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/RECORD deleted file mode 100644 index f7eaa36..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/RECORD +++ /dev/null @@ -1,91 +0,0 @@ -fastapi-0.111.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -fastapi-0.111.0.dist-info/METADATA,sha256=E4htngMdh1XMorTOXG49Q4_NiD5dkSasEvOzzSu95cE,25954 -fastapi-0.111.0.dist-info/RECORD,, -fastapi-0.111.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fastapi-0.111.0.dist-info/WHEEL,sha256=vnE8JVcI2Wz7GRKorsPArnBdnW2SWKWGow5gu5tHlRU,90 -fastapi-0.111.0.dist-info/licenses/LICENSE,sha256=Tsif_IFIW5f-xYSy1KlhAy7v_oNEU4lP2cEnSQbMdE4,1086 -fastapi/__init__.py,sha256=YhhDsditFgjCfvQR8M0CXSRhp4dlFLbGd9q1Hbtkcq8,1081 -fastapi/__pycache__/__init__.cpython-310.pyc,, -fastapi/__pycache__/_compat.cpython-310.pyc,, -fastapi/__pycache__/applications.cpython-310.pyc,, -fastapi/__pycache__/background.cpython-310.pyc,, -fastapi/__pycache__/concurrency.cpython-310.pyc,, -fastapi/__pycache__/datastructures.cpython-310.pyc,, -fastapi/__pycache__/encoders.cpython-310.pyc,, -fastapi/__pycache__/exception_handlers.cpython-310.pyc,, -fastapi/__pycache__/exceptions.cpython-310.pyc,, -fastapi/__pycache__/logger.cpython-310.pyc,, -fastapi/__pycache__/param_functions.cpython-310.pyc,, -fastapi/__pycache__/params.cpython-310.pyc,, -fastapi/__pycache__/requests.cpython-310.pyc,, -fastapi/__pycache__/responses.cpython-310.pyc,, -fastapi/__pycache__/routing.cpython-310.pyc,, -fastapi/__pycache__/staticfiles.cpython-310.pyc,, -fastapi/__pycache__/templating.cpython-310.pyc,, -fastapi/__pycache__/testclient.cpython-310.pyc,, -fastapi/__pycache__/types.cpython-310.pyc,, -fastapi/__pycache__/utils.cpython-310.pyc,, -fastapi/__pycache__/websockets.cpython-310.pyc,, -fastapi/_compat.py,sha256=OjE3FUZ0IPXqIJWKhoWKDNCHv4so-FQ-rfN8ngQZeFE,23134 -fastapi/applications.py,sha256=owRSmdslsJhJCDxxatkfMdewlaiE-9DPbwQ7alyexgU,176342 -fastapi/background.py,sha256=rouLirxUANrcYC824MSMypXL_Qb2HYg2YZqaiEqbEKI,1768 -fastapi/concurrency.py,sha256=AYLnS4judDUmXsNRICtoKSP0prfYDcS8ehBtYW9JhQQ,1403 -fastapi/datastructures.py,sha256=b2PEz77XGq-u3Ur1Inwk0AGjOsQZO49yF9C7IPJ15cY,5766 -fastapi/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fastapi/dependencies/__pycache__/__init__.cpython-310.pyc,, -fastapi/dependencies/__pycache__/models.cpython-310.pyc,, -fastapi/dependencies/__pycache__/utils.cpython-310.pyc,, -fastapi/dependencies/models.py,sha256=-n-YCxzgVBkurQi49qOTooT71v_oeAhHJ-qQFonxh5o,2494 -fastapi/dependencies/utils.py,sha256=rynOrwW6BKSv0bTVDCY1ag4kRsOzJwmmzO31sRKsTzA,30241 -fastapi/encoders.py,sha256=LvwYmFeOz4tVwvgBoC5rvZnbr7hZr73KGrU8O7zSptU,11068 -fastapi/exception_handlers.py,sha256=MBrIOA-ugjJDivIi4rSsUJBdTsjuzN76q4yh0q1COKw,1332 -fastapi/exceptions.py,sha256=taNixuFEXb67lI1bnX1ubq8y8TseJ4yoPlWjyP0fTzk,4969 -fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54 -fastapi/middleware/__init__.py,sha256=oQDxiFVcc1fYJUOIFvphnK7pTT5kktmfL32QXpBFvvo,58 -fastapi/middleware/__pycache__/__init__.cpython-310.pyc,, -fastapi/middleware/__pycache__/cors.cpython-310.pyc,, -fastapi/middleware/__pycache__/gzip.cpython-310.pyc,, -fastapi/middleware/__pycache__/httpsredirect.cpython-310.pyc,, -fastapi/middleware/__pycache__/trustedhost.cpython-310.pyc,, -fastapi/middleware/__pycache__/wsgi.cpython-310.pyc,, -fastapi/middleware/cors.py,sha256=ynwjWQZoc_vbhzZ3_ZXceoaSrslHFHPdoM52rXr0WUU,79 -fastapi/middleware/gzip.py,sha256=xM5PcsH8QlAimZw4VDvcmTnqQamslThsfe3CVN2voa0,79 -fastapi/middleware/httpsredirect.py,sha256=rL8eXMnmLijwVkH7_400zHri1AekfeBd6D6qs8ix950,115 -fastapi/middleware/trustedhost.py,sha256=eE5XGRxGa7c5zPnMJDGp3BxaL25k5iVQlhnv-Pk0Pss,109 -fastapi/middleware/wsgi.py,sha256=Z3Ue-7wni4lUZMvH3G9ek__acgYdJstbnpZX_HQAboY,79 -fastapi/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fastapi/openapi/__pycache__/__init__.cpython-310.pyc,, -fastapi/openapi/__pycache__/constants.cpython-310.pyc,, -fastapi/openapi/__pycache__/docs.cpython-310.pyc,, -fastapi/openapi/__pycache__/models.cpython-310.pyc,, -fastapi/openapi/__pycache__/utils.cpython-310.pyc,, -fastapi/openapi/constants.py,sha256=adGzmis1L1HJRTE3kJ5fmHS_Noq6tIY6pWv_SFzoFDU,153 -fastapi/openapi/docs.py,sha256=INQd4dFFyOwckrtlrkMbWzsyI1a4wvz8c7S_u0vYgOo,10356 -fastapi/openapi/models.py,sha256=PqkxQiqcEgjKuhfUIWPZPQcyTcubtUCB3vcObLsB7VE,15397 -fastapi/openapi/utils.py,sha256=asSbOKDuagDfpByNQvPy7OM0sqOBdUmqh64BH-n-5f0,22286 -fastapi/param_functions.py,sha256=LcVyxFoK-W1gYGaH7H1dGvth1alwwxXouReg4zKSk88,64005 -fastapi/params.py,sha256=GB7aNcyBt8xFUVLnLzt8AGJfZAncQJvwd4N8nhjcXHk,28191 -fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fastapi/requests.py,sha256=zayepKFcienBllv3snmWI20Gk0oHNVLU4DDhqXBb4LU,142 -fastapi/responses.py,sha256=QNQQlwpKhQoIPZTTWkpc9d_QGeGZ_aVQPaDV3nQ8m7c,1761 -fastapi/routing.py,sha256=dcQBjxUsO9KT0pmp1ewJzM8qD3wjcZi1BrnyyqYELoE,174150 -fastapi/security/__init__.py,sha256=bO8pNmxqVRXUjfl2mOKiVZLn0FpBQ61VUYVjmppnbJw,881 -fastapi/security/__pycache__/__init__.cpython-310.pyc,, -fastapi/security/__pycache__/api_key.cpython-310.pyc,, -fastapi/security/__pycache__/base.cpython-310.pyc,, -fastapi/security/__pycache__/http.cpython-310.pyc,, -fastapi/security/__pycache__/oauth2.cpython-310.pyc,, -fastapi/security/__pycache__/open_id_connect_url.cpython-310.pyc,, -fastapi/security/__pycache__/utils.cpython-310.pyc,, -fastapi/security/api_key.py,sha256=_OqUUjEHG5_MT1IPAhXIGJRCPldTBdSww_DegFy_W8Y,9368 -fastapi/security/base.py,sha256=dl4pvbC-RxjfbWgPtCWd8MVU-7CB2SZ22rJDXVCXO6c,141 -fastapi/security/http.py,sha256=sXw3jvaMPxDmMaGlf5e2ES5TuGXDKXFOigntzUfSqIg,13506 -fastapi/security/oauth2.py,sha256=lWemX4CLAvanR6-jiQxFtOyHjHbzEnNbpytA_WXgZcw,21583 -fastapi/security/open_id_connect_url.py,sha256=8vizZ2tGqEp1ur8SwtVgyHJhGAJ5AqahgcvSpaIioDI,2722 -fastapi/security/utils.py,sha256=bd8T0YM7UQD5ATKucr1bNtAvz_Y3__dVNAv5UebiPvc,293 -fastapi/staticfiles.py,sha256=iirGIt3sdY2QZXd36ijs3Cj-T0FuGFda3cd90kM9Ikw,69 -fastapi/templating.py,sha256=4zsuTWgcjcEainMJFAlW6-gnslm6AgOS1SiiDWfmQxk,76 -fastapi/testclient.py,sha256=nBvaAmX66YldReJNZXPOk1sfuo2Q6hs8bOvIaCep6LQ,66 -fastapi/types.py,sha256=nFb36sK3DSoqoyo7Miwy3meKK5UdFBgkAgLSzQlUVyI,383 -fastapi/utils.py,sha256=lHKngr-TmOx9QzSyA6PXYSvEgxPYUIk5t3u-kZtskEM,8035 -fastapi/websockets.py,sha256=419uncYObEKZG0YcrXscfQQYLSWoE10jqxVMetGdR98,222 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/REQUESTED b/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/REQUESTED deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/WHEEL deleted file mode 100644 index 20fb324..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: pdm-backend (2.3.0) -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/licenses/LICENSE b/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/licenses/LICENSE deleted file mode 100644 index 3e92463..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi-0.111.0.dist-info/licenses/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Sebastián Ramírez - -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/write-message/venv/lib/python3.10/site-packages/fastapi/__init__.py b/write-message/venv/lib/python3.10/site-packages/fastapi/__init__.py deleted file mode 100644 index 04305ad..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -"""FastAPI framework, high performance, easy to learn, fast to code, ready for production""" - -__version__ = "0.111.0" - -from starlette import status as status - -from .applications import FastAPI as FastAPI -from .background import BackgroundTasks as BackgroundTasks -from .datastructures import UploadFile as UploadFile -from .exceptions import HTTPException as HTTPException -from .exceptions import WebSocketException as WebSocketException -from .param_functions import Body as Body -from .param_functions import Cookie as Cookie -from .param_functions import Depends as Depends -from .param_functions import File as File -from .param_functions import Form as Form -from .param_functions import Header as Header -from .param_functions import Path as Path -from .param_functions import Query as Query -from .param_functions import Security as Security -from .requests import Request as Request -from .responses import Response as Response -from .routing import APIRouter as APIRouter -from .websockets import WebSocket as WebSocket -from .websockets import WebSocketDisconnect as WebSocketDisconnect diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 5cb0591..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/_compat.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/_compat.cpython-310.pyc deleted file mode 100644 index 6b03fbf..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/_compat.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/applications.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/applications.cpython-310.pyc deleted file mode 100644 index 8a39eac..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/applications.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/background.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/background.cpython-310.pyc deleted file mode 100644 index e375c62..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/background.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/concurrency.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/concurrency.cpython-310.pyc deleted file mode 100644 index 885d17b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/concurrency.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/datastructures.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/datastructures.cpython-310.pyc deleted file mode 100644 index 6ab3d35..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/datastructures.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/encoders.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/encoders.cpython-310.pyc deleted file mode 100644 index 0a0d78e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/encoders.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/exception_handlers.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/exception_handlers.cpython-310.pyc deleted file mode 100644 index 071478e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/exception_handlers.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/exceptions.cpython-310.pyc deleted file mode 100644 index 2ea21d7..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/logger.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/logger.cpython-310.pyc deleted file mode 100644 index 6798592..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/logger.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/param_functions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/param_functions.cpython-310.pyc deleted file mode 100644 index 427a257..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/param_functions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/params.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/params.cpython-310.pyc deleted file mode 100644 index 54a69d4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/params.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/requests.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/requests.cpython-310.pyc deleted file mode 100644 index 97e20c9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/requests.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/responses.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/responses.cpython-310.pyc deleted file mode 100644 index a48df60..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/responses.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/routing.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/routing.cpython-310.pyc deleted file mode 100644 index 9335197..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/routing.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/staticfiles.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/staticfiles.cpython-310.pyc deleted file mode 100644 index cc4b3e8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/staticfiles.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/templating.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/templating.cpython-310.pyc deleted file mode 100644 index 6c93373..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/templating.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/testclient.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/testclient.cpython-310.pyc deleted file mode 100644 index 67d9dbc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/testclient.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/types.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/types.cpython-310.pyc deleted file mode 100644 index 349eb92..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/types.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/utils.cpython-310.pyc deleted file mode 100644 index 2d37a6b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/websockets.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/websockets.cpython-310.pyc deleted file mode 100644 index 5a062e5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/__pycache__/websockets.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/_compat.py b/write-message/venv/lib/python3.10/site-packages/fastapi/_compat.py deleted file mode 100644 index 06b847b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/_compat.py +++ /dev/null @@ -1,636 +0,0 @@ -from collections import deque -from copy import copy -from dataclasses import dataclass, is_dataclass -from enum import Enum -from typing import ( - Any, - Callable, - Deque, - Dict, - FrozenSet, - List, - Mapping, - Sequence, - Set, - Tuple, - Type, - Union, -) - -from fastapi.exceptions import RequestErrorModel -from fastapi.types import IncEx, ModelNameMap, UnionType -from pydantic import BaseModel, create_model -from pydantic.version import VERSION as P_VERSION -from starlette.datastructures import UploadFile -from typing_extensions import Annotated, Literal, get_args, get_origin - -# Reassign variable to make it reexported for mypy -PYDANTIC_VERSION = P_VERSION -PYDANTIC_V2 = PYDANTIC_VERSION.startswith("2.") - - -sequence_annotation_to_type = { - Sequence: list, - List: list, - list: list, - Tuple: tuple, - tuple: tuple, - Set: set, - set: set, - FrozenSet: frozenset, - frozenset: frozenset, - Deque: deque, - deque: deque, -} - -sequence_types = tuple(sequence_annotation_to_type.keys()) - -if PYDANTIC_V2: - from pydantic import PydanticSchemaGenerationError as PydanticSchemaGenerationError - from pydantic import TypeAdapter - from pydantic import ValidationError as ValidationError - from pydantic._internal._schema_generation_shared import ( # type: ignore[attr-defined] - GetJsonSchemaHandler as GetJsonSchemaHandler, - ) - from pydantic._internal._typing_extra import eval_type_lenient - from pydantic._internal._utils import lenient_issubclass as lenient_issubclass - from pydantic.fields import FieldInfo - from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema - from pydantic.json_schema import JsonSchemaValue as JsonSchemaValue - from pydantic_core import CoreSchema as CoreSchema - from pydantic_core import PydanticUndefined, PydanticUndefinedType - from pydantic_core import Url as Url - - try: - from pydantic_core.core_schema import ( - with_info_plain_validator_function as with_info_plain_validator_function, - ) - except ImportError: # pragma: no cover - from pydantic_core.core_schema import ( - general_plain_validator_function as with_info_plain_validator_function, # noqa: F401 - ) - - Required = PydanticUndefined - Undefined = PydanticUndefined - UndefinedType = PydanticUndefinedType - evaluate_forwardref = eval_type_lenient - Validator = Any - - class BaseConfig: - pass - - class ErrorWrapper(Exception): - pass - - @dataclass - class ModelField: - field_info: FieldInfo - name: str - mode: Literal["validation", "serialization"] = "validation" - - @property - def alias(self) -> str: - a = self.field_info.alias - return a if a is not None else self.name - - @property - def required(self) -> bool: - return self.field_info.is_required() - - @property - def default(self) -> Any: - return self.get_default() - - @property - def type_(self) -> Any: - return self.field_info.annotation - - def __post_init__(self) -> None: - self._type_adapter: TypeAdapter[Any] = TypeAdapter( - Annotated[self.field_info.annotation, self.field_info] - ) - - def get_default(self) -> Any: - if self.field_info.is_required(): - return Undefined - return self.field_info.get_default(call_default_factory=True) - - def validate( - self, - value: Any, - values: Dict[str, Any] = {}, # noqa: B006 - *, - loc: Tuple[Union[int, str], ...] = (), - ) -> Tuple[Any, Union[List[Dict[str, Any]], None]]: - try: - return ( - self._type_adapter.validate_python(value, from_attributes=True), - None, - ) - except ValidationError as exc: - return None, _regenerate_error_with_loc( - errors=exc.errors(include_url=False), loc_prefix=loc - ) - - def serialize( - self, - value: Any, - *, - mode: Literal["json", "python"] = "json", - include: Union[IncEx, None] = None, - exclude: Union[IncEx, None] = None, - by_alias: bool = True, - exclude_unset: bool = False, - exclude_defaults: bool = False, - exclude_none: bool = False, - ) -> Any: - # What calls this code passes a value that already called - # self._type_adapter.validate_python(value) - return self._type_adapter.dump_python( - value, - mode=mode, - include=include, - exclude=exclude, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - ) - - def __hash__(self) -> int: - # Each ModelField is unique for our purposes, to allow making a dict from - # ModelField to its JSON Schema. - return id(self) - - def get_annotation_from_field_info( - annotation: Any, field_info: FieldInfo, field_name: str - ) -> Any: - return annotation - - def _normalize_errors(errors: Sequence[Any]) -> List[Dict[str, Any]]: - return errors # type: ignore[return-value] - - def _model_rebuild(model: Type[BaseModel]) -> None: - model.model_rebuild() - - def _model_dump( - model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any - ) -> Any: - return model.model_dump(mode=mode, **kwargs) - - def _get_model_config(model: BaseModel) -> Any: - return model.model_config - - def get_schema_from_model_field( - *, - field: ModelField, - schema_generator: GenerateJsonSchema, - model_name_map: ModelNameMap, - field_mapping: Dict[ - Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue - ], - separate_input_output_schemas: bool = True, - ) -> Dict[str, Any]: - override_mode: Union[Literal["validation"], None] = ( - None if separate_input_output_schemas else "validation" - ) - # This expects that GenerateJsonSchema was already used to generate the definitions - json_schema = field_mapping[(field, override_mode or field.mode)] - if "$ref" not in json_schema: - # TODO remove when deprecating Pydantic v1 - # Ref: https://github.com/pydantic/pydantic/blob/d61792cc42c80b13b23e3ffa74bc37ec7c77f7d1/pydantic/schema.py#L207 - json_schema["title"] = ( - field.field_info.title or field.alias.title().replace("_", " ") - ) - return json_schema - - def get_compat_model_name_map(fields: List[ModelField]) -> ModelNameMap: - return {} - - def get_definitions( - *, - fields: List[ModelField], - schema_generator: GenerateJsonSchema, - model_name_map: ModelNameMap, - separate_input_output_schemas: bool = True, - ) -> Tuple[ - Dict[ - Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue - ], - Dict[str, Dict[str, Any]], - ]: - override_mode: Union[Literal["validation"], None] = ( - None if separate_input_output_schemas else "validation" - ) - inputs = [ - (field, override_mode or field.mode, field._type_adapter.core_schema) - for field in fields - ] - field_mapping, definitions = schema_generator.generate_definitions( - inputs=inputs - ) - return field_mapping, definitions # type: ignore[return-value] - - def is_scalar_field(field: ModelField) -> bool: - from fastapi import params - - return field_annotation_is_scalar( - field.field_info.annotation - ) and not isinstance(field.field_info, params.Body) - - def is_sequence_field(field: ModelField) -> bool: - return field_annotation_is_sequence(field.field_info.annotation) - - def is_scalar_sequence_field(field: ModelField) -> bool: - return field_annotation_is_scalar_sequence(field.field_info.annotation) - - def is_bytes_field(field: ModelField) -> bool: - return is_bytes_or_nonable_bytes_annotation(field.type_) - - def is_bytes_sequence_field(field: ModelField) -> bool: - return is_bytes_sequence_annotation(field.type_) - - def copy_field_info(*, field_info: FieldInfo, annotation: Any) -> FieldInfo: - cls = type(field_info) - merged_field_info = cls.from_annotation(annotation) - new_field_info = copy(field_info) - new_field_info.metadata = merged_field_info.metadata - new_field_info.annotation = merged_field_info.annotation - return new_field_info - - def serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]: - origin_type = ( - get_origin(field.field_info.annotation) or field.field_info.annotation - ) - assert issubclass(origin_type, sequence_types) # type: ignore[arg-type] - return sequence_annotation_to_type[origin_type](value) # type: ignore[no-any-return] - - def get_missing_field_error(loc: Tuple[str, ...]) -> Dict[str, Any]: - error = ValidationError.from_exception_data( - "Field required", [{"type": "missing", "loc": loc, "input": {}}] - ).errors(include_url=False)[0] - error["input"] = None - return error # type: ignore[return-value] - - def create_body_model( - *, fields: Sequence[ModelField], model_name: str - ) -> Type[BaseModel]: - field_params = {f.name: (f.field_info.annotation, f.field_info) for f in fields} - BodyModel: Type[BaseModel] = create_model(model_name, **field_params) # type: ignore[call-overload] - return BodyModel - -else: - from fastapi.openapi.constants import REF_PREFIX as REF_PREFIX - from pydantic import AnyUrl as Url # noqa: F401 - from pydantic import ( # type: ignore[assignment] - BaseConfig as BaseConfig, # noqa: F401 - ) - from pydantic import ValidationError as ValidationError # noqa: F401 - from pydantic.class_validators import ( # type: ignore[no-redef] - Validator as Validator, # noqa: F401 - ) - from pydantic.error_wrappers import ( # type: ignore[no-redef] - ErrorWrapper as ErrorWrapper, # noqa: F401 - ) - from pydantic.errors import MissingError - from pydantic.fields import ( # type: ignore[attr-defined] - SHAPE_FROZENSET, - SHAPE_LIST, - SHAPE_SEQUENCE, - SHAPE_SET, - SHAPE_SINGLETON, - SHAPE_TUPLE, - SHAPE_TUPLE_ELLIPSIS, - ) - from pydantic.fields import FieldInfo as FieldInfo - from pydantic.fields import ( # type: ignore[no-redef,attr-defined] - ModelField as ModelField, # noqa: F401 - ) - from pydantic.fields import ( # type: ignore[no-redef,attr-defined] - Required as Required, # noqa: F401 - ) - from pydantic.fields import ( # type: ignore[no-redef,attr-defined] - Undefined as Undefined, - ) - from pydantic.fields import ( # type: ignore[no-redef, attr-defined] - UndefinedType as UndefinedType, # noqa: F401 - ) - from pydantic.schema import ( - field_schema, - get_flat_models_from_fields, - get_model_name_map, - model_process_schema, - ) - from pydantic.schema import ( # type: ignore[no-redef] # noqa: F401 - get_annotation_from_field_info as get_annotation_from_field_info, - ) - from pydantic.typing import ( # type: ignore[no-redef] - evaluate_forwardref as evaluate_forwardref, # noqa: F401 - ) - from pydantic.utils import ( # type: ignore[no-redef] - lenient_issubclass as lenient_issubclass, # noqa: F401 - ) - - GetJsonSchemaHandler = Any # type: ignore[assignment,misc] - JsonSchemaValue = Dict[str, Any] # type: ignore[misc] - CoreSchema = Any # type: ignore[assignment,misc] - - sequence_shapes = { - SHAPE_LIST, - SHAPE_SET, - SHAPE_FROZENSET, - SHAPE_TUPLE, - SHAPE_SEQUENCE, - SHAPE_TUPLE_ELLIPSIS, - } - sequence_shape_to_type = { - SHAPE_LIST: list, - SHAPE_SET: set, - SHAPE_TUPLE: tuple, - SHAPE_SEQUENCE: list, - SHAPE_TUPLE_ELLIPSIS: list, - } - - @dataclass - class GenerateJsonSchema: # type: ignore[no-redef] - ref_template: str - - class PydanticSchemaGenerationError(Exception): # type: ignore[no-redef] - pass - - def with_info_plain_validator_function( # type: ignore[misc] - function: Callable[..., Any], - *, - ref: Union[str, None] = None, - metadata: Any = None, - serialization: Any = None, - ) -> Any: - return {} - - def get_model_definitions( - *, - flat_models: Set[Union[Type[BaseModel], Type[Enum]]], - model_name_map: Dict[Union[Type[BaseModel], Type[Enum]], str], - ) -> Dict[str, Any]: - definitions: Dict[str, Dict[str, Any]] = {} - for model in flat_models: - m_schema, m_definitions, m_nested_models = model_process_schema( - model, model_name_map=model_name_map, ref_prefix=REF_PREFIX - ) - definitions.update(m_definitions) - model_name = model_name_map[model] - if "description" in m_schema: - m_schema["description"] = m_schema["description"].split("\f")[0] - definitions[model_name] = m_schema - return definitions - - def is_pv1_scalar_field(field: ModelField) -> bool: - from fastapi import params - - field_info = field.field_info - if not ( - field.shape == SHAPE_SINGLETON # type: ignore[attr-defined] - and not lenient_issubclass(field.type_, BaseModel) - and not lenient_issubclass(field.type_, dict) - and not field_annotation_is_sequence(field.type_) - and not is_dataclass(field.type_) - and not isinstance(field_info, params.Body) - ): - return False - if field.sub_fields: # type: ignore[attr-defined] - if not all( - is_pv1_scalar_field(f) - for f in field.sub_fields # type: ignore[attr-defined] - ): - return False - return True - - def is_pv1_scalar_sequence_field(field: ModelField) -> bool: - if (field.shape in sequence_shapes) and not lenient_issubclass( # type: ignore[attr-defined] - field.type_, BaseModel - ): - if field.sub_fields is not None: # type: ignore[attr-defined] - for sub_field in field.sub_fields: # type: ignore[attr-defined] - if not is_pv1_scalar_field(sub_field): - return False - return True - if _annotation_is_sequence(field.type_): - return True - return False - - def _normalize_errors(errors: Sequence[Any]) -> List[Dict[str, Any]]: - use_errors: List[Any] = [] - for error in errors: - if isinstance(error, ErrorWrapper): - new_errors = ValidationError( # type: ignore[call-arg] - errors=[error], model=RequestErrorModel - ).errors() - use_errors.extend(new_errors) - elif isinstance(error, list): - use_errors.extend(_normalize_errors(error)) - else: - use_errors.append(error) - return use_errors - - def _model_rebuild(model: Type[BaseModel]) -> None: - model.update_forward_refs() - - def _model_dump( - model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any - ) -> Any: - return model.dict(**kwargs) - - def _get_model_config(model: BaseModel) -> Any: - return model.__config__ # type: ignore[attr-defined] - - def get_schema_from_model_field( - *, - field: ModelField, - schema_generator: GenerateJsonSchema, - model_name_map: ModelNameMap, - field_mapping: Dict[ - Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue - ], - separate_input_output_schemas: bool = True, - ) -> Dict[str, Any]: - # This expects that GenerateJsonSchema was already used to generate the definitions - return field_schema( # type: ignore[no-any-return] - field, model_name_map=model_name_map, ref_prefix=REF_PREFIX - )[0] - - def get_compat_model_name_map(fields: List[ModelField]) -> ModelNameMap: - models = get_flat_models_from_fields(fields, known_models=set()) - return get_model_name_map(models) # type: ignore[no-any-return] - - def get_definitions( - *, - fields: List[ModelField], - schema_generator: GenerateJsonSchema, - model_name_map: ModelNameMap, - separate_input_output_schemas: bool = True, - ) -> Tuple[ - Dict[ - Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue - ], - Dict[str, Dict[str, Any]], - ]: - models = get_flat_models_from_fields(fields, known_models=set()) - return {}, get_model_definitions( - flat_models=models, model_name_map=model_name_map - ) - - def is_scalar_field(field: ModelField) -> bool: - return is_pv1_scalar_field(field) - - def is_sequence_field(field: ModelField) -> bool: - return field.shape in sequence_shapes or _annotation_is_sequence(field.type_) # type: ignore[attr-defined] - - def is_scalar_sequence_field(field: ModelField) -> bool: - return is_pv1_scalar_sequence_field(field) - - def is_bytes_field(field: ModelField) -> bool: - return lenient_issubclass(field.type_, bytes) - - def is_bytes_sequence_field(field: ModelField) -> bool: - return field.shape in sequence_shapes and lenient_issubclass(field.type_, bytes) # type: ignore[attr-defined] - - def copy_field_info(*, field_info: FieldInfo, annotation: Any) -> FieldInfo: - return copy(field_info) - - def serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]: - return sequence_shape_to_type[field.shape](value) # type: ignore[no-any-return,attr-defined] - - def get_missing_field_error(loc: Tuple[str, ...]) -> Dict[str, Any]: - missing_field_error = ErrorWrapper(MissingError(), loc=loc) # type: ignore[call-arg] - new_error = ValidationError([missing_field_error], RequestErrorModel) - return new_error.errors()[0] # type: ignore[return-value] - - def create_body_model( - *, fields: Sequence[ModelField], model_name: str - ) -> Type[BaseModel]: - BodyModel = create_model(model_name) - for f in fields: - BodyModel.__fields__[f.name] = f # type: ignore[index] - return BodyModel - - -def _regenerate_error_with_loc( - *, errors: Sequence[Any], loc_prefix: Tuple[Union[str, int], ...] -) -> List[Dict[str, Any]]: - updated_loc_errors: List[Any] = [ - {**err, "loc": loc_prefix + err.get("loc", ())} - for err in _normalize_errors(errors) - ] - - return updated_loc_errors - - -def _annotation_is_sequence(annotation: Union[Type[Any], None]) -> bool: - if lenient_issubclass(annotation, (str, bytes)): - return False - return lenient_issubclass(annotation, sequence_types) - - -def field_annotation_is_sequence(annotation: Union[Type[Any], None]) -> bool: - return _annotation_is_sequence(annotation) or _annotation_is_sequence( - get_origin(annotation) - ) - - -def value_is_sequence(value: Any) -> bool: - return isinstance(value, sequence_types) and not isinstance(value, (str, bytes)) # type: ignore[arg-type] - - -def _annotation_is_complex(annotation: Union[Type[Any], None]) -> bool: - return ( - lenient_issubclass(annotation, (BaseModel, Mapping, UploadFile)) - or _annotation_is_sequence(annotation) - or is_dataclass(annotation) - ) - - -def field_annotation_is_complex(annotation: Union[Type[Any], None]) -> bool: - origin = get_origin(annotation) - if origin is Union or origin is UnionType: - return any(field_annotation_is_complex(arg) for arg in get_args(annotation)) - - return ( - _annotation_is_complex(annotation) - or _annotation_is_complex(origin) - or hasattr(origin, "__pydantic_core_schema__") - or hasattr(origin, "__get_pydantic_core_schema__") - ) - - -def field_annotation_is_scalar(annotation: Any) -> bool: - # handle Ellipsis here to make tuple[int, ...] work nicely - return annotation is Ellipsis or not field_annotation_is_complex(annotation) - - -def field_annotation_is_scalar_sequence(annotation: Union[Type[Any], None]) -> bool: - origin = get_origin(annotation) - if origin is Union or origin is UnionType: - at_least_one_scalar_sequence = False - for arg in get_args(annotation): - if field_annotation_is_scalar_sequence(arg): - at_least_one_scalar_sequence = True - continue - elif not field_annotation_is_scalar(arg): - return False - return at_least_one_scalar_sequence - return field_annotation_is_sequence(annotation) and all( - field_annotation_is_scalar(sub_annotation) - for sub_annotation in get_args(annotation) - ) - - -def is_bytes_or_nonable_bytes_annotation(annotation: Any) -> bool: - if lenient_issubclass(annotation, bytes): - return True - origin = get_origin(annotation) - if origin is Union or origin is UnionType: - for arg in get_args(annotation): - if lenient_issubclass(arg, bytes): - return True - return False - - -def is_uploadfile_or_nonable_uploadfile_annotation(annotation: Any) -> bool: - if lenient_issubclass(annotation, UploadFile): - return True - origin = get_origin(annotation) - if origin is Union or origin is UnionType: - for arg in get_args(annotation): - if lenient_issubclass(arg, UploadFile): - return True - return False - - -def is_bytes_sequence_annotation(annotation: Any) -> bool: - origin = get_origin(annotation) - if origin is Union or origin is UnionType: - at_least_one = False - for arg in get_args(annotation): - if is_bytes_sequence_annotation(arg): - at_least_one = True - continue - return at_least_one - return field_annotation_is_sequence(annotation) and all( - is_bytes_or_nonable_bytes_annotation(sub_annotation) - for sub_annotation in get_args(annotation) - ) - - -def is_uploadfile_sequence_annotation(annotation: Any) -> bool: - origin = get_origin(annotation) - if origin is Union or origin is UnionType: - at_least_one = False - for arg in get_args(annotation): - if is_uploadfile_sequence_annotation(arg): - at_least_one = True - continue - return at_least_one - return field_annotation_is_sequence(annotation) and all( - is_uploadfile_or_nonable_uploadfile_annotation(sub_annotation) - for sub_annotation in get_args(annotation) - ) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/applications.py b/write-message/venv/lib/python3.10/site-packages/fastapi/applications.py deleted file mode 100644 index 4446cac..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/applications.py +++ /dev/null @@ -1,4585 +0,0 @@ -from enum import Enum -from typing import ( - Any, - Awaitable, - Callable, - Coroutine, - Dict, - List, - Optional, - Sequence, - Type, - TypeVar, - Union, -) - -from fastapi import routing -from fastapi.datastructures import Default, DefaultPlaceholder -from fastapi.exception_handlers import ( - http_exception_handler, - request_validation_exception_handler, - websocket_request_validation_exception_handler, -) -from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError -from fastapi.logger import logger -from fastapi.openapi.docs import ( - get_redoc_html, - get_swagger_ui_html, - get_swagger_ui_oauth2_redirect_html, -) -from fastapi.openapi.utils import get_openapi -from fastapi.params import Depends -from fastapi.types import DecoratedCallable, IncEx -from fastapi.utils import generate_unique_id -from starlette.applications import Starlette -from starlette.datastructures import State -from starlette.exceptions import HTTPException -from starlette.middleware import Middleware -from starlette.middleware.base import BaseHTTPMiddleware -from starlette.requests import Request -from starlette.responses import HTMLResponse, JSONResponse, Response -from starlette.routing import BaseRoute -from starlette.types import ASGIApp, Lifespan, Receive, Scope, Send -from typing_extensions import Annotated, Doc, deprecated - -AppType = TypeVar("AppType", bound="FastAPI") - - -class FastAPI(Starlette): - """ - `FastAPI` app class, the main entrypoint to use FastAPI. - - Read more in the - [FastAPI docs for First Steps](https://fastapi.tiangolo.com/tutorial/first-steps/). - - ## Example - - ```python - from fastapi import FastAPI - - app = FastAPI() - ``` - """ - - def __init__( - self: AppType, - *, - debug: Annotated[ - bool, - Doc( - """ - Boolean indicating if debug tracebacks should be returned on server - errors. - - Read more in the - [Starlette docs for Applications](https://www.starlette.io/applications/#instantiating-the-application). - """ - ), - ] = False, - routes: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - **Note**: you probably shouldn't use this parameter, it is inherited - from Starlette and supported for compatibility. - - --- - - A list of routes to serve incoming HTTP and WebSocket requests. - """ - ), - deprecated( - """ - You normally wouldn't use this parameter with FastAPI, it is inherited - from Starlette and supported for compatibility. - - In FastAPI, you normally would use the *path operation methods*, - like `app.get()`, `app.post()`, etc. - """ - ), - ] = None, - title: Annotated[ - str, - Doc( - """ - The title of the API. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(title="ChimichangApp") - ``` - """ - ), - ] = "FastAPI", - summary: Annotated[ - Optional[str], - Doc( - """ - A short summary of the API. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(summary="Deadpond's favorite app. Nuff said.") - ``` - """ - ), - ] = None, - description: Annotated[ - str, - Doc( - ''' - A description of the API. Supports Markdown (using - [CommonMark syntax](https://commonmark.org/)). - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI( - description=""" - ChimichangApp API helps you do awesome stuff. 🚀 - - ## Items - - You can **read items**. - - ## Users - - You will be able to: - - * **Create users** (_not implemented_). - * **Read users** (_not implemented_). - - """ - ) - ``` - ''' - ), - ] = "", - version: Annotated[ - str, - Doc( - """ - The version of the API. - - **Note** This is the version of your application, not the version of - the OpenAPI specification nor the version of FastAPI being used. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(version="0.0.1") - ``` - """ - ), - ] = "0.1.0", - openapi_url: Annotated[ - Optional[str], - Doc( - """ - The URL where the OpenAPI schema will be served from. - - If you set it to `None`, no OpenAPI schema will be served publicly, and - the default automatic endpoints `/docs` and `/redoc` will also be - disabled. - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#openapi-url). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(openapi_url="/api/v1/openapi.json") - ``` - """ - ), - ] = "/openapi.json", - openapi_tags: Annotated[ - Optional[List[Dict[str, Any]]], - Doc( - """ - A list of tags used by OpenAPI, these are the same `tags` you can set - in the *path operations*, like: - - * `@app.get("/users/", tags=["users"])` - * `@app.get("/items/", tags=["items"])` - - The order of the tags can be used to specify the order shown in - tools like Swagger UI, used in the automatic path `/docs`. - - It's not required to specify all the tags used. - - The tags that are not declared MAY be organized randomly or based - on the tools' logic. Each tag name in the list MUST be unique. - - The value of each item is a `dict` containing: - - * `name`: The name of the tag. - * `description`: A short description of the tag. - [CommonMark syntax](https://commonmark.org/) MAY be used for rich - text representation. - * `externalDocs`: Additional external documentation for this tag. If - provided, it would contain a `dict` with: - * `description`: A short description of the target documentation. - [CommonMark syntax](https://commonmark.org/) MAY be used for - rich text representation. - * `url`: The URL for the target documentation. Value MUST be in - the form of a URL. - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-tags). - - **Example** - - ```python - from fastapi import FastAPI - - tags_metadata = [ - { - "name": "users", - "description": "Operations with users. The **login** logic is also here.", - }, - { - "name": "items", - "description": "Manage items. So _fancy_ they have their own docs.", - "externalDocs": { - "description": "Items external docs", - "url": "https://fastapi.tiangolo.com/", - }, - }, - ] - - app = FastAPI(openapi_tags=tags_metadata) - ``` - """ - ), - ] = None, - servers: Annotated[ - Optional[List[Dict[str, Union[str, Any]]]], - Doc( - """ - A `list` of `dict`s with connectivity information to a target server. - - You would use it, for example, if your application is served from - different domains and you want to use the same Swagger UI in the - browser to interact with each of them (instead of having multiple - browser tabs open). Or if you want to leave fixed the possible URLs. - - If the servers `list` is not provided, or is an empty `list`, the - default value would be a `dict` with a `url` value of `/`. - - Each item in the `list` is a `dict` containing: - - * `url`: A URL to the target host. This URL supports Server Variables - and MAY be relative, to indicate that the host location is relative - to the location where the OpenAPI document is being served. Variable - substitutions will be made when a variable is named in `{`brackets`}`. - * `description`: An optional string describing the host designated by - the URL. [CommonMark syntax](https://commonmark.org/) MAY be used for - rich text representation. - * `variables`: A `dict` between a variable name and its value. The value - is used for substitution in the server's URL template. - - Read more in the - [FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/#additional-servers). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI( - servers=[ - {"url": "https://stag.example.com", "description": "Staging environment"}, - {"url": "https://prod.example.com", "description": "Production environment"}, - ] - ) - ``` - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of global dependencies, they will be applied to each - *path operation*, including in sub-routers. - - Read more about it in the - [FastAPI docs for Global Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/global-dependencies/). - - **Example** - - ```python - from fastapi import Depends, FastAPI - - from .dependencies import func_dep_1, func_dep_2 - - app = FastAPI(dependencies=[Depends(func_dep_1), Depends(func_dep_2)]) - ``` - """ - ), - ] = None, - default_response_class: Annotated[ - Type[Response], - Doc( - """ - The default response class to be used. - - Read more in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class). - - **Example** - - ```python - from fastapi import FastAPI - from fastapi.responses import ORJSONResponse - - app = FastAPI(default_response_class=ORJSONResponse) - ``` - """ - ), - ] = Default(JSONResponse), - redirect_slashes: Annotated[ - bool, - Doc( - """ - Whether to detect and redirect slashes in URLs when the client doesn't - use the same format. - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(redirect_slashes=True) # the default - - @app.get("/items/") - async def read_items(): - return [{"item_id": "Foo"}] - ``` - - With this app, if a client goes to `/items` (without a trailing slash), - they will be automatically redirected with an HTTP status code of 307 - to `/items/`. - """ - ), - ] = True, - docs_url: Annotated[ - Optional[str], - Doc( - """ - The path to the automatic interactive API documentation. - It is handled in the browser by Swagger UI. - - The default URL is `/docs`. You can disable it by setting it to `None`. - - If `openapi_url` is set to `None`, this will be automatically disabled. - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#docs-urls). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(docs_url="/documentation", redoc_url=None) - ``` - """ - ), - ] = "/docs", - redoc_url: Annotated[ - Optional[str], - Doc( - """ - The path to the alternative automatic interactive API documentation - provided by ReDoc. - - The default URL is `/redoc`. You can disable it by setting it to `None`. - - If `openapi_url` is set to `None`, this will be automatically disabled. - - Read more in the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#docs-urls). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(docs_url="/documentation", redoc_url="redocumentation") - ``` - """ - ), - ] = "/redoc", - swagger_ui_oauth2_redirect_url: Annotated[ - Optional[str], - Doc( - """ - The OAuth2 redirect endpoint for the Swagger UI. - - By default it is `/docs/oauth2-redirect`. - - This is only used if you use OAuth2 (with the "Authorize" button) - with Swagger UI. - """ - ), - ] = "/docs/oauth2-redirect", - swagger_ui_init_oauth: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - OAuth2 configuration for the Swagger UI, by default shown at `/docs`. - - Read more about the available configuration options in the - [Swagger UI docs](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/). - """ - ), - ] = None, - middleware: Annotated[ - Optional[Sequence[Middleware]], - Doc( - """ - List of middleware to be added when creating the application. - - In FastAPI you would normally do this with `app.add_middleware()` - instead. - - Read more in the - [FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/). - """ - ), - ] = None, - exception_handlers: Annotated[ - Optional[ - Dict[ - Union[int, Type[Exception]], - Callable[[Request, Any], Coroutine[Any, Any, Response]], - ] - ], - Doc( - """ - A dictionary with handlers for exceptions. - - In FastAPI, you would normally use the decorator - `@app.exception_handler()`. - - Read more in the - [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/). - """ - ), - ] = None, - on_startup: Annotated[ - Optional[Sequence[Callable[[], Any]]], - Doc( - """ - A list of startup event handler functions. - - You should instead use the `lifespan` handlers. - - Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). - """ - ), - ] = None, - on_shutdown: Annotated[ - Optional[Sequence[Callable[[], Any]]], - Doc( - """ - A list of shutdown event handler functions. - - You should instead use the `lifespan` handlers. - - Read more in the - [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). - """ - ), - ] = None, - lifespan: Annotated[ - Optional[Lifespan[AppType]], - Doc( - """ - A `Lifespan` context manager handler. This replaces `startup` and - `shutdown` functions with a single context manager. - - Read more in the - [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). - """ - ), - ] = None, - terms_of_service: Annotated[ - Optional[str], - Doc( - """ - A URL to the Terms of Service for your API. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more at the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). - - **Example** - - ```python - app = FastAPI(terms_of_service="http://example.com/terms/") - ``` - """ - ), - ] = None, - contact: Annotated[ - Optional[Dict[str, Union[str, Any]]], - Doc( - """ - A dictionary with the contact information for the exposed API. - - It can contain several fields. - - * `name`: (`str`) The name of the contact person/organization. - * `url`: (`str`) A URL pointing to the contact information. MUST be in - the format of a URL. - * `email`: (`str`) The email address of the contact person/organization. - MUST be in the format of an email address. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more at the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). - - **Example** - - ```python - app = FastAPI( - contact={ - "name": "Deadpoolio the Amazing", - "url": "http://x-force.example.com/contact/", - "email": "dp@x-force.example.com", - } - ) - ``` - """ - ), - ] = None, - license_info: Annotated[ - Optional[Dict[str, Union[str, Any]]], - Doc( - """ - A dictionary with the license information for the exposed API. - - It can contain several fields. - - * `name`: (`str`) **REQUIRED** (if a `license_info` is set). The - license name used for the API. - * `identifier`: (`str`) An [SPDX](https://spdx.dev/) license expression - for the API. The `identifier` field is mutually exclusive of the `url` - field. Available since OpenAPI 3.1.0, FastAPI 0.99.0. - * `url`: (`str`) A URL to the license used for the API. This MUST be - the format of a URL. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more at the - [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api). - - **Example** - - ```python - app = FastAPI( - license_info={ - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html", - } - ) - ``` - """ - ), - ] = None, - openapi_prefix: Annotated[ - str, - Doc( - """ - A URL prefix for the OpenAPI URL. - """ - ), - deprecated( - """ - "openapi_prefix" has been deprecated in favor of "root_path", which - follows more closely the ASGI standard, is simpler, and more - automatic. - """ - ), - ] = "", - root_path: Annotated[ - str, - Doc( - """ - A path prefix handled by a proxy that is not seen by the application - but is seen by external clients, which affects things like Swagger UI. - - Read more about it at the - [FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(root_path="/api/v1") - ``` - """ - ), - ] = "", - root_path_in_servers: Annotated[ - bool, - Doc( - """ - To disable automatically generating the URLs in the `servers` field - in the autogenerated OpenAPI using the `root_path`. - - Read more about it in the - [FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/#disable-automatic-server-from-root_path). - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI(root_path_in_servers=False) - ``` - """ - ), - ] = True, - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses to be shown in OpenAPI. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Additional Responses in OpenAPI](https://fastapi.tiangolo.com/advanced/additional-responses/). - - And in the - [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies). - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - OpenAPI callbacks that should apply to all *path operations*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - webhooks: Annotated[ - Optional[routing.APIRouter], - Doc( - """ - Add OpenAPI webhooks. This is similar to `callbacks` but it doesn't - depend on specific *path operations*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - **Note**: This is available since OpenAPI 3.1.0, FastAPI 0.99.0. - - Read more about it in the - [FastAPI docs for OpenAPI Webhooks](https://fastapi.tiangolo.com/advanced/openapi-webhooks/). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark all *path operations* as deprecated. You probably don't need it, - but it's available. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) all the *path operations* in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - swagger_ui_parameters: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Parameters to configure Swagger UI, the autogenerated interactive API - documentation (by default at `/docs`). - - Read more about it in the - [FastAPI docs about how to Configure Swagger UI](https://fastapi.tiangolo.com/how-to/configure-swagger-ui/). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - separate_input_output_schemas: Annotated[ - bool, - Doc( - """ - Whether to generate separate OpenAPI schemas for request body and - response body when the results would be more precise. - - This is particularly useful when automatically generating clients. - - For example, if you have a model like: - - ```python - from pydantic import BaseModel - - class Item(BaseModel): - name: str - tags: list[str] = [] - ``` - - When `Item` is used for input, a request body, `tags` is not required, - the client doesn't have to provide it. - - But when using `Item` for output, for a response body, `tags` is always - available because it has a default value, even if it's just an empty - list. So, the client should be able to always expect it. - - In this case, there would be two different schemas, one for input and - another one for output. - """ - ), - ] = True, - **extra: Annotated[ - Any, - Doc( - """ - Extra keyword arguments to be stored in the app, not used by FastAPI - anywhere. - """ - ), - ], - ) -> None: - self.debug = debug - self.title = title - self.summary = summary - self.description = description - self.version = version - self.terms_of_service = terms_of_service - self.contact = contact - self.license_info = license_info - self.openapi_url = openapi_url - self.openapi_tags = openapi_tags - self.root_path_in_servers = root_path_in_servers - self.docs_url = docs_url - self.redoc_url = redoc_url - self.swagger_ui_oauth2_redirect_url = swagger_ui_oauth2_redirect_url - self.swagger_ui_init_oauth = swagger_ui_init_oauth - self.swagger_ui_parameters = swagger_ui_parameters - self.servers = servers or [] - self.separate_input_output_schemas = separate_input_output_schemas - self.extra = extra - self.openapi_version: Annotated[ - str, - Doc( - """ - The version string of OpenAPI. - - FastAPI will generate OpenAPI version 3.1.0, and will output that as - the OpenAPI version. But some tools, even though they might be - compatible with OpenAPI 3.1.0, might not recognize it as a valid. - - So you could override this value to trick those tools into using - the generated OpenAPI. Have in mind that this is a hack. But if you - avoid using features added in OpenAPI 3.1.0, it might work for your - use case. - - This is not passed as a parameter to the `FastAPI` class to avoid - giving the false idea that FastAPI would generate a different OpenAPI - schema. It is only available as an attribute. - - **Example** - - ```python - from fastapi import FastAPI - - app = FastAPI() - - app.openapi_version = "3.0.2" - ``` - """ - ), - ] = "3.1.0" - self.openapi_schema: Optional[Dict[str, Any]] = None - if self.openapi_url: - assert self.title, "A title must be provided for OpenAPI, e.g.: 'My API'" - assert self.version, "A version must be provided for OpenAPI, e.g.: '2.1.0'" - # TODO: remove when discarding the openapi_prefix parameter - if openapi_prefix: - logger.warning( - '"openapi_prefix" has been deprecated in favor of "root_path", which ' - "follows more closely the ASGI standard, is simpler, and more " - "automatic. Check the docs at " - "https://fastapi.tiangolo.com/advanced/sub-applications/" - ) - self.webhooks: Annotated[ - routing.APIRouter, - Doc( - """ - The `app.webhooks` attribute is an `APIRouter` with the *path - operations* that will be used just for documentation of webhooks. - - Read more about it in the - [FastAPI docs for OpenAPI Webhooks](https://fastapi.tiangolo.com/advanced/openapi-webhooks/). - """ - ), - ] = webhooks or routing.APIRouter() - self.root_path = root_path or openapi_prefix - self.state: Annotated[ - State, - Doc( - """ - A state object for the application. This is the same object for the - entire application, it doesn't change from request to request. - - You normally woudln't use this in FastAPI, for most of the cases you - would instead use FastAPI dependencies. - - This is simply inherited from Starlette. - - Read more about it in the - [Starlette docs for Applications](https://www.starlette.io/applications/#storing-state-on-the-app-instance). - """ - ), - ] = State() - self.dependency_overrides: Annotated[ - Dict[Callable[..., Any], Callable[..., Any]], - Doc( - """ - A dictionary with overrides for the dependencies. - - Each key is the original dependency callable, and the value is the - actual dependency that should be called. - - This is for testing, to replace expensive dependencies with testing - versions. - - Read more about it in the - [FastAPI docs for Testing Dependencies with Overrides](https://fastapi.tiangolo.com/advanced/testing-dependencies/). - """ - ), - ] = {} - self.router: routing.APIRouter = routing.APIRouter( - routes=routes, - redirect_slashes=redirect_slashes, - dependency_overrides_provider=self, - on_startup=on_startup, - on_shutdown=on_shutdown, - lifespan=lifespan, - default_response_class=default_response_class, - dependencies=dependencies, - callbacks=callbacks, - deprecated=deprecated, - include_in_schema=include_in_schema, - responses=responses, - generate_unique_id_function=generate_unique_id_function, - ) - self.exception_handlers: Dict[ - Any, Callable[[Request, Any], Union[Response, Awaitable[Response]]] - ] = {} if exception_handlers is None else dict(exception_handlers) - self.exception_handlers.setdefault(HTTPException, http_exception_handler) - self.exception_handlers.setdefault( - RequestValidationError, request_validation_exception_handler - ) - self.exception_handlers.setdefault( - WebSocketRequestValidationError, - # Starlette still has incorrect type specification for the handlers - websocket_request_validation_exception_handler, # type: ignore - ) - - self.user_middleware: List[Middleware] = ( - [] if middleware is None else list(middleware) - ) - self.middleware_stack: Union[ASGIApp, None] = None - self.setup() - - def openapi(self) -> Dict[str, Any]: - """ - Generate the OpenAPI schema of the application. This is called by FastAPI - internally. - - The first time it is called it stores the result in the attribute - `app.openapi_schema`, and next times it is called, it just returns that same - result. To avoid the cost of generating the schema every time. - - If you need to modify the generated OpenAPI schema, you could modify it. - - Read more in the - [FastAPI docs for OpenAPI](https://fastapi.tiangolo.com/how-to/extending-openapi/). - """ - if not self.openapi_schema: - self.openapi_schema = get_openapi( - title=self.title, - version=self.version, - openapi_version=self.openapi_version, - summary=self.summary, - description=self.description, - terms_of_service=self.terms_of_service, - contact=self.contact, - license_info=self.license_info, - routes=self.routes, - webhooks=self.webhooks.routes, - tags=self.openapi_tags, - servers=self.servers, - separate_input_output_schemas=self.separate_input_output_schemas, - ) - return self.openapi_schema - - def setup(self) -> None: - if self.openapi_url: - urls = (server_data.get("url") for server_data in self.servers) - server_urls = {url for url in urls if url} - - async def openapi(req: Request) -> JSONResponse: - root_path = req.scope.get("root_path", "").rstrip("/") - if root_path not in server_urls: - if root_path and self.root_path_in_servers: - self.servers.insert(0, {"url": root_path}) - server_urls.add(root_path) - return JSONResponse(self.openapi()) - - self.add_route(self.openapi_url, openapi, include_in_schema=False) - if self.openapi_url and self.docs_url: - - async def swagger_ui_html(req: Request) -> HTMLResponse: - root_path = req.scope.get("root_path", "").rstrip("/") - openapi_url = root_path + self.openapi_url - oauth2_redirect_url = self.swagger_ui_oauth2_redirect_url - if oauth2_redirect_url: - oauth2_redirect_url = root_path + oauth2_redirect_url - return get_swagger_ui_html( - openapi_url=openapi_url, - title=f"{self.title} - Swagger UI", - oauth2_redirect_url=oauth2_redirect_url, - init_oauth=self.swagger_ui_init_oauth, - swagger_ui_parameters=self.swagger_ui_parameters, - ) - - self.add_route(self.docs_url, swagger_ui_html, include_in_schema=False) - - if self.swagger_ui_oauth2_redirect_url: - - async def swagger_ui_redirect(req: Request) -> HTMLResponse: - return get_swagger_ui_oauth2_redirect_html() - - self.add_route( - self.swagger_ui_oauth2_redirect_url, - swagger_ui_redirect, - include_in_schema=False, - ) - if self.openapi_url and self.redoc_url: - - async def redoc_html(req: Request) -> HTMLResponse: - root_path = req.scope.get("root_path", "").rstrip("/") - openapi_url = root_path + self.openapi_url - return get_redoc_html( - openapi_url=openapi_url, title=f"{self.title} - ReDoc" - ) - - self.add_route(self.redoc_url, redoc_html, include_in_schema=False) - - async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: - if self.root_path: - scope["root_path"] = self.root_path - await super().__call__(scope, receive, send) - - def add_api_route( - self, - path: str, - endpoint: Callable[..., Coroutine[Any, Any, Response]], - *, - response_model: Any = Default(None), - status_code: Optional[int] = None, - tags: Optional[List[Union[str, Enum]]] = None, - dependencies: Optional[Sequence[Depends]] = None, - summary: Optional[str] = None, - description: Optional[str] = None, - response_description: str = "Successful Response", - responses: Optional[Dict[Union[int, str], Dict[str, Any]]] = None, - deprecated: Optional[bool] = None, - methods: Optional[List[str]] = None, - operation_id: Optional[str] = None, - response_model_include: Optional[IncEx] = None, - response_model_exclude: Optional[IncEx] = None, - response_model_by_alias: bool = True, - response_model_exclude_unset: bool = False, - response_model_exclude_defaults: bool = False, - response_model_exclude_none: bool = False, - include_in_schema: bool = True, - response_class: Union[Type[Response], DefaultPlaceholder] = Default( - JSONResponse - ), - name: Optional[str] = None, - openapi_extra: Optional[Dict[str, Any]] = None, - generate_unique_id_function: Callable[[routing.APIRoute], str] = Default( - generate_unique_id - ), - ) -> None: - self.router.add_api_route( - path, - endpoint=endpoint, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=methods, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def api_route( - self, - path: str, - *, - response_model: Any = Default(None), - status_code: Optional[int] = None, - tags: Optional[List[Union[str, Enum]]] = None, - dependencies: Optional[Sequence[Depends]] = None, - summary: Optional[str] = None, - description: Optional[str] = None, - response_description: str = "Successful Response", - responses: Optional[Dict[Union[int, str], Dict[str, Any]]] = None, - deprecated: Optional[bool] = None, - methods: Optional[List[str]] = None, - operation_id: Optional[str] = None, - response_model_include: Optional[IncEx] = None, - response_model_exclude: Optional[IncEx] = None, - response_model_by_alias: bool = True, - response_model_exclude_unset: bool = False, - response_model_exclude_defaults: bool = False, - response_model_exclude_none: bool = False, - include_in_schema: bool = True, - response_class: Type[Response] = Default(JSONResponse), - name: Optional[str] = None, - openapi_extra: Optional[Dict[str, Any]] = None, - generate_unique_id_function: Callable[[routing.APIRoute], str] = Default( - generate_unique_id - ), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.router.add_api_route( - path, - func, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=methods, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - return func - - return decorator - - def add_api_websocket_route( - self, - path: str, - endpoint: Callable[..., Any], - name: Optional[str] = None, - *, - dependencies: Optional[Sequence[Depends]] = None, - ) -> None: - self.router.add_api_websocket_route( - path, - endpoint, - name=name, - dependencies=dependencies, - ) - - def websocket( - self, - path: Annotated[ - str, - Doc( - """ - WebSocket path. - """ - ), - ], - name: Annotated[ - Optional[str], - Doc( - """ - A name for the WebSocket. Only used internally. - """ - ), - ] = None, - *, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be used for this - WebSocket. - - Read more about it in the - [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/). - """ - ), - ] = None, - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Decorate a WebSocket function. - - Read more about it in the - [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/). - - **Example** - - ```python - from fastapi import FastAPI, WebSocket - - app = FastAPI() - - @app.websocket("/ws") - async def websocket_endpoint(websocket: WebSocket): - await websocket.accept() - while True: - data = await websocket.receive_text() - await websocket.send_text(f"Message text was: {data}") - ``` - """ - - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_api_websocket_route( - path, - func, - name=name, - dependencies=dependencies, - ) - return func - - return decorator - - def include_router( - self, - router: Annotated[routing.APIRouter, Doc("The `APIRouter` to include.")], - *, - prefix: Annotated[str, Doc("An optional path prefix for the router.")] = "", - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to all the *path operations* in this - router. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to all the - *path operations* in this router. - - Read more about it in the - [FastAPI docs for Bigger Applications - Multiple Files](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies). - - **Example** - - ```python - from fastapi import Depends, FastAPI - - from .dependencies import get_token_header - from .internal import admin - - app = FastAPI() - - app.include_router( - admin.router, - dependencies=[Depends(get_token_header)], - ) - ``` - """ - ), - ] = None, - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses to be shown in OpenAPI. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Additional Responses in OpenAPI](https://fastapi.tiangolo.com/advanced/additional-responses/). - - And in the - [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark all the *path operations* in this router as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - **Example** - - ```python - from fastapi import FastAPI - - from .internal import old_api - - app = FastAPI() - - app.include_router( - old_api.router, - deprecated=True, - ) - ``` - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include (or not) all the *path operations* in this router in the - generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - **Example** - - ```python - from fastapi import FastAPI - - from .internal import old_api - - app = FastAPI() - - app.include_router( - old_api.router, - include_in_schema=False, - ) - ``` - """ - ), - ] = True, - default_response_class: Annotated[ - Type[Response], - Doc( - """ - Default response class to be used for the *path operations* in this - router. - - Read more in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class). - - **Example** - - ```python - from fastapi import FastAPI - from fastapi.responses import ORJSONResponse - - from .internal import old_api - - app = FastAPI() - - app.include_router( - old_api.router, - default_response_class=ORJSONResponse, - ) - ``` - """ - ), - ] = Default(JSONResponse), - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> None: - """ - Include an `APIRouter` in the same app. - - Read more about it in the - [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/). - - ## Example - - ```python - from fastapi import FastAPI - - from .users import users_router - - app = FastAPI() - - app.include_router(users_router) - ``` - """ - self.router.include_router( - router, - prefix=prefix, - tags=tags, - dependencies=dependencies, - responses=responses, - deprecated=deprecated, - include_in_schema=include_in_schema, - default_response_class=default_response_class, - callbacks=callbacks, - generate_unique_id_function=generate_unique_id_function, - ) - - def get( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP GET operation. - - ## Example - - ```python - from fastapi import FastAPI - - app = FastAPI() - - @app.get("/items/") - def read_items(): - return [{"name": "Empanada"}, {"name": "Arepa"}] - ``` - """ - return self.router.get( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def put( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP PUT operation. - - ## Example - - ```python - from fastapi import FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - - @app.put("/items/{item_id}") - def replace_item(item_id: str, item: Item): - return {"message": "Item replaced", "id": item_id} - ``` - """ - return self.router.put( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def post( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP POST operation. - - ## Example - - ```python - from fastapi import FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - - @app.post("/items/") - def create_item(item: Item): - return {"message": "Item created"} - ``` - """ - return self.router.post( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def delete( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP DELETE operation. - - ## Example - - ```python - from fastapi import FastAPI - - app = FastAPI() - - @app.delete("/items/{item_id}") - def delete_item(item_id: str): - return {"message": "Item deleted"} - ``` - """ - return self.router.delete( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def options( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP OPTIONS operation. - - ## Example - - ```python - from fastapi import FastAPI - - app = FastAPI() - - @app.options("/items/") - def get_item_options(): - return {"additions": ["Aji", "Guacamole"]} - ``` - """ - return self.router.options( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def head( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP HEAD operation. - - ## Example - - ```python - from fastapi import FastAPI, Response - - app = FastAPI() - - @app.head("/items/", status_code=204) - def get_items_headers(response: Response): - response.headers["X-Cat-Dog"] = "Alone in the world" - ``` - """ - return self.router.head( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def patch( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP PATCH operation. - - ## Example - - ```python - from fastapi import FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - - @app.patch("/items/") - def update_item(item: Item): - return {"message": "Item updated in place"} - ``` - """ - return self.router.patch( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def trace( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[routing.APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP TRACE operation. - - ## Example - - ```python - from fastapi import FastAPI - - app = FastAPI() - - @app.put("/items/{item_id}") - def trace_item(item_id: str): - return None - ``` - """ - return self.router.trace( - path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def websocket_route( - self, path: str, name: Union[str, None] = None - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.router.add_websocket_route(path, func, name=name) - return func - - return decorator - - @deprecated( - """ - on_event is deprecated, use lifespan event handlers instead. - - Read more about it in the - [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/). - """ - ) - def on_event( - self, - event_type: Annotated[ - str, - Doc( - """ - The type of event. `startup` or `shutdown`. - """ - ), - ], - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add an event handler for the application. - - `on_event` is deprecated, use `lifespan` event handlers instead. - - Read more about it in the - [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/#alternative-events-deprecated). - """ - return self.router.on_event(event_type) - - def middleware( - self, - middleware_type: Annotated[ - str, - Doc( - """ - The type of middleware. Currently only supports `http`. - """ - ), - ], - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a middleware to the application. - - Read more about it in the - [FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/). - - ## Example - - ```python - import time - - from fastapi import FastAPI, Request - - app = FastAPI() - - - @app.middleware("http") - async def add_process_time_header(request: Request, call_next): - start_time = time.time() - response = await call_next(request) - process_time = time.time() - start_time - response.headers["X-Process-Time"] = str(process_time) - return response - ``` - """ - - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_middleware(BaseHTTPMiddleware, dispatch=func) - return func - - return decorator - - def exception_handler( - self, - exc_class_or_status_code: Annotated[ - Union[int, Type[Exception]], - Doc( - """ - The Exception class this would handle, or a status code. - """ - ), - ], - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add an exception handler to the app. - - Read more about it in the - [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/). - - ## Example - - ```python - from fastapi import FastAPI, Request - from fastapi.responses import JSONResponse - - - class UnicornException(Exception): - def __init__(self, name: str): - self.name = name - - - app = FastAPI() - - - @app.exception_handler(UnicornException) - async def unicorn_exception_handler(request: Request, exc: UnicornException): - return JSONResponse( - status_code=418, - content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."}, - ) - ``` - """ - - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_exception_handler(exc_class_or_status_code, func) - return func - - return decorator diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/background.py b/write-message/venv/lib/python3.10/site-packages/fastapi/background.py deleted file mode 100644 index 203578a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/background.py +++ /dev/null @@ -1,59 +0,0 @@ -from typing import Any, Callable - -from starlette.background import BackgroundTasks as StarletteBackgroundTasks -from typing_extensions import Annotated, Doc, ParamSpec - -P = ParamSpec("P") - - -class BackgroundTasks(StarletteBackgroundTasks): - """ - A collection of background tasks that will be called after a response has been - sent to the client. - - Read more about it in the - [FastAPI docs for Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/). - - ## Example - - ```python - from fastapi import BackgroundTasks, FastAPI - - app = FastAPI() - - - def write_notification(email: str, message=""): - with open("log.txt", mode="w") as email_file: - content = f"notification for {email}: {message}" - email_file.write(content) - - - @app.post("/send-notification/{email}") - async def send_notification(email: str, background_tasks: BackgroundTasks): - background_tasks.add_task(write_notification, email, message="some notification") - return {"message": "Notification sent in the background"} - ``` - """ - - def add_task( - self, - func: Annotated[ - Callable[P, Any], - Doc( - """ - The function to call after the response is sent. - - It can be a regular `def` function or an `async def` function. - """ - ), - ], - *args: P.args, - **kwargs: P.kwargs, - ) -> None: - """ - Add a function to be called in the background after the response is sent. - - Read more about it in the - [FastAPI docs for Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/). - """ - return super().add_task(func, *args, **kwargs) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/concurrency.py b/write-message/venv/lib/python3.10/site-packages/fastapi/concurrency.py deleted file mode 100644 index 894bd3e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/concurrency.py +++ /dev/null @@ -1,39 +0,0 @@ -from contextlib import asynccontextmanager as asynccontextmanager -from typing import AsyncGenerator, ContextManager, TypeVar - -import anyio -from anyio import CapacityLimiter -from starlette.concurrency import iterate_in_threadpool as iterate_in_threadpool # noqa -from starlette.concurrency import run_in_threadpool as run_in_threadpool # noqa -from starlette.concurrency import ( # noqa - run_until_first_complete as run_until_first_complete, -) - -_T = TypeVar("_T") - - -@asynccontextmanager -async def contextmanager_in_threadpool( - cm: ContextManager[_T], -) -> AsyncGenerator[_T, None]: - # blocking __exit__ from running waiting on a free thread - # can create race conditions/deadlocks if the context manager itself - # has its own internal pool (e.g. a database connection pool) - # to avoid this we let __exit__ run without a capacity limit - # since we're creating a new limiter for each call, any non-zero limit - # works (1 is arbitrary) - exit_limiter = CapacityLimiter(1) - try: - yield await run_in_threadpool(cm.__enter__) - except Exception as e: - ok = bool( - await anyio.to_thread.run_sync( - cm.__exit__, type(e), e, None, limiter=exit_limiter - ) - ) - if not ok: - raise e - else: - await anyio.to_thread.run_sync( - cm.__exit__, None, None, None, limiter=exit_limiter - ) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/datastructures.py b/write-message/venv/lib/python3.10/site-packages/fastapi/datastructures.py deleted file mode 100644 index cf8406b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/datastructures.py +++ /dev/null @@ -1,204 +0,0 @@ -from typing import ( - Any, - BinaryIO, - Callable, - Dict, - Iterable, - Optional, - Type, - TypeVar, - cast, -) - -from fastapi._compat import ( - PYDANTIC_V2, - CoreSchema, - GetJsonSchemaHandler, - JsonSchemaValue, - with_info_plain_validator_function, -) -from starlette.datastructures import URL as URL # noqa: F401 -from starlette.datastructures import Address as Address # noqa: F401 -from starlette.datastructures import FormData as FormData # noqa: F401 -from starlette.datastructures import Headers as Headers # noqa: F401 -from starlette.datastructures import QueryParams as QueryParams # noqa: F401 -from starlette.datastructures import State as State # noqa: F401 -from starlette.datastructures import UploadFile as StarletteUploadFile -from typing_extensions import Annotated, Doc - - -class UploadFile(StarletteUploadFile): - """ - A file uploaded in a request. - - Define it as a *path operation function* (or dependency) parameter. - - If you are using a regular `def` function, you can use the `upload_file.file` - attribute to access the raw standard Python file (blocking, not async), useful and - needed for non-async code. - - Read more about it in the - [FastAPI docs for Request Files](https://fastapi.tiangolo.com/tutorial/request-files/). - - ## Example - - ```python - from typing import Annotated - - from fastapi import FastAPI, File, UploadFile - - app = FastAPI() - - - @app.post("/files/") - async def create_file(file: Annotated[bytes, File()]): - return {"file_size": len(file)} - - - @app.post("/uploadfile/") - async def create_upload_file(file: UploadFile): - return {"filename": file.filename} - ``` - """ - - file: Annotated[ - BinaryIO, - Doc("The standard Python file object (non-async)."), - ] - filename: Annotated[Optional[str], Doc("The original file name.")] - size: Annotated[Optional[int], Doc("The size of the file in bytes.")] - headers: Annotated[Headers, Doc("The headers of the request.")] - content_type: Annotated[ - Optional[str], Doc("The content type of the request, from the headers.") - ] - - async def write( - self, - data: Annotated[ - bytes, - Doc( - """ - The bytes to write to the file. - """ - ), - ], - ) -> None: - """ - Write some bytes to the file. - - You normally wouldn't use this from a file you read in a request. - - To be awaitable, compatible with async, this is run in threadpool. - """ - return await super().write(data) - - async def read( - self, - size: Annotated[ - int, - Doc( - """ - The number of bytes to read from the file. - """ - ), - ] = -1, - ) -> bytes: - """ - Read some bytes from the file. - - To be awaitable, compatible with async, this is run in threadpool. - """ - return await super().read(size) - - async def seek( - self, - offset: Annotated[ - int, - Doc( - """ - The position in bytes to seek to in the file. - """ - ), - ], - ) -> None: - """ - Move to a position in the file. - - Any next read or write will be done from that position. - - To be awaitable, compatible with async, this is run in threadpool. - """ - return await super().seek(offset) - - async def close(self) -> None: - """ - Close the file. - - To be awaitable, compatible with async, this is run in threadpool. - """ - return await super().close() - - @classmethod - def __get_validators__(cls: Type["UploadFile"]) -> Iterable[Callable[..., Any]]: - yield cls.validate - - @classmethod - def validate(cls: Type["UploadFile"], v: Any) -> Any: - if not isinstance(v, StarletteUploadFile): - raise ValueError(f"Expected UploadFile, received: {type(v)}") - return v - - @classmethod - def _validate(cls, __input_value: Any, _: Any) -> "UploadFile": - if not isinstance(__input_value, StarletteUploadFile): - raise ValueError(f"Expected UploadFile, received: {type(__input_value)}") - return cast(UploadFile, __input_value) - - if not PYDANTIC_V2: - - @classmethod - def __modify_schema__(cls, field_schema: Dict[str, Any]) -> None: - field_schema.update({"type": "string", "format": "binary"}) - - @classmethod - def __get_pydantic_json_schema__( - cls, core_schema: CoreSchema, handler: GetJsonSchemaHandler - ) -> JsonSchemaValue: - return {"type": "string", "format": "binary"} - - @classmethod - def __get_pydantic_core_schema__( - cls, source: Type[Any], handler: Callable[[Any], CoreSchema] - ) -> CoreSchema: - return with_info_plain_validator_function(cls._validate) - - -class DefaultPlaceholder: - """ - You shouldn't use this class directly. - - It's used internally to recognize when a default value has been overwritten, even - if the overridden default value was truthy. - """ - - def __init__(self, value: Any): - self.value = value - - def __bool__(self) -> bool: - return bool(self.value) - - def __eq__(self, o: object) -> bool: - return isinstance(o, DefaultPlaceholder) and o.value == self.value - - -DefaultType = TypeVar("DefaultType") - - -def Default(value: DefaultType) -> DefaultType: - """ - You shouldn't use this function directly. - - It's used internally to recognize when a default value has been overwritten, even - if the overridden default value was truthy. - """ - return DefaultPlaceholder(value) # type: ignore diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__init__.py b/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 62bb9b3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/models.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/models.cpython-310.pyc deleted file mode 100644 index c05cadf..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/utils.cpython-310.pyc deleted file mode 100644 index 91a93f0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/__pycache__/utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/models.py b/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/models.py deleted file mode 100644 index 61ef006..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/models.py +++ /dev/null @@ -1,58 +0,0 @@ -from typing import Any, Callable, List, Optional, Sequence - -from fastapi._compat import ModelField -from fastapi.security.base import SecurityBase - - -class SecurityRequirement: - def __init__( - self, security_scheme: SecurityBase, scopes: Optional[Sequence[str]] = None - ): - self.security_scheme = security_scheme - self.scopes = scopes - - -class Dependant: - def __init__( - self, - *, - path_params: Optional[List[ModelField]] = None, - query_params: Optional[List[ModelField]] = None, - header_params: Optional[List[ModelField]] = None, - cookie_params: Optional[List[ModelField]] = None, - body_params: Optional[List[ModelField]] = None, - dependencies: Optional[List["Dependant"]] = None, - security_schemes: Optional[List[SecurityRequirement]] = None, - name: Optional[str] = None, - call: Optional[Callable[..., Any]] = None, - request_param_name: Optional[str] = None, - websocket_param_name: Optional[str] = None, - http_connection_param_name: Optional[str] = None, - response_param_name: Optional[str] = None, - background_tasks_param_name: Optional[str] = None, - security_scopes_param_name: Optional[str] = None, - security_scopes: Optional[List[str]] = None, - use_cache: bool = True, - path: Optional[str] = None, - ) -> None: - self.path_params = path_params or [] - self.query_params = query_params or [] - self.header_params = header_params or [] - self.cookie_params = cookie_params or [] - self.body_params = body_params or [] - self.dependencies = dependencies or [] - self.security_requirements = security_schemes or [] - self.request_param_name = request_param_name - self.websocket_param_name = websocket_param_name - self.http_connection_param_name = http_connection_param_name - self.response_param_name = response_param_name - self.background_tasks_param_name = background_tasks_param_name - self.security_scopes = security_scopes - self.security_scopes_param_name = security_scopes_param_name - self.name = name - self.call = call - self.use_cache = use_cache - # Store the path to be able to re-generate a dependable from it in overrides - self.path = path - # Save the cache key at creation to optimize performance - self.cache_key = (self.call, tuple(sorted(set(self.security_scopes or [])))) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py b/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py deleted file mode 100644 index 4f98417..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py +++ /dev/null @@ -1,818 +0,0 @@ -import inspect -from contextlib import AsyncExitStack, contextmanager -from copy import copy, deepcopy -from typing import ( - Any, - Callable, - Coroutine, - Dict, - ForwardRef, - List, - Mapping, - Optional, - Sequence, - Tuple, - Type, - Union, - cast, -) - -import anyio -from fastapi import params -from fastapi._compat import ( - PYDANTIC_V2, - ErrorWrapper, - ModelField, - Required, - Undefined, - _regenerate_error_with_loc, - copy_field_info, - create_body_model, - evaluate_forwardref, - field_annotation_is_scalar, - get_annotation_from_field_info, - get_missing_field_error, - is_bytes_field, - is_bytes_sequence_field, - is_scalar_field, - is_scalar_sequence_field, - is_sequence_field, - is_uploadfile_or_nonable_uploadfile_annotation, - is_uploadfile_sequence_annotation, - lenient_issubclass, - sequence_types, - serialize_sequence_value, - value_is_sequence, -) -from fastapi.background import BackgroundTasks -from fastapi.concurrency import ( - asynccontextmanager, - contextmanager_in_threadpool, -) -from fastapi.dependencies.models import Dependant, SecurityRequirement -from fastapi.logger import logger -from fastapi.security.base import SecurityBase -from fastapi.security.oauth2 import OAuth2, SecurityScopes -from fastapi.security.open_id_connect_url import OpenIdConnect -from fastapi.utils import create_response_field, get_path_param_names -from pydantic.fields import FieldInfo -from starlette.background import BackgroundTasks as StarletteBackgroundTasks -from starlette.concurrency import run_in_threadpool -from starlette.datastructures import FormData, Headers, QueryParams, UploadFile -from starlette.requests import HTTPConnection, Request -from starlette.responses import Response -from starlette.websockets import WebSocket -from typing_extensions import Annotated, get_args, get_origin - -multipart_not_installed_error = ( - 'Form data requires "python-multipart" to be installed. \n' - 'You can install "python-multipart" with: \n\n' - "pip install python-multipart\n" -) -multipart_incorrect_install_error = ( - 'Form data requires "python-multipart" to be installed. ' - 'It seems you installed "multipart" instead. \n' - 'You can remove "multipart" with: \n\n' - "pip uninstall multipart\n\n" - 'And then install "python-multipart" with: \n\n' - "pip install python-multipart\n" -) - - -def check_file_field(field: ModelField) -> None: - field_info = field.field_info - if isinstance(field_info, params.Form): - try: - # __version__ is available in both multiparts, and can be mocked - from multipart import __version__ # type: ignore - - assert __version__ - try: - # parse_options_header is only available in the right multipart - from multipart.multipart import parse_options_header # type: ignore - - assert parse_options_header - except ImportError: - logger.error(multipart_incorrect_install_error) - raise RuntimeError(multipart_incorrect_install_error) from None - except ImportError: - logger.error(multipart_not_installed_error) - raise RuntimeError(multipart_not_installed_error) from None - - -def get_param_sub_dependant( - *, - param_name: str, - depends: params.Depends, - path: str, - security_scopes: Optional[List[str]] = None, -) -> Dependant: - assert depends.dependency - return get_sub_dependant( - depends=depends, - dependency=depends.dependency, - path=path, - name=param_name, - security_scopes=security_scopes, - ) - - -def get_parameterless_sub_dependant(*, depends: params.Depends, path: str) -> Dependant: - assert callable( - depends.dependency - ), "A parameter-less dependency must have a callable dependency" - return get_sub_dependant(depends=depends, dependency=depends.dependency, path=path) - - -def get_sub_dependant( - *, - depends: params.Depends, - dependency: Callable[..., Any], - path: str, - name: Optional[str] = None, - security_scopes: Optional[List[str]] = None, -) -> Dependant: - security_requirement = None - security_scopes = security_scopes or [] - if isinstance(depends, params.Security): - dependency_scopes = depends.scopes - security_scopes.extend(dependency_scopes) - if isinstance(dependency, SecurityBase): - use_scopes: List[str] = [] - if isinstance(dependency, (OAuth2, OpenIdConnect)): - use_scopes = security_scopes - security_requirement = SecurityRequirement( - security_scheme=dependency, scopes=use_scopes - ) - sub_dependant = get_dependant( - path=path, - call=dependency, - name=name, - security_scopes=security_scopes, - use_cache=depends.use_cache, - ) - if security_requirement: - sub_dependant.security_requirements.append(security_requirement) - return sub_dependant - - -CacheKey = Tuple[Optional[Callable[..., Any]], Tuple[str, ...]] - - -def get_flat_dependant( - dependant: Dependant, - *, - skip_repeats: bool = False, - visited: Optional[List[CacheKey]] = None, -) -> Dependant: - if visited is None: - visited = [] - visited.append(dependant.cache_key) - - flat_dependant = Dependant( - path_params=dependant.path_params.copy(), - query_params=dependant.query_params.copy(), - header_params=dependant.header_params.copy(), - cookie_params=dependant.cookie_params.copy(), - body_params=dependant.body_params.copy(), - security_schemes=dependant.security_requirements.copy(), - use_cache=dependant.use_cache, - path=dependant.path, - ) - for sub_dependant in dependant.dependencies: - if skip_repeats and sub_dependant.cache_key in visited: - continue - flat_sub = get_flat_dependant( - sub_dependant, skip_repeats=skip_repeats, visited=visited - ) - flat_dependant.path_params.extend(flat_sub.path_params) - flat_dependant.query_params.extend(flat_sub.query_params) - flat_dependant.header_params.extend(flat_sub.header_params) - flat_dependant.cookie_params.extend(flat_sub.cookie_params) - flat_dependant.body_params.extend(flat_sub.body_params) - flat_dependant.security_requirements.extend(flat_sub.security_requirements) - return flat_dependant - - -def get_flat_params(dependant: Dependant) -> List[ModelField]: - flat_dependant = get_flat_dependant(dependant, skip_repeats=True) - return ( - flat_dependant.path_params - + flat_dependant.query_params - + flat_dependant.header_params - + flat_dependant.cookie_params - ) - - -def get_typed_signature(call: Callable[..., Any]) -> inspect.Signature: - signature = inspect.signature(call) - globalns = getattr(call, "__globals__", {}) - typed_params = [ - inspect.Parameter( - name=param.name, - kind=param.kind, - default=param.default, - annotation=get_typed_annotation(param.annotation, globalns), - ) - for param in signature.parameters.values() - ] - typed_signature = inspect.Signature(typed_params) - return typed_signature - - -def get_typed_annotation(annotation: Any, globalns: Dict[str, Any]) -> Any: - if isinstance(annotation, str): - annotation = ForwardRef(annotation) - annotation = evaluate_forwardref(annotation, globalns, globalns) - return annotation - - -def get_typed_return_annotation(call: Callable[..., Any]) -> Any: - signature = inspect.signature(call) - annotation = signature.return_annotation - - if annotation is inspect.Signature.empty: - return None - - globalns = getattr(call, "__globals__", {}) - return get_typed_annotation(annotation, globalns) - - -def get_dependant( - *, - path: str, - call: Callable[..., Any], - name: Optional[str] = None, - security_scopes: Optional[List[str]] = None, - use_cache: bool = True, -) -> Dependant: - path_param_names = get_path_param_names(path) - endpoint_signature = get_typed_signature(call) - signature_params = endpoint_signature.parameters - dependant = Dependant( - call=call, - name=name, - path=path, - security_scopes=security_scopes, - use_cache=use_cache, - ) - for param_name, param in signature_params.items(): - is_path_param = param_name in path_param_names - type_annotation, depends, param_field = analyze_param( - param_name=param_name, - annotation=param.annotation, - value=param.default, - is_path_param=is_path_param, - ) - if depends is not None: - sub_dependant = get_param_sub_dependant( - param_name=param_name, - depends=depends, - path=path, - security_scopes=security_scopes, - ) - dependant.dependencies.append(sub_dependant) - continue - if add_non_field_param_to_dependency( - param_name=param_name, - type_annotation=type_annotation, - dependant=dependant, - ): - assert ( - param_field is None - ), f"Cannot specify multiple FastAPI annotations for {param_name!r}" - continue - assert param_field is not None - if is_body_param(param_field=param_field, is_path_param=is_path_param): - dependant.body_params.append(param_field) - else: - add_param_to_fields(field=param_field, dependant=dependant) - return dependant - - -def add_non_field_param_to_dependency( - *, param_name: str, type_annotation: Any, dependant: Dependant -) -> Optional[bool]: - if lenient_issubclass(type_annotation, Request): - dependant.request_param_name = param_name - return True - elif lenient_issubclass(type_annotation, WebSocket): - dependant.websocket_param_name = param_name - return True - elif lenient_issubclass(type_annotation, HTTPConnection): - dependant.http_connection_param_name = param_name - return True - elif lenient_issubclass(type_annotation, Response): - dependant.response_param_name = param_name - return True - elif lenient_issubclass(type_annotation, StarletteBackgroundTasks): - dependant.background_tasks_param_name = param_name - return True - elif lenient_issubclass(type_annotation, SecurityScopes): - dependant.security_scopes_param_name = param_name - return True - return None - - -def analyze_param( - *, - param_name: str, - annotation: Any, - value: Any, - is_path_param: bool, -) -> Tuple[Any, Optional[params.Depends], Optional[ModelField]]: - field_info = None - depends = None - type_annotation: Any = Any - use_annotation: Any = Any - if annotation is not inspect.Signature.empty: - use_annotation = annotation - type_annotation = annotation - if get_origin(use_annotation) is Annotated: - annotated_args = get_args(annotation) - type_annotation = annotated_args[0] - fastapi_annotations = [ - arg - for arg in annotated_args[1:] - if isinstance(arg, (FieldInfo, params.Depends)) - ] - fastapi_specific_annotations = [ - arg - for arg in fastapi_annotations - if isinstance(arg, (params.Param, params.Body, params.Depends)) - ] - if fastapi_specific_annotations: - fastapi_annotation: Union[ - FieldInfo, params.Depends, None - ] = fastapi_specific_annotations[-1] - else: - fastapi_annotation = None - if isinstance(fastapi_annotation, FieldInfo): - # Copy `field_info` because we mutate `field_info.default` below. - field_info = copy_field_info( - field_info=fastapi_annotation, annotation=use_annotation - ) - assert field_info.default is Undefined or field_info.default is Required, ( - f"`{field_info.__class__.__name__}` default value cannot be set in" - f" `Annotated` for {param_name!r}. Set the default value with `=` instead." - ) - if value is not inspect.Signature.empty: - assert not is_path_param, "Path parameters cannot have default values" - field_info.default = value - else: - field_info.default = Required - elif isinstance(fastapi_annotation, params.Depends): - depends = fastapi_annotation - - if isinstance(value, params.Depends): - assert depends is None, ( - "Cannot specify `Depends` in `Annotated` and default value" - f" together for {param_name!r}" - ) - assert field_info is None, ( - "Cannot specify a FastAPI annotation in `Annotated` and `Depends` as a" - f" default value together for {param_name!r}" - ) - depends = value - elif isinstance(value, FieldInfo): - assert field_info is None, ( - "Cannot specify FastAPI annotations in `Annotated` and default value" - f" together for {param_name!r}" - ) - field_info = value - if PYDANTIC_V2: - field_info.annotation = type_annotation - - if depends is not None and depends.dependency is None: - # Copy `depends` before mutating it - depends = copy(depends) - depends.dependency = type_annotation - - if lenient_issubclass( - type_annotation, - ( - Request, - WebSocket, - HTTPConnection, - Response, - StarletteBackgroundTasks, - SecurityScopes, - ), - ): - assert depends is None, f"Cannot specify `Depends` for type {type_annotation!r}" - assert ( - field_info is None - ), f"Cannot specify FastAPI annotation for type {type_annotation!r}" - elif field_info is None and depends is None: - default_value = value if value is not inspect.Signature.empty else Required - if is_path_param: - # We might check here that `default_value is Required`, but the fact is that the same - # parameter might sometimes be a path parameter and sometimes not. See - # `tests/test_infer_param_optionality.py` for an example. - field_info = params.Path(annotation=use_annotation) - elif is_uploadfile_or_nonable_uploadfile_annotation( - type_annotation - ) or is_uploadfile_sequence_annotation(type_annotation): - field_info = params.File(annotation=use_annotation, default=default_value) - elif not field_annotation_is_scalar(annotation=type_annotation): - field_info = params.Body(annotation=use_annotation, default=default_value) - else: - field_info = params.Query(annotation=use_annotation, default=default_value) - - field = None - if field_info is not None: - if is_path_param: - assert isinstance(field_info, params.Path), ( - f"Cannot use `{field_info.__class__.__name__}` for path param" - f" {param_name!r}" - ) - elif ( - isinstance(field_info, params.Param) - and getattr(field_info, "in_", None) is None - ): - field_info.in_ = params.ParamTypes.query - use_annotation_from_field_info = get_annotation_from_field_info( - use_annotation, - field_info, - param_name, - ) - if not field_info.alias and getattr(field_info, "convert_underscores", None): - alias = param_name.replace("_", "-") - else: - alias = field_info.alias or param_name - field_info.alias = alias - field = create_response_field( - name=param_name, - type_=use_annotation_from_field_info, - default=field_info.default, - alias=alias, - required=field_info.default in (Required, Undefined), - field_info=field_info, - ) - - return type_annotation, depends, field - - -def is_body_param(*, param_field: ModelField, is_path_param: bool) -> bool: - if is_path_param: - assert is_scalar_field( - field=param_field - ), "Path params must be of one of the supported types" - return False - elif is_scalar_field(field=param_field): - return False - elif isinstance( - param_field.field_info, (params.Query, params.Header) - ) and is_scalar_sequence_field(param_field): - return False - else: - assert isinstance( - param_field.field_info, params.Body - ), f"Param: {param_field.name} can only be a request body, using Body()" - return True - - -def add_param_to_fields(*, field: ModelField, dependant: Dependant) -> None: - field_info = field.field_info - field_info_in = getattr(field_info, "in_", None) - if field_info_in == params.ParamTypes.path: - dependant.path_params.append(field) - elif field_info_in == params.ParamTypes.query: - dependant.query_params.append(field) - elif field_info_in == params.ParamTypes.header: - dependant.header_params.append(field) - else: - assert ( - field_info_in == params.ParamTypes.cookie - ), f"non-body parameters must be in path, query, header or cookie: {field.name}" - dependant.cookie_params.append(field) - - -def is_coroutine_callable(call: Callable[..., Any]) -> bool: - if inspect.isroutine(call): - return inspect.iscoroutinefunction(call) - if inspect.isclass(call): - return False - dunder_call = getattr(call, "__call__", None) # noqa: B004 - return inspect.iscoroutinefunction(dunder_call) - - -def is_async_gen_callable(call: Callable[..., Any]) -> bool: - if inspect.isasyncgenfunction(call): - return True - dunder_call = getattr(call, "__call__", None) # noqa: B004 - return inspect.isasyncgenfunction(dunder_call) - - -def is_gen_callable(call: Callable[..., Any]) -> bool: - if inspect.isgeneratorfunction(call): - return True - dunder_call = getattr(call, "__call__", None) # noqa: B004 - return inspect.isgeneratorfunction(dunder_call) - - -async def solve_generator( - *, call: Callable[..., Any], stack: AsyncExitStack, sub_values: Dict[str, Any] -) -> Any: - if is_gen_callable(call): - cm = contextmanager_in_threadpool(contextmanager(call)(**sub_values)) - elif is_async_gen_callable(call): - cm = asynccontextmanager(call)(**sub_values) - return await stack.enter_async_context(cm) - - -async def solve_dependencies( - *, - request: Union[Request, WebSocket], - dependant: Dependant, - body: Optional[Union[Dict[str, Any], FormData]] = None, - background_tasks: Optional[StarletteBackgroundTasks] = None, - response: Optional[Response] = None, - dependency_overrides_provider: Optional[Any] = None, - dependency_cache: Optional[Dict[Tuple[Callable[..., Any], Tuple[str]], Any]] = None, - async_exit_stack: AsyncExitStack, -) -> Tuple[ - Dict[str, Any], - List[Any], - Optional[StarletteBackgroundTasks], - Response, - Dict[Tuple[Callable[..., Any], Tuple[str]], Any], -]: - values: Dict[str, Any] = {} - errors: List[Any] = [] - if response is None: - response = Response() - del response.headers["content-length"] - response.status_code = None # type: ignore - dependency_cache = dependency_cache or {} - sub_dependant: Dependant - for sub_dependant in dependant.dependencies: - sub_dependant.call = cast(Callable[..., Any], sub_dependant.call) - sub_dependant.cache_key = cast( - Tuple[Callable[..., Any], Tuple[str]], sub_dependant.cache_key - ) - call = sub_dependant.call - use_sub_dependant = sub_dependant - if ( - dependency_overrides_provider - and dependency_overrides_provider.dependency_overrides - ): - original_call = sub_dependant.call - call = getattr( - dependency_overrides_provider, "dependency_overrides", {} - ).get(original_call, original_call) - use_path: str = sub_dependant.path # type: ignore - use_sub_dependant = get_dependant( - path=use_path, - call=call, - name=sub_dependant.name, - security_scopes=sub_dependant.security_scopes, - ) - - solved_result = await solve_dependencies( - request=request, - dependant=use_sub_dependant, - body=body, - background_tasks=background_tasks, - response=response, - dependency_overrides_provider=dependency_overrides_provider, - dependency_cache=dependency_cache, - async_exit_stack=async_exit_stack, - ) - ( - sub_values, - sub_errors, - background_tasks, - _, # the subdependency returns the same response we have - sub_dependency_cache, - ) = solved_result - dependency_cache.update(sub_dependency_cache) - if sub_errors: - errors.extend(sub_errors) - continue - if sub_dependant.use_cache and sub_dependant.cache_key in dependency_cache: - solved = dependency_cache[sub_dependant.cache_key] - elif is_gen_callable(call) or is_async_gen_callable(call): - solved = await solve_generator( - call=call, stack=async_exit_stack, sub_values=sub_values - ) - elif is_coroutine_callable(call): - solved = await call(**sub_values) - else: - solved = await run_in_threadpool(call, **sub_values) - if sub_dependant.name is not None: - values[sub_dependant.name] = solved - if sub_dependant.cache_key not in dependency_cache: - dependency_cache[sub_dependant.cache_key] = solved - path_values, path_errors = request_params_to_args( - dependant.path_params, request.path_params - ) - query_values, query_errors = request_params_to_args( - dependant.query_params, request.query_params - ) - header_values, header_errors = request_params_to_args( - dependant.header_params, request.headers - ) - cookie_values, cookie_errors = request_params_to_args( - dependant.cookie_params, request.cookies - ) - values.update(path_values) - values.update(query_values) - values.update(header_values) - values.update(cookie_values) - errors += path_errors + query_errors + header_errors + cookie_errors - if dependant.body_params: - ( - body_values, - body_errors, - ) = await request_body_to_args( # body_params checked above - required_params=dependant.body_params, received_body=body - ) - values.update(body_values) - errors.extend(body_errors) - if dependant.http_connection_param_name: - values[dependant.http_connection_param_name] = request - if dependant.request_param_name and isinstance(request, Request): - values[dependant.request_param_name] = request - elif dependant.websocket_param_name and isinstance(request, WebSocket): - values[dependant.websocket_param_name] = request - if dependant.background_tasks_param_name: - if background_tasks is None: - background_tasks = BackgroundTasks() - values[dependant.background_tasks_param_name] = background_tasks - if dependant.response_param_name: - values[dependant.response_param_name] = response - if dependant.security_scopes_param_name: - values[dependant.security_scopes_param_name] = SecurityScopes( - scopes=dependant.security_scopes - ) - return values, errors, background_tasks, response, dependency_cache - - -def request_params_to_args( - required_params: Sequence[ModelField], - received_params: Union[Mapping[str, Any], QueryParams, Headers], -) -> Tuple[Dict[str, Any], List[Any]]: - values = {} - errors = [] - for field in required_params: - if is_scalar_sequence_field(field) and isinstance( - received_params, (QueryParams, Headers) - ): - value = received_params.getlist(field.alias) or field.default - else: - value = received_params.get(field.alias) - field_info = field.field_info - assert isinstance( - field_info, params.Param - ), "Params must be subclasses of Param" - loc = (field_info.in_.value, field.alias) - if value is None: - if field.required: - errors.append(get_missing_field_error(loc=loc)) - else: - values[field.name] = deepcopy(field.default) - continue - v_, errors_ = field.validate(value, values, loc=loc) - if isinstance(errors_, ErrorWrapper): - errors.append(errors_) - elif isinstance(errors_, list): - new_errors = _regenerate_error_with_loc(errors=errors_, loc_prefix=()) - errors.extend(new_errors) - else: - values[field.name] = v_ - return values, errors - - -async def request_body_to_args( - required_params: List[ModelField], - received_body: Optional[Union[Dict[str, Any], FormData]], -) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: - values = {} - errors: List[Dict[str, Any]] = [] - if required_params: - field = required_params[0] - field_info = field.field_info - embed = getattr(field_info, "embed", None) - field_alias_omitted = len(required_params) == 1 and not embed - if field_alias_omitted: - received_body = {field.alias: received_body} - - for field in required_params: - loc: Tuple[str, ...] - if field_alias_omitted: - loc = ("body",) - else: - loc = ("body", field.alias) - - value: Optional[Any] = None - if received_body is not None: - if (is_sequence_field(field)) and isinstance(received_body, FormData): - value = received_body.getlist(field.alias) - else: - try: - value = received_body.get(field.alias) - except AttributeError: - errors.append(get_missing_field_error(loc)) - continue - if ( - value is None - or (isinstance(field_info, params.Form) and value == "") - or ( - isinstance(field_info, params.Form) - and is_sequence_field(field) - and len(value) == 0 - ) - ): - if field.required: - errors.append(get_missing_field_error(loc)) - else: - values[field.name] = deepcopy(field.default) - continue - if ( - isinstance(field_info, params.File) - and is_bytes_field(field) - and isinstance(value, UploadFile) - ): - value = await value.read() - elif ( - is_bytes_sequence_field(field) - and isinstance(field_info, params.File) - and value_is_sequence(value) - ): - # For types - assert isinstance(value, sequence_types) # type: ignore[arg-type] - results: List[Union[bytes, str]] = [] - - async def process_fn( - fn: Callable[[], Coroutine[Any, Any, Any]], - ) -> None: - result = await fn() - results.append(result) # noqa: B023 - - async with anyio.create_task_group() as tg: - for sub_value in value: - tg.start_soon(process_fn, sub_value.read) - value = serialize_sequence_value(field=field, value=results) - - v_, errors_ = field.validate(value, values, loc=loc) - - if isinstance(errors_, list): - errors.extend(errors_) - elif errors_: - errors.append(errors_) - else: - values[field.name] = v_ - return values, errors - - -def get_body_field(*, dependant: Dependant, name: str) -> Optional[ModelField]: - flat_dependant = get_flat_dependant(dependant) - if not flat_dependant.body_params: - return None - first_param = flat_dependant.body_params[0] - field_info = first_param.field_info - embed = getattr(field_info, "embed", None) - body_param_names_set = {param.name for param in flat_dependant.body_params} - if len(body_param_names_set) == 1 and not embed: - check_file_field(first_param) - return first_param - # If one field requires to embed, all have to be embedded - # in case a sub-dependency is evaluated with a single unique body field - # That is combined (embedded) with other body fields - for param in flat_dependant.body_params: - setattr(param.field_info, "embed", True) # noqa: B010 - model_name = "Body_" + name - BodyModel = create_body_model( - fields=flat_dependant.body_params, model_name=model_name - ) - required = any(True for f in flat_dependant.body_params if f.required) - BodyFieldInfo_kwargs: Dict[str, Any] = { - "annotation": BodyModel, - "alias": "body", - } - if not required: - BodyFieldInfo_kwargs["default"] = None - if any(isinstance(f.field_info, params.File) for f in flat_dependant.body_params): - BodyFieldInfo: Type[params.Body] = params.File - elif any(isinstance(f.field_info, params.Form) for f in flat_dependant.body_params): - BodyFieldInfo = params.Form - else: - BodyFieldInfo = params.Body - - body_param_media_types = [ - f.field_info.media_type - for f in flat_dependant.body_params - if isinstance(f.field_info, params.Body) - ] - if len(set(body_param_media_types)) == 1: - BodyFieldInfo_kwargs["media_type"] = body_param_media_types[0] - final_field = create_response_field( - name="body", - type_=BodyModel, - required=required, - alias="body", - field_info=BodyFieldInfo(**BodyFieldInfo_kwargs), - ) - check_file_field(final_field) - return final_field diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/encoders.py b/write-message/venv/lib/python3.10/site-packages/fastapi/encoders.py deleted file mode 100644 index 451ea07..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/encoders.py +++ /dev/null @@ -1,343 +0,0 @@ -import dataclasses -import datetime -from collections import defaultdict, deque -from decimal import Decimal -from enum import Enum -from ipaddress import ( - IPv4Address, - IPv4Interface, - IPv4Network, - IPv6Address, - IPv6Interface, - IPv6Network, -) -from pathlib import Path, PurePath -from re import Pattern -from types import GeneratorType -from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union -from uuid import UUID - -from fastapi.types import IncEx -from pydantic import BaseModel -from pydantic.color import Color -from pydantic.networks import AnyUrl, NameEmail -from pydantic.types import SecretBytes, SecretStr -from typing_extensions import Annotated, Doc - -from ._compat import PYDANTIC_V2, UndefinedType, Url, _model_dump - - -# Taken from Pydantic v1 as is -def isoformat(o: Union[datetime.date, datetime.time]) -> str: - return o.isoformat() - - -# Taken from Pydantic v1 as is -# TODO: pv2 should this return strings instead? -def decimal_encoder(dec_value: Decimal) -> Union[int, float]: - """ - Encodes a Decimal as int of there's no exponent, otherwise float - - This is useful when we use ConstrainedDecimal to represent Numeric(x,0) - where a integer (but not int typed) is used. Encoding this as a float - results in failed round-tripping between encode and parse. - Our Id type is a prime example of this. - - >>> decimal_encoder(Decimal("1.0")) - 1.0 - - >>> decimal_encoder(Decimal("1")) - 1 - """ - if dec_value.as_tuple().exponent >= 0: # type: ignore[operator] - return int(dec_value) - else: - return float(dec_value) - - -ENCODERS_BY_TYPE: Dict[Type[Any], Callable[[Any], Any]] = { - bytes: lambda o: o.decode(), - Color: str, - datetime.date: isoformat, - datetime.datetime: isoformat, - datetime.time: isoformat, - datetime.timedelta: lambda td: td.total_seconds(), - Decimal: decimal_encoder, - Enum: lambda o: o.value, - frozenset: list, - deque: list, - GeneratorType: list, - IPv4Address: str, - IPv4Interface: str, - IPv4Network: str, - IPv6Address: str, - IPv6Interface: str, - IPv6Network: str, - NameEmail: str, - Path: str, - Pattern: lambda o: o.pattern, - SecretBytes: str, - SecretStr: str, - set: list, - UUID: str, - Url: str, - AnyUrl: str, -} - - -def generate_encoders_by_class_tuples( - type_encoder_map: Dict[Any, Callable[[Any], Any]], -) -> Dict[Callable[[Any], Any], Tuple[Any, ...]]: - encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict( - tuple - ) - for type_, encoder in type_encoder_map.items(): - encoders_by_class_tuples[encoder] += (type_,) - return encoders_by_class_tuples - - -encoders_by_class_tuples = generate_encoders_by_class_tuples(ENCODERS_BY_TYPE) - - -def jsonable_encoder( - obj: Annotated[ - Any, - Doc( - """ - The input object to convert to JSON. - """ - ), - ], - include: Annotated[ - Optional[IncEx], - Doc( - """ - Pydantic's `include` parameter, passed to Pydantic models to set the - fields to include. - """ - ), - ] = None, - exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Pydantic's `exclude` parameter, passed to Pydantic models to set the - fields to exclude. - """ - ), - ] = None, - by_alias: Annotated[ - bool, - Doc( - """ - Pydantic's `by_alias` parameter, passed to Pydantic models to define if - the output should use the alias names (when provided) or the Python - attribute names. In an API, if you set an alias, it's probably because you - want to use it in the result, so you probably want to leave this set to - `True`. - """ - ), - ] = True, - exclude_unset: Annotated[ - bool, - Doc( - """ - Pydantic's `exclude_unset` parameter, passed to Pydantic models to define - if it should exclude from the output the fields that were not explicitly - set (and that only had their default values). - """ - ), - ] = False, - exclude_defaults: Annotated[ - bool, - Doc( - """ - Pydantic's `exclude_defaults` parameter, passed to Pydantic models to define - if it should exclude from the output the fields that had the same default - value, even when they were explicitly set. - """ - ), - ] = False, - exclude_none: Annotated[ - bool, - Doc( - """ - Pydantic's `exclude_none` parameter, passed to Pydantic models to define - if it should exclude from the output any fields that have a `None` value. - """ - ), - ] = False, - custom_encoder: Annotated[ - Optional[Dict[Any, Callable[[Any], Any]]], - Doc( - """ - Pydantic's `custom_encoder` parameter, passed to Pydantic models to define - a custom encoder. - """ - ), - ] = None, - sqlalchemy_safe: Annotated[ - bool, - Doc( - """ - Exclude from the output any fields that start with the name `_sa`. - - This is mainly a hack for compatibility with SQLAlchemy objects, they - store internal SQLAlchemy-specific state in attributes named with `_sa`, - and those objects can't (and shouldn't be) serialized to JSON. - """ - ), - ] = True, -) -> Any: - """ - Convert any object to something that can be encoded in JSON. - - This is used internally by FastAPI to make sure anything you return can be - encoded as JSON before it is sent to the client. - - You can also use it yourself, for example to convert objects before saving them - in a database that supports only JSON. - - Read more about it in the - [FastAPI docs for JSON Compatible Encoder](https://fastapi.tiangolo.com/tutorial/encoder/). - """ - custom_encoder = custom_encoder or {} - if custom_encoder: - if type(obj) in custom_encoder: - return custom_encoder[type(obj)](obj) - else: - for encoder_type, encoder_instance in custom_encoder.items(): - if isinstance(obj, encoder_type): - return encoder_instance(obj) - if include is not None and not isinstance(include, (set, dict)): - include = set(include) - if exclude is not None and not isinstance(exclude, (set, dict)): - exclude = set(exclude) - if isinstance(obj, BaseModel): - # TODO: remove when deprecating Pydantic v1 - encoders: Dict[Any, Any] = {} - if not PYDANTIC_V2: - encoders = getattr(obj.__config__, "json_encoders", {}) # type: ignore[attr-defined] - if custom_encoder: - encoders.update(custom_encoder) - obj_dict = _model_dump( - obj, - mode="json", - include=include, - exclude=exclude, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_none=exclude_none, - exclude_defaults=exclude_defaults, - ) - if "__root__" in obj_dict: - obj_dict = obj_dict["__root__"] - return jsonable_encoder( - obj_dict, - exclude_none=exclude_none, - exclude_defaults=exclude_defaults, - # TODO: remove when deprecating Pydantic v1 - custom_encoder=encoders, - sqlalchemy_safe=sqlalchemy_safe, - ) - if dataclasses.is_dataclass(obj): - obj_dict = dataclasses.asdict(obj) - return jsonable_encoder( - obj_dict, - include=include, - exclude=exclude, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - custom_encoder=custom_encoder, - sqlalchemy_safe=sqlalchemy_safe, - ) - if isinstance(obj, Enum): - return obj.value - if isinstance(obj, PurePath): - return str(obj) - if isinstance(obj, (str, int, float, type(None))): - return obj - if isinstance(obj, UndefinedType): - return None - if isinstance(obj, dict): - encoded_dict = {} - allowed_keys = set(obj.keys()) - if include is not None: - allowed_keys &= set(include) - if exclude is not None: - allowed_keys -= set(exclude) - for key, value in obj.items(): - if ( - ( - not sqlalchemy_safe - or (not isinstance(key, str)) - or (not key.startswith("_sa")) - ) - and (value is not None or not exclude_none) - and key in allowed_keys - ): - encoded_key = jsonable_encoder( - key, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_none=exclude_none, - custom_encoder=custom_encoder, - sqlalchemy_safe=sqlalchemy_safe, - ) - encoded_value = jsonable_encoder( - value, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_none=exclude_none, - custom_encoder=custom_encoder, - sqlalchemy_safe=sqlalchemy_safe, - ) - encoded_dict[encoded_key] = encoded_value - return encoded_dict - if isinstance(obj, (list, set, frozenset, GeneratorType, tuple, deque)): - encoded_list = [] - for item in obj: - encoded_list.append( - jsonable_encoder( - item, - include=include, - exclude=exclude, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - custom_encoder=custom_encoder, - sqlalchemy_safe=sqlalchemy_safe, - ) - ) - return encoded_list - - if type(obj) in ENCODERS_BY_TYPE: - return ENCODERS_BY_TYPE[type(obj)](obj) - for encoder, classes_tuple in encoders_by_class_tuples.items(): - if isinstance(obj, classes_tuple): - return encoder(obj) - - try: - data = dict(obj) - except Exception as e: - errors: List[Exception] = [] - errors.append(e) - try: - data = vars(obj) - except Exception as e: - errors.append(e) - raise ValueError(errors) from e - return jsonable_encoder( - data, - include=include, - exclude=exclude, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - custom_encoder=custom_encoder, - sqlalchemy_safe=sqlalchemy_safe, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/exception_handlers.py b/write-message/venv/lib/python3.10/site-packages/fastapi/exception_handlers.py deleted file mode 100644 index 6c2ba7f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/exception_handlers.py +++ /dev/null @@ -1,34 +0,0 @@ -from fastapi.encoders import jsonable_encoder -from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError -from fastapi.utils import is_body_allowed_for_status_code -from fastapi.websockets import WebSocket -from starlette.exceptions import HTTPException -from starlette.requests import Request -from starlette.responses import JSONResponse, Response -from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY, WS_1008_POLICY_VIOLATION - - -async def http_exception_handler(request: Request, exc: HTTPException) -> Response: - headers = getattr(exc, "headers", None) - if not is_body_allowed_for_status_code(exc.status_code): - return Response(status_code=exc.status_code, headers=headers) - return JSONResponse( - {"detail": exc.detail}, status_code=exc.status_code, headers=headers - ) - - -async def request_validation_exception_handler( - request: Request, exc: RequestValidationError -) -> JSONResponse: - return JSONResponse( - status_code=HTTP_422_UNPROCESSABLE_ENTITY, - content={"detail": jsonable_encoder(exc.errors())}, - ) - - -async def websocket_request_validation_exception_handler( - websocket: WebSocket, exc: WebSocketRequestValidationError -) -> None: - await websocket.close( - code=WS_1008_POLICY_VIOLATION, reason=jsonable_encoder(exc.errors()) - ) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/exceptions.py b/write-message/venv/lib/python3.10/site-packages/fastapi/exceptions.py deleted file mode 100644 index 44d4ada..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/exceptions.py +++ /dev/null @@ -1,176 +0,0 @@ -from typing import Any, Dict, Optional, Sequence, Type, Union - -from pydantic import BaseModel, create_model -from starlette.exceptions import HTTPException as StarletteHTTPException -from starlette.exceptions import WebSocketException as StarletteWebSocketException -from typing_extensions import Annotated, Doc - - -class HTTPException(StarletteHTTPException): - """ - An HTTP exception you can raise in your own code to show errors to the client. - - This is for client errors, invalid authentication, invalid data, etc. Not for server - errors in your code. - - Read more about it in the - [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/). - - ## Example - - ```python - from fastapi import FastAPI, HTTPException - - app = FastAPI() - - items = {"foo": "The Foo Wrestlers"} - - - @app.get("/items/{item_id}") - async def read_item(item_id: str): - if item_id not in items: - raise HTTPException(status_code=404, detail="Item not found") - return {"item": items[item_id]} - ``` - """ - - def __init__( - self, - status_code: Annotated[ - int, - Doc( - """ - HTTP status code to send to the client. - """ - ), - ], - detail: Annotated[ - Any, - Doc( - """ - Any data to be sent to the client in the `detail` key of the JSON - response. - """ - ), - ] = None, - headers: Annotated[ - Optional[Dict[str, str]], - Doc( - """ - Any headers to send to the client in the response. - """ - ), - ] = None, - ) -> None: - super().__init__(status_code=status_code, detail=detail, headers=headers) - - -class WebSocketException(StarletteWebSocketException): - """ - A WebSocket exception you can raise in your own code to show errors to the client. - - This is for client errors, invalid authentication, invalid data, etc. Not for server - errors in your code. - - Read more about it in the - [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/). - - ## Example - - ```python - from typing import Annotated - - from fastapi import ( - Cookie, - FastAPI, - WebSocket, - WebSocketException, - status, - ) - - app = FastAPI() - - @app.websocket("/items/{item_id}/ws") - async def websocket_endpoint( - *, - websocket: WebSocket, - session: Annotated[str | None, Cookie()] = None, - item_id: str, - ): - if session is None: - raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION) - await websocket.accept() - while True: - data = await websocket.receive_text() - await websocket.send_text(f"Session cookie is: {session}") - await websocket.send_text(f"Message text was: {data}, for item ID: {item_id}") - ``` - """ - - def __init__( - self, - code: Annotated[ - int, - Doc( - """ - A closing code from the - [valid codes defined in the specification](https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1). - """ - ), - ], - reason: Annotated[ - Union[str, None], - Doc( - """ - The reason to close the WebSocket connection. - - It is UTF-8-encoded data. The interpretation of the reason is up to the - application, it is not specified by the WebSocket specification. - - It could contain text that could be human-readable or interpretable - by the client code, etc. - """ - ), - ] = None, - ) -> None: - super().__init__(code=code, reason=reason) - - -RequestErrorModel: Type[BaseModel] = create_model("Request") -WebSocketErrorModel: Type[BaseModel] = create_model("WebSocket") - - -class FastAPIError(RuntimeError): - """ - A generic, FastAPI-specific error. - """ - - -class ValidationException(Exception): - def __init__(self, errors: Sequence[Any]) -> None: - self._errors = errors - - def errors(self) -> Sequence[Any]: - return self._errors - - -class RequestValidationError(ValidationException): - def __init__(self, errors: Sequence[Any], *, body: Any = None) -> None: - super().__init__(errors) - self.body = body - - -class WebSocketRequestValidationError(ValidationException): - pass - - -class ResponseValidationError(ValidationException): - def __init__(self, errors: Sequence[Any], *, body: Any = None) -> None: - super().__init__(errors) - self.body = body - - def __str__(self) -> str: - message = f"{len(self._errors)} validation errors:\n" - for err in self._errors: - message += f" {err}\n" - return message diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/logger.py b/write-message/venv/lib/python3.10/site-packages/fastapi/logger.py deleted file mode 100644 index 5b2c4ad..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/logger.py +++ /dev/null @@ -1,3 +0,0 @@ -import logging - -logger = logging.getLogger("fastapi") diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__init__.py b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__init__.py deleted file mode 100644 index 620296d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.middleware import Middleware as Middleware diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 3de9a2c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/cors.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/cors.cpython-310.pyc deleted file mode 100644 index b33d4cd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/cors.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/gzip.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/gzip.cpython-310.pyc deleted file mode 100644 index a92e1dc..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/gzip.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/httpsredirect.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/httpsredirect.cpython-310.pyc deleted file mode 100644 index 978a017..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/httpsredirect.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/trustedhost.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/trustedhost.cpython-310.pyc deleted file mode 100644 index 3284600..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/trustedhost.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/wsgi.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/wsgi.cpython-310.pyc deleted file mode 100644 index d41a0e8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/__pycache__/wsgi.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/cors.py b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/cors.py deleted file mode 100644 index 8dfaad0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/cors.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.middleware.cors import CORSMiddleware as CORSMiddleware # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/gzip.py b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/gzip.py deleted file mode 100644 index bbeb2cc..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/gzip.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.middleware.gzip import GZipMiddleware as GZipMiddleware # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/httpsredirect.py b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/httpsredirect.py deleted file mode 100644 index b7a3d8e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/httpsredirect.py +++ /dev/null @@ -1,3 +0,0 @@ -from starlette.middleware.httpsredirect import ( # noqa - HTTPSRedirectMiddleware as HTTPSRedirectMiddleware, -) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/trustedhost.py b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/trustedhost.py deleted file mode 100644 index 08d7e03..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/trustedhost.py +++ /dev/null @@ -1,3 +0,0 @@ -from starlette.middleware.trustedhost import ( # noqa - TrustedHostMiddleware as TrustedHostMiddleware, -) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/wsgi.py b/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/wsgi.py deleted file mode 100644 index c4c6a79..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/middleware/wsgi.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.middleware.wsgi import WSGIMiddleware as WSGIMiddleware # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__init__.py b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 852f89f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/constants.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/constants.cpython-310.pyc deleted file mode 100644 index 1d5976c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/constants.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/docs.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/docs.cpython-310.pyc deleted file mode 100644 index 09bb13d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/docs.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/models.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/models.cpython-310.pyc deleted file mode 100644 index 2feb048..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/utils.cpython-310.pyc deleted file mode 100644 index 8541881..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/__pycache__/utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/constants.py b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/constants.py deleted file mode 100644 index d724ee3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/constants.py +++ /dev/null @@ -1,3 +0,0 @@ -METHODS_WITH_BODY = {"GET", "HEAD", "POST", "PUT", "DELETE", "PATCH"} -REF_PREFIX = "#/components/schemas/" -REF_TEMPLATE = "#/components/schemas/{model}" diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/docs.py b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/docs.py deleted file mode 100644 index 67815e0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/docs.py +++ /dev/null @@ -1,344 +0,0 @@ -import json -from typing import Any, Dict, Optional - -from fastapi.encoders import jsonable_encoder -from starlette.responses import HTMLResponse -from typing_extensions import Annotated, Doc - -swagger_ui_default_parameters: Annotated[ - Dict[str, Any], - Doc( - """ - Default configurations for Swagger UI. - - You can use it as a template to add any other configurations needed. - """ - ), -] = { - "dom_id": "#swagger-ui", - "layout": "BaseLayout", - "deepLinking": True, - "showExtensions": True, - "showCommonExtensions": True, -} - - -def get_swagger_ui_html( - *, - openapi_url: Annotated[ - str, - Doc( - """ - The OpenAPI URL that Swagger UI should load and use. - - This is normally done automatically by FastAPI using the default URL - `/openapi.json`. - """ - ), - ], - title: Annotated[ - str, - Doc( - """ - The HTML `` content, normally shown in the browser tab. - """ - ), - ], - swagger_js_url: Annotated[ - str, - Doc( - """ - The URL to use to load the Swagger UI JavaScript. - - It is normally set to a CDN URL. - """ - ), - ] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui-bundle.js", - swagger_css_url: Annotated[ - str, - Doc( - """ - The URL to use to load the Swagger UI CSS. - - It is normally set to a CDN URL. - """ - ), - ] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui.css", - swagger_favicon_url: Annotated[ - str, - Doc( - """ - The URL of the favicon to use. It is normally shown in the browser tab. - """ - ), - ] = "https://fastapi.tiangolo.com/img/favicon.png", - oauth2_redirect_url: Annotated[ - Optional[str], - Doc( - """ - The OAuth2 redirect URL, it is normally automatically handled by FastAPI. - """ - ), - ] = None, - init_oauth: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - A dictionary with Swagger UI OAuth2 initialization configurations. - """ - ), - ] = None, - swagger_ui_parameters: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Configuration parameters for Swagger UI. - - It defaults to [swagger_ui_default_parameters][fastapi.openapi.docs.swagger_ui_default_parameters]. - """ - ), - ] = None, -) -> HTMLResponse: - """ - Generate and return the HTML that loads Swagger UI for the interactive - API docs (normally served at `/docs`). - - You would only call this function yourself if you needed to override some parts, - for example the URLs to use to load Swagger UI's JavaScript and CSS. - - Read more about it in the - [FastAPI docs for Configure Swagger UI](https://fastapi.tiangolo.com/how-to/configure-swagger-ui/) - and the [FastAPI docs for Custom Docs UI Static Assets (Self-Hosting)](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/). - """ - current_swagger_ui_parameters = swagger_ui_default_parameters.copy() - if swagger_ui_parameters: - current_swagger_ui_parameters.update(swagger_ui_parameters) - - html = f""" - <!DOCTYPE html> - <html> - <head> - <link type="text/css" rel="stylesheet" href="{swagger_css_url}"> - <link rel="shortcut icon" href="{swagger_favicon_url}"> - <title>{title} - - -
-
- - - - - - """ - return HTMLResponse(html) - - -def get_redoc_html( - *, - openapi_url: Annotated[ - str, - Doc( - """ - The OpenAPI URL that ReDoc should load and use. - - This is normally done automatically by FastAPI using the default URL - `/openapi.json`. - """ - ), - ], - title: Annotated[ - str, - Doc( - """ - The HTML `` content, normally shown in the browser tab. - """ - ), - ], - redoc_js_url: Annotated[ - str, - Doc( - """ - The URL to use to load the ReDoc JavaScript. - - It is normally set to a CDN URL. - """ - ), - ] = "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js", - redoc_favicon_url: Annotated[ - str, - Doc( - """ - The URL of the favicon to use. It is normally shown in the browser tab. - """ - ), - ] = "https://fastapi.tiangolo.com/img/favicon.png", - with_google_fonts: Annotated[ - bool, - Doc( - """ - Load and use Google Fonts. - """ - ), - ] = True, -) -> HTMLResponse: - """ - Generate and return the HTML response that loads ReDoc for the alternative - API docs (normally served at `/redoc`). - - You would only call this function yourself if you needed to override some parts, - for example the URLs to use to load ReDoc's JavaScript and CSS. - - Read more about it in the - [FastAPI docs for Custom Docs UI Static Assets (Self-Hosting)](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/). - """ - html = f""" - <!DOCTYPE html> - <html> - <head> - <title>{title} - - - - """ - if with_google_fonts: - html += """ - - """ - html += f""" - - - - - - - - - - - """ - return HTMLResponse(html) - - -def get_swagger_ui_oauth2_redirect_html() -> HTMLResponse: - """ - Generate the HTML response with the OAuth2 redirection for Swagger UI. - - You normally don't need to use or change this. - """ - # copied from https://github.com/swagger-api/swagger-ui/blob/v4.14.0/dist/oauth2-redirect.html - html = """ - - - - Swagger UI: OAuth2 Redirect - - - - - - """ - return HTMLResponse(content=html) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/models.py b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/models.py deleted file mode 100644 index ed07b40..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/models.py +++ /dev/null @@ -1,445 +0,0 @@ -from enum import Enum -from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Type, Union - -from fastapi._compat import ( - PYDANTIC_V2, - CoreSchema, - GetJsonSchemaHandler, - JsonSchemaValue, - _model_rebuild, - with_info_plain_validator_function, -) -from fastapi.logger import logger -from pydantic import AnyUrl, BaseModel, Field -from typing_extensions import Annotated, Literal, TypedDict -from typing_extensions import deprecated as typing_deprecated - -try: - import email_validator - - assert email_validator # make autoflake ignore the unused import - from pydantic import EmailStr -except ImportError: # pragma: no cover - - class EmailStr(str): # type: ignore - @classmethod - def __get_validators__(cls) -> Iterable[Callable[..., Any]]: - yield cls.validate - - @classmethod - def validate(cls, v: Any) -> str: - logger.warning( - "email-validator not installed, email fields will be treated as str.\n" - "To install, run: pip install email-validator" - ) - return str(v) - - @classmethod - def _validate(cls, __input_value: Any, _: Any) -> str: - logger.warning( - "email-validator not installed, email fields will be treated as str.\n" - "To install, run: pip install email-validator" - ) - return str(__input_value) - - @classmethod - def __get_pydantic_json_schema__( - cls, core_schema: CoreSchema, handler: GetJsonSchemaHandler - ) -> JsonSchemaValue: - return {"type": "string", "format": "email"} - - @classmethod - def __get_pydantic_core_schema__( - cls, source: Type[Any], handler: Callable[[Any], CoreSchema] - ) -> CoreSchema: - return with_info_plain_validator_function(cls._validate) - - -class BaseModelWithConfig(BaseModel): - if PYDANTIC_V2: - model_config = {"extra": "allow"} - - else: - - class Config: - extra = "allow" - - -class Contact(BaseModelWithConfig): - name: Optional[str] = None - url: Optional[AnyUrl] = None - email: Optional[EmailStr] = None - - -class License(BaseModelWithConfig): - name: str - identifier: Optional[str] = None - url: Optional[AnyUrl] = None - - -class Info(BaseModelWithConfig): - title: str - summary: Optional[str] = None - description: Optional[str] = None - termsOfService: Optional[str] = None - contact: Optional[Contact] = None - license: Optional[License] = None - version: str - - -class ServerVariable(BaseModelWithConfig): - enum: Annotated[Optional[List[str]], Field(min_length=1)] = None - default: str - description: Optional[str] = None - - -class Server(BaseModelWithConfig): - url: Union[AnyUrl, str] - description: Optional[str] = None - variables: Optional[Dict[str, ServerVariable]] = None - - -class Reference(BaseModel): - ref: str = Field(alias="$ref") - - -class Discriminator(BaseModel): - propertyName: str - mapping: Optional[Dict[str, str]] = None - - -class XML(BaseModelWithConfig): - name: Optional[str] = None - namespace: Optional[str] = None - prefix: Optional[str] = None - attribute: Optional[bool] = None - wrapped: Optional[bool] = None - - -class ExternalDocumentation(BaseModelWithConfig): - description: Optional[str] = None - url: AnyUrl - - -class Schema(BaseModelWithConfig): - # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-the-json-schema-core-vocabu - # Core Vocabulary - schema_: Optional[str] = Field(default=None, alias="$schema") - vocabulary: Optional[str] = Field(default=None, alias="$vocabulary") - id: Optional[str] = Field(default=None, alias="$id") - anchor: Optional[str] = Field(default=None, alias="$anchor") - dynamicAnchor: Optional[str] = Field(default=None, alias="$dynamicAnchor") - ref: Optional[str] = Field(default=None, alias="$ref") - dynamicRef: Optional[str] = Field(default=None, alias="$dynamicRef") - defs: Optional[Dict[str, "SchemaOrBool"]] = Field(default=None, alias="$defs") - comment: Optional[str] = Field(default=None, alias="$comment") - # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-a-vocabulary-for-applying-s - # A Vocabulary for Applying Subschemas - allOf: Optional[List["SchemaOrBool"]] = None - anyOf: Optional[List["SchemaOrBool"]] = None - oneOf: Optional[List["SchemaOrBool"]] = None - not_: Optional["SchemaOrBool"] = Field(default=None, alias="not") - if_: Optional["SchemaOrBool"] = Field(default=None, alias="if") - then: Optional["SchemaOrBool"] = None - else_: Optional["SchemaOrBool"] = Field(default=None, alias="else") - dependentSchemas: Optional[Dict[str, "SchemaOrBool"]] = None - prefixItems: Optional[List["SchemaOrBool"]] = None - # TODO: uncomment and remove below when deprecating Pydantic v1 - # It generales a list of schemas for tuples, before prefixItems was available - # items: Optional["SchemaOrBool"] = None - items: Optional[Union["SchemaOrBool", List["SchemaOrBool"]]] = None - contains: Optional["SchemaOrBool"] = None - properties: Optional[Dict[str, "SchemaOrBool"]] = None - patternProperties: Optional[Dict[str, "SchemaOrBool"]] = None - additionalProperties: Optional["SchemaOrBool"] = None - propertyNames: Optional["SchemaOrBool"] = None - unevaluatedItems: Optional["SchemaOrBool"] = None - unevaluatedProperties: Optional["SchemaOrBool"] = None - # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-structural - # A Vocabulary for Structural Validation - type: Optional[str] = None - enum: Optional[List[Any]] = None - const: Optional[Any] = None - multipleOf: Optional[float] = Field(default=None, gt=0) - maximum: Optional[float] = None - exclusiveMaximum: Optional[float] = None - minimum: Optional[float] = None - exclusiveMinimum: Optional[float] = None - maxLength: Optional[int] = Field(default=None, ge=0) - minLength: Optional[int] = Field(default=None, ge=0) - pattern: Optional[str] = None - maxItems: Optional[int] = Field(default=None, ge=0) - minItems: Optional[int] = Field(default=None, ge=0) - uniqueItems: Optional[bool] = None - maxContains: Optional[int] = Field(default=None, ge=0) - minContains: Optional[int] = Field(default=None, ge=0) - maxProperties: Optional[int] = Field(default=None, ge=0) - minProperties: Optional[int] = Field(default=None, ge=0) - required: Optional[List[str]] = None - dependentRequired: Optional[Dict[str, Set[str]]] = None - # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-vocabularies-for-semantic-c - # Vocabularies for Semantic Content With "format" - format: Optional[str] = None - # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-the-conten - # A Vocabulary for the Contents of String-Encoded Data - contentEncoding: Optional[str] = None - contentMediaType: Optional[str] = None - contentSchema: Optional["SchemaOrBool"] = None - # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-basic-meta - # A Vocabulary for Basic Meta-Data Annotations - title: Optional[str] = None - description: Optional[str] = None - default: Optional[Any] = None - deprecated: Optional[bool] = None - readOnly: Optional[bool] = None - writeOnly: Optional[bool] = None - examples: Optional[List[Any]] = None - # Ref: OpenAPI 3.1.0: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object - # Schema Object - discriminator: Optional[Discriminator] = None - xml: Optional[XML] = None - externalDocs: Optional[ExternalDocumentation] = None - example: Annotated[ - Optional[Any], - typing_deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = None - - -# Ref: https://json-schema.org/draft/2020-12/json-schema-core.html#name-json-schema-documents -# A JSON Schema MUST be an object or a boolean. -SchemaOrBool = Union[Schema, bool] - - -class Example(TypedDict, total=False): - summary: Optional[str] - description: Optional[str] - value: Optional[Any] - externalValue: Optional[AnyUrl] - - if PYDANTIC_V2: # type: ignore [misc] - __pydantic_config__ = {"extra": "allow"} - - else: - - class Config: - extra = "allow" - - -class ParameterInType(Enum): - query = "query" - header = "header" - path = "path" - cookie = "cookie" - - -class Encoding(BaseModelWithConfig): - contentType: Optional[str] = None - headers: Optional[Dict[str, Union["Header", Reference]]] = None - style: Optional[str] = None - explode: Optional[bool] = None - allowReserved: Optional[bool] = None - - -class MediaType(BaseModelWithConfig): - schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema") - example: Optional[Any] = None - examples: Optional[Dict[str, Union[Example, Reference]]] = None - encoding: Optional[Dict[str, Encoding]] = None - - -class ParameterBase(BaseModelWithConfig): - description: Optional[str] = None - required: Optional[bool] = None - deprecated: Optional[bool] = None - # Serialization rules for simple scenarios - style: Optional[str] = None - explode: Optional[bool] = None - allowReserved: Optional[bool] = None - schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema") - example: Optional[Any] = None - examples: Optional[Dict[str, Union[Example, Reference]]] = None - # Serialization rules for more complex scenarios - content: Optional[Dict[str, MediaType]] = None - - -class Parameter(ParameterBase): - name: str - in_: ParameterInType = Field(alias="in") - - -class Header(ParameterBase): - pass - - -class RequestBody(BaseModelWithConfig): - description: Optional[str] = None - content: Dict[str, MediaType] - required: Optional[bool] = None - - -class Link(BaseModelWithConfig): - operationRef: Optional[str] = None - operationId: Optional[str] = None - parameters: Optional[Dict[str, Union[Any, str]]] = None - requestBody: Optional[Union[Any, str]] = None - description: Optional[str] = None - server: Optional[Server] = None - - -class Response(BaseModelWithConfig): - description: str - headers: Optional[Dict[str, Union[Header, Reference]]] = None - content: Optional[Dict[str, MediaType]] = None - links: Optional[Dict[str, Union[Link, Reference]]] = None - - -class Operation(BaseModelWithConfig): - tags: Optional[List[str]] = None - summary: Optional[str] = None - description: Optional[str] = None - externalDocs: Optional[ExternalDocumentation] = None - operationId: Optional[str] = None - parameters: Optional[List[Union[Parameter, Reference]]] = None - requestBody: Optional[Union[RequestBody, Reference]] = None - # Using Any for Specification Extensions - responses: Optional[Dict[str, Union[Response, Any]]] = None - callbacks: Optional[Dict[str, Union[Dict[str, "PathItem"], Reference]]] = None - deprecated: Optional[bool] = None - security: Optional[List[Dict[str, List[str]]]] = None - servers: Optional[List[Server]] = None - - -class PathItem(BaseModelWithConfig): - ref: Optional[str] = Field(default=None, alias="$ref") - summary: Optional[str] = None - description: Optional[str] = None - get: Optional[Operation] = None - put: Optional[Operation] = None - post: Optional[Operation] = None - delete: Optional[Operation] = None - options: Optional[Operation] = None - head: Optional[Operation] = None - patch: Optional[Operation] = None - trace: Optional[Operation] = None - servers: Optional[List[Server]] = None - parameters: Optional[List[Union[Parameter, Reference]]] = None - - -class SecuritySchemeType(Enum): - apiKey = "apiKey" - http = "http" - oauth2 = "oauth2" - openIdConnect = "openIdConnect" - - -class SecurityBase(BaseModelWithConfig): - type_: SecuritySchemeType = Field(alias="type") - description: Optional[str] = None - - -class APIKeyIn(Enum): - query = "query" - header = "header" - cookie = "cookie" - - -class APIKey(SecurityBase): - type_: SecuritySchemeType = Field(default=SecuritySchemeType.apiKey, alias="type") - in_: APIKeyIn = Field(alias="in") - name: str - - -class HTTPBase(SecurityBase): - type_: SecuritySchemeType = Field(default=SecuritySchemeType.http, alias="type") - scheme: str - - -class HTTPBearer(HTTPBase): - scheme: Literal["bearer"] = "bearer" - bearerFormat: Optional[str] = None - - -class OAuthFlow(BaseModelWithConfig): - refreshUrl: Optional[str] = None - scopes: Dict[str, str] = {} - - -class OAuthFlowImplicit(OAuthFlow): - authorizationUrl: str - - -class OAuthFlowPassword(OAuthFlow): - tokenUrl: str - - -class OAuthFlowClientCredentials(OAuthFlow): - tokenUrl: str - - -class OAuthFlowAuthorizationCode(OAuthFlow): - authorizationUrl: str - tokenUrl: str - - -class OAuthFlows(BaseModelWithConfig): - implicit: Optional[OAuthFlowImplicit] = None - password: Optional[OAuthFlowPassword] = None - clientCredentials: Optional[OAuthFlowClientCredentials] = None - authorizationCode: Optional[OAuthFlowAuthorizationCode] = None - - -class OAuth2(SecurityBase): - type_: SecuritySchemeType = Field(default=SecuritySchemeType.oauth2, alias="type") - flows: OAuthFlows - - -class OpenIdConnect(SecurityBase): - type_: SecuritySchemeType = Field( - default=SecuritySchemeType.openIdConnect, alias="type" - ) - openIdConnectUrl: str - - -SecurityScheme = Union[APIKey, HTTPBase, OAuth2, OpenIdConnect, HTTPBearer] - - -class Components(BaseModelWithConfig): - schemas: Optional[Dict[str, Union[Schema, Reference]]] = None - responses: Optional[Dict[str, Union[Response, Reference]]] = None - parameters: Optional[Dict[str, Union[Parameter, Reference]]] = None - examples: Optional[Dict[str, Union[Example, Reference]]] = None - requestBodies: Optional[Dict[str, Union[RequestBody, Reference]]] = None - headers: Optional[Dict[str, Union[Header, Reference]]] = None - securitySchemes: Optional[Dict[str, Union[SecurityScheme, Reference]]] = None - links: Optional[Dict[str, Union[Link, Reference]]] = None - # Using Any for Specification Extensions - callbacks: Optional[Dict[str, Union[Dict[str, PathItem], Reference, Any]]] = None - pathItems: Optional[Dict[str, Union[PathItem, Reference]]] = None - - -class Tag(BaseModelWithConfig): - name: str - description: Optional[str] = None - externalDocs: Optional[ExternalDocumentation] = None - - -class OpenAPI(BaseModelWithConfig): - openapi: str - info: Info - jsonSchemaDialect: Optional[str] = None - servers: Optional[List[Server]] = None - # Using Any for Specification Extensions - paths: Optional[Dict[str, Union[PathItem, Any]]] = None - webhooks: Optional[Dict[str, Union[PathItem, Reference]]] = None - components: Optional[Components] = None - security: Optional[List[Dict[str, List[str]]]] = None - tags: Optional[List[Tag]] = None - externalDocs: Optional[ExternalDocumentation] = None - - -_model_rebuild(Schema) -_model_rebuild(Operation) -_model_rebuild(Encoding) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/utils.py b/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/utils.py deleted file mode 100644 index 79ad9f8..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/openapi/utils.py +++ /dev/null @@ -1,530 +0,0 @@ -import http.client -import inspect -import warnings -from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Type, Union, cast - -from fastapi import routing -from fastapi._compat import ( - GenerateJsonSchema, - JsonSchemaValue, - ModelField, - Undefined, - get_compat_model_name_map, - get_definitions, - get_schema_from_model_field, - lenient_issubclass, -) -from fastapi.datastructures import DefaultPlaceholder -from fastapi.dependencies.models import Dependant -from fastapi.dependencies.utils import get_flat_dependant, get_flat_params -from fastapi.encoders import jsonable_encoder -from fastapi.openapi.constants import METHODS_WITH_BODY, REF_PREFIX, REF_TEMPLATE -from fastapi.openapi.models import OpenAPI -from fastapi.params import Body, Param -from fastapi.responses import Response -from fastapi.types import ModelNameMap -from fastapi.utils import ( - deep_dict_update, - generate_operation_id_for_path, - is_body_allowed_for_status_code, -) -from starlette.responses import JSONResponse -from starlette.routing import BaseRoute -from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY -from typing_extensions import Literal - -validation_error_definition = { - "title": "ValidationError", - "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, - }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, - "required": ["loc", "msg", "type"], -} - -validation_error_response_definition = { - "title": "HTTPValidationError", - "type": "object", - "properties": { - "detail": { - "title": "Detail", - "type": "array", - "items": {"$ref": REF_PREFIX + "ValidationError"}, - } - }, -} - -status_code_ranges: Dict[str, str] = { - "1XX": "Information", - "2XX": "Success", - "3XX": "Redirection", - "4XX": "Client Error", - "5XX": "Server Error", - "DEFAULT": "Default Response", -} - - -def get_openapi_security_definitions( - flat_dependant: Dependant, -) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: - security_definitions = {} - operation_security = [] - for security_requirement in flat_dependant.security_requirements: - security_definition = jsonable_encoder( - security_requirement.security_scheme.model, - by_alias=True, - exclude_none=True, - ) - security_name = security_requirement.security_scheme.scheme_name - security_definitions[security_name] = security_definition - operation_security.append({security_name: security_requirement.scopes}) - return security_definitions, operation_security - - -def get_openapi_operation_parameters( - *, - all_route_params: Sequence[ModelField], - schema_generator: GenerateJsonSchema, - model_name_map: ModelNameMap, - field_mapping: Dict[ - Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue - ], - separate_input_output_schemas: bool = True, -) -> List[Dict[str, Any]]: - parameters = [] - for param in all_route_params: - field_info = param.field_info - field_info = cast(Param, field_info) - if not field_info.include_in_schema: - continue - param_schema = get_schema_from_model_field( - field=param, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - parameter = { - "name": param.alias, - "in": field_info.in_.value, - "required": param.required, - "schema": param_schema, - } - if field_info.description: - parameter["description"] = field_info.description - if field_info.openapi_examples: - parameter["examples"] = jsonable_encoder(field_info.openapi_examples) - elif field_info.example != Undefined: - parameter["example"] = jsonable_encoder(field_info.example) - if field_info.deprecated: - parameter["deprecated"] = True - parameters.append(parameter) - return parameters - - -def get_openapi_operation_request_body( - *, - body_field: Optional[ModelField], - schema_generator: GenerateJsonSchema, - model_name_map: ModelNameMap, - field_mapping: Dict[ - Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue - ], - separate_input_output_schemas: bool = True, -) -> Optional[Dict[str, Any]]: - if not body_field: - return None - assert isinstance(body_field, ModelField) - body_schema = get_schema_from_model_field( - field=body_field, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - field_info = cast(Body, body_field.field_info) - request_media_type = field_info.media_type - required = body_field.required - request_body_oai: Dict[str, Any] = {} - if required: - request_body_oai["required"] = required - request_media_content: Dict[str, Any] = {"schema": body_schema} - if field_info.openapi_examples: - request_media_content["examples"] = jsonable_encoder( - field_info.openapi_examples - ) - elif field_info.example != Undefined: - request_media_content["example"] = jsonable_encoder(field_info.example) - request_body_oai["content"] = {request_media_type: request_media_content} - return request_body_oai - - -def generate_operation_id( - *, route: routing.APIRoute, method: str -) -> str: # pragma: nocover - warnings.warn( - "fastapi.openapi.utils.generate_operation_id() was deprecated, " - "it is not used internally, and will be removed soon", - DeprecationWarning, - stacklevel=2, - ) - if route.operation_id: - return route.operation_id - path: str = route.path_format - return generate_operation_id_for_path(name=route.name, path=path, method=method) - - -def generate_operation_summary(*, route: routing.APIRoute, method: str) -> str: - if route.summary: - return route.summary - return route.name.replace("_", " ").title() - - -def get_openapi_operation_metadata( - *, route: routing.APIRoute, method: str, operation_ids: Set[str] -) -> Dict[str, Any]: - operation: Dict[str, Any] = {} - if route.tags: - operation["tags"] = route.tags - operation["summary"] = generate_operation_summary(route=route, method=method) - if route.description: - operation["description"] = route.description - operation_id = route.operation_id or route.unique_id - if operation_id in operation_ids: - message = ( - f"Duplicate Operation ID {operation_id} for function " - + f"{route.endpoint.__name__}" - ) - file_name = getattr(route.endpoint, "__globals__", {}).get("__file__") - if file_name: - message += f" at {file_name}" - warnings.warn(message, stacklevel=1) - operation_ids.add(operation_id) - operation["operationId"] = operation_id - if route.deprecated: - operation["deprecated"] = route.deprecated - return operation - - -def get_openapi_path( - *, - route: routing.APIRoute, - operation_ids: Set[str], - schema_generator: GenerateJsonSchema, - model_name_map: ModelNameMap, - field_mapping: Dict[ - Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue - ], - separate_input_output_schemas: bool = True, -) -> Tuple[Dict[str, Any], Dict[str, Any], Dict[str, Any]]: - path = {} - security_schemes: Dict[str, Any] = {} - definitions: Dict[str, Any] = {} - assert route.methods is not None, "Methods must be a list" - if isinstance(route.response_class, DefaultPlaceholder): - current_response_class: Type[Response] = route.response_class.value - else: - current_response_class = route.response_class - assert current_response_class, "A response class is needed to generate OpenAPI" - route_response_media_type: Optional[str] = current_response_class.media_type - if route.include_in_schema: - for method in route.methods: - operation = get_openapi_operation_metadata( - route=route, method=method, operation_ids=operation_ids - ) - parameters: List[Dict[str, Any]] = [] - flat_dependant = get_flat_dependant(route.dependant, skip_repeats=True) - security_definitions, operation_security = get_openapi_security_definitions( - flat_dependant=flat_dependant - ) - if operation_security: - operation.setdefault("security", []).extend(operation_security) - if security_definitions: - security_schemes.update(security_definitions) - all_route_params = get_flat_params(route.dependant) - operation_parameters = get_openapi_operation_parameters( - all_route_params=all_route_params, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - parameters.extend(operation_parameters) - if parameters: - all_parameters = { - (param["in"], param["name"]): param for param in parameters - } - required_parameters = { - (param["in"], param["name"]): param - for param in parameters - if param.get("required") - } - # Make sure required definitions of the same parameter take precedence - # over non-required definitions - all_parameters.update(required_parameters) - operation["parameters"] = list(all_parameters.values()) - if method in METHODS_WITH_BODY: - request_body_oai = get_openapi_operation_request_body( - body_field=route.body_field, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - if request_body_oai: - operation["requestBody"] = request_body_oai - if route.callbacks: - callbacks = {} - for callback in route.callbacks: - if isinstance(callback, routing.APIRoute): - ( - cb_path, - cb_security_schemes, - cb_definitions, - ) = get_openapi_path( - route=callback, - operation_ids=operation_ids, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - callbacks[callback.name] = {callback.path: cb_path} - operation["callbacks"] = callbacks - if route.status_code is not None: - status_code = str(route.status_code) - else: - # It would probably make more sense for all response classes to have an - # explicit default status_code, and to extract it from them, instead of - # doing this inspection tricks, that would probably be in the future - # TODO: probably make status_code a default class attribute for all - # responses in Starlette - response_signature = inspect.signature(current_response_class.__init__) - status_code_param = response_signature.parameters.get("status_code") - if status_code_param is not None: - if isinstance(status_code_param.default, int): - status_code = str(status_code_param.default) - operation.setdefault("responses", {}).setdefault(status_code, {})[ - "description" - ] = route.response_description - if route_response_media_type and is_body_allowed_for_status_code( - route.status_code - ): - response_schema = {"type": "string"} - if lenient_issubclass(current_response_class, JSONResponse): - if route.response_field: - response_schema = get_schema_from_model_field( - field=route.response_field, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - else: - response_schema = {} - operation.setdefault("responses", {}).setdefault( - status_code, {} - ).setdefault("content", {}).setdefault(route_response_media_type, {})[ - "schema" - ] = response_schema - if route.responses: - operation_responses = operation.setdefault("responses", {}) - for ( - additional_status_code, - additional_response, - ) in route.responses.items(): - process_response = additional_response.copy() - process_response.pop("model", None) - status_code_key = str(additional_status_code).upper() - if status_code_key == "DEFAULT": - status_code_key = "default" - openapi_response = operation_responses.setdefault( - status_code_key, {} - ) - assert isinstance( - process_response, dict - ), "An additional response must be a dict" - field = route.response_fields.get(additional_status_code) - additional_field_schema: Optional[Dict[str, Any]] = None - if field: - additional_field_schema = get_schema_from_model_field( - field=field, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - media_type = route_response_media_type or "application/json" - additional_schema = ( - process_response.setdefault("content", {}) - .setdefault(media_type, {}) - .setdefault("schema", {}) - ) - deep_dict_update(additional_schema, additional_field_schema) - status_text: Optional[str] = status_code_ranges.get( - str(additional_status_code).upper() - ) or http.client.responses.get(int(additional_status_code)) - description = ( - process_response.get("description") - or openapi_response.get("description") - or status_text - or "Additional Response" - ) - deep_dict_update(openapi_response, process_response) - openapi_response["description"] = description - http422 = str(HTTP_422_UNPROCESSABLE_ENTITY) - if (all_route_params or route.body_field) and not any( - status in operation["responses"] - for status in [http422, "4XX", "default"] - ): - operation["responses"][http422] = { - "description": "Validation Error", - "content": { - "application/json": { - "schema": {"$ref": REF_PREFIX + "HTTPValidationError"} - } - }, - } - if "ValidationError" not in definitions: - definitions.update( - { - "ValidationError": validation_error_definition, - "HTTPValidationError": validation_error_response_definition, - } - ) - if route.openapi_extra: - deep_dict_update(operation, route.openapi_extra) - path[method.lower()] = operation - return path, security_schemes, definitions - - -def get_fields_from_routes( - routes: Sequence[BaseRoute], -) -> List[ModelField]: - body_fields_from_routes: List[ModelField] = [] - responses_from_routes: List[ModelField] = [] - request_fields_from_routes: List[ModelField] = [] - callback_flat_models: List[ModelField] = [] - for route in routes: - if getattr(route, "include_in_schema", None) and isinstance( - route, routing.APIRoute - ): - if route.body_field: - assert isinstance( - route.body_field, ModelField - ), "A request body must be a Pydantic Field" - body_fields_from_routes.append(route.body_field) - if route.response_field: - responses_from_routes.append(route.response_field) - if route.response_fields: - responses_from_routes.extend(route.response_fields.values()) - if route.callbacks: - callback_flat_models.extend(get_fields_from_routes(route.callbacks)) - params = get_flat_params(route.dependant) - request_fields_from_routes.extend(params) - - flat_models = callback_flat_models + list( - body_fields_from_routes + responses_from_routes + request_fields_from_routes - ) - return flat_models - - -def get_openapi( - *, - title: str, - version: str, - openapi_version: str = "3.1.0", - summary: Optional[str] = None, - description: Optional[str] = None, - routes: Sequence[BaseRoute], - webhooks: Optional[Sequence[BaseRoute]] = None, - tags: Optional[List[Dict[str, Any]]] = None, - servers: Optional[List[Dict[str, Union[str, Any]]]] = None, - terms_of_service: Optional[str] = None, - contact: Optional[Dict[str, Union[str, Any]]] = None, - license_info: Optional[Dict[str, Union[str, Any]]] = None, - separate_input_output_schemas: bool = True, -) -> Dict[str, Any]: - info: Dict[str, Any] = {"title": title, "version": version} - if summary: - info["summary"] = summary - if description: - info["description"] = description - if terms_of_service: - info["termsOfService"] = terms_of_service - if contact: - info["contact"] = contact - if license_info: - info["license"] = license_info - output: Dict[str, Any] = {"openapi": openapi_version, "info": info} - if servers: - output["servers"] = servers - components: Dict[str, Dict[str, Any]] = {} - paths: Dict[str, Dict[str, Any]] = {} - webhook_paths: Dict[str, Dict[str, Any]] = {} - operation_ids: Set[str] = set() - all_fields = get_fields_from_routes(list(routes or []) + list(webhooks or [])) - model_name_map = get_compat_model_name_map(all_fields) - schema_generator = GenerateJsonSchema(ref_template=REF_TEMPLATE) - field_mapping, definitions = get_definitions( - fields=all_fields, - schema_generator=schema_generator, - model_name_map=model_name_map, - separate_input_output_schemas=separate_input_output_schemas, - ) - for route in routes or []: - if isinstance(route, routing.APIRoute): - result = get_openapi_path( - route=route, - operation_ids=operation_ids, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - if result: - path, security_schemes, path_definitions = result - if path: - paths.setdefault(route.path_format, {}).update(path) - if security_schemes: - components.setdefault("securitySchemes", {}).update( - security_schemes - ) - if path_definitions: - definitions.update(path_definitions) - for webhook in webhooks or []: - if isinstance(webhook, routing.APIRoute): - result = get_openapi_path( - route=webhook, - operation_ids=operation_ids, - schema_generator=schema_generator, - model_name_map=model_name_map, - field_mapping=field_mapping, - separate_input_output_schemas=separate_input_output_schemas, - ) - if result: - path, security_schemes, path_definitions = result - if path: - webhook_paths.setdefault(webhook.path_format, {}).update(path) - if security_schemes: - components.setdefault("securitySchemes", {}).update( - security_schemes - ) - if path_definitions: - definitions.update(path_definitions) - if definitions: - components["schemas"] = {k: definitions[k] for k in sorted(definitions)} - if components: - output["components"] = components - output["paths"] = paths - if webhook_paths: - output["webhooks"] = webhook_paths - if tags: - output["tags"] = tags - return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True) # type: ignore diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/param_functions.py b/write-message/venv/lib/python3.10/site-packages/fastapi/param_functions.py deleted file mode 100644 index 3b25d77..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/param_functions.py +++ /dev/null @@ -1,2360 +0,0 @@ -from typing import Any, Callable, Dict, List, Optional, Sequence, Union - -from fastapi import params -from fastapi._compat import Undefined -from fastapi.openapi.models import Example -from typing_extensions import Annotated, Doc, deprecated - -_Unset: Any = Undefined - - -def Path( # noqa: N802 - default: Annotated[ - Any, - Doc( - """ - Default value if the parameter field is not set. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = ..., - *, - default_factory: Annotated[ - Union[Callable[[], Any], None], - Doc( - """ - A callable to generate the default value. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = _Unset, - alias: Annotated[ - Optional[str], - Doc( - """ - An alternative name for the parameter field. - - This will be used to extract the data and for the generated OpenAPI. - It is particularly useful when you can't use the name you want because it - is a Python reserved keyword or similar. - """ - ), - ] = None, - alias_priority: Annotated[ - Union[int, None], - Doc( - """ - Priority of the alias. This affects whether an alias generator is used. - """ - ), - ] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Whitelist' validation step. The parameter field will be the single one - allowed by the alias or set of aliases defined. - """ - ), - ] = None, - serialization_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Blacklist' validation step. The vanilla parameter field will be the - single one of the alias' or set of aliases' fields and all the other - fields will be ignored at serialization time. - """ - ), - ] = None, - title: Annotated[ - Optional[str], - Doc( - """ - Human-readable title. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Human-readable description. - """ - ), - ] = None, - gt: Annotated[ - Optional[float], - Doc( - """ - Greater than. If set, value must be greater than this. Only applicable to - numbers. - """ - ), - ] = None, - ge: Annotated[ - Optional[float], - Doc( - """ - Greater than or equal. If set, value must be greater than or equal to - this. Only applicable to numbers. - """ - ), - ] = None, - lt: Annotated[ - Optional[float], - Doc( - """ - Less than. If set, value must be less than this. Only applicable to numbers. - """ - ), - ] = None, - le: Annotated[ - Optional[float], - Doc( - """ - Less than or equal. If set, value must be less than or equal to this. - Only applicable to numbers. - """ - ), - ] = None, - min_length: Annotated[ - Optional[int], - Doc( - """ - Minimum length for strings. - """ - ), - ] = None, - max_length: Annotated[ - Optional[int], - Doc( - """ - Maximum length for strings. - """ - ), - ] = None, - pattern: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - ] = None, - regex: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Annotated[ - Union[str, None], - Doc( - """ - Parameter field name for discriminating the type in a tagged union. - """ - ), - ] = None, - strict: Annotated[ - Union[bool, None], - Doc( - """ - If `True`, strict validation is applied to the field. - """ - ), - ] = _Unset, - multiple_of: Annotated[ - Union[float, None], - Doc( - """ - Value must be a multiple of this. Only applicable to numbers. - """ - ), - ] = _Unset, - allow_inf_nan: Annotated[ - Union[bool, None], - Doc( - """ - Allow `inf`, `-inf`, `nan`. Only applicable to numbers. - """ - ), - ] = _Unset, - max_digits: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of allow digits for strings. - """ - ), - ] = _Unset, - decimal_places: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of decimal places allowed for numbers. - """ - ), - ] = _Unset, - examples: Annotated[ - Optional[List[Any]], - Doc( - """ - Example values for this field. - """ - ), - ] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Annotated[ - Optional[Dict[str, Example]], - Doc( - """ - OpenAPI-specific examples. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Swagger UI (that provides the `/docs` interface) has better support for the - OpenAPI-specific examples than the JSON Schema `examples`, that's the main - use case for this. - - Read more about it in the - [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). - """ - ), - ] = None, - deprecated: Annotated[ - Union[deprecated, str, bool, None], - Doc( - """ - Mark this parameter field as deprecated. - - It will affect the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) this parameter field in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - json_schema_extra: Annotated[ - Union[Dict[str, Any], None], - Doc( - """ - Any additional JSON schema data. - """ - ), - ] = None, - **extra: Annotated[ - Any, - Doc( - """ - Include extra fields used by the JSON Schema. - """ - ), - deprecated( - """ - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - """ - ), - ], -) -> Any: - """ - Declare a path parameter for a *path operation*. - - Read more about it in the - [FastAPI docs for Path Parameters and Numeric Validations](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/). - - ```python - from typing import Annotated - - from fastapi import FastAPI, Path - - app = FastAPI() - - - @app.get("/items/{item_id}") - async def read_items( - item_id: Annotated[int, Path(title="The ID of the item to get")], - ): - return {"item_id": item_id} - ``` - """ - return params.Path( - default=default, - default_factory=default_factory, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - example=example, - examples=examples, - openapi_examples=openapi_examples, - deprecated=deprecated, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -def Query( # noqa: N802 - default: Annotated[ - Any, - Doc( - """ - Default value if the parameter field is not set. - """ - ), - ] = Undefined, - *, - default_factory: Annotated[ - Union[Callable[[], Any], None], - Doc( - """ - A callable to generate the default value. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = _Unset, - alias: Annotated[ - Optional[str], - Doc( - """ - An alternative name for the parameter field. - - This will be used to extract the data and for the generated OpenAPI. - It is particularly useful when you can't use the name you want because it - is a Python reserved keyword or similar. - """ - ), - ] = None, - alias_priority: Annotated[ - Union[int, None], - Doc( - """ - Priority of the alias. This affects whether an alias generator is used. - """ - ), - ] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Whitelist' validation step. The parameter field will be the single one - allowed by the alias or set of aliases defined. - """ - ), - ] = None, - serialization_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Blacklist' validation step. The vanilla parameter field will be the - single one of the alias' or set of aliases' fields and all the other - fields will be ignored at serialization time. - """ - ), - ] = None, - title: Annotated[ - Optional[str], - Doc( - """ - Human-readable title. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Human-readable description. - """ - ), - ] = None, - gt: Annotated[ - Optional[float], - Doc( - """ - Greater than. If set, value must be greater than this. Only applicable to - numbers. - """ - ), - ] = None, - ge: Annotated[ - Optional[float], - Doc( - """ - Greater than or equal. If set, value must be greater than or equal to - this. Only applicable to numbers. - """ - ), - ] = None, - lt: Annotated[ - Optional[float], - Doc( - """ - Less than. If set, value must be less than this. Only applicable to numbers. - """ - ), - ] = None, - le: Annotated[ - Optional[float], - Doc( - """ - Less than or equal. If set, value must be less than or equal to this. - Only applicable to numbers. - """ - ), - ] = None, - min_length: Annotated[ - Optional[int], - Doc( - """ - Minimum length for strings. - """ - ), - ] = None, - max_length: Annotated[ - Optional[int], - Doc( - """ - Maximum length for strings. - """ - ), - ] = None, - pattern: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - ] = None, - regex: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Annotated[ - Union[str, None], - Doc( - """ - Parameter field name for discriminating the type in a tagged union. - """ - ), - ] = None, - strict: Annotated[ - Union[bool, None], - Doc( - """ - If `True`, strict validation is applied to the field. - """ - ), - ] = _Unset, - multiple_of: Annotated[ - Union[float, None], - Doc( - """ - Value must be a multiple of this. Only applicable to numbers. - """ - ), - ] = _Unset, - allow_inf_nan: Annotated[ - Union[bool, None], - Doc( - """ - Allow `inf`, `-inf`, `nan`. Only applicable to numbers. - """ - ), - ] = _Unset, - max_digits: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of allow digits for strings. - """ - ), - ] = _Unset, - decimal_places: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of decimal places allowed for numbers. - """ - ), - ] = _Unset, - examples: Annotated[ - Optional[List[Any]], - Doc( - """ - Example values for this field. - """ - ), - ] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Annotated[ - Optional[Dict[str, Example]], - Doc( - """ - OpenAPI-specific examples. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Swagger UI (that provides the `/docs` interface) has better support for the - OpenAPI-specific examples than the JSON Schema `examples`, that's the main - use case for this. - - Read more about it in the - [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). - """ - ), - ] = None, - deprecated: Annotated[ - Union[deprecated, str, bool, None], - Doc( - """ - Mark this parameter field as deprecated. - - It will affect the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) this parameter field in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - json_schema_extra: Annotated[ - Union[Dict[str, Any], None], - Doc( - """ - Any additional JSON schema data. - """ - ), - ] = None, - **extra: Annotated[ - Any, - Doc( - """ - Include extra fields used by the JSON Schema. - """ - ), - deprecated( - """ - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - """ - ), - ], -) -> Any: - return params.Query( - default=default, - default_factory=default_factory, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - example=example, - examples=examples, - openapi_examples=openapi_examples, - deprecated=deprecated, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -def Header( # noqa: N802 - default: Annotated[ - Any, - Doc( - """ - Default value if the parameter field is not set. - """ - ), - ] = Undefined, - *, - default_factory: Annotated[ - Union[Callable[[], Any], None], - Doc( - """ - A callable to generate the default value. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = _Unset, - alias: Annotated[ - Optional[str], - Doc( - """ - An alternative name for the parameter field. - - This will be used to extract the data and for the generated OpenAPI. - It is particularly useful when you can't use the name you want because it - is a Python reserved keyword or similar. - """ - ), - ] = None, - alias_priority: Annotated[ - Union[int, None], - Doc( - """ - Priority of the alias. This affects whether an alias generator is used. - """ - ), - ] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Whitelist' validation step. The parameter field will be the single one - allowed by the alias or set of aliases defined. - """ - ), - ] = None, - serialization_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Blacklist' validation step. The vanilla parameter field will be the - single one of the alias' or set of aliases' fields and all the other - fields will be ignored at serialization time. - """ - ), - ] = None, - convert_underscores: Annotated[ - bool, - Doc( - """ - Automatically convert underscores to hyphens in the parameter field name. - - Read more about it in the - [FastAPI docs for Header Parameters](https://fastapi.tiangolo.com/tutorial/header-params/#automatic-conversion) - """ - ), - ] = True, - title: Annotated[ - Optional[str], - Doc( - """ - Human-readable title. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Human-readable description. - """ - ), - ] = None, - gt: Annotated[ - Optional[float], - Doc( - """ - Greater than. If set, value must be greater than this. Only applicable to - numbers. - """ - ), - ] = None, - ge: Annotated[ - Optional[float], - Doc( - """ - Greater than or equal. If set, value must be greater than or equal to - this. Only applicable to numbers. - """ - ), - ] = None, - lt: Annotated[ - Optional[float], - Doc( - """ - Less than. If set, value must be less than this. Only applicable to numbers. - """ - ), - ] = None, - le: Annotated[ - Optional[float], - Doc( - """ - Less than or equal. If set, value must be less than or equal to this. - Only applicable to numbers. - """ - ), - ] = None, - min_length: Annotated[ - Optional[int], - Doc( - """ - Minimum length for strings. - """ - ), - ] = None, - max_length: Annotated[ - Optional[int], - Doc( - """ - Maximum length for strings. - """ - ), - ] = None, - pattern: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - ] = None, - regex: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Annotated[ - Union[str, None], - Doc( - """ - Parameter field name for discriminating the type in a tagged union. - """ - ), - ] = None, - strict: Annotated[ - Union[bool, None], - Doc( - """ - If `True`, strict validation is applied to the field. - """ - ), - ] = _Unset, - multiple_of: Annotated[ - Union[float, None], - Doc( - """ - Value must be a multiple of this. Only applicable to numbers. - """ - ), - ] = _Unset, - allow_inf_nan: Annotated[ - Union[bool, None], - Doc( - """ - Allow `inf`, `-inf`, `nan`. Only applicable to numbers. - """ - ), - ] = _Unset, - max_digits: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of allow digits for strings. - """ - ), - ] = _Unset, - decimal_places: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of decimal places allowed for numbers. - """ - ), - ] = _Unset, - examples: Annotated[ - Optional[List[Any]], - Doc( - """ - Example values for this field. - """ - ), - ] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Annotated[ - Optional[Dict[str, Example]], - Doc( - """ - OpenAPI-specific examples. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Swagger UI (that provides the `/docs` interface) has better support for the - OpenAPI-specific examples than the JSON Schema `examples`, that's the main - use case for this. - - Read more about it in the - [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). - """ - ), - ] = None, - deprecated: Annotated[ - Union[deprecated, str, bool, None], - Doc( - """ - Mark this parameter field as deprecated. - - It will affect the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) this parameter field in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - json_schema_extra: Annotated[ - Union[Dict[str, Any], None], - Doc( - """ - Any additional JSON schema data. - """ - ), - ] = None, - **extra: Annotated[ - Any, - Doc( - """ - Include extra fields used by the JSON Schema. - """ - ), - deprecated( - """ - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - """ - ), - ], -) -> Any: - return params.Header( - default=default, - default_factory=default_factory, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - convert_underscores=convert_underscores, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - example=example, - examples=examples, - openapi_examples=openapi_examples, - deprecated=deprecated, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -def Cookie( # noqa: N802 - default: Annotated[ - Any, - Doc( - """ - Default value if the parameter field is not set. - """ - ), - ] = Undefined, - *, - default_factory: Annotated[ - Union[Callable[[], Any], None], - Doc( - """ - A callable to generate the default value. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = _Unset, - alias: Annotated[ - Optional[str], - Doc( - """ - An alternative name for the parameter field. - - This will be used to extract the data and for the generated OpenAPI. - It is particularly useful when you can't use the name you want because it - is a Python reserved keyword or similar. - """ - ), - ] = None, - alias_priority: Annotated[ - Union[int, None], - Doc( - """ - Priority of the alias. This affects whether an alias generator is used. - """ - ), - ] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Whitelist' validation step. The parameter field will be the single one - allowed by the alias or set of aliases defined. - """ - ), - ] = None, - serialization_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Blacklist' validation step. The vanilla parameter field will be the - single one of the alias' or set of aliases' fields and all the other - fields will be ignored at serialization time. - """ - ), - ] = None, - title: Annotated[ - Optional[str], - Doc( - """ - Human-readable title. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Human-readable description. - """ - ), - ] = None, - gt: Annotated[ - Optional[float], - Doc( - """ - Greater than. If set, value must be greater than this. Only applicable to - numbers. - """ - ), - ] = None, - ge: Annotated[ - Optional[float], - Doc( - """ - Greater than or equal. If set, value must be greater than or equal to - this. Only applicable to numbers. - """ - ), - ] = None, - lt: Annotated[ - Optional[float], - Doc( - """ - Less than. If set, value must be less than this. Only applicable to numbers. - """ - ), - ] = None, - le: Annotated[ - Optional[float], - Doc( - """ - Less than or equal. If set, value must be less than or equal to this. - Only applicable to numbers. - """ - ), - ] = None, - min_length: Annotated[ - Optional[int], - Doc( - """ - Minimum length for strings. - """ - ), - ] = None, - max_length: Annotated[ - Optional[int], - Doc( - """ - Maximum length for strings. - """ - ), - ] = None, - pattern: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - ] = None, - regex: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Annotated[ - Union[str, None], - Doc( - """ - Parameter field name for discriminating the type in a tagged union. - """ - ), - ] = None, - strict: Annotated[ - Union[bool, None], - Doc( - """ - If `True`, strict validation is applied to the field. - """ - ), - ] = _Unset, - multiple_of: Annotated[ - Union[float, None], - Doc( - """ - Value must be a multiple of this. Only applicable to numbers. - """ - ), - ] = _Unset, - allow_inf_nan: Annotated[ - Union[bool, None], - Doc( - """ - Allow `inf`, `-inf`, `nan`. Only applicable to numbers. - """ - ), - ] = _Unset, - max_digits: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of allow digits for strings. - """ - ), - ] = _Unset, - decimal_places: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of decimal places allowed for numbers. - """ - ), - ] = _Unset, - examples: Annotated[ - Optional[List[Any]], - Doc( - """ - Example values for this field. - """ - ), - ] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Annotated[ - Optional[Dict[str, Example]], - Doc( - """ - OpenAPI-specific examples. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Swagger UI (that provides the `/docs` interface) has better support for the - OpenAPI-specific examples than the JSON Schema `examples`, that's the main - use case for this. - - Read more about it in the - [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). - """ - ), - ] = None, - deprecated: Annotated[ - Union[deprecated, str, bool, None], - Doc( - """ - Mark this parameter field as deprecated. - - It will affect the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) this parameter field in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - json_schema_extra: Annotated[ - Union[Dict[str, Any], None], - Doc( - """ - Any additional JSON schema data. - """ - ), - ] = None, - **extra: Annotated[ - Any, - Doc( - """ - Include extra fields used by the JSON Schema. - """ - ), - deprecated( - """ - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - """ - ), - ], -) -> Any: - return params.Cookie( - default=default, - default_factory=default_factory, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - example=example, - examples=examples, - openapi_examples=openapi_examples, - deprecated=deprecated, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -def Body( # noqa: N802 - default: Annotated[ - Any, - Doc( - """ - Default value if the parameter field is not set. - """ - ), - ] = Undefined, - *, - default_factory: Annotated[ - Union[Callable[[], Any], None], - Doc( - """ - A callable to generate the default value. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = _Unset, - embed: Annotated[ - bool, - Doc( - """ - When `embed` is `True`, the parameter will be expected in a JSON body as a - key instead of being the JSON body itself. - - This happens automatically when more than one `Body` parameter is declared. - - Read more about it in the - [FastAPI docs for Body - Multiple Parameters](https://fastapi.tiangolo.com/tutorial/body-multiple-params/#embed-a-single-body-parameter). - """ - ), - ] = False, - media_type: Annotated[ - str, - Doc( - """ - The media type of this parameter field. Changing it would affect the - generated OpenAPI, but currently it doesn't affect the parsing of the data. - """ - ), - ] = "application/json", - alias: Annotated[ - Optional[str], - Doc( - """ - An alternative name for the parameter field. - - This will be used to extract the data and for the generated OpenAPI. - It is particularly useful when you can't use the name you want because it - is a Python reserved keyword or similar. - """ - ), - ] = None, - alias_priority: Annotated[ - Union[int, None], - Doc( - """ - Priority of the alias. This affects whether an alias generator is used. - """ - ), - ] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Whitelist' validation step. The parameter field will be the single one - allowed by the alias or set of aliases defined. - """ - ), - ] = None, - serialization_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Blacklist' validation step. The vanilla parameter field will be the - single one of the alias' or set of aliases' fields and all the other - fields will be ignored at serialization time. - """ - ), - ] = None, - title: Annotated[ - Optional[str], - Doc( - """ - Human-readable title. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Human-readable description. - """ - ), - ] = None, - gt: Annotated[ - Optional[float], - Doc( - """ - Greater than. If set, value must be greater than this. Only applicable to - numbers. - """ - ), - ] = None, - ge: Annotated[ - Optional[float], - Doc( - """ - Greater than or equal. If set, value must be greater than or equal to - this. Only applicable to numbers. - """ - ), - ] = None, - lt: Annotated[ - Optional[float], - Doc( - """ - Less than. If set, value must be less than this. Only applicable to numbers. - """ - ), - ] = None, - le: Annotated[ - Optional[float], - Doc( - """ - Less than or equal. If set, value must be less than or equal to this. - Only applicable to numbers. - """ - ), - ] = None, - min_length: Annotated[ - Optional[int], - Doc( - """ - Minimum length for strings. - """ - ), - ] = None, - max_length: Annotated[ - Optional[int], - Doc( - """ - Maximum length for strings. - """ - ), - ] = None, - pattern: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - ] = None, - regex: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Annotated[ - Union[str, None], - Doc( - """ - Parameter field name for discriminating the type in a tagged union. - """ - ), - ] = None, - strict: Annotated[ - Union[bool, None], - Doc( - """ - If `True`, strict validation is applied to the field. - """ - ), - ] = _Unset, - multiple_of: Annotated[ - Union[float, None], - Doc( - """ - Value must be a multiple of this. Only applicable to numbers. - """ - ), - ] = _Unset, - allow_inf_nan: Annotated[ - Union[bool, None], - Doc( - """ - Allow `inf`, `-inf`, `nan`. Only applicable to numbers. - """ - ), - ] = _Unset, - max_digits: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of allow digits for strings. - """ - ), - ] = _Unset, - decimal_places: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of decimal places allowed for numbers. - """ - ), - ] = _Unset, - examples: Annotated[ - Optional[List[Any]], - Doc( - """ - Example values for this field. - """ - ), - ] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Annotated[ - Optional[Dict[str, Example]], - Doc( - """ - OpenAPI-specific examples. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Swagger UI (that provides the `/docs` interface) has better support for the - OpenAPI-specific examples than the JSON Schema `examples`, that's the main - use case for this. - - Read more about it in the - [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). - """ - ), - ] = None, - deprecated: Annotated[ - Union[deprecated, str, bool, None], - Doc( - """ - Mark this parameter field as deprecated. - - It will affect the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) this parameter field in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - json_schema_extra: Annotated[ - Union[Dict[str, Any], None], - Doc( - """ - Any additional JSON schema data. - """ - ), - ] = None, - **extra: Annotated[ - Any, - Doc( - """ - Include extra fields used by the JSON Schema. - """ - ), - deprecated( - """ - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - """ - ), - ], -) -> Any: - return params.Body( - default=default, - default_factory=default_factory, - embed=embed, - media_type=media_type, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - example=example, - examples=examples, - openapi_examples=openapi_examples, - deprecated=deprecated, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -def Form( # noqa: N802 - default: Annotated[ - Any, - Doc( - """ - Default value if the parameter field is not set. - """ - ), - ] = Undefined, - *, - default_factory: Annotated[ - Union[Callable[[], Any], None], - Doc( - """ - A callable to generate the default value. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = _Unset, - media_type: Annotated[ - str, - Doc( - """ - The media type of this parameter field. Changing it would affect the - generated OpenAPI, but currently it doesn't affect the parsing of the data. - """ - ), - ] = "application/x-www-form-urlencoded", - alias: Annotated[ - Optional[str], - Doc( - """ - An alternative name for the parameter field. - - This will be used to extract the data and for the generated OpenAPI. - It is particularly useful when you can't use the name you want because it - is a Python reserved keyword or similar. - """ - ), - ] = None, - alias_priority: Annotated[ - Union[int, None], - Doc( - """ - Priority of the alias. This affects whether an alias generator is used. - """ - ), - ] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Whitelist' validation step. The parameter field will be the single one - allowed by the alias or set of aliases defined. - """ - ), - ] = None, - serialization_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Blacklist' validation step. The vanilla parameter field will be the - single one of the alias' or set of aliases' fields and all the other - fields will be ignored at serialization time. - """ - ), - ] = None, - title: Annotated[ - Optional[str], - Doc( - """ - Human-readable title. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Human-readable description. - """ - ), - ] = None, - gt: Annotated[ - Optional[float], - Doc( - """ - Greater than. If set, value must be greater than this. Only applicable to - numbers. - """ - ), - ] = None, - ge: Annotated[ - Optional[float], - Doc( - """ - Greater than or equal. If set, value must be greater than or equal to - this. Only applicable to numbers. - """ - ), - ] = None, - lt: Annotated[ - Optional[float], - Doc( - """ - Less than. If set, value must be less than this. Only applicable to numbers. - """ - ), - ] = None, - le: Annotated[ - Optional[float], - Doc( - """ - Less than or equal. If set, value must be less than or equal to this. - Only applicable to numbers. - """ - ), - ] = None, - min_length: Annotated[ - Optional[int], - Doc( - """ - Minimum length for strings. - """ - ), - ] = None, - max_length: Annotated[ - Optional[int], - Doc( - """ - Maximum length for strings. - """ - ), - ] = None, - pattern: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - ] = None, - regex: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Annotated[ - Union[str, None], - Doc( - """ - Parameter field name for discriminating the type in a tagged union. - """ - ), - ] = None, - strict: Annotated[ - Union[bool, None], - Doc( - """ - If `True`, strict validation is applied to the field. - """ - ), - ] = _Unset, - multiple_of: Annotated[ - Union[float, None], - Doc( - """ - Value must be a multiple of this. Only applicable to numbers. - """ - ), - ] = _Unset, - allow_inf_nan: Annotated[ - Union[bool, None], - Doc( - """ - Allow `inf`, `-inf`, `nan`. Only applicable to numbers. - """ - ), - ] = _Unset, - max_digits: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of allow digits for strings. - """ - ), - ] = _Unset, - decimal_places: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of decimal places allowed for numbers. - """ - ), - ] = _Unset, - examples: Annotated[ - Optional[List[Any]], - Doc( - """ - Example values for this field. - """ - ), - ] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Annotated[ - Optional[Dict[str, Example]], - Doc( - """ - OpenAPI-specific examples. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Swagger UI (that provides the `/docs` interface) has better support for the - OpenAPI-specific examples than the JSON Schema `examples`, that's the main - use case for this. - - Read more about it in the - [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). - """ - ), - ] = None, - deprecated: Annotated[ - Union[deprecated, str, bool, None], - Doc( - """ - Mark this parameter field as deprecated. - - It will affect the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) this parameter field in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - json_schema_extra: Annotated[ - Union[Dict[str, Any], None], - Doc( - """ - Any additional JSON schema data. - """ - ), - ] = None, - **extra: Annotated[ - Any, - Doc( - """ - Include extra fields used by the JSON Schema. - """ - ), - deprecated( - """ - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - """ - ), - ], -) -> Any: - return params.Form( - default=default, - default_factory=default_factory, - media_type=media_type, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - example=example, - examples=examples, - openapi_examples=openapi_examples, - deprecated=deprecated, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -def File( # noqa: N802 - default: Annotated[ - Any, - Doc( - """ - Default value if the parameter field is not set. - """ - ), - ] = Undefined, - *, - default_factory: Annotated[ - Union[Callable[[], Any], None], - Doc( - """ - A callable to generate the default value. - - This doesn't affect `Path` parameters as the value is always required. - The parameter is available only for compatibility. - """ - ), - ] = _Unset, - media_type: Annotated[ - str, - Doc( - """ - The media type of this parameter field. Changing it would affect the - generated OpenAPI, but currently it doesn't affect the parsing of the data. - """ - ), - ] = "multipart/form-data", - alias: Annotated[ - Optional[str], - Doc( - """ - An alternative name for the parameter field. - - This will be used to extract the data and for the generated OpenAPI. - It is particularly useful when you can't use the name you want because it - is a Python reserved keyword or similar. - """ - ), - ] = None, - alias_priority: Annotated[ - Union[int, None], - Doc( - """ - Priority of the alias. This affects whether an alias generator is used. - """ - ), - ] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Whitelist' validation step. The parameter field will be the single one - allowed by the alias or set of aliases defined. - """ - ), - ] = None, - serialization_alias: Annotated[ - Union[str, None], - Doc( - """ - 'Blacklist' validation step. The vanilla parameter field will be the - single one of the alias' or set of aliases' fields and all the other - fields will be ignored at serialization time. - """ - ), - ] = None, - title: Annotated[ - Optional[str], - Doc( - """ - Human-readable title. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Human-readable description. - """ - ), - ] = None, - gt: Annotated[ - Optional[float], - Doc( - """ - Greater than. If set, value must be greater than this. Only applicable to - numbers. - """ - ), - ] = None, - ge: Annotated[ - Optional[float], - Doc( - """ - Greater than or equal. If set, value must be greater than or equal to - this. Only applicable to numbers. - """ - ), - ] = None, - lt: Annotated[ - Optional[float], - Doc( - """ - Less than. If set, value must be less than this. Only applicable to numbers. - """ - ), - ] = None, - le: Annotated[ - Optional[float], - Doc( - """ - Less than or equal. If set, value must be less than or equal to this. - Only applicable to numbers. - """ - ), - ] = None, - min_length: Annotated[ - Optional[int], - Doc( - """ - Minimum length for strings. - """ - ), - ] = None, - max_length: Annotated[ - Optional[int], - Doc( - """ - Maximum length for strings. - """ - ), - ] = None, - pattern: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - ] = None, - regex: Annotated[ - Optional[str], - Doc( - """ - RegEx pattern for strings. - """ - ), - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Annotated[ - Union[str, None], - Doc( - """ - Parameter field name for discriminating the type in a tagged union. - """ - ), - ] = None, - strict: Annotated[ - Union[bool, None], - Doc( - """ - If `True`, strict validation is applied to the field. - """ - ), - ] = _Unset, - multiple_of: Annotated[ - Union[float, None], - Doc( - """ - Value must be a multiple of this. Only applicable to numbers. - """ - ), - ] = _Unset, - allow_inf_nan: Annotated[ - Union[bool, None], - Doc( - """ - Allow `inf`, `-inf`, `nan`. Only applicable to numbers. - """ - ), - ] = _Unset, - max_digits: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of allow digits for strings. - """ - ), - ] = _Unset, - decimal_places: Annotated[ - Union[int, None], - Doc( - """ - Maximum number of decimal places allowed for numbers. - """ - ), - ] = _Unset, - examples: Annotated[ - Optional[List[Any]], - Doc( - """ - Example values for this field. - """ - ), - ] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Annotated[ - Optional[Dict[str, Example]], - Doc( - """ - OpenAPI-specific examples. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Swagger UI (that provides the `/docs` interface) has better support for the - OpenAPI-specific examples than the JSON Schema `examples`, that's the main - use case for this. - - Read more about it in the - [FastAPI docs for Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#using-the-openapi_examples-parameter). - """ - ), - ] = None, - deprecated: Annotated[ - Union[deprecated, str, bool, None], - Doc( - """ - Mark this parameter field as deprecated. - - It will affect the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) this parameter field in the generated OpenAPI. - You probably don't need it, but it's available. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - json_schema_extra: Annotated[ - Union[Dict[str, Any], None], - Doc( - """ - Any additional JSON schema data. - """ - ), - ] = None, - **extra: Annotated[ - Any, - Doc( - """ - Include extra fields used by the JSON Schema. - """ - ), - deprecated( - """ - The `extra` kwargs is deprecated. Use `json_schema_extra` instead. - """ - ), - ], -) -> Any: - return params.File( - default=default, - default_factory=default_factory, - media_type=media_type, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - example=example, - examples=examples, - openapi_examples=openapi_examples, - deprecated=deprecated, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -def Depends( # noqa: N802 - dependency: Annotated[ - Optional[Callable[..., Any]], - Doc( - """ - A "dependable" callable (like a function). - - Don't call it directly, FastAPI will call it for you, just pass the object - directly. - """ - ), - ] = None, - *, - use_cache: Annotated[ - bool, - Doc( - """ - By default, after a dependency is called the first time in a request, if - the dependency is declared again for the rest of the request (for example - if the dependency is needed by several dependencies), the value will be - re-used for the rest of the request. - - Set `use_cache` to `False` to disable this behavior and ensure the - dependency is called again (if declared more than once) in the same request. - """ - ), - ] = True, -) -> Any: - """ - Declare a FastAPI dependency. - - It takes a single "dependable" callable (like a function). - - Don't call it directly, FastAPI will call it for you. - - Read more about it in the - [FastAPI docs for Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/). - - **Example** - - ```python - from typing import Annotated - - from fastapi import Depends, FastAPI - - app = FastAPI() - - - async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100): - return {"q": q, "skip": skip, "limit": limit} - - - @app.get("/items/") - async def read_items(commons: Annotated[dict, Depends(common_parameters)]): - return commons - ``` - """ - return params.Depends(dependency=dependency, use_cache=use_cache) - - -def Security( # noqa: N802 - dependency: Annotated[ - Optional[Callable[..., Any]], - Doc( - """ - A "dependable" callable (like a function). - - Don't call it directly, FastAPI will call it for you, just pass the object - directly. - """ - ), - ] = None, - *, - scopes: Annotated[ - Optional[Sequence[str]], - Doc( - """ - OAuth2 scopes required for the *path operation* that uses this Security - dependency. - - The term "scope" comes from the OAuth2 specification, it seems to be - intentionaly vague and interpretable. It normally refers to permissions, - in cases to roles. - - These scopes are integrated with OpenAPI (and the API docs at `/docs`). - So they are visible in the OpenAPI specification. - ) - """ - ), - ] = None, - use_cache: Annotated[ - bool, - Doc( - """ - By default, after a dependency is called the first time in a request, if - the dependency is declared again for the rest of the request (for example - if the dependency is needed by several dependencies), the value will be - re-used for the rest of the request. - - Set `use_cache` to `False` to disable this behavior and ensure the - dependency is called again (if declared more than once) in the same request. - """ - ), - ] = True, -) -> Any: - """ - Declare a FastAPI Security dependency. - - The only difference with a regular dependency is that it can declare OAuth2 - scopes that will be integrated with OpenAPI and the automatic UI docs (by default - at `/docs`). - - It takes a single "dependable" callable (like a function). - - Don't call it directly, FastAPI will call it for you. - - Read more about it in the - [FastAPI docs for Security](https://fastapi.tiangolo.com/tutorial/security/) and - in the - [FastAPI docs for OAuth2 scopes](https://fastapi.tiangolo.com/advanced/security/oauth2-scopes/). - - **Example** - - ```python - from typing import Annotated - - from fastapi import Depends, FastAPI - - from .db import User - from .security import get_current_active_user - - app = FastAPI() - - @app.get("/users/me/items/") - async def read_own_items( - current_user: Annotated[User, Security(get_current_active_user, scopes=["items"])] - ): - return [{"item_id": "Foo", "owner": current_user.username}] - ``` - """ - return params.Security(dependency=dependency, scopes=scopes, use_cache=use_cache) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/params.py b/write-message/venv/lib/python3.10/site-packages/fastapi/params.py deleted file mode 100644 index 8601465..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/params.py +++ /dev/null @@ -1,783 +0,0 @@ -import warnings -from enum import Enum -from typing import Any, Callable, Dict, List, Optional, Sequence, Union - -from fastapi.openapi.models import Example -from pydantic.fields import FieldInfo -from typing_extensions import Annotated, deprecated - -from ._compat import PYDANTIC_V2, PYDANTIC_VERSION, Undefined - -_Unset: Any = Undefined - - -class ParamTypes(Enum): - query = "query" - header = "header" - path = "path" - cookie = "cookie" - - -class Param(FieldInfo): - in_: ParamTypes - - def __init__( - self, - default: Any = Undefined, - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - if example is not _Unset: - warnings.warn( - "`example` has been deprecated, please use `examples` instead", - category=DeprecationWarning, - stacklevel=4, - ) - self.example = example - self.include_in_schema = include_in_schema - self.openapi_examples = openapi_examples - kwargs = dict( - default=default, - default_factory=default_factory, - alias=alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - discriminator=discriminator, - multiple_of=multiple_of, - allow_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - **extra, - ) - if examples is not None: - kwargs["examples"] = examples - if regex is not None: - warnings.warn( - "`regex` has been deprecated, please use `pattern` instead", - category=DeprecationWarning, - stacklevel=4, - ) - current_json_schema_extra = json_schema_extra or extra - if PYDANTIC_VERSION < "2.7.0": - self.deprecated = deprecated - else: - kwargs["deprecated"] = deprecated - if PYDANTIC_V2: - kwargs.update( - { - "annotation": annotation, - "alias_priority": alias_priority, - "validation_alias": validation_alias, - "serialization_alias": serialization_alias, - "strict": strict, - "json_schema_extra": current_json_schema_extra, - } - ) - kwargs["pattern"] = pattern or regex - else: - kwargs["regex"] = pattern or regex - kwargs.update(**current_json_schema_extra) - use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset} - - super().__init__(**use_kwargs) - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({self.default})" - - -class Path(Param): - in_ = ParamTypes.path - - def __init__( - self, - default: Any = ..., - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - assert default is ..., "Path parameters cannot have a default value" - self.in_ = self.in_ - super().__init__( - default=default, - default_factory=default_factory, - annotation=annotation, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - deprecated=deprecated, - example=example, - examples=examples, - openapi_examples=openapi_examples, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -class Query(Param): - in_ = ParamTypes.query - - def __init__( - self, - default: Any = Undefined, - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - super().__init__( - default=default, - default_factory=default_factory, - annotation=annotation, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - deprecated=deprecated, - example=example, - examples=examples, - openapi_examples=openapi_examples, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -class Header(Param): - in_ = ParamTypes.header - - def __init__( - self, - default: Any = Undefined, - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - convert_underscores: bool = True, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - self.convert_underscores = convert_underscores - super().__init__( - default=default, - default_factory=default_factory, - annotation=annotation, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - deprecated=deprecated, - example=example, - examples=examples, - openapi_examples=openapi_examples, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -class Cookie(Param): - in_ = ParamTypes.cookie - - def __init__( - self, - default: Any = Undefined, - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - super().__init__( - default=default, - default_factory=default_factory, - annotation=annotation, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - deprecated=deprecated, - example=example, - examples=examples, - openapi_examples=openapi_examples, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -class Body(FieldInfo): - def __init__( - self, - default: Any = Undefined, - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - embed: bool = False, - media_type: str = "application/json", - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - self.embed = embed - self.media_type = media_type - if example is not _Unset: - warnings.warn( - "`example` has been deprecated, please use `examples` instead", - category=DeprecationWarning, - stacklevel=4, - ) - self.example = example - self.include_in_schema = include_in_schema - self.openapi_examples = openapi_examples - kwargs = dict( - default=default, - default_factory=default_factory, - alias=alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - discriminator=discriminator, - multiple_of=multiple_of, - allow_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - **extra, - ) - if examples is not None: - kwargs["examples"] = examples - if regex is not None: - warnings.warn( - "`regex` has been depreacated, please use `pattern` instead", - category=DeprecationWarning, - stacklevel=4, - ) - current_json_schema_extra = json_schema_extra or extra - if PYDANTIC_VERSION < "2.7.0": - self.deprecated = deprecated - else: - kwargs["deprecated"] = deprecated - if PYDANTIC_V2: - kwargs.update( - { - "annotation": annotation, - "alias_priority": alias_priority, - "validation_alias": validation_alias, - "serialization_alias": serialization_alias, - "strict": strict, - "json_schema_extra": current_json_schema_extra, - } - ) - kwargs["pattern"] = pattern or regex - else: - kwargs["regex"] = pattern or regex - kwargs.update(**current_json_schema_extra) - - use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset} - - super().__init__(**use_kwargs) - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({self.default})" - - -class Form(Body): - def __init__( - self, - default: Any = Undefined, - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - media_type: str = "application/x-www-form-urlencoded", - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - super().__init__( - default=default, - default_factory=default_factory, - annotation=annotation, - embed=True, - media_type=media_type, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - deprecated=deprecated, - example=example, - examples=examples, - openapi_examples=openapi_examples, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -class File(Form): - def __init__( - self, - default: Any = Undefined, - *, - default_factory: Union[Callable[[], Any], None] = _Unset, - annotation: Optional[Any] = None, - media_type: str = "multipart/form-data", - alias: Optional[str] = None, - alias_priority: Union[int, None] = _Unset, - # TODO: update when deprecating Pydantic v1, import these types - # validation_alias: str | AliasPath | AliasChoices | None - validation_alias: Union[str, None] = None, - serialization_alias: Union[str, None] = None, - title: Optional[str] = None, - description: Optional[str] = None, - gt: Optional[float] = None, - ge: Optional[float] = None, - lt: Optional[float] = None, - le: Optional[float] = None, - min_length: Optional[int] = None, - max_length: Optional[int] = None, - pattern: Optional[str] = None, - regex: Annotated[ - Optional[str], - deprecated( - "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." - ), - ] = None, - discriminator: Union[str, None] = None, - strict: Union[bool, None] = _Unset, - multiple_of: Union[float, None] = _Unset, - allow_inf_nan: Union[bool, None] = _Unset, - max_digits: Union[int, None] = _Unset, - decimal_places: Union[int, None] = _Unset, - examples: Optional[List[Any]] = None, - example: Annotated[ - Optional[Any], - deprecated( - "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " - "although still supported. Use examples instead." - ), - ] = _Unset, - openapi_examples: Optional[Dict[str, Example]] = None, - deprecated: Union[deprecated, str, bool, None] = None, - include_in_schema: bool = True, - json_schema_extra: Union[Dict[str, Any], None] = None, - **extra: Any, - ): - super().__init__( - default=default, - default_factory=default_factory, - annotation=annotation, - media_type=media_type, - alias=alias, - alias_priority=alias_priority, - validation_alias=validation_alias, - serialization_alias=serialization_alias, - title=title, - description=description, - gt=gt, - ge=ge, - lt=lt, - le=le, - min_length=min_length, - max_length=max_length, - pattern=pattern, - regex=regex, - discriminator=discriminator, - strict=strict, - multiple_of=multiple_of, - allow_inf_nan=allow_inf_nan, - max_digits=max_digits, - decimal_places=decimal_places, - deprecated=deprecated, - example=example, - examples=examples, - openapi_examples=openapi_examples, - include_in_schema=include_in_schema, - json_schema_extra=json_schema_extra, - **extra, - ) - - -class Depends: - def __init__( - self, dependency: Optional[Callable[..., Any]] = None, *, use_cache: bool = True - ): - self.dependency = dependency - self.use_cache = use_cache - - def __repr__(self) -> str: - attr = getattr(self.dependency, "__name__", type(self.dependency).__name__) - cache = "" if self.use_cache else ", use_cache=False" - return f"{self.__class__.__name__}({attr}{cache})" - - -class Security(Depends): - def __init__( - self, - dependency: Optional[Callable[..., Any]] = None, - *, - scopes: Optional[Sequence[str]] = None, - use_cache: bool = True, - ): - super().__init__(dependency=dependency, use_cache=use_cache) - self.scopes = scopes or [] diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/py.typed b/write-message/venv/lib/python3.10/site-packages/fastapi/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/requests.py b/write-message/venv/lib/python3.10/site-packages/fastapi/requests.py deleted file mode 100644 index d16552c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/requests.py +++ /dev/null @@ -1,2 +0,0 @@ -from starlette.requests import HTTPConnection as HTTPConnection # noqa: F401 -from starlette.requests import Request as Request # noqa: F401 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/responses.py b/write-message/venv/lib/python3.10/site-packages/fastapi/responses.py deleted file mode 100644 index 6c8db6f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/responses.py +++ /dev/null @@ -1,48 +0,0 @@ -from typing import Any - -from starlette.responses import FileResponse as FileResponse # noqa -from starlette.responses import HTMLResponse as HTMLResponse # noqa -from starlette.responses import JSONResponse as JSONResponse # noqa -from starlette.responses import PlainTextResponse as PlainTextResponse # noqa -from starlette.responses import RedirectResponse as RedirectResponse # noqa -from starlette.responses import Response as Response # noqa -from starlette.responses import StreamingResponse as StreamingResponse # noqa - -try: - import ujson -except ImportError: # pragma: nocover - ujson = None # type: ignore - - -try: - import orjson -except ImportError: # pragma: nocover - orjson = None # type: ignore - - -class UJSONResponse(JSONResponse): - """ - JSON response using the high-performance ujson library to serialize data to JSON. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/). - """ - - def render(self, content: Any) -> bytes: - assert ujson is not None, "ujson must be installed to use UJSONResponse" - return ujson.dumps(content, ensure_ascii=False).encode("utf-8") - - -class ORJSONResponse(JSONResponse): - """ - JSON response using the high-performance orjson library to serialize data to JSON. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/). - """ - - def render(self, content: Any) -> bytes: - assert orjson is not None, "orjson must be installed to use ORJSONResponse" - return orjson.dumps( - content, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY - ) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/routing.py b/write-message/venv/lib/python3.10/site-packages/fastapi/routing.py deleted file mode 100644 index fa13518..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/routing.py +++ /dev/null @@ -1,4385 +0,0 @@ -import asyncio -import dataclasses -import email.message -import inspect -import json -from contextlib import AsyncExitStack -from enum import Enum, IntEnum -from typing import ( - Any, - Callable, - Coroutine, - Dict, - List, - Optional, - Sequence, - Set, - Tuple, - Type, - Union, -) - -from fastapi import params -from fastapi._compat import ( - ModelField, - Undefined, - _get_model_config, - _model_dump, - _normalize_errors, - lenient_issubclass, -) -from fastapi.datastructures import Default, DefaultPlaceholder -from fastapi.dependencies.models import Dependant -from fastapi.dependencies.utils import ( - get_body_field, - get_dependant, - get_parameterless_sub_dependant, - get_typed_return_annotation, - solve_dependencies, -) -from fastapi.encoders import jsonable_encoder -from fastapi.exceptions import ( - FastAPIError, - RequestValidationError, - ResponseValidationError, - WebSocketRequestValidationError, -) -from fastapi.types import DecoratedCallable, IncEx -from fastapi.utils import ( - create_cloned_field, - create_response_field, - generate_unique_id, - get_value_or_default, - is_body_allowed_for_status_code, -) -from pydantic import BaseModel -from starlette import routing -from starlette.concurrency import run_in_threadpool -from starlette.exceptions import HTTPException -from starlette.requests import Request -from starlette.responses import JSONResponse, Response -from starlette.routing import ( - BaseRoute, - Match, - compile_path, - get_name, - request_response, - websocket_session, -) -from starlette.routing import Mount as Mount # noqa -from starlette.types import ASGIApp, Lifespan, Scope -from starlette.websockets import WebSocket -from typing_extensions import Annotated, Doc, deprecated - - -def _prepare_response_content( - res: Any, - *, - exclude_unset: bool, - exclude_defaults: bool = False, - exclude_none: bool = False, -) -> Any: - if isinstance(res, BaseModel): - read_with_orm_mode = getattr(_get_model_config(res), "read_with_orm_mode", None) - if read_with_orm_mode: - # Let from_orm extract the data from this model instead of converting - # it now to a dict. - # Otherwise, there's no way to extract lazy data that requires attribute - # access instead of dict iteration, e.g. lazy relationships. - return res - return _model_dump( - res, - by_alias=True, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - ) - elif isinstance(res, list): - return [ - _prepare_response_content( - item, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - ) - for item in res - ] - elif isinstance(res, dict): - return { - k: _prepare_response_content( - v, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - ) - for k, v in res.items() - } - elif dataclasses.is_dataclass(res): - return dataclasses.asdict(res) - return res - - -async def serialize_response( - *, - field: Optional[ModelField] = None, - response_content: Any, - include: Optional[IncEx] = None, - exclude: Optional[IncEx] = None, - by_alias: bool = True, - exclude_unset: bool = False, - exclude_defaults: bool = False, - exclude_none: bool = False, - is_coroutine: bool = True, -) -> Any: - if field: - errors = [] - if not hasattr(field, "serialize"): - # pydantic v1 - response_content = _prepare_response_content( - response_content, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - ) - if is_coroutine: - value, errors_ = field.validate(response_content, {}, loc=("response",)) - else: - value, errors_ = await run_in_threadpool( - field.validate, response_content, {}, loc=("response",) - ) - if isinstance(errors_, list): - errors.extend(errors_) - elif errors_: - errors.append(errors_) - if errors: - raise ResponseValidationError( - errors=_normalize_errors(errors), body=response_content - ) - - if hasattr(field, "serialize"): - return field.serialize( - value, - include=include, - exclude=exclude, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - ) - - return jsonable_encoder( - value, - include=include, - exclude=exclude, - by_alias=by_alias, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, - exclude_none=exclude_none, - ) - else: - return jsonable_encoder(response_content) - - -async def run_endpoint_function( - *, dependant: Dependant, values: Dict[str, Any], is_coroutine: bool -) -> Any: - # Only called by get_request_handler. Has been split into its own function to - # facilitate profiling endpoints, since inner functions are harder to profile. - assert dependant.call is not None, "dependant.call must be a function" - - if is_coroutine: - return await dependant.call(**values) - else: - return await run_in_threadpool(dependant.call, **values) - - -def get_request_handler( - dependant: Dependant, - body_field: Optional[ModelField] = None, - status_code: Optional[int] = None, - response_class: Union[Type[Response], DefaultPlaceholder] = Default(JSONResponse), - response_field: Optional[ModelField] = None, - response_model_include: Optional[IncEx] = None, - response_model_exclude: Optional[IncEx] = None, - response_model_by_alias: bool = True, - response_model_exclude_unset: bool = False, - response_model_exclude_defaults: bool = False, - response_model_exclude_none: bool = False, - dependency_overrides_provider: Optional[Any] = None, -) -> Callable[[Request], Coroutine[Any, Any, Response]]: - assert dependant.call is not None, "dependant.call must be a function" - is_coroutine = asyncio.iscoroutinefunction(dependant.call) - is_body_form = body_field and isinstance(body_field.field_info, params.Form) - if isinstance(response_class, DefaultPlaceholder): - actual_response_class: Type[Response] = response_class.value - else: - actual_response_class = response_class - - async def app(request: Request) -> Response: - response: Union[Response, None] = None - async with AsyncExitStack() as file_stack: - try: - body: Any = None - if body_field: - if is_body_form: - body = await request.form() - file_stack.push_async_callback(body.close) - else: - body_bytes = await request.body() - if body_bytes: - json_body: Any = Undefined - content_type_value = request.headers.get("content-type") - if not content_type_value: - json_body = await request.json() - else: - message = email.message.Message() - message["content-type"] = content_type_value - if message.get_content_maintype() == "application": - subtype = message.get_content_subtype() - if subtype == "json" or subtype.endswith("+json"): - json_body = await request.json() - if json_body != Undefined: - body = json_body - else: - body = body_bytes - except json.JSONDecodeError as e: - validation_error = RequestValidationError( - [ - { - "type": "json_invalid", - "loc": ("body", e.pos), - "msg": "JSON decode error", - "input": {}, - "ctx": {"error": e.msg}, - } - ], - body=e.doc, - ) - raise validation_error from e - except HTTPException: - # If a middleware raises an HTTPException, it should be raised again - raise - except Exception as e: - http_error = HTTPException( - status_code=400, detail="There was an error parsing the body" - ) - raise http_error from e - errors: List[Any] = [] - async with AsyncExitStack() as async_exit_stack: - solved_result = await solve_dependencies( - request=request, - dependant=dependant, - body=body, - dependency_overrides_provider=dependency_overrides_provider, - async_exit_stack=async_exit_stack, - ) - values, errors, background_tasks, sub_response, _ = solved_result - if not errors: - raw_response = await run_endpoint_function( - dependant=dependant, values=values, is_coroutine=is_coroutine - ) - if isinstance(raw_response, Response): - if raw_response.background is None: - raw_response.background = background_tasks - response = raw_response - else: - response_args: Dict[str, Any] = {"background": background_tasks} - # If status_code was set, use it, otherwise use the default from the - # response class, in the case of redirect it's 307 - current_status_code = ( - status_code if status_code else sub_response.status_code - ) - if current_status_code is not None: - response_args["status_code"] = current_status_code - if sub_response.status_code: - response_args["status_code"] = sub_response.status_code - content = await serialize_response( - field=response_field, - response_content=raw_response, - include=response_model_include, - exclude=response_model_exclude, - by_alias=response_model_by_alias, - exclude_unset=response_model_exclude_unset, - exclude_defaults=response_model_exclude_defaults, - exclude_none=response_model_exclude_none, - is_coroutine=is_coroutine, - ) - response = actual_response_class(content, **response_args) - if not is_body_allowed_for_status_code(response.status_code): - response.body = b"" - response.headers.raw.extend(sub_response.headers.raw) - if errors: - validation_error = RequestValidationError( - _normalize_errors(errors), body=body - ) - raise validation_error - if response is None: - raise FastAPIError( - "No response object was returned. There's a high chance that the " - "application code is raising an exception and a dependency with yield " - "has a block with a bare except, or a block with except Exception, " - "and is not raising the exception again. Read more about it in the " - "docs: https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield/#dependencies-with-yield-and-except" - ) - return response - - return app - - -def get_websocket_app( - dependant: Dependant, dependency_overrides_provider: Optional[Any] = None -) -> Callable[[WebSocket], Coroutine[Any, Any, Any]]: - async def app(websocket: WebSocket) -> None: - async with AsyncExitStack() as async_exit_stack: - # TODO: remove this scope later, after a few releases - # This scope fastapi_astack is no longer used by FastAPI, kept for - # compatibility, just in case - websocket.scope["fastapi_astack"] = async_exit_stack - solved_result = await solve_dependencies( - request=websocket, - dependant=dependant, - dependency_overrides_provider=dependency_overrides_provider, - async_exit_stack=async_exit_stack, - ) - values, errors, _, _2, _3 = solved_result - if errors: - raise WebSocketRequestValidationError(_normalize_errors(errors)) - assert dependant.call is not None, "dependant.call must be a function" - await dependant.call(**values) - - return app - - -class APIWebSocketRoute(routing.WebSocketRoute): - def __init__( - self, - path: str, - endpoint: Callable[..., Any], - *, - name: Optional[str] = None, - dependencies: Optional[Sequence[params.Depends]] = None, - dependency_overrides_provider: Optional[Any] = None, - ) -> None: - self.path = path - self.endpoint = endpoint - self.name = get_name(endpoint) if name is None else name - self.dependencies = list(dependencies or []) - self.path_regex, self.path_format, self.param_convertors = compile_path(path) - self.dependant = get_dependant(path=self.path_format, call=self.endpoint) - for depends in self.dependencies[::-1]: - self.dependant.dependencies.insert( - 0, - get_parameterless_sub_dependant(depends=depends, path=self.path_format), - ) - - self.app = websocket_session( - get_websocket_app( - dependant=self.dependant, - dependency_overrides_provider=dependency_overrides_provider, - ) - ) - - def matches(self, scope: Scope) -> Tuple[Match, Scope]: - match, child_scope = super().matches(scope) - if match != Match.NONE: - child_scope["route"] = self - return match, child_scope - - -class APIRoute(routing.Route): - def __init__( - self, - path: str, - endpoint: Callable[..., Any], - *, - response_model: Any = Default(None), - status_code: Optional[int] = None, - tags: Optional[List[Union[str, Enum]]] = None, - dependencies: Optional[Sequence[params.Depends]] = None, - summary: Optional[str] = None, - description: Optional[str] = None, - response_description: str = "Successful Response", - responses: Optional[Dict[Union[int, str], Dict[str, Any]]] = None, - deprecated: Optional[bool] = None, - name: Optional[str] = None, - methods: Optional[Union[Set[str], List[str]]] = None, - operation_id: Optional[str] = None, - response_model_include: Optional[IncEx] = None, - response_model_exclude: Optional[IncEx] = None, - response_model_by_alias: bool = True, - response_model_exclude_unset: bool = False, - response_model_exclude_defaults: bool = False, - response_model_exclude_none: bool = False, - include_in_schema: bool = True, - response_class: Union[Type[Response], DefaultPlaceholder] = Default( - JSONResponse - ), - dependency_overrides_provider: Optional[Any] = None, - callbacks: Optional[List[BaseRoute]] = None, - openapi_extra: Optional[Dict[str, Any]] = None, - generate_unique_id_function: Union[ - Callable[["APIRoute"], str], DefaultPlaceholder - ] = Default(generate_unique_id), - ) -> None: - self.path = path - self.endpoint = endpoint - if isinstance(response_model, DefaultPlaceholder): - return_annotation = get_typed_return_annotation(endpoint) - if lenient_issubclass(return_annotation, Response): - response_model = None - else: - response_model = return_annotation - self.response_model = response_model - self.summary = summary - self.response_description = response_description - self.deprecated = deprecated - self.operation_id = operation_id - self.response_model_include = response_model_include - self.response_model_exclude = response_model_exclude - self.response_model_by_alias = response_model_by_alias - self.response_model_exclude_unset = response_model_exclude_unset - self.response_model_exclude_defaults = response_model_exclude_defaults - self.response_model_exclude_none = response_model_exclude_none - self.include_in_schema = include_in_schema - self.response_class = response_class - self.dependency_overrides_provider = dependency_overrides_provider - self.callbacks = callbacks - self.openapi_extra = openapi_extra - self.generate_unique_id_function = generate_unique_id_function - self.tags = tags or [] - self.responses = responses or {} - self.name = get_name(endpoint) if name is None else name - self.path_regex, self.path_format, self.param_convertors = compile_path(path) - if methods is None: - methods = ["GET"] - self.methods: Set[str] = {method.upper() for method in methods} - if isinstance(generate_unique_id_function, DefaultPlaceholder): - current_generate_unique_id: Callable[ - ["APIRoute"], str - ] = generate_unique_id_function.value - else: - current_generate_unique_id = generate_unique_id_function - self.unique_id = self.operation_id or current_generate_unique_id(self) - # normalize enums e.g. http.HTTPStatus - if isinstance(status_code, IntEnum): - status_code = int(status_code) - self.status_code = status_code - if self.response_model: - assert is_body_allowed_for_status_code( - status_code - ), f"Status code {status_code} must not have a response body" - response_name = "Response_" + self.unique_id - self.response_field = create_response_field( - name=response_name, - type_=self.response_model, - mode="serialization", - ) - # Create a clone of the field, so that a Pydantic submodel is not returned - # as is just because it's an instance of a subclass of a more limited class - # e.g. UserInDB (containing hashed_password) could be a subclass of User - # that doesn't have the hashed_password. But because it's a subclass, it - # would pass the validation and be returned as is. - # By being a new field, no inheritance will be passed as is. A new model - # will always be created. - # TODO: remove when deprecating Pydantic v1 - self.secure_cloned_response_field: Optional[ - ModelField - ] = create_cloned_field(self.response_field) - else: - self.response_field = None # type: ignore - self.secure_cloned_response_field = None - self.dependencies = list(dependencies or []) - self.description = description or inspect.cleandoc(self.endpoint.__doc__ or "") - # if a "form feed" character (page break) is found in the description text, - # truncate description text to the content preceding the first "form feed" - self.description = self.description.split("\f")[0].strip() - response_fields = {} - for additional_status_code, response in self.responses.items(): - assert isinstance(response, dict), "An additional response must be a dict" - model = response.get("model") - if model: - assert is_body_allowed_for_status_code( - additional_status_code - ), f"Status code {additional_status_code} must not have a response body" - response_name = f"Response_{additional_status_code}_{self.unique_id}" - response_field = create_response_field(name=response_name, type_=model) - response_fields[additional_status_code] = response_field - if response_fields: - self.response_fields: Dict[Union[int, str], ModelField] = response_fields - else: - self.response_fields = {} - - assert callable(endpoint), "An endpoint must be a callable" - self.dependant = get_dependant(path=self.path_format, call=self.endpoint) - for depends in self.dependencies[::-1]: - self.dependant.dependencies.insert( - 0, - get_parameterless_sub_dependant(depends=depends, path=self.path_format), - ) - self.body_field = get_body_field(dependant=self.dependant, name=self.unique_id) - self.app = request_response(self.get_route_handler()) - - def get_route_handler(self) -> Callable[[Request], Coroutine[Any, Any, Response]]: - return get_request_handler( - dependant=self.dependant, - body_field=self.body_field, - status_code=self.status_code, - response_class=self.response_class, - response_field=self.secure_cloned_response_field, - response_model_include=self.response_model_include, - response_model_exclude=self.response_model_exclude, - response_model_by_alias=self.response_model_by_alias, - response_model_exclude_unset=self.response_model_exclude_unset, - response_model_exclude_defaults=self.response_model_exclude_defaults, - response_model_exclude_none=self.response_model_exclude_none, - dependency_overrides_provider=self.dependency_overrides_provider, - ) - - def matches(self, scope: Scope) -> Tuple[Match, Scope]: - match, child_scope = super().matches(scope) - if match != Match.NONE: - child_scope["route"] = self - return match, child_scope - - -class APIRouter(routing.Router): - """ - `APIRouter` class, used to group *path operations*, for example to structure - an app in multiple files. It would then be included in the `FastAPI` app, or - in another `APIRouter` (ultimately included in the app). - - Read more about it in the - [FastAPI docs for Bigger Applications - Multiple Files](https://fastapi.tiangolo.com/tutorial/bigger-applications/). - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - - app = FastAPI() - router = APIRouter() - - - @router.get("/users/", tags=["users"]) - async def read_users(): - return [{"username": "Rick"}, {"username": "Morty"}] - - - app.include_router(router) - ``` - """ - - def __init__( - self, - *, - prefix: Annotated[str, Doc("An optional path prefix for the router.")] = "", - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to all the *path operations* in this - router. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to all the - *path operations* in this router. - - Read more about it in the - [FastAPI docs for Bigger Applications - Multiple Files](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies). - """ - ), - ] = None, - default_response_class: Annotated[ - Type[Response], - Doc( - """ - The default response class to be used. - - Read more in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class). - """ - ), - ] = Default(JSONResponse), - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses to be shown in OpenAPI. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Additional Responses in OpenAPI](https://fastapi.tiangolo.com/advanced/additional-responses/). - - And in the - [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies). - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - OpenAPI callbacks that should apply to all *path operations* in this - router. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - routes: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - **Note**: you probably shouldn't use this parameter, it is inherited - from Starlette and supported for compatibility. - - --- - - A list of routes to serve incoming HTTP and WebSocket requests. - """ - ), - deprecated( - """ - You normally wouldn't use this parameter with FastAPI, it is inherited - from Starlette and supported for compatibility. - - In FastAPI, you normally would use the *path operation methods*, - like `router.get()`, `router.post()`, etc. - """ - ), - ] = None, - redirect_slashes: Annotated[ - bool, - Doc( - """ - Whether to detect and redirect slashes in URLs when the client doesn't - use the same format. - """ - ), - ] = True, - default: Annotated[ - Optional[ASGIApp], - Doc( - """ - Default function handler for this router. Used to handle - 404 Not Found errors. - """ - ), - ] = None, - dependency_overrides_provider: Annotated[ - Optional[Any], - Doc( - """ - Only used internally by FastAPI to handle dependency overrides. - - You shouldn't need to use it. It normally points to the `FastAPI` app - object. - """ - ), - ] = None, - route_class: Annotated[ - Type[APIRoute], - Doc( - """ - Custom route (*path operation*) class to be used by this router. - - Read more about it in the - [FastAPI docs for Custom Request and APIRoute class](https://fastapi.tiangolo.com/how-to/custom-request-and-route/#custom-apiroute-class-in-a-router). - """ - ), - ] = APIRoute, - on_startup: Annotated[ - Optional[Sequence[Callable[[], Any]]], - Doc( - """ - A list of startup event handler functions. - - You should instead use the `lifespan` handlers. - - Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). - """ - ), - ] = None, - on_shutdown: Annotated[ - Optional[Sequence[Callable[[], Any]]], - Doc( - """ - A list of shutdown event handler functions. - - You should instead use the `lifespan` handlers. - - Read more in the - [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). - """ - ), - ] = None, - # the generic to Lifespan[AppType] is the type of the top level application - # which the router cannot know statically, so we use typing.Any - lifespan: Annotated[ - Optional[Lifespan[Any]], - Doc( - """ - A `Lifespan` context manager handler. This replaces `startup` and - `shutdown` functions with a single context manager. - - Read more in the - [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark all *path operations* in this router as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - To include (or not) all the *path operations* in this router in the - generated OpenAPI. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> None: - super().__init__( - routes=routes, - redirect_slashes=redirect_slashes, - default=default, - on_startup=on_startup, - on_shutdown=on_shutdown, - lifespan=lifespan, - ) - if prefix: - assert prefix.startswith("/"), "A path prefix must start with '/'" - assert not prefix.endswith( - "/" - ), "A path prefix must not end with '/', as the routes will start with '/'" - self.prefix = prefix - self.tags: List[Union[str, Enum]] = tags or [] - self.dependencies = list(dependencies or []) - self.deprecated = deprecated - self.include_in_schema = include_in_schema - self.responses = responses or {} - self.callbacks = callbacks or [] - self.dependency_overrides_provider = dependency_overrides_provider - self.route_class = route_class - self.default_response_class = default_response_class - self.generate_unique_id_function = generate_unique_id_function - - def route( - self, - path: str, - methods: Optional[List[str]] = None, - name: Optional[str] = None, - include_in_schema: bool = True, - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_route( - path, - func, - methods=methods, - name=name, - include_in_schema=include_in_schema, - ) - return func - - return decorator - - def add_api_route( - self, - path: str, - endpoint: Callable[..., Any], - *, - response_model: Any = Default(None), - status_code: Optional[int] = None, - tags: Optional[List[Union[str, Enum]]] = None, - dependencies: Optional[Sequence[params.Depends]] = None, - summary: Optional[str] = None, - description: Optional[str] = None, - response_description: str = "Successful Response", - responses: Optional[Dict[Union[int, str], Dict[str, Any]]] = None, - deprecated: Optional[bool] = None, - methods: Optional[Union[Set[str], List[str]]] = None, - operation_id: Optional[str] = None, - response_model_include: Optional[IncEx] = None, - response_model_exclude: Optional[IncEx] = None, - response_model_by_alias: bool = True, - response_model_exclude_unset: bool = False, - response_model_exclude_defaults: bool = False, - response_model_exclude_none: bool = False, - include_in_schema: bool = True, - response_class: Union[Type[Response], DefaultPlaceholder] = Default( - JSONResponse - ), - name: Optional[str] = None, - route_class_override: Optional[Type[APIRoute]] = None, - callbacks: Optional[List[BaseRoute]] = None, - openapi_extra: Optional[Dict[str, Any]] = None, - generate_unique_id_function: Union[ - Callable[[APIRoute], str], DefaultPlaceholder - ] = Default(generate_unique_id), - ) -> None: - route_class = route_class_override or self.route_class - responses = responses or {} - combined_responses = {**self.responses, **responses} - current_response_class = get_value_or_default( - response_class, self.default_response_class - ) - current_tags = self.tags.copy() - if tags: - current_tags.extend(tags) - current_dependencies = self.dependencies.copy() - if dependencies: - current_dependencies.extend(dependencies) - current_callbacks = self.callbacks.copy() - if callbacks: - current_callbacks.extend(callbacks) - current_generate_unique_id = get_value_or_default( - generate_unique_id_function, self.generate_unique_id_function - ) - route = route_class( - self.prefix + path, - endpoint=endpoint, - response_model=response_model, - status_code=status_code, - tags=current_tags, - dependencies=current_dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=combined_responses, - deprecated=deprecated or self.deprecated, - methods=methods, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema and self.include_in_schema, - response_class=current_response_class, - name=name, - dependency_overrides_provider=self.dependency_overrides_provider, - callbacks=current_callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=current_generate_unique_id, - ) - self.routes.append(route) - - def api_route( - self, - path: str, - *, - response_model: Any = Default(None), - status_code: Optional[int] = None, - tags: Optional[List[Union[str, Enum]]] = None, - dependencies: Optional[Sequence[params.Depends]] = None, - summary: Optional[str] = None, - description: Optional[str] = None, - response_description: str = "Successful Response", - responses: Optional[Dict[Union[int, str], Dict[str, Any]]] = None, - deprecated: Optional[bool] = None, - methods: Optional[List[str]] = None, - operation_id: Optional[str] = None, - response_model_include: Optional[IncEx] = None, - response_model_exclude: Optional[IncEx] = None, - response_model_by_alias: bool = True, - response_model_exclude_unset: bool = False, - response_model_exclude_defaults: bool = False, - response_model_exclude_none: bool = False, - include_in_schema: bool = True, - response_class: Type[Response] = Default(JSONResponse), - name: Optional[str] = None, - callbacks: Optional[List[BaseRoute]] = None, - openapi_extra: Optional[Dict[str, Any]] = None, - generate_unique_id_function: Callable[[APIRoute], str] = Default( - generate_unique_id - ), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_api_route( - path, - func, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=methods, - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - return func - - return decorator - - def add_api_websocket_route( - self, - path: str, - endpoint: Callable[..., Any], - name: Optional[str] = None, - *, - dependencies: Optional[Sequence[params.Depends]] = None, - ) -> None: - current_dependencies = self.dependencies.copy() - if dependencies: - current_dependencies.extend(dependencies) - - route = APIWebSocketRoute( - self.prefix + path, - endpoint=endpoint, - name=name, - dependencies=current_dependencies, - dependency_overrides_provider=self.dependency_overrides_provider, - ) - self.routes.append(route) - - def websocket( - self, - path: Annotated[ - str, - Doc( - """ - WebSocket path. - """ - ), - ], - name: Annotated[ - Optional[str], - Doc( - """ - A name for the WebSocket. Only used internally. - """ - ), - ] = None, - *, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be used for this - WebSocket. - - Read more about it in the - [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/). - """ - ), - ] = None, - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Decorate a WebSocket function. - - Read more about it in the - [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/). - - **Example** - - ## Example - - ```python - from fastapi import APIRouter, FastAPI, WebSocket - - app = FastAPI() - router = APIRouter() - - @router.websocket("/ws") - async def websocket_endpoint(websocket: WebSocket): - await websocket.accept() - while True: - data = await websocket.receive_text() - await websocket.send_text(f"Message text was: {data}") - - app.include_router(router) - ``` - """ - - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_api_websocket_route( - path, func, name=name, dependencies=dependencies - ) - return func - - return decorator - - def websocket_route( - self, path: str, name: Union[str, None] = None - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_websocket_route(path, func, name=name) - return func - - return decorator - - def include_router( - self, - router: Annotated["APIRouter", Doc("The `APIRouter` to include.")], - *, - prefix: Annotated[str, Doc("An optional path prefix for the router.")] = "", - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to all the *path operations* in this - router. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to all the - *path operations* in this router. - - Read more about it in the - [FastAPI docs for Bigger Applications - Multiple Files](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies). - """ - ), - ] = None, - default_response_class: Annotated[ - Type[Response], - Doc( - """ - The default response class to be used. - - Read more in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class). - """ - ), - ] = Default(JSONResponse), - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses to be shown in OpenAPI. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Additional Responses in OpenAPI](https://fastapi.tiangolo.com/advanced/additional-responses/). - - And in the - [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies). - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - OpenAPI callbacks that should apply to all *path operations* in this - router. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark all *path operations* in this router as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include (or not) all the *path operations* in this router in the - generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = True, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> None: - """ - Include another `APIRouter` in the same current `APIRouter`. - - Read more about it in the - [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/). - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - - app = FastAPI() - internal_router = APIRouter() - users_router = APIRouter() - - @users_router.get("/users/") - def read_users(): - return [{"name": "Rick"}, {"name": "Morty"}] - - internal_router.include_router(users_router) - app.include_router(internal_router) - ``` - """ - if prefix: - assert prefix.startswith("/"), "A path prefix must start with '/'" - assert not prefix.endswith( - "/" - ), "A path prefix must not end with '/', as the routes will start with '/'" - else: - for r in router.routes: - path = getattr(r, "path") # noqa: B009 - name = getattr(r, "name", "unknown") - if path is not None and not path: - raise FastAPIError( - f"Prefix and path cannot be both empty (path operation: {name})" - ) - if responses is None: - responses = {} - for route in router.routes: - if isinstance(route, APIRoute): - combined_responses = {**responses, **route.responses} - use_response_class = get_value_or_default( - route.response_class, - router.default_response_class, - default_response_class, - self.default_response_class, - ) - current_tags = [] - if tags: - current_tags.extend(tags) - if route.tags: - current_tags.extend(route.tags) - current_dependencies: List[params.Depends] = [] - if dependencies: - current_dependencies.extend(dependencies) - if route.dependencies: - current_dependencies.extend(route.dependencies) - current_callbacks = [] - if callbacks: - current_callbacks.extend(callbacks) - if route.callbacks: - current_callbacks.extend(route.callbacks) - current_generate_unique_id = get_value_or_default( - route.generate_unique_id_function, - router.generate_unique_id_function, - generate_unique_id_function, - self.generate_unique_id_function, - ) - self.add_api_route( - prefix + route.path, - route.endpoint, - response_model=route.response_model, - status_code=route.status_code, - tags=current_tags, - dependencies=current_dependencies, - summary=route.summary, - description=route.description, - response_description=route.response_description, - responses=combined_responses, - deprecated=route.deprecated or deprecated or self.deprecated, - methods=route.methods, - operation_id=route.operation_id, - response_model_include=route.response_model_include, - response_model_exclude=route.response_model_exclude, - response_model_by_alias=route.response_model_by_alias, - response_model_exclude_unset=route.response_model_exclude_unset, - response_model_exclude_defaults=route.response_model_exclude_defaults, - response_model_exclude_none=route.response_model_exclude_none, - include_in_schema=route.include_in_schema - and self.include_in_schema - and include_in_schema, - response_class=use_response_class, - name=route.name, - route_class_override=type(route), - callbacks=current_callbacks, - openapi_extra=route.openapi_extra, - generate_unique_id_function=current_generate_unique_id, - ) - elif isinstance(route, routing.Route): - methods = list(route.methods or []) - self.add_route( - prefix + route.path, - route.endpoint, - methods=methods, - include_in_schema=route.include_in_schema, - name=route.name, - ) - elif isinstance(route, APIWebSocketRoute): - current_dependencies = [] - if dependencies: - current_dependencies.extend(dependencies) - if route.dependencies: - current_dependencies.extend(route.dependencies) - self.add_api_websocket_route( - prefix + route.path, - route.endpoint, - dependencies=current_dependencies, - name=route.name, - ) - elif isinstance(route, routing.WebSocketRoute): - self.add_websocket_route( - prefix + route.path, route.endpoint, name=route.name - ) - for handler in router.on_startup: - self.add_event_handler("startup", handler) - for handler in router.on_shutdown: - self.add_event_handler("shutdown", handler) - - def get( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP GET operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - - app = FastAPI() - router = APIRouter() - - @router.get("/items/") - def read_items(): - return [{"name": "Empanada"}, {"name": "Arepa"}] - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["GET"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def put( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP PUT operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - router = APIRouter() - - @router.put("/items/{item_id}") - def replace_item(item_id: str, item: Item): - return {"message": "Item replaced", "id": item_id} - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["PUT"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def post( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP POST operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - router = APIRouter() - - @router.post("/items/") - def create_item(item: Item): - return {"message": "Item created"} - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["POST"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def delete( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP DELETE operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - - app = FastAPI() - router = APIRouter() - - @router.delete("/items/{item_id}") - def delete_item(item_id: str): - return {"message": "Item deleted"} - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["DELETE"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def options( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP OPTIONS operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - - app = FastAPI() - router = APIRouter() - - @router.options("/items/") - def get_item_options(): - return {"additions": ["Aji", "Guacamole"]} - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["OPTIONS"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def head( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP HEAD operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - router = APIRouter() - - @router.head("/items/", status_code=204) - def get_items_headers(response: Response): - response.headers["X-Cat-Dog"] = "Alone in the world" - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["HEAD"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def patch( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP PATCH operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - router = APIRouter() - - @router.patch("/items/") - def update_item(item: Item): - return {"message": "Item updated in place"} - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["PATCH"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - def trace( - self, - path: Annotated[ - str, - Doc( - """ - The URL path to be used for this *path operation*. - - For example, in `http://example.com/items`, the path is `/items`. - """ - ), - ], - *, - response_model: Annotated[ - Any, - Doc( - """ - The type to use for the response. - - It could be any valid Pydantic *field* type. So, it doesn't have to - be a Pydantic model, it could be other things, like a `list`, `dict`, - etc. - - It will be used for: - - * Documentation: the generated OpenAPI (and the UI at `/docs`) will - show it as the response (JSON Schema). - * Serialization: you could return an arbitrary object and the - `response_model` would be used to serialize that object into the - corresponding JSON. - * Filtering: the JSON sent to the client will only contain the data - (fields) defined in the `response_model`. If you returned an object - that contains an attribute `password` but the `response_model` does - not include that field, the JSON sent to the client would not have - that `password`. - * Validation: whatever you return will be serialized with the - `response_model`, converting any data as necessary to generate the - corresponding JSON. But if the data in the object returned is not - valid, that would mean a violation of the contract with the client, - so it's an error from the API developer. So, FastAPI will raise an - error and return a 500 error code (Internal Server Error). - - Read more about it in the - [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). - """ - ), - ] = Default(None), - status_code: Annotated[ - Optional[int], - Doc( - """ - The default status code to be used for the response. - - You could override the status code by returning a response directly. - - Read more about it in the - [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/). - """ - ), - ] = None, - tags: Annotated[ - Optional[List[Union[str, Enum]]], - Doc( - """ - A list of tags to be applied to the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags). - """ - ), - ] = None, - dependencies: Annotated[ - Optional[Sequence[params.Depends]], - Doc( - """ - A list of dependencies (using `Depends()`) to be applied to the - *path operation*. - - Read more about it in the - [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/). - """ - ), - ] = None, - summary: Annotated[ - Optional[str], - Doc( - """ - A summary for the *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - A description for the *path operation*. - - If not provided, it will be extracted automatically from the docstring - of the *path operation function*. - - It can contain Markdown. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/). - """ - ), - ] = None, - response_description: Annotated[ - str, - Doc( - """ - The description for the default response. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = "Successful Response", - responses: Annotated[ - Optional[Dict[Union[int, str], Dict[str, Any]]], - Doc( - """ - Additional responses that could be returned by this *path operation*. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - deprecated: Annotated[ - Optional[bool], - Doc( - """ - Mark this *path operation* as deprecated. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - operation_id: Annotated[ - Optional[str], - Doc( - """ - Custom operation ID to be used by this *path operation*. - - By default, it is generated automatically. - - If you provide a custom operation ID, you need to make sure it is - unique for the whole API. - - You can customize the - operation ID generation with the parameter - `generate_unique_id_function` in the `FastAPI` class. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = None, - response_model_include: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to include only certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_exclude: Annotated[ - Optional[IncEx], - Doc( - """ - Configuration passed to Pydantic to exclude certain fields in the - response data. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = None, - response_model_by_alias: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response model - should be serialized by alias when an alias is used. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude). - """ - ), - ] = True, - response_model_exclude_unset: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that were not set and - have their default values. This is different from - `response_model_exclude_defaults` in that if the fields are set, - they will be included in the response, even if the value is the same - as the default. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_defaults: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data - should have all the fields, including the ones that have the same value - as the default. This is different from `response_model_exclude_unset` - in that if the fields are set but contain the same default values, - they will be excluded from the response. - - When `True`, default values are omitted from the response. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter). - """ - ), - ] = False, - response_model_exclude_none: Annotated[ - bool, - Doc( - """ - Configuration passed to Pydantic to define if the response data should - exclude fields set to `None`. - - This is much simpler (less smart) than `response_model_exclude_unset` - and `response_model_exclude_defaults`. You probably want to use one of - those two instead of this one, as those allow returning `None` values - when it makes sense. - - Read more about it in the - [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none). - """ - ), - ] = False, - include_in_schema: Annotated[ - bool, - Doc( - """ - Include this *path operation* in the generated OpenAPI schema. - - This affects the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi). - """ - ), - ] = True, - response_class: Annotated[ - Type[Response], - Doc( - """ - Response class to be used for this *path operation*. - - This will not be used if you return a response directly. - - Read more about it in the - [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse). - """ - ), - ] = Default(JSONResponse), - name: Annotated[ - Optional[str], - Doc( - """ - Name for this *path operation*. Only used internally. - """ - ), - ] = None, - callbacks: Annotated[ - Optional[List[BaseRoute]], - Doc( - """ - List of *path operations* that will be used as OpenAPI callbacks. - - This is only for OpenAPI documentation, the callbacks won't be used - directly. - - It will be added to the generated OpenAPI (e.g. visible at `/docs`). - - Read more about it in the - [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/). - """ - ), - ] = None, - openapi_extra: Annotated[ - Optional[Dict[str, Any]], - Doc( - """ - Extra metadata to be included in the OpenAPI schema for this *path - operation*. - - Read more about it in the - [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema). - """ - ), - ] = None, - generate_unique_id_function: Annotated[ - Callable[[APIRoute], str], - Doc( - """ - Customize the function used to generate unique IDs for the *path - operations* shown in the generated OpenAPI. - - This is particularly useful when automatically generating clients or - SDKs for your API. - - Read more about it in the - [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function). - """ - ), - ] = Default(generate_unique_id), - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add a *path operation* using an HTTP TRACE operation. - - ## Example - - ```python - from fastapi import APIRouter, FastAPI - from pydantic import BaseModel - - class Item(BaseModel): - name: str - description: str | None = None - - app = FastAPI() - router = APIRouter() - - @router.trace("/items/{item_id}") - def trace_item(item_id: str): - return None - - app.include_router(router) - ``` - """ - return self.api_route( - path=path, - response_model=response_model, - status_code=status_code, - tags=tags, - dependencies=dependencies, - summary=summary, - description=description, - response_description=response_description, - responses=responses, - deprecated=deprecated, - methods=["TRACE"], - operation_id=operation_id, - response_model_include=response_model_include, - response_model_exclude=response_model_exclude, - response_model_by_alias=response_model_by_alias, - response_model_exclude_unset=response_model_exclude_unset, - response_model_exclude_defaults=response_model_exclude_defaults, - response_model_exclude_none=response_model_exclude_none, - include_in_schema=include_in_schema, - response_class=response_class, - name=name, - callbacks=callbacks, - openapi_extra=openapi_extra, - generate_unique_id_function=generate_unique_id_function, - ) - - @deprecated( - """ - on_event is deprecated, use lifespan event handlers instead. - - Read more about it in the - [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/). - """ - ) - def on_event( - self, - event_type: Annotated[ - str, - Doc( - """ - The type of event. `startup` or `shutdown`. - """ - ), - ], - ) -> Callable[[DecoratedCallable], DecoratedCallable]: - """ - Add an event handler for the router. - - `on_event` is deprecated, use `lifespan` event handlers instead. - - Read more about it in the - [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/#alternative-events-deprecated). - """ - - def decorator(func: DecoratedCallable) -> DecoratedCallable: - self.add_event_handler(event_type, func) - return func - - return decorator diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__init__.py b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__init__.py deleted file mode 100644 index 3aa6bf2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -from .api_key import APIKeyCookie as APIKeyCookie -from .api_key import APIKeyHeader as APIKeyHeader -from .api_key import APIKeyQuery as APIKeyQuery -from .http import HTTPAuthorizationCredentials as HTTPAuthorizationCredentials -from .http import HTTPBasic as HTTPBasic -from .http import HTTPBasicCredentials as HTTPBasicCredentials -from .http import HTTPBearer as HTTPBearer -from .http import HTTPDigest as HTTPDigest -from .oauth2 import OAuth2 as OAuth2 -from .oauth2 import OAuth2AuthorizationCodeBearer as OAuth2AuthorizationCodeBearer -from .oauth2 import OAuth2PasswordBearer as OAuth2PasswordBearer -from .oauth2 import OAuth2PasswordRequestForm as OAuth2PasswordRequestForm -from .oauth2 import OAuth2PasswordRequestFormStrict as OAuth2PasswordRequestFormStrict -from .oauth2 import SecurityScopes as SecurityScopes -from .open_id_connect_url import OpenIdConnect as OpenIdConnect diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 48371f8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/api_key.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/api_key.cpython-310.pyc deleted file mode 100644 index 2ab6a36..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/api_key.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/base.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/base.cpython-310.pyc deleted file mode 100644 index 90deae3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/base.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/http.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/http.cpython-310.pyc deleted file mode 100644 index c998161..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/http.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/oauth2.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/oauth2.cpython-310.pyc deleted file mode 100644 index 4dffcda..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/oauth2.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/open_id_connect_url.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/open_id_connect_url.cpython-310.pyc deleted file mode 100644 index 7950fec..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/open_id_connect_url.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/utils.cpython-310.pyc deleted file mode 100644 index 2e89747..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi/security/__pycache__/utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/api_key.py b/write-message/venv/lib/python3.10/site-packages/fastapi/security/api_key.py deleted file mode 100644 index d68bdb0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/security/api_key.py +++ /dev/null @@ -1,301 +0,0 @@ -from typing import Optional - -from fastapi.openapi.models import APIKey, APIKeyIn -from fastapi.security.base import SecurityBase -from starlette.exceptions import HTTPException -from starlette.requests import Request -from starlette.status import HTTP_403_FORBIDDEN -from typing_extensions import Annotated, Doc - - -class APIKeyBase(SecurityBase): - pass - - -class APIKeyQuery(APIKeyBase): - """ - API key authentication using a query parameter. - - This defines the name of the query parameter that should be provided in the request - with the API key and integrates that into the OpenAPI documentation. It extracts - the key value sent in the query parameter automatically and provides it as the - dependency result. But it doesn't define how to send that API key to the client. - - ## Usage - - Create an instance object and use that object as the dependency in `Depends()`. - - The dependency result will be a string containing the key value. - - ## Example - - ```python - from fastapi import Depends, FastAPI - from fastapi.security import APIKeyQuery - - app = FastAPI() - - query_scheme = APIKeyQuery(name="api_key") - - - @app.get("/items/") - async def read_items(api_key: str = Depends(query_scheme)): - return {"api_key": api_key} - ``` - """ - - def __init__( - self, - *, - name: Annotated[ - str, - Doc("Query parameter name."), - ], - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if the query parameter is not provided, `APIKeyQuery` will - automatically cancel the request and send the client an error. - - If `auto_error` is set to `False`, when the query parameter is not - available, instead of erroring out, the dependency result will be - `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, in a query - parameter or in an HTTP Bearer token). - """ - ), - ] = True, - ): - self.model: APIKey = APIKey( - **{"in": APIKeyIn.query}, # type: ignore[arg-type] - name=name, - description=description, - ) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__(self, request: Request) -> Optional[str]: - api_key = request.query_params.get(self.model.name) - if not api_key: - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - return api_key - - -class APIKeyHeader(APIKeyBase): - """ - API key authentication using a header. - - This defines the name of the header that should be provided in the request with - the API key and integrates that into the OpenAPI documentation. It extracts - the key value sent in the header automatically and provides it as the dependency - result. But it doesn't define how to send that key to the client. - - ## Usage - - Create an instance object and use that object as the dependency in `Depends()`. - - The dependency result will be a string containing the key value. - - ## Example - - ```python - from fastapi import Depends, FastAPI - from fastapi.security import APIKeyHeader - - app = FastAPI() - - header_scheme = APIKeyHeader(name="x-key") - - - @app.get("/items/") - async def read_items(key: str = Depends(header_scheme)): - return {"key": key} - ``` - """ - - def __init__( - self, - *, - name: Annotated[str, Doc("Header name.")], - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if the header is not provided, `APIKeyHeader` will - automatically cancel the request and send the client an error. - - If `auto_error` is set to `False`, when the header is not available, - instead of erroring out, the dependency result will be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, in a header or - in an HTTP Bearer token). - """ - ), - ] = True, - ): - self.model: APIKey = APIKey( - **{"in": APIKeyIn.header}, # type: ignore[arg-type] - name=name, - description=description, - ) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__(self, request: Request) -> Optional[str]: - api_key = request.headers.get(self.model.name) - if not api_key: - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - return api_key - - -class APIKeyCookie(APIKeyBase): - """ - API key authentication using a cookie. - - This defines the name of the cookie that should be provided in the request with - the API key and integrates that into the OpenAPI documentation. It extracts - the key value sent in the cookie automatically and provides it as the dependency - result. But it doesn't define how to set that cookie. - - ## Usage - - Create an instance object and use that object as the dependency in `Depends()`. - - The dependency result will be a string containing the key value. - - ## Example - - ```python - from fastapi import Depends, FastAPI - from fastapi.security import APIKeyCookie - - app = FastAPI() - - cookie_scheme = APIKeyCookie(name="session") - - - @app.get("/items/") - async def read_items(session: str = Depends(cookie_scheme)): - return {"session": session} - ``` - """ - - def __init__( - self, - *, - name: Annotated[str, Doc("Cookie name.")], - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if the cookie is not provided, `APIKeyCookie` will - automatically cancel the request and send the client an error. - - If `auto_error` is set to `False`, when the cookie is not available, - instead of erroring out, the dependency result will be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, in a cookie or - in an HTTP Bearer token). - """ - ), - ] = True, - ): - self.model: APIKey = APIKey( - **{"in": APIKeyIn.cookie}, # type: ignore[arg-type] - name=name, - description=description, - ) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__(self, request: Request) -> Optional[str]: - api_key = request.cookies.get(self.model.name) - if not api_key: - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - return api_key diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/base.py b/write-message/venv/lib/python3.10/site-packages/fastapi/security/base.py deleted file mode 100644 index c43555d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/security/base.py +++ /dev/null @@ -1,6 +0,0 @@ -from fastapi.openapi.models import SecurityBase as SecurityBaseModel - - -class SecurityBase: - model: SecurityBaseModel - scheme_name: str diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/http.py b/write-message/venv/lib/python3.10/site-packages/fastapi/security/http.py deleted file mode 100644 index a142b13..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/security/http.py +++ /dev/null @@ -1,420 +0,0 @@ -import binascii -from base64 import b64decode -from typing import Optional - -from fastapi.exceptions import HTTPException -from fastapi.openapi.models import HTTPBase as HTTPBaseModel -from fastapi.openapi.models import HTTPBearer as HTTPBearerModel -from fastapi.security.base import SecurityBase -from fastapi.security.utils import get_authorization_scheme_param -from pydantic import BaseModel -from starlette.requests import Request -from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN -from typing_extensions import Annotated, Doc - - -class HTTPBasicCredentials(BaseModel): - """ - The HTTP Basic credentials given as the result of using `HTTPBasic` in a - dependency. - - Read more about it in the - [FastAPI docs for HTTP Basic Auth](https://fastapi.tiangolo.com/advanced/security/http-basic-auth/). - """ - - username: Annotated[str, Doc("The HTTP Basic username.")] - password: Annotated[str, Doc("The HTTP Basic password.")] - - -class HTTPAuthorizationCredentials(BaseModel): - """ - The HTTP authorization credentials in the result of using `HTTPBearer` or - `HTTPDigest` in a dependency. - - The HTTP authorization header value is split by the first space. - - The first part is the `scheme`, the second part is the `credentials`. - - For example, in an HTTP Bearer token scheme, the client will send a header - like: - - ``` - Authorization: Bearer deadbeef12346 - ``` - - In this case: - - * `scheme` will have the value `"Bearer"` - * `credentials` will have the value `"deadbeef12346"` - """ - - scheme: Annotated[ - str, - Doc( - """ - The HTTP authorization scheme extracted from the header value. - """ - ), - ] - credentials: Annotated[ - str, - Doc( - """ - The HTTP authorization credentials extracted from the header value. - """ - ), - ] - - -class HTTPBase(SecurityBase): - def __init__( - self, - *, - scheme: str, - scheme_name: Optional[str] = None, - description: Optional[str] = None, - auto_error: bool = True, - ): - self.model = HTTPBaseModel(scheme=scheme, description=description) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__( - self, request: Request - ) -> Optional[HTTPAuthorizationCredentials]: - authorization = request.headers.get("Authorization") - scheme, credentials = get_authorization_scheme_param(authorization) - if not (authorization and scheme and credentials): - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials) - - -class HTTPBasic(HTTPBase): - """ - HTTP Basic authentication. - - ## Usage - - Create an instance object and use that object as the dependency in `Depends()`. - - The dependency result will be an `HTTPBasicCredentials` object containing the - `username` and the `password`. - - Read more about it in the - [FastAPI docs for HTTP Basic Auth](https://fastapi.tiangolo.com/advanced/security/http-basic-auth/). - - ## Example - - ```python - from typing import Annotated - - from fastapi import Depends, FastAPI - from fastapi.security import HTTPBasic, HTTPBasicCredentials - - app = FastAPI() - - security = HTTPBasic() - - - @app.get("/users/me") - def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]): - return {"username": credentials.username, "password": credentials.password} - ``` - """ - - def __init__( - self, - *, - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - realm: Annotated[ - Optional[str], - Doc( - """ - HTTP Basic authentication realm. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if the HTTP Basic authentication is not provided (a - header), `HTTPBasic` will automatically cancel the request and send the - client an error. - - If `auto_error` is set to `False`, when the HTTP Basic authentication - is not available, instead of erroring out, the dependency result will - be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, in HTTP Basic - authentication or in an HTTP Bearer token). - """ - ), - ] = True, - ): - self.model = HTTPBaseModel(scheme="basic", description=description) - self.scheme_name = scheme_name or self.__class__.__name__ - self.realm = realm - self.auto_error = auto_error - - async def __call__( # type: ignore - self, request: Request - ) -> Optional[HTTPBasicCredentials]: - authorization = request.headers.get("Authorization") - scheme, param = get_authorization_scheme_param(authorization) - if self.realm: - unauthorized_headers = {"WWW-Authenticate": f'Basic realm="{self.realm}"'} - else: - unauthorized_headers = {"WWW-Authenticate": "Basic"} - if not authorization or scheme.lower() != "basic": - if self.auto_error: - raise HTTPException( - status_code=HTTP_401_UNAUTHORIZED, - detail="Not authenticated", - headers=unauthorized_headers, - ) - else: - return None - invalid_user_credentials_exc = HTTPException( - status_code=HTTP_401_UNAUTHORIZED, - detail="Invalid authentication credentials", - headers=unauthorized_headers, - ) - try: - data = b64decode(param).decode("ascii") - except (ValueError, UnicodeDecodeError, binascii.Error): - raise invalid_user_credentials_exc # noqa: B904 - username, separator, password = data.partition(":") - if not separator: - raise invalid_user_credentials_exc - return HTTPBasicCredentials(username=username, password=password) - - -class HTTPBearer(HTTPBase): - """ - HTTP Bearer token authentication. - - ## Usage - - Create an instance object and use that object as the dependency in `Depends()`. - - The dependency result will be an `HTTPAuthorizationCredentials` object containing - the `scheme` and the `credentials`. - - ## Example - - ```python - from typing import Annotated - - from fastapi import Depends, FastAPI - from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer - - app = FastAPI() - - security = HTTPBearer() - - - @app.get("/users/me") - def read_current_user( - credentials: Annotated[HTTPAuthorizationCredentials, Depends(security)] - ): - return {"scheme": credentials.scheme, "credentials": credentials.credentials} - ``` - """ - - def __init__( - self, - *, - bearerFormat: Annotated[Optional[str], Doc("Bearer token format.")] = None, - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if the HTTP Bearer token not provided (in an - `Authorization` header), `HTTPBearer` will automatically cancel the - request and send the client an error. - - If `auto_error` is set to `False`, when the HTTP Bearer token - is not available, instead of erroring out, the dependency result will - be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, in an HTTP - Bearer token or in a cookie). - """ - ), - ] = True, - ): - self.model = HTTPBearerModel(bearerFormat=bearerFormat, description=description) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__( - self, request: Request - ) -> Optional[HTTPAuthorizationCredentials]: - authorization = request.headers.get("Authorization") - scheme, credentials = get_authorization_scheme_param(authorization) - if not (authorization and scheme and credentials): - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - if scheme.lower() != "bearer": - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, - detail="Invalid authentication credentials", - ) - else: - return None - return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials) - - -class HTTPDigest(HTTPBase): - """ - HTTP Digest authentication. - - ## Usage - - Create an instance object and use that object as the dependency in `Depends()`. - - The dependency result will be an `HTTPAuthorizationCredentials` object containing - the `scheme` and the `credentials`. - - ## Example - - ```python - from typing import Annotated - - from fastapi import Depends, FastAPI - from fastapi.security import HTTPAuthorizationCredentials, HTTPDigest - - app = FastAPI() - - security = HTTPDigest() - - - @app.get("/users/me") - def read_current_user( - credentials: Annotated[HTTPAuthorizationCredentials, Depends(security)] - ): - return {"scheme": credentials.scheme, "credentials": credentials.credentials} - ``` - """ - - def __init__( - self, - *, - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if the HTTP Digest not provided, `HTTPDigest` will - automatically cancel the request and send the client an error. - - If `auto_error` is set to `False`, when the HTTP Digest is not - available, instead of erroring out, the dependency result will - be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, in HTTP - Digest or in a cookie). - """ - ), - ] = True, - ): - self.model = HTTPBaseModel(scheme="digest", description=description) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__( - self, request: Request - ) -> Optional[HTTPAuthorizationCredentials]: - authorization = request.headers.get("Authorization") - scheme, credentials = get_authorization_scheme_param(authorization) - if not (authorization and scheme and credentials): - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - if scheme.lower() != "digest": - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, - detail="Invalid authentication credentials", - ) - return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/oauth2.py b/write-message/venv/lib/python3.10/site-packages/fastapi/security/oauth2.py deleted file mode 100644 index 9720cac..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/security/oauth2.py +++ /dev/null @@ -1,638 +0,0 @@ -from typing import Any, Dict, List, Optional, Union, cast - -from fastapi.exceptions import HTTPException -from fastapi.openapi.models import OAuth2 as OAuth2Model -from fastapi.openapi.models import OAuthFlows as OAuthFlowsModel -from fastapi.param_functions import Form -from fastapi.security.base import SecurityBase -from fastapi.security.utils import get_authorization_scheme_param -from starlette.requests import Request -from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN - -# TODO: import from typing when deprecating Python 3.9 -from typing_extensions import Annotated, Doc - - -class OAuth2PasswordRequestForm: - """ - This is a dependency class to collect the `username` and `password` as form data - for an OAuth2 password flow. - - The OAuth2 specification dictates that for a password flow the data should be - collected using form data (instead of JSON) and that it should have the specific - fields `username` and `password`. - - All the initialization parameters are extracted from the request. - - Read more about it in the - [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/). - - ## Example - - ```python - from typing import Annotated - - from fastapi import Depends, FastAPI - from fastapi.security import OAuth2PasswordRequestForm - - app = FastAPI() - - - @app.post("/login") - def login(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]): - data = {} - data["scopes"] = [] - for scope in form_data.scopes: - data["scopes"].append(scope) - if form_data.client_id: - data["client_id"] = form_data.client_id - if form_data.client_secret: - data["client_secret"] = form_data.client_secret - return data - ``` - - Note that for OAuth2 the scope `items:read` is a single scope in an opaque string. - You could have custom internal logic to separate it by colon caracters (`:`) or - similar, and get the two parts `items` and `read`. Many applications do that to - group and organize permissions, you could do it as well in your application, just - know that that it is application specific, it's not part of the specification. - """ - - def __init__( - self, - *, - grant_type: Annotated[ - Union[str, None], - Form(pattern="password"), - Doc( - """ - The OAuth2 spec says it is required and MUST be the fixed string - "password". Nevertheless, this dependency class is permissive and - allows not passing it. If you want to enforce it, use instead the - `OAuth2PasswordRequestFormStrict` dependency. - """ - ), - ] = None, - username: Annotated[ - str, - Form(), - Doc( - """ - `username` string. The OAuth2 spec requires the exact field name - `username`. - """ - ), - ], - password: Annotated[ - str, - Form(), - Doc( - """ - `password` string. The OAuth2 spec requires the exact field name - `password". - """ - ), - ], - scope: Annotated[ - str, - Form(), - Doc( - """ - A single string with actually several scopes separated by spaces. Each - scope is also a string. - - For example, a single string with: - - ```python - "items:read items:write users:read profile openid" - ```` - - would represent the scopes: - - * `items:read` - * `items:write` - * `users:read` - * `profile` - * `openid` - """ - ), - ] = "", - client_id: Annotated[ - Union[str, None], - Form(), - Doc( - """ - If there's a `client_id`, it can be sent as part of the form fields. - But the OAuth2 specification recommends sending the `client_id` and - `client_secret` (if any) using HTTP Basic auth. - """ - ), - ] = None, - client_secret: Annotated[ - Union[str, None], - Form(), - Doc( - """ - If there's a `client_password` (and a `client_id`), they can be sent - as part of the form fields. But the OAuth2 specification recommends - sending the `client_id` and `client_secret` (if any) using HTTP Basic - auth. - """ - ), - ] = None, - ): - self.grant_type = grant_type - self.username = username - self.password = password - self.scopes = scope.split() - self.client_id = client_id - self.client_secret = client_secret - - -class OAuth2PasswordRequestFormStrict(OAuth2PasswordRequestForm): - """ - This is a dependency class to collect the `username` and `password` as form data - for an OAuth2 password flow. - - The OAuth2 specification dictates that for a password flow the data should be - collected using form data (instead of JSON) and that it should have the specific - fields `username` and `password`. - - All the initialization parameters are extracted from the request. - - The only difference between `OAuth2PasswordRequestFormStrict` and - `OAuth2PasswordRequestForm` is that `OAuth2PasswordRequestFormStrict` requires the - client to send the form field `grant_type` with the value `"password"`, which - is required in the OAuth2 specification (it seems that for no particular reason), - while for `OAuth2PasswordRequestForm` `grant_type` is optional. - - Read more about it in the - [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/). - - ## Example - - ```python - from typing import Annotated - - from fastapi import Depends, FastAPI - from fastapi.security import OAuth2PasswordRequestForm - - app = FastAPI() - - - @app.post("/login") - def login(form_data: Annotated[OAuth2PasswordRequestFormStrict, Depends()]): - data = {} - data["scopes"] = [] - for scope in form_data.scopes: - data["scopes"].append(scope) - if form_data.client_id: - data["client_id"] = form_data.client_id - if form_data.client_secret: - data["client_secret"] = form_data.client_secret - return data - ``` - - Note that for OAuth2 the scope `items:read` is a single scope in an opaque string. - You could have custom internal logic to separate it by colon caracters (`:`) or - similar, and get the two parts `items` and `read`. Many applications do that to - group and organize permissions, you could do it as well in your application, just - know that that it is application specific, it's not part of the specification. - - - grant_type: the OAuth2 spec says it is required and MUST be the fixed string "password". - This dependency is strict about it. If you want to be permissive, use instead the - OAuth2PasswordRequestForm dependency class. - username: username string. The OAuth2 spec requires the exact field name "username". - password: password string. The OAuth2 spec requires the exact field name "password". - scope: Optional string. Several scopes (each one a string) separated by spaces. E.g. - "items:read items:write users:read profile openid" - client_id: optional string. OAuth2 recommends sending the client_id and client_secret (if any) - using HTTP Basic auth, as: client_id:client_secret - client_secret: optional string. OAuth2 recommends sending the client_id and client_secret (if any) - using HTTP Basic auth, as: client_id:client_secret - """ - - def __init__( - self, - grant_type: Annotated[ - str, - Form(pattern="password"), - Doc( - """ - The OAuth2 spec says it is required and MUST be the fixed string - "password". This dependency is strict about it. If you want to be - permissive, use instead the `OAuth2PasswordRequestForm` dependency - class. - """ - ), - ], - username: Annotated[ - str, - Form(), - Doc( - """ - `username` string. The OAuth2 spec requires the exact field name - `username`. - """ - ), - ], - password: Annotated[ - str, - Form(), - Doc( - """ - `password` string. The OAuth2 spec requires the exact field name - `password". - """ - ), - ], - scope: Annotated[ - str, - Form(), - Doc( - """ - A single string with actually several scopes separated by spaces. Each - scope is also a string. - - For example, a single string with: - - ```python - "items:read items:write users:read profile openid" - ```` - - would represent the scopes: - - * `items:read` - * `items:write` - * `users:read` - * `profile` - * `openid` - """ - ), - ] = "", - client_id: Annotated[ - Union[str, None], - Form(), - Doc( - """ - If there's a `client_id`, it can be sent as part of the form fields. - But the OAuth2 specification recommends sending the `client_id` and - `client_secret` (if any) using HTTP Basic auth. - """ - ), - ] = None, - client_secret: Annotated[ - Union[str, None], - Form(), - Doc( - """ - If there's a `client_password` (and a `client_id`), they can be sent - as part of the form fields. But the OAuth2 specification recommends - sending the `client_id` and `client_secret` (if any) using HTTP Basic - auth. - """ - ), - ] = None, - ): - super().__init__( - grant_type=grant_type, - username=username, - password=password, - scope=scope, - client_id=client_id, - client_secret=client_secret, - ) - - -class OAuth2(SecurityBase): - """ - This is the base class for OAuth2 authentication, an instance of it would be used - as a dependency. All other OAuth2 classes inherit from it and customize it for - each OAuth2 flow. - - You normally would not create a new class inheriting from it but use one of the - existing subclasses, and maybe compose them if you want to support multiple flows. - - Read more about it in the - [FastAPI docs for Security](https://fastapi.tiangolo.com/tutorial/security/). - """ - - def __init__( - self, - *, - flows: Annotated[ - Union[OAuthFlowsModel, Dict[str, Dict[str, Any]]], - Doc( - """ - The dictionary of OAuth2 flows. - """ - ), - ] = OAuthFlowsModel(), - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if no HTTP Authorization header is provided, required for - OAuth2 authentication, it will automatically cancel the request and - send the client an error. - - If `auto_error` is set to `False`, when the HTTP Authorization header - is not available, instead of erroring out, the dependency result will - be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, with OAuth2 - or in a cookie). - """ - ), - ] = True, - ): - self.model = OAuth2Model( - flows=cast(OAuthFlowsModel, flows), description=description - ) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__(self, request: Request) -> Optional[str]: - authorization = request.headers.get("Authorization") - if not authorization: - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - return authorization - - -class OAuth2PasswordBearer(OAuth2): - """ - OAuth2 flow for authentication using a bearer token obtained with a password. - An instance of it would be used as a dependency. - - Read more about it in the - [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/). - """ - - def __init__( - self, - tokenUrl: Annotated[ - str, - Doc( - """ - The URL to obtain the OAuth2 token. This would be the *path operation* - that has `OAuth2PasswordRequestForm` as a dependency. - """ - ), - ], - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - scopes: Annotated[ - Optional[Dict[str, str]], - Doc( - """ - The OAuth2 scopes that would be required by the *path operations* that - use this dependency. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if no HTTP Authorization header is provided, required for - OAuth2 authentication, it will automatically cancel the request and - send the client an error. - - If `auto_error` is set to `False`, when the HTTP Authorization header - is not available, instead of erroring out, the dependency result will - be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, with OAuth2 - or in a cookie). - """ - ), - ] = True, - ): - if not scopes: - scopes = {} - flows = OAuthFlowsModel( - password=cast(Any, {"tokenUrl": tokenUrl, "scopes": scopes}) - ) - super().__init__( - flows=flows, - scheme_name=scheme_name, - description=description, - auto_error=auto_error, - ) - - async def __call__(self, request: Request) -> Optional[str]: - authorization = request.headers.get("Authorization") - scheme, param = get_authorization_scheme_param(authorization) - if not authorization or scheme.lower() != "bearer": - if self.auto_error: - raise HTTPException( - status_code=HTTP_401_UNAUTHORIZED, - detail="Not authenticated", - headers={"WWW-Authenticate": "Bearer"}, - ) - else: - return None - return param - - -class OAuth2AuthorizationCodeBearer(OAuth2): - """ - OAuth2 flow for authentication using a bearer token obtained with an OAuth2 code - flow. An instance of it would be used as a dependency. - """ - - def __init__( - self, - authorizationUrl: str, - tokenUrl: Annotated[ - str, - Doc( - """ - The URL to obtain the OAuth2 token. - """ - ), - ], - refreshUrl: Annotated[ - Optional[str], - Doc( - """ - The URL to refresh the token and obtain a new one. - """ - ), - ] = None, - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - scopes: Annotated[ - Optional[Dict[str, str]], - Doc( - """ - The OAuth2 scopes that would be required by the *path operations* that - use this dependency. - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if no HTTP Authorization header is provided, required for - OAuth2 authentication, it will automatically cancel the request and - send the client an error. - - If `auto_error` is set to `False`, when the HTTP Authorization header - is not available, instead of erroring out, the dependency result will - be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, with OAuth2 - or in a cookie). - """ - ), - ] = True, - ): - if not scopes: - scopes = {} - flows = OAuthFlowsModel( - authorizationCode=cast( - Any, - { - "authorizationUrl": authorizationUrl, - "tokenUrl": tokenUrl, - "refreshUrl": refreshUrl, - "scopes": scopes, - }, - ) - ) - super().__init__( - flows=flows, - scheme_name=scheme_name, - description=description, - auto_error=auto_error, - ) - - async def __call__(self, request: Request) -> Optional[str]: - authorization = request.headers.get("Authorization") - scheme, param = get_authorization_scheme_param(authorization) - if not authorization or scheme.lower() != "bearer": - if self.auto_error: - raise HTTPException( - status_code=HTTP_401_UNAUTHORIZED, - detail="Not authenticated", - headers={"WWW-Authenticate": "Bearer"}, - ) - else: - return None # pragma: nocover - return param - - -class SecurityScopes: - """ - This is a special class that you can define in a parameter in a dependency to - obtain the OAuth2 scopes required by all the dependencies in the same chain. - - This way, multiple dependencies can have different scopes, even when used in the - same *path operation*. And with this, you can access all the scopes required in - all those dependencies in a single place. - - Read more about it in the - [FastAPI docs for OAuth2 scopes](https://fastapi.tiangolo.com/advanced/security/oauth2-scopes/). - """ - - def __init__( - self, - scopes: Annotated[ - Optional[List[str]], - Doc( - """ - This will be filled by FastAPI. - """ - ), - ] = None, - ): - self.scopes: Annotated[ - List[str], - Doc( - """ - The list of all the scopes required by dependencies. - """ - ), - ] = scopes or [] - self.scope_str: Annotated[ - str, - Doc( - """ - All the scopes required by all the dependencies in a single string - separated by spaces, as defined in the OAuth2 specification. - """ - ), - ] = " ".join(self.scopes) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/open_id_connect_url.py b/write-message/venv/lib/python3.10/site-packages/fastapi/security/open_id_connect_url.py deleted file mode 100644 index c8cceb9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/security/open_id_connect_url.py +++ /dev/null @@ -1,84 +0,0 @@ -from typing import Optional - -from fastapi.openapi.models import OpenIdConnect as OpenIdConnectModel -from fastapi.security.base import SecurityBase -from starlette.exceptions import HTTPException -from starlette.requests import Request -from starlette.status import HTTP_403_FORBIDDEN -from typing_extensions import Annotated, Doc - - -class OpenIdConnect(SecurityBase): - """ - OpenID Connect authentication class. An instance of it would be used as a - dependency. - """ - - def __init__( - self, - *, - openIdConnectUrl: Annotated[ - str, - Doc( - """ - The OpenID Connect URL. - """ - ), - ], - scheme_name: Annotated[ - Optional[str], - Doc( - """ - Security scheme name. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - description: Annotated[ - Optional[str], - Doc( - """ - Security scheme description. - - It will be included in the generated OpenAPI (e.g. visible at `/docs`). - """ - ), - ] = None, - auto_error: Annotated[ - bool, - Doc( - """ - By default, if no HTTP Authorization header is provided, required for - OpenID Connect authentication, it will automatically cancel the request - and send the client an error. - - If `auto_error` is set to `False`, when the HTTP Authorization header - is not available, instead of erroring out, the dependency result will - be `None`. - - This is useful when you want to have optional authentication. - - It is also useful when you want to have authentication that can be - provided in one of multiple optional ways (for example, with OpenID - Connect or in a cookie). - """ - ), - ] = True, - ): - self.model = OpenIdConnectModel( - openIdConnectUrl=openIdConnectUrl, description=description - ) - self.scheme_name = scheme_name or self.__class__.__name__ - self.auto_error = auto_error - - async def __call__(self, request: Request) -> Optional[str]: - authorization = request.headers.get("Authorization") - if not authorization: - if self.auto_error: - raise HTTPException( - status_code=HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - else: - return None - return authorization diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/security/utils.py b/write-message/venv/lib/python3.10/site-packages/fastapi/security/utils.py deleted file mode 100644 index fa7a450..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/security/utils.py +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Optional, Tuple - - -def get_authorization_scheme_param( - authorization_header_value: Optional[str], -) -> Tuple[str, str]: - if not authorization_header_value: - return "", "" - scheme, _, param = authorization_header_value.partition(" ") - return scheme, param diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/staticfiles.py b/write-message/venv/lib/python3.10/site-packages/fastapi/staticfiles.py deleted file mode 100644 index 299015d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/staticfiles.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.staticfiles import StaticFiles as StaticFiles # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/templating.py b/write-message/venv/lib/python3.10/site-packages/fastapi/templating.py deleted file mode 100644 index 0cb8684..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/templating.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.templating import Jinja2Templates as Jinja2Templates # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/testclient.py b/write-message/venv/lib/python3.10/site-packages/fastapi/testclient.py deleted file mode 100644 index 4012406..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/testclient.py +++ /dev/null @@ -1 +0,0 @@ -from starlette.testclient import TestClient as TestClient # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/types.py b/write-message/venv/lib/python3.10/site-packages/fastapi/types.py deleted file mode 100644 index 3205654..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/types.py +++ /dev/null @@ -1,10 +0,0 @@ -import types -from enum import Enum -from typing import Any, Callable, Dict, Set, Type, TypeVar, Union - -from pydantic import BaseModel - -DecoratedCallable = TypeVar("DecoratedCallable", bound=Callable[..., Any]) -UnionType = getattr(types, "UnionType", Union) -ModelNameMap = Dict[Union[Type[BaseModel], Type[Enum]], str] -IncEx = Union[Set[int], Set[str], Dict[int, Any], Dict[str, Any]] diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/utils.py b/write-message/venv/lib/python3.10/site-packages/fastapi/utils.py deleted file mode 100644 index dfda4e6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/utils.py +++ /dev/null @@ -1,223 +0,0 @@ -import re -import warnings -from dataclasses import is_dataclass -from typing import ( - TYPE_CHECKING, - Any, - Dict, - MutableMapping, - Optional, - Set, - Type, - Union, - cast, -) -from weakref import WeakKeyDictionary - -import fastapi -from fastapi._compat import ( - PYDANTIC_V2, - BaseConfig, - ModelField, - PydanticSchemaGenerationError, - Undefined, - UndefinedType, - Validator, - lenient_issubclass, -) -from fastapi.datastructures import DefaultPlaceholder, DefaultType -from pydantic import BaseModel, create_model -from pydantic.fields import FieldInfo -from typing_extensions import Literal - -if TYPE_CHECKING: # pragma: nocover - from .routing import APIRoute - -# Cache for `create_cloned_field` -_CLONED_TYPES_CACHE: MutableMapping[ - Type[BaseModel], Type[BaseModel] -] = WeakKeyDictionary() - - -def is_body_allowed_for_status_code(status_code: Union[int, str, None]) -> bool: - if status_code is None: - return True - # Ref: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#patterned-fields-1 - if status_code in { - "default", - "1XX", - "2XX", - "3XX", - "4XX", - "5XX", - }: - return True - current_status_code = int(status_code) - return not (current_status_code < 200 or current_status_code in {204, 205, 304}) - - -def get_path_param_names(path: str) -> Set[str]: - return set(re.findall("{(.*?)}", path)) - - -def create_response_field( - name: str, - type_: Type[Any], - class_validators: Optional[Dict[str, Validator]] = None, - default: Optional[Any] = Undefined, - required: Union[bool, UndefinedType] = Undefined, - model_config: Type[BaseConfig] = BaseConfig, - field_info: Optional[FieldInfo] = None, - alias: Optional[str] = None, - mode: Literal["validation", "serialization"] = "validation", -) -> ModelField: - """ - Create a new response field. Raises if type_ is invalid. - """ - class_validators = class_validators or {} - if PYDANTIC_V2: - field_info = field_info or FieldInfo( - annotation=type_, default=default, alias=alias - ) - else: - field_info = field_info or FieldInfo() - kwargs = {"name": name, "field_info": field_info} - if PYDANTIC_V2: - kwargs.update({"mode": mode}) - else: - kwargs.update( - { - "type_": type_, - "class_validators": class_validators, - "default": default, - "required": required, - "model_config": model_config, - "alias": alias, - } - ) - try: - return ModelField(**kwargs) # type: ignore[arg-type] - except (RuntimeError, PydanticSchemaGenerationError): - raise fastapi.exceptions.FastAPIError( - "Invalid args for response field! Hint: " - f"check that {type_} is a valid Pydantic field type. " - "If you are using a return type annotation that is not a valid Pydantic " - "field (e.g. Union[Response, dict, None]) you can disable generating the " - "response model from the type annotation with the path operation decorator " - "parameter response_model=None. Read more: " - "https://fastapi.tiangolo.com/tutorial/response-model/" - ) from None - - -def create_cloned_field( - field: ModelField, - *, - cloned_types: Optional[MutableMapping[Type[BaseModel], Type[BaseModel]]] = None, -) -> ModelField: - if PYDANTIC_V2: - return field - # cloned_types caches already cloned types to support recursive models and improve - # performance by avoiding unnecessary cloning - if cloned_types is None: - cloned_types = _CLONED_TYPES_CACHE - - original_type = field.type_ - if is_dataclass(original_type) and hasattr(original_type, "__pydantic_model__"): - original_type = original_type.__pydantic_model__ - use_type = original_type - if lenient_issubclass(original_type, BaseModel): - original_type = cast(Type[BaseModel], original_type) - use_type = cloned_types.get(original_type) - if use_type is None: - use_type = create_model(original_type.__name__, __base__=original_type) - cloned_types[original_type] = use_type - for f in original_type.__fields__.values(): - use_type.__fields__[f.name] = create_cloned_field( - f, cloned_types=cloned_types - ) - new_field = create_response_field(name=field.name, type_=use_type) - new_field.has_alias = field.has_alias # type: ignore[attr-defined] - new_field.alias = field.alias # type: ignore[misc] - new_field.class_validators = field.class_validators # type: ignore[attr-defined] - new_field.default = field.default # type: ignore[misc] - new_field.required = field.required # type: ignore[misc] - new_field.model_config = field.model_config # type: ignore[attr-defined] - new_field.field_info = field.field_info - new_field.allow_none = field.allow_none # type: ignore[attr-defined] - new_field.validate_always = field.validate_always # type: ignore[attr-defined] - if field.sub_fields: # type: ignore[attr-defined] - new_field.sub_fields = [ # type: ignore[attr-defined] - create_cloned_field(sub_field, cloned_types=cloned_types) - for sub_field in field.sub_fields # type: ignore[attr-defined] - ] - if field.key_field: # type: ignore[attr-defined] - new_field.key_field = create_cloned_field( # type: ignore[attr-defined] - field.key_field, # type: ignore[attr-defined] - cloned_types=cloned_types, - ) - new_field.validators = field.validators # type: ignore[attr-defined] - new_field.pre_validators = field.pre_validators # type: ignore[attr-defined] - new_field.post_validators = field.post_validators # type: ignore[attr-defined] - new_field.parse_json = field.parse_json # type: ignore[attr-defined] - new_field.shape = field.shape # type: ignore[attr-defined] - new_field.populate_validators() # type: ignore[attr-defined] - return new_field - - -def generate_operation_id_for_path( - *, name: str, path: str, method: str -) -> str: # pragma: nocover - warnings.warn( - "fastapi.utils.generate_operation_id_for_path() was deprecated, " - "it is not used internally, and will be removed soon", - DeprecationWarning, - stacklevel=2, - ) - operation_id = f"{name}{path}" - operation_id = re.sub(r"\W", "_", operation_id) - operation_id = f"{operation_id}_{method.lower()}" - return operation_id - - -def generate_unique_id(route: "APIRoute") -> str: - operation_id = f"{route.name}{route.path_format}" - operation_id = re.sub(r"\W", "_", operation_id) - assert route.methods - operation_id = f"{operation_id}_{list(route.methods)[0].lower()}" - return operation_id - - -def deep_dict_update(main_dict: Dict[Any, Any], update_dict: Dict[Any, Any]) -> None: - for key, value in update_dict.items(): - if ( - key in main_dict - and isinstance(main_dict[key], dict) - and isinstance(value, dict) - ): - deep_dict_update(main_dict[key], value) - elif ( - key in main_dict - and isinstance(main_dict[key], list) - and isinstance(update_dict[key], list) - ): - main_dict[key] = main_dict[key] + update_dict[key] - else: - main_dict[key] = value - - -def get_value_or_default( - first_item: Union[DefaultPlaceholder, DefaultType], - *extra_items: Union[DefaultPlaceholder, DefaultType], -) -> Union[DefaultPlaceholder, DefaultType]: - """ - Pass items or `DefaultPlaceholder`s by descending priority. - - The first one to _not_ be a `DefaultPlaceholder` will be returned. - - Otherwise, the first item (a `DefaultPlaceholder`) will be returned. - """ - items = (first_item,) + extra_items - for item in items: - if not isinstance(item, DefaultPlaceholder): - return item - return first_item diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi/websockets.py b/write-message/venv/lib/python3.10/site-packages/fastapi/websockets.py deleted file mode 100644 index 55a4ac4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi/websockets.py +++ /dev/null @@ -1,3 +0,0 @@ -from starlette.websockets import WebSocket as WebSocket # noqa -from starlette.websockets import WebSocketDisconnect as WebSocketDisconnect # noqa -from starlette.websockets import WebSocketState as WebSocketState # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/METADATA deleted file mode 100644 index 9e6e903..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/METADATA +++ /dev/null @@ -1,137 +0,0 @@ -Metadata-Version: 2.1 -Name: fastapi-cli -Version: 0.0.8 -Summary: Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀 -Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= -License: MIT -Classifier: Intended Audience :: Information Technology -Classifier: Intended Audience :: System Administrators -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python -Classifier: Topic :: Software Development :: Libraries :: Application Frameworks -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Software Development :: Libraries -Classifier: Topic :: Software Development -Classifier: Typing :: Typed -Classifier: Development Status :: 4 - Beta -Classifier: Framework :: FastAPI -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: License :: OSI Approved :: MIT License -Project-URL: Homepage, https://github.com/fastapi/fastapi-cli -Project-URL: Documentation, https://fastapi.tiangolo.com/fastapi-cli/ -Project-URL: Repository, https://github.com/fastapi/fastapi-cli -Project-URL: Issues, https://github.com/fastapi/fastapi-cli/issues -Project-URL: Changelog, https://github.com/fastapi/fastapi-cli/blob/main/release-notes.md -Requires-Python: >=3.8 -Requires-Dist: typer>=0.15.1 -Requires-Dist: uvicorn[standard]>=0.15.0 -Requires-Dist: rich-toolkit>=0.14.8 -Provides-Extra: standard -Requires-Dist: uvicorn[standard]>=0.15.0; extra == "standard" -Requires-Dist: fastapi-cloud-cli>=0.1.1; extra == "standard" -Provides-Extra: standard-no-fastapi-cloud-cli -Requires-Dist: uvicorn[standard]>=0.15.0; extra == "standard-no-fastapi-cloud-cli" -Description-Content-Type: text/markdown - -# FastAPI CLI - - - Test - - - Publish - - - Coverage - - Package version - - ---- - -**Source Code**: https://github.com/fastapi/fastapi-cli - ---- - -Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀 - -## Description - -**FastAPI CLI** is a command line program `fastapi` that you can use to serve your FastAPI app, manage your FastAPI project, and more. - -When you install FastAPI (e.g. with `pip install "fastapi[standard]"`), it includes a package called `fastapi-cli`, this package provides the `fastapi` command in the terminal. - -To run your FastAPI app for development, you can use the `fastapi dev` command: - -
- -```console -$ fastapi dev main.py - - FastAPI Starting development server 🚀 - - Searching for package file structure from directories with __init__.py files - Importing from /home/user/code/awesomeapp - - module 🐍 main.py - - code Importing the FastAPI app object from the module with the following code: - - from main import app - - app Using import string: main:app - - server Server started at http://127.0.0.1:8000 - server Documentation at http://127.0.0.1:8000/docs - - tip Running in development mode, for production use: fastapi run - - Logs: - - INFO Will watch for changes in these directories: ['/home/user/code/awesomeapp'] - INFO Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) - INFO Started reloader process [4106097] using WatchFiles - INFO Started server process [4106120] - INFO Waiting for application startup. - INFO Application startup complete. -``` - -
- -That command line program called `fastapi` is **FastAPI CLI**. - -FastAPI CLI takes the path to your Python program and automatically detects the variable with the FastAPI (commonly named `app`) and how to import it, and then serves it. - -For production you would use `fastapi run` instead. 🚀 - -Internally, **FastAPI CLI** uses Uvicorn, a high-performance, production-ready, ASGI server. 😎 - -## `fastapi dev` - -When you run `fastapi dev`, it will run on development mode. - -By default, it will have **auto-reload** enabled, so it will automatically reload the server when you make changes to your code. This is resource intensive and could be less stable than without it, you should only use it for development. - -By default it will listen on the IP address `127.0.0.1`, which is the IP for your machine to communicate with itself alone (`localhost`). - -## `fastapi run` - -When you run `fastapi run`, it will run on production mode by default. - -It will have **auto-reload disabled** by default. - -It will listen on the IP address `0.0.0.0`, which means all the available IP addresses, this way it will be publicly accessible to anyone that can communicate with the machine. This is how you would normally run it in production, for example, in a container. - -In most cases you would (and should) have a "termination proxy" handling HTTPS for you on top, this will depend on how you deploy your application, your provider might do this for you, or you might need to set it up yourself. You can learn more about it in the FastAPI Deployment documentation. - -## License - -This project is licensed under the terms of the MIT license. diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/RECORD deleted file mode 100644 index c544de2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/RECORD +++ /dev/null @@ -1,24 +0,0 @@ -../../../bin/fastapi,sha256=P5fnHOHavcewxxV50araFo36xhqIbCUusp_zgOC-0zk,275 -fastapi_cli-0.0.8.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -fastapi_cli-0.0.8.dist-info/METADATA,sha256=X79w3QC4o9tKdWy59HlE8P737JMvOQE8xx-aGzVuQqM,6342 -fastapi_cli-0.0.8.dist-info/RECORD,, -fastapi_cli-0.0.8.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90 -fastapi_cli-0.0.8.dist-info/entry_points.txt,sha256=L-dwDLGAhOlBVadq5cDBAB1i8y4oSFueX02A4gmMKco,65 -fastapi_cli-0.0.8.dist-info/licenses/LICENSE,sha256=FqD5B4VbXJnefprQseE0U8llL6FxojC-i8muZy7YmSU,1086 -fastapi_cli/__init__.py,sha256=wOJN3HxAgnSon5vWYU3Txm2UZ_7tBHDKXUKZIH-mXX8,22 -fastapi_cli/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30 -fastapi_cli/__pycache__/__init__.cpython-310.pyc,, -fastapi_cli/__pycache__/__main__.cpython-310.pyc,, -fastapi_cli/__pycache__/cli.cpython-310.pyc,, -fastapi_cli/__pycache__/discover.cpython-310.pyc,, -fastapi_cli/__pycache__/exceptions.cpython-310.pyc,, -fastapi_cli/__pycache__/logging.cpython-310.pyc,, -fastapi_cli/cli.py,sha256=c3_y-wlrzmJYlZPmZyFORYk_vEIHR2zgkny3ERcYwFk,11565 -fastapi_cli/discover.py,sha256=Q3CSEWt2V68JcNuAv31l7IcO_-146n2dBUSdtexJPYE,3971 -fastapi_cli/exceptions.py,sha256=AHRSqd43fbqN5IpX-Fq389k9MoEK_q28wVFL7oqPNcc,47 -fastapi_cli/logging.py,sha256=Yh2Nx5eC8XE_a3psTMO0kA5BM8lf63bBCqSMyDxUN7s,690 -fastapi_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fastapi_cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fastapi_cli/utils/__pycache__/__init__.cpython-310.pyc,, -fastapi_cli/utils/__pycache__/cli.cpython-310.pyc,, -fastapi_cli/utils/cli.py,sha256=tAFRHnSurPgGX-JneQhGUJrzYLuuEKn1SxHK8Zj3nng,2268 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/WHEEL deleted file mode 100644 index 045c8ac..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: pdm-backend (2.4.5) -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/entry_points.txt b/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/entry_points.txt deleted file mode 100644 index a951c02..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/entry_points.txt +++ /dev/null @@ -1,5 +0,0 @@ -[console_scripts] -fastapi = fastapi_cli.cli:main - -[gui_scripts] - diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/licenses/LICENSE b/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/licenses/LICENSE deleted file mode 100644 index ef706ea..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli-0.0.8.dist-info/licenses/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2024 Sebastián Ramírez - -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/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__init__.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__init__.py deleted file mode 100644 index a73339b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.0.8" diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__main__.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__main__.py deleted file mode 100644 index 4e28416..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__main__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .cli import main - -main() diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index bb617f1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/__main__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/__main__.cpython-310.pyc deleted file mode 100644 index 103b18e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/__main__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/cli.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/cli.cpython-310.pyc deleted file mode 100644 index 21d91b9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/cli.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/discover.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/discover.cpython-310.pyc deleted file mode 100644 index be53286..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/discover.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/exceptions.cpython-310.pyc deleted file mode 100644 index 7dcd928..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/logging.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/logging.cpython-310.pyc deleted file mode 100644 index 2793bcd..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/__pycache__/logging.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/cli.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/cli.py deleted file mode 100644 index 7764721..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/cli.py +++ /dev/null @@ -1,358 +0,0 @@ -import logging -from pathlib import Path -from typing import Any, List, Union - -import typer -from rich import print -from rich.tree import Tree -from typing_extensions import Annotated - -from fastapi_cli.discover import get_import_data -from fastapi_cli.exceptions import FastAPICLIException - -from . import __version__ -from .logging import setup_logging -from .utils.cli import get_rich_toolkit, get_uvicorn_log_config - -app = typer.Typer(rich_markup_mode="rich") - -logger = logging.getLogger(__name__) - - -try: - import uvicorn -except ImportError: # pragma: no cover - uvicorn = None # type: ignore[assignment] - - -try: - from fastapi_cloud_cli.cli import ( - app as fastapi_cloud_cli, - ) - - app.add_typer(fastapi_cloud_cli) -except ImportError: # pragma: no cover - pass - - -def version_callback(value: bool) -> None: - if value: - print(f"FastAPI CLI version: [green]{__version__}[/green]") - raise typer.Exit() - - -@app.callback() -def callback( - version: Annotated[ - Union[bool, None], - typer.Option( - "--version", help="Show the version and exit.", callback=version_callback - ), - ] = None, - verbose: bool = typer.Option(False, help="Enable verbose output"), -) -> None: - """ - FastAPI CLI - The [bold]fastapi[/bold] command line app. 😎 - - Manage your [bold]FastAPI[/bold] projects, run your FastAPI apps, and more. - - Read more in the docs: [link=https://fastapi.tiangolo.com/fastapi-cli/]https://fastapi.tiangolo.com/fastapi-cli/[/link]. - """ - - log_level = logging.DEBUG if verbose else logging.INFO - - setup_logging(level=log_level) - - -def _get_module_tree(module_paths: List[Path]) -> Tree: - root = module_paths[0] - name = f"🐍 {root.name}" if root.is_file() else f"📁 {root.name}" - - root_tree = Tree(name) - - if root.is_dir(): - root_tree.add("[dim]🐍 __init__.py[/dim]") - - tree = root_tree - for sub_path in module_paths[1:]: - sub_name = ( - f"🐍 {sub_path.name}" if sub_path.is_file() else f"📁 {sub_path.name}" - ) - tree = tree.add(sub_name) - if sub_path.is_dir(): - tree.add("[dim]🐍 __init__.py[/dim]") - - return root_tree - - -def _run( - path: Union[Path, None] = None, - *, - host: str = "127.0.0.1", - port: int = 8000, - reload: bool = True, - workers: Union[int, None] = None, - root_path: str = "", - command: str, - app: Union[str, None] = None, - proxy_headers: bool = False, -) -> None: - with get_rich_toolkit() as toolkit: - server_type = "development" if command == "dev" else "production" - - toolkit.print_title(f"Starting {server_type} server 🚀", tag="FastAPI") - toolkit.print_line() - - toolkit.print( - "Searching for package file structure from directories with [blue]__init__.py[/blue] files" - ) - - try: - import_data = get_import_data(path=path, app_name=app) - except FastAPICLIException as e: - toolkit.print_line() - toolkit.print(f"[error]{e}") - raise typer.Exit(code=1) from None - - logger.debug(f"Importing from {import_data.module_data.extra_sys_path}") - logger.debug(f"Importing module {import_data.module_data.module_import_str}") - - module_data = import_data.module_data - import_string = import_data.import_string - - toolkit.print(f"Importing from {module_data.extra_sys_path}") - toolkit.print_line() - - root_tree = _get_module_tree(module_data.module_paths) - - toolkit.print(root_tree, tag="module") - toolkit.print_line() - - toolkit.print( - "Importing the FastAPI app object from the module with the following code:", - tag="code", - ) - toolkit.print_line() - toolkit.print( - f"[underline]from [bold]{module_data.module_import_str}[/bold] import [bold]{import_data.app_name}[/bold]" - ) - toolkit.print_line() - - toolkit.print( - f"Using import string: [blue]{import_string}[/]", - tag="app", - ) - - url = f"http://{host}:{port}" - url_docs = f"{url}/docs" - - toolkit.print_line() - toolkit.print( - f"Server started at [link={url}]{url}[/]", - f"Documentation at [link={url_docs}]{url_docs}[/]", - tag="server", - ) - - if command == "dev": - toolkit.print_line() - toolkit.print( - "Running in development mode, for production use: [bold]fastapi run[/]", - tag="tip", - ) - - if not uvicorn: - raise FastAPICLIException( - "Could not import Uvicorn, try running 'pip install uvicorn'" - ) from None - - toolkit.print_line() - toolkit.print("Logs:") - toolkit.print_line() - - uvicorn.run( - app=import_string, - host=host, - port=port, - reload=reload, - workers=workers, - root_path=root_path, - proxy_headers=proxy_headers, - log_config=get_uvicorn_log_config(), - ) - - -@app.command() -def dev( - path: Annotated[ - Union[Path, None], - typer.Argument( - help="A path to a Python file or package directory (with [blue]__init__.py[/blue] files) containing a [bold]FastAPI[/bold] app. If not provided, a default set of paths will be tried." - ), - ] = None, - *, - host: Annotated[ - str, - typer.Option( - help="The host to serve on. For local development in localhost use [blue]127.0.0.1[/blue]. To enable public access, e.g. in a container, use all the IP addresses available with [blue]0.0.0.0[/blue]." - ), - ] = "127.0.0.1", - port: Annotated[ - int, - typer.Option( - help="The port to serve on. You would normally have a termination proxy on top (another program) handling HTTPS on port [blue]443[/blue] and HTTP on port [blue]80[/blue], transferring the communication to your app." - ), - ] = 8000, - reload: Annotated[ - bool, - typer.Option( - help="Enable auto-reload of the server when (code) files change. This is [bold]resource intensive[/bold], use it only during development." - ), - ] = True, - root_path: Annotated[ - str, - typer.Option( - help="The root path is used to tell your app that it is being served to the outside world with some [bold]path prefix[/bold] set up in some termination proxy or similar." - ), - ] = "", - app: Annotated[ - Union[str, None], - typer.Option( - help="The name of the variable that contains the [bold]FastAPI[/bold] app in the imported module or package. If not provided, it is detected automatically." - ), - ] = None, - proxy_headers: Annotated[ - bool, - typer.Option( - help="Enable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to populate remote address info." - ), - ] = True, -) -> Any: - """ - Run a [bold]FastAPI[/bold] app in [yellow]development[/yellow] mode. 🧪 - - This is equivalent to [bold]fastapi run[/bold] but with [bold]reload[/bold] enabled and listening on the [blue]127.0.0.1[/blue] address. - - It automatically detects the Python module or package that needs to be imported based on the file or directory path passed. - - If no path is passed, it tries with: - - - [blue]main.py[/blue] - - [blue]app.py[/blue] - - [blue]api.py[/blue] - - [blue]app/main.py[/blue] - - [blue]app/app.py[/blue] - - [blue]app/api.py[/blue] - - It also detects the directory that needs to be added to the [bold]PYTHONPATH[/bold] to make the app importable and adds it. - - It detects the [bold]FastAPI[/bold] app object to use. By default it looks in the module or package for an object named: - - - [blue]app[/blue] - - [blue]api[/blue] - - Otherwise, it uses the first [bold]FastAPI[/bold] app found in the imported module or package. - """ - _run( - path=path, - host=host, - port=port, - reload=reload, - root_path=root_path, - app=app, - command="dev", - proxy_headers=proxy_headers, - ) - - -@app.command() -def run( - path: Annotated[ - Union[Path, None], - typer.Argument( - help="A path to a Python file or package directory (with [blue]__init__.py[/blue] files) containing a [bold]FastAPI[/bold] app. If not provided, a default set of paths will be tried." - ), - ] = None, - *, - host: Annotated[ - str, - typer.Option( - help="The host to serve on. For local development in localhost use [blue]127.0.0.1[/blue]. To enable public access, e.g. in a container, use all the IP addresses available with [blue]0.0.0.0[/blue]." - ), - ] = "0.0.0.0", - port: Annotated[ - int, - typer.Option( - help="The port to serve on. You would normally have a termination proxy on top (another program) handling HTTPS on port [blue]443[/blue] and HTTP on port [blue]80[/blue], transferring the communication to your app." - ), - ] = 8000, - reload: Annotated[ - bool, - typer.Option( - help="Enable auto-reload of the server when (code) files change. This is [bold]resource intensive[/bold], use it only during development." - ), - ] = False, - workers: Annotated[ - Union[int, None], - typer.Option( - help="Use multiple worker processes. Mutually exclusive with the --reload flag." - ), - ] = None, - root_path: Annotated[ - str, - typer.Option( - help="The root path is used to tell your app that it is being served to the outside world with some [bold]path prefix[/bold] set up in some termination proxy or similar." - ), - ] = "", - app: Annotated[ - Union[str, None], - typer.Option( - help="The name of the variable that contains the [bold]FastAPI[/bold] app in the imported module or package. If not provided, it is detected automatically." - ), - ] = None, - proxy_headers: Annotated[ - bool, - typer.Option( - help="Enable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to populate remote address info." - ), - ] = True, -) -> Any: - """ - Run a [bold]FastAPI[/bold] app in [green]production[/green] mode. 🚀 - - This is equivalent to [bold]fastapi dev[/bold] but with [bold]reload[/bold] disabled and listening on the [blue]0.0.0.0[/blue] address. - - It automatically detects the Python module or package that needs to be imported based on the file or directory path passed. - - If no path is passed, it tries with: - - - [blue]main.py[/blue] - - [blue]app.py[/blue] - - [blue]api.py[/blue] - - [blue]app/main.py[/blue] - - [blue]app/app.py[/blue] - - [blue]app/api.py[/blue] - - It also detects the directory that needs to be added to the [bold]PYTHONPATH[/bold] to make the app importable and adds it. - - It detects the [bold]FastAPI[/bold] app object to use. By default it looks in the module or package for an object named: - - - [blue]app[/blue] - - [blue]api[/blue] - - Otherwise, it uses the first [bold]FastAPI[/bold] app found in the imported module or package. - """ - _run( - path=path, - host=host, - port=port, - reload=reload, - workers=workers, - root_path=root_path, - app=app, - command="run", - proxy_headers=proxy_headers, - ) - - -def main() -> None: - app() diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/discover.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/discover.py deleted file mode 100644 index 43d0e9c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/discover.py +++ /dev/null @@ -1,132 +0,0 @@ -import importlib -import sys -from dataclasses import dataclass -from logging import getLogger -from pathlib import Path -from typing import List, Union - -from fastapi_cli.exceptions import FastAPICLIException - -logger = getLogger(__name__) - -try: - from fastapi import FastAPI -except ImportError: # pragma: no cover - FastAPI = None # type: ignore[misc, assignment] - - -def get_default_path() -> Path: - potential_paths = ( - "main.py", - "app.py", - "api.py", - "app/main.py", - "app/app.py", - "app/api.py", - ) - - for full_path in potential_paths: - path = Path(full_path) - if path.is_file(): - return path - - raise FastAPICLIException( - "Could not find a default file to run, please provide an explicit path" - ) - - -@dataclass -class ModuleData: - module_import_str: str - extra_sys_path: Path - module_paths: List[Path] - - -def get_module_data_from_path(path: Path) -> ModuleData: - use_path = path.resolve() - module_path = use_path - if use_path.is_file() and use_path.stem == "__init__": - module_path = use_path.parent - module_paths = [module_path] - extra_sys_path = module_path.parent - for parent in module_path.parents: - init_path = parent / "__init__.py" - if init_path.is_file(): - module_paths.insert(0, parent) - extra_sys_path = parent.parent - else: - break - - module_str = ".".join(p.stem for p in module_paths) - return ModuleData( - module_import_str=module_str, - extra_sys_path=extra_sys_path.resolve(), - module_paths=module_paths, - ) - - -def get_app_name(*, mod_data: ModuleData, app_name: Union[str, None] = None) -> str: - try: - mod = importlib.import_module(mod_data.module_import_str) - except (ImportError, ValueError) as e: - logger.error(f"Import error: {e}") - logger.warning( - "Ensure all the package directories have an [blue]__init__.py[/blue] file" - ) - raise - if not FastAPI: # type: ignore[truthy-function] - raise FastAPICLIException( - "Could not import FastAPI, try running 'pip install fastapi'" - ) from None - object_names = dir(mod) - object_names_set = set(object_names) - if app_name: - if app_name not in object_names_set: - raise FastAPICLIException( - f"Could not find app name {app_name} in {mod_data.module_import_str}" - ) - app = getattr(mod, app_name) - if not isinstance(app, FastAPI): - raise FastAPICLIException( - f"The app name {app_name} in {mod_data.module_import_str} doesn't seem to be a FastAPI app" - ) - return app_name - for preferred_name in ["app", "api"]: - if preferred_name in object_names_set: - obj = getattr(mod, preferred_name) - if isinstance(obj, FastAPI): - return preferred_name - for name in object_names: - obj = getattr(mod, name) - if isinstance(obj, FastAPI): - return name - raise FastAPICLIException("Could not find FastAPI app in module, try using --app") - - -@dataclass -class ImportData: - app_name: str - module_data: ModuleData - import_string: str - - -def get_import_data( - *, path: Union[Path, None] = None, app_name: Union[str, None] = None -) -> ImportData: - if not path: - path = get_default_path() - - logger.debug(f"Using path [blue]{path}[/blue]") - logger.debug(f"Resolved absolute path {path.resolve()}") - - if not path.exists(): - raise FastAPICLIException(f"Path does not exist {path}") - mod_data = get_module_data_from_path(path) - sys.path.insert(0, str(mod_data.extra_sys_path)) - use_app_name = get_app_name(mod_data=mod_data, app_name=app_name) - - import_string = f"{mod_data.module_import_str}:{use_app_name}" - - return ImportData( - app_name=use_app_name, module_data=mod_data, import_string=import_string - ) diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/exceptions.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/exceptions.py deleted file mode 100644 index a3d9a05..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/exceptions.py +++ /dev/null @@ -1,2 +0,0 @@ -class FastAPICLIException(Exception): - pass diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/logging.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/logging.py deleted file mode 100644 index 67f116c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/logging.py +++ /dev/null @@ -1,25 +0,0 @@ -import logging -from typing import Union - -from rich.console import Console -from rich.logging import RichHandler - - -def setup_logging( - terminal_width: Union[int, None] = None, level: int = logging.INFO -) -> None: - logger = logging.getLogger("fastapi_cli") - console = Console(width=terminal_width) if terminal_width else None - rich_handler = RichHandler( - show_time=False, - rich_tracebacks=True, - tracebacks_show_locals=True, - markup=True, - show_path=False, - console=console, - ) - rich_handler.setFormatter(logging.Formatter("%(message)s")) - logger.addHandler(rich_handler) - - logger.setLevel(level) - logger.propagate = False diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/py.typed b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__init__.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index e91c218..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__pycache__/cli.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__pycache__/cli.cpython-310.pyc deleted file mode 100644 index df3c141..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/__pycache__/cli.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/cli.py b/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/cli.py deleted file mode 100644 index f6805e7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/fastapi_cli/utils/cli.py +++ /dev/null @@ -1,76 +0,0 @@ -import logging -from typing import Any, Dict - -from rich_toolkit import RichToolkit, RichToolkitTheme -from rich_toolkit.styles import TaggedStyle -from uvicorn.logging import DefaultFormatter - - -class CustomFormatter(DefaultFormatter): - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.toolkit = get_rich_toolkit() - - def formatMessage(self, record: logging.LogRecord) -> str: - return self.toolkit.print_as_string(record.getMessage(), tag=record.levelname) - - -def get_uvicorn_log_config() -> Dict[str, Any]: - return { - "version": 1, - "disable_existing_loggers": False, - "formatters": { - "default": { - "()": CustomFormatter, - "fmt": "%(levelprefix)s %(message)s", - "use_colors": None, - }, - "access": { - "()": CustomFormatter, - "fmt": "%(levelprefix)s %(client_addr)s - '%(request_line)s' %(status_code)s", - }, - }, - "handlers": { - "default": { - "formatter": "default", - "class": "logging.StreamHandler", - "stream": "ext://sys.stderr", - }, - "access": { - "formatter": "access", - "class": "logging.StreamHandler", - "stream": "ext://sys.stdout", - }, - }, - "loggers": { - "uvicorn": {"handlers": ["default"], "level": "INFO"}, - "uvicorn.error": {"level": "INFO"}, - "uvicorn.access": { - "handlers": ["access"], - "level": "INFO", - "propagate": False, - }, - }, - } - - -logger = logging.getLogger(__name__) - - -def get_rich_toolkit() -> RichToolkit: - theme = RichToolkitTheme( - style=TaggedStyle(tag_width=11), - theme={ - "tag.title": "white on #009485", - "tag": "white on #007166", - "placeholder": "grey85", - "text": "white", - "selected": "#007166", - "result": "grey85", - "progress": "on #007166", - "error": "red", - "log.info": "black on blue", - }, - ) - - return RichToolkit(theme=theme) diff --git a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/METADATA deleted file mode 100644 index 8a2f639..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/METADATA +++ /dev/null @@ -1,202 +0,0 @@ -Metadata-Version: 2.4 -Name: h11 -Version: 0.16.0 -Summary: A pure-Python, bring-your-own-I/O implementation of HTTP/1.1 -Home-page: https://github.com/python-hyper/h11 -Author: Nathaniel J. Smith -Author-email: njs@pobox.com -License: MIT -Classifier: Development Status :: 3 - Alpha -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT 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.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Internet :: WWW/HTTP -Classifier: Topic :: System :: Networking -Requires-Python: >=3.8 -License-File: LICENSE.txt -Dynamic: author -Dynamic: author-email -Dynamic: classifier -Dynamic: description -Dynamic: home-page -Dynamic: license -Dynamic: license-file -Dynamic: requires-python -Dynamic: summary - -h11 -=== - -.. image:: https://travis-ci.org/python-hyper/h11.svg?branch=master - :target: https://travis-ci.org/python-hyper/h11 - :alt: Automated test status - -.. image:: https://codecov.io/gh/python-hyper/h11/branch/master/graph/badge.svg - :target: https://codecov.io/gh/python-hyper/h11 - :alt: Test coverage - -.. image:: https://readthedocs.org/projects/h11/badge/?version=latest - :target: http://h11.readthedocs.io/en/latest/?badge=latest - :alt: Documentation Status - -This is a little HTTP/1.1 library written from scratch in Python, -heavily inspired by `hyper-h2 `_. - -It's a "bring-your-own-I/O" library; h11 contains no IO code -whatsoever. This means you can hook h11 up to your favorite network -API, and that could be anything you want: synchronous, threaded, -asynchronous, or your own implementation of `RFC 6214 -`_ -- h11 won't judge you. -(Compare this to the current state of the art, where every time a `new -network API `_ comes along then someone -gets to start over reimplementing the entire HTTP protocol from -scratch.) Cory Benfield made an `excellent blog post describing the -benefits of this approach -`_, or if you like video -then here's his `PyCon 2016 talk on the same theme -`_. - -This also means that h11 is not immediately useful out of the box: -it's a toolkit for building programs that speak HTTP, not something -that could directly replace ``requests`` or ``twisted.web`` or -whatever. But h11 makes it much easier to implement something like -``requests`` or ``twisted.web``. - -At a high level, working with h11 goes like this: - -1) First, create an ``h11.Connection`` object to track the state of a - single HTTP/1.1 connection. - -2) When you read data off the network, pass it to - ``conn.receive_data(...)``; you'll get back a list of objects - representing high-level HTTP "events". - -3) When you want to send a high-level HTTP event, create the - corresponding "event" object and pass it to ``conn.send(...)``; - this will give you back some bytes that you can then push out - through the network. - -For example, a client might instantiate and then send a -``h11.Request`` object, then zero or more ``h11.Data`` objects for the -request body (e.g., if this is a POST), and then a -``h11.EndOfMessage`` to indicate the end of the message. Then the -server would then send back a ``h11.Response``, some ``h11.Data``, and -its own ``h11.EndOfMessage``. If either side violates the protocol, -you'll get a ``h11.ProtocolError`` exception. - -h11 is suitable for implementing both servers and clients, and has a -pleasantly symmetric API: the events you send as a client are exactly -the ones that you receive as a server and vice-versa. - -`Here's an example of a tiny HTTP client -`_ - -It also has `a fine manual `_. - -FAQ ---- - -*Whyyyyy?* - -I wanted to play with HTTP in `Curio -`__ and `Trio -`__, which at the time didn't have any -HTTP libraries. So I thought, no big deal, Python has, like, a dozen -different implementations of HTTP, surely I can find one that's -reusable. I didn't find one, but I did find Cory's call-to-arms -blog-post. So I figured, well, fine, if I have to implement HTTP from -scratch, at least I can make sure no-one *else* has to ever again. - -*Should I use it?* - -Maybe. You should be aware that it's a very young project. But, it's -feature complete and has an exhaustive test-suite and complete docs, -so the next step is for people to try using it and see how it goes -:-). If you do then please let us know -- if nothing else we'll want -to talk to you before making any incompatible changes! - -*What are the features/limitations?* - -Roughly speaking, it's trying to be a robust, complete, and non-hacky -implementation of the first "chapter" of the HTTP/1.1 spec: `RFC 7230: -HTTP/1.1 Message Syntax and Routing -`_. That is, it mostly focuses on -implementing HTTP at the level of taking bytes on and off the wire, -and the headers related to that, and tries to be anal about spec -conformance. It doesn't know about higher-level concerns like URL -routing, conditional GETs, cross-origin cookie policies, or content -negotiation. But it does know how to take care of framing, -cross-version differences in keep-alive handling, and the "obsolete -line folding" rule, so you can focus your energies on the hard / -interesting parts for your application, and it tries to support the -full specification in the sense that any useful HTTP/1.1 conformant -application should be able to use h11. - -It's pure Python, and has no dependencies outside of the standard -library. - -It has a test suite with 100.0% coverage for both statements and -branches. - -Currently it supports Python 3 (testing on 3.8-3.12) and PyPy 3. -The last Python 2-compatible version was h11 0.11.x. -(Originally it had a Cython wrapper for `http-parser -`_ and a beautiful nested state -machine implemented with ``yield from`` to postprocess the output. But -I had to take these out -- the new *parser* needs fewer lines-of-code -than the old *parser wrapper*, is written in pure Python, uses no -exotic language syntax, and has more features. It's sad, really; that -old state machine was really slick. I just need a few sentences here -to mourn that.) - -I don't know how fast it is. I haven't benchmarked or profiled it yet, -so it's probably got a few pointless hot spots, and I've been trying -to err on the side of simplicity and robustness instead of -micro-optimization. But at the architectural level I tried hard to -avoid fundamentally bad decisions, e.g., I believe that all the -parsing algorithms remain linear-time even in the face of pathological -input like slowloris, and there are no byte-by-byte loops. (I also -believe that it maintains bounded memory usage in the face of -arbitrary/pathological input.) - -The whole library is ~800 lines-of-code. You can read and understand -the whole thing in less than an hour. Most of the energy invested in -this so far has been spent on trying to keep things simple by -minimizing special-cases and ad hoc state manipulation; even though it -is now quite small and simple, I'm still annoyed that I haven't -figured out how to make it even smaller and simpler. (Unfortunately, -HTTP does not lend itself to simplicity.) - -The API is ~feature complete and I don't expect the general outlines -to change much, but you can't judge an API's ergonomics until you -actually document and use it, so I'd expect some changes in the -details. - -*How do I try it?* - -.. code-block:: sh - - $ pip install h11 - $ git clone git@github.com:python-hyper/h11 - $ cd h11/examples - $ python basic-client.py - -and go from there. - -*License?* - -MIT - -*Code of conduct?* - -Contributors are requested to follow our `code of conduct -`_ in -all project spaces. diff --git a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/RECORD deleted file mode 100644 index 43bafd3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/RECORD +++ /dev/null @@ -1,29 +0,0 @@ -h11-0.16.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -h11-0.16.0.dist-info/METADATA,sha256=KPMmCYrAn8unm48YD5YIfIQf4kViFct7hyqcfVzRnWQ,8348 -h11-0.16.0.dist-info/RECORD,, -h11-0.16.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91 -h11-0.16.0.dist-info/licenses/LICENSE.txt,sha256=N9tbuFkm2yikJ6JYZ_ELEjIAOuob5pzLhRE4rbjm82E,1124 -h11-0.16.0.dist-info/top_level.txt,sha256=F7dC4jl3zeh8TGHEPaWJrMbeuoWbS379Gwdi-Yvdcis,4 -h11/__init__.py,sha256=iO1KzkSO42yZ6ffg-VMgbx_ZVTWGUY00nRYEWn-s3kY,1507 -h11/__pycache__/__init__.cpython-310.pyc,, -h11/__pycache__/_abnf.cpython-310.pyc,, -h11/__pycache__/_connection.cpython-310.pyc,, -h11/__pycache__/_events.cpython-310.pyc,, -h11/__pycache__/_headers.cpython-310.pyc,, -h11/__pycache__/_readers.cpython-310.pyc,, -h11/__pycache__/_receivebuffer.cpython-310.pyc,, -h11/__pycache__/_state.cpython-310.pyc,, -h11/__pycache__/_util.cpython-310.pyc,, -h11/__pycache__/_version.cpython-310.pyc,, -h11/__pycache__/_writers.cpython-310.pyc,, -h11/_abnf.py,sha256=ybixr0xsupnkA6GFAyMubuXF6Tc1lb_hF890NgCsfNc,4815 -h11/_connection.py,sha256=k9YRVf6koZqbttBW36xSWaJpWdZwa-xQVU9AHEo9DuI,26863 -h11/_events.py,sha256=I97aXoal1Wu7dkL548BANBUCkOIbe-x5CioYA9IBY14,11792 -h11/_headers.py,sha256=P7D-lBNxHwdLZPLimmYwrPG-9ZkjElvvJZJdZAgSP-4,10412 -h11/_readers.py,sha256=a4RypORUCC3d0q_kxPuBIM7jTD8iLt5X91TH0FsduN4,8590 -h11/_receivebuffer.py,sha256=xrspsdsNgWFxRfQcTXxR8RrdjRXXTK0Io5cQYWpJ1Ws,5252 -h11/_state.py,sha256=_5LG_BGR8FCcFQeBPH-TMHgm_-B-EUcWCnQof_9XjFE,13231 -h11/_util.py,sha256=LWkkjXyJaFlAy6Lt39w73UStklFT5ovcvo0TkY7RYuk,4888 -h11/_version.py,sha256=GVSsbPSPDcOuF6ptfIiXnVJoaEm3ygXbMnqlr_Giahw,686 -h11/_writers.py,sha256=oFKm6PtjeHfbj4RLX7VB7KDc1gIY53gXG3_HR9ltmTA,5081 -h11/py.typed,sha256=sow9soTwP9T_gEAQSVh7Gb8855h04Nwmhs2We-JRgZM,7 diff --git a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/WHEEL deleted file mode 100644 index 1eb3c49..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (78.1.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/licenses/LICENSE.txt b/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/licenses/LICENSE.txt deleted file mode 100644 index 8f080ea..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/licenses/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Nathaniel J. Smith and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/top_level.txt deleted file mode 100644 index 0d24def..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11-0.16.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -h11 diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__init__.py b/write-message/venv/lib/python3.10/site-packages/h11/__init__.py deleted file mode 100644 index 989e92c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/__init__.py +++ /dev/null @@ -1,62 +0,0 @@ -# A highish-level implementation of the HTTP/1.1 wire protocol (RFC 7230), -# containing no networking code at all, loosely modelled on hyper-h2's generic -# implementation of HTTP/2 (and in particular the h2.connection.H2Connection -# class). There's still a bunch of subtle details you need to get right if you -# want to make this actually useful, because it doesn't implement all the -# semantics to check that what you're asking to write to the wire is sensible, -# but at least it gets you out of dealing with the wire itself. - -from h11._connection import Connection, NEED_DATA, PAUSED -from h11._events import ( - ConnectionClosed, - Data, - EndOfMessage, - Event, - InformationalResponse, - Request, - Response, -) -from h11._state import ( - CLIENT, - CLOSED, - DONE, - ERROR, - IDLE, - MIGHT_SWITCH_PROTOCOL, - MUST_CLOSE, - SEND_BODY, - SEND_RESPONSE, - SERVER, - SWITCHED_PROTOCOL, -) -from h11._util import LocalProtocolError, ProtocolError, RemoteProtocolError -from h11._version import __version__ - -PRODUCT_ID = "python-h11/" + __version__ - - -__all__ = ( - "Connection", - "NEED_DATA", - "PAUSED", - "ConnectionClosed", - "Data", - "EndOfMessage", - "Event", - "InformationalResponse", - "Request", - "Response", - "CLIENT", - "CLOSED", - "DONE", - "ERROR", - "IDLE", - "MUST_CLOSE", - "SEND_BODY", - "SEND_RESPONSE", - "SERVER", - "SWITCHED_PROTOCOL", - "ProtocolError", - "LocalProtocolError", - "RemoteProtocolError", -) diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 0e4c3a8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_abnf.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_abnf.cpython-310.pyc deleted file mode 100644 index f6b35d6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_abnf.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_connection.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_connection.cpython-310.pyc deleted file mode 100644 index 984deff..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_connection.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_events.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_events.cpython-310.pyc deleted file mode 100644 index eaa0e69..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_events.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_headers.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_headers.cpython-310.pyc deleted file mode 100644 index 7f77a7f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_headers.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_readers.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_readers.cpython-310.pyc deleted file mode 100644 index f1faaa2..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_readers.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_receivebuffer.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_receivebuffer.cpython-310.pyc deleted file mode 100644 index 741b1b4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_receivebuffer.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_state.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_state.cpython-310.pyc deleted file mode 100644 index a98f44c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_state.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_util.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_util.cpython-310.pyc deleted file mode 100644 index 5b3b03d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_util.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_version.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_version.cpython-310.pyc deleted file mode 100644 index 1fe3bce..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_version.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_writers.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_writers.cpython-310.pyc deleted file mode 100644 index f551835..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/h11/__pycache__/_writers.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_abnf.py b/write-message/venv/lib/python3.10/site-packages/h11/_abnf.py deleted file mode 100644 index 933587f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_abnf.py +++ /dev/null @@ -1,132 +0,0 @@ -# We use native strings for all the re patterns, to take advantage of string -# formatting, and then convert to bytestrings when compiling the final re -# objects. - -# https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230.html#whitespace -# OWS = *( SP / HTAB ) -# ; optional whitespace -OWS = r"[ \t]*" - -# https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230.html#rule.token.separators -# token = 1*tchar -# -# tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" -# / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" -# / DIGIT / ALPHA -# ; any VCHAR, except delimiters -token = r"[-!#$%&'*+.^_`|~0-9a-zA-Z]+" - -# https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230.html#header.fields -# field-name = token -field_name = token - -# The standard says: -# -# field-value = *( field-content / obs-fold ) -# field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] -# field-vchar = VCHAR / obs-text -# obs-fold = CRLF 1*( SP / HTAB ) -# ; obsolete line folding -# ; see Section 3.2.4 -# -# https://tools.ietf.org/html/rfc5234#appendix-B.1 -# -# VCHAR = %x21-7E -# ; visible (printing) characters -# -# https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230.html#rule.quoted-string -# obs-text = %x80-FF -# -# However, the standard definition of field-content is WRONG! It disallows -# fields containing a single visible character surrounded by whitespace, -# e.g. "foo a bar". -# -# See: https://www.rfc-editor.org/errata_search.php?rfc=7230&eid=4189 -# -# So our definition of field_content attempts to fix it up... -# -# Also, we allow lots of control characters, because apparently people assume -# that they're legal in practice (e.g., google analytics makes cookies with -# \x01 in them!): -# https://github.com/python-hyper/h11/issues/57 -# We still don't allow NUL or whitespace, because those are often treated as -# meta-characters and letting them through can lead to nasty issues like SSRF. -vchar = r"[\x21-\x7e]" -vchar_or_obs_text = r"[^\x00\s]" -field_vchar = vchar_or_obs_text -field_content = r"{field_vchar}+(?:[ \t]+{field_vchar}+)*".format(**globals()) - -# We handle obs-fold at a different level, and our fixed-up field_content -# already grows to swallow the whole value, so ? instead of * -field_value = r"({field_content})?".format(**globals()) - -# header-field = field-name ":" OWS field-value OWS -header_field = ( - r"(?P{field_name})" - r":" - r"{OWS}" - r"(?P{field_value})" - r"{OWS}".format(**globals()) -) - -# https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230.html#request.line -# -# request-line = method SP request-target SP HTTP-version CRLF -# method = token -# HTTP-version = HTTP-name "/" DIGIT "." DIGIT -# HTTP-name = %x48.54.54.50 ; "HTTP", case-sensitive -# -# request-target is complicated (see RFC 7230 sec 5.3) -- could be path, full -# URL, host+port (for connect), or even "*", but in any case we are guaranteed -# that it contists of the visible printing characters. -method = token -request_target = r"{vchar}+".format(**globals()) -http_version = r"HTTP/(?P[0-9]\.[0-9])" -request_line = ( - r"(?P{method})" - r" " - r"(?P{request_target})" - r" " - r"{http_version}".format(**globals()) -) - -# https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230.html#status.line -# -# status-line = HTTP-version SP status-code SP reason-phrase CRLF -# status-code = 3DIGIT -# reason-phrase = *( HTAB / SP / VCHAR / obs-text ) -status_code = r"[0-9]{3}" -reason_phrase = r"([ \t]|{vchar_or_obs_text})*".format(**globals()) -status_line = ( - r"{http_version}" - r" " - r"(?P{status_code})" - # However, there are apparently a few too many servers out there that just - # leave out the reason phrase: - # https://github.com/scrapy/scrapy/issues/345#issuecomment-281756036 - # https://github.com/seanmonstar/httparse/issues/29 - # so make it optional. ?: is a non-capturing group. - r"(?: (?P{reason_phrase}))?".format(**globals()) -) - -HEXDIG = r"[0-9A-Fa-f]" -# Actually -# -# chunk-size = 1*HEXDIG -# -# but we impose an upper-limit to avoid ridiculosity. len(str(2**64)) == 20 -chunk_size = r"({HEXDIG}){{1,20}}".format(**globals()) -# Actually -# -# chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) -# -# but we aren't parsing the things so we don't really care. -chunk_ext = r";.*" -chunk_header = ( - r"(?P{chunk_size})" - r"(?P{chunk_ext})?" - r"{OWS}\r\n".format( - **globals() - ) # Even though the specification does not allow for extra whitespaces, - # we are lenient with trailing whitespaces because some servers on the wild use it. -) diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_connection.py b/write-message/venv/lib/python3.10/site-packages/h11/_connection.py deleted file mode 100644 index e37d82a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_connection.py +++ /dev/null @@ -1,659 +0,0 @@ -# This contains the main Connection class. Everything in h11 revolves around -# this. -from typing import ( - Any, - Callable, - cast, - Dict, - List, - Optional, - overload, - Tuple, - Type, - Union, -) - -from ._events import ( - ConnectionClosed, - Data, - EndOfMessage, - Event, - InformationalResponse, - Request, - Response, -) -from ._headers import get_comma_header, has_expect_100_continue, set_comma_header -from ._readers import READERS, ReadersType -from ._receivebuffer import ReceiveBuffer -from ._state import ( - _SWITCH_CONNECT, - _SWITCH_UPGRADE, - CLIENT, - ConnectionState, - DONE, - ERROR, - MIGHT_SWITCH_PROTOCOL, - SEND_BODY, - SERVER, - SWITCHED_PROTOCOL, -) -from ._util import ( # Import the internal things we need - LocalProtocolError, - RemoteProtocolError, - Sentinel, -) -from ._writers import WRITERS, WritersType - -# Everything in __all__ gets re-exported as part of the h11 public API. -__all__ = ["Connection", "NEED_DATA", "PAUSED"] - - -class NEED_DATA(Sentinel, metaclass=Sentinel): - pass - - -class PAUSED(Sentinel, metaclass=Sentinel): - pass - - -# If we ever have this much buffered without it making a complete parseable -# event, we error out. The only time we really buffer is when reading the -# request/response line + headers together, so this is effectively the limit on -# the size of that. -# -# Some precedents for defaults: -# - node.js: 80 * 1024 -# - tomcat: 8 * 1024 -# - IIS: 16 * 1024 -# - Apache: <8 KiB per line> -DEFAULT_MAX_INCOMPLETE_EVENT_SIZE = 16 * 1024 - - -# RFC 7230's rules for connection lifecycles: -# - If either side says they want to close the connection, then the connection -# must close. -# - HTTP/1.1 defaults to keep-alive unless someone says Connection: close -# - HTTP/1.0 defaults to close unless both sides say Connection: keep-alive -# (and even this is a mess -- e.g. if you're implementing a proxy then -# sending Connection: keep-alive is forbidden). -# -# We simplify life by simply not supporting keep-alive with HTTP/1.0 peers. So -# our rule is: -# - If someone says Connection: close, we will close -# - If someone uses HTTP/1.0, we will close. -def _keep_alive(event: Union[Request, Response]) -> bool: - connection = get_comma_header(event.headers, b"connection") - if b"close" in connection: - return False - if getattr(event, "http_version", b"1.1") < b"1.1": - return False - return True - - -def _body_framing( - request_method: bytes, event: Union[Request, Response] -) -> Tuple[str, Union[Tuple[()], Tuple[int]]]: - # Called when we enter SEND_BODY to figure out framing information for - # this body. - # - # These are the only two events that can trigger a SEND_BODY state: - assert type(event) in (Request, Response) - # Returns one of: - # - # ("content-length", count) - # ("chunked", ()) - # ("http/1.0", ()) - # - # which are (lookup key, *args) for constructing body reader/writer - # objects. - # - # Reference: https://tools.ietf.org/html/rfc7230#section-3.3.3 - # - # Step 1: some responses always have an empty body, regardless of what the - # headers say. - if type(event) is Response: - if ( - event.status_code in (204, 304) - or request_method == b"HEAD" - or (request_method == b"CONNECT" and 200 <= event.status_code < 300) - ): - return ("content-length", (0,)) - # Section 3.3.3 also lists another case -- responses with status_code - # < 200. For us these are InformationalResponses, not Responses, so - # they can't get into this function in the first place. - assert event.status_code >= 200 - - # Step 2: check for Transfer-Encoding (T-E beats C-L): - transfer_encodings = get_comma_header(event.headers, b"transfer-encoding") - if transfer_encodings: - assert transfer_encodings == [b"chunked"] - return ("chunked", ()) - - # Step 3: check for Content-Length - content_lengths = get_comma_header(event.headers, b"content-length") - if content_lengths: - return ("content-length", (int(content_lengths[0]),)) - - # Step 4: no applicable headers; fallback/default depends on type - if type(event) is Request: - return ("content-length", (0,)) - else: - return ("http/1.0", ()) - - -################################################################ -# -# The main Connection class -# -################################################################ - - -class Connection: - """An object encapsulating the state of an HTTP connection. - - Args: - our_role: If you're implementing a client, pass :data:`h11.CLIENT`. If - you're implementing a server, pass :data:`h11.SERVER`. - - max_incomplete_event_size (int): - The maximum number of bytes we're willing to buffer of an - incomplete event. In practice this mostly sets a limit on the - maximum size of the request/response line + headers. If this is - exceeded, then :meth:`next_event` will raise - :exc:`RemoteProtocolError`. - - """ - - def __init__( - self, - our_role: Type[Sentinel], - max_incomplete_event_size: int = DEFAULT_MAX_INCOMPLETE_EVENT_SIZE, - ) -> None: - self._max_incomplete_event_size = max_incomplete_event_size - # State and role tracking - if our_role not in (CLIENT, SERVER): - raise ValueError(f"expected CLIENT or SERVER, not {our_role!r}") - self.our_role = our_role - self.their_role: Type[Sentinel] - if our_role is CLIENT: - self.their_role = SERVER - else: - self.their_role = CLIENT - self._cstate = ConnectionState() - - # Callables for converting data->events or vice-versa given the - # current state - self._writer = self._get_io_object(self.our_role, None, WRITERS) - self._reader = self._get_io_object(self.their_role, None, READERS) - - # Holds any unprocessed received data - self._receive_buffer = ReceiveBuffer() - # If this is true, then it indicates that the incoming connection was - # closed *after* the end of whatever's in self._receive_buffer: - self._receive_buffer_closed = False - - # Extra bits of state that don't fit into the state machine. - # - # These two are only used to interpret framing headers for figuring - # out how to read/write response bodies. their_http_version is also - # made available as a convenient public API. - self.their_http_version: Optional[bytes] = None - self._request_method: Optional[bytes] = None - # This is pure flow-control and doesn't at all affect the set of legal - # transitions, so no need to bother ConnectionState with it: - self.client_is_waiting_for_100_continue = False - - @property - def states(self) -> Dict[Type[Sentinel], Type[Sentinel]]: - """A dictionary like:: - - {CLIENT: , SERVER: } - - See :ref:`state-machine` for details. - - """ - return dict(self._cstate.states) - - @property - def our_state(self) -> Type[Sentinel]: - """The current state of whichever role we are playing. See - :ref:`state-machine` for details. - """ - return self._cstate.states[self.our_role] - - @property - def their_state(self) -> Type[Sentinel]: - """The current state of whichever role we are NOT playing. See - :ref:`state-machine` for details. - """ - return self._cstate.states[self.their_role] - - @property - def they_are_waiting_for_100_continue(self) -> bool: - return self.their_role is CLIENT and self.client_is_waiting_for_100_continue - - def start_next_cycle(self) -> None: - """Attempt to reset our connection state for a new request/response - cycle. - - If both client and server are in :data:`DONE` state, then resets them - both to :data:`IDLE` state in preparation for a new request/response - cycle on this same connection. Otherwise, raises a - :exc:`LocalProtocolError`. - - See :ref:`keepalive-and-pipelining`. - - """ - old_states = dict(self._cstate.states) - self._cstate.start_next_cycle() - self._request_method = None - # self.their_http_version gets left alone, since it presumably lasts - # beyond a single request/response cycle - assert not self.client_is_waiting_for_100_continue - self._respond_to_state_changes(old_states) - - def _process_error(self, role: Type[Sentinel]) -> None: - old_states = dict(self._cstate.states) - self._cstate.process_error(role) - self._respond_to_state_changes(old_states) - - def _server_switch_event(self, event: Event) -> Optional[Type[Sentinel]]: - if type(event) is InformationalResponse and event.status_code == 101: - return _SWITCH_UPGRADE - if type(event) is Response: - if ( - _SWITCH_CONNECT in self._cstate.pending_switch_proposals - and 200 <= event.status_code < 300 - ): - return _SWITCH_CONNECT - return None - - # All events go through here - def _process_event(self, role: Type[Sentinel], event: Event) -> None: - # First, pass the event through the state machine to make sure it - # succeeds. - old_states = dict(self._cstate.states) - if role is CLIENT and type(event) is Request: - if event.method == b"CONNECT": - self._cstate.process_client_switch_proposal(_SWITCH_CONNECT) - if get_comma_header(event.headers, b"upgrade"): - self._cstate.process_client_switch_proposal(_SWITCH_UPGRADE) - server_switch_event = None - if role is SERVER: - server_switch_event = self._server_switch_event(event) - self._cstate.process_event(role, type(event), server_switch_event) - - # Then perform the updates triggered by it. - - if type(event) is Request: - self._request_method = event.method - - if role is self.their_role and type(event) in ( - Request, - Response, - InformationalResponse, - ): - event = cast(Union[Request, Response, InformationalResponse], event) - self.their_http_version = event.http_version - - # Keep alive handling - # - # RFC 7230 doesn't really say what one should do if Connection: close - # shows up on a 1xx InformationalResponse. I think the idea is that - # this is not supposed to happen. In any case, if it does happen, we - # ignore it. - if type(event) in (Request, Response) and not _keep_alive( - cast(Union[Request, Response], event) - ): - self._cstate.process_keep_alive_disabled() - - # 100-continue - if type(event) is Request and has_expect_100_continue(event): - self.client_is_waiting_for_100_continue = True - if type(event) in (InformationalResponse, Response): - self.client_is_waiting_for_100_continue = False - if role is CLIENT and type(event) in (Data, EndOfMessage): - self.client_is_waiting_for_100_continue = False - - self._respond_to_state_changes(old_states, event) - - def _get_io_object( - self, - role: Type[Sentinel], - event: Optional[Event], - io_dict: Union[ReadersType, WritersType], - ) -> Optional[Callable[..., Any]]: - # event may be None; it's only used when entering SEND_BODY - state = self._cstate.states[role] - if state is SEND_BODY: - # Special case: the io_dict has a dict of reader/writer factories - # that depend on the request/response framing. - framing_type, args = _body_framing( - cast(bytes, self._request_method), cast(Union[Request, Response], event) - ) - return io_dict[SEND_BODY][framing_type](*args) # type: ignore[index] - else: - # General case: the io_dict just has the appropriate reader/writer - # for this state - return io_dict.get((role, state)) # type: ignore[return-value] - - # This must be called after any action that might have caused - # self._cstate.states to change. - def _respond_to_state_changes( - self, - old_states: Dict[Type[Sentinel], Type[Sentinel]], - event: Optional[Event] = None, - ) -> None: - # Update reader/writer - if self.our_state != old_states[self.our_role]: - self._writer = self._get_io_object(self.our_role, event, WRITERS) - if self.their_state != old_states[self.their_role]: - self._reader = self._get_io_object(self.their_role, event, READERS) - - @property - def trailing_data(self) -> Tuple[bytes, bool]: - """Data that has been received, but not yet processed, represented as - a tuple with two elements, where the first is a byte-string containing - the unprocessed data itself, and the second is a bool that is True if - the receive connection was closed. - - See :ref:`switching-protocols` for discussion of why you'd want this. - """ - return (bytes(self._receive_buffer), self._receive_buffer_closed) - - def receive_data(self, data: bytes) -> None: - """Add data to our internal receive buffer. - - This does not actually do any processing on the data, just stores - it. To trigger processing, you have to call :meth:`next_event`. - - Args: - data (:term:`bytes-like object`): - The new data that was just received. - - Special case: If *data* is an empty byte-string like ``b""``, - then this indicates that the remote side has closed the - connection (end of file). Normally this is convenient, because - standard Python APIs like :meth:`file.read` or - :meth:`socket.recv` use ``b""`` to indicate end-of-file, while - other failures to read are indicated using other mechanisms - like raising :exc:`TimeoutError`. When using such an API you - can just blindly pass through whatever you get from ``read`` - to :meth:`receive_data`, and everything will work. - - But, if you have an API where reading an empty string is a - valid non-EOF condition, then you need to be aware of this and - make sure to check for such strings and avoid passing them to - :meth:`receive_data`. - - Returns: - Nothing, but after calling this you should call :meth:`next_event` - to parse the newly received data. - - Raises: - RuntimeError: - Raised if you pass an empty *data*, indicating EOF, and then - pass a non-empty *data*, indicating more data that somehow - arrived after the EOF. - - (Calling ``receive_data(b"")`` multiple times is fine, - and equivalent to calling it once.) - - """ - if data: - if self._receive_buffer_closed: - raise RuntimeError("received close, then received more data?") - self._receive_buffer += data - else: - self._receive_buffer_closed = True - - def _extract_next_receive_event( - self, - ) -> Union[Event, Type[NEED_DATA], Type[PAUSED]]: - state = self.their_state - # We don't pause immediately when they enter DONE, because even in - # DONE state we can still process a ConnectionClosed() event. But - # if we have data in our buffer, then we definitely aren't getting - # a ConnectionClosed() immediately and we need to pause. - if state is DONE and self._receive_buffer: - return PAUSED - if state is MIGHT_SWITCH_PROTOCOL or state is SWITCHED_PROTOCOL: - return PAUSED - assert self._reader is not None - event = self._reader(self._receive_buffer) - if event is None: - if not self._receive_buffer and self._receive_buffer_closed: - # In some unusual cases (basically just HTTP/1.0 bodies), EOF - # triggers an actual protocol event; in that case, we want to - # return that event, and then the state will change and we'll - # get called again to generate the actual ConnectionClosed(). - if hasattr(self._reader, "read_eof"): - event = self._reader.read_eof() - else: - event = ConnectionClosed() - if event is None: - event = NEED_DATA - return event # type: ignore[no-any-return] - - def next_event(self) -> Union[Event, Type[NEED_DATA], Type[PAUSED]]: - """Parse the next event out of our receive buffer, update our internal - state, and return it. - - This is a mutating operation -- think of it like calling :func:`next` - on an iterator. - - Returns: - : One of three things: - - 1) An event object -- see :ref:`events`. - - 2) The special constant :data:`NEED_DATA`, which indicates that - you need to read more data from your socket and pass it to - :meth:`receive_data` before this method will be able to return - any more events. - - 3) The special constant :data:`PAUSED`, which indicates that we - are not in a state where we can process incoming data (usually - because the peer has finished their part of the current - request/response cycle, and you have not yet called - :meth:`start_next_cycle`). See :ref:`flow-control` for details. - - Raises: - RemoteProtocolError: - The peer has misbehaved. You should close the connection - (possibly after sending some kind of 4xx response). - - Once this method returns :class:`ConnectionClosed` once, then all - subsequent calls will also return :class:`ConnectionClosed`. - - If this method raises any exception besides :exc:`RemoteProtocolError` - then that's a bug -- if it happens please file a bug report! - - If this method raises any exception then it also sets - :attr:`Connection.their_state` to :data:`ERROR` -- see - :ref:`error-handling` for discussion. - - """ - - if self.their_state is ERROR: - raise RemoteProtocolError("Can't receive data when peer state is ERROR") - try: - event = self._extract_next_receive_event() - if event not in [NEED_DATA, PAUSED]: - self._process_event(self.their_role, cast(Event, event)) - if event is NEED_DATA: - if len(self._receive_buffer) > self._max_incomplete_event_size: - # 431 is "Request header fields too large" which is pretty - # much the only situation where we can get here - raise RemoteProtocolError( - "Receive buffer too long", error_status_hint=431 - ) - if self._receive_buffer_closed: - # We're still trying to complete some event, but that's - # never going to happen because no more data is coming - raise RemoteProtocolError("peer unexpectedly closed connection") - return event - except BaseException as exc: - self._process_error(self.their_role) - if isinstance(exc, LocalProtocolError): - exc._reraise_as_remote_protocol_error() - else: - raise - - @overload - def send(self, event: ConnectionClosed) -> None: - ... - - @overload - def send( - self, event: Union[Request, InformationalResponse, Response, Data, EndOfMessage] - ) -> bytes: - ... - - @overload - def send(self, event: Event) -> Optional[bytes]: - ... - - def send(self, event: Event) -> Optional[bytes]: - """Convert a high-level event into bytes that can be sent to the peer, - while updating our internal state machine. - - Args: - event: The :ref:`event ` to send. - - Returns: - If ``type(event) is ConnectionClosed``, then returns - ``None``. Otherwise, returns a :term:`bytes-like object`. - - Raises: - LocalProtocolError: - Sending this event at this time would violate our - understanding of the HTTP/1.1 protocol. - - If this method raises any exception then it also sets - :attr:`Connection.our_state` to :data:`ERROR` -- see - :ref:`error-handling` for discussion. - - """ - data_list = self.send_with_data_passthrough(event) - if data_list is None: - return None - else: - return b"".join(data_list) - - def send_with_data_passthrough(self, event: Event) -> Optional[List[bytes]]: - """Identical to :meth:`send`, except that in situations where - :meth:`send` returns a single :term:`bytes-like object`, this instead - returns a list of them -- and when sending a :class:`Data` event, this - list is guaranteed to contain the exact object you passed in as - :attr:`Data.data`. See :ref:`sendfile` for discussion. - - """ - if self.our_state is ERROR: - raise LocalProtocolError("Can't send data when our state is ERROR") - try: - if type(event) is Response: - event = self._clean_up_response_headers_for_sending(event) - # We want to call _process_event before calling the writer, - # because if someone tries to do something invalid then this will - # give a sensible error message, while our writers all just assume - # they will only receive valid events. But, _process_event might - # change self._writer. So we have to do a little dance: - writer = self._writer - self._process_event(self.our_role, event) - if type(event) is ConnectionClosed: - return None - else: - # In any situation where writer is None, process_event should - # have raised ProtocolError - assert writer is not None - data_list: List[bytes] = [] - writer(event, data_list.append) - return data_list - except: - self._process_error(self.our_role) - raise - - def send_failed(self) -> None: - """Notify the state machine that we failed to send the data it gave - us. - - This causes :attr:`Connection.our_state` to immediately become - :data:`ERROR` -- see :ref:`error-handling` for discussion. - - """ - self._process_error(self.our_role) - - # When sending a Response, we take responsibility for a few things: - # - # - Sometimes you MUST set Connection: close. We take care of those - # times. (You can also set it yourself if you want, and if you do then - # we'll respect that and close the connection at the right time. But you - # don't have to worry about that unless you want to.) - # - # - The user has to set Content-Length if they want it. Otherwise, for - # responses that have bodies (e.g. not HEAD), then we will automatically - # select the right mechanism for streaming a body of unknown length, - # which depends on depending on the peer's HTTP version. - # - # This function's *only* responsibility is making sure headers are set up - # right -- everything downstream just looks at the headers. There are no - # side channels. - def _clean_up_response_headers_for_sending(self, response: Response) -> Response: - assert type(response) is Response - - headers = response.headers - need_close = False - - # HEAD requests need some special handling: they always act like they - # have Content-Length: 0, and that's how _body_framing treats - # them. But their headers are supposed to match what we would send if - # the request was a GET. (Technically there is one deviation allowed: - # we're allowed to leave out the framing headers -- see - # https://tools.ietf.org/html/rfc7231#section-4.3.2 . But it's just as - # easy to get them right.) - method_for_choosing_headers = cast(bytes, self._request_method) - if method_for_choosing_headers == b"HEAD": - method_for_choosing_headers = b"GET" - framing_type, _ = _body_framing(method_for_choosing_headers, response) - if framing_type in ("chunked", "http/1.0"): - # This response has a body of unknown length. - # If our peer is HTTP/1.1, we use Transfer-Encoding: chunked - # If our peer is HTTP/1.0, we use no framing headers, and close the - # connection afterwards. - # - # Make sure to clear Content-Length (in principle user could have - # set both and then we ignored Content-Length b/c - # Transfer-Encoding overwrote it -- this would be naughty of them, - # but the HTTP spec says that if our peer does this then we have - # to fix it instead of erroring out, so we'll accord the user the - # same respect). - headers = set_comma_header(headers, b"content-length", []) - if self.their_http_version is None or self.their_http_version < b"1.1": - # Either we never got a valid request and are sending back an - # error (their_http_version is None), so we assume the worst; - # or else we did get a valid HTTP/1.0 request, so we know that - # they don't understand chunked encoding. - headers = set_comma_header(headers, b"transfer-encoding", []) - # This is actually redundant ATM, since currently we - # unconditionally disable keep-alive when talking to HTTP/1.0 - # peers. But let's be defensive just in case we add - # Connection: keep-alive support later: - if self._request_method != b"HEAD": - need_close = True - else: - headers = set_comma_header(headers, b"transfer-encoding", [b"chunked"]) - - if not self._cstate.keep_alive or need_close: - # Make sure Connection: close is set - connection = set(get_comma_header(headers, b"connection")) - connection.discard(b"keep-alive") - connection.add(b"close") - headers = set_comma_header(headers, b"connection", sorted(connection)) - - return Response( - headers=headers, - status_code=response.status_code, - http_version=response.http_version, - reason=response.reason, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_events.py b/write-message/venv/lib/python3.10/site-packages/h11/_events.py deleted file mode 100644 index ca1c3ad..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_events.py +++ /dev/null @@ -1,369 +0,0 @@ -# High level events that make up HTTP/1.1 conversations. Loosely inspired by -# the corresponding events in hyper-h2: -# -# http://python-hyper.org/h2/en/stable/api.html#events -# -# Don't subclass these. Stuff will break. - -import re -from abc import ABC -from dataclasses import dataclass -from typing import List, Tuple, Union - -from ._abnf import method, request_target -from ._headers import Headers, normalize_and_validate -from ._util import bytesify, LocalProtocolError, validate - -# Everything in __all__ gets re-exported as part of the h11 public API. -__all__ = [ - "Event", - "Request", - "InformationalResponse", - "Response", - "Data", - "EndOfMessage", - "ConnectionClosed", -] - -method_re = re.compile(method.encode("ascii")) -request_target_re = re.compile(request_target.encode("ascii")) - - -class Event(ABC): - """ - Base class for h11 events. - """ - - __slots__ = () - - -@dataclass(init=False, frozen=True) -class Request(Event): - """The beginning of an HTTP request. - - Fields: - - .. attribute:: method - - An HTTP method, e.g. ``b"GET"`` or ``b"POST"``. Always a byte - string. :term:`Bytes-like objects ` and native - strings containing only ascii characters will be automatically - converted to byte strings. - - .. attribute:: target - - The target of an HTTP request, e.g. ``b"/index.html"``, or one of the - more exotic formats described in `RFC 7320, section 5.3 - `_. Always a byte - string. :term:`Bytes-like objects ` and native - strings containing only ascii characters will be automatically - converted to byte strings. - - .. attribute:: headers - - Request headers, represented as a list of (name, value) pairs. See - :ref:`the header normalization rules ` for details. - - .. attribute:: http_version - - The HTTP protocol version, represented as a byte string like - ``b"1.1"``. See :ref:`the HTTP version normalization rules - ` for details. - - """ - - __slots__ = ("method", "headers", "target", "http_version") - - method: bytes - headers: Headers - target: bytes - http_version: bytes - - def __init__( - self, - *, - method: Union[bytes, str], - headers: Union[Headers, List[Tuple[bytes, bytes]], List[Tuple[str, str]]], - target: Union[bytes, str], - http_version: Union[bytes, str] = b"1.1", - _parsed: bool = False, - ) -> None: - super().__init__() - if isinstance(headers, Headers): - object.__setattr__(self, "headers", headers) - else: - object.__setattr__( - self, "headers", normalize_and_validate(headers, _parsed=_parsed) - ) - if not _parsed: - object.__setattr__(self, "method", bytesify(method)) - object.__setattr__(self, "target", bytesify(target)) - object.__setattr__(self, "http_version", bytesify(http_version)) - else: - object.__setattr__(self, "method", method) - object.__setattr__(self, "target", target) - object.__setattr__(self, "http_version", http_version) - - # "A server MUST respond with a 400 (Bad Request) status code to any - # HTTP/1.1 request message that lacks a Host header field and to any - # request message that contains more than one Host header field or a - # Host header field with an invalid field-value." - # -- https://tools.ietf.org/html/rfc7230#section-5.4 - host_count = 0 - for name, value in self.headers: - if name == b"host": - host_count += 1 - if self.http_version == b"1.1" and host_count == 0: - raise LocalProtocolError("Missing mandatory Host: header") - if host_count > 1: - raise LocalProtocolError("Found multiple Host: headers") - - validate(method_re, self.method, "Illegal method characters") - validate(request_target_re, self.target, "Illegal target characters") - - # This is an unhashable type. - __hash__ = None # type: ignore - - -@dataclass(init=False, frozen=True) -class _ResponseBase(Event): - __slots__ = ("headers", "http_version", "reason", "status_code") - - headers: Headers - http_version: bytes - reason: bytes - status_code: int - - def __init__( - self, - *, - headers: Union[Headers, List[Tuple[bytes, bytes]], List[Tuple[str, str]]], - status_code: int, - http_version: Union[bytes, str] = b"1.1", - reason: Union[bytes, str] = b"", - _parsed: bool = False, - ) -> None: - super().__init__() - if isinstance(headers, Headers): - object.__setattr__(self, "headers", headers) - else: - object.__setattr__( - self, "headers", normalize_and_validate(headers, _parsed=_parsed) - ) - if not _parsed: - object.__setattr__(self, "reason", bytesify(reason)) - object.__setattr__(self, "http_version", bytesify(http_version)) - if not isinstance(status_code, int): - raise LocalProtocolError("status code must be integer") - # Because IntEnum objects are instances of int, but aren't - # duck-compatible (sigh), see gh-72. - object.__setattr__(self, "status_code", int(status_code)) - else: - object.__setattr__(self, "reason", reason) - object.__setattr__(self, "http_version", http_version) - object.__setattr__(self, "status_code", status_code) - - self.__post_init__() - - def __post_init__(self) -> None: - pass - - # This is an unhashable type. - __hash__ = None # type: ignore - - -@dataclass(init=False, frozen=True) -class InformationalResponse(_ResponseBase): - """An HTTP informational response. - - Fields: - - .. attribute:: status_code - - The status code of this response, as an integer. For an - :class:`InformationalResponse`, this is always in the range [100, - 200). - - .. attribute:: headers - - Request headers, represented as a list of (name, value) pairs. See - :ref:`the header normalization rules ` for - details. - - .. attribute:: http_version - - The HTTP protocol version, represented as a byte string like - ``b"1.1"``. See :ref:`the HTTP version normalization rules - ` for details. - - .. attribute:: reason - - The reason phrase of this response, as a byte string. For example: - ``b"OK"``, or ``b"Not Found"``. - - """ - - def __post_init__(self) -> None: - if not (100 <= self.status_code < 200): - raise LocalProtocolError( - "InformationalResponse status_code should be in range " - "[100, 200), not {}".format(self.status_code) - ) - - # This is an unhashable type. - __hash__ = None # type: ignore - - -@dataclass(init=False, frozen=True) -class Response(_ResponseBase): - """The beginning of an HTTP response. - - Fields: - - .. attribute:: status_code - - The status code of this response, as an integer. For an - :class:`Response`, this is always in the range [200, - 1000). - - .. attribute:: headers - - Request headers, represented as a list of (name, value) pairs. See - :ref:`the header normalization rules ` for details. - - .. attribute:: http_version - - The HTTP protocol version, represented as a byte string like - ``b"1.1"``. See :ref:`the HTTP version normalization rules - ` for details. - - .. attribute:: reason - - The reason phrase of this response, as a byte string. For example: - ``b"OK"``, or ``b"Not Found"``. - - """ - - def __post_init__(self) -> None: - if not (200 <= self.status_code < 1000): - raise LocalProtocolError( - "Response status_code should be in range [200, 1000), not {}".format( - self.status_code - ) - ) - - # This is an unhashable type. - __hash__ = None # type: ignore - - -@dataclass(init=False, frozen=True) -class Data(Event): - """Part of an HTTP message body. - - Fields: - - .. attribute:: data - - A :term:`bytes-like object` containing part of a message body. Or, if - using the ``combine=False`` argument to :meth:`Connection.send`, then - any object that your socket writing code knows what to do with, and for - which calling :func:`len` returns the number of bytes that will be - written -- see :ref:`sendfile` for details. - - .. attribute:: chunk_start - - A marker that indicates whether this data object is from the start of a - chunked transfer encoding chunk. This field is ignored when when a Data - event is provided to :meth:`Connection.send`: it is only valid on - events emitted from :meth:`Connection.next_event`. You probably - shouldn't use this attribute at all; see - :ref:`chunk-delimiters-are-bad` for details. - - .. attribute:: chunk_end - - A marker that indicates whether this data object is the last for a - given chunked transfer encoding chunk. This field is ignored when when - a Data event is provided to :meth:`Connection.send`: it is only valid - on events emitted from :meth:`Connection.next_event`. You probably - shouldn't use this attribute at all; see - :ref:`chunk-delimiters-are-bad` for details. - - """ - - __slots__ = ("data", "chunk_start", "chunk_end") - - data: bytes - chunk_start: bool - chunk_end: bool - - def __init__( - self, data: bytes, chunk_start: bool = False, chunk_end: bool = False - ) -> None: - object.__setattr__(self, "data", data) - object.__setattr__(self, "chunk_start", chunk_start) - object.__setattr__(self, "chunk_end", chunk_end) - - # This is an unhashable type. - __hash__ = None # type: ignore - - -# XX FIXME: "A recipient MUST ignore (or consider as an error) any fields that -# are forbidden to be sent in a trailer, since processing them as if they were -# present in the header section might bypass external security filters." -# https://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7230.html#chunked.trailer.part -# Unfortunately, the list of forbidden fields is long and vague :-/ -@dataclass(init=False, frozen=True) -class EndOfMessage(Event): - """The end of an HTTP message. - - Fields: - - .. attribute:: headers - - Default value: ``[]`` - - Any trailing headers attached to this message, represented as a list of - (name, value) pairs. See :ref:`the header normalization rules - ` for details. - - Must be empty unless ``Transfer-Encoding: chunked`` is in use. - - """ - - __slots__ = ("headers",) - - headers: Headers - - def __init__( - self, - *, - headers: Union[ - Headers, List[Tuple[bytes, bytes]], List[Tuple[str, str]], None - ] = None, - _parsed: bool = False, - ) -> None: - super().__init__() - if headers is None: - headers = Headers([]) - elif not isinstance(headers, Headers): - headers = normalize_and_validate(headers, _parsed=_parsed) - - object.__setattr__(self, "headers", headers) - - # This is an unhashable type. - __hash__ = None # type: ignore - - -@dataclass(frozen=True) -class ConnectionClosed(Event): - """This event indicates that the sender has closed their outgoing - connection. - - Note that this does not necessarily mean that they can't *receive* further - data, because TCP connections are composed to two one-way channels which - can be closed independently. See :ref:`closing` for details. - - No fields. - """ - - pass diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_headers.py b/write-message/venv/lib/python3.10/site-packages/h11/_headers.py deleted file mode 100644 index 31da3e2..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_headers.py +++ /dev/null @@ -1,282 +0,0 @@ -import re -from typing import AnyStr, cast, List, overload, Sequence, Tuple, TYPE_CHECKING, Union - -from ._abnf import field_name, field_value -from ._util import bytesify, LocalProtocolError, validate - -if TYPE_CHECKING: - from ._events import Request - -try: - from typing import Literal -except ImportError: - from typing_extensions import Literal # type: ignore - -CONTENT_LENGTH_MAX_DIGITS = 20 # allow up to 1 billion TB - 1 - - -# Facts -# ----- -# -# Headers are: -# keys: case-insensitive ascii -# values: mixture of ascii and raw bytes -# -# "Historically, HTTP has allowed field content with text in the ISO-8859-1 -# charset [ISO-8859-1], supporting other charsets only through use of -# [RFC2047] encoding. In practice, most HTTP header field values use only a -# subset of the US-ASCII charset [USASCII]. Newly defined header fields SHOULD -# limit their field values to US-ASCII octets. A recipient SHOULD treat other -# octets in field content (obs-text) as opaque data." -# And it deprecates all non-ascii values -# -# Leading/trailing whitespace in header names is forbidden -# -# Values get leading/trailing whitespace stripped -# -# Content-Disposition actually needs to contain unicode semantically; to -# accomplish this it has a terrifically weird way of encoding the filename -# itself as ascii (and even this still has lots of cross-browser -# incompatibilities) -# -# Order is important: -# "a proxy MUST NOT change the order of these field values when forwarding a -# message" -# (and there are several headers where the order indicates a preference) -# -# Multiple occurences of the same header: -# "A sender MUST NOT generate multiple header fields with the same field name -# in a message unless either the entire field value for that header field is -# defined as a comma-separated list [or the header is Set-Cookie which gets a -# special exception]" - RFC 7230. (cookies are in RFC 6265) -# -# So every header aside from Set-Cookie can be merged by b", ".join if it -# occurs repeatedly. But, of course, they can't necessarily be split by -# .split(b","), because quoting. -# -# Given all this mess (case insensitive, duplicates allowed, order is -# important, ...), there doesn't appear to be any standard way to handle -# headers in Python -- they're almost like dicts, but... actually just -# aren't. For now we punt and just use a super simple representation: headers -# are a list of pairs -# -# [(name1, value1), (name2, value2), ...] -# -# where all entries are bytestrings, names are lowercase and have no -# leading/trailing whitespace, and values are bytestrings with no -# leading/trailing whitespace. Searching and updating are done via naive O(n) -# methods. -# -# Maybe a dict-of-lists would be better? - -_content_length_re = re.compile(rb"[0-9]+") -_field_name_re = re.compile(field_name.encode("ascii")) -_field_value_re = re.compile(field_value.encode("ascii")) - - -class Headers(Sequence[Tuple[bytes, bytes]]): - """ - A list-like interface that allows iterating over headers as byte-pairs - of (lowercased-name, value). - - Internally we actually store the representation as three-tuples, - including both the raw original casing, in order to preserve casing - over-the-wire, and the lowercased name, for case-insensitive comparisions. - - r = Request( - method="GET", - target="/", - headers=[("Host", "example.org"), ("Connection", "keep-alive")], - http_version="1.1", - ) - assert r.headers == [ - (b"host", b"example.org"), - (b"connection", b"keep-alive") - ] - assert r.headers.raw_items() == [ - (b"Host", b"example.org"), - (b"Connection", b"keep-alive") - ] - """ - - __slots__ = "_full_items" - - def __init__(self, full_items: List[Tuple[bytes, bytes, bytes]]) -> None: - self._full_items = full_items - - def __bool__(self) -> bool: - return bool(self._full_items) - - def __eq__(self, other: object) -> bool: - return list(self) == list(other) # type: ignore - - def __len__(self) -> int: - return len(self._full_items) - - def __repr__(self) -> str: - return "" % repr(list(self)) - - def __getitem__(self, idx: int) -> Tuple[bytes, bytes]: # type: ignore[override] - _, name, value = self._full_items[idx] - return (name, value) - - def raw_items(self) -> List[Tuple[bytes, bytes]]: - return [(raw_name, value) for raw_name, _, value in self._full_items] - - -HeaderTypes = Union[ - List[Tuple[bytes, bytes]], - List[Tuple[bytes, str]], - List[Tuple[str, bytes]], - List[Tuple[str, str]], -] - - -@overload -def normalize_and_validate(headers: Headers, _parsed: Literal[True]) -> Headers: - ... - - -@overload -def normalize_and_validate(headers: HeaderTypes, _parsed: Literal[False]) -> Headers: - ... - - -@overload -def normalize_and_validate( - headers: Union[Headers, HeaderTypes], _parsed: bool = False -) -> Headers: - ... - - -def normalize_and_validate( - headers: Union[Headers, HeaderTypes], _parsed: bool = False -) -> Headers: - new_headers = [] - seen_content_length = None - saw_transfer_encoding = False - for name, value in headers: - # For headers coming out of the parser, we can safely skip some steps, - # because it always returns bytes and has already run these regexes - # over the data: - if not _parsed: - name = bytesify(name) - value = bytesify(value) - validate(_field_name_re, name, "Illegal header name {!r}", name) - validate(_field_value_re, value, "Illegal header value {!r}", value) - assert isinstance(name, bytes) - assert isinstance(value, bytes) - - raw_name = name - name = name.lower() - if name == b"content-length": - lengths = {length.strip() for length in value.split(b",")} - if len(lengths) != 1: - raise LocalProtocolError("conflicting Content-Length headers") - value = lengths.pop() - validate(_content_length_re, value, "bad Content-Length") - if len(value) > CONTENT_LENGTH_MAX_DIGITS: - raise LocalProtocolError("bad Content-Length") - if seen_content_length is None: - seen_content_length = value - new_headers.append((raw_name, name, value)) - elif seen_content_length != value: - raise LocalProtocolError("conflicting Content-Length headers") - elif name == b"transfer-encoding": - # "A server that receives a request message with a transfer coding - # it does not understand SHOULD respond with 501 (Not - # Implemented)." - # https://tools.ietf.org/html/rfc7230#section-3.3.1 - if saw_transfer_encoding: - raise LocalProtocolError( - "multiple Transfer-Encoding headers", error_status_hint=501 - ) - # "All transfer-coding names are case-insensitive" - # -- https://tools.ietf.org/html/rfc7230#section-4 - value = value.lower() - if value != b"chunked": - raise LocalProtocolError( - "Only Transfer-Encoding: chunked is supported", - error_status_hint=501, - ) - saw_transfer_encoding = True - new_headers.append((raw_name, name, value)) - else: - new_headers.append((raw_name, name, value)) - return Headers(new_headers) - - -def get_comma_header(headers: Headers, name: bytes) -> List[bytes]: - # Should only be used for headers whose value is a list of - # comma-separated, case-insensitive values. - # - # The header name `name` is expected to be lower-case bytes. - # - # Connection: meets these criteria (including cast insensitivity). - # - # Content-Length: technically is just a single value (1*DIGIT), but the - # standard makes reference to implementations that do multiple values, and - # using this doesn't hurt. Ditto, case insensitivity doesn't things either - # way. - # - # Transfer-Encoding: is more complex (allows for quoted strings), so - # splitting on , is actually wrong. For example, this is legal: - # - # Transfer-Encoding: foo; options="1,2", chunked - # - # and should be parsed as - # - # foo; options="1,2" - # chunked - # - # but this naive function will parse it as - # - # foo; options="1 - # 2" - # chunked - # - # However, this is okay because the only thing we are going to do with - # any Transfer-Encoding is reject ones that aren't just "chunked", so - # both of these will be treated the same anyway. - # - # Expect: the only legal value is the literal string - # "100-continue". Splitting on commas is harmless. Case insensitive. - # - out: List[bytes] = [] - for _, found_name, found_raw_value in headers._full_items: - if found_name == name: - found_raw_value = found_raw_value.lower() - for found_split_value in found_raw_value.split(b","): - found_split_value = found_split_value.strip() - if found_split_value: - out.append(found_split_value) - return out - - -def set_comma_header(headers: Headers, name: bytes, new_values: List[bytes]) -> Headers: - # The header name `name` is expected to be lower-case bytes. - # - # Note that when we store the header we use title casing for the header - # names, in order to match the conventional HTTP header style. - # - # Simply calling `.title()` is a blunt approach, but it's correct - # here given the cases where we're using `set_comma_header`... - # - # Connection, Content-Length, Transfer-Encoding. - new_headers: List[Tuple[bytes, bytes]] = [] - for found_raw_name, found_name, found_raw_value in headers._full_items: - if found_name != name: - new_headers.append((found_raw_name, found_raw_value)) - for new_value in new_values: - new_headers.append((name.title(), new_value)) - return normalize_and_validate(new_headers) - - -def has_expect_100_continue(request: "Request") -> bool: - # https://tools.ietf.org/html/rfc7231#section-5.1.1 - # "A server that receives a 100-continue expectation in an HTTP/1.0 request - # MUST ignore that expectation." - if request.http_version < b"1.1": - return False - expect = get_comma_header(request.headers, b"expect") - return b"100-continue" in expect diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_readers.py b/write-message/venv/lib/python3.10/site-packages/h11/_readers.py deleted file mode 100644 index 576804c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_readers.py +++ /dev/null @@ -1,250 +0,0 @@ -# Code to read HTTP data -# -# Strategy: each reader is a callable which takes a ReceiveBuffer object, and -# either: -# 1) consumes some of it and returns an Event -# 2) raises a LocalProtocolError (for consistency -- e.g. we call validate() -# and it might raise a LocalProtocolError, so simpler just to always use -# this) -# 3) returns None, meaning "I need more data" -# -# If they have a .read_eof attribute, then this will be called if an EOF is -# received -- but this is optional. Either way, the actual ConnectionClosed -# event will be generated afterwards. -# -# READERS is a dict describing how to pick a reader. It maps states to either: -# - a reader -# - or, for body readers, a dict of per-framing reader factories - -import re -from typing import Any, Callable, Dict, Iterable, NoReturn, Optional, Tuple, Type, Union - -from ._abnf import chunk_header, header_field, request_line, status_line -from ._events import Data, EndOfMessage, InformationalResponse, Request, Response -from ._receivebuffer import ReceiveBuffer -from ._state import ( - CLIENT, - CLOSED, - DONE, - IDLE, - MUST_CLOSE, - SEND_BODY, - SEND_RESPONSE, - SERVER, -) -from ._util import LocalProtocolError, RemoteProtocolError, Sentinel, validate - -__all__ = ["READERS"] - -header_field_re = re.compile(header_field.encode("ascii")) -obs_fold_re = re.compile(rb"[ \t]+") - - -def _obsolete_line_fold(lines: Iterable[bytes]) -> Iterable[bytes]: - it = iter(lines) - last: Optional[bytes] = None - for line in it: - match = obs_fold_re.match(line) - if match: - if last is None: - raise LocalProtocolError("continuation line at start of headers") - if not isinstance(last, bytearray): - # Cast to a mutable type, avoiding copy on append to ensure O(n) time - last = bytearray(last) - last += b" " - last += line[match.end() :] - else: - if last is not None: - yield last - last = line - if last is not None: - yield last - - -def _decode_header_lines( - lines: Iterable[bytes], -) -> Iterable[Tuple[bytes, bytes]]: - for line in _obsolete_line_fold(lines): - matches = validate(header_field_re, line, "illegal header line: {!r}", line) - yield (matches["field_name"], matches["field_value"]) - - -request_line_re = re.compile(request_line.encode("ascii")) - - -def maybe_read_from_IDLE_client(buf: ReceiveBuffer) -> Optional[Request]: - lines = buf.maybe_extract_lines() - if lines is None: - if buf.is_next_line_obviously_invalid_request_line(): - raise LocalProtocolError("illegal request line") - return None - if not lines: - raise LocalProtocolError("no request line received") - matches = validate( - request_line_re, lines[0], "illegal request line: {!r}", lines[0] - ) - return Request( - headers=list(_decode_header_lines(lines[1:])), _parsed=True, **matches - ) - - -status_line_re = re.compile(status_line.encode("ascii")) - - -def maybe_read_from_SEND_RESPONSE_server( - buf: ReceiveBuffer, -) -> Union[InformationalResponse, Response, None]: - lines = buf.maybe_extract_lines() - if lines is None: - if buf.is_next_line_obviously_invalid_request_line(): - raise LocalProtocolError("illegal request line") - return None - if not lines: - raise LocalProtocolError("no response line received") - matches = validate(status_line_re, lines[0], "illegal status line: {!r}", lines[0]) - http_version = ( - b"1.1" if matches["http_version"] is None else matches["http_version"] - ) - reason = b"" if matches["reason"] is None else matches["reason"] - status_code = int(matches["status_code"]) - class_: Union[Type[InformationalResponse], Type[Response]] = ( - InformationalResponse if status_code < 200 else Response - ) - return class_( - headers=list(_decode_header_lines(lines[1:])), - _parsed=True, - status_code=status_code, - reason=reason, - http_version=http_version, - ) - - -class ContentLengthReader: - def __init__(self, length: int) -> None: - self._length = length - self._remaining = length - - def __call__(self, buf: ReceiveBuffer) -> Union[Data, EndOfMessage, None]: - if self._remaining == 0: - return EndOfMessage() - data = buf.maybe_extract_at_most(self._remaining) - if data is None: - return None - self._remaining -= len(data) - return Data(data=data) - - def read_eof(self) -> NoReturn: - raise RemoteProtocolError( - "peer closed connection without sending complete message body " - "(received {} bytes, expected {})".format( - self._length - self._remaining, self._length - ) - ) - - -chunk_header_re = re.compile(chunk_header.encode("ascii")) - - -class ChunkedReader: - def __init__(self) -> None: - self._bytes_in_chunk = 0 - # After reading a chunk, we have to throw away the trailing \r\n. - # This tracks the bytes that we need to match and throw away. - self._bytes_to_discard = b"" - self._reading_trailer = False - - def __call__(self, buf: ReceiveBuffer) -> Union[Data, EndOfMessage, None]: - if self._reading_trailer: - lines = buf.maybe_extract_lines() - if lines is None: - return None - return EndOfMessage(headers=list(_decode_header_lines(lines))) - if self._bytes_to_discard: - data = buf.maybe_extract_at_most(len(self._bytes_to_discard)) - if data is None: - return None - if data != self._bytes_to_discard[: len(data)]: - raise LocalProtocolError( - f"malformed chunk footer: {data!r} (expected {self._bytes_to_discard!r})" - ) - self._bytes_to_discard = self._bytes_to_discard[len(data) :] - if self._bytes_to_discard: - return None - # else, fall through and read some more - assert self._bytes_to_discard == b"" - if self._bytes_in_chunk == 0: - # We need to refill our chunk count - chunk_header = buf.maybe_extract_next_line() - if chunk_header is None: - return None - matches = validate( - chunk_header_re, - chunk_header, - "illegal chunk header: {!r}", - chunk_header, - ) - # XX FIXME: we discard chunk extensions. Does anyone care? - self._bytes_in_chunk = int(matches["chunk_size"], base=16) - if self._bytes_in_chunk == 0: - self._reading_trailer = True - return self(buf) - chunk_start = True - else: - chunk_start = False - assert self._bytes_in_chunk > 0 - data = buf.maybe_extract_at_most(self._bytes_in_chunk) - if data is None: - return None - self._bytes_in_chunk -= len(data) - if self._bytes_in_chunk == 0: - self._bytes_to_discard = b"\r\n" - chunk_end = True - else: - chunk_end = False - return Data(data=data, chunk_start=chunk_start, chunk_end=chunk_end) - - def read_eof(self) -> NoReturn: - raise RemoteProtocolError( - "peer closed connection without sending complete message body " - "(incomplete chunked read)" - ) - - -class Http10Reader: - def __call__(self, buf: ReceiveBuffer) -> Optional[Data]: - data = buf.maybe_extract_at_most(999999999) - if data is None: - return None - return Data(data=data) - - def read_eof(self) -> EndOfMessage: - return EndOfMessage() - - -def expect_nothing(buf: ReceiveBuffer) -> None: - if buf: - raise LocalProtocolError("Got data when expecting EOF") - return None - - -ReadersType = Dict[ - Union[Type[Sentinel], Tuple[Type[Sentinel], Type[Sentinel]]], - Union[Callable[..., Any], Dict[str, Callable[..., Any]]], -] - -READERS: ReadersType = { - (CLIENT, IDLE): maybe_read_from_IDLE_client, - (SERVER, IDLE): maybe_read_from_SEND_RESPONSE_server, - (SERVER, SEND_RESPONSE): maybe_read_from_SEND_RESPONSE_server, - (CLIENT, DONE): expect_nothing, - (CLIENT, MUST_CLOSE): expect_nothing, - (CLIENT, CLOSED): expect_nothing, - (SERVER, DONE): expect_nothing, - (SERVER, MUST_CLOSE): expect_nothing, - (SERVER, CLOSED): expect_nothing, - SEND_BODY: { - "chunked": ChunkedReader, - "content-length": ContentLengthReader, - "http/1.0": Http10Reader, - }, -} diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_receivebuffer.py b/write-message/venv/lib/python3.10/site-packages/h11/_receivebuffer.py deleted file mode 100644 index e5c4e08..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_receivebuffer.py +++ /dev/null @@ -1,153 +0,0 @@ -import re -import sys -from typing import List, Optional, Union - -__all__ = ["ReceiveBuffer"] - - -# Operations we want to support: -# - find next \r\n or \r\n\r\n (\n or \n\n are also acceptable), -# or wait until there is one -# - read at-most-N bytes -# Goals: -# - on average, do this fast -# - worst case, do this in O(n) where n is the number of bytes processed -# Plan: -# - store bytearray, offset, how far we've searched for a separator token -# - use the how-far-we've-searched data to avoid rescanning -# - while doing a stream of uninterrupted processing, advance offset instead -# of constantly copying -# WARNING: -# - I haven't benchmarked or profiled any of this yet. -# -# Note that starting in Python 3.4, deleting the initial n bytes from a -# bytearray is amortized O(n), thanks to some excellent work by Antoine -# Martin: -# -# https://bugs.python.org/issue19087 -# -# This means that if we only supported 3.4+, we could get rid of the code here -# involving self._start and self.compress, because it's doing exactly the same -# thing that bytearray now does internally. -# -# BUT unfortunately, we still support 2.7, and reading short segments out of a -# long buffer MUST be O(bytes read) to avoid DoS issues, so we can't actually -# delete this code. Yet: -# -# https://pythonclock.org/ -# -# (Two things to double-check first though: make sure PyPy also has the -# optimization, and benchmark to make sure it's a win, since we do have a -# slightly clever thing where we delay calling compress() until we've -# processed a whole event, which could in theory be slightly more efficient -# than the internal bytearray support.) -blank_line_regex = re.compile(b"\n\r?\n", re.MULTILINE) - - -class ReceiveBuffer: - def __init__(self) -> None: - self._data = bytearray() - self._next_line_search = 0 - self._multiple_lines_search = 0 - - def __iadd__(self, byteslike: Union[bytes, bytearray]) -> "ReceiveBuffer": - self._data += byteslike - return self - - def __bool__(self) -> bool: - return bool(len(self)) - - def __len__(self) -> int: - return len(self._data) - - # for @property unprocessed_data - def __bytes__(self) -> bytes: - return bytes(self._data) - - def _extract(self, count: int) -> bytearray: - # extracting an initial slice of the data buffer and return it - out = self._data[:count] - del self._data[:count] - - self._next_line_search = 0 - self._multiple_lines_search = 0 - - return out - - def maybe_extract_at_most(self, count: int) -> Optional[bytearray]: - """ - Extract a fixed number of bytes from the buffer. - """ - out = self._data[:count] - if not out: - return None - - return self._extract(count) - - def maybe_extract_next_line(self) -> Optional[bytearray]: - """ - Extract the first line, if it is completed in the buffer. - """ - # Only search in buffer space that we've not already looked at. - search_start_index = max(0, self._next_line_search - 1) - partial_idx = self._data.find(b"\r\n", search_start_index) - - if partial_idx == -1: - self._next_line_search = len(self._data) - return None - - # + 2 is to compensate len(b"\r\n") - idx = partial_idx + 2 - - return self._extract(idx) - - def maybe_extract_lines(self) -> Optional[List[bytearray]]: - """ - Extract everything up to the first blank line, and return a list of lines. - """ - # Handle the case where we have an immediate empty line. - if self._data[:1] == b"\n": - self._extract(1) - return [] - - if self._data[:2] == b"\r\n": - self._extract(2) - return [] - - # Only search in buffer space that we've not already looked at. - match = blank_line_regex.search(self._data, self._multiple_lines_search) - if match is None: - self._multiple_lines_search = max(0, len(self._data) - 2) - return None - - # Truncate the buffer and return it. - idx = match.span(0)[-1] - out = self._extract(idx) - lines = out.split(b"\n") - - for line in lines: - if line.endswith(b"\r"): - del line[-1] - - assert lines[-2] == lines[-1] == b"" - - del lines[-2:] - - return lines - - # In theory we should wait until `\r\n` before starting to validate - # incoming data. However it's interesting to detect (very) invalid data - # early given they might not even contain `\r\n` at all (hence only - # timeout will get rid of them). - # This is not a 100% effective detection but more of a cheap sanity check - # allowing for early abort in some useful cases. - # This is especially interesting when peer is messing up with HTTPS and - # sent us a TLS stream where we were expecting plain HTTP given all - # versions of TLS so far start handshake with a 0x16 message type code. - def is_next_line_obviously_invalid_request_line(self) -> bool: - try: - # HTTP header line must not contain non-printable characters - # and should not start with a space - return self._data[0] < 0x21 - except IndexError: - return False diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_state.py b/write-message/venv/lib/python3.10/site-packages/h11/_state.py deleted file mode 100644 index 3ad444b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_state.py +++ /dev/null @@ -1,365 +0,0 @@ -################################################################ -# The core state machine -################################################################ -# -# Rule 1: everything that affects the state machine and state transitions must -# live here in this file. As much as possible goes into the table-based -# representation, but for the bits that don't quite fit, the actual code and -# state must nonetheless live here. -# -# Rule 2: this file does not know about what role we're playing; it only knows -# about HTTP request/response cycles in the abstract. This ensures that we -# don't cheat and apply different rules to local and remote parties. -# -# -# Theory of operation -# =================== -# -# Possibly the simplest way to think about this is that we actually have 5 -# different state machines here. Yes, 5. These are: -# -# 1) The client state, with its complicated automaton (see the docs) -# 2) The server state, with its complicated automaton (see the docs) -# 3) The keep-alive state, with possible states {True, False} -# 4) The SWITCH_CONNECT state, with possible states {False, True} -# 5) The SWITCH_UPGRADE state, with possible states {False, True} -# -# For (3)-(5), the first state listed is the initial state. -# -# (1)-(3) are stored explicitly in member variables. The last -# two are stored implicitly in the pending_switch_proposals set as: -# (state of 4) == (_SWITCH_CONNECT in pending_switch_proposals) -# (state of 5) == (_SWITCH_UPGRADE in pending_switch_proposals) -# -# And each of these machines has two different kinds of transitions: -# -# a) Event-triggered -# b) State-triggered -# -# Event triggered is the obvious thing that you'd think it is: some event -# happens, and if it's the right event at the right time then a transition -# happens. But there are somewhat complicated rules for which machines can -# "see" which events. (As a rule of thumb, if a machine "sees" an event, this -# means two things: the event can affect the machine, and if the machine is -# not in a state where it expects that event then it's an error.) These rules -# are: -# -# 1) The client machine sees all h11.events objects emitted by the client. -# -# 2) The server machine sees all h11.events objects emitted by the server. -# -# It also sees the client's Request event. -# -# And sometimes, server events are annotated with a _SWITCH_* event. For -# example, we can have a (Response, _SWITCH_CONNECT) event, which is -# different from a regular Response event. -# -# 3) The keep-alive machine sees the process_keep_alive_disabled() event -# (which is derived from Request/Response events), and this event -# transitions it from True -> False, or from False -> False. There's no way -# to transition back. -# -# 4&5) The _SWITCH_* machines transition from False->True when we get a -# Request that proposes the relevant type of switch (via -# process_client_switch_proposals), and they go from True->False when we -# get a Response that has no _SWITCH_* annotation. -# -# So that's event-triggered transitions. -# -# State-triggered transitions are less standard. What they do here is couple -# the machines together. The way this works is, when certain *joint* -# configurations of states are achieved, then we automatically transition to a -# new *joint* state. So, for example, if we're ever in a joint state with -# -# client: DONE -# keep-alive: False -# -# then the client state immediately transitions to: -# -# client: MUST_CLOSE -# -# This is fundamentally different from an event-based transition, because it -# doesn't matter how we arrived at the {client: DONE, keep-alive: False} state -# -- maybe the client transitioned SEND_BODY -> DONE, or keep-alive -# transitioned True -> False. Either way, once this precondition is satisfied, -# this transition is immediately triggered. -# -# What if two conflicting state-based transitions get enabled at the same -# time? In practice there's only one case where this arises (client DONE -> -# MIGHT_SWITCH_PROTOCOL versus DONE -> MUST_CLOSE), and we resolve it by -# explicitly prioritizing the DONE -> MIGHT_SWITCH_PROTOCOL transition. -# -# Implementation -# -------------- -# -# The event-triggered transitions for the server and client machines are all -# stored explicitly in a table. Ditto for the state-triggered transitions that -# involve just the server and client state. -# -# The transitions for the other machines, and the state-triggered transitions -# that involve the other machines, are written out as explicit Python code. -# -# It'd be nice if there were some cleaner way to do all this. This isn't -# *too* terrible, but I feel like it could probably be better. -# -# WARNING -# ------- -# -# The script that generates the state machine diagrams for the docs knows how -# to read out the EVENT_TRIGGERED_TRANSITIONS and STATE_TRIGGERED_TRANSITIONS -# tables. But it can't automatically read the transitions that are written -# directly in Python code. So if you touch those, you need to also update the -# script to keep it in sync! -from typing import cast, Dict, Optional, Set, Tuple, Type, Union - -from ._events import * -from ._util import LocalProtocolError, Sentinel - -# Everything in __all__ gets re-exported as part of the h11 public API. -__all__ = [ - "CLIENT", - "SERVER", - "IDLE", - "SEND_RESPONSE", - "SEND_BODY", - "DONE", - "MUST_CLOSE", - "CLOSED", - "MIGHT_SWITCH_PROTOCOL", - "SWITCHED_PROTOCOL", - "ERROR", -] - - -class CLIENT(Sentinel, metaclass=Sentinel): - pass - - -class SERVER(Sentinel, metaclass=Sentinel): - pass - - -# States -class IDLE(Sentinel, metaclass=Sentinel): - pass - - -class SEND_RESPONSE(Sentinel, metaclass=Sentinel): - pass - - -class SEND_BODY(Sentinel, metaclass=Sentinel): - pass - - -class DONE(Sentinel, metaclass=Sentinel): - pass - - -class MUST_CLOSE(Sentinel, metaclass=Sentinel): - pass - - -class CLOSED(Sentinel, metaclass=Sentinel): - pass - - -class ERROR(Sentinel, metaclass=Sentinel): - pass - - -# Switch types -class MIGHT_SWITCH_PROTOCOL(Sentinel, metaclass=Sentinel): - pass - - -class SWITCHED_PROTOCOL(Sentinel, metaclass=Sentinel): - pass - - -class _SWITCH_UPGRADE(Sentinel, metaclass=Sentinel): - pass - - -class _SWITCH_CONNECT(Sentinel, metaclass=Sentinel): - pass - - -EventTransitionType = Dict[ - Type[Sentinel], - Dict[ - Type[Sentinel], - Dict[Union[Type[Event], Tuple[Type[Event], Type[Sentinel]]], Type[Sentinel]], - ], -] - -EVENT_TRIGGERED_TRANSITIONS: EventTransitionType = { - CLIENT: { - IDLE: {Request: SEND_BODY, ConnectionClosed: CLOSED}, - SEND_BODY: {Data: SEND_BODY, EndOfMessage: DONE}, - DONE: {ConnectionClosed: CLOSED}, - MUST_CLOSE: {ConnectionClosed: CLOSED}, - CLOSED: {ConnectionClosed: CLOSED}, - MIGHT_SWITCH_PROTOCOL: {}, - SWITCHED_PROTOCOL: {}, - ERROR: {}, - }, - SERVER: { - IDLE: { - ConnectionClosed: CLOSED, - Response: SEND_BODY, - # Special case: server sees client Request events, in this form - (Request, CLIENT): SEND_RESPONSE, - }, - SEND_RESPONSE: { - InformationalResponse: SEND_RESPONSE, - Response: SEND_BODY, - (InformationalResponse, _SWITCH_UPGRADE): SWITCHED_PROTOCOL, - (Response, _SWITCH_CONNECT): SWITCHED_PROTOCOL, - }, - SEND_BODY: {Data: SEND_BODY, EndOfMessage: DONE}, - DONE: {ConnectionClosed: CLOSED}, - MUST_CLOSE: {ConnectionClosed: CLOSED}, - CLOSED: {ConnectionClosed: CLOSED}, - SWITCHED_PROTOCOL: {}, - ERROR: {}, - }, -} - -StateTransitionType = Dict[ - Tuple[Type[Sentinel], Type[Sentinel]], Dict[Type[Sentinel], Type[Sentinel]] -] - -# NB: there are also some special-case state-triggered transitions hard-coded -# into _fire_state_triggered_transitions below. -STATE_TRIGGERED_TRANSITIONS: StateTransitionType = { - # (Client state, Server state) -> new states - # Protocol negotiation - (MIGHT_SWITCH_PROTOCOL, SWITCHED_PROTOCOL): {CLIENT: SWITCHED_PROTOCOL}, - # Socket shutdown - (CLOSED, DONE): {SERVER: MUST_CLOSE}, - (CLOSED, IDLE): {SERVER: MUST_CLOSE}, - (ERROR, DONE): {SERVER: MUST_CLOSE}, - (DONE, CLOSED): {CLIENT: MUST_CLOSE}, - (IDLE, CLOSED): {CLIENT: MUST_CLOSE}, - (DONE, ERROR): {CLIENT: MUST_CLOSE}, -} - - -class ConnectionState: - def __init__(self) -> None: - # Extra bits of state that don't quite fit into the state model. - - # If this is False then it enables the automatic DONE -> MUST_CLOSE - # transition. Don't set this directly; call .keep_alive_disabled() - self.keep_alive = True - - # This is a subset of {UPGRADE, CONNECT}, containing the proposals - # made by the client for switching protocols. - self.pending_switch_proposals: Set[Type[Sentinel]] = set() - - self.states: Dict[Type[Sentinel], Type[Sentinel]] = {CLIENT: IDLE, SERVER: IDLE} - - def process_error(self, role: Type[Sentinel]) -> None: - self.states[role] = ERROR - self._fire_state_triggered_transitions() - - def process_keep_alive_disabled(self) -> None: - self.keep_alive = False - self._fire_state_triggered_transitions() - - def process_client_switch_proposal(self, switch_event: Type[Sentinel]) -> None: - self.pending_switch_proposals.add(switch_event) - self._fire_state_triggered_transitions() - - def process_event( - self, - role: Type[Sentinel], - event_type: Type[Event], - server_switch_event: Optional[Type[Sentinel]] = None, - ) -> None: - _event_type: Union[Type[Event], Tuple[Type[Event], Type[Sentinel]]] = event_type - if server_switch_event is not None: - assert role is SERVER - if server_switch_event not in self.pending_switch_proposals: - raise LocalProtocolError( - "Received server _SWITCH_UPGRADE event without a pending proposal" - ) - _event_type = (event_type, server_switch_event) - if server_switch_event is None and _event_type is Response: - self.pending_switch_proposals = set() - self._fire_event_triggered_transitions(role, _event_type) - # Special case: the server state does get to see Request - # events. - if _event_type is Request: - assert role is CLIENT - self._fire_event_triggered_transitions(SERVER, (Request, CLIENT)) - self._fire_state_triggered_transitions() - - def _fire_event_triggered_transitions( - self, - role: Type[Sentinel], - event_type: Union[Type[Event], Tuple[Type[Event], Type[Sentinel]]], - ) -> None: - state = self.states[role] - try: - new_state = EVENT_TRIGGERED_TRANSITIONS[role][state][event_type] - except KeyError: - event_type = cast(Type[Event], event_type) - raise LocalProtocolError( - "can't handle event type {} when role={} and state={}".format( - event_type.__name__, role, self.states[role] - ) - ) from None - self.states[role] = new_state - - def _fire_state_triggered_transitions(self) -> None: - # We apply these rules repeatedly until converging on a fixed point - while True: - start_states = dict(self.states) - - # It could happen that both these special-case transitions are - # enabled at the same time: - # - # DONE -> MIGHT_SWITCH_PROTOCOL - # DONE -> MUST_CLOSE - # - # For example, this will always be true of a HTTP/1.0 client - # requesting CONNECT. If this happens, the protocol switch takes - # priority. From there the client will either go to - # SWITCHED_PROTOCOL, in which case it's none of our business when - # they close the connection, or else the server will deny the - # request, in which case the client will go back to DONE and then - # from there to MUST_CLOSE. - if self.pending_switch_proposals: - if self.states[CLIENT] is DONE: - self.states[CLIENT] = MIGHT_SWITCH_PROTOCOL - - if not self.pending_switch_proposals: - if self.states[CLIENT] is MIGHT_SWITCH_PROTOCOL: - self.states[CLIENT] = DONE - - if not self.keep_alive: - for role in (CLIENT, SERVER): - if self.states[role] is DONE: - self.states[role] = MUST_CLOSE - - # Tabular state-triggered transitions - joint_state = (self.states[CLIENT], self.states[SERVER]) - changes = STATE_TRIGGERED_TRANSITIONS.get(joint_state, {}) - self.states.update(changes) - - if self.states == start_states: - # Fixed point reached - return - - def start_next_cycle(self) -> None: - if self.states != {CLIENT: DONE, SERVER: DONE}: - raise LocalProtocolError( - f"not in a reusable state. self.states={self.states}" - ) - # Can't reach DONE/DONE with any of these active, but still, let's be - # sure. - assert self.keep_alive - assert not self.pending_switch_proposals - self.states = {CLIENT: IDLE, SERVER: IDLE} diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_util.py b/write-message/venv/lib/python3.10/site-packages/h11/_util.py deleted file mode 100644 index 6718445..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_util.py +++ /dev/null @@ -1,135 +0,0 @@ -from typing import Any, Dict, NoReturn, Pattern, Tuple, Type, TypeVar, Union - -__all__ = [ - "ProtocolError", - "LocalProtocolError", - "RemoteProtocolError", - "validate", - "bytesify", -] - - -class ProtocolError(Exception): - """Exception indicating a violation of the HTTP/1.1 protocol. - - This as an abstract base class, with two concrete base classes: - :exc:`LocalProtocolError`, which indicates that you tried to do something - that HTTP/1.1 says is illegal, and :exc:`RemoteProtocolError`, which - indicates that the remote peer tried to do something that HTTP/1.1 says is - illegal. See :ref:`error-handling` for details. - - In addition to the normal :exc:`Exception` features, it has one attribute: - - .. attribute:: error_status_hint - - This gives a suggestion as to what status code a server might use if - this error occurred as part of a request. - - For a :exc:`RemoteProtocolError`, this is useful as a suggestion for - how you might want to respond to a misbehaving peer, if you're - implementing a server. - - For a :exc:`LocalProtocolError`, this can be taken as a suggestion for - how your peer might have responded to *you* if h11 had allowed you to - continue. - - The default is 400 Bad Request, a generic catch-all for protocol - violations. - - """ - - def __init__(self, msg: str, error_status_hint: int = 400) -> None: - if type(self) is ProtocolError: - raise TypeError("tried to directly instantiate ProtocolError") - Exception.__init__(self, msg) - self.error_status_hint = error_status_hint - - -# Strategy: there are a number of public APIs where a LocalProtocolError can -# be raised (send(), all the different event constructors, ...), and only one -# public API where RemoteProtocolError can be raised -# (receive_data()). Therefore we always raise LocalProtocolError internally, -# and then receive_data will translate this into a RemoteProtocolError. -# -# Internally: -# LocalProtocolError is the generic "ProtocolError". -# Externally: -# LocalProtocolError is for local errors and RemoteProtocolError is for -# remote errors. -class LocalProtocolError(ProtocolError): - def _reraise_as_remote_protocol_error(self) -> NoReturn: - # After catching a LocalProtocolError, use this method to re-raise it - # as a RemoteProtocolError. This method must be called from inside an - # except: block. - # - # An easy way to get an equivalent RemoteProtocolError is just to - # modify 'self' in place. - self.__class__ = RemoteProtocolError # type: ignore - # But the re-raising is somewhat non-trivial -- you might think that - # now that we've modified the in-flight exception object, that just - # doing 'raise' to re-raise it would be enough. But it turns out that - # this doesn't work, because Python tracks the exception type - # (exc_info[0]) separately from the exception object (exc_info[1]), - # and we only modified the latter. So we really do need to re-raise - # the new type explicitly. - # On py3, the traceback is part of the exception object, so our - # in-place modification preserved it and we can just re-raise: - raise self - - -class RemoteProtocolError(ProtocolError): - pass - - -def validate( - regex: Pattern[bytes], data: bytes, msg: str = "malformed data", *format_args: Any -) -> Dict[str, bytes]: - match = regex.fullmatch(data) - if not match: - if format_args: - msg = msg.format(*format_args) - raise LocalProtocolError(msg) - return match.groupdict() - - -# Sentinel values -# -# - Inherit identity-based comparison and hashing from object -# - Have a nice repr -# - Have a *bonus property*: type(sentinel) is sentinel -# -# The bonus property is useful if you want to take the return value from -# next_event() and do some sort of dispatch based on type(event). - -_T_Sentinel = TypeVar("_T_Sentinel", bound="Sentinel") - - -class Sentinel(type): - def __new__( - cls: Type[_T_Sentinel], - name: str, - bases: Tuple[type, ...], - namespace: Dict[str, Any], - **kwds: Any - ) -> _T_Sentinel: - assert bases == (Sentinel,) - v = super().__new__(cls, name, bases, namespace, **kwds) - v.__class__ = v # type: ignore - return v - - def __repr__(self) -> str: - return self.__name__ - - -# Used for methods, request targets, HTTP versions, header names, and header -# values. Accepts ascii-strings, or bytes/bytearray/memoryview/..., and always -# returns bytes. -def bytesify(s: Union[bytes, bytearray, memoryview, int, str]) -> bytes: - # Fast-path: - if type(s) is bytes: - return s - if isinstance(s, str): - s = s.encode("ascii") - if isinstance(s, int): - raise TypeError("expected bytes-like object, not int") - return bytes(s) diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_version.py b/write-message/venv/lib/python3.10/site-packages/h11/_version.py deleted file mode 100644 index 76e7327..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file must be kept very simple, because it is consumed from several -# places -- it is imported by h11/__init__.py, execfile'd by setup.py, etc. - -# We use a simple scheme: -# 1.0.0 -> 1.0.0+dev -> 1.1.0 -> 1.1.0+dev -# where the +dev versions are never released into the wild, they're just what -# we stick into the VCS in between releases. -# -# This is compatible with PEP 440: -# http://legacy.python.org/dev/peps/pep-0440/ -# via the use of the "local suffix" "+dev", which is disallowed on index -# servers and causes 1.0.0+dev to sort after plain 1.0.0, which is what we -# want. (Contrast with the special suffix 1.0.0.dev, which sorts *before* -# 1.0.0.) - -__version__ = "0.16.0" diff --git a/write-message/venv/lib/python3.10/site-packages/h11/_writers.py b/write-message/venv/lib/python3.10/site-packages/h11/_writers.py deleted file mode 100644 index 939cdb9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/_writers.py +++ /dev/null @@ -1,145 +0,0 @@ -# Code to read HTTP data -# -# Strategy: each writer takes an event + a write-some-bytes function, which is -# calls. -# -# WRITERS is a dict describing how to pick a reader. It maps states to either: -# - a writer -# - or, for body writers, a dict of framin-dependent writer factories - -from typing import Any, Callable, Dict, List, Tuple, Type, Union - -from ._events import Data, EndOfMessage, Event, InformationalResponse, Request, Response -from ._headers import Headers -from ._state import CLIENT, IDLE, SEND_BODY, SEND_RESPONSE, SERVER -from ._util import LocalProtocolError, Sentinel - -__all__ = ["WRITERS"] - -Writer = Callable[[bytes], Any] - - -def write_headers(headers: Headers, write: Writer) -> None: - # "Since the Host field-value is critical information for handling a - # request, a user agent SHOULD generate Host as the first header field - # following the request-line." - RFC 7230 - raw_items = headers._full_items - for raw_name, name, value in raw_items: - if name == b"host": - write(b"%s: %s\r\n" % (raw_name, value)) - for raw_name, name, value in raw_items: - if name != b"host": - write(b"%s: %s\r\n" % (raw_name, value)) - write(b"\r\n") - - -def write_request(request: Request, write: Writer) -> None: - if request.http_version != b"1.1": - raise LocalProtocolError("I only send HTTP/1.1") - write(b"%s %s HTTP/1.1\r\n" % (request.method, request.target)) - write_headers(request.headers, write) - - -# Shared between InformationalResponse and Response -def write_any_response( - response: Union[InformationalResponse, Response], write: Writer -) -> None: - if response.http_version != b"1.1": - raise LocalProtocolError("I only send HTTP/1.1") - status_bytes = str(response.status_code).encode("ascii") - # We don't bother sending ascii status messages like "OK"; they're - # optional and ignored by the protocol. (But the space after the numeric - # status code is mandatory.) - # - # XX FIXME: could at least make an effort to pull out the status message - # from stdlib's http.HTTPStatus table. Or maybe just steal their enums - # (either by import or copy/paste). We already accept them as status codes - # since they're of type IntEnum < int. - write(b"HTTP/1.1 %s %s\r\n" % (status_bytes, response.reason)) - write_headers(response.headers, write) - - -class BodyWriter: - def __call__(self, event: Event, write: Writer) -> None: - if type(event) is Data: - self.send_data(event.data, write) - elif type(event) is EndOfMessage: - self.send_eom(event.headers, write) - else: # pragma: no cover - assert False - - def send_data(self, data: bytes, write: Writer) -> None: - pass - - def send_eom(self, headers: Headers, write: Writer) -> None: - pass - - -# -# These are all careful not to do anything to 'data' except call len(data) and -# write(data). This allows us to transparently pass-through funny objects, -# like placeholder objects referring to files on disk that will be sent via -# sendfile(2). -# -class ContentLengthWriter(BodyWriter): - def __init__(self, length: int) -> None: - self._length = length - - def send_data(self, data: bytes, write: Writer) -> None: - self._length -= len(data) - if self._length < 0: - raise LocalProtocolError("Too much data for declared Content-Length") - write(data) - - def send_eom(self, headers: Headers, write: Writer) -> None: - if self._length != 0: - raise LocalProtocolError("Too little data for declared Content-Length") - if headers: - raise LocalProtocolError("Content-Length and trailers don't mix") - - -class ChunkedWriter(BodyWriter): - def send_data(self, data: bytes, write: Writer) -> None: - # if we encoded 0-length data in the naive way, it would look like an - # end-of-message. - if not data: - return - write(b"%x\r\n" % len(data)) - write(data) - write(b"\r\n") - - def send_eom(self, headers: Headers, write: Writer) -> None: - write(b"0\r\n") - write_headers(headers, write) - - -class Http10Writer(BodyWriter): - def send_data(self, data: bytes, write: Writer) -> None: - write(data) - - def send_eom(self, headers: Headers, write: Writer) -> None: - if headers: - raise LocalProtocolError("can't send trailers to HTTP/1.0 client") - # no need to close the socket ourselves, that will be taken care of by - # Connection: close machinery - - -WritersType = Dict[ - Union[Tuple[Type[Sentinel], Type[Sentinel]], Type[Sentinel]], - Union[ - Dict[str, Type[BodyWriter]], - Callable[[Union[InformationalResponse, Response], Writer], None], - Callable[[Request, Writer], None], - ], -] - -WRITERS: WritersType = { - (CLIENT, IDLE): write_request, - (SERVER, IDLE): write_any_response, - (SERVER, SEND_RESPONSE): write_any_response, - SEND_BODY: { - "chunked": ChunkedWriter, - "content-length": ContentLengthWriter, - "http/1.0": Http10Writer, - }, -} diff --git a/write-message/venv/lib/python3.10/site-packages/h11/py.typed b/write-message/venv/lib/python3.10/site-packages/h11/py.typed deleted file mode 100644 index f5642f7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/h11/py.typed +++ /dev/null @@ -1 +0,0 @@ -Marker diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/METADATA deleted file mode 100644 index 8056834..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/METADATA +++ /dev/null @@ -1,625 +0,0 @@ -Metadata-Version: 2.4 -Name: httpcore -Version: 1.0.9 -Summary: A minimal low-level HTTP client. -Project-URL: Documentation, https://www.encode.io/httpcore -Project-URL: Homepage, https://www.encode.io/httpcore/ -Project-URL: Source, https://github.com/encode/httpcore -Author-email: Tom Christie -License-Expression: BSD-3-Clause -License-File: LICENSE.md -Classifier: Development Status :: 3 - Alpha -Classifier: Environment :: Web Environment -Classifier: Framework :: AsyncIO -Classifier: Framework :: Trio -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Internet :: WWW/HTTP -Requires-Python: >=3.8 -Requires-Dist: certifi -Requires-Dist: h11>=0.16 -Provides-Extra: asyncio -Requires-Dist: anyio<5.0,>=4.0; extra == 'asyncio' -Provides-Extra: http2 -Requires-Dist: h2<5,>=3; extra == 'http2' -Provides-Extra: socks -Requires-Dist: socksio==1.*; extra == 'socks' -Provides-Extra: trio -Requires-Dist: trio<1.0,>=0.22.0; extra == 'trio' -Description-Content-Type: text/markdown - -# HTTP Core - -[![Test Suite](https://github.com/encode/httpcore/workflows/Test%20Suite/badge.svg)](https://github.com/encode/httpcore/actions) -[![Package version](https://badge.fury.io/py/httpcore.svg)](https://pypi.org/project/httpcore/) - -> *Do one thing, and do it well.* - -The HTTP Core package provides a minimal low-level HTTP client, which does -one thing only. Sending HTTP requests. - -It does not provide any high level model abstractions over the API, -does not handle redirects, multipart uploads, building authentication headers, -transparent HTTP caching, URL parsing, session cookie handling, -content or charset decoding, handling JSON, environment based configuration -defaults, or any of that Jazz. - -Some things HTTP Core does do: - -* Sending HTTP requests. -* Thread-safe / task-safe connection pooling. -* HTTP(S) proxy & SOCKS proxy support. -* Supports HTTP/1.1 and HTTP/2. -* Provides both sync and async interfaces. -* Async backend support for `asyncio` and `trio`. - -## Requirements - -Python 3.8+ - -## Installation - -For HTTP/1.1 only support, install with: - -```shell -$ pip install httpcore -``` - -There are also a number of optional extras available... - -```shell -$ pip install httpcore['asyncio,trio,http2,socks'] -``` - -## Sending requests - -Send an HTTP request: - -```python -import httpcore - -response = httpcore.request("GET", "https://www.example.com/") - -print(response) -# -print(response.status) -# 200 -print(response.headers) -# [(b'Accept-Ranges', b'bytes'), (b'Age', b'557328'), (b'Cache-Control', b'max-age=604800'), ...] -print(response.content) -# b'\n\n\nExample Domain\n\n\n ...' -``` - -The top-level `httpcore.request()` function is provided for convenience. In practice whenever you're working with `httpcore` you'll want to use the connection pooling functionality that it provides. - -```python -import httpcore - -http = httpcore.ConnectionPool() -response = http.request("GET", "https://www.example.com/") -``` - -Once you're ready to get going, [head over to the documentation](https://www.encode.io/httpcore/). - -## Motivation - -You *probably* don't want to be using HTTP Core directly. It might make sense if -you're writing something like a proxy service in Python, and you just want -something at the lowest possible level, but more typically you'll want to use -a higher level client library, such as `httpx`. - -The motivation for `httpcore` is: - -* To provide a reusable low-level client library, that other packages can then build on top of. -* To provide a *really clear interface split* between the networking code and client logic, - so that each is easier to understand and reason about in isolation. - -## Dependencies - -The `httpcore` package has the following dependencies... - -* `h11` -* `certifi` - -And the following optional extras... - -* `anyio` - Required by `pip install httpcore['asyncio']`. -* `trio` - Required by `pip install httpcore['trio']`. -* `h2` - Required by `pip install httpcore['http2']`. -* `socksio` - Required by `pip install httpcore['socks']`. - -## Versioning - -We use [SEMVER for our versioning policy](https://semver.org/). - -For changes between package versions please see our [project changelog](CHANGELOG.md). - -We recommend pinning your requirements either the most current major version, or a more specific version range: - -```python -pip install 'httpcore==1.*' -``` -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - -## Version 1.0.9 (April 24th, 2025) - -- Resolve https://github.com/advisories/GHSA-vqfr-h8mv-ghfj with h11 dependency update. (#1008) - -## Version 1.0.8 (April 11th, 2025) - -- Fix `AttributeError` when importing on Python 3.14. (#1005) - -## Version 1.0.7 (November 15th, 2024) - -- Support `proxy=…` configuration on `ConnectionPool()`. (#974) - -## Version 1.0.6 (October 1st, 2024) - -- Relax `trio` dependency pinning. (#956) -- Handle `trio` raising `NotImplementedError` on unsupported platforms. (#955) -- Handle mapping `ssl.SSLError` to `httpcore.ConnectError`. (#918) - -## 1.0.5 (March 27th, 2024) - -- Handle `EndOfStream` exception for anyio backend. (#899) -- Allow trio `0.25.*` series in package dependancies. (#903) - -## 1.0.4 (February 21st, 2024) - -- Add `target` request extension. (#888) -- Fix support for connection `Upgrade` and `CONNECT` when some data in the stream has been read. (#882) - -## 1.0.3 (February 13th, 2024) - -- Fix support for async cancellations. (#880) -- Fix trace extension when used with socks proxy. (#849) -- Fix SSL context for connections using the "wss" scheme (#869) - -## 1.0.2 (November 10th, 2023) - -- Fix `float("inf")` timeouts in `Event.wait` function. (#846) - -## 1.0.1 (November 3rd, 2023) - -- Fix pool timeout to account for the total time spent retrying. (#823) -- Raise a neater RuntimeError when the correct async deps are not installed. (#826) -- Add support for synchronous TLS-in-TLS streams. (#840) - -## 1.0.0 (October 6th, 2023) - -From version 1.0 our async support is now optional, as the package has minimal dependencies by default. - -For async support use either `pip install 'httpcore[asyncio]'` or `pip install 'httpcore[trio]'`. - -The project versioning policy is now explicitly governed by SEMVER. See https://semver.org/. - -- Async support becomes fully optional. (#809) -- Add support for Python 3.12. (#807) - -## 0.18.0 (September 8th, 2023) - -- Add support for HTTPS proxies. (#745, #786) -- Drop Python 3.7 support. (#727) -- Handle `sni_hostname` extension with SOCKS proxy. (#774) -- Handle HTTP/1.1 half-closed connections gracefully. (#641) -- Change the type of `Extensions` from `Mapping[Str, Any]` to `MutableMapping[Str, Any]`. (#762) - -## 0.17.3 (July 5th, 2023) - -- Support async cancellations, ensuring that the connection pool is left in a clean state when cancellations occur. (#726) -- The networking backend interface has [been added to the public API](https://www.encode.io/httpcore/network-backends). Some classes which were previously private implementation detail are now part of the top-level public API. (#699) -- Graceful handling of HTTP/2 GoAway frames, with requests being transparently retried on a new connection. (#730) -- Add exceptions when a synchronous `trace callback` is passed to an asynchronous request or an asynchronous `trace callback` is passed to a synchronous request. (#717) -- Drop Python 3.7 support. (#727) - -## 0.17.2 (May 23th, 2023) - -- Add `socket_options` argument to `ConnectionPool` and `HTTProxy` classes. (#668) -- Improve logging with per-module logger names. (#690) -- Add `sni_hostname` request extension. (#696) -- Resolve race condition during import of `anyio` package. (#692) -- Enable TCP_NODELAY for all synchronous sockets. (#651) - -## 0.17.1 (May 17th, 2023) - -- If 'retries' is set, then allow retries if an SSL handshake error occurs. (#669) -- Improve correctness of tracebacks on network exceptions, by raising properly chained exceptions. (#678) -- Prevent connection-hanging behaviour when HTTP/2 connections are closed by a server-sent 'GoAway' frame. (#679) -- Fix edge-case exception when removing requests from the connection pool. (#680) -- Fix pool timeout edge-case. (#688) - -## 0.17.0 (March 16th, 2023) - -- Add DEBUG level logging. (#648) -- Respect HTTP/2 max concurrent streams when settings updates are sent by server. (#652) -- Increase the allowable HTTP header size to 100kB. (#647) -- Add `retries` option to SOCKS proxy classes. (#643) - -## 0.16.3 (December 20th, 2022) - -- Allow `ws` and `wss` schemes. Allows us to properly support websocket upgrade connections. (#625) -- Forwarding HTTP proxies use a connection-per-remote-host. Required by some proxy implementations. (#637) -- Don't raise `RuntimeError` when closing a connection pool with active connections. Removes some error cases when cancellations are used. (#631) -- Lazy import `anyio`, so that it's no longer a hard dependancy, and isn't imported if unused. (#639) - -## 0.16.2 (November 25th, 2022) - -- Revert 'Fix async cancellation behaviour', which introduced race conditions. (#627) -- Raise `RuntimeError` if attempting to us UNIX domain sockets on Windows. (#619) - -## 0.16.1 (November 17th, 2022) - -- Fix HTTP/1.1 interim informational responses, such as "100 Continue". (#605) - -## 0.16.0 (October 11th, 2022) - -- Support HTTP/1.1 informational responses. (#581) -- Fix async cancellation behaviour. (#580) -- Support `h11` 0.14. (#579) - -## 0.15.0 (May 17th, 2022) - -- Drop Python 3.6 support (#535) -- Ensure HTTP proxy CONNECT requests include `timeout` configuration. (#506) -- Switch to explicit `typing.Optional` for type hints. (#513) -- For `trio` map OSError exceptions to `ConnectError`. (#543) - -## 0.14.7 (February 4th, 2022) - -- Requests which raise a PoolTimeout need to be removed from the pool queue. (#502) -- Fix AttributeError that happened when Socks5Connection were terminated. (#501) - -## 0.14.6 (February 1st, 2022) - -- Fix SOCKS support for `http://` URLs. (#492) -- Resolve race condition around exceptions during streaming a response. (#491) - -## 0.14.5 (January 18th, 2022) - -- SOCKS proxy support. (#478) -- Add proxy_auth argument to HTTPProxy. (#481) -- Improve error message on 'RemoteProtocolError' exception when server disconnects without sending a response. (#479) - -## 0.14.4 (January 5th, 2022) - -- Support HTTP/2 on HTTPS tunnelling proxies. (#468) -- Fix proxy headers missing on HTTP forwarding. (#456) -- Only instantiate SSL context if required. (#457) -- More robust HTTP/2 handling. (#253, #439, #440, #441) - -## 0.14.3 (November 17th, 2021) - -- Fix race condition when removing closed connections from the pool. (#437) - -## 0.14.2 (November 16th, 2021) - -- Failed connections no longer remain in the pool. (Pull #433) - -## 0.14.1 (November 12th, 2021) - -- `max_connections` becomes optional. (Pull #429) -- `certifi` is now included in the install dependancies. (Pull #428) -- `h2` is now strictly optional. (Pull #428) - -## 0.14.0 (November 11th, 2021) - -The 0.14 release is a complete reworking of `httpcore`, comprehensively addressing some underlying issues in the connection pooling, as well as substantially redesigning the API to be more user friendly. - -Some of the lower-level API design also makes the components more easily testable in isolation, and the package now has 100% test coverage. - -See [discussion #419](https://github.com/encode/httpcore/discussions/419) for a little more background. - -There's some other neat bits in there too, such as the "trace" extension, which gives a hook into inspecting the internal events that occur during the request/response cycle. This extension is needed for the HTTPX cli, in order to... - -* Log the point at which the connection is established, and the IP/port on which it is made. -* Determine if the outgoing request should log as HTTP/1.1 or HTTP/2, rather than having to assume it's HTTP/2 if the --http2 flag was passed. (Which may not actually be true.) -* Log SSL version info / certificate info. - -Note that `curio` support is not currently available in 0.14.0. If you're using `httpcore` with `curio` please get in touch, so we can assess if we ought to prioritize it as a feature or not. - -## 0.13.7 (September 13th, 2021) - -- Fix broken error messaging when URL scheme is missing, or a non HTTP(S) scheme is used. (Pull #403) - -## 0.13.6 (June 15th, 2021) - -### Fixed - -- Close sockets when read or write timeouts occur. (Pull #365) - -## 0.13.5 (June 14th, 2021) - -### Fixed - -- Resolved niggles with AnyIO EOF behaviours. (Pull #358, #362) - -## 0.13.4 (June 9th, 2021) - -### Added - -- Improved error messaging when URL scheme is missing, or a non HTTP(S) scheme is used. (Pull #354) - -### Fixed - -- Switched to `anyio` as the default backend implementation when running with `asyncio`. Resolves some awkward [TLS timeout issues](https://github.com/encode/httpx/discussions/1511). - -## 0.13.3 (May 6th, 2021) - -### Added - -- Support HTTP/2 prior knowledge, using `httpcore.SyncConnectionPool(http1=False)`. (Pull #333) - -### Fixed - -- Handle cases where environment does not provide `select.poll` support. (Pull #331) - -## 0.13.2 (April 29th, 2021) - -### Added - -- Improve error message for specific case of `RemoteProtocolError` where server disconnects without sending a response. (Pull #313) - -## 0.13.1 (April 28th, 2021) - -### Fixed - -- More resiliant testing for closed connections. (Pull #311) -- Don't raise exceptions on ungraceful connection closes. (Pull #310) - -## 0.13.0 (April 21st, 2021) - -The 0.13 release updates the core API in order to match the HTTPX Transport API, -introduced in HTTPX 0.18 onwards. - -An example of making requests with the new interface is: - -```python -with httpcore.SyncConnectionPool() as http: - status_code, headers, stream, extensions = http.handle_request( - method=b'GET', - url=(b'https', b'example.org', 443, b'/'), - headers=[(b'host', b'example.org'), (b'user-agent', b'httpcore')] - stream=httpcore.ByteStream(b''), - extensions={} - ) - body = stream.read() - print(status_code, body) -``` - -### Changed - -- The `.request()` method is now `handle_request()`. (Pull #296) -- The `.arequest()` method is now `.handle_async_request()`. (Pull #296) -- The `headers` argument is no longer optional. (Pull #296) -- The `stream` argument is no longer optional. (Pull #296) -- The `ext` argument is now named `extensions`, and is no longer optional. (Pull #296) -- The `"reason"` extension keyword is now named `"reason_phrase"`. (Pull #296) -- The `"reason_phrase"` and `"http_version"` extensions now use byte strings for their values. (Pull #296) -- The `httpcore.PlainByteStream()` class becomes `httpcore.ByteStream()`. (Pull #296) - -### Added - -- Streams now support a `.read()` interface. (Pull #296) - -### Fixed - -- Task cancellation no longer leaks connections from the connection pool. (Pull #305) - -## 0.12.3 (December 7th, 2020) - -### Fixed - -- Abort SSL connections on close rather than waiting for remote EOF when using `asyncio`. (Pull #167) -- Fix exception raised in case of connect timeouts when using the `anyio` backend. (Pull #236) -- Fix `Host` header precedence for `:authority` in HTTP/2. (Pull #241, #243) -- Handle extra edge case when detecting for socket readability when using `asyncio`. (Pull #242, #244) -- Fix `asyncio` SSL warning when using proxy tunneling. (Pull #249) - -## 0.12.2 (November 20th, 2020) - -### Fixed - -- Properly wrap connect errors on the asyncio backend. (Pull #235) -- Fix `ImportError` occurring on Python 3.9 when using the HTTP/1.1 sync client in a multithreaded context. (Pull #237) - -## 0.12.1 (November 7th, 2020) - -### Added - -- Add connect retries. (Pull #221) - -### Fixed - -- Tweak detection of dropped connections, resolving an issue with open files limits on Linux. (Pull #185) -- Avoid leaking connections when establishing an HTTP tunnel to a proxy has failed. (Pull #223) -- Properly wrap OS errors when using `trio`. (Pull #225) - -## 0.12.0 (October 6th, 2020) - -### Changed - -- HTTP header casing is now preserved, rather than always sent in lowercase. (#216 and python-hyper/h11#104) - -### Added - -- Add Python 3.9 to officially supported versions. - -### Fixed - -- Gracefully handle a stdlib asyncio bug when a connection is closed while it is in a paused-for-reading state. (#201) - -## 0.11.1 (September 28nd, 2020) - -### Fixed - -- Add await to async semaphore release() coroutine (#197) -- Drop incorrect curio classifier (#192) - -## 0.11.0 (September 22nd, 2020) - -The Transport API with 0.11.0 has a couple of significant changes. - -Firstly we've moved changed the request interface in order to allow extensions, which will later enable us to support features -such as trailing headers, HTTP/2 server push, and CONNECT/Upgrade connections. - -The interface changes from: - -```python -def request(method, url, headers, stream, timeout): - return (http_version, status_code, reason, headers, stream) -``` - -To instead including an optional dictionary of extensions on the request and response: - -```python -def request(method, url, headers, stream, ext): - return (status_code, headers, stream, ext) -``` - -Having an open-ended extensions point will allow us to add later support for various optional features, that wouldn't otherwise be supported without these API changes. - -In particular: - -* Trailing headers support. -* HTTP/2 Server Push -* sendfile. -* Exposing raw connection on CONNECT, Upgrade, HTTP/2 bi-di streaming. -* Exposing debug information out of the API, including template name, template context. - -Currently extensions are limited to: - -* request: `timeout` - Optional. Timeout dictionary. -* response: `http_version` - Optional. Include the HTTP version used on the response. -* response: `reason` - Optional. Include the reason phrase used on the response. Only valid with HTTP/1.*. - -See https://github.com/encode/httpx/issues/1274#issuecomment-694884553 for the history behind this. - -Secondly, the async version of `request` is now namespaced as `arequest`. - -This allows concrete transports to support both sync and async implementations on the same class. - -### Added - -- Add curio support. (Pull #168) -- Add anyio support, with `backend="anyio"`. (Pull #169) - -### Changed - -- Update the Transport API to use 'ext' for optional extensions. (Pull #190) -- Update the Transport API to use `.request` and `.arequest` so implementations can support both sync and async. (Pull #189) - -## 0.10.2 (August 20th, 2020) - -### Added - -- Added Unix Domain Socket support. (Pull #139) - -### Fixed - -- Always include the port on proxy CONNECT requests. (Pull #154) -- Fix `max_keepalive_connections` configuration. (Pull #153) -- Fixes behaviour in HTTP/1.1 where server disconnects can be used to signal the end of the response body. (Pull #164) - -## 0.10.1 (August 7th, 2020) - -- Include `max_keepalive_connections` on `AsyncHTTPProxy`/`SyncHTTPProxy` classes. - -## 0.10.0 (August 7th, 2020) - -The most notable change in the 0.10.0 release is that HTTP/2 support is now fully optional. - -Use either `pip install httpcore` for HTTP/1.1 support only, or `pip install httpcore[http2]` for HTTP/1.1 and HTTP/2 support. - -### Added - -- HTTP/2 support becomes optional. (Pull #121, #130) -- Add `local_address=...` support. (Pull #100, #134) -- Add `PlainByteStream`, `IteratorByteStream`, `AsyncIteratorByteStream`. The `AsyncByteSteam` and `SyncByteStream` classes are now pure interface classes. (#133) -- Add `LocalProtocolError`, `RemoteProtocolError` exceptions. (Pull #129) -- Add `UnsupportedProtocol` exception. (Pull #128) -- Add `.get_connection_info()` method. (Pull #102, #137) -- Add better TRACE logs. (Pull #101) - -### Changed - -- `max_keepalive` is deprecated in favour of `max_keepalive_connections`. (Pull #140) - -### Fixed - -- Improve handling of server disconnects. (Pull #112) - -## 0.9.1 (May 27th, 2020) - -### Fixed - -- Proper host resolution for sync case, including IPv6 support. (Pull #97) -- Close outstanding connections when connection pool is closed. (Pull #98) - -## 0.9.0 (May 21th, 2020) - -### Changed - -- URL port becomes an `Optional[int]` instead of `int`. (Pull #92) - -### Fixed - -- Honor HTTP/2 max concurrent streams settings. (Pull #89, #90) -- Remove incorrect debug log. (Pull #83) - -## 0.8.4 (May 11th, 2020) - -### Added - -- Logging via HTTPCORE_LOG_LEVEL and HTTPX_LOG_LEVEL environment variables -and TRACE level logging. (Pull #79) - -### Fixed - -- Reuse of connections on HTTP/2 in close concurrency situations. (Pull #81) - -## 0.8.3 (May 6rd, 2020) - -### Fixed - -- Include `Host` and `Accept` headers on proxy "CONNECT" requests. -- De-duplicate any headers also contained in proxy_headers. -- HTTP/2 flag not being passed down to proxy connections. - -## 0.8.2 (May 3rd, 2020) - -### Fixed - -- Fix connections using proxy forwarding requests not being added to the -connection pool properly. (Pull #70) - -## 0.8.1 (April 30th, 2020) - -### Changed - -- Allow inherintance of both `httpcore.AsyncByteStream`, `httpcore.SyncByteStream` without type conflicts. - -## 0.8.0 (April 30th, 2020) - -### Fixed - -- Fixed tunnel proxy support. - -### Added - -- New `TimeoutException` base class. - -## 0.7.0 (March 5th, 2020) - -- First integration with HTTPX. diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/RECORD deleted file mode 100644 index aac7c19..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/RECORD +++ /dev/null @@ -1,68 +0,0 @@ -httpcore-1.0.9.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -httpcore-1.0.9.dist-info/METADATA,sha256=_i1P2mGZEol4d54M8n88BFxTGGP83Zh-rMdPOhjUHCE,21529 -httpcore-1.0.9.dist-info/RECORD,, -httpcore-1.0.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87 -httpcore-1.0.9.dist-info/licenses/LICENSE.md,sha256=_ctZFUx0y6uhahEkL3dAvqnyPW_rVUeRfYxflKgDkqU,1518 -httpcore/__init__.py,sha256=9kT_kqChCCJUTHww24ZmR_ezcdbpRYWksD-gYNzkZP8,3445 -httpcore/__pycache__/__init__.cpython-310.pyc,, -httpcore/__pycache__/_api.cpython-310.pyc,, -httpcore/__pycache__/_exceptions.cpython-310.pyc,, -httpcore/__pycache__/_models.cpython-310.pyc,, -httpcore/__pycache__/_ssl.cpython-310.pyc,, -httpcore/__pycache__/_synchronization.cpython-310.pyc,, -httpcore/__pycache__/_trace.cpython-310.pyc,, -httpcore/__pycache__/_utils.cpython-310.pyc,, -httpcore/_api.py,sha256=unZmeDschBWCGCPCwkS3Wot9euK6bg_kKxLtGTxw214,3146 -httpcore/_async/__init__.py,sha256=EWdl2v4thnAHzJpqjU4h2a8DUiGAvNiWrkii9pfhTf0,1221 -httpcore/_async/__pycache__/__init__.cpython-310.pyc,, -httpcore/_async/__pycache__/connection.cpython-310.pyc,, -httpcore/_async/__pycache__/connection_pool.cpython-310.pyc,, -httpcore/_async/__pycache__/http11.cpython-310.pyc,, -httpcore/_async/__pycache__/http2.cpython-310.pyc,, -httpcore/_async/__pycache__/http_proxy.cpython-310.pyc,, -httpcore/_async/__pycache__/interfaces.cpython-310.pyc,, -httpcore/_async/__pycache__/socks_proxy.cpython-310.pyc,, -httpcore/_async/connection.py,sha256=6OcPXqMEfc0BU38_-iHUNDd1vKSTc2UVT09XqNb_BOk,8449 -httpcore/_async/connection_pool.py,sha256=DOIQ2s2ZCf9qfwxhzMprTPLqCL8OxGXiKF6qRHxvVyY,17307 -httpcore/_async/http11.py,sha256=-qM9bV7PjSQF5vxs37-eUXOIFwbIjPcZbNliuX9TtBw,13880 -httpcore/_async/http2.py,sha256=azX1fcmtXaIwjputFlZ4vd92J8xwjGOa9ax9QIv4394,23936 -httpcore/_async/http_proxy.py,sha256=2zVkrlv-Ds-rWGaqaXlrhEJiAQFPo23BT3Gq_sWoBXU,14701 -httpcore/_async/interfaces.py,sha256=jTiaWL83pgpGC9ziv90ZfwaKNMmHwmOalzaKiuTxATo,4455 -httpcore/_async/socks_proxy.py,sha256=lLKgLlggPfhFlqi0ODeBkOWvt9CghBBUyqsnsU1tx6Q,13841 -httpcore/_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -httpcore/_backends/__pycache__/__init__.cpython-310.pyc,, -httpcore/_backends/__pycache__/anyio.cpython-310.pyc,, -httpcore/_backends/__pycache__/auto.cpython-310.pyc,, -httpcore/_backends/__pycache__/base.cpython-310.pyc,, -httpcore/_backends/__pycache__/mock.cpython-310.pyc,, -httpcore/_backends/__pycache__/sync.cpython-310.pyc,, -httpcore/_backends/__pycache__/trio.cpython-310.pyc,, -httpcore/_backends/anyio.py,sha256=x8PgEhXRC8bVqsdzk_YJx8Y6d9Tub06CuUSwnbmtqoY,5252 -httpcore/_backends/auto.py,sha256=zO136PKZmsaTDK-HRk84eA-MUg8_2wJf4NvmK432Aio,1662 -httpcore/_backends/base.py,sha256=aShgRdZnMmRhFWHetjumlM73f8Kz1YOAyCUP_4kHslA,3042 -httpcore/_backends/mock.py,sha256=er9T436uSe7NLrfiLa4x6Nuqg5ivQ693CxWYCWsgbH4,4077 -httpcore/_backends/sync.py,sha256=bhE4d9iK9Umxdsdsgm2EfKnXaBms2WggGYU-7jmUujU,7977 -httpcore/_backends/trio.py,sha256=LHu4_Mr5MswQmmT3yE4oLgf9b_JJfeVS4BjDxeJc7Ro,5996 -httpcore/_exceptions.py,sha256=looCKga3_YVYu3s-d3L9RMPRJyhsY7fiuuGxvkOD0c0,1184 -httpcore/_models.py,sha256=IO2CcXcdpovRcLTdGFGB6RyBZdEm2h_TOmoCc4rEKho,17623 -httpcore/_ssl.py,sha256=srqmSNU4iOUvWF-SrJvb8G_YEbHFELOXQOwdDIBTS9c,187 -httpcore/_sync/__init__.py,sha256=JBDIgXt5la1LCJ1sLQeKhjKFpLnpNr8Svs6z2ni3fgg,1141 -httpcore/_sync/__pycache__/__init__.cpython-310.pyc,, -httpcore/_sync/__pycache__/connection.cpython-310.pyc,, -httpcore/_sync/__pycache__/connection_pool.cpython-310.pyc,, -httpcore/_sync/__pycache__/http11.cpython-310.pyc,, -httpcore/_sync/__pycache__/http2.cpython-310.pyc,, -httpcore/_sync/__pycache__/http_proxy.cpython-310.pyc,, -httpcore/_sync/__pycache__/interfaces.cpython-310.pyc,, -httpcore/_sync/__pycache__/socks_proxy.cpython-310.pyc,, -httpcore/_sync/connection.py,sha256=9exGOb3PB-Mp2T1-sckSeL2t-tJ_9-NXomV8ihmWCgU,8238 -httpcore/_sync/connection_pool.py,sha256=a-T8LTsUxc7r0Ww1atfHSDoWPjQ0fA8Ul7S3-F0Mj70,16955 -httpcore/_sync/http11.py,sha256=IFobD1Md5JFlJGKWnh1_Q3epikUryI8qo09v8MiJIEA,13476 -httpcore/_sync/http2.py,sha256=AxU4yhcq68Bn5vqdJYtiXKYUj7nvhYbxz3v4rT4xnvA,23400 -httpcore/_sync/http_proxy.py,sha256=_al_6crKuEZu2wyvu493RZImJdBJnj5oGKNjLOJL2Zo,14463 -httpcore/_sync/interfaces.py,sha256=snXON42vUDHO5JBJvo8D4VWk2Wat44z2OXXHDrjbl94,4344 -httpcore/_sync/socks_proxy.py,sha256=zegZW9Snqj2_992DFJa8_CppOVBkVL4AgwduRkStakQ,13614 -httpcore/_synchronization.py,sha256=zSi13mAColBnknjZBknUC6hKNDQT4C6ijnezZ-r0T2s,9434 -httpcore/_trace.py,sha256=ck6ZoIzYTkdNAIfq5MGeKqBXDtqjOX-qfYwmZFbrGco,3952 -httpcore/_utils.py,sha256=_RLgXYOAYC350ikALV59GZ68IJrdocRZxPs9PjmzdFY,1537 -httpcore/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/WHEEL deleted file mode 100644 index 12228d4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: hatchling 1.27.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/licenses/LICENSE.md b/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/licenses/LICENSE.md deleted file mode 100644 index 311b2b5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/licenses/LICENSE.md +++ /dev/null @@ -1,27 +0,0 @@ -Copyright © 2020, [Encode OSS Ltd](https://www.encode.io/). -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__init__.py b/write-message/venv/lib/python3.10/site-packages/httpcore/__init__.py deleted file mode 100644 index 9a92dc4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/__init__.py +++ /dev/null @@ -1,141 +0,0 @@ -from ._api import request, stream -from ._async import ( - AsyncConnectionInterface, - AsyncConnectionPool, - AsyncHTTP2Connection, - AsyncHTTP11Connection, - AsyncHTTPConnection, - AsyncHTTPProxy, - AsyncSOCKSProxy, -) -from ._backends.base import ( - SOCKET_OPTION, - AsyncNetworkBackend, - AsyncNetworkStream, - NetworkBackend, - NetworkStream, -) -from ._backends.mock import AsyncMockBackend, AsyncMockStream, MockBackend, MockStream -from ._backends.sync import SyncBackend -from ._exceptions import ( - ConnectError, - ConnectionNotAvailable, - ConnectTimeout, - LocalProtocolError, - NetworkError, - PoolTimeout, - ProtocolError, - ProxyError, - ReadError, - ReadTimeout, - RemoteProtocolError, - TimeoutException, - UnsupportedProtocol, - WriteError, - WriteTimeout, -) -from ._models import URL, Origin, Proxy, Request, Response -from ._ssl import default_ssl_context -from ._sync import ( - ConnectionInterface, - ConnectionPool, - HTTP2Connection, - HTTP11Connection, - HTTPConnection, - HTTPProxy, - SOCKSProxy, -) - -# The 'httpcore.AnyIOBackend' class is conditional on 'anyio' being installed. -try: - from ._backends.anyio import AnyIOBackend -except ImportError: # pragma: nocover - - class AnyIOBackend: # type: ignore - def __init__(self, *args, **kwargs): # type: ignore - msg = ( - "Attempted to use 'httpcore.AnyIOBackend' but 'anyio' is not installed." - ) - raise RuntimeError(msg) - - -# The 'httpcore.TrioBackend' class is conditional on 'trio' being installed. -try: - from ._backends.trio import TrioBackend -except ImportError: # pragma: nocover - - class TrioBackend: # type: ignore - def __init__(self, *args, **kwargs): # type: ignore - msg = "Attempted to use 'httpcore.TrioBackend' but 'trio' is not installed." - raise RuntimeError(msg) - - -__all__ = [ - # top-level requests - "request", - "stream", - # models - "Origin", - "URL", - "Request", - "Response", - "Proxy", - # async - "AsyncHTTPConnection", - "AsyncConnectionPool", - "AsyncHTTPProxy", - "AsyncHTTP11Connection", - "AsyncHTTP2Connection", - "AsyncConnectionInterface", - "AsyncSOCKSProxy", - # sync - "HTTPConnection", - "ConnectionPool", - "HTTPProxy", - "HTTP11Connection", - "HTTP2Connection", - "ConnectionInterface", - "SOCKSProxy", - # network backends, implementations - "SyncBackend", - "AnyIOBackend", - "TrioBackend", - # network backends, mock implementations - "AsyncMockBackend", - "AsyncMockStream", - "MockBackend", - "MockStream", - # network backends, interface - "AsyncNetworkStream", - "AsyncNetworkBackend", - "NetworkStream", - "NetworkBackend", - # util - "default_ssl_context", - "SOCKET_OPTION", - # exceptions - "ConnectionNotAvailable", - "ProxyError", - "ProtocolError", - "LocalProtocolError", - "RemoteProtocolError", - "UnsupportedProtocol", - "TimeoutException", - "PoolTimeout", - "ConnectTimeout", - "ReadTimeout", - "WriteTimeout", - "NetworkError", - "ConnectError", - "ReadError", - "WriteError", -] - -__version__ = "1.0.9" - - -__locals = locals() -for __name in __all__: - # Exclude SOCKET_OPTION, it causes AttributeError on Python 3.14 - if not __name.startswith(("__", "SOCKET_OPTION")): - setattr(__locals[__name], "__module__", "httpcore") # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index d2171f3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_api.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_api.cpython-310.pyc deleted file mode 100644 index 52b6a41..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_api.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_exceptions.cpython-310.pyc deleted file mode 100644 index 5b30e94..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_models.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_models.cpython-310.pyc deleted file mode 100644 index 40a4f57..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_models.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_ssl.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_ssl.cpython-310.pyc deleted file mode 100644 index e8b8b0d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_ssl.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_synchronization.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_synchronization.cpython-310.pyc deleted file mode 100644 index cf5516a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_synchronization.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_trace.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_trace.cpython-310.pyc deleted file mode 100644 index 6b9da10..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_trace.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_utils.cpython-310.pyc deleted file mode 100644 index 63479e0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/__pycache__/_utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_api.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_api.py deleted file mode 100644 index 38b961d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_api.py +++ /dev/null @@ -1,94 +0,0 @@ -from __future__ import annotations - -import contextlib -import typing - -from ._models import URL, Extensions, HeaderTypes, Response -from ._sync.connection_pool import ConnectionPool - - -def request( - method: bytes | str, - url: URL | bytes | str, - *, - headers: HeaderTypes = None, - content: bytes | typing.Iterator[bytes] | None = None, - extensions: Extensions | None = None, -) -> Response: - """ - Sends an HTTP request, returning the response. - - ``` - response = httpcore.request("GET", "https://www.example.com/") - ``` - - Arguments: - method: The HTTP method for the request. Typically one of `"GET"`, - `"OPTIONS"`, `"HEAD"`, `"POST"`, `"PUT"`, `"PATCH"`, or `"DELETE"`. - url: The URL of the HTTP request. Either as an instance of `httpcore.URL`, - or as str/bytes. - headers: The HTTP request headers. Either as a dictionary of str/bytes, - or as a list of two-tuples of str/bytes. - content: The content of the request body. Either as bytes, - or as a bytes iterator. - extensions: A dictionary of optional extra information included on the request. - Possible keys include `"timeout"`. - - Returns: - An instance of `httpcore.Response`. - """ - with ConnectionPool() as pool: - return pool.request( - method=method, - url=url, - headers=headers, - content=content, - extensions=extensions, - ) - - -@contextlib.contextmanager -def stream( - method: bytes | str, - url: URL | bytes | str, - *, - headers: HeaderTypes = None, - content: bytes | typing.Iterator[bytes] | None = None, - extensions: Extensions | None = None, -) -> typing.Iterator[Response]: - """ - Sends an HTTP request, returning the response within a content manager. - - ``` - with httpcore.stream("GET", "https://www.example.com/") as response: - ... - ``` - - When using the `stream()` function, the body of the response will not be - automatically read. If you want to access the response body you should - either use `content = response.read()`, or `for chunk in response.iter_content()`. - - Arguments: - method: The HTTP method for the request. Typically one of `"GET"`, - `"OPTIONS"`, `"HEAD"`, `"POST"`, `"PUT"`, `"PATCH"`, or `"DELETE"`. - url: The URL of the HTTP request. Either as an instance of `httpcore.URL`, - or as str/bytes. - headers: The HTTP request headers. Either as a dictionary of str/bytes, - or as a list of two-tuples of str/bytes. - content: The content of the request body. Either as bytes, - or as a bytes iterator. - extensions: A dictionary of optional extra information included on the request. - Possible keys include `"timeout"`. - - Returns: - An instance of `httpcore.Response`. - """ - with ConnectionPool() as pool: - with pool.stream( - method=method, - url=url, - headers=headers, - content=content, - extensions=extensions, - ) as response: - yield response diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__init__.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__init__.py deleted file mode 100644 index 88dc7f0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -from .connection import AsyncHTTPConnection -from .connection_pool import AsyncConnectionPool -from .http11 import AsyncHTTP11Connection -from .http_proxy import AsyncHTTPProxy -from .interfaces import AsyncConnectionInterface - -try: - from .http2 import AsyncHTTP2Connection -except ImportError: # pragma: nocover - - class AsyncHTTP2Connection: # type: ignore - def __init__(self, *args, **kwargs) -> None: # type: ignore - raise RuntimeError( - "Attempted to use http2 support, but the `h2` package is not " - "installed. Use 'pip install httpcore[http2]'." - ) - - -try: - from .socks_proxy import AsyncSOCKSProxy -except ImportError: # pragma: nocover - - class AsyncSOCKSProxy: # type: ignore - def __init__(self, *args, **kwargs) -> None: # type: ignore - raise RuntimeError( - "Attempted to use SOCKS support, but the `socksio` package is not " - "installed. Use 'pip install httpcore[socks]'." - ) - - -__all__ = [ - "AsyncHTTPConnection", - "AsyncConnectionPool", - "AsyncHTTPProxy", - "AsyncHTTP11Connection", - "AsyncHTTP2Connection", - "AsyncConnectionInterface", - "AsyncSOCKSProxy", -] diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 9c6d030..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/connection.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/connection.cpython-310.pyc deleted file mode 100644 index 1f24412..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/connection.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/connection_pool.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/connection_pool.cpython-310.pyc deleted file mode 100644 index 7d5413f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/connection_pool.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http11.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http11.cpython-310.pyc deleted file mode 100644 index 16c736d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http11.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http2.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http2.cpython-310.pyc deleted file mode 100644 index 1e49ff4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http2.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http_proxy.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http_proxy.cpython-310.pyc deleted file mode 100644 index 47c3a9d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/http_proxy.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/interfaces.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/interfaces.cpython-310.pyc deleted file mode 100644 index 859083b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/interfaces.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/socks_proxy.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/socks_proxy.cpython-310.pyc deleted file mode 100644 index 38762d5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/__pycache__/socks_proxy.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/connection.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/connection.py deleted file mode 100644 index b42581d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/connection.py +++ /dev/null @@ -1,222 +0,0 @@ -from __future__ import annotations - -import itertools -import logging -import ssl -import types -import typing - -from .._backends.auto import AutoBackend -from .._backends.base import SOCKET_OPTION, AsyncNetworkBackend, AsyncNetworkStream -from .._exceptions import ConnectError, ConnectTimeout -from .._models import Origin, Request, Response -from .._ssl import default_ssl_context -from .._synchronization import AsyncLock -from .._trace import Trace -from .http11 import AsyncHTTP11Connection -from .interfaces import AsyncConnectionInterface - -RETRIES_BACKOFF_FACTOR = 0.5 # 0s, 0.5s, 1s, 2s, 4s, etc. - - -logger = logging.getLogger("httpcore.connection") - - -def exponential_backoff(factor: float) -> typing.Iterator[float]: - """ - Generate a geometric sequence that has a ratio of 2 and starts with 0. - - For example: - - `factor = 2`: `0, 2, 4, 8, 16, 32, 64, ...` - - `factor = 3`: `0, 3, 6, 12, 24, 48, 96, ...` - """ - yield 0 - for n in itertools.count(): - yield factor * 2**n - - -class AsyncHTTPConnection(AsyncConnectionInterface): - def __init__( - self, - origin: Origin, - ssl_context: ssl.SSLContext | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - local_address: str | None = None, - uds: str | None = None, - network_backend: AsyncNetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - self._origin = origin - self._ssl_context = ssl_context - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - self._retries = retries - self._local_address = local_address - self._uds = uds - - self._network_backend: AsyncNetworkBackend = ( - AutoBackend() if network_backend is None else network_backend - ) - self._connection: AsyncConnectionInterface | None = None - self._connect_failed: bool = False - self._request_lock = AsyncLock() - self._socket_options = socket_options - - async def handle_async_request(self, request: Request) -> Response: - if not self.can_handle_request(request.url.origin): - raise RuntimeError( - f"Attempted to send request to {request.url.origin} on connection to {self._origin}" - ) - - try: - async with self._request_lock: - if self._connection is None: - stream = await self._connect(request) - - ssl_object = stream.get_extra_info("ssl_object") - http2_negotiated = ( - ssl_object is not None - and ssl_object.selected_alpn_protocol() == "h2" - ) - if http2_negotiated or (self._http2 and not self._http1): - from .http2 import AsyncHTTP2Connection - - self._connection = AsyncHTTP2Connection( - origin=self._origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - else: - self._connection = AsyncHTTP11Connection( - origin=self._origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - except BaseException as exc: - self._connect_failed = True - raise exc - - return await self._connection.handle_async_request(request) - - async def _connect(self, request: Request) -> AsyncNetworkStream: - timeouts = request.extensions.get("timeout", {}) - sni_hostname = request.extensions.get("sni_hostname", None) - timeout = timeouts.get("connect", None) - - retries_left = self._retries - delays = exponential_backoff(factor=RETRIES_BACKOFF_FACTOR) - - while True: - try: - if self._uds is None: - kwargs = { - "host": self._origin.host.decode("ascii"), - "port": self._origin.port, - "local_address": self._local_address, - "timeout": timeout, - "socket_options": self._socket_options, - } - async with Trace("connect_tcp", logger, request, kwargs) as trace: - stream = await self._network_backend.connect_tcp(**kwargs) - trace.return_value = stream - else: - kwargs = { - "path": self._uds, - "timeout": timeout, - "socket_options": self._socket_options, - } - async with Trace( - "connect_unix_socket", logger, request, kwargs - ) as trace: - stream = await self._network_backend.connect_unix_socket( - **kwargs - ) - trace.return_value = stream - - if self._origin.scheme in (b"https", b"wss"): - ssl_context = ( - default_ssl_context() - if self._ssl_context is None - else self._ssl_context - ) - alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"] - ssl_context.set_alpn_protocols(alpn_protocols) - - kwargs = { - "ssl_context": ssl_context, - "server_hostname": sni_hostname - or self._origin.host.decode("ascii"), - "timeout": timeout, - } - async with Trace("start_tls", logger, request, kwargs) as trace: - stream = await stream.start_tls(**kwargs) - trace.return_value = stream - return stream - except (ConnectError, ConnectTimeout): - if retries_left <= 0: - raise - retries_left -= 1 - delay = next(delays) - async with Trace("retry", logger, request, kwargs) as trace: - await self._network_backend.sleep(delay) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._origin - - async def aclose(self) -> None: - if self._connection is not None: - async with Trace("close", logger, None, {}): - await self._connection.aclose() - - def is_available(self) -> bool: - if self._connection is None: - # If HTTP/2 support is enabled, and the resulting connection could - # end up as HTTP/2 then we should indicate the connection as being - # available to service multiple requests. - return ( - self._http2 - and (self._origin.scheme == b"https" or not self._http1) - and not self._connect_failed - ) - return self._connection.is_available() - - def has_expired(self) -> bool: - if self._connection is None: - return self._connect_failed - return self._connection.has_expired() - - def is_idle(self) -> bool: - if self._connection is None: - return self._connect_failed - return self._connection.is_idle() - - def is_closed(self) -> bool: - if self._connection is None: - return self._connect_failed - return self._connection.is_closed() - - def info(self) -> str: - if self._connection is None: - return "CONNECTION FAILED" if self._connect_failed else "CONNECTING" - return self._connection.info() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" - - # These context managers are not used in the standard flow, but are - # useful for testing or working with connection instances directly. - - async def __aenter__(self) -> AsyncHTTPConnection: - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - await self.aclose() diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/connection_pool.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/connection_pool.py deleted file mode 100644 index 96e973d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/connection_pool.py +++ /dev/null @@ -1,420 +0,0 @@ -from __future__ import annotations - -import ssl -import sys -import types -import typing - -from .._backends.auto import AutoBackend -from .._backends.base import SOCKET_OPTION, AsyncNetworkBackend -from .._exceptions import ConnectionNotAvailable, UnsupportedProtocol -from .._models import Origin, Proxy, Request, Response -from .._synchronization import AsyncEvent, AsyncShieldCancellation, AsyncThreadLock -from .connection import AsyncHTTPConnection -from .interfaces import AsyncConnectionInterface, AsyncRequestInterface - - -class AsyncPoolRequest: - def __init__(self, request: Request) -> None: - self.request = request - self.connection: AsyncConnectionInterface | None = None - self._connection_acquired = AsyncEvent() - - def assign_to_connection(self, connection: AsyncConnectionInterface | None) -> None: - self.connection = connection - self._connection_acquired.set() - - def clear_connection(self) -> None: - self.connection = None - self._connection_acquired = AsyncEvent() - - async def wait_for_connection( - self, timeout: float | None = None - ) -> AsyncConnectionInterface: - if self.connection is None: - await self._connection_acquired.wait(timeout=timeout) - assert self.connection is not None - return self.connection - - def is_queued(self) -> bool: - return self.connection is None - - -class AsyncConnectionPool(AsyncRequestInterface): - """ - A connection pool for making HTTP requests. - """ - - def __init__( - self, - ssl_context: ssl.SSLContext | None = None, - proxy: Proxy | None = None, - max_connections: int | None = 10, - max_keepalive_connections: int | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - local_address: str | None = None, - uds: str | None = None, - network_backend: AsyncNetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - """ - A connection pool for making HTTP requests. - - Parameters: - ssl_context: An SSL context to use for verifying connections. - If not specified, the default `httpcore.default_ssl_context()` - will be used. - max_connections: The maximum number of concurrent HTTP connections that - the pool should allow. Any attempt to send a request on a pool that - would exceed this amount will block until a connection is available. - max_keepalive_connections: The maximum number of idle HTTP connections - that will be maintained in the pool. - keepalive_expiry: The duration in seconds that an idle HTTP connection - may be maintained for before being expired from the pool. - http1: A boolean indicating if HTTP/1.1 requests should be supported - by the connection pool. Defaults to True. - http2: A boolean indicating if HTTP/2 requests should be supported by - the connection pool. Defaults to False. - retries: The maximum number of retries when trying to establish a - connection. - local_address: Local address to connect from. Can also be used to connect - using a particular address family. Using `local_address="0.0.0.0"` - will connect using an `AF_INET` address (IPv4), while using - `local_address="::"` will connect using an `AF_INET6` address (IPv6). - uds: Path to a Unix Domain Socket to use instead of TCP sockets. - network_backend: A backend instance to use for handling network I/O. - socket_options: Socket options that have to be included - in the TCP socket when the connection was established. - """ - self._ssl_context = ssl_context - self._proxy = proxy - self._max_connections = ( - sys.maxsize if max_connections is None else max_connections - ) - self._max_keepalive_connections = ( - sys.maxsize - if max_keepalive_connections is None - else max_keepalive_connections - ) - self._max_keepalive_connections = min( - self._max_connections, self._max_keepalive_connections - ) - - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - self._retries = retries - self._local_address = local_address - self._uds = uds - - self._network_backend = ( - AutoBackend() if network_backend is None else network_backend - ) - self._socket_options = socket_options - - # The mutable state on a connection pool is the queue of incoming requests, - # and the set of connections that are servicing those requests. - self._connections: list[AsyncConnectionInterface] = [] - self._requests: list[AsyncPoolRequest] = [] - - # We only mutate the state of the connection pool within an 'optional_thread_lock' - # context. This holds a threading lock unless we're running in async mode, - # in which case it is a no-op. - self._optional_thread_lock = AsyncThreadLock() - - def create_connection(self, origin: Origin) -> AsyncConnectionInterface: - if self._proxy is not None: - if self._proxy.url.scheme in (b"socks5", b"socks5h"): - from .socks_proxy import AsyncSocks5Connection - - return AsyncSocks5Connection( - proxy_origin=self._proxy.url.origin, - proxy_auth=self._proxy.auth, - remote_origin=origin, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - elif origin.scheme == b"http": - from .http_proxy import AsyncForwardHTTPConnection - - return AsyncForwardHTTPConnection( - proxy_origin=self._proxy.url.origin, - proxy_headers=self._proxy.headers, - proxy_ssl_context=self._proxy.ssl_context, - remote_origin=origin, - keepalive_expiry=self._keepalive_expiry, - network_backend=self._network_backend, - ) - from .http_proxy import AsyncTunnelHTTPConnection - - return AsyncTunnelHTTPConnection( - proxy_origin=self._proxy.url.origin, - proxy_headers=self._proxy.headers, - proxy_ssl_context=self._proxy.ssl_context, - remote_origin=origin, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - - return AsyncHTTPConnection( - origin=origin, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - retries=self._retries, - local_address=self._local_address, - uds=self._uds, - network_backend=self._network_backend, - socket_options=self._socket_options, - ) - - @property - def connections(self) -> list[AsyncConnectionInterface]: - """ - Return a list of the connections currently in the pool. - - For example: - - ```python - >>> pool.connections - [ - , - , - , - ] - ``` - """ - return list(self._connections) - - async def handle_async_request(self, request: Request) -> Response: - """ - Send an HTTP request, and return an HTTP response. - - This is the core implementation that is called into by `.request()` or `.stream()`. - """ - scheme = request.url.scheme.decode() - if scheme == "": - raise UnsupportedProtocol( - "Request URL is missing an 'http://' or 'https://' protocol." - ) - if scheme not in ("http", "https", "ws", "wss"): - raise UnsupportedProtocol( - f"Request URL has an unsupported protocol '{scheme}://'." - ) - - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("pool", None) - - with self._optional_thread_lock: - # Add the incoming request to our request queue. - pool_request = AsyncPoolRequest(request) - self._requests.append(pool_request) - - try: - while True: - with self._optional_thread_lock: - # Assign incoming requests to available connections, - # closing or creating new connections as required. - closing = self._assign_requests_to_connections() - await self._close_connections(closing) - - # Wait until this request has an assigned connection. - connection = await pool_request.wait_for_connection(timeout=timeout) - - try: - # Send the request on the assigned connection. - response = await connection.handle_async_request( - pool_request.request - ) - except ConnectionNotAvailable: - # In some cases a connection may initially be available to - # handle a request, but then become unavailable. - # - # In this case we clear the connection and try again. - pool_request.clear_connection() - else: - break # pragma: nocover - - except BaseException as exc: - with self._optional_thread_lock: - # For any exception or cancellation we remove the request from - # the queue, and then re-assign requests to connections. - self._requests.remove(pool_request) - closing = self._assign_requests_to_connections() - - await self._close_connections(closing) - raise exc from None - - # Return the response. Note that in this case we still have to manage - # the point at which the response is closed. - assert isinstance(response.stream, typing.AsyncIterable) - return Response( - status=response.status, - headers=response.headers, - content=PoolByteStream( - stream=response.stream, pool_request=pool_request, pool=self - ), - extensions=response.extensions, - ) - - def _assign_requests_to_connections(self) -> list[AsyncConnectionInterface]: - """ - Manage the state of the connection pool, assigning incoming - requests to connections as available. - - Called whenever a new request is added or removed from the pool. - - Any closing connections are returned, allowing the I/O for closing - those connections to be handled seperately. - """ - closing_connections = [] - - # First we handle cleaning up any connections that are closed, - # have expired their keep-alive, or surplus idle connections. - for connection in list(self._connections): - if connection.is_closed(): - # log: "removing closed connection" - self._connections.remove(connection) - elif connection.has_expired(): - # log: "closing expired connection" - self._connections.remove(connection) - closing_connections.append(connection) - elif ( - connection.is_idle() - and len([connection.is_idle() for connection in self._connections]) - > self._max_keepalive_connections - ): - # log: "closing idle connection" - self._connections.remove(connection) - closing_connections.append(connection) - - # Assign queued requests to connections. - queued_requests = [request for request in self._requests if request.is_queued()] - for pool_request in queued_requests: - origin = pool_request.request.url.origin - available_connections = [ - connection - for connection in self._connections - if connection.can_handle_request(origin) and connection.is_available() - ] - idle_connections = [ - connection for connection in self._connections if connection.is_idle() - ] - - # There are three cases for how we may be able to handle the request: - # - # 1. There is an existing connection that can handle the request. - # 2. We can create a new connection to handle the request. - # 3. We can close an idle connection and then create a new connection - # to handle the request. - if available_connections: - # log: "reusing existing connection" - connection = available_connections[0] - pool_request.assign_to_connection(connection) - elif len(self._connections) < self._max_connections: - # log: "creating new connection" - connection = self.create_connection(origin) - self._connections.append(connection) - pool_request.assign_to_connection(connection) - elif idle_connections: - # log: "closing idle connection" - connection = idle_connections[0] - self._connections.remove(connection) - closing_connections.append(connection) - # log: "creating new connection" - connection = self.create_connection(origin) - self._connections.append(connection) - pool_request.assign_to_connection(connection) - - return closing_connections - - async def _close_connections(self, closing: list[AsyncConnectionInterface]) -> None: - # Close connections which have been removed from the pool. - with AsyncShieldCancellation(): - for connection in closing: - await connection.aclose() - - async def aclose(self) -> None: - # Explicitly close the connection pool. - # Clears all existing requests and connections. - with self._optional_thread_lock: - closing_connections = list(self._connections) - self._connections = [] - await self._close_connections(closing_connections) - - async def __aenter__(self) -> AsyncConnectionPool: - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - await self.aclose() - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - with self._optional_thread_lock: - request_is_queued = [request.is_queued() for request in self._requests] - connection_is_idle = [ - connection.is_idle() for connection in self._connections - ] - - num_active_requests = request_is_queued.count(False) - num_queued_requests = request_is_queued.count(True) - num_active_connections = connection_is_idle.count(False) - num_idle_connections = connection_is_idle.count(True) - - requests_info = ( - f"Requests: {num_active_requests} active, {num_queued_requests} queued" - ) - connection_info = ( - f"Connections: {num_active_connections} active, {num_idle_connections} idle" - ) - - return f"<{class_name} [{requests_info} | {connection_info}]>" - - -class PoolByteStream: - def __init__( - self, - stream: typing.AsyncIterable[bytes], - pool_request: AsyncPoolRequest, - pool: AsyncConnectionPool, - ) -> None: - self._stream = stream - self._pool_request = pool_request - self._pool = pool - self._closed = False - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - try: - async for part in self._stream: - yield part - except BaseException as exc: - await self.aclose() - raise exc from None - - async def aclose(self) -> None: - if not self._closed: - self._closed = True - with AsyncShieldCancellation(): - if hasattr(self._stream, "aclose"): - await self._stream.aclose() - - with self._pool._optional_thread_lock: - self._pool._requests.remove(self._pool_request) - closing = self._pool._assign_requests_to_connections() - - await self._pool._close_connections(closing) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http11.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http11.py deleted file mode 100644 index e6d6d70..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http11.py +++ /dev/null @@ -1,379 +0,0 @@ -from __future__ import annotations - -import enum -import logging -import ssl -import time -import types -import typing - -import h11 - -from .._backends.base import AsyncNetworkStream -from .._exceptions import ( - ConnectionNotAvailable, - LocalProtocolError, - RemoteProtocolError, - WriteError, - map_exceptions, -) -from .._models import Origin, Request, Response -from .._synchronization import AsyncLock, AsyncShieldCancellation -from .._trace import Trace -from .interfaces import AsyncConnectionInterface - -logger = logging.getLogger("httpcore.http11") - - -# A subset of `h11.Event` types supported by `_send_event` -H11SendEvent = typing.Union[ - h11.Request, - h11.Data, - h11.EndOfMessage, -] - - -class HTTPConnectionState(enum.IntEnum): - NEW = 0 - ACTIVE = 1 - IDLE = 2 - CLOSED = 3 - - -class AsyncHTTP11Connection(AsyncConnectionInterface): - READ_NUM_BYTES = 64 * 1024 - MAX_INCOMPLETE_EVENT_SIZE = 100 * 1024 - - def __init__( - self, - origin: Origin, - stream: AsyncNetworkStream, - keepalive_expiry: float | None = None, - ) -> None: - self._origin = origin - self._network_stream = stream - self._keepalive_expiry: float | None = keepalive_expiry - self._expire_at: float | None = None - self._state = HTTPConnectionState.NEW - self._state_lock = AsyncLock() - self._request_count = 0 - self._h11_state = h11.Connection( - our_role=h11.CLIENT, - max_incomplete_event_size=self.MAX_INCOMPLETE_EVENT_SIZE, - ) - - async def handle_async_request(self, request: Request) -> Response: - if not self.can_handle_request(request.url.origin): - raise RuntimeError( - f"Attempted to send request to {request.url.origin} on connection " - f"to {self._origin}" - ) - - async with self._state_lock: - if self._state in (HTTPConnectionState.NEW, HTTPConnectionState.IDLE): - self._request_count += 1 - self._state = HTTPConnectionState.ACTIVE - self._expire_at = None - else: - raise ConnectionNotAvailable() - - try: - kwargs = {"request": request} - try: - async with Trace( - "send_request_headers", logger, request, kwargs - ) as trace: - await self._send_request_headers(**kwargs) - async with Trace("send_request_body", logger, request, kwargs) as trace: - await self._send_request_body(**kwargs) - except WriteError: - # If we get a write error while we're writing the request, - # then we supress this error and move on to attempting to - # read the response. Servers can sometimes close the request - # pre-emptively and then respond with a well formed HTTP - # error response. - pass - - async with Trace( - "receive_response_headers", logger, request, kwargs - ) as trace: - ( - http_version, - status, - reason_phrase, - headers, - trailing_data, - ) = await self._receive_response_headers(**kwargs) - trace.return_value = ( - http_version, - status, - reason_phrase, - headers, - ) - - network_stream = self._network_stream - - # CONNECT or Upgrade request - if (status == 101) or ( - (request.method == b"CONNECT") and (200 <= status < 300) - ): - network_stream = AsyncHTTP11UpgradeStream(network_stream, trailing_data) - - return Response( - status=status, - headers=headers, - content=HTTP11ConnectionByteStream(self, request), - extensions={ - "http_version": http_version, - "reason_phrase": reason_phrase, - "network_stream": network_stream, - }, - ) - except BaseException as exc: - with AsyncShieldCancellation(): - async with Trace("response_closed", logger, request) as trace: - await self._response_closed() - raise exc - - # Sending the request... - - async def _send_request_headers(self, request: Request) -> None: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("write", None) - - with map_exceptions({h11.LocalProtocolError: LocalProtocolError}): - event = h11.Request( - method=request.method, - target=request.url.target, - headers=request.headers, - ) - await self._send_event(event, timeout=timeout) - - async def _send_request_body(self, request: Request) -> None: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("write", None) - - assert isinstance(request.stream, typing.AsyncIterable) - async for chunk in request.stream: - event = h11.Data(data=chunk) - await self._send_event(event, timeout=timeout) - - await self._send_event(h11.EndOfMessage(), timeout=timeout) - - async def _send_event(self, event: h11.Event, timeout: float | None = None) -> None: - bytes_to_send = self._h11_state.send(event) - if bytes_to_send is not None: - await self._network_stream.write(bytes_to_send, timeout=timeout) - - # Receiving the response... - - async def _receive_response_headers( - self, request: Request - ) -> tuple[bytes, int, bytes, list[tuple[bytes, bytes]], bytes]: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("read", None) - - while True: - event = await self._receive_event(timeout=timeout) - if isinstance(event, h11.Response): - break - if ( - isinstance(event, h11.InformationalResponse) - and event.status_code == 101 - ): - break - - http_version = b"HTTP/" + event.http_version - - # h11 version 0.11+ supports a `raw_items` interface to get the - # raw header casing, rather than the enforced lowercase headers. - headers = event.headers.raw_items() - - trailing_data, _ = self._h11_state.trailing_data - - return http_version, event.status_code, event.reason, headers, trailing_data - - async def _receive_response_body( - self, request: Request - ) -> typing.AsyncIterator[bytes]: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("read", None) - - while True: - event = await self._receive_event(timeout=timeout) - if isinstance(event, h11.Data): - yield bytes(event.data) - elif isinstance(event, (h11.EndOfMessage, h11.PAUSED)): - break - - async def _receive_event( - self, timeout: float | None = None - ) -> h11.Event | type[h11.PAUSED]: - while True: - with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}): - event = self._h11_state.next_event() - - if event is h11.NEED_DATA: - data = await self._network_stream.read( - self.READ_NUM_BYTES, timeout=timeout - ) - - # If we feed this case through h11 we'll raise an exception like: - # - # httpcore.RemoteProtocolError: can't handle event type - # ConnectionClosed when role=SERVER and state=SEND_RESPONSE - # - # Which is accurate, but not very informative from an end-user - # perspective. Instead we handle this case distinctly and treat - # it as a ConnectError. - if data == b"" and self._h11_state.their_state == h11.SEND_RESPONSE: - msg = "Server disconnected without sending a response." - raise RemoteProtocolError(msg) - - self._h11_state.receive_data(data) - else: - # mypy fails to narrow the type in the above if statement above - return event # type: ignore[return-value] - - async def _response_closed(self) -> None: - async with self._state_lock: - if ( - self._h11_state.our_state is h11.DONE - and self._h11_state.their_state is h11.DONE - ): - self._state = HTTPConnectionState.IDLE - self._h11_state.start_next_cycle() - if self._keepalive_expiry is not None: - now = time.monotonic() - self._expire_at = now + self._keepalive_expiry - else: - await self.aclose() - - # Once the connection is no longer required... - - async def aclose(self) -> None: - # Note that this method unilaterally closes the connection, and does - # not have any kind of locking in place around it. - self._state = HTTPConnectionState.CLOSED - await self._network_stream.aclose() - - # The AsyncConnectionInterface methods provide information about the state of - # the connection, allowing for a connection pooling implementation to - # determine when to reuse and when to close the connection... - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._origin - - def is_available(self) -> bool: - # Note that HTTP/1.1 connections in the "NEW" state are not treated as - # being "available". The control flow which created the connection will - # be able to send an outgoing request, but the connection will not be - # acquired from the connection pool for any other request. - return self._state == HTTPConnectionState.IDLE - - def has_expired(self) -> bool: - now = time.monotonic() - keepalive_expired = self._expire_at is not None and now > self._expire_at - - # If the HTTP connection is idle but the socket is readable, then the - # only valid state is that the socket is about to return b"", indicating - # a server-initiated disconnect. - server_disconnected = ( - self._state == HTTPConnectionState.IDLE - and self._network_stream.get_extra_info("is_readable") - ) - - return keepalive_expired or server_disconnected - - def is_idle(self) -> bool: - return self._state == HTTPConnectionState.IDLE - - def is_closed(self) -> bool: - return self._state == HTTPConnectionState.CLOSED - - def info(self) -> str: - origin = str(self._origin) - return ( - f"{origin!r}, HTTP/1.1, {self._state.name}, " - f"Request Count: {self._request_count}" - ) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - origin = str(self._origin) - return ( - f"<{class_name} [{origin!r}, {self._state.name}, " - f"Request Count: {self._request_count}]>" - ) - - # These context managers are not used in the standard flow, but are - # useful for testing or working with connection instances directly. - - async def __aenter__(self) -> AsyncHTTP11Connection: - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - await self.aclose() - - -class HTTP11ConnectionByteStream: - def __init__(self, connection: AsyncHTTP11Connection, request: Request) -> None: - self._connection = connection - self._request = request - self._closed = False - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - kwargs = {"request": self._request} - try: - async with Trace("receive_response_body", logger, self._request, kwargs): - async for chunk in self._connection._receive_response_body(**kwargs): - yield chunk - except BaseException as exc: - # If we get an exception while streaming the response, - # we want to close the response (and possibly the connection) - # before raising that exception. - with AsyncShieldCancellation(): - await self.aclose() - raise exc - - async def aclose(self) -> None: - if not self._closed: - self._closed = True - async with Trace("response_closed", logger, self._request): - await self._connection._response_closed() - - -class AsyncHTTP11UpgradeStream(AsyncNetworkStream): - def __init__(self, stream: AsyncNetworkStream, leading_data: bytes) -> None: - self._stream = stream - self._leading_data = leading_data - - async def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - if self._leading_data: - buffer = self._leading_data[:max_bytes] - self._leading_data = self._leading_data[max_bytes:] - return buffer - else: - return await self._stream.read(max_bytes, timeout) - - async def write(self, buffer: bytes, timeout: float | None = None) -> None: - await self._stream.write(buffer, timeout) - - async def aclose(self) -> None: - await self._stream.aclose() - - async def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> AsyncNetworkStream: - return await self._stream.start_tls(ssl_context, server_hostname, timeout) - - def get_extra_info(self, info: str) -> typing.Any: - return self._stream.get_extra_info(info) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http2.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http2.py deleted file mode 100644 index dbd0bee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http2.py +++ /dev/null @@ -1,592 +0,0 @@ -from __future__ import annotations - -import enum -import logging -import time -import types -import typing - -import h2.config -import h2.connection -import h2.events -import h2.exceptions -import h2.settings - -from .._backends.base import AsyncNetworkStream -from .._exceptions import ( - ConnectionNotAvailable, - LocalProtocolError, - RemoteProtocolError, -) -from .._models import Origin, Request, Response -from .._synchronization import AsyncLock, AsyncSemaphore, AsyncShieldCancellation -from .._trace import Trace -from .interfaces import AsyncConnectionInterface - -logger = logging.getLogger("httpcore.http2") - - -def has_body_headers(request: Request) -> bool: - return any( - k.lower() == b"content-length" or k.lower() == b"transfer-encoding" - for k, v in request.headers - ) - - -class HTTPConnectionState(enum.IntEnum): - ACTIVE = 1 - IDLE = 2 - CLOSED = 3 - - -class AsyncHTTP2Connection(AsyncConnectionInterface): - READ_NUM_BYTES = 64 * 1024 - CONFIG = h2.config.H2Configuration(validate_inbound_headers=False) - - def __init__( - self, - origin: Origin, - stream: AsyncNetworkStream, - keepalive_expiry: float | None = None, - ): - self._origin = origin - self._network_stream = stream - self._keepalive_expiry: float | None = keepalive_expiry - self._h2_state = h2.connection.H2Connection(config=self.CONFIG) - self._state = HTTPConnectionState.IDLE - self._expire_at: float | None = None - self._request_count = 0 - self._init_lock = AsyncLock() - self._state_lock = AsyncLock() - self._read_lock = AsyncLock() - self._write_lock = AsyncLock() - self._sent_connection_init = False - self._used_all_stream_ids = False - self._connection_error = False - - # Mapping from stream ID to response stream events. - self._events: dict[ - int, - list[ - h2.events.ResponseReceived - | h2.events.DataReceived - | h2.events.StreamEnded - | h2.events.StreamReset, - ], - ] = {} - - # Connection terminated events are stored as state since - # we need to handle them for all streams. - self._connection_terminated: h2.events.ConnectionTerminated | None = None - - self._read_exception: Exception | None = None - self._write_exception: Exception | None = None - - async def handle_async_request(self, request: Request) -> Response: - if not self.can_handle_request(request.url.origin): - # This cannot occur in normal operation, since the connection pool - # will only send requests on connections that handle them. - # It's in place simply for resilience as a guard against incorrect - # usage, for anyone working directly with httpcore connections. - raise RuntimeError( - f"Attempted to send request to {request.url.origin} on connection " - f"to {self._origin}" - ) - - async with self._state_lock: - if self._state in (HTTPConnectionState.ACTIVE, HTTPConnectionState.IDLE): - self._request_count += 1 - self._expire_at = None - self._state = HTTPConnectionState.ACTIVE - else: - raise ConnectionNotAvailable() - - async with self._init_lock: - if not self._sent_connection_init: - try: - sci_kwargs = {"request": request} - async with Trace( - "send_connection_init", logger, request, sci_kwargs - ): - await self._send_connection_init(**sci_kwargs) - except BaseException as exc: - with AsyncShieldCancellation(): - await self.aclose() - raise exc - - self._sent_connection_init = True - - # Initially start with just 1 until the remote server provides - # its max_concurrent_streams value - self._max_streams = 1 - - local_settings_max_streams = ( - self._h2_state.local_settings.max_concurrent_streams - ) - self._max_streams_semaphore = AsyncSemaphore(local_settings_max_streams) - - for _ in range(local_settings_max_streams - self._max_streams): - await self._max_streams_semaphore.acquire() - - await self._max_streams_semaphore.acquire() - - try: - stream_id = self._h2_state.get_next_available_stream_id() - self._events[stream_id] = [] - except h2.exceptions.NoAvailableStreamIDError: # pragma: nocover - self._used_all_stream_ids = True - self._request_count -= 1 - raise ConnectionNotAvailable() - - try: - kwargs = {"request": request, "stream_id": stream_id} - async with Trace("send_request_headers", logger, request, kwargs): - await self._send_request_headers(request=request, stream_id=stream_id) - async with Trace("send_request_body", logger, request, kwargs): - await self._send_request_body(request=request, stream_id=stream_id) - async with Trace( - "receive_response_headers", logger, request, kwargs - ) as trace: - status, headers = await self._receive_response( - request=request, stream_id=stream_id - ) - trace.return_value = (status, headers) - - return Response( - status=status, - headers=headers, - content=HTTP2ConnectionByteStream(self, request, stream_id=stream_id), - extensions={ - "http_version": b"HTTP/2", - "network_stream": self._network_stream, - "stream_id": stream_id, - }, - ) - except BaseException as exc: # noqa: PIE786 - with AsyncShieldCancellation(): - kwargs = {"stream_id": stream_id} - async with Trace("response_closed", logger, request, kwargs): - await self._response_closed(stream_id=stream_id) - - if isinstance(exc, h2.exceptions.ProtocolError): - # One case where h2 can raise a protocol error is when a - # closed frame has been seen by the state machine. - # - # This happens when one stream is reading, and encounters - # a GOAWAY event. Other flows of control may then raise - # a protocol error at any point they interact with the 'h2_state'. - # - # In this case we'll have stored the event, and should raise - # it as a RemoteProtocolError. - if self._connection_terminated: # pragma: nocover - raise RemoteProtocolError(self._connection_terminated) - # If h2 raises a protocol error in some other state then we - # must somehow have made a protocol violation. - raise LocalProtocolError(exc) # pragma: nocover - - raise exc - - async def _send_connection_init(self, request: Request) -> None: - """ - The HTTP/2 connection requires some initial setup before we can start - using individual request/response streams on it. - """ - # Need to set these manually here instead of manipulating via - # __setitem__() otherwise the H2Connection will emit SettingsUpdate - # frames in addition to sending the undesired defaults. - self._h2_state.local_settings = h2.settings.Settings( - client=True, - initial_values={ - # Disable PUSH_PROMISE frames from the server since we don't do anything - # with them for now. Maybe when we support caching? - h2.settings.SettingCodes.ENABLE_PUSH: 0, - # These two are taken from h2 for safe defaults - h2.settings.SettingCodes.MAX_CONCURRENT_STREAMS: 100, - h2.settings.SettingCodes.MAX_HEADER_LIST_SIZE: 65536, - }, - ) - - # Some websites (*cough* Yahoo *cough*) balk at this setting being - # present in the initial handshake since it's not defined in the original - # RFC despite the RFC mandating ignoring settings you don't know about. - del self._h2_state.local_settings[ - h2.settings.SettingCodes.ENABLE_CONNECT_PROTOCOL - ] - - self._h2_state.initiate_connection() - self._h2_state.increment_flow_control_window(2**24) - await self._write_outgoing_data(request) - - # Sending the request... - - async def _send_request_headers(self, request: Request, stream_id: int) -> None: - """ - Send the request headers to a given stream ID. - """ - end_stream = not has_body_headers(request) - - # In HTTP/2 the ':authority' pseudo-header is used instead of 'Host'. - # In order to gracefully handle HTTP/1.1 and HTTP/2 we always require - # HTTP/1.1 style headers, and map them appropriately if we end up on - # an HTTP/2 connection. - authority = [v for k, v in request.headers if k.lower() == b"host"][0] - - headers = [ - (b":method", request.method), - (b":authority", authority), - (b":scheme", request.url.scheme), - (b":path", request.url.target), - ] + [ - (k.lower(), v) - for k, v in request.headers - if k.lower() - not in ( - b"host", - b"transfer-encoding", - ) - ] - - self._h2_state.send_headers(stream_id, headers, end_stream=end_stream) - self._h2_state.increment_flow_control_window(2**24, stream_id=stream_id) - await self._write_outgoing_data(request) - - async def _send_request_body(self, request: Request, stream_id: int) -> None: - """ - Iterate over the request body sending it to a given stream ID. - """ - if not has_body_headers(request): - return - - assert isinstance(request.stream, typing.AsyncIterable) - async for data in request.stream: - await self._send_stream_data(request, stream_id, data) - await self._send_end_stream(request, stream_id) - - async def _send_stream_data( - self, request: Request, stream_id: int, data: bytes - ) -> None: - """ - Send a single chunk of data in one or more data frames. - """ - while data: - max_flow = await self._wait_for_outgoing_flow(request, stream_id) - chunk_size = min(len(data), max_flow) - chunk, data = data[:chunk_size], data[chunk_size:] - self._h2_state.send_data(stream_id, chunk) - await self._write_outgoing_data(request) - - async def _send_end_stream(self, request: Request, stream_id: int) -> None: - """ - Send an empty data frame on on a given stream ID with the END_STREAM flag set. - """ - self._h2_state.end_stream(stream_id) - await self._write_outgoing_data(request) - - # Receiving the response... - - async def _receive_response( - self, request: Request, stream_id: int - ) -> tuple[int, list[tuple[bytes, bytes]]]: - """ - Return the response status code and headers for a given stream ID. - """ - while True: - event = await self._receive_stream_event(request, stream_id) - if isinstance(event, h2.events.ResponseReceived): - break - - status_code = 200 - headers = [] - assert event.headers is not None - for k, v in event.headers: - if k == b":status": - status_code = int(v.decode("ascii", errors="ignore")) - elif not k.startswith(b":"): - headers.append((k, v)) - - return (status_code, headers) - - async def _receive_response_body( - self, request: Request, stream_id: int - ) -> typing.AsyncIterator[bytes]: - """ - Iterator that returns the bytes of the response body for a given stream ID. - """ - while True: - event = await self._receive_stream_event(request, stream_id) - if isinstance(event, h2.events.DataReceived): - assert event.flow_controlled_length is not None - assert event.data is not None - amount = event.flow_controlled_length - self._h2_state.acknowledge_received_data(amount, stream_id) - await self._write_outgoing_data(request) - yield event.data - elif isinstance(event, h2.events.StreamEnded): - break - - async def _receive_stream_event( - self, request: Request, stream_id: int - ) -> h2.events.ResponseReceived | h2.events.DataReceived | h2.events.StreamEnded: - """ - Return the next available event for a given stream ID. - - Will read more data from the network if required. - """ - while not self._events.get(stream_id): - await self._receive_events(request, stream_id) - event = self._events[stream_id].pop(0) - if isinstance(event, h2.events.StreamReset): - raise RemoteProtocolError(event) - return event - - async def _receive_events( - self, request: Request, stream_id: int | None = None - ) -> None: - """ - Read some data from the network until we see one or more events - for a given stream ID. - """ - async with self._read_lock: - if self._connection_terminated is not None: - last_stream_id = self._connection_terminated.last_stream_id - if stream_id and last_stream_id and stream_id > last_stream_id: - self._request_count -= 1 - raise ConnectionNotAvailable() - raise RemoteProtocolError(self._connection_terminated) - - # This conditional is a bit icky. We don't want to block reading if we've - # actually got an event to return for a given stream. We need to do that - # check *within* the atomic read lock. Though it also need to be optional, - # because when we call it from `_wait_for_outgoing_flow` we *do* want to - # block until we've available flow control, event when we have events - # pending for the stream ID we're attempting to send on. - if stream_id is None or not self._events.get(stream_id): - events = await self._read_incoming_data(request) - for event in events: - if isinstance(event, h2.events.RemoteSettingsChanged): - async with Trace( - "receive_remote_settings", logger, request - ) as trace: - await self._receive_remote_settings_change(event) - trace.return_value = event - - elif isinstance( - event, - ( - h2.events.ResponseReceived, - h2.events.DataReceived, - h2.events.StreamEnded, - h2.events.StreamReset, - ), - ): - if event.stream_id in self._events: - self._events[event.stream_id].append(event) - - elif isinstance(event, h2.events.ConnectionTerminated): - self._connection_terminated = event - - await self._write_outgoing_data(request) - - async def _receive_remote_settings_change( - self, event: h2.events.RemoteSettingsChanged - ) -> None: - max_concurrent_streams = event.changed_settings.get( - h2.settings.SettingCodes.MAX_CONCURRENT_STREAMS - ) - if max_concurrent_streams: - new_max_streams = min( - max_concurrent_streams.new_value, - self._h2_state.local_settings.max_concurrent_streams, - ) - if new_max_streams and new_max_streams != self._max_streams: - while new_max_streams > self._max_streams: - await self._max_streams_semaphore.release() - self._max_streams += 1 - while new_max_streams < self._max_streams: - await self._max_streams_semaphore.acquire() - self._max_streams -= 1 - - async def _response_closed(self, stream_id: int) -> None: - await self._max_streams_semaphore.release() - del self._events[stream_id] - async with self._state_lock: - if self._connection_terminated and not self._events: - await self.aclose() - - elif self._state == HTTPConnectionState.ACTIVE and not self._events: - self._state = HTTPConnectionState.IDLE - if self._keepalive_expiry is not None: - now = time.monotonic() - self._expire_at = now + self._keepalive_expiry - if self._used_all_stream_ids: # pragma: nocover - await self.aclose() - - async def aclose(self) -> None: - # Note that this method unilaterally closes the connection, and does - # not have any kind of locking in place around it. - self._h2_state.close_connection() - self._state = HTTPConnectionState.CLOSED - await self._network_stream.aclose() - - # Wrappers around network read/write operations... - - async def _read_incoming_data(self, request: Request) -> list[h2.events.Event]: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("read", None) - - if self._read_exception is not None: - raise self._read_exception # pragma: nocover - - try: - data = await self._network_stream.read(self.READ_NUM_BYTES, timeout) - if data == b"": - raise RemoteProtocolError("Server disconnected") - except Exception as exc: - # If we get a network error we should: - # - # 1. Save the exception and just raise it immediately on any future reads. - # (For example, this means that a single read timeout or disconnect will - # immediately close all pending streams. Without requiring multiple - # sequential timeouts.) - # 2. Mark the connection as errored, so that we don't accept any other - # incoming requests. - self._read_exception = exc - self._connection_error = True - raise exc - - events: list[h2.events.Event] = self._h2_state.receive_data(data) - - return events - - async def _write_outgoing_data(self, request: Request) -> None: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("write", None) - - async with self._write_lock: - data_to_send = self._h2_state.data_to_send() - - if self._write_exception is not None: - raise self._write_exception # pragma: nocover - - try: - await self._network_stream.write(data_to_send, timeout) - except Exception as exc: # pragma: nocover - # If we get a network error we should: - # - # 1. Save the exception and just raise it immediately on any future write. - # (For example, this means that a single write timeout or disconnect will - # immediately close all pending streams. Without requiring multiple - # sequential timeouts.) - # 2. Mark the connection as errored, so that we don't accept any other - # incoming requests. - self._write_exception = exc - self._connection_error = True - raise exc - - # Flow control... - - async def _wait_for_outgoing_flow(self, request: Request, stream_id: int) -> int: - """ - Returns the maximum allowable outgoing flow for a given stream. - - If the allowable flow is zero, then waits on the network until - WindowUpdated frames have increased the flow rate. - https://tools.ietf.org/html/rfc7540#section-6.9 - """ - local_flow: int = self._h2_state.local_flow_control_window(stream_id) - max_frame_size: int = self._h2_state.max_outbound_frame_size - flow = min(local_flow, max_frame_size) - while flow == 0: - await self._receive_events(request) - local_flow = self._h2_state.local_flow_control_window(stream_id) - max_frame_size = self._h2_state.max_outbound_frame_size - flow = min(local_flow, max_frame_size) - return flow - - # Interface for connection pooling... - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._origin - - def is_available(self) -> bool: - return ( - self._state != HTTPConnectionState.CLOSED - and not self._connection_error - and not self._used_all_stream_ids - and not ( - self._h2_state.state_machine.state - == h2.connection.ConnectionState.CLOSED - ) - ) - - def has_expired(self) -> bool: - now = time.monotonic() - return self._expire_at is not None and now > self._expire_at - - def is_idle(self) -> bool: - return self._state == HTTPConnectionState.IDLE - - def is_closed(self) -> bool: - return self._state == HTTPConnectionState.CLOSED - - def info(self) -> str: - origin = str(self._origin) - return ( - f"{origin!r}, HTTP/2, {self._state.name}, " - f"Request Count: {self._request_count}" - ) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - origin = str(self._origin) - return ( - f"<{class_name} [{origin!r}, {self._state.name}, " - f"Request Count: {self._request_count}]>" - ) - - # These context managers are not used in the standard flow, but are - # useful for testing or working with connection instances directly. - - async def __aenter__(self) -> AsyncHTTP2Connection: - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - await self.aclose() - - -class HTTP2ConnectionByteStream: - def __init__( - self, connection: AsyncHTTP2Connection, request: Request, stream_id: int - ) -> None: - self._connection = connection - self._request = request - self._stream_id = stream_id - self._closed = False - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - kwargs = {"request": self._request, "stream_id": self._stream_id} - try: - async with Trace("receive_response_body", logger, self._request, kwargs): - async for chunk in self._connection._receive_response_body( - request=self._request, stream_id=self._stream_id - ): - yield chunk - except BaseException as exc: - # If we get an exception while streaming the response, - # we want to close the response (and possibly the connection) - # before raising that exception. - with AsyncShieldCancellation(): - await self.aclose() - raise exc - - async def aclose(self) -> None: - if not self._closed: - self._closed = True - kwargs = {"stream_id": self._stream_id} - async with Trace("response_closed", logger, self._request, kwargs): - await self._connection._response_closed(stream_id=self._stream_id) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http_proxy.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http_proxy.py deleted file mode 100644 index cc9d920..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/http_proxy.py +++ /dev/null @@ -1,367 +0,0 @@ -from __future__ import annotations - -import base64 -import logging -import ssl -import typing - -from .._backends.base import SOCKET_OPTION, AsyncNetworkBackend -from .._exceptions import ProxyError -from .._models import ( - URL, - Origin, - Request, - Response, - enforce_bytes, - enforce_headers, - enforce_url, -) -from .._ssl import default_ssl_context -from .._synchronization import AsyncLock -from .._trace import Trace -from .connection import AsyncHTTPConnection -from .connection_pool import AsyncConnectionPool -from .http11 import AsyncHTTP11Connection -from .interfaces import AsyncConnectionInterface - -ByteOrStr = typing.Union[bytes, str] -HeadersAsSequence = typing.Sequence[typing.Tuple[ByteOrStr, ByteOrStr]] -HeadersAsMapping = typing.Mapping[ByteOrStr, ByteOrStr] - - -logger = logging.getLogger("httpcore.proxy") - - -def merge_headers( - default_headers: typing.Sequence[tuple[bytes, bytes]] | None = None, - override_headers: typing.Sequence[tuple[bytes, bytes]] | None = None, -) -> list[tuple[bytes, bytes]]: - """ - Append default_headers and override_headers, de-duplicating if a key exists - in both cases. - """ - default_headers = [] if default_headers is None else list(default_headers) - override_headers = [] if override_headers is None else list(override_headers) - has_override = set(key.lower() for key, value in override_headers) - default_headers = [ - (key, value) - for key, value in default_headers - if key.lower() not in has_override - ] - return default_headers + override_headers - - -class AsyncHTTPProxy(AsyncConnectionPool): # pragma: nocover - """ - A connection pool that sends requests via an HTTP proxy. - """ - - def __init__( - self, - proxy_url: URL | bytes | str, - proxy_auth: tuple[bytes | str, bytes | str] | None = None, - proxy_headers: HeadersAsMapping | HeadersAsSequence | None = None, - ssl_context: ssl.SSLContext | None = None, - proxy_ssl_context: ssl.SSLContext | None = None, - max_connections: int | None = 10, - max_keepalive_connections: int | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - local_address: str | None = None, - uds: str | None = None, - network_backend: AsyncNetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - """ - A connection pool for making HTTP requests. - - Parameters: - proxy_url: The URL to use when connecting to the proxy server. - For example `"http://127.0.0.1:8080/"`. - proxy_auth: Any proxy authentication as a two-tuple of - (username, password). May be either bytes or ascii-only str. - proxy_headers: Any HTTP headers to use for the proxy requests. - For example `{"Proxy-Authorization": "Basic :"}`. - ssl_context: An SSL context to use for verifying connections. - If not specified, the default `httpcore.default_ssl_context()` - will be used. - proxy_ssl_context: The same as `ssl_context`, but for a proxy server rather than a remote origin. - max_connections: The maximum number of concurrent HTTP connections that - the pool should allow. Any attempt to send a request on a pool that - would exceed this amount will block until a connection is available. - max_keepalive_connections: The maximum number of idle HTTP connections - that will be maintained in the pool. - keepalive_expiry: The duration in seconds that an idle HTTP connection - may be maintained for before being expired from the pool. - http1: A boolean indicating if HTTP/1.1 requests should be supported - by the connection pool. Defaults to True. - http2: A boolean indicating if HTTP/2 requests should be supported by - the connection pool. Defaults to False. - retries: The maximum number of retries when trying to establish - a connection. - local_address: Local address to connect from. Can also be used to - connect using a particular address family. Using - `local_address="0.0.0.0"` will connect using an `AF_INET` address - (IPv4), while using `local_address="::"` will connect using an - `AF_INET6` address (IPv6). - uds: Path to a Unix Domain Socket to use instead of TCP sockets. - network_backend: A backend instance to use for handling network I/O. - """ - super().__init__( - ssl_context=ssl_context, - max_connections=max_connections, - max_keepalive_connections=max_keepalive_connections, - keepalive_expiry=keepalive_expiry, - http1=http1, - http2=http2, - network_backend=network_backend, - retries=retries, - local_address=local_address, - uds=uds, - socket_options=socket_options, - ) - - self._proxy_url = enforce_url(proxy_url, name="proxy_url") - if ( - self._proxy_url.scheme == b"http" and proxy_ssl_context is not None - ): # pragma: no cover - raise RuntimeError( - "The `proxy_ssl_context` argument is not allowed for the http scheme" - ) - - self._ssl_context = ssl_context - self._proxy_ssl_context = proxy_ssl_context - self._proxy_headers = enforce_headers(proxy_headers, name="proxy_headers") - if proxy_auth is not None: - username = enforce_bytes(proxy_auth[0], name="proxy_auth") - password = enforce_bytes(proxy_auth[1], name="proxy_auth") - userpass = username + b":" + password - authorization = b"Basic " + base64.b64encode(userpass) - self._proxy_headers = [ - (b"Proxy-Authorization", authorization) - ] + self._proxy_headers - - def create_connection(self, origin: Origin) -> AsyncConnectionInterface: - if origin.scheme == b"http": - return AsyncForwardHTTPConnection( - proxy_origin=self._proxy_url.origin, - proxy_headers=self._proxy_headers, - remote_origin=origin, - keepalive_expiry=self._keepalive_expiry, - network_backend=self._network_backend, - proxy_ssl_context=self._proxy_ssl_context, - ) - return AsyncTunnelHTTPConnection( - proxy_origin=self._proxy_url.origin, - proxy_headers=self._proxy_headers, - remote_origin=origin, - ssl_context=self._ssl_context, - proxy_ssl_context=self._proxy_ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - - -class AsyncForwardHTTPConnection(AsyncConnectionInterface): - def __init__( - self, - proxy_origin: Origin, - remote_origin: Origin, - proxy_headers: HeadersAsMapping | HeadersAsSequence | None = None, - keepalive_expiry: float | None = None, - network_backend: AsyncNetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - proxy_ssl_context: ssl.SSLContext | None = None, - ) -> None: - self._connection = AsyncHTTPConnection( - origin=proxy_origin, - keepalive_expiry=keepalive_expiry, - network_backend=network_backend, - socket_options=socket_options, - ssl_context=proxy_ssl_context, - ) - self._proxy_origin = proxy_origin - self._proxy_headers = enforce_headers(proxy_headers, name="proxy_headers") - self._remote_origin = remote_origin - - async def handle_async_request(self, request: Request) -> Response: - headers = merge_headers(self._proxy_headers, request.headers) - url = URL( - scheme=self._proxy_origin.scheme, - host=self._proxy_origin.host, - port=self._proxy_origin.port, - target=bytes(request.url), - ) - proxy_request = Request( - method=request.method, - url=url, - headers=headers, - content=request.stream, - extensions=request.extensions, - ) - return await self._connection.handle_async_request(proxy_request) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._remote_origin - - async def aclose(self) -> None: - await self._connection.aclose() - - def info(self) -> str: - return self._connection.info() - - def is_available(self) -> bool: - return self._connection.is_available() - - def has_expired(self) -> bool: - return self._connection.has_expired() - - def is_idle(self) -> bool: - return self._connection.is_idle() - - def is_closed(self) -> bool: - return self._connection.is_closed() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" - - -class AsyncTunnelHTTPConnection(AsyncConnectionInterface): - def __init__( - self, - proxy_origin: Origin, - remote_origin: Origin, - ssl_context: ssl.SSLContext | None = None, - proxy_ssl_context: ssl.SSLContext | None = None, - proxy_headers: typing.Sequence[tuple[bytes, bytes]] | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - network_backend: AsyncNetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - self._connection: AsyncConnectionInterface = AsyncHTTPConnection( - origin=proxy_origin, - keepalive_expiry=keepalive_expiry, - network_backend=network_backend, - socket_options=socket_options, - ssl_context=proxy_ssl_context, - ) - self._proxy_origin = proxy_origin - self._remote_origin = remote_origin - self._ssl_context = ssl_context - self._proxy_ssl_context = proxy_ssl_context - self._proxy_headers = enforce_headers(proxy_headers, name="proxy_headers") - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - self._connect_lock = AsyncLock() - self._connected = False - - async def handle_async_request(self, request: Request) -> Response: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("connect", None) - - async with self._connect_lock: - if not self._connected: - target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) - - connect_url = URL( - scheme=self._proxy_origin.scheme, - host=self._proxy_origin.host, - port=self._proxy_origin.port, - target=target, - ) - connect_headers = merge_headers( - [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers - ) - connect_request = Request( - method=b"CONNECT", - url=connect_url, - headers=connect_headers, - extensions=request.extensions, - ) - connect_response = await self._connection.handle_async_request( - connect_request - ) - - if connect_response.status < 200 or connect_response.status > 299: - reason_bytes = connect_response.extensions.get("reason_phrase", b"") - reason_str = reason_bytes.decode("ascii", errors="ignore") - msg = "%d %s" % (connect_response.status, reason_str) - await self._connection.aclose() - raise ProxyError(msg) - - stream = connect_response.extensions["network_stream"] - - # Upgrade the stream to SSL - ssl_context = ( - default_ssl_context() - if self._ssl_context is None - else self._ssl_context - ) - alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"] - ssl_context.set_alpn_protocols(alpn_protocols) - - kwargs = { - "ssl_context": ssl_context, - "server_hostname": self._remote_origin.host.decode("ascii"), - "timeout": timeout, - } - async with Trace("start_tls", logger, request, kwargs) as trace: - stream = await stream.start_tls(**kwargs) - trace.return_value = stream - - # Determine if we should be using HTTP/1.1 or HTTP/2 - ssl_object = stream.get_extra_info("ssl_object") - http2_negotiated = ( - ssl_object is not None - and ssl_object.selected_alpn_protocol() == "h2" - ) - - # Create the HTTP/1.1 or HTTP/2 connection - if http2_negotiated or (self._http2 and not self._http1): - from .http2 import AsyncHTTP2Connection - - self._connection = AsyncHTTP2Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - else: - self._connection = AsyncHTTP11Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - - self._connected = True - return await self._connection.handle_async_request(request) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._remote_origin - - async def aclose(self) -> None: - await self._connection.aclose() - - def info(self) -> str: - return self._connection.info() - - def is_available(self) -> bool: - return self._connection.is_available() - - def has_expired(self) -> bool: - return self._connection.has_expired() - - def is_idle(self) -> bool: - return self._connection.is_idle() - - def is_closed(self) -> bool: - return self._connection.is_closed() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/interfaces.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/interfaces.py deleted file mode 100644 index 361583b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/interfaces.py +++ /dev/null @@ -1,137 +0,0 @@ -from __future__ import annotations - -import contextlib -import typing - -from .._models import ( - URL, - Extensions, - HeaderTypes, - Origin, - Request, - Response, - enforce_bytes, - enforce_headers, - enforce_url, - include_request_headers, -) - - -class AsyncRequestInterface: - async def request( - self, - method: bytes | str, - url: URL | bytes | str, - *, - headers: HeaderTypes = None, - content: bytes | typing.AsyncIterator[bytes] | None = None, - extensions: Extensions | None = None, - ) -> Response: - # Strict type checking on our parameters. - method = enforce_bytes(method, name="method") - url = enforce_url(url, name="url") - headers = enforce_headers(headers, name="headers") - - # Include Host header, and optionally Content-Length or Transfer-Encoding. - headers = include_request_headers(headers, url=url, content=content) - - request = Request( - method=method, - url=url, - headers=headers, - content=content, - extensions=extensions, - ) - response = await self.handle_async_request(request) - try: - await response.aread() - finally: - await response.aclose() - return response - - @contextlib.asynccontextmanager - async def stream( - self, - method: bytes | str, - url: URL | bytes | str, - *, - headers: HeaderTypes = None, - content: bytes | typing.AsyncIterator[bytes] | None = None, - extensions: Extensions | None = None, - ) -> typing.AsyncIterator[Response]: - # Strict type checking on our parameters. - method = enforce_bytes(method, name="method") - url = enforce_url(url, name="url") - headers = enforce_headers(headers, name="headers") - - # Include Host header, and optionally Content-Length or Transfer-Encoding. - headers = include_request_headers(headers, url=url, content=content) - - request = Request( - method=method, - url=url, - headers=headers, - content=content, - extensions=extensions, - ) - response = await self.handle_async_request(request) - try: - yield response - finally: - await response.aclose() - - async def handle_async_request(self, request: Request) -> Response: - raise NotImplementedError() # pragma: nocover - - -class AsyncConnectionInterface(AsyncRequestInterface): - async def aclose(self) -> None: - raise NotImplementedError() # pragma: nocover - - def info(self) -> str: - raise NotImplementedError() # pragma: nocover - - def can_handle_request(self, origin: Origin) -> bool: - raise NotImplementedError() # pragma: nocover - - def is_available(self) -> bool: - """ - Return `True` if the connection is currently able to accept an - outgoing request. - - An HTTP/1.1 connection will only be available if it is currently idle. - - An HTTP/2 connection will be available so long as the stream ID space is - not yet exhausted, and the connection is not in an error state. - - While the connection is being established we may not yet know if it is going - to result in an HTTP/1.1 or HTTP/2 connection. The connection should be - treated as being available, but might ultimately raise `NewConnectionRequired` - required exceptions if multiple requests are attempted over a connection - that ends up being established as HTTP/1.1. - """ - raise NotImplementedError() # pragma: nocover - - def has_expired(self) -> bool: - """ - Return `True` if the connection is in a state where it should be closed. - - This either means that the connection is idle and it has passed the - expiry time on its keep-alive, or that server has sent an EOF. - """ - raise NotImplementedError() # pragma: nocover - - def is_idle(self) -> bool: - """ - Return `True` if the connection is currently idle. - """ - raise NotImplementedError() # pragma: nocover - - def is_closed(self) -> bool: - """ - Return `True` if the connection has been closed. - - Used when a response is closed to determine if the connection may be - returned to the connection pool or not. - """ - raise NotImplementedError() # pragma: nocover diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/socks_proxy.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_async/socks_proxy.py deleted file mode 100644 index b363f55..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_async/socks_proxy.py +++ /dev/null @@ -1,341 +0,0 @@ -from __future__ import annotations - -import logging -import ssl - -import socksio - -from .._backends.auto import AutoBackend -from .._backends.base import AsyncNetworkBackend, AsyncNetworkStream -from .._exceptions import ConnectionNotAvailable, ProxyError -from .._models import URL, Origin, Request, Response, enforce_bytes, enforce_url -from .._ssl import default_ssl_context -from .._synchronization import AsyncLock -from .._trace import Trace -from .connection_pool import AsyncConnectionPool -from .http11 import AsyncHTTP11Connection -from .interfaces import AsyncConnectionInterface - -logger = logging.getLogger("httpcore.socks") - - -AUTH_METHODS = { - b"\x00": "NO AUTHENTICATION REQUIRED", - b"\x01": "GSSAPI", - b"\x02": "USERNAME/PASSWORD", - b"\xff": "NO ACCEPTABLE METHODS", -} - -REPLY_CODES = { - b"\x00": "Succeeded", - b"\x01": "General SOCKS server failure", - b"\x02": "Connection not allowed by ruleset", - b"\x03": "Network unreachable", - b"\x04": "Host unreachable", - b"\x05": "Connection refused", - b"\x06": "TTL expired", - b"\x07": "Command not supported", - b"\x08": "Address type not supported", -} - - -async def _init_socks5_connection( - stream: AsyncNetworkStream, - *, - host: bytes, - port: int, - auth: tuple[bytes, bytes] | None = None, -) -> None: - conn = socksio.socks5.SOCKS5Connection() - - # Auth method request - auth_method = ( - socksio.socks5.SOCKS5AuthMethod.NO_AUTH_REQUIRED - if auth is None - else socksio.socks5.SOCKS5AuthMethod.USERNAME_PASSWORD - ) - conn.send(socksio.socks5.SOCKS5AuthMethodsRequest([auth_method])) - outgoing_bytes = conn.data_to_send() - await stream.write(outgoing_bytes) - - # Auth method response - incoming_bytes = await stream.read(max_bytes=4096) - response = conn.receive_data(incoming_bytes) - assert isinstance(response, socksio.socks5.SOCKS5AuthReply) - if response.method != auth_method: - requested = AUTH_METHODS.get(auth_method, "UNKNOWN") - responded = AUTH_METHODS.get(response.method, "UNKNOWN") - raise ProxyError( - f"Requested {requested} from proxy server, but got {responded}." - ) - - if response.method == socksio.socks5.SOCKS5AuthMethod.USERNAME_PASSWORD: - # Username/password request - assert auth is not None - username, password = auth - conn.send(socksio.socks5.SOCKS5UsernamePasswordRequest(username, password)) - outgoing_bytes = conn.data_to_send() - await stream.write(outgoing_bytes) - - # Username/password response - incoming_bytes = await stream.read(max_bytes=4096) - response = conn.receive_data(incoming_bytes) - assert isinstance(response, socksio.socks5.SOCKS5UsernamePasswordReply) - if not response.success: - raise ProxyError("Invalid username/password") - - # Connect request - conn.send( - socksio.socks5.SOCKS5CommandRequest.from_address( - socksio.socks5.SOCKS5Command.CONNECT, (host, port) - ) - ) - outgoing_bytes = conn.data_to_send() - await stream.write(outgoing_bytes) - - # Connect response - incoming_bytes = await stream.read(max_bytes=4096) - response = conn.receive_data(incoming_bytes) - assert isinstance(response, socksio.socks5.SOCKS5Reply) - if response.reply_code != socksio.socks5.SOCKS5ReplyCode.SUCCEEDED: - reply_code = REPLY_CODES.get(response.reply_code, "UNKOWN") - raise ProxyError(f"Proxy Server could not connect: {reply_code}.") - - -class AsyncSOCKSProxy(AsyncConnectionPool): # pragma: nocover - """ - A connection pool that sends requests via an HTTP proxy. - """ - - def __init__( - self, - proxy_url: URL | bytes | str, - proxy_auth: tuple[bytes | str, bytes | str] | None = None, - ssl_context: ssl.SSLContext | None = None, - max_connections: int | None = 10, - max_keepalive_connections: int | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - network_backend: AsyncNetworkBackend | None = None, - ) -> None: - """ - A connection pool for making HTTP requests. - - Parameters: - proxy_url: The URL to use when connecting to the proxy server. - For example `"http://127.0.0.1:8080/"`. - ssl_context: An SSL context to use for verifying connections. - If not specified, the default `httpcore.default_ssl_context()` - will be used. - max_connections: The maximum number of concurrent HTTP connections that - the pool should allow. Any attempt to send a request on a pool that - would exceed this amount will block until a connection is available. - max_keepalive_connections: The maximum number of idle HTTP connections - that will be maintained in the pool. - keepalive_expiry: The duration in seconds that an idle HTTP connection - may be maintained for before being expired from the pool. - http1: A boolean indicating if HTTP/1.1 requests should be supported - by the connection pool. Defaults to True. - http2: A boolean indicating if HTTP/2 requests should be supported by - the connection pool. Defaults to False. - retries: The maximum number of retries when trying to establish - a connection. - local_address: Local address to connect from. Can also be used to - connect using a particular address family. Using - `local_address="0.0.0.0"` will connect using an `AF_INET` address - (IPv4), while using `local_address="::"` will connect using an - `AF_INET6` address (IPv6). - uds: Path to a Unix Domain Socket to use instead of TCP sockets. - network_backend: A backend instance to use for handling network I/O. - """ - super().__init__( - ssl_context=ssl_context, - max_connections=max_connections, - max_keepalive_connections=max_keepalive_connections, - keepalive_expiry=keepalive_expiry, - http1=http1, - http2=http2, - network_backend=network_backend, - retries=retries, - ) - self._ssl_context = ssl_context - self._proxy_url = enforce_url(proxy_url, name="proxy_url") - if proxy_auth is not None: - username, password = proxy_auth - username_bytes = enforce_bytes(username, name="proxy_auth") - password_bytes = enforce_bytes(password, name="proxy_auth") - self._proxy_auth: tuple[bytes, bytes] | None = ( - username_bytes, - password_bytes, - ) - else: - self._proxy_auth = None - - def create_connection(self, origin: Origin) -> AsyncConnectionInterface: - return AsyncSocks5Connection( - proxy_origin=self._proxy_url.origin, - remote_origin=origin, - proxy_auth=self._proxy_auth, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - - -class AsyncSocks5Connection(AsyncConnectionInterface): - def __init__( - self, - proxy_origin: Origin, - remote_origin: Origin, - proxy_auth: tuple[bytes, bytes] | None = None, - ssl_context: ssl.SSLContext | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - network_backend: AsyncNetworkBackend | None = None, - ) -> None: - self._proxy_origin = proxy_origin - self._remote_origin = remote_origin - self._proxy_auth = proxy_auth - self._ssl_context = ssl_context - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - - self._network_backend: AsyncNetworkBackend = ( - AutoBackend() if network_backend is None else network_backend - ) - self._connect_lock = AsyncLock() - self._connection: AsyncConnectionInterface | None = None - self._connect_failed = False - - async def handle_async_request(self, request: Request) -> Response: - timeouts = request.extensions.get("timeout", {}) - sni_hostname = request.extensions.get("sni_hostname", None) - timeout = timeouts.get("connect", None) - - async with self._connect_lock: - if self._connection is None: - try: - # Connect to the proxy - kwargs = { - "host": self._proxy_origin.host.decode("ascii"), - "port": self._proxy_origin.port, - "timeout": timeout, - } - async with Trace("connect_tcp", logger, request, kwargs) as trace: - stream = await self._network_backend.connect_tcp(**kwargs) - trace.return_value = stream - - # Connect to the remote host using socks5 - kwargs = { - "stream": stream, - "host": self._remote_origin.host.decode("ascii"), - "port": self._remote_origin.port, - "auth": self._proxy_auth, - } - async with Trace( - "setup_socks5_connection", logger, request, kwargs - ) as trace: - await _init_socks5_connection(**kwargs) - trace.return_value = stream - - # Upgrade the stream to SSL - if self._remote_origin.scheme == b"https": - ssl_context = ( - default_ssl_context() - if self._ssl_context is None - else self._ssl_context - ) - alpn_protocols = ( - ["http/1.1", "h2"] if self._http2 else ["http/1.1"] - ) - ssl_context.set_alpn_protocols(alpn_protocols) - - kwargs = { - "ssl_context": ssl_context, - "server_hostname": sni_hostname - or self._remote_origin.host.decode("ascii"), - "timeout": timeout, - } - async with Trace("start_tls", logger, request, kwargs) as trace: - stream = await stream.start_tls(**kwargs) - trace.return_value = stream - - # Determine if we should be using HTTP/1.1 or HTTP/2 - ssl_object = stream.get_extra_info("ssl_object") - http2_negotiated = ( - ssl_object is not None - and ssl_object.selected_alpn_protocol() == "h2" - ) - - # Create the HTTP/1.1 or HTTP/2 connection - if http2_negotiated or ( - self._http2 and not self._http1 - ): # pragma: nocover - from .http2 import AsyncHTTP2Connection - - self._connection = AsyncHTTP2Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - else: - self._connection = AsyncHTTP11Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - except Exception as exc: - self._connect_failed = True - raise exc - elif not self._connection.is_available(): # pragma: nocover - raise ConnectionNotAvailable() - - return await self._connection.handle_async_request(request) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._remote_origin - - async def aclose(self) -> None: - if self._connection is not None: - await self._connection.aclose() - - def is_available(self) -> bool: - if self._connection is None: # pragma: nocover - # If HTTP/2 support is enabled, and the resulting connection could - # end up as HTTP/2 then we should indicate the connection as being - # available to service multiple requests. - return ( - self._http2 - and (self._remote_origin.scheme == b"https" or not self._http1) - and not self._connect_failed - ) - return self._connection.is_available() - - def has_expired(self) -> bool: - if self._connection is None: # pragma: nocover - return self._connect_failed - return self._connection.has_expired() - - def is_idle(self) -> bool: - if self._connection is None: # pragma: nocover - return self._connect_failed - return self._connection.is_idle() - - def is_closed(self) -> bool: - if self._connection is None: # pragma: nocover - return self._connect_failed - return self._connection.is_closed() - - def info(self) -> str: - if self._connection is None: # pragma: nocover - return "CONNECTION FAILED" if self._connect_failed else "CONNECTING" - return self._connection.info() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__init__.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 1fea246..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/anyio.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/anyio.cpython-310.pyc deleted file mode 100644 index 388f872..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/anyio.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/auto.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/auto.cpython-310.pyc deleted file mode 100644 index 79205c6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/auto.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/base.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/base.cpython-310.pyc deleted file mode 100644 index aa80f3e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/base.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/mock.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/mock.cpython-310.pyc deleted file mode 100644 index c1296e3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/mock.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/sync.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/sync.cpython-310.pyc deleted file mode 100644 index ebf3061..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/sync.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/trio.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/trio.cpython-310.pyc deleted file mode 100644 index 11618ff..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/__pycache__/trio.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/anyio.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/anyio.py deleted file mode 100644 index a140095..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/anyio.py +++ /dev/null @@ -1,146 +0,0 @@ -from __future__ import annotations - -import ssl -import typing - -import anyio - -from .._exceptions import ( - ConnectError, - ConnectTimeout, - ReadError, - ReadTimeout, - WriteError, - WriteTimeout, - map_exceptions, -) -from .._utils import is_socket_readable -from .base import SOCKET_OPTION, AsyncNetworkBackend, AsyncNetworkStream - - -class AnyIOStream(AsyncNetworkStream): - def __init__(self, stream: anyio.abc.ByteStream) -> None: - self._stream = stream - - async def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - exc_map = { - TimeoutError: ReadTimeout, - anyio.BrokenResourceError: ReadError, - anyio.ClosedResourceError: ReadError, - anyio.EndOfStream: ReadError, - } - with map_exceptions(exc_map): - with anyio.fail_after(timeout): - try: - return await self._stream.receive(max_bytes=max_bytes) - except anyio.EndOfStream: # pragma: nocover - return b"" - - async def write(self, buffer: bytes, timeout: float | None = None) -> None: - if not buffer: - return - - exc_map = { - TimeoutError: WriteTimeout, - anyio.BrokenResourceError: WriteError, - anyio.ClosedResourceError: WriteError, - } - with map_exceptions(exc_map): - with anyio.fail_after(timeout): - await self._stream.send(item=buffer) - - async def aclose(self) -> None: - await self._stream.aclose() - - async def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> AsyncNetworkStream: - exc_map = { - TimeoutError: ConnectTimeout, - anyio.BrokenResourceError: ConnectError, - anyio.EndOfStream: ConnectError, - ssl.SSLError: ConnectError, - } - with map_exceptions(exc_map): - try: - with anyio.fail_after(timeout): - ssl_stream = await anyio.streams.tls.TLSStream.wrap( - self._stream, - ssl_context=ssl_context, - hostname=server_hostname, - standard_compatible=False, - server_side=False, - ) - except Exception as exc: # pragma: nocover - await self.aclose() - raise exc - return AnyIOStream(ssl_stream) - - def get_extra_info(self, info: str) -> typing.Any: - if info == "ssl_object": - return self._stream.extra(anyio.streams.tls.TLSAttribute.ssl_object, None) - if info == "client_addr": - return self._stream.extra(anyio.abc.SocketAttribute.local_address, None) - if info == "server_addr": - return self._stream.extra(anyio.abc.SocketAttribute.remote_address, None) - if info == "socket": - return self._stream.extra(anyio.abc.SocketAttribute.raw_socket, None) - if info == "is_readable": - sock = self._stream.extra(anyio.abc.SocketAttribute.raw_socket, None) - return is_socket_readable(sock) - return None - - -class AnyIOBackend(AsyncNetworkBackend): - async def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: # pragma: nocover - if socket_options is None: - socket_options = [] - exc_map = { - TimeoutError: ConnectTimeout, - OSError: ConnectError, - anyio.BrokenResourceError: ConnectError, - } - with map_exceptions(exc_map): - with anyio.fail_after(timeout): - stream: anyio.abc.ByteStream = await anyio.connect_tcp( - remote_host=host, - remote_port=port, - local_host=local_address, - ) - # By default TCP sockets opened in `asyncio` include TCP_NODELAY. - for option in socket_options: - stream._raw_socket.setsockopt(*option) # type: ignore[attr-defined] # pragma: no cover - return AnyIOStream(stream) - - async def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: # pragma: nocover - if socket_options is None: - socket_options = [] - exc_map = { - TimeoutError: ConnectTimeout, - OSError: ConnectError, - anyio.BrokenResourceError: ConnectError, - } - with map_exceptions(exc_map): - with anyio.fail_after(timeout): - stream: anyio.abc.ByteStream = await anyio.connect_unix(path) - for option in socket_options: - stream._raw_socket.setsockopt(*option) # type: ignore[attr-defined] # pragma: no cover - return AnyIOStream(stream) - - async def sleep(self, seconds: float) -> None: - await anyio.sleep(seconds) # pragma: nocover diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/auto.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/auto.py deleted file mode 100644 index 49f0e69..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/auto.py +++ /dev/null @@ -1,52 +0,0 @@ -from __future__ import annotations - -import typing - -from .._synchronization import current_async_library -from .base import SOCKET_OPTION, AsyncNetworkBackend, AsyncNetworkStream - - -class AutoBackend(AsyncNetworkBackend): - async def _init_backend(self) -> None: - if not (hasattr(self, "_backend")): - backend = current_async_library() - if backend == "trio": - from .trio import TrioBackend - - self._backend: AsyncNetworkBackend = TrioBackend() - else: - from .anyio import AnyIOBackend - - self._backend = AnyIOBackend() - - async def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: - await self._init_backend() - return await self._backend.connect_tcp( - host, - port, - timeout=timeout, - local_address=local_address, - socket_options=socket_options, - ) - - async def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: # pragma: nocover - await self._init_backend() - return await self._backend.connect_unix_socket( - path, timeout=timeout, socket_options=socket_options - ) - - async def sleep(self, seconds: float) -> None: # pragma: nocover - await self._init_backend() - return await self._backend.sleep(seconds) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/base.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/base.py deleted file mode 100644 index cf55c8b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/base.py +++ /dev/null @@ -1,101 +0,0 @@ -from __future__ import annotations - -import ssl -import time -import typing - -SOCKET_OPTION = typing.Union[ - typing.Tuple[int, int, int], - typing.Tuple[int, int, typing.Union[bytes, bytearray]], - typing.Tuple[int, int, None, int], -] - - -class NetworkStream: - def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - raise NotImplementedError() # pragma: nocover - - def write(self, buffer: bytes, timeout: float | None = None) -> None: - raise NotImplementedError() # pragma: nocover - - def close(self) -> None: - raise NotImplementedError() # pragma: nocover - - def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> NetworkStream: - raise NotImplementedError() # pragma: nocover - - def get_extra_info(self, info: str) -> typing.Any: - return None # pragma: nocover - - -class NetworkBackend: - def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> NetworkStream: - raise NotImplementedError() # pragma: nocover - - def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> NetworkStream: - raise NotImplementedError() # pragma: nocover - - def sleep(self, seconds: float) -> None: - time.sleep(seconds) # pragma: nocover - - -class AsyncNetworkStream: - async def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - raise NotImplementedError() # pragma: nocover - - async def write(self, buffer: bytes, timeout: float | None = None) -> None: - raise NotImplementedError() # pragma: nocover - - async def aclose(self) -> None: - raise NotImplementedError() # pragma: nocover - - async def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> AsyncNetworkStream: - raise NotImplementedError() # pragma: nocover - - def get_extra_info(self, info: str) -> typing.Any: - return None # pragma: nocover - - -class AsyncNetworkBackend: - async def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: - raise NotImplementedError() # pragma: nocover - - async def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: - raise NotImplementedError() # pragma: nocover - - async def sleep(self, seconds: float) -> None: - raise NotImplementedError() # pragma: nocover diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/mock.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/mock.py deleted file mode 100644 index 9b6edca..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/mock.py +++ /dev/null @@ -1,143 +0,0 @@ -from __future__ import annotations - -import ssl -import typing - -from .._exceptions import ReadError -from .base import ( - SOCKET_OPTION, - AsyncNetworkBackend, - AsyncNetworkStream, - NetworkBackend, - NetworkStream, -) - - -class MockSSLObject: - def __init__(self, http2: bool): - self._http2 = http2 - - def selected_alpn_protocol(self) -> str: - return "h2" if self._http2 else "http/1.1" - - -class MockStream(NetworkStream): - def __init__(self, buffer: list[bytes], http2: bool = False) -> None: - self._buffer = buffer - self._http2 = http2 - self._closed = False - - def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - if self._closed: - raise ReadError("Connection closed") - if not self._buffer: - return b"" - return self._buffer.pop(0) - - def write(self, buffer: bytes, timeout: float | None = None) -> None: - pass - - def close(self) -> None: - self._closed = True - - def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> NetworkStream: - return self - - def get_extra_info(self, info: str) -> typing.Any: - return MockSSLObject(http2=self._http2) if info == "ssl_object" else None - - def __repr__(self) -> str: - return "" - - -class MockBackend(NetworkBackend): - def __init__(self, buffer: list[bytes], http2: bool = False) -> None: - self._buffer = buffer - self._http2 = http2 - - def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> NetworkStream: - return MockStream(list(self._buffer), http2=self._http2) - - def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> NetworkStream: - return MockStream(list(self._buffer), http2=self._http2) - - def sleep(self, seconds: float) -> None: - pass - - -class AsyncMockStream(AsyncNetworkStream): - def __init__(self, buffer: list[bytes], http2: bool = False) -> None: - self._buffer = buffer - self._http2 = http2 - self._closed = False - - async def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - if self._closed: - raise ReadError("Connection closed") - if not self._buffer: - return b"" - return self._buffer.pop(0) - - async def write(self, buffer: bytes, timeout: float | None = None) -> None: - pass - - async def aclose(self) -> None: - self._closed = True - - async def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> AsyncNetworkStream: - return self - - def get_extra_info(self, info: str) -> typing.Any: - return MockSSLObject(http2=self._http2) if info == "ssl_object" else None - - def __repr__(self) -> str: - return "" - - -class AsyncMockBackend(AsyncNetworkBackend): - def __init__(self, buffer: list[bytes], http2: bool = False) -> None: - self._buffer = buffer - self._http2 = http2 - - async def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: - return AsyncMockStream(list(self._buffer), http2=self._http2) - - async def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: - return AsyncMockStream(list(self._buffer), http2=self._http2) - - async def sleep(self, seconds: float) -> None: - pass diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/sync.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/sync.py deleted file mode 100644 index 4018a09..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/sync.py +++ /dev/null @@ -1,241 +0,0 @@ -from __future__ import annotations - -import functools -import socket -import ssl -import sys -import typing - -from .._exceptions import ( - ConnectError, - ConnectTimeout, - ExceptionMapping, - ReadError, - ReadTimeout, - WriteError, - WriteTimeout, - map_exceptions, -) -from .._utils import is_socket_readable -from .base import SOCKET_OPTION, NetworkBackend, NetworkStream - - -class TLSinTLSStream(NetworkStream): # pragma: no cover - """ - Because the standard `SSLContext.wrap_socket` method does - not work for `SSLSocket` objects, we need this class - to implement TLS stream using an underlying `SSLObject` - instance in order to support TLS on top of TLS. - """ - - # Defined in RFC 8449 - TLS_RECORD_SIZE = 16384 - - def __init__( - self, - sock: socket.socket, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ): - self._sock = sock - self._incoming = ssl.MemoryBIO() - self._outgoing = ssl.MemoryBIO() - - self.ssl_obj = ssl_context.wrap_bio( - incoming=self._incoming, - outgoing=self._outgoing, - server_hostname=server_hostname, - ) - - self._sock.settimeout(timeout) - self._perform_io(self.ssl_obj.do_handshake) - - def _perform_io( - self, - func: typing.Callable[..., typing.Any], - ) -> typing.Any: - ret = None - - while True: - errno = None - try: - ret = func() - except (ssl.SSLWantReadError, ssl.SSLWantWriteError) as e: - errno = e.errno - - self._sock.sendall(self._outgoing.read()) - - if errno == ssl.SSL_ERROR_WANT_READ: - buf = self._sock.recv(self.TLS_RECORD_SIZE) - - if buf: - self._incoming.write(buf) - else: - self._incoming.write_eof() - if errno is None: - return ret - - def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - exc_map: ExceptionMapping = {socket.timeout: ReadTimeout, OSError: ReadError} - with map_exceptions(exc_map): - self._sock.settimeout(timeout) - return typing.cast( - bytes, self._perform_io(functools.partial(self.ssl_obj.read, max_bytes)) - ) - - def write(self, buffer: bytes, timeout: float | None = None) -> None: - exc_map: ExceptionMapping = {socket.timeout: WriteTimeout, OSError: WriteError} - with map_exceptions(exc_map): - self._sock.settimeout(timeout) - while buffer: - nsent = self._perform_io(functools.partial(self.ssl_obj.write, buffer)) - buffer = buffer[nsent:] - - def close(self) -> None: - self._sock.close() - - def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> NetworkStream: - raise NotImplementedError() - - def get_extra_info(self, info: str) -> typing.Any: - if info == "ssl_object": - return self.ssl_obj - if info == "client_addr": - return self._sock.getsockname() - if info == "server_addr": - return self._sock.getpeername() - if info == "socket": - return self._sock - if info == "is_readable": - return is_socket_readable(self._sock) - return None - - -class SyncStream(NetworkStream): - def __init__(self, sock: socket.socket) -> None: - self._sock = sock - - def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - exc_map: ExceptionMapping = {socket.timeout: ReadTimeout, OSError: ReadError} - with map_exceptions(exc_map): - self._sock.settimeout(timeout) - return self._sock.recv(max_bytes) - - def write(self, buffer: bytes, timeout: float | None = None) -> None: - if not buffer: - return - - exc_map: ExceptionMapping = {socket.timeout: WriteTimeout, OSError: WriteError} - with map_exceptions(exc_map): - while buffer: - self._sock.settimeout(timeout) - n = self._sock.send(buffer) - buffer = buffer[n:] - - def close(self) -> None: - self._sock.close() - - def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> NetworkStream: - exc_map: ExceptionMapping = { - socket.timeout: ConnectTimeout, - OSError: ConnectError, - } - with map_exceptions(exc_map): - try: - if isinstance(self._sock, ssl.SSLSocket): # pragma: no cover - # If the underlying socket has already been upgraded - # to the TLS layer (i.e. is an instance of SSLSocket), - # we need some additional smarts to support TLS-in-TLS. - return TLSinTLSStream( - self._sock, ssl_context, server_hostname, timeout - ) - else: - self._sock.settimeout(timeout) - sock = ssl_context.wrap_socket( - self._sock, server_hostname=server_hostname - ) - except Exception as exc: # pragma: nocover - self.close() - raise exc - return SyncStream(sock) - - def get_extra_info(self, info: str) -> typing.Any: - if info == "ssl_object" and isinstance(self._sock, ssl.SSLSocket): - return self._sock._sslobj # type: ignore - if info == "client_addr": - return self._sock.getsockname() - if info == "server_addr": - return self._sock.getpeername() - if info == "socket": - return self._sock - if info == "is_readable": - return is_socket_readable(self._sock) - return None - - -class SyncBackend(NetworkBackend): - def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> NetworkStream: - # Note that we automatically include `TCP_NODELAY` - # in addition to any other custom socket options. - if socket_options is None: - socket_options = [] # pragma: no cover - address = (host, port) - source_address = None if local_address is None else (local_address, 0) - exc_map: ExceptionMapping = { - socket.timeout: ConnectTimeout, - OSError: ConnectError, - } - - with map_exceptions(exc_map): - sock = socket.create_connection( - address, - timeout, - source_address=source_address, - ) - for option in socket_options: - sock.setsockopt(*option) # pragma: no cover - sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - return SyncStream(sock) - - def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> NetworkStream: # pragma: nocover - if sys.platform == "win32": - raise RuntimeError( - "Attempted to connect to a UNIX socket on a Windows system." - ) - if socket_options is None: - socket_options = [] - - exc_map: ExceptionMapping = { - socket.timeout: ConnectTimeout, - OSError: ConnectError, - } - with map_exceptions(exc_map): - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - for option in socket_options: - sock.setsockopt(*option) - sock.settimeout(timeout) - sock.connect(path) - return SyncStream(sock) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/trio.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/trio.py deleted file mode 100644 index 6f53f5f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_backends/trio.py +++ /dev/null @@ -1,159 +0,0 @@ -from __future__ import annotations - -import ssl -import typing - -import trio - -from .._exceptions import ( - ConnectError, - ConnectTimeout, - ExceptionMapping, - ReadError, - ReadTimeout, - WriteError, - WriteTimeout, - map_exceptions, -) -from .base import SOCKET_OPTION, AsyncNetworkBackend, AsyncNetworkStream - - -class TrioStream(AsyncNetworkStream): - def __init__(self, stream: trio.abc.Stream) -> None: - self._stream = stream - - async def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - timeout_or_inf = float("inf") if timeout is None else timeout - exc_map: ExceptionMapping = { - trio.TooSlowError: ReadTimeout, - trio.BrokenResourceError: ReadError, - trio.ClosedResourceError: ReadError, - } - with map_exceptions(exc_map): - with trio.fail_after(timeout_or_inf): - data: bytes = await self._stream.receive_some(max_bytes=max_bytes) - return data - - async def write(self, buffer: bytes, timeout: float | None = None) -> None: - if not buffer: - return - - timeout_or_inf = float("inf") if timeout is None else timeout - exc_map: ExceptionMapping = { - trio.TooSlowError: WriteTimeout, - trio.BrokenResourceError: WriteError, - trio.ClosedResourceError: WriteError, - } - with map_exceptions(exc_map): - with trio.fail_after(timeout_or_inf): - await self._stream.send_all(data=buffer) - - async def aclose(self) -> None: - await self._stream.aclose() - - async def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> AsyncNetworkStream: - timeout_or_inf = float("inf") if timeout is None else timeout - exc_map: ExceptionMapping = { - trio.TooSlowError: ConnectTimeout, - trio.BrokenResourceError: ConnectError, - } - ssl_stream = trio.SSLStream( - self._stream, - ssl_context=ssl_context, - server_hostname=server_hostname, - https_compatible=True, - server_side=False, - ) - with map_exceptions(exc_map): - try: - with trio.fail_after(timeout_or_inf): - await ssl_stream.do_handshake() - except Exception as exc: # pragma: nocover - await self.aclose() - raise exc - return TrioStream(ssl_stream) - - def get_extra_info(self, info: str) -> typing.Any: - if info == "ssl_object" and isinstance(self._stream, trio.SSLStream): - # Type checkers cannot see `_ssl_object` attribute because trio._ssl.SSLStream uses __getattr__/__setattr__. - # Tracked at https://github.com/python-trio/trio/issues/542 - return self._stream._ssl_object # type: ignore[attr-defined] - if info == "client_addr": - return self._get_socket_stream().socket.getsockname() - if info == "server_addr": - return self._get_socket_stream().socket.getpeername() - if info == "socket": - stream = self._stream - while isinstance(stream, trio.SSLStream): - stream = stream.transport_stream - assert isinstance(stream, trio.SocketStream) - return stream.socket - if info == "is_readable": - socket = self.get_extra_info("socket") - return socket.is_readable() - return None - - def _get_socket_stream(self) -> trio.SocketStream: - stream = self._stream - while isinstance(stream, trio.SSLStream): - stream = stream.transport_stream - assert isinstance(stream, trio.SocketStream) - return stream - - -class TrioBackend(AsyncNetworkBackend): - async def connect_tcp( - self, - host: str, - port: int, - timeout: float | None = None, - local_address: str | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: - # By default for TCP sockets, trio enables TCP_NODELAY. - # https://trio.readthedocs.io/en/stable/reference-io.html#trio.SocketStream - if socket_options is None: - socket_options = [] # pragma: no cover - timeout_or_inf = float("inf") if timeout is None else timeout - exc_map: ExceptionMapping = { - trio.TooSlowError: ConnectTimeout, - trio.BrokenResourceError: ConnectError, - OSError: ConnectError, - } - with map_exceptions(exc_map): - with trio.fail_after(timeout_or_inf): - stream: trio.abc.Stream = await trio.open_tcp_stream( - host=host, port=port, local_address=local_address - ) - for option in socket_options: - stream.setsockopt(*option) # type: ignore[attr-defined] # pragma: no cover - return TrioStream(stream) - - async def connect_unix_socket( - self, - path: str, - timeout: float | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> AsyncNetworkStream: # pragma: nocover - if socket_options is None: - socket_options = [] - timeout_or_inf = float("inf") if timeout is None else timeout - exc_map: ExceptionMapping = { - trio.TooSlowError: ConnectTimeout, - trio.BrokenResourceError: ConnectError, - OSError: ConnectError, - } - with map_exceptions(exc_map): - with trio.fail_after(timeout_or_inf): - stream: trio.abc.Stream = await trio.open_unix_socket(path) - for option in socket_options: - stream.setsockopt(*option) # type: ignore[attr-defined] # pragma: no cover - return TrioStream(stream) - - async def sleep(self, seconds: float) -> None: - await trio.sleep(seconds) # pragma: nocover diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_exceptions.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_exceptions.py deleted file mode 100644 index bc28d44..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_exceptions.py +++ /dev/null @@ -1,81 +0,0 @@ -import contextlib -import typing - -ExceptionMapping = typing.Mapping[typing.Type[Exception], typing.Type[Exception]] - - -@contextlib.contextmanager -def map_exceptions(map: ExceptionMapping) -> typing.Iterator[None]: - try: - yield - except Exception as exc: # noqa: PIE786 - for from_exc, to_exc in map.items(): - if isinstance(exc, from_exc): - raise to_exc(exc) from exc - raise # pragma: nocover - - -class ConnectionNotAvailable(Exception): - pass - - -class ProxyError(Exception): - pass - - -class UnsupportedProtocol(Exception): - pass - - -class ProtocolError(Exception): - pass - - -class RemoteProtocolError(ProtocolError): - pass - - -class LocalProtocolError(ProtocolError): - pass - - -# Timeout errors - - -class TimeoutException(Exception): - pass - - -class PoolTimeout(TimeoutException): - pass - - -class ConnectTimeout(TimeoutException): - pass - - -class ReadTimeout(TimeoutException): - pass - - -class WriteTimeout(TimeoutException): - pass - - -# Network errors - - -class NetworkError(Exception): - pass - - -class ConnectError(NetworkError): - pass - - -class ReadError(NetworkError): - pass - - -class WriteError(NetworkError): - pass diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_models.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_models.py deleted file mode 100644 index 8a65f13..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_models.py +++ /dev/null @@ -1,516 +0,0 @@ -from __future__ import annotations - -import base64 -import ssl -import typing -import urllib.parse - -# Functions for typechecking... - - -ByteOrStr = typing.Union[bytes, str] -HeadersAsSequence = typing.Sequence[typing.Tuple[ByteOrStr, ByteOrStr]] -HeadersAsMapping = typing.Mapping[ByteOrStr, ByteOrStr] -HeaderTypes = typing.Union[HeadersAsSequence, HeadersAsMapping, None] - -Extensions = typing.MutableMapping[str, typing.Any] - - -def enforce_bytes(value: bytes | str, *, name: str) -> bytes: - """ - Any arguments that are ultimately represented as bytes can be specified - either as bytes or as strings. - - However we enforce that any string arguments must only contain characters in - the plain ASCII range. chr(0)...chr(127). If you need to use characters - outside that range then be precise, and use a byte-wise argument. - """ - if isinstance(value, str): - try: - return value.encode("ascii") - except UnicodeEncodeError: - raise TypeError(f"{name} strings may not include unicode characters.") - elif isinstance(value, bytes): - return value - - seen_type = type(value).__name__ - raise TypeError(f"{name} must be bytes or str, but got {seen_type}.") - - -def enforce_url(value: URL | bytes | str, *, name: str) -> URL: - """ - Type check for URL parameters. - """ - if isinstance(value, (bytes, str)): - return URL(value) - elif isinstance(value, URL): - return value - - seen_type = type(value).__name__ - raise TypeError(f"{name} must be a URL, bytes, or str, but got {seen_type}.") - - -def enforce_headers( - value: HeadersAsMapping | HeadersAsSequence | None = None, *, name: str -) -> list[tuple[bytes, bytes]]: - """ - Convienence function that ensure all items in request or response headers - are either bytes or strings in the plain ASCII range. - """ - if value is None: - return [] - elif isinstance(value, typing.Mapping): - return [ - ( - enforce_bytes(k, name="header name"), - enforce_bytes(v, name="header value"), - ) - for k, v in value.items() - ] - elif isinstance(value, typing.Sequence): - return [ - ( - enforce_bytes(k, name="header name"), - enforce_bytes(v, name="header value"), - ) - for k, v in value - ] - - seen_type = type(value).__name__ - raise TypeError( - f"{name} must be a mapping or sequence of two-tuples, but got {seen_type}." - ) - - -def enforce_stream( - value: bytes | typing.Iterable[bytes] | typing.AsyncIterable[bytes] | None, - *, - name: str, -) -> typing.Iterable[bytes] | typing.AsyncIterable[bytes]: - if value is None: - return ByteStream(b"") - elif isinstance(value, bytes): - return ByteStream(value) - return value - - -# * https://tools.ietf.org/html/rfc3986#section-3.2.3 -# * https://url.spec.whatwg.org/#url-miscellaneous -# * https://url.spec.whatwg.org/#scheme-state -DEFAULT_PORTS = { - b"ftp": 21, - b"http": 80, - b"https": 443, - b"ws": 80, - b"wss": 443, -} - - -def include_request_headers( - headers: list[tuple[bytes, bytes]], - *, - url: "URL", - content: None | bytes | typing.Iterable[bytes] | typing.AsyncIterable[bytes], -) -> list[tuple[bytes, bytes]]: - headers_set = set(k.lower() for k, v in headers) - - if b"host" not in headers_set: - default_port = DEFAULT_PORTS.get(url.scheme) - if url.port is None or url.port == default_port: - header_value = url.host - else: - header_value = b"%b:%d" % (url.host, url.port) - headers = [(b"Host", header_value)] + headers - - if ( - content is not None - and b"content-length" not in headers_set - and b"transfer-encoding" not in headers_set - ): - if isinstance(content, bytes): - content_length = str(len(content)).encode("ascii") - headers += [(b"Content-Length", content_length)] - else: - headers += [(b"Transfer-Encoding", b"chunked")] # pragma: nocover - - return headers - - -# Interfaces for byte streams... - - -class ByteStream: - """ - A container for non-streaming content, and that supports both sync and async - stream iteration. - """ - - def __init__(self, content: bytes) -> None: - self._content = content - - def __iter__(self) -> typing.Iterator[bytes]: - yield self._content - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - yield self._content - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{len(self._content)} bytes]>" - - -class Origin: - def __init__(self, scheme: bytes, host: bytes, port: int) -> None: - self.scheme = scheme - self.host = host - self.port = port - - def __eq__(self, other: typing.Any) -> bool: - return ( - isinstance(other, Origin) - and self.scheme == other.scheme - and self.host == other.host - and self.port == other.port - ) - - def __str__(self) -> str: - scheme = self.scheme.decode("ascii") - host = self.host.decode("ascii") - port = str(self.port) - return f"{scheme}://{host}:{port}" - - -class URL: - """ - Represents the URL against which an HTTP request may be made. - - The URL may either be specified as a plain string, for convienence: - - ```python - url = httpcore.URL("https://www.example.com/") - ``` - - Or be constructed with explicitily pre-parsed components: - - ```python - url = httpcore.URL(scheme=b'https', host=b'www.example.com', port=None, target=b'/') - ``` - - Using this second more explicit style allows integrations that are using - `httpcore` to pass through URLs that have already been parsed in order to use - libraries such as `rfc-3986` rather than relying on the stdlib. It also ensures - that URL parsing is treated identically at both the networking level and at any - higher layers of abstraction. - - The four components are important here, as they allow the URL to be precisely - specified in a pre-parsed format. They also allow certain types of request to - be created that could not otherwise be expressed. - - For example, an HTTP request to `http://www.example.com/` forwarded via a proxy - at `http://localhost:8080`... - - ```python - # Constructs an HTTP request with a complete URL as the target: - # GET https://www.example.com/ HTTP/1.1 - url = httpcore.URL( - scheme=b'http', - host=b'localhost', - port=8080, - target=b'https://www.example.com/' - ) - request = httpcore.Request( - method="GET", - url=url - ) - ``` - - Another example is constructing an `OPTIONS *` request... - - ```python - # Constructs an 'OPTIONS *' HTTP request: - # OPTIONS * HTTP/1.1 - url = httpcore.URL(scheme=b'https', host=b'www.example.com', target=b'*') - request = httpcore.Request(method="OPTIONS", url=url) - ``` - - This kind of request is not possible to formulate with a URL string, - because the `/` delimiter is always used to demark the target from the - host/port portion of the URL. - - For convenience, string-like arguments may be specified either as strings or - as bytes. However, once a request is being issue over-the-wire, the URL - components are always ultimately required to be a bytewise representation. - - In order to avoid any ambiguity over character encodings, when strings are used - as arguments, they must be strictly limited to the ASCII range `chr(0)`-`chr(127)`. - If you require a bytewise representation that is outside this range you must - handle the character encoding directly, and pass a bytes instance. - """ - - def __init__( - self, - url: bytes | str = "", - *, - scheme: bytes | str = b"", - host: bytes | str = b"", - port: int | None = None, - target: bytes | str = b"", - ) -> None: - """ - Parameters: - url: The complete URL as a string or bytes. - scheme: The URL scheme as a string or bytes. - Typically either `"http"` or `"https"`. - host: The URL host as a string or bytes. Such as `"www.example.com"`. - port: The port to connect to. Either an integer or `None`. - target: The target of the HTTP request. Such as `"/items?search=red"`. - """ - if url: - parsed = urllib.parse.urlparse(enforce_bytes(url, name="url")) - self.scheme = parsed.scheme - self.host = parsed.hostname or b"" - self.port = parsed.port - self.target = (parsed.path or b"/") + ( - b"?" + parsed.query if parsed.query else b"" - ) - else: - self.scheme = enforce_bytes(scheme, name="scheme") - self.host = enforce_bytes(host, name="host") - self.port = port - self.target = enforce_bytes(target, name="target") - - @property - def origin(self) -> Origin: - default_port = { - b"http": 80, - b"https": 443, - b"ws": 80, - b"wss": 443, - b"socks5": 1080, - b"socks5h": 1080, - }[self.scheme] - return Origin( - scheme=self.scheme, host=self.host, port=self.port or default_port - ) - - def __eq__(self, other: typing.Any) -> bool: - return ( - isinstance(other, URL) - and other.scheme == self.scheme - and other.host == self.host - and other.port == self.port - and other.target == self.target - ) - - def __bytes__(self) -> bytes: - if self.port is None: - return b"%b://%b%b" % (self.scheme, self.host, self.target) - return b"%b://%b:%d%b" % (self.scheme, self.host, self.port, self.target) - - def __repr__(self) -> str: - return ( - f"{self.__class__.__name__}(scheme={self.scheme!r}, " - f"host={self.host!r}, port={self.port!r}, target={self.target!r})" - ) - - -class Request: - """ - An HTTP request. - """ - - def __init__( - self, - method: bytes | str, - url: URL | bytes | str, - *, - headers: HeaderTypes = None, - content: bytes - | typing.Iterable[bytes] - | typing.AsyncIterable[bytes] - | None = None, - extensions: Extensions | None = None, - ) -> None: - """ - Parameters: - method: The HTTP request method, either as a string or bytes. - For example: `GET`. - url: The request URL, either as a `URL` instance, or as a string or bytes. - For example: `"https://www.example.com".` - headers: The HTTP request headers. - content: The content of the request body. - extensions: A dictionary of optional extra information included on - the request. Possible keys include `"timeout"`, and `"trace"`. - """ - self.method: bytes = enforce_bytes(method, name="method") - self.url: URL = enforce_url(url, name="url") - self.headers: list[tuple[bytes, bytes]] = enforce_headers( - headers, name="headers" - ) - self.stream: typing.Iterable[bytes] | typing.AsyncIterable[bytes] = ( - enforce_stream(content, name="content") - ) - self.extensions = {} if extensions is None else extensions - - if "target" in self.extensions: - self.url = URL( - scheme=self.url.scheme, - host=self.url.host, - port=self.url.port, - target=self.extensions["target"], - ) - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.method!r}]>" - - -class Response: - """ - An HTTP response. - """ - - def __init__( - self, - status: int, - *, - headers: HeaderTypes = None, - content: bytes - | typing.Iterable[bytes] - | typing.AsyncIterable[bytes] - | None = None, - extensions: Extensions | None = None, - ) -> None: - """ - Parameters: - status: The HTTP status code of the response. For example `200`. - headers: The HTTP response headers. - content: The content of the response body. - extensions: A dictionary of optional extra information included on - the responseself.Possible keys include `"http_version"`, - `"reason_phrase"`, and `"network_stream"`. - """ - self.status: int = status - self.headers: list[tuple[bytes, bytes]] = enforce_headers( - headers, name="headers" - ) - self.stream: typing.Iterable[bytes] | typing.AsyncIterable[bytes] = ( - enforce_stream(content, name="content") - ) - self.extensions = {} if extensions is None else extensions - - self._stream_consumed = False - - @property - def content(self) -> bytes: - if not hasattr(self, "_content"): - if isinstance(self.stream, typing.Iterable): - raise RuntimeError( - "Attempted to access 'response.content' on a streaming response. " - "Call 'response.read()' first." - ) - else: - raise RuntimeError( - "Attempted to access 'response.content' on a streaming response. " - "Call 'await response.aread()' first." - ) - return self._content - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.status}]>" - - # Sync interface... - - def read(self) -> bytes: - if not isinstance(self.stream, typing.Iterable): # pragma: nocover - raise RuntimeError( - "Attempted to read an asynchronous response using 'response.read()'. " - "You should use 'await response.aread()' instead." - ) - if not hasattr(self, "_content"): - self._content = b"".join([part for part in self.iter_stream()]) - return self._content - - def iter_stream(self) -> typing.Iterator[bytes]: - if not isinstance(self.stream, typing.Iterable): # pragma: nocover - raise RuntimeError( - "Attempted to stream an asynchronous response using 'for ... in " - "response.iter_stream()'. " - "You should use 'async for ... in response.aiter_stream()' instead." - ) - if self._stream_consumed: - raise RuntimeError( - "Attempted to call 'for ... in response.iter_stream()' more than once." - ) - self._stream_consumed = True - for chunk in self.stream: - yield chunk - - def close(self) -> None: - if not isinstance(self.stream, typing.Iterable): # pragma: nocover - raise RuntimeError( - "Attempted to close an asynchronous response using 'response.close()'. " - "You should use 'await response.aclose()' instead." - ) - if hasattr(self.stream, "close"): - self.stream.close() - - # Async interface... - - async def aread(self) -> bytes: - if not isinstance(self.stream, typing.AsyncIterable): # pragma: nocover - raise RuntimeError( - "Attempted to read an synchronous response using " - "'await response.aread()'. " - "You should use 'response.read()' instead." - ) - if not hasattr(self, "_content"): - self._content = b"".join([part async for part in self.aiter_stream()]) - return self._content - - async def aiter_stream(self) -> typing.AsyncIterator[bytes]: - if not isinstance(self.stream, typing.AsyncIterable): # pragma: nocover - raise RuntimeError( - "Attempted to stream an synchronous response using 'async for ... in " - "response.aiter_stream()'. " - "You should use 'for ... in response.iter_stream()' instead." - ) - if self._stream_consumed: - raise RuntimeError( - "Attempted to call 'async for ... in response.aiter_stream()' " - "more than once." - ) - self._stream_consumed = True - async for chunk in self.stream: - yield chunk - - async def aclose(self) -> None: - if not isinstance(self.stream, typing.AsyncIterable): # pragma: nocover - raise RuntimeError( - "Attempted to close a synchronous response using " - "'await response.aclose()'. " - "You should use 'response.close()' instead." - ) - if hasattr(self.stream, "aclose"): - await self.stream.aclose() - - -class Proxy: - def __init__( - self, - url: URL | bytes | str, - auth: tuple[bytes | str, bytes | str] | None = None, - headers: HeadersAsMapping | HeadersAsSequence | None = None, - ssl_context: ssl.SSLContext | None = None, - ): - self.url = enforce_url(url, name="url") - self.headers = enforce_headers(headers, name="headers") - self.ssl_context = ssl_context - - if auth is not None: - username = enforce_bytes(auth[0], name="auth") - password = enforce_bytes(auth[1], name="auth") - userpass = username + b":" + password - authorization = b"Basic " + base64.b64encode(userpass) - self.auth: tuple[bytes, bytes] | None = (username, password) - self.headers = [(b"Proxy-Authorization", authorization)] + self.headers - else: - self.auth = None diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_ssl.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_ssl.py deleted file mode 100644 index c99c5a6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_ssl.py +++ /dev/null @@ -1,9 +0,0 @@ -import ssl - -import certifi - - -def default_ssl_context() -> ssl.SSLContext: - context = ssl.create_default_context() - context.load_verify_locations(certifi.where()) - return context diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__init__.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__init__.py deleted file mode 100644 index b476d76..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -from .connection import HTTPConnection -from .connection_pool import ConnectionPool -from .http11 import HTTP11Connection -from .http_proxy import HTTPProxy -from .interfaces import ConnectionInterface - -try: - from .http2 import HTTP2Connection -except ImportError: # pragma: nocover - - class HTTP2Connection: # type: ignore - def __init__(self, *args, **kwargs) -> None: # type: ignore - raise RuntimeError( - "Attempted to use http2 support, but the `h2` package is not " - "installed. Use 'pip install httpcore[http2]'." - ) - - -try: - from .socks_proxy import SOCKSProxy -except ImportError: # pragma: nocover - - class SOCKSProxy: # type: ignore - def __init__(self, *args, **kwargs) -> None: # type: ignore - raise RuntimeError( - "Attempted to use SOCKS support, but the `socksio` package is not " - "installed. Use 'pip install httpcore[socks]'." - ) - - -__all__ = [ - "HTTPConnection", - "ConnectionPool", - "HTTPProxy", - "HTTP11Connection", - "HTTP2Connection", - "ConnectionInterface", - "SOCKSProxy", -] diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index ac5353c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/connection.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/connection.cpython-310.pyc deleted file mode 100644 index 9b53008..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/connection.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/connection_pool.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/connection_pool.cpython-310.pyc deleted file mode 100644 index 25a6044..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/connection_pool.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http11.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http11.cpython-310.pyc deleted file mode 100644 index 580bf5b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http11.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http2.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http2.cpython-310.pyc deleted file mode 100644 index 773b6b1..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http2.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http_proxy.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http_proxy.cpython-310.pyc deleted file mode 100644 index 69d074c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/http_proxy.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/interfaces.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/interfaces.cpython-310.pyc deleted file mode 100644 index cdefa56..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/interfaces.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/socks_proxy.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/socks_proxy.cpython-310.pyc deleted file mode 100644 index 33db962..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/__pycache__/socks_proxy.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/connection.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/connection.py deleted file mode 100644 index 363f8be..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/connection.py +++ /dev/null @@ -1,222 +0,0 @@ -from __future__ import annotations - -import itertools -import logging -import ssl -import types -import typing - -from .._backends.sync import SyncBackend -from .._backends.base import SOCKET_OPTION, NetworkBackend, NetworkStream -from .._exceptions import ConnectError, ConnectTimeout -from .._models import Origin, Request, Response -from .._ssl import default_ssl_context -from .._synchronization import Lock -from .._trace import Trace -from .http11 import HTTP11Connection -from .interfaces import ConnectionInterface - -RETRIES_BACKOFF_FACTOR = 0.5 # 0s, 0.5s, 1s, 2s, 4s, etc. - - -logger = logging.getLogger("httpcore.connection") - - -def exponential_backoff(factor: float) -> typing.Iterator[float]: - """ - Generate a geometric sequence that has a ratio of 2 and starts with 0. - - For example: - - `factor = 2`: `0, 2, 4, 8, 16, 32, 64, ...` - - `factor = 3`: `0, 3, 6, 12, 24, 48, 96, ...` - """ - yield 0 - for n in itertools.count(): - yield factor * 2**n - - -class HTTPConnection(ConnectionInterface): - def __init__( - self, - origin: Origin, - ssl_context: ssl.SSLContext | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - local_address: str | None = None, - uds: str | None = None, - network_backend: NetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - self._origin = origin - self._ssl_context = ssl_context - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - self._retries = retries - self._local_address = local_address - self._uds = uds - - self._network_backend: NetworkBackend = ( - SyncBackend() if network_backend is None else network_backend - ) - self._connection: ConnectionInterface | None = None - self._connect_failed: bool = False - self._request_lock = Lock() - self._socket_options = socket_options - - def handle_request(self, request: Request) -> Response: - if not self.can_handle_request(request.url.origin): - raise RuntimeError( - f"Attempted to send request to {request.url.origin} on connection to {self._origin}" - ) - - try: - with self._request_lock: - if self._connection is None: - stream = self._connect(request) - - ssl_object = stream.get_extra_info("ssl_object") - http2_negotiated = ( - ssl_object is not None - and ssl_object.selected_alpn_protocol() == "h2" - ) - if http2_negotiated or (self._http2 and not self._http1): - from .http2 import HTTP2Connection - - self._connection = HTTP2Connection( - origin=self._origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - else: - self._connection = HTTP11Connection( - origin=self._origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - except BaseException as exc: - self._connect_failed = True - raise exc - - return self._connection.handle_request(request) - - def _connect(self, request: Request) -> NetworkStream: - timeouts = request.extensions.get("timeout", {}) - sni_hostname = request.extensions.get("sni_hostname", None) - timeout = timeouts.get("connect", None) - - retries_left = self._retries - delays = exponential_backoff(factor=RETRIES_BACKOFF_FACTOR) - - while True: - try: - if self._uds is None: - kwargs = { - "host": self._origin.host.decode("ascii"), - "port": self._origin.port, - "local_address": self._local_address, - "timeout": timeout, - "socket_options": self._socket_options, - } - with Trace("connect_tcp", logger, request, kwargs) as trace: - stream = self._network_backend.connect_tcp(**kwargs) - trace.return_value = stream - else: - kwargs = { - "path": self._uds, - "timeout": timeout, - "socket_options": self._socket_options, - } - with Trace( - "connect_unix_socket", logger, request, kwargs - ) as trace: - stream = self._network_backend.connect_unix_socket( - **kwargs - ) - trace.return_value = stream - - if self._origin.scheme in (b"https", b"wss"): - ssl_context = ( - default_ssl_context() - if self._ssl_context is None - else self._ssl_context - ) - alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"] - ssl_context.set_alpn_protocols(alpn_protocols) - - kwargs = { - "ssl_context": ssl_context, - "server_hostname": sni_hostname - or self._origin.host.decode("ascii"), - "timeout": timeout, - } - with Trace("start_tls", logger, request, kwargs) as trace: - stream = stream.start_tls(**kwargs) - trace.return_value = stream - return stream - except (ConnectError, ConnectTimeout): - if retries_left <= 0: - raise - retries_left -= 1 - delay = next(delays) - with Trace("retry", logger, request, kwargs) as trace: - self._network_backend.sleep(delay) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._origin - - def close(self) -> None: - if self._connection is not None: - with Trace("close", logger, None, {}): - self._connection.close() - - def is_available(self) -> bool: - if self._connection is None: - # If HTTP/2 support is enabled, and the resulting connection could - # end up as HTTP/2 then we should indicate the connection as being - # available to service multiple requests. - return ( - self._http2 - and (self._origin.scheme == b"https" or not self._http1) - and not self._connect_failed - ) - return self._connection.is_available() - - def has_expired(self) -> bool: - if self._connection is None: - return self._connect_failed - return self._connection.has_expired() - - def is_idle(self) -> bool: - if self._connection is None: - return self._connect_failed - return self._connection.is_idle() - - def is_closed(self) -> bool: - if self._connection is None: - return self._connect_failed - return self._connection.is_closed() - - def info(self) -> str: - if self._connection is None: - return "CONNECTION FAILED" if self._connect_failed else "CONNECTING" - return self._connection.info() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" - - # These context managers are not used in the standard flow, but are - # useful for testing or working with connection instances directly. - - def __enter__(self) -> HTTPConnection: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - self.close() diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py deleted file mode 100644 index 9ccfa53..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py +++ /dev/null @@ -1,420 +0,0 @@ -from __future__ import annotations - -import ssl -import sys -import types -import typing - -from .._backends.sync import SyncBackend -from .._backends.base import SOCKET_OPTION, NetworkBackend -from .._exceptions import ConnectionNotAvailable, UnsupportedProtocol -from .._models import Origin, Proxy, Request, Response -from .._synchronization import Event, ShieldCancellation, ThreadLock -from .connection import HTTPConnection -from .interfaces import ConnectionInterface, RequestInterface - - -class PoolRequest: - def __init__(self, request: Request) -> None: - self.request = request - self.connection: ConnectionInterface | None = None - self._connection_acquired = Event() - - def assign_to_connection(self, connection: ConnectionInterface | None) -> None: - self.connection = connection - self._connection_acquired.set() - - def clear_connection(self) -> None: - self.connection = None - self._connection_acquired = Event() - - def wait_for_connection( - self, timeout: float | None = None - ) -> ConnectionInterface: - if self.connection is None: - self._connection_acquired.wait(timeout=timeout) - assert self.connection is not None - return self.connection - - def is_queued(self) -> bool: - return self.connection is None - - -class ConnectionPool(RequestInterface): - """ - A connection pool for making HTTP requests. - """ - - def __init__( - self, - ssl_context: ssl.SSLContext | None = None, - proxy: Proxy | None = None, - max_connections: int | None = 10, - max_keepalive_connections: int | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - local_address: str | None = None, - uds: str | None = None, - network_backend: NetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - """ - A connection pool for making HTTP requests. - - Parameters: - ssl_context: An SSL context to use for verifying connections. - If not specified, the default `httpcore.default_ssl_context()` - will be used. - max_connections: The maximum number of concurrent HTTP connections that - the pool should allow. Any attempt to send a request on a pool that - would exceed this amount will block until a connection is available. - max_keepalive_connections: The maximum number of idle HTTP connections - that will be maintained in the pool. - keepalive_expiry: The duration in seconds that an idle HTTP connection - may be maintained for before being expired from the pool. - http1: A boolean indicating if HTTP/1.1 requests should be supported - by the connection pool. Defaults to True. - http2: A boolean indicating if HTTP/2 requests should be supported by - the connection pool. Defaults to False. - retries: The maximum number of retries when trying to establish a - connection. - local_address: Local address to connect from. Can also be used to connect - using a particular address family. Using `local_address="0.0.0.0"` - will connect using an `AF_INET` address (IPv4), while using - `local_address="::"` will connect using an `AF_INET6` address (IPv6). - uds: Path to a Unix Domain Socket to use instead of TCP sockets. - network_backend: A backend instance to use for handling network I/O. - socket_options: Socket options that have to be included - in the TCP socket when the connection was established. - """ - self._ssl_context = ssl_context - self._proxy = proxy - self._max_connections = ( - sys.maxsize if max_connections is None else max_connections - ) - self._max_keepalive_connections = ( - sys.maxsize - if max_keepalive_connections is None - else max_keepalive_connections - ) - self._max_keepalive_connections = min( - self._max_connections, self._max_keepalive_connections - ) - - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - self._retries = retries - self._local_address = local_address - self._uds = uds - - self._network_backend = ( - SyncBackend() if network_backend is None else network_backend - ) - self._socket_options = socket_options - - # The mutable state on a connection pool is the queue of incoming requests, - # and the set of connections that are servicing those requests. - self._connections: list[ConnectionInterface] = [] - self._requests: list[PoolRequest] = [] - - # We only mutate the state of the connection pool within an 'optional_thread_lock' - # context. This holds a threading lock unless we're running in async mode, - # in which case it is a no-op. - self._optional_thread_lock = ThreadLock() - - def create_connection(self, origin: Origin) -> ConnectionInterface: - if self._proxy is not None: - if self._proxy.url.scheme in (b"socks5", b"socks5h"): - from .socks_proxy import Socks5Connection - - return Socks5Connection( - proxy_origin=self._proxy.url.origin, - proxy_auth=self._proxy.auth, - remote_origin=origin, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - elif origin.scheme == b"http": - from .http_proxy import ForwardHTTPConnection - - return ForwardHTTPConnection( - proxy_origin=self._proxy.url.origin, - proxy_headers=self._proxy.headers, - proxy_ssl_context=self._proxy.ssl_context, - remote_origin=origin, - keepalive_expiry=self._keepalive_expiry, - network_backend=self._network_backend, - ) - from .http_proxy import TunnelHTTPConnection - - return TunnelHTTPConnection( - proxy_origin=self._proxy.url.origin, - proxy_headers=self._proxy.headers, - proxy_ssl_context=self._proxy.ssl_context, - remote_origin=origin, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - - return HTTPConnection( - origin=origin, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - retries=self._retries, - local_address=self._local_address, - uds=self._uds, - network_backend=self._network_backend, - socket_options=self._socket_options, - ) - - @property - def connections(self) -> list[ConnectionInterface]: - """ - Return a list of the connections currently in the pool. - - For example: - - ```python - >>> pool.connections - [ - , - , - , - ] - ``` - """ - return list(self._connections) - - def handle_request(self, request: Request) -> Response: - """ - Send an HTTP request, and return an HTTP response. - - This is the core implementation that is called into by `.request()` or `.stream()`. - """ - scheme = request.url.scheme.decode() - if scheme == "": - raise UnsupportedProtocol( - "Request URL is missing an 'http://' or 'https://' protocol." - ) - if scheme not in ("http", "https", "ws", "wss"): - raise UnsupportedProtocol( - f"Request URL has an unsupported protocol '{scheme}://'." - ) - - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("pool", None) - - with self._optional_thread_lock: - # Add the incoming request to our request queue. - pool_request = PoolRequest(request) - self._requests.append(pool_request) - - try: - while True: - with self._optional_thread_lock: - # Assign incoming requests to available connections, - # closing or creating new connections as required. - closing = self._assign_requests_to_connections() - self._close_connections(closing) - - # Wait until this request has an assigned connection. - connection = pool_request.wait_for_connection(timeout=timeout) - - try: - # Send the request on the assigned connection. - response = connection.handle_request( - pool_request.request - ) - except ConnectionNotAvailable: - # In some cases a connection may initially be available to - # handle a request, but then become unavailable. - # - # In this case we clear the connection and try again. - pool_request.clear_connection() - else: - break # pragma: nocover - - except BaseException as exc: - with self._optional_thread_lock: - # For any exception or cancellation we remove the request from - # the queue, and then re-assign requests to connections. - self._requests.remove(pool_request) - closing = self._assign_requests_to_connections() - - self._close_connections(closing) - raise exc from None - - # Return the response. Note that in this case we still have to manage - # the point at which the response is closed. - assert isinstance(response.stream, typing.Iterable) - return Response( - status=response.status, - headers=response.headers, - content=PoolByteStream( - stream=response.stream, pool_request=pool_request, pool=self - ), - extensions=response.extensions, - ) - - def _assign_requests_to_connections(self) -> list[ConnectionInterface]: - """ - Manage the state of the connection pool, assigning incoming - requests to connections as available. - - Called whenever a new request is added or removed from the pool. - - Any closing connections are returned, allowing the I/O for closing - those connections to be handled seperately. - """ - closing_connections = [] - - # First we handle cleaning up any connections that are closed, - # have expired their keep-alive, or surplus idle connections. - for connection in list(self._connections): - if connection.is_closed(): - # log: "removing closed connection" - self._connections.remove(connection) - elif connection.has_expired(): - # log: "closing expired connection" - self._connections.remove(connection) - closing_connections.append(connection) - elif ( - connection.is_idle() - and len([connection.is_idle() for connection in self._connections]) - > self._max_keepalive_connections - ): - # log: "closing idle connection" - self._connections.remove(connection) - closing_connections.append(connection) - - # Assign queued requests to connections. - queued_requests = [request for request in self._requests if request.is_queued()] - for pool_request in queued_requests: - origin = pool_request.request.url.origin - available_connections = [ - connection - for connection in self._connections - if connection.can_handle_request(origin) and connection.is_available() - ] - idle_connections = [ - connection for connection in self._connections if connection.is_idle() - ] - - # There are three cases for how we may be able to handle the request: - # - # 1. There is an existing connection that can handle the request. - # 2. We can create a new connection to handle the request. - # 3. We can close an idle connection and then create a new connection - # to handle the request. - if available_connections: - # log: "reusing existing connection" - connection = available_connections[0] - pool_request.assign_to_connection(connection) - elif len(self._connections) < self._max_connections: - # log: "creating new connection" - connection = self.create_connection(origin) - self._connections.append(connection) - pool_request.assign_to_connection(connection) - elif idle_connections: - # log: "closing idle connection" - connection = idle_connections[0] - self._connections.remove(connection) - closing_connections.append(connection) - # log: "creating new connection" - connection = self.create_connection(origin) - self._connections.append(connection) - pool_request.assign_to_connection(connection) - - return closing_connections - - def _close_connections(self, closing: list[ConnectionInterface]) -> None: - # Close connections which have been removed from the pool. - with ShieldCancellation(): - for connection in closing: - connection.close() - - def close(self) -> None: - # Explicitly close the connection pool. - # Clears all existing requests and connections. - with self._optional_thread_lock: - closing_connections = list(self._connections) - self._connections = [] - self._close_connections(closing_connections) - - def __enter__(self) -> ConnectionPool: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - self.close() - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - with self._optional_thread_lock: - request_is_queued = [request.is_queued() for request in self._requests] - connection_is_idle = [ - connection.is_idle() for connection in self._connections - ] - - num_active_requests = request_is_queued.count(False) - num_queued_requests = request_is_queued.count(True) - num_active_connections = connection_is_idle.count(False) - num_idle_connections = connection_is_idle.count(True) - - requests_info = ( - f"Requests: {num_active_requests} active, {num_queued_requests} queued" - ) - connection_info = ( - f"Connections: {num_active_connections} active, {num_idle_connections} idle" - ) - - return f"<{class_name} [{requests_info} | {connection_info}]>" - - -class PoolByteStream: - def __init__( - self, - stream: typing.Iterable[bytes], - pool_request: PoolRequest, - pool: ConnectionPool, - ) -> None: - self._stream = stream - self._pool_request = pool_request - self._pool = pool - self._closed = False - - def __iter__(self) -> typing.Iterator[bytes]: - try: - for part in self._stream: - yield part - except BaseException as exc: - self.close() - raise exc from None - - def close(self) -> None: - if not self._closed: - self._closed = True - with ShieldCancellation(): - if hasattr(self._stream, "close"): - self._stream.close() - - with self._pool._optional_thread_lock: - self._pool._requests.remove(self._pool_request) - closing = self._pool._assign_requests_to_connections() - - self._pool._close_connections(closing) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http11.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http11.py deleted file mode 100644 index ebd3a97..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http11.py +++ /dev/null @@ -1,379 +0,0 @@ -from __future__ import annotations - -import enum -import logging -import ssl -import time -import types -import typing - -import h11 - -from .._backends.base import NetworkStream -from .._exceptions import ( - ConnectionNotAvailable, - LocalProtocolError, - RemoteProtocolError, - WriteError, - map_exceptions, -) -from .._models import Origin, Request, Response -from .._synchronization import Lock, ShieldCancellation -from .._trace import Trace -from .interfaces import ConnectionInterface - -logger = logging.getLogger("httpcore.http11") - - -# A subset of `h11.Event` types supported by `_send_event` -H11SendEvent = typing.Union[ - h11.Request, - h11.Data, - h11.EndOfMessage, -] - - -class HTTPConnectionState(enum.IntEnum): - NEW = 0 - ACTIVE = 1 - IDLE = 2 - CLOSED = 3 - - -class HTTP11Connection(ConnectionInterface): - READ_NUM_BYTES = 64 * 1024 - MAX_INCOMPLETE_EVENT_SIZE = 100 * 1024 - - def __init__( - self, - origin: Origin, - stream: NetworkStream, - keepalive_expiry: float | None = None, - ) -> None: - self._origin = origin - self._network_stream = stream - self._keepalive_expiry: float | None = keepalive_expiry - self._expire_at: float | None = None - self._state = HTTPConnectionState.NEW - self._state_lock = Lock() - self._request_count = 0 - self._h11_state = h11.Connection( - our_role=h11.CLIENT, - max_incomplete_event_size=self.MAX_INCOMPLETE_EVENT_SIZE, - ) - - def handle_request(self, request: Request) -> Response: - if not self.can_handle_request(request.url.origin): - raise RuntimeError( - f"Attempted to send request to {request.url.origin} on connection " - f"to {self._origin}" - ) - - with self._state_lock: - if self._state in (HTTPConnectionState.NEW, HTTPConnectionState.IDLE): - self._request_count += 1 - self._state = HTTPConnectionState.ACTIVE - self._expire_at = None - else: - raise ConnectionNotAvailable() - - try: - kwargs = {"request": request} - try: - with Trace( - "send_request_headers", logger, request, kwargs - ) as trace: - self._send_request_headers(**kwargs) - with Trace("send_request_body", logger, request, kwargs) as trace: - self._send_request_body(**kwargs) - except WriteError: - # If we get a write error while we're writing the request, - # then we supress this error and move on to attempting to - # read the response. Servers can sometimes close the request - # pre-emptively and then respond with a well formed HTTP - # error response. - pass - - with Trace( - "receive_response_headers", logger, request, kwargs - ) as trace: - ( - http_version, - status, - reason_phrase, - headers, - trailing_data, - ) = self._receive_response_headers(**kwargs) - trace.return_value = ( - http_version, - status, - reason_phrase, - headers, - ) - - network_stream = self._network_stream - - # CONNECT or Upgrade request - if (status == 101) or ( - (request.method == b"CONNECT") and (200 <= status < 300) - ): - network_stream = HTTP11UpgradeStream(network_stream, trailing_data) - - return Response( - status=status, - headers=headers, - content=HTTP11ConnectionByteStream(self, request), - extensions={ - "http_version": http_version, - "reason_phrase": reason_phrase, - "network_stream": network_stream, - }, - ) - except BaseException as exc: - with ShieldCancellation(): - with Trace("response_closed", logger, request) as trace: - self._response_closed() - raise exc - - # Sending the request... - - def _send_request_headers(self, request: Request) -> None: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("write", None) - - with map_exceptions({h11.LocalProtocolError: LocalProtocolError}): - event = h11.Request( - method=request.method, - target=request.url.target, - headers=request.headers, - ) - self._send_event(event, timeout=timeout) - - def _send_request_body(self, request: Request) -> None: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("write", None) - - assert isinstance(request.stream, typing.Iterable) - for chunk in request.stream: - event = h11.Data(data=chunk) - self._send_event(event, timeout=timeout) - - self._send_event(h11.EndOfMessage(), timeout=timeout) - - def _send_event(self, event: h11.Event, timeout: float | None = None) -> None: - bytes_to_send = self._h11_state.send(event) - if bytes_to_send is not None: - self._network_stream.write(bytes_to_send, timeout=timeout) - - # Receiving the response... - - def _receive_response_headers( - self, request: Request - ) -> tuple[bytes, int, bytes, list[tuple[bytes, bytes]], bytes]: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("read", None) - - while True: - event = self._receive_event(timeout=timeout) - if isinstance(event, h11.Response): - break - if ( - isinstance(event, h11.InformationalResponse) - and event.status_code == 101 - ): - break - - http_version = b"HTTP/" + event.http_version - - # h11 version 0.11+ supports a `raw_items` interface to get the - # raw header casing, rather than the enforced lowercase headers. - headers = event.headers.raw_items() - - trailing_data, _ = self._h11_state.trailing_data - - return http_version, event.status_code, event.reason, headers, trailing_data - - def _receive_response_body( - self, request: Request - ) -> typing.Iterator[bytes]: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("read", None) - - while True: - event = self._receive_event(timeout=timeout) - if isinstance(event, h11.Data): - yield bytes(event.data) - elif isinstance(event, (h11.EndOfMessage, h11.PAUSED)): - break - - def _receive_event( - self, timeout: float | None = None - ) -> h11.Event | type[h11.PAUSED]: - while True: - with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}): - event = self._h11_state.next_event() - - if event is h11.NEED_DATA: - data = self._network_stream.read( - self.READ_NUM_BYTES, timeout=timeout - ) - - # If we feed this case through h11 we'll raise an exception like: - # - # httpcore.RemoteProtocolError: can't handle event type - # ConnectionClosed when role=SERVER and state=SEND_RESPONSE - # - # Which is accurate, but not very informative from an end-user - # perspective. Instead we handle this case distinctly and treat - # it as a ConnectError. - if data == b"" and self._h11_state.their_state == h11.SEND_RESPONSE: - msg = "Server disconnected without sending a response." - raise RemoteProtocolError(msg) - - self._h11_state.receive_data(data) - else: - # mypy fails to narrow the type in the above if statement above - return event # type: ignore[return-value] - - def _response_closed(self) -> None: - with self._state_lock: - if ( - self._h11_state.our_state is h11.DONE - and self._h11_state.their_state is h11.DONE - ): - self._state = HTTPConnectionState.IDLE - self._h11_state.start_next_cycle() - if self._keepalive_expiry is not None: - now = time.monotonic() - self._expire_at = now + self._keepalive_expiry - else: - self.close() - - # Once the connection is no longer required... - - def close(self) -> None: - # Note that this method unilaterally closes the connection, and does - # not have any kind of locking in place around it. - self._state = HTTPConnectionState.CLOSED - self._network_stream.close() - - # The ConnectionInterface methods provide information about the state of - # the connection, allowing for a connection pooling implementation to - # determine when to reuse and when to close the connection... - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._origin - - def is_available(self) -> bool: - # Note that HTTP/1.1 connections in the "NEW" state are not treated as - # being "available". The control flow which created the connection will - # be able to send an outgoing request, but the connection will not be - # acquired from the connection pool for any other request. - return self._state == HTTPConnectionState.IDLE - - def has_expired(self) -> bool: - now = time.monotonic() - keepalive_expired = self._expire_at is not None and now > self._expire_at - - # If the HTTP connection is idle but the socket is readable, then the - # only valid state is that the socket is about to return b"", indicating - # a server-initiated disconnect. - server_disconnected = ( - self._state == HTTPConnectionState.IDLE - and self._network_stream.get_extra_info("is_readable") - ) - - return keepalive_expired or server_disconnected - - def is_idle(self) -> bool: - return self._state == HTTPConnectionState.IDLE - - def is_closed(self) -> bool: - return self._state == HTTPConnectionState.CLOSED - - def info(self) -> str: - origin = str(self._origin) - return ( - f"{origin!r}, HTTP/1.1, {self._state.name}, " - f"Request Count: {self._request_count}" - ) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - origin = str(self._origin) - return ( - f"<{class_name} [{origin!r}, {self._state.name}, " - f"Request Count: {self._request_count}]>" - ) - - # These context managers are not used in the standard flow, but are - # useful for testing or working with connection instances directly. - - def __enter__(self) -> HTTP11Connection: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - self.close() - - -class HTTP11ConnectionByteStream: - def __init__(self, connection: HTTP11Connection, request: Request) -> None: - self._connection = connection - self._request = request - self._closed = False - - def __iter__(self) -> typing.Iterator[bytes]: - kwargs = {"request": self._request} - try: - with Trace("receive_response_body", logger, self._request, kwargs): - for chunk in self._connection._receive_response_body(**kwargs): - yield chunk - except BaseException as exc: - # If we get an exception while streaming the response, - # we want to close the response (and possibly the connection) - # before raising that exception. - with ShieldCancellation(): - self.close() - raise exc - - def close(self) -> None: - if not self._closed: - self._closed = True - with Trace("response_closed", logger, self._request): - self._connection._response_closed() - - -class HTTP11UpgradeStream(NetworkStream): - def __init__(self, stream: NetworkStream, leading_data: bytes) -> None: - self._stream = stream - self._leading_data = leading_data - - def read(self, max_bytes: int, timeout: float | None = None) -> bytes: - if self._leading_data: - buffer = self._leading_data[:max_bytes] - self._leading_data = self._leading_data[max_bytes:] - return buffer - else: - return self._stream.read(max_bytes, timeout) - - def write(self, buffer: bytes, timeout: float | None = None) -> None: - self._stream.write(buffer, timeout) - - def close(self) -> None: - self._stream.close() - - def start_tls( - self, - ssl_context: ssl.SSLContext, - server_hostname: str | None = None, - timeout: float | None = None, - ) -> NetworkStream: - return self._stream.start_tls(ssl_context, server_hostname, timeout) - - def get_extra_info(self, info: str) -> typing.Any: - return self._stream.get_extra_info(info) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http2.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http2.py deleted file mode 100644 index ddcc189..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http2.py +++ /dev/null @@ -1,592 +0,0 @@ -from __future__ import annotations - -import enum -import logging -import time -import types -import typing - -import h2.config -import h2.connection -import h2.events -import h2.exceptions -import h2.settings - -from .._backends.base import NetworkStream -from .._exceptions import ( - ConnectionNotAvailable, - LocalProtocolError, - RemoteProtocolError, -) -from .._models import Origin, Request, Response -from .._synchronization import Lock, Semaphore, ShieldCancellation -from .._trace import Trace -from .interfaces import ConnectionInterface - -logger = logging.getLogger("httpcore.http2") - - -def has_body_headers(request: Request) -> bool: - return any( - k.lower() == b"content-length" or k.lower() == b"transfer-encoding" - for k, v in request.headers - ) - - -class HTTPConnectionState(enum.IntEnum): - ACTIVE = 1 - IDLE = 2 - CLOSED = 3 - - -class HTTP2Connection(ConnectionInterface): - READ_NUM_BYTES = 64 * 1024 - CONFIG = h2.config.H2Configuration(validate_inbound_headers=False) - - def __init__( - self, - origin: Origin, - stream: NetworkStream, - keepalive_expiry: float | None = None, - ): - self._origin = origin - self._network_stream = stream - self._keepalive_expiry: float | None = keepalive_expiry - self._h2_state = h2.connection.H2Connection(config=self.CONFIG) - self._state = HTTPConnectionState.IDLE - self._expire_at: float | None = None - self._request_count = 0 - self._init_lock = Lock() - self._state_lock = Lock() - self._read_lock = Lock() - self._write_lock = Lock() - self._sent_connection_init = False - self._used_all_stream_ids = False - self._connection_error = False - - # Mapping from stream ID to response stream events. - self._events: dict[ - int, - list[ - h2.events.ResponseReceived - | h2.events.DataReceived - | h2.events.StreamEnded - | h2.events.StreamReset, - ], - ] = {} - - # Connection terminated events are stored as state since - # we need to handle them for all streams. - self._connection_terminated: h2.events.ConnectionTerminated | None = None - - self._read_exception: Exception | None = None - self._write_exception: Exception | None = None - - def handle_request(self, request: Request) -> Response: - if not self.can_handle_request(request.url.origin): - # This cannot occur in normal operation, since the connection pool - # will only send requests on connections that handle them. - # It's in place simply for resilience as a guard against incorrect - # usage, for anyone working directly with httpcore connections. - raise RuntimeError( - f"Attempted to send request to {request.url.origin} on connection " - f"to {self._origin}" - ) - - with self._state_lock: - if self._state in (HTTPConnectionState.ACTIVE, HTTPConnectionState.IDLE): - self._request_count += 1 - self._expire_at = None - self._state = HTTPConnectionState.ACTIVE - else: - raise ConnectionNotAvailable() - - with self._init_lock: - if not self._sent_connection_init: - try: - sci_kwargs = {"request": request} - with Trace( - "send_connection_init", logger, request, sci_kwargs - ): - self._send_connection_init(**sci_kwargs) - except BaseException as exc: - with ShieldCancellation(): - self.close() - raise exc - - self._sent_connection_init = True - - # Initially start with just 1 until the remote server provides - # its max_concurrent_streams value - self._max_streams = 1 - - local_settings_max_streams = ( - self._h2_state.local_settings.max_concurrent_streams - ) - self._max_streams_semaphore = Semaphore(local_settings_max_streams) - - for _ in range(local_settings_max_streams - self._max_streams): - self._max_streams_semaphore.acquire() - - self._max_streams_semaphore.acquire() - - try: - stream_id = self._h2_state.get_next_available_stream_id() - self._events[stream_id] = [] - except h2.exceptions.NoAvailableStreamIDError: # pragma: nocover - self._used_all_stream_ids = True - self._request_count -= 1 - raise ConnectionNotAvailable() - - try: - kwargs = {"request": request, "stream_id": stream_id} - with Trace("send_request_headers", logger, request, kwargs): - self._send_request_headers(request=request, stream_id=stream_id) - with Trace("send_request_body", logger, request, kwargs): - self._send_request_body(request=request, stream_id=stream_id) - with Trace( - "receive_response_headers", logger, request, kwargs - ) as trace: - status, headers = self._receive_response( - request=request, stream_id=stream_id - ) - trace.return_value = (status, headers) - - return Response( - status=status, - headers=headers, - content=HTTP2ConnectionByteStream(self, request, stream_id=stream_id), - extensions={ - "http_version": b"HTTP/2", - "network_stream": self._network_stream, - "stream_id": stream_id, - }, - ) - except BaseException as exc: # noqa: PIE786 - with ShieldCancellation(): - kwargs = {"stream_id": stream_id} - with Trace("response_closed", logger, request, kwargs): - self._response_closed(stream_id=stream_id) - - if isinstance(exc, h2.exceptions.ProtocolError): - # One case where h2 can raise a protocol error is when a - # closed frame has been seen by the state machine. - # - # This happens when one stream is reading, and encounters - # a GOAWAY event. Other flows of control may then raise - # a protocol error at any point they interact with the 'h2_state'. - # - # In this case we'll have stored the event, and should raise - # it as a RemoteProtocolError. - if self._connection_terminated: # pragma: nocover - raise RemoteProtocolError(self._connection_terminated) - # If h2 raises a protocol error in some other state then we - # must somehow have made a protocol violation. - raise LocalProtocolError(exc) # pragma: nocover - - raise exc - - def _send_connection_init(self, request: Request) -> None: - """ - The HTTP/2 connection requires some initial setup before we can start - using individual request/response streams on it. - """ - # Need to set these manually here instead of manipulating via - # __setitem__() otherwise the H2Connection will emit SettingsUpdate - # frames in addition to sending the undesired defaults. - self._h2_state.local_settings = h2.settings.Settings( - client=True, - initial_values={ - # Disable PUSH_PROMISE frames from the server since we don't do anything - # with them for now. Maybe when we support caching? - h2.settings.SettingCodes.ENABLE_PUSH: 0, - # These two are taken from h2 for safe defaults - h2.settings.SettingCodes.MAX_CONCURRENT_STREAMS: 100, - h2.settings.SettingCodes.MAX_HEADER_LIST_SIZE: 65536, - }, - ) - - # Some websites (*cough* Yahoo *cough*) balk at this setting being - # present in the initial handshake since it's not defined in the original - # RFC despite the RFC mandating ignoring settings you don't know about. - del self._h2_state.local_settings[ - h2.settings.SettingCodes.ENABLE_CONNECT_PROTOCOL - ] - - self._h2_state.initiate_connection() - self._h2_state.increment_flow_control_window(2**24) - self._write_outgoing_data(request) - - # Sending the request... - - def _send_request_headers(self, request: Request, stream_id: int) -> None: - """ - Send the request headers to a given stream ID. - """ - end_stream = not has_body_headers(request) - - # In HTTP/2 the ':authority' pseudo-header is used instead of 'Host'. - # In order to gracefully handle HTTP/1.1 and HTTP/2 we always require - # HTTP/1.1 style headers, and map them appropriately if we end up on - # an HTTP/2 connection. - authority = [v for k, v in request.headers if k.lower() == b"host"][0] - - headers = [ - (b":method", request.method), - (b":authority", authority), - (b":scheme", request.url.scheme), - (b":path", request.url.target), - ] + [ - (k.lower(), v) - for k, v in request.headers - if k.lower() - not in ( - b"host", - b"transfer-encoding", - ) - ] - - self._h2_state.send_headers(stream_id, headers, end_stream=end_stream) - self._h2_state.increment_flow_control_window(2**24, stream_id=stream_id) - self._write_outgoing_data(request) - - def _send_request_body(self, request: Request, stream_id: int) -> None: - """ - Iterate over the request body sending it to a given stream ID. - """ - if not has_body_headers(request): - return - - assert isinstance(request.stream, typing.Iterable) - for data in request.stream: - self._send_stream_data(request, stream_id, data) - self._send_end_stream(request, stream_id) - - def _send_stream_data( - self, request: Request, stream_id: int, data: bytes - ) -> None: - """ - Send a single chunk of data in one or more data frames. - """ - while data: - max_flow = self._wait_for_outgoing_flow(request, stream_id) - chunk_size = min(len(data), max_flow) - chunk, data = data[:chunk_size], data[chunk_size:] - self._h2_state.send_data(stream_id, chunk) - self._write_outgoing_data(request) - - def _send_end_stream(self, request: Request, stream_id: int) -> None: - """ - Send an empty data frame on on a given stream ID with the END_STREAM flag set. - """ - self._h2_state.end_stream(stream_id) - self._write_outgoing_data(request) - - # Receiving the response... - - def _receive_response( - self, request: Request, stream_id: int - ) -> tuple[int, list[tuple[bytes, bytes]]]: - """ - Return the response status code and headers for a given stream ID. - """ - while True: - event = self._receive_stream_event(request, stream_id) - if isinstance(event, h2.events.ResponseReceived): - break - - status_code = 200 - headers = [] - assert event.headers is not None - for k, v in event.headers: - if k == b":status": - status_code = int(v.decode("ascii", errors="ignore")) - elif not k.startswith(b":"): - headers.append((k, v)) - - return (status_code, headers) - - def _receive_response_body( - self, request: Request, stream_id: int - ) -> typing.Iterator[bytes]: - """ - Iterator that returns the bytes of the response body for a given stream ID. - """ - while True: - event = self._receive_stream_event(request, stream_id) - if isinstance(event, h2.events.DataReceived): - assert event.flow_controlled_length is not None - assert event.data is not None - amount = event.flow_controlled_length - self._h2_state.acknowledge_received_data(amount, stream_id) - self._write_outgoing_data(request) - yield event.data - elif isinstance(event, h2.events.StreamEnded): - break - - def _receive_stream_event( - self, request: Request, stream_id: int - ) -> h2.events.ResponseReceived | h2.events.DataReceived | h2.events.StreamEnded: - """ - Return the next available event for a given stream ID. - - Will read more data from the network if required. - """ - while not self._events.get(stream_id): - self._receive_events(request, stream_id) - event = self._events[stream_id].pop(0) - if isinstance(event, h2.events.StreamReset): - raise RemoteProtocolError(event) - return event - - def _receive_events( - self, request: Request, stream_id: int | None = None - ) -> None: - """ - Read some data from the network until we see one or more events - for a given stream ID. - """ - with self._read_lock: - if self._connection_terminated is not None: - last_stream_id = self._connection_terminated.last_stream_id - if stream_id and last_stream_id and stream_id > last_stream_id: - self._request_count -= 1 - raise ConnectionNotAvailable() - raise RemoteProtocolError(self._connection_terminated) - - # This conditional is a bit icky. We don't want to block reading if we've - # actually got an event to return for a given stream. We need to do that - # check *within* the atomic read lock. Though it also need to be optional, - # because when we call it from `_wait_for_outgoing_flow` we *do* want to - # block until we've available flow control, event when we have events - # pending for the stream ID we're attempting to send on. - if stream_id is None or not self._events.get(stream_id): - events = self._read_incoming_data(request) - for event in events: - if isinstance(event, h2.events.RemoteSettingsChanged): - with Trace( - "receive_remote_settings", logger, request - ) as trace: - self._receive_remote_settings_change(event) - trace.return_value = event - - elif isinstance( - event, - ( - h2.events.ResponseReceived, - h2.events.DataReceived, - h2.events.StreamEnded, - h2.events.StreamReset, - ), - ): - if event.stream_id in self._events: - self._events[event.stream_id].append(event) - - elif isinstance(event, h2.events.ConnectionTerminated): - self._connection_terminated = event - - self._write_outgoing_data(request) - - def _receive_remote_settings_change( - self, event: h2.events.RemoteSettingsChanged - ) -> None: - max_concurrent_streams = event.changed_settings.get( - h2.settings.SettingCodes.MAX_CONCURRENT_STREAMS - ) - if max_concurrent_streams: - new_max_streams = min( - max_concurrent_streams.new_value, - self._h2_state.local_settings.max_concurrent_streams, - ) - if new_max_streams and new_max_streams != self._max_streams: - while new_max_streams > self._max_streams: - self._max_streams_semaphore.release() - self._max_streams += 1 - while new_max_streams < self._max_streams: - self._max_streams_semaphore.acquire() - self._max_streams -= 1 - - def _response_closed(self, stream_id: int) -> None: - self._max_streams_semaphore.release() - del self._events[stream_id] - with self._state_lock: - if self._connection_terminated and not self._events: - self.close() - - elif self._state == HTTPConnectionState.ACTIVE and not self._events: - self._state = HTTPConnectionState.IDLE - if self._keepalive_expiry is not None: - now = time.monotonic() - self._expire_at = now + self._keepalive_expiry - if self._used_all_stream_ids: # pragma: nocover - self.close() - - def close(self) -> None: - # Note that this method unilaterally closes the connection, and does - # not have any kind of locking in place around it. - self._h2_state.close_connection() - self._state = HTTPConnectionState.CLOSED - self._network_stream.close() - - # Wrappers around network read/write operations... - - def _read_incoming_data(self, request: Request) -> list[h2.events.Event]: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("read", None) - - if self._read_exception is not None: - raise self._read_exception # pragma: nocover - - try: - data = self._network_stream.read(self.READ_NUM_BYTES, timeout) - if data == b"": - raise RemoteProtocolError("Server disconnected") - except Exception as exc: - # If we get a network error we should: - # - # 1. Save the exception and just raise it immediately on any future reads. - # (For example, this means that a single read timeout or disconnect will - # immediately close all pending streams. Without requiring multiple - # sequential timeouts.) - # 2. Mark the connection as errored, so that we don't accept any other - # incoming requests. - self._read_exception = exc - self._connection_error = True - raise exc - - events: list[h2.events.Event] = self._h2_state.receive_data(data) - - return events - - def _write_outgoing_data(self, request: Request) -> None: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("write", None) - - with self._write_lock: - data_to_send = self._h2_state.data_to_send() - - if self._write_exception is not None: - raise self._write_exception # pragma: nocover - - try: - self._network_stream.write(data_to_send, timeout) - except Exception as exc: # pragma: nocover - # If we get a network error we should: - # - # 1. Save the exception and just raise it immediately on any future write. - # (For example, this means that a single write timeout or disconnect will - # immediately close all pending streams. Without requiring multiple - # sequential timeouts.) - # 2. Mark the connection as errored, so that we don't accept any other - # incoming requests. - self._write_exception = exc - self._connection_error = True - raise exc - - # Flow control... - - def _wait_for_outgoing_flow(self, request: Request, stream_id: int) -> int: - """ - Returns the maximum allowable outgoing flow for a given stream. - - If the allowable flow is zero, then waits on the network until - WindowUpdated frames have increased the flow rate. - https://tools.ietf.org/html/rfc7540#section-6.9 - """ - local_flow: int = self._h2_state.local_flow_control_window(stream_id) - max_frame_size: int = self._h2_state.max_outbound_frame_size - flow = min(local_flow, max_frame_size) - while flow == 0: - self._receive_events(request) - local_flow = self._h2_state.local_flow_control_window(stream_id) - max_frame_size = self._h2_state.max_outbound_frame_size - flow = min(local_flow, max_frame_size) - return flow - - # Interface for connection pooling... - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._origin - - def is_available(self) -> bool: - return ( - self._state != HTTPConnectionState.CLOSED - and not self._connection_error - and not self._used_all_stream_ids - and not ( - self._h2_state.state_machine.state - == h2.connection.ConnectionState.CLOSED - ) - ) - - def has_expired(self) -> bool: - now = time.monotonic() - return self._expire_at is not None and now > self._expire_at - - def is_idle(self) -> bool: - return self._state == HTTPConnectionState.IDLE - - def is_closed(self) -> bool: - return self._state == HTTPConnectionState.CLOSED - - def info(self) -> str: - origin = str(self._origin) - return ( - f"{origin!r}, HTTP/2, {self._state.name}, " - f"Request Count: {self._request_count}" - ) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - origin = str(self._origin) - return ( - f"<{class_name} [{origin!r}, {self._state.name}, " - f"Request Count: {self._request_count}]>" - ) - - # These context managers are not used in the standard flow, but are - # useful for testing or working with connection instances directly. - - def __enter__(self) -> HTTP2Connection: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - self.close() - - -class HTTP2ConnectionByteStream: - def __init__( - self, connection: HTTP2Connection, request: Request, stream_id: int - ) -> None: - self._connection = connection - self._request = request - self._stream_id = stream_id - self._closed = False - - def __iter__(self) -> typing.Iterator[bytes]: - kwargs = {"request": self._request, "stream_id": self._stream_id} - try: - with Trace("receive_response_body", logger, self._request, kwargs): - for chunk in self._connection._receive_response_body( - request=self._request, stream_id=self._stream_id - ): - yield chunk - except BaseException as exc: - # If we get an exception while streaming the response, - # we want to close the response (and possibly the connection) - # before raising that exception. - with ShieldCancellation(): - self.close() - raise exc - - def close(self) -> None: - if not self._closed: - self._closed = True - kwargs = {"stream_id": self._stream_id} - with Trace("response_closed", logger, self._request, kwargs): - self._connection._response_closed(stream_id=self._stream_id) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http_proxy.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http_proxy.py deleted file mode 100644 index ecca88f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/http_proxy.py +++ /dev/null @@ -1,367 +0,0 @@ -from __future__ import annotations - -import base64 -import logging -import ssl -import typing - -from .._backends.base import SOCKET_OPTION, NetworkBackend -from .._exceptions import ProxyError -from .._models import ( - URL, - Origin, - Request, - Response, - enforce_bytes, - enforce_headers, - enforce_url, -) -from .._ssl import default_ssl_context -from .._synchronization import Lock -from .._trace import Trace -from .connection import HTTPConnection -from .connection_pool import ConnectionPool -from .http11 import HTTP11Connection -from .interfaces import ConnectionInterface - -ByteOrStr = typing.Union[bytes, str] -HeadersAsSequence = typing.Sequence[typing.Tuple[ByteOrStr, ByteOrStr]] -HeadersAsMapping = typing.Mapping[ByteOrStr, ByteOrStr] - - -logger = logging.getLogger("httpcore.proxy") - - -def merge_headers( - default_headers: typing.Sequence[tuple[bytes, bytes]] | None = None, - override_headers: typing.Sequence[tuple[bytes, bytes]] | None = None, -) -> list[tuple[bytes, bytes]]: - """ - Append default_headers and override_headers, de-duplicating if a key exists - in both cases. - """ - default_headers = [] if default_headers is None else list(default_headers) - override_headers = [] if override_headers is None else list(override_headers) - has_override = set(key.lower() for key, value in override_headers) - default_headers = [ - (key, value) - for key, value in default_headers - if key.lower() not in has_override - ] - return default_headers + override_headers - - -class HTTPProxy(ConnectionPool): # pragma: nocover - """ - A connection pool that sends requests via an HTTP proxy. - """ - - def __init__( - self, - proxy_url: URL | bytes | str, - proxy_auth: tuple[bytes | str, bytes | str] | None = None, - proxy_headers: HeadersAsMapping | HeadersAsSequence | None = None, - ssl_context: ssl.SSLContext | None = None, - proxy_ssl_context: ssl.SSLContext | None = None, - max_connections: int | None = 10, - max_keepalive_connections: int | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - local_address: str | None = None, - uds: str | None = None, - network_backend: NetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - """ - A connection pool for making HTTP requests. - - Parameters: - proxy_url: The URL to use when connecting to the proxy server. - For example `"http://127.0.0.1:8080/"`. - proxy_auth: Any proxy authentication as a two-tuple of - (username, password). May be either bytes or ascii-only str. - proxy_headers: Any HTTP headers to use for the proxy requests. - For example `{"Proxy-Authorization": "Basic :"}`. - ssl_context: An SSL context to use for verifying connections. - If not specified, the default `httpcore.default_ssl_context()` - will be used. - proxy_ssl_context: The same as `ssl_context`, but for a proxy server rather than a remote origin. - max_connections: The maximum number of concurrent HTTP connections that - the pool should allow. Any attempt to send a request on a pool that - would exceed this amount will block until a connection is available. - max_keepalive_connections: The maximum number of idle HTTP connections - that will be maintained in the pool. - keepalive_expiry: The duration in seconds that an idle HTTP connection - may be maintained for before being expired from the pool. - http1: A boolean indicating if HTTP/1.1 requests should be supported - by the connection pool. Defaults to True. - http2: A boolean indicating if HTTP/2 requests should be supported by - the connection pool. Defaults to False. - retries: The maximum number of retries when trying to establish - a connection. - local_address: Local address to connect from. Can also be used to - connect using a particular address family. Using - `local_address="0.0.0.0"` will connect using an `AF_INET` address - (IPv4), while using `local_address="::"` will connect using an - `AF_INET6` address (IPv6). - uds: Path to a Unix Domain Socket to use instead of TCP sockets. - network_backend: A backend instance to use for handling network I/O. - """ - super().__init__( - ssl_context=ssl_context, - max_connections=max_connections, - max_keepalive_connections=max_keepalive_connections, - keepalive_expiry=keepalive_expiry, - http1=http1, - http2=http2, - network_backend=network_backend, - retries=retries, - local_address=local_address, - uds=uds, - socket_options=socket_options, - ) - - self._proxy_url = enforce_url(proxy_url, name="proxy_url") - if ( - self._proxy_url.scheme == b"http" and proxy_ssl_context is not None - ): # pragma: no cover - raise RuntimeError( - "The `proxy_ssl_context` argument is not allowed for the http scheme" - ) - - self._ssl_context = ssl_context - self._proxy_ssl_context = proxy_ssl_context - self._proxy_headers = enforce_headers(proxy_headers, name="proxy_headers") - if proxy_auth is not None: - username = enforce_bytes(proxy_auth[0], name="proxy_auth") - password = enforce_bytes(proxy_auth[1], name="proxy_auth") - userpass = username + b":" + password - authorization = b"Basic " + base64.b64encode(userpass) - self._proxy_headers = [ - (b"Proxy-Authorization", authorization) - ] + self._proxy_headers - - def create_connection(self, origin: Origin) -> ConnectionInterface: - if origin.scheme == b"http": - return ForwardHTTPConnection( - proxy_origin=self._proxy_url.origin, - proxy_headers=self._proxy_headers, - remote_origin=origin, - keepalive_expiry=self._keepalive_expiry, - network_backend=self._network_backend, - proxy_ssl_context=self._proxy_ssl_context, - ) - return TunnelHTTPConnection( - proxy_origin=self._proxy_url.origin, - proxy_headers=self._proxy_headers, - remote_origin=origin, - ssl_context=self._ssl_context, - proxy_ssl_context=self._proxy_ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - - -class ForwardHTTPConnection(ConnectionInterface): - def __init__( - self, - proxy_origin: Origin, - remote_origin: Origin, - proxy_headers: HeadersAsMapping | HeadersAsSequence | None = None, - keepalive_expiry: float | None = None, - network_backend: NetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - proxy_ssl_context: ssl.SSLContext | None = None, - ) -> None: - self._connection = HTTPConnection( - origin=proxy_origin, - keepalive_expiry=keepalive_expiry, - network_backend=network_backend, - socket_options=socket_options, - ssl_context=proxy_ssl_context, - ) - self._proxy_origin = proxy_origin - self._proxy_headers = enforce_headers(proxy_headers, name="proxy_headers") - self._remote_origin = remote_origin - - def handle_request(self, request: Request) -> Response: - headers = merge_headers(self._proxy_headers, request.headers) - url = URL( - scheme=self._proxy_origin.scheme, - host=self._proxy_origin.host, - port=self._proxy_origin.port, - target=bytes(request.url), - ) - proxy_request = Request( - method=request.method, - url=url, - headers=headers, - content=request.stream, - extensions=request.extensions, - ) - return self._connection.handle_request(proxy_request) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._remote_origin - - def close(self) -> None: - self._connection.close() - - def info(self) -> str: - return self._connection.info() - - def is_available(self) -> bool: - return self._connection.is_available() - - def has_expired(self) -> bool: - return self._connection.has_expired() - - def is_idle(self) -> bool: - return self._connection.is_idle() - - def is_closed(self) -> bool: - return self._connection.is_closed() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" - - -class TunnelHTTPConnection(ConnectionInterface): - def __init__( - self, - proxy_origin: Origin, - remote_origin: Origin, - ssl_context: ssl.SSLContext | None = None, - proxy_ssl_context: ssl.SSLContext | None = None, - proxy_headers: typing.Sequence[tuple[bytes, bytes]] | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - network_backend: NetworkBackend | None = None, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - self._connection: ConnectionInterface = HTTPConnection( - origin=proxy_origin, - keepalive_expiry=keepalive_expiry, - network_backend=network_backend, - socket_options=socket_options, - ssl_context=proxy_ssl_context, - ) - self._proxy_origin = proxy_origin - self._remote_origin = remote_origin - self._ssl_context = ssl_context - self._proxy_ssl_context = proxy_ssl_context - self._proxy_headers = enforce_headers(proxy_headers, name="proxy_headers") - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - self._connect_lock = Lock() - self._connected = False - - def handle_request(self, request: Request) -> Response: - timeouts = request.extensions.get("timeout", {}) - timeout = timeouts.get("connect", None) - - with self._connect_lock: - if not self._connected: - target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) - - connect_url = URL( - scheme=self._proxy_origin.scheme, - host=self._proxy_origin.host, - port=self._proxy_origin.port, - target=target, - ) - connect_headers = merge_headers( - [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers - ) - connect_request = Request( - method=b"CONNECT", - url=connect_url, - headers=connect_headers, - extensions=request.extensions, - ) - connect_response = self._connection.handle_request( - connect_request - ) - - if connect_response.status < 200 or connect_response.status > 299: - reason_bytes = connect_response.extensions.get("reason_phrase", b"") - reason_str = reason_bytes.decode("ascii", errors="ignore") - msg = "%d %s" % (connect_response.status, reason_str) - self._connection.close() - raise ProxyError(msg) - - stream = connect_response.extensions["network_stream"] - - # Upgrade the stream to SSL - ssl_context = ( - default_ssl_context() - if self._ssl_context is None - else self._ssl_context - ) - alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"] - ssl_context.set_alpn_protocols(alpn_protocols) - - kwargs = { - "ssl_context": ssl_context, - "server_hostname": self._remote_origin.host.decode("ascii"), - "timeout": timeout, - } - with Trace("start_tls", logger, request, kwargs) as trace: - stream = stream.start_tls(**kwargs) - trace.return_value = stream - - # Determine if we should be using HTTP/1.1 or HTTP/2 - ssl_object = stream.get_extra_info("ssl_object") - http2_negotiated = ( - ssl_object is not None - and ssl_object.selected_alpn_protocol() == "h2" - ) - - # Create the HTTP/1.1 or HTTP/2 connection - if http2_negotiated or (self._http2 and not self._http1): - from .http2 import HTTP2Connection - - self._connection = HTTP2Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - else: - self._connection = HTTP11Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - - self._connected = True - return self._connection.handle_request(request) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._remote_origin - - def close(self) -> None: - self._connection.close() - - def info(self) -> str: - return self._connection.info() - - def is_available(self) -> bool: - return self._connection.is_available() - - def has_expired(self) -> bool: - return self._connection.has_expired() - - def is_idle(self) -> bool: - return self._connection.is_idle() - - def is_closed(self) -> bool: - return self._connection.is_closed() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/interfaces.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/interfaces.py deleted file mode 100644 index e673d4c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/interfaces.py +++ /dev/null @@ -1,137 +0,0 @@ -from __future__ import annotations - -import contextlib -import typing - -from .._models import ( - URL, - Extensions, - HeaderTypes, - Origin, - Request, - Response, - enforce_bytes, - enforce_headers, - enforce_url, - include_request_headers, -) - - -class RequestInterface: - def request( - self, - method: bytes | str, - url: URL | bytes | str, - *, - headers: HeaderTypes = None, - content: bytes | typing.Iterator[bytes] | None = None, - extensions: Extensions | None = None, - ) -> Response: - # Strict type checking on our parameters. - method = enforce_bytes(method, name="method") - url = enforce_url(url, name="url") - headers = enforce_headers(headers, name="headers") - - # Include Host header, and optionally Content-Length or Transfer-Encoding. - headers = include_request_headers(headers, url=url, content=content) - - request = Request( - method=method, - url=url, - headers=headers, - content=content, - extensions=extensions, - ) - response = self.handle_request(request) - try: - response.read() - finally: - response.close() - return response - - @contextlib.contextmanager - def stream( - self, - method: bytes | str, - url: URL | bytes | str, - *, - headers: HeaderTypes = None, - content: bytes | typing.Iterator[bytes] | None = None, - extensions: Extensions | None = None, - ) -> typing.Iterator[Response]: - # Strict type checking on our parameters. - method = enforce_bytes(method, name="method") - url = enforce_url(url, name="url") - headers = enforce_headers(headers, name="headers") - - # Include Host header, and optionally Content-Length or Transfer-Encoding. - headers = include_request_headers(headers, url=url, content=content) - - request = Request( - method=method, - url=url, - headers=headers, - content=content, - extensions=extensions, - ) - response = self.handle_request(request) - try: - yield response - finally: - response.close() - - def handle_request(self, request: Request) -> Response: - raise NotImplementedError() # pragma: nocover - - -class ConnectionInterface(RequestInterface): - def close(self) -> None: - raise NotImplementedError() # pragma: nocover - - def info(self) -> str: - raise NotImplementedError() # pragma: nocover - - def can_handle_request(self, origin: Origin) -> bool: - raise NotImplementedError() # pragma: nocover - - def is_available(self) -> bool: - """ - Return `True` if the connection is currently able to accept an - outgoing request. - - An HTTP/1.1 connection will only be available if it is currently idle. - - An HTTP/2 connection will be available so long as the stream ID space is - not yet exhausted, and the connection is not in an error state. - - While the connection is being established we may not yet know if it is going - to result in an HTTP/1.1 or HTTP/2 connection. The connection should be - treated as being available, but might ultimately raise `NewConnectionRequired` - required exceptions if multiple requests are attempted over a connection - that ends up being established as HTTP/1.1. - """ - raise NotImplementedError() # pragma: nocover - - def has_expired(self) -> bool: - """ - Return `True` if the connection is in a state where it should be closed. - - This either means that the connection is idle and it has passed the - expiry time on its keep-alive, or that server has sent an EOF. - """ - raise NotImplementedError() # pragma: nocover - - def is_idle(self) -> bool: - """ - Return `True` if the connection is currently idle. - """ - raise NotImplementedError() # pragma: nocover - - def is_closed(self) -> bool: - """ - Return `True` if the connection has been closed. - - Used when a response is closed to determine if the connection may be - returned to the connection pool or not. - """ - raise NotImplementedError() # pragma: nocover diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/socks_proxy.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/socks_proxy.py deleted file mode 100644 index 0ca96dd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_sync/socks_proxy.py +++ /dev/null @@ -1,341 +0,0 @@ -from __future__ import annotations - -import logging -import ssl - -import socksio - -from .._backends.sync import SyncBackend -from .._backends.base import NetworkBackend, NetworkStream -from .._exceptions import ConnectionNotAvailable, ProxyError -from .._models import URL, Origin, Request, Response, enforce_bytes, enforce_url -from .._ssl import default_ssl_context -from .._synchronization import Lock -from .._trace import Trace -from .connection_pool import ConnectionPool -from .http11 import HTTP11Connection -from .interfaces import ConnectionInterface - -logger = logging.getLogger("httpcore.socks") - - -AUTH_METHODS = { - b"\x00": "NO AUTHENTICATION REQUIRED", - b"\x01": "GSSAPI", - b"\x02": "USERNAME/PASSWORD", - b"\xff": "NO ACCEPTABLE METHODS", -} - -REPLY_CODES = { - b"\x00": "Succeeded", - b"\x01": "General SOCKS server failure", - b"\x02": "Connection not allowed by ruleset", - b"\x03": "Network unreachable", - b"\x04": "Host unreachable", - b"\x05": "Connection refused", - b"\x06": "TTL expired", - b"\x07": "Command not supported", - b"\x08": "Address type not supported", -} - - -def _init_socks5_connection( - stream: NetworkStream, - *, - host: bytes, - port: int, - auth: tuple[bytes, bytes] | None = None, -) -> None: - conn = socksio.socks5.SOCKS5Connection() - - # Auth method request - auth_method = ( - socksio.socks5.SOCKS5AuthMethod.NO_AUTH_REQUIRED - if auth is None - else socksio.socks5.SOCKS5AuthMethod.USERNAME_PASSWORD - ) - conn.send(socksio.socks5.SOCKS5AuthMethodsRequest([auth_method])) - outgoing_bytes = conn.data_to_send() - stream.write(outgoing_bytes) - - # Auth method response - incoming_bytes = stream.read(max_bytes=4096) - response = conn.receive_data(incoming_bytes) - assert isinstance(response, socksio.socks5.SOCKS5AuthReply) - if response.method != auth_method: - requested = AUTH_METHODS.get(auth_method, "UNKNOWN") - responded = AUTH_METHODS.get(response.method, "UNKNOWN") - raise ProxyError( - f"Requested {requested} from proxy server, but got {responded}." - ) - - if response.method == socksio.socks5.SOCKS5AuthMethod.USERNAME_PASSWORD: - # Username/password request - assert auth is not None - username, password = auth - conn.send(socksio.socks5.SOCKS5UsernamePasswordRequest(username, password)) - outgoing_bytes = conn.data_to_send() - stream.write(outgoing_bytes) - - # Username/password response - incoming_bytes = stream.read(max_bytes=4096) - response = conn.receive_data(incoming_bytes) - assert isinstance(response, socksio.socks5.SOCKS5UsernamePasswordReply) - if not response.success: - raise ProxyError("Invalid username/password") - - # Connect request - conn.send( - socksio.socks5.SOCKS5CommandRequest.from_address( - socksio.socks5.SOCKS5Command.CONNECT, (host, port) - ) - ) - outgoing_bytes = conn.data_to_send() - stream.write(outgoing_bytes) - - # Connect response - incoming_bytes = stream.read(max_bytes=4096) - response = conn.receive_data(incoming_bytes) - assert isinstance(response, socksio.socks5.SOCKS5Reply) - if response.reply_code != socksio.socks5.SOCKS5ReplyCode.SUCCEEDED: - reply_code = REPLY_CODES.get(response.reply_code, "UNKOWN") - raise ProxyError(f"Proxy Server could not connect: {reply_code}.") - - -class SOCKSProxy(ConnectionPool): # pragma: nocover - """ - A connection pool that sends requests via an HTTP proxy. - """ - - def __init__( - self, - proxy_url: URL | bytes | str, - proxy_auth: tuple[bytes | str, bytes | str] | None = None, - ssl_context: ssl.SSLContext | None = None, - max_connections: int | None = 10, - max_keepalive_connections: int | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - retries: int = 0, - network_backend: NetworkBackend | None = None, - ) -> None: - """ - A connection pool for making HTTP requests. - - Parameters: - proxy_url: The URL to use when connecting to the proxy server. - For example `"http://127.0.0.1:8080/"`. - ssl_context: An SSL context to use for verifying connections. - If not specified, the default `httpcore.default_ssl_context()` - will be used. - max_connections: The maximum number of concurrent HTTP connections that - the pool should allow. Any attempt to send a request on a pool that - would exceed this amount will block until a connection is available. - max_keepalive_connections: The maximum number of idle HTTP connections - that will be maintained in the pool. - keepalive_expiry: The duration in seconds that an idle HTTP connection - may be maintained for before being expired from the pool. - http1: A boolean indicating if HTTP/1.1 requests should be supported - by the connection pool. Defaults to True. - http2: A boolean indicating if HTTP/2 requests should be supported by - the connection pool. Defaults to False. - retries: The maximum number of retries when trying to establish - a connection. - local_address: Local address to connect from. Can also be used to - connect using a particular address family. Using - `local_address="0.0.0.0"` will connect using an `AF_INET` address - (IPv4), while using `local_address="::"` will connect using an - `AF_INET6` address (IPv6). - uds: Path to a Unix Domain Socket to use instead of TCP sockets. - network_backend: A backend instance to use for handling network I/O. - """ - super().__init__( - ssl_context=ssl_context, - max_connections=max_connections, - max_keepalive_connections=max_keepalive_connections, - keepalive_expiry=keepalive_expiry, - http1=http1, - http2=http2, - network_backend=network_backend, - retries=retries, - ) - self._ssl_context = ssl_context - self._proxy_url = enforce_url(proxy_url, name="proxy_url") - if proxy_auth is not None: - username, password = proxy_auth - username_bytes = enforce_bytes(username, name="proxy_auth") - password_bytes = enforce_bytes(password, name="proxy_auth") - self._proxy_auth: tuple[bytes, bytes] | None = ( - username_bytes, - password_bytes, - ) - else: - self._proxy_auth = None - - def create_connection(self, origin: Origin) -> ConnectionInterface: - return Socks5Connection( - proxy_origin=self._proxy_url.origin, - remote_origin=origin, - proxy_auth=self._proxy_auth, - ssl_context=self._ssl_context, - keepalive_expiry=self._keepalive_expiry, - http1=self._http1, - http2=self._http2, - network_backend=self._network_backend, - ) - - -class Socks5Connection(ConnectionInterface): - def __init__( - self, - proxy_origin: Origin, - remote_origin: Origin, - proxy_auth: tuple[bytes, bytes] | None = None, - ssl_context: ssl.SSLContext | None = None, - keepalive_expiry: float | None = None, - http1: bool = True, - http2: bool = False, - network_backend: NetworkBackend | None = None, - ) -> None: - self._proxy_origin = proxy_origin - self._remote_origin = remote_origin - self._proxy_auth = proxy_auth - self._ssl_context = ssl_context - self._keepalive_expiry = keepalive_expiry - self._http1 = http1 - self._http2 = http2 - - self._network_backend: NetworkBackend = ( - SyncBackend() if network_backend is None else network_backend - ) - self._connect_lock = Lock() - self._connection: ConnectionInterface | None = None - self._connect_failed = False - - def handle_request(self, request: Request) -> Response: - timeouts = request.extensions.get("timeout", {}) - sni_hostname = request.extensions.get("sni_hostname", None) - timeout = timeouts.get("connect", None) - - with self._connect_lock: - if self._connection is None: - try: - # Connect to the proxy - kwargs = { - "host": self._proxy_origin.host.decode("ascii"), - "port": self._proxy_origin.port, - "timeout": timeout, - } - with Trace("connect_tcp", logger, request, kwargs) as trace: - stream = self._network_backend.connect_tcp(**kwargs) - trace.return_value = stream - - # Connect to the remote host using socks5 - kwargs = { - "stream": stream, - "host": self._remote_origin.host.decode("ascii"), - "port": self._remote_origin.port, - "auth": self._proxy_auth, - } - with Trace( - "setup_socks5_connection", logger, request, kwargs - ) as trace: - _init_socks5_connection(**kwargs) - trace.return_value = stream - - # Upgrade the stream to SSL - if self._remote_origin.scheme == b"https": - ssl_context = ( - default_ssl_context() - if self._ssl_context is None - else self._ssl_context - ) - alpn_protocols = ( - ["http/1.1", "h2"] if self._http2 else ["http/1.1"] - ) - ssl_context.set_alpn_protocols(alpn_protocols) - - kwargs = { - "ssl_context": ssl_context, - "server_hostname": sni_hostname - or self._remote_origin.host.decode("ascii"), - "timeout": timeout, - } - with Trace("start_tls", logger, request, kwargs) as trace: - stream = stream.start_tls(**kwargs) - trace.return_value = stream - - # Determine if we should be using HTTP/1.1 or HTTP/2 - ssl_object = stream.get_extra_info("ssl_object") - http2_negotiated = ( - ssl_object is not None - and ssl_object.selected_alpn_protocol() == "h2" - ) - - # Create the HTTP/1.1 or HTTP/2 connection - if http2_negotiated or ( - self._http2 and not self._http1 - ): # pragma: nocover - from .http2 import HTTP2Connection - - self._connection = HTTP2Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - else: - self._connection = HTTP11Connection( - origin=self._remote_origin, - stream=stream, - keepalive_expiry=self._keepalive_expiry, - ) - except Exception as exc: - self._connect_failed = True - raise exc - elif not self._connection.is_available(): # pragma: nocover - raise ConnectionNotAvailable() - - return self._connection.handle_request(request) - - def can_handle_request(self, origin: Origin) -> bool: - return origin == self._remote_origin - - def close(self) -> None: - if self._connection is not None: - self._connection.close() - - def is_available(self) -> bool: - if self._connection is None: # pragma: nocover - # If HTTP/2 support is enabled, and the resulting connection could - # end up as HTTP/2 then we should indicate the connection as being - # available to service multiple requests. - return ( - self._http2 - and (self._remote_origin.scheme == b"https" or not self._http1) - and not self._connect_failed - ) - return self._connection.is_available() - - def has_expired(self) -> bool: - if self._connection is None: # pragma: nocover - return self._connect_failed - return self._connection.has_expired() - - def is_idle(self) -> bool: - if self._connection is None: # pragma: nocover - return self._connect_failed - return self._connection.is_idle() - - def is_closed(self) -> bool: - if self._connection is None: # pragma: nocover - return self._connect_failed - return self._connection.is_closed() - - def info(self) -> str: - if self._connection is None: # pragma: nocover - return "CONNECTION FAILED" if self._connect_failed else "CONNECTING" - return self._connection.info() - - def __repr__(self) -> str: - return f"<{self.__class__.__name__} [{self.info()}]>" diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_synchronization.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_synchronization.py deleted file mode 100644 index 2ecc9e9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_synchronization.py +++ /dev/null @@ -1,318 +0,0 @@ -from __future__ import annotations - -import threading -import types - -from ._exceptions import ExceptionMapping, PoolTimeout, map_exceptions - -# Our async synchronization primatives use either 'anyio' or 'trio' depending -# on if they're running under asyncio or trio. - -try: - import trio -except (ImportError, NotImplementedError): # pragma: nocover - trio = None # type: ignore - -try: - import anyio -except ImportError: # pragma: nocover - anyio = None # type: ignore - - -def current_async_library() -> str: - # Determine if we're running under trio or asyncio. - # See https://sniffio.readthedocs.io/en/latest/ - try: - import sniffio - except ImportError: # pragma: nocover - environment = "asyncio" - else: - environment = sniffio.current_async_library() - - if environment not in ("asyncio", "trio"): # pragma: nocover - raise RuntimeError("Running under an unsupported async environment.") - - if environment == "asyncio" and anyio is None: # pragma: nocover - raise RuntimeError( - "Running with asyncio requires installation of 'httpcore[asyncio]'." - ) - - if environment == "trio" and trio is None: # pragma: nocover - raise RuntimeError( - "Running with trio requires installation of 'httpcore[trio]'." - ) - - return environment - - -class AsyncLock: - """ - This is a standard lock. - - In the sync case `Lock` provides thread locking. - In the async case `AsyncLock` provides async locking. - """ - - def __init__(self) -> None: - self._backend = "" - - def setup(self) -> None: - """ - Detect if we're running under 'asyncio' or 'trio' and create - a lock with the correct implementation. - """ - self._backend = current_async_library() - if self._backend == "trio": - self._trio_lock = trio.Lock() - elif self._backend == "asyncio": - self._anyio_lock = anyio.Lock() - - async def __aenter__(self) -> AsyncLock: - if not self._backend: - self.setup() - - if self._backend == "trio": - await self._trio_lock.acquire() - elif self._backend == "asyncio": - await self._anyio_lock.acquire() - - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - if self._backend == "trio": - self._trio_lock.release() - elif self._backend == "asyncio": - self._anyio_lock.release() - - -class AsyncThreadLock: - """ - This is a threading-only lock for no-I/O contexts. - - In the sync case `ThreadLock` provides thread locking. - In the async case `AsyncThreadLock` is a no-op. - """ - - def __enter__(self) -> AsyncThreadLock: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - pass - - -class AsyncEvent: - def __init__(self) -> None: - self._backend = "" - - def setup(self) -> None: - """ - Detect if we're running under 'asyncio' or 'trio' and create - a lock with the correct implementation. - """ - self._backend = current_async_library() - if self._backend == "trio": - self._trio_event = trio.Event() - elif self._backend == "asyncio": - self._anyio_event = anyio.Event() - - def set(self) -> None: - if not self._backend: - self.setup() - - if self._backend == "trio": - self._trio_event.set() - elif self._backend == "asyncio": - self._anyio_event.set() - - async def wait(self, timeout: float | None = None) -> None: - if not self._backend: - self.setup() - - if self._backend == "trio": - trio_exc_map: ExceptionMapping = {trio.TooSlowError: PoolTimeout} - timeout_or_inf = float("inf") if timeout is None else timeout - with map_exceptions(trio_exc_map): - with trio.fail_after(timeout_or_inf): - await self._trio_event.wait() - elif self._backend == "asyncio": - anyio_exc_map: ExceptionMapping = {TimeoutError: PoolTimeout} - with map_exceptions(anyio_exc_map): - with anyio.fail_after(timeout): - await self._anyio_event.wait() - - -class AsyncSemaphore: - def __init__(self, bound: int) -> None: - self._bound = bound - self._backend = "" - - def setup(self) -> None: - """ - Detect if we're running under 'asyncio' or 'trio' and create - a semaphore with the correct implementation. - """ - self._backend = current_async_library() - if self._backend == "trio": - self._trio_semaphore = trio.Semaphore( - initial_value=self._bound, max_value=self._bound - ) - elif self._backend == "asyncio": - self._anyio_semaphore = anyio.Semaphore( - initial_value=self._bound, max_value=self._bound - ) - - async def acquire(self) -> None: - if not self._backend: - self.setup() - - if self._backend == "trio": - await self._trio_semaphore.acquire() - elif self._backend == "asyncio": - await self._anyio_semaphore.acquire() - - async def release(self) -> None: - if self._backend == "trio": - self._trio_semaphore.release() - elif self._backend == "asyncio": - self._anyio_semaphore.release() - - -class AsyncShieldCancellation: - # For certain portions of our codebase where we're dealing with - # closing connections during exception handling we want to shield - # the operation from being cancelled. - # - # with AsyncShieldCancellation(): - # ... # clean-up operations, shielded from cancellation. - - def __init__(self) -> None: - """ - Detect if we're running under 'asyncio' or 'trio' and create - a shielded scope with the correct implementation. - """ - self._backend = current_async_library() - - if self._backend == "trio": - self._trio_shield = trio.CancelScope(shield=True) - elif self._backend == "asyncio": - self._anyio_shield = anyio.CancelScope(shield=True) - - def __enter__(self) -> AsyncShieldCancellation: - if self._backend == "trio": - self._trio_shield.__enter__() - elif self._backend == "asyncio": - self._anyio_shield.__enter__() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - if self._backend == "trio": - self._trio_shield.__exit__(exc_type, exc_value, traceback) - elif self._backend == "asyncio": - self._anyio_shield.__exit__(exc_type, exc_value, traceback) - - -# Our thread-based synchronization primitives... - - -class Lock: - """ - This is a standard lock. - - In the sync case `Lock` provides thread locking. - In the async case `AsyncLock` provides async locking. - """ - - def __init__(self) -> None: - self._lock = threading.Lock() - - def __enter__(self) -> Lock: - self._lock.acquire() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - self._lock.release() - - -class ThreadLock: - """ - This is a threading-only lock for no-I/O contexts. - - In the sync case `ThreadLock` provides thread locking. - In the async case `AsyncThreadLock` is a no-op. - """ - - def __init__(self) -> None: - self._lock = threading.Lock() - - def __enter__(self) -> ThreadLock: - self._lock.acquire() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - self._lock.release() - - -class Event: - def __init__(self) -> None: - self._event = threading.Event() - - def set(self) -> None: - self._event.set() - - def wait(self, timeout: float | None = None) -> None: - if timeout == float("inf"): # pragma: no cover - timeout = None - if not self._event.wait(timeout=timeout): - raise PoolTimeout() # pragma: nocover - - -class Semaphore: - def __init__(self, bound: int) -> None: - self._semaphore = threading.Semaphore(value=bound) - - def acquire(self) -> None: - self._semaphore.acquire() - - def release(self) -> None: - self._semaphore.release() - - -class ShieldCancellation: - # Thread-synchronous codebases don't support cancellation semantics. - # We have this class because we need to mirror the async and sync - # cases within our package, but it's just a no-op. - def __enter__(self) -> ShieldCancellation: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - pass diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_trace.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_trace.py deleted file mode 100644 index 5f1cd7c..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_trace.py +++ /dev/null @@ -1,107 +0,0 @@ -from __future__ import annotations - -import inspect -import logging -import types -import typing - -from ._models import Request - - -class Trace: - def __init__( - self, - name: str, - logger: logging.Logger, - request: Request | None = None, - kwargs: dict[str, typing.Any] | None = None, - ) -> None: - self.name = name - self.logger = logger - self.trace_extension = ( - None if request is None else request.extensions.get("trace") - ) - self.debug = self.logger.isEnabledFor(logging.DEBUG) - self.kwargs = kwargs or {} - self.return_value: typing.Any = None - self.should_trace = self.debug or self.trace_extension is not None - self.prefix = self.logger.name.split(".")[-1] - - def trace(self, name: str, info: dict[str, typing.Any]) -> None: - if self.trace_extension is not None: - prefix_and_name = f"{self.prefix}.{name}" - ret = self.trace_extension(prefix_and_name, info) - if inspect.iscoroutine(ret): # pragma: no cover - raise TypeError( - "If you are using a synchronous interface, " - "the callback of the `trace` extension should " - "be a normal function instead of an asynchronous function." - ) - - if self.debug: - if not info or "return_value" in info and info["return_value"] is None: - message = name - else: - args = " ".join([f"{key}={value!r}" for key, value in info.items()]) - message = f"{name} {args}" - self.logger.debug(message) - - def __enter__(self) -> Trace: - if self.should_trace: - info = self.kwargs - self.trace(f"{self.name}.started", info) - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - if self.should_trace: - if exc_value is None: - info = {"return_value": self.return_value} - self.trace(f"{self.name}.complete", info) - else: - info = {"exception": exc_value} - self.trace(f"{self.name}.failed", info) - - async def atrace(self, name: str, info: dict[str, typing.Any]) -> None: - if self.trace_extension is not None: - prefix_and_name = f"{self.prefix}.{name}" - coro = self.trace_extension(prefix_and_name, info) - if not inspect.iscoroutine(coro): # pragma: no cover - raise TypeError( - "If you're using an asynchronous interface, " - "the callback of the `trace` extension should " - "be an asynchronous function rather than a normal function." - ) - await coro - - if self.debug: - if not info or "return_value" in info and info["return_value"] is None: - message = name - else: - args = " ".join([f"{key}={value!r}" for key, value in info.items()]) - message = f"{name} {args}" - self.logger.debug(message) - - async def __aenter__(self) -> Trace: - if self.should_trace: - info = self.kwargs - await self.atrace(f"{self.name}.started", info) - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: types.TracebackType | None = None, - ) -> None: - if self.should_trace: - if exc_value is None: - info = {"return_value": self.return_value} - await self.atrace(f"{self.name}.complete", info) - else: - info = {"exception": exc_value} - await self.atrace(f"{self.name}.failed", info) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/_utils.py b/write-message/venv/lib/python3.10/site-packages/httpcore/_utils.py deleted file mode 100644 index c44ff93..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpcore/_utils.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import annotations - -import select -import socket -import sys - - -def is_socket_readable(sock: socket.socket | None) -> bool: - """ - Return whether a socket, as identifed by its file descriptor, is readable. - "A socket is readable" means that the read buffer isn't empty, i.e. that calling - .recv() on it would immediately return some data. - """ - # NOTE: we want check for readability without actually attempting to read, because - # we don't want to block forever if it's not readable. - - # In the case that the socket no longer exists, or cannot return a file - # descriptor, we treat it as being readable, as if it the next read operation - # on it is ready to return the terminating `b""`. - sock_fd = None if sock is None else sock.fileno() - if sock_fd is None or sock_fd < 0: # pragma: nocover - return True - - # The implementation below was stolen from: - # https://github.com/python-trio/trio/blob/20ee2b1b7376db637435d80e266212a35837ddcc/trio/_socket.py#L471-L478 - # See also: https://github.com/encode/httpcore/pull/193#issuecomment-703129316 - - # Use select.select on Windows, and when poll is unavailable and select.poll - # everywhere else. (E.g. When eventlet is in use. See #327) - if ( - sys.platform == "win32" or getattr(select, "poll", None) is None - ): # pragma: nocover - rready, _, _ = select.select([sock_fd], [], [], 0) - return bool(rready) - p = select.poll() - p.register(sock_fd, select.POLLIN) - return bool(p.poll(0)) diff --git a/write-message/venv/lib/python3.10/site-packages/httpcore/py.typed b/write-message/venv/lib/python3.10/site-packages/httpcore/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/LICENSE b/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/LICENSE deleted file mode 100644 index 79a03ca..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2015 MagicStack Inc. http://magic.io - -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/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/METADATA deleted file mode 100644 index 8e35e17..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/METADATA +++ /dev/null @@ -1,133 +0,0 @@ -Metadata-Version: 2.1 -Name: httptools -Version: 0.6.4 -Summary: A collection of framework independent HTTP protocol utils. -Home-page: https://github.com/MagicStack/httptools -Author: Yury Selivanov -Author-email: yury@magic.io -License: MIT -Platform: macOS -Platform: POSIX -Platform: Windows -Classifier: License :: OSI Approved :: MIT License -Classifier: Intended Audience :: Developers -Classifier: Programming Language :: Python :: 3 -Classifier: Operating System :: POSIX -Classifier: Operating System :: MacOS :: MacOS X -Classifier: Environment :: Web Environment -Classifier: Development Status :: 5 - Production/Stable -Requires-Python: >=3.8.0 -Description-Content-Type: text/markdown -License-File: LICENSE -Provides-Extra: test -Requires-Dist: Cython >=0.29.24 ; extra == 'test' - -![Tests](https://github.com/MagicStack/httptools/workflows/Tests/badge.svg) - -httptools is a Python binding for the nodejs HTTP parser. - -The package is available on PyPI: `pip install httptools`. - - -# APIs - -httptools contains two classes `httptools.HttpRequestParser`, -`httptools.HttpResponseParser` (fulfilled through -[llhttp](https://github.com/nodejs/llhttp)) and a function for -parsing URLs `httptools.parse_url` (through -[http-parse](https://github.com/nodejs/http-parser) for now). -See unittests for examples. - - -```python - -class HttpRequestParser: - - def __init__(self, protocol): - """HttpRequestParser - - protocol -- a Python object with the following methods - (all optional): - - - on_message_begin() - - on_url(url: bytes) - - on_header(name: bytes, value: bytes) - - on_headers_complete() - - on_body(body: bytes) - - on_message_complete() - - on_chunk_header() - - on_chunk_complete() - - on_status(status: bytes) - """ - - def get_http_version(self) -> str: - """Return an HTTP protocol version.""" - - def should_keep_alive(self) -> bool: - """Return ``True`` if keep-alive mode is preferred.""" - - def should_upgrade(self) -> bool: - """Return ``True`` if the parsed request is a valid Upgrade request. - The method exposes a flag set just before on_headers_complete. - Calling this method earlier will only yield `False`. - """ - - def feed_data(self, data: bytes): - """Feed data to the parser. - - Will eventually trigger callbacks on the ``protocol`` - object. - - On HTTP upgrade, this method will raise an - ``HttpParserUpgrade`` exception, with its sole argument - set to the offset of the non-HTTP data in ``data``. - """ - - def get_method(self) -> bytes: - """Return HTTP request method (GET, HEAD, etc)""" - - -class HttpResponseParser: - - """Has all methods except ``get_method()`` that - HttpRequestParser has.""" - - def get_status_code(self) -> int: - """Return the status code of the HTTP response""" - - -def parse_url(url: bytes): - """Parse URL strings into a structured Python object. - - Returns an instance of ``httptools.URL`` class with the - following attributes: - - - schema: bytes - - host: bytes - - port: int - - path: bytes - - query: bytes - - fragment: bytes - - userinfo: bytes - """ -``` - - -# Development - -1. Clone this repository with - `git clone --recursive git@github.com:MagicStack/httptools.git` - -2. Create a virtual environment with Python 3: - `python3 -m venv envname` - -3. Activate the environment with `source envname/bin/activate` - -4. Install development requirements with `pip install -e .[test]` - -5. Run `make` and `make test`. - - -# License - -MIT. diff --git a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/RECORD deleted file mode 100644 index ac981e3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/RECORD +++ /dev/null @@ -1,21 +0,0 @@ -httptools-0.6.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -httptools-0.6.4.dist-info/LICENSE,sha256=9Fc-fLdnZ0X7W402-lSKqT45HPtoct2s1lEwxF6mqS0,1093 -httptools-0.6.4.dist-info/METADATA,sha256=TeeHZl3JvfneY2qmDgq6pk1saKikURf4Dz41IRt19Hg,3585 -httptools-0.6.4.dist-info/RECORD,, -httptools-0.6.4.dist-info/WHEEL,sha256=lXrF9eVJm7UF3ZOBaBu2Y-RekBGubHbC1Bvbd4BEjAQ,109 -httptools-0.6.4.dist-info/top_level.txt,sha256=APjJKTbZcj0OQ4fdgf2eTCk82nK1n2BFXOD7ky41MPY,10 -httptools/__init__.py,sha256=plt3MIbueJdco9Dy7zoH3ksLNeyirqWagat5rwRmAjo,147 -httptools/__pycache__/__init__.cpython-310.pyc,, -httptools/__pycache__/_version.cpython-310.pyc,, -httptools/_version.py,sha256=ASqOB8fLS7jwZsM551Lc49WxYPyjteqnz1iDWmka-KA,575 -httptools/parser/__init__.py,sha256=fWyconPEHZlJojzRwmBKSn4C85OGXmKEwiEcdjHqXO8,166 -httptools/parser/__pycache__/__init__.cpython-310.pyc,, -httptools/parser/__pycache__/errors.cpython-310.pyc,, -httptools/parser/cparser.pxd,sha256=4qBxnma83Vz86Z9sOZRxjqYj20A-aLSWVGXZgTVLJqE,4977 -httptools/parser/errors.py,sha256=ZVrtN1smPIb_opQ2Ud3uCbGlNLMlECYM2-6S7r5LnHs,566 -httptools/parser/parser.cpython-310-darwin.so,sha256=j_zaYaFYK-Ox1Ib0fgISjAANIJWQiinSbxd8fB8nq7g,200560 -httptools/parser/parser.pyx,sha256=x0BUY9EzHNKCDaw-U8bkZ1MaKGtrOQ8iVCm1IuOtEQI,15140 -httptools/parser/python.pxd,sha256=zWCdGZh34fyQNt3BUHIUjPqY8a5sodRUkfdABxqYHgQ,138 -httptools/parser/url_cparser.pxd,sha256=X5dDI8A7T0l5HL_Czt0mTs0l_d2lXnUDHx1TN8LeiCM,779 -httptools/parser/url_parser.cpython-310-darwin.so,sha256=5WgP5ENa258IO92QuCMAUy01UPU9llL5RkKK0vOhtpY,122128 -httptools/parser/url_parser.pyx,sha256=ZJVUZqrIDdhzVodA7tTtoFb570av-SczIyh2oAZXKzM,3758 diff --git a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/WHEEL deleted file mode 100644 index 15be5eb..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: setuptools (75.2.0) -Root-Is-Purelib: false -Tag: cp310-cp310-macosx_11_0_arm64 - diff --git a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/top_level.txt b/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/top_level.txt deleted file mode 100644 index bef3b40..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools-0.6.4.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -httptools diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/__init__.py b/write-message/venv/lib/python3.10/site-packages/httptools/__init__.py deleted file mode 100644 index 972053e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from . import parser -from .parser import * # NOQA - -from ._version import __version__ # NOQA - -__all__ = parser.__all__ + ('__version__',) # NOQA diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httptools/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index f7abe31..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httptools/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/__pycache__/_version.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httptools/__pycache__/_version.cpython-310.pyc deleted file mode 100644 index ad16be8..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httptools/__pycache__/_version.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/_version.py b/write-message/venv/lib/python3.10/site-packages/httptools/_version.py deleted file mode 100644 index d49ea6f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/_version.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file MUST NOT contain anything but the __version__ assignment. -# -# When making a release, change the value of __version__ -# to an appropriate value, and open a pull request against -# the correct branch (master if making a new feature release). -# The commit message MUST contain a properly formatted release -# log, and the commit must be signed. -# -# The release automation will: build and test the packages for the -# supported platforms, publish the packages on PyPI, merge the PR -# to the target branch, create a Git tag pointing to the commit. - -__version__ = '0.6.4' diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/__init__.py b/write-message/venv/lib/python3.10/site-packages/httptools/parser/__init__.py deleted file mode 100644 index ba371f5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/parser/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from .parser import * # NoQA -from .errors import * # NoQA -from .url_parser import * # NoQA - -__all__ = parser.__all__ + errors.__all__ + url_parser.__all__ # NoQA diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httptools/parser/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 0a12179..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httptools/parser/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/__pycache__/errors.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httptools/parser/__pycache__/errors.cpython-310.pyc deleted file mode 100644 index ad644b6..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httptools/parser/__pycache__/errors.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/cparser.pxd b/write-message/venv/lib/python3.10/site-packages/httptools/parser/cparser.pxd deleted file mode 100644 index 3281864..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/parser/cparser.pxd +++ /dev/null @@ -1,167 +0,0 @@ -from libc.stdint cimport int32_t, uint8_t, uint16_t, uint64_t - - -cdef extern from "llhttp.h": - struct llhttp__internal_s: - int32_t _index - void *_span_pos0 - void *_span_cb0 - int32_t error - const char *reason - const char *error_pos - void *data - void *_current - uint64_t content_length - uint8_t type - uint8_t method - uint8_t http_major - uint8_t http_minor - uint8_t header_state - uint16_t flags - uint8_t upgrade - uint16_t status_code - uint8_t finish - void *settings - ctypedef llhttp__internal_s llhttp__internal_t - ctypedef llhttp__internal_t llhttp_t - - ctypedef int (*llhttp_data_cb) (llhttp_t*, - const char *at, - size_t length) except -1 - - ctypedef int (*llhttp_cb) (llhttp_t*) except -1 - - struct llhttp_settings_s: - llhttp_cb on_message_begin - llhttp_data_cb on_url - llhttp_data_cb on_status - llhttp_data_cb on_header_field - llhttp_data_cb on_header_value - llhttp_cb on_headers_complete - llhttp_data_cb on_body - llhttp_cb on_message_complete - llhttp_cb on_chunk_header - llhttp_cb on_chunk_complete - ctypedef llhttp_settings_s llhttp_settings_t - - enum llhttp_type: - HTTP_BOTH, - HTTP_REQUEST, - HTTP_RESPONSE - ctypedef llhttp_type llhttp_type_t - - enum llhttp_errno: - HPE_OK, - HPE_INTERNAL, - HPE_STRICT, - HPE_LF_EXPECTED, - HPE_UNEXPECTED_CONTENT_LENGTH, - HPE_CLOSED_CONNECTION, - HPE_INVALID_METHOD, - HPE_INVALID_URL, - HPE_INVALID_CONSTANT, - HPE_INVALID_VERSION, - HPE_INVALID_HEADER_TOKEN, - HPE_INVALID_CONTENT_LENGTH, - HPE_INVALID_CHUNK_SIZE, - HPE_INVALID_STATUS, - HPE_INVALID_EOF_STATE, - HPE_INVALID_TRANSFER_ENCODING, - HPE_CB_MESSAGE_BEGIN, - HPE_CB_HEADERS_COMPLETE, - HPE_CB_MESSAGE_COMPLETE, - HPE_CB_CHUNK_HEADER, - HPE_CB_CHUNK_COMPLETE, - HPE_PAUSED, - HPE_PAUSED_UPGRADE, - HPE_USER - ctypedef llhttp_errno llhttp_errno_t - - enum llhttp_flags: - F_CONNECTION_KEEP_ALIVE, - F_CONNECTION_CLOSE, - F_CONNECTION_UPGRADE, - F_CHUNKED, - F_UPGRADE, - F_CONTENT_LENGTH, - F_SKIPBODY, - F_TRAILING, - F_LENIENT, - F_TRANSFER_ENCODING - ctypedef llhttp_flags llhttp_flags_t - - enum llhttp_method: - HTTP_DELETE, - HTTP_GET, - HTTP_HEAD, - HTTP_POST, - HTTP_PUT, - HTTP_CONNECT, - HTTP_OPTIONS, - HTTP_TRACE, - HTTP_COPY, - HTTP_LOCK, - HTTP_MKCOL, - HTTP_MOVE, - HTTP_PROPFIND, - HTTP_PROPPATCH, - HTTP_SEARCH, - HTTP_UNLOCK, - HTTP_BIND, - HTTP_REBIND, - HTTP_UNBIND, - HTTP_ACL, - HTTP_REPORT, - HTTP_MKACTIVITY, - HTTP_CHECKOUT, - HTTP_MERGE, - HTTP_MSEARCH, - HTTP_NOTIFY, - HTTP_SUBSCRIBE, - HTTP_UNSUBSCRIBE, - HTTP_PATCH, - HTTP_PURGE, - HTTP_MKCALENDAR, - HTTP_LINK, - HTTP_UNLINK, - HTTP_SOURCE, - HTTP_PRI, - HTTP_DESCRIBE, - HTTP_ANNOUNCE, - HTTP_SETUP, - HTTP_PLAY, - HTTP_PAUSE, - HTTP_TEARDOWN, - HTTP_GET_PARAMETER, - HTTP_SET_PARAMETER, - HTTP_REDIRECT, - HTTP_RECORD, - HTTP_FLUSH - ctypedef llhttp_method llhttp_method_t - - void llhttp_init(llhttp_t* parser, llhttp_type_t type, const llhttp_settings_t* settings) - - void llhttp_settings_init(llhttp_settings_t* settings) - - llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len) - - void llhttp_resume_after_upgrade(llhttp_t* parser) - - int llhttp_should_keep_alive(const llhttp_t* parser) - - const char* llhttp_get_error_pos(const llhttp_t* parser) - const char* llhttp_get_error_reason(const llhttp_t* parser) - const char* llhttp_method_name(llhttp_method_t method) - - void llhttp_set_error_reason(llhttp_t* parser, const char* reason); - - void llhttp_set_lenient_headers(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_chunked_length(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_keep_alive(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_transfer_encoding(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_version(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_data_after_close(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_optional_lf_after_cr(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_optional_cr_before_lf(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, bint enabled); - void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, bint enabled); diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/errors.py b/write-message/venv/lib/python3.10/site-packages/httptools/parser/errors.py deleted file mode 100644 index bc24c46..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/parser/errors.py +++ /dev/null @@ -1,30 +0,0 @@ -__all__ = ('HttpParserError', - 'HttpParserCallbackError', - 'HttpParserInvalidStatusError', - 'HttpParserInvalidMethodError', - 'HttpParserInvalidURLError', - 'HttpParserUpgrade') - - -class HttpParserError(Exception): - pass - - -class HttpParserCallbackError(HttpParserError): - pass - - -class HttpParserInvalidStatusError(HttpParserError): - pass - - -class HttpParserInvalidMethodError(HttpParserError): - pass - - -class HttpParserInvalidURLError(HttpParserError): - pass - - -class HttpParserUpgrade(Exception): - pass diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/parser.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/httptools/parser/parser.cpython-310-darwin.so deleted file mode 100755 index 6992dc5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httptools/parser/parser.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/parser.pyx b/write-message/venv/lib/python3.10/site-packages/httptools/parser/parser.pyx deleted file mode 100644 index 2fa5026..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/parser/parser.pyx +++ /dev/null @@ -1,436 +0,0 @@ -#cython: language_level=3 - -from __future__ import print_function -from typing import Optional - -from cpython.mem cimport PyMem_Malloc, PyMem_Free -from cpython cimport PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, \ - Py_buffer, PyBytes_AsString - -from .python cimport PyMemoryView_Check, PyMemoryView_GET_BUFFER - - -from .errors import (HttpParserError, - HttpParserCallbackError, - HttpParserInvalidStatusError, - HttpParserInvalidMethodError, - HttpParserInvalidURLError, - HttpParserUpgrade) - -cimport cython -from . cimport cparser - - -__all__ = ('HttpRequestParser', 'HttpResponseParser') - - -@cython.internal -cdef class HttpParser: - - cdef: - cparser.llhttp_t* _cparser - cparser.llhttp_settings_t* _csettings - - bytes _current_header_name - bytes _current_header_value - - _proto_on_url, _proto_on_status, _proto_on_body, \ - _proto_on_header, _proto_on_headers_complete, \ - _proto_on_message_complete, _proto_on_chunk_header, \ - _proto_on_chunk_complete, _proto_on_message_begin - - object _last_error - - Py_buffer py_buf - - def __cinit__(self): - self._cparser = \ - PyMem_Malloc(sizeof(cparser.llhttp_t)) - if self._cparser is NULL: - raise MemoryError() - - self._csettings = \ - PyMem_Malloc(sizeof(cparser.llhttp_settings_t)) - if self._csettings is NULL: - raise MemoryError() - - def __dealloc__(self): - PyMem_Free(self._cparser) - PyMem_Free(self._csettings) - - cdef _init(self, protocol, cparser.llhttp_type_t mode): - cparser.llhttp_settings_init(self._csettings) - - cparser.llhttp_init(self._cparser, mode, self._csettings) - self._cparser.data = self - - self._current_header_name = None - self._current_header_value = None - - self._proto_on_header = getattr(protocol, 'on_header', None) - if self._proto_on_header is not None: - self._csettings.on_header_field = cb_on_header_field - self._csettings.on_header_value = cb_on_header_value - self._proto_on_headers_complete = getattr( - protocol, 'on_headers_complete', None) - self._csettings.on_headers_complete = cb_on_headers_complete - - self._proto_on_body = getattr(protocol, 'on_body', None) - if self._proto_on_body is not None: - self._csettings.on_body = cb_on_body - - self._proto_on_message_begin = getattr( - protocol, 'on_message_begin', None) - if self._proto_on_message_begin is not None: - self._csettings.on_message_begin = cb_on_message_begin - - self._proto_on_message_complete = getattr( - protocol, 'on_message_complete', None) - if self._proto_on_message_complete is not None: - self._csettings.on_message_complete = cb_on_message_complete - - self._proto_on_chunk_header = getattr( - protocol, 'on_chunk_header', None) - self._csettings.on_chunk_header = cb_on_chunk_header - - self._proto_on_chunk_complete = getattr( - protocol, 'on_chunk_complete', None) - self._csettings.on_chunk_complete = cb_on_chunk_complete - - self._last_error = None - - cdef _maybe_call_on_header(self): - if self._current_header_value is not None: - current_header_name = self._current_header_name - current_header_value = self._current_header_value - - self._current_header_name = self._current_header_value = None - - if self._proto_on_header is not None: - self._proto_on_header(current_header_name, - current_header_value) - - cdef _on_header_field(self, bytes field): - self._maybe_call_on_header() - if self._current_header_name is None: - self._current_header_name = field - else: - self._current_header_name += field - - cdef _on_header_value(self, bytes val): - if self._current_header_value is None: - self._current_header_value = val - else: - # This is unlikely, as mostly HTTP headers are one-line - self._current_header_value += val - - cdef _on_headers_complete(self): - self._maybe_call_on_header() - - if self._proto_on_headers_complete is not None: - self._proto_on_headers_complete() - - cdef _on_chunk_header(self): - if (self._current_header_value is not None or - self._current_header_name is not None): - raise HttpParserError('invalid headers state') - - if self._proto_on_chunk_header is not None: - self._proto_on_chunk_header() - - cdef _on_chunk_complete(self): - self._maybe_call_on_header() - - if self._proto_on_chunk_complete is not None: - self._proto_on_chunk_complete() - - ### Public API ### - - def set_dangerous_leniencies( - self, - lenient_headers: Optional[bool] = None, - lenient_chunked_length: Optional[bool] = None, - lenient_keep_alive: Optional[bool] = None, - lenient_transfer_encoding: Optional[bool] = None, - lenient_version: Optional[bool] = None, - lenient_data_after_close: Optional[bool] = None, - lenient_optional_lf_after_cr: Optional[bool] = None, - lenient_optional_cr_before_lf: Optional[bool] = None, - lenient_optional_crlf_after_chunk: Optional[bool] = None, - lenient_spaces_after_chunk_size: Optional[bool] = None, - ): - cdef cparser.llhttp_t* parser = self._cparser - if lenient_headers is not None: - cparser.llhttp_set_lenient_headers( - parser, lenient_headers) - if lenient_chunked_length is not None: - cparser.llhttp_set_lenient_chunked_length( - parser, lenient_chunked_length) - if lenient_keep_alive is not None: - cparser.llhttp_set_lenient_keep_alive( - parser, lenient_keep_alive) - if lenient_transfer_encoding is not None: - cparser.llhttp_set_lenient_transfer_encoding( - parser, lenient_transfer_encoding) - if lenient_version is not None: - cparser.llhttp_set_lenient_version( - parser, lenient_version) - if lenient_data_after_close is not None: - cparser.llhttp_set_lenient_data_after_close( - parser, lenient_data_after_close) - if lenient_optional_lf_after_cr is not None: - cparser.llhttp_set_lenient_optional_lf_after_cr( - parser, lenient_optional_lf_after_cr) - if lenient_optional_cr_before_lf is not None: - cparser.llhttp_set_lenient_optional_cr_before_lf( - parser, lenient_optional_cr_before_lf) - if lenient_optional_crlf_after_chunk is not None: - cparser.llhttp_set_lenient_optional_crlf_after_chunk( - parser, lenient_optional_crlf_after_chunk) - if lenient_spaces_after_chunk_size is not None: - cparser.llhttp_set_lenient_spaces_after_chunk_size( - parser, lenient_spaces_after_chunk_size) - - def get_http_version(self): - cdef cparser.llhttp_t* parser = self._cparser - return '{}.{}'.format(parser.http_major, parser.http_minor) - - def should_keep_alive(self): - return bool(cparser.llhttp_should_keep_alive(self._cparser)) - - def should_upgrade(self): - cdef cparser.llhttp_t* parser = self._cparser - return bool(parser.upgrade) - - def feed_data(self, data): - cdef: - size_t data_len - cparser.llhttp_errno_t err - Py_buffer *buf - bint owning_buf = False - const char* err_pos - - if PyMemoryView_Check(data): - buf = PyMemoryView_GET_BUFFER(data) - data_len = buf.len - err = cparser.llhttp_execute( - self._cparser, - buf.buf, - data_len) - - else: - buf = &self.py_buf - PyObject_GetBuffer(data, buf, PyBUF_SIMPLE) - owning_buf = True - data_len = buf.len - - err = cparser.llhttp_execute( - self._cparser, - buf.buf, - data_len) - - try: - if self._cparser.upgrade == 1 and err == cparser.HPE_PAUSED_UPGRADE: - err_pos = cparser.llhttp_get_error_pos(self._cparser) - - # Immediately free the parser from "error" state, simulating - # http-parser behavior here because 1) we never had the API to - # allow users manually "resume after upgrade", and 2) the use - # case for resuming parsing is very rare. - cparser.llhttp_resume_after_upgrade(self._cparser) - - # The err_pos here is specific for the input buf. So if we ever - # switch to the llhttp behavior (re-raise HttpParserUpgrade for - # successive calls to feed_data() until resume_after_upgrade is - # called), we have to store the result and keep our own state. - raise HttpParserUpgrade(err_pos - buf.buf) - finally: - if owning_buf: - PyBuffer_Release(buf) - - if err != cparser.HPE_OK: - ex = parser_error_from_errno( - self._cparser, - self._cparser.error) - if isinstance(ex, HttpParserCallbackError): - if self._last_error is not None: - ex.__context__ = self._last_error - self._last_error = None - raise ex - - -cdef class HttpRequestParser(HttpParser): - - def __init__(self, protocol): - self._init(protocol, cparser.HTTP_REQUEST) - - self._proto_on_url = getattr(protocol, 'on_url', None) - if self._proto_on_url is not None: - self._csettings.on_url = cb_on_url - - def get_method(self): - cdef cparser.llhttp_t* parser = self._cparser - return cparser.llhttp_method_name( parser.method) - - -cdef class HttpResponseParser(HttpParser): - - def __init__(self, protocol): - self._init(protocol, cparser.HTTP_RESPONSE) - - self._proto_on_status = getattr(protocol, 'on_status', None) - if self._proto_on_status is not None: - self._csettings.on_status = cb_on_status - - def get_status_code(self): - cdef cparser.llhttp_t* parser = self._cparser - return parser.status_code - - -cdef int cb_on_message_begin(cparser.llhttp_t* parser) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._proto_on_message_begin() - except BaseException as ex: - pyparser._last_error = ex - return -1 - else: - return 0 - - -cdef int cb_on_url(cparser.llhttp_t* parser, - const char *at, size_t length) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._proto_on_url(at[:length]) - except BaseException as ex: - cparser.llhttp_set_error_reason(parser, "`on_url` callback error") - pyparser._last_error = ex - return cparser.HPE_USER - else: - return 0 - - -cdef int cb_on_status(cparser.llhttp_t* parser, - const char *at, size_t length) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._proto_on_status(at[:length]) - except BaseException as ex: - cparser.llhttp_set_error_reason(parser, "`on_status` callback error") - pyparser._last_error = ex - return cparser.HPE_USER - else: - return 0 - - -cdef int cb_on_header_field(cparser.llhttp_t* parser, - const char *at, size_t length) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._on_header_field(at[:length]) - except BaseException as ex: - cparser.llhttp_set_error_reason(parser, "`on_header_field` callback error") - pyparser._last_error = ex - return cparser.HPE_USER - else: - return 0 - - -cdef int cb_on_header_value(cparser.llhttp_t* parser, - const char *at, size_t length) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._on_header_value(at[:length]) - except BaseException as ex: - cparser.llhttp_set_error_reason(parser, "`on_header_value` callback error") - pyparser._last_error = ex - return cparser.HPE_USER - else: - return 0 - - -cdef int cb_on_headers_complete(cparser.llhttp_t* parser) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._on_headers_complete() - except BaseException as ex: - pyparser._last_error = ex - return -1 - else: - if pyparser._cparser.upgrade: - return 1 - else: - return 0 - - -cdef int cb_on_body(cparser.llhttp_t* parser, - const char *at, size_t length) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._proto_on_body(at[:length]) - except BaseException as ex: - cparser.llhttp_set_error_reason(parser, "`on_body` callback error") - pyparser._last_error = ex - return cparser.HPE_USER - else: - return 0 - - -cdef int cb_on_message_complete(cparser.llhttp_t* parser) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._proto_on_message_complete() - except BaseException as ex: - pyparser._last_error = ex - return -1 - else: - return 0 - - -cdef int cb_on_chunk_header(cparser.llhttp_t* parser) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._on_chunk_header() - except BaseException as ex: - pyparser._last_error = ex - return -1 - else: - return 0 - - -cdef int cb_on_chunk_complete(cparser.llhttp_t* parser) except -1: - cdef HttpParser pyparser = parser.data - try: - pyparser._on_chunk_complete() - except BaseException as ex: - pyparser._last_error = ex - return -1 - else: - return 0 - - -cdef parser_error_from_errno(cparser.llhttp_t* parser, cparser.llhttp_errno_t errno): - cdef bytes reason = cparser.llhttp_get_error_reason(parser) - - if errno in (cparser.HPE_CB_MESSAGE_BEGIN, - cparser.HPE_CB_HEADERS_COMPLETE, - cparser.HPE_CB_MESSAGE_COMPLETE, - cparser.HPE_CB_CHUNK_HEADER, - cparser.HPE_CB_CHUNK_COMPLETE, - cparser.HPE_USER): - cls = HttpParserCallbackError - - elif errno == cparser.HPE_INVALID_STATUS: - cls = HttpParserInvalidStatusError - - elif errno == cparser.HPE_INVALID_METHOD: - cls = HttpParserInvalidMethodError - - elif errno == cparser.HPE_INVALID_URL: - cls = HttpParserInvalidURLError - - else: - cls = HttpParserError - - return cls(reason.decode('latin-1')) diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/python.pxd b/write-message/venv/lib/python3.10/site-packages/httptools/parser/python.pxd deleted file mode 100644 index 8e95925..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/parser/python.pxd +++ /dev/null @@ -1,6 +0,0 @@ -cimport cpython - - -cdef extern from "Python.h": - cpython.Py_buffer* PyMemoryView_GET_BUFFER(object) - bint PyMemoryView_Check(object) diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_cparser.pxd b/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_cparser.pxd deleted file mode 100644 index ab9265a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_cparser.pxd +++ /dev/null @@ -1,31 +0,0 @@ -from libc.stdint cimport uint16_t - - -cdef extern from "http_parser.h": - # URL Parser - - enum http_parser_url_fields: - UF_SCHEMA = 0, - UF_HOST = 1, - UF_PORT = 2, - UF_PATH = 3, - UF_QUERY = 4, - UF_FRAGMENT = 5, - UF_USERINFO = 6, - UF_MAX = 7 - - struct http_parser_url_field_data: - uint16_t off - uint16_t len - - struct http_parser_url: - uint16_t field_set - uint16_t port - http_parser_url_field_data[UF_MAX] field_data - - void http_parser_url_init(http_parser_url *u) - - int http_parser_parse_url(const char *buf, - size_t buflen, - int is_connect, - http_parser_url *u) diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_parser.cpython-310-darwin.so b/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_parser.cpython-310-darwin.so deleted file mode 100755 index 2cfb718..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_parser.cpython-310-darwin.so and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_parser.pyx b/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_parser.pyx deleted file mode 100644 index 49908f3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httptools/parser/url_parser.pyx +++ /dev/null @@ -1,108 +0,0 @@ -#cython: language_level=3 - -from __future__ import print_function -from cpython.mem cimport PyMem_Malloc, PyMem_Free -from cpython cimport PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, \ - Py_buffer - -from .errors import HttpParserInvalidURLError - -cimport cython -from . cimport url_cparser as uparser - -__all__ = ('parse_url',) - -@cython.freelist(250) -cdef class URL: - cdef readonly bytes schema - cdef readonly bytes host - cdef readonly object port - cdef readonly bytes path - cdef readonly bytes query - cdef readonly bytes fragment - cdef readonly bytes userinfo - - def __cinit__(self, bytes schema, bytes host, object port, bytes path, - bytes query, bytes fragment, bytes userinfo): - - self.schema = schema - self.host = host - self.port = port - self.path = path - self.query = query - self.fragment = fragment - self.userinfo = userinfo - - def __repr__(self): - return ('' - .format(self.schema, self.host, self.port, self.path, - self.query, self.fragment, self.userinfo)) - - -def parse_url(url): - cdef: - Py_buffer py_buf - char* buf_data - uparser.http_parser_url* parsed - int res - bytes schema = None - bytes host = None - object port = None - bytes path = None - bytes query = None - bytes fragment = None - bytes userinfo = None - object result = None - int off - int ln - - parsed = \ - PyMem_Malloc(sizeof(uparser.http_parser_url)) - uparser.http_parser_url_init(parsed) - - PyObject_GetBuffer(url, &py_buf, PyBUF_SIMPLE) - try: - buf_data = py_buf.buf - res = uparser.http_parser_parse_url(buf_data, py_buf.len, 0, parsed) - - if res == 0: - if parsed.field_set & (1 << uparser.UF_SCHEMA): - off = parsed.field_data[uparser.UF_SCHEMA].off - ln = parsed.field_data[uparser.UF_SCHEMA].len - schema = buf_data[off:off+ln] - - if parsed.field_set & (1 << uparser.UF_HOST): - off = parsed.field_data[uparser.UF_HOST].off - ln = parsed.field_data[uparser.UF_HOST].len - host = buf_data[off:off+ln] - - if parsed.field_set & (1 << uparser.UF_PORT): - port = parsed.port - - if parsed.field_set & (1 << uparser.UF_PATH): - off = parsed.field_data[uparser.UF_PATH].off - ln = parsed.field_data[uparser.UF_PATH].len - path = buf_data[off:off+ln] - - if parsed.field_set & (1 << uparser.UF_QUERY): - off = parsed.field_data[uparser.UF_QUERY].off - ln = parsed.field_data[uparser.UF_QUERY].len - query = buf_data[off:off+ln] - - if parsed.field_set & (1 << uparser.UF_FRAGMENT): - off = parsed.field_data[uparser.UF_FRAGMENT].off - ln = parsed.field_data[uparser.UF_FRAGMENT].len - fragment = buf_data[off:off+ln] - - if parsed.field_set & (1 << uparser.UF_USERINFO): - off = parsed.field_data[uparser.UF_USERINFO].off - ln = parsed.field_data[uparser.UF_USERINFO].len - userinfo = buf_data[off:off+ln] - - return URL(schema, host, port, path, query, fragment, userinfo) - else: - raise HttpParserInvalidURLError("invalid url {!r}".format(url)) - finally: - PyBuffer_Release(&py_buf) - PyMem_Free(parsed) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/METADATA deleted file mode 100644 index b0d2b19..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/METADATA +++ /dev/null @@ -1,203 +0,0 @@ -Metadata-Version: 2.3 -Name: httpx -Version: 0.28.1 -Summary: The next generation HTTP client. -Project-URL: Changelog, https://github.com/encode/httpx/blob/master/CHANGELOG.md -Project-URL: Documentation, https://www.python-httpx.org -Project-URL: Homepage, https://github.com/encode/httpx -Project-URL: Source, https://github.com/encode/httpx -Author-email: Tom Christie -License: BSD-3-Clause -Classifier: Development Status :: 4 - Beta -Classifier: Environment :: Web Environment -Classifier: Framework :: AsyncIO -Classifier: Framework :: Trio -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Topic :: Internet :: WWW/HTTP -Requires-Python: >=3.8 -Requires-Dist: anyio -Requires-Dist: certifi -Requires-Dist: httpcore==1.* -Requires-Dist: idna -Provides-Extra: brotli -Requires-Dist: brotli; (platform_python_implementation == 'CPython') and extra == 'brotli' -Requires-Dist: brotlicffi; (platform_python_implementation != 'CPython') and extra == 'brotli' -Provides-Extra: cli -Requires-Dist: click==8.*; extra == 'cli' -Requires-Dist: pygments==2.*; extra == 'cli' -Requires-Dist: rich<14,>=10; extra == 'cli' -Provides-Extra: http2 -Requires-Dist: h2<5,>=3; extra == 'http2' -Provides-Extra: socks -Requires-Dist: socksio==1.*; extra == 'socks' -Provides-Extra: zstd -Requires-Dist: zstandard>=0.18.0; extra == 'zstd' -Description-Content-Type: text/markdown - -

- HTTPX -

- -

HTTPX - A next-generation HTTP client for Python.

- -

- - Test Suite - - - Package version - -

- -HTTPX is a fully featured HTTP client library for Python 3. It includes **an integrated command line client**, has support for both **HTTP/1.1 and HTTP/2**, and provides both **sync and async APIs**. - ---- - -Install HTTPX using pip: - -```shell -$ pip install httpx -``` - -Now, let's get started: - -```pycon ->>> import httpx ->>> r = httpx.get('https://www.example.org/') ->>> r - ->>> r.status_code -200 ->>> r.headers['content-type'] -'text/html; charset=UTF-8' ->>> r.text -'\n\n\nExample Domain...' -``` - -Or, using the command-line client. - -```shell -$ pip install 'httpx[cli]' # The command line client is an optional dependency. -``` - -Which now allows us to use HTTPX directly from the command-line... - -

- httpx --help -

- -Sending a request... - -

- httpx http://httpbin.org/json -

- -## Features - -HTTPX builds on the well-established usability of `requests`, and gives you: - -* A broadly [requests-compatible API](https://www.python-httpx.org/compatibility/). -* An integrated command-line client. -* HTTP/1.1 [and HTTP/2 support](https://www.python-httpx.org/http2/). -* Standard synchronous interface, but with [async support if you need it](https://www.python-httpx.org/async/). -* Ability to make requests directly to [WSGI applications](https://www.python-httpx.org/advanced/transports/#wsgi-transport) or [ASGI applications](https://www.python-httpx.org/advanced/transports/#asgi-transport). -* Strict timeouts everywhere. -* Fully type annotated. -* 100% test coverage. - -Plus all the standard features of `requests`... - -* International Domains and URLs -* Keep-Alive & Connection Pooling -* Sessions with Cookie Persistence -* Browser-style SSL Verification -* Basic/Digest Authentication -* Elegant Key/Value Cookies -* Automatic Decompression -* Automatic Content Decoding -* Unicode Response Bodies -* Multipart File Uploads -* HTTP(S) Proxy Support -* Connection Timeouts -* Streaming Downloads -* .netrc Support -* Chunked Requests - -## Installation - -Install with pip: - -```shell -$ pip install httpx -``` - -Or, to include the optional HTTP/2 support, use: - -```shell -$ pip install httpx[http2] -``` - -HTTPX requires Python 3.8+. - -## Documentation - -Project documentation is available at [https://www.python-httpx.org/](https://www.python-httpx.org/). - -For a run-through of all the basics, head over to the [QuickStart](https://www.python-httpx.org/quickstart/). - -For more advanced topics, see the [Advanced Usage](https://www.python-httpx.org/advanced/) section, the [async support](https://www.python-httpx.org/async/) section, or the [HTTP/2](https://www.python-httpx.org/http2/) section. - -The [Developer Interface](https://www.python-httpx.org/api/) provides a comprehensive API reference. - -To find out about tools that integrate with HTTPX, see [Third Party Packages](https://www.python-httpx.org/third_party_packages/). - -## Contribute - -If you want to contribute with HTTPX check out the [Contributing Guide](https://www.python-httpx.org/contributing/) to learn how to start. - -## Dependencies - -The HTTPX project relies on these excellent libraries: - -* `httpcore` - The underlying transport implementation for `httpx`. - * `h11` - HTTP/1.1 support. -* `certifi` - SSL certificates. -* `idna` - Internationalized domain name support. -* `sniffio` - Async library autodetection. - -As well as these optional installs: - -* `h2` - HTTP/2 support. *(Optional, with `httpx[http2]`)* -* `socksio` - SOCKS proxy support. *(Optional, with `httpx[socks]`)* -* `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)* -* `click` - Command line client support. *(Optional, with `httpx[cli]`)* -* `brotli` or `brotlicffi` - Decoding for "brotli" compressed responses. *(Optional, with `httpx[brotli]`)* -* `zstandard` - Decoding for "zstd" compressed responses. *(Optional, with `httpx[zstd]`)* - -A huge amount of credit is due to `requests` for the API layout that -much of this work follows, as well as to `urllib3` for plenty of design -inspiration around the lower-level networking details. - ---- - -

HTTPX is BSD licensed code.
Designed & crafted with care.

— 🦋 —

- -## Release Information - -### Fixed - -* Reintroduced supposedly-private `URLTypes` shortcut. (#2673) - - ---- - -[Full changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/RECORD deleted file mode 100644 index 3763958..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/RECORD +++ /dev/null @@ -1,54 +0,0 @@ -../../../bin/httpx,sha256=gwP13BtMFKa0xyKGcdhV8qoJcuqDcUzWXYo2P_uQXyk,265 -httpx-0.28.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -httpx-0.28.1.dist-info/METADATA,sha256=_rubD48-gNV8gZnDBPNcQzboWB0dGNeYPJJ2a4J5OyU,7052 -httpx-0.28.1.dist-info/RECORD,, -httpx-0.28.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87 -httpx-0.28.1.dist-info/entry_points.txt,sha256=2lVkdQmxLA1pNMgSN2eV89o90HCZezhmNwsy6ryKDSA,37 -httpx-0.28.1.dist-info/licenses/LICENSE.md,sha256=TsWdVE8StfU5o6cW_TIaxYzNgDC0ZSIfLIgCAM3yjY0,1508 -httpx/__init__.py,sha256=CsaZe6yZj0rHg6322AWKWHGTMVr9txgEfD5P3_Rrz60,2171 -httpx/__pycache__/__init__.cpython-310.pyc,, -httpx/__pycache__/__version__.cpython-310.pyc,, -httpx/__pycache__/_api.cpython-310.pyc,, -httpx/__pycache__/_auth.cpython-310.pyc,, -httpx/__pycache__/_client.cpython-310.pyc,, -httpx/__pycache__/_config.cpython-310.pyc,, -httpx/__pycache__/_content.cpython-310.pyc,, -httpx/__pycache__/_decoders.cpython-310.pyc,, -httpx/__pycache__/_exceptions.cpython-310.pyc,, -httpx/__pycache__/_main.cpython-310.pyc,, -httpx/__pycache__/_models.cpython-310.pyc,, -httpx/__pycache__/_multipart.cpython-310.pyc,, -httpx/__pycache__/_status_codes.cpython-310.pyc,, -httpx/__pycache__/_types.cpython-310.pyc,, -httpx/__pycache__/_urlparse.cpython-310.pyc,, -httpx/__pycache__/_urls.cpython-310.pyc,, -httpx/__pycache__/_utils.cpython-310.pyc,, -httpx/__version__.py,sha256=LoUyYeOXTieGzuP_64UL0wxdtxjuu_QbOvE7NOg-IqU,108 -httpx/_api.py,sha256=r_Zgs4jIpcPJLqK5dbbSayqo_iVMKFaxZCd-oOHxLEs,11743 -httpx/_auth.py,sha256=Yr3QwaUSK17rGYx-7j-FdicFIzz4Y9FFV-1F4-7RXX4,11891 -httpx/_client.py,sha256=xD-UG67-WMkeltAAOeGGj-cZ2RRTAm19sWRxlFY7_40,65714 -httpx/_config.py,sha256=pPp2U-wicfcKsF-KYRE1LYdt3e6ERGeIoXZ8Gjo3LWc,8547 -httpx/_content.py,sha256=LGGzrJTR3OvN4Mb1GVVNLXkXJH-6oKlwAttO9p5w_yg,8161 -httpx/_decoders.py,sha256=p0dX8I0NEHexs3UGp4SsZutiMhsXrrWl6-GnqVb0iKM,12041 -httpx/_exceptions.py,sha256=bxW7fxzgVMAdNTbwT0Vnq04gJDW1_gI_GFiQPuMyjL0,8527 -httpx/_main.py,sha256=Cg9GMabiTT_swaDfUgIRitSwxLRMSwUDOm7LdSGqlA4,15626 -httpx/_models.py,sha256=4__Guyv1gLxuZChwim8kfQNiIOcJ9acreFOSurvZfms,44700 -httpx/_multipart.py,sha256=KOHEZZl6oohg9mPaKyyu345qq1rJLg35TUG3YAzXB3Y,9843 -httpx/_status_codes.py,sha256=DYn-2ufBgMeXy5s8x3_TB7wjAuAAMewTakPrm5rXEsc,5639 -httpx/_transports/__init__.py,sha256=GbUoBSAOp7z-l-9j5YhMhR3DMIcn6FVLhj072O3Nnno,275 -httpx/_transports/__pycache__/__init__.cpython-310.pyc,, -httpx/_transports/__pycache__/asgi.cpython-310.pyc,, -httpx/_transports/__pycache__/base.cpython-310.pyc,, -httpx/_transports/__pycache__/default.cpython-310.pyc,, -httpx/_transports/__pycache__/mock.cpython-310.pyc,, -httpx/_transports/__pycache__/wsgi.cpython-310.pyc,, -httpx/_transports/asgi.py,sha256=HRfiDYMPt4wQH2gFgHZg4c-i3sblo6bL5GTqcET-xz8,5501 -httpx/_transports/base.py,sha256=kZS_VMbViYfF570pogUCJ1bulz-ybfL51Pqs9yktebU,2523 -httpx/_transports/default.py,sha256=AzeaRUyVwCccTyyNJexDf0n1dFfzzydpdIQgvw7PLnk,13983 -httpx/_transports/mock.py,sha256=PTo0d567RITXxGrki6kN7_67wwAxfwiMDcuXJiZCjEo,1232 -httpx/_transports/wsgi.py,sha256=NcPX3Xap_EwCFZWO_OaSyQNuInCYx1QMNbO8GAei6jY,4825 -httpx/_types.py,sha256=Jyh41GQq7AOev8IOWKDAg7zCbvHAfufmW5g_PiTtErY,2965 -httpx/_urlparse.py,sha256=ZAmH47ONfkxrrj-PPYhGeiHjb6AjKCS-ANWIN4OL_KY,18546 -httpx/_urls.py,sha256=dX99VR1DSOHpgo9Aq7PzYO4FKdxqKjwyNp8grf8dHN0,21550 -httpx/_utils.py,sha256=_TVeqAKvxJkKHdz7dFeb4s0LZqQXgeFkXSgfiHBK_1o,8285 -httpx/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/WHEEL deleted file mode 100644 index 21aaa72..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: hatchling 1.26.3 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/entry_points.txt b/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/entry_points.txt deleted file mode 100644 index 8ae9600..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -httpx = httpx:main diff --git a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md b/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md deleted file mode 100644 index ab79d16..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md +++ /dev/null @@ -1,12 +0,0 @@ -Copyright © 2019, [Encode OSS Ltd](https://www.encode.io/). -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__init__.py b/write-message/venv/lib/python3.10/site-packages/httpx/__init__.py deleted file mode 100644 index e9addde..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/__init__.py +++ /dev/null @@ -1,105 +0,0 @@ -from .__version__ import __description__, __title__, __version__ -from ._api import * -from ._auth import * -from ._client import * -from ._config import * -from ._content import * -from ._exceptions import * -from ._models import * -from ._status_codes import * -from ._transports import * -from ._types import * -from ._urls import * - -try: - from ._main import main -except ImportError: # pragma: no cover - - def main() -> None: # type: ignore - import sys - - print( - "The httpx command line client could not run because the required " - "dependencies were not installed.\nMake sure you've installed " - "everything with: pip install 'httpx[cli]'" - ) - sys.exit(1) - - -__all__ = [ - "__description__", - "__title__", - "__version__", - "ASGITransport", - "AsyncBaseTransport", - "AsyncByteStream", - "AsyncClient", - "AsyncHTTPTransport", - "Auth", - "BaseTransport", - "BasicAuth", - "ByteStream", - "Client", - "CloseError", - "codes", - "ConnectError", - "ConnectTimeout", - "CookieConflict", - "Cookies", - "create_ssl_context", - "DecodingError", - "delete", - "DigestAuth", - "get", - "head", - "Headers", - "HTTPError", - "HTTPStatusError", - "HTTPTransport", - "InvalidURL", - "Limits", - "LocalProtocolError", - "main", - "MockTransport", - "NetRCAuth", - "NetworkError", - "options", - "patch", - "PoolTimeout", - "post", - "ProtocolError", - "Proxy", - "ProxyError", - "put", - "QueryParams", - "ReadError", - "ReadTimeout", - "RemoteProtocolError", - "request", - "Request", - "RequestError", - "RequestNotRead", - "Response", - "ResponseNotRead", - "stream", - "StreamClosed", - "StreamConsumed", - "StreamError", - "SyncByteStream", - "Timeout", - "TimeoutException", - "TooManyRedirects", - "TransportError", - "UnsupportedProtocol", - "URL", - "USE_CLIENT_DEFAULT", - "WriteError", - "WriteTimeout", - "WSGITransport", -] - - -__locals = locals() -for __name in __all__: - if not __name.startswith("__"): - setattr(__locals[__name], "__module__", "httpx") # noqa diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index bea62f9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/__version__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/__version__.cpython-310.pyc deleted file mode 100644 index ddb088f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/__version__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_api.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_api.cpython-310.pyc deleted file mode 100644 index 933fa89..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_api.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_auth.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_auth.cpython-310.pyc deleted file mode 100644 index 8b9aa95..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_auth.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_client.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_client.cpython-310.pyc deleted file mode 100644 index b49063c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_client.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_config.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_config.cpython-310.pyc deleted file mode 100644 index 883d031..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_config.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_content.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_content.cpython-310.pyc deleted file mode 100644 index 95d3cae..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_content.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_decoders.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_decoders.cpython-310.pyc deleted file mode 100644 index 274748b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_decoders.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_exceptions.cpython-310.pyc deleted file mode 100644 index ece02d0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_main.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_main.cpython-310.pyc deleted file mode 100644 index 447358c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_main.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_models.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_models.cpython-310.pyc deleted file mode 100644 index d31146a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_models.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_multipart.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_multipart.cpython-310.pyc deleted file mode 100644 index 83d0597..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_multipart.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_status_codes.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_status_codes.cpython-310.pyc deleted file mode 100644 index 504420c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_status_codes.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_types.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_types.cpython-310.pyc deleted file mode 100644 index 6feeba5..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_types.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_urlparse.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_urlparse.cpython-310.pyc deleted file mode 100644 index 15d7ec9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_urlparse.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_urls.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_urls.cpython-310.pyc deleted file mode 100644 index 0d41510..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_urls.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_utils.cpython-310.pyc deleted file mode 100644 index eba0846..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/__pycache__/_utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/__version__.py b/write-message/venv/lib/python3.10/site-packages/httpx/__version__.py deleted file mode 100644 index 801bfac..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/__version__.py +++ /dev/null @@ -1,3 +0,0 @@ -__title__ = "httpx" -__description__ = "A next generation HTTP client, for Python 3." -__version__ = "0.28.1" diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_api.py b/write-message/venv/lib/python3.10/site-packages/httpx/_api.py deleted file mode 100644 index c3cda1e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_api.py +++ /dev/null @@ -1,438 +0,0 @@ -from __future__ import annotations - -import typing -from contextlib import contextmanager - -from ._client import Client -from ._config import DEFAULT_TIMEOUT_CONFIG -from ._models import Response -from ._types import ( - AuthTypes, - CookieTypes, - HeaderTypes, - ProxyTypes, - QueryParamTypes, - RequestContent, - RequestData, - RequestFiles, - TimeoutTypes, -) -from ._urls import URL - -if typing.TYPE_CHECKING: - import ssl # pragma: no cover - - -__all__ = [ - "delete", - "get", - "head", - "options", - "patch", - "post", - "put", - "request", - "stream", -] - - -def request( - method: str, - url: URL | str, - *, - params: QueryParamTypes | None = None, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - trust_env: bool = True, -) -> Response: - """ - Sends an HTTP request. - - **Parameters:** - - * **method** - HTTP method for the new `Request` object: `GET`, `OPTIONS`, - `HEAD`, `POST`, `PUT`, `PATCH`, or `DELETE`. - * **url** - URL for the new `Request` object. - * **params** - *(optional)* Query parameters to include in the URL, as a - string, dictionary, or sequence of two-tuples. - * **content** - *(optional)* Binary content to include in the body of the - request, as bytes or a byte iterator. - * **data** - *(optional)* Form data to include in the body of the request, - as a dictionary. - * **files** - *(optional)* A dictionary of upload files to include in the - body of the request. - * **json** - *(optional)* A JSON serializable object to include in the body - of the request. - * **headers** - *(optional)* Dictionary of HTTP headers to include in the - request. - * **cookies** - *(optional)* Dictionary of Cookie items to include in the - request. - * **auth** - *(optional)* An authentication class to use when sending the - request. - * **proxy** - *(optional)* A proxy URL where all the traffic should be routed. - * **timeout** - *(optional)* The timeout configuration to use when sending - the request. - * **follow_redirects** - *(optional)* Enables or disables HTTP redirects. - * **verify** - *(optional)* Either `True` to use an SSL context with the - default CA bundle, `False` to disable verification, or an instance of - `ssl.SSLContext` to use a custom context. - * **trust_env** - *(optional)* Enables or disables usage of environment - variables for configuration. - - **Returns:** `Response` - - Usage: - - ``` - >>> import httpx - >>> response = httpx.request('GET', 'https://httpbin.org/get') - >>> response - - ``` - """ - with Client( - cookies=cookies, - proxy=proxy, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) as client: - return client.request( - method=method, - url=url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - auth=auth, - follow_redirects=follow_redirects, - ) - - -@contextmanager -def stream( - method: str, - url: URL | str, - *, - params: QueryParamTypes | None = None, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - trust_env: bool = True, -) -> typing.Iterator[Response]: - """ - Alternative to `httpx.request()` that streams the response body - instead of loading it into memory at once. - - **Parameters**: See `httpx.request`. - - See also: [Streaming Responses][0] - - [0]: /quickstart#streaming-responses - """ - with Client( - cookies=cookies, - proxy=proxy, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) as client: - with client.stream( - method=method, - url=url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - auth=auth, - follow_redirects=follow_redirects, - ) as response: - yield response - - -def get( - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - trust_env: bool = True, -) -> Response: - """ - Sends a `GET` request. - - **Parameters**: See `httpx.request`. - - Note that the `data`, `files`, `json` and `content` parameters are not available - on this function, as `GET` requests should not include a request body. - """ - return request( - "GET", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - proxy=proxy, - follow_redirects=follow_redirects, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) - - -def options( - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - trust_env: bool = True, -) -> Response: - """ - Sends an `OPTIONS` request. - - **Parameters**: See `httpx.request`. - - Note that the `data`, `files`, `json` and `content` parameters are not available - on this function, as `OPTIONS` requests should not include a request body. - """ - return request( - "OPTIONS", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - proxy=proxy, - follow_redirects=follow_redirects, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) - - -def head( - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - trust_env: bool = True, -) -> Response: - """ - Sends a `HEAD` request. - - **Parameters**: See `httpx.request`. - - Note that the `data`, `files`, `json` and `content` parameters are not available - on this function, as `HEAD` requests should not include a request body. - """ - return request( - "HEAD", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - proxy=proxy, - follow_redirects=follow_redirects, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) - - -def post( - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - trust_env: bool = True, -) -> Response: - """ - Sends a `POST` request. - - **Parameters**: See `httpx.request`. - """ - return request( - "POST", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - proxy=proxy, - follow_redirects=follow_redirects, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) - - -def put( - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - trust_env: bool = True, -) -> Response: - """ - Sends a `PUT` request. - - **Parameters**: See `httpx.request`. - """ - return request( - "PUT", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - proxy=proxy, - follow_redirects=follow_redirects, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) - - -def patch( - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - follow_redirects: bool = False, - verify: ssl.SSLContext | str | bool = True, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - trust_env: bool = True, -) -> Response: - """ - Sends a `PATCH` request. - - **Parameters**: See `httpx.request`. - """ - return request( - "PATCH", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - proxy=proxy, - follow_redirects=follow_redirects, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) - - -def delete( - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | None = None, - proxy: ProxyTypes | None = None, - follow_redirects: bool = False, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - verify: ssl.SSLContext | str | bool = True, - trust_env: bool = True, -) -> Response: - """ - Sends a `DELETE` request. - - **Parameters**: See `httpx.request`. - - Note that the `data`, `files`, `json` and `content` parameters are not available - on this function, as `DELETE` requests should not include a request body. - """ - return request( - "DELETE", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - proxy=proxy, - follow_redirects=follow_redirects, - verify=verify, - timeout=timeout, - trust_env=trust_env, - ) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_auth.py b/write-message/venv/lib/python3.10/site-packages/httpx/_auth.py deleted file mode 100644 index b03971a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_auth.py +++ /dev/null @@ -1,348 +0,0 @@ -from __future__ import annotations - -import hashlib -import os -import re -import time -import typing -from base64 import b64encode -from urllib.request import parse_http_list - -from ._exceptions import ProtocolError -from ._models import Cookies, Request, Response -from ._utils import to_bytes, to_str, unquote - -if typing.TYPE_CHECKING: # pragma: no cover - from hashlib import _Hash - - -__all__ = ["Auth", "BasicAuth", "DigestAuth", "NetRCAuth"] - - -class Auth: - """ - Base class for all authentication schemes. - - To implement a custom authentication scheme, subclass `Auth` and override - the `.auth_flow()` method. - - If the authentication scheme does I/O such as disk access or network calls, or uses - synchronization primitives such as locks, you should override `.sync_auth_flow()` - and/or `.async_auth_flow()` instead of `.auth_flow()` to provide specialized - implementations that will be used by `Client` and `AsyncClient` respectively. - """ - - requires_request_body = False - requires_response_body = False - - def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]: - """ - Execute the authentication flow. - - To dispatch a request, `yield` it: - - ``` - yield request - ``` - - The client will `.send()` the response back into the flow generator. You can - access it like so: - - ``` - response = yield request - ``` - - A `return` (or reaching the end of the generator) will result in the - client returning the last response obtained from the server. - - You can dispatch as many requests as is necessary. - """ - yield request - - def sync_auth_flow( - self, request: Request - ) -> typing.Generator[Request, Response, None]: - """ - Execute the authentication flow synchronously. - - By default, this defers to `.auth_flow()`. You should override this method - when the authentication scheme does I/O and/or uses concurrency primitives. - """ - if self.requires_request_body: - request.read() - - flow = self.auth_flow(request) - request = next(flow) - - while True: - response = yield request - if self.requires_response_body: - response.read() - - try: - request = flow.send(response) - except StopIteration: - break - - async def async_auth_flow( - self, request: Request - ) -> typing.AsyncGenerator[Request, Response]: - """ - Execute the authentication flow asynchronously. - - By default, this defers to `.auth_flow()`. You should override this method - when the authentication scheme does I/O and/or uses concurrency primitives. - """ - if self.requires_request_body: - await request.aread() - - flow = self.auth_flow(request) - request = next(flow) - - while True: - response = yield request - if self.requires_response_body: - await response.aread() - - try: - request = flow.send(response) - except StopIteration: - break - - -class FunctionAuth(Auth): - """ - Allows the 'auth' argument to be passed as a simple callable function, - that takes the request, and returns a new, modified request. - """ - - def __init__(self, func: typing.Callable[[Request], Request]) -> None: - self._func = func - - def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]: - yield self._func(request) - - -class BasicAuth(Auth): - """ - Allows the 'auth' argument to be passed as a (username, password) pair, - and uses HTTP Basic authentication. - """ - - def __init__(self, username: str | bytes, password: str | bytes) -> None: - self._auth_header = self._build_auth_header(username, password) - - def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]: - request.headers["Authorization"] = self._auth_header - yield request - - def _build_auth_header(self, username: str | bytes, password: str | bytes) -> str: - userpass = b":".join((to_bytes(username), to_bytes(password))) - token = b64encode(userpass).decode() - return f"Basic {token}" - - -class NetRCAuth(Auth): - """ - Use a 'netrc' file to lookup basic auth credentials based on the url host. - """ - - def __init__(self, file: str | None = None) -> None: - # Lazily import 'netrc'. - # There's no need for us to load this module unless 'NetRCAuth' is being used. - import netrc - - self._netrc_info = netrc.netrc(file) - - def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]: - auth_info = self._netrc_info.authenticators(request.url.host) - if auth_info is None or not auth_info[2]: - # The netrc file did not have authentication credentials for this host. - yield request - else: - # Build a basic auth header with credentials from the netrc file. - request.headers["Authorization"] = self._build_auth_header( - username=auth_info[0], password=auth_info[2] - ) - yield request - - def _build_auth_header(self, username: str | bytes, password: str | bytes) -> str: - userpass = b":".join((to_bytes(username), to_bytes(password))) - token = b64encode(userpass).decode() - return f"Basic {token}" - - -class DigestAuth(Auth): - _ALGORITHM_TO_HASH_FUNCTION: dict[str, typing.Callable[[bytes], _Hash]] = { - "MD5": hashlib.md5, - "MD5-SESS": hashlib.md5, - "SHA": hashlib.sha1, - "SHA-SESS": hashlib.sha1, - "SHA-256": hashlib.sha256, - "SHA-256-SESS": hashlib.sha256, - "SHA-512": hashlib.sha512, - "SHA-512-SESS": hashlib.sha512, - } - - def __init__(self, username: str | bytes, password: str | bytes) -> None: - self._username = to_bytes(username) - self._password = to_bytes(password) - self._last_challenge: _DigestAuthChallenge | None = None - self._nonce_count = 1 - - def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]: - if self._last_challenge: - request.headers["Authorization"] = self._build_auth_header( - request, self._last_challenge - ) - - response = yield request - - if response.status_code != 401 or "www-authenticate" not in response.headers: - # If the response is not a 401 then we don't - # need to build an authenticated request. - return - - for auth_header in response.headers.get_list("www-authenticate"): - if auth_header.lower().startswith("digest "): - break - else: - # If the response does not include a 'WWW-Authenticate: Digest ...' - # header, then we don't need to build an authenticated request. - return - - self._last_challenge = self._parse_challenge(request, response, auth_header) - self._nonce_count = 1 - - request.headers["Authorization"] = self._build_auth_header( - request, self._last_challenge - ) - if response.cookies: - Cookies(response.cookies).set_cookie_header(request=request) - yield request - - def _parse_challenge( - self, request: Request, response: Response, auth_header: str - ) -> _DigestAuthChallenge: - """ - Returns a challenge from a Digest WWW-Authenticate header. - These take the form of: - `Digest realm="realm@host.com",qop="auth,auth-int",nonce="abc",opaque="xyz"` - """ - scheme, _, fields = auth_header.partition(" ") - - # This method should only ever have been called with a Digest auth header. - assert scheme.lower() == "digest" - - header_dict: dict[str, str] = {} - for field in parse_http_list(fields): - key, value = field.strip().split("=", 1) - header_dict[key] = unquote(value) - - try: - realm = header_dict["realm"].encode() - nonce = header_dict["nonce"].encode() - algorithm = header_dict.get("algorithm", "MD5") - opaque = header_dict["opaque"].encode() if "opaque" in header_dict else None - qop = header_dict["qop"].encode() if "qop" in header_dict else None - return _DigestAuthChallenge( - realm=realm, nonce=nonce, algorithm=algorithm, opaque=opaque, qop=qop - ) - except KeyError as exc: - message = "Malformed Digest WWW-Authenticate header" - raise ProtocolError(message, request=request) from exc - - def _build_auth_header( - self, request: Request, challenge: _DigestAuthChallenge - ) -> str: - hash_func = self._ALGORITHM_TO_HASH_FUNCTION[challenge.algorithm.upper()] - - def digest(data: bytes) -> bytes: - return hash_func(data).hexdigest().encode() - - A1 = b":".join((self._username, challenge.realm, self._password)) - - path = request.url.raw_path - A2 = b":".join((request.method.encode(), path)) - # TODO: implement auth-int - HA2 = digest(A2) - - nc_value = b"%08x" % self._nonce_count - cnonce = self._get_client_nonce(self._nonce_count, challenge.nonce) - self._nonce_count += 1 - - HA1 = digest(A1) - if challenge.algorithm.lower().endswith("-sess"): - HA1 = digest(b":".join((HA1, challenge.nonce, cnonce))) - - qop = self._resolve_qop(challenge.qop, request=request) - if qop is None: - # Following RFC 2069 - digest_data = [HA1, challenge.nonce, HA2] - else: - # Following RFC 2617/7616 - digest_data = [HA1, challenge.nonce, nc_value, cnonce, qop, HA2] - - format_args = { - "username": self._username, - "realm": challenge.realm, - "nonce": challenge.nonce, - "uri": path, - "response": digest(b":".join(digest_data)), - "algorithm": challenge.algorithm.encode(), - } - if challenge.opaque: - format_args["opaque"] = challenge.opaque - if qop: - format_args["qop"] = b"auth" - format_args["nc"] = nc_value - format_args["cnonce"] = cnonce - - return "Digest " + self._get_header_value(format_args) - - def _get_client_nonce(self, nonce_count: int, nonce: bytes) -> bytes: - s = str(nonce_count).encode() - s += nonce - s += time.ctime().encode() - s += os.urandom(8) - - return hashlib.sha1(s).hexdigest()[:16].encode() - - def _get_header_value(self, header_fields: dict[str, bytes]) -> str: - NON_QUOTED_FIELDS = ("algorithm", "qop", "nc") - QUOTED_TEMPLATE = '{}="{}"' - NON_QUOTED_TEMPLATE = "{}={}" - - header_value = "" - for i, (field, value) in enumerate(header_fields.items()): - if i > 0: - header_value += ", " - template = ( - QUOTED_TEMPLATE - if field not in NON_QUOTED_FIELDS - else NON_QUOTED_TEMPLATE - ) - header_value += template.format(field, to_str(value)) - - return header_value - - def _resolve_qop(self, qop: bytes | None, request: Request) -> bytes | None: - if qop is None: - return None - qops = re.split(b", ?", qop) - if b"auth" in qops: - return b"auth" - - if qops == [b"auth-int"]: - raise NotImplementedError("Digest auth-int support is not yet implemented") - - message = f'Unexpected qop value "{qop!r}" in digest auth' - raise ProtocolError(message, request=request) - - -class _DigestAuthChallenge(typing.NamedTuple): - realm: bytes - nonce: bytes - algorithm: str - opaque: bytes | None - qop: bytes | None diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_client.py b/write-message/venv/lib/python3.10/site-packages/httpx/_client.py deleted file mode 100644 index 2249231..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_client.py +++ /dev/null @@ -1,2019 +0,0 @@ -from __future__ import annotations - -import datetime -import enum -import logging -import time -import typing -import warnings -from contextlib import asynccontextmanager, contextmanager -from types import TracebackType - -from .__version__ import __version__ -from ._auth import Auth, BasicAuth, FunctionAuth -from ._config import ( - DEFAULT_LIMITS, - DEFAULT_MAX_REDIRECTS, - DEFAULT_TIMEOUT_CONFIG, - Limits, - Proxy, - Timeout, -) -from ._decoders import SUPPORTED_DECODERS -from ._exceptions import ( - InvalidURL, - RemoteProtocolError, - TooManyRedirects, - request_context, -) -from ._models import Cookies, Headers, Request, Response -from ._status_codes import codes -from ._transports.base import AsyncBaseTransport, BaseTransport -from ._transports.default import AsyncHTTPTransport, HTTPTransport -from ._types import ( - AsyncByteStream, - AuthTypes, - CertTypes, - CookieTypes, - HeaderTypes, - ProxyTypes, - QueryParamTypes, - RequestContent, - RequestData, - RequestExtensions, - RequestFiles, - SyncByteStream, - TimeoutTypes, -) -from ._urls import URL, QueryParams -from ._utils import URLPattern, get_environment_proxies - -if typing.TYPE_CHECKING: - import ssl # pragma: no cover - -__all__ = ["USE_CLIENT_DEFAULT", "AsyncClient", "Client"] - -# The type annotation for @classmethod and context managers here follows PEP 484 -# https://www.python.org/dev/peps/pep-0484/#annotating-instance-and-class-methods -T = typing.TypeVar("T", bound="Client") -U = typing.TypeVar("U", bound="AsyncClient") - - -def _is_https_redirect(url: URL, location: URL) -> bool: - """ - Return 'True' if 'location' is a HTTPS upgrade of 'url' - """ - if url.host != location.host: - return False - - return ( - url.scheme == "http" - and _port_or_default(url) == 80 - and location.scheme == "https" - and _port_or_default(location) == 443 - ) - - -def _port_or_default(url: URL) -> int | None: - if url.port is not None: - return url.port - return {"http": 80, "https": 443}.get(url.scheme) - - -def _same_origin(url: URL, other: URL) -> bool: - """ - Return 'True' if the given URLs share the same origin. - """ - return ( - url.scheme == other.scheme - and url.host == other.host - and _port_or_default(url) == _port_or_default(other) - ) - - -class UseClientDefault: - """ - For some parameters such as `auth=...` and `timeout=...` we need to be able - to indicate the default "unset" state, in a way that is distinctly different - to using `None`. - - The default "unset" state indicates that whatever default is set on the - client should be used. This is different to setting `None`, which - explicitly disables the parameter, possibly overriding a client default. - - For example we use `timeout=USE_CLIENT_DEFAULT` in the `request()` signature. - Omitting the `timeout` parameter will send a request using whatever default - timeout has been configured on the client. Including `timeout=None` will - ensure no timeout is used. - - Note that user code shouldn't need to use the `USE_CLIENT_DEFAULT` constant, - but it is used internally when a parameter is not included. - """ - - -USE_CLIENT_DEFAULT = UseClientDefault() - - -logger = logging.getLogger("httpx") - -USER_AGENT = f"python-httpx/{__version__}" -ACCEPT_ENCODING = ", ".join( - [key for key in SUPPORTED_DECODERS.keys() if key != "identity"] -) - - -class ClientState(enum.Enum): - # UNOPENED: - # The client has been instantiated, but has not been used to send a request, - # or been opened by entering the context of a `with` block. - UNOPENED = 1 - # OPENED: - # The client has either sent a request, or is within a `with` block. - OPENED = 2 - # CLOSED: - # The client has either exited the `with` block, or `close()` has - # been called explicitly. - CLOSED = 3 - - -class BoundSyncStream(SyncByteStream): - """ - A byte stream that is bound to a given response instance, and that - ensures the `response.elapsed` is set once the response is closed. - """ - - def __init__( - self, stream: SyncByteStream, response: Response, start: float - ) -> None: - self._stream = stream - self._response = response - self._start = start - - def __iter__(self) -> typing.Iterator[bytes]: - for chunk in self._stream: - yield chunk - - def close(self) -> None: - elapsed = time.perf_counter() - self._start - self._response.elapsed = datetime.timedelta(seconds=elapsed) - self._stream.close() - - -class BoundAsyncStream(AsyncByteStream): - """ - An async byte stream that is bound to a given response instance, and that - ensures the `response.elapsed` is set once the response is closed. - """ - - def __init__( - self, stream: AsyncByteStream, response: Response, start: float - ) -> None: - self._stream = stream - self._response = response - self._start = start - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - async for chunk in self._stream: - yield chunk - - async def aclose(self) -> None: - elapsed = time.perf_counter() - self._start - self._response.elapsed = datetime.timedelta(seconds=elapsed) - await self._stream.aclose() - - -EventHook = typing.Callable[..., typing.Any] - - -class BaseClient: - def __init__( - self, - *, - auth: AuthTypes | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - follow_redirects: bool = False, - max_redirects: int = DEFAULT_MAX_REDIRECTS, - event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None, - base_url: URL | str = "", - trust_env: bool = True, - default_encoding: str | typing.Callable[[bytes], str] = "utf-8", - ) -> None: - event_hooks = {} if event_hooks is None else event_hooks - - self._base_url = self._enforce_trailing_slash(URL(base_url)) - - self._auth = self._build_auth(auth) - self._params = QueryParams(params) - self.headers = Headers(headers) - self._cookies = Cookies(cookies) - self._timeout = Timeout(timeout) - self.follow_redirects = follow_redirects - self.max_redirects = max_redirects - self._event_hooks = { - "request": list(event_hooks.get("request", [])), - "response": list(event_hooks.get("response", [])), - } - self._trust_env = trust_env - self._default_encoding = default_encoding - self._state = ClientState.UNOPENED - - @property - def is_closed(self) -> bool: - """ - Check if the client being closed - """ - return self._state == ClientState.CLOSED - - @property - def trust_env(self) -> bool: - return self._trust_env - - def _enforce_trailing_slash(self, url: URL) -> URL: - if url.raw_path.endswith(b"/"): - return url - return url.copy_with(raw_path=url.raw_path + b"/") - - def _get_proxy_map( - self, proxy: ProxyTypes | None, allow_env_proxies: bool - ) -> dict[str, Proxy | None]: - if proxy is None: - if allow_env_proxies: - return { - key: None if url is None else Proxy(url=url) - for key, url in get_environment_proxies().items() - } - return {} - else: - proxy = Proxy(url=proxy) if isinstance(proxy, (str, URL)) else proxy - return {"all://": proxy} - - @property - def timeout(self) -> Timeout: - return self._timeout - - @timeout.setter - def timeout(self, timeout: TimeoutTypes) -> None: - self._timeout = Timeout(timeout) - - @property - def event_hooks(self) -> dict[str, list[EventHook]]: - return self._event_hooks - - @event_hooks.setter - def event_hooks(self, event_hooks: dict[str, list[EventHook]]) -> None: - self._event_hooks = { - "request": list(event_hooks.get("request", [])), - "response": list(event_hooks.get("response", [])), - } - - @property - def auth(self) -> Auth | None: - """ - Authentication class used when none is passed at the request-level. - - See also [Authentication][0]. - - [0]: /quickstart/#authentication - """ - return self._auth - - @auth.setter - def auth(self, auth: AuthTypes) -> None: - self._auth = self._build_auth(auth) - - @property - def base_url(self) -> URL: - """ - Base URL to use when sending requests with relative URLs. - """ - return self._base_url - - @base_url.setter - def base_url(self, url: URL | str) -> None: - self._base_url = self._enforce_trailing_slash(URL(url)) - - @property - def headers(self) -> Headers: - """ - HTTP headers to include when sending requests. - """ - return self._headers - - @headers.setter - def headers(self, headers: HeaderTypes) -> None: - client_headers = Headers( - { - b"Accept": b"*/*", - b"Accept-Encoding": ACCEPT_ENCODING.encode("ascii"), - b"Connection": b"keep-alive", - b"User-Agent": USER_AGENT.encode("ascii"), - } - ) - client_headers.update(headers) - self._headers = client_headers - - @property - def cookies(self) -> Cookies: - """ - Cookie values to include when sending requests. - """ - return self._cookies - - @cookies.setter - def cookies(self, cookies: CookieTypes) -> None: - self._cookies = Cookies(cookies) - - @property - def params(self) -> QueryParams: - """ - Query parameters to include in the URL when sending requests. - """ - return self._params - - @params.setter - def params(self, params: QueryParamTypes) -> None: - self._params = QueryParams(params) - - def build_request( - self, - method: str, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Request: - """ - Build and return a request instance. - - * The `params`, `headers` and `cookies` arguments - are merged with any values set on the client. - * The `url` argument is merged with any `base_url` set on the client. - - See also: [Request instances][0] - - [0]: /advanced/clients/#request-instances - """ - url = self._merge_url(url) - headers = self._merge_headers(headers) - cookies = self._merge_cookies(cookies) - params = self._merge_queryparams(params) - extensions = {} if extensions is None else extensions - if "timeout" not in extensions: - timeout = ( - self.timeout - if isinstance(timeout, UseClientDefault) - else Timeout(timeout) - ) - extensions = dict(**extensions, timeout=timeout.as_dict()) - return Request( - method, - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - extensions=extensions, - ) - - def _merge_url(self, url: URL | str) -> URL: - """ - Merge a URL argument together with any 'base_url' on the client, - to create the URL used for the outgoing request. - """ - merge_url = URL(url) - if merge_url.is_relative_url: - # To merge URLs we always append to the base URL. To get this - # behaviour correct we always ensure the base URL ends in a '/' - # separator, and strip any leading '/' from the merge URL. - # - # So, eg... - # - # >>> client = Client(base_url="https://www.example.com/subpath") - # >>> client.base_url - # URL('https://www.example.com/subpath/') - # >>> client.build_request("GET", "/path").url - # URL('https://www.example.com/subpath/path') - merge_raw_path = self.base_url.raw_path + merge_url.raw_path.lstrip(b"/") - return self.base_url.copy_with(raw_path=merge_raw_path) - return merge_url - - def _merge_cookies(self, cookies: CookieTypes | None = None) -> CookieTypes | None: - """ - Merge a cookies argument together with any cookies on the client, - to create the cookies used for the outgoing request. - """ - if cookies or self.cookies: - merged_cookies = Cookies(self.cookies) - merged_cookies.update(cookies) - return merged_cookies - return cookies - - def _merge_headers(self, headers: HeaderTypes | None = None) -> HeaderTypes | None: - """ - Merge a headers argument together with any headers on the client, - to create the headers used for the outgoing request. - """ - merged_headers = Headers(self.headers) - merged_headers.update(headers) - return merged_headers - - def _merge_queryparams( - self, params: QueryParamTypes | None = None - ) -> QueryParamTypes | None: - """ - Merge a queryparams argument together with any queryparams on the client, - to create the queryparams used for the outgoing request. - """ - if params or self.params: - merged_queryparams = QueryParams(self.params) - return merged_queryparams.merge(params) - return params - - def _build_auth(self, auth: AuthTypes | None) -> Auth | None: - if auth is None: - return None - elif isinstance(auth, tuple): - return BasicAuth(username=auth[0], password=auth[1]) - elif isinstance(auth, Auth): - return auth - elif callable(auth): - return FunctionAuth(func=auth) - else: - raise TypeError(f'Invalid "auth" argument: {auth!r}') - - def _build_request_auth( - self, - request: Request, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - ) -> Auth: - auth = ( - self._auth if isinstance(auth, UseClientDefault) else self._build_auth(auth) - ) - - if auth is not None: - return auth - - username, password = request.url.username, request.url.password - if username or password: - return BasicAuth(username=username, password=password) - - return Auth() - - def _build_redirect_request(self, request: Request, response: Response) -> Request: - """ - Given a request and a redirect response, return a new request that - should be used to effect the redirect. - """ - method = self._redirect_method(request, response) - url = self._redirect_url(request, response) - headers = self._redirect_headers(request, url, method) - stream = self._redirect_stream(request, method) - cookies = Cookies(self.cookies) - return Request( - method=method, - url=url, - headers=headers, - cookies=cookies, - stream=stream, - extensions=request.extensions, - ) - - def _redirect_method(self, request: Request, response: Response) -> str: - """ - When being redirected we may want to change the method of the request - based on certain specs or browser behavior. - """ - method = request.method - - # https://tools.ietf.org/html/rfc7231#section-6.4.4 - if response.status_code == codes.SEE_OTHER and method != "HEAD": - method = "GET" - - # Do what the browsers do, despite standards... - # Turn 302s into GETs. - if response.status_code == codes.FOUND and method != "HEAD": - method = "GET" - - # If a POST is responded to with a 301, turn it into a GET. - # This bizarre behaviour is explained in 'requests' issue 1704. - if response.status_code == codes.MOVED_PERMANENTLY and method == "POST": - method = "GET" - - return method - - def _redirect_url(self, request: Request, response: Response) -> URL: - """ - Return the URL for the redirect to follow. - """ - location = response.headers["Location"] - - try: - url = URL(location) - except InvalidURL as exc: - raise RemoteProtocolError( - f"Invalid URL in location header: {exc}.", request=request - ) from None - - # Handle malformed 'Location' headers that are "absolute" form, have no host. - # See: https://github.com/encode/httpx/issues/771 - if url.scheme and not url.host: - url = url.copy_with(host=request.url.host) - - # Facilitate relative 'Location' headers, as allowed by RFC 7231. - # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') - if url.is_relative_url: - url = request.url.join(url) - - # Attach previous fragment if needed (RFC 7231 7.1.2) - if request.url.fragment and not url.fragment: - url = url.copy_with(fragment=request.url.fragment) - - return url - - def _redirect_headers(self, request: Request, url: URL, method: str) -> Headers: - """ - Return the headers that should be used for the redirect request. - """ - headers = Headers(request.headers) - - if not _same_origin(url, request.url): - if not _is_https_redirect(request.url, url): - # Strip Authorization headers when responses are redirected - # away from the origin. (Except for direct HTTP to HTTPS redirects.) - headers.pop("Authorization", None) - - # Update the Host header. - headers["Host"] = url.netloc.decode("ascii") - - if method != request.method and method == "GET": - # If we've switch to a 'GET' request, then strip any headers which - # are only relevant to the request body. - headers.pop("Content-Length", None) - headers.pop("Transfer-Encoding", None) - - # We should use the client cookie store to determine any cookie header, - # rather than whatever was on the original outgoing request. - headers.pop("Cookie", None) - - return headers - - def _redirect_stream( - self, request: Request, method: str - ) -> SyncByteStream | AsyncByteStream | None: - """ - Return the body that should be used for the redirect request. - """ - if method != request.method and method == "GET": - return None - - return request.stream - - def _set_timeout(self, request: Request) -> None: - if "timeout" not in request.extensions: - timeout = ( - self.timeout - if isinstance(self.timeout, UseClientDefault) - else Timeout(self.timeout) - ) - request.extensions = dict(**request.extensions, timeout=timeout.as_dict()) - - -class Client(BaseClient): - """ - An HTTP client, with connection pooling, HTTP/2, redirects, cookie persistence, etc. - - It can be shared between threads. - - Usage: - - ```python - >>> client = httpx.Client() - >>> response = client.get('https://example.org') - ``` - - **Parameters:** - - * **auth** - *(optional)* An authentication class to use when sending - requests. - * **params** - *(optional)* Query parameters to include in request URLs, as - a string, dictionary, or sequence of two-tuples. - * **headers** - *(optional)* Dictionary of HTTP headers to include when - sending requests. - * **cookies** - *(optional)* Dictionary of Cookie items to include when - sending requests. - * **verify** - *(optional)* Either `True` to use an SSL context with the - default CA bundle, `False` to disable verification, or an instance of - `ssl.SSLContext` to use a custom context. - * **http2** - *(optional)* A boolean indicating if HTTP/2 support should be - enabled. Defaults to `False`. - * **proxy** - *(optional)* A proxy URL where all the traffic should be routed. - * **timeout** - *(optional)* The timeout configuration to use when sending - requests. - * **limits** - *(optional)* The limits configuration to use. - * **max_redirects** - *(optional)* The maximum number of redirect responses - that should be followed. - * **base_url** - *(optional)* A URL to use as the base when building - request URLs. - * **transport** - *(optional)* A transport class to use for sending requests - over the network. - * **trust_env** - *(optional)* Enables or disables usage of environment - variables for configuration. - * **default_encoding** - *(optional)* The default encoding to use for decoding - response text, if no charset information is included in a response Content-Type - header. Set to a callable for automatic character set detection. Default: "utf-8". - """ - - def __init__( - self, - *, - auth: AuthTypes | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, - http1: bool = True, - http2: bool = False, - proxy: ProxyTypes | None = None, - mounts: None | (typing.Mapping[str, BaseTransport | None]) = None, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - follow_redirects: bool = False, - limits: Limits = DEFAULT_LIMITS, - max_redirects: int = DEFAULT_MAX_REDIRECTS, - event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None, - base_url: URL | str = "", - transport: BaseTransport | None = None, - default_encoding: str | typing.Callable[[bytes], str] = "utf-8", - ) -> None: - super().__init__( - auth=auth, - params=params, - headers=headers, - cookies=cookies, - timeout=timeout, - follow_redirects=follow_redirects, - max_redirects=max_redirects, - event_hooks=event_hooks, - base_url=base_url, - trust_env=trust_env, - default_encoding=default_encoding, - ) - - if http2: - try: - import h2 # noqa - except ImportError: # pragma: no cover - raise ImportError( - "Using http2=True, but the 'h2' package is not installed. " - "Make sure to install httpx using `pip install httpx[http2]`." - ) from None - - allow_env_proxies = trust_env and transport is None - proxy_map = self._get_proxy_map(proxy, allow_env_proxies) - - self._transport = self._init_transport( - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - transport=transport, - ) - self._mounts: dict[URLPattern, BaseTransport | None] = { - URLPattern(key): None - if proxy is None - else self._init_proxy_transport( - proxy, - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - ) - for key, proxy in proxy_map.items() - } - if mounts is not None: - self._mounts.update( - {URLPattern(key): transport for key, transport in mounts.items()} - ) - - self._mounts = dict(sorted(self._mounts.items())) - - def _init_transport( - self, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, - http1: bool = True, - http2: bool = False, - limits: Limits = DEFAULT_LIMITS, - transport: BaseTransport | None = None, - ) -> BaseTransport: - if transport is not None: - return transport - - return HTTPTransport( - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - ) - - def _init_proxy_transport( - self, - proxy: Proxy, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, - http1: bool = True, - http2: bool = False, - limits: Limits = DEFAULT_LIMITS, - ) -> BaseTransport: - return HTTPTransport( - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - proxy=proxy, - ) - - def _transport_for_url(self, url: URL) -> BaseTransport: - """ - Returns the transport instance that should be used for a given URL. - This will either be the standard connection pool, or a proxy. - """ - for pattern, transport in self._mounts.items(): - if pattern.matches(url): - return self._transport if transport is None else transport - - return self._transport - - def request( - self, - method: str, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Build and send a request. - - Equivalent to: - - ```python - request = client.build_request(...) - response = client.send(request, ...) - ``` - - See `Client.build_request()`, `Client.send()` and - [Merging of configuration][0] for how the various parameters - are merged with client-level configuration. - - [0]: /advanced/clients/#merging-of-configuration - """ - if cookies is not None: - message = ( - "Setting per-request cookies=<...> is being deprecated, because " - "the expected behaviour on cookie persistence is ambiguous. Set " - "cookies directly on the client instance instead." - ) - warnings.warn(message, DeprecationWarning, stacklevel=2) - - request = self.build_request( - method=method, - url=url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - timeout=timeout, - extensions=extensions, - ) - return self.send(request, auth=auth, follow_redirects=follow_redirects) - - @contextmanager - def stream( - self, - method: str, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> typing.Iterator[Response]: - """ - Alternative to `httpx.request()` that streams the response body - instead of loading it into memory at once. - - **Parameters**: See `httpx.request`. - - See also: [Streaming Responses][0] - - [0]: /quickstart#streaming-responses - """ - request = self.build_request( - method=method, - url=url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - timeout=timeout, - extensions=extensions, - ) - response = self.send( - request=request, - auth=auth, - follow_redirects=follow_redirects, - stream=True, - ) - try: - yield response - finally: - response.close() - - def send( - self, - request: Request, - *, - stream: bool = False, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - ) -> Response: - """ - Send a request. - - The request is sent as-is, unmodified. - - Typically you'll want to build one with `Client.build_request()` - so that any client-level configuration is merged into the request, - but passing an explicit `httpx.Request()` is supported as well. - - See also: [Request instances][0] - - [0]: /advanced/clients/#request-instances - """ - if self._state == ClientState.CLOSED: - raise RuntimeError("Cannot send a request, as the client has been closed.") - - self._state = ClientState.OPENED - follow_redirects = ( - self.follow_redirects - if isinstance(follow_redirects, UseClientDefault) - else follow_redirects - ) - - self._set_timeout(request) - - auth = self._build_request_auth(request, auth) - - response = self._send_handling_auth( - request, - auth=auth, - follow_redirects=follow_redirects, - history=[], - ) - try: - if not stream: - response.read() - - return response - - except BaseException as exc: - response.close() - raise exc - - def _send_handling_auth( - self, - request: Request, - auth: Auth, - follow_redirects: bool, - history: list[Response], - ) -> Response: - auth_flow = auth.sync_auth_flow(request) - try: - request = next(auth_flow) - - while True: - response = self._send_handling_redirects( - request, - follow_redirects=follow_redirects, - history=history, - ) - try: - try: - next_request = auth_flow.send(response) - except StopIteration: - return response - - response.history = list(history) - response.read() - request = next_request - history.append(response) - - except BaseException as exc: - response.close() - raise exc - finally: - auth_flow.close() - - def _send_handling_redirects( - self, - request: Request, - follow_redirects: bool, - history: list[Response], - ) -> Response: - while True: - if len(history) > self.max_redirects: - raise TooManyRedirects( - "Exceeded maximum allowed redirects.", request=request - ) - - for hook in self._event_hooks["request"]: - hook(request) - - response = self._send_single_request(request) - try: - for hook in self._event_hooks["response"]: - hook(response) - response.history = list(history) - - if not response.has_redirect_location: - return response - - request = self._build_redirect_request(request, response) - history = history + [response] - - if follow_redirects: - response.read() - else: - response.next_request = request - return response - - except BaseException as exc: - response.close() - raise exc - - def _send_single_request(self, request: Request) -> Response: - """ - Sends a single request, without handling any redirections. - """ - transport = self._transport_for_url(request.url) - start = time.perf_counter() - - if not isinstance(request.stream, SyncByteStream): - raise RuntimeError( - "Attempted to send an async request with a sync Client instance." - ) - - with request_context(request=request): - response = transport.handle_request(request) - - assert isinstance(response.stream, SyncByteStream) - - response.request = request - response.stream = BoundSyncStream( - response.stream, response=response, start=start - ) - self.cookies.extract_cookies(response) - response.default_encoding = self._default_encoding - - logger.info( - 'HTTP Request: %s %s "%s %d %s"', - request.method, - request.url, - response.http_version, - response.status_code, - response.reason_phrase, - ) - - return response - - def get( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `GET` request. - - **Parameters**: See `httpx.request`. - """ - return self.request( - "GET", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - def options( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send an `OPTIONS` request. - - **Parameters**: See `httpx.request`. - """ - return self.request( - "OPTIONS", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - def head( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `HEAD` request. - - **Parameters**: See `httpx.request`. - """ - return self.request( - "HEAD", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - def post( - self, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `POST` request. - - **Parameters**: See `httpx.request`. - """ - return self.request( - "POST", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - def put( - self, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `PUT` request. - - **Parameters**: See `httpx.request`. - """ - return self.request( - "PUT", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - def patch( - self, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `PATCH` request. - - **Parameters**: See `httpx.request`. - """ - return self.request( - "PATCH", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - def delete( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `DELETE` request. - - **Parameters**: See `httpx.request`. - """ - return self.request( - "DELETE", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - def close(self) -> None: - """ - Close transport and proxies. - """ - if self._state != ClientState.CLOSED: - self._state = ClientState.CLOSED - - self._transport.close() - for transport in self._mounts.values(): - if transport is not None: - transport.close() - - def __enter__(self: T) -> T: - if self._state != ClientState.UNOPENED: - msg = { - ClientState.OPENED: "Cannot open a client instance more than once.", - ClientState.CLOSED: ( - "Cannot reopen a client instance, once it has been closed." - ), - }[self._state] - raise RuntimeError(msg) - - self._state = ClientState.OPENED - - self._transport.__enter__() - for transport in self._mounts.values(): - if transport is not None: - transport.__enter__() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: TracebackType | None = None, - ) -> None: - self._state = ClientState.CLOSED - - self._transport.__exit__(exc_type, exc_value, traceback) - for transport in self._mounts.values(): - if transport is not None: - transport.__exit__(exc_type, exc_value, traceback) - - -class AsyncClient(BaseClient): - """ - An asynchronous HTTP client, with connection pooling, HTTP/2, redirects, - cookie persistence, etc. - - It can be shared between tasks. - - Usage: - - ```python - >>> async with httpx.AsyncClient() as client: - >>> response = await client.get('https://example.org') - ``` - - **Parameters:** - - * **auth** - *(optional)* An authentication class to use when sending - requests. - * **params** - *(optional)* Query parameters to include in request URLs, as - a string, dictionary, or sequence of two-tuples. - * **headers** - *(optional)* Dictionary of HTTP headers to include when - sending requests. - * **cookies** - *(optional)* Dictionary of Cookie items to include when - sending requests. - * **verify** - *(optional)* Either `True` to use an SSL context with the - default CA bundle, `False` to disable verification, or an instance of - `ssl.SSLContext` to use a custom context. - * **http2** - *(optional)* A boolean indicating if HTTP/2 support should be - enabled. Defaults to `False`. - * **proxy** - *(optional)* A proxy URL where all the traffic should be routed. - * **timeout** - *(optional)* The timeout configuration to use when sending - requests. - * **limits** - *(optional)* The limits configuration to use. - * **max_redirects** - *(optional)* The maximum number of redirect responses - that should be followed. - * **base_url** - *(optional)* A URL to use as the base when building - request URLs. - * **transport** - *(optional)* A transport class to use for sending requests - over the network. - * **trust_env** - *(optional)* Enables or disables usage of environment - variables for configuration. - * **default_encoding** - *(optional)* The default encoding to use for decoding - response text, if no charset information is included in a response Content-Type - header. Set to a callable for automatic character set detection. Default: "utf-8". - """ - - def __init__( - self, - *, - auth: AuthTypes | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - http1: bool = True, - http2: bool = False, - proxy: ProxyTypes | None = None, - mounts: None | (typing.Mapping[str, AsyncBaseTransport | None]) = None, - timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG, - follow_redirects: bool = False, - limits: Limits = DEFAULT_LIMITS, - max_redirects: int = DEFAULT_MAX_REDIRECTS, - event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None, - base_url: URL | str = "", - transport: AsyncBaseTransport | None = None, - trust_env: bool = True, - default_encoding: str | typing.Callable[[bytes], str] = "utf-8", - ) -> None: - super().__init__( - auth=auth, - params=params, - headers=headers, - cookies=cookies, - timeout=timeout, - follow_redirects=follow_redirects, - max_redirects=max_redirects, - event_hooks=event_hooks, - base_url=base_url, - trust_env=trust_env, - default_encoding=default_encoding, - ) - - if http2: - try: - import h2 # noqa - except ImportError: # pragma: no cover - raise ImportError( - "Using http2=True, but the 'h2' package is not installed. " - "Make sure to install httpx using `pip install httpx[http2]`." - ) from None - - allow_env_proxies = trust_env and transport is None - proxy_map = self._get_proxy_map(proxy, allow_env_proxies) - - self._transport = self._init_transport( - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - transport=transport, - ) - - self._mounts: dict[URLPattern, AsyncBaseTransport | None] = { - URLPattern(key): None - if proxy is None - else self._init_proxy_transport( - proxy, - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - ) - for key, proxy in proxy_map.items() - } - if mounts is not None: - self._mounts.update( - {URLPattern(key): transport for key, transport in mounts.items()} - ) - self._mounts = dict(sorted(self._mounts.items())) - - def _init_transport( - self, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, - http1: bool = True, - http2: bool = False, - limits: Limits = DEFAULT_LIMITS, - transport: AsyncBaseTransport | None = None, - ) -> AsyncBaseTransport: - if transport is not None: - return transport - - return AsyncHTTPTransport( - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - ) - - def _init_proxy_transport( - self, - proxy: Proxy, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, - http1: bool = True, - http2: bool = False, - limits: Limits = DEFAULT_LIMITS, - ) -> AsyncBaseTransport: - return AsyncHTTPTransport( - verify=verify, - cert=cert, - trust_env=trust_env, - http1=http1, - http2=http2, - limits=limits, - proxy=proxy, - ) - - def _transport_for_url(self, url: URL) -> AsyncBaseTransport: - """ - Returns the transport instance that should be used for a given URL. - This will either be the standard connection pool, or a proxy. - """ - for pattern, transport in self._mounts.items(): - if pattern.matches(url): - return self._transport if transport is None else transport - - return self._transport - - async def request( - self, - method: str, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Build and send a request. - - Equivalent to: - - ```python - request = client.build_request(...) - response = await client.send(request, ...) - ``` - - See `AsyncClient.build_request()`, `AsyncClient.send()` - and [Merging of configuration][0] for how the various parameters - are merged with client-level configuration. - - [0]: /advanced/clients/#merging-of-configuration - """ - - if cookies is not None: # pragma: no cover - message = ( - "Setting per-request cookies=<...> is being deprecated, because " - "the expected behaviour on cookie persistence is ambiguous. Set " - "cookies directly on the client instance instead." - ) - warnings.warn(message, DeprecationWarning, stacklevel=2) - - request = self.build_request( - method=method, - url=url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - timeout=timeout, - extensions=extensions, - ) - return await self.send(request, auth=auth, follow_redirects=follow_redirects) - - @asynccontextmanager - async def stream( - self, - method: str, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> typing.AsyncIterator[Response]: - """ - Alternative to `httpx.request()` that streams the response body - instead of loading it into memory at once. - - **Parameters**: See `httpx.request`. - - See also: [Streaming Responses][0] - - [0]: /quickstart#streaming-responses - """ - request = self.build_request( - method=method, - url=url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - timeout=timeout, - extensions=extensions, - ) - response = await self.send( - request=request, - auth=auth, - follow_redirects=follow_redirects, - stream=True, - ) - try: - yield response - finally: - await response.aclose() - - async def send( - self, - request: Request, - *, - stream: bool = False, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - ) -> Response: - """ - Send a request. - - The request is sent as-is, unmodified. - - Typically you'll want to build one with `AsyncClient.build_request()` - so that any client-level configuration is merged into the request, - but passing an explicit `httpx.Request()` is supported as well. - - See also: [Request instances][0] - - [0]: /advanced/clients/#request-instances - """ - if self._state == ClientState.CLOSED: - raise RuntimeError("Cannot send a request, as the client has been closed.") - - self._state = ClientState.OPENED - follow_redirects = ( - self.follow_redirects - if isinstance(follow_redirects, UseClientDefault) - else follow_redirects - ) - - self._set_timeout(request) - - auth = self._build_request_auth(request, auth) - - response = await self._send_handling_auth( - request, - auth=auth, - follow_redirects=follow_redirects, - history=[], - ) - try: - if not stream: - await response.aread() - - return response - - except BaseException as exc: - await response.aclose() - raise exc - - async def _send_handling_auth( - self, - request: Request, - auth: Auth, - follow_redirects: bool, - history: list[Response], - ) -> Response: - auth_flow = auth.async_auth_flow(request) - try: - request = await auth_flow.__anext__() - - while True: - response = await self._send_handling_redirects( - request, - follow_redirects=follow_redirects, - history=history, - ) - try: - try: - next_request = await auth_flow.asend(response) - except StopAsyncIteration: - return response - - response.history = list(history) - await response.aread() - request = next_request - history.append(response) - - except BaseException as exc: - await response.aclose() - raise exc - finally: - await auth_flow.aclose() - - async def _send_handling_redirects( - self, - request: Request, - follow_redirects: bool, - history: list[Response], - ) -> Response: - while True: - if len(history) > self.max_redirects: - raise TooManyRedirects( - "Exceeded maximum allowed redirects.", request=request - ) - - for hook in self._event_hooks["request"]: - await hook(request) - - response = await self._send_single_request(request) - try: - for hook in self._event_hooks["response"]: - await hook(response) - - response.history = list(history) - - if not response.has_redirect_location: - return response - - request = self._build_redirect_request(request, response) - history = history + [response] - - if follow_redirects: - await response.aread() - else: - response.next_request = request - return response - - except BaseException as exc: - await response.aclose() - raise exc - - async def _send_single_request(self, request: Request) -> Response: - """ - Sends a single request, without handling any redirections. - """ - transport = self._transport_for_url(request.url) - start = time.perf_counter() - - if not isinstance(request.stream, AsyncByteStream): - raise RuntimeError( - "Attempted to send an sync request with an AsyncClient instance." - ) - - with request_context(request=request): - response = await transport.handle_async_request(request) - - assert isinstance(response.stream, AsyncByteStream) - response.request = request - response.stream = BoundAsyncStream( - response.stream, response=response, start=start - ) - self.cookies.extract_cookies(response) - response.default_encoding = self._default_encoding - - logger.info( - 'HTTP Request: %s %s "%s %d %s"', - request.method, - request.url, - response.http_version, - response.status_code, - response.reason_phrase, - ) - - return response - - async def get( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `GET` request. - - **Parameters**: See `httpx.request`. - """ - return await self.request( - "GET", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - async def options( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send an `OPTIONS` request. - - **Parameters**: See `httpx.request`. - """ - return await self.request( - "OPTIONS", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - async def head( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `HEAD` request. - - **Parameters**: See `httpx.request`. - """ - return await self.request( - "HEAD", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - async def post( - self, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `POST` request. - - **Parameters**: See `httpx.request`. - """ - return await self.request( - "POST", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - async def put( - self, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `PUT` request. - - **Parameters**: See `httpx.request`. - """ - return await self.request( - "PUT", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - async def patch( - self, - url: URL | str, - *, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `PATCH` request. - - **Parameters**: See `httpx.request`. - """ - return await self.request( - "PATCH", - url, - content=content, - data=data, - files=files, - json=json, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - async def delete( - self, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - auth: AuthTypes | UseClientDefault = USE_CLIENT_DEFAULT, - follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT, - timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT, - extensions: RequestExtensions | None = None, - ) -> Response: - """ - Send a `DELETE` request. - - **Parameters**: See `httpx.request`. - """ - return await self.request( - "DELETE", - url, - params=params, - headers=headers, - cookies=cookies, - auth=auth, - follow_redirects=follow_redirects, - timeout=timeout, - extensions=extensions, - ) - - async def aclose(self) -> None: - """ - Close transport and proxies. - """ - if self._state != ClientState.CLOSED: - self._state = ClientState.CLOSED - - await self._transport.aclose() - for proxy in self._mounts.values(): - if proxy is not None: - await proxy.aclose() - - async def __aenter__(self: U) -> U: - if self._state != ClientState.UNOPENED: - msg = { - ClientState.OPENED: "Cannot open a client instance more than once.", - ClientState.CLOSED: ( - "Cannot reopen a client instance, once it has been closed." - ), - }[self._state] - raise RuntimeError(msg) - - self._state = ClientState.OPENED - - await self._transport.__aenter__() - for proxy in self._mounts.values(): - if proxy is not None: - await proxy.__aenter__() - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: TracebackType | None = None, - ) -> None: - self._state = ClientState.CLOSED - - await self._transport.__aexit__(exc_type, exc_value, traceback) - for proxy in self._mounts.values(): - if proxy is not None: - await proxy.__aexit__(exc_type, exc_value, traceback) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_config.py b/write-message/venv/lib/python3.10/site-packages/httpx/_config.py deleted file mode 100644 index 467a6c9..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_config.py +++ /dev/null @@ -1,248 +0,0 @@ -from __future__ import annotations - -import os -import typing - -from ._models import Headers -from ._types import CertTypes, HeaderTypes, TimeoutTypes -from ._urls import URL - -if typing.TYPE_CHECKING: - import ssl # pragma: no cover - -__all__ = ["Limits", "Proxy", "Timeout", "create_ssl_context"] - - -class UnsetType: - pass # pragma: no cover - - -UNSET = UnsetType() - - -def create_ssl_context( - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, -) -> ssl.SSLContext: - import ssl - import warnings - - import certifi - - if verify is True: - if trust_env and os.environ.get("SSL_CERT_FILE"): # pragma: nocover - ctx = ssl.create_default_context(cafile=os.environ["SSL_CERT_FILE"]) - elif trust_env and os.environ.get("SSL_CERT_DIR"): # pragma: nocover - ctx = ssl.create_default_context(capath=os.environ["SSL_CERT_DIR"]) - else: - # Default case... - ctx = ssl.create_default_context(cafile=certifi.where()) - elif verify is False: - ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - ctx.check_hostname = False - ctx.verify_mode = ssl.CERT_NONE - elif isinstance(verify, str): # pragma: nocover - message = ( - "`verify=` is deprecated. " - "Use `verify=ssl.create_default_context(cafile=...)` " - "or `verify=ssl.create_default_context(capath=...)` instead." - ) - warnings.warn(message, DeprecationWarning) - if os.path.isdir(verify): - return ssl.create_default_context(capath=verify) - return ssl.create_default_context(cafile=verify) - else: - ctx = verify - - if cert: # pragma: nocover - message = ( - "`cert=...` is deprecated. Use `verify=` instead," - "with `.load_cert_chain()` to configure the certificate chain." - ) - warnings.warn(message, DeprecationWarning) - if isinstance(cert, str): - ctx.load_cert_chain(cert) - else: - ctx.load_cert_chain(*cert) - - return ctx - - -class Timeout: - """ - Timeout configuration. - - **Usage**: - - Timeout(None) # No timeouts. - Timeout(5.0) # 5s timeout on all operations. - Timeout(None, connect=5.0) # 5s timeout on connect, no other timeouts. - Timeout(5.0, connect=10.0) # 10s timeout on connect. 5s timeout elsewhere. - Timeout(5.0, pool=None) # No timeout on acquiring connection from pool. - # 5s timeout elsewhere. - """ - - def __init__( - self, - timeout: TimeoutTypes | UnsetType = UNSET, - *, - connect: None | float | UnsetType = UNSET, - read: None | float | UnsetType = UNSET, - write: None | float | UnsetType = UNSET, - pool: None | float | UnsetType = UNSET, - ) -> None: - if isinstance(timeout, Timeout): - # Passed as a single explicit Timeout. - assert connect is UNSET - assert read is UNSET - assert write is UNSET - assert pool is UNSET - self.connect = timeout.connect # type: typing.Optional[float] - self.read = timeout.read # type: typing.Optional[float] - self.write = timeout.write # type: typing.Optional[float] - self.pool = timeout.pool # type: typing.Optional[float] - elif isinstance(timeout, tuple): - # Passed as a tuple. - self.connect = timeout[0] - self.read = timeout[1] - self.write = None if len(timeout) < 3 else timeout[2] - self.pool = None if len(timeout) < 4 else timeout[3] - elif not ( - isinstance(connect, UnsetType) - or isinstance(read, UnsetType) - or isinstance(write, UnsetType) - or isinstance(pool, UnsetType) - ): - self.connect = connect - self.read = read - self.write = write - self.pool = pool - else: - if isinstance(timeout, UnsetType): - raise ValueError( - "httpx.Timeout must either include a default, or set all " - "four parameters explicitly." - ) - self.connect = timeout if isinstance(connect, UnsetType) else connect - self.read = timeout if isinstance(read, UnsetType) else read - self.write = timeout if isinstance(write, UnsetType) else write - self.pool = timeout if isinstance(pool, UnsetType) else pool - - def as_dict(self) -> dict[str, float | None]: - return { - "connect": self.connect, - "read": self.read, - "write": self.write, - "pool": self.pool, - } - - def __eq__(self, other: typing.Any) -> bool: - return ( - isinstance(other, self.__class__) - and self.connect == other.connect - and self.read == other.read - and self.write == other.write - and self.pool == other.pool - ) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - if len({self.connect, self.read, self.write, self.pool}) == 1: - return f"{class_name}(timeout={self.connect})" - return ( - f"{class_name}(connect={self.connect}, " - f"read={self.read}, write={self.write}, pool={self.pool})" - ) - - -class Limits: - """ - Configuration for limits to various client behaviors. - - **Parameters:** - - * **max_connections** - The maximum number of concurrent connections that may be - established. - * **max_keepalive_connections** - Allow the connection pool to maintain - keep-alive connections below this point. Should be less than or equal - to `max_connections`. - * **keepalive_expiry** - Time limit on idle keep-alive connections in seconds. - """ - - def __init__( - self, - *, - max_connections: int | None = None, - max_keepalive_connections: int | None = None, - keepalive_expiry: float | None = 5.0, - ) -> None: - self.max_connections = max_connections - self.max_keepalive_connections = max_keepalive_connections - self.keepalive_expiry = keepalive_expiry - - def __eq__(self, other: typing.Any) -> bool: - return ( - isinstance(other, self.__class__) - and self.max_connections == other.max_connections - and self.max_keepalive_connections == other.max_keepalive_connections - and self.keepalive_expiry == other.keepalive_expiry - ) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - return ( - f"{class_name}(max_connections={self.max_connections}, " - f"max_keepalive_connections={self.max_keepalive_connections}, " - f"keepalive_expiry={self.keepalive_expiry})" - ) - - -class Proxy: - def __init__( - self, - url: URL | str, - *, - ssl_context: ssl.SSLContext | None = None, - auth: tuple[str, str] | None = None, - headers: HeaderTypes | None = None, - ) -> None: - url = URL(url) - headers = Headers(headers) - - if url.scheme not in ("http", "https", "socks5", "socks5h"): - raise ValueError(f"Unknown scheme for proxy URL {url!r}") - - if url.username or url.password: - # Remove any auth credentials from the URL. - auth = (url.username, url.password) - url = url.copy_with(username=None, password=None) - - self.url = url - self.auth = auth - self.headers = headers - self.ssl_context = ssl_context - - @property - def raw_auth(self) -> tuple[bytes, bytes] | None: - # The proxy authentication as raw bytes. - return ( - None - if self.auth is None - else (self.auth[0].encode("utf-8"), self.auth[1].encode("utf-8")) - ) - - def __repr__(self) -> str: - # The authentication is represented with the password component masked. - auth = (self.auth[0], "********") if self.auth else None - - # Build a nice concise representation. - url_str = f"{str(self.url)!r}" - auth_str = f", auth={auth!r}" if auth else "" - headers_str = f", headers={dict(self.headers)!r}" if self.headers else "" - return f"Proxy({url_str}{auth_str}{headers_str})" - - -DEFAULT_TIMEOUT_CONFIG = Timeout(timeout=5.0) -DEFAULT_LIMITS = Limits(max_connections=100, max_keepalive_connections=20) -DEFAULT_MAX_REDIRECTS = 20 diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_content.py b/write-message/venv/lib/python3.10/site-packages/httpx/_content.py deleted file mode 100644 index 6f479a0..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_content.py +++ /dev/null @@ -1,240 +0,0 @@ -from __future__ import annotations - -import inspect -import warnings -from json import dumps as json_dumps -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Iterable, - Iterator, - Mapping, -) -from urllib.parse import urlencode - -from ._exceptions import StreamClosed, StreamConsumed -from ._multipart import MultipartStream -from ._types import ( - AsyncByteStream, - RequestContent, - RequestData, - RequestFiles, - ResponseContent, - SyncByteStream, -) -from ._utils import peek_filelike_length, primitive_value_to_str - -__all__ = ["ByteStream"] - - -class ByteStream(AsyncByteStream, SyncByteStream): - def __init__(self, stream: bytes) -> None: - self._stream = stream - - def __iter__(self) -> Iterator[bytes]: - yield self._stream - - async def __aiter__(self) -> AsyncIterator[bytes]: - yield self._stream - - -class IteratorByteStream(SyncByteStream): - CHUNK_SIZE = 65_536 - - def __init__(self, stream: Iterable[bytes]) -> None: - self._stream = stream - self._is_stream_consumed = False - self._is_generator = inspect.isgenerator(stream) - - def __iter__(self) -> Iterator[bytes]: - if self._is_stream_consumed and self._is_generator: - raise StreamConsumed() - - self._is_stream_consumed = True - if hasattr(self._stream, "read"): - # File-like interfaces should use 'read' directly. - chunk = self._stream.read(self.CHUNK_SIZE) - while chunk: - yield chunk - chunk = self._stream.read(self.CHUNK_SIZE) - else: - # Otherwise iterate. - for part in self._stream: - yield part - - -class AsyncIteratorByteStream(AsyncByteStream): - CHUNK_SIZE = 65_536 - - def __init__(self, stream: AsyncIterable[bytes]) -> None: - self._stream = stream - self._is_stream_consumed = False - self._is_generator = inspect.isasyncgen(stream) - - async def __aiter__(self) -> AsyncIterator[bytes]: - if self._is_stream_consumed and self._is_generator: - raise StreamConsumed() - - self._is_stream_consumed = True - if hasattr(self._stream, "aread"): - # File-like interfaces should use 'aread' directly. - chunk = await self._stream.aread(self.CHUNK_SIZE) - while chunk: - yield chunk - chunk = await self._stream.aread(self.CHUNK_SIZE) - else: - # Otherwise iterate. - async for part in self._stream: - yield part - - -class UnattachedStream(AsyncByteStream, SyncByteStream): - """ - If a request or response is serialized using pickle, then it is no longer - attached to a stream for I/O purposes. Any stream operations should result - in `httpx.StreamClosed`. - """ - - def __iter__(self) -> Iterator[bytes]: - raise StreamClosed() - - async def __aiter__(self) -> AsyncIterator[bytes]: - raise StreamClosed() - yield b"" # pragma: no cover - - -def encode_content( - content: str | bytes | Iterable[bytes] | AsyncIterable[bytes], -) -> tuple[dict[str, str], SyncByteStream | AsyncByteStream]: - if isinstance(content, (bytes, str)): - body = content.encode("utf-8") if isinstance(content, str) else content - content_length = len(body) - headers = {"Content-Length": str(content_length)} if body else {} - return headers, ByteStream(body) - - elif isinstance(content, Iterable) and not isinstance(content, dict): - # `not isinstance(content, dict)` is a bit oddly specific, but it - # catches a case that's easy for users to make in error, and would - # otherwise pass through here, like any other bytes-iterable, - # because `dict` happens to be iterable. See issue #2491. - content_length_or_none = peek_filelike_length(content) - - if content_length_or_none is None: - headers = {"Transfer-Encoding": "chunked"} - else: - headers = {"Content-Length": str(content_length_or_none)} - return headers, IteratorByteStream(content) # type: ignore - - elif isinstance(content, AsyncIterable): - headers = {"Transfer-Encoding": "chunked"} - return headers, AsyncIteratorByteStream(content) - - raise TypeError(f"Unexpected type for 'content', {type(content)!r}") - - -def encode_urlencoded_data( - data: RequestData, -) -> tuple[dict[str, str], ByteStream]: - plain_data = [] - for key, value in data.items(): - if isinstance(value, (list, tuple)): - plain_data.extend([(key, primitive_value_to_str(item)) for item in value]) - else: - plain_data.append((key, primitive_value_to_str(value))) - body = urlencode(plain_data, doseq=True).encode("utf-8") - content_length = str(len(body)) - content_type = "application/x-www-form-urlencoded" - headers = {"Content-Length": content_length, "Content-Type": content_type} - return headers, ByteStream(body) - - -def encode_multipart_data( - data: RequestData, files: RequestFiles, boundary: bytes | None -) -> tuple[dict[str, str], MultipartStream]: - multipart = MultipartStream(data=data, files=files, boundary=boundary) - headers = multipart.get_headers() - return headers, multipart - - -def encode_text(text: str) -> tuple[dict[str, str], ByteStream]: - body = text.encode("utf-8") - content_length = str(len(body)) - content_type = "text/plain; charset=utf-8" - headers = {"Content-Length": content_length, "Content-Type": content_type} - return headers, ByteStream(body) - - -def encode_html(html: str) -> tuple[dict[str, str], ByteStream]: - body = html.encode("utf-8") - content_length = str(len(body)) - content_type = "text/html; charset=utf-8" - headers = {"Content-Length": content_length, "Content-Type": content_type} - return headers, ByteStream(body) - - -def encode_json(json: Any) -> tuple[dict[str, str], ByteStream]: - body = json_dumps( - json, ensure_ascii=False, separators=(",", ":"), allow_nan=False - ).encode("utf-8") - content_length = str(len(body)) - content_type = "application/json" - headers = {"Content-Length": content_length, "Content-Type": content_type} - return headers, ByteStream(body) - - -def encode_request( - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: Any | None = None, - boundary: bytes | None = None, -) -> tuple[dict[str, str], SyncByteStream | AsyncByteStream]: - """ - Handles encoding the given `content`, `data`, `files`, and `json`, - returning a two-tuple of (, ). - """ - if data is not None and not isinstance(data, Mapping): - # We prefer to separate `content=` - # for raw request content, and `data=
` for url encoded or - # multipart form content. - # - # However for compat with requests, we *do* still support - # `data=` usages. We deal with that case here, treating it - # as if `content=<...>` had been supplied instead. - message = "Use 'content=<...>' to upload raw bytes/text content." - warnings.warn(message, DeprecationWarning, stacklevel=2) - return encode_content(data) - - if content is not None: - return encode_content(content) - elif files: - return encode_multipart_data(data or {}, files, boundary) - elif data: - return encode_urlencoded_data(data) - elif json is not None: - return encode_json(json) - - return {}, ByteStream(b"") - - -def encode_response( - content: ResponseContent | None = None, - text: str | None = None, - html: str | None = None, - json: Any | None = None, -) -> tuple[dict[str, str], SyncByteStream | AsyncByteStream]: - """ - Handles encoding the given `content`, returning a two-tuple of - (, ). - """ - if content is not None: - return encode_content(content) - elif text is not None: - return encode_text(text) - elif html is not None: - return encode_html(html) - elif json is not None: - return encode_json(json) - - return {}, ByteStream(b"") diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_decoders.py b/write-message/venv/lib/python3.10/site-packages/httpx/_decoders.py deleted file mode 100644 index 899dfad..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_decoders.py +++ /dev/null @@ -1,393 +0,0 @@ -""" -Handlers for Content-Encoding. - -See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding -""" - -from __future__ import annotations - -import codecs -import io -import typing -import zlib - -from ._exceptions import DecodingError - -# Brotli support is optional -try: - # The C bindings in `brotli` are recommended for CPython. - import brotli -except ImportError: # pragma: no cover - try: - # The CFFI bindings in `brotlicffi` are recommended for PyPy - # and other environments. - import brotlicffi as brotli - except ImportError: - brotli = None - - -# Zstandard support is optional -try: - import zstandard -except ImportError: # pragma: no cover - zstandard = None # type: ignore - - -class ContentDecoder: - def decode(self, data: bytes) -> bytes: - raise NotImplementedError() # pragma: no cover - - def flush(self) -> bytes: - raise NotImplementedError() # pragma: no cover - - -class IdentityDecoder(ContentDecoder): - """ - Handle unencoded data. - """ - - def decode(self, data: bytes) -> bytes: - return data - - def flush(self) -> bytes: - return b"" - - -class DeflateDecoder(ContentDecoder): - """ - Handle 'deflate' decoding. - - See: https://stackoverflow.com/questions/1838699 - """ - - def __init__(self) -> None: - self.first_attempt = True - self.decompressor = zlib.decompressobj() - - def decode(self, data: bytes) -> bytes: - was_first_attempt = self.first_attempt - self.first_attempt = False - try: - return self.decompressor.decompress(data) - except zlib.error as exc: - if was_first_attempt: - self.decompressor = zlib.decompressobj(-zlib.MAX_WBITS) - return self.decode(data) - raise DecodingError(str(exc)) from exc - - def flush(self) -> bytes: - try: - return self.decompressor.flush() - except zlib.error as exc: # pragma: no cover - raise DecodingError(str(exc)) from exc - - -class GZipDecoder(ContentDecoder): - """ - Handle 'gzip' decoding. - - See: https://stackoverflow.com/questions/1838699 - """ - - def __init__(self) -> None: - self.decompressor = zlib.decompressobj(zlib.MAX_WBITS | 16) - - def decode(self, data: bytes) -> bytes: - try: - return self.decompressor.decompress(data) - except zlib.error as exc: - raise DecodingError(str(exc)) from exc - - def flush(self) -> bytes: - try: - return self.decompressor.flush() - except zlib.error as exc: # pragma: no cover - raise DecodingError(str(exc)) from exc - - -class BrotliDecoder(ContentDecoder): - """ - Handle 'brotli' decoding. - - Requires `pip install brotlipy`. See: https://brotlipy.readthedocs.io/ - or `pip install brotli`. See https://github.com/google/brotli - Supports both 'brotlipy' and 'Brotli' packages since they share an import - name. The top branches are for 'brotlipy' and bottom branches for 'Brotli' - """ - - def __init__(self) -> None: - if brotli is None: # pragma: no cover - raise ImportError( - "Using 'BrotliDecoder', but neither of the 'brotlicffi' or 'brotli' " - "packages have been installed. " - "Make sure to install httpx using `pip install httpx[brotli]`." - ) from None - - self.decompressor = brotli.Decompressor() - self.seen_data = False - self._decompress: typing.Callable[[bytes], bytes] - if hasattr(self.decompressor, "decompress"): - # The 'brotlicffi' package. - self._decompress = self.decompressor.decompress # pragma: no cover - else: - # The 'brotli' package. - self._decompress = self.decompressor.process # pragma: no cover - - def decode(self, data: bytes) -> bytes: - if not data: - return b"" - self.seen_data = True - try: - return self._decompress(data) - except brotli.error as exc: - raise DecodingError(str(exc)) from exc - - def flush(self) -> bytes: - if not self.seen_data: - return b"" - try: - if hasattr(self.decompressor, "finish"): - # Only available in the 'brotlicffi' package. - - # As the decompressor decompresses eagerly, this - # will never actually emit any data. However, it will potentially throw - # errors if a truncated or damaged data stream has been used. - self.decompressor.finish() # pragma: no cover - return b"" - except brotli.error as exc: # pragma: no cover - raise DecodingError(str(exc)) from exc - - -class ZStandardDecoder(ContentDecoder): - """ - Handle 'zstd' RFC 8878 decoding. - - Requires `pip install zstandard`. - Can be installed as a dependency of httpx using `pip install httpx[zstd]`. - """ - - # inspired by the ZstdDecoder implementation in urllib3 - def __init__(self) -> None: - if zstandard is None: # pragma: no cover - raise ImportError( - "Using 'ZStandardDecoder', ..." - "Make sure to install httpx using `pip install httpx[zstd]`." - ) from None - - self.decompressor = zstandard.ZstdDecompressor().decompressobj() - self.seen_data = False - - def decode(self, data: bytes) -> bytes: - assert zstandard is not None - self.seen_data = True - output = io.BytesIO() - try: - output.write(self.decompressor.decompress(data)) - while self.decompressor.eof and self.decompressor.unused_data: - unused_data = self.decompressor.unused_data - self.decompressor = zstandard.ZstdDecompressor().decompressobj() - output.write(self.decompressor.decompress(unused_data)) - except zstandard.ZstdError as exc: - raise DecodingError(str(exc)) from exc - return output.getvalue() - - def flush(self) -> bytes: - if not self.seen_data: - return b"" - ret = self.decompressor.flush() # note: this is a no-op - if not self.decompressor.eof: - raise DecodingError("Zstandard data is incomplete") # pragma: no cover - return bytes(ret) - - -class MultiDecoder(ContentDecoder): - """ - Handle the case where multiple encodings have been applied. - """ - - def __init__(self, children: typing.Sequence[ContentDecoder]) -> None: - """ - 'children' should be a sequence of decoders in the order in which - each was applied. - """ - # Note that we reverse the order for decoding. - self.children = list(reversed(children)) - - def decode(self, data: bytes) -> bytes: - for child in self.children: - data = child.decode(data) - return data - - def flush(self) -> bytes: - data = b"" - for child in self.children: - data = child.decode(data) + child.flush() - return data - - -class ByteChunker: - """ - Handles returning byte content in fixed-size chunks. - """ - - def __init__(self, chunk_size: int | None = None) -> None: - self._buffer = io.BytesIO() - self._chunk_size = chunk_size - - def decode(self, content: bytes) -> list[bytes]: - if self._chunk_size is None: - return [content] if content else [] - - self._buffer.write(content) - if self._buffer.tell() >= self._chunk_size: - value = self._buffer.getvalue() - chunks = [ - value[i : i + self._chunk_size] - for i in range(0, len(value), self._chunk_size) - ] - if len(chunks[-1]) == self._chunk_size: - self._buffer.seek(0) - self._buffer.truncate() - return chunks - else: - self._buffer.seek(0) - self._buffer.write(chunks[-1]) - self._buffer.truncate() - return chunks[:-1] - else: - return [] - - def flush(self) -> list[bytes]: - value = self._buffer.getvalue() - self._buffer.seek(0) - self._buffer.truncate() - return [value] if value else [] - - -class TextChunker: - """ - Handles returning text content in fixed-size chunks. - """ - - def __init__(self, chunk_size: int | None = None) -> None: - self._buffer = io.StringIO() - self._chunk_size = chunk_size - - def decode(self, content: str) -> list[str]: - if self._chunk_size is None: - return [content] if content else [] - - self._buffer.write(content) - if self._buffer.tell() >= self._chunk_size: - value = self._buffer.getvalue() - chunks = [ - value[i : i + self._chunk_size] - for i in range(0, len(value), self._chunk_size) - ] - if len(chunks[-1]) == self._chunk_size: - self._buffer.seek(0) - self._buffer.truncate() - return chunks - else: - self._buffer.seek(0) - self._buffer.write(chunks[-1]) - self._buffer.truncate() - return chunks[:-1] - else: - return [] - - def flush(self) -> list[str]: - value = self._buffer.getvalue() - self._buffer.seek(0) - self._buffer.truncate() - return [value] if value else [] - - -class TextDecoder: - """ - Handles incrementally decoding bytes into text - """ - - def __init__(self, encoding: str = "utf-8") -> None: - self.decoder = codecs.getincrementaldecoder(encoding)(errors="replace") - - def decode(self, data: bytes) -> str: - return self.decoder.decode(data) - - def flush(self) -> str: - return self.decoder.decode(b"", True) - - -class LineDecoder: - """ - Handles incrementally reading lines from text. - - Has the same behaviour as the stdllib splitlines, - but handling the input iteratively. - """ - - def __init__(self) -> None: - self.buffer: list[str] = [] - self.trailing_cr: bool = False - - def decode(self, text: str) -> list[str]: - # See https://docs.python.org/3/library/stdtypes.html#str.splitlines - NEWLINE_CHARS = "\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029" - - # We always push a trailing `\r` into the next decode iteration. - if self.trailing_cr: - text = "\r" + text - self.trailing_cr = False - if text.endswith("\r"): - self.trailing_cr = True - text = text[:-1] - - if not text: - # NOTE: the edge case input of empty text doesn't occur in practice, - # because other httpx internals filter out this value - return [] # pragma: no cover - - trailing_newline = text[-1] in NEWLINE_CHARS - lines = text.splitlines() - - if len(lines) == 1 and not trailing_newline: - # No new lines, buffer the input and continue. - self.buffer.append(lines[0]) - return [] - - if self.buffer: - # Include any existing buffer in the first portion of the - # splitlines result. - lines = ["".join(self.buffer) + lines[0]] + lines[1:] - self.buffer = [] - - if not trailing_newline: - # If the last segment of splitlines is not newline terminated, - # then drop it from our output and start a new buffer. - self.buffer = [lines.pop()] - - return lines - - def flush(self) -> list[str]: - if not self.buffer and not self.trailing_cr: - return [] - - lines = ["".join(self.buffer)] - self.buffer = [] - self.trailing_cr = False - return lines - - -SUPPORTED_DECODERS = { - "identity": IdentityDecoder, - "gzip": GZipDecoder, - "deflate": DeflateDecoder, - "br": BrotliDecoder, - "zstd": ZStandardDecoder, -} - - -if brotli is None: - SUPPORTED_DECODERS.pop("br") # pragma: no cover -if zstandard is None: - SUPPORTED_DECODERS.pop("zstd") # pragma: no cover diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_exceptions.py b/write-message/venv/lib/python3.10/site-packages/httpx/_exceptions.py deleted file mode 100644 index 77f45a6..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_exceptions.py +++ /dev/null @@ -1,379 +0,0 @@ -""" -Our exception hierarchy: - -* HTTPError - x RequestError - + TransportError - - TimeoutException - · ConnectTimeout - · ReadTimeout - · WriteTimeout - · PoolTimeout - - NetworkError - · ConnectError - · ReadError - · WriteError - · CloseError - - ProtocolError - · LocalProtocolError - · RemoteProtocolError - - ProxyError - - UnsupportedProtocol - + DecodingError - + TooManyRedirects - x HTTPStatusError -* InvalidURL -* CookieConflict -* StreamError - x StreamConsumed - x StreamClosed - x ResponseNotRead - x RequestNotRead -""" - -from __future__ import annotations - -import contextlib -import typing - -if typing.TYPE_CHECKING: - from ._models import Request, Response # pragma: no cover - -__all__ = [ - "CloseError", - "ConnectError", - "ConnectTimeout", - "CookieConflict", - "DecodingError", - "HTTPError", - "HTTPStatusError", - "InvalidURL", - "LocalProtocolError", - "NetworkError", - "PoolTimeout", - "ProtocolError", - "ProxyError", - "ReadError", - "ReadTimeout", - "RemoteProtocolError", - "RequestError", - "RequestNotRead", - "ResponseNotRead", - "StreamClosed", - "StreamConsumed", - "StreamError", - "TimeoutException", - "TooManyRedirects", - "TransportError", - "UnsupportedProtocol", - "WriteError", - "WriteTimeout", -] - - -class HTTPError(Exception): - """ - Base class for `RequestError` and `HTTPStatusError`. - - Useful for `try...except` blocks when issuing a request, - and then calling `.raise_for_status()`. - - For example: - - ``` - try: - response = httpx.get("https://www.example.com") - response.raise_for_status() - except httpx.HTTPError as exc: - print(f"HTTP Exception for {exc.request.url} - {exc}") - ``` - """ - - def __init__(self, message: str) -> None: - super().__init__(message) - self._request: Request | None = None - - @property - def request(self) -> Request: - if self._request is None: - raise RuntimeError("The .request property has not been set.") - return self._request - - @request.setter - def request(self, request: Request) -> None: - self._request = request - - -class RequestError(HTTPError): - """ - Base class for all exceptions that may occur when issuing a `.request()`. - """ - - def __init__(self, message: str, *, request: Request | None = None) -> None: - super().__init__(message) - # At the point an exception is raised we won't typically have a request - # instance to associate it with. - # - # The 'request_context' context manager is used within the Client and - # Response methods in order to ensure that any raised exceptions - # have a `.request` property set on them. - self._request = request - - -class TransportError(RequestError): - """ - Base class for all exceptions that occur at the level of the Transport API. - """ - - -# Timeout exceptions... - - -class TimeoutException(TransportError): - """ - The base class for timeout errors. - - An operation has timed out. - """ - - -class ConnectTimeout(TimeoutException): - """ - Timed out while connecting to the host. - """ - - -class ReadTimeout(TimeoutException): - """ - Timed out while receiving data from the host. - """ - - -class WriteTimeout(TimeoutException): - """ - Timed out while sending data to the host. - """ - - -class PoolTimeout(TimeoutException): - """ - Timed out waiting to acquire a connection from the pool. - """ - - -# Core networking exceptions... - - -class NetworkError(TransportError): - """ - The base class for network-related errors. - - An error occurred while interacting with the network. - """ - - -class ReadError(NetworkError): - """ - Failed to receive data from the network. - """ - - -class WriteError(NetworkError): - """ - Failed to send data through the network. - """ - - -class ConnectError(NetworkError): - """ - Failed to establish a connection. - """ - - -class CloseError(NetworkError): - """ - Failed to close a connection. - """ - - -# Other transport exceptions... - - -class ProxyError(TransportError): - """ - An error occurred while establishing a proxy connection. - """ - - -class UnsupportedProtocol(TransportError): - """ - Attempted to make a request to an unsupported protocol. - - For example issuing a request to `ftp://www.example.com`. - """ - - -class ProtocolError(TransportError): - """ - The protocol was violated. - """ - - -class LocalProtocolError(ProtocolError): - """ - A protocol was violated by the client. - - For example if the user instantiated a `Request` instance explicitly, - failed to include the mandatory `Host:` header, and then issued it directly - using `client.send()`. - """ - - -class RemoteProtocolError(ProtocolError): - """ - The protocol was violated by the server. - - For example, returning malformed HTTP. - """ - - -# Other request exceptions... - - -class DecodingError(RequestError): - """ - Decoding of the response failed, due to a malformed encoding. - """ - - -class TooManyRedirects(RequestError): - """ - Too many redirects. - """ - - -# Client errors - - -class HTTPStatusError(HTTPError): - """ - The response had an error HTTP status of 4xx or 5xx. - - May be raised when calling `response.raise_for_status()` - """ - - def __init__(self, message: str, *, request: Request, response: Response) -> None: - super().__init__(message) - self.request = request - self.response = response - - -class InvalidURL(Exception): - """ - URL is improperly formed or cannot be parsed. - """ - - def __init__(self, message: str) -> None: - super().__init__(message) - - -class CookieConflict(Exception): - """ - Attempted to lookup a cookie by name, but multiple cookies existed. - - Can occur when calling `response.cookies.get(...)`. - """ - - def __init__(self, message: str) -> None: - super().__init__(message) - - -# Stream exceptions... - -# These may occur as the result of a programming error, by accessing -# the request/response stream in an invalid manner. - - -class StreamError(RuntimeError): - """ - The base class for stream exceptions. - - The developer made an error in accessing the request stream in - an invalid way. - """ - - def __init__(self, message: str) -> None: - super().__init__(message) - - -class StreamConsumed(StreamError): - """ - Attempted to read or stream content, but the content has already - been streamed. - """ - - def __init__(self) -> None: - message = ( - "Attempted to read or stream some content, but the content has " - "already been streamed. For requests, this could be due to passing " - "a generator as request content, and then receiving a redirect " - "response or a secondary request as part of an authentication flow." - "For responses, this could be due to attempting to stream the response " - "content more than once." - ) - super().__init__(message) - - -class StreamClosed(StreamError): - """ - Attempted to read or stream response content, but the request has been - closed. - """ - - def __init__(self) -> None: - message = ( - "Attempted to read or stream content, but the stream has " "been closed." - ) - super().__init__(message) - - -class ResponseNotRead(StreamError): - """ - Attempted to access streaming response content, without having called `read()`. - """ - - def __init__(self) -> None: - message = ( - "Attempted to access streaming response content," - " without having called `read()`." - ) - super().__init__(message) - - -class RequestNotRead(StreamError): - """ - Attempted to access streaming request content, without having called `read()`. - """ - - def __init__(self) -> None: - message = ( - "Attempted to access streaming request content," - " without having called `read()`." - ) - super().__init__(message) - - -@contextlib.contextmanager -def request_context( - request: Request | None = None, -) -> typing.Iterator[None]: - """ - A context manager that can be used to attach the given request context - to any `RequestError` exceptions that are raised within the block. - """ - try: - yield - except RequestError as exc: - if request is not None: - exc.request = request - raise exc diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_main.py b/write-message/venv/lib/python3.10/site-packages/httpx/_main.py deleted file mode 100644 index cffa4bb..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_main.py +++ /dev/null @@ -1,506 +0,0 @@ -from __future__ import annotations - -import functools -import json -import sys -import typing - -import click -import pygments.lexers -import pygments.util -import rich.console -import rich.markup -import rich.progress -import rich.syntax -import rich.table - -from ._client import Client -from ._exceptions import RequestError -from ._models import Response -from ._status_codes import codes - -if typing.TYPE_CHECKING: - import httpcore # pragma: no cover - - -def print_help() -> None: - console = rich.console.Console() - - console.print("[bold]HTTPX :butterfly:", justify="center") - console.print() - console.print("A next generation HTTP client.", justify="center") - console.print() - console.print( - "Usage: [bold]httpx[/bold] [cyan] [OPTIONS][/cyan] ", justify="left" - ) - console.print() - - table = rich.table.Table.grid(padding=1, pad_edge=True) - table.add_column("Parameter", no_wrap=True, justify="left", style="bold") - table.add_column("Description") - table.add_row( - "-m, --method [cyan]METHOD", - "Request method, such as GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD.\n" - "[Default: GET, or POST if a request body is included]", - ) - table.add_row( - "-p, --params [cyan] ...", - "Query parameters to include in the request URL.", - ) - table.add_row( - "-c, --content [cyan]TEXT", "Byte content to include in the request body." - ) - table.add_row( - "-d, --data [cyan] ...", "Form data to include in the request body." - ) - table.add_row( - "-f, --files [cyan] ...", - "Form files to include in the request body.", - ) - table.add_row("-j, --json [cyan]TEXT", "JSON data to include in the request body.") - table.add_row( - "-h, --headers [cyan] ...", - "Include additional HTTP headers in the request.", - ) - table.add_row( - "--cookies [cyan] ...", "Cookies to include in the request." - ) - table.add_row( - "--auth [cyan]", - "Username and password to include in the request. Specify '-' for the password" - " to use a password prompt. Note that using --verbose/-v will expose" - " the Authorization header, including the password encoding" - " in a trivially reversible format.", - ) - - table.add_row( - "--proxy [cyan]URL", - "Send the request via a proxy. Should be the URL giving the proxy address.", - ) - - table.add_row( - "--timeout [cyan]FLOAT", - "Timeout value to use for network operations, such as establishing the" - " connection, reading some data, etc... [Default: 5.0]", - ) - - table.add_row("--follow-redirects", "Automatically follow redirects.") - table.add_row("--no-verify", "Disable SSL verification.") - table.add_row( - "--http2", "Send the request using HTTP/2, if the remote server supports it." - ) - - table.add_row( - "--download [cyan]FILE", - "Save the response content as a file, rather than displaying it.", - ) - - table.add_row("-v, --verbose", "Verbose output. Show request as well as response.") - table.add_row("--help", "Show this message and exit.") - console.print(table) - - -def get_lexer_for_response(response: Response) -> str: - content_type = response.headers.get("Content-Type") - if content_type is not None: - mime_type, _, _ = content_type.partition(";") - try: - return typing.cast( - str, pygments.lexers.get_lexer_for_mimetype(mime_type.strip()).name - ) - except pygments.util.ClassNotFound: # pragma: no cover - pass - return "" # pragma: no cover - - -def format_request_headers(request: httpcore.Request, http2: bool = False) -> str: - version = "HTTP/2" if http2 else "HTTP/1.1" - headers = [ - (name.lower() if http2 else name, value) for name, value in request.headers - ] - method = request.method.decode("ascii") - target = request.url.target.decode("ascii") - lines = [f"{method} {target} {version}"] + [ - f"{name.decode('ascii')}: {value.decode('ascii')}" for name, value in headers - ] - return "\n".join(lines) - - -def format_response_headers( - http_version: bytes, - status: int, - reason_phrase: bytes | None, - headers: list[tuple[bytes, bytes]], -) -> str: - version = http_version.decode("ascii") - reason = ( - codes.get_reason_phrase(status) - if reason_phrase is None - else reason_phrase.decode("ascii") - ) - lines = [f"{version} {status} {reason}"] + [ - f"{name.decode('ascii')}: {value.decode('ascii')}" for name, value in headers - ] - return "\n".join(lines) - - -def print_request_headers(request: httpcore.Request, http2: bool = False) -> None: - console = rich.console.Console() - http_text = format_request_headers(request, http2=http2) - syntax = rich.syntax.Syntax(http_text, "http", theme="ansi_dark", word_wrap=True) - console.print(syntax) - syntax = rich.syntax.Syntax("", "http", theme="ansi_dark", word_wrap=True) - console.print(syntax) - - -def print_response_headers( - http_version: bytes, - status: int, - reason_phrase: bytes | None, - headers: list[tuple[bytes, bytes]], -) -> None: - console = rich.console.Console() - http_text = format_response_headers(http_version, status, reason_phrase, headers) - syntax = rich.syntax.Syntax(http_text, "http", theme="ansi_dark", word_wrap=True) - console.print(syntax) - syntax = rich.syntax.Syntax("", "http", theme="ansi_dark", word_wrap=True) - console.print(syntax) - - -def print_response(response: Response) -> None: - console = rich.console.Console() - lexer_name = get_lexer_for_response(response) - if lexer_name: - if lexer_name.lower() == "json": - try: - data = response.json() - text = json.dumps(data, indent=4) - except ValueError: # pragma: no cover - text = response.text - else: - text = response.text - - syntax = rich.syntax.Syntax(text, lexer_name, theme="ansi_dark", word_wrap=True) - console.print(syntax) - else: - console.print(f"<{len(response.content)} bytes of binary data>") - - -_PCTRTT = typing.Tuple[typing.Tuple[str, str], ...] -_PCTRTTT = typing.Tuple[_PCTRTT, ...] -_PeerCertRetDictType = typing.Dict[str, typing.Union[str, _PCTRTTT, _PCTRTT]] - - -def format_certificate(cert: _PeerCertRetDictType) -> str: # pragma: no cover - lines = [] - for key, value in cert.items(): - if isinstance(value, (list, tuple)): - lines.append(f"* {key}:") - for item in value: - if key in ("subject", "issuer"): - for sub_item in item: - lines.append(f"* {sub_item[0]}: {sub_item[1]!r}") - elif isinstance(item, tuple) and len(item) == 2: - lines.append(f"* {item[0]}: {item[1]!r}") - else: - lines.append(f"* {item!r}") - else: - lines.append(f"* {key}: {value!r}") - return "\n".join(lines) - - -def trace( - name: str, info: typing.Mapping[str, typing.Any], verbose: bool = False -) -> None: - console = rich.console.Console() - if name == "connection.connect_tcp.started" and verbose: - host = info["host"] - console.print(f"* Connecting to {host!r}") - elif name == "connection.connect_tcp.complete" and verbose: - stream = info["return_value"] - server_addr = stream.get_extra_info("server_addr") - console.print(f"* Connected to {server_addr[0]!r} on port {server_addr[1]}") - elif name == "connection.start_tls.complete" and verbose: # pragma: no cover - stream = info["return_value"] - ssl_object = stream.get_extra_info("ssl_object") - version = ssl_object.version() - cipher = ssl_object.cipher() - server_cert = ssl_object.getpeercert() - alpn = ssl_object.selected_alpn_protocol() - console.print(f"* SSL established using {version!r} / {cipher[0]!r}") - console.print(f"* Selected ALPN protocol: {alpn!r}") - if server_cert: - console.print("* Server certificate:") - console.print(format_certificate(server_cert)) - elif name == "http11.send_request_headers.started" and verbose: - request = info["request"] - print_request_headers(request, http2=False) - elif name == "http2.send_request_headers.started" and verbose: # pragma: no cover - request = info["request"] - print_request_headers(request, http2=True) - elif name == "http11.receive_response_headers.complete": - http_version, status, reason_phrase, headers = info["return_value"] - print_response_headers(http_version, status, reason_phrase, headers) - elif name == "http2.receive_response_headers.complete": # pragma: no cover - status, headers = info["return_value"] - http_version = b"HTTP/2" - reason_phrase = None - print_response_headers(http_version, status, reason_phrase, headers) - - -def download_response(response: Response, download: typing.BinaryIO) -> None: - console = rich.console.Console() - console.print() - content_length = response.headers.get("Content-Length") - with rich.progress.Progress( - "[progress.description]{task.description}", - "[progress.percentage]{task.percentage:>3.0f}%", - rich.progress.BarColumn(bar_width=None), - rich.progress.DownloadColumn(), - rich.progress.TransferSpeedColumn(), - ) as progress: - description = f"Downloading [bold]{rich.markup.escape(download.name)}" - download_task = progress.add_task( - description, - total=int(content_length or 0), - start=content_length is not None, - ) - for chunk in response.iter_bytes(): - download.write(chunk) - progress.update(download_task, completed=response.num_bytes_downloaded) - - -def validate_json( - ctx: click.Context, - param: click.Option | click.Parameter, - value: typing.Any, -) -> typing.Any: - if value is None: - return None - - try: - return json.loads(value) - except json.JSONDecodeError: # pragma: no cover - raise click.BadParameter("Not valid JSON") - - -def validate_auth( - ctx: click.Context, - param: click.Option | click.Parameter, - value: typing.Any, -) -> typing.Any: - if value == (None, None): - return None - - username, password = value - if password == "-": # pragma: no cover - password = click.prompt("Password", hide_input=True) - return (username, password) - - -def handle_help( - ctx: click.Context, - param: click.Option | click.Parameter, - value: typing.Any, -) -> None: - if not value or ctx.resilient_parsing: - return - - print_help() - ctx.exit() - - -@click.command(add_help_option=False) -@click.argument("url", type=str) -@click.option( - "--method", - "-m", - "method", - type=str, - help=( - "Request method, such as GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD. " - "[Default: GET, or POST if a request body is included]" - ), -) -@click.option( - "--params", - "-p", - "params", - type=(str, str), - multiple=True, - help="Query parameters to include in the request URL.", -) -@click.option( - "--content", - "-c", - "content", - type=str, - help="Byte content to include in the request body.", -) -@click.option( - "--data", - "-d", - "data", - type=(str, str), - multiple=True, - help="Form data to include in the request body.", -) -@click.option( - "--files", - "-f", - "files", - type=(str, click.File(mode="rb")), - multiple=True, - help="Form files to include in the request body.", -) -@click.option( - "--json", - "-j", - "json", - type=str, - callback=validate_json, - help="JSON data to include in the request body.", -) -@click.option( - "--headers", - "-h", - "headers", - type=(str, str), - multiple=True, - help="Include additional HTTP headers in the request.", -) -@click.option( - "--cookies", - "cookies", - type=(str, str), - multiple=True, - help="Cookies to include in the request.", -) -@click.option( - "--auth", - "auth", - type=(str, str), - default=(None, None), - callback=validate_auth, - help=( - "Username and password to include in the request. " - "Specify '-' for the password to use a password prompt. " - "Note that using --verbose/-v will expose the Authorization header, " - "including the password encoding in a trivially reversible format." - ), -) -@click.option( - "--proxy", - "proxy", - type=str, - default=None, - help="Send the request via a proxy. Should be the URL giving the proxy address.", -) -@click.option( - "--timeout", - "timeout", - type=float, - default=5.0, - help=( - "Timeout value to use for network operations, such as establishing the " - "connection, reading some data, etc... [Default: 5.0]" - ), -) -@click.option( - "--follow-redirects", - "follow_redirects", - is_flag=True, - default=False, - help="Automatically follow redirects.", -) -@click.option( - "--no-verify", - "verify", - is_flag=True, - default=True, - help="Disable SSL verification.", -) -@click.option( - "--http2", - "http2", - type=bool, - is_flag=True, - default=False, - help="Send the request using HTTP/2, if the remote server supports it.", -) -@click.option( - "--download", - type=click.File("wb"), - help="Save the response content as a file, rather than displaying it.", -) -@click.option( - "--verbose", - "-v", - type=bool, - is_flag=True, - default=False, - help="Verbose. Show request as well as response.", -) -@click.option( - "--help", - is_flag=True, - is_eager=True, - expose_value=False, - callback=handle_help, - help="Show this message and exit.", -) -def main( - url: str, - method: str, - params: list[tuple[str, str]], - content: str, - data: list[tuple[str, str]], - files: list[tuple[str, click.File]], - json: str, - headers: list[tuple[str, str]], - cookies: list[tuple[str, str]], - auth: tuple[str, str] | None, - proxy: str, - timeout: float, - follow_redirects: bool, - verify: bool, - http2: bool, - download: typing.BinaryIO | None, - verbose: bool, -) -> None: - """ - An HTTP command line client. - Sends a request and displays the response. - """ - if not method: - method = "POST" if content or data or files or json else "GET" - - try: - with Client(proxy=proxy, timeout=timeout, http2=http2, verify=verify) as client: - with client.stream( - method, - url, - params=list(params), - content=content, - data=dict(data), - files=files, # type: ignore - json=json, - headers=headers, - cookies=dict(cookies), - auth=auth, - follow_redirects=follow_redirects, - extensions={"trace": functools.partial(trace, verbose=verbose)}, - ) as response: - if download is not None: - download_response(response, download) - else: - response.read() - if response.content: - print_response(response) - - except RequestError as exc: - console = rich.console.Console() - console.print(f"[red]{type(exc).__name__}[/red]: {exc}") - sys.exit(1) - - sys.exit(0 if response.is_success else 1) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_models.py b/write-message/venv/lib/python3.10/site-packages/httpx/_models.py deleted file mode 100644 index 67d74bf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_models.py +++ /dev/null @@ -1,1277 +0,0 @@ -from __future__ import annotations - -import codecs -import datetime -import email.message -import json as jsonlib -import re -import typing -import urllib.request -from collections.abc import Mapping -from http.cookiejar import Cookie, CookieJar - -from ._content import ByteStream, UnattachedStream, encode_request, encode_response -from ._decoders import ( - SUPPORTED_DECODERS, - ByteChunker, - ContentDecoder, - IdentityDecoder, - LineDecoder, - MultiDecoder, - TextChunker, - TextDecoder, -) -from ._exceptions import ( - CookieConflict, - HTTPStatusError, - RequestNotRead, - ResponseNotRead, - StreamClosed, - StreamConsumed, - request_context, -) -from ._multipart import get_multipart_boundary_from_content_type -from ._status_codes import codes -from ._types import ( - AsyncByteStream, - CookieTypes, - HeaderTypes, - QueryParamTypes, - RequestContent, - RequestData, - RequestExtensions, - RequestFiles, - ResponseContent, - ResponseExtensions, - SyncByteStream, -) -from ._urls import URL -from ._utils import to_bytes_or_str, to_str - -__all__ = ["Cookies", "Headers", "Request", "Response"] - -SENSITIVE_HEADERS = {"authorization", "proxy-authorization"} - - -def _is_known_encoding(encoding: str) -> bool: - """ - Return `True` if `encoding` is a known codec. - """ - try: - codecs.lookup(encoding) - except LookupError: - return False - return True - - -def _normalize_header_key(key: str | bytes, encoding: str | None = None) -> bytes: - """ - Coerce str/bytes into a strictly byte-wise HTTP header key. - """ - return key if isinstance(key, bytes) else key.encode(encoding or "ascii") - - -def _normalize_header_value(value: str | bytes, encoding: str | None = None) -> bytes: - """ - Coerce str/bytes into a strictly byte-wise HTTP header value. - """ - if isinstance(value, bytes): - return value - if not isinstance(value, str): - raise TypeError(f"Header value must be str or bytes, not {type(value)}") - return value.encode(encoding or "ascii") - - -def _parse_content_type_charset(content_type: str) -> str | None: - # We used to use `cgi.parse_header()` here, but `cgi` became a dead battery. - # See: https://peps.python.org/pep-0594/#cgi - msg = email.message.Message() - msg["content-type"] = content_type - return msg.get_content_charset(failobj=None) - - -def _parse_header_links(value: str) -> list[dict[str, str]]: - """ - Returns a list of parsed link headers, for more info see: - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link - The generic syntax of those is: - Link: < uri-reference >; param1=value1; param2="value2" - So for instance: - Link; '; type="image/jpeg",;' - would return - [ - {"url": "http:/.../front.jpeg", "type": "image/jpeg"}, - {"url": "http://.../back.jpeg"}, - ] - :param value: HTTP Link entity-header field - :return: list of parsed link headers - """ - links: list[dict[str, str]] = [] - replace_chars = " '\"" - value = value.strip(replace_chars) - if not value: - return links - for val in re.split(", *<", value): - try: - url, params = val.split(";", 1) - except ValueError: - url, params = val, "" - link = {"url": url.strip("<> '\"")} - for param in params.split(";"): - try: - key, value = param.split("=") - except ValueError: - break - link[key.strip(replace_chars)] = value.strip(replace_chars) - links.append(link) - return links - - -def _obfuscate_sensitive_headers( - items: typing.Iterable[tuple[typing.AnyStr, typing.AnyStr]], -) -> typing.Iterator[tuple[typing.AnyStr, typing.AnyStr]]: - for k, v in items: - if to_str(k.lower()) in SENSITIVE_HEADERS: - v = to_bytes_or_str("[secure]", match_type_of=v) - yield k, v - - -class Headers(typing.MutableMapping[str, str]): - """ - HTTP headers, as a case-insensitive multi-dict. - """ - - def __init__( - self, - headers: HeaderTypes | None = None, - encoding: str | None = None, - ) -> None: - self._list = [] # type: typing.List[typing.Tuple[bytes, bytes, bytes]] - - if isinstance(headers, Headers): - self._list = list(headers._list) - elif isinstance(headers, Mapping): - for k, v in headers.items(): - bytes_key = _normalize_header_key(k, encoding) - bytes_value = _normalize_header_value(v, encoding) - self._list.append((bytes_key, bytes_key.lower(), bytes_value)) - elif headers is not None: - for k, v in headers: - bytes_key = _normalize_header_key(k, encoding) - bytes_value = _normalize_header_value(v, encoding) - self._list.append((bytes_key, bytes_key.lower(), bytes_value)) - - self._encoding = encoding - - @property - def encoding(self) -> str: - """ - Header encoding is mandated as ascii, but we allow fallbacks to utf-8 - or iso-8859-1. - """ - if self._encoding is None: - for encoding in ["ascii", "utf-8"]: - for key, value in self.raw: - try: - key.decode(encoding) - value.decode(encoding) - except UnicodeDecodeError: - break - else: - # The else block runs if 'break' did not occur, meaning - # all values fitted the encoding. - self._encoding = encoding - break - else: - # The ISO-8859-1 encoding covers all 256 code points in a byte, - # so will never raise decode errors. - self._encoding = "iso-8859-1" - return self._encoding - - @encoding.setter - def encoding(self, value: str) -> None: - self._encoding = value - - @property - def raw(self) -> list[tuple[bytes, bytes]]: - """ - Returns a list of the raw header items, as byte pairs. - """ - return [(raw_key, value) for raw_key, _, value in self._list] - - def keys(self) -> typing.KeysView[str]: - return {key.decode(self.encoding): None for _, key, value in self._list}.keys() - - def values(self) -> typing.ValuesView[str]: - values_dict: dict[str, str] = {} - for _, key, value in self._list: - str_key = key.decode(self.encoding) - str_value = value.decode(self.encoding) - if str_key in values_dict: - values_dict[str_key] += f", {str_value}" - else: - values_dict[str_key] = str_value - return values_dict.values() - - def items(self) -> typing.ItemsView[str, str]: - """ - Return `(key, value)` items of headers. Concatenate headers - into a single comma separated value when a key occurs multiple times. - """ - values_dict: dict[str, str] = {} - for _, key, value in self._list: - str_key = key.decode(self.encoding) - str_value = value.decode(self.encoding) - if str_key in values_dict: - values_dict[str_key] += f", {str_value}" - else: - values_dict[str_key] = str_value - return values_dict.items() - - def multi_items(self) -> list[tuple[str, str]]: - """ - Return a list of `(key, value)` pairs of headers. Allow multiple - occurrences of the same key without concatenating into a single - comma separated value. - """ - return [ - (key.decode(self.encoding), value.decode(self.encoding)) - for _, key, value in self._list - ] - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Return a header value. If multiple occurrences of the header occur - then concatenate them together with commas. - """ - try: - return self[key] - except KeyError: - return default - - def get_list(self, key: str, split_commas: bool = False) -> list[str]: - """ - Return a list of all header values for a given key. - If `split_commas=True` is passed, then any comma separated header - values are split into multiple return strings. - """ - get_header_key = key.lower().encode(self.encoding) - - values = [ - item_value.decode(self.encoding) - for _, item_key, item_value in self._list - if item_key.lower() == get_header_key - ] - - if not split_commas: - return values - - split_values = [] - for value in values: - split_values.extend([item.strip() for item in value.split(",")]) - return split_values - - def update(self, headers: HeaderTypes | None = None) -> None: # type: ignore - headers = Headers(headers) - for key in headers.keys(): - if key in self: - self.pop(key) - self._list.extend(headers._list) - - def copy(self) -> Headers: - return Headers(self, encoding=self.encoding) - - def __getitem__(self, key: str) -> str: - """ - Return a single header value. - - If there are multiple headers with the same key, then we concatenate - them with commas. See: https://tools.ietf.org/html/rfc7230#section-3.2.2 - """ - normalized_key = key.lower().encode(self.encoding) - - items = [ - header_value.decode(self.encoding) - for _, header_key, header_value in self._list - if header_key == normalized_key - ] - - if items: - return ", ".join(items) - - raise KeyError(key) - - def __setitem__(self, key: str, value: str) -> None: - """ - Set the header `key` to `value`, removing any duplicate entries. - Retains insertion order. - """ - set_key = key.encode(self._encoding or "utf-8") - set_value = value.encode(self._encoding or "utf-8") - lookup_key = set_key.lower() - - found_indexes = [ - idx - for idx, (_, item_key, _) in enumerate(self._list) - if item_key == lookup_key - ] - - for idx in reversed(found_indexes[1:]): - del self._list[idx] - - if found_indexes: - idx = found_indexes[0] - self._list[idx] = (set_key, lookup_key, set_value) - else: - self._list.append((set_key, lookup_key, set_value)) - - def __delitem__(self, key: str) -> None: - """ - Remove the header `key`. - """ - del_key = key.lower().encode(self.encoding) - - pop_indexes = [ - idx - for idx, (_, item_key, _) in enumerate(self._list) - if item_key.lower() == del_key - ] - - if not pop_indexes: - raise KeyError(key) - - for idx in reversed(pop_indexes): - del self._list[idx] - - def __contains__(self, key: typing.Any) -> bool: - header_key = key.lower().encode(self.encoding) - return header_key in [key for _, key, _ in self._list] - - def __iter__(self) -> typing.Iterator[typing.Any]: - return iter(self.keys()) - - def __len__(self) -> int: - return len(self._list) - - def __eq__(self, other: typing.Any) -> bool: - try: - other_headers = Headers(other) - except ValueError: - return False - - self_list = [(key, value) for _, key, value in self._list] - other_list = [(key, value) for _, key, value in other_headers._list] - return sorted(self_list) == sorted(other_list) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - - encoding_str = "" - if self.encoding != "ascii": - encoding_str = f", encoding={self.encoding!r}" - - as_list = list(_obfuscate_sensitive_headers(self.multi_items())) - as_dict = dict(as_list) - - no_duplicate_keys = len(as_dict) == len(as_list) - if no_duplicate_keys: - return f"{class_name}({as_dict!r}{encoding_str})" - return f"{class_name}({as_list!r}{encoding_str})" - - -class Request: - def __init__( - self, - method: str, - url: URL | str, - *, - params: QueryParamTypes | None = None, - headers: HeaderTypes | None = None, - cookies: CookieTypes | None = None, - content: RequestContent | None = None, - data: RequestData | None = None, - files: RequestFiles | None = None, - json: typing.Any | None = None, - stream: SyncByteStream | AsyncByteStream | None = None, - extensions: RequestExtensions | None = None, - ) -> None: - self.method = method.upper() - self.url = URL(url) if params is None else URL(url, params=params) - self.headers = Headers(headers) - self.extensions = {} if extensions is None else dict(extensions) - - if cookies: - Cookies(cookies).set_cookie_header(self) - - if stream is None: - content_type: str | None = self.headers.get("content-type") - headers, stream = encode_request( - content=content, - data=data, - files=files, - json=json, - boundary=get_multipart_boundary_from_content_type( - content_type=content_type.encode(self.headers.encoding) - if content_type - else None - ), - ) - self._prepare(headers) - self.stream = stream - # Load the request body, except for streaming content. - if isinstance(stream, ByteStream): - self.read() - else: - # There's an important distinction between `Request(content=...)`, - # and `Request(stream=...)`. - # - # Using `content=...` implies automatically populated `Host` and content - # headers, of either `Content-Length: ...` or `Transfer-Encoding: chunked`. - # - # Using `stream=...` will not automatically include *any* - # auto-populated headers. - # - # As an end-user you don't really need `stream=...`. It's only - # useful when: - # - # * Preserving the request stream when copying requests, eg for redirects. - # * Creating request instances on the *server-side* of the transport API. - self.stream = stream - - def _prepare(self, default_headers: dict[str, str]) -> None: - for key, value in default_headers.items(): - # Ignore Transfer-Encoding if the Content-Length has been set explicitly. - if key.lower() == "transfer-encoding" and "Content-Length" in self.headers: - continue - self.headers.setdefault(key, value) - - auto_headers: list[tuple[bytes, bytes]] = [] - - has_host = "Host" in self.headers - has_content_length = ( - "Content-Length" in self.headers or "Transfer-Encoding" in self.headers - ) - - if not has_host and self.url.host: - auto_headers.append((b"Host", self.url.netloc)) - if not has_content_length and self.method in ("POST", "PUT", "PATCH"): - auto_headers.append((b"Content-Length", b"0")) - - self.headers = Headers(auto_headers + self.headers.raw) - - @property - def content(self) -> bytes: - if not hasattr(self, "_content"): - raise RequestNotRead() - return self._content - - def read(self) -> bytes: - """ - Read and return the request content. - """ - if not hasattr(self, "_content"): - assert isinstance(self.stream, typing.Iterable) - self._content = b"".join(self.stream) - if not isinstance(self.stream, ByteStream): - # If a streaming request has been read entirely into memory, then - # we can replace the stream with a raw bytes implementation, - # to ensure that any non-replayable streams can still be used. - self.stream = ByteStream(self._content) - return self._content - - async def aread(self) -> bytes: - """ - Read and return the request content. - """ - if not hasattr(self, "_content"): - assert isinstance(self.stream, typing.AsyncIterable) - self._content = b"".join([part async for part in self.stream]) - if not isinstance(self.stream, ByteStream): - # If a streaming request has been read entirely into memory, then - # we can replace the stream with a raw bytes implementation, - # to ensure that any non-replayable streams can still be used. - self.stream = ByteStream(self._content) - return self._content - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - url = str(self.url) - return f"<{class_name}({self.method!r}, {url!r})>" - - def __getstate__(self) -> dict[str, typing.Any]: - return { - name: value - for name, value in self.__dict__.items() - if name not in ["extensions", "stream"] - } - - def __setstate__(self, state: dict[str, typing.Any]) -> None: - for name, value in state.items(): - setattr(self, name, value) - self.extensions = {} - self.stream = UnattachedStream() - - -class Response: - def __init__( - self, - status_code: int, - *, - headers: HeaderTypes | None = None, - content: ResponseContent | None = None, - text: str | None = None, - html: str | None = None, - json: typing.Any = None, - stream: SyncByteStream | AsyncByteStream | None = None, - request: Request | None = None, - extensions: ResponseExtensions | None = None, - history: list[Response] | None = None, - default_encoding: str | typing.Callable[[bytes], str] = "utf-8", - ) -> None: - self.status_code = status_code - self.headers = Headers(headers) - - self._request: Request | None = request - - # When follow_redirects=False and a redirect is received, - # the client will set `response.next_request`. - self.next_request: Request | None = None - - self.extensions = {} if extensions is None else dict(extensions) - self.history = [] if history is None else list(history) - - self.is_closed = False - self.is_stream_consumed = False - - self.default_encoding = default_encoding - - if stream is None: - headers, stream = encode_response(content, text, html, json) - self._prepare(headers) - self.stream = stream - if isinstance(stream, ByteStream): - # Load the response body, except for streaming content. - self.read() - else: - # There's an important distinction between `Response(content=...)`, - # and `Response(stream=...)`. - # - # Using `content=...` implies automatically populated content headers, - # of either `Content-Length: ...` or `Transfer-Encoding: chunked`. - # - # Using `stream=...` will not automatically include any content headers. - # - # As an end-user you don't really need `stream=...`. It's only - # useful when creating response instances having received a stream - # from the transport API. - self.stream = stream - - self._num_bytes_downloaded = 0 - - def _prepare(self, default_headers: dict[str, str]) -> None: - for key, value in default_headers.items(): - # Ignore Transfer-Encoding if the Content-Length has been set explicitly. - if key.lower() == "transfer-encoding" and "content-length" in self.headers: - continue - self.headers.setdefault(key, value) - - @property - def elapsed(self) -> datetime.timedelta: - """ - Returns the time taken for the complete request/response - cycle to complete. - """ - if not hasattr(self, "_elapsed"): - raise RuntimeError( - "'.elapsed' may only be accessed after the response " - "has been read or closed." - ) - return self._elapsed - - @elapsed.setter - def elapsed(self, elapsed: datetime.timedelta) -> None: - self._elapsed = elapsed - - @property - def request(self) -> Request: - """ - Returns the request instance associated to the current response. - """ - if self._request is None: - raise RuntimeError( - "The request instance has not been set on this response." - ) - return self._request - - @request.setter - def request(self, value: Request) -> None: - self._request = value - - @property - def http_version(self) -> str: - try: - http_version: bytes = self.extensions["http_version"] - except KeyError: - return "HTTP/1.1" - else: - return http_version.decode("ascii", errors="ignore") - - @property - def reason_phrase(self) -> str: - try: - reason_phrase: bytes = self.extensions["reason_phrase"] - except KeyError: - return codes.get_reason_phrase(self.status_code) - else: - return reason_phrase.decode("ascii", errors="ignore") - - @property - def url(self) -> URL: - """ - Returns the URL for which the request was made. - """ - return self.request.url - - @property - def content(self) -> bytes: - if not hasattr(self, "_content"): - raise ResponseNotRead() - return self._content - - @property - def text(self) -> str: - if not hasattr(self, "_text"): - content = self.content - if not content: - self._text = "" - else: - decoder = TextDecoder(encoding=self.encoding or "utf-8") - self._text = "".join([decoder.decode(self.content), decoder.flush()]) - return self._text - - @property - def encoding(self) -> str | None: - """ - Return an encoding to use for decoding the byte content into text. - The priority for determining this is given by... - - * `.encoding = <>` has been set explicitly. - * The encoding as specified by the charset parameter in the Content-Type header. - * The encoding as determined by `default_encoding`, which may either be - a string like "utf-8" indicating the encoding to use, or may be a callable - which enables charset autodetection. - """ - if not hasattr(self, "_encoding"): - encoding = self.charset_encoding - if encoding is None or not _is_known_encoding(encoding): - if isinstance(self.default_encoding, str): - encoding = self.default_encoding - elif hasattr(self, "_content"): - encoding = self.default_encoding(self._content) - self._encoding = encoding or "utf-8" - return self._encoding - - @encoding.setter - def encoding(self, value: str) -> None: - """ - Set the encoding to use for decoding the byte content into text. - - If the `text` attribute has been accessed, attempting to set the - encoding will throw a ValueError. - """ - if hasattr(self, "_text"): - raise ValueError( - "Setting encoding after `text` has been accessed is not allowed." - ) - self._encoding = value - - @property - def charset_encoding(self) -> str | None: - """ - Return the encoding, as specified by the Content-Type header. - """ - content_type = self.headers.get("Content-Type") - if content_type is None: - return None - - return _parse_content_type_charset(content_type) - - def _get_content_decoder(self) -> ContentDecoder: - """ - Returns a decoder instance which can be used to decode the raw byte - content, depending on the Content-Encoding used in the response. - """ - if not hasattr(self, "_decoder"): - decoders: list[ContentDecoder] = [] - values = self.headers.get_list("content-encoding", split_commas=True) - for value in values: - value = value.strip().lower() - try: - decoder_cls = SUPPORTED_DECODERS[value] - decoders.append(decoder_cls()) - except KeyError: - continue - - if len(decoders) == 1: - self._decoder = decoders[0] - elif len(decoders) > 1: - self._decoder = MultiDecoder(children=decoders) - else: - self._decoder = IdentityDecoder() - - return self._decoder - - @property - def is_informational(self) -> bool: - """ - A property which is `True` for 1xx status codes, `False` otherwise. - """ - return codes.is_informational(self.status_code) - - @property - def is_success(self) -> bool: - """ - A property which is `True` for 2xx status codes, `False` otherwise. - """ - return codes.is_success(self.status_code) - - @property - def is_redirect(self) -> bool: - """ - A property which is `True` for 3xx status codes, `False` otherwise. - - Note that not all responses with a 3xx status code indicate a URL redirect. - - Use `response.has_redirect_location` to determine responses with a properly - formed URL redirection. - """ - return codes.is_redirect(self.status_code) - - @property - def is_client_error(self) -> bool: - """ - A property which is `True` for 4xx status codes, `False` otherwise. - """ - return codes.is_client_error(self.status_code) - - @property - def is_server_error(self) -> bool: - """ - A property which is `True` for 5xx status codes, `False` otherwise. - """ - return codes.is_server_error(self.status_code) - - @property - def is_error(self) -> bool: - """ - A property which is `True` for 4xx and 5xx status codes, `False` otherwise. - """ - return codes.is_error(self.status_code) - - @property - def has_redirect_location(self) -> bool: - """ - Returns True for 3xx responses with a properly formed URL redirection, - `False` otherwise. - """ - return ( - self.status_code - in ( - # 301 (Cacheable redirect. Method may change to GET.) - codes.MOVED_PERMANENTLY, - # 302 (Uncacheable redirect. Method may change to GET.) - codes.FOUND, - # 303 (Client should make a GET or HEAD request.) - codes.SEE_OTHER, - # 307 (Equiv. 302, but retain method) - codes.TEMPORARY_REDIRECT, - # 308 (Equiv. 301, but retain method) - codes.PERMANENT_REDIRECT, - ) - and "Location" in self.headers - ) - - def raise_for_status(self) -> Response: - """ - Raise the `HTTPStatusError` if one occurred. - """ - request = self._request - if request is None: - raise RuntimeError( - "Cannot call `raise_for_status` as the request " - "instance has not been set on this response." - ) - - if self.is_success: - return self - - if self.has_redirect_location: - message = ( - "{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n" - "Redirect location: '{0.headers[location]}'\n" - "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}" - ) - else: - message = ( - "{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'\n" - "For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}" - ) - - status_class = self.status_code // 100 - error_types = { - 1: "Informational response", - 3: "Redirect response", - 4: "Client error", - 5: "Server error", - } - error_type = error_types.get(status_class, "Invalid status code") - message = message.format(self, error_type=error_type) - raise HTTPStatusError(message, request=request, response=self) - - def json(self, **kwargs: typing.Any) -> typing.Any: - return jsonlib.loads(self.content, **kwargs) - - @property - def cookies(self) -> Cookies: - if not hasattr(self, "_cookies"): - self._cookies = Cookies() - self._cookies.extract_cookies(self) - return self._cookies - - @property - def links(self) -> dict[str | None, dict[str, str]]: - """ - Returns the parsed header links of the response, if any - """ - header = self.headers.get("link") - if header is None: - return {} - - return { - (link.get("rel") or link.get("url")): link - for link in _parse_header_links(header) - } - - @property - def num_bytes_downloaded(self) -> int: - return self._num_bytes_downloaded - - def __repr__(self) -> str: - return f"" - - def __getstate__(self) -> dict[str, typing.Any]: - return { - name: value - for name, value in self.__dict__.items() - if name not in ["extensions", "stream", "is_closed", "_decoder"] - } - - def __setstate__(self, state: dict[str, typing.Any]) -> None: - for name, value in state.items(): - setattr(self, name, value) - self.is_closed = True - self.extensions = {} - self.stream = UnattachedStream() - - def read(self) -> bytes: - """ - Read and return the response content. - """ - if not hasattr(self, "_content"): - self._content = b"".join(self.iter_bytes()) - return self._content - - def iter_bytes(self, chunk_size: int | None = None) -> typing.Iterator[bytes]: - """ - A byte-iterator over the decoded response content. - This allows us to handle gzip, deflate, brotli, and zstd encoded responses. - """ - if hasattr(self, "_content"): - chunk_size = len(self._content) if chunk_size is None else chunk_size - for i in range(0, len(self._content), max(chunk_size, 1)): - yield self._content[i : i + chunk_size] - else: - decoder = self._get_content_decoder() - chunker = ByteChunker(chunk_size=chunk_size) - with request_context(request=self._request): - for raw_bytes in self.iter_raw(): - decoded = decoder.decode(raw_bytes) - for chunk in chunker.decode(decoded): - yield chunk - decoded = decoder.flush() - for chunk in chunker.decode(decoded): - yield chunk # pragma: no cover - for chunk in chunker.flush(): - yield chunk - - def iter_text(self, chunk_size: int | None = None) -> typing.Iterator[str]: - """ - A str-iterator over the decoded response content - that handles both gzip, deflate, etc but also detects the content's - string encoding. - """ - decoder = TextDecoder(encoding=self.encoding or "utf-8") - chunker = TextChunker(chunk_size=chunk_size) - with request_context(request=self._request): - for byte_content in self.iter_bytes(): - text_content = decoder.decode(byte_content) - for chunk in chunker.decode(text_content): - yield chunk - text_content = decoder.flush() - for chunk in chunker.decode(text_content): - yield chunk # pragma: no cover - for chunk in chunker.flush(): - yield chunk - - def iter_lines(self) -> typing.Iterator[str]: - decoder = LineDecoder() - with request_context(request=self._request): - for text in self.iter_text(): - for line in decoder.decode(text): - yield line - for line in decoder.flush(): - yield line - - def iter_raw(self, chunk_size: int | None = None) -> typing.Iterator[bytes]: - """ - A byte-iterator over the raw response content. - """ - if self.is_stream_consumed: - raise StreamConsumed() - if self.is_closed: - raise StreamClosed() - if not isinstance(self.stream, SyncByteStream): - raise RuntimeError("Attempted to call a sync iterator on an async stream.") - - self.is_stream_consumed = True - self._num_bytes_downloaded = 0 - chunker = ByteChunker(chunk_size=chunk_size) - - with request_context(request=self._request): - for raw_stream_bytes in self.stream: - self._num_bytes_downloaded += len(raw_stream_bytes) - for chunk in chunker.decode(raw_stream_bytes): - yield chunk - - for chunk in chunker.flush(): - yield chunk - - self.close() - - def close(self) -> None: - """ - Close the response and release the connection. - Automatically called if the response body is read to completion. - """ - if not isinstance(self.stream, SyncByteStream): - raise RuntimeError("Attempted to call an sync close on an async stream.") - - if not self.is_closed: - self.is_closed = True - with request_context(request=self._request): - self.stream.close() - - async def aread(self) -> bytes: - """ - Read and return the response content. - """ - if not hasattr(self, "_content"): - self._content = b"".join([part async for part in self.aiter_bytes()]) - return self._content - - async def aiter_bytes( - self, chunk_size: int | None = None - ) -> typing.AsyncIterator[bytes]: - """ - A byte-iterator over the decoded response content. - This allows us to handle gzip, deflate, brotli, and zstd encoded responses. - """ - if hasattr(self, "_content"): - chunk_size = len(self._content) if chunk_size is None else chunk_size - for i in range(0, len(self._content), max(chunk_size, 1)): - yield self._content[i : i + chunk_size] - else: - decoder = self._get_content_decoder() - chunker = ByteChunker(chunk_size=chunk_size) - with request_context(request=self._request): - async for raw_bytes in self.aiter_raw(): - decoded = decoder.decode(raw_bytes) - for chunk in chunker.decode(decoded): - yield chunk - decoded = decoder.flush() - for chunk in chunker.decode(decoded): - yield chunk # pragma: no cover - for chunk in chunker.flush(): - yield chunk - - async def aiter_text( - self, chunk_size: int | None = None - ) -> typing.AsyncIterator[str]: - """ - A str-iterator over the decoded response content - that handles both gzip, deflate, etc but also detects the content's - string encoding. - """ - decoder = TextDecoder(encoding=self.encoding or "utf-8") - chunker = TextChunker(chunk_size=chunk_size) - with request_context(request=self._request): - async for byte_content in self.aiter_bytes(): - text_content = decoder.decode(byte_content) - for chunk in chunker.decode(text_content): - yield chunk - text_content = decoder.flush() - for chunk in chunker.decode(text_content): - yield chunk # pragma: no cover - for chunk in chunker.flush(): - yield chunk - - async def aiter_lines(self) -> typing.AsyncIterator[str]: - decoder = LineDecoder() - with request_context(request=self._request): - async for text in self.aiter_text(): - for line in decoder.decode(text): - yield line - for line in decoder.flush(): - yield line - - async def aiter_raw( - self, chunk_size: int | None = None - ) -> typing.AsyncIterator[bytes]: - """ - A byte-iterator over the raw response content. - """ - if self.is_stream_consumed: - raise StreamConsumed() - if self.is_closed: - raise StreamClosed() - if not isinstance(self.stream, AsyncByteStream): - raise RuntimeError("Attempted to call an async iterator on an sync stream.") - - self.is_stream_consumed = True - self._num_bytes_downloaded = 0 - chunker = ByteChunker(chunk_size=chunk_size) - - with request_context(request=self._request): - async for raw_stream_bytes in self.stream: - self._num_bytes_downloaded += len(raw_stream_bytes) - for chunk in chunker.decode(raw_stream_bytes): - yield chunk - - for chunk in chunker.flush(): - yield chunk - - await self.aclose() - - async def aclose(self) -> None: - """ - Close the response and release the connection. - Automatically called if the response body is read to completion. - """ - if not isinstance(self.stream, AsyncByteStream): - raise RuntimeError("Attempted to call an async close on an sync stream.") - - if not self.is_closed: - self.is_closed = True - with request_context(request=self._request): - await self.stream.aclose() - - -class Cookies(typing.MutableMapping[str, str]): - """ - HTTP Cookies, as a mutable mapping. - """ - - def __init__(self, cookies: CookieTypes | None = None) -> None: - if cookies is None or isinstance(cookies, dict): - self.jar = CookieJar() - if isinstance(cookies, dict): - for key, value in cookies.items(): - self.set(key, value) - elif isinstance(cookies, list): - self.jar = CookieJar() - for key, value in cookies: - self.set(key, value) - elif isinstance(cookies, Cookies): - self.jar = CookieJar() - for cookie in cookies.jar: - self.jar.set_cookie(cookie) - else: - self.jar = cookies - - def extract_cookies(self, response: Response) -> None: - """ - Loads any cookies based on the response `Set-Cookie` headers. - """ - urllib_response = self._CookieCompatResponse(response) - urllib_request = self._CookieCompatRequest(response.request) - - self.jar.extract_cookies(urllib_response, urllib_request) # type: ignore - - def set_cookie_header(self, request: Request) -> None: - """ - Sets an appropriate 'Cookie:' HTTP header on the `Request`. - """ - urllib_request = self._CookieCompatRequest(request) - self.jar.add_cookie_header(urllib_request) - - def set(self, name: str, value: str, domain: str = "", path: str = "/") -> None: - """ - Set a cookie value by name. May optionally include domain and path. - """ - kwargs = { - "version": 0, - "name": name, - "value": value, - "port": None, - "port_specified": False, - "domain": domain, - "domain_specified": bool(domain), - "domain_initial_dot": domain.startswith("."), - "path": path, - "path_specified": bool(path), - "secure": False, - "expires": None, - "discard": True, - "comment": None, - "comment_url": None, - "rest": {"HttpOnly": None}, - "rfc2109": False, - } - cookie = Cookie(**kwargs) # type: ignore - self.jar.set_cookie(cookie) - - def get( # type: ignore - self, - name: str, - default: str | None = None, - domain: str | None = None, - path: str | None = None, - ) -> str | None: - """ - Get a cookie by name. May optionally include domain and path - in order to specify exactly which cookie to retrieve. - """ - value = None - for cookie in self.jar: - if cookie.name == name: - if domain is None or cookie.domain == domain: - if path is None or cookie.path == path: - if value is not None: - message = f"Multiple cookies exist with name={name}" - raise CookieConflict(message) - value = cookie.value - - if value is None: - return default - return value - - def delete( - self, - name: str, - domain: str | None = None, - path: str | None = None, - ) -> None: - """ - Delete a cookie by name. May optionally include domain and path - in order to specify exactly which cookie to delete. - """ - if domain is not None and path is not None: - return self.jar.clear(domain, path, name) - - remove = [ - cookie - for cookie in self.jar - if cookie.name == name - and (domain is None or cookie.domain == domain) - and (path is None or cookie.path == path) - ] - - for cookie in remove: - self.jar.clear(cookie.domain, cookie.path, cookie.name) - - def clear(self, domain: str | None = None, path: str | None = None) -> None: - """ - Delete all cookies. Optionally include a domain and path in - order to only delete a subset of all the cookies. - """ - args = [] - if domain is not None: - args.append(domain) - if path is not None: - assert domain is not None - args.append(path) - self.jar.clear(*args) - - def update(self, cookies: CookieTypes | None = None) -> None: # type: ignore - cookies = Cookies(cookies) - for cookie in cookies.jar: - self.jar.set_cookie(cookie) - - def __setitem__(self, name: str, value: str) -> None: - return self.set(name, value) - - def __getitem__(self, name: str) -> str: - value = self.get(name) - if value is None: - raise KeyError(name) - return value - - def __delitem__(self, name: str) -> None: - return self.delete(name) - - def __len__(self) -> int: - return len(self.jar) - - def __iter__(self) -> typing.Iterator[str]: - return (cookie.name for cookie in self.jar) - - def __bool__(self) -> bool: - for _ in self.jar: - return True - return False - - def __repr__(self) -> str: - cookies_repr = ", ".join( - [ - f"" - for cookie in self.jar - ] - ) - - return f"" - - class _CookieCompatRequest(urllib.request.Request): - """ - Wraps a `Request` instance up in a compatibility interface suitable - for use with `CookieJar` operations. - """ - - def __init__(self, request: Request) -> None: - super().__init__( - url=str(request.url), - headers=dict(request.headers), - method=request.method, - ) - self.request = request - - def add_unredirected_header(self, key: str, value: str) -> None: - super().add_unredirected_header(key, value) - self.request.headers[key] = value - - class _CookieCompatResponse: - """ - Wraps a `Request` instance up in a compatibility interface suitable - for use with `CookieJar` operations. - """ - - def __init__(self, response: Response) -> None: - self.response = response - - def info(self) -> email.message.Message: - info = email.message.Message() - for key, value in self.response.headers.multi_items(): - # Note that setting `info[key]` here is an "append" operation, - # not a "replace" operation. - # https://docs.python.org/3/library/email.compat32-message.html#email.message.Message.__setitem__ - info[key] = value - return info diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_multipart.py b/write-message/venv/lib/python3.10/site-packages/httpx/_multipart.py deleted file mode 100644 index b4761af..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_multipart.py +++ /dev/null @@ -1,300 +0,0 @@ -from __future__ import annotations - -import io -import mimetypes -import os -import re -import typing -from pathlib import Path - -from ._types import ( - AsyncByteStream, - FileContent, - FileTypes, - RequestData, - RequestFiles, - SyncByteStream, -) -from ._utils import ( - peek_filelike_length, - primitive_value_to_str, - to_bytes, -) - -_HTML5_FORM_ENCODING_REPLACEMENTS = {'"': "%22", "\\": "\\\\"} -_HTML5_FORM_ENCODING_REPLACEMENTS.update( - {chr(c): "%{:02X}".format(c) for c in range(0x1F + 1) if c != 0x1B} -) -_HTML5_FORM_ENCODING_RE = re.compile( - r"|".join([re.escape(c) for c in _HTML5_FORM_ENCODING_REPLACEMENTS.keys()]) -) - - -def _format_form_param(name: str, value: str) -> bytes: - """ - Encode a name/value pair within a multipart form. - """ - - def replacer(match: typing.Match[str]) -> str: - return _HTML5_FORM_ENCODING_REPLACEMENTS[match.group(0)] - - value = _HTML5_FORM_ENCODING_RE.sub(replacer, value) - return f'{name}="{value}"'.encode() - - -def _guess_content_type(filename: str | None) -> str | None: - """ - Guesses the mimetype based on a filename. Defaults to `application/octet-stream`. - - Returns `None` if `filename` is `None` or empty. - """ - if filename: - return mimetypes.guess_type(filename)[0] or "application/octet-stream" - return None - - -def get_multipart_boundary_from_content_type( - content_type: bytes | None, -) -> bytes | None: - if not content_type or not content_type.startswith(b"multipart/form-data"): - return None - # parse boundary according to - # https://www.rfc-editor.org/rfc/rfc2046#section-5.1.1 - if b";" in content_type: - for section in content_type.split(b";"): - if section.strip().lower().startswith(b"boundary="): - return section.strip()[len(b"boundary=") :].strip(b'"') - return None - - -class DataField: - """ - A single form field item, within a multipart form field. - """ - - def __init__(self, name: str, value: str | bytes | int | float | None) -> None: - if not isinstance(name, str): - raise TypeError( - f"Invalid type for name. Expected str, got {type(name)}: {name!r}" - ) - if value is not None and not isinstance(value, (str, bytes, int, float)): - raise TypeError( - "Invalid type for value. Expected primitive type," - f" got {type(value)}: {value!r}" - ) - self.name = name - self.value: str | bytes = ( - value if isinstance(value, bytes) else primitive_value_to_str(value) - ) - - def render_headers(self) -> bytes: - if not hasattr(self, "_headers"): - name = _format_form_param("name", self.name) - self._headers = b"".join( - [b"Content-Disposition: form-data; ", name, b"\r\n\r\n"] - ) - - return self._headers - - def render_data(self) -> bytes: - if not hasattr(self, "_data"): - self._data = to_bytes(self.value) - - return self._data - - def get_length(self) -> int: - headers = self.render_headers() - data = self.render_data() - return len(headers) + len(data) - - def render(self) -> typing.Iterator[bytes]: - yield self.render_headers() - yield self.render_data() - - -class FileField: - """ - A single file field item, within a multipart form field. - """ - - CHUNK_SIZE = 64 * 1024 - - def __init__(self, name: str, value: FileTypes) -> None: - self.name = name - - fileobj: FileContent - - headers: dict[str, str] = {} - content_type: str | None = None - - # This large tuple based API largely mirror's requests' API - # It would be good to think of better APIs for this that we could - # include in httpx 2.0 since variable length tuples(especially of 4 elements) - # are quite unwieldly - if isinstance(value, tuple): - if len(value) == 2: - # neither the 3rd parameter (content_type) nor the 4th (headers) - # was included - filename, fileobj = value - elif len(value) == 3: - filename, fileobj, content_type = value - else: - # all 4 parameters included - filename, fileobj, content_type, headers = value # type: ignore - else: - filename = Path(str(getattr(value, "name", "upload"))).name - fileobj = value - - if content_type is None: - content_type = _guess_content_type(filename) - - has_content_type_header = any("content-type" in key.lower() for key in headers) - if content_type is not None and not has_content_type_header: - # note that unlike requests, we ignore the content_type provided in the 3rd - # tuple element if it is also included in the headers requests does - # the opposite (it overwrites the headerwith the 3rd tuple element) - headers["Content-Type"] = content_type - - if isinstance(fileobj, io.StringIO): - raise TypeError( - "Multipart file uploads require 'io.BytesIO', not 'io.StringIO'." - ) - if isinstance(fileobj, io.TextIOBase): - raise TypeError( - "Multipart file uploads must be opened in binary mode, not text mode." - ) - - self.filename = filename - self.file = fileobj - self.headers = headers - - def get_length(self) -> int | None: - headers = self.render_headers() - - if isinstance(self.file, (str, bytes)): - return len(headers) + len(to_bytes(self.file)) - - file_length = peek_filelike_length(self.file) - - # If we can't determine the filesize without reading it into memory, - # then return `None` here, to indicate an unknown file length. - if file_length is None: - return None - - return len(headers) + file_length - - def render_headers(self) -> bytes: - if not hasattr(self, "_headers"): - parts = [ - b"Content-Disposition: form-data; ", - _format_form_param("name", self.name), - ] - if self.filename: - filename = _format_form_param("filename", self.filename) - parts.extend([b"; ", filename]) - for header_name, header_value in self.headers.items(): - key, val = f"\r\n{header_name}: ".encode(), header_value.encode() - parts.extend([key, val]) - parts.append(b"\r\n\r\n") - self._headers = b"".join(parts) - - return self._headers - - def render_data(self) -> typing.Iterator[bytes]: - if isinstance(self.file, (str, bytes)): - yield to_bytes(self.file) - return - - if hasattr(self.file, "seek"): - try: - self.file.seek(0) - except io.UnsupportedOperation: - pass - - chunk = self.file.read(self.CHUNK_SIZE) - while chunk: - yield to_bytes(chunk) - chunk = self.file.read(self.CHUNK_SIZE) - - def render(self) -> typing.Iterator[bytes]: - yield self.render_headers() - yield from self.render_data() - - -class MultipartStream(SyncByteStream, AsyncByteStream): - """ - Request content as streaming multipart encoded form data. - """ - - def __init__( - self, - data: RequestData, - files: RequestFiles, - boundary: bytes | None = None, - ) -> None: - if boundary is None: - boundary = os.urandom(16).hex().encode("ascii") - - self.boundary = boundary - self.content_type = "multipart/form-data; boundary=%s" % boundary.decode( - "ascii" - ) - self.fields = list(self._iter_fields(data, files)) - - def _iter_fields( - self, data: RequestData, files: RequestFiles - ) -> typing.Iterator[FileField | DataField]: - for name, value in data.items(): - if isinstance(value, (tuple, list)): - for item in value: - yield DataField(name=name, value=item) - else: - yield DataField(name=name, value=value) - - file_items = files.items() if isinstance(files, typing.Mapping) else files - for name, value in file_items: - yield FileField(name=name, value=value) - - def iter_chunks(self) -> typing.Iterator[bytes]: - for field in self.fields: - yield b"--%s\r\n" % self.boundary - yield from field.render() - yield b"\r\n" - yield b"--%s--\r\n" % self.boundary - - def get_content_length(self) -> int | None: - """ - Return the length of the multipart encoded content, or `None` if - any of the files have a length that cannot be determined upfront. - """ - boundary_length = len(self.boundary) - length = 0 - - for field in self.fields: - field_length = field.get_length() - if field_length is None: - return None - - length += 2 + boundary_length + 2 # b"--{boundary}\r\n" - length += field_length - length += 2 # b"\r\n" - - length += 2 + boundary_length + 4 # b"--{boundary}--\r\n" - return length - - # Content stream interface. - - def get_headers(self) -> dict[str, str]: - content_length = self.get_content_length() - content_type = self.content_type - if content_length is None: - return {"Transfer-Encoding": "chunked", "Content-Type": content_type} - return {"Content-Length": str(content_length), "Content-Type": content_type} - - def __iter__(self) -> typing.Iterator[bytes]: - for chunk in self.iter_chunks(): - yield chunk - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - for chunk in self.iter_chunks(): - yield chunk diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_status_codes.py b/write-message/venv/lib/python3.10/site-packages/httpx/_status_codes.py deleted file mode 100644 index 133a623..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_status_codes.py +++ /dev/null @@ -1,162 +0,0 @@ -from __future__ import annotations - -from enum import IntEnum - -__all__ = ["codes"] - - -class codes(IntEnum): - """HTTP status codes and reason phrases - - Status codes from the following RFCs are all observed: - - * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 - * RFC 6585: Additional HTTP Status Codes - * RFC 3229: Delta encoding in HTTP - * RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518 - * RFC 5842: Binding Extensions to WebDAV - * RFC 7238: Permanent Redirect - * RFC 2295: Transparent Content Negotiation in HTTP - * RFC 2774: An HTTP Extension Framework - * RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2) - * RFC 2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0) - * RFC 7725: An HTTP Status Code to Report Legal Obstacles - * RFC 8297: An HTTP Status Code for Indicating Hints - * RFC 8470: Using Early Data in HTTP - """ - - def __new__(cls, value: int, phrase: str = "") -> codes: - obj = int.__new__(cls, value) - obj._value_ = value - - obj.phrase = phrase # type: ignore[attr-defined] - return obj - - def __str__(self) -> str: - return str(self.value) - - @classmethod - def get_reason_phrase(cls, value: int) -> str: - try: - return codes(value).phrase # type: ignore - except ValueError: - return "" - - @classmethod - def is_informational(cls, value: int) -> bool: - """ - Returns `True` for 1xx status codes, `False` otherwise. - """ - return 100 <= value <= 199 - - @classmethod - def is_success(cls, value: int) -> bool: - """ - Returns `True` for 2xx status codes, `False` otherwise. - """ - return 200 <= value <= 299 - - @classmethod - def is_redirect(cls, value: int) -> bool: - """ - Returns `True` for 3xx status codes, `False` otherwise. - """ - return 300 <= value <= 399 - - @classmethod - def is_client_error(cls, value: int) -> bool: - """ - Returns `True` for 4xx status codes, `False` otherwise. - """ - return 400 <= value <= 499 - - @classmethod - def is_server_error(cls, value: int) -> bool: - """ - Returns `True` for 5xx status codes, `False` otherwise. - """ - return 500 <= value <= 599 - - @classmethod - def is_error(cls, value: int) -> bool: - """ - Returns `True` for 4xx or 5xx status codes, `False` otherwise. - """ - return 400 <= value <= 599 - - # informational - CONTINUE = 100, "Continue" - SWITCHING_PROTOCOLS = 101, "Switching Protocols" - PROCESSING = 102, "Processing" - EARLY_HINTS = 103, "Early Hints" - - # success - OK = 200, "OK" - CREATED = 201, "Created" - ACCEPTED = 202, "Accepted" - NON_AUTHORITATIVE_INFORMATION = 203, "Non-Authoritative Information" - NO_CONTENT = 204, "No Content" - RESET_CONTENT = 205, "Reset Content" - PARTIAL_CONTENT = 206, "Partial Content" - MULTI_STATUS = 207, "Multi-Status" - ALREADY_REPORTED = 208, "Already Reported" - IM_USED = 226, "IM Used" - - # redirection - MULTIPLE_CHOICES = 300, "Multiple Choices" - MOVED_PERMANENTLY = 301, "Moved Permanently" - FOUND = 302, "Found" - SEE_OTHER = 303, "See Other" - NOT_MODIFIED = 304, "Not Modified" - USE_PROXY = 305, "Use Proxy" - TEMPORARY_REDIRECT = 307, "Temporary Redirect" - PERMANENT_REDIRECT = 308, "Permanent Redirect" - - # client error - BAD_REQUEST = 400, "Bad Request" - UNAUTHORIZED = 401, "Unauthorized" - PAYMENT_REQUIRED = 402, "Payment Required" - FORBIDDEN = 403, "Forbidden" - NOT_FOUND = 404, "Not Found" - METHOD_NOT_ALLOWED = 405, "Method Not Allowed" - NOT_ACCEPTABLE = 406, "Not Acceptable" - PROXY_AUTHENTICATION_REQUIRED = 407, "Proxy Authentication Required" - REQUEST_TIMEOUT = 408, "Request Timeout" - CONFLICT = 409, "Conflict" - GONE = 410, "Gone" - LENGTH_REQUIRED = 411, "Length Required" - PRECONDITION_FAILED = 412, "Precondition Failed" - REQUEST_ENTITY_TOO_LARGE = 413, "Request Entity Too Large" - REQUEST_URI_TOO_LONG = 414, "Request-URI Too Long" - UNSUPPORTED_MEDIA_TYPE = 415, "Unsupported Media Type" - REQUESTED_RANGE_NOT_SATISFIABLE = 416, "Requested Range Not Satisfiable" - EXPECTATION_FAILED = 417, "Expectation Failed" - IM_A_TEAPOT = 418, "I'm a teapot" - MISDIRECTED_REQUEST = 421, "Misdirected Request" - UNPROCESSABLE_ENTITY = 422, "Unprocessable Entity" - LOCKED = 423, "Locked" - FAILED_DEPENDENCY = 424, "Failed Dependency" - TOO_EARLY = 425, "Too Early" - UPGRADE_REQUIRED = 426, "Upgrade Required" - PRECONDITION_REQUIRED = 428, "Precondition Required" - TOO_MANY_REQUESTS = 429, "Too Many Requests" - REQUEST_HEADER_FIELDS_TOO_LARGE = 431, "Request Header Fields Too Large" - UNAVAILABLE_FOR_LEGAL_REASONS = 451, "Unavailable For Legal Reasons" - - # server errors - INTERNAL_SERVER_ERROR = 500, "Internal Server Error" - NOT_IMPLEMENTED = 501, "Not Implemented" - BAD_GATEWAY = 502, "Bad Gateway" - SERVICE_UNAVAILABLE = 503, "Service Unavailable" - GATEWAY_TIMEOUT = 504, "Gateway Timeout" - HTTP_VERSION_NOT_SUPPORTED = 505, "HTTP Version Not Supported" - VARIANT_ALSO_NEGOTIATES = 506, "Variant Also Negotiates" - INSUFFICIENT_STORAGE = 507, "Insufficient Storage" - LOOP_DETECTED = 508, "Loop Detected" - NOT_EXTENDED = 510, "Not Extended" - NETWORK_AUTHENTICATION_REQUIRED = 511, "Network Authentication Required" - - -# Include lower-case styles for `requests` compatibility. -for code in codes: - setattr(codes, code._name_.lower(), int(code)) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__init__.py b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__init__.py deleted file mode 100644 index 7a32105..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -from .asgi import * -from .base import * -from .default import * -from .mock import * -from .wsgi import * - -__all__ = [ - "ASGITransport", - "AsyncBaseTransport", - "BaseTransport", - "AsyncHTTPTransport", - "HTTPTransport", - "MockTransport", - "WSGITransport", -] diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index bdabb46..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/asgi.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/asgi.cpython-310.pyc deleted file mode 100644 index 7f099e3..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/asgi.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/base.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/base.cpython-310.pyc deleted file mode 100644 index 65b5d98..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/base.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/default.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/default.cpython-310.pyc deleted file mode 100644 index 924cc5e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/default.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/mock.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/mock.cpython-310.pyc deleted file mode 100644 index 7ae1f95..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/mock.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/wsgi.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/wsgi.cpython-310.pyc deleted file mode 100644 index b4fe61a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/__pycache__/wsgi.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/asgi.py b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/asgi.py deleted file mode 100644 index 2bc4efa..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/asgi.py +++ /dev/null @@ -1,187 +0,0 @@ -from __future__ import annotations - -import typing - -from .._models import Request, Response -from .._types import AsyncByteStream -from .base import AsyncBaseTransport - -if typing.TYPE_CHECKING: # pragma: no cover - import asyncio - - import trio - - Event = typing.Union[asyncio.Event, trio.Event] - - -_Message = typing.MutableMapping[str, typing.Any] -_Receive = typing.Callable[[], typing.Awaitable[_Message]] -_Send = typing.Callable[ - [typing.MutableMapping[str, typing.Any]], typing.Awaitable[None] -] -_ASGIApp = typing.Callable[ - [typing.MutableMapping[str, typing.Any], _Receive, _Send], typing.Awaitable[None] -] - -__all__ = ["ASGITransport"] - - -def is_running_trio() -> bool: - try: - # sniffio is a dependency of trio. - - # See https://github.com/python-trio/trio/issues/2802 - import sniffio - - if sniffio.current_async_library() == "trio": - return True - except ImportError: # pragma: nocover - pass - - return False - - -def create_event() -> Event: - if is_running_trio(): - import trio - - return trio.Event() - - import asyncio - - return asyncio.Event() - - -class ASGIResponseStream(AsyncByteStream): - def __init__(self, body: list[bytes]) -> None: - self._body = body - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - yield b"".join(self._body) - - -class ASGITransport(AsyncBaseTransport): - """ - A custom AsyncTransport that handles sending requests directly to an ASGI app. - - ```python - transport = httpx.ASGITransport( - app=app, - root_path="/submount", - client=("1.2.3.4", 123) - ) - client = httpx.AsyncClient(transport=transport) - ``` - - Arguments: - - * `app` - The ASGI application. - * `raise_app_exceptions` - Boolean indicating if exceptions in the application - should be raised. Default to `True`. Can be set to `False` for use cases - such as testing the content of a client 500 response. - * `root_path` - The root path on which the ASGI application should be mounted. - * `client` - A two-tuple indicating the client IP and port of incoming requests. - ``` - """ - - def __init__( - self, - app: _ASGIApp, - raise_app_exceptions: bool = True, - root_path: str = "", - client: tuple[str, int] = ("127.0.0.1", 123), - ) -> None: - self.app = app - self.raise_app_exceptions = raise_app_exceptions - self.root_path = root_path - self.client = client - - async def handle_async_request( - self, - request: Request, - ) -> Response: - assert isinstance(request.stream, AsyncByteStream) - - # ASGI scope. - scope = { - "type": "http", - "asgi": {"version": "3.0"}, - "http_version": "1.1", - "method": request.method, - "headers": [(k.lower(), v) for (k, v) in request.headers.raw], - "scheme": request.url.scheme, - "path": request.url.path, - "raw_path": request.url.raw_path.split(b"?")[0], - "query_string": request.url.query, - "server": (request.url.host, request.url.port), - "client": self.client, - "root_path": self.root_path, - } - - # Request. - request_body_chunks = request.stream.__aiter__() - request_complete = False - - # Response. - status_code = None - response_headers = None - body_parts = [] - response_started = False - response_complete = create_event() - - # ASGI callables. - - async def receive() -> dict[str, typing.Any]: - nonlocal request_complete - - if request_complete: - await response_complete.wait() - return {"type": "http.disconnect"} - - try: - body = await request_body_chunks.__anext__() - except StopAsyncIteration: - request_complete = True - return {"type": "http.request", "body": b"", "more_body": False} - return {"type": "http.request", "body": body, "more_body": True} - - async def send(message: typing.MutableMapping[str, typing.Any]) -> None: - nonlocal status_code, response_headers, response_started - - if message["type"] == "http.response.start": - assert not response_started - - status_code = message["status"] - response_headers = message.get("headers", []) - response_started = True - - elif message["type"] == "http.response.body": - assert not response_complete.is_set() - body = message.get("body", b"") - more_body = message.get("more_body", False) - - if body and request.method != "HEAD": - body_parts.append(body) - - if not more_body: - response_complete.set() - - try: - await self.app(scope, receive, send) - except Exception: # noqa: PIE-786 - if self.raise_app_exceptions: - raise - - response_complete.set() - if status_code is None: - status_code = 500 - if response_headers is None: - response_headers = {} - - assert response_complete.is_set() - assert status_code is not None - assert response_headers is not None - - stream = ASGIResponseStream(body_parts) - - return Response(status_code, headers=response_headers, stream=stream) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/base.py b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/base.py deleted file mode 100644 index 66fd99d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/base.py +++ /dev/null @@ -1,86 +0,0 @@ -from __future__ import annotations - -import typing -from types import TracebackType - -from .._models import Request, Response - -T = typing.TypeVar("T", bound="BaseTransport") -A = typing.TypeVar("A", bound="AsyncBaseTransport") - -__all__ = ["AsyncBaseTransport", "BaseTransport"] - - -class BaseTransport: - def __enter__(self: T) -> T: - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: TracebackType | None = None, - ) -> None: - self.close() - - def handle_request(self, request: Request) -> Response: - """ - Send a single HTTP request and return a response. - - Developers shouldn't typically ever need to call into this API directly, - since the Client class provides all the higher level user-facing API - niceties. - - In order to properly release any network resources, the response - stream should *either* be consumed immediately, with a call to - `response.stream.read()`, or else the `handle_request` call should - be followed with a try/finally block to ensuring the stream is - always closed. - - Example usage: - - with httpx.HTTPTransport() as transport: - req = httpx.Request( - method=b"GET", - url=(b"https", b"www.example.com", 443, b"/"), - headers=[(b"Host", b"www.example.com")], - ) - resp = transport.handle_request(req) - body = resp.stream.read() - print(resp.status_code, resp.headers, body) - - - Takes a `Request` instance as the only argument. - - Returns a `Response` instance. - """ - raise NotImplementedError( - "The 'handle_request' method must be implemented." - ) # pragma: no cover - - def close(self) -> None: - pass - - -class AsyncBaseTransport: - async def __aenter__(self: A) -> A: - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: TracebackType | None = None, - ) -> None: - await self.aclose() - - async def handle_async_request( - self, - request: Request, - ) -> Response: - raise NotImplementedError( - "The 'handle_async_request' method must be implemented." - ) # pragma: no cover - - async def aclose(self) -> None: - pass diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/default.py b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/default.py deleted file mode 100644 index d5aa05f..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/default.py +++ /dev/null @@ -1,406 +0,0 @@ -""" -Custom transports, with nicely configured defaults. - -The following additional keyword arguments are currently supported by httpcore... - -* uds: str -* local_address: str -* retries: int - -Example usages... - -# Disable HTTP/2 on a single specific domain. -mounts = { - "all://": httpx.HTTPTransport(http2=True), - "all://*example.org": httpx.HTTPTransport() -} - -# Using advanced httpcore configuration, with connection retries. -transport = httpx.HTTPTransport(retries=1) -client = httpx.Client(transport=transport) - -# Using advanced httpcore configuration, with unix domain sockets. -transport = httpx.HTTPTransport(uds="socket.uds") -client = httpx.Client(transport=transport) -""" - -from __future__ import annotations - -import contextlib -import typing -from types import TracebackType - -if typing.TYPE_CHECKING: - import ssl # pragma: no cover - - import httpx # pragma: no cover - -from .._config import DEFAULT_LIMITS, Limits, Proxy, create_ssl_context -from .._exceptions import ( - ConnectError, - ConnectTimeout, - LocalProtocolError, - NetworkError, - PoolTimeout, - ProtocolError, - ProxyError, - ReadError, - ReadTimeout, - RemoteProtocolError, - TimeoutException, - UnsupportedProtocol, - WriteError, - WriteTimeout, -) -from .._models import Request, Response -from .._types import AsyncByteStream, CertTypes, ProxyTypes, SyncByteStream -from .._urls import URL -from .base import AsyncBaseTransport, BaseTransport - -T = typing.TypeVar("T", bound="HTTPTransport") -A = typing.TypeVar("A", bound="AsyncHTTPTransport") - -SOCKET_OPTION = typing.Union[ - typing.Tuple[int, int, int], - typing.Tuple[int, int, typing.Union[bytes, bytearray]], - typing.Tuple[int, int, None, int], -] - -__all__ = ["AsyncHTTPTransport", "HTTPTransport"] - -HTTPCORE_EXC_MAP: dict[type[Exception], type[httpx.HTTPError]] = {} - - -def _load_httpcore_exceptions() -> dict[type[Exception], type[httpx.HTTPError]]: - import httpcore - - return { - httpcore.TimeoutException: TimeoutException, - httpcore.ConnectTimeout: ConnectTimeout, - httpcore.ReadTimeout: ReadTimeout, - httpcore.WriteTimeout: WriteTimeout, - httpcore.PoolTimeout: PoolTimeout, - httpcore.NetworkError: NetworkError, - httpcore.ConnectError: ConnectError, - httpcore.ReadError: ReadError, - httpcore.WriteError: WriteError, - httpcore.ProxyError: ProxyError, - httpcore.UnsupportedProtocol: UnsupportedProtocol, - httpcore.ProtocolError: ProtocolError, - httpcore.LocalProtocolError: LocalProtocolError, - httpcore.RemoteProtocolError: RemoteProtocolError, - } - - -@contextlib.contextmanager -def map_httpcore_exceptions() -> typing.Iterator[None]: - global HTTPCORE_EXC_MAP - if len(HTTPCORE_EXC_MAP) == 0: - HTTPCORE_EXC_MAP = _load_httpcore_exceptions() - try: - yield - except Exception as exc: - mapped_exc = None - - for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): - if not isinstance(exc, from_exc): - continue - # We want to map to the most specific exception we can find. - # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to - # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. - if mapped_exc is None or issubclass(to_exc, mapped_exc): - mapped_exc = to_exc - - if mapped_exc is None: # pragma: no cover - raise - - message = str(exc) - raise mapped_exc(message) from exc - - -class ResponseStream(SyncByteStream): - def __init__(self, httpcore_stream: typing.Iterable[bytes]) -> None: - self._httpcore_stream = httpcore_stream - - def __iter__(self) -> typing.Iterator[bytes]: - with map_httpcore_exceptions(): - for part in self._httpcore_stream: - yield part - - def close(self) -> None: - if hasattr(self._httpcore_stream, "close"): - self._httpcore_stream.close() - - -class HTTPTransport(BaseTransport): - def __init__( - self, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, - http1: bool = True, - http2: bool = False, - limits: Limits = DEFAULT_LIMITS, - proxy: ProxyTypes | None = None, - uds: str | None = None, - local_address: str | None = None, - retries: int = 0, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - import httpcore - - proxy = Proxy(url=proxy) if isinstance(proxy, (str, URL)) else proxy - ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env) - - if proxy is None: - self._pool = httpcore.ConnectionPool( - ssl_context=ssl_context, - max_connections=limits.max_connections, - max_keepalive_connections=limits.max_keepalive_connections, - keepalive_expiry=limits.keepalive_expiry, - http1=http1, - http2=http2, - uds=uds, - local_address=local_address, - retries=retries, - socket_options=socket_options, - ) - elif proxy.url.scheme in ("http", "https"): - self._pool = httpcore.HTTPProxy( - proxy_url=httpcore.URL( - scheme=proxy.url.raw_scheme, - host=proxy.url.raw_host, - port=proxy.url.port, - target=proxy.url.raw_path, - ), - proxy_auth=proxy.raw_auth, - proxy_headers=proxy.headers.raw, - ssl_context=ssl_context, - proxy_ssl_context=proxy.ssl_context, - max_connections=limits.max_connections, - max_keepalive_connections=limits.max_keepalive_connections, - keepalive_expiry=limits.keepalive_expiry, - http1=http1, - http2=http2, - socket_options=socket_options, - ) - elif proxy.url.scheme in ("socks5", "socks5h"): - try: - import socksio # noqa - except ImportError: # pragma: no cover - raise ImportError( - "Using SOCKS proxy, but the 'socksio' package is not installed. " - "Make sure to install httpx using `pip install httpx[socks]`." - ) from None - - self._pool = httpcore.SOCKSProxy( - proxy_url=httpcore.URL( - scheme=proxy.url.raw_scheme, - host=proxy.url.raw_host, - port=proxy.url.port, - target=proxy.url.raw_path, - ), - proxy_auth=proxy.raw_auth, - ssl_context=ssl_context, - max_connections=limits.max_connections, - max_keepalive_connections=limits.max_keepalive_connections, - keepalive_expiry=limits.keepalive_expiry, - http1=http1, - http2=http2, - ) - else: # pragma: no cover - raise ValueError( - "Proxy protocol must be either 'http', 'https', 'socks5', or 'socks5h'," - f" but got {proxy.url.scheme!r}." - ) - - def __enter__(self: T) -> T: # Use generics for subclass support. - self._pool.__enter__() - return self - - def __exit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: TracebackType | None = None, - ) -> None: - with map_httpcore_exceptions(): - self._pool.__exit__(exc_type, exc_value, traceback) - - def handle_request( - self, - request: Request, - ) -> Response: - assert isinstance(request.stream, SyncByteStream) - import httpcore - - req = httpcore.Request( - method=request.method, - url=httpcore.URL( - scheme=request.url.raw_scheme, - host=request.url.raw_host, - port=request.url.port, - target=request.url.raw_path, - ), - headers=request.headers.raw, - content=request.stream, - extensions=request.extensions, - ) - with map_httpcore_exceptions(): - resp = self._pool.handle_request(req) - - assert isinstance(resp.stream, typing.Iterable) - - return Response( - status_code=resp.status, - headers=resp.headers, - stream=ResponseStream(resp.stream), - extensions=resp.extensions, - ) - - def close(self) -> None: - self._pool.close() - - -class AsyncResponseStream(AsyncByteStream): - def __init__(self, httpcore_stream: typing.AsyncIterable[bytes]) -> None: - self._httpcore_stream = httpcore_stream - - async def __aiter__(self) -> typing.AsyncIterator[bytes]: - with map_httpcore_exceptions(): - async for part in self._httpcore_stream: - yield part - - async def aclose(self) -> None: - if hasattr(self._httpcore_stream, "aclose"): - await self._httpcore_stream.aclose() - - -class AsyncHTTPTransport(AsyncBaseTransport): - def __init__( - self, - verify: ssl.SSLContext | str | bool = True, - cert: CertTypes | None = None, - trust_env: bool = True, - http1: bool = True, - http2: bool = False, - limits: Limits = DEFAULT_LIMITS, - proxy: ProxyTypes | None = None, - uds: str | None = None, - local_address: str | None = None, - retries: int = 0, - socket_options: typing.Iterable[SOCKET_OPTION] | None = None, - ) -> None: - import httpcore - - proxy = Proxy(url=proxy) if isinstance(proxy, (str, URL)) else proxy - ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env) - - if proxy is None: - self._pool = httpcore.AsyncConnectionPool( - ssl_context=ssl_context, - max_connections=limits.max_connections, - max_keepalive_connections=limits.max_keepalive_connections, - keepalive_expiry=limits.keepalive_expiry, - http1=http1, - http2=http2, - uds=uds, - local_address=local_address, - retries=retries, - socket_options=socket_options, - ) - elif proxy.url.scheme in ("http", "https"): - self._pool = httpcore.AsyncHTTPProxy( - proxy_url=httpcore.URL( - scheme=proxy.url.raw_scheme, - host=proxy.url.raw_host, - port=proxy.url.port, - target=proxy.url.raw_path, - ), - proxy_auth=proxy.raw_auth, - proxy_headers=proxy.headers.raw, - proxy_ssl_context=proxy.ssl_context, - ssl_context=ssl_context, - max_connections=limits.max_connections, - max_keepalive_connections=limits.max_keepalive_connections, - keepalive_expiry=limits.keepalive_expiry, - http1=http1, - http2=http2, - socket_options=socket_options, - ) - elif proxy.url.scheme in ("socks5", "socks5h"): - try: - import socksio # noqa - except ImportError: # pragma: no cover - raise ImportError( - "Using SOCKS proxy, but the 'socksio' package is not installed. " - "Make sure to install httpx using `pip install httpx[socks]`." - ) from None - - self._pool = httpcore.AsyncSOCKSProxy( - proxy_url=httpcore.URL( - scheme=proxy.url.raw_scheme, - host=proxy.url.raw_host, - port=proxy.url.port, - target=proxy.url.raw_path, - ), - proxy_auth=proxy.raw_auth, - ssl_context=ssl_context, - max_connections=limits.max_connections, - max_keepalive_connections=limits.max_keepalive_connections, - keepalive_expiry=limits.keepalive_expiry, - http1=http1, - http2=http2, - ) - else: # pragma: no cover - raise ValueError( - "Proxy protocol must be either 'http', 'https', 'socks5', or 'socks5h'," - " but got {proxy.url.scheme!r}." - ) - - async def __aenter__(self: A) -> A: # Use generics for subclass support. - await self._pool.__aenter__() - return self - - async def __aexit__( - self, - exc_type: type[BaseException] | None = None, - exc_value: BaseException | None = None, - traceback: TracebackType | None = None, - ) -> None: - with map_httpcore_exceptions(): - await self._pool.__aexit__(exc_type, exc_value, traceback) - - async def handle_async_request( - self, - request: Request, - ) -> Response: - assert isinstance(request.stream, AsyncByteStream) - import httpcore - - req = httpcore.Request( - method=request.method, - url=httpcore.URL( - scheme=request.url.raw_scheme, - host=request.url.raw_host, - port=request.url.port, - target=request.url.raw_path, - ), - headers=request.headers.raw, - content=request.stream, - extensions=request.extensions, - ) - with map_httpcore_exceptions(): - resp = await self._pool.handle_async_request(req) - - assert isinstance(resp.stream, typing.AsyncIterable) - - return Response( - status_code=resp.status, - headers=resp.headers, - stream=AsyncResponseStream(resp.stream), - extensions=resp.extensions, - ) - - async def aclose(self) -> None: - await self._pool.aclose() diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/mock.py b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/mock.py deleted file mode 100644 index 8c418f5..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/mock.py +++ /dev/null @@ -1,43 +0,0 @@ -from __future__ import annotations - -import typing - -from .._models import Request, Response -from .base import AsyncBaseTransport, BaseTransport - -SyncHandler = typing.Callable[[Request], Response] -AsyncHandler = typing.Callable[[Request], typing.Coroutine[None, None, Response]] - - -__all__ = ["MockTransport"] - - -class MockTransport(AsyncBaseTransport, BaseTransport): - def __init__(self, handler: SyncHandler | AsyncHandler) -> None: - self.handler = handler - - def handle_request( - self, - request: Request, - ) -> Response: - request.read() - response = self.handler(request) - if not isinstance(response, Response): # pragma: no cover - raise TypeError("Cannot use an async handler in a sync Client") - return response - - async def handle_async_request( - self, - request: Request, - ) -> Response: - await request.aread() - response = self.handler(request) - - # Allow handler to *optionally* be an `async` function. - # If it is, then the `response` variable need to be awaited to actually - # return the result. - - if not isinstance(response, Response): - response = await response - - return response diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/wsgi.py b/write-message/venv/lib/python3.10/site-packages/httpx/_transports/wsgi.py deleted file mode 100644 index 8592ffe..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_transports/wsgi.py +++ /dev/null @@ -1,149 +0,0 @@ -from __future__ import annotations - -import io -import itertools -import sys -import typing - -from .._models import Request, Response -from .._types import SyncByteStream -from .base import BaseTransport - -if typing.TYPE_CHECKING: - from _typeshed import OptExcInfo # pragma: no cover - from _typeshed.wsgi import WSGIApplication # pragma: no cover - -_T = typing.TypeVar("_T") - - -__all__ = ["WSGITransport"] - - -def _skip_leading_empty_chunks(body: typing.Iterable[_T]) -> typing.Iterable[_T]: - body = iter(body) - for chunk in body: - if chunk: - return itertools.chain([chunk], body) - return [] - - -class WSGIByteStream(SyncByteStream): - def __init__(self, result: typing.Iterable[bytes]) -> None: - self._close = getattr(result, "close", None) - self._result = _skip_leading_empty_chunks(result) - - def __iter__(self) -> typing.Iterator[bytes]: - for part in self._result: - yield part - - def close(self) -> None: - if self._close is not None: - self._close() - - -class WSGITransport(BaseTransport): - """ - A custom transport that handles sending requests directly to an WSGI app. - The simplest way to use this functionality is to use the `app` argument. - - ``` - client = httpx.Client(app=app) - ``` - - Alternatively, you can setup the transport instance explicitly. - This allows you to include any additional configuration arguments specific - to the WSGITransport class: - - ``` - transport = httpx.WSGITransport( - app=app, - script_name="/submount", - remote_addr="1.2.3.4" - ) - client = httpx.Client(transport=transport) - ``` - - Arguments: - - * `app` - The WSGI application. - * `raise_app_exceptions` - Boolean indicating if exceptions in the application - should be raised. Default to `True`. Can be set to `False` for use cases - such as testing the content of a client 500 response. - * `script_name` - The root path on which the WSGI application should be mounted. - * `remote_addr` - A string indicating the client IP of incoming requests. - ``` - """ - - def __init__( - self, - app: WSGIApplication, - raise_app_exceptions: bool = True, - script_name: str = "", - remote_addr: str = "127.0.0.1", - wsgi_errors: typing.TextIO | None = None, - ) -> None: - self.app = app - self.raise_app_exceptions = raise_app_exceptions - self.script_name = script_name - self.remote_addr = remote_addr - self.wsgi_errors = wsgi_errors - - def handle_request(self, request: Request) -> Response: - request.read() - wsgi_input = io.BytesIO(request.content) - - port = request.url.port or {"http": 80, "https": 443}[request.url.scheme] - environ = { - "wsgi.version": (1, 0), - "wsgi.url_scheme": request.url.scheme, - "wsgi.input": wsgi_input, - "wsgi.errors": self.wsgi_errors or sys.stderr, - "wsgi.multithread": True, - "wsgi.multiprocess": False, - "wsgi.run_once": False, - "REQUEST_METHOD": request.method, - "SCRIPT_NAME": self.script_name, - "PATH_INFO": request.url.path, - "QUERY_STRING": request.url.query.decode("ascii"), - "SERVER_NAME": request.url.host, - "SERVER_PORT": str(port), - "SERVER_PROTOCOL": "HTTP/1.1", - "REMOTE_ADDR": self.remote_addr, - } - for header_key, header_value in request.headers.raw: - key = header_key.decode("ascii").upper().replace("-", "_") - if key not in ("CONTENT_TYPE", "CONTENT_LENGTH"): - key = "HTTP_" + key - environ[key] = header_value.decode("ascii") - - seen_status = None - seen_response_headers = None - seen_exc_info = None - - def start_response( - status: str, - response_headers: list[tuple[str, str]], - exc_info: OptExcInfo | None = None, - ) -> typing.Callable[[bytes], typing.Any]: - nonlocal seen_status, seen_response_headers, seen_exc_info - seen_status = status - seen_response_headers = response_headers - seen_exc_info = exc_info - return lambda _: None - - result = self.app(environ, start_response) - - stream = WSGIByteStream(result) - - assert seen_status is not None - assert seen_response_headers is not None - if seen_exc_info and seen_exc_info[0] and self.raise_app_exceptions: - raise seen_exc_info[1] - - status_code = int(seen_status.split()[0]) - headers = [ - (key.encode("ascii"), value.encode("ascii")) - for key, value in seen_response_headers - ] - - return Response(status_code, headers=headers, stream=stream) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_types.py b/write-message/venv/lib/python3.10/site-packages/httpx/_types.py deleted file mode 100644 index 704dfdf..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_types.py +++ /dev/null @@ -1,114 +0,0 @@ -""" -Type definitions for type checking purposes. -""" - -from http.cookiejar import CookieJar -from typing import ( - IO, - TYPE_CHECKING, - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - Iterable, - Iterator, - List, - Mapping, - Optional, - Sequence, - Tuple, - Union, -) - -if TYPE_CHECKING: # pragma: no cover - from ._auth import Auth # noqa: F401 - from ._config import Proxy, Timeout # noqa: F401 - from ._models import Cookies, Headers, Request # noqa: F401 - from ._urls import URL, QueryParams # noqa: F401 - - -PrimitiveData = Optional[Union[str, int, float, bool]] - -URLTypes = Union["URL", str] - -QueryParamTypes = Union[ - "QueryParams", - Mapping[str, Union[PrimitiveData, Sequence[PrimitiveData]]], - List[Tuple[str, PrimitiveData]], - Tuple[Tuple[str, PrimitiveData], ...], - str, - bytes, -] - -HeaderTypes = Union[ - "Headers", - Mapping[str, str], - Mapping[bytes, bytes], - Sequence[Tuple[str, str]], - Sequence[Tuple[bytes, bytes]], -] - -CookieTypes = Union["Cookies", CookieJar, Dict[str, str], List[Tuple[str, str]]] - -TimeoutTypes = Union[ - Optional[float], - Tuple[Optional[float], Optional[float], Optional[float], Optional[float]], - "Timeout", -] -ProxyTypes = Union["URL", str, "Proxy"] -CertTypes = Union[str, Tuple[str, str], Tuple[str, str, str]] - -AuthTypes = Union[ - Tuple[Union[str, bytes], Union[str, bytes]], - Callable[["Request"], "Request"], - "Auth", -] - -RequestContent = Union[str, bytes, Iterable[bytes], AsyncIterable[bytes]] -ResponseContent = Union[str, bytes, Iterable[bytes], AsyncIterable[bytes]] -ResponseExtensions = Mapping[str, Any] - -RequestData = Mapping[str, Any] - -FileContent = Union[IO[bytes], bytes, str] -FileTypes = Union[ - # file (or bytes) - FileContent, - # (filename, file (or bytes)) - Tuple[Optional[str], FileContent], - # (filename, file (or bytes), content_type) - Tuple[Optional[str], FileContent, Optional[str]], - # (filename, file (or bytes), content_type, headers) - Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], -] -RequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]] - -RequestExtensions = Mapping[str, Any] - -__all__ = ["AsyncByteStream", "SyncByteStream"] - - -class SyncByteStream: - def __iter__(self) -> Iterator[bytes]: - raise NotImplementedError( - "The '__iter__' method must be implemented." - ) # pragma: no cover - yield b"" # pragma: no cover - - def close(self) -> None: - """ - Subclasses can override this method to release any network resources - after a request/response cycle is complete. - """ - - -class AsyncByteStream: - async def __aiter__(self) -> AsyncIterator[bytes]: - raise NotImplementedError( - "The '__aiter__' method must be implemented." - ) # pragma: no cover - yield b"" # pragma: no cover - - async def aclose(self) -> None: - pass diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_urlparse.py b/write-message/venv/lib/python3.10/site-packages/httpx/_urlparse.py deleted file mode 100644 index bf190fd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_urlparse.py +++ /dev/null @@ -1,527 +0,0 @@ -""" -An implementation of `urlparse` that provides URL validation and normalization -as described by RFC3986. - -We rely on this implementation rather than the one in Python's stdlib, because: - -* It provides more complete URL validation. -* It properly differentiates between an empty querystring and an absent querystring, - to distinguish URLs with a trailing '?'. -* It handles scheme, hostname, port, and path normalization. -* It supports IDNA hostnames, normalizing them to their encoded form. -* The API supports passing individual components, as well as the complete URL string. - -Previously we relied on the excellent `rfc3986` package to handle URL parsing and -validation, but this module provides a simpler alternative, with less indirection -required. -""" - -from __future__ import annotations - -import ipaddress -import re -import typing - -import idna - -from ._exceptions import InvalidURL - -MAX_URL_LENGTH = 65536 - -# https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3 -UNRESERVED_CHARACTERS = ( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~" -) -SUB_DELIMS = "!$&'()*+,;=" - -PERCENT_ENCODED_REGEX = re.compile("%[A-Fa-f0-9]{2}") - -# https://url.spec.whatwg.org/#percent-encoded-bytes - -# The fragment percent-encode set is the C0 control percent-encode set -# and U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and U+0060 (`). -FRAG_SAFE = "".join( - [chr(i) for i in range(0x20, 0x7F) if i not in (0x20, 0x22, 0x3C, 0x3E, 0x60)] -) - -# The query percent-encode set is the C0 control percent-encode set -# and U+0020 SPACE, U+0022 ("), U+0023 (#), U+003C (<), and U+003E (>). -QUERY_SAFE = "".join( - [chr(i) for i in range(0x20, 0x7F) if i not in (0x20, 0x22, 0x23, 0x3C, 0x3E)] -) - -# The path percent-encode set is the query percent-encode set -# and U+003F (?), U+0060 (`), U+007B ({), and U+007D (}). -PATH_SAFE = "".join( - [ - chr(i) - for i in range(0x20, 0x7F) - if i not in (0x20, 0x22, 0x23, 0x3C, 0x3E) + (0x3F, 0x60, 0x7B, 0x7D) - ] -) - -# The userinfo percent-encode set is the path percent-encode set -# and U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@), -# U+005B ([) to U+005E (^), inclusive, and U+007C (|). -USERNAME_SAFE = "".join( - [ - chr(i) - for i in range(0x20, 0x7F) - if i - not in (0x20, 0x22, 0x23, 0x3C, 0x3E) - + (0x3F, 0x60, 0x7B, 0x7D) - + (0x2F, 0x3A, 0x3B, 0x3D, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x7C) - ] -) -PASSWORD_SAFE = "".join( - [ - chr(i) - for i in range(0x20, 0x7F) - if i - not in (0x20, 0x22, 0x23, 0x3C, 0x3E) - + (0x3F, 0x60, 0x7B, 0x7D) - + (0x2F, 0x3A, 0x3B, 0x3D, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x7C) - ] -) -# Note... The terminology 'userinfo' percent-encode set in the WHATWG document -# is used for the username and password quoting. For the joint userinfo component -# we remove U+003A (:) from the safe set. -USERINFO_SAFE = "".join( - [ - chr(i) - for i in range(0x20, 0x7F) - if i - not in (0x20, 0x22, 0x23, 0x3C, 0x3E) - + (0x3F, 0x60, 0x7B, 0x7D) - + (0x2F, 0x3B, 0x3D, 0x40, 0x5B, 0x5C, 0x5D, 0x5E, 0x7C) - ] -) - - -# {scheme}: (optional) -# //{authority} (optional) -# {path} -# ?{query} (optional) -# #{fragment} (optional) -URL_REGEX = re.compile( - ( - r"(?:(?P{scheme}):)?" - r"(?://(?P{authority}))?" - r"(?P{path})" - r"(?:\?(?P{query}))?" - r"(?:#(?P{fragment}))?" - ).format( - scheme="([a-zA-Z][a-zA-Z0-9+.-]*)?", - authority="[^/?#]*", - path="[^?#]*", - query="[^#]*", - fragment=".*", - ) -) - -# {userinfo}@ (optional) -# {host} -# :{port} (optional) -AUTHORITY_REGEX = re.compile( - ( - r"(?:(?P{userinfo})@)?" r"(?P{host})" r":?(?P{port})?" - ).format( - userinfo=".*", # Any character sequence. - host="(\\[.*\\]|[^:@]*)", # Either any character sequence excluding ':' or '@', - # or an IPv6 address enclosed within square brackets. - port=".*", # Any character sequence. - ) -) - - -# If we call urlparse with an individual component, then we need to regex -# validate that component individually. -# Note that we're duplicating the same strings as above. Shock! Horror!! -COMPONENT_REGEX = { - "scheme": re.compile("([a-zA-Z][a-zA-Z0-9+.-]*)?"), - "authority": re.compile("[^/?#]*"), - "path": re.compile("[^?#]*"), - "query": re.compile("[^#]*"), - "fragment": re.compile(".*"), - "userinfo": re.compile("[^@]*"), - "host": re.compile("(\\[.*\\]|[^:]*)"), - "port": re.compile(".*"), -} - - -# We use these simple regexs as a first pass before handing off to -# the stdlib 'ipaddress' module for IP address validation. -IPv4_STYLE_HOSTNAME = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$") -IPv6_STYLE_HOSTNAME = re.compile(r"^\[.*\]$") - - -class ParseResult(typing.NamedTuple): - scheme: str - userinfo: str - host: str - port: int | None - path: str - query: str | None - fragment: str | None - - @property - def authority(self) -> str: - return "".join( - [ - f"{self.userinfo}@" if self.userinfo else "", - f"[{self.host}]" if ":" in self.host else self.host, - f":{self.port}" if self.port is not None else "", - ] - ) - - @property - def netloc(self) -> str: - return "".join( - [ - f"[{self.host}]" if ":" in self.host else self.host, - f":{self.port}" if self.port is not None else "", - ] - ) - - def copy_with(self, **kwargs: str | None) -> ParseResult: - if not kwargs: - return self - - defaults = { - "scheme": self.scheme, - "authority": self.authority, - "path": self.path, - "query": self.query, - "fragment": self.fragment, - } - defaults.update(kwargs) - return urlparse("", **defaults) - - def __str__(self) -> str: - authority = self.authority - return "".join( - [ - f"{self.scheme}:" if self.scheme else "", - f"//{authority}" if authority else "", - self.path, - f"?{self.query}" if self.query is not None else "", - f"#{self.fragment}" if self.fragment is not None else "", - ] - ) - - -def urlparse(url: str = "", **kwargs: str | None) -> ParseResult: - # Initial basic checks on allowable URLs. - # --------------------------------------- - - # Hard limit the maximum allowable URL length. - if len(url) > MAX_URL_LENGTH: - raise InvalidURL("URL too long") - - # If a URL includes any ASCII control characters including \t, \r, \n, - # then treat it as invalid. - if any(char.isascii() and not char.isprintable() for char in url): - char = next(char for char in url if char.isascii() and not char.isprintable()) - idx = url.find(char) - error = ( - f"Invalid non-printable ASCII character in URL, {char!r} at position {idx}." - ) - raise InvalidURL(error) - - # Some keyword arguments require special handling. - # ------------------------------------------------ - - # Coerce "port" to a string, if it is provided as an integer. - if "port" in kwargs: - port = kwargs["port"] - kwargs["port"] = str(port) if isinstance(port, int) else port - - # Replace "netloc" with "host and "port". - if "netloc" in kwargs: - netloc = kwargs.pop("netloc") or "" - kwargs["host"], _, kwargs["port"] = netloc.partition(":") - - # Replace "username" and/or "password" with "userinfo". - if "username" in kwargs or "password" in kwargs: - username = quote(kwargs.pop("username", "") or "", safe=USERNAME_SAFE) - password = quote(kwargs.pop("password", "") or "", safe=PASSWORD_SAFE) - kwargs["userinfo"] = f"{username}:{password}" if password else username - - # Replace "raw_path" with "path" and "query". - if "raw_path" in kwargs: - raw_path = kwargs.pop("raw_path") or "" - kwargs["path"], seperator, kwargs["query"] = raw_path.partition("?") - if not seperator: - kwargs["query"] = None - - # Ensure that IPv6 "host" addresses are always escaped with "[...]". - if "host" in kwargs: - host = kwargs.get("host") or "" - if ":" in host and not (host.startswith("[") and host.endswith("]")): - kwargs["host"] = f"[{host}]" - - # If any keyword arguments are provided, ensure they are valid. - # ------------------------------------------------------------- - - for key, value in kwargs.items(): - if value is not None: - if len(value) > MAX_URL_LENGTH: - raise InvalidURL(f"URL component '{key}' too long") - - # If a component includes any ASCII control characters including \t, \r, \n, - # then treat it as invalid. - if any(char.isascii() and not char.isprintable() for char in value): - char = next( - char for char in value if char.isascii() and not char.isprintable() - ) - idx = value.find(char) - error = ( - f"Invalid non-printable ASCII character in URL {key} component, " - f"{char!r} at position {idx}." - ) - raise InvalidURL(error) - - # Ensure that keyword arguments match as a valid regex. - if not COMPONENT_REGEX[key].fullmatch(value): - raise InvalidURL(f"Invalid URL component '{key}'") - - # The URL_REGEX will always match, but may have empty components. - url_match = URL_REGEX.match(url) - assert url_match is not None - url_dict = url_match.groupdict() - - # * 'scheme', 'authority', and 'path' may be empty strings. - # * 'query' may be 'None', indicating no trailing "?" portion. - # Any string including the empty string, indicates a trailing "?". - # * 'fragment' may be 'None', indicating no trailing "#" portion. - # Any string including the empty string, indicates a trailing "#". - scheme = kwargs.get("scheme", url_dict["scheme"]) or "" - authority = kwargs.get("authority", url_dict["authority"]) or "" - path = kwargs.get("path", url_dict["path"]) or "" - query = kwargs.get("query", url_dict["query"]) - frag = kwargs.get("fragment", url_dict["fragment"]) - - # The AUTHORITY_REGEX will always match, but may have empty components. - authority_match = AUTHORITY_REGEX.match(authority) - assert authority_match is not None - authority_dict = authority_match.groupdict() - - # * 'userinfo' and 'host' may be empty strings. - # * 'port' may be 'None'. - userinfo = kwargs.get("userinfo", authority_dict["userinfo"]) or "" - host = kwargs.get("host", authority_dict["host"]) or "" - port = kwargs.get("port", authority_dict["port"]) - - # Normalize and validate each component. - # We end up with a parsed representation of the URL, - # with components that are plain ASCII bytestrings. - parsed_scheme: str = scheme.lower() - parsed_userinfo: str = quote(userinfo, safe=USERINFO_SAFE) - parsed_host: str = encode_host(host) - parsed_port: int | None = normalize_port(port, scheme) - - has_scheme = parsed_scheme != "" - has_authority = ( - parsed_userinfo != "" or parsed_host != "" or parsed_port is not None - ) - validate_path(path, has_scheme=has_scheme, has_authority=has_authority) - if has_scheme or has_authority: - path = normalize_path(path) - - parsed_path: str = quote(path, safe=PATH_SAFE) - parsed_query: str | None = None if query is None else quote(query, safe=QUERY_SAFE) - parsed_frag: str | None = None if frag is None else quote(frag, safe=FRAG_SAFE) - - # The parsed ASCII bytestrings are our canonical form. - # All properties of the URL are derived from these. - return ParseResult( - parsed_scheme, - parsed_userinfo, - parsed_host, - parsed_port, - parsed_path, - parsed_query, - parsed_frag, - ) - - -def encode_host(host: str) -> str: - if not host: - return "" - - elif IPv4_STYLE_HOSTNAME.match(host): - # Validate IPv4 hostnames like #.#.#.# - # - # From https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.2 - # - # IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet - try: - ipaddress.IPv4Address(host) - except ipaddress.AddressValueError: - raise InvalidURL(f"Invalid IPv4 address: {host!r}") - return host - - elif IPv6_STYLE_HOSTNAME.match(host): - # Validate IPv6 hostnames like [...] - # - # From https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.2 - # - # "A host identified by an Internet Protocol literal address, version 6 - # [RFC3513] or later, is distinguished by enclosing the IP literal - # within square brackets ("[" and "]"). This is the only place where - # square bracket characters are allowed in the URI syntax." - try: - ipaddress.IPv6Address(host[1:-1]) - except ipaddress.AddressValueError: - raise InvalidURL(f"Invalid IPv6 address: {host!r}") - return host[1:-1] - - elif host.isascii(): - # Regular ASCII hostnames - # - # From https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.2 - # - # reg-name = *( unreserved / pct-encoded / sub-delims ) - WHATWG_SAFE = '"`{}%|\\' - return quote(host.lower(), safe=SUB_DELIMS + WHATWG_SAFE) - - # IDNA hostnames - try: - return idna.encode(host.lower()).decode("ascii") - except idna.IDNAError: - raise InvalidURL(f"Invalid IDNA hostname: {host!r}") - - -def normalize_port(port: str | int | None, scheme: str) -> int | None: - # From https://tools.ietf.org/html/rfc3986#section-3.2.3 - # - # "A scheme may define a default port. For example, the "http" scheme - # defines a default port of "80", corresponding to its reserved TCP - # port number. The type of port designated by the port number (e.g., - # TCP, UDP, SCTP) is defined by the URI scheme. URI producers and - # normalizers should omit the port component and its ":" delimiter if - # port is empty or if its value would be the same as that of the - # scheme's default." - if port is None or port == "": - return None - - try: - port_as_int = int(port) - except ValueError: - raise InvalidURL(f"Invalid port: {port!r}") - - # See https://url.spec.whatwg.org/#url-miscellaneous - default_port = {"ftp": 21, "http": 80, "https": 443, "ws": 80, "wss": 443}.get( - scheme - ) - if port_as_int == default_port: - return None - return port_as_int - - -def validate_path(path: str, has_scheme: bool, has_authority: bool) -> None: - """ - Path validation rules that depend on if the URL contains - a scheme or authority component. - - See https://datatracker.ietf.org/doc/html/rfc3986.html#section-3.3 - """ - if has_authority: - # If a URI contains an authority component, then the path component - # must either be empty or begin with a slash ("/") character." - if path and not path.startswith("/"): - raise InvalidURL("For absolute URLs, path must be empty or begin with '/'") - - if not has_scheme and not has_authority: - # If a URI does not contain an authority component, then the path cannot begin - # with two slash characters ("//"). - if path.startswith("//"): - raise InvalidURL("Relative URLs cannot have a path starting with '//'") - - # In addition, a URI reference (Section 4.1) may be a relative-path reference, - # in which case the first path segment cannot contain a colon (":") character. - if path.startswith(":"): - raise InvalidURL("Relative URLs cannot have a path starting with ':'") - - -def normalize_path(path: str) -> str: - """ - Drop "." and ".." segments from a URL path. - - For example: - - normalize_path("/path/./to/somewhere/..") == "/path/to" - """ - # Fast return when no '.' characters in the path. - if "." not in path: - return path - - components = path.split("/") - - # Fast return when no '.' or '..' components in the path. - if "." not in components and ".." not in components: - return path - - # https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4 - output: list[str] = [] - for component in components: - if component == ".": - pass - elif component == "..": - if output and output != [""]: - output.pop() - else: - output.append(component) - return "/".join(output) - - -def PERCENT(string: str) -> str: - return "".join([f"%{byte:02X}" for byte in string.encode("utf-8")]) - - -def percent_encoded(string: str, safe: str) -> str: - """ - Use percent-encoding to quote a string. - """ - NON_ESCAPED_CHARS = UNRESERVED_CHARACTERS + safe - - # Fast path for strings that don't need escaping. - if not string.rstrip(NON_ESCAPED_CHARS): - return string - - return "".join( - [char if char in NON_ESCAPED_CHARS else PERCENT(char) for char in string] - ) - - -def quote(string: str, safe: str) -> str: - """ - Use percent-encoding to quote a string, omitting existing '%xx' escape sequences. - - See: https://www.rfc-editor.org/rfc/rfc3986#section-2.1 - - * `string`: The string to be percent-escaped. - * `safe`: A string containing characters that may be treated as safe, and do not - need to be escaped. Unreserved characters are always treated as safe. - See: https://www.rfc-editor.org/rfc/rfc3986#section-2.3 - """ - parts = [] - current_position = 0 - for match in re.finditer(PERCENT_ENCODED_REGEX, string): - start_position, end_position = match.start(), match.end() - matched_text = match.group(0) - # Add any text up to the '%xx' escape sequence. - if start_position != current_position: - leading_text = string[current_position:start_position] - parts.append(percent_encoded(leading_text, safe=safe)) - - # Add the '%xx' escape sequence. - parts.append(matched_text) - current_position = end_position - - # Add any text after the final '%xx' escape sequence. - if current_position != len(string): - trailing_text = string[current_position:] - parts.append(percent_encoded(trailing_text, safe=safe)) - - return "".join(parts) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_urls.py b/write-message/venv/lib/python3.10/site-packages/httpx/_urls.py deleted file mode 100644 index 147a8fa..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_urls.py +++ /dev/null @@ -1,641 +0,0 @@ -from __future__ import annotations - -import typing -from urllib.parse import parse_qs, unquote, urlencode - -import idna - -from ._types import QueryParamTypes -from ._urlparse import urlparse -from ._utils import primitive_value_to_str - -__all__ = ["URL", "QueryParams"] - - -class URL: - """ - url = httpx.URL("HTTPS://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink") - - assert url.scheme == "https" - assert url.username == "jo@email.com" - assert url.password == "a secret" - assert url.userinfo == b"jo%40email.com:a%20secret" - assert url.host == "müller.de" - assert url.raw_host == b"xn--mller-kva.de" - assert url.port == 1234 - assert url.netloc == b"xn--mller-kva.de:1234" - assert url.path == "/pa th" - assert url.query == b"?search=ab" - assert url.raw_path == b"/pa%20th?search=ab" - assert url.fragment == "anchorlink" - - The components of a URL are broken down like this: - - https://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink - [scheme] [ username ] [password] [ host ][port][ path ] [ query ] [fragment] - [ userinfo ] [ netloc ][ raw_path ] - - Note that: - - * `url.scheme` is normalized to always be lowercased. - - * `url.host` is normalized to always be lowercased. Internationalized domain - names are represented in unicode, without IDNA encoding applied. For instance: - - url = httpx.URL("http://中国.icom.museum") - assert url.host == "中国.icom.museum" - url = httpx.URL("http://xn--fiqs8s.icom.museum") - assert url.host == "中国.icom.museum" - - * `url.raw_host` is normalized to always be lowercased, and is IDNA encoded. - - url = httpx.URL("http://中国.icom.museum") - assert url.raw_host == b"xn--fiqs8s.icom.museum" - url = httpx.URL("http://xn--fiqs8s.icom.museum") - assert url.raw_host == b"xn--fiqs8s.icom.museum" - - * `url.port` is either None or an integer. URLs that include the default port for - "http", "https", "ws", "wss", and "ftp" schemes have their port - normalized to `None`. - - assert httpx.URL("http://example.com") == httpx.URL("http://example.com:80") - assert httpx.URL("http://example.com").port is None - assert httpx.URL("http://example.com:80").port is None - - * `url.userinfo` is raw bytes, without URL escaping. Usually you'll want to work - with `url.username` and `url.password` instead, which handle the URL escaping. - - * `url.raw_path` is raw bytes of both the path and query, without URL escaping. - This portion is used as the target when constructing HTTP requests. Usually you'll - want to work with `url.path` instead. - - * `url.query` is raw bytes, without URL escaping. A URL query string portion can - only be properly URL escaped when decoding the parameter names and values - themselves. - """ - - def __init__(self, url: URL | str = "", **kwargs: typing.Any) -> None: - if kwargs: - allowed = { - "scheme": str, - "username": str, - "password": str, - "userinfo": bytes, - "host": str, - "port": int, - "netloc": bytes, - "path": str, - "query": bytes, - "raw_path": bytes, - "fragment": str, - "params": object, - } - - # Perform type checking for all supported keyword arguments. - for key, value in kwargs.items(): - if key not in allowed: - message = f"{key!r} is an invalid keyword argument for URL()" - raise TypeError(message) - if value is not None and not isinstance(value, allowed[key]): - expected = allowed[key].__name__ - seen = type(value).__name__ - message = f"Argument {key!r} must be {expected} but got {seen}" - raise TypeError(message) - if isinstance(value, bytes): - kwargs[key] = value.decode("ascii") - - if "params" in kwargs: - # Replace any "params" keyword with the raw "query" instead. - # - # Ensure that empty params use `kwargs["query"] = None` rather - # than `kwargs["query"] = ""`, so that generated URLs do not - # include an empty trailing "?". - params = kwargs.pop("params") - kwargs["query"] = None if not params else str(QueryParams(params)) - - if isinstance(url, str): - self._uri_reference = urlparse(url, **kwargs) - elif isinstance(url, URL): - self._uri_reference = url._uri_reference.copy_with(**kwargs) - else: - raise TypeError( - "Invalid type for url. Expected str or httpx.URL," - f" got {type(url)}: {url!r}" - ) - - @property - def scheme(self) -> str: - """ - The URL scheme, such as "http", "https". - Always normalised to lowercase. - """ - return self._uri_reference.scheme - - @property - def raw_scheme(self) -> bytes: - """ - The raw bytes representation of the URL scheme, such as b"http", b"https". - Always normalised to lowercase. - """ - return self._uri_reference.scheme.encode("ascii") - - @property - def userinfo(self) -> bytes: - """ - The URL userinfo as a raw bytestring. - For example: b"jo%40email.com:a%20secret". - """ - return self._uri_reference.userinfo.encode("ascii") - - @property - def username(self) -> str: - """ - The URL username as a string, with URL decoding applied. - For example: "jo@email.com" - """ - userinfo = self._uri_reference.userinfo - return unquote(userinfo.partition(":")[0]) - - @property - def password(self) -> str: - """ - The URL password as a string, with URL decoding applied. - For example: "a secret" - """ - userinfo = self._uri_reference.userinfo - return unquote(userinfo.partition(":")[2]) - - @property - def host(self) -> str: - """ - The URL host as a string. - Always normalized to lowercase, with IDNA hosts decoded into unicode. - - Examples: - - url = httpx.URL("http://www.EXAMPLE.org") - assert url.host == "www.example.org" - - url = httpx.URL("http://中国.icom.museum") - assert url.host == "中国.icom.museum" - - url = httpx.URL("http://xn--fiqs8s.icom.museum") - assert url.host == "中国.icom.museum" - - url = httpx.URL("https://[::ffff:192.168.0.1]") - assert url.host == "::ffff:192.168.0.1" - """ - host: str = self._uri_reference.host - - if host.startswith("xn--"): - host = idna.decode(host) - - return host - - @property - def raw_host(self) -> bytes: - """ - The raw bytes representation of the URL host. - Always normalized to lowercase, and IDNA encoded. - - Examples: - - url = httpx.URL("http://www.EXAMPLE.org") - assert url.raw_host == b"www.example.org" - - url = httpx.URL("http://中国.icom.museum") - assert url.raw_host == b"xn--fiqs8s.icom.museum" - - url = httpx.URL("http://xn--fiqs8s.icom.museum") - assert url.raw_host == b"xn--fiqs8s.icom.museum" - - url = httpx.URL("https://[::ffff:192.168.0.1]") - assert url.raw_host == b"::ffff:192.168.0.1" - """ - return self._uri_reference.host.encode("ascii") - - @property - def port(self) -> int | None: - """ - The URL port as an integer. - - Note that the URL class performs port normalization as per the WHATWG spec. - Default ports for "http", "https", "ws", "wss", and "ftp" schemes are always - treated as `None`. - - For example: - - assert httpx.URL("http://www.example.com") == httpx.URL("http://www.example.com:80") - assert httpx.URL("http://www.example.com:80").port is None - """ - return self._uri_reference.port - - @property - def netloc(self) -> bytes: - """ - Either `` or `:` as bytes. - Always normalized to lowercase, and IDNA encoded. - - This property may be used for generating the value of a request - "Host" header. - """ - return self._uri_reference.netloc.encode("ascii") - - @property - def path(self) -> str: - """ - The URL path as a string. Excluding the query string, and URL decoded. - - For example: - - url = httpx.URL("https://example.com/pa%20th") - assert url.path == "/pa th" - """ - path = self._uri_reference.path or "/" - return unquote(path) - - @property - def query(self) -> bytes: - """ - The URL query string, as raw bytes, excluding the leading b"?". - - This is necessarily a bytewise interface, because we cannot - perform URL decoding of this representation until we've parsed - the keys and values into a QueryParams instance. - - For example: - - url = httpx.URL("https://example.com/?filter=some%20search%20terms") - assert url.query == b"filter=some%20search%20terms" - """ - query = self._uri_reference.query or "" - return query.encode("ascii") - - @property - def params(self) -> QueryParams: - """ - The URL query parameters, neatly parsed and packaged into an immutable - multidict representation. - """ - return QueryParams(self._uri_reference.query) - - @property - def raw_path(self) -> bytes: - """ - The complete URL path and query string as raw bytes. - Used as the target when constructing HTTP requests. - - For example: - - GET /users?search=some%20text HTTP/1.1 - Host: www.example.org - Connection: close - """ - path = self._uri_reference.path or "/" - if self._uri_reference.query is not None: - path += "?" + self._uri_reference.query - return path.encode("ascii") - - @property - def fragment(self) -> str: - """ - The URL fragments, as used in HTML anchors. - As a string, without the leading '#'. - """ - return unquote(self._uri_reference.fragment or "") - - @property - def is_absolute_url(self) -> bool: - """ - Return `True` for absolute URLs such as 'http://example.com/path', - and `False` for relative URLs such as '/path'. - """ - # We don't use `.is_absolute` from `rfc3986` because it treats - # URLs with a fragment portion as not absolute. - # What we actually care about is if the URL provides - # a scheme and hostname to which connections should be made. - return bool(self._uri_reference.scheme and self._uri_reference.host) - - @property - def is_relative_url(self) -> bool: - """ - Return `False` for absolute URLs such as 'http://example.com/path', - and `True` for relative URLs such as '/path'. - """ - return not self.is_absolute_url - - def copy_with(self, **kwargs: typing.Any) -> URL: - """ - Copy this URL, returning a new URL with some components altered. - Accepts the same set of parameters as the components that are made - available via properties on the `URL` class. - - For example: - - url = httpx.URL("https://www.example.com").copy_with( - username="jo@gmail.com", password="a secret" - ) - assert url == "https://jo%40email.com:a%20secret@www.example.com" - """ - return URL(self, **kwargs) - - def copy_set_param(self, key: str, value: typing.Any = None) -> URL: - return self.copy_with(params=self.params.set(key, value)) - - def copy_add_param(self, key: str, value: typing.Any = None) -> URL: - return self.copy_with(params=self.params.add(key, value)) - - def copy_remove_param(self, key: str) -> URL: - return self.copy_with(params=self.params.remove(key)) - - def copy_merge_params(self, params: QueryParamTypes) -> URL: - return self.copy_with(params=self.params.merge(params)) - - def join(self, url: URL | str) -> URL: - """ - Return an absolute URL, using this URL as the base. - - Eg. - - url = httpx.URL("https://www.example.com/test") - url = url.join("/new/path") - assert url == "https://www.example.com/new/path" - """ - from urllib.parse import urljoin - - return URL(urljoin(str(self), str(URL(url)))) - - def __hash__(self) -> int: - return hash(str(self)) - - def __eq__(self, other: typing.Any) -> bool: - return isinstance(other, (URL, str)) and str(self) == str(URL(other)) - - def __str__(self) -> str: - return str(self._uri_reference) - - def __repr__(self) -> str: - scheme, userinfo, host, port, path, query, fragment = self._uri_reference - - if ":" in userinfo: - # Mask any password component. - userinfo = f'{userinfo.split(":")[0]}:[secure]' - - authority = "".join( - [ - f"{userinfo}@" if userinfo else "", - f"[{host}]" if ":" in host else host, - f":{port}" if port is not None else "", - ] - ) - url = "".join( - [ - f"{self.scheme}:" if scheme else "", - f"//{authority}" if authority else "", - path, - f"?{query}" if query is not None else "", - f"#{fragment}" if fragment is not None else "", - ] - ) - - return f"{self.__class__.__name__}({url!r})" - - @property - def raw(self) -> tuple[bytes, bytes, int, bytes]: # pragma: nocover - import collections - import warnings - - warnings.warn("URL.raw is deprecated.") - RawURL = collections.namedtuple( - "RawURL", ["raw_scheme", "raw_host", "port", "raw_path"] - ) - return RawURL( - raw_scheme=self.raw_scheme, - raw_host=self.raw_host, - port=self.port, - raw_path=self.raw_path, - ) - - -class QueryParams(typing.Mapping[str, str]): - """ - URL query parameters, as a multi-dict. - """ - - def __init__(self, *args: QueryParamTypes | None, **kwargs: typing.Any) -> None: - assert len(args) < 2, "Too many arguments." - assert not (args and kwargs), "Cannot mix named and unnamed arguments." - - value = args[0] if args else kwargs - - if value is None or isinstance(value, (str, bytes)): - value = value.decode("ascii") if isinstance(value, bytes) else value - self._dict = parse_qs(value, keep_blank_values=True) - elif isinstance(value, QueryParams): - self._dict = {k: list(v) for k, v in value._dict.items()} - else: - dict_value: dict[typing.Any, list[typing.Any]] = {} - if isinstance(value, (list, tuple)): - # Convert list inputs like: - # [("a", "123"), ("a", "456"), ("b", "789")] - # To a dict representation, like: - # {"a": ["123", "456"], "b": ["789"]} - for item in value: - dict_value.setdefault(item[0], []).append(item[1]) - else: - # Convert dict inputs like: - # {"a": "123", "b": ["456", "789"]} - # To dict inputs where values are always lists, like: - # {"a": ["123"], "b": ["456", "789"]} - dict_value = { - k: list(v) if isinstance(v, (list, tuple)) else [v] - for k, v in value.items() - } - - # Ensure that keys and values are neatly coerced to strings. - # We coerce values `True` and `False` to JSON-like "true" and "false" - # representations, and coerce `None` values to the empty string. - self._dict = { - str(k): [primitive_value_to_str(item) for item in v] - for k, v in dict_value.items() - } - - def keys(self) -> typing.KeysView[str]: - """ - Return all the keys in the query params. - - Usage: - - q = httpx.QueryParams("a=123&a=456&b=789") - assert list(q.keys()) == ["a", "b"] - """ - return self._dict.keys() - - def values(self) -> typing.ValuesView[str]: - """ - Return all the values in the query params. If a key occurs more than once - only the first item for that key is returned. - - Usage: - - q = httpx.QueryParams("a=123&a=456&b=789") - assert list(q.values()) == ["123", "789"] - """ - return {k: v[0] for k, v in self._dict.items()}.values() - - def items(self) -> typing.ItemsView[str, str]: - """ - Return all items in the query params. If a key occurs more than once - only the first item for that key is returned. - - Usage: - - q = httpx.QueryParams("a=123&a=456&b=789") - assert list(q.items()) == [("a", "123"), ("b", "789")] - """ - return {k: v[0] for k, v in self._dict.items()}.items() - - def multi_items(self) -> list[tuple[str, str]]: - """ - Return all items in the query params. Allow duplicate keys to occur. - - Usage: - - q = httpx.QueryParams("a=123&a=456&b=789") - assert list(q.multi_items()) == [("a", "123"), ("a", "456"), ("b", "789")] - """ - multi_items: list[tuple[str, str]] = [] - for k, v in self._dict.items(): - multi_items.extend([(k, i) for i in v]) - return multi_items - - def get(self, key: typing.Any, default: typing.Any = None) -> typing.Any: - """ - Get a value from the query param for a given key. If the key occurs - more than once, then only the first value is returned. - - Usage: - - q = httpx.QueryParams("a=123&a=456&b=789") - assert q.get("a") == "123" - """ - if key in self._dict: - return self._dict[str(key)][0] - return default - - def get_list(self, key: str) -> list[str]: - """ - Get all values from the query param for a given key. - - Usage: - - q = httpx.QueryParams("a=123&a=456&b=789") - assert q.get_list("a") == ["123", "456"] - """ - return list(self._dict.get(str(key), [])) - - def set(self, key: str, value: typing.Any = None) -> QueryParams: - """ - Return a new QueryParams instance, setting the value of a key. - - Usage: - - q = httpx.QueryParams("a=123") - q = q.set("a", "456") - assert q == httpx.QueryParams("a=456") - """ - q = QueryParams() - q._dict = dict(self._dict) - q._dict[str(key)] = [primitive_value_to_str(value)] - return q - - def add(self, key: str, value: typing.Any = None) -> QueryParams: - """ - Return a new QueryParams instance, setting or appending the value of a key. - - Usage: - - q = httpx.QueryParams("a=123") - q = q.add("a", "456") - assert q == httpx.QueryParams("a=123&a=456") - """ - q = QueryParams() - q._dict = dict(self._dict) - q._dict[str(key)] = q.get_list(key) + [primitive_value_to_str(value)] - return q - - def remove(self, key: str) -> QueryParams: - """ - Return a new QueryParams instance, removing the value of a key. - - Usage: - - q = httpx.QueryParams("a=123") - q = q.remove("a") - assert q == httpx.QueryParams("") - """ - q = QueryParams() - q._dict = dict(self._dict) - q._dict.pop(str(key), None) - return q - - def merge(self, params: QueryParamTypes | None = None) -> QueryParams: - """ - Return a new QueryParams instance, updated with. - - Usage: - - q = httpx.QueryParams("a=123") - q = q.merge({"b": "456"}) - assert q == httpx.QueryParams("a=123&b=456") - - q = httpx.QueryParams("a=123") - q = q.merge({"a": "456", "b": "789"}) - assert q == httpx.QueryParams("a=456&b=789") - """ - q = QueryParams(params) - q._dict = {**self._dict, **q._dict} - return q - - def __getitem__(self, key: typing.Any) -> str: - return self._dict[key][0] - - def __contains__(self, key: typing.Any) -> bool: - return key in self._dict - - def __iter__(self) -> typing.Iterator[typing.Any]: - return iter(self.keys()) - - def __len__(self) -> int: - return len(self._dict) - - def __bool__(self) -> bool: - return bool(self._dict) - - def __hash__(self) -> int: - return hash(str(self)) - - def __eq__(self, other: typing.Any) -> bool: - if not isinstance(other, self.__class__): - return False - return sorted(self.multi_items()) == sorted(other.multi_items()) - - def __str__(self) -> str: - return urlencode(self.multi_items()) - - def __repr__(self) -> str: - class_name = self.__class__.__name__ - query_string = str(self) - return f"{class_name}({query_string!r})" - - def update(self, params: QueryParamTypes | None = None) -> None: - raise RuntimeError( - "QueryParams are immutable since 0.18.0. " - "Use `q = q.merge(...)` to create an updated copy." - ) - - def __setitem__(self, key: str, value: str) -> None: - raise RuntimeError( - "QueryParams are immutable since 0.18.0. " - "Use `q = q.set(key, value)` to create an updated copy." - ) diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/_utils.py b/write-message/venv/lib/python3.10/site-packages/httpx/_utils.py deleted file mode 100644 index 7fe827d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/httpx/_utils.py +++ /dev/null @@ -1,242 +0,0 @@ -from __future__ import annotations - -import ipaddress -import os -import re -import typing -from urllib.request import getproxies - -from ._types import PrimitiveData - -if typing.TYPE_CHECKING: # pragma: no cover - from ._urls import URL - - -def primitive_value_to_str(value: PrimitiveData) -> str: - """ - Coerce a primitive data type into a string value. - - Note that we prefer JSON-style 'true'/'false' for boolean values here. - """ - if value is True: - return "true" - elif value is False: - return "false" - elif value is None: - return "" - return str(value) - - -def get_environment_proxies() -> dict[str, str | None]: - """Gets proxy information from the environment""" - - # urllib.request.getproxies() falls back on System - # Registry and Config for proxies on Windows and macOS. - # We don't want to propagate non-HTTP proxies into - # our configuration such as 'TRAVIS_APT_PROXY'. - proxy_info = getproxies() - mounts: dict[str, str | None] = {} - - for scheme in ("http", "https", "all"): - if proxy_info.get(scheme): - hostname = proxy_info[scheme] - mounts[f"{scheme}://"] = ( - hostname if "://" in hostname else f"http://{hostname}" - ) - - no_proxy_hosts = [host.strip() for host in proxy_info.get("no", "").split(",")] - for hostname in no_proxy_hosts: - # See https://curl.haxx.se/libcurl/c/CURLOPT_NOPROXY.html for details - # on how names in `NO_PROXY` are handled. - if hostname == "*": - # If NO_PROXY=* is used or if "*" occurs as any one of the comma - # separated hostnames, then we should just bypass any information - # from HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and always ignore - # proxies. - return {} - elif hostname: - # NO_PROXY=.google.com is marked as "all://*.google.com, - # which disables "www.google.com" but not "google.com" - # NO_PROXY=google.com is marked as "all://*google.com, - # which disables "www.google.com" and "google.com". - # (But not "wwwgoogle.com") - # NO_PROXY can include domains, IPv6, IPv4 addresses and "localhost" - # NO_PROXY=example.com,::1,localhost,192.168.0.0/16 - if "://" in hostname: - mounts[hostname] = None - elif is_ipv4_hostname(hostname): - mounts[f"all://{hostname}"] = None - elif is_ipv6_hostname(hostname): - mounts[f"all://[{hostname}]"] = None - elif hostname.lower() == "localhost": - mounts[f"all://{hostname}"] = None - else: - mounts[f"all://*{hostname}"] = None - - return mounts - - -def to_bytes(value: str | bytes, encoding: str = "utf-8") -> bytes: - return value.encode(encoding) if isinstance(value, str) else value - - -def to_str(value: str | bytes, encoding: str = "utf-8") -> str: - return value if isinstance(value, str) else value.decode(encoding) - - -def to_bytes_or_str(value: str, match_type_of: typing.AnyStr) -> typing.AnyStr: - return value if isinstance(match_type_of, str) else value.encode() - - -def unquote(value: str) -> str: - return value[1:-1] if value[0] == value[-1] == '"' else value - - -def peek_filelike_length(stream: typing.Any) -> int | None: - """ - Given a file-like stream object, return its length in number of bytes - without reading it into memory. - """ - try: - # Is it an actual file? - fd = stream.fileno() - # Yup, seems to be an actual file. - length = os.fstat(fd).st_size - except (AttributeError, OSError): - # No... Maybe it's something that supports random access, like `io.BytesIO`? - try: - # Assuming so, go to end of stream to figure out its length, - # then put it back in place. - offset = stream.tell() - length = stream.seek(0, os.SEEK_END) - stream.seek(offset) - except (AttributeError, OSError): - # Not even that? Sorry, we're doomed... - return None - - return length - - -class URLPattern: - """ - A utility class currently used for making lookups against proxy keys... - - # Wildcard matching... - >>> pattern = URLPattern("all://") - >>> pattern.matches(httpx.URL("http://example.com")) - True - - # Witch scheme matching... - >>> pattern = URLPattern("https://") - >>> pattern.matches(httpx.URL("https://example.com")) - True - >>> pattern.matches(httpx.URL("http://example.com")) - False - - # With domain matching... - >>> pattern = URLPattern("https://example.com") - >>> pattern.matches(httpx.URL("https://example.com")) - True - >>> pattern.matches(httpx.URL("http://example.com")) - False - >>> pattern.matches(httpx.URL("https://other.com")) - False - - # Wildcard scheme, with domain matching... - >>> pattern = URLPattern("all://example.com") - >>> pattern.matches(httpx.URL("https://example.com")) - True - >>> pattern.matches(httpx.URL("http://example.com")) - True - >>> pattern.matches(httpx.URL("https://other.com")) - False - - # With port matching... - >>> pattern = URLPattern("https://example.com:1234") - >>> pattern.matches(httpx.URL("https://example.com:1234")) - True - >>> pattern.matches(httpx.URL("https://example.com")) - False - """ - - def __init__(self, pattern: str) -> None: - from ._urls import URL - - if pattern and ":" not in pattern: - raise ValueError( - f"Proxy keys should use proper URL forms rather " - f"than plain scheme strings. " - f'Instead of "{pattern}", use "{pattern}://"' - ) - - url = URL(pattern) - self.pattern = pattern - self.scheme = "" if url.scheme == "all" else url.scheme - self.host = "" if url.host == "*" else url.host - self.port = url.port - if not url.host or url.host == "*": - self.host_regex: typing.Pattern[str] | None = None - elif url.host.startswith("*."): - # *.example.com should match "www.example.com", but not "example.com" - domain = re.escape(url.host[2:]) - self.host_regex = re.compile(f"^.+\\.{domain}$") - elif url.host.startswith("*"): - # *example.com should match "www.example.com" and "example.com" - domain = re.escape(url.host[1:]) - self.host_regex = re.compile(f"^(.+\\.)?{domain}$") - else: - # example.com should match "example.com" but not "www.example.com" - domain = re.escape(url.host) - self.host_regex = re.compile(f"^{domain}$") - - def matches(self, other: URL) -> bool: - if self.scheme and self.scheme != other.scheme: - return False - if ( - self.host - and self.host_regex is not None - and not self.host_regex.match(other.host) - ): - return False - if self.port is not None and self.port != other.port: - return False - return True - - @property - def priority(self) -> tuple[int, int, int]: - """ - The priority allows URLPattern instances to be sortable, so that - we can match from most specific to least specific. - """ - # URLs with a port should take priority over URLs without a port. - port_priority = 0 if self.port is not None else 1 - # Longer hostnames should match first. - host_priority = -len(self.host) - # Longer schemes should match first. - scheme_priority = -len(self.scheme) - return (port_priority, host_priority, scheme_priority) - - def __hash__(self) -> int: - return hash(self.pattern) - - def __lt__(self, other: URLPattern) -> bool: - return self.priority < other.priority - - def __eq__(self, other: typing.Any) -> bool: - return isinstance(other, URLPattern) and self.pattern == other.pattern - - -def is_ipv4_hostname(hostname: str) -> bool: - try: - ipaddress.IPv4Address(hostname.split("/")[0]) - except Exception: - return False - return True - - -def is_ipv6_hostname(hostname: str) -> bool: - try: - ipaddress.IPv6Address(hostname.split("/")[0]) - except Exception: - return False - return True diff --git a/write-message/venv/lib/python3.10/site-packages/httpx/py.typed b/write-message/venv/lib/python3.10/site-packages/httpx/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/LICENSE.md b/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/LICENSE.md deleted file mode 100644 index 19b6b45..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/LICENSE.md +++ /dev/null @@ -1,31 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2013-2024, Kim Davies and 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 the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/METADATA deleted file mode 100644 index c42623e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/METADATA +++ /dev/null @@ -1,250 +0,0 @@ -Metadata-Version: 2.1 -Name: idna -Version: 3.10 -Summary: Internationalized Domain Names in Applications (IDNA) -Author-email: Kim Davies -Requires-Python: >=3.6 -Description-Content-Type: text/x-rst -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: System Administrators -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.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: Programming Language :: Python :: 3.13 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Internet :: Name Service (DNS) -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: Utilities -Requires-Dist: ruff >= 0.6.2 ; extra == "all" -Requires-Dist: mypy >= 1.11.2 ; extra == "all" -Requires-Dist: pytest >= 8.3.2 ; extra == "all" -Requires-Dist: flake8 >= 7.1.1 ; extra == "all" -Project-URL: Changelog, https://github.com/kjd/idna/blob/master/HISTORY.rst -Project-URL: Issue tracker, https://github.com/kjd/idna/issues -Project-URL: Source, https://github.com/kjd/idna -Provides-Extra: all - -Internationalized Domain Names in Applications (IDNA) -===================================================== - -Support for the Internationalized Domain Names in -Applications (IDNA) protocol as specified in `RFC 5891 -`_. This is the latest version of -the protocol and is sometimes referred to as “IDNA 2008”. - -This library also provides support for Unicode Technical -Standard 46, `Unicode IDNA Compatibility Processing -`_. - -This acts as a suitable replacement for the “encodings.idna” -module that comes with the Python standard library, but which -only supports the older superseded IDNA specification (`RFC 3490 -`_). - -Basic functions are simply executed: - -.. code-block:: pycon - - >>> import idna - >>> idna.encode('ドメイン.テスト') - b'xn--eckwd4c7c.xn--zckzah' - >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) - ドメイン.テスト - - -Installation ------------- - -This package is available for installation from PyPI: - -.. code-block:: bash - - $ python3 -m pip install idna - - -Usage ------ - -For typical usage, the ``encode`` and ``decode`` functions will take a -domain name argument and perform a conversion to A-labels or U-labels -respectively. - -.. code-block:: pycon - - >>> import idna - >>> idna.encode('ドメイン.テスト') - b'xn--eckwd4c7c.xn--zckzah' - >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) - ドメイン.テスト - -You may use the codec encoding and decoding methods using the -``idna.codec`` module: - -.. code-block:: pycon - - >>> import idna.codec - >>> print('домен.испытание'.encode('idna2008')) - b'xn--d1acufc.xn--80akhbyknj4f' - >>> print(b'xn--d1acufc.xn--80akhbyknj4f'.decode('idna2008')) - домен.испытание - -Conversions can be applied at a per-label basis using the ``ulabel`` or -``alabel`` functions if necessary: - -.. code-block:: pycon - - >>> idna.alabel('测试') - b'xn--0zwm56d' - -Compatibility Mapping (UTS #46) -+++++++++++++++++++++++++++++++ - -As described in `RFC 5895 `_, the -IDNA specification does not normalize input from different potential -ways a user may input a domain name. This functionality, known as -a “mapping”, is considered by the specification to be a local -user-interface issue distinct from IDNA conversion functionality. - -This library provides one such mapping that was developed by the -Unicode Consortium. Known as `Unicode IDNA Compatibility Processing -`_, it provides for both a regular -mapping for typical applications, as well as a transitional mapping to -help migrate from older IDNA 2003 applications. Strings are -preprocessed according to Section 4.4 “Preprocessing for IDNA2008” -prior to the IDNA operations. - -For example, “Königsgäßchen” is not a permissible label as *LATIN -CAPITAL LETTER K* is not allowed (nor are capital letters in general). -UTS 46 will convert this into lower case prior to applying the IDNA -conversion. - -.. code-block:: pycon - - >>> import idna - >>> idna.encode('Königsgäßchen') - ... - idna.core.InvalidCodepoint: Codepoint U+004B at position 1 of 'Königsgäßchen' not allowed - >>> idna.encode('Königsgäßchen', uts46=True) - b'xn--knigsgchen-b4a3dun' - >>> print(idna.decode('xn--knigsgchen-b4a3dun')) - königsgäßchen - -Transitional processing provides conversions to help transition from -the older 2003 standard to the current standard. For example, in the -original IDNA specification, the *LATIN SMALL LETTER SHARP S* (ß) was -converted into two *LATIN SMALL LETTER S* (ss), whereas in the current -IDNA specification this conversion is not performed. - -.. code-block:: pycon - - >>> idna.encode('Königsgäßchen', uts46=True, transitional=True) - 'xn--knigsgsschen-lcb0w' - -Implementers should use transitional processing with caution, only in -rare cases where conversion from legacy labels to current labels must be -performed (i.e. IDNA implementations that pre-date 2008). For typical -applications that just need to convert labels, transitional processing -is unlikely to be beneficial and could produce unexpected incompatible -results. - -``encodings.idna`` Compatibility -++++++++++++++++++++++++++++++++ - -Function calls from the Python built-in ``encodings.idna`` module are -mapped to their IDNA 2008 equivalents using the ``idna.compat`` module. -Simply substitute the ``import`` clause in your code to refer to the new -module name. - -Exceptions ----------- - -All errors raised during the conversion following the specification -should raise an exception derived from the ``idna.IDNAError`` base -class. - -More specific exceptions that may be generated as ``idna.IDNABidiError`` -when the error reflects an illegal combination of left-to-right and -right-to-left characters in a label; ``idna.InvalidCodepoint`` when -a specific codepoint is an illegal character in an IDN label (i.e. -INVALID); and ``idna.InvalidCodepointContext`` when the codepoint is -illegal based on its positional context (i.e. it is CONTEXTO or CONTEXTJ -but the contextual requirements are not satisfied.) - -Building and Diagnostics ------------------------- - -The IDNA and UTS 46 functionality relies upon pre-calculated lookup -tables for performance. These tables are derived from computing against -eligibility criteria in the respective standards. These tables are -computed using the command-line script ``tools/idna-data``. - -This tool will fetch relevant codepoint data from the Unicode repository -and perform the required calculations to identify eligibility. There are -three main modes: - -* ``idna-data make-libdata``. Generates ``idnadata.py`` and - ``uts46data.py``, the pre-calculated lookup tables used for IDNA and - UTS 46 conversions. Implementers who wish to track this library against - a different Unicode version may use this tool to manually generate a - different version of the ``idnadata.py`` and ``uts46data.py`` files. - -* ``idna-data make-table``. Generate a table of the IDNA disposition - (e.g. PVALID, CONTEXTJ, CONTEXTO) in the format found in Appendix - B.1 of RFC 5892 and the pre-computed tables published by `IANA - `_. - -* ``idna-data U+0061``. Prints debugging output on the various - properties associated with an individual Unicode codepoint (in this - case, U+0061), that are used to assess the IDNA and UTS 46 status of a - codepoint. This is helpful in debugging or analysis. - -The tool accepts a number of arguments, described using ``idna-data --h``. Most notably, the ``--version`` argument allows the specification -of the version of Unicode to be used in computing the table data. For -example, ``idna-data --version 9.0.0 make-libdata`` will generate -library data against Unicode 9.0.0. - - -Additional Notes ----------------- - -* **Packages**. The latest tagged release version is published in the - `Python Package Index `_. - -* **Version support**. This library supports Python 3.6 and higher. - As this library serves as a low-level toolkit for a variety of - applications, many of which strive for broad compatibility with older - Python versions, there is no rush to remove older interpreter support. - Removing support for older versions should be well justified in that the - maintenance burden has become too high. - -* **Python 2**. Python 2 is supported by version 2.x of this library. - Use "idna<3" in your requirements file if you need this library for - a Python 2 application. Be advised that these versions are no longer - actively developed. - -* **Testing**. The library has a test suite based on each rule of the - IDNA specification, as well as tests that are provided as part of the - Unicode Technical Standard 46, `Unicode IDNA Compatibility Processing - `_. - -* **Emoji**. It is an occasional request to support emoji domains in - this library. Encoding of symbols like emoji is expressly prohibited by - the technical standard IDNA 2008 and emoji domains are broadly phased - out across the domain industry due to associated security risks. For - now, applications that need to support these non-compliant labels - may wish to consider trying the encode/decode operation in this library - first, and then falling back to using `encodings.idna`. See `the Github - project `_ for more discussion. - diff --git a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/RECORD deleted file mode 100644 index 97aaf63..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/RECORD +++ /dev/null @@ -1,22 +0,0 @@ -idna-3.10.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -idna-3.10.dist-info/LICENSE.md,sha256=pZ8LDvNjWHQQmkRhykT_enDVBpboFHZ7-vch1Mmw2w8,1541 -idna-3.10.dist-info/METADATA,sha256=URR5ZyDfQ1PCEGhkYoojqfi2Ra0tau2--lhwG4XSfjI,10158 -idna-3.10.dist-info/RECORD,, -idna-3.10.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 -idna/__init__.py,sha256=MPqNDLZbXqGaNdXxAFhiqFPKEQXju2jNQhCey6-5eJM,868 -idna/__pycache__/__init__.cpython-310.pyc,, -idna/__pycache__/codec.cpython-310.pyc,, -idna/__pycache__/compat.cpython-310.pyc,, -idna/__pycache__/core.cpython-310.pyc,, -idna/__pycache__/idnadata.cpython-310.pyc,, -idna/__pycache__/intranges.cpython-310.pyc,, -idna/__pycache__/package_data.cpython-310.pyc,, -idna/__pycache__/uts46data.cpython-310.pyc,, -idna/codec.py,sha256=PEew3ItwzjW4hymbasnty2N2OXvNcgHB-JjrBuxHPYY,3422 -idna/compat.py,sha256=RzLy6QQCdl9784aFhb2EX9EKGCJjg0P3PilGdeXXcx8,316 -idna/core.py,sha256=YJYyAMnwiQEPjVC4-Fqu_p4CJ6yKKuDGmppBNQNQpFs,13239 -idna/idnadata.py,sha256=W30GcIGvtOWYwAjZj4ZjuouUutC6ffgNuyjJy7fZ-lo,78306 -idna/intranges.py,sha256=amUtkdhYcQG8Zr-CoMM_kVRacxkivC1WgxN1b63KKdU,1898 -idna/package_data.py,sha256=q59S3OXsc5VI8j6vSD0sGBMyk6zZ4vWFREE88yCJYKs,21 -idna/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -idna/uts46data.py,sha256=rt90K9J40gUSwppDPCrhjgi5AA6pWM65dEGRSf6rIhM,239289 diff --git a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/WHEEL deleted file mode 100644 index 3b5e64b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna-3.10.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.9.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__init__.py b/write-message/venv/lib/python3.10/site-packages/idna/__init__.py deleted file mode 100644 index cfdc030..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -from .core import ( - IDNABidiError, - IDNAError, - InvalidCodepoint, - InvalidCodepointContext, - alabel, - check_bidi, - check_hyphen_ok, - check_initial_combiner, - check_label, - check_nfc, - decode, - encode, - ulabel, - uts46_remap, - valid_contextj, - valid_contexto, - valid_label_length, - valid_string_length, -) -from .intranges import intranges_contain -from .package_data import __version__ - -__all__ = [ - "__version__", - "IDNABidiError", - "IDNAError", - "InvalidCodepoint", - "InvalidCodepointContext", - "alabel", - "check_bidi", - "check_hyphen_ok", - "check_initial_combiner", - "check_label", - "check_nfc", - "decode", - "encode", - "intranges_contain", - "ulabel", - "uts46_remap", - "valid_contextj", - "valid_contexto", - "valid_label_length", - "valid_string_length", -] diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index ebfa9d9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/codec.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/codec.cpython-310.pyc deleted file mode 100644 index 184b0ed..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/codec.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/compat.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/compat.cpython-310.pyc deleted file mode 100644 index a9ab44b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/compat.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/core.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/core.cpython-310.pyc deleted file mode 100644 index 9e22a4c..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/core.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/idnadata.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/idnadata.cpython-310.pyc deleted file mode 100644 index a4ced5b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/idnadata.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/intranges.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/intranges.cpython-310.pyc deleted file mode 100644 index 435a09f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/intranges.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/package_data.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/package_data.cpython-310.pyc deleted file mode 100644 index e63a079..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/package_data.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/uts46data.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/uts46data.cpython-310.pyc deleted file mode 100644 index e29bb0f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/idna/__pycache__/uts46data.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/idna/codec.py b/write-message/venv/lib/python3.10/site-packages/idna/codec.py deleted file mode 100644 index 913abfd..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/codec.py +++ /dev/null @@ -1,122 +0,0 @@ -import codecs -import re -from typing import Any, Optional, Tuple - -from .core import IDNAError, alabel, decode, encode, ulabel - -_unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]") - - -class Codec(codecs.Codec): - def encode(self, data: str, errors: str = "strict") -> Tuple[bytes, int]: - if errors != "strict": - raise IDNAError('Unsupported error handling "{}"'.format(errors)) - - if not data: - return b"", 0 - - return encode(data), len(data) - - def decode(self, data: bytes, errors: str = "strict") -> Tuple[str, int]: - if errors != "strict": - raise IDNAError('Unsupported error handling "{}"'.format(errors)) - - if not data: - return "", 0 - - return decode(data), len(data) - - -class IncrementalEncoder(codecs.BufferedIncrementalEncoder): - def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[bytes, int]: - if errors != "strict": - raise IDNAError('Unsupported error handling "{}"'.format(errors)) - - if not data: - return b"", 0 - - labels = _unicode_dots_re.split(data) - trailing_dot = b"" - if labels: - if not labels[-1]: - trailing_dot = b"." - del labels[-1] - elif not final: - # Keep potentially unfinished label until the next call - del labels[-1] - if labels: - trailing_dot = b"." - - result = [] - size = 0 - for label in labels: - result.append(alabel(label)) - if size: - size += 1 - size += len(label) - - # Join with U+002E - result_bytes = b".".join(result) + trailing_dot - size += len(trailing_dot) - return result_bytes, size - - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def _buffer_decode(self, data: Any, errors: str, final: bool) -> Tuple[str, int]: - if errors != "strict": - raise IDNAError('Unsupported error handling "{}"'.format(errors)) - - if not data: - return ("", 0) - - if not isinstance(data, str): - data = str(data, "ascii") - - labels = _unicode_dots_re.split(data) - trailing_dot = "" - if labels: - if not labels[-1]: - trailing_dot = "." - del labels[-1] - elif not final: - # Keep potentially unfinished label until the next call - del labels[-1] - if labels: - trailing_dot = "." - - result = [] - size = 0 - for label in labels: - result.append(ulabel(label)) - if size: - size += 1 - size += len(label) - - result_str = ".".join(result) + trailing_dot - size += len(trailing_dot) - return (result_str, size) - - -class StreamWriter(Codec, codecs.StreamWriter): - pass - - -class StreamReader(Codec, codecs.StreamReader): - pass - - -def search_function(name: str) -> Optional[codecs.CodecInfo]: - if name != "idna2008": - return None - return codecs.CodecInfo( - name=name, - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) - - -codecs.register(search_function) diff --git a/write-message/venv/lib/python3.10/site-packages/idna/compat.py b/write-message/venv/lib/python3.10/site-packages/idna/compat.py deleted file mode 100644 index 1df9f2a..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/compat.py +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Any, Union - -from .core import decode, encode - - -def ToASCII(label: str) -> bytes: - return encode(label) - - -def ToUnicode(label: Union[bytes, bytearray]) -> str: - return decode(label) - - -def nameprep(s: Any) -> None: - raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol") diff --git a/write-message/venv/lib/python3.10/site-packages/idna/core.py b/write-message/venv/lib/python3.10/site-packages/idna/core.py deleted file mode 100644 index 9115f12..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/core.py +++ /dev/null @@ -1,437 +0,0 @@ -import bisect -import re -import unicodedata -from typing import Optional, Union - -from . import idnadata -from .intranges import intranges_contain - -_virama_combining_class = 9 -_alabel_prefix = b"xn--" -_unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]") - - -class IDNAError(UnicodeError): - """Base exception for all IDNA-encoding related problems""" - - pass - - -class IDNABidiError(IDNAError): - """Exception when bidirectional requirements are not satisfied""" - - pass - - -class InvalidCodepoint(IDNAError): - """Exception when a disallowed or unallocated codepoint is used""" - - pass - - -class InvalidCodepointContext(IDNAError): - """Exception when the codepoint is not valid in the context it is used""" - - pass - - -def _combining_class(cp: int) -> int: - v = unicodedata.combining(chr(cp)) - if v == 0: - if not unicodedata.name(chr(cp)): - raise ValueError("Unknown character in unicodedata") - return v - - -def _is_script(cp: str, script: str) -> bool: - return intranges_contain(ord(cp), idnadata.scripts[script]) - - -def _punycode(s: str) -> bytes: - return s.encode("punycode") - - -def _unot(s: int) -> str: - return "U+{:04X}".format(s) - - -def valid_label_length(label: Union[bytes, str]) -> bool: - if len(label) > 63: - return False - return True - - -def valid_string_length(label: Union[bytes, str], trailing_dot: bool) -> bool: - if len(label) > (254 if trailing_dot else 253): - return False - return True - - -def check_bidi(label: str, check_ltr: bool = False) -> bool: - # Bidi rules should only be applied if string contains RTL characters - bidi_label = False - for idx, cp in enumerate(label, 1): - direction = unicodedata.bidirectional(cp) - if direction == "": - # String likely comes from a newer version of Unicode - raise IDNABidiError("Unknown directionality in label {} at position {}".format(repr(label), idx)) - if direction in ["R", "AL", "AN"]: - bidi_label = True - if not bidi_label and not check_ltr: - return True - - # Bidi rule 1 - direction = unicodedata.bidirectional(label[0]) - if direction in ["R", "AL"]: - rtl = True - elif direction == "L": - rtl = False - else: - raise IDNABidiError("First codepoint in label {} must be directionality L, R or AL".format(repr(label))) - - valid_ending = False - number_type: Optional[str] = None - for idx, cp in enumerate(label, 1): - direction = unicodedata.bidirectional(cp) - - if rtl: - # Bidi rule 2 - if direction not in [ - "R", - "AL", - "AN", - "EN", - "ES", - "CS", - "ET", - "ON", - "BN", - "NSM", - ]: - raise IDNABidiError("Invalid direction for codepoint at position {} in a right-to-left label".format(idx)) - # Bidi rule 3 - if direction in ["R", "AL", "EN", "AN"]: - valid_ending = True - elif direction != "NSM": - valid_ending = False - # Bidi rule 4 - if direction in ["AN", "EN"]: - if not number_type: - number_type = direction - else: - if number_type != direction: - raise IDNABidiError("Can not mix numeral types in a right-to-left label") - else: - # Bidi rule 5 - if direction not in ["L", "EN", "ES", "CS", "ET", "ON", "BN", "NSM"]: - raise IDNABidiError("Invalid direction for codepoint at position {} in a left-to-right label".format(idx)) - # Bidi rule 6 - if direction in ["L", "EN"]: - valid_ending = True - elif direction != "NSM": - valid_ending = False - - if not valid_ending: - raise IDNABidiError("Label ends with illegal codepoint directionality") - - return True - - -def check_initial_combiner(label: str) -> bool: - if unicodedata.category(label[0])[0] == "M": - raise IDNAError("Label begins with an illegal combining character") - return True - - -def check_hyphen_ok(label: str) -> bool: - if label[2:4] == "--": - raise IDNAError("Label has disallowed hyphens in 3rd and 4th position") - if label[0] == "-" or label[-1] == "-": - raise IDNAError("Label must not start or end with a hyphen") - return True - - -def check_nfc(label: str) -> None: - if unicodedata.normalize("NFC", label) != label: - raise IDNAError("Label must be in Normalization Form C") - - -def valid_contextj(label: str, pos: int) -> bool: - cp_value = ord(label[pos]) - - if cp_value == 0x200C: - if pos > 0: - if _combining_class(ord(label[pos - 1])) == _virama_combining_class: - return True - - ok = False - for i in range(pos - 1, -1, -1): - joining_type = idnadata.joining_types.get(ord(label[i])) - if joining_type == ord("T"): - continue - elif joining_type in [ord("L"), ord("D")]: - ok = True - break - else: - break - - if not ok: - return False - - ok = False - for i in range(pos + 1, len(label)): - joining_type = idnadata.joining_types.get(ord(label[i])) - if joining_type == ord("T"): - continue - elif joining_type in [ord("R"), ord("D")]: - ok = True - break - else: - break - return ok - - if cp_value == 0x200D: - if pos > 0: - if _combining_class(ord(label[pos - 1])) == _virama_combining_class: - return True - return False - - else: - return False - - -def valid_contexto(label: str, pos: int, exception: bool = False) -> bool: - cp_value = ord(label[pos]) - - if cp_value == 0x00B7: - if 0 < pos < len(label) - 1: - if ord(label[pos - 1]) == 0x006C and ord(label[pos + 1]) == 0x006C: - return True - return False - - elif cp_value == 0x0375: - if pos < len(label) - 1 and len(label) > 1: - return _is_script(label[pos + 1], "Greek") - return False - - elif cp_value == 0x05F3 or cp_value == 0x05F4: - if pos > 0: - return _is_script(label[pos - 1], "Hebrew") - return False - - elif cp_value == 0x30FB: - for cp in label: - if cp == "\u30fb": - continue - if _is_script(cp, "Hiragana") or _is_script(cp, "Katakana") or _is_script(cp, "Han"): - return True - return False - - elif 0x660 <= cp_value <= 0x669: - for cp in label: - if 0x6F0 <= ord(cp) <= 0x06F9: - return False - return True - - elif 0x6F0 <= cp_value <= 0x6F9: - for cp in label: - if 0x660 <= ord(cp) <= 0x0669: - return False - return True - - return False - - -def check_label(label: Union[str, bytes, bytearray]) -> None: - if isinstance(label, (bytes, bytearray)): - label = label.decode("utf-8") - if len(label) == 0: - raise IDNAError("Empty Label") - - check_nfc(label) - check_hyphen_ok(label) - check_initial_combiner(label) - - for pos, cp in enumerate(label): - cp_value = ord(cp) - if intranges_contain(cp_value, idnadata.codepoint_classes["PVALID"]): - continue - elif intranges_contain(cp_value, idnadata.codepoint_classes["CONTEXTJ"]): - try: - if not valid_contextj(label, pos): - raise InvalidCodepointContext( - "Joiner {} not allowed at position {} in {}".format(_unot(cp_value), pos + 1, repr(label)) - ) - except ValueError: - raise IDNAError( - "Unknown codepoint adjacent to joiner {} at position {} in {}".format( - _unot(cp_value), pos + 1, repr(label) - ) - ) - elif intranges_contain(cp_value, idnadata.codepoint_classes["CONTEXTO"]): - if not valid_contexto(label, pos): - raise InvalidCodepointContext( - "Codepoint {} not allowed at position {} in {}".format(_unot(cp_value), pos + 1, repr(label)) - ) - else: - raise InvalidCodepoint( - "Codepoint {} at position {} of {} not allowed".format(_unot(cp_value), pos + 1, repr(label)) - ) - - check_bidi(label) - - -def alabel(label: str) -> bytes: - try: - label_bytes = label.encode("ascii") - ulabel(label_bytes) - if not valid_label_length(label_bytes): - raise IDNAError("Label too long") - return label_bytes - except UnicodeEncodeError: - pass - - check_label(label) - label_bytes = _alabel_prefix + _punycode(label) - - if not valid_label_length(label_bytes): - raise IDNAError("Label too long") - - return label_bytes - - -def ulabel(label: Union[str, bytes, bytearray]) -> str: - if not isinstance(label, (bytes, bytearray)): - try: - label_bytes = label.encode("ascii") - except UnicodeEncodeError: - check_label(label) - return label - else: - label_bytes = label - - label_bytes = label_bytes.lower() - if label_bytes.startswith(_alabel_prefix): - label_bytes = label_bytes[len(_alabel_prefix) :] - if not label_bytes: - raise IDNAError("Malformed A-label, no Punycode eligible content found") - if label_bytes.decode("ascii")[-1] == "-": - raise IDNAError("A-label must not end with a hyphen") - else: - check_label(label_bytes) - return label_bytes.decode("ascii") - - try: - label = label_bytes.decode("punycode") - except UnicodeError: - raise IDNAError("Invalid A-label") - check_label(label) - return label - - -def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False) -> str: - """Re-map the characters in the string according to UTS46 processing.""" - from .uts46data import uts46data - - output = "" - - for pos, char in enumerate(domain): - code_point = ord(char) - try: - uts46row = uts46data[code_point if code_point < 256 else bisect.bisect_left(uts46data, (code_point, "Z")) - 1] - status = uts46row[1] - replacement: Optional[str] = None - if len(uts46row) == 3: - replacement = uts46row[2] - if ( - status == "V" - or (status == "D" and not transitional) - or (status == "3" and not std3_rules and replacement is None) - ): - output += char - elif replacement is not None and ( - status == "M" or (status == "3" and not std3_rules) or (status == "D" and transitional) - ): - output += replacement - elif status != "I": - raise IndexError() - except IndexError: - raise InvalidCodepoint( - "Codepoint {} not allowed at position {} in {}".format(_unot(code_point), pos + 1, repr(domain)) - ) - - return unicodedata.normalize("NFC", output) - - -def encode( - s: Union[str, bytes, bytearray], - strict: bool = False, - uts46: bool = False, - std3_rules: bool = False, - transitional: bool = False, -) -> bytes: - if not isinstance(s, str): - try: - s = str(s, "ascii") - except UnicodeDecodeError: - raise IDNAError("should pass a unicode string to the function rather than a byte string.") - if uts46: - s = uts46_remap(s, std3_rules, transitional) - trailing_dot = False - result = [] - if strict: - labels = s.split(".") - else: - labels = _unicode_dots_re.split(s) - if not labels or labels == [""]: - raise IDNAError("Empty domain") - if labels[-1] == "": - del labels[-1] - trailing_dot = True - for label in labels: - s = alabel(label) - if s: - result.append(s) - else: - raise IDNAError("Empty label") - if trailing_dot: - result.append(b"") - s = b".".join(result) - if not valid_string_length(s, trailing_dot): - raise IDNAError("Domain too long") - return s - - -def decode( - s: Union[str, bytes, bytearray], - strict: bool = False, - uts46: bool = False, - std3_rules: bool = False, -) -> str: - try: - if not isinstance(s, str): - s = str(s, "ascii") - except UnicodeDecodeError: - raise IDNAError("Invalid ASCII in A-label") - if uts46: - s = uts46_remap(s, std3_rules, False) - trailing_dot = False - result = [] - if not strict: - labels = _unicode_dots_re.split(s) - else: - labels = s.split(".") - if not labels or labels == [""]: - raise IDNAError("Empty domain") - if not labels[-1]: - del labels[-1] - trailing_dot = True - for label in labels: - s = ulabel(label) - if s: - result.append(s) - else: - raise IDNAError("Empty label") - if trailing_dot: - result.append("") - return ".".join(result) diff --git a/write-message/venv/lib/python3.10/site-packages/idna/idnadata.py b/write-message/venv/lib/python3.10/site-packages/idna/idnadata.py deleted file mode 100644 index 4be6004..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/idnadata.py +++ /dev/null @@ -1,4243 +0,0 @@ -# This file is automatically generated by tools/idna-data - -__version__ = "15.1.0" -scripts = { - "Greek": ( - 0x37000000374, - 0x37500000378, - 0x37A0000037E, - 0x37F00000380, - 0x38400000385, - 0x38600000387, - 0x3880000038B, - 0x38C0000038D, - 0x38E000003A2, - 0x3A3000003E2, - 0x3F000000400, - 0x1D2600001D2B, - 0x1D5D00001D62, - 0x1D6600001D6B, - 0x1DBF00001DC0, - 0x1F0000001F16, - 0x1F1800001F1E, - 0x1F2000001F46, - 0x1F4800001F4E, - 0x1F5000001F58, - 0x1F5900001F5A, - 0x1F5B00001F5C, - 0x1F5D00001F5E, - 0x1F5F00001F7E, - 0x1F8000001FB5, - 0x1FB600001FC5, - 0x1FC600001FD4, - 0x1FD600001FDC, - 0x1FDD00001FF0, - 0x1FF200001FF5, - 0x1FF600001FFF, - 0x212600002127, - 0xAB650000AB66, - 0x101400001018F, - 0x101A0000101A1, - 0x1D2000001D246, - ), - "Han": ( - 0x2E8000002E9A, - 0x2E9B00002EF4, - 0x2F0000002FD6, - 0x300500003006, - 0x300700003008, - 0x30210000302A, - 0x30380000303C, - 0x340000004DC0, - 0x4E000000A000, - 0xF9000000FA6E, - 0xFA700000FADA, - 0x16FE200016FE4, - 0x16FF000016FF2, - 0x200000002A6E0, - 0x2A7000002B73A, - 0x2B7400002B81E, - 0x2B8200002CEA2, - 0x2CEB00002EBE1, - 0x2EBF00002EE5E, - 0x2F8000002FA1E, - 0x300000003134B, - 0x31350000323B0, - ), - "Hebrew": ( - 0x591000005C8, - 0x5D0000005EB, - 0x5EF000005F5, - 0xFB1D0000FB37, - 0xFB380000FB3D, - 0xFB3E0000FB3F, - 0xFB400000FB42, - 0xFB430000FB45, - 0xFB460000FB50, - ), - "Hiragana": ( - 0x304100003097, - 0x309D000030A0, - 0x1B0010001B120, - 0x1B1320001B133, - 0x1B1500001B153, - 0x1F2000001F201, - ), - "Katakana": ( - 0x30A1000030FB, - 0x30FD00003100, - 0x31F000003200, - 0x32D0000032FF, - 0x330000003358, - 0xFF660000FF70, - 0xFF710000FF9E, - 0x1AFF00001AFF4, - 0x1AFF50001AFFC, - 0x1AFFD0001AFFF, - 0x1B0000001B001, - 0x1B1200001B123, - 0x1B1550001B156, - 0x1B1640001B168, - ), -} -joining_types = { - 0xAD: 84, - 0x300: 84, - 0x301: 84, - 0x302: 84, - 0x303: 84, - 0x304: 84, - 0x305: 84, - 0x306: 84, - 0x307: 84, - 0x308: 84, - 0x309: 84, - 0x30A: 84, - 0x30B: 84, - 0x30C: 84, - 0x30D: 84, - 0x30E: 84, - 0x30F: 84, - 0x310: 84, - 0x311: 84, - 0x312: 84, - 0x313: 84, - 0x314: 84, - 0x315: 84, - 0x316: 84, - 0x317: 84, - 0x318: 84, - 0x319: 84, - 0x31A: 84, - 0x31B: 84, - 0x31C: 84, - 0x31D: 84, - 0x31E: 84, - 0x31F: 84, - 0x320: 84, - 0x321: 84, - 0x322: 84, - 0x323: 84, - 0x324: 84, - 0x325: 84, - 0x326: 84, - 0x327: 84, - 0x328: 84, - 0x329: 84, - 0x32A: 84, - 0x32B: 84, - 0x32C: 84, - 0x32D: 84, - 0x32E: 84, - 0x32F: 84, - 0x330: 84, - 0x331: 84, - 0x332: 84, - 0x333: 84, - 0x334: 84, - 0x335: 84, - 0x336: 84, - 0x337: 84, - 0x338: 84, - 0x339: 84, - 0x33A: 84, - 0x33B: 84, - 0x33C: 84, - 0x33D: 84, - 0x33E: 84, - 0x33F: 84, - 0x340: 84, - 0x341: 84, - 0x342: 84, - 0x343: 84, - 0x344: 84, - 0x345: 84, - 0x346: 84, - 0x347: 84, - 0x348: 84, - 0x349: 84, - 0x34A: 84, - 0x34B: 84, - 0x34C: 84, - 0x34D: 84, - 0x34E: 84, - 0x34F: 84, - 0x350: 84, - 0x351: 84, - 0x352: 84, - 0x353: 84, - 0x354: 84, - 0x355: 84, - 0x356: 84, - 0x357: 84, - 0x358: 84, - 0x359: 84, - 0x35A: 84, - 0x35B: 84, - 0x35C: 84, - 0x35D: 84, - 0x35E: 84, - 0x35F: 84, - 0x360: 84, - 0x361: 84, - 0x362: 84, - 0x363: 84, - 0x364: 84, - 0x365: 84, - 0x366: 84, - 0x367: 84, - 0x368: 84, - 0x369: 84, - 0x36A: 84, - 0x36B: 84, - 0x36C: 84, - 0x36D: 84, - 0x36E: 84, - 0x36F: 84, - 0x483: 84, - 0x484: 84, - 0x485: 84, - 0x486: 84, - 0x487: 84, - 0x488: 84, - 0x489: 84, - 0x591: 84, - 0x592: 84, - 0x593: 84, - 0x594: 84, - 0x595: 84, - 0x596: 84, - 0x597: 84, - 0x598: 84, - 0x599: 84, - 0x59A: 84, - 0x59B: 84, - 0x59C: 84, - 0x59D: 84, - 0x59E: 84, - 0x59F: 84, - 0x5A0: 84, - 0x5A1: 84, - 0x5A2: 84, - 0x5A3: 84, - 0x5A4: 84, - 0x5A5: 84, - 0x5A6: 84, - 0x5A7: 84, - 0x5A8: 84, - 0x5A9: 84, - 0x5AA: 84, - 0x5AB: 84, - 0x5AC: 84, - 0x5AD: 84, - 0x5AE: 84, - 0x5AF: 84, - 0x5B0: 84, - 0x5B1: 84, - 0x5B2: 84, - 0x5B3: 84, - 0x5B4: 84, - 0x5B5: 84, - 0x5B6: 84, - 0x5B7: 84, - 0x5B8: 84, - 0x5B9: 84, - 0x5BA: 84, - 0x5BB: 84, - 0x5BC: 84, - 0x5BD: 84, - 0x5BF: 84, - 0x5C1: 84, - 0x5C2: 84, - 0x5C4: 84, - 0x5C5: 84, - 0x5C7: 84, - 0x610: 84, - 0x611: 84, - 0x612: 84, - 0x613: 84, - 0x614: 84, - 0x615: 84, - 0x616: 84, - 0x617: 84, - 0x618: 84, - 0x619: 84, - 0x61A: 84, - 0x61C: 84, - 0x620: 68, - 0x622: 82, - 0x623: 82, - 0x624: 82, - 0x625: 82, - 0x626: 68, - 0x627: 82, - 0x628: 68, - 0x629: 82, - 0x62A: 68, - 0x62B: 68, - 0x62C: 68, - 0x62D: 68, - 0x62E: 68, - 0x62F: 82, - 0x630: 82, - 0x631: 82, - 0x632: 82, - 0x633: 68, - 0x634: 68, - 0x635: 68, - 0x636: 68, - 0x637: 68, - 0x638: 68, - 0x639: 68, - 0x63A: 68, - 0x63B: 68, - 0x63C: 68, - 0x63D: 68, - 0x63E: 68, - 0x63F: 68, - 0x640: 67, - 0x641: 68, - 0x642: 68, - 0x643: 68, - 0x644: 68, - 0x645: 68, - 0x646: 68, - 0x647: 68, - 0x648: 82, - 0x649: 68, - 0x64A: 68, - 0x64B: 84, - 0x64C: 84, - 0x64D: 84, - 0x64E: 84, - 0x64F: 84, - 0x650: 84, - 0x651: 84, - 0x652: 84, - 0x653: 84, - 0x654: 84, - 0x655: 84, - 0x656: 84, - 0x657: 84, - 0x658: 84, - 0x659: 84, - 0x65A: 84, - 0x65B: 84, - 0x65C: 84, - 0x65D: 84, - 0x65E: 84, - 0x65F: 84, - 0x66E: 68, - 0x66F: 68, - 0x670: 84, - 0x671: 82, - 0x672: 82, - 0x673: 82, - 0x675: 82, - 0x676: 82, - 0x677: 82, - 0x678: 68, - 0x679: 68, - 0x67A: 68, - 0x67B: 68, - 0x67C: 68, - 0x67D: 68, - 0x67E: 68, - 0x67F: 68, - 0x680: 68, - 0x681: 68, - 0x682: 68, - 0x683: 68, - 0x684: 68, - 0x685: 68, - 0x686: 68, - 0x687: 68, - 0x688: 82, - 0x689: 82, - 0x68A: 82, - 0x68B: 82, - 0x68C: 82, - 0x68D: 82, - 0x68E: 82, - 0x68F: 82, - 0x690: 82, - 0x691: 82, - 0x692: 82, - 0x693: 82, - 0x694: 82, - 0x695: 82, - 0x696: 82, - 0x697: 82, - 0x698: 82, - 0x699: 82, - 0x69A: 68, - 0x69B: 68, - 0x69C: 68, - 0x69D: 68, - 0x69E: 68, - 0x69F: 68, - 0x6A0: 68, - 0x6A1: 68, - 0x6A2: 68, - 0x6A3: 68, - 0x6A4: 68, - 0x6A5: 68, - 0x6A6: 68, - 0x6A7: 68, - 0x6A8: 68, - 0x6A9: 68, - 0x6AA: 68, - 0x6AB: 68, - 0x6AC: 68, - 0x6AD: 68, - 0x6AE: 68, - 0x6AF: 68, - 0x6B0: 68, - 0x6B1: 68, - 0x6B2: 68, - 0x6B3: 68, - 0x6B4: 68, - 0x6B5: 68, - 0x6B6: 68, - 0x6B7: 68, - 0x6B8: 68, - 0x6B9: 68, - 0x6BA: 68, - 0x6BB: 68, - 0x6BC: 68, - 0x6BD: 68, - 0x6BE: 68, - 0x6BF: 68, - 0x6C0: 82, - 0x6C1: 68, - 0x6C2: 68, - 0x6C3: 82, - 0x6C4: 82, - 0x6C5: 82, - 0x6C6: 82, - 0x6C7: 82, - 0x6C8: 82, - 0x6C9: 82, - 0x6CA: 82, - 0x6CB: 82, - 0x6CC: 68, - 0x6CD: 82, - 0x6CE: 68, - 0x6CF: 82, - 0x6D0: 68, - 0x6D1: 68, - 0x6D2: 82, - 0x6D3: 82, - 0x6D5: 82, - 0x6D6: 84, - 0x6D7: 84, - 0x6D8: 84, - 0x6D9: 84, - 0x6DA: 84, - 0x6DB: 84, - 0x6DC: 84, - 0x6DF: 84, - 0x6E0: 84, - 0x6E1: 84, - 0x6E2: 84, - 0x6E3: 84, - 0x6E4: 84, - 0x6E7: 84, - 0x6E8: 84, - 0x6EA: 84, - 0x6EB: 84, - 0x6EC: 84, - 0x6ED: 84, - 0x6EE: 82, - 0x6EF: 82, - 0x6FA: 68, - 0x6FB: 68, - 0x6FC: 68, - 0x6FF: 68, - 0x70F: 84, - 0x710: 82, - 0x711: 84, - 0x712: 68, - 0x713: 68, - 0x714: 68, - 0x715: 82, - 0x716: 82, - 0x717: 82, - 0x718: 82, - 0x719: 82, - 0x71A: 68, - 0x71B: 68, - 0x71C: 68, - 0x71D: 68, - 0x71E: 82, - 0x71F: 68, - 0x720: 68, - 0x721: 68, - 0x722: 68, - 0x723: 68, - 0x724: 68, - 0x725: 68, - 0x726: 68, - 0x727: 68, - 0x728: 82, - 0x729: 68, - 0x72A: 82, - 0x72B: 68, - 0x72C: 82, - 0x72D: 68, - 0x72E: 68, - 0x72F: 82, - 0x730: 84, - 0x731: 84, - 0x732: 84, - 0x733: 84, - 0x734: 84, - 0x735: 84, - 0x736: 84, - 0x737: 84, - 0x738: 84, - 0x739: 84, - 0x73A: 84, - 0x73B: 84, - 0x73C: 84, - 0x73D: 84, - 0x73E: 84, - 0x73F: 84, - 0x740: 84, - 0x741: 84, - 0x742: 84, - 0x743: 84, - 0x744: 84, - 0x745: 84, - 0x746: 84, - 0x747: 84, - 0x748: 84, - 0x749: 84, - 0x74A: 84, - 0x74D: 82, - 0x74E: 68, - 0x74F: 68, - 0x750: 68, - 0x751: 68, - 0x752: 68, - 0x753: 68, - 0x754: 68, - 0x755: 68, - 0x756: 68, - 0x757: 68, - 0x758: 68, - 0x759: 82, - 0x75A: 82, - 0x75B: 82, - 0x75C: 68, - 0x75D: 68, - 0x75E: 68, - 0x75F: 68, - 0x760: 68, - 0x761: 68, - 0x762: 68, - 0x763: 68, - 0x764: 68, - 0x765: 68, - 0x766: 68, - 0x767: 68, - 0x768: 68, - 0x769: 68, - 0x76A: 68, - 0x76B: 82, - 0x76C: 82, - 0x76D: 68, - 0x76E: 68, - 0x76F: 68, - 0x770: 68, - 0x771: 82, - 0x772: 68, - 0x773: 82, - 0x774: 82, - 0x775: 68, - 0x776: 68, - 0x777: 68, - 0x778: 82, - 0x779: 82, - 0x77A: 68, - 0x77B: 68, - 0x77C: 68, - 0x77D: 68, - 0x77E: 68, - 0x77F: 68, - 0x7A6: 84, - 0x7A7: 84, - 0x7A8: 84, - 0x7A9: 84, - 0x7AA: 84, - 0x7AB: 84, - 0x7AC: 84, - 0x7AD: 84, - 0x7AE: 84, - 0x7AF: 84, - 0x7B0: 84, - 0x7CA: 68, - 0x7CB: 68, - 0x7CC: 68, - 0x7CD: 68, - 0x7CE: 68, - 0x7CF: 68, - 0x7D0: 68, - 0x7D1: 68, - 0x7D2: 68, - 0x7D3: 68, - 0x7D4: 68, - 0x7D5: 68, - 0x7D6: 68, - 0x7D7: 68, - 0x7D8: 68, - 0x7D9: 68, - 0x7DA: 68, - 0x7DB: 68, - 0x7DC: 68, - 0x7DD: 68, - 0x7DE: 68, - 0x7DF: 68, - 0x7E0: 68, - 0x7E1: 68, - 0x7E2: 68, - 0x7E3: 68, - 0x7E4: 68, - 0x7E5: 68, - 0x7E6: 68, - 0x7E7: 68, - 0x7E8: 68, - 0x7E9: 68, - 0x7EA: 68, - 0x7EB: 84, - 0x7EC: 84, - 0x7ED: 84, - 0x7EE: 84, - 0x7EF: 84, - 0x7F0: 84, - 0x7F1: 84, - 0x7F2: 84, - 0x7F3: 84, - 0x7FA: 67, - 0x7FD: 84, - 0x816: 84, - 0x817: 84, - 0x818: 84, - 0x819: 84, - 0x81B: 84, - 0x81C: 84, - 0x81D: 84, - 0x81E: 84, - 0x81F: 84, - 0x820: 84, - 0x821: 84, - 0x822: 84, - 0x823: 84, - 0x825: 84, - 0x826: 84, - 0x827: 84, - 0x829: 84, - 0x82A: 84, - 0x82B: 84, - 0x82C: 84, - 0x82D: 84, - 0x840: 82, - 0x841: 68, - 0x842: 68, - 0x843: 68, - 0x844: 68, - 0x845: 68, - 0x846: 82, - 0x847: 82, - 0x848: 68, - 0x849: 82, - 0x84A: 68, - 0x84B: 68, - 0x84C: 68, - 0x84D: 68, - 0x84E: 68, - 0x84F: 68, - 0x850: 68, - 0x851: 68, - 0x852: 68, - 0x853: 68, - 0x854: 82, - 0x855: 68, - 0x856: 82, - 0x857: 82, - 0x858: 82, - 0x859: 84, - 0x85A: 84, - 0x85B: 84, - 0x860: 68, - 0x862: 68, - 0x863: 68, - 0x864: 68, - 0x865: 68, - 0x867: 82, - 0x868: 68, - 0x869: 82, - 0x86A: 82, - 0x870: 82, - 0x871: 82, - 0x872: 82, - 0x873: 82, - 0x874: 82, - 0x875: 82, - 0x876: 82, - 0x877: 82, - 0x878: 82, - 0x879: 82, - 0x87A: 82, - 0x87B: 82, - 0x87C: 82, - 0x87D: 82, - 0x87E: 82, - 0x87F: 82, - 0x880: 82, - 0x881: 82, - 0x882: 82, - 0x883: 67, - 0x884: 67, - 0x885: 67, - 0x886: 68, - 0x889: 68, - 0x88A: 68, - 0x88B: 68, - 0x88C: 68, - 0x88D: 68, - 0x88E: 82, - 0x898: 84, - 0x899: 84, - 0x89A: 84, - 0x89B: 84, - 0x89C: 84, - 0x89D: 84, - 0x89E: 84, - 0x89F: 84, - 0x8A0: 68, - 0x8A1: 68, - 0x8A2: 68, - 0x8A3: 68, - 0x8A4: 68, - 0x8A5: 68, - 0x8A6: 68, - 0x8A7: 68, - 0x8A8: 68, - 0x8A9: 68, - 0x8AA: 82, - 0x8AB: 82, - 0x8AC: 82, - 0x8AE: 82, - 0x8AF: 68, - 0x8B0: 68, - 0x8B1: 82, - 0x8B2: 82, - 0x8B3: 68, - 0x8B4: 68, - 0x8B5: 68, - 0x8B6: 68, - 0x8B7: 68, - 0x8B8: 68, - 0x8B9: 82, - 0x8BA: 68, - 0x8BB: 68, - 0x8BC: 68, - 0x8BD: 68, - 0x8BE: 68, - 0x8BF: 68, - 0x8C0: 68, - 0x8C1: 68, - 0x8C2: 68, - 0x8C3: 68, - 0x8C4: 68, - 0x8C5: 68, - 0x8C6: 68, - 0x8C7: 68, - 0x8C8: 68, - 0x8CA: 84, - 0x8CB: 84, - 0x8CC: 84, - 0x8CD: 84, - 0x8CE: 84, - 0x8CF: 84, - 0x8D0: 84, - 0x8D1: 84, - 0x8D2: 84, - 0x8D3: 84, - 0x8D4: 84, - 0x8D5: 84, - 0x8D6: 84, - 0x8D7: 84, - 0x8D8: 84, - 0x8D9: 84, - 0x8DA: 84, - 0x8DB: 84, - 0x8DC: 84, - 0x8DD: 84, - 0x8DE: 84, - 0x8DF: 84, - 0x8E0: 84, - 0x8E1: 84, - 0x8E3: 84, - 0x8E4: 84, - 0x8E5: 84, - 0x8E6: 84, - 0x8E7: 84, - 0x8E8: 84, - 0x8E9: 84, - 0x8EA: 84, - 0x8EB: 84, - 0x8EC: 84, - 0x8ED: 84, - 0x8EE: 84, - 0x8EF: 84, - 0x8F0: 84, - 0x8F1: 84, - 0x8F2: 84, - 0x8F3: 84, - 0x8F4: 84, - 0x8F5: 84, - 0x8F6: 84, - 0x8F7: 84, - 0x8F8: 84, - 0x8F9: 84, - 0x8FA: 84, - 0x8FB: 84, - 0x8FC: 84, - 0x8FD: 84, - 0x8FE: 84, - 0x8FF: 84, - 0x900: 84, - 0x901: 84, - 0x902: 84, - 0x93A: 84, - 0x93C: 84, - 0x941: 84, - 0x942: 84, - 0x943: 84, - 0x944: 84, - 0x945: 84, - 0x946: 84, - 0x947: 84, - 0x948: 84, - 0x94D: 84, - 0x951: 84, - 0x952: 84, - 0x953: 84, - 0x954: 84, - 0x955: 84, - 0x956: 84, - 0x957: 84, - 0x962: 84, - 0x963: 84, - 0x981: 84, - 0x9BC: 84, - 0x9C1: 84, - 0x9C2: 84, - 0x9C3: 84, - 0x9C4: 84, - 0x9CD: 84, - 0x9E2: 84, - 0x9E3: 84, - 0x9FE: 84, - 0xA01: 84, - 0xA02: 84, - 0xA3C: 84, - 0xA41: 84, - 0xA42: 84, - 0xA47: 84, - 0xA48: 84, - 0xA4B: 84, - 0xA4C: 84, - 0xA4D: 84, - 0xA51: 84, - 0xA70: 84, - 0xA71: 84, - 0xA75: 84, - 0xA81: 84, - 0xA82: 84, - 0xABC: 84, - 0xAC1: 84, - 0xAC2: 84, - 0xAC3: 84, - 0xAC4: 84, - 0xAC5: 84, - 0xAC7: 84, - 0xAC8: 84, - 0xACD: 84, - 0xAE2: 84, - 0xAE3: 84, - 0xAFA: 84, - 0xAFB: 84, - 0xAFC: 84, - 0xAFD: 84, - 0xAFE: 84, - 0xAFF: 84, - 0xB01: 84, - 0xB3C: 84, - 0xB3F: 84, - 0xB41: 84, - 0xB42: 84, - 0xB43: 84, - 0xB44: 84, - 0xB4D: 84, - 0xB55: 84, - 0xB56: 84, - 0xB62: 84, - 0xB63: 84, - 0xB82: 84, - 0xBC0: 84, - 0xBCD: 84, - 0xC00: 84, - 0xC04: 84, - 0xC3C: 84, - 0xC3E: 84, - 0xC3F: 84, - 0xC40: 84, - 0xC46: 84, - 0xC47: 84, - 0xC48: 84, - 0xC4A: 84, - 0xC4B: 84, - 0xC4C: 84, - 0xC4D: 84, - 0xC55: 84, - 0xC56: 84, - 0xC62: 84, - 0xC63: 84, - 0xC81: 84, - 0xCBC: 84, - 0xCBF: 84, - 0xCC6: 84, - 0xCCC: 84, - 0xCCD: 84, - 0xCE2: 84, - 0xCE3: 84, - 0xD00: 84, - 0xD01: 84, - 0xD3B: 84, - 0xD3C: 84, - 0xD41: 84, - 0xD42: 84, - 0xD43: 84, - 0xD44: 84, - 0xD4D: 84, - 0xD62: 84, - 0xD63: 84, - 0xD81: 84, - 0xDCA: 84, - 0xDD2: 84, - 0xDD3: 84, - 0xDD4: 84, - 0xDD6: 84, - 0xE31: 84, - 0xE34: 84, - 0xE35: 84, - 0xE36: 84, - 0xE37: 84, - 0xE38: 84, - 0xE39: 84, - 0xE3A: 84, - 0xE47: 84, - 0xE48: 84, - 0xE49: 84, - 0xE4A: 84, - 0xE4B: 84, - 0xE4C: 84, - 0xE4D: 84, - 0xE4E: 84, - 0xEB1: 84, - 0xEB4: 84, - 0xEB5: 84, - 0xEB6: 84, - 0xEB7: 84, - 0xEB8: 84, - 0xEB9: 84, - 0xEBA: 84, - 0xEBB: 84, - 0xEBC: 84, - 0xEC8: 84, - 0xEC9: 84, - 0xECA: 84, - 0xECB: 84, - 0xECC: 84, - 0xECD: 84, - 0xECE: 84, - 0xF18: 84, - 0xF19: 84, - 0xF35: 84, - 0xF37: 84, - 0xF39: 84, - 0xF71: 84, - 0xF72: 84, - 0xF73: 84, - 0xF74: 84, - 0xF75: 84, - 0xF76: 84, - 0xF77: 84, - 0xF78: 84, - 0xF79: 84, - 0xF7A: 84, - 0xF7B: 84, - 0xF7C: 84, - 0xF7D: 84, - 0xF7E: 84, - 0xF80: 84, - 0xF81: 84, - 0xF82: 84, - 0xF83: 84, - 0xF84: 84, - 0xF86: 84, - 0xF87: 84, - 0xF8D: 84, - 0xF8E: 84, - 0xF8F: 84, - 0xF90: 84, - 0xF91: 84, - 0xF92: 84, - 0xF93: 84, - 0xF94: 84, - 0xF95: 84, - 0xF96: 84, - 0xF97: 84, - 0xF99: 84, - 0xF9A: 84, - 0xF9B: 84, - 0xF9C: 84, - 0xF9D: 84, - 0xF9E: 84, - 0xF9F: 84, - 0xFA0: 84, - 0xFA1: 84, - 0xFA2: 84, - 0xFA3: 84, - 0xFA4: 84, - 0xFA5: 84, - 0xFA6: 84, - 0xFA7: 84, - 0xFA8: 84, - 0xFA9: 84, - 0xFAA: 84, - 0xFAB: 84, - 0xFAC: 84, - 0xFAD: 84, - 0xFAE: 84, - 0xFAF: 84, - 0xFB0: 84, - 0xFB1: 84, - 0xFB2: 84, - 0xFB3: 84, - 0xFB4: 84, - 0xFB5: 84, - 0xFB6: 84, - 0xFB7: 84, - 0xFB8: 84, - 0xFB9: 84, - 0xFBA: 84, - 0xFBB: 84, - 0xFBC: 84, - 0xFC6: 84, - 0x102D: 84, - 0x102E: 84, - 0x102F: 84, - 0x1030: 84, - 0x1032: 84, - 0x1033: 84, - 0x1034: 84, - 0x1035: 84, - 0x1036: 84, - 0x1037: 84, - 0x1039: 84, - 0x103A: 84, - 0x103D: 84, - 0x103E: 84, - 0x1058: 84, - 0x1059: 84, - 0x105E: 84, - 0x105F: 84, - 0x1060: 84, - 0x1071: 84, - 0x1072: 84, - 0x1073: 84, - 0x1074: 84, - 0x1082: 84, - 0x1085: 84, - 0x1086: 84, - 0x108D: 84, - 0x109D: 84, - 0x135D: 84, - 0x135E: 84, - 0x135F: 84, - 0x1712: 84, - 0x1713: 84, - 0x1714: 84, - 0x1732: 84, - 0x1733: 84, - 0x1752: 84, - 0x1753: 84, - 0x1772: 84, - 0x1773: 84, - 0x17B4: 84, - 0x17B5: 84, - 0x17B7: 84, - 0x17B8: 84, - 0x17B9: 84, - 0x17BA: 84, - 0x17BB: 84, - 0x17BC: 84, - 0x17BD: 84, - 0x17C6: 84, - 0x17C9: 84, - 0x17CA: 84, - 0x17CB: 84, - 0x17CC: 84, - 0x17CD: 84, - 0x17CE: 84, - 0x17CF: 84, - 0x17D0: 84, - 0x17D1: 84, - 0x17D2: 84, - 0x17D3: 84, - 0x17DD: 84, - 0x1807: 68, - 0x180A: 67, - 0x180B: 84, - 0x180C: 84, - 0x180D: 84, - 0x180F: 84, - 0x1820: 68, - 0x1821: 68, - 0x1822: 68, - 0x1823: 68, - 0x1824: 68, - 0x1825: 68, - 0x1826: 68, - 0x1827: 68, - 0x1828: 68, - 0x1829: 68, - 0x182A: 68, - 0x182B: 68, - 0x182C: 68, - 0x182D: 68, - 0x182E: 68, - 0x182F: 68, - 0x1830: 68, - 0x1831: 68, - 0x1832: 68, - 0x1833: 68, - 0x1834: 68, - 0x1835: 68, - 0x1836: 68, - 0x1837: 68, - 0x1838: 68, - 0x1839: 68, - 0x183A: 68, - 0x183B: 68, - 0x183C: 68, - 0x183D: 68, - 0x183E: 68, - 0x183F: 68, - 0x1840: 68, - 0x1841: 68, - 0x1842: 68, - 0x1843: 68, - 0x1844: 68, - 0x1845: 68, - 0x1846: 68, - 0x1847: 68, - 0x1848: 68, - 0x1849: 68, - 0x184A: 68, - 0x184B: 68, - 0x184C: 68, - 0x184D: 68, - 0x184E: 68, - 0x184F: 68, - 0x1850: 68, - 0x1851: 68, - 0x1852: 68, - 0x1853: 68, - 0x1854: 68, - 0x1855: 68, - 0x1856: 68, - 0x1857: 68, - 0x1858: 68, - 0x1859: 68, - 0x185A: 68, - 0x185B: 68, - 0x185C: 68, - 0x185D: 68, - 0x185E: 68, - 0x185F: 68, - 0x1860: 68, - 0x1861: 68, - 0x1862: 68, - 0x1863: 68, - 0x1864: 68, - 0x1865: 68, - 0x1866: 68, - 0x1867: 68, - 0x1868: 68, - 0x1869: 68, - 0x186A: 68, - 0x186B: 68, - 0x186C: 68, - 0x186D: 68, - 0x186E: 68, - 0x186F: 68, - 0x1870: 68, - 0x1871: 68, - 0x1872: 68, - 0x1873: 68, - 0x1874: 68, - 0x1875: 68, - 0x1876: 68, - 0x1877: 68, - 0x1878: 68, - 0x1885: 84, - 0x1886: 84, - 0x1887: 68, - 0x1888: 68, - 0x1889: 68, - 0x188A: 68, - 0x188B: 68, - 0x188C: 68, - 0x188D: 68, - 0x188E: 68, - 0x188F: 68, - 0x1890: 68, - 0x1891: 68, - 0x1892: 68, - 0x1893: 68, - 0x1894: 68, - 0x1895: 68, - 0x1896: 68, - 0x1897: 68, - 0x1898: 68, - 0x1899: 68, - 0x189A: 68, - 0x189B: 68, - 0x189C: 68, - 0x189D: 68, - 0x189E: 68, - 0x189F: 68, - 0x18A0: 68, - 0x18A1: 68, - 0x18A2: 68, - 0x18A3: 68, - 0x18A4: 68, - 0x18A5: 68, - 0x18A6: 68, - 0x18A7: 68, - 0x18A8: 68, - 0x18A9: 84, - 0x18AA: 68, - 0x1920: 84, - 0x1921: 84, - 0x1922: 84, - 0x1927: 84, - 0x1928: 84, - 0x1932: 84, - 0x1939: 84, - 0x193A: 84, - 0x193B: 84, - 0x1A17: 84, - 0x1A18: 84, - 0x1A1B: 84, - 0x1A56: 84, - 0x1A58: 84, - 0x1A59: 84, - 0x1A5A: 84, - 0x1A5B: 84, - 0x1A5C: 84, - 0x1A5D: 84, - 0x1A5E: 84, - 0x1A60: 84, - 0x1A62: 84, - 0x1A65: 84, - 0x1A66: 84, - 0x1A67: 84, - 0x1A68: 84, - 0x1A69: 84, - 0x1A6A: 84, - 0x1A6B: 84, - 0x1A6C: 84, - 0x1A73: 84, - 0x1A74: 84, - 0x1A75: 84, - 0x1A76: 84, - 0x1A77: 84, - 0x1A78: 84, - 0x1A79: 84, - 0x1A7A: 84, - 0x1A7B: 84, - 0x1A7C: 84, - 0x1A7F: 84, - 0x1AB0: 84, - 0x1AB1: 84, - 0x1AB2: 84, - 0x1AB3: 84, - 0x1AB4: 84, - 0x1AB5: 84, - 0x1AB6: 84, - 0x1AB7: 84, - 0x1AB8: 84, - 0x1AB9: 84, - 0x1ABA: 84, - 0x1ABB: 84, - 0x1ABC: 84, - 0x1ABD: 84, - 0x1ABE: 84, - 0x1ABF: 84, - 0x1AC0: 84, - 0x1AC1: 84, - 0x1AC2: 84, - 0x1AC3: 84, - 0x1AC4: 84, - 0x1AC5: 84, - 0x1AC6: 84, - 0x1AC7: 84, - 0x1AC8: 84, - 0x1AC9: 84, - 0x1ACA: 84, - 0x1ACB: 84, - 0x1ACC: 84, - 0x1ACD: 84, - 0x1ACE: 84, - 0x1B00: 84, - 0x1B01: 84, - 0x1B02: 84, - 0x1B03: 84, - 0x1B34: 84, - 0x1B36: 84, - 0x1B37: 84, - 0x1B38: 84, - 0x1B39: 84, - 0x1B3A: 84, - 0x1B3C: 84, - 0x1B42: 84, - 0x1B6B: 84, - 0x1B6C: 84, - 0x1B6D: 84, - 0x1B6E: 84, - 0x1B6F: 84, - 0x1B70: 84, - 0x1B71: 84, - 0x1B72: 84, - 0x1B73: 84, - 0x1B80: 84, - 0x1B81: 84, - 0x1BA2: 84, - 0x1BA3: 84, - 0x1BA4: 84, - 0x1BA5: 84, - 0x1BA8: 84, - 0x1BA9: 84, - 0x1BAB: 84, - 0x1BAC: 84, - 0x1BAD: 84, - 0x1BE6: 84, - 0x1BE8: 84, - 0x1BE9: 84, - 0x1BED: 84, - 0x1BEF: 84, - 0x1BF0: 84, - 0x1BF1: 84, - 0x1C2C: 84, - 0x1C2D: 84, - 0x1C2E: 84, - 0x1C2F: 84, - 0x1C30: 84, - 0x1C31: 84, - 0x1C32: 84, - 0x1C33: 84, - 0x1C36: 84, - 0x1C37: 84, - 0x1CD0: 84, - 0x1CD1: 84, - 0x1CD2: 84, - 0x1CD4: 84, - 0x1CD5: 84, - 0x1CD6: 84, - 0x1CD7: 84, - 0x1CD8: 84, - 0x1CD9: 84, - 0x1CDA: 84, - 0x1CDB: 84, - 0x1CDC: 84, - 0x1CDD: 84, - 0x1CDE: 84, - 0x1CDF: 84, - 0x1CE0: 84, - 0x1CE2: 84, - 0x1CE3: 84, - 0x1CE4: 84, - 0x1CE5: 84, - 0x1CE6: 84, - 0x1CE7: 84, - 0x1CE8: 84, - 0x1CED: 84, - 0x1CF4: 84, - 0x1CF8: 84, - 0x1CF9: 84, - 0x1DC0: 84, - 0x1DC1: 84, - 0x1DC2: 84, - 0x1DC3: 84, - 0x1DC4: 84, - 0x1DC5: 84, - 0x1DC6: 84, - 0x1DC7: 84, - 0x1DC8: 84, - 0x1DC9: 84, - 0x1DCA: 84, - 0x1DCB: 84, - 0x1DCC: 84, - 0x1DCD: 84, - 0x1DCE: 84, - 0x1DCF: 84, - 0x1DD0: 84, - 0x1DD1: 84, - 0x1DD2: 84, - 0x1DD3: 84, - 0x1DD4: 84, - 0x1DD5: 84, - 0x1DD6: 84, - 0x1DD7: 84, - 0x1DD8: 84, - 0x1DD9: 84, - 0x1DDA: 84, - 0x1DDB: 84, - 0x1DDC: 84, - 0x1DDD: 84, - 0x1DDE: 84, - 0x1DDF: 84, - 0x1DE0: 84, - 0x1DE1: 84, - 0x1DE2: 84, - 0x1DE3: 84, - 0x1DE4: 84, - 0x1DE5: 84, - 0x1DE6: 84, - 0x1DE7: 84, - 0x1DE8: 84, - 0x1DE9: 84, - 0x1DEA: 84, - 0x1DEB: 84, - 0x1DEC: 84, - 0x1DED: 84, - 0x1DEE: 84, - 0x1DEF: 84, - 0x1DF0: 84, - 0x1DF1: 84, - 0x1DF2: 84, - 0x1DF3: 84, - 0x1DF4: 84, - 0x1DF5: 84, - 0x1DF6: 84, - 0x1DF7: 84, - 0x1DF8: 84, - 0x1DF9: 84, - 0x1DFA: 84, - 0x1DFB: 84, - 0x1DFC: 84, - 0x1DFD: 84, - 0x1DFE: 84, - 0x1DFF: 84, - 0x200B: 84, - 0x200D: 67, - 0x200E: 84, - 0x200F: 84, - 0x202A: 84, - 0x202B: 84, - 0x202C: 84, - 0x202D: 84, - 0x202E: 84, - 0x2060: 84, - 0x2061: 84, - 0x2062: 84, - 0x2063: 84, - 0x2064: 84, - 0x206A: 84, - 0x206B: 84, - 0x206C: 84, - 0x206D: 84, - 0x206E: 84, - 0x206F: 84, - 0x20D0: 84, - 0x20D1: 84, - 0x20D2: 84, - 0x20D3: 84, - 0x20D4: 84, - 0x20D5: 84, - 0x20D6: 84, - 0x20D7: 84, - 0x20D8: 84, - 0x20D9: 84, - 0x20DA: 84, - 0x20DB: 84, - 0x20DC: 84, - 0x20DD: 84, - 0x20DE: 84, - 0x20DF: 84, - 0x20E0: 84, - 0x20E1: 84, - 0x20E2: 84, - 0x20E3: 84, - 0x20E4: 84, - 0x20E5: 84, - 0x20E6: 84, - 0x20E7: 84, - 0x20E8: 84, - 0x20E9: 84, - 0x20EA: 84, - 0x20EB: 84, - 0x20EC: 84, - 0x20ED: 84, - 0x20EE: 84, - 0x20EF: 84, - 0x20F0: 84, - 0x2CEF: 84, - 0x2CF0: 84, - 0x2CF1: 84, - 0x2D7F: 84, - 0x2DE0: 84, - 0x2DE1: 84, - 0x2DE2: 84, - 0x2DE3: 84, - 0x2DE4: 84, - 0x2DE5: 84, - 0x2DE6: 84, - 0x2DE7: 84, - 0x2DE8: 84, - 0x2DE9: 84, - 0x2DEA: 84, - 0x2DEB: 84, - 0x2DEC: 84, - 0x2DED: 84, - 0x2DEE: 84, - 0x2DEF: 84, - 0x2DF0: 84, - 0x2DF1: 84, - 0x2DF2: 84, - 0x2DF3: 84, - 0x2DF4: 84, - 0x2DF5: 84, - 0x2DF6: 84, - 0x2DF7: 84, - 0x2DF8: 84, - 0x2DF9: 84, - 0x2DFA: 84, - 0x2DFB: 84, - 0x2DFC: 84, - 0x2DFD: 84, - 0x2DFE: 84, - 0x2DFF: 84, - 0x302A: 84, - 0x302B: 84, - 0x302C: 84, - 0x302D: 84, - 0x3099: 84, - 0x309A: 84, - 0xA66F: 84, - 0xA670: 84, - 0xA671: 84, - 0xA672: 84, - 0xA674: 84, - 0xA675: 84, - 0xA676: 84, - 0xA677: 84, - 0xA678: 84, - 0xA679: 84, - 0xA67A: 84, - 0xA67B: 84, - 0xA67C: 84, - 0xA67D: 84, - 0xA69E: 84, - 0xA69F: 84, - 0xA6F0: 84, - 0xA6F1: 84, - 0xA802: 84, - 0xA806: 84, - 0xA80B: 84, - 0xA825: 84, - 0xA826: 84, - 0xA82C: 84, - 0xA840: 68, - 0xA841: 68, - 0xA842: 68, - 0xA843: 68, - 0xA844: 68, - 0xA845: 68, - 0xA846: 68, - 0xA847: 68, - 0xA848: 68, - 0xA849: 68, - 0xA84A: 68, - 0xA84B: 68, - 0xA84C: 68, - 0xA84D: 68, - 0xA84E: 68, - 0xA84F: 68, - 0xA850: 68, - 0xA851: 68, - 0xA852: 68, - 0xA853: 68, - 0xA854: 68, - 0xA855: 68, - 0xA856: 68, - 0xA857: 68, - 0xA858: 68, - 0xA859: 68, - 0xA85A: 68, - 0xA85B: 68, - 0xA85C: 68, - 0xA85D: 68, - 0xA85E: 68, - 0xA85F: 68, - 0xA860: 68, - 0xA861: 68, - 0xA862: 68, - 0xA863: 68, - 0xA864: 68, - 0xA865: 68, - 0xA866: 68, - 0xA867: 68, - 0xA868: 68, - 0xA869: 68, - 0xA86A: 68, - 0xA86B: 68, - 0xA86C: 68, - 0xA86D: 68, - 0xA86E: 68, - 0xA86F: 68, - 0xA870: 68, - 0xA871: 68, - 0xA872: 76, - 0xA8C4: 84, - 0xA8C5: 84, - 0xA8E0: 84, - 0xA8E1: 84, - 0xA8E2: 84, - 0xA8E3: 84, - 0xA8E4: 84, - 0xA8E5: 84, - 0xA8E6: 84, - 0xA8E7: 84, - 0xA8E8: 84, - 0xA8E9: 84, - 0xA8EA: 84, - 0xA8EB: 84, - 0xA8EC: 84, - 0xA8ED: 84, - 0xA8EE: 84, - 0xA8EF: 84, - 0xA8F0: 84, - 0xA8F1: 84, - 0xA8FF: 84, - 0xA926: 84, - 0xA927: 84, - 0xA928: 84, - 0xA929: 84, - 0xA92A: 84, - 0xA92B: 84, - 0xA92C: 84, - 0xA92D: 84, - 0xA947: 84, - 0xA948: 84, - 0xA949: 84, - 0xA94A: 84, - 0xA94B: 84, - 0xA94C: 84, - 0xA94D: 84, - 0xA94E: 84, - 0xA94F: 84, - 0xA950: 84, - 0xA951: 84, - 0xA980: 84, - 0xA981: 84, - 0xA982: 84, - 0xA9B3: 84, - 0xA9B6: 84, - 0xA9B7: 84, - 0xA9B8: 84, - 0xA9B9: 84, - 0xA9BC: 84, - 0xA9BD: 84, - 0xA9E5: 84, - 0xAA29: 84, - 0xAA2A: 84, - 0xAA2B: 84, - 0xAA2C: 84, - 0xAA2D: 84, - 0xAA2E: 84, - 0xAA31: 84, - 0xAA32: 84, - 0xAA35: 84, - 0xAA36: 84, - 0xAA43: 84, - 0xAA4C: 84, - 0xAA7C: 84, - 0xAAB0: 84, - 0xAAB2: 84, - 0xAAB3: 84, - 0xAAB4: 84, - 0xAAB7: 84, - 0xAAB8: 84, - 0xAABE: 84, - 0xAABF: 84, - 0xAAC1: 84, - 0xAAEC: 84, - 0xAAED: 84, - 0xAAF6: 84, - 0xABE5: 84, - 0xABE8: 84, - 0xABED: 84, - 0xFB1E: 84, - 0xFE00: 84, - 0xFE01: 84, - 0xFE02: 84, - 0xFE03: 84, - 0xFE04: 84, - 0xFE05: 84, - 0xFE06: 84, - 0xFE07: 84, - 0xFE08: 84, - 0xFE09: 84, - 0xFE0A: 84, - 0xFE0B: 84, - 0xFE0C: 84, - 0xFE0D: 84, - 0xFE0E: 84, - 0xFE0F: 84, - 0xFE20: 84, - 0xFE21: 84, - 0xFE22: 84, - 0xFE23: 84, - 0xFE24: 84, - 0xFE25: 84, - 0xFE26: 84, - 0xFE27: 84, - 0xFE28: 84, - 0xFE29: 84, - 0xFE2A: 84, - 0xFE2B: 84, - 0xFE2C: 84, - 0xFE2D: 84, - 0xFE2E: 84, - 0xFE2F: 84, - 0xFEFF: 84, - 0xFFF9: 84, - 0xFFFA: 84, - 0xFFFB: 84, - 0x101FD: 84, - 0x102E0: 84, - 0x10376: 84, - 0x10377: 84, - 0x10378: 84, - 0x10379: 84, - 0x1037A: 84, - 0x10A01: 84, - 0x10A02: 84, - 0x10A03: 84, - 0x10A05: 84, - 0x10A06: 84, - 0x10A0C: 84, - 0x10A0D: 84, - 0x10A0E: 84, - 0x10A0F: 84, - 0x10A38: 84, - 0x10A39: 84, - 0x10A3A: 84, - 0x10A3F: 84, - 0x10AC0: 68, - 0x10AC1: 68, - 0x10AC2: 68, - 0x10AC3: 68, - 0x10AC4: 68, - 0x10AC5: 82, - 0x10AC7: 82, - 0x10AC9: 82, - 0x10ACA: 82, - 0x10ACD: 76, - 0x10ACE: 82, - 0x10ACF: 82, - 0x10AD0: 82, - 0x10AD1: 82, - 0x10AD2: 82, - 0x10AD3: 68, - 0x10AD4: 68, - 0x10AD5: 68, - 0x10AD6: 68, - 0x10AD7: 76, - 0x10AD8: 68, - 0x10AD9: 68, - 0x10ADA: 68, - 0x10ADB: 68, - 0x10ADC: 68, - 0x10ADD: 82, - 0x10ADE: 68, - 0x10ADF: 68, - 0x10AE0: 68, - 0x10AE1: 82, - 0x10AE4: 82, - 0x10AE5: 84, - 0x10AE6: 84, - 0x10AEB: 68, - 0x10AEC: 68, - 0x10AED: 68, - 0x10AEE: 68, - 0x10AEF: 82, - 0x10B80: 68, - 0x10B81: 82, - 0x10B82: 68, - 0x10B83: 82, - 0x10B84: 82, - 0x10B85: 82, - 0x10B86: 68, - 0x10B87: 68, - 0x10B88: 68, - 0x10B89: 82, - 0x10B8A: 68, - 0x10B8B: 68, - 0x10B8C: 82, - 0x10B8D: 68, - 0x10B8E: 82, - 0x10B8F: 82, - 0x10B90: 68, - 0x10B91: 82, - 0x10BA9: 82, - 0x10BAA: 82, - 0x10BAB: 82, - 0x10BAC: 82, - 0x10BAD: 68, - 0x10BAE: 68, - 0x10D00: 76, - 0x10D01: 68, - 0x10D02: 68, - 0x10D03: 68, - 0x10D04: 68, - 0x10D05: 68, - 0x10D06: 68, - 0x10D07: 68, - 0x10D08: 68, - 0x10D09: 68, - 0x10D0A: 68, - 0x10D0B: 68, - 0x10D0C: 68, - 0x10D0D: 68, - 0x10D0E: 68, - 0x10D0F: 68, - 0x10D10: 68, - 0x10D11: 68, - 0x10D12: 68, - 0x10D13: 68, - 0x10D14: 68, - 0x10D15: 68, - 0x10D16: 68, - 0x10D17: 68, - 0x10D18: 68, - 0x10D19: 68, - 0x10D1A: 68, - 0x10D1B: 68, - 0x10D1C: 68, - 0x10D1D: 68, - 0x10D1E: 68, - 0x10D1F: 68, - 0x10D20: 68, - 0x10D21: 68, - 0x10D22: 82, - 0x10D23: 68, - 0x10D24: 84, - 0x10D25: 84, - 0x10D26: 84, - 0x10D27: 84, - 0x10EAB: 84, - 0x10EAC: 84, - 0x10EFD: 84, - 0x10EFE: 84, - 0x10EFF: 84, - 0x10F30: 68, - 0x10F31: 68, - 0x10F32: 68, - 0x10F33: 82, - 0x10F34: 68, - 0x10F35: 68, - 0x10F36: 68, - 0x10F37: 68, - 0x10F38: 68, - 0x10F39: 68, - 0x10F3A: 68, - 0x10F3B: 68, - 0x10F3C: 68, - 0x10F3D: 68, - 0x10F3E: 68, - 0x10F3F: 68, - 0x10F40: 68, - 0x10F41: 68, - 0x10F42: 68, - 0x10F43: 68, - 0x10F44: 68, - 0x10F46: 84, - 0x10F47: 84, - 0x10F48: 84, - 0x10F49: 84, - 0x10F4A: 84, - 0x10F4B: 84, - 0x10F4C: 84, - 0x10F4D: 84, - 0x10F4E: 84, - 0x10F4F: 84, - 0x10F50: 84, - 0x10F51: 68, - 0x10F52: 68, - 0x10F53: 68, - 0x10F54: 82, - 0x10F70: 68, - 0x10F71: 68, - 0x10F72: 68, - 0x10F73: 68, - 0x10F74: 82, - 0x10F75: 82, - 0x10F76: 68, - 0x10F77: 68, - 0x10F78: 68, - 0x10F79: 68, - 0x10F7A: 68, - 0x10F7B: 68, - 0x10F7C: 68, - 0x10F7D: 68, - 0x10F7E: 68, - 0x10F7F: 68, - 0x10F80: 68, - 0x10F81: 68, - 0x10F82: 84, - 0x10F83: 84, - 0x10F84: 84, - 0x10F85: 84, - 0x10FB0: 68, - 0x10FB2: 68, - 0x10FB3: 68, - 0x10FB4: 82, - 0x10FB5: 82, - 0x10FB6: 82, - 0x10FB8: 68, - 0x10FB9: 82, - 0x10FBA: 82, - 0x10FBB: 68, - 0x10FBC: 68, - 0x10FBD: 82, - 0x10FBE: 68, - 0x10FBF: 68, - 0x10FC1: 68, - 0x10FC2: 82, - 0x10FC3: 82, - 0x10FC4: 68, - 0x10FC9: 82, - 0x10FCA: 68, - 0x10FCB: 76, - 0x11001: 84, - 0x11038: 84, - 0x11039: 84, - 0x1103A: 84, - 0x1103B: 84, - 0x1103C: 84, - 0x1103D: 84, - 0x1103E: 84, - 0x1103F: 84, - 0x11040: 84, - 0x11041: 84, - 0x11042: 84, - 0x11043: 84, - 0x11044: 84, - 0x11045: 84, - 0x11046: 84, - 0x11070: 84, - 0x11073: 84, - 0x11074: 84, - 0x1107F: 84, - 0x11080: 84, - 0x11081: 84, - 0x110B3: 84, - 0x110B4: 84, - 0x110B5: 84, - 0x110B6: 84, - 0x110B9: 84, - 0x110BA: 84, - 0x110C2: 84, - 0x11100: 84, - 0x11101: 84, - 0x11102: 84, - 0x11127: 84, - 0x11128: 84, - 0x11129: 84, - 0x1112A: 84, - 0x1112B: 84, - 0x1112D: 84, - 0x1112E: 84, - 0x1112F: 84, - 0x11130: 84, - 0x11131: 84, - 0x11132: 84, - 0x11133: 84, - 0x11134: 84, - 0x11173: 84, - 0x11180: 84, - 0x11181: 84, - 0x111B6: 84, - 0x111B7: 84, - 0x111B8: 84, - 0x111B9: 84, - 0x111BA: 84, - 0x111BB: 84, - 0x111BC: 84, - 0x111BD: 84, - 0x111BE: 84, - 0x111C9: 84, - 0x111CA: 84, - 0x111CB: 84, - 0x111CC: 84, - 0x111CF: 84, - 0x1122F: 84, - 0x11230: 84, - 0x11231: 84, - 0x11234: 84, - 0x11236: 84, - 0x11237: 84, - 0x1123E: 84, - 0x11241: 84, - 0x112DF: 84, - 0x112E3: 84, - 0x112E4: 84, - 0x112E5: 84, - 0x112E6: 84, - 0x112E7: 84, - 0x112E8: 84, - 0x112E9: 84, - 0x112EA: 84, - 0x11300: 84, - 0x11301: 84, - 0x1133B: 84, - 0x1133C: 84, - 0x11340: 84, - 0x11366: 84, - 0x11367: 84, - 0x11368: 84, - 0x11369: 84, - 0x1136A: 84, - 0x1136B: 84, - 0x1136C: 84, - 0x11370: 84, - 0x11371: 84, - 0x11372: 84, - 0x11373: 84, - 0x11374: 84, - 0x11438: 84, - 0x11439: 84, - 0x1143A: 84, - 0x1143B: 84, - 0x1143C: 84, - 0x1143D: 84, - 0x1143E: 84, - 0x1143F: 84, - 0x11442: 84, - 0x11443: 84, - 0x11444: 84, - 0x11446: 84, - 0x1145E: 84, - 0x114B3: 84, - 0x114B4: 84, - 0x114B5: 84, - 0x114B6: 84, - 0x114B7: 84, - 0x114B8: 84, - 0x114BA: 84, - 0x114BF: 84, - 0x114C0: 84, - 0x114C2: 84, - 0x114C3: 84, - 0x115B2: 84, - 0x115B3: 84, - 0x115B4: 84, - 0x115B5: 84, - 0x115BC: 84, - 0x115BD: 84, - 0x115BF: 84, - 0x115C0: 84, - 0x115DC: 84, - 0x115DD: 84, - 0x11633: 84, - 0x11634: 84, - 0x11635: 84, - 0x11636: 84, - 0x11637: 84, - 0x11638: 84, - 0x11639: 84, - 0x1163A: 84, - 0x1163D: 84, - 0x1163F: 84, - 0x11640: 84, - 0x116AB: 84, - 0x116AD: 84, - 0x116B0: 84, - 0x116B1: 84, - 0x116B2: 84, - 0x116B3: 84, - 0x116B4: 84, - 0x116B5: 84, - 0x116B7: 84, - 0x1171D: 84, - 0x1171E: 84, - 0x1171F: 84, - 0x11722: 84, - 0x11723: 84, - 0x11724: 84, - 0x11725: 84, - 0x11727: 84, - 0x11728: 84, - 0x11729: 84, - 0x1172A: 84, - 0x1172B: 84, - 0x1182F: 84, - 0x11830: 84, - 0x11831: 84, - 0x11832: 84, - 0x11833: 84, - 0x11834: 84, - 0x11835: 84, - 0x11836: 84, - 0x11837: 84, - 0x11839: 84, - 0x1183A: 84, - 0x1193B: 84, - 0x1193C: 84, - 0x1193E: 84, - 0x11943: 84, - 0x119D4: 84, - 0x119D5: 84, - 0x119D6: 84, - 0x119D7: 84, - 0x119DA: 84, - 0x119DB: 84, - 0x119E0: 84, - 0x11A01: 84, - 0x11A02: 84, - 0x11A03: 84, - 0x11A04: 84, - 0x11A05: 84, - 0x11A06: 84, - 0x11A07: 84, - 0x11A08: 84, - 0x11A09: 84, - 0x11A0A: 84, - 0x11A33: 84, - 0x11A34: 84, - 0x11A35: 84, - 0x11A36: 84, - 0x11A37: 84, - 0x11A38: 84, - 0x11A3B: 84, - 0x11A3C: 84, - 0x11A3D: 84, - 0x11A3E: 84, - 0x11A47: 84, - 0x11A51: 84, - 0x11A52: 84, - 0x11A53: 84, - 0x11A54: 84, - 0x11A55: 84, - 0x11A56: 84, - 0x11A59: 84, - 0x11A5A: 84, - 0x11A5B: 84, - 0x11A8A: 84, - 0x11A8B: 84, - 0x11A8C: 84, - 0x11A8D: 84, - 0x11A8E: 84, - 0x11A8F: 84, - 0x11A90: 84, - 0x11A91: 84, - 0x11A92: 84, - 0x11A93: 84, - 0x11A94: 84, - 0x11A95: 84, - 0x11A96: 84, - 0x11A98: 84, - 0x11A99: 84, - 0x11C30: 84, - 0x11C31: 84, - 0x11C32: 84, - 0x11C33: 84, - 0x11C34: 84, - 0x11C35: 84, - 0x11C36: 84, - 0x11C38: 84, - 0x11C39: 84, - 0x11C3A: 84, - 0x11C3B: 84, - 0x11C3C: 84, - 0x11C3D: 84, - 0x11C3F: 84, - 0x11C92: 84, - 0x11C93: 84, - 0x11C94: 84, - 0x11C95: 84, - 0x11C96: 84, - 0x11C97: 84, - 0x11C98: 84, - 0x11C99: 84, - 0x11C9A: 84, - 0x11C9B: 84, - 0x11C9C: 84, - 0x11C9D: 84, - 0x11C9E: 84, - 0x11C9F: 84, - 0x11CA0: 84, - 0x11CA1: 84, - 0x11CA2: 84, - 0x11CA3: 84, - 0x11CA4: 84, - 0x11CA5: 84, - 0x11CA6: 84, - 0x11CA7: 84, - 0x11CAA: 84, - 0x11CAB: 84, - 0x11CAC: 84, - 0x11CAD: 84, - 0x11CAE: 84, - 0x11CAF: 84, - 0x11CB0: 84, - 0x11CB2: 84, - 0x11CB3: 84, - 0x11CB5: 84, - 0x11CB6: 84, - 0x11D31: 84, - 0x11D32: 84, - 0x11D33: 84, - 0x11D34: 84, - 0x11D35: 84, - 0x11D36: 84, - 0x11D3A: 84, - 0x11D3C: 84, - 0x11D3D: 84, - 0x11D3F: 84, - 0x11D40: 84, - 0x11D41: 84, - 0x11D42: 84, - 0x11D43: 84, - 0x11D44: 84, - 0x11D45: 84, - 0x11D47: 84, - 0x11D90: 84, - 0x11D91: 84, - 0x11D95: 84, - 0x11D97: 84, - 0x11EF3: 84, - 0x11EF4: 84, - 0x11F00: 84, - 0x11F01: 84, - 0x11F36: 84, - 0x11F37: 84, - 0x11F38: 84, - 0x11F39: 84, - 0x11F3A: 84, - 0x11F40: 84, - 0x11F42: 84, - 0x13430: 84, - 0x13431: 84, - 0x13432: 84, - 0x13433: 84, - 0x13434: 84, - 0x13435: 84, - 0x13436: 84, - 0x13437: 84, - 0x13438: 84, - 0x13439: 84, - 0x1343A: 84, - 0x1343B: 84, - 0x1343C: 84, - 0x1343D: 84, - 0x1343E: 84, - 0x1343F: 84, - 0x13440: 84, - 0x13447: 84, - 0x13448: 84, - 0x13449: 84, - 0x1344A: 84, - 0x1344B: 84, - 0x1344C: 84, - 0x1344D: 84, - 0x1344E: 84, - 0x1344F: 84, - 0x13450: 84, - 0x13451: 84, - 0x13452: 84, - 0x13453: 84, - 0x13454: 84, - 0x13455: 84, - 0x16AF0: 84, - 0x16AF1: 84, - 0x16AF2: 84, - 0x16AF3: 84, - 0x16AF4: 84, - 0x16B30: 84, - 0x16B31: 84, - 0x16B32: 84, - 0x16B33: 84, - 0x16B34: 84, - 0x16B35: 84, - 0x16B36: 84, - 0x16F4F: 84, - 0x16F8F: 84, - 0x16F90: 84, - 0x16F91: 84, - 0x16F92: 84, - 0x16FE4: 84, - 0x1BC9D: 84, - 0x1BC9E: 84, - 0x1BCA0: 84, - 0x1BCA1: 84, - 0x1BCA2: 84, - 0x1BCA3: 84, - 0x1CF00: 84, - 0x1CF01: 84, - 0x1CF02: 84, - 0x1CF03: 84, - 0x1CF04: 84, - 0x1CF05: 84, - 0x1CF06: 84, - 0x1CF07: 84, - 0x1CF08: 84, - 0x1CF09: 84, - 0x1CF0A: 84, - 0x1CF0B: 84, - 0x1CF0C: 84, - 0x1CF0D: 84, - 0x1CF0E: 84, - 0x1CF0F: 84, - 0x1CF10: 84, - 0x1CF11: 84, - 0x1CF12: 84, - 0x1CF13: 84, - 0x1CF14: 84, - 0x1CF15: 84, - 0x1CF16: 84, - 0x1CF17: 84, - 0x1CF18: 84, - 0x1CF19: 84, - 0x1CF1A: 84, - 0x1CF1B: 84, - 0x1CF1C: 84, - 0x1CF1D: 84, - 0x1CF1E: 84, - 0x1CF1F: 84, - 0x1CF20: 84, - 0x1CF21: 84, - 0x1CF22: 84, - 0x1CF23: 84, - 0x1CF24: 84, - 0x1CF25: 84, - 0x1CF26: 84, - 0x1CF27: 84, - 0x1CF28: 84, - 0x1CF29: 84, - 0x1CF2A: 84, - 0x1CF2B: 84, - 0x1CF2C: 84, - 0x1CF2D: 84, - 0x1CF30: 84, - 0x1CF31: 84, - 0x1CF32: 84, - 0x1CF33: 84, - 0x1CF34: 84, - 0x1CF35: 84, - 0x1CF36: 84, - 0x1CF37: 84, - 0x1CF38: 84, - 0x1CF39: 84, - 0x1CF3A: 84, - 0x1CF3B: 84, - 0x1CF3C: 84, - 0x1CF3D: 84, - 0x1CF3E: 84, - 0x1CF3F: 84, - 0x1CF40: 84, - 0x1CF41: 84, - 0x1CF42: 84, - 0x1CF43: 84, - 0x1CF44: 84, - 0x1CF45: 84, - 0x1CF46: 84, - 0x1D167: 84, - 0x1D168: 84, - 0x1D169: 84, - 0x1D173: 84, - 0x1D174: 84, - 0x1D175: 84, - 0x1D176: 84, - 0x1D177: 84, - 0x1D178: 84, - 0x1D179: 84, - 0x1D17A: 84, - 0x1D17B: 84, - 0x1D17C: 84, - 0x1D17D: 84, - 0x1D17E: 84, - 0x1D17F: 84, - 0x1D180: 84, - 0x1D181: 84, - 0x1D182: 84, - 0x1D185: 84, - 0x1D186: 84, - 0x1D187: 84, - 0x1D188: 84, - 0x1D189: 84, - 0x1D18A: 84, - 0x1D18B: 84, - 0x1D1AA: 84, - 0x1D1AB: 84, - 0x1D1AC: 84, - 0x1D1AD: 84, - 0x1D242: 84, - 0x1D243: 84, - 0x1D244: 84, - 0x1DA00: 84, - 0x1DA01: 84, - 0x1DA02: 84, - 0x1DA03: 84, - 0x1DA04: 84, - 0x1DA05: 84, - 0x1DA06: 84, - 0x1DA07: 84, - 0x1DA08: 84, - 0x1DA09: 84, - 0x1DA0A: 84, - 0x1DA0B: 84, - 0x1DA0C: 84, - 0x1DA0D: 84, - 0x1DA0E: 84, - 0x1DA0F: 84, - 0x1DA10: 84, - 0x1DA11: 84, - 0x1DA12: 84, - 0x1DA13: 84, - 0x1DA14: 84, - 0x1DA15: 84, - 0x1DA16: 84, - 0x1DA17: 84, - 0x1DA18: 84, - 0x1DA19: 84, - 0x1DA1A: 84, - 0x1DA1B: 84, - 0x1DA1C: 84, - 0x1DA1D: 84, - 0x1DA1E: 84, - 0x1DA1F: 84, - 0x1DA20: 84, - 0x1DA21: 84, - 0x1DA22: 84, - 0x1DA23: 84, - 0x1DA24: 84, - 0x1DA25: 84, - 0x1DA26: 84, - 0x1DA27: 84, - 0x1DA28: 84, - 0x1DA29: 84, - 0x1DA2A: 84, - 0x1DA2B: 84, - 0x1DA2C: 84, - 0x1DA2D: 84, - 0x1DA2E: 84, - 0x1DA2F: 84, - 0x1DA30: 84, - 0x1DA31: 84, - 0x1DA32: 84, - 0x1DA33: 84, - 0x1DA34: 84, - 0x1DA35: 84, - 0x1DA36: 84, - 0x1DA3B: 84, - 0x1DA3C: 84, - 0x1DA3D: 84, - 0x1DA3E: 84, - 0x1DA3F: 84, - 0x1DA40: 84, - 0x1DA41: 84, - 0x1DA42: 84, - 0x1DA43: 84, - 0x1DA44: 84, - 0x1DA45: 84, - 0x1DA46: 84, - 0x1DA47: 84, - 0x1DA48: 84, - 0x1DA49: 84, - 0x1DA4A: 84, - 0x1DA4B: 84, - 0x1DA4C: 84, - 0x1DA4D: 84, - 0x1DA4E: 84, - 0x1DA4F: 84, - 0x1DA50: 84, - 0x1DA51: 84, - 0x1DA52: 84, - 0x1DA53: 84, - 0x1DA54: 84, - 0x1DA55: 84, - 0x1DA56: 84, - 0x1DA57: 84, - 0x1DA58: 84, - 0x1DA59: 84, - 0x1DA5A: 84, - 0x1DA5B: 84, - 0x1DA5C: 84, - 0x1DA5D: 84, - 0x1DA5E: 84, - 0x1DA5F: 84, - 0x1DA60: 84, - 0x1DA61: 84, - 0x1DA62: 84, - 0x1DA63: 84, - 0x1DA64: 84, - 0x1DA65: 84, - 0x1DA66: 84, - 0x1DA67: 84, - 0x1DA68: 84, - 0x1DA69: 84, - 0x1DA6A: 84, - 0x1DA6B: 84, - 0x1DA6C: 84, - 0x1DA75: 84, - 0x1DA84: 84, - 0x1DA9B: 84, - 0x1DA9C: 84, - 0x1DA9D: 84, - 0x1DA9E: 84, - 0x1DA9F: 84, - 0x1DAA1: 84, - 0x1DAA2: 84, - 0x1DAA3: 84, - 0x1DAA4: 84, - 0x1DAA5: 84, - 0x1DAA6: 84, - 0x1DAA7: 84, - 0x1DAA8: 84, - 0x1DAA9: 84, - 0x1DAAA: 84, - 0x1DAAB: 84, - 0x1DAAC: 84, - 0x1DAAD: 84, - 0x1DAAE: 84, - 0x1DAAF: 84, - 0x1E000: 84, - 0x1E001: 84, - 0x1E002: 84, - 0x1E003: 84, - 0x1E004: 84, - 0x1E005: 84, - 0x1E006: 84, - 0x1E008: 84, - 0x1E009: 84, - 0x1E00A: 84, - 0x1E00B: 84, - 0x1E00C: 84, - 0x1E00D: 84, - 0x1E00E: 84, - 0x1E00F: 84, - 0x1E010: 84, - 0x1E011: 84, - 0x1E012: 84, - 0x1E013: 84, - 0x1E014: 84, - 0x1E015: 84, - 0x1E016: 84, - 0x1E017: 84, - 0x1E018: 84, - 0x1E01B: 84, - 0x1E01C: 84, - 0x1E01D: 84, - 0x1E01E: 84, - 0x1E01F: 84, - 0x1E020: 84, - 0x1E021: 84, - 0x1E023: 84, - 0x1E024: 84, - 0x1E026: 84, - 0x1E027: 84, - 0x1E028: 84, - 0x1E029: 84, - 0x1E02A: 84, - 0x1E08F: 84, - 0x1E130: 84, - 0x1E131: 84, - 0x1E132: 84, - 0x1E133: 84, - 0x1E134: 84, - 0x1E135: 84, - 0x1E136: 84, - 0x1E2AE: 84, - 0x1E2EC: 84, - 0x1E2ED: 84, - 0x1E2EE: 84, - 0x1E2EF: 84, - 0x1E4EC: 84, - 0x1E4ED: 84, - 0x1E4EE: 84, - 0x1E4EF: 84, - 0x1E8D0: 84, - 0x1E8D1: 84, - 0x1E8D2: 84, - 0x1E8D3: 84, - 0x1E8D4: 84, - 0x1E8D5: 84, - 0x1E8D6: 84, - 0x1E900: 68, - 0x1E901: 68, - 0x1E902: 68, - 0x1E903: 68, - 0x1E904: 68, - 0x1E905: 68, - 0x1E906: 68, - 0x1E907: 68, - 0x1E908: 68, - 0x1E909: 68, - 0x1E90A: 68, - 0x1E90B: 68, - 0x1E90C: 68, - 0x1E90D: 68, - 0x1E90E: 68, - 0x1E90F: 68, - 0x1E910: 68, - 0x1E911: 68, - 0x1E912: 68, - 0x1E913: 68, - 0x1E914: 68, - 0x1E915: 68, - 0x1E916: 68, - 0x1E917: 68, - 0x1E918: 68, - 0x1E919: 68, - 0x1E91A: 68, - 0x1E91B: 68, - 0x1E91C: 68, - 0x1E91D: 68, - 0x1E91E: 68, - 0x1E91F: 68, - 0x1E920: 68, - 0x1E921: 68, - 0x1E922: 68, - 0x1E923: 68, - 0x1E924: 68, - 0x1E925: 68, - 0x1E926: 68, - 0x1E927: 68, - 0x1E928: 68, - 0x1E929: 68, - 0x1E92A: 68, - 0x1E92B: 68, - 0x1E92C: 68, - 0x1E92D: 68, - 0x1E92E: 68, - 0x1E92F: 68, - 0x1E930: 68, - 0x1E931: 68, - 0x1E932: 68, - 0x1E933: 68, - 0x1E934: 68, - 0x1E935: 68, - 0x1E936: 68, - 0x1E937: 68, - 0x1E938: 68, - 0x1E939: 68, - 0x1E93A: 68, - 0x1E93B: 68, - 0x1E93C: 68, - 0x1E93D: 68, - 0x1E93E: 68, - 0x1E93F: 68, - 0x1E940: 68, - 0x1E941: 68, - 0x1E942: 68, - 0x1E943: 68, - 0x1E944: 84, - 0x1E945: 84, - 0x1E946: 84, - 0x1E947: 84, - 0x1E948: 84, - 0x1E949: 84, - 0x1E94A: 84, - 0x1E94B: 84, - 0xE0001: 84, - 0xE0020: 84, - 0xE0021: 84, - 0xE0022: 84, - 0xE0023: 84, - 0xE0024: 84, - 0xE0025: 84, - 0xE0026: 84, - 0xE0027: 84, - 0xE0028: 84, - 0xE0029: 84, - 0xE002A: 84, - 0xE002B: 84, - 0xE002C: 84, - 0xE002D: 84, - 0xE002E: 84, - 0xE002F: 84, - 0xE0030: 84, - 0xE0031: 84, - 0xE0032: 84, - 0xE0033: 84, - 0xE0034: 84, - 0xE0035: 84, - 0xE0036: 84, - 0xE0037: 84, - 0xE0038: 84, - 0xE0039: 84, - 0xE003A: 84, - 0xE003B: 84, - 0xE003C: 84, - 0xE003D: 84, - 0xE003E: 84, - 0xE003F: 84, - 0xE0040: 84, - 0xE0041: 84, - 0xE0042: 84, - 0xE0043: 84, - 0xE0044: 84, - 0xE0045: 84, - 0xE0046: 84, - 0xE0047: 84, - 0xE0048: 84, - 0xE0049: 84, - 0xE004A: 84, - 0xE004B: 84, - 0xE004C: 84, - 0xE004D: 84, - 0xE004E: 84, - 0xE004F: 84, - 0xE0050: 84, - 0xE0051: 84, - 0xE0052: 84, - 0xE0053: 84, - 0xE0054: 84, - 0xE0055: 84, - 0xE0056: 84, - 0xE0057: 84, - 0xE0058: 84, - 0xE0059: 84, - 0xE005A: 84, - 0xE005B: 84, - 0xE005C: 84, - 0xE005D: 84, - 0xE005E: 84, - 0xE005F: 84, - 0xE0060: 84, - 0xE0061: 84, - 0xE0062: 84, - 0xE0063: 84, - 0xE0064: 84, - 0xE0065: 84, - 0xE0066: 84, - 0xE0067: 84, - 0xE0068: 84, - 0xE0069: 84, - 0xE006A: 84, - 0xE006B: 84, - 0xE006C: 84, - 0xE006D: 84, - 0xE006E: 84, - 0xE006F: 84, - 0xE0070: 84, - 0xE0071: 84, - 0xE0072: 84, - 0xE0073: 84, - 0xE0074: 84, - 0xE0075: 84, - 0xE0076: 84, - 0xE0077: 84, - 0xE0078: 84, - 0xE0079: 84, - 0xE007A: 84, - 0xE007B: 84, - 0xE007C: 84, - 0xE007D: 84, - 0xE007E: 84, - 0xE007F: 84, - 0xE0100: 84, - 0xE0101: 84, - 0xE0102: 84, - 0xE0103: 84, - 0xE0104: 84, - 0xE0105: 84, - 0xE0106: 84, - 0xE0107: 84, - 0xE0108: 84, - 0xE0109: 84, - 0xE010A: 84, - 0xE010B: 84, - 0xE010C: 84, - 0xE010D: 84, - 0xE010E: 84, - 0xE010F: 84, - 0xE0110: 84, - 0xE0111: 84, - 0xE0112: 84, - 0xE0113: 84, - 0xE0114: 84, - 0xE0115: 84, - 0xE0116: 84, - 0xE0117: 84, - 0xE0118: 84, - 0xE0119: 84, - 0xE011A: 84, - 0xE011B: 84, - 0xE011C: 84, - 0xE011D: 84, - 0xE011E: 84, - 0xE011F: 84, - 0xE0120: 84, - 0xE0121: 84, - 0xE0122: 84, - 0xE0123: 84, - 0xE0124: 84, - 0xE0125: 84, - 0xE0126: 84, - 0xE0127: 84, - 0xE0128: 84, - 0xE0129: 84, - 0xE012A: 84, - 0xE012B: 84, - 0xE012C: 84, - 0xE012D: 84, - 0xE012E: 84, - 0xE012F: 84, - 0xE0130: 84, - 0xE0131: 84, - 0xE0132: 84, - 0xE0133: 84, - 0xE0134: 84, - 0xE0135: 84, - 0xE0136: 84, - 0xE0137: 84, - 0xE0138: 84, - 0xE0139: 84, - 0xE013A: 84, - 0xE013B: 84, - 0xE013C: 84, - 0xE013D: 84, - 0xE013E: 84, - 0xE013F: 84, - 0xE0140: 84, - 0xE0141: 84, - 0xE0142: 84, - 0xE0143: 84, - 0xE0144: 84, - 0xE0145: 84, - 0xE0146: 84, - 0xE0147: 84, - 0xE0148: 84, - 0xE0149: 84, - 0xE014A: 84, - 0xE014B: 84, - 0xE014C: 84, - 0xE014D: 84, - 0xE014E: 84, - 0xE014F: 84, - 0xE0150: 84, - 0xE0151: 84, - 0xE0152: 84, - 0xE0153: 84, - 0xE0154: 84, - 0xE0155: 84, - 0xE0156: 84, - 0xE0157: 84, - 0xE0158: 84, - 0xE0159: 84, - 0xE015A: 84, - 0xE015B: 84, - 0xE015C: 84, - 0xE015D: 84, - 0xE015E: 84, - 0xE015F: 84, - 0xE0160: 84, - 0xE0161: 84, - 0xE0162: 84, - 0xE0163: 84, - 0xE0164: 84, - 0xE0165: 84, - 0xE0166: 84, - 0xE0167: 84, - 0xE0168: 84, - 0xE0169: 84, - 0xE016A: 84, - 0xE016B: 84, - 0xE016C: 84, - 0xE016D: 84, - 0xE016E: 84, - 0xE016F: 84, - 0xE0170: 84, - 0xE0171: 84, - 0xE0172: 84, - 0xE0173: 84, - 0xE0174: 84, - 0xE0175: 84, - 0xE0176: 84, - 0xE0177: 84, - 0xE0178: 84, - 0xE0179: 84, - 0xE017A: 84, - 0xE017B: 84, - 0xE017C: 84, - 0xE017D: 84, - 0xE017E: 84, - 0xE017F: 84, - 0xE0180: 84, - 0xE0181: 84, - 0xE0182: 84, - 0xE0183: 84, - 0xE0184: 84, - 0xE0185: 84, - 0xE0186: 84, - 0xE0187: 84, - 0xE0188: 84, - 0xE0189: 84, - 0xE018A: 84, - 0xE018B: 84, - 0xE018C: 84, - 0xE018D: 84, - 0xE018E: 84, - 0xE018F: 84, - 0xE0190: 84, - 0xE0191: 84, - 0xE0192: 84, - 0xE0193: 84, - 0xE0194: 84, - 0xE0195: 84, - 0xE0196: 84, - 0xE0197: 84, - 0xE0198: 84, - 0xE0199: 84, - 0xE019A: 84, - 0xE019B: 84, - 0xE019C: 84, - 0xE019D: 84, - 0xE019E: 84, - 0xE019F: 84, - 0xE01A0: 84, - 0xE01A1: 84, - 0xE01A2: 84, - 0xE01A3: 84, - 0xE01A4: 84, - 0xE01A5: 84, - 0xE01A6: 84, - 0xE01A7: 84, - 0xE01A8: 84, - 0xE01A9: 84, - 0xE01AA: 84, - 0xE01AB: 84, - 0xE01AC: 84, - 0xE01AD: 84, - 0xE01AE: 84, - 0xE01AF: 84, - 0xE01B0: 84, - 0xE01B1: 84, - 0xE01B2: 84, - 0xE01B3: 84, - 0xE01B4: 84, - 0xE01B5: 84, - 0xE01B6: 84, - 0xE01B7: 84, - 0xE01B8: 84, - 0xE01B9: 84, - 0xE01BA: 84, - 0xE01BB: 84, - 0xE01BC: 84, - 0xE01BD: 84, - 0xE01BE: 84, - 0xE01BF: 84, - 0xE01C0: 84, - 0xE01C1: 84, - 0xE01C2: 84, - 0xE01C3: 84, - 0xE01C4: 84, - 0xE01C5: 84, - 0xE01C6: 84, - 0xE01C7: 84, - 0xE01C8: 84, - 0xE01C9: 84, - 0xE01CA: 84, - 0xE01CB: 84, - 0xE01CC: 84, - 0xE01CD: 84, - 0xE01CE: 84, - 0xE01CF: 84, - 0xE01D0: 84, - 0xE01D1: 84, - 0xE01D2: 84, - 0xE01D3: 84, - 0xE01D4: 84, - 0xE01D5: 84, - 0xE01D6: 84, - 0xE01D7: 84, - 0xE01D8: 84, - 0xE01D9: 84, - 0xE01DA: 84, - 0xE01DB: 84, - 0xE01DC: 84, - 0xE01DD: 84, - 0xE01DE: 84, - 0xE01DF: 84, - 0xE01E0: 84, - 0xE01E1: 84, - 0xE01E2: 84, - 0xE01E3: 84, - 0xE01E4: 84, - 0xE01E5: 84, - 0xE01E6: 84, - 0xE01E7: 84, - 0xE01E8: 84, - 0xE01E9: 84, - 0xE01EA: 84, - 0xE01EB: 84, - 0xE01EC: 84, - 0xE01ED: 84, - 0xE01EE: 84, - 0xE01EF: 84, -} -codepoint_classes = { - "PVALID": ( - 0x2D0000002E, - 0x300000003A, - 0x610000007B, - 0xDF000000F7, - 0xF800000100, - 0x10100000102, - 0x10300000104, - 0x10500000106, - 0x10700000108, - 0x1090000010A, - 0x10B0000010C, - 0x10D0000010E, - 0x10F00000110, - 0x11100000112, - 0x11300000114, - 0x11500000116, - 0x11700000118, - 0x1190000011A, - 0x11B0000011C, - 0x11D0000011E, - 0x11F00000120, - 0x12100000122, - 0x12300000124, - 0x12500000126, - 0x12700000128, - 0x1290000012A, - 0x12B0000012C, - 0x12D0000012E, - 0x12F00000130, - 0x13100000132, - 0x13500000136, - 0x13700000139, - 0x13A0000013B, - 0x13C0000013D, - 0x13E0000013F, - 0x14200000143, - 0x14400000145, - 0x14600000147, - 0x14800000149, - 0x14B0000014C, - 0x14D0000014E, - 0x14F00000150, - 0x15100000152, - 0x15300000154, - 0x15500000156, - 0x15700000158, - 0x1590000015A, - 0x15B0000015C, - 0x15D0000015E, - 0x15F00000160, - 0x16100000162, - 0x16300000164, - 0x16500000166, - 0x16700000168, - 0x1690000016A, - 0x16B0000016C, - 0x16D0000016E, - 0x16F00000170, - 0x17100000172, - 0x17300000174, - 0x17500000176, - 0x17700000178, - 0x17A0000017B, - 0x17C0000017D, - 0x17E0000017F, - 0x18000000181, - 0x18300000184, - 0x18500000186, - 0x18800000189, - 0x18C0000018E, - 0x19200000193, - 0x19500000196, - 0x1990000019C, - 0x19E0000019F, - 0x1A1000001A2, - 0x1A3000001A4, - 0x1A5000001A6, - 0x1A8000001A9, - 0x1AA000001AC, - 0x1AD000001AE, - 0x1B0000001B1, - 0x1B4000001B5, - 0x1B6000001B7, - 0x1B9000001BC, - 0x1BD000001C4, - 0x1CE000001CF, - 0x1D0000001D1, - 0x1D2000001D3, - 0x1D4000001D5, - 0x1D6000001D7, - 0x1D8000001D9, - 0x1DA000001DB, - 0x1DC000001DE, - 0x1DF000001E0, - 0x1E1000001E2, - 0x1E3000001E4, - 0x1E5000001E6, - 0x1E7000001E8, - 0x1E9000001EA, - 0x1EB000001EC, - 0x1ED000001EE, - 0x1EF000001F1, - 0x1F5000001F6, - 0x1F9000001FA, - 0x1FB000001FC, - 0x1FD000001FE, - 0x1FF00000200, - 0x20100000202, - 0x20300000204, - 0x20500000206, - 0x20700000208, - 0x2090000020A, - 0x20B0000020C, - 0x20D0000020E, - 0x20F00000210, - 0x21100000212, - 0x21300000214, - 0x21500000216, - 0x21700000218, - 0x2190000021A, - 0x21B0000021C, - 0x21D0000021E, - 0x21F00000220, - 0x22100000222, - 0x22300000224, - 0x22500000226, - 0x22700000228, - 0x2290000022A, - 0x22B0000022C, - 0x22D0000022E, - 0x22F00000230, - 0x23100000232, - 0x2330000023A, - 0x23C0000023D, - 0x23F00000241, - 0x24200000243, - 0x24700000248, - 0x2490000024A, - 0x24B0000024C, - 0x24D0000024E, - 0x24F000002B0, - 0x2B9000002C2, - 0x2C6000002D2, - 0x2EC000002ED, - 0x2EE000002EF, - 0x30000000340, - 0x34200000343, - 0x3460000034F, - 0x35000000370, - 0x37100000372, - 0x37300000374, - 0x37700000378, - 0x37B0000037E, - 0x39000000391, - 0x3AC000003CF, - 0x3D7000003D8, - 0x3D9000003DA, - 0x3DB000003DC, - 0x3DD000003DE, - 0x3DF000003E0, - 0x3E1000003E2, - 0x3E3000003E4, - 0x3E5000003E6, - 0x3E7000003E8, - 0x3E9000003EA, - 0x3EB000003EC, - 0x3ED000003EE, - 0x3EF000003F0, - 0x3F3000003F4, - 0x3F8000003F9, - 0x3FB000003FD, - 0x43000000460, - 0x46100000462, - 0x46300000464, - 0x46500000466, - 0x46700000468, - 0x4690000046A, - 0x46B0000046C, - 0x46D0000046E, - 0x46F00000470, - 0x47100000472, - 0x47300000474, - 0x47500000476, - 0x47700000478, - 0x4790000047A, - 0x47B0000047C, - 0x47D0000047E, - 0x47F00000480, - 0x48100000482, - 0x48300000488, - 0x48B0000048C, - 0x48D0000048E, - 0x48F00000490, - 0x49100000492, - 0x49300000494, - 0x49500000496, - 0x49700000498, - 0x4990000049A, - 0x49B0000049C, - 0x49D0000049E, - 0x49F000004A0, - 0x4A1000004A2, - 0x4A3000004A4, - 0x4A5000004A6, - 0x4A7000004A8, - 0x4A9000004AA, - 0x4AB000004AC, - 0x4AD000004AE, - 0x4AF000004B0, - 0x4B1000004B2, - 0x4B3000004B4, - 0x4B5000004B6, - 0x4B7000004B8, - 0x4B9000004BA, - 0x4BB000004BC, - 0x4BD000004BE, - 0x4BF000004C0, - 0x4C2000004C3, - 0x4C4000004C5, - 0x4C6000004C7, - 0x4C8000004C9, - 0x4CA000004CB, - 0x4CC000004CD, - 0x4CE000004D0, - 0x4D1000004D2, - 0x4D3000004D4, - 0x4D5000004D6, - 0x4D7000004D8, - 0x4D9000004DA, - 0x4DB000004DC, - 0x4DD000004DE, - 0x4DF000004E0, - 0x4E1000004E2, - 0x4E3000004E4, - 0x4E5000004E6, - 0x4E7000004E8, - 0x4E9000004EA, - 0x4EB000004EC, - 0x4ED000004EE, - 0x4EF000004F0, - 0x4F1000004F2, - 0x4F3000004F4, - 0x4F5000004F6, - 0x4F7000004F8, - 0x4F9000004FA, - 0x4FB000004FC, - 0x4FD000004FE, - 0x4FF00000500, - 0x50100000502, - 0x50300000504, - 0x50500000506, - 0x50700000508, - 0x5090000050A, - 0x50B0000050C, - 0x50D0000050E, - 0x50F00000510, - 0x51100000512, - 0x51300000514, - 0x51500000516, - 0x51700000518, - 0x5190000051A, - 0x51B0000051C, - 0x51D0000051E, - 0x51F00000520, - 0x52100000522, - 0x52300000524, - 0x52500000526, - 0x52700000528, - 0x5290000052A, - 0x52B0000052C, - 0x52D0000052E, - 0x52F00000530, - 0x5590000055A, - 0x56000000587, - 0x58800000589, - 0x591000005BE, - 0x5BF000005C0, - 0x5C1000005C3, - 0x5C4000005C6, - 0x5C7000005C8, - 0x5D0000005EB, - 0x5EF000005F3, - 0x6100000061B, - 0x62000000640, - 0x64100000660, - 0x66E00000675, - 0x679000006D4, - 0x6D5000006DD, - 0x6DF000006E9, - 0x6EA000006F0, - 0x6FA00000700, - 0x7100000074B, - 0x74D000007B2, - 0x7C0000007F6, - 0x7FD000007FE, - 0x8000000082E, - 0x8400000085C, - 0x8600000086B, - 0x87000000888, - 0x8890000088F, - 0x898000008E2, - 0x8E300000958, - 0x96000000964, - 0x96600000970, - 0x97100000984, - 0x9850000098D, - 0x98F00000991, - 0x993000009A9, - 0x9AA000009B1, - 0x9B2000009B3, - 0x9B6000009BA, - 0x9BC000009C5, - 0x9C7000009C9, - 0x9CB000009CF, - 0x9D7000009D8, - 0x9E0000009E4, - 0x9E6000009F2, - 0x9FC000009FD, - 0x9FE000009FF, - 0xA0100000A04, - 0xA0500000A0B, - 0xA0F00000A11, - 0xA1300000A29, - 0xA2A00000A31, - 0xA3200000A33, - 0xA3500000A36, - 0xA3800000A3A, - 0xA3C00000A3D, - 0xA3E00000A43, - 0xA4700000A49, - 0xA4B00000A4E, - 0xA5100000A52, - 0xA5C00000A5D, - 0xA6600000A76, - 0xA8100000A84, - 0xA8500000A8E, - 0xA8F00000A92, - 0xA9300000AA9, - 0xAAA00000AB1, - 0xAB200000AB4, - 0xAB500000ABA, - 0xABC00000AC6, - 0xAC700000ACA, - 0xACB00000ACE, - 0xAD000000AD1, - 0xAE000000AE4, - 0xAE600000AF0, - 0xAF900000B00, - 0xB0100000B04, - 0xB0500000B0D, - 0xB0F00000B11, - 0xB1300000B29, - 0xB2A00000B31, - 0xB3200000B34, - 0xB3500000B3A, - 0xB3C00000B45, - 0xB4700000B49, - 0xB4B00000B4E, - 0xB5500000B58, - 0xB5F00000B64, - 0xB6600000B70, - 0xB7100000B72, - 0xB8200000B84, - 0xB8500000B8B, - 0xB8E00000B91, - 0xB9200000B96, - 0xB9900000B9B, - 0xB9C00000B9D, - 0xB9E00000BA0, - 0xBA300000BA5, - 0xBA800000BAB, - 0xBAE00000BBA, - 0xBBE00000BC3, - 0xBC600000BC9, - 0xBCA00000BCE, - 0xBD000000BD1, - 0xBD700000BD8, - 0xBE600000BF0, - 0xC0000000C0D, - 0xC0E00000C11, - 0xC1200000C29, - 0xC2A00000C3A, - 0xC3C00000C45, - 0xC4600000C49, - 0xC4A00000C4E, - 0xC5500000C57, - 0xC5800000C5B, - 0xC5D00000C5E, - 0xC6000000C64, - 0xC6600000C70, - 0xC8000000C84, - 0xC8500000C8D, - 0xC8E00000C91, - 0xC9200000CA9, - 0xCAA00000CB4, - 0xCB500000CBA, - 0xCBC00000CC5, - 0xCC600000CC9, - 0xCCA00000CCE, - 0xCD500000CD7, - 0xCDD00000CDF, - 0xCE000000CE4, - 0xCE600000CF0, - 0xCF100000CF4, - 0xD0000000D0D, - 0xD0E00000D11, - 0xD1200000D45, - 0xD4600000D49, - 0xD4A00000D4F, - 0xD5400000D58, - 0xD5F00000D64, - 0xD6600000D70, - 0xD7A00000D80, - 0xD8100000D84, - 0xD8500000D97, - 0xD9A00000DB2, - 0xDB300000DBC, - 0xDBD00000DBE, - 0xDC000000DC7, - 0xDCA00000DCB, - 0xDCF00000DD5, - 0xDD600000DD7, - 0xDD800000DE0, - 0xDE600000DF0, - 0xDF200000DF4, - 0xE0100000E33, - 0xE3400000E3B, - 0xE4000000E4F, - 0xE5000000E5A, - 0xE8100000E83, - 0xE8400000E85, - 0xE8600000E8B, - 0xE8C00000EA4, - 0xEA500000EA6, - 0xEA700000EB3, - 0xEB400000EBE, - 0xEC000000EC5, - 0xEC600000EC7, - 0xEC800000ECF, - 0xED000000EDA, - 0xEDE00000EE0, - 0xF0000000F01, - 0xF0B00000F0C, - 0xF1800000F1A, - 0xF2000000F2A, - 0xF3500000F36, - 0xF3700000F38, - 0xF3900000F3A, - 0xF3E00000F43, - 0xF4400000F48, - 0xF4900000F4D, - 0xF4E00000F52, - 0xF5300000F57, - 0xF5800000F5C, - 0xF5D00000F69, - 0xF6A00000F6D, - 0xF7100000F73, - 0xF7400000F75, - 0xF7A00000F81, - 0xF8200000F85, - 0xF8600000F93, - 0xF9400000F98, - 0xF9900000F9D, - 0xF9E00000FA2, - 0xFA300000FA7, - 0xFA800000FAC, - 0xFAD00000FB9, - 0xFBA00000FBD, - 0xFC600000FC7, - 0x10000000104A, - 0x10500000109E, - 0x10D0000010FB, - 0x10FD00001100, - 0x120000001249, - 0x124A0000124E, - 0x125000001257, - 0x125800001259, - 0x125A0000125E, - 0x126000001289, - 0x128A0000128E, - 0x1290000012B1, - 0x12B2000012B6, - 0x12B8000012BF, - 0x12C0000012C1, - 0x12C2000012C6, - 0x12C8000012D7, - 0x12D800001311, - 0x131200001316, - 0x13180000135B, - 0x135D00001360, - 0x138000001390, - 0x13A0000013F6, - 0x14010000166D, - 0x166F00001680, - 0x16810000169B, - 0x16A0000016EB, - 0x16F1000016F9, - 0x170000001716, - 0x171F00001735, - 0x174000001754, - 0x17600000176D, - 0x176E00001771, - 0x177200001774, - 0x1780000017B4, - 0x17B6000017D4, - 0x17D7000017D8, - 0x17DC000017DE, - 0x17E0000017EA, - 0x18100000181A, - 0x182000001879, - 0x1880000018AB, - 0x18B0000018F6, - 0x19000000191F, - 0x19200000192C, - 0x19300000193C, - 0x19460000196E, - 0x197000001975, - 0x1980000019AC, - 0x19B0000019CA, - 0x19D0000019DA, - 0x1A0000001A1C, - 0x1A2000001A5F, - 0x1A6000001A7D, - 0x1A7F00001A8A, - 0x1A9000001A9A, - 0x1AA700001AA8, - 0x1AB000001ABE, - 0x1ABF00001ACF, - 0x1B0000001B4D, - 0x1B5000001B5A, - 0x1B6B00001B74, - 0x1B8000001BF4, - 0x1C0000001C38, - 0x1C4000001C4A, - 0x1C4D00001C7E, - 0x1CD000001CD3, - 0x1CD400001CFB, - 0x1D0000001D2C, - 0x1D2F00001D30, - 0x1D3B00001D3C, - 0x1D4E00001D4F, - 0x1D6B00001D78, - 0x1D7900001D9B, - 0x1DC000001E00, - 0x1E0100001E02, - 0x1E0300001E04, - 0x1E0500001E06, - 0x1E0700001E08, - 0x1E0900001E0A, - 0x1E0B00001E0C, - 0x1E0D00001E0E, - 0x1E0F00001E10, - 0x1E1100001E12, - 0x1E1300001E14, - 0x1E1500001E16, - 0x1E1700001E18, - 0x1E1900001E1A, - 0x1E1B00001E1C, - 0x1E1D00001E1E, - 0x1E1F00001E20, - 0x1E2100001E22, - 0x1E2300001E24, - 0x1E2500001E26, - 0x1E2700001E28, - 0x1E2900001E2A, - 0x1E2B00001E2C, - 0x1E2D00001E2E, - 0x1E2F00001E30, - 0x1E3100001E32, - 0x1E3300001E34, - 0x1E3500001E36, - 0x1E3700001E38, - 0x1E3900001E3A, - 0x1E3B00001E3C, - 0x1E3D00001E3E, - 0x1E3F00001E40, - 0x1E4100001E42, - 0x1E4300001E44, - 0x1E4500001E46, - 0x1E4700001E48, - 0x1E4900001E4A, - 0x1E4B00001E4C, - 0x1E4D00001E4E, - 0x1E4F00001E50, - 0x1E5100001E52, - 0x1E5300001E54, - 0x1E5500001E56, - 0x1E5700001E58, - 0x1E5900001E5A, - 0x1E5B00001E5C, - 0x1E5D00001E5E, - 0x1E5F00001E60, - 0x1E6100001E62, - 0x1E6300001E64, - 0x1E6500001E66, - 0x1E6700001E68, - 0x1E6900001E6A, - 0x1E6B00001E6C, - 0x1E6D00001E6E, - 0x1E6F00001E70, - 0x1E7100001E72, - 0x1E7300001E74, - 0x1E7500001E76, - 0x1E7700001E78, - 0x1E7900001E7A, - 0x1E7B00001E7C, - 0x1E7D00001E7E, - 0x1E7F00001E80, - 0x1E8100001E82, - 0x1E8300001E84, - 0x1E8500001E86, - 0x1E8700001E88, - 0x1E8900001E8A, - 0x1E8B00001E8C, - 0x1E8D00001E8E, - 0x1E8F00001E90, - 0x1E9100001E92, - 0x1E9300001E94, - 0x1E9500001E9A, - 0x1E9C00001E9E, - 0x1E9F00001EA0, - 0x1EA100001EA2, - 0x1EA300001EA4, - 0x1EA500001EA6, - 0x1EA700001EA8, - 0x1EA900001EAA, - 0x1EAB00001EAC, - 0x1EAD00001EAE, - 0x1EAF00001EB0, - 0x1EB100001EB2, - 0x1EB300001EB4, - 0x1EB500001EB6, - 0x1EB700001EB8, - 0x1EB900001EBA, - 0x1EBB00001EBC, - 0x1EBD00001EBE, - 0x1EBF00001EC0, - 0x1EC100001EC2, - 0x1EC300001EC4, - 0x1EC500001EC6, - 0x1EC700001EC8, - 0x1EC900001ECA, - 0x1ECB00001ECC, - 0x1ECD00001ECE, - 0x1ECF00001ED0, - 0x1ED100001ED2, - 0x1ED300001ED4, - 0x1ED500001ED6, - 0x1ED700001ED8, - 0x1ED900001EDA, - 0x1EDB00001EDC, - 0x1EDD00001EDE, - 0x1EDF00001EE0, - 0x1EE100001EE2, - 0x1EE300001EE4, - 0x1EE500001EE6, - 0x1EE700001EE8, - 0x1EE900001EEA, - 0x1EEB00001EEC, - 0x1EED00001EEE, - 0x1EEF00001EF0, - 0x1EF100001EF2, - 0x1EF300001EF4, - 0x1EF500001EF6, - 0x1EF700001EF8, - 0x1EF900001EFA, - 0x1EFB00001EFC, - 0x1EFD00001EFE, - 0x1EFF00001F08, - 0x1F1000001F16, - 0x1F2000001F28, - 0x1F3000001F38, - 0x1F4000001F46, - 0x1F5000001F58, - 0x1F6000001F68, - 0x1F7000001F71, - 0x1F7200001F73, - 0x1F7400001F75, - 0x1F7600001F77, - 0x1F7800001F79, - 0x1F7A00001F7B, - 0x1F7C00001F7D, - 0x1FB000001FB2, - 0x1FB600001FB7, - 0x1FC600001FC7, - 0x1FD000001FD3, - 0x1FD600001FD8, - 0x1FE000001FE3, - 0x1FE400001FE8, - 0x1FF600001FF7, - 0x214E0000214F, - 0x218400002185, - 0x2C3000002C60, - 0x2C6100002C62, - 0x2C6500002C67, - 0x2C6800002C69, - 0x2C6A00002C6B, - 0x2C6C00002C6D, - 0x2C7100002C72, - 0x2C7300002C75, - 0x2C7600002C7C, - 0x2C8100002C82, - 0x2C8300002C84, - 0x2C8500002C86, - 0x2C8700002C88, - 0x2C8900002C8A, - 0x2C8B00002C8C, - 0x2C8D00002C8E, - 0x2C8F00002C90, - 0x2C9100002C92, - 0x2C9300002C94, - 0x2C9500002C96, - 0x2C9700002C98, - 0x2C9900002C9A, - 0x2C9B00002C9C, - 0x2C9D00002C9E, - 0x2C9F00002CA0, - 0x2CA100002CA2, - 0x2CA300002CA4, - 0x2CA500002CA6, - 0x2CA700002CA8, - 0x2CA900002CAA, - 0x2CAB00002CAC, - 0x2CAD00002CAE, - 0x2CAF00002CB0, - 0x2CB100002CB2, - 0x2CB300002CB4, - 0x2CB500002CB6, - 0x2CB700002CB8, - 0x2CB900002CBA, - 0x2CBB00002CBC, - 0x2CBD00002CBE, - 0x2CBF00002CC0, - 0x2CC100002CC2, - 0x2CC300002CC4, - 0x2CC500002CC6, - 0x2CC700002CC8, - 0x2CC900002CCA, - 0x2CCB00002CCC, - 0x2CCD00002CCE, - 0x2CCF00002CD0, - 0x2CD100002CD2, - 0x2CD300002CD4, - 0x2CD500002CD6, - 0x2CD700002CD8, - 0x2CD900002CDA, - 0x2CDB00002CDC, - 0x2CDD00002CDE, - 0x2CDF00002CE0, - 0x2CE100002CE2, - 0x2CE300002CE5, - 0x2CEC00002CED, - 0x2CEE00002CF2, - 0x2CF300002CF4, - 0x2D0000002D26, - 0x2D2700002D28, - 0x2D2D00002D2E, - 0x2D3000002D68, - 0x2D7F00002D97, - 0x2DA000002DA7, - 0x2DA800002DAF, - 0x2DB000002DB7, - 0x2DB800002DBF, - 0x2DC000002DC7, - 0x2DC800002DCF, - 0x2DD000002DD7, - 0x2DD800002DDF, - 0x2DE000002E00, - 0x2E2F00002E30, - 0x300500003008, - 0x302A0000302E, - 0x303C0000303D, - 0x304100003097, - 0x30990000309B, - 0x309D0000309F, - 0x30A1000030FB, - 0x30FC000030FF, - 0x310500003130, - 0x31A0000031C0, - 0x31F000003200, - 0x340000004DC0, - 0x4E000000A48D, - 0xA4D00000A4FE, - 0xA5000000A60D, - 0xA6100000A62C, - 0xA6410000A642, - 0xA6430000A644, - 0xA6450000A646, - 0xA6470000A648, - 0xA6490000A64A, - 0xA64B0000A64C, - 0xA64D0000A64E, - 0xA64F0000A650, - 0xA6510000A652, - 0xA6530000A654, - 0xA6550000A656, - 0xA6570000A658, - 0xA6590000A65A, - 0xA65B0000A65C, - 0xA65D0000A65E, - 0xA65F0000A660, - 0xA6610000A662, - 0xA6630000A664, - 0xA6650000A666, - 0xA6670000A668, - 0xA6690000A66A, - 0xA66B0000A66C, - 0xA66D0000A670, - 0xA6740000A67E, - 0xA67F0000A680, - 0xA6810000A682, - 0xA6830000A684, - 0xA6850000A686, - 0xA6870000A688, - 0xA6890000A68A, - 0xA68B0000A68C, - 0xA68D0000A68E, - 0xA68F0000A690, - 0xA6910000A692, - 0xA6930000A694, - 0xA6950000A696, - 0xA6970000A698, - 0xA6990000A69A, - 0xA69B0000A69C, - 0xA69E0000A6E6, - 0xA6F00000A6F2, - 0xA7170000A720, - 0xA7230000A724, - 0xA7250000A726, - 0xA7270000A728, - 0xA7290000A72A, - 0xA72B0000A72C, - 0xA72D0000A72E, - 0xA72F0000A732, - 0xA7330000A734, - 0xA7350000A736, - 0xA7370000A738, - 0xA7390000A73A, - 0xA73B0000A73C, - 0xA73D0000A73E, - 0xA73F0000A740, - 0xA7410000A742, - 0xA7430000A744, - 0xA7450000A746, - 0xA7470000A748, - 0xA7490000A74A, - 0xA74B0000A74C, - 0xA74D0000A74E, - 0xA74F0000A750, - 0xA7510000A752, - 0xA7530000A754, - 0xA7550000A756, - 0xA7570000A758, - 0xA7590000A75A, - 0xA75B0000A75C, - 0xA75D0000A75E, - 0xA75F0000A760, - 0xA7610000A762, - 0xA7630000A764, - 0xA7650000A766, - 0xA7670000A768, - 0xA7690000A76A, - 0xA76B0000A76C, - 0xA76D0000A76E, - 0xA76F0000A770, - 0xA7710000A779, - 0xA77A0000A77B, - 0xA77C0000A77D, - 0xA77F0000A780, - 0xA7810000A782, - 0xA7830000A784, - 0xA7850000A786, - 0xA7870000A789, - 0xA78C0000A78D, - 0xA78E0000A790, - 0xA7910000A792, - 0xA7930000A796, - 0xA7970000A798, - 0xA7990000A79A, - 0xA79B0000A79C, - 0xA79D0000A79E, - 0xA79F0000A7A0, - 0xA7A10000A7A2, - 0xA7A30000A7A4, - 0xA7A50000A7A6, - 0xA7A70000A7A8, - 0xA7A90000A7AA, - 0xA7AF0000A7B0, - 0xA7B50000A7B6, - 0xA7B70000A7B8, - 0xA7B90000A7BA, - 0xA7BB0000A7BC, - 0xA7BD0000A7BE, - 0xA7BF0000A7C0, - 0xA7C10000A7C2, - 0xA7C30000A7C4, - 0xA7C80000A7C9, - 0xA7CA0000A7CB, - 0xA7D10000A7D2, - 0xA7D30000A7D4, - 0xA7D50000A7D6, - 0xA7D70000A7D8, - 0xA7D90000A7DA, - 0xA7F60000A7F8, - 0xA7FA0000A828, - 0xA82C0000A82D, - 0xA8400000A874, - 0xA8800000A8C6, - 0xA8D00000A8DA, - 0xA8E00000A8F8, - 0xA8FB0000A8FC, - 0xA8FD0000A92E, - 0xA9300000A954, - 0xA9800000A9C1, - 0xA9CF0000A9DA, - 0xA9E00000A9FF, - 0xAA000000AA37, - 0xAA400000AA4E, - 0xAA500000AA5A, - 0xAA600000AA77, - 0xAA7A0000AAC3, - 0xAADB0000AADE, - 0xAAE00000AAF0, - 0xAAF20000AAF7, - 0xAB010000AB07, - 0xAB090000AB0F, - 0xAB110000AB17, - 0xAB200000AB27, - 0xAB280000AB2F, - 0xAB300000AB5B, - 0xAB600000AB69, - 0xABC00000ABEB, - 0xABEC0000ABEE, - 0xABF00000ABFA, - 0xAC000000D7A4, - 0xFA0E0000FA10, - 0xFA110000FA12, - 0xFA130000FA15, - 0xFA1F0000FA20, - 0xFA210000FA22, - 0xFA230000FA25, - 0xFA270000FA2A, - 0xFB1E0000FB1F, - 0xFE200000FE30, - 0xFE730000FE74, - 0x100000001000C, - 0x1000D00010027, - 0x100280001003B, - 0x1003C0001003E, - 0x1003F0001004E, - 0x100500001005E, - 0x10080000100FB, - 0x101FD000101FE, - 0x102800001029D, - 0x102A0000102D1, - 0x102E0000102E1, - 0x1030000010320, - 0x1032D00010341, - 0x103420001034A, - 0x103500001037B, - 0x103800001039E, - 0x103A0000103C4, - 0x103C8000103D0, - 0x104280001049E, - 0x104A0000104AA, - 0x104D8000104FC, - 0x1050000010528, - 0x1053000010564, - 0x10597000105A2, - 0x105A3000105B2, - 0x105B3000105BA, - 0x105BB000105BD, - 0x1060000010737, - 0x1074000010756, - 0x1076000010768, - 0x1078000010781, - 0x1080000010806, - 0x1080800010809, - 0x1080A00010836, - 0x1083700010839, - 0x1083C0001083D, - 0x1083F00010856, - 0x1086000010877, - 0x108800001089F, - 0x108E0000108F3, - 0x108F4000108F6, - 0x1090000010916, - 0x109200001093A, - 0x10980000109B8, - 0x109BE000109C0, - 0x10A0000010A04, - 0x10A0500010A07, - 0x10A0C00010A14, - 0x10A1500010A18, - 0x10A1900010A36, - 0x10A3800010A3B, - 0x10A3F00010A40, - 0x10A6000010A7D, - 0x10A8000010A9D, - 0x10AC000010AC8, - 0x10AC900010AE7, - 0x10B0000010B36, - 0x10B4000010B56, - 0x10B6000010B73, - 0x10B8000010B92, - 0x10C0000010C49, - 0x10CC000010CF3, - 0x10D0000010D28, - 0x10D3000010D3A, - 0x10E8000010EAA, - 0x10EAB00010EAD, - 0x10EB000010EB2, - 0x10EFD00010F1D, - 0x10F2700010F28, - 0x10F3000010F51, - 0x10F7000010F86, - 0x10FB000010FC5, - 0x10FE000010FF7, - 0x1100000011047, - 0x1106600011076, - 0x1107F000110BB, - 0x110C2000110C3, - 0x110D0000110E9, - 0x110F0000110FA, - 0x1110000011135, - 0x1113600011140, - 0x1114400011148, - 0x1115000011174, - 0x1117600011177, - 0x11180000111C5, - 0x111C9000111CD, - 0x111CE000111DB, - 0x111DC000111DD, - 0x1120000011212, - 0x1121300011238, - 0x1123E00011242, - 0x1128000011287, - 0x1128800011289, - 0x1128A0001128E, - 0x1128F0001129E, - 0x1129F000112A9, - 0x112B0000112EB, - 0x112F0000112FA, - 0x1130000011304, - 0x113050001130D, - 0x1130F00011311, - 0x1131300011329, - 0x1132A00011331, - 0x1133200011334, - 0x113350001133A, - 0x1133B00011345, - 0x1134700011349, - 0x1134B0001134E, - 0x1135000011351, - 0x1135700011358, - 0x1135D00011364, - 0x113660001136D, - 0x1137000011375, - 0x114000001144B, - 0x114500001145A, - 0x1145E00011462, - 0x11480000114C6, - 0x114C7000114C8, - 0x114D0000114DA, - 0x11580000115B6, - 0x115B8000115C1, - 0x115D8000115DE, - 0x1160000011641, - 0x1164400011645, - 0x116500001165A, - 0x11680000116B9, - 0x116C0000116CA, - 0x117000001171B, - 0x1171D0001172C, - 0x117300001173A, - 0x1174000011747, - 0x118000001183B, - 0x118C0000118EA, - 0x118FF00011907, - 0x119090001190A, - 0x1190C00011914, - 0x1191500011917, - 0x1191800011936, - 0x1193700011939, - 0x1193B00011944, - 0x119500001195A, - 0x119A0000119A8, - 0x119AA000119D8, - 0x119DA000119E2, - 0x119E3000119E5, - 0x11A0000011A3F, - 0x11A4700011A48, - 0x11A5000011A9A, - 0x11A9D00011A9E, - 0x11AB000011AF9, - 0x11C0000011C09, - 0x11C0A00011C37, - 0x11C3800011C41, - 0x11C5000011C5A, - 0x11C7200011C90, - 0x11C9200011CA8, - 0x11CA900011CB7, - 0x11D0000011D07, - 0x11D0800011D0A, - 0x11D0B00011D37, - 0x11D3A00011D3B, - 0x11D3C00011D3E, - 0x11D3F00011D48, - 0x11D5000011D5A, - 0x11D6000011D66, - 0x11D6700011D69, - 0x11D6A00011D8F, - 0x11D9000011D92, - 0x11D9300011D99, - 0x11DA000011DAA, - 0x11EE000011EF7, - 0x11F0000011F11, - 0x11F1200011F3B, - 0x11F3E00011F43, - 0x11F5000011F5A, - 0x11FB000011FB1, - 0x120000001239A, - 0x1248000012544, - 0x12F9000012FF1, - 0x1300000013430, - 0x1344000013456, - 0x1440000014647, - 0x1680000016A39, - 0x16A4000016A5F, - 0x16A6000016A6A, - 0x16A7000016ABF, - 0x16AC000016ACA, - 0x16AD000016AEE, - 0x16AF000016AF5, - 0x16B0000016B37, - 0x16B4000016B44, - 0x16B5000016B5A, - 0x16B6300016B78, - 0x16B7D00016B90, - 0x16E6000016E80, - 0x16F0000016F4B, - 0x16F4F00016F88, - 0x16F8F00016FA0, - 0x16FE000016FE2, - 0x16FE300016FE5, - 0x16FF000016FF2, - 0x17000000187F8, - 0x1880000018CD6, - 0x18D0000018D09, - 0x1AFF00001AFF4, - 0x1AFF50001AFFC, - 0x1AFFD0001AFFF, - 0x1B0000001B123, - 0x1B1320001B133, - 0x1B1500001B153, - 0x1B1550001B156, - 0x1B1640001B168, - 0x1B1700001B2FC, - 0x1BC000001BC6B, - 0x1BC700001BC7D, - 0x1BC800001BC89, - 0x1BC900001BC9A, - 0x1BC9D0001BC9F, - 0x1CF000001CF2E, - 0x1CF300001CF47, - 0x1DA000001DA37, - 0x1DA3B0001DA6D, - 0x1DA750001DA76, - 0x1DA840001DA85, - 0x1DA9B0001DAA0, - 0x1DAA10001DAB0, - 0x1DF000001DF1F, - 0x1DF250001DF2B, - 0x1E0000001E007, - 0x1E0080001E019, - 0x1E01B0001E022, - 0x1E0230001E025, - 0x1E0260001E02B, - 0x1E08F0001E090, - 0x1E1000001E12D, - 0x1E1300001E13E, - 0x1E1400001E14A, - 0x1E14E0001E14F, - 0x1E2900001E2AF, - 0x1E2C00001E2FA, - 0x1E4D00001E4FA, - 0x1E7E00001E7E7, - 0x1E7E80001E7EC, - 0x1E7ED0001E7EF, - 0x1E7F00001E7FF, - 0x1E8000001E8C5, - 0x1E8D00001E8D7, - 0x1E9220001E94C, - 0x1E9500001E95A, - 0x200000002A6E0, - 0x2A7000002B73A, - 0x2B7400002B81E, - 0x2B8200002CEA2, - 0x2CEB00002EBE1, - 0x2EBF00002EE5E, - 0x300000003134B, - 0x31350000323B0, - ), - "CONTEXTJ": (0x200C0000200E,), - "CONTEXTO": ( - 0xB7000000B8, - 0x37500000376, - 0x5F3000005F5, - 0x6600000066A, - 0x6F0000006FA, - 0x30FB000030FC, - ), -} diff --git a/write-message/venv/lib/python3.10/site-packages/idna/intranges.py b/write-message/venv/lib/python3.10/site-packages/idna/intranges.py deleted file mode 100644 index 7bfaa8d..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/intranges.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Given a list of integers, made up of (hopefully) a small number of long runs -of consecutive integers, compute a representation of the form -((start1, end1), (start2, end2) ...). Then answer the question "was x present -in the original list?" in time O(log(# runs)). -""" - -import bisect -from typing import List, Tuple - - -def intranges_from_list(list_: List[int]) -> Tuple[int, ...]: - """Represent a list of integers as a sequence of ranges: - ((start_0, end_0), (start_1, end_1), ...), such that the original - integers are exactly those x such that start_i <= x < end_i for some i. - - Ranges are encoded as single integers (start << 32 | end), not as tuples. - """ - - sorted_list = sorted(list_) - ranges = [] - last_write = -1 - for i in range(len(sorted_list)): - if i + 1 < len(sorted_list): - if sorted_list[i] == sorted_list[i + 1] - 1: - continue - current_range = sorted_list[last_write + 1 : i + 1] - ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) - last_write = i - - return tuple(ranges) - - -def _encode_range(start: int, end: int) -> int: - return (start << 32) | end - - -def _decode_range(r: int) -> Tuple[int, int]: - return (r >> 32), (r & ((1 << 32) - 1)) - - -def intranges_contain(int_: int, ranges: Tuple[int, ...]) -> bool: - """Determine if `int_` falls into one of the ranges in `ranges`.""" - tuple_ = _encode_range(int_, 0) - pos = bisect.bisect_left(ranges, tuple_) - # we could be immediately ahead of a tuple (start, end) - # with start < int_ <= end - if pos > 0: - left, right = _decode_range(ranges[pos - 1]) - if left <= int_ < right: - return True - # or we could be immediately behind a tuple (int_, end) - if pos < len(ranges): - left, _ = _decode_range(ranges[pos]) - if left == int_: - return True - return False diff --git a/write-message/venv/lib/python3.10/site-packages/idna/package_data.py b/write-message/venv/lib/python3.10/site-packages/idna/package_data.py deleted file mode 100644 index 514ff7e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/package_data.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "3.10" diff --git a/write-message/venv/lib/python3.10/site-packages/idna/py.typed b/write-message/venv/lib/python3.10/site-packages/idna/py.typed deleted file mode 100644 index e69de29..0000000 diff --git a/write-message/venv/lib/python3.10/site-packages/idna/uts46data.py b/write-message/venv/lib/python3.10/site-packages/idna/uts46data.py deleted file mode 100644 index eb89432..0000000 --- a/write-message/venv/lib/python3.10/site-packages/idna/uts46data.py +++ /dev/null @@ -1,8681 +0,0 @@ -# This file is automatically generated by tools/idna-data -# vim: set fileencoding=utf-8 : - -from typing import List, Tuple, Union - -"""IDNA Mapping Table from UTS46.""" - - -__version__ = "15.1.0" - - -def _seg_0() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x0, "3"), - (0x1, "3"), - (0x2, "3"), - (0x3, "3"), - (0x4, "3"), - (0x5, "3"), - (0x6, "3"), - (0x7, "3"), - (0x8, "3"), - (0x9, "3"), - (0xA, "3"), - (0xB, "3"), - (0xC, "3"), - (0xD, "3"), - (0xE, "3"), - (0xF, "3"), - (0x10, "3"), - (0x11, "3"), - (0x12, "3"), - (0x13, "3"), - (0x14, "3"), - (0x15, "3"), - (0x16, "3"), - (0x17, "3"), - (0x18, "3"), - (0x19, "3"), - (0x1A, "3"), - (0x1B, "3"), - (0x1C, "3"), - (0x1D, "3"), - (0x1E, "3"), - (0x1F, "3"), - (0x20, "3"), - (0x21, "3"), - (0x22, "3"), - (0x23, "3"), - (0x24, "3"), - (0x25, "3"), - (0x26, "3"), - (0x27, "3"), - (0x28, "3"), - (0x29, "3"), - (0x2A, "3"), - (0x2B, "3"), - (0x2C, "3"), - (0x2D, "V"), - (0x2E, "V"), - (0x2F, "3"), - (0x30, "V"), - (0x31, "V"), - (0x32, "V"), - (0x33, "V"), - (0x34, "V"), - (0x35, "V"), - (0x36, "V"), - (0x37, "V"), - (0x38, "V"), - (0x39, "V"), - (0x3A, "3"), - (0x3B, "3"), - (0x3C, "3"), - (0x3D, "3"), - (0x3E, "3"), - (0x3F, "3"), - (0x40, "3"), - (0x41, "M", "a"), - (0x42, "M", "b"), - (0x43, "M", "c"), - (0x44, "M", "d"), - (0x45, "M", "e"), - (0x46, "M", "f"), - (0x47, "M", "g"), - (0x48, "M", "h"), - (0x49, "M", "i"), - (0x4A, "M", "j"), - (0x4B, "M", "k"), - (0x4C, "M", "l"), - (0x4D, "M", "m"), - (0x4E, "M", "n"), - (0x4F, "M", "o"), - (0x50, "M", "p"), - (0x51, "M", "q"), - (0x52, "M", "r"), - (0x53, "M", "s"), - (0x54, "M", "t"), - (0x55, "M", "u"), - (0x56, "M", "v"), - (0x57, "M", "w"), - (0x58, "M", "x"), - (0x59, "M", "y"), - (0x5A, "M", "z"), - (0x5B, "3"), - (0x5C, "3"), - (0x5D, "3"), - (0x5E, "3"), - (0x5F, "3"), - (0x60, "3"), - (0x61, "V"), - (0x62, "V"), - (0x63, "V"), - ] - - -def _seg_1() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x64, "V"), - (0x65, "V"), - (0x66, "V"), - (0x67, "V"), - (0x68, "V"), - (0x69, "V"), - (0x6A, "V"), - (0x6B, "V"), - (0x6C, "V"), - (0x6D, "V"), - (0x6E, "V"), - (0x6F, "V"), - (0x70, "V"), - (0x71, "V"), - (0x72, "V"), - (0x73, "V"), - (0x74, "V"), - (0x75, "V"), - (0x76, "V"), - (0x77, "V"), - (0x78, "V"), - (0x79, "V"), - (0x7A, "V"), - (0x7B, "3"), - (0x7C, "3"), - (0x7D, "3"), - (0x7E, "3"), - (0x7F, "3"), - (0x80, "X"), - (0x81, "X"), - (0x82, "X"), - (0x83, "X"), - (0x84, "X"), - (0x85, "X"), - (0x86, "X"), - (0x87, "X"), - (0x88, "X"), - (0x89, "X"), - (0x8A, "X"), - (0x8B, "X"), - (0x8C, "X"), - (0x8D, "X"), - (0x8E, "X"), - (0x8F, "X"), - (0x90, "X"), - (0x91, "X"), - (0x92, "X"), - (0x93, "X"), - (0x94, "X"), - (0x95, "X"), - (0x96, "X"), - (0x97, "X"), - (0x98, "X"), - (0x99, "X"), - (0x9A, "X"), - (0x9B, "X"), - (0x9C, "X"), - (0x9D, "X"), - (0x9E, "X"), - (0x9F, "X"), - (0xA0, "3", " "), - (0xA1, "V"), - (0xA2, "V"), - (0xA3, "V"), - (0xA4, "V"), - (0xA5, "V"), - (0xA6, "V"), - (0xA7, "V"), - (0xA8, "3", " ̈"), - (0xA9, "V"), - (0xAA, "M", "a"), - (0xAB, "V"), - (0xAC, "V"), - (0xAD, "I"), - (0xAE, "V"), - (0xAF, "3", " ̄"), - (0xB0, "V"), - (0xB1, "V"), - (0xB2, "M", "2"), - (0xB3, "M", "3"), - (0xB4, "3", " ́"), - (0xB5, "M", "μ"), - (0xB6, "V"), - (0xB7, "V"), - (0xB8, "3", " ̧"), - (0xB9, "M", "1"), - (0xBA, "M", "o"), - (0xBB, "V"), - (0xBC, "M", "1⁄4"), - (0xBD, "M", "1⁄2"), - (0xBE, "M", "3⁄4"), - (0xBF, "V"), - (0xC0, "M", "à"), - (0xC1, "M", "á"), - (0xC2, "M", "â"), - (0xC3, "M", "ã"), - (0xC4, "M", "ä"), - (0xC5, "M", "å"), - (0xC6, "M", "æ"), - (0xC7, "M", "ç"), - ] - - -def _seg_2() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xC8, "M", "è"), - (0xC9, "M", "é"), - (0xCA, "M", "ê"), - (0xCB, "M", "ë"), - (0xCC, "M", "ì"), - (0xCD, "M", "í"), - (0xCE, "M", "î"), - (0xCF, "M", "ï"), - (0xD0, "M", "ð"), - (0xD1, "M", "ñ"), - (0xD2, "M", "ò"), - (0xD3, "M", "ó"), - (0xD4, "M", "ô"), - (0xD5, "M", "õ"), - (0xD6, "M", "ö"), - (0xD7, "V"), - (0xD8, "M", "ø"), - (0xD9, "M", "ù"), - (0xDA, "M", "ú"), - (0xDB, "M", "û"), - (0xDC, "M", "ü"), - (0xDD, "M", "ý"), - (0xDE, "M", "þ"), - (0xDF, "D", "ss"), - (0xE0, "V"), - (0xE1, "V"), - (0xE2, "V"), - (0xE3, "V"), - (0xE4, "V"), - (0xE5, "V"), - (0xE6, "V"), - (0xE7, "V"), - (0xE8, "V"), - (0xE9, "V"), - (0xEA, "V"), - (0xEB, "V"), - (0xEC, "V"), - (0xED, "V"), - (0xEE, "V"), - (0xEF, "V"), - (0xF0, "V"), - (0xF1, "V"), - (0xF2, "V"), - (0xF3, "V"), - (0xF4, "V"), - (0xF5, "V"), - (0xF6, "V"), - (0xF7, "V"), - (0xF8, "V"), - (0xF9, "V"), - (0xFA, "V"), - (0xFB, "V"), - (0xFC, "V"), - (0xFD, "V"), - (0xFE, "V"), - (0xFF, "V"), - (0x100, "M", "ā"), - (0x101, "V"), - (0x102, "M", "ă"), - (0x103, "V"), - (0x104, "M", "ą"), - (0x105, "V"), - (0x106, "M", "ć"), - (0x107, "V"), - (0x108, "M", "ĉ"), - (0x109, "V"), - (0x10A, "M", "ċ"), - (0x10B, "V"), - (0x10C, "M", "č"), - (0x10D, "V"), - (0x10E, "M", "ď"), - (0x10F, "V"), - (0x110, "M", "đ"), - (0x111, "V"), - (0x112, "M", "ē"), - (0x113, "V"), - (0x114, "M", "ĕ"), - (0x115, "V"), - (0x116, "M", "ė"), - (0x117, "V"), - (0x118, "M", "ę"), - (0x119, "V"), - (0x11A, "M", "ě"), - (0x11B, "V"), - (0x11C, "M", "ĝ"), - (0x11D, "V"), - (0x11E, "M", "ğ"), - (0x11F, "V"), - (0x120, "M", "ġ"), - (0x121, "V"), - (0x122, "M", "ģ"), - (0x123, "V"), - (0x124, "M", "ĥ"), - (0x125, "V"), - (0x126, "M", "ħ"), - (0x127, "V"), - (0x128, "M", "ĩ"), - (0x129, "V"), - (0x12A, "M", "ī"), - (0x12B, "V"), - ] - - -def _seg_3() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x12C, "M", "ĭ"), - (0x12D, "V"), - (0x12E, "M", "į"), - (0x12F, "V"), - (0x130, "M", "i̇"), - (0x131, "V"), - (0x132, "M", "ij"), - (0x134, "M", "ĵ"), - (0x135, "V"), - (0x136, "M", "ķ"), - (0x137, "V"), - (0x139, "M", "ĺ"), - (0x13A, "V"), - (0x13B, "M", "ļ"), - (0x13C, "V"), - (0x13D, "M", "ľ"), - (0x13E, "V"), - (0x13F, "M", "l·"), - (0x141, "M", "ł"), - (0x142, "V"), - (0x143, "M", "ń"), - (0x144, "V"), - (0x145, "M", "ņ"), - (0x146, "V"), - (0x147, "M", "ň"), - (0x148, "V"), - (0x149, "M", "ʼn"), - (0x14A, "M", "ŋ"), - (0x14B, "V"), - (0x14C, "M", "ō"), - (0x14D, "V"), - (0x14E, "M", "ŏ"), - (0x14F, "V"), - (0x150, "M", "ő"), - (0x151, "V"), - (0x152, "M", "œ"), - (0x153, "V"), - (0x154, "M", "ŕ"), - (0x155, "V"), - (0x156, "M", "ŗ"), - (0x157, "V"), - (0x158, "M", "ř"), - (0x159, "V"), - (0x15A, "M", "ś"), - (0x15B, "V"), - (0x15C, "M", "ŝ"), - (0x15D, "V"), - (0x15E, "M", "ş"), - (0x15F, "V"), - (0x160, "M", "š"), - (0x161, "V"), - (0x162, "M", "ţ"), - (0x163, "V"), - (0x164, "M", "ť"), - (0x165, "V"), - (0x166, "M", "ŧ"), - (0x167, "V"), - (0x168, "M", "ũ"), - (0x169, "V"), - (0x16A, "M", "ū"), - (0x16B, "V"), - (0x16C, "M", "ŭ"), - (0x16D, "V"), - (0x16E, "M", "ů"), - (0x16F, "V"), - (0x170, "M", "ű"), - (0x171, "V"), - (0x172, "M", "ų"), - (0x173, "V"), - (0x174, "M", "ŵ"), - (0x175, "V"), - (0x176, "M", "ŷ"), - (0x177, "V"), - (0x178, "M", "ÿ"), - (0x179, "M", "ź"), - (0x17A, "V"), - (0x17B, "M", "ż"), - (0x17C, "V"), - (0x17D, "M", "ž"), - (0x17E, "V"), - (0x17F, "M", "s"), - (0x180, "V"), - (0x181, "M", "ɓ"), - (0x182, "M", "ƃ"), - (0x183, "V"), - (0x184, "M", "ƅ"), - (0x185, "V"), - (0x186, "M", "ɔ"), - (0x187, "M", "ƈ"), - (0x188, "V"), - (0x189, "M", "ɖ"), - (0x18A, "M", "ɗ"), - (0x18B, "M", "ƌ"), - (0x18C, "V"), - (0x18E, "M", "ǝ"), - (0x18F, "M", "ə"), - (0x190, "M", "ɛ"), - (0x191, "M", "ƒ"), - (0x192, "V"), - (0x193, "M", "ɠ"), - ] - - -def _seg_4() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x194, "M", "ɣ"), - (0x195, "V"), - (0x196, "M", "ɩ"), - (0x197, "M", "ɨ"), - (0x198, "M", "ƙ"), - (0x199, "V"), - (0x19C, "M", "ɯ"), - (0x19D, "M", "ɲ"), - (0x19E, "V"), - (0x19F, "M", "ɵ"), - (0x1A0, "M", "ơ"), - (0x1A1, "V"), - (0x1A2, "M", "ƣ"), - (0x1A3, "V"), - (0x1A4, "M", "ƥ"), - (0x1A5, "V"), - (0x1A6, "M", "ʀ"), - (0x1A7, "M", "ƨ"), - (0x1A8, "V"), - (0x1A9, "M", "ʃ"), - (0x1AA, "V"), - (0x1AC, "M", "ƭ"), - (0x1AD, "V"), - (0x1AE, "M", "ʈ"), - (0x1AF, "M", "ư"), - (0x1B0, "V"), - (0x1B1, "M", "ʊ"), - (0x1B2, "M", "ʋ"), - (0x1B3, "M", "ƴ"), - (0x1B4, "V"), - (0x1B5, "M", "ƶ"), - (0x1B6, "V"), - (0x1B7, "M", "ʒ"), - (0x1B8, "M", "ƹ"), - (0x1B9, "V"), - (0x1BC, "M", "ƽ"), - (0x1BD, "V"), - (0x1C4, "M", "dž"), - (0x1C7, "M", "lj"), - (0x1CA, "M", "nj"), - (0x1CD, "M", "ǎ"), - (0x1CE, "V"), - (0x1CF, "M", "ǐ"), - (0x1D0, "V"), - (0x1D1, "M", "ǒ"), - (0x1D2, "V"), - (0x1D3, "M", "ǔ"), - (0x1D4, "V"), - (0x1D5, "M", "ǖ"), - (0x1D6, "V"), - (0x1D7, "M", "ǘ"), - (0x1D8, "V"), - (0x1D9, "M", "ǚ"), - (0x1DA, "V"), - (0x1DB, "M", "ǜ"), - (0x1DC, "V"), - (0x1DE, "M", "ǟ"), - (0x1DF, "V"), - (0x1E0, "M", "ǡ"), - (0x1E1, "V"), - (0x1E2, "M", "ǣ"), - (0x1E3, "V"), - (0x1E4, "M", "ǥ"), - (0x1E5, "V"), - (0x1E6, "M", "ǧ"), - (0x1E7, "V"), - (0x1E8, "M", "ǩ"), - (0x1E9, "V"), - (0x1EA, "M", "ǫ"), - (0x1EB, "V"), - (0x1EC, "M", "ǭ"), - (0x1ED, "V"), - (0x1EE, "M", "ǯ"), - (0x1EF, "V"), - (0x1F1, "M", "dz"), - (0x1F4, "M", "ǵ"), - (0x1F5, "V"), - (0x1F6, "M", "ƕ"), - (0x1F7, "M", "ƿ"), - (0x1F8, "M", "ǹ"), - (0x1F9, "V"), - (0x1FA, "M", "ǻ"), - (0x1FB, "V"), - (0x1FC, "M", "ǽ"), - (0x1FD, "V"), - (0x1FE, "M", "ǿ"), - (0x1FF, "V"), - (0x200, "M", "ȁ"), - (0x201, "V"), - (0x202, "M", "ȃ"), - (0x203, "V"), - (0x204, "M", "ȅ"), - (0x205, "V"), - (0x206, "M", "ȇ"), - (0x207, "V"), - (0x208, "M", "ȉ"), - (0x209, "V"), - (0x20A, "M", "ȋ"), - (0x20B, "V"), - (0x20C, "M", "ȍ"), - ] - - -def _seg_5() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x20D, "V"), - (0x20E, "M", "ȏ"), - (0x20F, "V"), - (0x210, "M", "ȑ"), - (0x211, "V"), - (0x212, "M", "ȓ"), - (0x213, "V"), - (0x214, "M", "ȕ"), - (0x215, "V"), - (0x216, "M", "ȗ"), - (0x217, "V"), - (0x218, "M", "ș"), - (0x219, "V"), - (0x21A, "M", "ț"), - (0x21B, "V"), - (0x21C, "M", "ȝ"), - (0x21D, "V"), - (0x21E, "M", "ȟ"), - (0x21F, "V"), - (0x220, "M", "ƞ"), - (0x221, "V"), - (0x222, "M", "ȣ"), - (0x223, "V"), - (0x224, "M", "ȥ"), - (0x225, "V"), - (0x226, "M", "ȧ"), - (0x227, "V"), - (0x228, "M", "ȩ"), - (0x229, "V"), - (0x22A, "M", "ȫ"), - (0x22B, "V"), - (0x22C, "M", "ȭ"), - (0x22D, "V"), - (0x22E, "M", "ȯ"), - (0x22F, "V"), - (0x230, "M", "ȱ"), - (0x231, "V"), - (0x232, "M", "ȳ"), - (0x233, "V"), - (0x23A, "M", "ⱥ"), - (0x23B, "M", "ȼ"), - (0x23C, "V"), - (0x23D, "M", "ƚ"), - (0x23E, "M", "ⱦ"), - (0x23F, "V"), - (0x241, "M", "ɂ"), - (0x242, "V"), - (0x243, "M", "ƀ"), - (0x244, "M", "ʉ"), - (0x245, "M", "ʌ"), - (0x246, "M", "ɇ"), - (0x247, "V"), - (0x248, "M", "ɉ"), - (0x249, "V"), - (0x24A, "M", "ɋ"), - (0x24B, "V"), - (0x24C, "M", "ɍ"), - (0x24D, "V"), - (0x24E, "M", "ɏ"), - (0x24F, "V"), - (0x2B0, "M", "h"), - (0x2B1, "M", "ɦ"), - (0x2B2, "M", "j"), - (0x2B3, "M", "r"), - (0x2B4, "M", "ɹ"), - (0x2B5, "M", "ɻ"), - (0x2B6, "M", "ʁ"), - (0x2B7, "M", "w"), - (0x2B8, "M", "y"), - (0x2B9, "V"), - (0x2D8, "3", " ̆"), - (0x2D9, "3", " ̇"), - (0x2DA, "3", " ̊"), - (0x2DB, "3", " ̨"), - (0x2DC, "3", " ̃"), - (0x2DD, "3", " ̋"), - (0x2DE, "V"), - (0x2E0, "M", "ɣ"), - (0x2E1, "M", "l"), - (0x2E2, "M", "s"), - (0x2E3, "M", "x"), - (0x2E4, "M", "ʕ"), - (0x2E5, "V"), - (0x340, "M", "̀"), - (0x341, "M", "́"), - (0x342, "V"), - (0x343, "M", "̓"), - (0x344, "M", "̈́"), - (0x345, "M", "ι"), - (0x346, "V"), - (0x34F, "I"), - (0x350, "V"), - (0x370, "M", "ͱ"), - (0x371, "V"), - (0x372, "M", "ͳ"), - (0x373, "V"), - (0x374, "M", "ʹ"), - (0x375, "V"), - (0x376, "M", "ͷ"), - (0x377, "V"), - ] - - -def _seg_6() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x378, "X"), - (0x37A, "3", " ι"), - (0x37B, "V"), - (0x37E, "3", ";"), - (0x37F, "M", "ϳ"), - (0x380, "X"), - (0x384, "3", " ́"), - (0x385, "3", " ̈́"), - (0x386, "M", "ά"), - (0x387, "M", "·"), - (0x388, "M", "έ"), - (0x389, "M", "ή"), - (0x38A, "M", "ί"), - (0x38B, "X"), - (0x38C, "M", "ό"), - (0x38D, "X"), - (0x38E, "M", "ύ"), - (0x38F, "M", "ώ"), - (0x390, "V"), - (0x391, "M", "α"), - (0x392, "M", "β"), - (0x393, "M", "γ"), - (0x394, "M", "δ"), - (0x395, "M", "ε"), - (0x396, "M", "ζ"), - (0x397, "M", "η"), - (0x398, "M", "θ"), - (0x399, "M", "ι"), - (0x39A, "M", "κ"), - (0x39B, "M", "λ"), - (0x39C, "M", "μ"), - (0x39D, "M", "ν"), - (0x39E, "M", "ξ"), - (0x39F, "M", "ο"), - (0x3A0, "M", "π"), - (0x3A1, "M", "ρ"), - (0x3A2, "X"), - (0x3A3, "M", "σ"), - (0x3A4, "M", "τ"), - (0x3A5, "M", "υ"), - (0x3A6, "M", "φ"), - (0x3A7, "M", "χ"), - (0x3A8, "M", "ψ"), - (0x3A9, "M", "ω"), - (0x3AA, "M", "ϊ"), - (0x3AB, "M", "ϋ"), - (0x3AC, "V"), - (0x3C2, "D", "σ"), - (0x3C3, "V"), - (0x3CF, "M", "ϗ"), - (0x3D0, "M", "β"), - (0x3D1, "M", "θ"), - (0x3D2, "M", "υ"), - (0x3D3, "M", "ύ"), - (0x3D4, "M", "ϋ"), - (0x3D5, "M", "φ"), - (0x3D6, "M", "π"), - (0x3D7, "V"), - (0x3D8, "M", "ϙ"), - (0x3D9, "V"), - (0x3DA, "M", "ϛ"), - (0x3DB, "V"), - (0x3DC, "M", "ϝ"), - (0x3DD, "V"), - (0x3DE, "M", "ϟ"), - (0x3DF, "V"), - (0x3E0, "M", "ϡ"), - (0x3E1, "V"), - (0x3E2, "M", "ϣ"), - (0x3E3, "V"), - (0x3E4, "M", "ϥ"), - (0x3E5, "V"), - (0x3E6, "M", "ϧ"), - (0x3E7, "V"), - (0x3E8, "M", "ϩ"), - (0x3E9, "V"), - (0x3EA, "M", "ϫ"), - (0x3EB, "V"), - (0x3EC, "M", "ϭ"), - (0x3ED, "V"), - (0x3EE, "M", "ϯ"), - (0x3EF, "V"), - (0x3F0, "M", "κ"), - (0x3F1, "M", "ρ"), - (0x3F2, "M", "σ"), - (0x3F3, "V"), - (0x3F4, "M", "θ"), - (0x3F5, "M", "ε"), - (0x3F6, "V"), - (0x3F7, "M", "ϸ"), - (0x3F8, "V"), - (0x3F9, "M", "σ"), - (0x3FA, "M", "ϻ"), - (0x3FB, "V"), - (0x3FD, "M", "ͻ"), - (0x3FE, "M", "ͼ"), - (0x3FF, "M", "ͽ"), - (0x400, "M", "ѐ"), - (0x401, "M", "ё"), - (0x402, "M", "ђ"), - ] - - -def _seg_7() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x403, "M", "ѓ"), - (0x404, "M", "є"), - (0x405, "M", "ѕ"), - (0x406, "M", "і"), - (0x407, "M", "ї"), - (0x408, "M", "ј"), - (0x409, "M", "љ"), - (0x40A, "M", "њ"), - (0x40B, "M", "ћ"), - (0x40C, "M", "ќ"), - (0x40D, "M", "ѝ"), - (0x40E, "M", "ў"), - (0x40F, "M", "џ"), - (0x410, "M", "а"), - (0x411, "M", "б"), - (0x412, "M", "в"), - (0x413, "M", "г"), - (0x414, "M", "д"), - (0x415, "M", "е"), - (0x416, "M", "ж"), - (0x417, "M", "з"), - (0x418, "M", "и"), - (0x419, "M", "й"), - (0x41A, "M", "к"), - (0x41B, "M", "л"), - (0x41C, "M", "м"), - (0x41D, "M", "н"), - (0x41E, "M", "о"), - (0x41F, "M", "п"), - (0x420, "M", "р"), - (0x421, "M", "с"), - (0x422, "M", "т"), - (0x423, "M", "у"), - (0x424, "M", "ф"), - (0x425, "M", "х"), - (0x426, "M", "ц"), - (0x427, "M", "ч"), - (0x428, "M", "ш"), - (0x429, "M", "щ"), - (0x42A, "M", "ъ"), - (0x42B, "M", "ы"), - (0x42C, "M", "ь"), - (0x42D, "M", "э"), - (0x42E, "M", "ю"), - (0x42F, "M", "я"), - (0x430, "V"), - (0x460, "M", "ѡ"), - (0x461, "V"), - (0x462, "M", "ѣ"), - (0x463, "V"), - (0x464, "M", "ѥ"), - (0x465, "V"), - (0x466, "M", "ѧ"), - (0x467, "V"), - (0x468, "M", "ѩ"), - (0x469, "V"), - (0x46A, "M", "ѫ"), - (0x46B, "V"), - (0x46C, "M", "ѭ"), - (0x46D, "V"), - (0x46E, "M", "ѯ"), - (0x46F, "V"), - (0x470, "M", "ѱ"), - (0x471, "V"), - (0x472, "M", "ѳ"), - (0x473, "V"), - (0x474, "M", "ѵ"), - (0x475, "V"), - (0x476, "M", "ѷ"), - (0x477, "V"), - (0x478, "M", "ѹ"), - (0x479, "V"), - (0x47A, "M", "ѻ"), - (0x47B, "V"), - (0x47C, "M", "ѽ"), - (0x47D, "V"), - (0x47E, "M", "ѿ"), - (0x47F, "V"), - (0x480, "M", "ҁ"), - (0x481, "V"), - (0x48A, "M", "ҋ"), - (0x48B, "V"), - (0x48C, "M", "ҍ"), - (0x48D, "V"), - (0x48E, "M", "ҏ"), - (0x48F, "V"), - (0x490, "M", "ґ"), - (0x491, "V"), - (0x492, "M", "ғ"), - (0x493, "V"), - (0x494, "M", "ҕ"), - (0x495, "V"), - (0x496, "M", "җ"), - (0x497, "V"), - (0x498, "M", "ҙ"), - (0x499, "V"), - (0x49A, "M", "қ"), - (0x49B, "V"), - (0x49C, "M", "ҝ"), - (0x49D, "V"), - ] - - -def _seg_8() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x49E, "M", "ҟ"), - (0x49F, "V"), - (0x4A0, "M", "ҡ"), - (0x4A1, "V"), - (0x4A2, "M", "ң"), - (0x4A3, "V"), - (0x4A4, "M", "ҥ"), - (0x4A5, "V"), - (0x4A6, "M", "ҧ"), - (0x4A7, "V"), - (0x4A8, "M", "ҩ"), - (0x4A9, "V"), - (0x4AA, "M", "ҫ"), - (0x4AB, "V"), - (0x4AC, "M", "ҭ"), - (0x4AD, "V"), - (0x4AE, "M", "ү"), - (0x4AF, "V"), - (0x4B0, "M", "ұ"), - (0x4B1, "V"), - (0x4B2, "M", "ҳ"), - (0x4B3, "V"), - (0x4B4, "M", "ҵ"), - (0x4B5, "V"), - (0x4B6, "M", "ҷ"), - (0x4B7, "V"), - (0x4B8, "M", "ҹ"), - (0x4B9, "V"), - (0x4BA, "M", "һ"), - (0x4BB, "V"), - (0x4BC, "M", "ҽ"), - (0x4BD, "V"), - (0x4BE, "M", "ҿ"), - (0x4BF, "V"), - (0x4C0, "X"), - (0x4C1, "M", "ӂ"), - (0x4C2, "V"), - (0x4C3, "M", "ӄ"), - (0x4C4, "V"), - (0x4C5, "M", "ӆ"), - (0x4C6, "V"), - (0x4C7, "M", "ӈ"), - (0x4C8, "V"), - (0x4C9, "M", "ӊ"), - (0x4CA, "V"), - (0x4CB, "M", "ӌ"), - (0x4CC, "V"), - (0x4CD, "M", "ӎ"), - (0x4CE, "V"), - (0x4D0, "M", "ӑ"), - (0x4D1, "V"), - (0x4D2, "M", "ӓ"), - (0x4D3, "V"), - (0x4D4, "M", "ӕ"), - (0x4D5, "V"), - (0x4D6, "M", "ӗ"), - (0x4D7, "V"), - (0x4D8, "M", "ә"), - (0x4D9, "V"), - (0x4DA, "M", "ӛ"), - (0x4DB, "V"), - (0x4DC, "M", "ӝ"), - (0x4DD, "V"), - (0x4DE, "M", "ӟ"), - (0x4DF, "V"), - (0x4E0, "M", "ӡ"), - (0x4E1, "V"), - (0x4E2, "M", "ӣ"), - (0x4E3, "V"), - (0x4E4, "M", "ӥ"), - (0x4E5, "V"), - (0x4E6, "M", "ӧ"), - (0x4E7, "V"), - (0x4E8, "M", "ө"), - (0x4E9, "V"), - (0x4EA, "M", "ӫ"), - (0x4EB, "V"), - (0x4EC, "M", "ӭ"), - (0x4ED, "V"), - (0x4EE, "M", "ӯ"), - (0x4EF, "V"), - (0x4F0, "M", "ӱ"), - (0x4F1, "V"), - (0x4F2, "M", "ӳ"), - (0x4F3, "V"), - (0x4F4, "M", "ӵ"), - (0x4F5, "V"), - (0x4F6, "M", "ӷ"), - (0x4F7, "V"), - (0x4F8, "M", "ӹ"), - (0x4F9, "V"), - (0x4FA, "M", "ӻ"), - (0x4FB, "V"), - (0x4FC, "M", "ӽ"), - (0x4FD, "V"), - (0x4FE, "M", "ӿ"), - (0x4FF, "V"), - (0x500, "M", "ԁ"), - (0x501, "V"), - (0x502, "M", "ԃ"), - ] - - -def _seg_9() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x503, "V"), - (0x504, "M", "ԅ"), - (0x505, "V"), - (0x506, "M", "ԇ"), - (0x507, "V"), - (0x508, "M", "ԉ"), - (0x509, "V"), - (0x50A, "M", "ԋ"), - (0x50B, "V"), - (0x50C, "M", "ԍ"), - (0x50D, "V"), - (0x50E, "M", "ԏ"), - (0x50F, "V"), - (0x510, "M", "ԑ"), - (0x511, "V"), - (0x512, "M", "ԓ"), - (0x513, "V"), - (0x514, "M", "ԕ"), - (0x515, "V"), - (0x516, "M", "ԗ"), - (0x517, "V"), - (0x518, "M", "ԙ"), - (0x519, "V"), - (0x51A, "M", "ԛ"), - (0x51B, "V"), - (0x51C, "M", "ԝ"), - (0x51D, "V"), - (0x51E, "M", "ԟ"), - (0x51F, "V"), - (0x520, "M", "ԡ"), - (0x521, "V"), - (0x522, "M", "ԣ"), - (0x523, "V"), - (0x524, "M", "ԥ"), - (0x525, "V"), - (0x526, "M", "ԧ"), - (0x527, "V"), - (0x528, "M", "ԩ"), - (0x529, "V"), - (0x52A, "M", "ԫ"), - (0x52B, "V"), - (0x52C, "M", "ԭ"), - (0x52D, "V"), - (0x52E, "M", "ԯ"), - (0x52F, "V"), - (0x530, "X"), - (0x531, "M", "ա"), - (0x532, "M", "բ"), - (0x533, "M", "գ"), - (0x534, "M", "դ"), - (0x535, "M", "ե"), - (0x536, "M", "զ"), - (0x537, "M", "է"), - (0x538, "M", "ը"), - (0x539, "M", "թ"), - (0x53A, "M", "ժ"), - (0x53B, "M", "ի"), - (0x53C, "M", "լ"), - (0x53D, "M", "խ"), - (0x53E, "M", "ծ"), - (0x53F, "M", "կ"), - (0x540, "M", "հ"), - (0x541, "M", "ձ"), - (0x542, "M", "ղ"), - (0x543, "M", "ճ"), - (0x544, "M", "մ"), - (0x545, "M", "յ"), - (0x546, "M", "ն"), - (0x547, "M", "շ"), - (0x548, "M", "ո"), - (0x549, "M", "չ"), - (0x54A, "M", "պ"), - (0x54B, "M", "ջ"), - (0x54C, "M", "ռ"), - (0x54D, "M", "ս"), - (0x54E, "M", "վ"), - (0x54F, "M", "տ"), - (0x550, "M", "ր"), - (0x551, "M", "ց"), - (0x552, "M", "ւ"), - (0x553, "M", "փ"), - (0x554, "M", "ք"), - (0x555, "M", "օ"), - (0x556, "M", "ֆ"), - (0x557, "X"), - (0x559, "V"), - (0x587, "M", "եւ"), - (0x588, "V"), - (0x58B, "X"), - (0x58D, "V"), - (0x590, "X"), - (0x591, "V"), - (0x5C8, "X"), - (0x5D0, "V"), - (0x5EB, "X"), - (0x5EF, "V"), - (0x5F5, "X"), - (0x606, "V"), - (0x61C, "X"), - (0x61D, "V"), - ] - - -def _seg_10() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x675, "M", "اٴ"), - (0x676, "M", "وٴ"), - (0x677, "M", "ۇٴ"), - (0x678, "M", "يٴ"), - (0x679, "V"), - (0x6DD, "X"), - (0x6DE, "V"), - (0x70E, "X"), - (0x710, "V"), - (0x74B, "X"), - (0x74D, "V"), - (0x7B2, "X"), - (0x7C0, "V"), - (0x7FB, "X"), - (0x7FD, "V"), - (0x82E, "X"), - (0x830, "V"), - (0x83F, "X"), - (0x840, "V"), - (0x85C, "X"), - (0x85E, "V"), - (0x85F, "X"), - (0x860, "V"), - (0x86B, "X"), - (0x870, "V"), - (0x88F, "X"), - (0x898, "V"), - (0x8E2, "X"), - (0x8E3, "V"), - (0x958, "M", "क़"), - (0x959, "M", "ख़"), - (0x95A, "M", "ग़"), - (0x95B, "M", "ज़"), - (0x95C, "M", "ड़"), - (0x95D, "M", "ढ़"), - (0x95E, "M", "फ़"), - (0x95F, "M", "य़"), - (0x960, "V"), - (0x984, "X"), - (0x985, "V"), - (0x98D, "X"), - (0x98F, "V"), - (0x991, "X"), - (0x993, "V"), - (0x9A9, "X"), - (0x9AA, "V"), - (0x9B1, "X"), - (0x9B2, "V"), - (0x9B3, "X"), - (0x9B6, "V"), - (0x9BA, "X"), - (0x9BC, "V"), - (0x9C5, "X"), - (0x9C7, "V"), - (0x9C9, "X"), - (0x9CB, "V"), - (0x9CF, "X"), - (0x9D7, "V"), - (0x9D8, "X"), - (0x9DC, "M", "ড়"), - (0x9DD, "M", "ঢ়"), - (0x9DE, "X"), - (0x9DF, "M", "য়"), - (0x9E0, "V"), - (0x9E4, "X"), - (0x9E6, "V"), - (0x9FF, "X"), - (0xA01, "V"), - (0xA04, "X"), - (0xA05, "V"), - (0xA0B, "X"), - (0xA0F, "V"), - (0xA11, "X"), - (0xA13, "V"), - (0xA29, "X"), - (0xA2A, "V"), - (0xA31, "X"), - (0xA32, "V"), - (0xA33, "M", "ਲ਼"), - (0xA34, "X"), - (0xA35, "V"), - (0xA36, "M", "ਸ਼"), - (0xA37, "X"), - (0xA38, "V"), - (0xA3A, "X"), - (0xA3C, "V"), - (0xA3D, "X"), - (0xA3E, "V"), - (0xA43, "X"), - (0xA47, "V"), - (0xA49, "X"), - (0xA4B, "V"), - (0xA4E, "X"), - (0xA51, "V"), - (0xA52, "X"), - (0xA59, "M", "ਖ਼"), - (0xA5A, "M", "ਗ਼"), - (0xA5B, "M", "ਜ਼"), - (0xA5C, "V"), - (0xA5D, "X"), - ] - - -def _seg_11() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA5E, "M", "ਫ਼"), - (0xA5F, "X"), - (0xA66, "V"), - (0xA77, "X"), - (0xA81, "V"), - (0xA84, "X"), - (0xA85, "V"), - (0xA8E, "X"), - (0xA8F, "V"), - (0xA92, "X"), - (0xA93, "V"), - (0xAA9, "X"), - (0xAAA, "V"), - (0xAB1, "X"), - (0xAB2, "V"), - (0xAB4, "X"), - (0xAB5, "V"), - (0xABA, "X"), - (0xABC, "V"), - (0xAC6, "X"), - (0xAC7, "V"), - (0xACA, "X"), - (0xACB, "V"), - (0xACE, "X"), - (0xAD0, "V"), - (0xAD1, "X"), - (0xAE0, "V"), - (0xAE4, "X"), - (0xAE6, "V"), - (0xAF2, "X"), - (0xAF9, "V"), - (0xB00, "X"), - (0xB01, "V"), - (0xB04, "X"), - (0xB05, "V"), - (0xB0D, "X"), - (0xB0F, "V"), - (0xB11, "X"), - (0xB13, "V"), - (0xB29, "X"), - (0xB2A, "V"), - (0xB31, "X"), - (0xB32, "V"), - (0xB34, "X"), - (0xB35, "V"), - (0xB3A, "X"), - (0xB3C, "V"), - (0xB45, "X"), - (0xB47, "V"), - (0xB49, "X"), - (0xB4B, "V"), - (0xB4E, "X"), - (0xB55, "V"), - (0xB58, "X"), - (0xB5C, "M", "ଡ଼"), - (0xB5D, "M", "ଢ଼"), - (0xB5E, "X"), - (0xB5F, "V"), - (0xB64, "X"), - (0xB66, "V"), - (0xB78, "X"), - (0xB82, "V"), - (0xB84, "X"), - (0xB85, "V"), - (0xB8B, "X"), - (0xB8E, "V"), - (0xB91, "X"), - (0xB92, "V"), - (0xB96, "X"), - (0xB99, "V"), - (0xB9B, "X"), - (0xB9C, "V"), - (0xB9D, "X"), - (0xB9E, "V"), - (0xBA0, "X"), - (0xBA3, "V"), - (0xBA5, "X"), - (0xBA8, "V"), - (0xBAB, "X"), - (0xBAE, "V"), - (0xBBA, "X"), - (0xBBE, "V"), - (0xBC3, "X"), - (0xBC6, "V"), - (0xBC9, "X"), - (0xBCA, "V"), - (0xBCE, "X"), - (0xBD0, "V"), - (0xBD1, "X"), - (0xBD7, "V"), - (0xBD8, "X"), - (0xBE6, "V"), - (0xBFB, "X"), - (0xC00, "V"), - (0xC0D, "X"), - (0xC0E, "V"), - (0xC11, "X"), - (0xC12, "V"), - (0xC29, "X"), - (0xC2A, "V"), - ] - - -def _seg_12() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xC3A, "X"), - (0xC3C, "V"), - (0xC45, "X"), - (0xC46, "V"), - (0xC49, "X"), - (0xC4A, "V"), - (0xC4E, "X"), - (0xC55, "V"), - (0xC57, "X"), - (0xC58, "V"), - (0xC5B, "X"), - (0xC5D, "V"), - (0xC5E, "X"), - (0xC60, "V"), - (0xC64, "X"), - (0xC66, "V"), - (0xC70, "X"), - (0xC77, "V"), - (0xC8D, "X"), - (0xC8E, "V"), - (0xC91, "X"), - (0xC92, "V"), - (0xCA9, "X"), - (0xCAA, "V"), - (0xCB4, "X"), - (0xCB5, "V"), - (0xCBA, "X"), - (0xCBC, "V"), - (0xCC5, "X"), - (0xCC6, "V"), - (0xCC9, "X"), - (0xCCA, "V"), - (0xCCE, "X"), - (0xCD5, "V"), - (0xCD7, "X"), - (0xCDD, "V"), - (0xCDF, "X"), - (0xCE0, "V"), - (0xCE4, "X"), - (0xCE6, "V"), - (0xCF0, "X"), - (0xCF1, "V"), - (0xCF4, "X"), - (0xD00, "V"), - (0xD0D, "X"), - (0xD0E, "V"), - (0xD11, "X"), - (0xD12, "V"), - (0xD45, "X"), - (0xD46, "V"), - (0xD49, "X"), - (0xD4A, "V"), - (0xD50, "X"), - (0xD54, "V"), - (0xD64, "X"), - (0xD66, "V"), - (0xD80, "X"), - (0xD81, "V"), - (0xD84, "X"), - (0xD85, "V"), - (0xD97, "X"), - (0xD9A, "V"), - (0xDB2, "X"), - (0xDB3, "V"), - (0xDBC, "X"), - (0xDBD, "V"), - (0xDBE, "X"), - (0xDC0, "V"), - (0xDC7, "X"), - (0xDCA, "V"), - (0xDCB, "X"), - (0xDCF, "V"), - (0xDD5, "X"), - (0xDD6, "V"), - (0xDD7, "X"), - (0xDD8, "V"), - (0xDE0, "X"), - (0xDE6, "V"), - (0xDF0, "X"), - (0xDF2, "V"), - (0xDF5, "X"), - (0xE01, "V"), - (0xE33, "M", "ํา"), - (0xE34, "V"), - (0xE3B, "X"), - (0xE3F, "V"), - (0xE5C, "X"), - (0xE81, "V"), - (0xE83, "X"), - (0xE84, "V"), - (0xE85, "X"), - (0xE86, "V"), - (0xE8B, "X"), - (0xE8C, "V"), - (0xEA4, "X"), - (0xEA5, "V"), - (0xEA6, "X"), - (0xEA7, "V"), - (0xEB3, "M", "ໍາ"), - (0xEB4, "V"), - ] - - -def _seg_13() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xEBE, "X"), - (0xEC0, "V"), - (0xEC5, "X"), - (0xEC6, "V"), - (0xEC7, "X"), - (0xEC8, "V"), - (0xECF, "X"), - (0xED0, "V"), - (0xEDA, "X"), - (0xEDC, "M", "ຫນ"), - (0xEDD, "M", "ຫມ"), - (0xEDE, "V"), - (0xEE0, "X"), - (0xF00, "V"), - (0xF0C, "M", "་"), - (0xF0D, "V"), - (0xF43, "M", "གྷ"), - (0xF44, "V"), - (0xF48, "X"), - (0xF49, "V"), - (0xF4D, "M", "ཌྷ"), - (0xF4E, "V"), - (0xF52, "M", "དྷ"), - (0xF53, "V"), - (0xF57, "M", "བྷ"), - (0xF58, "V"), - (0xF5C, "M", "ཛྷ"), - (0xF5D, "V"), - (0xF69, "M", "ཀྵ"), - (0xF6A, "V"), - (0xF6D, "X"), - (0xF71, "V"), - (0xF73, "M", "ཱི"), - (0xF74, "V"), - (0xF75, "M", "ཱུ"), - (0xF76, "M", "ྲྀ"), - (0xF77, "M", "ྲཱྀ"), - (0xF78, "M", "ླྀ"), - (0xF79, "M", "ླཱྀ"), - (0xF7A, "V"), - (0xF81, "M", "ཱྀ"), - (0xF82, "V"), - (0xF93, "M", "ྒྷ"), - (0xF94, "V"), - (0xF98, "X"), - (0xF99, "V"), - (0xF9D, "M", "ྜྷ"), - (0xF9E, "V"), - (0xFA2, "M", "ྡྷ"), - (0xFA3, "V"), - (0xFA7, "M", "ྦྷ"), - (0xFA8, "V"), - (0xFAC, "M", "ྫྷ"), - (0xFAD, "V"), - (0xFB9, "M", "ྐྵ"), - (0xFBA, "V"), - (0xFBD, "X"), - (0xFBE, "V"), - (0xFCD, "X"), - (0xFCE, "V"), - (0xFDB, "X"), - (0x1000, "V"), - (0x10A0, "X"), - (0x10C7, "M", "ⴧ"), - (0x10C8, "X"), - (0x10CD, "M", "ⴭ"), - (0x10CE, "X"), - (0x10D0, "V"), - (0x10FC, "M", "ნ"), - (0x10FD, "V"), - (0x115F, "X"), - (0x1161, "V"), - (0x1249, "X"), - (0x124A, "V"), - (0x124E, "X"), - (0x1250, "V"), - (0x1257, "X"), - (0x1258, "V"), - (0x1259, "X"), - (0x125A, "V"), - (0x125E, "X"), - (0x1260, "V"), - (0x1289, "X"), - (0x128A, "V"), - (0x128E, "X"), - (0x1290, "V"), - (0x12B1, "X"), - (0x12B2, "V"), - (0x12B6, "X"), - (0x12B8, "V"), - (0x12BF, "X"), - (0x12C0, "V"), - (0x12C1, "X"), - (0x12C2, "V"), - (0x12C6, "X"), - (0x12C8, "V"), - (0x12D7, "X"), - (0x12D8, "V"), - (0x1311, "X"), - (0x1312, "V"), - ] - - -def _seg_14() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1316, "X"), - (0x1318, "V"), - (0x135B, "X"), - (0x135D, "V"), - (0x137D, "X"), - (0x1380, "V"), - (0x139A, "X"), - (0x13A0, "V"), - (0x13F6, "X"), - (0x13F8, "M", "Ᏸ"), - (0x13F9, "M", "Ᏹ"), - (0x13FA, "M", "Ᏺ"), - (0x13FB, "M", "Ᏻ"), - (0x13FC, "M", "Ᏼ"), - (0x13FD, "M", "Ᏽ"), - (0x13FE, "X"), - (0x1400, "V"), - (0x1680, "X"), - (0x1681, "V"), - (0x169D, "X"), - (0x16A0, "V"), - (0x16F9, "X"), - (0x1700, "V"), - (0x1716, "X"), - (0x171F, "V"), - (0x1737, "X"), - (0x1740, "V"), - (0x1754, "X"), - (0x1760, "V"), - (0x176D, "X"), - (0x176E, "V"), - (0x1771, "X"), - (0x1772, "V"), - (0x1774, "X"), - (0x1780, "V"), - (0x17B4, "X"), - (0x17B6, "V"), - (0x17DE, "X"), - (0x17E0, "V"), - (0x17EA, "X"), - (0x17F0, "V"), - (0x17FA, "X"), - (0x1800, "V"), - (0x1806, "X"), - (0x1807, "V"), - (0x180B, "I"), - (0x180E, "X"), - (0x180F, "I"), - (0x1810, "V"), - (0x181A, "X"), - (0x1820, "V"), - (0x1879, "X"), - (0x1880, "V"), - (0x18AB, "X"), - (0x18B0, "V"), - (0x18F6, "X"), - (0x1900, "V"), - (0x191F, "X"), - (0x1920, "V"), - (0x192C, "X"), - (0x1930, "V"), - (0x193C, "X"), - (0x1940, "V"), - (0x1941, "X"), - (0x1944, "V"), - (0x196E, "X"), - (0x1970, "V"), - (0x1975, "X"), - (0x1980, "V"), - (0x19AC, "X"), - (0x19B0, "V"), - (0x19CA, "X"), - (0x19D0, "V"), - (0x19DB, "X"), - (0x19DE, "V"), - (0x1A1C, "X"), - (0x1A1E, "V"), - (0x1A5F, "X"), - (0x1A60, "V"), - (0x1A7D, "X"), - (0x1A7F, "V"), - (0x1A8A, "X"), - (0x1A90, "V"), - (0x1A9A, "X"), - (0x1AA0, "V"), - (0x1AAE, "X"), - (0x1AB0, "V"), - (0x1ACF, "X"), - (0x1B00, "V"), - (0x1B4D, "X"), - (0x1B50, "V"), - (0x1B7F, "X"), - (0x1B80, "V"), - (0x1BF4, "X"), - (0x1BFC, "V"), - (0x1C38, "X"), - (0x1C3B, "V"), - (0x1C4A, "X"), - (0x1C4D, "V"), - (0x1C80, "M", "в"), - ] - - -def _seg_15() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1C81, "M", "д"), - (0x1C82, "M", "о"), - (0x1C83, "M", "с"), - (0x1C84, "M", "т"), - (0x1C86, "M", "ъ"), - (0x1C87, "M", "ѣ"), - (0x1C88, "M", "ꙋ"), - (0x1C89, "X"), - (0x1C90, "M", "ა"), - (0x1C91, "M", "ბ"), - (0x1C92, "M", "გ"), - (0x1C93, "M", "დ"), - (0x1C94, "M", "ე"), - (0x1C95, "M", "ვ"), - (0x1C96, "M", "ზ"), - (0x1C97, "M", "თ"), - (0x1C98, "M", "ი"), - (0x1C99, "M", "კ"), - (0x1C9A, "M", "ლ"), - (0x1C9B, "M", "მ"), - (0x1C9C, "M", "ნ"), - (0x1C9D, "M", "ო"), - (0x1C9E, "M", "პ"), - (0x1C9F, "M", "ჟ"), - (0x1CA0, "M", "რ"), - (0x1CA1, "M", "ს"), - (0x1CA2, "M", "ტ"), - (0x1CA3, "M", "უ"), - (0x1CA4, "M", "ფ"), - (0x1CA5, "M", "ქ"), - (0x1CA6, "M", "ღ"), - (0x1CA7, "M", "ყ"), - (0x1CA8, "M", "შ"), - (0x1CA9, "M", "ჩ"), - (0x1CAA, "M", "ც"), - (0x1CAB, "M", "ძ"), - (0x1CAC, "M", "წ"), - (0x1CAD, "M", "ჭ"), - (0x1CAE, "M", "ხ"), - (0x1CAF, "M", "ჯ"), - (0x1CB0, "M", "ჰ"), - (0x1CB1, "M", "ჱ"), - (0x1CB2, "M", "ჲ"), - (0x1CB3, "M", "ჳ"), - (0x1CB4, "M", "ჴ"), - (0x1CB5, "M", "ჵ"), - (0x1CB6, "M", "ჶ"), - (0x1CB7, "M", "ჷ"), - (0x1CB8, "M", "ჸ"), - (0x1CB9, "M", "ჹ"), - (0x1CBA, "M", "ჺ"), - (0x1CBB, "X"), - (0x1CBD, "M", "ჽ"), - (0x1CBE, "M", "ჾ"), - (0x1CBF, "M", "ჿ"), - (0x1CC0, "V"), - (0x1CC8, "X"), - (0x1CD0, "V"), - (0x1CFB, "X"), - (0x1D00, "V"), - (0x1D2C, "M", "a"), - (0x1D2D, "M", "æ"), - (0x1D2E, "M", "b"), - (0x1D2F, "V"), - (0x1D30, "M", "d"), - (0x1D31, "M", "e"), - (0x1D32, "M", "ǝ"), - (0x1D33, "M", "g"), - (0x1D34, "M", "h"), - (0x1D35, "M", "i"), - (0x1D36, "M", "j"), - (0x1D37, "M", "k"), - (0x1D38, "M", "l"), - (0x1D39, "M", "m"), - (0x1D3A, "M", "n"), - (0x1D3B, "V"), - (0x1D3C, "M", "o"), - (0x1D3D, "M", "ȣ"), - (0x1D3E, "M", "p"), - (0x1D3F, "M", "r"), - (0x1D40, "M", "t"), - (0x1D41, "M", "u"), - (0x1D42, "M", "w"), - (0x1D43, "M", "a"), - (0x1D44, "M", "ɐ"), - (0x1D45, "M", "ɑ"), - (0x1D46, "M", "ᴂ"), - (0x1D47, "M", "b"), - (0x1D48, "M", "d"), - (0x1D49, "M", "e"), - (0x1D4A, "M", "ə"), - (0x1D4B, "M", "ɛ"), - (0x1D4C, "M", "ɜ"), - (0x1D4D, "M", "g"), - (0x1D4E, "V"), - (0x1D4F, "M", "k"), - (0x1D50, "M", "m"), - (0x1D51, "M", "ŋ"), - (0x1D52, "M", "o"), - (0x1D53, "M", "ɔ"), - ] - - -def _seg_16() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D54, "M", "ᴖ"), - (0x1D55, "M", "ᴗ"), - (0x1D56, "M", "p"), - (0x1D57, "M", "t"), - (0x1D58, "M", "u"), - (0x1D59, "M", "ᴝ"), - (0x1D5A, "M", "ɯ"), - (0x1D5B, "M", "v"), - (0x1D5C, "M", "ᴥ"), - (0x1D5D, "M", "β"), - (0x1D5E, "M", "γ"), - (0x1D5F, "M", "δ"), - (0x1D60, "M", "φ"), - (0x1D61, "M", "χ"), - (0x1D62, "M", "i"), - (0x1D63, "M", "r"), - (0x1D64, "M", "u"), - (0x1D65, "M", "v"), - (0x1D66, "M", "β"), - (0x1D67, "M", "γ"), - (0x1D68, "M", "ρ"), - (0x1D69, "M", "φ"), - (0x1D6A, "M", "χ"), - (0x1D6B, "V"), - (0x1D78, "M", "н"), - (0x1D79, "V"), - (0x1D9B, "M", "ɒ"), - (0x1D9C, "M", "c"), - (0x1D9D, "M", "ɕ"), - (0x1D9E, "M", "ð"), - (0x1D9F, "M", "ɜ"), - (0x1DA0, "M", "f"), - (0x1DA1, "M", "ɟ"), - (0x1DA2, "M", "ɡ"), - (0x1DA3, "M", "ɥ"), - (0x1DA4, "M", "ɨ"), - (0x1DA5, "M", "ɩ"), - (0x1DA6, "M", "ɪ"), - (0x1DA7, "M", "ᵻ"), - (0x1DA8, "M", "ʝ"), - (0x1DA9, "M", "ɭ"), - (0x1DAA, "M", "ᶅ"), - (0x1DAB, "M", "ʟ"), - (0x1DAC, "M", "ɱ"), - (0x1DAD, "M", "ɰ"), - (0x1DAE, "M", "ɲ"), - (0x1DAF, "M", "ɳ"), - (0x1DB0, "M", "ɴ"), - (0x1DB1, "M", "ɵ"), - (0x1DB2, "M", "ɸ"), - (0x1DB3, "M", "ʂ"), - (0x1DB4, "M", "ʃ"), - (0x1DB5, "M", "ƫ"), - (0x1DB6, "M", "ʉ"), - (0x1DB7, "M", "ʊ"), - (0x1DB8, "M", "ᴜ"), - (0x1DB9, "M", "ʋ"), - (0x1DBA, "M", "ʌ"), - (0x1DBB, "M", "z"), - (0x1DBC, "M", "ʐ"), - (0x1DBD, "M", "ʑ"), - (0x1DBE, "M", "ʒ"), - (0x1DBF, "M", "θ"), - (0x1DC0, "V"), - (0x1E00, "M", "ḁ"), - (0x1E01, "V"), - (0x1E02, "M", "ḃ"), - (0x1E03, "V"), - (0x1E04, "M", "ḅ"), - (0x1E05, "V"), - (0x1E06, "M", "ḇ"), - (0x1E07, "V"), - (0x1E08, "M", "ḉ"), - (0x1E09, "V"), - (0x1E0A, "M", "ḋ"), - (0x1E0B, "V"), - (0x1E0C, "M", "ḍ"), - (0x1E0D, "V"), - (0x1E0E, "M", "ḏ"), - (0x1E0F, "V"), - (0x1E10, "M", "ḑ"), - (0x1E11, "V"), - (0x1E12, "M", "ḓ"), - (0x1E13, "V"), - (0x1E14, "M", "ḕ"), - (0x1E15, "V"), - (0x1E16, "M", "ḗ"), - (0x1E17, "V"), - (0x1E18, "M", "ḙ"), - (0x1E19, "V"), - (0x1E1A, "M", "ḛ"), - (0x1E1B, "V"), - (0x1E1C, "M", "ḝ"), - (0x1E1D, "V"), - (0x1E1E, "M", "ḟ"), - (0x1E1F, "V"), - (0x1E20, "M", "ḡ"), - (0x1E21, "V"), - (0x1E22, "M", "ḣ"), - (0x1E23, "V"), - ] - - -def _seg_17() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E24, "M", "ḥ"), - (0x1E25, "V"), - (0x1E26, "M", "ḧ"), - (0x1E27, "V"), - (0x1E28, "M", "ḩ"), - (0x1E29, "V"), - (0x1E2A, "M", "ḫ"), - (0x1E2B, "V"), - (0x1E2C, "M", "ḭ"), - (0x1E2D, "V"), - (0x1E2E, "M", "ḯ"), - (0x1E2F, "V"), - (0x1E30, "M", "ḱ"), - (0x1E31, "V"), - (0x1E32, "M", "ḳ"), - (0x1E33, "V"), - (0x1E34, "M", "ḵ"), - (0x1E35, "V"), - (0x1E36, "M", "ḷ"), - (0x1E37, "V"), - (0x1E38, "M", "ḹ"), - (0x1E39, "V"), - (0x1E3A, "M", "ḻ"), - (0x1E3B, "V"), - (0x1E3C, "M", "ḽ"), - (0x1E3D, "V"), - (0x1E3E, "M", "ḿ"), - (0x1E3F, "V"), - (0x1E40, "M", "ṁ"), - (0x1E41, "V"), - (0x1E42, "M", "ṃ"), - (0x1E43, "V"), - (0x1E44, "M", "ṅ"), - (0x1E45, "V"), - (0x1E46, "M", "ṇ"), - (0x1E47, "V"), - (0x1E48, "M", "ṉ"), - (0x1E49, "V"), - (0x1E4A, "M", "ṋ"), - (0x1E4B, "V"), - (0x1E4C, "M", "ṍ"), - (0x1E4D, "V"), - (0x1E4E, "M", "ṏ"), - (0x1E4F, "V"), - (0x1E50, "M", "ṑ"), - (0x1E51, "V"), - (0x1E52, "M", "ṓ"), - (0x1E53, "V"), - (0x1E54, "M", "ṕ"), - (0x1E55, "V"), - (0x1E56, "M", "ṗ"), - (0x1E57, "V"), - (0x1E58, "M", "ṙ"), - (0x1E59, "V"), - (0x1E5A, "M", "ṛ"), - (0x1E5B, "V"), - (0x1E5C, "M", "ṝ"), - (0x1E5D, "V"), - (0x1E5E, "M", "ṟ"), - (0x1E5F, "V"), - (0x1E60, "M", "ṡ"), - (0x1E61, "V"), - (0x1E62, "M", "ṣ"), - (0x1E63, "V"), - (0x1E64, "M", "ṥ"), - (0x1E65, "V"), - (0x1E66, "M", "ṧ"), - (0x1E67, "V"), - (0x1E68, "M", "ṩ"), - (0x1E69, "V"), - (0x1E6A, "M", "ṫ"), - (0x1E6B, "V"), - (0x1E6C, "M", "ṭ"), - (0x1E6D, "V"), - (0x1E6E, "M", "ṯ"), - (0x1E6F, "V"), - (0x1E70, "M", "ṱ"), - (0x1E71, "V"), - (0x1E72, "M", "ṳ"), - (0x1E73, "V"), - (0x1E74, "M", "ṵ"), - (0x1E75, "V"), - (0x1E76, "M", "ṷ"), - (0x1E77, "V"), - (0x1E78, "M", "ṹ"), - (0x1E79, "V"), - (0x1E7A, "M", "ṻ"), - (0x1E7B, "V"), - (0x1E7C, "M", "ṽ"), - (0x1E7D, "V"), - (0x1E7E, "M", "ṿ"), - (0x1E7F, "V"), - (0x1E80, "M", "ẁ"), - (0x1E81, "V"), - (0x1E82, "M", "ẃ"), - (0x1E83, "V"), - (0x1E84, "M", "ẅ"), - (0x1E85, "V"), - (0x1E86, "M", "ẇ"), - (0x1E87, "V"), - ] - - -def _seg_18() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E88, "M", "ẉ"), - (0x1E89, "V"), - (0x1E8A, "M", "ẋ"), - (0x1E8B, "V"), - (0x1E8C, "M", "ẍ"), - (0x1E8D, "V"), - (0x1E8E, "M", "ẏ"), - (0x1E8F, "V"), - (0x1E90, "M", "ẑ"), - (0x1E91, "V"), - (0x1E92, "M", "ẓ"), - (0x1E93, "V"), - (0x1E94, "M", "ẕ"), - (0x1E95, "V"), - (0x1E9A, "M", "aʾ"), - (0x1E9B, "M", "ṡ"), - (0x1E9C, "V"), - (0x1E9E, "M", "ß"), - (0x1E9F, "V"), - (0x1EA0, "M", "ạ"), - (0x1EA1, "V"), - (0x1EA2, "M", "ả"), - (0x1EA3, "V"), - (0x1EA4, "M", "ấ"), - (0x1EA5, "V"), - (0x1EA6, "M", "ầ"), - (0x1EA7, "V"), - (0x1EA8, "M", "ẩ"), - (0x1EA9, "V"), - (0x1EAA, "M", "ẫ"), - (0x1EAB, "V"), - (0x1EAC, "M", "ậ"), - (0x1EAD, "V"), - (0x1EAE, "M", "ắ"), - (0x1EAF, "V"), - (0x1EB0, "M", "ằ"), - (0x1EB1, "V"), - (0x1EB2, "M", "ẳ"), - (0x1EB3, "V"), - (0x1EB4, "M", "ẵ"), - (0x1EB5, "V"), - (0x1EB6, "M", "ặ"), - (0x1EB7, "V"), - (0x1EB8, "M", "ẹ"), - (0x1EB9, "V"), - (0x1EBA, "M", "ẻ"), - (0x1EBB, "V"), - (0x1EBC, "M", "ẽ"), - (0x1EBD, "V"), - (0x1EBE, "M", "ế"), - (0x1EBF, "V"), - (0x1EC0, "M", "ề"), - (0x1EC1, "V"), - (0x1EC2, "M", "ể"), - (0x1EC3, "V"), - (0x1EC4, "M", "ễ"), - (0x1EC5, "V"), - (0x1EC6, "M", "ệ"), - (0x1EC7, "V"), - (0x1EC8, "M", "ỉ"), - (0x1EC9, "V"), - (0x1ECA, "M", "ị"), - (0x1ECB, "V"), - (0x1ECC, "M", "ọ"), - (0x1ECD, "V"), - (0x1ECE, "M", "ỏ"), - (0x1ECF, "V"), - (0x1ED0, "M", "ố"), - (0x1ED1, "V"), - (0x1ED2, "M", "ồ"), - (0x1ED3, "V"), - (0x1ED4, "M", "ổ"), - (0x1ED5, "V"), - (0x1ED6, "M", "ỗ"), - (0x1ED7, "V"), - (0x1ED8, "M", "ộ"), - (0x1ED9, "V"), - (0x1EDA, "M", "ớ"), - (0x1EDB, "V"), - (0x1EDC, "M", "ờ"), - (0x1EDD, "V"), - (0x1EDE, "M", "ở"), - (0x1EDF, "V"), - (0x1EE0, "M", "ỡ"), - (0x1EE1, "V"), - (0x1EE2, "M", "ợ"), - (0x1EE3, "V"), - (0x1EE4, "M", "ụ"), - (0x1EE5, "V"), - (0x1EE6, "M", "ủ"), - (0x1EE7, "V"), - (0x1EE8, "M", "ứ"), - (0x1EE9, "V"), - (0x1EEA, "M", "ừ"), - (0x1EEB, "V"), - (0x1EEC, "M", "ử"), - (0x1EED, "V"), - (0x1EEE, "M", "ữ"), - (0x1EEF, "V"), - (0x1EF0, "M", "ự"), - ] - - -def _seg_19() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EF1, "V"), - (0x1EF2, "M", "ỳ"), - (0x1EF3, "V"), - (0x1EF4, "M", "ỵ"), - (0x1EF5, "V"), - (0x1EF6, "M", "ỷ"), - (0x1EF7, "V"), - (0x1EF8, "M", "ỹ"), - (0x1EF9, "V"), - (0x1EFA, "M", "ỻ"), - (0x1EFB, "V"), - (0x1EFC, "M", "ỽ"), - (0x1EFD, "V"), - (0x1EFE, "M", "ỿ"), - (0x1EFF, "V"), - (0x1F08, "M", "ἀ"), - (0x1F09, "M", "ἁ"), - (0x1F0A, "M", "ἂ"), - (0x1F0B, "M", "ἃ"), - (0x1F0C, "M", "ἄ"), - (0x1F0D, "M", "ἅ"), - (0x1F0E, "M", "ἆ"), - (0x1F0F, "M", "ἇ"), - (0x1F10, "V"), - (0x1F16, "X"), - (0x1F18, "M", "ἐ"), - (0x1F19, "M", "ἑ"), - (0x1F1A, "M", "ἒ"), - (0x1F1B, "M", "ἓ"), - (0x1F1C, "M", "ἔ"), - (0x1F1D, "M", "ἕ"), - (0x1F1E, "X"), - (0x1F20, "V"), - (0x1F28, "M", "ἠ"), - (0x1F29, "M", "ἡ"), - (0x1F2A, "M", "ἢ"), - (0x1F2B, "M", "ἣ"), - (0x1F2C, "M", "ἤ"), - (0x1F2D, "M", "ἥ"), - (0x1F2E, "M", "ἦ"), - (0x1F2F, "M", "ἧ"), - (0x1F30, "V"), - (0x1F38, "M", "ἰ"), - (0x1F39, "M", "ἱ"), - (0x1F3A, "M", "ἲ"), - (0x1F3B, "M", "ἳ"), - (0x1F3C, "M", "ἴ"), - (0x1F3D, "M", "ἵ"), - (0x1F3E, "M", "ἶ"), - (0x1F3F, "M", "ἷ"), - (0x1F40, "V"), - (0x1F46, "X"), - (0x1F48, "M", "ὀ"), - (0x1F49, "M", "ὁ"), - (0x1F4A, "M", "ὂ"), - (0x1F4B, "M", "ὃ"), - (0x1F4C, "M", "ὄ"), - (0x1F4D, "M", "ὅ"), - (0x1F4E, "X"), - (0x1F50, "V"), - (0x1F58, "X"), - (0x1F59, "M", "ὑ"), - (0x1F5A, "X"), - (0x1F5B, "M", "ὓ"), - (0x1F5C, "X"), - (0x1F5D, "M", "ὕ"), - (0x1F5E, "X"), - (0x1F5F, "M", "ὗ"), - (0x1F60, "V"), - (0x1F68, "M", "ὠ"), - (0x1F69, "M", "ὡ"), - (0x1F6A, "M", "ὢ"), - (0x1F6B, "M", "ὣ"), - (0x1F6C, "M", "ὤ"), - (0x1F6D, "M", "ὥ"), - (0x1F6E, "M", "ὦ"), - (0x1F6F, "M", "ὧ"), - (0x1F70, "V"), - (0x1F71, "M", "ά"), - (0x1F72, "V"), - (0x1F73, "M", "έ"), - (0x1F74, "V"), - (0x1F75, "M", "ή"), - (0x1F76, "V"), - (0x1F77, "M", "ί"), - (0x1F78, "V"), - (0x1F79, "M", "ό"), - (0x1F7A, "V"), - (0x1F7B, "M", "ύ"), - (0x1F7C, "V"), - (0x1F7D, "M", "ώ"), - (0x1F7E, "X"), - (0x1F80, "M", "ἀι"), - (0x1F81, "M", "ἁι"), - (0x1F82, "M", "ἂι"), - (0x1F83, "M", "ἃι"), - (0x1F84, "M", "ἄι"), - (0x1F85, "M", "ἅι"), - (0x1F86, "M", "ἆι"), - (0x1F87, "M", "ἇι"), - ] - - -def _seg_20() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1F88, "M", "ἀι"), - (0x1F89, "M", "ἁι"), - (0x1F8A, "M", "ἂι"), - (0x1F8B, "M", "ἃι"), - (0x1F8C, "M", "ἄι"), - (0x1F8D, "M", "ἅι"), - (0x1F8E, "M", "ἆι"), - (0x1F8F, "M", "ἇι"), - (0x1F90, "M", "ἠι"), - (0x1F91, "M", "ἡι"), - (0x1F92, "M", "ἢι"), - (0x1F93, "M", "ἣι"), - (0x1F94, "M", "ἤι"), - (0x1F95, "M", "ἥι"), - (0x1F96, "M", "ἦι"), - (0x1F97, "M", "ἧι"), - (0x1F98, "M", "ἠι"), - (0x1F99, "M", "ἡι"), - (0x1F9A, "M", "ἢι"), - (0x1F9B, "M", "ἣι"), - (0x1F9C, "M", "ἤι"), - (0x1F9D, "M", "ἥι"), - (0x1F9E, "M", "ἦι"), - (0x1F9F, "M", "ἧι"), - (0x1FA0, "M", "ὠι"), - (0x1FA1, "M", "ὡι"), - (0x1FA2, "M", "ὢι"), - (0x1FA3, "M", "ὣι"), - (0x1FA4, "M", "ὤι"), - (0x1FA5, "M", "ὥι"), - (0x1FA6, "M", "ὦι"), - (0x1FA7, "M", "ὧι"), - (0x1FA8, "M", "ὠι"), - (0x1FA9, "M", "ὡι"), - (0x1FAA, "M", "ὢι"), - (0x1FAB, "M", "ὣι"), - (0x1FAC, "M", "ὤι"), - (0x1FAD, "M", "ὥι"), - (0x1FAE, "M", "ὦι"), - (0x1FAF, "M", "ὧι"), - (0x1FB0, "V"), - (0x1FB2, "M", "ὰι"), - (0x1FB3, "M", "αι"), - (0x1FB4, "M", "άι"), - (0x1FB5, "X"), - (0x1FB6, "V"), - (0x1FB7, "M", "ᾶι"), - (0x1FB8, "M", "ᾰ"), - (0x1FB9, "M", "ᾱ"), - (0x1FBA, "M", "ὰ"), - (0x1FBB, "M", "ά"), - (0x1FBC, "M", "αι"), - (0x1FBD, "3", " ̓"), - (0x1FBE, "M", "ι"), - (0x1FBF, "3", " ̓"), - (0x1FC0, "3", " ͂"), - (0x1FC1, "3", " ̈͂"), - (0x1FC2, "M", "ὴι"), - (0x1FC3, "M", "ηι"), - (0x1FC4, "M", "ήι"), - (0x1FC5, "X"), - (0x1FC6, "V"), - (0x1FC7, "M", "ῆι"), - (0x1FC8, "M", "ὲ"), - (0x1FC9, "M", "έ"), - (0x1FCA, "M", "ὴ"), - (0x1FCB, "M", "ή"), - (0x1FCC, "M", "ηι"), - (0x1FCD, "3", " ̓̀"), - (0x1FCE, "3", " ̓́"), - (0x1FCF, "3", " ̓͂"), - (0x1FD0, "V"), - (0x1FD3, "M", "ΐ"), - (0x1FD4, "X"), - (0x1FD6, "V"), - (0x1FD8, "M", "ῐ"), - (0x1FD9, "M", "ῑ"), - (0x1FDA, "M", "ὶ"), - (0x1FDB, "M", "ί"), - (0x1FDC, "X"), - (0x1FDD, "3", " ̔̀"), - (0x1FDE, "3", " ̔́"), - (0x1FDF, "3", " ̔͂"), - (0x1FE0, "V"), - (0x1FE3, "M", "ΰ"), - (0x1FE4, "V"), - (0x1FE8, "M", "ῠ"), - (0x1FE9, "M", "ῡ"), - (0x1FEA, "M", "ὺ"), - (0x1FEB, "M", "ύ"), - (0x1FEC, "M", "ῥ"), - (0x1FED, "3", " ̈̀"), - (0x1FEE, "3", " ̈́"), - (0x1FEF, "3", "`"), - (0x1FF0, "X"), - (0x1FF2, "M", "ὼι"), - (0x1FF3, "M", "ωι"), - (0x1FF4, "M", "ώι"), - (0x1FF5, "X"), - (0x1FF6, "V"), - ] - - -def _seg_21() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1FF7, "M", "ῶι"), - (0x1FF8, "M", "ὸ"), - (0x1FF9, "M", "ό"), - (0x1FFA, "M", "ὼ"), - (0x1FFB, "M", "ώ"), - (0x1FFC, "M", "ωι"), - (0x1FFD, "3", " ́"), - (0x1FFE, "3", " ̔"), - (0x1FFF, "X"), - (0x2000, "3", " "), - (0x200B, "I"), - (0x200C, "D", ""), - (0x200E, "X"), - (0x2010, "V"), - (0x2011, "M", "‐"), - (0x2012, "V"), - (0x2017, "3", " ̳"), - (0x2018, "V"), - (0x2024, "X"), - (0x2027, "V"), - (0x2028, "X"), - (0x202F, "3", " "), - (0x2030, "V"), - (0x2033, "M", "′′"), - (0x2034, "M", "′′′"), - (0x2035, "V"), - (0x2036, "M", "‵‵"), - (0x2037, "M", "‵‵‵"), - (0x2038, "V"), - (0x203C, "3", "!!"), - (0x203D, "V"), - (0x203E, "3", " ̅"), - (0x203F, "V"), - (0x2047, "3", "??"), - (0x2048, "3", "?!"), - (0x2049, "3", "!?"), - (0x204A, "V"), - (0x2057, "M", "′′′′"), - (0x2058, "V"), - (0x205F, "3", " "), - (0x2060, "I"), - (0x2061, "X"), - (0x2064, "I"), - (0x2065, "X"), - (0x2070, "M", "0"), - (0x2071, "M", "i"), - (0x2072, "X"), - (0x2074, "M", "4"), - (0x2075, "M", "5"), - (0x2076, "M", "6"), - (0x2077, "M", "7"), - (0x2078, "M", "8"), - (0x2079, "M", "9"), - (0x207A, "3", "+"), - (0x207B, "M", "−"), - (0x207C, "3", "="), - (0x207D, "3", "("), - (0x207E, "3", ")"), - (0x207F, "M", "n"), - (0x2080, "M", "0"), - (0x2081, "M", "1"), - (0x2082, "M", "2"), - (0x2083, "M", "3"), - (0x2084, "M", "4"), - (0x2085, "M", "5"), - (0x2086, "M", "6"), - (0x2087, "M", "7"), - (0x2088, "M", "8"), - (0x2089, "M", "9"), - (0x208A, "3", "+"), - (0x208B, "M", "−"), - (0x208C, "3", "="), - (0x208D, "3", "("), - (0x208E, "3", ")"), - (0x208F, "X"), - (0x2090, "M", "a"), - (0x2091, "M", "e"), - (0x2092, "M", "o"), - (0x2093, "M", "x"), - (0x2094, "M", "ə"), - (0x2095, "M", "h"), - (0x2096, "M", "k"), - (0x2097, "M", "l"), - (0x2098, "M", "m"), - (0x2099, "M", "n"), - (0x209A, "M", "p"), - (0x209B, "M", "s"), - (0x209C, "M", "t"), - (0x209D, "X"), - (0x20A0, "V"), - (0x20A8, "M", "rs"), - (0x20A9, "V"), - (0x20C1, "X"), - (0x20D0, "V"), - (0x20F1, "X"), - (0x2100, "3", "a/c"), - (0x2101, "3", "a/s"), - (0x2102, "M", "c"), - (0x2103, "M", "°c"), - (0x2104, "V"), - ] - - -def _seg_22() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2105, "3", "c/o"), - (0x2106, "3", "c/u"), - (0x2107, "M", "ɛ"), - (0x2108, "V"), - (0x2109, "M", "°f"), - (0x210A, "M", "g"), - (0x210B, "M", "h"), - (0x210F, "M", "ħ"), - (0x2110, "M", "i"), - (0x2112, "M", "l"), - (0x2114, "V"), - (0x2115, "M", "n"), - (0x2116, "M", "no"), - (0x2117, "V"), - (0x2119, "M", "p"), - (0x211A, "M", "q"), - (0x211B, "M", "r"), - (0x211E, "V"), - (0x2120, "M", "sm"), - (0x2121, "M", "tel"), - (0x2122, "M", "tm"), - (0x2123, "V"), - (0x2124, "M", "z"), - (0x2125, "V"), - (0x2126, "M", "ω"), - (0x2127, "V"), - (0x2128, "M", "z"), - (0x2129, "V"), - (0x212A, "M", "k"), - (0x212B, "M", "å"), - (0x212C, "M", "b"), - (0x212D, "M", "c"), - (0x212E, "V"), - (0x212F, "M", "e"), - (0x2131, "M", "f"), - (0x2132, "X"), - (0x2133, "M", "m"), - (0x2134, "M", "o"), - (0x2135, "M", "א"), - (0x2136, "M", "ב"), - (0x2137, "M", "ג"), - (0x2138, "M", "ד"), - (0x2139, "M", "i"), - (0x213A, "V"), - (0x213B, "M", "fax"), - (0x213C, "M", "π"), - (0x213D, "M", "γ"), - (0x213F, "M", "π"), - (0x2140, "M", "∑"), - (0x2141, "V"), - (0x2145, "M", "d"), - (0x2147, "M", "e"), - (0x2148, "M", "i"), - (0x2149, "M", "j"), - (0x214A, "V"), - (0x2150, "M", "1⁄7"), - (0x2151, "M", "1⁄9"), - (0x2152, "M", "1⁄10"), - (0x2153, "M", "1⁄3"), - (0x2154, "M", "2⁄3"), - (0x2155, "M", "1⁄5"), - (0x2156, "M", "2⁄5"), - (0x2157, "M", "3⁄5"), - (0x2158, "M", "4⁄5"), - (0x2159, "M", "1⁄6"), - (0x215A, "M", "5⁄6"), - (0x215B, "M", "1⁄8"), - (0x215C, "M", "3⁄8"), - (0x215D, "M", "5⁄8"), - (0x215E, "M", "7⁄8"), - (0x215F, "M", "1⁄"), - (0x2160, "M", "i"), - (0x2161, "M", "ii"), - (0x2162, "M", "iii"), - (0x2163, "M", "iv"), - (0x2164, "M", "v"), - (0x2165, "M", "vi"), - (0x2166, "M", "vii"), - (0x2167, "M", "viii"), - (0x2168, "M", "ix"), - (0x2169, "M", "x"), - (0x216A, "M", "xi"), - (0x216B, "M", "xii"), - (0x216C, "M", "l"), - (0x216D, "M", "c"), - (0x216E, "M", "d"), - (0x216F, "M", "m"), - (0x2170, "M", "i"), - (0x2171, "M", "ii"), - (0x2172, "M", "iii"), - (0x2173, "M", "iv"), - (0x2174, "M", "v"), - (0x2175, "M", "vi"), - (0x2176, "M", "vii"), - (0x2177, "M", "viii"), - (0x2178, "M", "ix"), - (0x2179, "M", "x"), - (0x217A, "M", "xi"), - (0x217B, "M", "xii"), - (0x217C, "M", "l"), - ] - - -def _seg_23() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x217D, "M", "c"), - (0x217E, "M", "d"), - (0x217F, "M", "m"), - (0x2180, "V"), - (0x2183, "X"), - (0x2184, "V"), - (0x2189, "M", "0⁄3"), - (0x218A, "V"), - (0x218C, "X"), - (0x2190, "V"), - (0x222C, "M", "∫∫"), - (0x222D, "M", "∫∫∫"), - (0x222E, "V"), - (0x222F, "M", "∮∮"), - (0x2230, "M", "∮∮∮"), - (0x2231, "V"), - (0x2329, "M", "〈"), - (0x232A, "M", "〉"), - (0x232B, "V"), - (0x2427, "X"), - (0x2440, "V"), - (0x244B, "X"), - (0x2460, "M", "1"), - (0x2461, "M", "2"), - (0x2462, "M", "3"), - (0x2463, "M", "4"), - (0x2464, "M", "5"), - (0x2465, "M", "6"), - (0x2466, "M", "7"), - (0x2467, "M", "8"), - (0x2468, "M", "9"), - (0x2469, "M", "10"), - (0x246A, "M", "11"), - (0x246B, "M", "12"), - (0x246C, "M", "13"), - (0x246D, "M", "14"), - (0x246E, "M", "15"), - (0x246F, "M", "16"), - (0x2470, "M", "17"), - (0x2471, "M", "18"), - (0x2472, "M", "19"), - (0x2473, "M", "20"), - (0x2474, "3", "(1)"), - (0x2475, "3", "(2)"), - (0x2476, "3", "(3)"), - (0x2477, "3", "(4)"), - (0x2478, "3", "(5)"), - (0x2479, "3", "(6)"), - (0x247A, "3", "(7)"), - (0x247B, "3", "(8)"), - (0x247C, "3", "(9)"), - (0x247D, "3", "(10)"), - (0x247E, "3", "(11)"), - (0x247F, "3", "(12)"), - (0x2480, "3", "(13)"), - (0x2481, "3", "(14)"), - (0x2482, "3", "(15)"), - (0x2483, "3", "(16)"), - (0x2484, "3", "(17)"), - (0x2485, "3", "(18)"), - (0x2486, "3", "(19)"), - (0x2487, "3", "(20)"), - (0x2488, "X"), - (0x249C, "3", "(a)"), - (0x249D, "3", "(b)"), - (0x249E, "3", "(c)"), - (0x249F, "3", "(d)"), - (0x24A0, "3", "(e)"), - (0x24A1, "3", "(f)"), - (0x24A2, "3", "(g)"), - (0x24A3, "3", "(h)"), - (0x24A4, "3", "(i)"), - (0x24A5, "3", "(j)"), - (0x24A6, "3", "(k)"), - (0x24A7, "3", "(l)"), - (0x24A8, "3", "(m)"), - (0x24A9, "3", "(n)"), - (0x24AA, "3", "(o)"), - (0x24AB, "3", "(p)"), - (0x24AC, "3", "(q)"), - (0x24AD, "3", "(r)"), - (0x24AE, "3", "(s)"), - (0x24AF, "3", "(t)"), - (0x24B0, "3", "(u)"), - (0x24B1, "3", "(v)"), - (0x24B2, "3", "(w)"), - (0x24B3, "3", "(x)"), - (0x24B4, "3", "(y)"), - (0x24B5, "3", "(z)"), - (0x24B6, "M", "a"), - (0x24B7, "M", "b"), - (0x24B8, "M", "c"), - (0x24B9, "M", "d"), - (0x24BA, "M", "e"), - (0x24BB, "M", "f"), - (0x24BC, "M", "g"), - (0x24BD, "M", "h"), - (0x24BE, "M", "i"), - (0x24BF, "M", "j"), - (0x24C0, "M", "k"), - ] - - -def _seg_24() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x24C1, "M", "l"), - (0x24C2, "M", "m"), - (0x24C3, "M", "n"), - (0x24C4, "M", "o"), - (0x24C5, "M", "p"), - (0x24C6, "M", "q"), - (0x24C7, "M", "r"), - (0x24C8, "M", "s"), - (0x24C9, "M", "t"), - (0x24CA, "M", "u"), - (0x24CB, "M", "v"), - (0x24CC, "M", "w"), - (0x24CD, "M", "x"), - (0x24CE, "M", "y"), - (0x24CF, "M", "z"), - (0x24D0, "M", "a"), - (0x24D1, "M", "b"), - (0x24D2, "M", "c"), - (0x24D3, "M", "d"), - (0x24D4, "M", "e"), - (0x24D5, "M", "f"), - (0x24D6, "M", "g"), - (0x24D7, "M", "h"), - (0x24D8, "M", "i"), - (0x24D9, "M", "j"), - (0x24DA, "M", "k"), - (0x24DB, "M", "l"), - (0x24DC, "M", "m"), - (0x24DD, "M", "n"), - (0x24DE, "M", "o"), - (0x24DF, "M", "p"), - (0x24E0, "M", "q"), - (0x24E1, "M", "r"), - (0x24E2, "M", "s"), - (0x24E3, "M", "t"), - (0x24E4, "M", "u"), - (0x24E5, "M", "v"), - (0x24E6, "M", "w"), - (0x24E7, "M", "x"), - (0x24E8, "M", "y"), - (0x24E9, "M", "z"), - (0x24EA, "M", "0"), - (0x24EB, "V"), - (0x2A0C, "M", "∫∫∫∫"), - (0x2A0D, "V"), - (0x2A74, "3", "::="), - (0x2A75, "3", "=="), - (0x2A76, "3", "==="), - (0x2A77, "V"), - (0x2ADC, "M", "⫝̸"), - (0x2ADD, "V"), - (0x2B74, "X"), - (0x2B76, "V"), - (0x2B96, "X"), - (0x2B97, "V"), - (0x2C00, "M", "ⰰ"), - (0x2C01, "M", "ⰱ"), - (0x2C02, "M", "ⰲ"), - (0x2C03, "M", "ⰳ"), - (0x2C04, "M", "ⰴ"), - (0x2C05, "M", "ⰵ"), - (0x2C06, "M", "ⰶ"), - (0x2C07, "M", "ⰷ"), - (0x2C08, "M", "ⰸ"), - (0x2C09, "M", "ⰹ"), - (0x2C0A, "M", "ⰺ"), - (0x2C0B, "M", "ⰻ"), - (0x2C0C, "M", "ⰼ"), - (0x2C0D, "M", "ⰽ"), - (0x2C0E, "M", "ⰾ"), - (0x2C0F, "M", "ⰿ"), - (0x2C10, "M", "ⱀ"), - (0x2C11, "M", "ⱁ"), - (0x2C12, "M", "ⱂ"), - (0x2C13, "M", "ⱃ"), - (0x2C14, "M", "ⱄ"), - (0x2C15, "M", "ⱅ"), - (0x2C16, "M", "ⱆ"), - (0x2C17, "M", "ⱇ"), - (0x2C18, "M", "ⱈ"), - (0x2C19, "M", "ⱉ"), - (0x2C1A, "M", "ⱊ"), - (0x2C1B, "M", "ⱋ"), - (0x2C1C, "M", "ⱌ"), - (0x2C1D, "M", "ⱍ"), - (0x2C1E, "M", "ⱎ"), - (0x2C1F, "M", "ⱏ"), - (0x2C20, "M", "ⱐ"), - (0x2C21, "M", "ⱑ"), - (0x2C22, "M", "ⱒ"), - (0x2C23, "M", "ⱓ"), - (0x2C24, "M", "ⱔ"), - (0x2C25, "M", "ⱕ"), - (0x2C26, "M", "ⱖ"), - (0x2C27, "M", "ⱗ"), - (0x2C28, "M", "ⱘ"), - (0x2C29, "M", "ⱙ"), - (0x2C2A, "M", "ⱚ"), - (0x2C2B, "M", "ⱛ"), - (0x2C2C, "M", "ⱜ"), - ] - - -def _seg_25() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2C2D, "M", "ⱝ"), - (0x2C2E, "M", "ⱞ"), - (0x2C2F, "M", "ⱟ"), - (0x2C30, "V"), - (0x2C60, "M", "ⱡ"), - (0x2C61, "V"), - (0x2C62, "M", "ɫ"), - (0x2C63, "M", "ᵽ"), - (0x2C64, "M", "ɽ"), - (0x2C65, "V"), - (0x2C67, "M", "ⱨ"), - (0x2C68, "V"), - (0x2C69, "M", "ⱪ"), - (0x2C6A, "V"), - (0x2C6B, "M", "ⱬ"), - (0x2C6C, "V"), - (0x2C6D, "M", "ɑ"), - (0x2C6E, "M", "ɱ"), - (0x2C6F, "M", "ɐ"), - (0x2C70, "M", "ɒ"), - (0x2C71, "V"), - (0x2C72, "M", "ⱳ"), - (0x2C73, "V"), - (0x2C75, "M", "ⱶ"), - (0x2C76, "V"), - (0x2C7C, "M", "j"), - (0x2C7D, "M", "v"), - (0x2C7E, "M", "ȿ"), - (0x2C7F, "M", "ɀ"), - (0x2C80, "M", "ⲁ"), - (0x2C81, "V"), - (0x2C82, "M", "ⲃ"), - (0x2C83, "V"), - (0x2C84, "M", "ⲅ"), - (0x2C85, "V"), - (0x2C86, "M", "ⲇ"), - (0x2C87, "V"), - (0x2C88, "M", "ⲉ"), - (0x2C89, "V"), - (0x2C8A, "M", "ⲋ"), - (0x2C8B, "V"), - (0x2C8C, "M", "ⲍ"), - (0x2C8D, "V"), - (0x2C8E, "M", "ⲏ"), - (0x2C8F, "V"), - (0x2C90, "M", "ⲑ"), - (0x2C91, "V"), - (0x2C92, "M", "ⲓ"), - (0x2C93, "V"), - (0x2C94, "M", "ⲕ"), - (0x2C95, "V"), - (0x2C96, "M", "ⲗ"), - (0x2C97, "V"), - (0x2C98, "M", "ⲙ"), - (0x2C99, "V"), - (0x2C9A, "M", "ⲛ"), - (0x2C9B, "V"), - (0x2C9C, "M", "ⲝ"), - (0x2C9D, "V"), - (0x2C9E, "M", "ⲟ"), - (0x2C9F, "V"), - (0x2CA0, "M", "ⲡ"), - (0x2CA1, "V"), - (0x2CA2, "M", "ⲣ"), - (0x2CA3, "V"), - (0x2CA4, "M", "ⲥ"), - (0x2CA5, "V"), - (0x2CA6, "M", "ⲧ"), - (0x2CA7, "V"), - (0x2CA8, "M", "ⲩ"), - (0x2CA9, "V"), - (0x2CAA, "M", "ⲫ"), - (0x2CAB, "V"), - (0x2CAC, "M", "ⲭ"), - (0x2CAD, "V"), - (0x2CAE, "M", "ⲯ"), - (0x2CAF, "V"), - (0x2CB0, "M", "ⲱ"), - (0x2CB1, "V"), - (0x2CB2, "M", "ⲳ"), - (0x2CB3, "V"), - (0x2CB4, "M", "ⲵ"), - (0x2CB5, "V"), - (0x2CB6, "M", "ⲷ"), - (0x2CB7, "V"), - (0x2CB8, "M", "ⲹ"), - (0x2CB9, "V"), - (0x2CBA, "M", "ⲻ"), - (0x2CBB, "V"), - (0x2CBC, "M", "ⲽ"), - (0x2CBD, "V"), - (0x2CBE, "M", "ⲿ"), - (0x2CBF, "V"), - (0x2CC0, "M", "ⳁ"), - (0x2CC1, "V"), - (0x2CC2, "M", "ⳃ"), - (0x2CC3, "V"), - (0x2CC4, "M", "ⳅ"), - (0x2CC5, "V"), - (0x2CC6, "M", "ⳇ"), - ] - - -def _seg_26() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2CC7, "V"), - (0x2CC8, "M", "ⳉ"), - (0x2CC9, "V"), - (0x2CCA, "M", "ⳋ"), - (0x2CCB, "V"), - (0x2CCC, "M", "ⳍ"), - (0x2CCD, "V"), - (0x2CCE, "M", "ⳏ"), - (0x2CCF, "V"), - (0x2CD0, "M", "ⳑ"), - (0x2CD1, "V"), - (0x2CD2, "M", "ⳓ"), - (0x2CD3, "V"), - (0x2CD4, "M", "ⳕ"), - (0x2CD5, "V"), - (0x2CD6, "M", "ⳗ"), - (0x2CD7, "V"), - (0x2CD8, "M", "ⳙ"), - (0x2CD9, "V"), - (0x2CDA, "M", "ⳛ"), - (0x2CDB, "V"), - (0x2CDC, "M", "ⳝ"), - (0x2CDD, "V"), - (0x2CDE, "M", "ⳟ"), - (0x2CDF, "V"), - (0x2CE0, "M", "ⳡ"), - (0x2CE1, "V"), - (0x2CE2, "M", "ⳣ"), - (0x2CE3, "V"), - (0x2CEB, "M", "ⳬ"), - (0x2CEC, "V"), - (0x2CED, "M", "ⳮ"), - (0x2CEE, "V"), - (0x2CF2, "M", "ⳳ"), - (0x2CF3, "V"), - (0x2CF4, "X"), - (0x2CF9, "V"), - (0x2D26, "X"), - (0x2D27, "V"), - (0x2D28, "X"), - (0x2D2D, "V"), - (0x2D2E, "X"), - (0x2D30, "V"), - (0x2D68, "X"), - (0x2D6F, "M", "ⵡ"), - (0x2D70, "V"), - (0x2D71, "X"), - (0x2D7F, "V"), - (0x2D97, "X"), - (0x2DA0, "V"), - (0x2DA7, "X"), - (0x2DA8, "V"), - (0x2DAF, "X"), - (0x2DB0, "V"), - (0x2DB7, "X"), - (0x2DB8, "V"), - (0x2DBF, "X"), - (0x2DC0, "V"), - (0x2DC7, "X"), - (0x2DC8, "V"), - (0x2DCF, "X"), - (0x2DD0, "V"), - (0x2DD7, "X"), - (0x2DD8, "V"), - (0x2DDF, "X"), - (0x2DE0, "V"), - (0x2E5E, "X"), - (0x2E80, "V"), - (0x2E9A, "X"), - (0x2E9B, "V"), - (0x2E9F, "M", "母"), - (0x2EA0, "V"), - (0x2EF3, "M", "龟"), - (0x2EF4, "X"), - (0x2F00, "M", "一"), - (0x2F01, "M", "丨"), - (0x2F02, "M", "丶"), - (0x2F03, "M", "丿"), - (0x2F04, "M", "乙"), - (0x2F05, "M", "亅"), - (0x2F06, "M", "二"), - (0x2F07, "M", "亠"), - (0x2F08, "M", "人"), - (0x2F09, "M", "儿"), - (0x2F0A, "M", "入"), - (0x2F0B, "M", "八"), - (0x2F0C, "M", "冂"), - (0x2F0D, "M", "冖"), - (0x2F0E, "M", "冫"), - (0x2F0F, "M", "几"), - (0x2F10, "M", "凵"), - (0x2F11, "M", "刀"), - (0x2F12, "M", "力"), - (0x2F13, "M", "勹"), - (0x2F14, "M", "匕"), - (0x2F15, "M", "匚"), - (0x2F16, "M", "匸"), - (0x2F17, "M", "十"), - (0x2F18, "M", "卜"), - (0x2F19, "M", "卩"), - ] - - -def _seg_27() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F1A, "M", "厂"), - (0x2F1B, "M", "厶"), - (0x2F1C, "M", "又"), - (0x2F1D, "M", "口"), - (0x2F1E, "M", "囗"), - (0x2F1F, "M", "土"), - (0x2F20, "M", "士"), - (0x2F21, "M", "夂"), - (0x2F22, "M", "夊"), - (0x2F23, "M", "夕"), - (0x2F24, "M", "大"), - (0x2F25, "M", "女"), - (0x2F26, "M", "子"), - (0x2F27, "M", "宀"), - (0x2F28, "M", "寸"), - (0x2F29, "M", "小"), - (0x2F2A, "M", "尢"), - (0x2F2B, "M", "尸"), - (0x2F2C, "M", "屮"), - (0x2F2D, "M", "山"), - (0x2F2E, "M", "巛"), - (0x2F2F, "M", "工"), - (0x2F30, "M", "己"), - (0x2F31, "M", "巾"), - (0x2F32, "M", "干"), - (0x2F33, "M", "幺"), - (0x2F34, "M", "广"), - (0x2F35, "M", "廴"), - (0x2F36, "M", "廾"), - (0x2F37, "M", "弋"), - (0x2F38, "M", "弓"), - (0x2F39, "M", "彐"), - (0x2F3A, "M", "彡"), - (0x2F3B, "M", "彳"), - (0x2F3C, "M", "心"), - (0x2F3D, "M", "戈"), - (0x2F3E, "M", "戶"), - (0x2F3F, "M", "手"), - (0x2F40, "M", "支"), - (0x2F41, "M", "攴"), - (0x2F42, "M", "文"), - (0x2F43, "M", "斗"), - (0x2F44, "M", "斤"), - (0x2F45, "M", "方"), - (0x2F46, "M", "无"), - (0x2F47, "M", "日"), - (0x2F48, "M", "曰"), - (0x2F49, "M", "月"), - (0x2F4A, "M", "木"), - (0x2F4B, "M", "欠"), - (0x2F4C, "M", "止"), - (0x2F4D, "M", "歹"), - (0x2F4E, "M", "殳"), - (0x2F4F, "M", "毋"), - (0x2F50, "M", "比"), - (0x2F51, "M", "毛"), - (0x2F52, "M", "氏"), - (0x2F53, "M", "气"), - (0x2F54, "M", "水"), - (0x2F55, "M", "火"), - (0x2F56, "M", "爪"), - (0x2F57, "M", "父"), - (0x2F58, "M", "爻"), - (0x2F59, "M", "爿"), - (0x2F5A, "M", "片"), - (0x2F5B, "M", "牙"), - (0x2F5C, "M", "牛"), - (0x2F5D, "M", "犬"), - (0x2F5E, "M", "玄"), - (0x2F5F, "M", "玉"), - (0x2F60, "M", "瓜"), - (0x2F61, "M", "瓦"), - (0x2F62, "M", "甘"), - (0x2F63, "M", "生"), - (0x2F64, "M", "用"), - (0x2F65, "M", "田"), - (0x2F66, "M", "疋"), - (0x2F67, "M", "疒"), - (0x2F68, "M", "癶"), - (0x2F69, "M", "白"), - (0x2F6A, "M", "皮"), - (0x2F6B, "M", "皿"), - (0x2F6C, "M", "目"), - (0x2F6D, "M", "矛"), - (0x2F6E, "M", "矢"), - (0x2F6F, "M", "石"), - (0x2F70, "M", "示"), - (0x2F71, "M", "禸"), - (0x2F72, "M", "禾"), - (0x2F73, "M", "穴"), - (0x2F74, "M", "立"), - (0x2F75, "M", "竹"), - (0x2F76, "M", "米"), - (0x2F77, "M", "糸"), - (0x2F78, "M", "缶"), - (0x2F79, "M", "网"), - (0x2F7A, "M", "羊"), - (0x2F7B, "M", "羽"), - (0x2F7C, "M", "老"), - (0x2F7D, "M", "而"), - ] - - -def _seg_28() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F7E, "M", "耒"), - (0x2F7F, "M", "耳"), - (0x2F80, "M", "聿"), - (0x2F81, "M", "肉"), - (0x2F82, "M", "臣"), - (0x2F83, "M", "自"), - (0x2F84, "M", "至"), - (0x2F85, "M", "臼"), - (0x2F86, "M", "舌"), - (0x2F87, "M", "舛"), - (0x2F88, "M", "舟"), - (0x2F89, "M", "艮"), - (0x2F8A, "M", "色"), - (0x2F8B, "M", "艸"), - (0x2F8C, "M", "虍"), - (0x2F8D, "M", "虫"), - (0x2F8E, "M", "血"), - (0x2F8F, "M", "行"), - (0x2F90, "M", "衣"), - (0x2F91, "M", "襾"), - (0x2F92, "M", "見"), - (0x2F93, "M", "角"), - (0x2F94, "M", "言"), - (0x2F95, "M", "谷"), - (0x2F96, "M", "豆"), - (0x2F97, "M", "豕"), - (0x2F98, "M", "豸"), - (0x2F99, "M", "貝"), - (0x2F9A, "M", "赤"), - (0x2F9B, "M", "走"), - (0x2F9C, "M", "足"), - (0x2F9D, "M", "身"), - (0x2F9E, "M", "車"), - (0x2F9F, "M", "辛"), - (0x2FA0, "M", "辰"), - (0x2FA1, "M", "辵"), - (0x2FA2, "M", "邑"), - (0x2FA3, "M", "酉"), - (0x2FA4, "M", "釆"), - (0x2FA5, "M", "里"), - (0x2FA6, "M", "金"), - (0x2FA7, "M", "長"), - (0x2FA8, "M", "門"), - (0x2FA9, "M", "阜"), - (0x2FAA, "M", "隶"), - (0x2FAB, "M", "隹"), - (0x2FAC, "M", "雨"), - (0x2FAD, "M", "靑"), - (0x2FAE, "M", "非"), - (0x2FAF, "M", "面"), - (0x2FB0, "M", "革"), - (0x2FB1, "M", "韋"), - (0x2FB2, "M", "韭"), - (0x2FB3, "M", "音"), - (0x2FB4, "M", "頁"), - (0x2FB5, "M", "風"), - (0x2FB6, "M", "飛"), - (0x2FB7, "M", "食"), - (0x2FB8, "M", "首"), - (0x2FB9, "M", "香"), - (0x2FBA, "M", "馬"), - (0x2FBB, "M", "骨"), - (0x2FBC, "M", "高"), - (0x2FBD, "M", "髟"), - (0x2FBE, "M", "鬥"), - (0x2FBF, "M", "鬯"), - (0x2FC0, "M", "鬲"), - (0x2FC1, "M", "鬼"), - (0x2FC2, "M", "魚"), - (0x2FC3, "M", "鳥"), - (0x2FC4, "M", "鹵"), - (0x2FC5, "M", "鹿"), - (0x2FC6, "M", "麥"), - (0x2FC7, "M", "麻"), - (0x2FC8, "M", "黃"), - (0x2FC9, "M", "黍"), - (0x2FCA, "M", "黑"), - (0x2FCB, "M", "黹"), - (0x2FCC, "M", "黽"), - (0x2FCD, "M", "鼎"), - (0x2FCE, "M", "鼓"), - (0x2FCF, "M", "鼠"), - (0x2FD0, "M", "鼻"), - (0x2FD1, "M", "齊"), - (0x2FD2, "M", "齒"), - (0x2FD3, "M", "龍"), - (0x2FD4, "M", "龜"), - (0x2FD5, "M", "龠"), - (0x2FD6, "X"), - (0x3000, "3", " "), - (0x3001, "V"), - (0x3002, "M", "."), - (0x3003, "V"), - (0x3036, "M", "〒"), - (0x3037, "V"), - (0x3038, "M", "十"), - (0x3039, "M", "卄"), - (0x303A, "M", "卅"), - (0x303B, "V"), - (0x3040, "X"), - ] - - -def _seg_29() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3041, "V"), - (0x3097, "X"), - (0x3099, "V"), - (0x309B, "3", " ゙"), - (0x309C, "3", " ゚"), - (0x309D, "V"), - (0x309F, "M", "より"), - (0x30A0, "V"), - (0x30FF, "M", "コト"), - (0x3100, "X"), - (0x3105, "V"), - (0x3130, "X"), - (0x3131, "M", "ᄀ"), - (0x3132, "M", "ᄁ"), - (0x3133, "M", "ᆪ"), - (0x3134, "M", "ᄂ"), - (0x3135, "M", "ᆬ"), - (0x3136, "M", "ᆭ"), - (0x3137, "M", "ᄃ"), - (0x3138, "M", "ᄄ"), - (0x3139, "M", "ᄅ"), - (0x313A, "M", "ᆰ"), - (0x313B, "M", "ᆱ"), - (0x313C, "M", "ᆲ"), - (0x313D, "M", "ᆳ"), - (0x313E, "M", "ᆴ"), - (0x313F, "M", "ᆵ"), - (0x3140, "M", "ᄚ"), - (0x3141, "M", "ᄆ"), - (0x3142, "M", "ᄇ"), - (0x3143, "M", "ᄈ"), - (0x3144, "M", "ᄡ"), - (0x3145, "M", "ᄉ"), - (0x3146, "M", "ᄊ"), - (0x3147, "M", "ᄋ"), - (0x3148, "M", "ᄌ"), - (0x3149, "M", "ᄍ"), - (0x314A, "M", "ᄎ"), - (0x314B, "M", "ᄏ"), - (0x314C, "M", "ᄐ"), - (0x314D, "M", "ᄑ"), - (0x314E, "M", "ᄒ"), - (0x314F, "M", "ᅡ"), - (0x3150, "M", "ᅢ"), - (0x3151, "M", "ᅣ"), - (0x3152, "M", "ᅤ"), - (0x3153, "M", "ᅥ"), - (0x3154, "M", "ᅦ"), - (0x3155, "M", "ᅧ"), - (0x3156, "M", "ᅨ"), - (0x3157, "M", "ᅩ"), - (0x3158, "M", "ᅪ"), - (0x3159, "M", "ᅫ"), - (0x315A, "M", "ᅬ"), - (0x315B, "M", "ᅭ"), - (0x315C, "M", "ᅮ"), - (0x315D, "M", "ᅯ"), - (0x315E, "M", "ᅰ"), - (0x315F, "M", "ᅱ"), - (0x3160, "M", "ᅲ"), - (0x3161, "M", "ᅳ"), - (0x3162, "M", "ᅴ"), - (0x3163, "M", "ᅵ"), - (0x3164, "X"), - (0x3165, "M", "ᄔ"), - (0x3166, "M", "ᄕ"), - (0x3167, "M", "ᇇ"), - (0x3168, "M", "ᇈ"), - (0x3169, "M", "ᇌ"), - (0x316A, "M", "ᇎ"), - (0x316B, "M", "ᇓ"), - (0x316C, "M", "ᇗ"), - (0x316D, "M", "ᇙ"), - (0x316E, "M", "ᄜ"), - (0x316F, "M", "ᇝ"), - (0x3170, "M", "ᇟ"), - (0x3171, "M", "ᄝ"), - (0x3172, "M", "ᄞ"), - (0x3173, "M", "ᄠ"), - (0x3174, "M", "ᄢ"), - (0x3175, "M", "ᄣ"), - (0x3176, "M", "ᄧ"), - (0x3177, "M", "ᄩ"), - (0x3178, "M", "ᄫ"), - (0x3179, "M", "ᄬ"), - (0x317A, "M", "ᄭ"), - (0x317B, "M", "ᄮ"), - (0x317C, "M", "ᄯ"), - (0x317D, "M", "ᄲ"), - (0x317E, "M", "ᄶ"), - (0x317F, "M", "ᅀ"), - (0x3180, "M", "ᅇ"), - (0x3181, "M", "ᅌ"), - (0x3182, "M", "ᇱ"), - (0x3183, "M", "ᇲ"), - (0x3184, "M", "ᅗ"), - (0x3185, "M", "ᅘ"), - (0x3186, "M", "ᅙ"), - (0x3187, "M", "ᆄ"), - (0x3188, "M", "ᆅ"), - ] - - -def _seg_30() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3189, "M", "ᆈ"), - (0x318A, "M", "ᆑ"), - (0x318B, "M", "ᆒ"), - (0x318C, "M", "ᆔ"), - (0x318D, "M", "ᆞ"), - (0x318E, "M", "ᆡ"), - (0x318F, "X"), - (0x3190, "V"), - (0x3192, "M", "一"), - (0x3193, "M", "二"), - (0x3194, "M", "三"), - (0x3195, "M", "四"), - (0x3196, "M", "上"), - (0x3197, "M", "中"), - (0x3198, "M", "下"), - (0x3199, "M", "甲"), - (0x319A, "M", "乙"), - (0x319B, "M", "丙"), - (0x319C, "M", "丁"), - (0x319D, "M", "天"), - (0x319E, "M", "地"), - (0x319F, "M", "人"), - (0x31A0, "V"), - (0x31E4, "X"), - (0x31F0, "V"), - (0x3200, "3", "(ᄀ)"), - (0x3201, "3", "(ᄂ)"), - (0x3202, "3", "(ᄃ)"), - (0x3203, "3", "(ᄅ)"), - (0x3204, "3", "(ᄆ)"), - (0x3205, "3", "(ᄇ)"), - (0x3206, "3", "(ᄉ)"), - (0x3207, "3", "(ᄋ)"), - (0x3208, "3", "(ᄌ)"), - (0x3209, "3", "(ᄎ)"), - (0x320A, "3", "(ᄏ)"), - (0x320B, "3", "(ᄐ)"), - (0x320C, "3", "(ᄑ)"), - (0x320D, "3", "(ᄒ)"), - (0x320E, "3", "(가)"), - (0x320F, "3", "(나)"), - (0x3210, "3", "(다)"), - (0x3211, "3", "(라)"), - (0x3212, "3", "(마)"), - (0x3213, "3", "(바)"), - (0x3214, "3", "(사)"), - (0x3215, "3", "(아)"), - (0x3216, "3", "(자)"), - (0x3217, "3", "(차)"), - (0x3218, "3", "(카)"), - (0x3219, "3", "(타)"), - (0x321A, "3", "(파)"), - (0x321B, "3", "(하)"), - (0x321C, "3", "(주)"), - (0x321D, "3", "(오전)"), - (0x321E, "3", "(오후)"), - (0x321F, "X"), - (0x3220, "3", "(一)"), - (0x3221, "3", "(二)"), - (0x3222, "3", "(三)"), - (0x3223, "3", "(四)"), - (0x3224, "3", "(五)"), - (0x3225, "3", "(六)"), - (0x3226, "3", "(七)"), - (0x3227, "3", "(八)"), - (0x3228, "3", "(九)"), - (0x3229, "3", "(十)"), - (0x322A, "3", "(月)"), - (0x322B, "3", "(火)"), - (0x322C, "3", "(水)"), - (0x322D, "3", "(木)"), - (0x322E, "3", "(金)"), - (0x322F, "3", "(土)"), - (0x3230, "3", "(日)"), - (0x3231, "3", "(株)"), - (0x3232, "3", "(有)"), - (0x3233, "3", "(社)"), - (0x3234, "3", "(名)"), - (0x3235, "3", "(特)"), - (0x3236, "3", "(財)"), - (0x3237, "3", "(祝)"), - (0x3238, "3", "(労)"), - (0x3239, "3", "(代)"), - (0x323A, "3", "(呼)"), - (0x323B, "3", "(学)"), - (0x323C, "3", "(監)"), - (0x323D, "3", "(企)"), - (0x323E, "3", "(資)"), - (0x323F, "3", "(協)"), - (0x3240, "3", "(祭)"), - (0x3241, "3", "(休)"), - (0x3242, "3", "(自)"), - (0x3243, "3", "(至)"), - (0x3244, "M", "問"), - (0x3245, "M", "幼"), - (0x3246, "M", "文"), - (0x3247, "M", "箏"), - (0x3248, "V"), - (0x3250, "M", "pte"), - (0x3251, "M", "21"), - ] - - -def _seg_31() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x3252, "M", "22"), - (0x3253, "M", "23"), - (0x3254, "M", "24"), - (0x3255, "M", "25"), - (0x3256, "M", "26"), - (0x3257, "M", "27"), - (0x3258, "M", "28"), - (0x3259, "M", "29"), - (0x325A, "M", "30"), - (0x325B, "M", "31"), - (0x325C, "M", "32"), - (0x325D, "M", "33"), - (0x325E, "M", "34"), - (0x325F, "M", "35"), - (0x3260, "M", "ᄀ"), - (0x3261, "M", "ᄂ"), - (0x3262, "M", "ᄃ"), - (0x3263, "M", "ᄅ"), - (0x3264, "M", "ᄆ"), - (0x3265, "M", "ᄇ"), - (0x3266, "M", "ᄉ"), - (0x3267, "M", "ᄋ"), - (0x3268, "M", "ᄌ"), - (0x3269, "M", "ᄎ"), - (0x326A, "M", "ᄏ"), - (0x326B, "M", "ᄐ"), - (0x326C, "M", "ᄑ"), - (0x326D, "M", "ᄒ"), - (0x326E, "M", "가"), - (0x326F, "M", "나"), - (0x3270, "M", "다"), - (0x3271, "M", "라"), - (0x3272, "M", "마"), - (0x3273, "M", "바"), - (0x3274, "M", "사"), - (0x3275, "M", "아"), - (0x3276, "M", "자"), - (0x3277, "M", "차"), - (0x3278, "M", "카"), - (0x3279, "M", "타"), - (0x327A, "M", "파"), - (0x327B, "M", "하"), - (0x327C, "M", "참고"), - (0x327D, "M", "주의"), - (0x327E, "M", "우"), - (0x327F, "V"), - (0x3280, "M", "一"), - (0x3281, "M", "二"), - (0x3282, "M", "三"), - (0x3283, "M", "四"), - (0x3284, "M", "五"), - (0x3285, "M", "六"), - (0x3286, "M", "七"), - (0x3287, "M", "八"), - (0x3288, "M", "九"), - (0x3289, "M", "十"), - (0x328A, "M", "月"), - (0x328B, "M", "火"), - (0x328C, "M", "水"), - (0x328D, "M", "木"), - (0x328E, "M", "金"), - (0x328F, "M", "土"), - (0x3290, "M", "日"), - (0x3291, "M", "株"), - (0x3292, "M", "有"), - (0x3293, "M", "社"), - (0x3294, "M", "名"), - (0x3295, "M", "特"), - (0x3296, "M", "財"), - (0x3297, "M", "祝"), - (0x3298, "M", "労"), - (0x3299, "M", "秘"), - (0x329A, "M", "男"), - (0x329B, "M", "女"), - (0x329C, "M", "適"), - (0x329D, "M", "優"), - (0x329E, "M", "印"), - (0x329F, "M", "注"), - (0x32A0, "M", "項"), - (0x32A1, "M", "休"), - (0x32A2, "M", "写"), - (0x32A3, "M", "正"), - (0x32A4, "M", "上"), - (0x32A5, "M", "中"), - (0x32A6, "M", "下"), - (0x32A7, "M", "左"), - (0x32A8, "M", "右"), - (0x32A9, "M", "医"), - (0x32AA, "M", "宗"), - (0x32AB, "M", "学"), - (0x32AC, "M", "監"), - (0x32AD, "M", "企"), - (0x32AE, "M", "資"), - (0x32AF, "M", "協"), - (0x32B0, "M", "夜"), - (0x32B1, "M", "36"), - (0x32B2, "M", "37"), - (0x32B3, "M", "38"), - (0x32B4, "M", "39"), - (0x32B5, "M", "40"), - ] - - -def _seg_32() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x32B6, "M", "41"), - (0x32B7, "M", "42"), - (0x32B8, "M", "43"), - (0x32B9, "M", "44"), - (0x32BA, "M", "45"), - (0x32BB, "M", "46"), - (0x32BC, "M", "47"), - (0x32BD, "M", "48"), - (0x32BE, "M", "49"), - (0x32BF, "M", "50"), - (0x32C0, "M", "1月"), - (0x32C1, "M", "2月"), - (0x32C2, "M", "3月"), - (0x32C3, "M", "4月"), - (0x32C4, "M", "5月"), - (0x32C5, "M", "6月"), - (0x32C6, "M", "7月"), - (0x32C7, "M", "8月"), - (0x32C8, "M", "9月"), - (0x32C9, "M", "10月"), - (0x32CA, "M", "11月"), - (0x32CB, "M", "12月"), - (0x32CC, "M", "hg"), - (0x32CD, "M", "erg"), - (0x32CE, "M", "ev"), - (0x32CF, "M", "ltd"), - (0x32D0, "M", "ア"), - (0x32D1, "M", "イ"), - (0x32D2, "M", "ウ"), - (0x32D3, "M", "エ"), - (0x32D4, "M", "オ"), - (0x32D5, "M", "カ"), - (0x32D6, "M", "キ"), - (0x32D7, "M", "ク"), - (0x32D8, "M", "ケ"), - (0x32D9, "M", "コ"), - (0x32DA, "M", "サ"), - (0x32DB, "M", "シ"), - (0x32DC, "M", "ス"), - (0x32DD, "M", "セ"), - (0x32DE, "M", "ソ"), - (0x32DF, "M", "タ"), - (0x32E0, "M", "チ"), - (0x32E1, "M", "ツ"), - (0x32E2, "M", "テ"), - (0x32E3, "M", "ト"), - (0x32E4, "M", "ナ"), - (0x32E5, "M", "ニ"), - (0x32E6, "M", "ヌ"), - (0x32E7, "M", "ネ"), - (0x32E8, "M", "ノ"), - (0x32E9, "M", "ハ"), - (0x32EA, "M", "ヒ"), - (0x32EB, "M", "フ"), - (0x32EC, "M", "ヘ"), - (0x32ED, "M", "ホ"), - (0x32EE, "M", "マ"), - (0x32EF, "M", "ミ"), - (0x32F0, "M", "ム"), - (0x32F1, "M", "メ"), - (0x32F2, "M", "モ"), - (0x32F3, "M", "ヤ"), - (0x32F4, "M", "ユ"), - (0x32F5, "M", "ヨ"), - (0x32F6, "M", "ラ"), - (0x32F7, "M", "リ"), - (0x32F8, "M", "ル"), - (0x32F9, "M", "レ"), - (0x32FA, "M", "ロ"), - (0x32FB, "M", "ワ"), - (0x32FC, "M", "ヰ"), - (0x32FD, "M", "ヱ"), - (0x32FE, "M", "ヲ"), - (0x32FF, "M", "令和"), - (0x3300, "M", "アパート"), - (0x3301, "M", "アルファ"), - (0x3302, "M", "アンペア"), - (0x3303, "M", "アール"), - (0x3304, "M", "イニング"), - (0x3305, "M", "インチ"), - (0x3306, "M", "ウォン"), - (0x3307, "M", "エスクード"), - (0x3308, "M", "エーカー"), - (0x3309, "M", "オンス"), - (0x330A, "M", "オーム"), - (0x330B, "M", "カイリ"), - (0x330C, "M", "カラット"), - (0x330D, "M", "カロリー"), - (0x330E, "M", "ガロン"), - (0x330F, "M", "ガンマ"), - (0x3310, "M", "ギガ"), - (0x3311, "M", "ギニー"), - (0x3312, "M", "キュリー"), - (0x3313, "M", "ギルダー"), - (0x3314, "M", "キロ"), - (0x3315, "M", "キログラム"), - (0x3316, "M", "キロメートル"), - (0x3317, "M", "キロワット"), - (0x3318, "M", "グラム"), - (0x3319, "M", "グラムトン"), - ] - - -def _seg_33() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x331A, "M", "クルゼイロ"), - (0x331B, "M", "クローネ"), - (0x331C, "M", "ケース"), - (0x331D, "M", "コルナ"), - (0x331E, "M", "コーポ"), - (0x331F, "M", "サイクル"), - (0x3320, "M", "サンチーム"), - (0x3321, "M", "シリング"), - (0x3322, "M", "センチ"), - (0x3323, "M", "セント"), - (0x3324, "M", "ダース"), - (0x3325, "M", "デシ"), - (0x3326, "M", "ドル"), - (0x3327, "M", "トン"), - (0x3328, "M", "ナノ"), - (0x3329, "M", "ノット"), - (0x332A, "M", "ハイツ"), - (0x332B, "M", "パーセント"), - (0x332C, "M", "パーツ"), - (0x332D, "M", "バーレル"), - (0x332E, "M", "ピアストル"), - (0x332F, "M", "ピクル"), - (0x3330, "M", "ピコ"), - (0x3331, "M", "ビル"), - (0x3332, "M", "ファラッド"), - (0x3333, "M", "フィート"), - (0x3334, "M", "ブッシェル"), - (0x3335, "M", "フラン"), - (0x3336, "M", "ヘクタール"), - (0x3337, "M", "ペソ"), - (0x3338, "M", "ペニヒ"), - (0x3339, "M", "ヘルツ"), - (0x333A, "M", "ペンス"), - (0x333B, "M", "ページ"), - (0x333C, "M", "ベータ"), - (0x333D, "M", "ポイント"), - (0x333E, "M", "ボルト"), - (0x333F, "M", "ホン"), - (0x3340, "M", "ポンド"), - (0x3341, "M", "ホール"), - (0x3342, "M", "ホーン"), - (0x3343, "M", "マイクロ"), - (0x3344, "M", "マイル"), - (0x3345, "M", "マッハ"), - (0x3346, "M", "マルク"), - (0x3347, "M", "マンション"), - (0x3348, "M", "ミクロン"), - (0x3349, "M", "ミリ"), - (0x334A, "M", "ミリバール"), - (0x334B, "M", "メガ"), - (0x334C, "M", "メガトン"), - (0x334D, "M", "メートル"), - (0x334E, "M", "ヤード"), - (0x334F, "M", "ヤール"), - (0x3350, "M", "ユアン"), - (0x3351, "M", "リットル"), - (0x3352, "M", "リラ"), - (0x3353, "M", "ルピー"), - (0x3354, "M", "ルーブル"), - (0x3355, "M", "レム"), - (0x3356, "M", "レントゲン"), - (0x3357, "M", "ワット"), - (0x3358, "M", "0点"), - (0x3359, "M", "1点"), - (0x335A, "M", "2点"), - (0x335B, "M", "3点"), - (0x335C, "M", "4点"), - (0x335D, "M", "5点"), - (0x335E, "M", "6点"), - (0x335F, "M", "7点"), - (0x3360, "M", "8点"), - (0x3361, "M", "9点"), - (0x3362, "M", "10点"), - (0x3363, "M", "11点"), - (0x3364, "M", "12点"), - (0x3365, "M", "13点"), - (0x3366, "M", "14点"), - (0x3367, "M", "15点"), - (0x3368, "M", "16点"), - (0x3369, "M", "17点"), - (0x336A, "M", "18点"), - (0x336B, "M", "19点"), - (0x336C, "M", "20点"), - (0x336D, "M", "21点"), - (0x336E, "M", "22点"), - (0x336F, "M", "23点"), - (0x3370, "M", "24点"), - (0x3371, "M", "hpa"), - (0x3372, "M", "da"), - (0x3373, "M", "au"), - (0x3374, "M", "bar"), - (0x3375, "M", "ov"), - (0x3376, "M", "pc"), - (0x3377, "M", "dm"), - (0x3378, "M", "dm2"), - (0x3379, "M", "dm3"), - (0x337A, "M", "iu"), - (0x337B, "M", "平成"), - (0x337C, "M", "昭和"), - (0x337D, "M", "大正"), - ] - - -def _seg_34() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x337E, "M", "明治"), - (0x337F, "M", "株式会社"), - (0x3380, "M", "pa"), - (0x3381, "M", "na"), - (0x3382, "M", "μa"), - (0x3383, "M", "ma"), - (0x3384, "M", "ka"), - (0x3385, "M", "kb"), - (0x3386, "M", "mb"), - (0x3387, "M", "gb"), - (0x3388, "M", "cal"), - (0x3389, "M", "kcal"), - (0x338A, "M", "pf"), - (0x338B, "M", "nf"), - (0x338C, "M", "μf"), - (0x338D, "M", "μg"), - (0x338E, "M", "mg"), - (0x338F, "M", "kg"), - (0x3390, "M", "hz"), - (0x3391, "M", "khz"), - (0x3392, "M", "mhz"), - (0x3393, "M", "ghz"), - (0x3394, "M", "thz"), - (0x3395, "M", "μl"), - (0x3396, "M", "ml"), - (0x3397, "M", "dl"), - (0x3398, "M", "kl"), - (0x3399, "M", "fm"), - (0x339A, "M", "nm"), - (0x339B, "M", "μm"), - (0x339C, "M", "mm"), - (0x339D, "M", "cm"), - (0x339E, "M", "km"), - (0x339F, "M", "mm2"), - (0x33A0, "M", "cm2"), - (0x33A1, "M", "m2"), - (0x33A2, "M", "km2"), - (0x33A3, "M", "mm3"), - (0x33A4, "M", "cm3"), - (0x33A5, "M", "m3"), - (0x33A6, "M", "km3"), - (0x33A7, "M", "m∕s"), - (0x33A8, "M", "m∕s2"), - (0x33A9, "M", "pa"), - (0x33AA, "M", "kpa"), - (0x33AB, "M", "mpa"), - (0x33AC, "M", "gpa"), - (0x33AD, "M", "rad"), - (0x33AE, "M", "rad∕s"), - (0x33AF, "M", "rad∕s2"), - (0x33B0, "M", "ps"), - (0x33B1, "M", "ns"), - (0x33B2, "M", "μs"), - (0x33B3, "M", "ms"), - (0x33B4, "M", "pv"), - (0x33B5, "M", "nv"), - (0x33B6, "M", "μv"), - (0x33B7, "M", "mv"), - (0x33B8, "M", "kv"), - (0x33B9, "M", "mv"), - (0x33BA, "M", "pw"), - (0x33BB, "M", "nw"), - (0x33BC, "M", "μw"), - (0x33BD, "M", "mw"), - (0x33BE, "M", "kw"), - (0x33BF, "M", "mw"), - (0x33C0, "M", "kω"), - (0x33C1, "M", "mω"), - (0x33C2, "X"), - (0x33C3, "M", "bq"), - (0x33C4, "M", "cc"), - (0x33C5, "M", "cd"), - (0x33C6, "M", "c∕kg"), - (0x33C7, "X"), - (0x33C8, "M", "db"), - (0x33C9, "M", "gy"), - (0x33CA, "M", "ha"), - (0x33CB, "M", "hp"), - (0x33CC, "M", "in"), - (0x33CD, "M", "kk"), - (0x33CE, "M", "km"), - (0x33CF, "M", "kt"), - (0x33D0, "M", "lm"), - (0x33D1, "M", "ln"), - (0x33D2, "M", "log"), - (0x33D3, "M", "lx"), - (0x33D4, "M", "mb"), - (0x33D5, "M", "mil"), - (0x33D6, "M", "mol"), - (0x33D7, "M", "ph"), - (0x33D8, "X"), - (0x33D9, "M", "ppm"), - (0x33DA, "M", "pr"), - (0x33DB, "M", "sr"), - (0x33DC, "M", "sv"), - (0x33DD, "M", "wb"), - (0x33DE, "M", "v∕m"), - (0x33DF, "M", "a∕m"), - (0x33E0, "M", "1日"), - (0x33E1, "M", "2日"), - ] - - -def _seg_35() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x33E2, "M", "3日"), - (0x33E3, "M", "4日"), - (0x33E4, "M", "5日"), - (0x33E5, "M", "6日"), - (0x33E6, "M", "7日"), - (0x33E7, "M", "8日"), - (0x33E8, "M", "9日"), - (0x33E9, "M", "10日"), - (0x33EA, "M", "11日"), - (0x33EB, "M", "12日"), - (0x33EC, "M", "13日"), - (0x33ED, "M", "14日"), - (0x33EE, "M", "15日"), - (0x33EF, "M", "16日"), - (0x33F0, "M", "17日"), - (0x33F1, "M", "18日"), - (0x33F2, "M", "19日"), - (0x33F3, "M", "20日"), - (0x33F4, "M", "21日"), - (0x33F5, "M", "22日"), - (0x33F6, "M", "23日"), - (0x33F7, "M", "24日"), - (0x33F8, "M", "25日"), - (0x33F9, "M", "26日"), - (0x33FA, "M", "27日"), - (0x33FB, "M", "28日"), - (0x33FC, "M", "29日"), - (0x33FD, "M", "30日"), - (0x33FE, "M", "31日"), - (0x33FF, "M", "gal"), - (0x3400, "V"), - (0xA48D, "X"), - (0xA490, "V"), - (0xA4C7, "X"), - (0xA4D0, "V"), - (0xA62C, "X"), - (0xA640, "M", "ꙁ"), - (0xA641, "V"), - (0xA642, "M", "ꙃ"), - (0xA643, "V"), - (0xA644, "M", "ꙅ"), - (0xA645, "V"), - (0xA646, "M", "ꙇ"), - (0xA647, "V"), - (0xA648, "M", "ꙉ"), - (0xA649, "V"), - (0xA64A, "M", "ꙋ"), - (0xA64B, "V"), - (0xA64C, "M", "ꙍ"), - (0xA64D, "V"), - (0xA64E, "M", "ꙏ"), - (0xA64F, "V"), - (0xA650, "M", "ꙑ"), - (0xA651, "V"), - (0xA652, "M", "ꙓ"), - (0xA653, "V"), - (0xA654, "M", "ꙕ"), - (0xA655, "V"), - (0xA656, "M", "ꙗ"), - (0xA657, "V"), - (0xA658, "M", "ꙙ"), - (0xA659, "V"), - (0xA65A, "M", "ꙛ"), - (0xA65B, "V"), - (0xA65C, "M", "ꙝ"), - (0xA65D, "V"), - (0xA65E, "M", "ꙟ"), - (0xA65F, "V"), - (0xA660, "M", "ꙡ"), - (0xA661, "V"), - (0xA662, "M", "ꙣ"), - (0xA663, "V"), - (0xA664, "M", "ꙥ"), - (0xA665, "V"), - (0xA666, "M", "ꙧ"), - (0xA667, "V"), - (0xA668, "M", "ꙩ"), - (0xA669, "V"), - (0xA66A, "M", "ꙫ"), - (0xA66B, "V"), - (0xA66C, "M", "ꙭ"), - (0xA66D, "V"), - (0xA680, "M", "ꚁ"), - (0xA681, "V"), - (0xA682, "M", "ꚃ"), - (0xA683, "V"), - (0xA684, "M", "ꚅ"), - (0xA685, "V"), - (0xA686, "M", "ꚇ"), - (0xA687, "V"), - (0xA688, "M", "ꚉ"), - (0xA689, "V"), - (0xA68A, "M", "ꚋ"), - (0xA68B, "V"), - (0xA68C, "M", "ꚍ"), - (0xA68D, "V"), - (0xA68E, "M", "ꚏ"), - (0xA68F, "V"), - (0xA690, "M", "ꚑ"), - (0xA691, "V"), - ] - - -def _seg_36() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA692, "M", "ꚓ"), - (0xA693, "V"), - (0xA694, "M", "ꚕ"), - (0xA695, "V"), - (0xA696, "M", "ꚗ"), - (0xA697, "V"), - (0xA698, "M", "ꚙ"), - (0xA699, "V"), - (0xA69A, "M", "ꚛ"), - (0xA69B, "V"), - (0xA69C, "M", "ъ"), - (0xA69D, "M", "ь"), - (0xA69E, "V"), - (0xA6F8, "X"), - (0xA700, "V"), - (0xA722, "M", "ꜣ"), - (0xA723, "V"), - (0xA724, "M", "ꜥ"), - (0xA725, "V"), - (0xA726, "M", "ꜧ"), - (0xA727, "V"), - (0xA728, "M", "ꜩ"), - (0xA729, "V"), - (0xA72A, "M", "ꜫ"), - (0xA72B, "V"), - (0xA72C, "M", "ꜭ"), - (0xA72D, "V"), - (0xA72E, "M", "ꜯ"), - (0xA72F, "V"), - (0xA732, "M", "ꜳ"), - (0xA733, "V"), - (0xA734, "M", "ꜵ"), - (0xA735, "V"), - (0xA736, "M", "ꜷ"), - (0xA737, "V"), - (0xA738, "M", "ꜹ"), - (0xA739, "V"), - (0xA73A, "M", "ꜻ"), - (0xA73B, "V"), - (0xA73C, "M", "ꜽ"), - (0xA73D, "V"), - (0xA73E, "M", "ꜿ"), - (0xA73F, "V"), - (0xA740, "M", "ꝁ"), - (0xA741, "V"), - (0xA742, "M", "ꝃ"), - (0xA743, "V"), - (0xA744, "M", "ꝅ"), - (0xA745, "V"), - (0xA746, "M", "ꝇ"), - (0xA747, "V"), - (0xA748, "M", "ꝉ"), - (0xA749, "V"), - (0xA74A, "M", "ꝋ"), - (0xA74B, "V"), - (0xA74C, "M", "ꝍ"), - (0xA74D, "V"), - (0xA74E, "M", "ꝏ"), - (0xA74F, "V"), - (0xA750, "M", "ꝑ"), - (0xA751, "V"), - (0xA752, "M", "ꝓ"), - (0xA753, "V"), - (0xA754, "M", "ꝕ"), - (0xA755, "V"), - (0xA756, "M", "ꝗ"), - (0xA757, "V"), - (0xA758, "M", "ꝙ"), - (0xA759, "V"), - (0xA75A, "M", "ꝛ"), - (0xA75B, "V"), - (0xA75C, "M", "ꝝ"), - (0xA75D, "V"), - (0xA75E, "M", "ꝟ"), - (0xA75F, "V"), - (0xA760, "M", "ꝡ"), - (0xA761, "V"), - (0xA762, "M", "ꝣ"), - (0xA763, "V"), - (0xA764, "M", "ꝥ"), - (0xA765, "V"), - (0xA766, "M", "ꝧ"), - (0xA767, "V"), - (0xA768, "M", "ꝩ"), - (0xA769, "V"), - (0xA76A, "M", "ꝫ"), - (0xA76B, "V"), - (0xA76C, "M", "ꝭ"), - (0xA76D, "V"), - (0xA76E, "M", "ꝯ"), - (0xA76F, "V"), - (0xA770, "M", "ꝯ"), - (0xA771, "V"), - (0xA779, "M", "ꝺ"), - (0xA77A, "V"), - (0xA77B, "M", "ꝼ"), - (0xA77C, "V"), - (0xA77D, "M", "ᵹ"), - (0xA77E, "M", "ꝿ"), - (0xA77F, "V"), - ] - - -def _seg_37() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA780, "M", "ꞁ"), - (0xA781, "V"), - (0xA782, "M", "ꞃ"), - (0xA783, "V"), - (0xA784, "M", "ꞅ"), - (0xA785, "V"), - (0xA786, "M", "ꞇ"), - (0xA787, "V"), - (0xA78B, "M", "ꞌ"), - (0xA78C, "V"), - (0xA78D, "M", "ɥ"), - (0xA78E, "V"), - (0xA790, "M", "ꞑ"), - (0xA791, "V"), - (0xA792, "M", "ꞓ"), - (0xA793, "V"), - (0xA796, "M", "ꞗ"), - (0xA797, "V"), - (0xA798, "M", "ꞙ"), - (0xA799, "V"), - (0xA79A, "M", "ꞛ"), - (0xA79B, "V"), - (0xA79C, "M", "ꞝ"), - (0xA79D, "V"), - (0xA79E, "M", "ꞟ"), - (0xA79F, "V"), - (0xA7A0, "M", "ꞡ"), - (0xA7A1, "V"), - (0xA7A2, "M", "ꞣ"), - (0xA7A3, "V"), - (0xA7A4, "M", "ꞥ"), - (0xA7A5, "V"), - (0xA7A6, "M", "ꞧ"), - (0xA7A7, "V"), - (0xA7A8, "M", "ꞩ"), - (0xA7A9, "V"), - (0xA7AA, "M", "ɦ"), - (0xA7AB, "M", "ɜ"), - (0xA7AC, "M", "ɡ"), - (0xA7AD, "M", "ɬ"), - (0xA7AE, "M", "ɪ"), - (0xA7AF, "V"), - (0xA7B0, "M", "ʞ"), - (0xA7B1, "M", "ʇ"), - (0xA7B2, "M", "ʝ"), - (0xA7B3, "M", "ꭓ"), - (0xA7B4, "M", "ꞵ"), - (0xA7B5, "V"), - (0xA7B6, "M", "ꞷ"), - (0xA7B7, "V"), - (0xA7B8, "M", "ꞹ"), - (0xA7B9, "V"), - (0xA7BA, "M", "ꞻ"), - (0xA7BB, "V"), - (0xA7BC, "M", "ꞽ"), - (0xA7BD, "V"), - (0xA7BE, "M", "ꞿ"), - (0xA7BF, "V"), - (0xA7C0, "M", "ꟁ"), - (0xA7C1, "V"), - (0xA7C2, "M", "ꟃ"), - (0xA7C3, "V"), - (0xA7C4, "M", "ꞔ"), - (0xA7C5, "M", "ʂ"), - (0xA7C6, "M", "ᶎ"), - (0xA7C7, "M", "ꟈ"), - (0xA7C8, "V"), - (0xA7C9, "M", "ꟊ"), - (0xA7CA, "V"), - (0xA7CB, "X"), - (0xA7D0, "M", "ꟑ"), - (0xA7D1, "V"), - (0xA7D2, "X"), - (0xA7D3, "V"), - (0xA7D4, "X"), - (0xA7D5, "V"), - (0xA7D6, "M", "ꟗ"), - (0xA7D7, "V"), - (0xA7D8, "M", "ꟙ"), - (0xA7D9, "V"), - (0xA7DA, "X"), - (0xA7F2, "M", "c"), - (0xA7F3, "M", "f"), - (0xA7F4, "M", "q"), - (0xA7F5, "M", "ꟶ"), - (0xA7F6, "V"), - (0xA7F8, "M", "ħ"), - (0xA7F9, "M", "œ"), - (0xA7FA, "V"), - (0xA82D, "X"), - (0xA830, "V"), - (0xA83A, "X"), - (0xA840, "V"), - (0xA878, "X"), - (0xA880, "V"), - (0xA8C6, "X"), - (0xA8CE, "V"), - (0xA8DA, "X"), - (0xA8E0, "V"), - (0xA954, "X"), - ] - - -def _seg_38() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xA95F, "V"), - (0xA97D, "X"), - (0xA980, "V"), - (0xA9CE, "X"), - (0xA9CF, "V"), - (0xA9DA, "X"), - (0xA9DE, "V"), - (0xA9FF, "X"), - (0xAA00, "V"), - (0xAA37, "X"), - (0xAA40, "V"), - (0xAA4E, "X"), - (0xAA50, "V"), - (0xAA5A, "X"), - (0xAA5C, "V"), - (0xAAC3, "X"), - (0xAADB, "V"), - (0xAAF7, "X"), - (0xAB01, "V"), - (0xAB07, "X"), - (0xAB09, "V"), - (0xAB0F, "X"), - (0xAB11, "V"), - (0xAB17, "X"), - (0xAB20, "V"), - (0xAB27, "X"), - (0xAB28, "V"), - (0xAB2F, "X"), - (0xAB30, "V"), - (0xAB5C, "M", "ꜧ"), - (0xAB5D, "M", "ꬷ"), - (0xAB5E, "M", "ɫ"), - (0xAB5F, "M", "ꭒ"), - (0xAB60, "V"), - (0xAB69, "M", "ʍ"), - (0xAB6A, "V"), - (0xAB6C, "X"), - (0xAB70, "M", "Ꭰ"), - (0xAB71, "M", "Ꭱ"), - (0xAB72, "M", "Ꭲ"), - (0xAB73, "M", "Ꭳ"), - (0xAB74, "M", "Ꭴ"), - (0xAB75, "M", "Ꭵ"), - (0xAB76, "M", "Ꭶ"), - (0xAB77, "M", "Ꭷ"), - (0xAB78, "M", "Ꭸ"), - (0xAB79, "M", "Ꭹ"), - (0xAB7A, "M", "Ꭺ"), - (0xAB7B, "M", "Ꭻ"), - (0xAB7C, "M", "Ꭼ"), - (0xAB7D, "M", "Ꭽ"), - (0xAB7E, "M", "Ꭾ"), - (0xAB7F, "M", "Ꭿ"), - (0xAB80, "M", "Ꮀ"), - (0xAB81, "M", "Ꮁ"), - (0xAB82, "M", "Ꮂ"), - (0xAB83, "M", "Ꮃ"), - (0xAB84, "M", "Ꮄ"), - (0xAB85, "M", "Ꮅ"), - (0xAB86, "M", "Ꮆ"), - (0xAB87, "M", "Ꮇ"), - (0xAB88, "M", "Ꮈ"), - (0xAB89, "M", "Ꮉ"), - (0xAB8A, "M", "Ꮊ"), - (0xAB8B, "M", "Ꮋ"), - (0xAB8C, "M", "Ꮌ"), - (0xAB8D, "M", "Ꮍ"), - (0xAB8E, "M", "Ꮎ"), - (0xAB8F, "M", "Ꮏ"), - (0xAB90, "M", "Ꮐ"), - (0xAB91, "M", "Ꮑ"), - (0xAB92, "M", "Ꮒ"), - (0xAB93, "M", "Ꮓ"), - (0xAB94, "M", "Ꮔ"), - (0xAB95, "M", "Ꮕ"), - (0xAB96, "M", "Ꮖ"), - (0xAB97, "M", "Ꮗ"), - (0xAB98, "M", "Ꮘ"), - (0xAB99, "M", "Ꮙ"), - (0xAB9A, "M", "Ꮚ"), - (0xAB9B, "M", "Ꮛ"), - (0xAB9C, "M", "Ꮜ"), - (0xAB9D, "M", "Ꮝ"), - (0xAB9E, "M", "Ꮞ"), - (0xAB9F, "M", "Ꮟ"), - (0xABA0, "M", "Ꮠ"), - (0xABA1, "M", "Ꮡ"), - (0xABA2, "M", "Ꮢ"), - (0xABA3, "M", "Ꮣ"), - (0xABA4, "M", "Ꮤ"), - (0xABA5, "M", "Ꮥ"), - (0xABA6, "M", "Ꮦ"), - (0xABA7, "M", "Ꮧ"), - (0xABA8, "M", "Ꮨ"), - (0xABA9, "M", "Ꮩ"), - (0xABAA, "M", "Ꮪ"), - (0xABAB, "M", "Ꮫ"), - (0xABAC, "M", "Ꮬ"), - (0xABAD, "M", "Ꮭ"), - (0xABAE, "M", "Ꮮ"), - ] - - -def _seg_39() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xABAF, "M", "Ꮯ"), - (0xABB0, "M", "Ꮰ"), - (0xABB1, "M", "Ꮱ"), - (0xABB2, "M", "Ꮲ"), - (0xABB3, "M", "Ꮳ"), - (0xABB4, "M", "Ꮴ"), - (0xABB5, "M", "Ꮵ"), - (0xABB6, "M", "Ꮶ"), - (0xABB7, "M", "Ꮷ"), - (0xABB8, "M", "Ꮸ"), - (0xABB9, "M", "Ꮹ"), - (0xABBA, "M", "Ꮺ"), - (0xABBB, "M", "Ꮻ"), - (0xABBC, "M", "Ꮼ"), - (0xABBD, "M", "Ꮽ"), - (0xABBE, "M", "Ꮾ"), - (0xABBF, "M", "Ꮿ"), - (0xABC0, "V"), - (0xABEE, "X"), - (0xABF0, "V"), - (0xABFA, "X"), - (0xAC00, "V"), - (0xD7A4, "X"), - (0xD7B0, "V"), - (0xD7C7, "X"), - (0xD7CB, "V"), - (0xD7FC, "X"), - (0xF900, "M", "豈"), - (0xF901, "M", "更"), - (0xF902, "M", "車"), - (0xF903, "M", "賈"), - (0xF904, "M", "滑"), - (0xF905, "M", "串"), - (0xF906, "M", "句"), - (0xF907, "M", "龜"), - (0xF909, "M", "契"), - (0xF90A, "M", "金"), - (0xF90B, "M", "喇"), - (0xF90C, "M", "奈"), - (0xF90D, "M", "懶"), - (0xF90E, "M", "癩"), - (0xF90F, "M", "羅"), - (0xF910, "M", "蘿"), - (0xF911, "M", "螺"), - (0xF912, "M", "裸"), - (0xF913, "M", "邏"), - (0xF914, "M", "樂"), - (0xF915, "M", "洛"), - (0xF916, "M", "烙"), - (0xF917, "M", "珞"), - (0xF918, "M", "落"), - (0xF919, "M", "酪"), - (0xF91A, "M", "駱"), - (0xF91B, "M", "亂"), - (0xF91C, "M", "卵"), - (0xF91D, "M", "欄"), - (0xF91E, "M", "爛"), - (0xF91F, "M", "蘭"), - (0xF920, "M", "鸞"), - (0xF921, "M", "嵐"), - (0xF922, "M", "濫"), - (0xF923, "M", "藍"), - (0xF924, "M", "襤"), - (0xF925, "M", "拉"), - (0xF926, "M", "臘"), - (0xF927, "M", "蠟"), - (0xF928, "M", "廊"), - (0xF929, "M", "朗"), - (0xF92A, "M", "浪"), - (0xF92B, "M", "狼"), - (0xF92C, "M", "郎"), - (0xF92D, "M", "來"), - (0xF92E, "M", "冷"), - (0xF92F, "M", "勞"), - (0xF930, "M", "擄"), - (0xF931, "M", "櫓"), - (0xF932, "M", "爐"), - (0xF933, "M", "盧"), - (0xF934, "M", "老"), - (0xF935, "M", "蘆"), - (0xF936, "M", "虜"), - (0xF937, "M", "路"), - (0xF938, "M", "露"), - (0xF939, "M", "魯"), - (0xF93A, "M", "鷺"), - (0xF93B, "M", "碌"), - (0xF93C, "M", "祿"), - (0xF93D, "M", "綠"), - (0xF93E, "M", "菉"), - (0xF93F, "M", "錄"), - (0xF940, "M", "鹿"), - (0xF941, "M", "論"), - (0xF942, "M", "壟"), - (0xF943, "M", "弄"), - (0xF944, "M", "籠"), - (0xF945, "M", "聾"), - (0xF946, "M", "牢"), - (0xF947, "M", "磊"), - (0xF948, "M", "賂"), - (0xF949, "M", "雷"), - ] - - -def _seg_40() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xF94A, "M", "壘"), - (0xF94B, "M", "屢"), - (0xF94C, "M", "樓"), - (0xF94D, "M", "淚"), - (0xF94E, "M", "漏"), - (0xF94F, "M", "累"), - (0xF950, "M", "縷"), - (0xF951, "M", "陋"), - (0xF952, "M", "勒"), - (0xF953, "M", "肋"), - (0xF954, "M", "凜"), - (0xF955, "M", "凌"), - (0xF956, "M", "稜"), - (0xF957, "M", "綾"), - (0xF958, "M", "菱"), - (0xF959, "M", "陵"), - (0xF95A, "M", "讀"), - (0xF95B, "M", "拏"), - (0xF95C, "M", "樂"), - (0xF95D, "M", "諾"), - (0xF95E, "M", "丹"), - (0xF95F, "M", "寧"), - (0xF960, "M", "怒"), - (0xF961, "M", "率"), - (0xF962, "M", "異"), - (0xF963, "M", "北"), - (0xF964, "M", "磻"), - (0xF965, "M", "便"), - (0xF966, "M", "復"), - (0xF967, "M", "不"), - (0xF968, "M", "泌"), - (0xF969, "M", "數"), - (0xF96A, "M", "索"), - (0xF96B, "M", "參"), - (0xF96C, "M", "塞"), - (0xF96D, "M", "省"), - (0xF96E, "M", "葉"), - (0xF96F, "M", "說"), - (0xF970, "M", "殺"), - (0xF971, "M", "辰"), - (0xF972, "M", "沈"), - (0xF973, "M", "拾"), - (0xF974, "M", "若"), - (0xF975, "M", "掠"), - (0xF976, "M", "略"), - (0xF977, "M", "亮"), - (0xF978, "M", "兩"), - (0xF979, "M", "凉"), - (0xF97A, "M", "梁"), - (0xF97B, "M", "糧"), - (0xF97C, "M", "良"), - (0xF97D, "M", "諒"), - (0xF97E, "M", "量"), - (0xF97F, "M", "勵"), - (0xF980, "M", "呂"), - (0xF981, "M", "女"), - (0xF982, "M", "廬"), - (0xF983, "M", "旅"), - (0xF984, "M", "濾"), - (0xF985, "M", "礪"), - (0xF986, "M", "閭"), - (0xF987, "M", "驪"), - (0xF988, "M", "麗"), - (0xF989, "M", "黎"), - (0xF98A, "M", "力"), - (0xF98B, "M", "曆"), - (0xF98C, "M", "歷"), - (0xF98D, "M", "轢"), - (0xF98E, "M", "年"), - (0xF98F, "M", "憐"), - (0xF990, "M", "戀"), - (0xF991, "M", "撚"), - (0xF992, "M", "漣"), - (0xF993, "M", "煉"), - (0xF994, "M", "璉"), - (0xF995, "M", "秊"), - (0xF996, "M", "練"), - (0xF997, "M", "聯"), - (0xF998, "M", "輦"), - (0xF999, "M", "蓮"), - (0xF99A, "M", "連"), - (0xF99B, "M", "鍊"), - (0xF99C, "M", "列"), - (0xF99D, "M", "劣"), - (0xF99E, "M", "咽"), - (0xF99F, "M", "烈"), - (0xF9A0, "M", "裂"), - (0xF9A1, "M", "說"), - (0xF9A2, "M", "廉"), - (0xF9A3, "M", "念"), - (0xF9A4, "M", "捻"), - (0xF9A5, "M", "殮"), - (0xF9A6, "M", "簾"), - (0xF9A7, "M", "獵"), - (0xF9A8, "M", "令"), - (0xF9A9, "M", "囹"), - (0xF9AA, "M", "寧"), - (0xF9AB, "M", "嶺"), - (0xF9AC, "M", "怜"), - (0xF9AD, "M", "玲"), - ] - - -def _seg_41() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xF9AE, "M", "瑩"), - (0xF9AF, "M", "羚"), - (0xF9B0, "M", "聆"), - (0xF9B1, "M", "鈴"), - (0xF9B2, "M", "零"), - (0xF9B3, "M", "靈"), - (0xF9B4, "M", "領"), - (0xF9B5, "M", "例"), - (0xF9B6, "M", "禮"), - (0xF9B7, "M", "醴"), - (0xF9B8, "M", "隸"), - (0xF9B9, "M", "惡"), - (0xF9BA, "M", "了"), - (0xF9BB, "M", "僚"), - (0xF9BC, "M", "寮"), - (0xF9BD, "M", "尿"), - (0xF9BE, "M", "料"), - (0xF9BF, "M", "樂"), - (0xF9C0, "M", "燎"), - (0xF9C1, "M", "療"), - (0xF9C2, "M", "蓼"), - (0xF9C3, "M", "遼"), - (0xF9C4, "M", "龍"), - (0xF9C5, "M", "暈"), - (0xF9C6, "M", "阮"), - (0xF9C7, "M", "劉"), - (0xF9C8, "M", "杻"), - (0xF9C9, "M", "柳"), - (0xF9CA, "M", "流"), - (0xF9CB, "M", "溜"), - (0xF9CC, "M", "琉"), - (0xF9CD, "M", "留"), - (0xF9CE, "M", "硫"), - (0xF9CF, "M", "紐"), - (0xF9D0, "M", "類"), - (0xF9D1, "M", "六"), - (0xF9D2, "M", "戮"), - (0xF9D3, "M", "陸"), - (0xF9D4, "M", "倫"), - (0xF9D5, "M", "崙"), - (0xF9D6, "M", "淪"), - (0xF9D7, "M", "輪"), - (0xF9D8, "M", "律"), - (0xF9D9, "M", "慄"), - (0xF9DA, "M", "栗"), - (0xF9DB, "M", "率"), - (0xF9DC, "M", "隆"), - (0xF9DD, "M", "利"), - (0xF9DE, "M", "吏"), - (0xF9DF, "M", "履"), - (0xF9E0, "M", "易"), - (0xF9E1, "M", "李"), - (0xF9E2, "M", "梨"), - (0xF9E3, "M", "泥"), - (0xF9E4, "M", "理"), - (0xF9E5, "M", "痢"), - (0xF9E6, "M", "罹"), - (0xF9E7, "M", "裏"), - (0xF9E8, "M", "裡"), - (0xF9E9, "M", "里"), - (0xF9EA, "M", "離"), - (0xF9EB, "M", "匿"), - (0xF9EC, "M", "溺"), - (0xF9ED, "M", "吝"), - (0xF9EE, "M", "燐"), - (0xF9EF, "M", "璘"), - (0xF9F0, "M", "藺"), - (0xF9F1, "M", "隣"), - (0xF9F2, "M", "鱗"), - (0xF9F3, "M", "麟"), - (0xF9F4, "M", "林"), - (0xF9F5, "M", "淋"), - (0xF9F6, "M", "臨"), - (0xF9F7, "M", "立"), - (0xF9F8, "M", "笠"), - (0xF9F9, "M", "粒"), - (0xF9FA, "M", "狀"), - (0xF9FB, "M", "炙"), - (0xF9FC, "M", "識"), - (0xF9FD, "M", "什"), - (0xF9FE, "M", "茶"), - (0xF9FF, "M", "刺"), - (0xFA00, "M", "切"), - (0xFA01, "M", "度"), - (0xFA02, "M", "拓"), - (0xFA03, "M", "糖"), - (0xFA04, "M", "宅"), - (0xFA05, "M", "洞"), - (0xFA06, "M", "暴"), - (0xFA07, "M", "輻"), - (0xFA08, "M", "行"), - (0xFA09, "M", "降"), - (0xFA0A, "M", "見"), - (0xFA0B, "M", "廓"), - (0xFA0C, "M", "兀"), - (0xFA0D, "M", "嗀"), - (0xFA0E, "V"), - (0xFA10, "M", "塚"), - (0xFA11, "V"), - (0xFA12, "M", "晴"), - ] - - -def _seg_42() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFA13, "V"), - (0xFA15, "M", "凞"), - (0xFA16, "M", "猪"), - (0xFA17, "M", "益"), - (0xFA18, "M", "礼"), - (0xFA19, "M", "神"), - (0xFA1A, "M", "祥"), - (0xFA1B, "M", "福"), - (0xFA1C, "M", "靖"), - (0xFA1D, "M", "精"), - (0xFA1E, "M", "羽"), - (0xFA1F, "V"), - (0xFA20, "M", "蘒"), - (0xFA21, "V"), - (0xFA22, "M", "諸"), - (0xFA23, "V"), - (0xFA25, "M", "逸"), - (0xFA26, "M", "都"), - (0xFA27, "V"), - (0xFA2A, "M", "飯"), - (0xFA2B, "M", "飼"), - (0xFA2C, "M", "館"), - (0xFA2D, "M", "鶴"), - (0xFA2E, "M", "郞"), - (0xFA2F, "M", "隷"), - (0xFA30, "M", "侮"), - (0xFA31, "M", "僧"), - (0xFA32, "M", "免"), - (0xFA33, "M", "勉"), - (0xFA34, "M", "勤"), - (0xFA35, "M", "卑"), - (0xFA36, "M", "喝"), - (0xFA37, "M", "嘆"), - (0xFA38, "M", "器"), - (0xFA39, "M", "塀"), - (0xFA3A, "M", "墨"), - (0xFA3B, "M", "層"), - (0xFA3C, "M", "屮"), - (0xFA3D, "M", "悔"), - (0xFA3E, "M", "慨"), - (0xFA3F, "M", "憎"), - (0xFA40, "M", "懲"), - (0xFA41, "M", "敏"), - (0xFA42, "M", "既"), - (0xFA43, "M", "暑"), - (0xFA44, "M", "梅"), - (0xFA45, "M", "海"), - (0xFA46, "M", "渚"), - (0xFA47, "M", "漢"), - (0xFA48, "M", "煮"), - (0xFA49, "M", "爫"), - (0xFA4A, "M", "琢"), - (0xFA4B, "M", "碑"), - (0xFA4C, "M", "社"), - (0xFA4D, "M", "祉"), - (0xFA4E, "M", "祈"), - (0xFA4F, "M", "祐"), - (0xFA50, "M", "祖"), - (0xFA51, "M", "祝"), - (0xFA52, "M", "禍"), - (0xFA53, "M", "禎"), - (0xFA54, "M", "穀"), - (0xFA55, "M", "突"), - (0xFA56, "M", "節"), - (0xFA57, "M", "練"), - (0xFA58, "M", "縉"), - (0xFA59, "M", "繁"), - (0xFA5A, "M", "署"), - (0xFA5B, "M", "者"), - (0xFA5C, "M", "臭"), - (0xFA5D, "M", "艹"), - (0xFA5F, "M", "著"), - (0xFA60, "M", "褐"), - (0xFA61, "M", "視"), - (0xFA62, "M", "謁"), - (0xFA63, "M", "謹"), - (0xFA64, "M", "賓"), - (0xFA65, "M", "贈"), - (0xFA66, "M", "辶"), - (0xFA67, "M", "逸"), - (0xFA68, "M", "難"), - (0xFA69, "M", "響"), - (0xFA6A, "M", "頻"), - (0xFA6B, "M", "恵"), - (0xFA6C, "M", "𤋮"), - (0xFA6D, "M", "舘"), - (0xFA6E, "X"), - (0xFA70, "M", "並"), - (0xFA71, "M", "况"), - (0xFA72, "M", "全"), - (0xFA73, "M", "侀"), - (0xFA74, "M", "充"), - (0xFA75, "M", "冀"), - (0xFA76, "M", "勇"), - (0xFA77, "M", "勺"), - (0xFA78, "M", "喝"), - (0xFA79, "M", "啕"), - (0xFA7A, "M", "喙"), - (0xFA7B, "M", "嗢"), - (0xFA7C, "M", "塚"), - ] - - -def _seg_43() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFA7D, "M", "墳"), - (0xFA7E, "M", "奄"), - (0xFA7F, "M", "奔"), - (0xFA80, "M", "婢"), - (0xFA81, "M", "嬨"), - (0xFA82, "M", "廒"), - (0xFA83, "M", "廙"), - (0xFA84, "M", "彩"), - (0xFA85, "M", "徭"), - (0xFA86, "M", "惘"), - (0xFA87, "M", "慎"), - (0xFA88, "M", "愈"), - (0xFA89, "M", "憎"), - (0xFA8A, "M", "慠"), - (0xFA8B, "M", "懲"), - (0xFA8C, "M", "戴"), - (0xFA8D, "M", "揄"), - (0xFA8E, "M", "搜"), - (0xFA8F, "M", "摒"), - (0xFA90, "M", "敖"), - (0xFA91, "M", "晴"), - (0xFA92, "M", "朗"), - (0xFA93, "M", "望"), - (0xFA94, "M", "杖"), - (0xFA95, "M", "歹"), - (0xFA96, "M", "殺"), - (0xFA97, "M", "流"), - (0xFA98, "M", "滛"), - (0xFA99, "M", "滋"), - (0xFA9A, "M", "漢"), - (0xFA9B, "M", "瀞"), - (0xFA9C, "M", "煮"), - (0xFA9D, "M", "瞧"), - (0xFA9E, "M", "爵"), - (0xFA9F, "M", "犯"), - (0xFAA0, "M", "猪"), - (0xFAA1, "M", "瑱"), - (0xFAA2, "M", "甆"), - (0xFAA3, "M", "画"), - (0xFAA4, "M", "瘝"), - (0xFAA5, "M", "瘟"), - (0xFAA6, "M", "益"), - (0xFAA7, "M", "盛"), - (0xFAA8, "M", "直"), - (0xFAA9, "M", "睊"), - (0xFAAA, "M", "着"), - (0xFAAB, "M", "磌"), - (0xFAAC, "M", "窱"), - (0xFAAD, "M", "節"), - (0xFAAE, "M", "类"), - (0xFAAF, "M", "絛"), - (0xFAB0, "M", "練"), - (0xFAB1, "M", "缾"), - (0xFAB2, "M", "者"), - (0xFAB3, "M", "荒"), - (0xFAB4, "M", "華"), - (0xFAB5, "M", "蝹"), - (0xFAB6, "M", "襁"), - (0xFAB7, "M", "覆"), - (0xFAB8, "M", "視"), - (0xFAB9, "M", "調"), - (0xFABA, "M", "諸"), - (0xFABB, "M", "請"), - (0xFABC, "M", "謁"), - (0xFABD, "M", "諾"), - (0xFABE, "M", "諭"), - (0xFABF, "M", "謹"), - (0xFAC0, "M", "變"), - (0xFAC1, "M", "贈"), - (0xFAC2, "M", "輸"), - (0xFAC3, "M", "遲"), - (0xFAC4, "M", "醙"), - (0xFAC5, "M", "鉶"), - (0xFAC6, "M", "陼"), - (0xFAC7, "M", "難"), - (0xFAC8, "M", "靖"), - (0xFAC9, "M", "韛"), - (0xFACA, "M", "響"), - (0xFACB, "M", "頋"), - (0xFACC, "M", "頻"), - (0xFACD, "M", "鬒"), - (0xFACE, "M", "龜"), - (0xFACF, "M", "𢡊"), - (0xFAD0, "M", "𢡄"), - (0xFAD1, "M", "𣏕"), - (0xFAD2, "M", "㮝"), - (0xFAD3, "M", "䀘"), - (0xFAD4, "M", "䀹"), - (0xFAD5, "M", "𥉉"), - (0xFAD6, "M", "𥳐"), - (0xFAD7, "M", "𧻓"), - (0xFAD8, "M", "齃"), - (0xFAD9, "M", "龎"), - (0xFADA, "X"), - (0xFB00, "M", "ff"), - (0xFB01, "M", "fi"), - (0xFB02, "M", "fl"), - (0xFB03, "M", "ffi"), - (0xFB04, "M", "ffl"), - (0xFB05, "M", "st"), - ] - - -def _seg_44() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFB07, "X"), - (0xFB13, "M", "մն"), - (0xFB14, "M", "մե"), - (0xFB15, "M", "մի"), - (0xFB16, "M", "վն"), - (0xFB17, "M", "մխ"), - (0xFB18, "X"), - (0xFB1D, "M", "יִ"), - (0xFB1E, "V"), - (0xFB1F, "M", "ײַ"), - (0xFB20, "M", "ע"), - (0xFB21, "M", "א"), - (0xFB22, "M", "ד"), - (0xFB23, "M", "ה"), - (0xFB24, "M", "כ"), - (0xFB25, "M", "ל"), - (0xFB26, "M", "ם"), - (0xFB27, "M", "ר"), - (0xFB28, "M", "ת"), - (0xFB29, "3", "+"), - (0xFB2A, "M", "שׁ"), - (0xFB2B, "M", "שׂ"), - (0xFB2C, "M", "שּׁ"), - (0xFB2D, "M", "שּׂ"), - (0xFB2E, "M", "אַ"), - (0xFB2F, "M", "אָ"), - (0xFB30, "M", "אּ"), - (0xFB31, "M", "בּ"), - (0xFB32, "M", "גּ"), - (0xFB33, "M", "דּ"), - (0xFB34, "M", "הּ"), - (0xFB35, "M", "וּ"), - (0xFB36, "M", "זּ"), - (0xFB37, "X"), - (0xFB38, "M", "טּ"), - (0xFB39, "M", "יּ"), - (0xFB3A, "M", "ךּ"), - (0xFB3B, "M", "כּ"), - (0xFB3C, "M", "לּ"), - (0xFB3D, "X"), - (0xFB3E, "M", "מּ"), - (0xFB3F, "X"), - (0xFB40, "M", "נּ"), - (0xFB41, "M", "סּ"), - (0xFB42, "X"), - (0xFB43, "M", "ףּ"), - (0xFB44, "M", "פּ"), - (0xFB45, "X"), - (0xFB46, "M", "צּ"), - (0xFB47, "M", "קּ"), - (0xFB48, "M", "רּ"), - (0xFB49, "M", "שּ"), - (0xFB4A, "M", "תּ"), - (0xFB4B, "M", "וֹ"), - (0xFB4C, "M", "בֿ"), - (0xFB4D, "M", "כֿ"), - (0xFB4E, "M", "פֿ"), - (0xFB4F, "M", "אל"), - (0xFB50, "M", "ٱ"), - (0xFB52, "M", "ٻ"), - (0xFB56, "M", "پ"), - (0xFB5A, "M", "ڀ"), - (0xFB5E, "M", "ٺ"), - (0xFB62, "M", "ٿ"), - (0xFB66, "M", "ٹ"), - (0xFB6A, "M", "ڤ"), - (0xFB6E, "M", "ڦ"), - (0xFB72, "M", "ڄ"), - (0xFB76, "M", "ڃ"), - (0xFB7A, "M", "چ"), - (0xFB7E, "M", "ڇ"), - (0xFB82, "M", "ڍ"), - (0xFB84, "M", "ڌ"), - (0xFB86, "M", "ڎ"), - (0xFB88, "M", "ڈ"), - (0xFB8A, "M", "ژ"), - (0xFB8C, "M", "ڑ"), - (0xFB8E, "M", "ک"), - (0xFB92, "M", "گ"), - (0xFB96, "M", "ڳ"), - (0xFB9A, "M", "ڱ"), - (0xFB9E, "M", "ں"), - (0xFBA0, "M", "ڻ"), - (0xFBA4, "M", "ۀ"), - (0xFBA6, "M", "ہ"), - (0xFBAA, "M", "ھ"), - (0xFBAE, "M", "ے"), - (0xFBB0, "M", "ۓ"), - (0xFBB2, "V"), - (0xFBC3, "X"), - (0xFBD3, "M", "ڭ"), - (0xFBD7, "M", "ۇ"), - (0xFBD9, "M", "ۆ"), - (0xFBDB, "M", "ۈ"), - (0xFBDD, "M", "ۇٴ"), - (0xFBDE, "M", "ۋ"), - (0xFBE0, "M", "ۅ"), - (0xFBE2, "M", "ۉ"), - (0xFBE4, "M", "ې"), - (0xFBE8, "M", "ى"), - ] - - -def _seg_45() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFBEA, "M", "ئا"), - (0xFBEC, "M", "ئە"), - (0xFBEE, "M", "ئو"), - (0xFBF0, "M", "ئۇ"), - (0xFBF2, "M", "ئۆ"), - (0xFBF4, "M", "ئۈ"), - (0xFBF6, "M", "ئې"), - (0xFBF9, "M", "ئى"), - (0xFBFC, "M", "ی"), - (0xFC00, "M", "ئج"), - (0xFC01, "M", "ئح"), - (0xFC02, "M", "ئم"), - (0xFC03, "M", "ئى"), - (0xFC04, "M", "ئي"), - (0xFC05, "M", "بج"), - (0xFC06, "M", "بح"), - (0xFC07, "M", "بخ"), - (0xFC08, "M", "بم"), - (0xFC09, "M", "بى"), - (0xFC0A, "M", "بي"), - (0xFC0B, "M", "تج"), - (0xFC0C, "M", "تح"), - (0xFC0D, "M", "تخ"), - (0xFC0E, "M", "تم"), - (0xFC0F, "M", "تى"), - (0xFC10, "M", "تي"), - (0xFC11, "M", "ثج"), - (0xFC12, "M", "ثم"), - (0xFC13, "M", "ثى"), - (0xFC14, "M", "ثي"), - (0xFC15, "M", "جح"), - (0xFC16, "M", "جم"), - (0xFC17, "M", "حج"), - (0xFC18, "M", "حم"), - (0xFC19, "M", "خج"), - (0xFC1A, "M", "خح"), - (0xFC1B, "M", "خم"), - (0xFC1C, "M", "سج"), - (0xFC1D, "M", "سح"), - (0xFC1E, "M", "سخ"), - (0xFC1F, "M", "سم"), - (0xFC20, "M", "صح"), - (0xFC21, "M", "صم"), - (0xFC22, "M", "ضج"), - (0xFC23, "M", "ضح"), - (0xFC24, "M", "ضخ"), - (0xFC25, "M", "ضم"), - (0xFC26, "M", "طح"), - (0xFC27, "M", "طم"), - (0xFC28, "M", "ظم"), - (0xFC29, "M", "عج"), - (0xFC2A, "M", "عم"), - (0xFC2B, "M", "غج"), - (0xFC2C, "M", "غم"), - (0xFC2D, "M", "فج"), - (0xFC2E, "M", "فح"), - (0xFC2F, "M", "فخ"), - (0xFC30, "M", "فم"), - (0xFC31, "M", "فى"), - (0xFC32, "M", "في"), - (0xFC33, "M", "قح"), - (0xFC34, "M", "قم"), - (0xFC35, "M", "قى"), - (0xFC36, "M", "قي"), - (0xFC37, "M", "كا"), - (0xFC38, "M", "كج"), - (0xFC39, "M", "كح"), - (0xFC3A, "M", "كخ"), - (0xFC3B, "M", "كل"), - (0xFC3C, "M", "كم"), - (0xFC3D, "M", "كى"), - (0xFC3E, "M", "كي"), - (0xFC3F, "M", "لج"), - (0xFC40, "M", "لح"), - (0xFC41, "M", "لخ"), - (0xFC42, "M", "لم"), - (0xFC43, "M", "لى"), - (0xFC44, "M", "لي"), - (0xFC45, "M", "مج"), - (0xFC46, "M", "مح"), - (0xFC47, "M", "مخ"), - (0xFC48, "M", "مم"), - (0xFC49, "M", "مى"), - (0xFC4A, "M", "مي"), - (0xFC4B, "M", "نج"), - (0xFC4C, "M", "نح"), - (0xFC4D, "M", "نخ"), - (0xFC4E, "M", "نم"), - (0xFC4F, "M", "نى"), - (0xFC50, "M", "ني"), - (0xFC51, "M", "هج"), - (0xFC52, "M", "هم"), - (0xFC53, "M", "هى"), - (0xFC54, "M", "هي"), - (0xFC55, "M", "يج"), - (0xFC56, "M", "يح"), - (0xFC57, "M", "يخ"), - (0xFC58, "M", "يم"), - (0xFC59, "M", "يى"), - (0xFC5A, "M", "يي"), - ] - - -def _seg_46() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFC5B, "M", "ذٰ"), - (0xFC5C, "M", "رٰ"), - (0xFC5D, "M", "ىٰ"), - (0xFC5E, "3", " ٌّ"), - (0xFC5F, "3", " ٍّ"), - (0xFC60, "3", " َّ"), - (0xFC61, "3", " ُّ"), - (0xFC62, "3", " ِّ"), - (0xFC63, "3", " ّٰ"), - (0xFC64, "M", "ئر"), - (0xFC65, "M", "ئز"), - (0xFC66, "M", "ئم"), - (0xFC67, "M", "ئن"), - (0xFC68, "M", "ئى"), - (0xFC69, "M", "ئي"), - (0xFC6A, "M", "بر"), - (0xFC6B, "M", "بز"), - (0xFC6C, "M", "بم"), - (0xFC6D, "M", "بن"), - (0xFC6E, "M", "بى"), - (0xFC6F, "M", "بي"), - (0xFC70, "M", "تر"), - (0xFC71, "M", "تز"), - (0xFC72, "M", "تم"), - (0xFC73, "M", "تن"), - (0xFC74, "M", "تى"), - (0xFC75, "M", "تي"), - (0xFC76, "M", "ثر"), - (0xFC77, "M", "ثز"), - (0xFC78, "M", "ثم"), - (0xFC79, "M", "ثن"), - (0xFC7A, "M", "ثى"), - (0xFC7B, "M", "ثي"), - (0xFC7C, "M", "فى"), - (0xFC7D, "M", "في"), - (0xFC7E, "M", "قى"), - (0xFC7F, "M", "قي"), - (0xFC80, "M", "كا"), - (0xFC81, "M", "كل"), - (0xFC82, "M", "كم"), - (0xFC83, "M", "كى"), - (0xFC84, "M", "كي"), - (0xFC85, "M", "لم"), - (0xFC86, "M", "لى"), - (0xFC87, "M", "لي"), - (0xFC88, "M", "ما"), - (0xFC89, "M", "مم"), - (0xFC8A, "M", "نر"), - (0xFC8B, "M", "نز"), - (0xFC8C, "M", "نم"), - (0xFC8D, "M", "نن"), - (0xFC8E, "M", "نى"), - (0xFC8F, "M", "ني"), - (0xFC90, "M", "ىٰ"), - (0xFC91, "M", "ير"), - (0xFC92, "M", "يز"), - (0xFC93, "M", "يم"), - (0xFC94, "M", "ين"), - (0xFC95, "M", "يى"), - (0xFC96, "M", "يي"), - (0xFC97, "M", "ئج"), - (0xFC98, "M", "ئح"), - (0xFC99, "M", "ئخ"), - (0xFC9A, "M", "ئم"), - (0xFC9B, "M", "ئه"), - (0xFC9C, "M", "بج"), - (0xFC9D, "M", "بح"), - (0xFC9E, "M", "بخ"), - (0xFC9F, "M", "بم"), - (0xFCA0, "M", "به"), - (0xFCA1, "M", "تج"), - (0xFCA2, "M", "تح"), - (0xFCA3, "M", "تخ"), - (0xFCA4, "M", "تم"), - (0xFCA5, "M", "ته"), - (0xFCA6, "M", "ثم"), - (0xFCA7, "M", "جح"), - (0xFCA8, "M", "جم"), - (0xFCA9, "M", "حج"), - (0xFCAA, "M", "حم"), - (0xFCAB, "M", "خج"), - (0xFCAC, "M", "خم"), - (0xFCAD, "M", "سج"), - (0xFCAE, "M", "سح"), - (0xFCAF, "M", "سخ"), - (0xFCB0, "M", "سم"), - (0xFCB1, "M", "صح"), - (0xFCB2, "M", "صخ"), - (0xFCB3, "M", "صم"), - (0xFCB4, "M", "ضج"), - (0xFCB5, "M", "ضح"), - (0xFCB6, "M", "ضخ"), - (0xFCB7, "M", "ضم"), - (0xFCB8, "M", "طح"), - (0xFCB9, "M", "ظم"), - (0xFCBA, "M", "عج"), - (0xFCBB, "M", "عم"), - (0xFCBC, "M", "غج"), - (0xFCBD, "M", "غم"), - (0xFCBE, "M", "فج"), - ] - - -def _seg_47() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFCBF, "M", "فح"), - (0xFCC0, "M", "فخ"), - (0xFCC1, "M", "فم"), - (0xFCC2, "M", "قح"), - (0xFCC3, "M", "قم"), - (0xFCC4, "M", "كج"), - (0xFCC5, "M", "كح"), - (0xFCC6, "M", "كخ"), - (0xFCC7, "M", "كل"), - (0xFCC8, "M", "كم"), - (0xFCC9, "M", "لج"), - (0xFCCA, "M", "لح"), - (0xFCCB, "M", "لخ"), - (0xFCCC, "M", "لم"), - (0xFCCD, "M", "له"), - (0xFCCE, "M", "مج"), - (0xFCCF, "M", "مح"), - (0xFCD0, "M", "مخ"), - (0xFCD1, "M", "مم"), - (0xFCD2, "M", "نج"), - (0xFCD3, "M", "نح"), - (0xFCD4, "M", "نخ"), - (0xFCD5, "M", "نم"), - (0xFCD6, "M", "نه"), - (0xFCD7, "M", "هج"), - (0xFCD8, "M", "هم"), - (0xFCD9, "M", "هٰ"), - (0xFCDA, "M", "يج"), - (0xFCDB, "M", "يح"), - (0xFCDC, "M", "يخ"), - (0xFCDD, "M", "يم"), - (0xFCDE, "M", "يه"), - (0xFCDF, "M", "ئم"), - (0xFCE0, "M", "ئه"), - (0xFCE1, "M", "بم"), - (0xFCE2, "M", "به"), - (0xFCE3, "M", "تم"), - (0xFCE4, "M", "ته"), - (0xFCE5, "M", "ثم"), - (0xFCE6, "M", "ثه"), - (0xFCE7, "M", "سم"), - (0xFCE8, "M", "سه"), - (0xFCE9, "M", "شم"), - (0xFCEA, "M", "شه"), - (0xFCEB, "M", "كل"), - (0xFCEC, "M", "كم"), - (0xFCED, "M", "لم"), - (0xFCEE, "M", "نم"), - (0xFCEF, "M", "نه"), - (0xFCF0, "M", "يم"), - (0xFCF1, "M", "يه"), - (0xFCF2, "M", "ـَّ"), - (0xFCF3, "M", "ـُّ"), - (0xFCF4, "M", "ـِّ"), - (0xFCF5, "M", "طى"), - (0xFCF6, "M", "طي"), - (0xFCF7, "M", "عى"), - (0xFCF8, "M", "عي"), - (0xFCF9, "M", "غى"), - (0xFCFA, "M", "غي"), - (0xFCFB, "M", "سى"), - (0xFCFC, "M", "سي"), - (0xFCFD, "M", "شى"), - (0xFCFE, "M", "شي"), - (0xFCFF, "M", "حى"), - (0xFD00, "M", "حي"), - (0xFD01, "M", "جى"), - (0xFD02, "M", "جي"), - (0xFD03, "M", "خى"), - (0xFD04, "M", "خي"), - (0xFD05, "M", "صى"), - (0xFD06, "M", "صي"), - (0xFD07, "M", "ضى"), - (0xFD08, "M", "ضي"), - (0xFD09, "M", "شج"), - (0xFD0A, "M", "شح"), - (0xFD0B, "M", "شخ"), - (0xFD0C, "M", "شم"), - (0xFD0D, "M", "شر"), - (0xFD0E, "M", "سر"), - (0xFD0F, "M", "صر"), - (0xFD10, "M", "ضر"), - (0xFD11, "M", "طى"), - (0xFD12, "M", "طي"), - (0xFD13, "M", "عى"), - (0xFD14, "M", "عي"), - (0xFD15, "M", "غى"), - (0xFD16, "M", "غي"), - (0xFD17, "M", "سى"), - (0xFD18, "M", "سي"), - (0xFD19, "M", "شى"), - (0xFD1A, "M", "شي"), - (0xFD1B, "M", "حى"), - (0xFD1C, "M", "حي"), - (0xFD1D, "M", "جى"), - (0xFD1E, "M", "جي"), - (0xFD1F, "M", "خى"), - (0xFD20, "M", "خي"), - (0xFD21, "M", "صى"), - (0xFD22, "M", "صي"), - ] - - -def _seg_48() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFD23, "M", "ضى"), - (0xFD24, "M", "ضي"), - (0xFD25, "M", "شج"), - (0xFD26, "M", "شح"), - (0xFD27, "M", "شخ"), - (0xFD28, "M", "شم"), - (0xFD29, "M", "شر"), - (0xFD2A, "M", "سر"), - (0xFD2B, "M", "صر"), - (0xFD2C, "M", "ضر"), - (0xFD2D, "M", "شج"), - (0xFD2E, "M", "شح"), - (0xFD2F, "M", "شخ"), - (0xFD30, "M", "شم"), - (0xFD31, "M", "سه"), - (0xFD32, "M", "شه"), - (0xFD33, "M", "طم"), - (0xFD34, "M", "سج"), - (0xFD35, "M", "سح"), - (0xFD36, "M", "سخ"), - (0xFD37, "M", "شج"), - (0xFD38, "M", "شح"), - (0xFD39, "M", "شخ"), - (0xFD3A, "M", "طم"), - (0xFD3B, "M", "ظم"), - (0xFD3C, "M", "اً"), - (0xFD3E, "V"), - (0xFD50, "M", "تجم"), - (0xFD51, "M", "تحج"), - (0xFD53, "M", "تحم"), - (0xFD54, "M", "تخم"), - (0xFD55, "M", "تمج"), - (0xFD56, "M", "تمح"), - (0xFD57, "M", "تمخ"), - (0xFD58, "M", "جمح"), - (0xFD5A, "M", "حمي"), - (0xFD5B, "M", "حمى"), - (0xFD5C, "M", "سحج"), - (0xFD5D, "M", "سجح"), - (0xFD5E, "M", "سجى"), - (0xFD5F, "M", "سمح"), - (0xFD61, "M", "سمج"), - (0xFD62, "M", "سمم"), - (0xFD64, "M", "صحح"), - (0xFD66, "M", "صمم"), - (0xFD67, "M", "شحم"), - (0xFD69, "M", "شجي"), - (0xFD6A, "M", "شمخ"), - (0xFD6C, "M", "شمم"), - (0xFD6E, "M", "ضحى"), - (0xFD6F, "M", "ضخم"), - (0xFD71, "M", "طمح"), - (0xFD73, "M", "طمم"), - (0xFD74, "M", "طمي"), - (0xFD75, "M", "عجم"), - (0xFD76, "M", "عمم"), - (0xFD78, "M", "عمى"), - (0xFD79, "M", "غمم"), - (0xFD7A, "M", "غمي"), - (0xFD7B, "M", "غمى"), - (0xFD7C, "M", "فخم"), - (0xFD7E, "M", "قمح"), - (0xFD7F, "M", "قمم"), - (0xFD80, "M", "لحم"), - (0xFD81, "M", "لحي"), - (0xFD82, "M", "لحى"), - (0xFD83, "M", "لجج"), - (0xFD85, "M", "لخم"), - (0xFD87, "M", "لمح"), - (0xFD89, "M", "محج"), - (0xFD8A, "M", "محم"), - (0xFD8B, "M", "محي"), - (0xFD8C, "M", "مجح"), - (0xFD8D, "M", "مجم"), - (0xFD8E, "M", "مخج"), - (0xFD8F, "M", "مخم"), - (0xFD90, "X"), - (0xFD92, "M", "مجخ"), - (0xFD93, "M", "همج"), - (0xFD94, "M", "همم"), - (0xFD95, "M", "نحم"), - (0xFD96, "M", "نحى"), - (0xFD97, "M", "نجم"), - (0xFD99, "M", "نجى"), - (0xFD9A, "M", "نمي"), - (0xFD9B, "M", "نمى"), - (0xFD9C, "M", "يمم"), - (0xFD9E, "M", "بخي"), - (0xFD9F, "M", "تجي"), - (0xFDA0, "M", "تجى"), - (0xFDA1, "M", "تخي"), - (0xFDA2, "M", "تخى"), - (0xFDA3, "M", "تمي"), - (0xFDA4, "M", "تمى"), - (0xFDA5, "M", "جمي"), - (0xFDA6, "M", "جحى"), - (0xFDA7, "M", "جمى"), - (0xFDA8, "M", "سخى"), - (0xFDA9, "M", "صحي"), - (0xFDAA, "M", "شحي"), - ] - - -def _seg_49() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFDAB, "M", "ضحي"), - (0xFDAC, "M", "لجي"), - (0xFDAD, "M", "لمي"), - (0xFDAE, "M", "يحي"), - (0xFDAF, "M", "يجي"), - (0xFDB0, "M", "يمي"), - (0xFDB1, "M", "ممي"), - (0xFDB2, "M", "قمي"), - (0xFDB3, "M", "نحي"), - (0xFDB4, "M", "قمح"), - (0xFDB5, "M", "لحم"), - (0xFDB6, "M", "عمي"), - (0xFDB7, "M", "كمي"), - (0xFDB8, "M", "نجح"), - (0xFDB9, "M", "مخي"), - (0xFDBA, "M", "لجم"), - (0xFDBB, "M", "كمم"), - (0xFDBC, "M", "لجم"), - (0xFDBD, "M", "نجح"), - (0xFDBE, "M", "جحي"), - (0xFDBF, "M", "حجي"), - (0xFDC0, "M", "مجي"), - (0xFDC1, "M", "فمي"), - (0xFDC2, "M", "بحي"), - (0xFDC3, "M", "كمم"), - (0xFDC4, "M", "عجم"), - (0xFDC5, "M", "صمم"), - (0xFDC6, "M", "سخي"), - (0xFDC7, "M", "نجي"), - (0xFDC8, "X"), - (0xFDCF, "V"), - (0xFDD0, "X"), - (0xFDF0, "M", "صلے"), - (0xFDF1, "M", "قلے"), - (0xFDF2, "M", "الله"), - (0xFDF3, "M", "اكبر"), - (0xFDF4, "M", "محمد"), - (0xFDF5, "M", "صلعم"), - (0xFDF6, "M", "رسول"), - (0xFDF7, "M", "عليه"), - (0xFDF8, "M", "وسلم"), - (0xFDF9, "M", "صلى"), - (0xFDFA, "3", "صلى الله عليه وسلم"), - (0xFDFB, "3", "جل جلاله"), - (0xFDFC, "M", "ریال"), - (0xFDFD, "V"), - (0xFE00, "I"), - (0xFE10, "3", ","), - (0xFE11, "M", "、"), - (0xFE12, "X"), - (0xFE13, "3", ":"), - (0xFE14, "3", ";"), - (0xFE15, "3", "!"), - (0xFE16, "3", "?"), - (0xFE17, "M", "〖"), - (0xFE18, "M", "〗"), - (0xFE19, "X"), - (0xFE20, "V"), - (0xFE30, "X"), - (0xFE31, "M", "—"), - (0xFE32, "M", "–"), - (0xFE33, "3", "_"), - (0xFE35, "3", "("), - (0xFE36, "3", ")"), - (0xFE37, "3", "{"), - (0xFE38, "3", "}"), - (0xFE39, "M", "〔"), - (0xFE3A, "M", "〕"), - (0xFE3B, "M", "【"), - (0xFE3C, "M", "】"), - (0xFE3D, "M", "《"), - (0xFE3E, "M", "》"), - (0xFE3F, "M", "〈"), - (0xFE40, "M", "〉"), - (0xFE41, "M", "「"), - (0xFE42, "M", "」"), - (0xFE43, "M", "『"), - (0xFE44, "M", "』"), - (0xFE45, "V"), - (0xFE47, "3", "["), - (0xFE48, "3", "]"), - (0xFE49, "3", " ̅"), - (0xFE4D, "3", "_"), - (0xFE50, "3", ","), - (0xFE51, "M", "、"), - (0xFE52, "X"), - (0xFE54, "3", ";"), - (0xFE55, "3", ":"), - (0xFE56, "3", "?"), - (0xFE57, "3", "!"), - (0xFE58, "M", "—"), - (0xFE59, "3", "("), - (0xFE5A, "3", ")"), - (0xFE5B, "3", "{"), - (0xFE5C, "3", "}"), - (0xFE5D, "M", "〔"), - (0xFE5E, "M", "〕"), - (0xFE5F, "3", "#"), - (0xFE60, "3", "&"), - (0xFE61, "3", "*"), - ] - - -def _seg_50() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFE62, "3", "+"), - (0xFE63, "M", "-"), - (0xFE64, "3", "<"), - (0xFE65, "3", ">"), - (0xFE66, "3", "="), - (0xFE67, "X"), - (0xFE68, "3", "\\"), - (0xFE69, "3", "$"), - (0xFE6A, "3", "%"), - (0xFE6B, "3", "@"), - (0xFE6C, "X"), - (0xFE70, "3", " ً"), - (0xFE71, "M", "ـً"), - (0xFE72, "3", " ٌ"), - (0xFE73, "V"), - (0xFE74, "3", " ٍ"), - (0xFE75, "X"), - (0xFE76, "3", " َ"), - (0xFE77, "M", "ـَ"), - (0xFE78, "3", " ُ"), - (0xFE79, "M", "ـُ"), - (0xFE7A, "3", " ِ"), - (0xFE7B, "M", "ـِ"), - (0xFE7C, "3", " ّ"), - (0xFE7D, "M", "ـّ"), - (0xFE7E, "3", " ْ"), - (0xFE7F, "M", "ـْ"), - (0xFE80, "M", "ء"), - (0xFE81, "M", "آ"), - (0xFE83, "M", "أ"), - (0xFE85, "M", "ؤ"), - (0xFE87, "M", "إ"), - (0xFE89, "M", "ئ"), - (0xFE8D, "M", "ا"), - (0xFE8F, "M", "ب"), - (0xFE93, "M", "ة"), - (0xFE95, "M", "ت"), - (0xFE99, "M", "ث"), - (0xFE9D, "M", "ج"), - (0xFEA1, "M", "ح"), - (0xFEA5, "M", "خ"), - (0xFEA9, "M", "د"), - (0xFEAB, "M", "ذ"), - (0xFEAD, "M", "ر"), - (0xFEAF, "M", "ز"), - (0xFEB1, "M", "س"), - (0xFEB5, "M", "ش"), - (0xFEB9, "M", "ص"), - (0xFEBD, "M", "ض"), - (0xFEC1, "M", "ط"), - (0xFEC5, "M", "ظ"), - (0xFEC9, "M", "ع"), - (0xFECD, "M", "غ"), - (0xFED1, "M", "ف"), - (0xFED5, "M", "ق"), - (0xFED9, "M", "ك"), - (0xFEDD, "M", "ل"), - (0xFEE1, "M", "م"), - (0xFEE5, "M", "ن"), - (0xFEE9, "M", "ه"), - (0xFEED, "M", "و"), - (0xFEEF, "M", "ى"), - (0xFEF1, "M", "ي"), - (0xFEF5, "M", "لآ"), - (0xFEF7, "M", "لأ"), - (0xFEF9, "M", "لإ"), - (0xFEFB, "M", "لا"), - (0xFEFD, "X"), - (0xFEFF, "I"), - (0xFF00, "X"), - (0xFF01, "3", "!"), - (0xFF02, "3", '"'), - (0xFF03, "3", "#"), - (0xFF04, "3", "$"), - (0xFF05, "3", "%"), - (0xFF06, "3", "&"), - (0xFF07, "3", "'"), - (0xFF08, "3", "("), - (0xFF09, "3", ")"), - (0xFF0A, "3", "*"), - (0xFF0B, "3", "+"), - (0xFF0C, "3", ","), - (0xFF0D, "M", "-"), - (0xFF0E, "M", "."), - (0xFF0F, "3", "/"), - (0xFF10, "M", "0"), - (0xFF11, "M", "1"), - (0xFF12, "M", "2"), - (0xFF13, "M", "3"), - (0xFF14, "M", "4"), - (0xFF15, "M", "5"), - (0xFF16, "M", "6"), - (0xFF17, "M", "7"), - (0xFF18, "M", "8"), - (0xFF19, "M", "9"), - (0xFF1A, "3", ":"), - (0xFF1B, "3", ";"), - (0xFF1C, "3", "<"), - (0xFF1D, "3", "="), - (0xFF1E, "3", ">"), - ] - - -def _seg_51() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFF1F, "3", "?"), - (0xFF20, "3", "@"), - (0xFF21, "M", "a"), - (0xFF22, "M", "b"), - (0xFF23, "M", "c"), - (0xFF24, "M", "d"), - (0xFF25, "M", "e"), - (0xFF26, "M", "f"), - (0xFF27, "M", "g"), - (0xFF28, "M", "h"), - (0xFF29, "M", "i"), - (0xFF2A, "M", "j"), - (0xFF2B, "M", "k"), - (0xFF2C, "M", "l"), - (0xFF2D, "M", "m"), - (0xFF2E, "M", "n"), - (0xFF2F, "M", "o"), - (0xFF30, "M", "p"), - (0xFF31, "M", "q"), - (0xFF32, "M", "r"), - (0xFF33, "M", "s"), - (0xFF34, "M", "t"), - (0xFF35, "M", "u"), - (0xFF36, "M", "v"), - (0xFF37, "M", "w"), - (0xFF38, "M", "x"), - (0xFF39, "M", "y"), - (0xFF3A, "M", "z"), - (0xFF3B, "3", "["), - (0xFF3C, "3", "\\"), - (0xFF3D, "3", "]"), - (0xFF3E, "3", "^"), - (0xFF3F, "3", "_"), - (0xFF40, "3", "`"), - (0xFF41, "M", "a"), - (0xFF42, "M", "b"), - (0xFF43, "M", "c"), - (0xFF44, "M", "d"), - (0xFF45, "M", "e"), - (0xFF46, "M", "f"), - (0xFF47, "M", "g"), - (0xFF48, "M", "h"), - (0xFF49, "M", "i"), - (0xFF4A, "M", "j"), - (0xFF4B, "M", "k"), - (0xFF4C, "M", "l"), - (0xFF4D, "M", "m"), - (0xFF4E, "M", "n"), - (0xFF4F, "M", "o"), - (0xFF50, "M", "p"), - (0xFF51, "M", "q"), - (0xFF52, "M", "r"), - (0xFF53, "M", "s"), - (0xFF54, "M", "t"), - (0xFF55, "M", "u"), - (0xFF56, "M", "v"), - (0xFF57, "M", "w"), - (0xFF58, "M", "x"), - (0xFF59, "M", "y"), - (0xFF5A, "M", "z"), - (0xFF5B, "3", "{"), - (0xFF5C, "3", "|"), - (0xFF5D, "3", "}"), - (0xFF5E, "3", "~"), - (0xFF5F, "M", "⦅"), - (0xFF60, "M", "⦆"), - (0xFF61, "M", "."), - (0xFF62, "M", "「"), - (0xFF63, "M", "」"), - (0xFF64, "M", "、"), - (0xFF65, "M", "・"), - (0xFF66, "M", "ヲ"), - (0xFF67, "M", "ァ"), - (0xFF68, "M", "ィ"), - (0xFF69, "M", "ゥ"), - (0xFF6A, "M", "ェ"), - (0xFF6B, "M", "ォ"), - (0xFF6C, "M", "ャ"), - (0xFF6D, "M", "ュ"), - (0xFF6E, "M", "ョ"), - (0xFF6F, "M", "ッ"), - (0xFF70, "M", "ー"), - (0xFF71, "M", "ア"), - (0xFF72, "M", "イ"), - (0xFF73, "M", "ウ"), - (0xFF74, "M", "エ"), - (0xFF75, "M", "オ"), - (0xFF76, "M", "カ"), - (0xFF77, "M", "キ"), - (0xFF78, "M", "ク"), - (0xFF79, "M", "ケ"), - (0xFF7A, "M", "コ"), - (0xFF7B, "M", "サ"), - (0xFF7C, "M", "シ"), - (0xFF7D, "M", "ス"), - (0xFF7E, "M", "セ"), - (0xFF7F, "M", "ソ"), - (0xFF80, "M", "タ"), - (0xFF81, "M", "チ"), - (0xFF82, "M", "ツ"), - ] - - -def _seg_52() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFF83, "M", "テ"), - (0xFF84, "M", "ト"), - (0xFF85, "M", "ナ"), - (0xFF86, "M", "ニ"), - (0xFF87, "M", "ヌ"), - (0xFF88, "M", "ネ"), - (0xFF89, "M", "ノ"), - (0xFF8A, "M", "ハ"), - (0xFF8B, "M", "ヒ"), - (0xFF8C, "M", "フ"), - (0xFF8D, "M", "ヘ"), - (0xFF8E, "M", "ホ"), - (0xFF8F, "M", "マ"), - (0xFF90, "M", "ミ"), - (0xFF91, "M", "ム"), - (0xFF92, "M", "メ"), - (0xFF93, "M", "モ"), - (0xFF94, "M", "ヤ"), - (0xFF95, "M", "ユ"), - (0xFF96, "M", "ヨ"), - (0xFF97, "M", "ラ"), - (0xFF98, "M", "リ"), - (0xFF99, "M", "ル"), - (0xFF9A, "M", "レ"), - (0xFF9B, "M", "ロ"), - (0xFF9C, "M", "ワ"), - (0xFF9D, "M", "ン"), - (0xFF9E, "M", "゙"), - (0xFF9F, "M", "゚"), - (0xFFA0, "X"), - (0xFFA1, "M", "ᄀ"), - (0xFFA2, "M", "ᄁ"), - (0xFFA3, "M", "ᆪ"), - (0xFFA4, "M", "ᄂ"), - (0xFFA5, "M", "ᆬ"), - (0xFFA6, "M", "ᆭ"), - (0xFFA7, "M", "ᄃ"), - (0xFFA8, "M", "ᄄ"), - (0xFFA9, "M", "ᄅ"), - (0xFFAA, "M", "ᆰ"), - (0xFFAB, "M", "ᆱ"), - (0xFFAC, "M", "ᆲ"), - (0xFFAD, "M", "ᆳ"), - (0xFFAE, "M", "ᆴ"), - (0xFFAF, "M", "ᆵ"), - (0xFFB0, "M", "ᄚ"), - (0xFFB1, "M", "ᄆ"), - (0xFFB2, "M", "ᄇ"), - (0xFFB3, "M", "ᄈ"), - (0xFFB4, "M", "ᄡ"), - (0xFFB5, "M", "ᄉ"), - (0xFFB6, "M", "ᄊ"), - (0xFFB7, "M", "ᄋ"), - (0xFFB8, "M", "ᄌ"), - (0xFFB9, "M", "ᄍ"), - (0xFFBA, "M", "ᄎ"), - (0xFFBB, "M", "ᄏ"), - (0xFFBC, "M", "ᄐ"), - (0xFFBD, "M", "ᄑ"), - (0xFFBE, "M", "ᄒ"), - (0xFFBF, "X"), - (0xFFC2, "M", "ᅡ"), - (0xFFC3, "M", "ᅢ"), - (0xFFC4, "M", "ᅣ"), - (0xFFC5, "M", "ᅤ"), - (0xFFC6, "M", "ᅥ"), - (0xFFC7, "M", "ᅦ"), - (0xFFC8, "X"), - (0xFFCA, "M", "ᅧ"), - (0xFFCB, "M", "ᅨ"), - (0xFFCC, "M", "ᅩ"), - (0xFFCD, "M", "ᅪ"), - (0xFFCE, "M", "ᅫ"), - (0xFFCF, "M", "ᅬ"), - (0xFFD0, "X"), - (0xFFD2, "M", "ᅭ"), - (0xFFD3, "M", "ᅮ"), - (0xFFD4, "M", "ᅯ"), - (0xFFD5, "M", "ᅰ"), - (0xFFD6, "M", "ᅱ"), - (0xFFD7, "M", "ᅲ"), - (0xFFD8, "X"), - (0xFFDA, "M", "ᅳ"), - (0xFFDB, "M", "ᅴ"), - (0xFFDC, "M", "ᅵ"), - (0xFFDD, "X"), - (0xFFE0, "M", "¢"), - (0xFFE1, "M", "£"), - (0xFFE2, "M", "¬"), - (0xFFE3, "3", " ̄"), - (0xFFE4, "M", "¦"), - (0xFFE5, "M", "¥"), - (0xFFE6, "M", "₩"), - (0xFFE7, "X"), - (0xFFE8, "M", "│"), - (0xFFE9, "M", "←"), - (0xFFEA, "M", "↑"), - (0xFFEB, "M", "→"), - (0xFFEC, "M", "↓"), - (0xFFED, "M", "■"), - ] - - -def _seg_53() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0xFFEE, "M", "○"), - (0xFFEF, "X"), - (0x10000, "V"), - (0x1000C, "X"), - (0x1000D, "V"), - (0x10027, "X"), - (0x10028, "V"), - (0x1003B, "X"), - (0x1003C, "V"), - (0x1003E, "X"), - (0x1003F, "V"), - (0x1004E, "X"), - (0x10050, "V"), - (0x1005E, "X"), - (0x10080, "V"), - (0x100FB, "X"), - (0x10100, "V"), - (0x10103, "X"), - (0x10107, "V"), - (0x10134, "X"), - (0x10137, "V"), - (0x1018F, "X"), - (0x10190, "V"), - (0x1019D, "X"), - (0x101A0, "V"), - (0x101A1, "X"), - (0x101D0, "V"), - (0x101FE, "X"), - (0x10280, "V"), - (0x1029D, "X"), - (0x102A0, "V"), - (0x102D1, "X"), - (0x102E0, "V"), - (0x102FC, "X"), - (0x10300, "V"), - (0x10324, "X"), - (0x1032D, "V"), - (0x1034B, "X"), - (0x10350, "V"), - (0x1037B, "X"), - (0x10380, "V"), - (0x1039E, "X"), - (0x1039F, "V"), - (0x103C4, "X"), - (0x103C8, "V"), - (0x103D6, "X"), - (0x10400, "M", "𐐨"), - (0x10401, "M", "𐐩"), - (0x10402, "M", "𐐪"), - (0x10403, "M", "𐐫"), - (0x10404, "M", "𐐬"), - (0x10405, "M", "𐐭"), - (0x10406, "M", "𐐮"), - (0x10407, "M", "𐐯"), - (0x10408, "M", "𐐰"), - (0x10409, "M", "𐐱"), - (0x1040A, "M", "𐐲"), - (0x1040B, "M", "𐐳"), - (0x1040C, "M", "𐐴"), - (0x1040D, "M", "𐐵"), - (0x1040E, "M", "𐐶"), - (0x1040F, "M", "𐐷"), - (0x10410, "M", "𐐸"), - (0x10411, "M", "𐐹"), - (0x10412, "M", "𐐺"), - (0x10413, "M", "𐐻"), - (0x10414, "M", "𐐼"), - (0x10415, "M", "𐐽"), - (0x10416, "M", "𐐾"), - (0x10417, "M", "𐐿"), - (0x10418, "M", "𐑀"), - (0x10419, "M", "𐑁"), - (0x1041A, "M", "𐑂"), - (0x1041B, "M", "𐑃"), - (0x1041C, "M", "𐑄"), - (0x1041D, "M", "𐑅"), - (0x1041E, "M", "𐑆"), - (0x1041F, "M", "𐑇"), - (0x10420, "M", "𐑈"), - (0x10421, "M", "𐑉"), - (0x10422, "M", "𐑊"), - (0x10423, "M", "𐑋"), - (0x10424, "M", "𐑌"), - (0x10425, "M", "𐑍"), - (0x10426, "M", "𐑎"), - (0x10427, "M", "𐑏"), - (0x10428, "V"), - (0x1049E, "X"), - (0x104A0, "V"), - (0x104AA, "X"), - (0x104B0, "M", "𐓘"), - (0x104B1, "M", "𐓙"), - (0x104B2, "M", "𐓚"), - (0x104B3, "M", "𐓛"), - (0x104B4, "M", "𐓜"), - (0x104B5, "M", "𐓝"), - (0x104B6, "M", "𐓞"), - (0x104B7, "M", "𐓟"), - (0x104B8, "M", "𐓠"), - (0x104B9, "M", "𐓡"), - ] - - -def _seg_54() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x104BA, "M", "𐓢"), - (0x104BB, "M", "𐓣"), - (0x104BC, "M", "𐓤"), - (0x104BD, "M", "𐓥"), - (0x104BE, "M", "𐓦"), - (0x104BF, "M", "𐓧"), - (0x104C0, "M", "𐓨"), - (0x104C1, "M", "𐓩"), - (0x104C2, "M", "𐓪"), - (0x104C3, "M", "𐓫"), - (0x104C4, "M", "𐓬"), - (0x104C5, "M", "𐓭"), - (0x104C6, "M", "𐓮"), - (0x104C7, "M", "𐓯"), - (0x104C8, "M", "𐓰"), - (0x104C9, "M", "𐓱"), - (0x104CA, "M", "𐓲"), - (0x104CB, "M", "𐓳"), - (0x104CC, "M", "𐓴"), - (0x104CD, "M", "𐓵"), - (0x104CE, "M", "𐓶"), - (0x104CF, "M", "𐓷"), - (0x104D0, "M", "𐓸"), - (0x104D1, "M", "𐓹"), - (0x104D2, "M", "𐓺"), - (0x104D3, "M", "𐓻"), - (0x104D4, "X"), - (0x104D8, "V"), - (0x104FC, "X"), - (0x10500, "V"), - (0x10528, "X"), - (0x10530, "V"), - (0x10564, "X"), - (0x1056F, "V"), - (0x10570, "M", "𐖗"), - (0x10571, "M", "𐖘"), - (0x10572, "M", "𐖙"), - (0x10573, "M", "𐖚"), - (0x10574, "M", "𐖛"), - (0x10575, "M", "𐖜"), - (0x10576, "M", "𐖝"), - (0x10577, "M", "𐖞"), - (0x10578, "M", "𐖟"), - (0x10579, "M", "𐖠"), - (0x1057A, "M", "𐖡"), - (0x1057B, "X"), - (0x1057C, "M", "𐖣"), - (0x1057D, "M", "𐖤"), - (0x1057E, "M", "𐖥"), - (0x1057F, "M", "𐖦"), - (0x10580, "M", "𐖧"), - (0x10581, "M", "𐖨"), - (0x10582, "M", "𐖩"), - (0x10583, "M", "𐖪"), - (0x10584, "M", "𐖫"), - (0x10585, "M", "𐖬"), - (0x10586, "M", "𐖭"), - (0x10587, "M", "𐖮"), - (0x10588, "M", "𐖯"), - (0x10589, "M", "𐖰"), - (0x1058A, "M", "𐖱"), - (0x1058B, "X"), - (0x1058C, "M", "𐖳"), - (0x1058D, "M", "𐖴"), - (0x1058E, "M", "𐖵"), - (0x1058F, "M", "𐖶"), - (0x10590, "M", "𐖷"), - (0x10591, "M", "𐖸"), - (0x10592, "M", "𐖹"), - (0x10593, "X"), - (0x10594, "M", "𐖻"), - (0x10595, "M", "𐖼"), - (0x10596, "X"), - (0x10597, "V"), - (0x105A2, "X"), - (0x105A3, "V"), - (0x105B2, "X"), - (0x105B3, "V"), - (0x105BA, "X"), - (0x105BB, "V"), - (0x105BD, "X"), - (0x10600, "V"), - (0x10737, "X"), - (0x10740, "V"), - (0x10756, "X"), - (0x10760, "V"), - (0x10768, "X"), - (0x10780, "V"), - (0x10781, "M", "ː"), - (0x10782, "M", "ˑ"), - (0x10783, "M", "æ"), - (0x10784, "M", "ʙ"), - (0x10785, "M", "ɓ"), - (0x10786, "X"), - (0x10787, "M", "ʣ"), - (0x10788, "M", "ꭦ"), - (0x10789, "M", "ʥ"), - (0x1078A, "M", "ʤ"), - (0x1078B, "M", "ɖ"), - (0x1078C, "M", "ɗ"), - ] - - -def _seg_55() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1078D, "M", "ᶑ"), - (0x1078E, "M", "ɘ"), - (0x1078F, "M", "ɞ"), - (0x10790, "M", "ʩ"), - (0x10791, "M", "ɤ"), - (0x10792, "M", "ɢ"), - (0x10793, "M", "ɠ"), - (0x10794, "M", "ʛ"), - (0x10795, "M", "ħ"), - (0x10796, "M", "ʜ"), - (0x10797, "M", "ɧ"), - (0x10798, "M", "ʄ"), - (0x10799, "M", "ʪ"), - (0x1079A, "M", "ʫ"), - (0x1079B, "M", "ɬ"), - (0x1079C, "M", "𝼄"), - (0x1079D, "M", "ꞎ"), - (0x1079E, "M", "ɮ"), - (0x1079F, "M", "𝼅"), - (0x107A0, "M", "ʎ"), - (0x107A1, "M", "𝼆"), - (0x107A2, "M", "ø"), - (0x107A3, "M", "ɶ"), - (0x107A4, "M", "ɷ"), - (0x107A5, "M", "q"), - (0x107A6, "M", "ɺ"), - (0x107A7, "M", "𝼈"), - (0x107A8, "M", "ɽ"), - (0x107A9, "M", "ɾ"), - (0x107AA, "M", "ʀ"), - (0x107AB, "M", "ʨ"), - (0x107AC, "M", "ʦ"), - (0x107AD, "M", "ꭧ"), - (0x107AE, "M", "ʧ"), - (0x107AF, "M", "ʈ"), - (0x107B0, "M", "ⱱ"), - (0x107B1, "X"), - (0x107B2, "M", "ʏ"), - (0x107B3, "M", "ʡ"), - (0x107B4, "M", "ʢ"), - (0x107B5, "M", "ʘ"), - (0x107B6, "M", "ǀ"), - (0x107B7, "M", "ǁ"), - (0x107B8, "M", "ǂ"), - (0x107B9, "M", "𝼊"), - (0x107BA, "M", "𝼞"), - (0x107BB, "X"), - (0x10800, "V"), - (0x10806, "X"), - (0x10808, "V"), - (0x10809, "X"), - (0x1080A, "V"), - (0x10836, "X"), - (0x10837, "V"), - (0x10839, "X"), - (0x1083C, "V"), - (0x1083D, "X"), - (0x1083F, "V"), - (0x10856, "X"), - (0x10857, "V"), - (0x1089F, "X"), - (0x108A7, "V"), - (0x108B0, "X"), - (0x108E0, "V"), - (0x108F3, "X"), - (0x108F4, "V"), - (0x108F6, "X"), - (0x108FB, "V"), - (0x1091C, "X"), - (0x1091F, "V"), - (0x1093A, "X"), - (0x1093F, "V"), - (0x10940, "X"), - (0x10980, "V"), - (0x109B8, "X"), - (0x109BC, "V"), - (0x109D0, "X"), - (0x109D2, "V"), - (0x10A04, "X"), - (0x10A05, "V"), - (0x10A07, "X"), - (0x10A0C, "V"), - (0x10A14, "X"), - (0x10A15, "V"), - (0x10A18, "X"), - (0x10A19, "V"), - (0x10A36, "X"), - (0x10A38, "V"), - (0x10A3B, "X"), - (0x10A3F, "V"), - (0x10A49, "X"), - (0x10A50, "V"), - (0x10A59, "X"), - (0x10A60, "V"), - (0x10AA0, "X"), - (0x10AC0, "V"), - (0x10AE7, "X"), - (0x10AEB, "V"), - (0x10AF7, "X"), - (0x10B00, "V"), - ] - - -def _seg_56() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x10B36, "X"), - (0x10B39, "V"), - (0x10B56, "X"), - (0x10B58, "V"), - (0x10B73, "X"), - (0x10B78, "V"), - (0x10B92, "X"), - (0x10B99, "V"), - (0x10B9D, "X"), - (0x10BA9, "V"), - (0x10BB0, "X"), - (0x10C00, "V"), - (0x10C49, "X"), - (0x10C80, "M", "𐳀"), - (0x10C81, "M", "𐳁"), - (0x10C82, "M", "𐳂"), - (0x10C83, "M", "𐳃"), - (0x10C84, "M", "𐳄"), - (0x10C85, "M", "𐳅"), - (0x10C86, "M", "𐳆"), - (0x10C87, "M", "𐳇"), - (0x10C88, "M", "𐳈"), - (0x10C89, "M", "𐳉"), - (0x10C8A, "M", "𐳊"), - (0x10C8B, "M", "𐳋"), - (0x10C8C, "M", "𐳌"), - (0x10C8D, "M", "𐳍"), - (0x10C8E, "M", "𐳎"), - (0x10C8F, "M", "𐳏"), - (0x10C90, "M", "𐳐"), - (0x10C91, "M", "𐳑"), - (0x10C92, "M", "𐳒"), - (0x10C93, "M", "𐳓"), - (0x10C94, "M", "𐳔"), - (0x10C95, "M", "𐳕"), - (0x10C96, "M", "𐳖"), - (0x10C97, "M", "𐳗"), - (0x10C98, "M", "𐳘"), - (0x10C99, "M", "𐳙"), - (0x10C9A, "M", "𐳚"), - (0x10C9B, "M", "𐳛"), - (0x10C9C, "M", "𐳜"), - (0x10C9D, "M", "𐳝"), - (0x10C9E, "M", "𐳞"), - (0x10C9F, "M", "𐳟"), - (0x10CA0, "M", "𐳠"), - (0x10CA1, "M", "𐳡"), - (0x10CA2, "M", "𐳢"), - (0x10CA3, "M", "𐳣"), - (0x10CA4, "M", "𐳤"), - (0x10CA5, "M", "𐳥"), - (0x10CA6, "M", "𐳦"), - (0x10CA7, "M", "𐳧"), - (0x10CA8, "M", "𐳨"), - (0x10CA9, "M", "𐳩"), - (0x10CAA, "M", "𐳪"), - (0x10CAB, "M", "𐳫"), - (0x10CAC, "M", "𐳬"), - (0x10CAD, "M", "𐳭"), - (0x10CAE, "M", "𐳮"), - (0x10CAF, "M", "𐳯"), - (0x10CB0, "M", "𐳰"), - (0x10CB1, "M", "𐳱"), - (0x10CB2, "M", "𐳲"), - (0x10CB3, "X"), - (0x10CC0, "V"), - (0x10CF3, "X"), - (0x10CFA, "V"), - (0x10D28, "X"), - (0x10D30, "V"), - (0x10D3A, "X"), - (0x10E60, "V"), - (0x10E7F, "X"), - (0x10E80, "V"), - (0x10EAA, "X"), - (0x10EAB, "V"), - (0x10EAE, "X"), - (0x10EB0, "V"), - (0x10EB2, "X"), - (0x10EFD, "V"), - (0x10F28, "X"), - (0x10F30, "V"), - (0x10F5A, "X"), - (0x10F70, "V"), - (0x10F8A, "X"), - (0x10FB0, "V"), - (0x10FCC, "X"), - (0x10FE0, "V"), - (0x10FF7, "X"), - (0x11000, "V"), - (0x1104E, "X"), - (0x11052, "V"), - (0x11076, "X"), - (0x1107F, "V"), - (0x110BD, "X"), - (0x110BE, "V"), - (0x110C3, "X"), - (0x110D0, "V"), - (0x110E9, "X"), - (0x110F0, "V"), - ] - - -def _seg_57() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x110FA, "X"), - (0x11100, "V"), - (0x11135, "X"), - (0x11136, "V"), - (0x11148, "X"), - (0x11150, "V"), - (0x11177, "X"), - (0x11180, "V"), - (0x111E0, "X"), - (0x111E1, "V"), - (0x111F5, "X"), - (0x11200, "V"), - (0x11212, "X"), - (0x11213, "V"), - (0x11242, "X"), - (0x11280, "V"), - (0x11287, "X"), - (0x11288, "V"), - (0x11289, "X"), - (0x1128A, "V"), - (0x1128E, "X"), - (0x1128F, "V"), - (0x1129E, "X"), - (0x1129F, "V"), - (0x112AA, "X"), - (0x112B0, "V"), - (0x112EB, "X"), - (0x112F0, "V"), - (0x112FA, "X"), - (0x11300, "V"), - (0x11304, "X"), - (0x11305, "V"), - (0x1130D, "X"), - (0x1130F, "V"), - (0x11311, "X"), - (0x11313, "V"), - (0x11329, "X"), - (0x1132A, "V"), - (0x11331, "X"), - (0x11332, "V"), - (0x11334, "X"), - (0x11335, "V"), - (0x1133A, "X"), - (0x1133B, "V"), - (0x11345, "X"), - (0x11347, "V"), - (0x11349, "X"), - (0x1134B, "V"), - (0x1134E, "X"), - (0x11350, "V"), - (0x11351, "X"), - (0x11357, "V"), - (0x11358, "X"), - (0x1135D, "V"), - (0x11364, "X"), - (0x11366, "V"), - (0x1136D, "X"), - (0x11370, "V"), - (0x11375, "X"), - (0x11400, "V"), - (0x1145C, "X"), - (0x1145D, "V"), - (0x11462, "X"), - (0x11480, "V"), - (0x114C8, "X"), - (0x114D0, "V"), - (0x114DA, "X"), - (0x11580, "V"), - (0x115B6, "X"), - (0x115B8, "V"), - (0x115DE, "X"), - (0x11600, "V"), - (0x11645, "X"), - (0x11650, "V"), - (0x1165A, "X"), - (0x11660, "V"), - (0x1166D, "X"), - (0x11680, "V"), - (0x116BA, "X"), - (0x116C0, "V"), - (0x116CA, "X"), - (0x11700, "V"), - (0x1171B, "X"), - (0x1171D, "V"), - (0x1172C, "X"), - (0x11730, "V"), - (0x11747, "X"), - (0x11800, "V"), - (0x1183C, "X"), - (0x118A0, "M", "𑣀"), - (0x118A1, "M", "𑣁"), - (0x118A2, "M", "𑣂"), - (0x118A3, "M", "𑣃"), - (0x118A4, "M", "𑣄"), - (0x118A5, "M", "𑣅"), - (0x118A6, "M", "𑣆"), - (0x118A7, "M", "𑣇"), - (0x118A8, "M", "𑣈"), - (0x118A9, "M", "𑣉"), - (0x118AA, "M", "𑣊"), - ] - - -def _seg_58() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x118AB, "M", "𑣋"), - (0x118AC, "M", "𑣌"), - (0x118AD, "M", "𑣍"), - (0x118AE, "M", "𑣎"), - (0x118AF, "M", "𑣏"), - (0x118B0, "M", "𑣐"), - (0x118B1, "M", "𑣑"), - (0x118B2, "M", "𑣒"), - (0x118B3, "M", "𑣓"), - (0x118B4, "M", "𑣔"), - (0x118B5, "M", "𑣕"), - (0x118B6, "M", "𑣖"), - (0x118B7, "M", "𑣗"), - (0x118B8, "M", "𑣘"), - (0x118B9, "M", "𑣙"), - (0x118BA, "M", "𑣚"), - (0x118BB, "M", "𑣛"), - (0x118BC, "M", "𑣜"), - (0x118BD, "M", "𑣝"), - (0x118BE, "M", "𑣞"), - (0x118BF, "M", "𑣟"), - (0x118C0, "V"), - (0x118F3, "X"), - (0x118FF, "V"), - (0x11907, "X"), - (0x11909, "V"), - (0x1190A, "X"), - (0x1190C, "V"), - (0x11914, "X"), - (0x11915, "V"), - (0x11917, "X"), - (0x11918, "V"), - (0x11936, "X"), - (0x11937, "V"), - (0x11939, "X"), - (0x1193B, "V"), - (0x11947, "X"), - (0x11950, "V"), - (0x1195A, "X"), - (0x119A0, "V"), - (0x119A8, "X"), - (0x119AA, "V"), - (0x119D8, "X"), - (0x119DA, "V"), - (0x119E5, "X"), - (0x11A00, "V"), - (0x11A48, "X"), - (0x11A50, "V"), - (0x11AA3, "X"), - (0x11AB0, "V"), - (0x11AF9, "X"), - (0x11B00, "V"), - (0x11B0A, "X"), - (0x11C00, "V"), - (0x11C09, "X"), - (0x11C0A, "V"), - (0x11C37, "X"), - (0x11C38, "V"), - (0x11C46, "X"), - (0x11C50, "V"), - (0x11C6D, "X"), - (0x11C70, "V"), - (0x11C90, "X"), - (0x11C92, "V"), - (0x11CA8, "X"), - (0x11CA9, "V"), - (0x11CB7, "X"), - (0x11D00, "V"), - (0x11D07, "X"), - (0x11D08, "V"), - (0x11D0A, "X"), - (0x11D0B, "V"), - (0x11D37, "X"), - (0x11D3A, "V"), - (0x11D3B, "X"), - (0x11D3C, "V"), - (0x11D3E, "X"), - (0x11D3F, "V"), - (0x11D48, "X"), - (0x11D50, "V"), - (0x11D5A, "X"), - (0x11D60, "V"), - (0x11D66, "X"), - (0x11D67, "V"), - (0x11D69, "X"), - (0x11D6A, "V"), - (0x11D8F, "X"), - (0x11D90, "V"), - (0x11D92, "X"), - (0x11D93, "V"), - (0x11D99, "X"), - (0x11DA0, "V"), - (0x11DAA, "X"), - (0x11EE0, "V"), - (0x11EF9, "X"), - (0x11F00, "V"), - (0x11F11, "X"), - (0x11F12, "V"), - (0x11F3B, "X"), - (0x11F3E, "V"), - ] - - -def _seg_59() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x11F5A, "X"), - (0x11FB0, "V"), - (0x11FB1, "X"), - (0x11FC0, "V"), - (0x11FF2, "X"), - (0x11FFF, "V"), - (0x1239A, "X"), - (0x12400, "V"), - (0x1246F, "X"), - (0x12470, "V"), - (0x12475, "X"), - (0x12480, "V"), - (0x12544, "X"), - (0x12F90, "V"), - (0x12FF3, "X"), - (0x13000, "V"), - (0x13430, "X"), - (0x13440, "V"), - (0x13456, "X"), - (0x14400, "V"), - (0x14647, "X"), - (0x16800, "V"), - (0x16A39, "X"), - (0x16A40, "V"), - (0x16A5F, "X"), - (0x16A60, "V"), - (0x16A6A, "X"), - (0x16A6E, "V"), - (0x16ABF, "X"), - (0x16AC0, "V"), - (0x16ACA, "X"), - (0x16AD0, "V"), - (0x16AEE, "X"), - (0x16AF0, "V"), - (0x16AF6, "X"), - (0x16B00, "V"), - (0x16B46, "X"), - (0x16B50, "V"), - (0x16B5A, "X"), - (0x16B5B, "V"), - (0x16B62, "X"), - (0x16B63, "V"), - (0x16B78, "X"), - (0x16B7D, "V"), - (0x16B90, "X"), - (0x16E40, "M", "𖹠"), - (0x16E41, "M", "𖹡"), - (0x16E42, "M", "𖹢"), - (0x16E43, "M", "𖹣"), - (0x16E44, "M", "𖹤"), - (0x16E45, "M", "𖹥"), - (0x16E46, "M", "𖹦"), - (0x16E47, "M", "𖹧"), - (0x16E48, "M", "𖹨"), - (0x16E49, "M", "𖹩"), - (0x16E4A, "M", "𖹪"), - (0x16E4B, "M", "𖹫"), - (0x16E4C, "M", "𖹬"), - (0x16E4D, "M", "𖹭"), - (0x16E4E, "M", "𖹮"), - (0x16E4F, "M", "𖹯"), - (0x16E50, "M", "𖹰"), - (0x16E51, "M", "𖹱"), - (0x16E52, "M", "𖹲"), - (0x16E53, "M", "𖹳"), - (0x16E54, "M", "𖹴"), - (0x16E55, "M", "𖹵"), - (0x16E56, "M", "𖹶"), - (0x16E57, "M", "𖹷"), - (0x16E58, "M", "𖹸"), - (0x16E59, "M", "𖹹"), - (0x16E5A, "M", "𖹺"), - (0x16E5B, "M", "𖹻"), - (0x16E5C, "M", "𖹼"), - (0x16E5D, "M", "𖹽"), - (0x16E5E, "M", "𖹾"), - (0x16E5F, "M", "𖹿"), - (0x16E60, "V"), - (0x16E9B, "X"), - (0x16F00, "V"), - (0x16F4B, "X"), - (0x16F4F, "V"), - (0x16F88, "X"), - (0x16F8F, "V"), - (0x16FA0, "X"), - (0x16FE0, "V"), - (0x16FE5, "X"), - (0x16FF0, "V"), - (0x16FF2, "X"), - (0x17000, "V"), - (0x187F8, "X"), - (0x18800, "V"), - (0x18CD6, "X"), - (0x18D00, "V"), - (0x18D09, "X"), - (0x1AFF0, "V"), - (0x1AFF4, "X"), - (0x1AFF5, "V"), - (0x1AFFC, "X"), - (0x1AFFD, "V"), - ] - - -def _seg_60() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1AFFF, "X"), - (0x1B000, "V"), - (0x1B123, "X"), - (0x1B132, "V"), - (0x1B133, "X"), - (0x1B150, "V"), - (0x1B153, "X"), - (0x1B155, "V"), - (0x1B156, "X"), - (0x1B164, "V"), - (0x1B168, "X"), - (0x1B170, "V"), - (0x1B2FC, "X"), - (0x1BC00, "V"), - (0x1BC6B, "X"), - (0x1BC70, "V"), - (0x1BC7D, "X"), - (0x1BC80, "V"), - (0x1BC89, "X"), - (0x1BC90, "V"), - (0x1BC9A, "X"), - (0x1BC9C, "V"), - (0x1BCA0, "I"), - (0x1BCA4, "X"), - (0x1CF00, "V"), - (0x1CF2E, "X"), - (0x1CF30, "V"), - (0x1CF47, "X"), - (0x1CF50, "V"), - (0x1CFC4, "X"), - (0x1D000, "V"), - (0x1D0F6, "X"), - (0x1D100, "V"), - (0x1D127, "X"), - (0x1D129, "V"), - (0x1D15E, "M", "𝅗𝅥"), - (0x1D15F, "M", "𝅘𝅥"), - (0x1D160, "M", "𝅘𝅥𝅮"), - (0x1D161, "M", "𝅘𝅥𝅯"), - (0x1D162, "M", "𝅘𝅥𝅰"), - (0x1D163, "M", "𝅘𝅥𝅱"), - (0x1D164, "M", "𝅘𝅥𝅲"), - (0x1D165, "V"), - (0x1D173, "X"), - (0x1D17B, "V"), - (0x1D1BB, "M", "𝆹𝅥"), - (0x1D1BC, "M", "𝆺𝅥"), - (0x1D1BD, "M", "𝆹𝅥𝅮"), - (0x1D1BE, "M", "𝆺𝅥𝅮"), - (0x1D1BF, "M", "𝆹𝅥𝅯"), - (0x1D1C0, "M", "𝆺𝅥𝅯"), - (0x1D1C1, "V"), - (0x1D1EB, "X"), - (0x1D200, "V"), - (0x1D246, "X"), - (0x1D2C0, "V"), - (0x1D2D4, "X"), - (0x1D2E0, "V"), - (0x1D2F4, "X"), - (0x1D300, "V"), - (0x1D357, "X"), - (0x1D360, "V"), - (0x1D379, "X"), - (0x1D400, "M", "a"), - (0x1D401, "M", "b"), - (0x1D402, "M", "c"), - (0x1D403, "M", "d"), - (0x1D404, "M", "e"), - (0x1D405, "M", "f"), - (0x1D406, "M", "g"), - (0x1D407, "M", "h"), - (0x1D408, "M", "i"), - (0x1D409, "M", "j"), - (0x1D40A, "M", "k"), - (0x1D40B, "M", "l"), - (0x1D40C, "M", "m"), - (0x1D40D, "M", "n"), - (0x1D40E, "M", "o"), - (0x1D40F, "M", "p"), - (0x1D410, "M", "q"), - (0x1D411, "M", "r"), - (0x1D412, "M", "s"), - (0x1D413, "M", "t"), - (0x1D414, "M", "u"), - (0x1D415, "M", "v"), - (0x1D416, "M", "w"), - (0x1D417, "M", "x"), - (0x1D418, "M", "y"), - (0x1D419, "M", "z"), - (0x1D41A, "M", "a"), - (0x1D41B, "M", "b"), - (0x1D41C, "M", "c"), - (0x1D41D, "M", "d"), - (0x1D41E, "M", "e"), - (0x1D41F, "M", "f"), - (0x1D420, "M", "g"), - (0x1D421, "M", "h"), - (0x1D422, "M", "i"), - (0x1D423, "M", "j"), - (0x1D424, "M", "k"), - ] - - -def _seg_61() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D425, "M", "l"), - (0x1D426, "M", "m"), - (0x1D427, "M", "n"), - (0x1D428, "M", "o"), - (0x1D429, "M", "p"), - (0x1D42A, "M", "q"), - (0x1D42B, "M", "r"), - (0x1D42C, "M", "s"), - (0x1D42D, "M", "t"), - (0x1D42E, "M", "u"), - (0x1D42F, "M", "v"), - (0x1D430, "M", "w"), - (0x1D431, "M", "x"), - (0x1D432, "M", "y"), - (0x1D433, "M", "z"), - (0x1D434, "M", "a"), - (0x1D435, "M", "b"), - (0x1D436, "M", "c"), - (0x1D437, "M", "d"), - (0x1D438, "M", "e"), - (0x1D439, "M", "f"), - (0x1D43A, "M", "g"), - (0x1D43B, "M", "h"), - (0x1D43C, "M", "i"), - (0x1D43D, "M", "j"), - (0x1D43E, "M", "k"), - (0x1D43F, "M", "l"), - (0x1D440, "M", "m"), - (0x1D441, "M", "n"), - (0x1D442, "M", "o"), - (0x1D443, "M", "p"), - (0x1D444, "M", "q"), - (0x1D445, "M", "r"), - (0x1D446, "M", "s"), - (0x1D447, "M", "t"), - (0x1D448, "M", "u"), - (0x1D449, "M", "v"), - (0x1D44A, "M", "w"), - (0x1D44B, "M", "x"), - (0x1D44C, "M", "y"), - (0x1D44D, "M", "z"), - (0x1D44E, "M", "a"), - (0x1D44F, "M", "b"), - (0x1D450, "M", "c"), - (0x1D451, "M", "d"), - (0x1D452, "M", "e"), - (0x1D453, "M", "f"), - (0x1D454, "M", "g"), - (0x1D455, "X"), - (0x1D456, "M", "i"), - (0x1D457, "M", "j"), - (0x1D458, "M", "k"), - (0x1D459, "M", "l"), - (0x1D45A, "M", "m"), - (0x1D45B, "M", "n"), - (0x1D45C, "M", "o"), - (0x1D45D, "M", "p"), - (0x1D45E, "M", "q"), - (0x1D45F, "M", "r"), - (0x1D460, "M", "s"), - (0x1D461, "M", "t"), - (0x1D462, "M", "u"), - (0x1D463, "M", "v"), - (0x1D464, "M", "w"), - (0x1D465, "M", "x"), - (0x1D466, "M", "y"), - (0x1D467, "M", "z"), - (0x1D468, "M", "a"), - (0x1D469, "M", "b"), - (0x1D46A, "M", "c"), - (0x1D46B, "M", "d"), - (0x1D46C, "M", "e"), - (0x1D46D, "M", "f"), - (0x1D46E, "M", "g"), - (0x1D46F, "M", "h"), - (0x1D470, "M", "i"), - (0x1D471, "M", "j"), - (0x1D472, "M", "k"), - (0x1D473, "M", "l"), - (0x1D474, "M", "m"), - (0x1D475, "M", "n"), - (0x1D476, "M", "o"), - (0x1D477, "M", "p"), - (0x1D478, "M", "q"), - (0x1D479, "M", "r"), - (0x1D47A, "M", "s"), - (0x1D47B, "M", "t"), - (0x1D47C, "M", "u"), - (0x1D47D, "M", "v"), - (0x1D47E, "M", "w"), - (0x1D47F, "M", "x"), - (0x1D480, "M", "y"), - (0x1D481, "M", "z"), - (0x1D482, "M", "a"), - (0x1D483, "M", "b"), - (0x1D484, "M", "c"), - (0x1D485, "M", "d"), - (0x1D486, "M", "e"), - (0x1D487, "M", "f"), - (0x1D488, "M", "g"), - ] - - -def _seg_62() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D489, "M", "h"), - (0x1D48A, "M", "i"), - (0x1D48B, "M", "j"), - (0x1D48C, "M", "k"), - (0x1D48D, "M", "l"), - (0x1D48E, "M", "m"), - (0x1D48F, "M", "n"), - (0x1D490, "M", "o"), - (0x1D491, "M", "p"), - (0x1D492, "M", "q"), - (0x1D493, "M", "r"), - (0x1D494, "M", "s"), - (0x1D495, "M", "t"), - (0x1D496, "M", "u"), - (0x1D497, "M", "v"), - (0x1D498, "M", "w"), - (0x1D499, "M", "x"), - (0x1D49A, "M", "y"), - (0x1D49B, "M", "z"), - (0x1D49C, "M", "a"), - (0x1D49D, "X"), - (0x1D49E, "M", "c"), - (0x1D49F, "M", "d"), - (0x1D4A0, "X"), - (0x1D4A2, "M", "g"), - (0x1D4A3, "X"), - (0x1D4A5, "M", "j"), - (0x1D4A6, "M", "k"), - (0x1D4A7, "X"), - (0x1D4A9, "M", "n"), - (0x1D4AA, "M", "o"), - (0x1D4AB, "M", "p"), - (0x1D4AC, "M", "q"), - (0x1D4AD, "X"), - (0x1D4AE, "M", "s"), - (0x1D4AF, "M", "t"), - (0x1D4B0, "M", "u"), - (0x1D4B1, "M", "v"), - (0x1D4B2, "M", "w"), - (0x1D4B3, "M", "x"), - (0x1D4B4, "M", "y"), - (0x1D4B5, "M", "z"), - (0x1D4B6, "M", "a"), - (0x1D4B7, "M", "b"), - (0x1D4B8, "M", "c"), - (0x1D4B9, "M", "d"), - (0x1D4BA, "X"), - (0x1D4BB, "M", "f"), - (0x1D4BC, "X"), - (0x1D4BD, "M", "h"), - (0x1D4BE, "M", "i"), - (0x1D4BF, "M", "j"), - (0x1D4C0, "M", "k"), - (0x1D4C1, "M", "l"), - (0x1D4C2, "M", "m"), - (0x1D4C3, "M", "n"), - (0x1D4C4, "X"), - (0x1D4C5, "M", "p"), - (0x1D4C6, "M", "q"), - (0x1D4C7, "M", "r"), - (0x1D4C8, "M", "s"), - (0x1D4C9, "M", "t"), - (0x1D4CA, "M", "u"), - (0x1D4CB, "M", "v"), - (0x1D4CC, "M", "w"), - (0x1D4CD, "M", "x"), - (0x1D4CE, "M", "y"), - (0x1D4CF, "M", "z"), - (0x1D4D0, "M", "a"), - (0x1D4D1, "M", "b"), - (0x1D4D2, "M", "c"), - (0x1D4D3, "M", "d"), - (0x1D4D4, "M", "e"), - (0x1D4D5, "M", "f"), - (0x1D4D6, "M", "g"), - (0x1D4D7, "M", "h"), - (0x1D4D8, "M", "i"), - (0x1D4D9, "M", "j"), - (0x1D4DA, "M", "k"), - (0x1D4DB, "M", "l"), - (0x1D4DC, "M", "m"), - (0x1D4DD, "M", "n"), - (0x1D4DE, "M", "o"), - (0x1D4DF, "M", "p"), - (0x1D4E0, "M", "q"), - (0x1D4E1, "M", "r"), - (0x1D4E2, "M", "s"), - (0x1D4E3, "M", "t"), - (0x1D4E4, "M", "u"), - (0x1D4E5, "M", "v"), - (0x1D4E6, "M", "w"), - (0x1D4E7, "M", "x"), - (0x1D4E8, "M", "y"), - (0x1D4E9, "M", "z"), - (0x1D4EA, "M", "a"), - (0x1D4EB, "M", "b"), - (0x1D4EC, "M", "c"), - (0x1D4ED, "M", "d"), - (0x1D4EE, "M", "e"), - (0x1D4EF, "M", "f"), - ] - - -def _seg_63() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D4F0, "M", "g"), - (0x1D4F1, "M", "h"), - (0x1D4F2, "M", "i"), - (0x1D4F3, "M", "j"), - (0x1D4F4, "M", "k"), - (0x1D4F5, "M", "l"), - (0x1D4F6, "M", "m"), - (0x1D4F7, "M", "n"), - (0x1D4F8, "M", "o"), - (0x1D4F9, "M", "p"), - (0x1D4FA, "M", "q"), - (0x1D4FB, "M", "r"), - (0x1D4FC, "M", "s"), - (0x1D4FD, "M", "t"), - (0x1D4FE, "M", "u"), - (0x1D4FF, "M", "v"), - (0x1D500, "M", "w"), - (0x1D501, "M", "x"), - (0x1D502, "M", "y"), - (0x1D503, "M", "z"), - (0x1D504, "M", "a"), - (0x1D505, "M", "b"), - (0x1D506, "X"), - (0x1D507, "M", "d"), - (0x1D508, "M", "e"), - (0x1D509, "M", "f"), - (0x1D50A, "M", "g"), - (0x1D50B, "X"), - (0x1D50D, "M", "j"), - (0x1D50E, "M", "k"), - (0x1D50F, "M", "l"), - (0x1D510, "M", "m"), - (0x1D511, "M", "n"), - (0x1D512, "M", "o"), - (0x1D513, "M", "p"), - (0x1D514, "M", "q"), - (0x1D515, "X"), - (0x1D516, "M", "s"), - (0x1D517, "M", "t"), - (0x1D518, "M", "u"), - (0x1D519, "M", "v"), - (0x1D51A, "M", "w"), - (0x1D51B, "M", "x"), - (0x1D51C, "M", "y"), - (0x1D51D, "X"), - (0x1D51E, "M", "a"), - (0x1D51F, "M", "b"), - (0x1D520, "M", "c"), - (0x1D521, "M", "d"), - (0x1D522, "M", "e"), - (0x1D523, "M", "f"), - (0x1D524, "M", "g"), - (0x1D525, "M", "h"), - (0x1D526, "M", "i"), - (0x1D527, "M", "j"), - (0x1D528, "M", "k"), - (0x1D529, "M", "l"), - (0x1D52A, "M", "m"), - (0x1D52B, "M", "n"), - (0x1D52C, "M", "o"), - (0x1D52D, "M", "p"), - (0x1D52E, "M", "q"), - (0x1D52F, "M", "r"), - (0x1D530, "M", "s"), - (0x1D531, "M", "t"), - (0x1D532, "M", "u"), - (0x1D533, "M", "v"), - (0x1D534, "M", "w"), - (0x1D535, "M", "x"), - (0x1D536, "M", "y"), - (0x1D537, "M", "z"), - (0x1D538, "M", "a"), - (0x1D539, "M", "b"), - (0x1D53A, "X"), - (0x1D53B, "M", "d"), - (0x1D53C, "M", "e"), - (0x1D53D, "M", "f"), - (0x1D53E, "M", "g"), - (0x1D53F, "X"), - (0x1D540, "M", "i"), - (0x1D541, "M", "j"), - (0x1D542, "M", "k"), - (0x1D543, "M", "l"), - (0x1D544, "M", "m"), - (0x1D545, "X"), - (0x1D546, "M", "o"), - (0x1D547, "X"), - (0x1D54A, "M", "s"), - (0x1D54B, "M", "t"), - (0x1D54C, "M", "u"), - (0x1D54D, "M", "v"), - (0x1D54E, "M", "w"), - (0x1D54F, "M", "x"), - (0x1D550, "M", "y"), - (0x1D551, "X"), - (0x1D552, "M", "a"), - (0x1D553, "M", "b"), - (0x1D554, "M", "c"), - (0x1D555, "M", "d"), - (0x1D556, "M", "e"), - ] - - -def _seg_64() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D557, "M", "f"), - (0x1D558, "M", "g"), - (0x1D559, "M", "h"), - (0x1D55A, "M", "i"), - (0x1D55B, "M", "j"), - (0x1D55C, "M", "k"), - (0x1D55D, "M", "l"), - (0x1D55E, "M", "m"), - (0x1D55F, "M", "n"), - (0x1D560, "M", "o"), - (0x1D561, "M", "p"), - (0x1D562, "M", "q"), - (0x1D563, "M", "r"), - (0x1D564, "M", "s"), - (0x1D565, "M", "t"), - (0x1D566, "M", "u"), - (0x1D567, "M", "v"), - (0x1D568, "M", "w"), - (0x1D569, "M", "x"), - (0x1D56A, "M", "y"), - (0x1D56B, "M", "z"), - (0x1D56C, "M", "a"), - (0x1D56D, "M", "b"), - (0x1D56E, "M", "c"), - (0x1D56F, "M", "d"), - (0x1D570, "M", "e"), - (0x1D571, "M", "f"), - (0x1D572, "M", "g"), - (0x1D573, "M", "h"), - (0x1D574, "M", "i"), - (0x1D575, "M", "j"), - (0x1D576, "M", "k"), - (0x1D577, "M", "l"), - (0x1D578, "M", "m"), - (0x1D579, "M", "n"), - (0x1D57A, "M", "o"), - (0x1D57B, "M", "p"), - (0x1D57C, "M", "q"), - (0x1D57D, "M", "r"), - (0x1D57E, "M", "s"), - (0x1D57F, "M", "t"), - (0x1D580, "M", "u"), - (0x1D581, "M", "v"), - (0x1D582, "M", "w"), - (0x1D583, "M", "x"), - (0x1D584, "M", "y"), - (0x1D585, "M", "z"), - (0x1D586, "M", "a"), - (0x1D587, "M", "b"), - (0x1D588, "M", "c"), - (0x1D589, "M", "d"), - (0x1D58A, "M", "e"), - (0x1D58B, "M", "f"), - (0x1D58C, "M", "g"), - (0x1D58D, "M", "h"), - (0x1D58E, "M", "i"), - (0x1D58F, "M", "j"), - (0x1D590, "M", "k"), - (0x1D591, "M", "l"), - (0x1D592, "M", "m"), - (0x1D593, "M", "n"), - (0x1D594, "M", "o"), - (0x1D595, "M", "p"), - (0x1D596, "M", "q"), - (0x1D597, "M", "r"), - (0x1D598, "M", "s"), - (0x1D599, "M", "t"), - (0x1D59A, "M", "u"), - (0x1D59B, "M", "v"), - (0x1D59C, "M", "w"), - (0x1D59D, "M", "x"), - (0x1D59E, "M", "y"), - (0x1D59F, "M", "z"), - (0x1D5A0, "M", "a"), - (0x1D5A1, "M", "b"), - (0x1D5A2, "M", "c"), - (0x1D5A3, "M", "d"), - (0x1D5A4, "M", "e"), - (0x1D5A5, "M", "f"), - (0x1D5A6, "M", "g"), - (0x1D5A7, "M", "h"), - (0x1D5A8, "M", "i"), - (0x1D5A9, "M", "j"), - (0x1D5AA, "M", "k"), - (0x1D5AB, "M", "l"), - (0x1D5AC, "M", "m"), - (0x1D5AD, "M", "n"), - (0x1D5AE, "M", "o"), - (0x1D5AF, "M", "p"), - (0x1D5B0, "M", "q"), - (0x1D5B1, "M", "r"), - (0x1D5B2, "M", "s"), - (0x1D5B3, "M", "t"), - (0x1D5B4, "M", "u"), - (0x1D5B5, "M", "v"), - (0x1D5B6, "M", "w"), - (0x1D5B7, "M", "x"), - (0x1D5B8, "M", "y"), - (0x1D5B9, "M", "z"), - (0x1D5BA, "M", "a"), - ] - - -def _seg_65() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D5BB, "M", "b"), - (0x1D5BC, "M", "c"), - (0x1D5BD, "M", "d"), - (0x1D5BE, "M", "e"), - (0x1D5BF, "M", "f"), - (0x1D5C0, "M", "g"), - (0x1D5C1, "M", "h"), - (0x1D5C2, "M", "i"), - (0x1D5C3, "M", "j"), - (0x1D5C4, "M", "k"), - (0x1D5C5, "M", "l"), - (0x1D5C6, "M", "m"), - (0x1D5C7, "M", "n"), - (0x1D5C8, "M", "o"), - (0x1D5C9, "M", "p"), - (0x1D5CA, "M", "q"), - (0x1D5CB, "M", "r"), - (0x1D5CC, "M", "s"), - (0x1D5CD, "M", "t"), - (0x1D5CE, "M", "u"), - (0x1D5CF, "M", "v"), - (0x1D5D0, "M", "w"), - (0x1D5D1, "M", "x"), - (0x1D5D2, "M", "y"), - (0x1D5D3, "M", "z"), - (0x1D5D4, "M", "a"), - (0x1D5D5, "M", "b"), - (0x1D5D6, "M", "c"), - (0x1D5D7, "M", "d"), - (0x1D5D8, "M", "e"), - (0x1D5D9, "M", "f"), - (0x1D5DA, "M", "g"), - (0x1D5DB, "M", "h"), - (0x1D5DC, "M", "i"), - (0x1D5DD, "M", "j"), - (0x1D5DE, "M", "k"), - (0x1D5DF, "M", "l"), - (0x1D5E0, "M", "m"), - (0x1D5E1, "M", "n"), - (0x1D5E2, "M", "o"), - (0x1D5E3, "M", "p"), - (0x1D5E4, "M", "q"), - (0x1D5E5, "M", "r"), - (0x1D5E6, "M", "s"), - (0x1D5E7, "M", "t"), - (0x1D5E8, "M", "u"), - (0x1D5E9, "M", "v"), - (0x1D5EA, "M", "w"), - (0x1D5EB, "M", "x"), - (0x1D5EC, "M", "y"), - (0x1D5ED, "M", "z"), - (0x1D5EE, "M", "a"), - (0x1D5EF, "M", "b"), - (0x1D5F0, "M", "c"), - (0x1D5F1, "M", "d"), - (0x1D5F2, "M", "e"), - (0x1D5F3, "M", "f"), - (0x1D5F4, "M", "g"), - (0x1D5F5, "M", "h"), - (0x1D5F6, "M", "i"), - (0x1D5F7, "M", "j"), - (0x1D5F8, "M", "k"), - (0x1D5F9, "M", "l"), - (0x1D5FA, "M", "m"), - (0x1D5FB, "M", "n"), - (0x1D5FC, "M", "o"), - (0x1D5FD, "M", "p"), - (0x1D5FE, "M", "q"), - (0x1D5FF, "M", "r"), - (0x1D600, "M", "s"), - (0x1D601, "M", "t"), - (0x1D602, "M", "u"), - (0x1D603, "M", "v"), - (0x1D604, "M", "w"), - (0x1D605, "M", "x"), - (0x1D606, "M", "y"), - (0x1D607, "M", "z"), - (0x1D608, "M", "a"), - (0x1D609, "M", "b"), - (0x1D60A, "M", "c"), - (0x1D60B, "M", "d"), - (0x1D60C, "M", "e"), - (0x1D60D, "M", "f"), - (0x1D60E, "M", "g"), - (0x1D60F, "M", "h"), - (0x1D610, "M", "i"), - (0x1D611, "M", "j"), - (0x1D612, "M", "k"), - (0x1D613, "M", "l"), - (0x1D614, "M", "m"), - (0x1D615, "M", "n"), - (0x1D616, "M", "o"), - (0x1D617, "M", "p"), - (0x1D618, "M", "q"), - (0x1D619, "M", "r"), - (0x1D61A, "M", "s"), - (0x1D61B, "M", "t"), - (0x1D61C, "M", "u"), - (0x1D61D, "M", "v"), - (0x1D61E, "M", "w"), - ] - - -def _seg_66() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D61F, "M", "x"), - (0x1D620, "M", "y"), - (0x1D621, "M", "z"), - (0x1D622, "M", "a"), - (0x1D623, "M", "b"), - (0x1D624, "M", "c"), - (0x1D625, "M", "d"), - (0x1D626, "M", "e"), - (0x1D627, "M", "f"), - (0x1D628, "M", "g"), - (0x1D629, "M", "h"), - (0x1D62A, "M", "i"), - (0x1D62B, "M", "j"), - (0x1D62C, "M", "k"), - (0x1D62D, "M", "l"), - (0x1D62E, "M", "m"), - (0x1D62F, "M", "n"), - (0x1D630, "M", "o"), - (0x1D631, "M", "p"), - (0x1D632, "M", "q"), - (0x1D633, "M", "r"), - (0x1D634, "M", "s"), - (0x1D635, "M", "t"), - (0x1D636, "M", "u"), - (0x1D637, "M", "v"), - (0x1D638, "M", "w"), - (0x1D639, "M", "x"), - (0x1D63A, "M", "y"), - (0x1D63B, "M", "z"), - (0x1D63C, "M", "a"), - (0x1D63D, "M", "b"), - (0x1D63E, "M", "c"), - (0x1D63F, "M", "d"), - (0x1D640, "M", "e"), - (0x1D641, "M", "f"), - (0x1D642, "M", "g"), - (0x1D643, "M", "h"), - (0x1D644, "M", "i"), - (0x1D645, "M", "j"), - (0x1D646, "M", "k"), - (0x1D647, "M", "l"), - (0x1D648, "M", "m"), - (0x1D649, "M", "n"), - (0x1D64A, "M", "o"), - (0x1D64B, "M", "p"), - (0x1D64C, "M", "q"), - (0x1D64D, "M", "r"), - (0x1D64E, "M", "s"), - (0x1D64F, "M", "t"), - (0x1D650, "M", "u"), - (0x1D651, "M", "v"), - (0x1D652, "M", "w"), - (0x1D653, "M", "x"), - (0x1D654, "M", "y"), - (0x1D655, "M", "z"), - (0x1D656, "M", "a"), - (0x1D657, "M", "b"), - (0x1D658, "M", "c"), - (0x1D659, "M", "d"), - (0x1D65A, "M", "e"), - (0x1D65B, "M", "f"), - (0x1D65C, "M", "g"), - (0x1D65D, "M", "h"), - (0x1D65E, "M", "i"), - (0x1D65F, "M", "j"), - (0x1D660, "M", "k"), - (0x1D661, "M", "l"), - (0x1D662, "M", "m"), - (0x1D663, "M", "n"), - (0x1D664, "M", "o"), - (0x1D665, "M", "p"), - (0x1D666, "M", "q"), - (0x1D667, "M", "r"), - (0x1D668, "M", "s"), - (0x1D669, "M", "t"), - (0x1D66A, "M", "u"), - (0x1D66B, "M", "v"), - (0x1D66C, "M", "w"), - (0x1D66D, "M", "x"), - (0x1D66E, "M", "y"), - (0x1D66F, "M", "z"), - (0x1D670, "M", "a"), - (0x1D671, "M", "b"), - (0x1D672, "M", "c"), - (0x1D673, "M", "d"), - (0x1D674, "M", "e"), - (0x1D675, "M", "f"), - (0x1D676, "M", "g"), - (0x1D677, "M", "h"), - (0x1D678, "M", "i"), - (0x1D679, "M", "j"), - (0x1D67A, "M", "k"), - (0x1D67B, "M", "l"), - (0x1D67C, "M", "m"), - (0x1D67D, "M", "n"), - (0x1D67E, "M", "o"), - (0x1D67F, "M", "p"), - (0x1D680, "M", "q"), - (0x1D681, "M", "r"), - (0x1D682, "M", "s"), - ] - - -def _seg_67() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D683, "M", "t"), - (0x1D684, "M", "u"), - (0x1D685, "M", "v"), - (0x1D686, "M", "w"), - (0x1D687, "M", "x"), - (0x1D688, "M", "y"), - (0x1D689, "M", "z"), - (0x1D68A, "M", "a"), - (0x1D68B, "M", "b"), - (0x1D68C, "M", "c"), - (0x1D68D, "M", "d"), - (0x1D68E, "M", "e"), - (0x1D68F, "M", "f"), - (0x1D690, "M", "g"), - (0x1D691, "M", "h"), - (0x1D692, "M", "i"), - (0x1D693, "M", "j"), - (0x1D694, "M", "k"), - (0x1D695, "M", "l"), - (0x1D696, "M", "m"), - (0x1D697, "M", "n"), - (0x1D698, "M", "o"), - (0x1D699, "M", "p"), - (0x1D69A, "M", "q"), - (0x1D69B, "M", "r"), - (0x1D69C, "M", "s"), - (0x1D69D, "M", "t"), - (0x1D69E, "M", "u"), - (0x1D69F, "M", "v"), - (0x1D6A0, "M", "w"), - (0x1D6A1, "M", "x"), - (0x1D6A2, "M", "y"), - (0x1D6A3, "M", "z"), - (0x1D6A4, "M", "ı"), - (0x1D6A5, "M", "ȷ"), - (0x1D6A6, "X"), - (0x1D6A8, "M", "α"), - (0x1D6A9, "M", "β"), - (0x1D6AA, "M", "γ"), - (0x1D6AB, "M", "δ"), - (0x1D6AC, "M", "ε"), - (0x1D6AD, "M", "ζ"), - (0x1D6AE, "M", "η"), - (0x1D6AF, "M", "θ"), - (0x1D6B0, "M", "ι"), - (0x1D6B1, "M", "κ"), - (0x1D6B2, "M", "λ"), - (0x1D6B3, "M", "μ"), - (0x1D6B4, "M", "ν"), - (0x1D6B5, "M", "ξ"), - (0x1D6B6, "M", "ο"), - (0x1D6B7, "M", "π"), - (0x1D6B8, "M", "ρ"), - (0x1D6B9, "M", "θ"), - (0x1D6BA, "M", "σ"), - (0x1D6BB, "M", "τ"), - (0x1D6BC, "M", "υ"), - (0x1D6BD, "M", "φ"), - (0x1D6BE, "M", "χ"), - (0x1D6BF, "M", "ψ"), - (0x1D6C0, "M", "ω"), - (0x1D6C1, "M", "∇"), - (0x1D6C2, "M", "α"), - (0x1D6C3, "M", "β"), - (0x1D6C4, "M", "γ"), - (0x1D6C5, "M", "δ"), - (0x1D6C6, "M", "ε"), - (0x1D6C7, "M", "ζ"), - (0x1D6C8, "M", "η"), - (0x1D6C9, "M", "θ"), - (0x1D6CA, "M", "ι"), - (0x1D6CB, "M", "κ"), - (0x1D6CC, "M", "λ"), - (0x1D6CD, "M", "μ"), - (0x1D6CE, "M", "ν"), - (0x1D6CF, "M", "ξ"), - (0x1D6D0, "M", "ο"), - (0x1D6D1, "M", "π"), - (0x1D6D2, "M", "ρ"), - (0x1D6D3, "M", "σ"), - (0x1D6D5, "M", "τ"), - (0x1D6D6, "M", "υ"), - (0x1D6D7, "M", "φ"), - (0x1D6D8, "M", "χ"), - (0x1D6D9, "M", "ψ"), - (0x1D6DA, "M", "ω"), - (0x1D6DB, "M", "∂"), - (0x1D6DC, "M", "ε"), - (0x1D6DD, "M", "θ"), - (0x1D6DE, "M", "κ"), - (0x1D6DF, "M", "φ"), - (0x1D6E0, "M", "ρ"), - (0x1D6E1, "M", "π"), - (0x1D6E2, "M", "α"), - (0x1D6E3, "M", "β"), - (0x1D6E4, "M", "γ"), - (0x1D6E5, "M", "δ"), - (0x1D6E6, "M", "ε"), - (0x1D6E7, "M", "ζ"), - (0x1D6E8, "M", "η"), - ] - - -def _seg_68() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D6E9, "M", "θ"), - (0x1D6EA, "M", "ι"), - (0x1D6EB, "M", "κ"), - (0x1D6EC, "M", "λ"), - (0x1D6ED, "M", "μ"), - (0x1D6EE, "M", "ν"), - (0x1D6EF, "M", "ξ"), - (0x1D6F0, "M", "ο"), - (0x1D6F1, "M", "π"), - (0x1D6F2, "M", "ρ"), - (0x1D6F3, "M", "θ"), - (0x1D6F4, "M", "σ"), - (0x1D6F5, "M", "τ"), - (0x1D6F6, "M", "υ"), - (0x1D6F7, "M", "φ"), - (0x1D6F8, "M", "χ"), - (0x1D6F9, "M", "ψ"), - (0x1D6FA, "M", "ω"), - (0x1D6FB, "M", "∇"), - (0x1D6FC, "M", "α"), - (0x1D6FD, "M", "β"), - (0x1D6FE, "M", "γ"), - (0x1D6FF, "M", "δ"), - (0x1D700, "M", "ε"), - (0x1D701, "M", "ζ"), - (0x1D702, "M", "η"), - (0x1D703, "M", "θ"), - (0x1D704, "M", "ι"), - (0x1D705, "M", "κ"), - (0x1D706, "M", "λ"), - (0x1D707, "M", "μ"), - (0x1D708, "M", "ν"), - (0x1D709, "M", "ξ"), - (0x1D70A, "M", "ο"), - (0x1D70B, "M", "π"), - (0x1D70C, "M", "ρ"), - (0x1D70D, "M", "σ"), - (0x1D70F, "M", "τ"), - (0x1D710, "M", "υ"), - (0x1D711, "M", "φ"), - (0x1D712, "M", "χ"), - (0x1D713, "M", "ψ"), - (0x1D714, "M", "ω"), - (0x1D715, "M", "∂"), - (0x1D716, "M", "ε"), - (0x1D717, "M", "θ"), - (0x1D718, "M", "κ"), - (0x1D719, "M", "φ"), - (0x1D71A, "M", "ρ"), - (0x1D71B, "M", "π"), - (0x1D71C, "M", "α"), - (0x1D71D, "M", "β"), - (0x1D71E, "M", "γ"), - (0x1D71F, "M", "δ"), - (0x1D720, "M", "ε"), - (0x1D721, "M", "ζ"), - (0x1D722, "M", "η"), - (0x1D723, "M", "θ"), - (0x1D724, "M", "ι"), - (0x1D725, "M", "κ"), - (0x1D726, "M", "λ"), - (0x1D727, "M", "μ"), - (0x1D728, "M", "ν"), - (0x1D729, "M", "ξ"), - (0x1D72A, "M", "ο"), - (0x1D72B, "M", "π"), - (0x1D72C, "M", "ρ"), - (0x1D72D, "M", "θ"), - (0x1D72E, "M", "σ"), - (0x1D72F, "M", "τ"), - (0x1D730, "M", "υ"), - (0x1D731, "M", "φ"), - (0x1D732, "M", "χ"), - (0x1D733, "M", "ψ"), - (0x1D734, "M", "ω"), - (0x1D735, "M", "∇"), - (0x1D736, "M", "α"), - (0x1D737, "M", "β"), - (0x1D738, "M", "γ"), - (0x1D739, "M", "δ"), - (0x1D73A, "M", "ε"), - (0x1D73B, "M", "ζ"), - (0x1D73C, "M", "η"), - (0x1D73D, "M", "θ"), - (0x1D73E, "M", "ι"), - (0x1D73F, "M", "κ"), - (0x1D740, "M", "λ"), - (0x1D741, "M", "μ"), - (0x1D742, "M", "ν"), - (0x1D743, "M", "ξ"), - (0x1D744, "M", "ο"), - (0x1D745, "M", "π"), - (0x1D746, "M", "ρ"), - (0x1D747, "M", "σ"), - (0x1D749, "M", "τ"), - (0x1D74A, "M", "υ"), - (0x1D74B, "M", "φ"), - (0x1D74C, "M", "χ"), - (0x1D74D, "M", "ψ"), - (0x1D74E, "M", "ω"), - ] - - -def _seg_69() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D74F, "M", "∂"), - (0x1D750, "M", "ε"), - (0x1D751, "M", "θ"), - (0x1D752, "M", "κ"), - (0x1D753, "M", "φ"), - (0x1D754, "M", "ρ"), - (0x1D755, "M", "π"), - (0x1D756, "M", "α"), - (0x1D757, "M", "β"), - (0x1D758, "M", "γ"), - (0x1D759, "M", "δ"), - (0x1D75A, "M", "ε"), - (0x1D75B, "M", "ζ"), - (0x1D75C, "M", "η"), - (0x1D75D, "M", "θ"), - (0x1D75E, "M", "ι"), - (0x1D75F, "M", "κ"), - (0x1D760, "M", "λ"), - (0x1D761, "M", "μ"), - (0x1D762, "M", "ν"), - (0x1D763, "M", "ξ"), - (0x1D764, "M", "ο"), - (0x1D765, "M", "π"), - (0x1D766, "M", "ρ"), - (0x1D767, "M", "θ"), - (0x1D768, "M", "σ"), - (0x1D769, "M", "τ"), - (0x1D76A, "M", "υ"), - (0x1D76B, "M", "φ"), - (0x1D76C, "M", "χ"), - (0x1D76D, "M", "ψ"), - (0x1D76E, "M", "ω"), - (0x1D76F, "M", "∇"), - (0x1D770, "M", "α"), - (0x1D771, "M", "β"), - (0x1D772, "M", "γ"), - (0x1D773, "M", "δ"), - (0x1D774, "M", "ε"), - (0x1D775, "M", "ζ"), - (0x1D776, "M", "η"), - (0x1D777, "M", "θ"), - (0x1D778, "M", "ι"), - (0x1D779, "M", "κ"), - (0x1D77A, "M", "λ"), - (0x1D77B, "M", "μ"), - (0x1D77C, "M", "ν"), - (0x1D77D, "M", "ξ"), - (0x1D77E, "M", "ο"), - (0x1D77F, "M", "π"), - (0x1D780, "M", "ρ"), - (0x1D781, "M", "σ"), - (0x1D783, "M", "τ"), - (0x1D784, "M", "υ"), - (0x1D785, "M", "φ"), - (0x1D786, "M", "χ"), - (0x1D787, "M", "ψ"), - (0x1D788, "M", "ω"), - (0x1D789, "M", "∂"), - (0x1D78A, "M", "ε"), - (0x1D78B, "M", "θ"), - (0x1D78C, "M", "κ"), - (0x1D78D, "M", "φ"), - (0x1D78E, "M", "ρ"), - (0x1D78F, "M", "π"), - (0x1D790, "M", "α"), - (0x1D791, "M", "β"), - (0x1D792, "M", "γ"), - (0x1D793, "M", "δ"), - (0x1D794, "M", "ε"), - (0x1D795, "M", "ζ"), - (0x1D796, "M", "η"), - (0x1D797, "M", "θ"), - (0x1D798, "M", "ι"), - (0x1D799, "M", "κ"), - (0x1D79A, "M", "λ"), - (0x1D79B, "M", "μ"), - (0x1D79C, "M", "ν"), - (0x1D79D, "M", "ξ"), - (0x1D79E, "M", "ο"), - (0x1D79F, "M", "π"), - (0x1D7A0, "M", "ρ"), - (0x1D7A1, "M", "θ"), - (0x1D7A2, "M", "σ"), - (0x1D7A3, "M", "τ"), - (0x1D7A4, "M", "υ"), - (0x1D7A5, "M", "φ"), - (0x1D7A6, "M", "χ"), - (0x1D7A7, "M", "ψ"), - (0x1D7A8, "M", "ω"), - (0x1D7A9, "M", "∇"), - (0x1D7AA, "M", "α"), - (0x1D7AB, "M", "β"), - (0x1D7AC, "M", "γ"), - (0x1D7AD, "M", "δ"), - (0x1D7AE, "M", "ε"), - (0x1D7AF, "M", "ζ"), - (0x1D7B0, "M", "η"), - (0x1D7B1, "M", "θ"), - (0x1D7B2, "M", "ι"), - (0x1D7B3, "M", "κ"), - ] - - -def _seg_70() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1D7B4, "M", "λ"), - (0x1D7B5, "M", "μ"), - (0x1D7B6, "M", "ν"), - (0x1D7B7, "M", "ξ"), - (0x1D7B8, "M", "ο"), - (0x1D7B9, "M", "π"), - (0x1D7BA, "M", "ρ"), - (0x1D7BB, "M", "σ"), - (0x1D7BD, "M", "τ"), - (0x1D7BE, "M", "υ"), - (0x1D7BF, "M", "φ"), - (0x1D7C0, "M", "χ"), - (0x1D7C1, "M", "ψ"), - (0x1D7C2, "M", "ω"), - (0x1D7C3, "M", "∂"), - (0x1D7C4, "M", "ε"), - (0x1D7C5, "M", "θ"), - (0x1D7C6, "M", "κ"), - (0x1D7C7, "M", "φ"), - (0x1D7C8, "M", "ρ"), - (0x1D7C9, "M", "π"), - (0x1D7CA, "M", "ϝ"), - (0x1D7CC, "X"), - (0x1D7CE, "M", "0"), - (0x1D7CF, "M", "1"), - (0x1D7D0, "M", "2"), - (0x1D7D1, "M", "3"), - (0x1D7D2, "M", "4"), - (0x1D7D3, "M", "5"), - (0x1D7D4, "M", "6"), - (0x1D7D5, "M", "7"), - (0x1D7D6, "M", "8"), - (0x1D7D7, "M", "9"), - (0x1D7D8, "M", "0"), - (0x1D7D9, "M", "1"), - (0x1D7DA, "M", "2"), - (0x1D7DB, "M", "3"), - (0x1D7DC, "M", "4"), - (0x1D7DD, "M", "5"), - (0x1D7DE, "M", "6"), - (0x1D7DF, "M", "7"), - (0x1D7E0, "M", "8"), - (0x1D7E1, "M", "9"), - (0x1D7E2, "M", "0"), - (0x1D7E3, "M", "1"), - (0x1D7E4, "M", "2"), - (0x1D7E5, "M", "3"), - (0x1D7E6, "M", "4"), - (0x1D7E7, "M", "5"), - (0x1D7E8, "M", "6"), - (0x1D7E9, "M", "7"), - (0x1D7EA, "M", "8"), - (0x1D7EB, "M", "9"), - (0x1D7EC, "M", "0"), - (0x1D7ED, "M", "1"), - (0x1D7EE, "M", "2"), - (0x1D7EF, "M", "3"), - (0x1D7F0, "M", "4"), - (0x1D7F1, "M", "5"), - (0x1D7F2, "M", "6"), - (0x1D7F3, "M", "7"), - (0x1D7F4, "M", "8"), - (0x1D7F5, "M", "9"), - (0x1D7F6, "M", "0"), - (0x1D7F7, "M", "1"), - (0x1D7F8, "M", "2"), - (0x1D7F9, "M", "3"), - (0x1D7FA, "M", "4"), - (0x1D7FB, "M", "5"), - (0x1D7FC, "M", "6"), - (0x1D7FD, "M", "7"), - (0x1D7FE, "M", "8"), - (0x1D7FF, "M", "9"), - (0x1D800, "V"), - (0x1DA8C, "X"), - (0x1DA9B, "V"), - (0x1DAA0, "X"), - (0x1DAA1, "V"), - (0x1DAB0, "X"), - (0x1DF00, "V"), - (0x1DF1F, "X"), - (0x1DF25, "V"), - (0x1DF2B, "X"), - (0x1E000, "V"), - (0x1E007, "X"), - (0x1E008, "V"), - (0x1E019, "X"), - (0x1E01B, "V"), - (0x1E022, "X"), - (0x1E023, "V"), - (0x1E025, "X"), - (0x1E026, "V"), - (0x1E02B, "X"), - (0x1E030, "M", "а"), - (0x1E031, "M", "б"), - (0x1E032, "M", "в"), - (0x1E033, "M", "г"), - (0x1E034, "M", "д"), - (0x1E035, "M", "е"), - (0x1E036, "M", "ж"), - ] - - -def _seg_71() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E037, "M", "з"), - (0x1E038, "M", "и"), - (0x1E039, "M", "к"), - (0x1E03A, "M", "л"), - (0x1E03B, "M", "м"), - (0x1E03C, "M", "о"), - (0x1E03D, "M", "п"), - (0x1E03E, "M", "р"), - (0x1E03F, "M", "с"), - (0x1E040, "M", "т"), - (0x1E041, "M", "у"), - (0x1E042, "M", "ф"), - (0x1E043, "M", "х"), - (0x1E044, "M", "ц"), - (0x1E045, "M", "ч"), - (0x1E046, "M", "ш"), - (0x1E047, "M", "ы"), - (0x1E048, "M", "э"), - (0x1E049, "M", "ю"), - (0x1E04A, "M", "ꚉ"), - (0x1E04B, "M", "ә"), - (0x1E04C, "M", "і"), - (0x1E04D, "M", "ј"), - (0x1E04E, "M", "ө"), - (0x1E04F, "M", "ү"), - (0x1E050, "M", "ӏ"), - (0x1E051, "M", "а"), - (0x1E052, "M", "б"), - (0x1E053, "M", "в"), - (0x1E054, "M", "г"), - (0x1E055, "M", "д"), - (0x1E056, "M", "е"), - (0x1E057, "M", "ж"), - (0x1E058, "M", "з"), - (0x1E059, "M", "и"), - (0x1E05A, "M", "к"), - (0x1E05B, "M", "л"), - (0x1E05C, "M", "о"), - (0x1E05D, "M", "п"), - (0x1E05E, "M", "с"), - (0x1E05F, "M", "у"), - (0x1E060, "M", "ф"), - (0x1E061, "M", "х"), - (0x1E062, "M", "ц"), - (0x1E063, "M", "ч"), - (0x1E064, "M", "ш"), - (0x1E065, "M", "ъ"), - (0x1E066, "M", "ы"), - (0x1E067, "M", "ґ"), - (0x1E068, "M", "і"), - (0x1E069, "M", "ѕ"), - (0x1E06A, "M", "џ"), - (0x1E06B, "M", "ҫ"), - (0x1E06C, "M", "ꙑ"), - (0x1E06D, "M", "ұ"), - (0x1E06E, "X"), - (0x1E08F, "V"), - (0x1E090, "X"), - (0x1E100, "V"), - (0x1E12D, "X"), - (0x1E130, "V"), - (0x1E13E, "X"), - (0x1E140, "V"), - (0x1E14A, "X"), - (0x1E14E, "V"), - (0x1E150, "X"), - (0x1E290, "V"), - (0x1E2AF, "X"), - (0x1E2C0, "V"), - (0x1E2FA, "X"), - (0x1E2FF, "V"), - (0x1E300, "X"), - (0x1E4D0, "V"), - (0x1E4FA, "X"), - (0x1E7E0, "V"), - (0x1E7E7, "X"), - (0x1E7E8, "V"), - (0x1E7EC, "X"), - (0x1E7ED, "V"), - (0x1E7EF, "X"), - (0x1E7F0, "V"), - (0x1E7FF, "X"), - (0x1E800, "V"), - (0x1E8C5, "X"), - (0x1E8C7, "V"), - (0x1E8D7, "X"), - (0x1E900, "M", "𞤢"), - (0x1E901, "M", "𞤣"), - (0x1E902, "M", "𞤤"), - (0x1E903, "M", "𞤥"), - (0x1E904, "M", "𞤦"), - (0x1E905, "M", "𞤧"), - (0x1E906, "M", "𞤨"), - (0x1E907, "M", "𞤩"), - (0x1E908, "M", "𞤪"), - (0x1E909, "M", "𞤫"), - (0x1E90A, "M", "𞤬"), - (0x1E90B, "M", "𞤭"), - (0x1E90C, "M", "𞤮"), - (0x1E90D, "M", "𞤯"), - ] - - -def _seg_72() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1E90E, "M", "𞤰"), - (0x1E90F, "M", "𞤱"), - (0x1E910, "M", "𞤲"), - (0x1E911, "M", "𞤳"), - (0x1E912, "M", "𞤴"), - (0x1E913, "M", "𞤵"), - (0x1E914, "M", "𞤶"), - (0x1E915, "M", "𞤷"), - (0x1E916, "M", "𞤸"), - (0x1E917, "M", "𞤹"), - (0x1E918, "M", "𞤺"), - (0x1E919, "M", "𞤻"), - (0x1E91A, "M", "𞤼"), - (0x1E91B, "M", "𞤽"), - (0x1E91C, "M", "𞤾"), - (0x1E91D, "M", "𞤿"), - (0x1E91E, "M", "𞥀"), - (0x1E91F, "M", "𞥁"), - (0x1E920, "M", "𞥂"), - (0x1E921, "M", "𞥃"), - (0x1E922, "V"), - (0x1E94C, "X"), - (0x1E950, "V"), - (0x1E95A, "X"), - (0x1E95E, "V"), - (0x1E960, "X"), - (0x1EC71, "V"), - (0x1ECB5, "X"), - (0x1ED01, "V"), - (0x1ED3E, "X"), - (0x1EE00, "M", "ا"), - (0x1EE01, "M", "ب"), - (0x1EE02, "M", "ج"), - (0x1EE03, "M", "د"), - (0x1EE04, "X"), - (0x1EE05, "M", "و"), - (0x1EE06, "M", "ز"), - (0x1EE07, "M", "ح"), - (0x1EE08, "M", "ط"), - (0x1EE09, "M", "ي"), - (0x1EE0A, "M", "ك"), - (0x1EE0B, "M", "ل"), - (0x1EE0C, "M", "م"), - (0x1EE0D, "M", "ن"), - (0x1EE0E, "M", "س"), - (0x1EE0F, "M", "ع"), - (0x1EE10, "M", "ف"), - (0x1EE11, "M", "ص"), - (0x1EE12, "M", "ق"), - (0x1EE13, "M", "ر"), - (0x1EE14, "M", "ش"), - (0x1EE15, "M", "ت"), - (0x1EE16, "M", "ث"), - (0x1EE17, "M", "خ"), - (0x1EE18, "M", "ذ"), - (0x1EE19, "M", "ض"), - (0x1EE1A, "M", "ظ"), - (0x1EE1B, "M", "غ"), - (0x1EE1C, "M", "ٮ"), - (0x1EE1D, "M", "ں"), - (0x1EE1E, "M", "ڡ"), - (0x1EE1F, "M", "ٯ"), - (0x1EE20, "X"), - (0x1EE21, "M", "ب"), - (0x1EE22, "M", "ج"), - (0x1EE23, "X"), - (0x1EE24, "M", "ه"), - (0x1EE25, "X"), - (0x1EE27, "M", "ح"), - (0x1EE28, "X"), - (0x1EE29, "M", "ي"), - (0x1EE2A, "M", "ك"), - (0x1EE2B, "M", "ل"), - (0x1EE2C, "M", "م"), - (0x1EE2D, "M", "ن"), - (0x1EE2E, "M", "س"), - (0x1EE2F, "M", "ع"), - (0x1EE30, "M", "ف"), - (0x1EE31, "M", "ص"), - (0x1EE32, "M", "ق"), - (0x1EE33, "X"), - (0x1EE34, "M", "ش"), - (0x1EE35, "M", "ت"), - (0x1EE36, "M", "ث"), - (0x1EE37, "M", "خ"), - (0x1EE38, "X"), - (0x1EE39, "M", "ض"), - (0x1EE3A, "X"), - (0x1EE3B, "M", "غ"), - (0x1EE3C, "X"), - (0x1EE42, "M", "ج"), - (0x1EE43, "X"), - (0x1EE47, "M", "ح"), - (0x1EE48, "X"), - (0x1EE49, "M", "ي"), - (0x1EE4A, "X"), - (0x1EE4B, "M", "ل"), - (0x1EE4C, "X"), - (0x1EE4D, "M", "ن"), - (0x1EE4E, "M", "س"), - ] - - -def _seg_73() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EE4F, "M", "ع"), - (0x1EE50, "X"), - (0x1EE51, "M", "ص"), - (0x1EE52, "M", "ق"), - (0x1EE53, "X"), - (0x1EE54, "M", "ش"), - (0x1EE55, "X"), - (0x1EE57, "M", "خ"), - (0x1EE58, "X"), - (0x1EE59, "M", "ض"), - (0x1EE5A, "X"), - (0x1EE5B, "M", "غ"), - (0x1EE5C, "X"), - (0x1EE5D, "M", "ں"), - (0x1EE5E, "X"), - (0x1EE5F, "M", "ٯ"), - (0x1EE60, "X"), - (0x1EE61, "M", "ب"), - (0x1EE62, "M", "ج"), - (0x1EE63, "X"), - (0x1EE64, "M", "ه"), - (0x1EE65, "X"), - (0x1EE67, "M", "ح"), - (0x1EE68, "M", "ط"), - (0x1EE69, "M", "ي"), - (0x1EE6A, "M", "ك"), - (0x1EE6B, "X"), - (0x1EE6C, "M", "م"), - (0x1EE6D, "M", "ن"), - (0x1EE6E, "M", "س"), - (0x1EE6F, "M", "ع"), - (0x1EE70, "M", "ف"), - (0x1EE71, "M", "ص"), - (0x1EE72, "M", "ق"), - (0x1EE73, "X"), - (0x1EE74, "M", "ش"), - (0x1EE75, "M", "ت"), - (0x1EE76, "M", "ث"), - (0x1EE77, "M", "خ"), - (0x1EE78, "X"), - (0x1EE79, "M", "ض"), - (0x1EE7A, "M", "ظ"), - (0x1EE7B, "M", "غ"), - (0x1EE7C, "M", "ٮ"), - (0x1EE7D, "X"), - (0x1EE7E, "M", "ڡ"), - (0x1EE7F, "X"), - (0x1EE80, "M", "ا"), - (0x1EE81, "M", "ب"), - (0x1EE82, "M", "ج"), - (0x1EE83, "M", "د"), - (0x1EE84, "M", "ه"), - (0x1EE85, "M", "و"), - (0x1EE86, "M", "ز"), - (0x1EE87, "M", "ح"), - (0x1EE88, "M", "ط"), - (0x1EE89, "M", "ي"), - (0x1EE8A, "X"), - (0x1EE8B, "M", "ل"), - (0x1EE8C, "M", "م"), - (0x1EE8D, "M", "ن"), - (0x1EE8E, "M", "س"), - (0x1EE8F, "M", "ع"), - (0x1EE90, "M", "ف"), - (0x1EE91, "M", "ص"), - (0x1EE92, "M", "ق"), - (0x1EE93, "M", "ر"), - (0x1EE94, "M", "ش"), - (0x1EE95, "M", "ت"), - (0x1EE96, "M", "ث"), - (0x1EE97, "M", "خ"), - (0x1EE98, "M", "ذ"), - (0x1EE99, "M", "ض"), - (0x1EE9A, "M", "ظ"), - (0x1EE9B, "M", "غ"), - (0x1EE9C, "X"), - (0x1EEA1, "M", "ب"), - (0x1EEA2, "M", "ج"), - (0x1EEA3, "M", "د"), - (0x1EEA4, "X"), - (0x1EEA5, "M", "و"), - (0x1EEA6, "M", "ز"), - (0x1EEA7, "M", "ح"), - (0x1EEA8, "M", "ط"), - (0x1EEA9, "M", "ي"), - (0x1EEAA, "X"), - (0x1EEAB, "M", "ل"), - (0x1EEAC, "M", "م"), - (0x1EEAD, "M", "ن"), - (0x1EEAE, "M", "س"), - (0x1EEAF, "M", "ع"), - (0x1EEB0, "M", "ف"), - (0x1EEB1, "M", "ص"), - (0x1EEB2, "M", "ق"), - (0x1EEB3, "M", "ر"), - (0x1EEB4, "M", "ش"), - (0x1EEB5, "M", "ت"), - (0x1EEB6, "M", "ث"), - (0x1EEB7, "M", "خ"), - (0x1EEB8, "M", "ذ"), - ] - - -def _seg_74() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1EEB9, "M", "ض"), - (0x1EEBA, "M", "ظ"), - (0x1EEBB, "M", "غ"), - (0x1EEBC, "X"), - (0x1EEF0, "V"), - (0x1EEF2, "X"), - (0x1F000, "V"), - (0x1F02C, "X"), - (0x1F030, "V"), - (0x1F094, "X"), - (0x1F0A0, "V"), - (0x1F0AF, "X"), - (0x1F0B1, "V"), - (0x1F0C0, "X"), - (0x1F0C1, "V"), - (0x1F0D0, "X"), - (0x1F0D1, "V"), - (0x1F0F6, "X"), - (0x1F101, "3", "0,"), - (0x1F102, "3", "1,"), - (0x1F103, "3", "2,"), - (0x1F104, "3", "3,"), - (0x1F105, "3", "4,"), - (0x1F106, "3", "5,"), - (0x1F107, "3", "6,"), - (0x1F108, "3", "7,"), - (0x1F109, "3", "8,"), - (0x1F10A, "3", "9,"), - (0x1F10B, "V"), - (0x1F110, "3", "(a)"), - (0x1F111, "3", "(b)"), - (0x1F112, "3", "(c)"), - (0x1F113, "3", "(d)"), - (0x1F114, "3", "(e)"), - (0x1F115, "3", "(f)"), - (0x1F116, "3", "(g)"), - (0x1F117, "3", "(h)"), - (0x1F118, "3", "(i)"), - (0x1F119, "3", "(j)"), - (0x1F11A, "3", "(k)"), - (0x1F11B, "3", "(l)"), - (0x1F11C, "3", "(m)"), - (0x1F11D, "3", "(n)"), - (0x1F11E, "3", "(o)"), - (0x1F11F, "3", "(p)"), - (0x1F120, "3", "(q)"), - (0x1F121, "3", "(r)"), - (0x1F122, "3", "(s)"), - (0x1F123, "3", "(t)"), - (0x1F124, "3", "(u)"), - (0x1F125, "3", "(v)"), - (0x1F126, "3", "(w)"), - (0x1F127, "3", "(x)"), - (0x1F128, "3", "(y)"), - (0x1F129, "3", "(z)"), - (0x1F12A, "M", "〔s〕"), - (0x1F12B, "M", "c"), - (0x1F12C, "M", "r"), - (0x1F12D, "M", "cd"), - (0x1F12E, "M", "wz"), - (0x1F12F, "V"), - (0x1F130, "M", "a"), - (0x1F131, "M", "b"), - (0x1F132, "M", "c"), - (0x1F133, "M", "d"), - (0x1F134, "M", "e"), - (0x1F135, "M", "f"), - (0x1F136, "M", "g"), - (0x1F137, "M", "h"), - (0x1F138, "M", "i"), - (0x1F139, "M", "j"), - (0x1F13A, "M", "k"), - (0x1F13B, "M", "l"), - (0x1F13C, "M", "m"), - (0x1F13D, "M", "n"), - (0x1F13E, "M", "o"), - (0x1F13F, "M", "p"), - (0x1F140, "M", "q"), - (0x1F141, "M", "r"), - (0x1F142, "M", "s"), - (0x1F143, "M", "t"), - (0x1F144, "M", "u"), - (0x1F145, "M", "v"), - (0x1F146, "M", "w"), - (0x1F147, "M", "x"), - (0x1F148, "M", "y"), - (0x1F149, "M", "z"), - (0x1F14A, "M", "hv"), - (0x1F14B, "M", "mv"), - (0x1F14C, "M", "sd"), - (0x1F14D, "M", "ss"), - (0x1F14E, "M", "ppv"), - (0x1F14F, "M", "wc"), - (0x1F150, "V"), - (0x1F16A, "M", "mc"), - (0x1F16B, "M", "md"), - (0x1F16C, "M", "mr"), - (0x1F16D, "V"), - (0x1F190, "M", "dj"), - (0x1F191, "V"), - ] - - -def _seg_75() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1F1AE, "X"), - (0x1F1E6, "V"), - (0x1F200, "M", "ほか"), - (0x1F201, "M", "ココ"), - (0x1F202, "M", "サ"), - (0x1F203, "X"), - (0x1F210, "M", "手"), - (0x1F211, "M", "字"), - (0x1F212, "M", "双"), - (0x1F213, "M", "デ"), - (0x1F214, "M", "二"), - (0x1F215, "M", "多"), - (0x1F216, "M", "解"), - (0x1F217, "M", "天"), - (0x1F218, "M", "交"), - (0x1F219, "M", "映"), - (0x1F21A, "M", "無"), - (0x1F21B, "M", "料"), - (0x1F21C, "M", "前"), - (0x1F21D, "M", "後"), - (0x1F21E, "M", "再"), - (0x1F21F, "M", "新"), - (0x1F220, "M", "初"), - (0x1F221, "M", "終"), - (0x1F222, "M", "生"), - (0x1F223, "M", "販"), - (0x1F224, "M", "声"), - (0x1F225, "M", "吹"), - (0x1F226, "M", "演"), - (0x1F227, "M", "投"), - (0x1F228, "M", "捕"), - (0x1F229, "M", "一"), - (0x1F22A, "M", "三"), - (0x1F22B, "M", "遊"), - (0x1F22C, "M", "左"), - (0x1F22D, "M", "中"), - (0x1F22E, "M", "右"), - (0x1F22F, "M", "指"), - (0x1F230, "M", "走"), - (0x1F231, "M", "打"), - (0x1F232, "M", "禁"), - (0x1F233, "M", "空"), - (0x1F234, "M", "合"), - (0x1F235, "M", "満"), - (0x1F236, "M", "有"), - (0x1F237, "M", "月"), - (0x1F238, "M", "申"), - (0x1F239, "M", "割"), - (0x1F23A, "M", "営"), - (0x1F23B, "M", "配"), - (0x1F23C, "X"), - (0x1F240, "M", "〔本〕"), - (0x1F241, "M", "〔三〕"), - (0x1F242, "M", "〔二〕"), - (0x1F243, "M", "〔安〕"), - (0x1F244, "M", "〔点〕"), - (0x1F245, "M", "〔打〕"), - (0x1F246, "M", "〔盗〕"), - (0x1F247, "M", "〔勝〕"), - (0x1F248, "M", "〔敗〕"), - (0x1F249, "X"), - (0x1F250, "M", "得"), - (0x1F251, "M", "可"), - (0x1F252, "X"), - (0x1F260, "V"), - (0x1F266, "X"), - (0x1F300, "V"), - (0x1F6D8, "X"), - (0x1F6DC, "V"), - (0x1F6ED, "X"), - (0x1F6F0, "V"), - (0x1F6FD, "X"), - (0x1F700, "V"), - (0x1F777, "X"), - (0x1F77B, "V"), - (0x1F7DA, "X"), - (0x1F7E0, "V"), - (0x1F7EC, "X"), - (0x1F7F0, "V"), - (0x1F7F1, "X"), - (0x1F800, "V"), - (0x1F80C, "X"), - (0x1F810, "V"), - (0x1F848, "X"), - (0x1F850, "V"), - (0x1F85A, "X"), - (0x1F860, "V"), - (0x1F888, "X"), - (0x1F890, "V"), - (0x1F8AE, "X"), - (0x1F8B0, "V"), - (0x1F8B2, "X"), - (0x1F900, "V"), - (0x1FA54, "X"), - (0x1FA60, "V"), - (0x1FA6E, "X"), - (0x1FA70, "V"), - (0x1FA7D, "X"), - (0x1FA80, "V"), - (0x1FA89, "X"), - ] - - -def _seg_76() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x1FA90, "V"), - (0x1FABE, "X"), - (0x1FABF, "V"), - (0x1FAC6, "X"), - (0x1FACE, "V"), - (0x1FADC, "X"), - (0x1FAE0, "V"), - (0x1FAE9, "X"), - (0x1FAF0, "V"), - (0x1FAF9, "X"), - (0x1FB00, "V"), - (0x1FB93, "X"), - (0x1FB94, "V"), - (0x1FBCB, "X"), - (0x1FBF0, "M", "0"), - (0x1FBF1, "M", "1"), - (0x1FBF2, "M", "2"), - (0x1FBF3, "M", "3"), - (0x1FBF4, "M", "4"), - (0x1FBF5, "M", "5"), - (0x1FBF6, "M", "6"), - (0x1FBF7, "M", "7"), - (0x1FBF8, "M", "8"), - (0x1FBF9, "M", "9"), - (0x1FBFA, "X"), - (0x20000, "V"), - (0x2A6E0, "X"), - (0x2A700, "V"), - (0x2B73A, "X"), - (0x2B740, "V"), - (0x2B81E, "X"), - (0x2B820, "V"), - (0x2CEA2, "X"), - (0x2CEB0, "V"), - (0x2EBE1, "X"), - (0x2EBF0, "V"), - (0x2EE5E, "X"), - (0x2F800, "M", "丽"), - (0x2F801, "M", "丸"), - (0x2F802, "M", "乁"), - (0x2F803, "M", "𠄢"), - (0x2F804, "M", "你"), - (0x2F805, "M", "侮"), - (0x2F806, "M", "侻"), - (0x2F807, "M", "倂"), - (0x2F808, "M", "偺"), - (0x2F809, "M", "備"), - (0x2F80A, "M", "僧"), - (0x2F80B, "M", "像"), - (0x2F80C, "M", "㒞"), - (0x2F80D, "M", "𠘺"), - (0x2F80E, "M", "免"), - (0x2F80F, "M", "兔"), - (0x2F810, "M", "兤"), - (0x2F811, "M", "具"), - (0x2F812, "M", "𠔜"), - (0x2F813, "M", "㒹"), - (0x2F814, "M", "內"), - (0x2F815, "M", "再"), - (0x2F816, "M", "𠕋"), - (0x2F817, "M", "冗"), - (0x2F818, "M", "冤"), - (0x2F819, "M", "仌"), - (0x2F81A, "M", "冬"), - (0x2F81B, "M", "况"), - (0x2F81C, "M", "𩇟"), - (0x2F81D, "M", "凵"), - (0x2F81E, "M", "刃"), - (0x2F81F, "M", "㓟"), - (0x2F820, "M", "刻"), - (0x2F821, "M", "剆"), - (0x2F822, "M", "割"), - (0x2F823, "M", "剷"), - (0x2F824, "M", "㔕"), - (0x2F825, "M", "勇"), - (0x2F826, "M", "勉"), - (0x2F827, "M", "勤"), - (0x2F828, "M", "勺"), - (0x2F829, "M", "包"), - (0x2F82A, "M", "匆"), - (0x2F82B, "M", "北"), - (0x2F82C, "M", "卉"), - (0x2F82D, "M", "卑"), - (0x2F82E, "M", "博"), - (0x2F82F, "M", "即"), - (0x2F830, "M", "卽"), - (0x2F831, "M", "卿"), - (0x2F834, "M", "𠨬"), - (0x2F835, "M", "灰"), - (0x2F836, "M", "及"), - (0x2F837, "M", "叟"), - (0x2F838, "M", "𠭣"), - (0x2F839, "M", "叫"), - (0x2F83A, "M", "叱"), - (0x2F83B, "M", "吆"), - (0x2F83C, "M", "咞"), - (0x2F83D, "M", "吸"), - (0x2F83E, "M", "呈"), - (0x2F83F, "M", "周"), - (0x2F840, "M", "咢"), - ] - - -def _seg_77() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F841, "M", "哶"), - (0x2F842, "M", "唐"), - (0x2F843, "M", "啓"), - (0x2F844, "M", "啣"), - (0x2F845, "M", "善"), - (0x2F847, "M", "喙"), - (0x2F848, "M", "喫"), - (0x2F849, "M", "喳"), - (0x2F84A, "M", "嗂"), - (0x2F84B, "M", "圖"), - (0x2F84C, "M", "嘆"), - (0x2F84D, "M", "圗"), - (0x2F84E, "M", "噑"), - (0x2F84F, "M", "噴"), - (0x2F850, "M", "切"), - (0x2F851, "M", "壮"), - (0x2F852, "M", "城"), - (0x2F853, "M", "埴"), - (0x2F854, "M", "堍"), - (0x2F855, "M", "型"), - (0x2F856, "M", "堲"), - (0x2F857, "M", "報"), - (0x2F858, "M", "墬"), - (0x2F859, "M", "𡓤"), - (0x2F85A, "M", "売"), - (0x2F85B, "M", "壷"), - (0x2F85C, "M", "夆"), - (0x2F85D, "M", "多"), - (0x2F85E, "M", "夢"), - (0x2F85F, "M", "奢"), - (0x2F860, "M", "𡚨"), - (0x2F861, "M", "𡛪"), - (0x2F862, "M", "姬"), - (0x2F863, "M", "娛"), - (0x2F864, "M", "娧"), - (0x2F865, "M", "姘"), - (0x2F866, "M", "婦"), - (0x2F867, "M", "㛮"), - (0x2F868, "X"), - (0x2F869, "M", "嬈"), - (0x2F86A, "M", "嬾"), - (0x2F86C, "M", "𡧈"), - (0x2F86D, "M", "寃"), - (0x2F86E, "M", "寘"), - (0x2F86F, "M", "寧"), - (0x2F870, "M", "寳"), - (0x2F871, "M", "𡬘"), - (0x2F872, "M", "寿"), - (0x2F873, "M", "将"), - (0x2F874, "X"), - (0x2F875, "M", "尢"), - (0x2F876, "M", "㞁"), - (0x2F877, "M", "屠"), - (0x2F878, "M", "屮"), - (0x2F879, "M", "峀"), - (0x2F87A, "M", "岍"), - (0x2F87B, "M", "𡷤"), - (0x2F87C, "M", "嵃"), - (0x2F87D, "M", "𡷦"), - (0x2F87E, "M", "嵮"), - (0x2F87F, "M", "嵫"), - (0x2F880, "M", "嵼"), - (0x2F881, "M", "巡"), - (0x2F882, "M", "巢"), - (0x2F883, "M", "㠯"), - (0x2F884, "M", "巽"), - (0x2F885, "M", "帨"), - (0x2F886, "M", "帽"), - (0x2F887, "M", "幩"), - (0x2F888, "M", "㡢"), - (0x2F889, "M", "𢆃"), - (0x2F88A, "M", "㡼"), - (0x2F88B, "M", "庰"), - (0x2F88C, "M", "庳"), - (0x2F88D, "M", "庶"), - (0x2F88E, "M", "廊"), - (0x2F88F, "M", "𪎒"), - (0x2F890, "M", "廾"), - (0x2F891, "M", "𢌱"), - (0x2F893, "M", "舁"), - (0x2F894, "M", "弢"), - (0x2F896, "M", "㣇"), - (0x2F897, "M", "𣊸"), - (0x2F898, "M", "𦇚"), - (0x2F899, "M", "形"), - (0x2F89A, "M", "彫"), - (0x2F89B, "M", "㣣"), - (0x2F89C, "M", "徚"), - (0x2F89D, "M", "忍"), - (0x2F89E, "M", "志"), - (0x2F89F, "M", "忹"), - (0x2F8A0, "M", "悁"), - (0x2F8A1, "M", "㤺"), - (0x2F8A2, "M", "㤜"), - (0x2F8A3, "M", "悔"), - (0x2F8A4, "M", "𢛔"), - (0x2F8A5, "M", "惇"), - (0x2F8A6, "M", "慈"), - (0x2F8A7, "M", "慌"), - (0x2F8A8, "M", "慎"), - ] - - -def _seg_78() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F8A9, "M", "慌"), - (0x2F8AA, "M", "慺"), - (0x2F8AB, "M", "憎"), - (0x2F8AC, "M", "憲"), - (0x2F8AD, "M", "憤"), - (0x2F8AE, "M", "憯"), - (0x2F8AF, "M", "懞"), - (0x2F8B0, "M", "懲"), - (0x2F8B1, "M", "懶"), - (0x2F8B2, "M", "成"), - (0x2F8B3, "M", "戛"), - (0x2F8B4, "M", "扝"), - (0x2F8B5, "M", "抱"), - (0x2F8B6, "M", "拔"), - (0x2F8B7, "M", "捐"), - (0x2F8B8, "M", "𢬌"), - (0x2F8B9, "M", "挽"), - (0x2F8BA, "M", "拼"), - (0x2F8BB, "M", "捨"), - (0x2F8BC, "M", "掃"), - (0x2F8BD, "M", "揤"), - (0x2F8BE, "M", "𢯱"), - (0x2F8BF, "M", "搢"), - (0x2F8C0, "M", "揅"), - (0x2F8C1, "M", "掩"), - (0x2F8C2, "M", "㨮"), - (0x2F8C3, "M", "摩"), - (0x2F8C4, "M", "摾"), - (0x2F8C5, "M", "撝"), - (0x2F8C6, "M", "摷"), - (0x2F8C7, "M", "㩬"), - (0x2F8C8, "M", "敏"), - (0x2F8C9, "M", "敬"), - (0x2F8CA, "M", "𣀊"), - (0x2F8CB, "M", "旣"), - (0x2F8CC, "M", "書"), - (0x2F8CD, "M", "晉"), - (0x2F8CE, "M", "㬙"), - (0x2F8CF, "M", "暑"), - (0x2F8D0, "M", "㬈"), - (0x2F8D1, "M", "㫤"), - (0x2F8D2, "M", "冒"), - (0x2F8D3, "M", "冕"), - (0x2F8D4, "M", "最"), - (0x2F8D5, "M", "暜"), - (0x2F8D6, "M", "肭"), - (0x2F8D7, "M", "䏙"), - (0x2F8D8, "M", "朗"), - (0x2F8D9, "M", "望"), - (0x2F8DA, "M", "朡"), - (0x2F8DB, "M", "杞"), - (0x2F8DC, "M", "杓"), - (0x2F8DD, "M", "𣏃"), - (0x2F8DE, "M", "㭉"), - (0x2F8DF, "M", "柺"), - (0x2F8E0, "M", "枅"), - (0x2F8E1, "M", "桒"), - (0x2F8E2, "M", "梅"), - (0x2F8E3, "M", "𣑭"), - (0x2F8E4, "M", "梎"), - (0x2F8E5, "M", "栟"), - (0x2F8E6, "M", "椔"), - (0x2F8E7, "M", "㮝"), - (0x2F8E8, "M", "楂"), - (0x2F8E9, "M", "榣"), - (0x2F8EA, "M", "槪"), - (0x2F8EB, "M", "檨"), - (0x2F8EC, "M", "𣚣"), - (0x2F8ED, "M", "櫛"), - (0x2F8EE, "M", "㰘"), - (0x2F8EF, "M", "次"), - (0x2F8F0, "M", "𣢧"), - (0x2F8F1, "M", "歔"), - (0x2F8F2, "M", "㱎"), - (0x2F8F3, "M", "歲"), - (0x2F8F4, "M", "殟"), - (0x2F8F5, "M", "殺"), - (0x2F8F6, "M", "殻"), - (0x2F8F7, "M", "𣪍"), - (0x2F8F8, "M", "𡴋"), - (0x2F8F9, "M", "𣫺"), - (0x2F8FA, "M", "汎"), - (0x2F8FB, "M", "𣲼"), - (0x2F8FC, "M", "沿"), - (0x2F8FD, "M", "泍"), - (0x2F8FE, "M", "汧"), - (0x2F8FF, "M", "洖"), - (0x2F900, "M", "派"), - (0x2F901, "M", "海"), - (0x2F902, "M", "流"), - (0x2F903, "M", "浩"), - (0x2F904, "M", "浸"), - (0x2F905, "M", "涅"), - (0x2F906, "M", "𣴞"), - (0x2F907, "M", "洴"), - (0x2F908, "M", "港"), - (0x2F909, "M", "湮"), - (0x2F90A, "M", "㴳"), - (0x2F90B, "M", "滋"), - (0x2F90C, "M", "滇"), - ] - - -def _seg_79() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F90D, "M", "𣻑"), - (0x2F90E, "M", "淹"), - (0x2F90F, "M", "潮"), - (0x2F910, "M", "𣽞"), - (0x2F911, "M", "𣾎"), - (0x2F912, "M", "濆"), - (0x2F913, "M", "瀹"), - (0x2F914, "M", "瀞"), - (0x2F915, "M", "瀛"), - (0x2F916, "M", "㶖"), - (0x2F917, "M", "灊"), - (0x2F918, "M", "災"), - (0x2F919, "M", "灷"), - (0x2F91A, "M", "炭"), - (0x2F91B, "M", "𠔥"), - (0x2F91C, "M", "煅"), - (0x2F91D, "M", "𤉣"), - (0x2F91E, "M", "熜"), - (0x2F91F, "X"), - (0x2F920, "M", "爨"), - (0x2F921, "M", "爵"), - (0x2F922, "M", "牐"), - (0x2F923, "M", "𤘈"), - (0x2F924, "M", "犀"), - (0x2F925, "M", "犕"), - (0x2F926, "M", "𤜵"), - (0x2F927, "M", "𤠔"), - (0x2F928, "M", "獺"), - (0x2F929, "M", "王"), - (0x2F92A, "M", "㺬"), - (0x2F92B, "M", "玥"), - (0x2F92C, "M", "㺸"), - (0x2F92E, "M", "瑇"), - (0x2F92F, "M", "瑜"), - (0x2F930, "M", "瑱"), - (0x2F931, "M", "璅"), - (0x2F932, "M", "瓊"), - (0x2F933, "M", "㼛"), - (0x2F934, "M", "甤"), - (0x2F935, "M", "𤰶"), - (0x2F936, "M", "甾"), - (0x2F937, "M", "𤲒"), - (0x2F938, "M", "異"), - (0x2F939, "M", "𢆟"), - (0x2F93A, "M", "瘐"), - (0x2F93B, "M", "𤾡"), - (0x2F93C, "M", "𤾸"), - (0x2F93D, "M", "𥁄"), - (0x2F93E, "M", "㿼"), - (0x2F93F, "M", "䀈"), - (0x2F940, "M", "直"), - (0x2F941, "M", "𥃳"), - (0x2F942, "M", "𥃲"), - (0x2F943, "M", "𥄙"), - (0x2F944, "M", "𥄳"), - (0x2F945, "M", "眞"), - (0x2F946, "M", "真"), - (0x2F948, "M", "睊"), - (0x2F949, "M", "䀹"), - (0x2F94A, "M", "瞋"), - (0x2F94B, "M", "䁆"), - (0x2F94C, "M", "䂖"), - (0x2F94D, "M", "𥐝"), - (0x2F94E, "M", "硎"), - (0x2F94F, "M", "碌"), - (0x2F950, "M", "磌"), - (0x2F951, "M", "䃣"), - (0x2F952, "M", "𥘦"), - (0x2F953, "M", "祖"), - (0x2F954, "M", "𥚚"), - (0x2F955, "M", "𥛅"), - (0x2F956, "M", "福"), - (0x2F957, "M", "秫"), - (0x2F958, "M", "䄯"), - (0x2F959, "M", "穀"), - (0x2F95A, "M", "穊"), - (0x2F95B, "M", "穏"), - (0x2F95C, "M", "𥥼"), - (0x2F95D, "M", "𥪧"), - (0x2F95F, "X"), - (0x2F960, "M", "䈂"), - (0x2F961, "M", "𥮫"), - (0x2F962, "M", "篆"), - (0x2F963, "M", "築"), - (0x2F964, "M", "䈧"), - (0x2F965, "M", "𥲀"), - (0x2F966, "M", "糒"), - (0x2F967, "M", "䊠"), - (0x2F968, "M", "糨"), - (0x2F969, "M", "糣"), - (0x2F96A, "M", "紀"), - (0x2F96B, "M", "𥾆"), - (0x2F96C, "M", "絣"), - (0x2F96D, "M", "䌁"), - (0x2F96E, "M", "緇"), - (0x2F96F, "M", "縂"), - (0x2F970, "M", "繅"), - (0x2F971, "M", "䌴"), - (0x2F972, "M", "𦈨"), - (0x2F973, "M", "𦉇"), - ] - - -def _seg_80() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F974, "M", "䍙"), - (0x2F975, "M", "𦋙"), - (0x2F976, "M", "罺"), - (0x2F977, "M", "𦌾"), - (0x2F978, "M", "羕"), - (0x2F979, "M", "翺"), - (0x2F97A, "M", "者"), - (0x2F97B, "M", "𦓚"), - (0x2F97C, "M", "𦔣"), - (0x2F97D, "M", "聠"), - (0x2F97E, "M", "𦖨"), - (0x2F97F, "M", "聰"), - (0x2F980, "M", "𣍟"), - (0x2F981, "M", "䏕"), - (0x2F982, "M", "育"), - (0x2F983, "M", "脃"), - (0x2F984, "M", "䐋"), - (0x2F985, "M", "脾"), - (0x2F986, "M", "媵"), - (0x2F987, "M", "𦞧"), - (0x2F988, "M", "𦞵"), - (0x2F989, "M", "𣎓"), - (0x2F98A, "M", "𣎜"), - (0x2F98B, "M", "舁"), - (0x2F98C, "M", "舄"), - (0x2F98D, "M", "辞"), - (0x2F98E, "M", "䑫"), - (0x2F98F, "M", "芑"), - (0x2F990, "M", "芋"), - (0x2F991, "M", "芝"), - (0x2F992, "M", "劳"), - (0x2F993, "M", "花"), - (0x2F994, "M", "芳"), - (0x2F995, "M", "芽"), - (0x2F996, "M", "苦"), - (0x2F997, "M", "𦬼"), - (0x2F998, "M", "若"), - (0x2F999, "M", "茝"), - (0x2F99A, "M", "荣"), - (0x2F99B, "M", "莭"), - (0x2F99C, "M", "茣"), - (0x2F99D, "M", "莽"), - (0x2F99E, "M", "菧"), - (0x2F99F, "M", "著"), - (0x2F9A0, "M", "荓"), - (0x2F9A1, "M", "菊"), - (0x2F9A2, "M", "菌"), - (0x2F9A3, "M", "菜"), - (0x2F9A4, "M", "𦰶"), - (0x2F9A5, "M", "𦵫"), - (0x2F9A6, "M", "𦳕"), - (0x2F9A7, "M", "䔫"), - (0x2F9A8, "M", "蓱"), - (0x2F9A9, "M", "蓳"), - (0x2F9AA, "M", "蔖"), - (0x2F9AB, "M", "𧏊"), - (0x2F9AC, "M", "蕤"), - (0x2F9AD, "M", "𦼬"), - (0x2F9AE, "M", "䕝"), - (0x2F9AF, "M", "䕡"), - (0x2F9B0, "M", "𦾱"), - (0x2F9B1, "M", "𧃒"), - (0x2F9B2, "M", "䕫"), - (0x2F9B3, "M", "虐"), - (0x2F9B4, "M", "虜"), - (0x2F9B5, "M", "虧"), - (0x2F9B6, "M", "虩"), - (0x2F9B7, "M", "蚩"), - (0x2F9B8, "M", "蚈"), - (0x2F9B9, "M", "蜎"), - (0x2F9BA, "M", "蛢"), - (0x2F9BB, "M", "蝹"), - (0x2F9BC, "M", "蜨"), - (0x2F9BD, "M", "蝫"), - (0x2F9BE, "M", "螆"), - (0x2F9BF, "X"), - (0x2F9C0, "M", "蟡"), - (0x2F9C1, "M", "蠁"), - (0x2F9C2, "M", "䗹"), - (0x2F9C3, "M", "衠"), - (0x2F9C4, "M", "衣"), - (0x2F9C5, "M", "𧙧"), - (0x2F9C6, "M", "裗"), - (0x2F9C7, "M", "裞"), - (0x2F9C8, "M", "䘵"), - (0x2F9C9, "M", "裺"), - (0x2F9CA, "M", "㒻"), - (0x2F9CB, "M", "𧢮"), - (0x2F9CC, "M", "𧥦"), - (0x2F9CD, "M", "䚾"), - (0x2F9CE, "M", "䛇"), - (0x2F9CF, "M", "誠"), - (0x2F9D0, "M", "諭"), - (0x2F9D1, "M", "變"), - (0x2F9D2, "M", "豕"), - (0x2F9D3, "M", "𧲨"), - (0x2F9D4, "M", "貫"), - (0x2F9D5, "M", "賁"), - (0x2F9D6, "M", "贛"), - (0x2F9D7, "M", "起"), - ] - - -def _seg_81() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: - return [ - (0x2F9D8, "M", "𧼯"), - (0x2F9D9, "M", "𠠄"), - (0x2F9DA, "M", "跋"), - (0x2F9DB, "M", "趼"), - (0x2F9DC, "M", "跰"), - (0x2F9DD, "M", "𠣞"), - (0x2F9DE, "M", "軔"), - (0x2F9DF, "M", "輸"), - (0x2F9E0, "M", "𨗒"), - (0x2F9E1, "M", "𨗭"), - (0x2F9E2, "M", "邔"), - (0x2F9E3, "M", "郱"), - (0x2F9E4, "M", "鄑"), - (0x2F9E5, "M", "𨜮"), - (0x2F9E6, "M", "鄛"), - (0x2F9E7, "M", "鈸"), - (0x2F9E8, "M", "鋗"), - (0x2F9E9, "M", "鋘"), - (0x2F9EA, "M", "鉼"), - (0x2F9EB, "M", "鏹"), - (0x2F9EC, "M", "鐕"), - (0x2F9ED, "M", "𨯺"), - (0x2F9EE, "M", "開"), - (0x2F9EF, "M", "䦕"), - (0x2F9F0, "M", "閷"), - (0x2F9F1, "M", "𨵷"), - (0x2F9F2, "M", "䧦"), - (0x2F9F3, "M", "雃"), - (0x2F9F4, "M", "嶲"), - (0x2F9F5, "M", "霣"), - (0x2F9F6, "M", "𩅅"), - (0x2F9F7, "M", "𩈚"), - (0x2F9F8, "M", "䩮"), - (0x2F9F9, "M", "䩶"), - (0x2F9FA, "M", "韠"), - (0x2F9FB, "M", "𩐊"), - (0x2F9FC, "M", "䪲"), - (0x2F9FD, "M", "𩒖"), - (0x2F9FE, "M", "頋"), - (0x2FA00, "M", "頩"), - (0x2FA01, "M", "𩖶"), - (0x2FA02, "M", "飢"), - (0x2FA03, "M", "䬳"), - (0x2FA04, "M", "餩"), - (0x2FA05, "M", "馧"), - (0x2FA06, "M", "駂"), - (0x2FA07, "M", "駾"), - (0x2FA08, "M", "䯎"), - (0x2FA09, "M", "𩬰"), - (0x2FA0A, "M", "鬒"), - (0x2FA0B, "M", "鱀"), - (0x2FA0C, "M", "鳽"), - (0x2FA0D, "M", "䳎"), - (0x2FA0E, "M", "䳭"), - (0x2FA0F, "M", "鵧"), - (0x2FA10, "M", "𪃎"), - (0x2FA11, "M", "䳸"), - (0x2FA12, "M", "𪄅"), - (0x2FA13, "M", "𪈎"), - (0x2FA14, "M", "𪊑"), - (0x2FA15, "M", "麻"), - (0x2FA16, "M", "䵖"), - (0x2FA17, "M", "黹"), - (0x2FA18, "M", "黾"), - (0x2FA19, "M", "鼅"), - (0x2FA1A, "M", "鼏"), - (0x2FA1B, "M", "鼖"), - (0x2FA1C, "M", "鼻"), - (0x2FA1D, "M", "𪘀"), - (0x2FA1E, "X"), - (0x30000, "V"), - (0x3134B, "X"), - (0x31350, "V"), - (0x323B0, "X"), - (0xE0100, "I"), - (0xE01F0, "X"), - ] - - -uts46data = tuple( - _seg_0() - + _seg_1() - + _seg_2() - + _seg_3() - + _seg_4() - + _seg_5() - + _seg_6() - + _seg_7() - + _seg_8() - + _seg_9() - + _seg_10() - + _seg_11() - + _seg_12() - + _seg_13() - + _seg_14() - + _seg_15() - + _seg_16() - + _seg_17() - + _seg_18() - + _seg_19() - + _seg_20() - + _seg_21() - + _seg_22() - + _seg_23() - + _seg_24() - + _seg_25() - + _seg_26() - + _seg_27() - + _seg_28() - + _seg_29() - + _seg_30() - + _seg_31() - + _seg_32() - + _seg_33() - + _seg_34() - + _seg_35() - + _seg_36() - + _seg_37() - + _seg_38() - + _seg_39() - + _seg_40() - + _seg_41() - + _seg_42() - + _seg_43() - + _seg_44() - + _seg_45() - + _seg_46() - + _seg_47() - + _seg_48() - + _seg_49() - + _seg_50() - + _seg_51() - + _seg_52() - + _seg_53() - + _seg_54() - + _seg_55() - + _seg_56() - + _seg_57() - + _seg_58() - + _seg_59() - + _seg_60() - + _seg_61() - + _seg_62() - + _seg_63() - + _seg_64() - + _seg_65() - + _seg_66() - + _seg_67() - + _seg_68() - + _seg_69() - + _seg_70() - + _seg_71() - + _seg_72() - + _seg_73() - + _seg_74() - + _seg_75() - + _seg_76() - + _seg_77() - + _seg_78() - + _seg_79() - + _seg_80() - + _seg_81() -) # type: Tuple[Union[Tuple[int, str], Tuple[int, str, str]], ...] diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/INSTALLER b/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/INSTALLER deleted file mode 100644 index a1b589e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA b/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA deleted file mode 100644 index ffef2ff..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA +++ /dev/null @@ -1,84 +0,0 @@ -Metadata-Version: 2.4 -Name: Jinja2 -Version: 3.1.6 -Summary: A very fast and expressive template engine. -Maintainer-email: Pallets -Requires-Python: >=3.7 -Description-Content-Type: text/markdown -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Web Environment -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: BSD License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content -Classifier: Topic :: Text Processing :: Markup :: HTML -Classifier: Typing :: Typed -License-File: LICENSE.txt -Requires-Dist: MarkupSafe>=2.0 -Requires-Dist: Babel>=2.7 ; extra == "i18n" -Project-URL: Changes, https://jinja.palletsprojects.com/changes/ -Project-URL: Chat, https://discord.gg/pallets -Project-URL: Documentation, https://jinja.palletsprojects.com/ -Project-URL: Donate, https://palletsprojects.com/donate -Project-URL: Source, https://github.com/pallets/jinja/ -Provides-Extra: i18n - -# Jinja - -Jinja is a fast, expressive, extensible templating engine. Special -placeholders in the template allow writing code similar to Python -syntax. Then the template is passed data to render the final document. - -It includes: - -- Template inheritance and inclusion. -- Define and import macros within templates. -- HTML templates can use autoescaping to prevent XSS from untrusted - user input. -- A sandboxed environment can safely render untrusted templates. -- AsyncIO support for generating templates and calling async - functions. -- I18N support with Babel. -- Templates are compiled to optimized Python code just-in-time and - cached, or can be compiled ahead-of-time. -- Exceptions point to the correct line in templates to make debugging - easier. -- Extensible filters, tests, functions, and even syntax. - -Jinja's philosophy is that while application logic belongs in Python if -possible, it shouldn't make the template designer's job difficult by -restricting functionality too much. - - -## In A Nutshell - -```jinja -{% extends "base.html" %} -{% block title %}Members{% endblock %} -{% block content %} - -{% endblock %} -``` - -## Donate - -The Pallets organization develops and supports Jinja and other popular -packages. In order to grow the community of contributors and users, and -allow the maintainers to devote more time to the projects, [please -donate today][]. - -[please donate today]: https://palletsprojects.com/donate - -## Contributing - -See our [detailed contributing documentation][contrib] for many ways to -contribute, including reporting issues, requesting features, asking or answering -questions, and making PRs. - -[contrib]: https://palletsprojects.com/contributing/ - diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/RECORD b/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/RECORD deleted file mode 100644 index 20d4fee..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/RECORD +++ /dev/null @@ -1,57 +0,0 @@ -jinja2-3.1.6.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -jinja2-3.1.6.dist-info/METADATA,sha256=aMVUj7Z8QTKhOJjZsx7FDGvqKr3ZFdkh8hQ1XDpkmcg,2871 -jinja2-3.1.6.dist-info/RECORD,, -jinja2-3.1.6.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82 -jinja2-3.1.6.dist-info/entry_points.txt,sha256=OL85gYU1eD8cuPlikifFngXpeBjaxl6rIJ8KkC_3r-I,58 -jinja2-3.1.6.dist-info/licenses/LICENSE.txt,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475 -jinja2/__init__.py,sha256=xxepO9i7DHsqkQrgBEduLtfoz2QCuT6_gbL4XSN1hbU,1928 -jinja2/__pycache__/__init__.cpython-310.pyc,, -jinja2/__pycache__/_identifier.cpython-310.pyc,, -jinja2/__pycache__/async_utils.cpython-310.pyc,, -jinja2/__pycache__/bccache.cpython-310.pyc,, -jinja2/__pycache__/compiler.cpython-310.pyc,, -jinja2/__pycache__/constants.cpython-310.pyc,, -jinja2/__pycache__/debug.cpython-310.pyc,, -jinja2/__pycache__/defaults.cpython-310.pyc,, -jinja2/__pycache__/environment.cpython-310.pyc,, -jinja2/__pycache__/exceptions.cpython-310.pyc,, -jinja2/__pycache__/ext.cpython-310.pyc,, -jinja2/__pycache__/filters.cpython-310.pyc,, -jinja2/__pycache__/idtracking.cpython-310.pyc,, -jinja2/__pycache__/lexer.cpython-310.pyc,, -jinja2/__pycache__/loaders.cpython-310.pyc,, -jinja2/__pycache__/meta.cpython-310.pyc,, -jinja2/__pycache__/nativetypes.cpython-310.pyc,, -jinja2/__pycache__/nodes.cpython-310.pyc,, -jinja2/__pycache__/optimizer.cpython-310.pyc,, -jinja2/__pycache__/parser.cpython-310.pyc,, -jinja2/__pycache__/runtime.cpython-310.pyc,, -jinja2/__pycache__/sandbox.cpython-310.pyc,, -jinja2/__pycache__/tests.cpython-310.pyc,, -jinja2/__pycache__/utils.cpython-310.pyc,, -jinja2/__pycache__/visitor.cpython-310.pyc,, -jinja2/_identifier.py,sha256=_zYctNKzRqlk_murTNlzrju1FFJL7Va_Ijqqd7ii2lU,1958 -jinja2/async_utils.py,sha256=vK-PdsuorOMnWSnEkT3iUJRIkTnYgO2T6MnGxDgHI5o,2834 -jinja2/bccache.py,sha256=gh0qs9rulnXo0PhX5jTJy2UHzI8wFnQ63o_vw7nhzRg,14061 -jinja2/compiler.py,sha256=9RpCQl5X88BHllJiPsHPh295Hh0uApvwFJNQuutULeM,74131 -jinja2/constants.py,sha256=GMoFydBF_kdpaRKPoM5cl5MviquVRLVyZtfp5-16jg0,1433 -jinja2/debug.py,sha256=CnHqCDHd-BVGvti_8ZsTolnXNhA3ECsY-6n_2pwU8Hw,6297 -jinja2/defaults.py,sha256=boBcSw78h-lp20YbaXSJsqkAI2uN_mD_TtCydpeq5wU,1267 -jinja2/environment.py,sha256=9nhrP7Ch-NbGX00wvyr4yy-uhNHq2OCc60ggGrni_fk,61513 -jinja2/exceptions.py,sha256=ioHeHrWwCWNaXX1inHmHVblvc4haO7AXsjCp3GfWvx0,5071 -jinja2/ext.py,sha256=5PF5eHfh8mXAIxXHHRB2xXbXohi8pE3nHSOxa66uS7E,31875 -jinja2/filters.py,sha256=PQ_Egd9n9jSgtnGQYyF4K5j2nYwhUIulhPnyimkdr-k,55212 -jinja2/idtracking.py,sha256=-ll5lIp73pML3ErUYiIJj7tdmWxcH_IlDv3yA_hiZYo,10555 -jinja2/lexer.py,sha256=LYiYio6br-Tep9nPcupWXsPEtjluw3p1mU-lNBVRUfk,29786 -jinja2/loaders.py,sha256=wIrnxjvcbqh5VwW28NSkfotiDq8qNCxIOSFbGUiSLB4,24055 -jinja2/meta.py,sha256=OTDPkaFvU2Hgvx-6akz7154F8BIWaRmvJcBFvwopHww,4397 -jinja2/nativetypes.py,sha256=7GIGALVJgdyL80oZJdQUaUfwSt5q2lSSZbXt0dNf_M4,4210 -jinja2/nodes.py,sha256=m1Duzcr6qhZI8JQ6VyJgUNinjAf5bQzijSmDnMsvUx8,34579 -jinja2/optimizer.py,sha256=rJnCRlQ7pZsEEmMhsQDgC_pKyDHxP5TPS6zVPGsgcu8,1651 -jinja2/parser.py,sha256=lLOFy3sEmHc5IaEHRiH1sQVnId2moUQzhyeJZTtdY30,40383 -jinja2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -jinja2/runtime.py,sha256=gDk-GvdriJXqgsGbHgrcKTP0Yp6zPXzhzrIpCFH3jAU,34249 -jinja2/sandbox.py,sha256=Mw2aitlY2I8la7FYhcX2YG9BtUYcLnD0Gh3d29cDWrY,15009 -jinja2/tests.py,sha256=VLsBhVFnWg-PxSBz1MhRnNWgP1ovXk3neO1FLQMeC9Q,5926 -jinja2/utils.py,sha256=rRp3o9e7ZKS4fyrWRbELyLcpuGVTFcnooaOa1qx_FIk,24129 -jinja2/visitor.py,sha256=EcnL1PIwf_4RVCOMxsRNuR8AXHbS1qfAdMOE2ngKJz4,3557 diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/WHEEL b/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/WHEEL deleted file mode 100644 index 23d2d7e..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.11.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt b/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt deleted file mode 100644 index abc3eae..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt +++ /dev/null @@ -1,3 +0,0 @@ -[babel.extractors] -jinja2=jinja2.ext:babel_extract[i18n] - diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/licenses/LICENSE.txt b/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/licenses/LICENSE.txt deleted file mode 100644 index c37cae4..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/licenses/LICENSE.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2007 Pallets - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__init__.py b/write-message/venv/lib/python3.10/site-packages/jinja2/__init__.py deleted file mode 100644 index 1a423a3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -"""Jinja is a template engine written in pure Python. It provides a -non-XML syntax that supports inline expressions and an optional -sandboxed environment. -""" - -from .bccache import BytecodeCache as BytecodeCache -from .bccache import FileSystemBytecodeCache as FileSystemBytecodeCache -from .bccache import MemcachedBytecodeCache as MemcachedBytecodeCache -from .environment import Environment as Environment -from .environment import Template as Template -from .exceptions import TemplateAssertionError as TemplateAssertionError -from .exceptions import TemplateError as TemplateError -from .exceptions import TemplateNotFound as TemplateNotFound -from .exceptions import TemplateRuntimeError as TemplateRuntimeError -from .exceptions import TemplatesNotFound as TemplatesNotFound -from .exceptions import TemplateSyntaxError as TemplateSyntaxError -from .exceptions import UndefinedError as UndefinedError -from .loaders import BaseLoader as BaseLoader -from .loaders import ChoiceLoader as ChoiceLoader -from .loaders import DictLoader as DictLoader -from .loaders import FileSystemLoader as FileSystemLoader -from .loaders import FunctionLoader as FunctionLoader -from .loaders import ModuleLoader as ModuleLoader -from .loaders import PackageLoader as PackageLoader -from .loaders import PrefixLoader as PrefixLoader -from .runtime import ChainableUndefined as ChainableUndefined -from .runtime import DebugUndefined as DebugUndefined -from .runtime import make_logging_undefined as make_logging_undefined -from .runtime import StrictUndefined as StrictUndefined -from .runtime import Undefined as Undefined -from .utils import clear_caches as clear_caches -from .utils import is_undefined as is_undefined -from .utils import pass_context as pass_context -from .utils import pass_environment as pass_environment -from .utils import pass_eval_context as pass_eval_context -from .utils import select_autoescape as select_autoescape - -__version__ = "3.1.6" diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/__init__.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 7249896..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/_identifier.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/_identifier.cpython-310.pyc deleted file mode 100644 index b539f3f..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/_identifier.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/async_utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/async_utils.cpython-310.pyc deleted file mode 100644 index ecb9efb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/async_utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/bccache.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/bccache.cpython-310.pyc deleted file mode 100644 index 4076234..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/bccache.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/compiler.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/compiler.cpython-310.pyc deleted file mode 100644 index c32c01a..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/compiler.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/constants.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/constants.cpython-310.pyc deleted file mode 100644 index 60a40ca..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/constants.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/debug.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/debug.cpython-310.pyc deleted file mode 100644 index bb68977..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/debug.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/defaults.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/defaults.cpython-310.pyc deleted file mode 100644 index 489156b..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/defaults.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/environment.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/environment.cpython-310.pyc deleted file mode 100644 index 231610e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/environment.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/exceptions.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/exceptions.cpython-310.pyc deleted file mode 100644 index efa5d5d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/exceptions.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/ext.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/ext.cpython-310.pyc deleted file mode 100644 index 7c546a0..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/ext.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/filters.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/filters.cpython-310.pyc deleted file mode 100644 index 017d4bb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/filters.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/idtracking.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/idtracking.cpython-310.pyc deleted file mode 100644 index a1dfecb..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/idtracking.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/lexer.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/lexer.cpython-310.pyc deleted file mode 100644 index 3f9ed48..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/lexer.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/loaders.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/loaders.cpython-310.pyc deleted file mode 100644 index e516b29..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/loaders.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/meta.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/meta.cpython-310.pyc deleted file mode 100644 index 409d405..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/meta.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/nativetypes.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/nativetypes.cpython-310.pyc deleted file mode 100644 index be0649e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/nativetypes.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/nodes.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/nodes.cpython-310.pyc deleted file mode 100644 index 85170e4..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/nodes.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/optimizer.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/optimizer.cpython-310.pyc deleted file mode 100644 index 146b51e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/optimizer.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/parser.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/parser.cpython-310.pyc deleted file mode 100644 index 9a09dc9..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/parser.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/runtime.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/runtime.cpython-310.pyc deleted file mode 100644 index d7e1e42..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/runtime.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/sandbox.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/sandbox.cpython-310.pyc deleted file mode 100644 index f53cc28..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/sandbox.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/tests.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/tests.cpython-310.pyc deleted file mode 100644 index e2a1dbf..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/tests.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/utils.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/utils.cpython-310.pyc deleted file mode 100644 index 7f6d97e..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/utils.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/visitor.cpython-310.pyc b/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/visitor.cpython-310.pyc deleted file mode 100644 index 95f975d..0000000 Binary files a/write-message/venv/lib/python3.10/site-packages/jinja2/__pycache__/visitor.cpython-310.pyc and /dev/null differ diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/_identifier.py b/write-message/venv/lib/python3.10/site-packages/jinja2/_identifier.py deleted file mode 100644 index 928c150..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/_identifier.py +++ /dev/null @@ -1,6 +0,0 @@ -import re - -# generated by scripts/generate_identifier_pattern.py -pattern = re.compile( - r"[\w·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣঁ-ঃ়া-ৄেৈো-্ৗৢৣ৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑੰੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣஂா-ூெ-ைொ-்ௗఀ-ఄా-ౄె-ైొ-్ౕౖౢౣಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣංඃ්ා-ුූෘ-ෟෲෳัิ-ฺ็-๎ັິ-ູົຼ່-ໍ༹༘༙༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝᠋-᠍ᢅᢆᢩᤠ-ᤫᤰ-᤻ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼᪰-᪽ᬀ-ᬄ᬴-᭄᭫-᭳ᮀ-ᮂᮡ-ᮭ᯦-᯳ᰤ-᰷᳐-᳔᳒-᳨᳭ᳲ-᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰℘℮⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣠-꣱ꣿꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀ꧥꨩ-ꨶꩃꩌꩍꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭ﬞ︀-️︠-︯︳︴﹍-﹏_𐇽𐋠𐍶-𐍺𐨁-𐨃𐨅𐨆𐨌-𐨏𐨸-𐨿𐨺𐫦𐫥𐴤-𐽆𐴧-𐽐𑀀-𑀂𑀸-𑁆𑁿-𑂂𑂰-𑂺𑄀-𑄂𑄧-𑄴𑅅𑅆𑅳𑆀-𑆂𑆳-𑇀𑇉-𑇌𑈬-𑈷𑈾𑋟-𑋪𑌀-𑌃𑌻𑌼𑌾-𑍄𑍇𑍈𑍋-𑍍𑍗𑍢𑍣𑍦-𑍬𑍰-𑍴𑐵-𑑆𑑞𑒰-𑓃𑖯-𑖵𑖸-𑗀𑗜𑗝𑘰-𑙀𑚫-𑚷𑜝-𑜫𑠬-𑠺𑨁-𑨊𑨳-𑨹𑨻-𑨾𑩇𑩑-𑩛𑪊-𑪙𑰯-𑰶𑰸-𑰿𑲒-𑲧𑲩-𑲶𑴱-𑴶𑴺𑴼𑴽𑴿-𑵅𑵇𑶊-𑶎𑶐𑶑𑶓-𑶗𑻳-𑻶𖫰-𖫴𖬰-𖬶𖽑-𖽾𖾏-𖾒𛲝𛲞𝅥-𝅩𝅭-𝅲𝅻-𝆂𝆅-𝆋𝆪-𝆭𝉂-𝉄𝨀-𝨶𝨻-𝩬𝩵𝪄𝪛-𝪟𝪡-𝪯𞀀-𞀆𞀈-𞀘𞀛-𞀡𞀣𞀤𞀦-𞣐𞀪-𞣖𞥄-𞥊󠄀-󠇯]+" # noqa: B950 -) diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/async_utils.py b/write-message/venv/lib/python3.10/site-packages/jinja2/async_utils.py deleted file mode 100644 index f0c1402..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/async_utils.py +++ /dev/null @@ -1,99 +0,0 @@ -import inspect -import typing as t -from functools import WRAPPER_ASSIGNMENTS -from functools import wraps - -from .utils import _PassArg -from .utils import pass_eval_context - -if t.TYPE_CHECKING: - import typing_extensions as te - -V = t.TypeVar("V") - - -def async_variant(normal_func): # type: ignore - def decorator(async_func): # type: ignore - pass_arg = _PassArg.from_obj(normal_func) - need_eval_context = pass_arg is None - - if pass_arg is _PassArg.environment: - - def is_async(args: t.Any) -> bool: - return t.cast(bool, args[0].is_async) - - else: - - def is_async(args: t.Any) -> bool: - return t.cast(bool, args[0].environment.is_async) - - # Take the doc and annotations from the sync function, but the - # name from the async function. Pallets-Sphinx-Themes - # build_function_directive expects __wrapped__ to point to the - # sync function. - async_func_attrs = ("__module__", "__name__", "__qualname__") - normal_func_attrs = tuple(set(WRAPPER_ASSIGNMENTS).difference(async_func_attrs)) - - @wraps(normal_func, assigned=normal_func_attrs) - @wraps(async_func, assigned=async_func_attrs, updated=()) - def wrapper(*args, **kwargs): # type: ignore - b = is_async(args) - - if need_eval_context: - args = args[1:] - - if b: - return async_func(*args, **kwargs) - - return normal_func(*args, **kwargs) - - if need_eval_context: - wrapper = pass_eval_context(wrapper) - - wrapper.jinja_async_variant = True # type: ignore[attr-defined] - return wrapper - - return decorator - - -_common_primitives = {int, float, bool, str, list, dict, tuple, type(None)} - - -async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V": - # Avoid a costly call to isawaitable - if type(value) in _common_primitives: - return t.cast("V", value) - - if inspect.isawaitable(value): - return await t.cast("t.Awaitable[V]", value) - - return value - - -class _IteratorToAsyncIterator(t.Generic[V]): - def __init__(self, iterator: "t.Iterator[V]"): - self._iterator = iterator - - def __aiter__(self) -> "te.Self": - return self - - async def __anext__(self) -> V: - try: - return next(self._iterator) - except StopIteration as e: - raise StopAsyncIteration(e.value) from e - - -def auto_aiter( - iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", -) -> "t.AsyncIterator[V]": - if hasattr(iterable, "__aiter__"): - return iterable.__aiter__() - else: - return _IteratorToAsyncIterator(iter(iterable)) - - -async def auto_to_list( - value: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", -) -> t.List["V"]: - return [x async for x in auto_aiter(value)] diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/bccache.py b/write-message/venv/lib/python3.10/site-packages/jinja2/bccache.py deleted file mode 100644 index ada8b09..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/bccache.py +++ /dev/null @@ -1,408 +0,0 @@ -"""The optional bytecode cache system. This is useful if you have very -complex template situations and the compilation of all those templates -slows down your application too much. - -Situations where this is useful are often forking web applications that -are initialized on the first request. -""" - -import errno -import fnmatch -import marshal -import os -import pickle -import stat -import sys -import tempfile -import typing as t -from hashlib import sha1 -from io import BytesIO -from types import CodeType - -if t.TYPE_CHECKING: - import typing_extensions as te - - from .environment import Environment - - class _MemcachedClient(te.Protocol): - def get(self, key: str) -> bytes: ... - - def set( - self, key: str, value: bytes, timeout: t.Optional[int] = None - ) -> None: ... - - -bc_version = 5 -# Magic bytes to identify Jinja bytecode cache files. Contains the -# Python major and minor version to avoid loading incompatible bytecode -# if a project upgrades its Python version. -bc_magic = ( - b"j2" - + pickle.dumps(bc_version, 2) - + pickle.dumps((sys.version_info[0] << 24) | sys.version_info[1], 2) -) - - -class Bucket: - """Buckets are used to store the bytecode for one template. It's created - and initialized by the bytecode cache and passed to the loading functions. - - The buckets get an internal checksum from the cache assigned and use this - to automatically reject outdated cache material. Individual bytecode - cache subclasses don't have to care about cache invalidation. - """ - - def __init__(self, environment: "Environment", key: str, checksum: str) -> None: - self.environment = environment - self.key = key - self.checksum = checksum - self.reset() - - def reset(self) -> None: - """Resets the bucket (unloads the bytecode).""" - self.code: t.Optional[CodeType] = None - - def load_bytecode(self, f: t.BinaryIO) -> None: - """Loads bytecode from a file or file like object.""" - # make sure the magic header is correct - magic = f.read(len(bc_magic)) - if magic != bc_magic: - self.reset() - return - # the source code of the file changed, we need to reload - checksum = pickle.load(f) - if self.checksum != checksum: - self.reset() - return - # if marshal_load fails then we need to reload - try: - self.code = marshal.load(f) - except (EOFError, ValueError, TypeError): - self.reset() - return - - def write_bytecode(self, f: t.IO[bytes]) -> None: - """Dump the bytecode into the file or file like object passed.""" - if self.code is None: - raise TypeError("can't write empty bucket") - f.write(bc_magic) - pickle.dump(self.checksum, f, 2) - marshal.dump(self.code, f) - - def bytecode_from_string(self, string: bytes) -> None: - """Load bytecode from bytes.""" - self.load_bytecode(BytesIO(string)) - - def bytecode_to_string(self) -> bytes: - """Return the bytecode as bytes.""" - out = BytesIO() - self.write_bytecode(out) - return out.getvalue() - - -class BytecodeCache: - """To implement your own bytecode cache you have to subclass this class - and override :meth:`load_bytecode` and :meth:`dump_bytecode`. Both of - these methods are passed a :class:`~jinja2.bccache.Bucket`. - - A very basic bytecode cache that saves the bytecode on the file system:: - - from os import path - - class MyCache(BytecodeCache): - - def __init__(self, directory): - self.directory = directory - - def load_bytecode(self, bucket): - filename = path.join(self.directory, bucket.key) - if path.exists(filename): - with open(filename, 'rb') as f: - bucket.load_bytecode(f) - - def dump_bytecode(self, bucket): - filename = path.join(self.directory, bucket.key) - with open(filename, 'wb') as f: - bucket.write_bytecode(f) - - A more advanced version of a filesystem based bytecode cache is part of - Jinja. - """ - - def load_bytecode(self, bucket: Bucket) -> None: - """Subclasses have to override this method to load bytecode into a - bucket. If they are not able to find code in the cache for the - bucket, it must not do anything. - """ - raise NotImplementedError() - - def dump_bytecode(self, bucket: Bucket) -> None: - """Subclasses have to override this method to write the bytecode - from a bucket back to the cache. If it unable to do so it must not - fail silently but raise an exception. - """ - raise NotImplementedError() - - def clear(self) -> None: - """Clears the cache. This method is not used by Jinja but should be - implemented to allow applications to clear the bytecode cache used - by a particular environment. - """ - - def get_cache_key( - self, name: str, filename: t.Optional[t.Union[str]] = None - ) -> str: - """Returns the unique hash key for this template name.""" - hash = sha1(name.encode("utf-8")) - - if filename is not None: - hash.update(f"|{filename}".encode()) - - return hash.hexdigest() - - def get_source_checksum(self, source: str) -> str: - """Returns a checksum for the source.""" - return sha1(source.encode("utf-8")).hexdigest() - - def get_bucket( - self, - environment: "Environment", - name: str, - filename: t.Optional[str], - source: str, - ) -> Bucket: - """Return a cache bucket for the given template. All arguments are - mandatory but filename may be `None`. - """ - key = self.get_cache_key(name, filename) - checksum = self.get_source_checksum(source) - bucket = Bucket(environment, key, checksum) - self.load_bytecode(bucket) - return bucket - - def set_bucket(self, bucket: Bucket) -> None: - """Put the bucket into the cache.""" - self.dump_bytecode(bucket) - - -class FileSystemBytecodeCache(BytecodeCache): - """A bytecode cache that stores bytecode on the filesystem. It accepts - two arguments: The directory where the cache items are stored and a - pattern string that is used to build the filename. - - If no directory is specified a default cache directory is selected. On - Windows the user's temp directory is used, on UNIX systems a directory - is created for the user in the system temp directory. - - The pattern can be used to have multiple separate caches operate on the - same directory. The default pattern is ``'__jinja2_%s.cache'``. ``%s`` - is replaced with the cache key. - - >>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache') - - This bytecode cache supports clearing of the cache using the clear method. - """ - - def __init__( - self, directory: t.Optional[str] = None, pattern: str = "__jinja2_%s.cache" - ) -> None: - if directory is None: - directory = self._get_default_cache_dir() - self.directory = directory - self.pattern = pattern - - def _get_default_cache_dir(self) -> str: - def _unsafe_dir() -> "te.NoReturn": - raise RuntimeError( - "Cannot determine safe temp directory. You " - "need to explicitly provide one." - ) - - tmpdir = tempfile.gettempdir() - - # On windows the temporary directory is used specific unless - # explicitly forced otherwise. We can just use that. - if os.name == "nt": - return tmpdir - if not hasattr(os, "getuid"): - _unsafe_dir() - - dirname = f"_jinja2-cache-{os.getuid()}" - actual_dir = os.path.join(tmpdir, dirname) - - try: - os.mkdir(actual_dir, stat.S_IRWXU) - except OSError as e: - if e.errno != errno.EEXIST: - raise - try: - os.chmod(actual_dir, stat.S_IRWXU) - actual_dir_stat = os.lstat(actual_dir) - if ( - actual_dir_stat.st_uid != os.getuid() - or not stat.S_ISDIR(actual_dir_stat.st_mode) - or stat.S_IMODE(actual_dir_stat.st_mode) != stat.S_IRWXU - ): - _unsafe_dir() - except OSError as e: - if e.errno != errno.EEXIST: - raise - - actual_dir_stat = os.lstat(actual_dir) - if ( - actual_dir_stat.st_uid != os.getuid() - or not stat.S_ISDIR(actual_dir_stat.st_mode) - or stat.S_IMODE(actual_dir_stat.st_mode) != stat.S_IRWXU - ): - _unsafe_dir() - - return actual_dir - - def _get_cache_filename(self, bucket: Bucket) -> str: - return os.path.join(self.directory, self.pattern % (bucket.key,)) - - def load_bytecode(self, bucket: Bucket) -> None: - filename = self._get_cache_filename(bucket) - - # Don't test for existence before opening the file, since the - # file could disappear after the test before the open. - try: - f = open(filename, "rb") - except (FileNotFoundError, IsADirectoryError, PermissionError): - # PermissionError can occur on Windows when an operation is - # in progress, such as calling clear(). - return - - with f: - bucket.load_bytecode(f) - - def dump_bytecode(self, bucket: Bucket) -> None: - # Write to a temporary file, then rename to the real name after - # writing. This avoids another process reading the file before - # it is fully written. - name = self._get_cache_filename(bucket) - f = tempfile.NamedTemporaryFile( - mode="wb", - dir=os.path.dirname(name), - prefix=os.path.basename(name), - suffix=".tmp", - delete=False, - ) - - def remove_silent() -> None: - try: - os.remove(f.name) - except OSError: - # Another process may have called clear(). On Windows, - # another program may be holding the file open. - pass - - try: - with f: - bucket.write_bytecode(f) - except BaseException: - remove_silent() - raise - - try: - os.replace(f.name, name) - except OSError: - # Another process may have called clear(). On Windows, - # another program may be holding the file open. - remove_silent() - except BaseException: - remove_silent() - raise - - def clear(self) -> None: - # imported lazily here because google app-engine doesn't support - # write access on the file system and the function does not exist - # normally. - from os import remove - - files = fnmatch.filter(os.listdir(self.directory), self.pattern % ("*",)) - for filename in files: - try: - remove(os.path.join(self.directory, filename)) - except OSError: - pass - - -class MemcachedBytecodeCache(BytecodeCache): - """This class implements a bytecode cache that uses a memcache cache for - storing the information. It does not enforce a specific memcache library - (tummy's memcache or cmemcache) but will accept any class that provides - the minimal interface required. - - Libraries compatible with this class: - - - `cachelib `_ - - `python-memcached `_ - - (Unfortunately the django cache interface is not compatible because it - does not support storing binary data, only text. You can however pass - the underlying cache client to the bytecode cache which is available - as `django.core.cache.cache._client`.) - - The minimal interface for the client passed to the constructor is this: - - .. class:: MinimalClientInterface - - .. method:: set(key, value[, timeout]) - - Stores the bytecode in the cache. `value` is a string and - `timeout` the timeout of the key. If timeout is not provided - a default timeout or no timeout should be assumed, if it's - provided it's an integer with the number of seconds the cache - item should exist. - - .. method:: get(key) - - Returns the value for the cache key. If the item does not - exist in the cache the return value must be `None`. - - The other arguments to the constructor are the prefix for all keys that - is added before the actual cache key and the timeout for the bytecode in - the cache system. We recommend a high (or no) timeout. - - This bytecode cache does not support clearing of used items in the cache. - The clear method is a no-operation function. - - .. versionadded:: 2.7 - Added support for ignoring memcache errors through the - `ignore_memcache_errors` parameter. - """ - - def __init__( - self, - client: "_MemcachedClient", - prefix: str = "jinja2/bytecode/", - timeout: t.Optional[int] = None, - ignore_memcache_errors: bool = True, - ): - self.client = client - self.prefix = prefix - self.timeout = timeout - self.ignore_memcache_errors = ignore_memcache_errors - - def load_bytecode(self, bucket: Bucket) -> None: - try: - code = self.client.get(self.prefix + bucket.key) - except Exception: - if not self.ignore_memcache_errors: - raise - else: - bucket.bytecode_from_string(code) - - def dump_bytecode(self, bucket: Bucket) -> None: - key = self.prefix + bucket.key - value = bucket.bytecode_to_string() - - try: - if self.timeout is not None: - self.client.set(key, value, self.timeout) - else: - self.client.set(key, value) - except Exception: - if not self.ignore_memcache_errors: - raise diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/compiler.py b/write-message/venv/lib/python3.10/site-packages/jinja2/compiler.py deleted file mode 100644 index a4ff6a1..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/compiler.py +++ /dev/null @@ -1,1998 +0,0 @@ -"""Compiles nodes from the parser into Python code.""" - -import typing as t -from contextlib import contextmanager -from functools import update_wrapper -from io import StringIO -from itertools import chain -from keyword import iskeyword as is_python_keyword - -from markupsafe import escape -from markupsafe import Markup - -from . import nodes -from .exceptions import TemplateAssertionError -from .idtracking import Symbols -from .idtracking import VAR_LOAD_ALIAS -from .idtracking import VAR_LOAD_PARAMETER -from .idtracking import VAR_LOAD_RESOLVE -from .idtracking import VAR_LOAD_UNDEFINED -from .nodes import EvalContext -from .optimizer import Optimizer -from .utils import _PassArg -from .utils import concat -from .visitor import NodeVisitor - -if t.TYPE_CHECKING: - import typing_extensions as te - - from .environment import Environment - -F = t.TypeVar("F", bound=t.Callable[..., t.Any]) - -operators = { - "eq": "==", - "ne": "!=", - "gt": ">", - "gteq": ">=", - "lt": "<", - "lteq": "<=", - "in": "in", - "notin": "not in", -} - - -def optimizeconst(f: F) -> F: - def new_func( - self: "CodeGenerator", node: nodes.Expr, frame: "Frame", **kwargs: t.Any - ) -> t.Any: - # Only optimize if the frame is not volatile - if self.optimizer is not None and not frame.eval_ctx.volatile: - new_node = self.optimizer.visit(node, frame.eval_ctx) - - if new_node != node: - return self.visit(new_node, frame) - - return f(self, node, frame, **kwargs) - - return update_wrapper(new_func, f) # type: ignore[return-value] - - -def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]: - @optimizeconst - def visitor(self: "CodeGenerator", node: nodes.BinExpr, frame: Frame) -> None: - if ( - self.environment.sandboxed and op in self.environment.intercepted_binops # type: ignore - ): - self.write(f"environment.call_binop(context, {op!r}, ") - self.visit(node.left, frame) - self.write(", ") - self.visit(node.right, frame) - else: - self.write("(") - self.visit(node.left, frame) - self.write(f" {op} ") - self.visit(node.right, frame) - - self.write(")") - - return visitor - - -def _make_unop( - op: str, -) -> t.Callable[["CodeGenerator", nodes.UnaryExpr, "Frame"], None]: - @optimizeconst - def visitor(self: "CodeGenerator", node: nodes.UnaryExpr, frame: Frame) -> None: - if ( - self.environment.sandboxed and op in self.environment.intercepted_unops # type: ignore - ): - self.write(f"environment.call_unop(context, {op!r}, ") - self.visit(node.node, frame) - else: - self.write("(" + op) - self.visit(node.node, frame) - - self.write(")") - - return visitor - - -def generate( - node: nodes.Template, - environment: "Environment", - name: t.Optional[str], - filename: t.Optional[str], - stream: t.Optional[t.TextIO] = None, - defer_init: bool = False, - optimized: bool = True, -) -> t.Optional[str]: - """Generate the python source for a node tree.""" - if not isinstance(node, nodes.Template): - raise TypeError("Can't compile non template nodes") - - generator = environment.code_generator_class( - environment, name, filename, stream, defer_init, optimized - ) - generator.visit(node) - - if stream is None: - return generator.stream.getvalue() # type: ignore - - return None - - -def has_safe_repr(value: t.Any) -> bool: - """Does the node have a safe representation?""" - if value is None or value is NotImplemented or value is Ellipsis: - return True - - if type(value) in {bool, int, float, complex, range, str, Markup}: - return True - - if type(value) in {tuple, list, set, frozenset}: - return all(has_safe_repr(v) for v in value) - - if type(value) is dict: # noqa E721 - return all(has_safe_repr(k) and has_safe_repr(v) for k, v in value.items()) - - return False - - -def find_undeclared( - nodes: t.Iterable[nodes.Node], names: t.Iterable[str] -) -> t.Set[str]: - """Check if the names passed are accessed undeclared. The return value - is a set of all the undeclared names from the sequence of names found. - """ - visitor = UndeclaredNameVisitor(names) - try: - for node in nodes: - visitor.visit(node) - except VisitorExit: - pass - return visitor.undeclared - - -class MacroRef: - def __init__(self, node: t.Union[nodes.Macro, nodes.CallBlock]) -> None: - self.node = node - self.accesses_caller = False - self.accesses_kwargs = False - self.accesses_varargs = False - - -class Frame: - """Holds compile time information for us.""" - - def __init__( - self, - eval_ctx: EvalContext, - parent: t.Optional["Frame"] = None, - level: t.Optional[int] = None, - ) -> None: - self.eval_ctx = eval_ctx - - # the parent of this frame - self.parent = parent - - if parent is None: - self.symbols = Symbols(level=level) - - # in some dynamic inheritance situations the compiler needs to add - # write tests around output statements. - self.require_output_check = False - - # inside some tags we are using a buffer rather than yield statements. - # this for example affects {% filter %} or {% macro %}. If a frame - # is buffered this variable points to the name of the list used as - # buffer. - self.buffer: t.Optional[str] = None - - # the name of the block we're in, otherwise None. - self.block: t.Optional[str] = None - - else: - self.symbols = Symbols(parent.symbols, level=level) - self.require_output_check = parent.require_output_check - self.buffer = parent.buffer - self.block = parent.block - - # a toplevel frame is the root + soft frames such as if conditions. - self.toplevel = False - - # the root frame is basically just the outermost frame, so no if - # conditions. This information is used to optimize inheritance - # situations. - self.rootlevel = False - - # variables set inside of loops and blocks should not affect outer frames, - # but they still needs to be kept track of as part of the active context. - self.loop_frame = False - self.block_frame = False - - # track whether the frame is being used in an if-statement or conditional - # expression as it determines which errors should be raised during runtime - # or compile time. - self.soft_frame = False - - def copy(self) -> "te.Self": - """Create a copy of the current one.""" - rv = object.__new__(self.__class__) - rv.__dict__.update(self.__dict__) - rv.symbols = self.symbols.copy() - return rv - - def inner(self, isolated: bool = False) -> "Frame": - """Return an inner frame.""" - if isolated: - return Frame(self.eval_ctx, level=self.symbols.level + 1) - return Frame(self.eval_ctx, self) - - def soft(self) -> "te.Self": - """Return a soft frame. A soft frame may not be modified as - standalone thing as it shares the resources with the frame it - was created of, but it's not a rootlevel frame any longer. - - This is only used to implement if-statements and conditional - expressions. - """ - rv = self.copy() - rv.rootlevel = False - rv.soft_frame = True - return rv - - __copy__ = copy - - -class VisitorExit(RuntimeError): - """Exception used by the `UndeclaredNameVisitor` to signal a stop.""" - - -class DependencyFinderVisitor(NodeVisitor): - """A visitor that collects filter and test calls.""" - - def __init__(self) -> None: - self.filters: t.Set[str] = set() - self.tests: t.Set[str] = set() - - def visit_Filter(self, node: nodes.Filter) -> None: - self.generic_visit(node) - self.filters.add(node.name) - - def visit_Test(self, node: nodes.Test) -> None: - self.generic_visit(node) - self.tests.add(node.name) - - def visit_Block(self, node: nodes.Block) -> None: - """Stop visiting at blocks.""" - - -class UndeclaredNameVisitor(NodeVisitor): - """A visitor that checks if a name is accessed without being - declared. This is different from the frame visitor as it will - not stop at closure frames. - """ - - def __init__(self, names: t.Iterable[str]) -> None: - self.names = set(names) - self.undeclared: t.Set[str] = set() - - def visit_Name(self, node: nodes.Name) -> None: - if node.ctx == "load" and node.name in self.names: - self.undeclared.add(node.name) - if self.undeclared == self.names: - raise VisitorExit() - else: - self.names.discard(node.name) - - def visit_Block(self, node: nodes.Block) -> None: - """Stop visiting a blocks.""" - - -class CompilerExit(Exception): - """Raised if the compiler encountered a situation where it just - doesn't make sense to further process the code. Any block that - raises such an exception is not further processed. - """ - - -class CodeGenerator(NodeVisitor): - def __init__( - self, - environment: "Environment", - name: t.Optional[str], - filename: t.Optional[str], - stream: t.Optional[t.TextIO] = None, - defer_init: bool = False, - optimized: bool = True, - ) -> None: - if stream is None: - stream = StringIO() - self.environment = environment - self.name = name - self.filename = filename - self.stream = stream - self.created_block_context = False - self.defer_init = defer_init - self.optimizer: t.Optional[Optimizer] = None - - if optimized: - self.optimizer = Optimizer(environment) - - # aliases for imports - self.import_aliases: t.Dict[str, str] = {} - - # a registry for all blocks. Because blocks are moved out - # into the global python scope they are registered here - self.blocks: t.Dict[str, nodes.Block] = {} - - # the number of extends statements so far - self.extends_so_far = 0 - - # some templates have a rootlevel extends. In this case we - # can safely assume that we're a child template and do some - # more optimizations. - self.has_known_extends = False - - # the current line number - self.code_lineno = 1 - - # registry of all filters and tests (global, not block local) - self.tests: t.Dict[str, str] = {} - self.filters: t.Dict[str, str] = {} - - # the debug information - self.debug_info: t.List[t.Tuple[int, int]] = [] - self._write_debug_info: t.Optional[int] = None - - # the number of new lines before the next write() - self._new_lines = 0 - - # the line number of the last written statement - self._last_line = 0 - - # true if nothing was written so far. - self._first_write = True - - # used by the `temporary_identifier` method to get new - # unique, temporary identifier - self._last_identifier = 0 - - # the current indentation - self._indentation = 0 - - # Tracks toplevel assignments - self._assign_stack: t.List[t.Set[str]] = [] - - # Tracks parameter definition blocks - self._param_def_block: t.List[t.Set[str]] = [] - - # Tracks the current context. - self._context_reference_stack = ["context"] - - @property - def optimized(self) -> bool: - return self.optimizer is not None - - # -- Various compilation helpers - - def fail(self, msg: str, lineno: int) -> "te.NoReturn": - """Fail with a :exc:`TemplateAssertionError`.""" - raise TemplateAssertionError(msg, lineno, self.name, self.filename) - - def temporary_identifier(self) -> str: - """Get a new unique identifier.""" - self._last_identifier += 1 - return f"t_{self._last_identifier}" - - def buffer(self, frame: Frame) -> None: - """Enable buffering for the frame from that point onwards.""" - frame.buffer = self.temporary_identifier() - self.writeline(f"{frame.buffer} = []") - - def return_buffer_contents( - self, frame: Frame, force_unescaped: bool = False - ) -> None: - """Return the buffer contents of the frame.""" - if not force_unescaped: - if frame.eval_ctx.volatile: - self.writeline("if context.eval_ctx.autoescape:") - self.indent() - self.writeline(f"return Markup(concat({frame.buffer}))") - self.outdent() - self.writeline("else:") - self.indent() - self.writeline(f"return concat({frame.buffer})") - self.outdent() - return - elif frame.eval_ctx.autoescape: - self.writeline(f"return Markup(concat({frame.buffer}))") - return - self.writeline(f"return concat({frame.buffer})") - - def indent(self) -> None: - """Indent by one.""" - self._indentation += 1 - - def outdent(self, step: int = 1) -> None: - """Outdent by step.""" - self._indentation -= step - - def start_write(self, frame: Frame, node: t.Optional[nodes.Node] = None) -> None: - """Yield or write into the frame buffer.""" - if frame.buffer is None: - self.writeline("yield ", node) - else: - self.writeline(f"{frame.buffer}.append(", node) - - def end_write(self, frame: Frame) -> None: - """End the writing process started by `start_write`.""" - if frame.buffer is not None: - self.write(")") - - def simple_write( - self, s: str, frame: Frame, node: t.Optional[nodes.Node] = None - ) -> None: - """Simple shortcut for start_write + write + end_write.""" - self.start_write(frame, node) - self.write(s) - self.end_write(frame) - - def blockvisit(self, nodes: t.Iterable[nodes.Node], frame: Frame) -> None: - """Visit a list of nodes as block in a frame. If the current frame - is no buffer a dummy ``if 0: yield None`` is written automatically. - """ - try: - self.writeline("pass") - for node in nodes: - self.visit(node, frame) - except CompilerExit: - pass - - def write(self, x: str) -> None: - """Write a string into the output stream.""" - if self._new_lines: - if not self._first_write: - self.stream.write("\n" * self._new_lines) - self.code_lineno += self._new_lines - if self._write_debug_info is not None: - self.debug_info.append((self._write_debug_info, self.code_lineno)) - self._write_debug_info = None - self._first_write = False - self.stream.write(" " * self._indentation) - self._new_lines = 0 - self.stream.write(x) - - def writeline( - self, x: str, node: t.Optional[nodes.Node] = None, extra: int = 0 - ) -> None: - """Combination of newline and write.""" - self.newline(node, extra) - self.write(x) - - def newline(self, node: t.Optional[nodes.Node] = None, extra: int = 0) -> None: - """Add one or more newlines before the next write.""" - self._new_lines = max(self._new_lines, 1 + extra) - if node is not None and node.lineno != self._last_line: - self._write_debug_info = node.lineno - self._last_line = node.lineno - - def signature( - self, - node: t.Union[nodes.Call, nodes.Filter, nodes.Test], - frame: Frame, - extra_kwargs: t.Optional[t.Mapping[str, t.Any]] = None, - ) -> None: - """Writes a function call to the stream for the current node. - A leading comma is added automatically. The extra keyword - arguments may not include python keywords otherwise a syntax - error could occur. The extra keyword arguments should be given - as python dict. - """ - # if any of the given keyword arguments is a python keyword - # we have to make sure that no invalid call is created. - kwarg_workaround = any( - is_python_keyword(t.cast(str, k)) - for k in chain((x.key for x in node.kwargs), extra_kwargs or ()) - ) - - for arg in node.args: - self.write(", ") - self.visit(arg, frame) - - if not kwarg_workaround: - for kwarg in node.kwargs: - self.write(", ") - self.visit(kwarg, frame) - if extra_kwargs is not None: - for key, value in extra_kwargs.items(): - self.write(f", {key}={value}") - if node.dyn_args: - self.write(", *") - self.visit(node.dyn_args, frame) - - if kwarg_workaround: - if node.dyn_kwargs is not None: - self.write(", **dict({") - else: - self.write(", **{") - for kwarg in node.kwargs: - self.write(f"{kwarg.key!r}: ") - self.visit(kwarg.value, frame) - self.write(", ") - if extra_kwargs is not None: - for key, value in extra_kwargs.items(): - self.write(f"{key!r}: {value}, ") - if node.dyn_kwargs is not None: - self.write("}, **") - self.visit(node.dyn_kwargs, frame) - self.write(")") - else: - self.write("}") - - elif node.dyn_kwargs is not None: - self.write(", **") - self.visit(node.dyn_kwargs, frame) - - def pull_dependencies(self, nodes: t.Iterable[nodes.Node]) -> None: - """Find all filter and test names used in the template and - assign them to variables in the compiled namespace. Checking - that the names are registered with the environment is done when - compiling the Filter and Test nodes. If the node is in an If or - CondExpr node, the check is done at runtime instead. - - .. versionchanged:: 3.0 - Filters and tests in If and CondExpr nodes are checked at - runtime instead of compile time. - """ - visitor = DependencyFinderVisitor() - - for node in nodes: - visitor.visit(node) - - for id_map, names, dependency in ( - (self.filters, visitor.filters, "filters"), - ( - self.tests, - visitor.tests, - "tests", - ), - ): - for name in sorted(names): - if name not in id_map: - id_map[name] = self.temporary_identifier() - - # add check during runtime that dependencies used inside of executed - # blocks are defined, as this step may be skipped during compile time - self.writeline("try:") - self.indent() - self.writeline(f"{id_map[name]} = environment.{dependency}[{name!r}]") - self.outdent() - self.writeline("except KeyError:") - self.indent() - self.writeline("@internalcode") - self.writeline(f"def {id_map[name]}(*unused):") - self.indent() - self.writeline( - f'raise TemplateRuntimeError("No {dependency[:-1]}' - f' named {name!r} found.")' - ) - self.outdent() - self.outdent() - - def enter_frame(self, frame: Frame) -> None: - undefs = [] - for target, (action, param) in frame.symbols.loads.items(): - if action == VAR_LOAD_PARAMETER: - pass - elif action == VAR_LOAD_RESOLVE: - self.writeline(f"{target} = {self.get_resolve_func()}({param!r})") - elif action == VAR_LOAD_ALIAS: - self.writeline(f"{target} = {param}") - elif action == VAR_LOAD_UNDEFINED: - undefs.append(target) - else: - raise NotImplementedError("unknown load instruction") - if undefs: - self.writeline(f"{' = '.join(undefs)} = missing") - - def leave_frame(self, frame: Frame, with_python_scope: bool = False) -> None: - if not with_python_scope: - undefs = [] - for target in frame.symbols.loads: - undefs.append(target) - if undefs: - self.writeline(f"{' = '.join(undefs)} = missing") - - def choose_async(self, async_value: str = "async ", sync_value: str = "") -> str: - return async_value if self.environment.is_async else sync_value - - def func(self, name: str) -> str: - return f"{self.choose_async()}def {name}" - - def macro_body( - self, node: t.Union[nodes.Macro, nodes.CallBlock], frame: Frame - ) -> t.Tuple[Frame, MacroRef]: - """Dump the function def of a macro or call block.""" - frame = frame.inner() - frame.symbols.analyze_node(node) - macro_ref = MacroRef(node) - - explicit_caller = None - skip_special_params = set() - args = [] - - for idx, arg in enumerate(node.args): - if arg.name == "caller": - explicit_caller = idx - if arg.name in ("kwargs", "varargs"): - skip_special_params.add(arg.name) - args.append(frame.symbols.ref(arg.name)) - - undeclared = find_undeclared(node.body, ("caller", "kwargs", "varargs")) - - if "caller" in undeclared: - # In older Jinja versions there was a bug that allowed caller - # to retain the special behavior even if it was mentioned in - # the argument list. However thankfully this was only really - # working if it was the last argument. So we are explicitly - # checking this now and error out if it is anywhere else in - # the argument list. - if explicit_caller is not None: - try: - node.defaults[explicit_caller - len(node.args)] - except IndexError: - self.fail( - "When defining macros or call blocks the " - 'special "caller" argument must be omitted ' - "or be given a default.", - node.lineno, - ) - else: - args.append(frame.symbols.declare_parameter("caller")) - macro_ref.accesses_caller = True - if "kwargs" in undeclared and "kwargs" not in skip_special_params: - args.append(frame.symbols.declare_parameter("kwargs")) - macro_ref.accesses_kwargs = True - if "varargs" in undeclared and "varargs" not in skip_special_params: - args.append(frame.symbols.declare_parameter("varargs")) - macro_ref.accesses_varargs = True - - # macros are delayed, they never require output checks - frame.require_output_check = False - frame.symbols.analyze_node(node) - self.writeline(f"{self.func('macro')}({', '.join(args)}):", node) - self.indent() - - self.buffer(frame) - self.enter_frame(frame) - - self.push_parameter_definitions(frame) - for idx, arg in enumerate(node.args): - ref = frame.symbols.ref(arg.name) - self.writeline(f"if {ref} is missing:") - self.indent() - try: - default = node.defaults[idx - len(node.args)] - except IndexError: - self.writeline( - f'{ref} = undefined("parameter {arg.name!r} was not provided",' - f" name={arg.name!r})" - ) - else: - self.writeline(f"{ref} = ") - self.visit(default, frame) - self.mark_parameter_stored(ref) - self.outdent() - self.pop_parameter_definitions() - - self.blockvisit(node.body, frame) - self.return_buffer_contents(frame, force_unescaped=True) - self.leave_frame(frame, with_python_scope=True) - self.outdent() - - return frame, macro_ref - - def macro_def(self, macro_ref: MacroRef, frame: Frame) -> None: - """Dump the macro definition for the def created by macro_body.""" - arg_tuple = ", ".join(repr(x.name) for x in macro_ref.node.args) - name = getattr(macro_ref.node, "name", None) - if len(macro_ref.node.args) == 1: - arg_tuple += "," - self.write( - f"Macro(environment, macro, {name!r}, ({arg_tuple})," - f" {macro_ref.accesses_kwargs!r}, {macro_ref.accesses_varargs!r}," - f" {macro_ref.accesses_caller!r}, context.eval_ctx.autoescape)" - ) - - def position(self, node: nodes.Node) -> str: - """Return a human readable position for the node.""" - rv = f"line {node.lineno}" - if self.name is not None: - rv = f"{rv} in {self.name!r}" - return rv - - def dump_local_context(self, frame: Frame) -> str: - items_kv = ", ".join( - f"{name!r}: {target}" - for name, target in frame.symbols.dump_stores().items() - ) - return f"{{{items_kv}}}" - - def write_commons(self) -> None: - """Writes a common preamble that is used by root and block functions. - Primarily this sets up common local helpers and enforces a generator - through a dead branch. - """ - self.writeline("resolve = context.resolve_or_missing") - self.writeline("undefined = environment.undefined") - self.writeline("concat = environment.concat") - # always use the standard Undefined class for the implicit else of - # conditional expressions - self.writeline("cond_expr_undefined = Undefined") - self.writeline("if 0: yield None") - - def push_parameter_definitions(self, frame: Frame) -> None: - """Pushes all parameter targets from the given frame into a local - stack that permits tracking of yet to be assigned parameters. In - particular this enables the optimization from `visit_Name` to skip - undefined expressions for parameters in macros as macros can reference - otherwise unbound parameters. - """ - self._param_def_block.append(frame.symbols.dump_param_targets()) - - def pop_parameter_definitions(self) -> None: - """Pops the current parameter definitions set.""" - self._param_def_block.pop() - - def mark_parameter_stored(self, target: str) -> None: - """Marks a parameter in the current parameter definitions as stored. - This will skip the enforced undefined checks. - """ - if self._param_def_block: - self._param_def_block[-1].discard(target) - - def push_context_reference(self, target: str) -> None: - self._context_reference_stack.append(target) - - def pop_context_reference(self) -> None: - self._context_reference_stack.pop() - - def get_context_ref(self) -> str: - return self._context_reference_stack[-1] - - def get_resolve_func(self) -> str: - target = self._context_reference_stack[-1] - if target == "context": - return "resolve" - return f"{target}.resolve" - - def derive_context(self, frame: Frame) -> str: - return f"{self.get_context_ref()}.derived({self.dump_local_context(frame)})" - - def parameter_is_undeclared(self, target: str) -> bool: - """Checks if a given target is an undeclared parameter.""" - if not self._param_def_block: - return False - return target in self._param_def_block[-1] - - def push_assign_tracking(self) -> None: - """Pushes a new layer for assignment tracking.""" - self._assign_stack.append(set()) - - def pop_assign_tracking(self, frame: Frame) -> None: - """Pops the topmost level for assignment tracking and updates the - context variables if necessary. - """ - vars = self._assign_stack.pop() - if ( - not frame.block_frame - and not frame.loop_frame - and not frame.toplevel - or not vars - ): - return - public_names = [x for x in vars if x[:1] != "_"] - if len(vars) == 1: - name = next(iter(vars)) - ref = frame.symbols.ref(name) - if frame.loop_frame: - self.writeline(f"_loop_vars[{name!r}] = {ref}") - return - if frame.block_frame: - self.writeline(f"_block_vars[{name!r}] = {ref}") - return - self.writeline(f"context.vars[{name!r}] = {ref}") - else: - if frame.loop_frame: - self.writeline("_loop_vars.update({") - elif frame.block_frame: - self.writeline("_block_vars.update({") - else: - self.writeline("context.vars.update({") - for idx, name in enumerate(sorted(vars)): - if idx: - self.write(", ") - ref = frame.symbols.ref(name) - self.write(f"{name!r}: {ref}") - self.write("})") - if not frame.block_frame and not frame.loop_frame and public_names: - if len(public_names) == 1: - self.writeline(f"context.exported_vars.add({public_names[0]!r})") - else: - names_str = ", ".join(map(repr, sorted(public_names))) - self.writeline(f"context.exported_vars.update(({names_str}))") - - # -- Statement Visitors - - def visit_Template( - self, node: nodes.Template, frame: t.Optional[Frame] = None - ) -> None: - assert frame is None, "no root frame allowed" - eval_ctx = EvalContext(self.environment, self.name) - - from .runtime import async_exported - from .runtime import exported - - if self.environment.is_async: - exported_names = sorted(exported + async_exported) - else: - exported_names = sorted(exported) - - self.writeline("from jinja2.runtime import " + ", ".join(exported_names)) - - # if we want a deferred initialization we cannot move the - # environment into a local name - envenv = "" if self.defer_init else ", environment=environment" - - # do we have an extends tag at all? If not, we can save some - # overhead by just not processing any inheritance code. - have_extends = node.find(nodes.Extends) is not None - - # find all blocks - for block in node.find_all(nodes.Block): - if block.name in self.blocks: - self.fail(f"block {block.name!r} defined twice", block.lineno) - self.blocks[block.name] = block - - # find all imports and import them - for import_ in node.find_all(nodes.ImportedName): - if import_.importname not in self.import_aliases: - imp = import_.importname - self.import_aliases[imp] = alias = self.temporary_identifier() - if "." in imp: - module, obj = imp.rsplit(".", 1) - self.writeline(f"from {module} import {obj} as {alias}") - else: - self.writeline(f"import {imp} as {alias}") - - # add the load name - self.writeline(f"name = {self.name!r}") - - # generate the root render function. - self.writeline( - f"{self.func('root')}(context, missing=missing{envenv}):", extra=1 - ) - self.indent() - self.write_commons() - - # process the root - frame = Frame(eval_ctx) - if "self" in find_undeclared(node.body, ("self",)): - ref = frame.symbols.declare_parameter("self") - self.writeline(f"{ref} = TemplateReference(context)") - frame.symbols.analyze_node(node) - frame.toplevel = frame.rootlevel = True - frame.require_output_check = have_extends and not self.has_known_extends - if have_extends: - self.writeline("parent_template = None") - self.enter_frame(frame) - self.pull_dependencies(node.body) - self.blockvisit(node.body, frame) - self.leave_frame(frame, with_python_scope=True) - self.outdent() - - # make sure that the parent root is called. - if have_extends: - if not self.has_known_extends: - self.indent() - self.writeline("if parent_template is not None:") - self.indent() - if not self.environment.is_async: - self.writeline("yield from parent_template.root_render_func(context)") - else: - self.writeline("agen = parent_template.root_render_func(context)") - self.writeline("try:") - self.indent() - self.writeline("async for event in agen:") - self.indent() - self.writeline("yield event") - self.outdent() - self.outdent() - self.writeline("finally: await agen.aclose()") - self.outdent(1 + (not self.has_known_extends)) - - # at this point we now have the blocks collected and can visit them too. - for name, block in self.blocks.items(): - self.writeline( - f"{self.func('block_' + name)}(context, missing=missing{envenv}):", - block, - 1, - ) - self.indent() - self.write_commons() - # It's important that we do not make this frame a child of the - # toplevel template. This would cause a variety of - # interesting issues with identifier tracking. - block_frame = Frame(eval_ctx) - block_frame.block_frame = True - undeclared = find_undeclared(block.body, ("self", "super")) - if "self" in undeclared: - ref = block_frame.symbols.declare_parameter("self") - self.writeline(f"{ref} = TemplateReference(context)") - if "super" in undeclared: - ref = block_frame.symbols.declare_parameter("super") - self.writeline(f"{ref} = context.super({name!r}, block_{name})") - block_frame.symbols.analyze_node(block) - block_frame.block = name - self.writeline("_block_vars = {}") - self.enter_frame(block_frame) - self.pull_dependencies(block.body) - self.blockvisit(block.body, block_frame) - self.leave_frame(block_frame, with_python_scope=True) - self.outdent() - - blocks_kv_str = ", ".join(f"{x!r}: block_{x}" for x in self.blocks) - self.writeline(f"blocks = {{{blocks_kv_str}}}", extra=1) - debug_kv_str = "&".join(f"{k}={v}" for k, v in self.debug_info) - self.writeline(f"debug_info = {debug_kv_str!r}") - - def visit_Block(self, node: nodes.Block, frame: Frame) -> None: - """Call a block and register it for the template.""" - level = 0 - if frame.toplevel: - # if we know that we are a child template, there is no need to - # check if we are one - if self.has_known_extends: - return - if self.extends_so_far > 0: - self.writeline("if parent_template is None:") - self.indent() - level += 1 - - if node.scoped: - context = self.derive_context(frame) - else: - context = self.get_context_ref() - - if node.required: - self.writeline(f"if len(context.blocks[{node.name!r}]) <= 1:", node) - self.indent() - self.writeline( - f'raise TemplateRuntimeError("Required block {node.name!r} not found")', - node, - ) - self.outdent() - - if not self.environment.is_async and frame.buffer is None: - self.writeline( - f"yield from context.blocks[{node.name!r}][0]({context})", node - ) - else: - self.writeline(f"gen = context.blocks[{node.name!r}][0]({context})") - self.writeline("try:") - self.indent() - self.writeline( - f"{self.choose_async()}for event in gen:", - node, - ) - self.indent() - self.simple_write("event", frame) - self.outdent() - self.outdent() - self.writeline( - f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" - ) - - self.outdent(level) - - def visit_Extends(self, node: nodes.Extends, frame: Frame) -> None: - """Calls the extender.""" - if not frame.toplevel: - self.fail("cannot use extend from a non top-level scope", node.lineno) - - # if the number of extends statements in general is zero so - # far, we don't have to add a check if something extended - # the template before this one. - if self.extends_so_far > 0: - # if we have a known extends we just add a template runtime - # error into the generated code. We could catch that at compile - # time too, but i welcome it not to confuse users by throwing the - # same error at different times just "because we can". - if not self.has_known_extends: - self.writeline("if parent_template is not None:") - self.indent() - self.writeline('raise TemplateRuntimeError("extended multiple times")') - - # if we have a known extends already we don't need that code here - # as we know that the template execution will end here. - if self.has_known_extends: - raise CompilerExit() - else: - self.outdent() - - self.writeline("parent_template = environment.get_template(", node) - self.visit(node.template, frame) - self.write(f", {self.name!r})") - self.writeline("for name, parent_block in parent_template.blocks.items():") - self.indent() - self.writeline("context.blocks.setdefault(name, []).append(parent_block)") - self.outdent() - - # if this extends statement was in the root level we can take - # advantage of that information and simplify the generated code - # in the top level from this point onwards - if frame.rootlevel: - self.has_known_extends = True - - # and now we have one more - self.extends_so_far += 1 - - def visit_Include(self, node: nodes.Include, frame: Frame) -> None: - """Handles includes.""" - if node.ignore_missing: - self.writeline("try:") - self.indent() - - func_name = "get_or_select_template" - if isinstance(node.template, nodes.Const): - if isinstance(node.template.value, str): - func_name = "get_template" - elif isinstance(node.template.value, (tuple, list)): - func_name = "select_template" - elif isinstance(node.template, (nodes.Tuple, nodes.List)): - func_name = "select_template" - - self.writeline(f"template = environment.{func_name}(", node) - self.visit(node.template, frame) - self.write(f", {self.name!r})") - if node.ignore_missing: - self.outdent() - self.writeline("except TemplateNotFound:") - self.indent() - self.writeline("pass") - self.outdent() - self.writeline("else:") - self.indent() - - def loop_body() -> None: - self.indent() - self.simple_write("event", frame) - self.outdent() - - if node.with_context: - self.writeline( - f"gen = template.root_render_func(" - "template.new_context(context.get_all(), True," - f" {self.dump_local_context(frame)}))" - ) - self.writeline("try:") - self.indent() - self.writeline(f"{self.choose_async()}for event in gen:") - loop_body() - self.outdent() - self.writeline( - f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" - ) - elif self.environment.is_async: - self.writeline( - "for event in (await template._get_default_module_async())" - "._body_stream:" - ) - loop_body() - else: - self.writeline("yield from template._get_default_module()._body_stream") - - if node.ignore_missing: - self.outdent() - - def _import_common( - self, node: t.Union[nodes.Import, nodes.FromImport], frame: Frame - ) -> None: - self.write(f"{self.choose_async('await ')}environment.get_template(") - self.visit(node.template, frame) - self.write(f", {self.name!r}).") - - if node.with_context: - f_name = f"make_module{self.choose_async('_async')}" - self.write( - f"{f_name}(context.get_all(), True, {self.dump_local_context(frame)})" - ) - else: - self.write(f"_get_default_module{self.choose_async('_async')}(context)") - - def visit_Import(self, node: nodes.Import, frame: Frame) -> None: - """Visit regular imports.""" - self.writeline(f"{frame.symbols.ref(node.target)} = ", node) - if frame.toplevel: - self.write(f"context.vars[{node.target!r}] = ") - - self._import_common(node, frame) - - if frame.toplevel and not node.target.startswith("_"): - self.writeline(f"context.exported_vars.discard({node.target!r})") - - def visit_FromImport(self, node: nodes.FromImport, frame: Frame) -> None: - """Visit named imports.""" - self.newline(node) - self.write("included_template = ") - self._import_common(node, frame) - var_names = [] - discarded_names = [] - for name in node.names: - if isinstance(name, tuple): - name, alias = name - else: - alias = name - self.writeline( - f"{frame.symbols.ref(alias)} =" - f" getattr(included_template, {name!r}, missing)" - ) - self.writeline(f"if {frame.symbols.ref(alias)} is missing:") - self.indent() - # The position will contain the template name, and will be formatted - # into a string that will be compiled into an f-string. Curly braces - # in the name must be replaced with escapes so that they will not be - # executed as part of the f-string. - position = self.position(node).replace("{", "{{").replace("}", "}}") - message = ( - "the template {included_template.__name__!r}" - f" (imported on {position})" - f" does not export the requested name {name!r}" - ) - self.writeline( - f"{frame.symbols.ref(alias)} = undefined(f{message!r}, name={name!r})" - ) - self.outdent() - if frame.toplevel: - var_names.append(alias) - if not alias.startswith("_"): - discarded_names.append(alias) - - if var_names: - if len(var_names) == 1: - name = var_names[0] - self.writeline(f"context.vars[{name!r}] = {frame.symbols.ref(name)}") - else: - names_kv = ", ".join( - f"{name!r}: {frame.symbols.ref(name)}" for name in var_names - ) - self.writeline(f"context.vars.update({{{names_kv}}})") - if discarded_names: - if len(discarded_names) == 1: - self.writeline(f"context.exported_vars.discard({discarded_names[0]!r})") - else: - names_str = ", ".join(map(repr, discarded_names)) - self.writeline( - f"context.exported_vars.difference_update(({names_str}))" - ) - - def visit_For(self, node: nodes.For, frame: Frame) -> None: - loop_frame = frame.inner() - loop_frame.loop_frame = True - test_frame = frame.inner() - else_frame = frame.inner() - - # try to figure out if we have an extended loop. An extended loop - # is necessary if the loop is in recursive mode if the special loop - # variable is accessed in the body if the body is a scoped block. - extended_loop = ( - node.recursive - or "loop" - in find_undeclared(node.iter_child_nodes(only=("body",)), ("loop",)) - or any(block.scoped for block in node.find_all(nodes.Block)) - ) - - loop_ref = None - if extended_loop: - loop_ref = loop_frame.symbols.declare_parameter("loop") - - loop_frame.symbols.analyze_node(node, for_branch="body") - if node.else_: - else_frame.symbols.analyze_node(node, for_branch="else") - - if node.test: - loop_filter_func = self.temporary_identifier() - test_frame.symbols.analyze_node(node, for_branch="test") - self.writeline(f"{self.func(loop_filter_func)}(fiter):", node.test) - self.indent() - self.enter_frame(test_frame) - self.writeline(self.choose_async("async for ", "for ")) - self.visit(node.target, loop_frame) - self.write(" in ") - self.write(self.choose_async("auto_aiter(fiter)", "fiter")) - self.write(":") - self.indent() - self.writeline("if ", node.test) - self.visit(node.test, test_frame) - self.write(":") - self.indent() - self.writeline("yield ") - self.visit(node.target, loop_frame) - self.outdent(3) - self.leave_frame(test_frame, with_python_scope=True) - - # if we don't have an recursive loop we have to find the shadowed - # variables at that point. Because loops can be nested but the loop - # variable is a special one we have to enforce aliasing for it. - if node.recursive: - self.writeline( - f"{self.func('loop')}(reciter, loop_render_func, depth=0):", node - ) - self.indent() - self.buffer(loop_frame) - - # Use the same buffer for the else frame - else_frame.buffer = loop_frame.buffer - - # make sure the loop variable is a special one and raise a template - # assertion error if a loop tries to write to loop - if extended_loop: - self.writeline(f"{loop_ref} = missing") - - for name in node.find_all(nodes.Name): - if name.ctx == "store" and name.name == "loop": - self.fail( - "Can't assign to special loop variable in for-loop target", - name.lineno, - ) - - if node.else_: - iteration_indicator = self.temporary_identifier() - self.writeline(f"{iteration_indicator} = 1") - - self.writeline(self.choose_async("async for ", "for "), node) - self.visit(node.target, loop_frame) - if extended_loop: - self.write(f", {loop_ref} in {self.choose_async('Async')}LoopContext(") - else: - self.write(" in ") - - if node.test: - self.write(f"{loop_filter_func}(") - if node.recursive: - self.write("reciter") - else: - if self.environment.is_async and not extended_loop: - self.write("auto_aiter(") - self.visit(node.iter, frame) - if self.environment.is_async and not extended_loop: - self.write(")") - if node.test: - self.write(")") - - if node.recursive: - self.write(", undefined, loop_render_func, depth):") - else: - self.write(", undefined):" if extended_loop else ":") - - self.indent() - self.enter_frame(loop_frame) - - self.writeline("_loop_vars = {}") - self.blockvisit(node.body, loop_frame) - if node.else_: - self.writeline(f"{iteration_indicator} = 0") - self.outdent() - self.leave_frame( - loop_frame, with_python_scope=node.recursive and not node.else_ - ) - - if node.else_: - self.writeline(f"if {iteration_indicator}:") - self.indent() - self.enter_frame(else_frame) - self.blockvisit(node.else_, else_frame) - self.leave_frame(else_frame) - self.outdent() - - # if the node was recursive we have to return the buffer contents - # and start the iteration code - if node.recursive: - self.return_buffer_contents(loop_frame) - self.outdent() - self.start_write(frame, node) - self.write(f"{self.choose_async('await ')}loop(") - if self.environment.is_async: - self.write("auto_aiter(") - self.visit(node.iter, frame) - if self.environment.is_async: - self.write(")") - self.write(", loop)") - self.end_write(frame) - - # at the end of the iteration, clear any assignments made in the - # loop from the top level - if self._assign_stack: - self._assign_stack[-1].difference_update(loop_frame.symbols.stores) - - def visit_If(self, node: nodes.If, frame: Frame) -> None: - if_frame = frame.soft() - self.writeline("if ", node) - self.visit(node.test, if_frame) - self.write(":") - self.indent() - self.blockvisit(node.body, if_frame) - self.outdent() - for elif_ in node.elif_: - self.writeline("elif ", elif_) - self.visit(elif_.test, if_frame) - self.write(":") - self.indent() - self.blockvisit(elif_.body, if_frame) - self.outdent() - if node.else_: - self.writeline("else:") - self.indent() - self.blockvisit(node.else_, if_frame) - self.outdent() - - def visit_Macro(self, node: nodes.Macro, frame: Frame) -> None: - macro_frame, macro_ref = self.macro_body(node, frame) - self.newline() - if frame.toplevel: - if not node.name.startswith("_"): - self.write(f"context.exported_vars.add({node.name!r})") - self.writeline(f"context.vars[{node.name!r}] = ") - self.write(f"{frame.symbols.ref(node.name)} = ") - self.macro_def(macro_ref, macro_frame) - - def visit_CallBlock(self, node: nodes.CallBlock, frame: Frame) -> None: - call_frame, macro_ref = self.macro_body(node, frame) - self.writeline("caller = ") - self.macro_def(macro_ref, call_frame) - self.start_write(frame, node) - self.visit_Call(node.call, frame, forward_caller=True) - self.end_write(frame) - - def visit_FilterBlock(self, node: nodes.FilterBlock, frame: Frame) -> None: - filter_frame = frame.inner() - filter_frame.symbols.analyze_node(node) - self.enter_frame(filter_frame) - self.buffer(filter_frame) - self.blockvisit(node.body, filter_frame) - self.start_write(frame, node) - self.visit_Filter(node.filter, filter_frame) - self.end_write(frame) - self.leave_frame(filter_frame) - - def visit_With(self, node: nodes.With, frame: Frame) -> None: - with_frame = frame.inner() - with_frame.symbols.analyze_node(node) - self.enter_frame(with_frame) - for target, expr in zip(node.targets, node.values): - self.newline() - self.visit(target, with_frame) - self.write(" = ") - self.visit(expr, frame) - self.blockvisit(node.body, with_frame) - self.leave_frame(with_frame) - - def visit_ExprStmt(self, node: nodes.ExprStmt, frame: Frame) -> None: - self.newline(node) - self.visit(node.node, frame) - - class _FinalizeInfo(t.NamedTuple): - const: t.Optional[t.Callable[..., str]] - src: t.Optional[str] - - @staticmethod - def _default_finalize(value: t.Any) -> t.Any: - """The default finalize function if the environment isn't - configured with one. Or, if the environment has one, this is - called on that function's output for constants. - """ - return str(value) - - _finalize: t.Optional[_FinalizeInfo] = None - - def _make_finalize(self) -> _FinalizeInfo: - """Build the finalize function to be used on constants and at - runtime. Cached so it's only created once for all output nodes. - - Returns a ``namedtuple`` with the following attributes: - - ``const`` - A function to finalize constant data at compile time. - - ``src`` - Source code to output around nodes to be evaluated at - runtime. - """ - if self._finalize is not None: - return self._finalize - - finalize: t.Optional[t.Callable[..., t.Any]] - finalize = default = self._default_finalize - src = None - - if self.environment.finalize: - src = "environment.finalize(" - env_finalize = self.environment.finalize - pass_arg = { - _PassArg.context: "context", - _PassArg.eval_context: "context.eval_ctx", - _PassArg.environment: "environment", - }.get( - _PassArg.from_obj(env_finalize) # type: ignore - ) - finalize = None - - if pass_arg is None: - - def finalize(value: t.Any) -> t.Any: # noqa: F811 - return default(env_finalize(value)) - - else: - src = f"{src}{pass_arg}, " - - if pass_arg == "environment": - - def finalize(value: t.Any) -> t.Any: # noqa: F811 - return default(env_finalize(self.environment, value)) - - self._finalize = self._FinalizeInfo(finalize, src) - return self._finalize - - def _output_const_repr(self, group: t.Iterable[t.Any]) -> str: - """Given a group of constant values converted from ``Output`` - child nodes, produce a string to write to the template module - source. - """ - return repr(concat(group)) - - def _output_child_to_const( - self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo - ) -> str: - """Try to optimize a child of an ``Output`` node by trying to - convert it to constant, finalized data at compile time. - - If :exc:`Impossible` is raised, the node is not constant and - will be evaluated at runtime. Any other exception will also be - evaluated at runtime for easier debugging. - """ - const = node.as_const(frame.eval_ctx) - - if frame.eval_ctx.autoescape: - const = escape(const) - - # Template data doesn't go through finalize. - if isinstance(node, nodes.TemplateData): - return str(const) - - return finalize.const(const) # type: ignore - - def _output_child_pre( - self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo - ) -> None: - """Output extra source code before visiting a child of an - ``Output`` node. - """ - if frame.eval_ctx.volatile: - self.write("(escape if context.eval_ctx.autoescape else str)(") - elif frame.eval_ctx.autoescape: - self.write("escape(") - else: - self.write("str(") - - if finalize.src is not None: - self.write(finalize.src) - - def _output_child_post( - self, node: nodes.Expr, frame: Frame, finalize: _FinalizeInfo - ) -> None: - """Output extra source code after visiting a child of an - ``Output`` node. - """ - self.write(")") - - if finalize.src is not None: - self.write(")") - - def visit_Output(self, node: nodes.Output, frame: Frame) -> None: - # If an extends is active, don't render outside a block. - if frame.require_output_check: - # A top-level extends is known to exist at compile time. - if self.has_known_extends: - return - - self.writeline("if parent_template is None:") - self.indent() - - finalize = self._make_finalize() - body: t.List[t.Union[t.List[t.Any], nodes.Expr]] = [] - - # Evaluate constants at compile time if possible. Each item in - # body will be either a list of static data or a node to be - # evaluated at runtime. - for child in node.nodes: - try: - if not ( - # If the finalize function requires runtime context, - # constants can't be evaluated at compile time. - finalize.const - # Unless it's basic template data that won't be - # finalized anyway. - or isinstance(child, nodes.TemplateData) - ): - raise nodes.Impossible() - - const = self._output_child_to_const(child, frame, finalize) - except (nodes.Impossible, Exception): - # The node was not constant and needs to be evaluated at - # runtime. Or another error was raised, which is easier - # to debug at runtime. - body.append(child) - continue - - if body and isinstance(body[-1], list): - body[-1].append(const) - else: - body.append([const]) - - if frame.buffer is not None: - if len(body) == 1: - self.writeline(f"{frame.buffer}.append(") - else: - self.writeline(f"{frame.buffer}.extend((") - - self.indent() - - for item in body: - if isinstance(item, list): - # A group of constant data to join and output. - val = self._output_const_repr(item) - - if frame.buffer is None: - self.writeline("yield " + val) - else: - self.writeline(val + ",") - else: - if frame.buffer is None: - self.writeline("yield ", item) - else: - self.newline(item) - - # A node to be evaluated at runtime. - self._output_child_pre(item, frame, finalize) - self.visit(item, frame) - self._output_child_post(item, frame, finalize) - - if frame.buffer is not None: - self.write(",") - - if frame.buffer is not None: - self.outdent() - self.writeline(")" if len(body) == 1 else "))") - - if frame.require_output_check: - self.outdent() - - def visit_Assign(self, node: nodes.Assign, frame: Frame) -> None: - self.push_assign_tracking() - - # ``a.b`` is allowed for assignment, and is parsed as an NSRef. However, - # it is only valid if it references a Namespace object. Emit a check for - # that for each ref here, before assignment code is emitted. This can't - # be done in visit_NSRef as the ref could be in the middle of a tuple. - seen_refs: t.Set[str] = set() - - for nsref in node.find_all(nodes.NSRef): - if nsref.name in seen_refs: - # Only emit the check for each reference once, in case the same - # ref is used multiple times in a tuple, `ns.a, ns.b = c, d`. - continue - - seen_refs.add(nsref.name) - ref = frame.symbols.ref(nsref.name) - self.writeline(f"if not isinstance({ref}, Namespace):") - self.indent() - self.writeline( - "raise TemplateRuntimeError" - '("cannot assign attribute on non-namespace object")' - ) - self.outdent() - - self.newline(node) - self.visit(node.target, frame) - self.write(" = ") - self.visit(node.node, frame) - self.pop_assign_tracking(frame) - - def visit_AssignBlock(self, node: nodes.AssignBlock, frame: Frame) -> None: - self.push_assign_tracking() - block_frame = frame.inner() - # This is a special case. Since a set block always captures we - # will disable output checks. This way one can use set blocks - # toplevel even in extended templates. - block_frame.require_output_check = False - block_frame.symbols.analyze_node(node) - self.enter_frame(block_frame) - self.buffer(block_frame) - self.blockvisit(node.body, block_frame) - self.newline(node) - self.visit(node.target, frame) - self.write(" = (Markup if context.eval_ctx.autoescape else identity)(") - if node.filter is not None: - self.visit_Filter(node.filter, block_frame) - else: - self.write(f"concat({block_frame.buffer})") - self.write(")") - self.pop_assign_tracking(frame) - self.leave_frame(block_frame) - - # -- Expression Visitors - - def visit_Name(self, node: nodes.Name, frame: Frame) -> None: - if node.ctx == "store" and ( - frame.toplevel or frame.loop_frame or frame.block_frame - ): - if self._assign_stack: - self._assign_stack[-1].add(node.name) - ref = frame.symbols.ref(node.name) - - # If we are looking up a variable we might have to deal with the - # case where it's undefined. We can skip that case if the load - # instruction indicates a parameter which are always defined. - if node.ctx == "load": - load = frame.symbols.find_load(ref) - if not ( - load is not None - and load[0] == VAR_LOAD_PARAMETER - and not self.parameter_is_undeclared(ref) - ): - self.write( - f"(undefined(name={node.name!r}) if {ref} is missing else {ref})" - ) - return - - self.write(ref) - - def visit_NSRef(self, node: nodes.NSRef, frame: Frame) -> None: - # NSRef is a dotted assignment target a.b=c, but uses a[b]=c internally. - # visit_Assign emits code to validate that each ref is to a Namespace - # object only. That can't be emitted here as the ref could be in the - # middle of a tuple assignment. - ref = frame.symbols.ref(node.name) - self.writeline(f"{ref}[{node.attr!r}]") - - def visit_Const(self, node: nodes.Const, frame: Frame) -> None: - val = node.as_const(frame.eval_ctx) - if isinstance(val, float): - self.write(str(val)) - else: - self.write(repr(val)) - - def visit_TemplateData(self, node: nodes.TemplateData, frame: Frame) -> None: - try: - self.write(repr(node.as_const(frame.eval_ctx))) - except nodes.Impossible: - self.write( - f"(Markup if context.eval_ctx.autoescape else identity)({node.data!r})" - ) - - def visit_Tuple(self, node: nodes.Tuple, frame: Frame) -> None: - self.write("(") - idx = -1 - for idx, item in enumerate(node.items): - if idx: - self.write(", ") - self.visit(item, frame) - self.write(",)" if idx == 0 else ")") - - def visit_List(self, node: nodes.List, frame: Frame) -> None: - self.write("[") - for idx, item in enumerate(node.items): - if idx: - self.write(", ") - self.visit(item, frame) - self.write("]") - - def visit_Dict(self, node: nodes.Dict, frame: Frame) -> None: - self.write("{") - for idx, item in enumerate(node.items): - if idx: - self.write(", ") - self.visit(item.key, frame) - self.write(": ") - self.visit(item.value, frame) - self.write("}") - - visit_Add = _make_binop("+") - visit_Sub = _make_binop("-") - visit_Mul = _make_binop("*") - visit_Div = _make_binop("/") - visit_FloorDiv = _make_binop("//") - visit_Pow = _make_binop("**") - visit_Mod = _make_binop("%") - visit_And = _make_binop("and") - visit_Or = _make_binop("or") - visit_Pos = _make_unop("+") - visit_Neg = _make_unop("-") - visit_Not = _make_unop("not ") - - @optimizeconst - def visit_Concat(self, node: nodes.Concat, frame: Frame) -> None: - if frame.eval_ctx.volatile: - func_name = "(markup_join if context.eval_ctx.volatile else str_join)" - elif frame.eval_ctx.autoescape: - func_name = "markup_join" - else: - func_name = "str_join" - self.write(f"{func_name}((") - for arg in node.nodes: - self.visit(arg, frame) - self.write(", ") - self.write("))") - - @optimizeconst - def visit_Compare(self, node: nodes.Compare, frame: Frame) -> None: - self.write("(") - self.visit(node.expr, frame) - for op in node.ops: - self.visit(op, frame) - self.write(")") - - def visit_Operand(self, node: nodes.Operand, frame: Frame) -> None: - self.write(f" {operators[node.op]} ") - self.visit(node.expr, frame) - - @optimizeconst - def visit_Getattr(self, node: nodes.Getattr, frame: Frame) -> None: - if self.environment.is_async: - self.write("(await auto_await(") - - self.write("environment.getattr(") - self.visit(node.node, frame) - self.write(f", {node.attr!r})") - - if self.environment.is_async: - self.write("))") - - @optimizeconst - def visit_Getitem(self, node: nodes.Getitem, frame: Frame) -> None: - # slices bypass the environment getitem method. - if isinstance(node.arg, nodes.Slice): - self.visit(node.node, frame) - self.write("[") - self.visit(node.arg, frame) - self.write("]") - else: - if self.environment.is_async: - self.write("(await auto_await(") - - self.write("environment.getitem(") - self.visit(node.node, frame) - self.write(", ") - self.visit(node.arg, frame) - self.write(")") - - if self.environment.is_async: - self.write("))") - - def visit_Slice(self, node: nodes.Slice, frame: Frame) -> None: - if node.start is not None: - self.visit(node.start, frame) - self.write(":") - if node.stop is not None: - self.visit(node.stop, frame) - if node.step is not None: - self.write(":") - self.visit(node.step, frame) - - @contextmanager - def _filter_test_common( - self, node: t.Union[nodes.Filter, nodes.Test], frame: Frame, is_filter: bool - ) -> t.Iterator[None]: - if self.environment.is_async: - self.write("(await auto_await(") - - if is_filter: - self.write(f"{self.filters[node.name]}(") - func = self.environment.filters.get(node.name) - else: - self.write(f"{self.tests[node.name]}(") - func = self.environment.tests.get(node.name) - - # When inside an If or CondExpr frame, allow the filter to be - # undefined at compile time and only raise an error if it's - # actually called at runtime. See pull_dependencies. - if func is None and not frame.soft_frame: - type_name = "filter" if is_filter else "test" - self.fail(f"No {type_name} named {node.name!r}.", node.lineno) - - pass_arg = { - _PassArg.context: "context", - _PassArg.eval_context: "context.eval_ctx", - _PassArg.environment: "environment", - }.get( - _PassArg.from_obj(func) # type: ignore - ) - - if pass_arg is not None: - self.write(f"{pass_arg}, ") - - # Back to the visitor function to handle visiting the target of - # the filter or test. - yield - - self.signature(node, frame) - self.write(")") - - if self.environment.is_async: - self.write("))") - - @optimizeconst - def visit_Filter(self, node: nodes.Filter, frame: Frame) -> None: - with self._filter_test_common(node, frame, True): - # if the filter node is None we are inside a filter block - # and want to write to the current buffer - if node.node is not None: - self.visit(node.node, frame) - elif frame.eval_ctx.volatile: - self.write( - f"(Markup(concat({frame.buffer}))" - f" if context.eval_ctx.autoescape else concat({frame.buffer}))" - ) - elif frame.eval_ctx.autoescape: - self.write(f"Markup(concat({frame.buffer}))") - else: - self.write(f"concat({frame.buffer})") - - @optimizeconst - def visit_Test(self, node: nodes.Test, frame: Frame) -> None: - with self._filter_test_common(node, frame, False): - self.visit(node.node, frame) - - @optimizeconst - def visit_CondExpr(self, node: nodes.CondExpr, frame: Frame) -> None: - frame = frame.soft() - - def write_expr2() -> None: - if node.expr2 is not None: - self.visit(node.expr2, frame) - return - - self.write( - f'cond_expr_undefined("the inline if-expression on' - f" {self.position(node)} evaluated to false and no else" - f' section was defined.")' - ) - - self.write("(") - self.visit(node.expr1, frame) - self.write(" if ") - self.visit(node.test, frame) - self.write(" else ") - write_expr2() - self.write(")") - - @optimizeconst - def visit_Call( - self, node: nodes.Call, frame: Frame, forward_caller: bool = False - ) -> None: - if self.environment.is_async: - self.write("(await auto_await(") - if self.environment.sandboxed: - self.write("environment.call(context, ") - else: - self.write("context.call(") - self.visit(node.node, frame) - extra_kwargs = {"caller": "caller"} if forward_caller else None - loop_kwargs = {"_loop_vars": "_loop_vars"} if frame.loop_frame else {} - block_kwargs = {"_block_vars": "_block_vars"} if frame.block_frame else {} - if extra_kwargs: - extra_kwargs.update(loop_kwargs, **block_kwargs) - elif loop_kwargs or block_kwargs: - extra_kwargs = dict(loop_kwargs, **block_kwargs) - self.signature(node, frame, extra_kwargs) - self.write(")") - if self.environment.is_async: - self.write("))") - - def visit_Keyword(self, node: nodes.Keyword, frame: Frame) -> None: - self.write(node.key + "=") - self.visit(node.value, frame) - - # -- Unused nodes for extensions - - def visit_MarkSafe(self, node: nodes.MarkSafe, frame: Frame) -> None: - self.write("Markup(") - self.visit(node.expr, frame) - self.write(")") - - def visit_MarkSafeIfAutoescape( - self, node: nodes.MarkSafeIfAutoescape, frame: Frame - ) -> None: - self.write("(Markup if context.eval_ctx.autoescape else identity)(") - self.visit(node.expr, frame) - self.write(")") - - def visit_EnvironmentAttribute( - self, node: nodes.EnvironmentAttribute, frame: Frame - ) -> None: - self.write("environment." + node.name) - - def visit_ExtensionAttribute( - self, node: nodes.ExtensionAttribute, frame: Frame - ) -> None: - self.write(f"environment.extensions[{node.identifier!r}].{node.name}") - - def visit_ImportedName(self, node: nodes.ImportedName, frame: Frame) -> None: - self.write(self.import_aliases[node.importname]) - - def visit_InternalName(self, node: nodes.InternalName, frame: Frame) -> None: - self.write(node.name) - - def visit_ContextReference( - self, node: nodes.ContextReference, frame: Frame - ) -> None: - self.write("context") - - def visit_DerivedContextReference( - self, node: nodes.DerivedContextReference, frame: Frame - ) -> None: - self.write(self.derive_context(frame)) - - def visit_Continue(self, node: nodes.Continue, frame: Frame) -> None: - self.writeline("continue", node) - - def visit_Break(self, node: nodes.Break, frame: Frame) -> None: - self.writeline("break", node) - - def visit_Scope(self, node: nodes.Scope, frame: Frame) -> None: - scope_frame = frame.inner() - scope_frame.symbols.analyze_node(node) - self.enter_frame(scope_frame) - self.blockvisit(node.body, scope_frame) - self.leave_frame(scope_frame) - - def visit_OverlayScope(self, node: nodes.OverlayScope, frame: Frame) -> None: - ctx = self.temporary_identifier() - self.writeline(f"{ctx} = {self.derive_context(frame)}") - self.writeline(f"{ctx}.vars = ") - self.visit(node.context, frame) - self.push_context_reference(ctx) - - scope_frame = frame.inner(isolated=True) - scope_frame.symbols.analyze_node(node) - self.enter_frame(scope_frame) - self.blockvisit(node.body, scope_frame) - self.leave_frame(scope_frame) - self.pop_context_reference() - - def visit_EvalContextModifier( - self, node: nodes.EvalContextModifier, frame: Frame - ) -> None: - for keyword in node.options: - self.writeline(f"context.eval_ctx.{keyword.key} = ") - self.visit(keyword.value, frame) - try: - val = keyword.value.as_const(frame.eval_ctx) - except nodes.Impossible: - frame.eval_ctx.volatile = True - else: - setattr(frame.eval_ctx, keyword.key, val) - - def visit_ScopedEvalContextModifier( - self, node: nodes.ScopedEvalContextModifier, frame: Frame - ) -> None: - old_ctx_name = self.temporary_identifier() - saved_ctx = frame.eval_ctx.save() - self.writeline(f"{old_ctx_name} = context.eval_ctx.save()") - self.visit_EvalContextModifier(node, frame) - for child in node.body: - self.visit(child, frame) - frame.eval_ctx.revert(saved_ctx) - self.writeline(f"context.eval_ctx.revert({old_ctx_name})") diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/constants.py b/write-message/venv/lib/python3.10/site-packages/jinja2/constants.py deleted file mode 100644 index 41a1c23..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/constants.py +++ /dev/null @@ -1,20 +0,0 @@ -#: list of lorem ipsum words used by the lipsum() helper function -LOREM_IPSUM_WORDS = """\ -a ac accumsan ad adipiscing aenean aliquam aliquet amet ante aptent arcu at -auctor augue bibendum blandit class commodo condimentum congue consectetuer -consequat conubia convallis cras cubilia cum curabitur curae cursus dapibus -diam dictum dictumst dignissim dis dolor donec dui duis egestas eget eleifend -elementum elit enim erat eros est et etiam eu euismod facilisi facilisis fames -faucibus felis fermentum feugiat fringilla fusce gravida habitant habitasse hac -hendrerit hymenaeos iaculis id imperdiet in inceptos integer interdum ipsum -justo lacinia lacus laoreet lectus leo libero ligula litora lobortis lorem -luctus maecenas magna magnis malesuada massa mattis mauris metus mi molestie -mollis montes morbi mus nam nascetur natoque nec neque netus nibh nisi nisl non -nonummy nostra nulla nullam nunc odio orci ornare parturient pede pellentesque -penatibus per pharetra phasellus placerat platea porta porttitor posuere -potenti praesent pretium primis proin pulvinar purus quam quis quisque rhoncus -ridiculus risus rutrum sagittis sapien scelerisque sed sem semper senectus sit -sociis sociosqu sodales sollicitudin suscipit suspendisse taciti tellus tempor -tempus tincidunt torquent tortor tristique turpis ullamcorper ultrices -ultricies urna ut varius vehicula vel velit venenatis vestibulum vitae vivamus -viverra volutpat vulputate""" diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/debug.py b/write-message/venv/lib/python3.10/site-packages/jinja2/debug.py deleted file mode 100644 index eeeeee7..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/debug.py +++ /dev/null @@ -1,191 +0,0 @@ -import sys -import typing as t -from types import CodeType -from types import TracebackType - -from .exceptions import TemplateSyntaxError -from .utils import internal_code -from .utils import missing - -if t.TYPE_CHECKING: - from .runtime import Context - - -def rewrite_traceback_stack(source: t.Optional[str] = None) -> BaseException: - """Rewrite the current exception to replace any tracebacks from - within compiled template code with tracebacks that look like they - came from the template source. - - This must be called within an ``except`` block. - - :param source: For ``TemplateSyntaxError``, the original source if - known. - :return: The original exception with the rewritten traceback. - """ - _, exc_value, tb = sys.exc_info() - exc_value = t.cast(BaseException, exc_value) - tb = t.cast(TracebackType, tb) - - if isinstance(exc_value, TemplateSyntaxError) and not exc_value.translated: - exc_value.translated = True - exc_value.source = source - # Remove the old traceback, otherwise the frames from the - # compiler still show up. - exc_value.with_traceback(None) - # Outside of runtime, so the frame isn't executing template - # code, but it still needs to point at the template. - tb = fake_traceback( - exc_value, None, exc_value.filename or "", exc_value.lineno - ) - else: - # Skip the frame for the render function. - tb = tb.tb_next - - stack = [] - - # Build the stack of traceback object, replacing any in template - # code with the source file and line information. - while tb is not None: - # Skip frames decorated with @internalcode. These are internal - # calls that aren't useful in template debugging output. - if tb.tb_frame.f_code in internal_code: - tb = tb.tb_next - continue - - template = tb.tb_frame.f_globals.get("__jinja_template__") - - if template is not None: - lineno = template.get_corresponding_lineno(tb.tb_lineno) - fake_tb = fake_traceback(exc_value, tb, template.filename, lineno) - stack.append(fake_tb) - else: - stack.append(tb) - - tb = tb.tb_next - - tb_next = None - - # Assign tb_next in reverse to avoid circular references. - for tb in reversed(stack): - tb.tb_next = tb_next - tb_next = tb - - return exc_value.with_traceback(tb_next) - - -def fake_traceback( # type: ignore - exc_value: BaseException, tb: t.Optional[TracebackType], filename: str, lineno: int -) -> TracebackType: - """Produce a new traceback object that looks like it came from the - template source instead of the compiled code. The filename, line - number, and location name will point to the template, and the local - variables will be the current template context. - - :param exc_value: The original exception to be re-raised to create - the new traceback. - :param tb: The original traceback to get the local variables and - code info from. - :param filename: The template filename. - :param lineno: The line number in the template source. - """ - if tb is not None: - # Replace the real locals with the context that would be - # available at that point in the template. - locals = get_template_locals(tb.tb_frame.f_locals) - locals.pop("__jinja_exception__", None) - else: - locals = {} - - globals = { - "__name__": filename, - "__file__": filename, - "__jinja_exception__": exc_value, - } - # Raise an exception at the correct line number. - code: CodeType = compile( - "\n" * (lineno - 1) + "raise __jinja_exception__", filename, "exec" - ) - - # Build a new code object that points to the template file and - # replaces the location with a block name. - location = "template" - - if tb is not None: - function = tb.tb_frame.f_code.co_name - - if function == "root": - location = "top-level template code" - elif function.startswith("block_"): - location = f"block {function[6:]!r}" - - if sys.version_info >= (3, 8): - code = code.replace(co_name=location) - else: - code = CodeType( - code.co_argcount, - code.co_kwonlyargcount, - code.co_nlocals, - code.co_stacksize, - code.co_flags, - code.co_code, - code.co_consts, - code.co_names, - code.co_varnames, - code.co_filename, - location, - code.co_firstlineno, - code.co_lnotab, - code.co_freevars, - code.co_cellvars, - ) - - # Execute the new code, which is guaranteed to raise, and return - # the new traceback without this frame. - try: - exec(code, globals, locals) - except BaseException: - return sys.exc_info()[2].tb_next # type: ignore - - -def get_template_locals(real_locals: t.Mapping[str, t.Any]) -> t.Dict[str, t.Any]: - """Based on the runtime locals, get the context that would be - available at that point in the template. - """ - # Start with the current template context. - ctx: t.Optional[Context] = real_locals.get("context") - - if ctx is not None: - data: t.Dict[str, t.Any] = ctx.get_all().copy() - else: - data = {} - - # Might be in a derived context that only sets local variables - # rather than pushing a context. Local variables follow the scheme - # l_depth_name. Find the highest-depth local that has a value for - # each name. - local_overrides: t.Dict[str, t.Tuple[int, t.Any]] = {} - - for name, value in real_locals.items(): - if not name.startswith("l_") or value is missing: - # Not a template variable, or no longer relevant. - continue - - try: - _, depth_str, name = name.split("_", 2) - depth = int(depth_str) - except ValueError: - continue - - cur_depth = local_overrides.get(name, (-1,))[0] - - if cur_depth < depth: - local_overrides[name] = (depth, value) - - # Modify the context with any derived context. - for name, (_, value) in local_overrides.items(): - if value is missing: - data.pop(name, None) - else: - data[name] = value - - return data diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/defaults.py b/write-message/venv/lib/python3.10/site-packages/jinja2/defaults.py deleted file mode 100644 index 638cad3..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/defaults.py +++ /dev/null @@ -1,48 +0,0 @@ -import typing as t - -from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401 -from .tests import TESTS as DEFAULT_TESTS # noqa: F401 -from .utils import Cycler -from .utils import generate_lorem_ipsum -from .utils import Joiner -from .utils import Namespace - -if t.TYPE_CHECKING: - import typing_extensions as te - -# defaults for the parser / lexer -BLOCK_START_STRING = "{%" -BLOCK_END_STRING = "%}" -VARIABLE_START_STRING = "{{" -VARIABLE_END_STRING = "}}" -COMMENT_START_STRING = "{#" -COMMENT_END_STRING = "#}" -LINE_STATEMENT_PREFIX: t.Optional[str] = None -LINE_COMMENT_PREFIX: t.Optional[str] = None -TRIM_BLOCKS = False -LSTRIP_BLOCKS = False -NEWLINE_SEQUENCE: "te.Literal['\\n', '\\r\\n', '\\r']" = "\n" -KEEP_TRAILING_NEWLINE = False - -# default filters, tests and namespace - -DEFAULT_NAMESPACE = { - "range": range, - "dict": dict, - "lipsum": generate_lorem_ipsum, - "cycler": Cycler, - "joiner": Joiner, - "namespace": Namespace, -} - -# default policies -DEFAULT_POLICIES: t.Dict[str, t.Any] = { - "compiler.ascii_str": True, - "urlize.rel": "noopener", - "urlize.target": None, - "urlize.extra_schemes": None, - "truncate.leeway": 5, - "json.dumps_function": None, - "json.dumps_kwargs": {"sort_keys": True}, - "ext.i18n.trimmed": False, -} diff --git a/write-message/venv/lib/python3.10/site-packages/jinja2/environment.py b/write-message/venv/lib/python3.10/site-packages/jinja2/environment.py deleted file mode 100644 index 0fc6e5b..0000000 --- a/write-message/venv/lib/python3.10/site-packages/jinja2/environment.py +++ /dev/null @@ -1,1672 +0,0 @@ -"""Classes for managing templates and their runtime and compile time -options. -""" - -import os -import typing -import typing as t -import weakref -from collections import ChainMap -from functools import lru_cache -from functools import partial -from functools import reduce -from types import CodeType - -from markupsafe import Markup - -from . import nodes -from .compiler import CodeGenerator -from .compiler import generate -from .defaults import BLOCK_END_STRING -from .defaults import BLOCK_START_STRING -from .defaults import COMMENT_END_STRING -from .defaults import COMMENT_START_STRING -from .defaults import DEFAULT_FILTERS # type: ignore[attr-defined] -from .defaults import DEFAULT_NAMESPACE -from .defaults import DEFAULT_POLICIES -from .defaults import DEFAULT_TESTS # type: ignore[attr-defined] -from .defaults import KEEP_TRAILING_NEWLINE -from .defaults import LINE_COMMENT_PREFIX -from .defaults import LINE_STATEMENT_PREFIX -from .defaults import LSTRIP_BLOCKS -from .defaults import NEWLINE_SEQUENCE -from .defaults import TRIM_BLOCKS -from .defaults import VARIABLE_END_STRING -from .defaults import VARIABLE_START_STRING -from .exceptions import TemplateNotFound -from .exceptions import TemplateRuntimeError -from .exceptions import TemplatesNotFound -from .exceptions import TemplateSyntaxError -from .exceptions import UndefinedError -from .lexer import get_lexer -from .lexer import Lexer -from .lexer import TokenStream -from .nodes import EvalContext -from .parser import Parser -from .runtime import Context -from .runtime import new_context -from .runtime import Undefined -from .utils import _PassArg -from .utils import concat -from .utils import consume -from .utils import import_string -from .utils import internalcode -from .utils import LRUCache -from .utils import missing - -if t.TYPE_CHECKING: - import typing_extensions as te - - from .bccache import BytecodeCache - from .ext import Extension - from .loaders import BaseLoader - -_env_bound = t.TypeVar("_env_bound", bound="Environment") - - -# for direct template usage we have up to ten living environments -@lru_cache(maxsize=10) -def get_spontaneous_environment(cls: t.Type[_env_bound], *args: t.Any) -> _env_bound: - """Return a new spontaneous environment. A spontaneous environment - is used for templates created directly rather than through an - existing environment. - - :param cls: Environment class to create. - :param args: Positional arguments passed to environment. - """ - env = cls(*args) - env.shared = True - return env - - -def create_cache( - size: int, -) -> t.Optional[t.MutableMapping[t.Tuple["weakref.ref[t.Any]", str], "Template"]]: - """Return the cache class for the given size.""" - if size == 0: - return None - - if size < 0: - return {} - - return LRUCache(size) # type: ignore - - -def copy_cache( - cache: t.Optional[t.MutableMapping[t.Any, t.Any]], -) -> t.Optional[t.MutableMapping[t.Tuple["weakref.ref[t.Any]", str], "Template"]]: - """Create an empty copy of the given cache.""" - if cache is None: - return None - - if type(cache) is dict: # noqa E721 - return {} - - return LRUCache(cache.capacity) # type: ignore - - -def load_extensions( - environment: "Environment", - extensions: t.Sequence[t.Union[str, t.Type["Extension"]]], -) -> t.Dict[str, "Extension"]: - """Load the extensions from the list and bind it to the environment. - Returns a dict of instantiated extensions. - """ - result = {} - - for extension in extensions: - if isinstance(extension, str): - extension = t.cast(t.Type["Extension"], import_string(extension)) - - result[extension.identifier] = extension(environment) - - return result - - -def _environment_config_check(environment: _env_bound) -> _env_bound: - """Perform a sanity check on the environment.""" - assert issubclass( - environment.undefined, Undefined - ), "'undefined' must be a subclass of 'jinja2.Undefined'." - assert ( - environment.block_start_string - != environment.variable_start_string - != environment.comment_start_string - ), "block, variable and comment start strings must be different." - assert environment.newline_sequence in { - "\r", - "\r\n", - "\n", - }, "'newline_sequence' must be one of '\\n', '\\r\\n', or '\\r'." - return environment - - -class Environment: - r"""The core component of Jinja is the `Environment`. It contains - important shared variables like configuration, filters, tests, - globals and others. Instances of this class may be modified if - they are not shared and if no template was loaded so far. - Modifications on environments after the first template was loaded - will lead to surprising effects and undefined behavior. - - Here are the possible initialization parameters: - - `block_start_string` - The string marking the beginning of a block. Defaults to ``'{%'``. - - `block_end_string` - The string marking the end of a block. Defaults to ``'%}'``. - - `variable_start_string` - The string marking the beginning of a print statement. - Defaults to ``'{{'``. - - `variable_end_string` - The string marking the end of a print statement. Defaults to - ``'}}'``. - - `comment_start_string` - The string marking the beginning of a comment. Defaults to ``'{#'``. - - `comment_end_string` - The string marking the end of a comment. Defaults to ``'#}'``. - - `line_statement_prefix` - If given and a string, this will be used as prefix for line based - statements. See also :ref:`line-statements`. - - `line_comment_prefix` - If given and a string, this will be used as prefix for line based - comments. See also :ref:`line-statements`. - - .. versionadded:: 2.2 - - `trim_blocks` - If this is set to ``True`` the first newline after a block is - removed (block, not variable tag!). Defaults to `False`. - - `lstrip_blocks` - If this is set to ``True`` leading spaces and tabs are stripped - from the start of a line to a block. Defaults to `False`. - - `newline_sequence` - The sequence that starts a newline. Must be one of ``'\r'``, - ``'\n'`` or ``'\r\n'``. The default is ``'\n'`` which is a - useful default for Linux and OS X systems as well as web - applications. - - `keep_trailing_newline` - Preserve the trailing newline when rendering templates. - The default is ``False``, which causes a single newline, - if present, to be stripped from the end of the template. - - .. versionadded:: 2.7 - - `extensions` - List of Jinja extensions to use. This can either be import paths - as strings or extension classes. For more information have a - look at :ref:`the extensions documentation `. - - `optimized` - should the optimizer be enabled? Default is ``True``. - - `undefined` - :class:`Undefined` or a subclass of it that is used to represent - undefined values in the template. - - `finalize` - A callable that can be used to process the result of a variable - expression before it is output. For example one can convert - ``None`` implicitly into an empty string here. - - `autoescape` - If set to ``True`` the XML/HTML autoescaping feature is enabled by - default. For more details about autoescaping see - :class:`~markupsafe.Markup`. As of Jinja 2.4 this can also - be a callable that is passed the template name and has to - return ``True`` or ``False`` depending on autoescape should be - enabled by default. - - .. versionchanged:: 2.4 - `autoescape` can now be a function - - `loader` - The template loader for this environment. - - `cache_size` - The size of the cache. Per default this is ``400`` which means - that if more than 400 templates are loaded the loader will clean - out the least recently used template. If the cache size is set to - ``0`` templates are recompiled all the time, if the cache size is - ``-1`` the cache will not be cleaned. - - .. versionchanged:: 2.8 - The cache size was increased to 400 from a low 50. - - `auto_reload` - Some loaders load templates from locations where the template - sources may change (ie: file system or database). If - ``auto_reload`` is set to ``True`` (default) every time a template is - requested the loader checks if the source changed and if yes, it - will reload the template. For higher performance it's possible to - disable that. - - `bytecode_cache` - If set to a bytecode cache object, this object will provide a - cache for the internal Jinja bytecode so that templates don't - have to be parsed if they were not changed. - - See :ref:`bytecode-cache` for more information. - - `enable_async` - If set to true this enables async template execution which - allows using async functions and generators. - """ - - #: if this environment is sandboxed. Modifying this variable won't make - #: the environment sandboxed though. For a real sandboxed environment - #: have a look at jinja2.sandbox. This flag alone controls the code - #: generation by the compiler. - sandboxed = False - - #: True if the environment is just an overlay - overlayed = False - - #: the environment this environment is linked to if it is an overlay - linked_to: t.Optional["Environment"] = None - - #: shared environments have this set to `True`. A shared environment - #: must not be modified - shared = False - - #: the class that is used for code generation. See - #: :class:`~jinja2.compiler.CodeGenerator` for more information. - code_generator_class: t.Type["CodeGenerator"] = CodeGenerator - - concat = "".join - - #: the context class that is used for templates. See - #: :class:`~jinja2.runtime.Context` for more information. - context_class: t.Type[Context] = Context - - template_class: t.Type["Template"] - - def __init__( - self, - block_start_string: str = BLOCK_START_STRING, - block_end_string: str = BLOCK_END_STRING, - variable_start_string: str = VARIABLE_START_STRING, - variable_end_string: str = VARIABLE_END_STRING, - comment_start_string: str = COMMENT_START_STRING, - comment_end_string: str = COMMENT_END_STRING, - line_statement_prefix: t.Optional[str] = LINE_STATEMENT_PREFIX, - line_comment_prefix: t.Optional[str] = LINE_COMMENT_PREFIX, - trim_blocks: bool = TRIM_BLOCKS, - lstrip_blocks: bool = LSTRIP_BLOCKS, - newline_sequence: "te.Literal['\\n', '\\r\\n', '\\r']" = NEWLINE_SEQUENCE, - keep_trailing_newline: bool = KEEP_TRAILING_NEWLINE, - extensions: t.Sequence[t.Union[str, t.Type["Extension"]]] = (), - optimized: bool = True, - undefined: t.Type[Undefined] = Undefined, - finalize: t.Optional[t.Callable[..., t.Any]] = None, - autoescape: t.Union[bool, t.Callable[[t.Optional[str]], bool]] = False, - loader: t.Optional["BaseLoader"] = None, - cache_size: int = 400, - auto_reload: bool = True, - bytecode_cache: t.Optional["BytecodeCache"] = None, - enable_async: bool = False, - ): - # !!Important notice!! - # The constructor accepts quite a few arguments that should be - # passed by keyword rather than position. However it's important to - # not change the order of arguments because it's used at least - # internally in those cases: - # - spontaneous environments (i18n extension and Template) - # - unittests - # If parameter changes are required only add parameters at the end - # and don't change the arguments (or the defaults!) of the arguments - # existing already. - - # lexer / parser information - self.block_start_string = block_start_string - self.block_end_string = block_end_string - self.variable_start_string = variable_start_string - self.variable_end_string = variable_end_string - self.comment_start_string = comment_start_string - self.comment_end_string = comment_end_string - self.line_statement_prefix = line_statement_prefix - self.line_comment_prefix = line_comment_prefix - self.trim_blocks = trim_blocks - self.lstrip_blocks = lstrip_blocks - self.newline_sequence = newline_sequence - self.keep_trailing_newline = keep_trailing_newline - - # runtime information - self.undefined: t.Type[Undefined] = undefined - self.optimized = optimized - self.finalize = finalize - self.autoescape = autoescape - - # defaults - self.filters = DEFAULT_FILTERS.copy() - self.tests = DEFAULT_TESTS.copy() - self.globals = DEFAULT_NAMESPACE.copy() - - # set the loader provided - self.loader = loader - self.cache = create_cache(cache_size) - self.bytecode_cache = bytecode_cache - self.auto_reload = auto_reload - - # configurable policies - self.policies = DEFAULT_POLICIES.copy() - - # load extensions - self.extensions = load_extensions(self, extensions) - - self.is_async = enable_async - _environment_config_check(self) - - def add_extension(self, extension: t.Union[str, t.Type["Extension"]]) -> None: - """Adds an extension after the environment was created. - - .. versionadded:: 2.5 - """ - self.extensions.update(load_extensions(self, [extension])) - - def extend(self, **attributes: t.Any) -> None: - """Add the items to the instance of the environment if they do not exist - yet. This is used by :ref:`extensions ` to register - callbacks and configuration values without breaking inheritance. - """ - for key, value in attributes.items(): - if not hasattr(self, key): - setattr(self, key, value) - - def overlay( - self, - block_start_string: str = missing, - block_end_string: str = missing, - variable_start_string: str = missing, - variable_end_string: str = missing, - comment_start_string: str = missing, - comment_end_string: str = missing, - line_statement_prefix: t.Optional[str] = missing, - line_comment_prefix: t.Optional[str] = missing, - trim_blocks: bool = missing, - lstrip_blocks: bool = missing, - newline_sequence: "te.Literal['\\n', '\\r\\n', '\\r']" = missing, - keep_trailing_newline: bool = missing, - extensions: t.Sequence[t.Union[str, t.Type["Extension"]]] = missing, - optimized: bool = missing, - undefined: t.Type[Undefined] = missing, - finalize: t.Optional[t.Callable[..., t.Any]] = missing, - autoescape: t.Union[bool, t.Callable[[t.Optional[str]], bool]] = missing, - loader: t.Optional["BaseLoader"] = missing, - cache_size: int = missing, - auto_reload: bool = missing, - bytecode_cache: t.Optional["BytecodeCache"] = missing, - enable_async: bool = missing, - ) -> "te.Self": - """Create a new overlay environment that shares all the data with the - current environment except for cache and the overridden attributes. - Extensions cannot be removed for an overlayed environment. An overlayed - environment automatically gets all the extensions of the environment it - is linked to plus optional extra extensions. - - Creating overlays should happen after the initial environment was set - up completely. Not all attributes are truly linked, some are just - copied over so modifications on the original environment may not shine - through. - - .. versionchanged:: 3.1.5 - ``enable_async`` is applied correctly. - - .. versionchanged:: 3.1.2 - Added the ``newline_sequence``, ``keep_trailing_newline``, - and ``enable_async`` parameters to match ``__init__``. - """ - args = dict(locals()) - del args["self"], args["cache_size"], args["extensions"], args["enable_async"] - - rv = object.__new__(self.__class__) - rv.__dict__.update(self.__dict__) - rv.overlayed = True - rv.linked_to = self - - for key, value in args.items(): - if value is not missing: - setattr(rv, key, value) - - if cache_size is not missing: - rv.cache = create_cache(cache_size) - else: - rv.cache = copy_cache(self.cache) - - rv.extensions = {} - for key, value in self.extensions.items(): - rv.extensions[key] = value.bind(rv) - if extensions is not missing: - rv.extensions.update(load_extensions(rv, extensions)) - - if enable_async is not missing: - rv.is_async = enable_async - - return _environment_config_check(rv) - - @property - def lexer(self) -> Lexer: - """The lexer for this environment.""" - return get_lexer(self) - - def iter_extensions(self) -> t.Iterator["Extension"]: - """Iterates over the extensions by priority.""" - return iter(sorted(self.extensions.values(), key=lambda x: x.priority)) - - def getitem( - self, obj: t.Any, argument: t.Union[str, t.Any] - ) -> t.Union[t.Any, Undefined]: - """Get an item or attribute of an object but prefer the item.""" - try: - return obj[argument] - except (AttributeError, TypeError, LookupError): - if isinstance(argument, str): - try: - attr = str(argument) - except Exception: - pass - else: - try: - return getattr(obj, attr) - except AttributeError: - pass - return self.undefined(obj=obj, name=argument) - - def getattr(self, obj: t.Any, attribute: str) -> t.Any: - """Get an item or attribute of an object but prefer the attribute. - Unlike :meth:`getitem` the attribute *must* be a string. - """ - try: - return getattr(obj, attribute) - except AttributeError: - pass - try: - return obj[attribute] - except (TypeError, LookupError, AttributeError): - return self.undefined(obj=obj, name=attribute) - - def _filter_test_common( - self, - name: t.Union[str, Undefined], - value: t.Any, - args: t.Optional[t.Sequence[t.Any]], - kwargs: t.Optional[t.Mapping[str, t.Any]], - context: t.Optional[Context], - eval_ctx: t.Optional[EvalContext], - is_filter: bool, - ) -> t.Any: - if is_filter: - env_map = self.filters - type_name = "filter" - else: - env_map = self.tests - type_name = "test" - - func = env_map.get(name) # type: ignore - - if func is None: - msg = f"No {type_name} named {name!r}." - - if isinstance(name, Undefined): - try: - name._fail_with_undefined_error() - except Exception as e: - msg = f"{msg} ({e}; did you forget to quote the callable name?)" - - raise TemplateRuntimeError(msg) - - args = [value, *(args if args is not None else ())] - kwargs = kwargs if kwargs is not None else {} - pass_arg = _PassArg.from_obj(func) - - if pass_arg is _PassArg.context: - if context is None: - raise TemplateRuntimeError( - f"Attempted to invoke a context {type_name} without context." - ) - - args.insert(0, context) - elif pass_arg is _PassArg.eval_context: - if eval_ctx is None: - if context is not None: - eval_ctx = context.eval_ctx - else: - eval_ctx = EvalContext(self) - - args.insert(0, eval_ctx) - elif pass_arg is _PassArg.environment: - args.insert(0, self) - - return func(*args, **kwargs) - - def call_filter( - self, - name: str, - value: t.Any, - args: t.Optional[t.Sequence[t.Any]] = None, - kwargs: t.Optional[t.Mapping[str, t.Any]] = None, - context: t.Optional[Context] = None, - eval_ctx: t.Optional[EvalContext] = None, - ) -> t.Any: - """Invoke a filter on a value the same way the compiler does. - - This might return a coroutine if the filter is running from an - environment in async mode and the filter supports async - execution. It's your responsibility to await this if needed. - - .. versionadded:: 2.7 - """ - return self._filter_test_common( - name, value, args, kwargs, context, eval_ctx, True - ) - - def call_test( - self, - name: str, - value: t.Any, - args: t.Optional[t.Sequence[t.Any]] = None, - kwargs: t.Optional[t.Mapping[str, t.Any]] = None, - context: t.Optional[Context] = None, - eval_ctx: t.Optional[EvalContext] = None, - ) -> t.Any: - """Invoke a test on a value the same way the compiler does. - - This might return a coroutine if the test is running from an - environment in async mode and the test supports async execution. - It's your responsibility to await this if needed. - - .. versionchanged:: 3.0 - Tests support ``@pass_context``, etc. decorators. Added - the ``context`` and ``eval_ctx`` parameters. - - .. versionadded:: 2.7 - """ - return self._filter_test_common( - name, value, args, kwargs, context, eval_ctx, False - ) - - @internalcode - def parse( - self, - source: str, - name: t.Optional[str] = None, - filename: t.Optional[str] = None, - ) -> nodes.Template: - """Parse the sourcecode and return the abstract syntax tree. This - tree of nodes is used by the compiler to convert the template into - executable source- or bytecode. This is useful for debugging or to - extract information from templates. - - If you are :ref:`developing Jinja extensions ` - this gives you a good overview of the node tree generated. - """ - try: - return self._parse(source, name, filename) - except TemplateSyntaxError: - self.handle_exception(source=source) - - def _parse( - self, source: str, name: t.Optional[str], filename: t.Optional[str] - ) -> nodes.Template: - """Internal parsing function used by `parse` and `compile`.""" - return Parser(self, source, name, filename).parse() - - def lex( - self, - source: str, - name: t.Optional[str] = None, - filename: t.Optional[str] = None, - ) -> t.Iterator[t.Tuple[int, str, str]]: - """Lex the given sourcecode and return a generator that yields - tokens as tuples in the form ``(lineno, token_type, value)``. - This can be useful for :ref:`extension development ` - and debugging templates. - - This does not perform preprocessing. If you want the preprocessing - of the extensions to be applied you have to filter source through - the :meth:`preprocess` method. - """ - source = str(source) - try: - return self.lexer.tokeniter(source, name, filename) - except TemplateSyntaxError: - self.handle_exception(source=source) - - def preprocess( - self, - source: str, - name: t.Optional[str] = None, - filename: t.Optional[str] = None, - ) -> str: - """Preprocesses the source with all extensions. This is automatically - called for all parsing and compiling methods but *not* for :meth:`lex` - because there you usually only want the actual source tokenized. - """ - return reduce( - lambda s, e: e.preprocess(s, name, filename), - self.iter_extensions(), - str(source), - ) - - def _tokenize( - self, - source: str, - name: t.Optional[str], - filename: t.Optional[str] = None, - state: t.Optional[str] = None, - ) -> TokenStream: - """Called by the parser to do the preprocessing and filtering - for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`. - """ - source = self.preprocess(source, name, filename) - stream = self.lexer.tokenize(source, name, filename, state) - - for ext in self.iter_extensions(): - stream = ext.filter_stream(stream) # type: ignore - - if not isinstance(stream, TokenStream): - stream = TokenStream(stream, name, filename) - - return stream - - def _generate( - self, - source: nodes.Template, - name: t.Optional[str], - filename: t.Optional[str], - defer_init: bool = False, - ) -> str: - """Internal hook that can be overridden to hook a different generate - method in. - - .. versionadded:: 2.5 - """ - return generate( # type: ignore - source, - self, - name, - filename, - defer_init=defer_init, - optimized=self.optimized, - ) - - def _compile(self, source: str, filename: str) -> CodeType: - """Internal hook that can be overridden to hook a different compile - method in. - - .. versionadded:: 2.5 - """ - return compile(source, filename, "exec") - - @typing.overload - def compile( - self, - source: t.Union[str, nodes.Template], - name: t.Optional[str] = None, - filename: t.Optional[str] = None, - raw: "te.Literal[False]" = False, - defer_init: bool = False, - ) -> CodeType: ... - - @typing.overload - def compile( - self, - source: t.Union[str, nodes.Template], - name: t.Optional[str] = None, - filename: t.Optional[str] = None, - raw: "te.Literal[True]" = ..., - defer_init: bool = False, - ) -> str: ... - - @internalcode - def compile( - self, - source: t.Union[str, nodes.Template], - name: t.Optional[str] = None, - filename: t.Optional[str] = None, - raw: bool = False, - defer_init: bool = False, - ) -> t.Union[str, CodeType]: - """Compile a node or template source code. The `name` parameter is - the load name of the template after it was joined using - :meth:`join_path` if necessary, not the filename on the file system. - the `filename` parameter is the estimated filename of the template on - the file system. If the template came from a database or memory this - can be omitted. - - The return value of this method is a python code object. If the `raw` - parameter is `True` the return value will be a string with python - code equivalent to the bytecode returned otherwise. This method is - mainly used internally. - - `defer_init` is use internally to aid the module code generator. This - causes the generated code to be able to import without the global - environment variable to be set. - - .. versionadded:: 2.4 - `defer_init` parameter added. - """ - source_hint = None - try: - if isinstance(source, str): - source_hint = source - source = self._parse(source, name, filename) - source = self._generate(source, name, filename, defer_init=defer_init) - if raw: - return source - if filename is None: - filename = "