diff --git a/.gitattributes b/.gitattributes index 263c83e973560527c1e56c2ce35b5fdb113fb0ee..59c7efb953cf18c71cc88e327c31145b7d93ed50 100644 --- a/.gitattributes +++ b/.gitattributes @@ -37,3 +37,4 @@ PDF/Anticiper-les-effets-de-l-adaptation-dun-rechauffement-climatique-de-plus-4- PDF/deu-2023.pdf filter=lfs diff=lfs merge=lfs -text PDF/memo_risques_physiques_focus_batiment_2022.pdf filter=lfs diff=lfs merge=lfs -text vectors/index.annoy filter=lfs diff=lfs merge=lfs -text +clara_env/bin/ruff filter=lfs diff=lfs merge=lfs -text diff --git a/.python-version b/.python-version new file mode 100644 index 0000000000000000000000000000000000000000..36435ac696df43ad2eccae85c22523ce6253e878 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10.8 diff --git a/README.md b/README.md index 28b2b5bf67bae1bba79b6a3938b35bb0a0095d45..65b84b2a3de20203a5b5471daa82e369a94dce89 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ --- -title: Clara -emoji: 📈 -colorFrom: green +title: clara +app_file: app.py +sdk: gradio +sdk_version: 4.19.1 +--- +# CLARA + + +--- +title: ClimateQ&A +emoji: 🌍 +colorFrom: blue colorTo: red sdk: gradio -sdk_version: 4.32.0 +sdk_version: 4.19.1 app_file: app.py +fullWidth: true pinned: false +short_description: Ask any questions to the IPCC and IPBES reports --- -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference +To run locally run ``gradio app.py`` \ No newline at end of file diff --git a/clara_env/bin/Activate.ps1 b/clara_env/bin/Activate.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..b49d77ba44b24fe6d69f6bbe75139b3b5dc23075 --- /dev/null +++ b/clara_env/bin/Activate.ps1 @@ -0,0 +1,247 @@ +<# +.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/clara_env/bin/activate b/clara_env/bin/activate new file mode 100644 index 0000000000000000000000000000000000000000..c56a17847b47f380b732a41b705f246d0aef6744 --- /dev/null +++ b/clara_env/bin/activate @@ -0,0 +1,69 @@ +# 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/lucas.s/Dev/clara/clara_env" +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="(clara_env) ${PS1:-}" + export PS1 + VIRTUAL_ENV_PROMPT="(clara_env) " + 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/clara_env/bin/activate.csh b/clara_env/bin/activate.csh new file mode 100644 index 0000000000000000000000000000000000000000..43fcb5e86a0e131f9c3f80f7fd73b67ac93abec3 --- /dev/null +++ b/clara_env/bin/activate.csh @@ -0,0 +1,26 @@ +# 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/lucas.s/Dev/clara/clara_env" + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/bin:$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + set prompt = "(clara_env) $prompt" + setenv VIRTUAL_ENV_PROMPT "(clara_env) " +endif + +alias pydoc python -m pydoc + +rehash diff --git a/clara_env/bin/activate.fish b/clara_env/bin/activate.fish new file mode 100644 index 0000000000000000000000000000000000000000..a9220260b96b39fa97f4ae0b22706e1658000be1 --- /dev/null +++ b/clara_env/bin/activate.fish @@ -0,0 +1,66 @@ +# 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" + functions -e fish_prompt + set -e _OLD_FISH_PROMPT_OVERRIDE + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + + set -e VIRTUAL_ENV + 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/lucas.s/Dev/clara/clara_env" + +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) "(clara_env) " (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 "(clara_env) " +end diff --git a/clara_env/bin/convert-caffe2-to-onnx b/clara_env/bin/convert-caffe2-to-onnx new file mode 100644 index 0000000000000000000000000000000000000000..c07e87be64b4f7e60d7271cbf757399fd12d1401 --- /dev/null +++ b/clara_env/bin/convert-caffe2-to-onnx @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from caffe2.python.onnx.bin.conversion import caffe2_to_onnx +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(caffe2_to_onnx()) diff --git a/clara_env/bin/convert-onnx-to-caffe2 b/clara_env/bin/convert-onnx-to-caffe2 new file mode 100644 index 0000000000000000000000000000000000000000..43d39449031ff6e175a95498d9ba4efce3ff276e --- /dev/null +++ b/clara_env/bin/convert-onnx-to-caffe2 @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from caffe2.python.onnx.bin.conversion import onnx_to_caffe2 +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(onnx_to_caffe2()) diff --git a/clara_env/bin/distro b/clara_env/bin/distro new file mode 100644 index 0000000000000000000000000000000000000000..c8c809db53df929b809d718da769d9b1c793f52f --- /dev/null +++ b/clara_env/bin/distro @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/dotenv b/clara_env/bin/dotenv new file mode 100644 index 0000000000000000000000000000000000000000..2a7214a1d2e7846ac4683c95692634f8388b74e2 --- /dev/null +++ b/clara_env/bin/dotenv @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/dumppdf.py b/clara_env/bin/dumppdf.py new file mode 100644 index 0000000000000000000000000000000000000000..fdd62e8c9a6c44b85403334f03236ef1bd4fd527 --- /dev/null +++ b/clara_env/bin/dumppdf.py @@ -0,0 +1,473 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +"""Extract pdf structure in XML format""" +import logging +import os.path +import re +import sys +from typing import Any, Container, Dict, Iterable, List, Optional, TextIO, Union, cast +from argparse import ArgumentParser + +import pdfminer +from pdfminer.pdfdocument import PDFDocument, PDFNoOutlines, PDFXRefFallback +from pdfminer.pdfpage import PDFPage +from pdfminer.pdfparser import PDFParser +from pdfminer.pdftypes import PDFObjectNotFound, PDFValueError +from pdfminer.pdftypes import PDFStream, PDFObjRef, resolve1, stream_value +from pdfminer.psparser import PSKeyword, PSLiteral, LIT +from pdfminer.utils import isnumber + +logging.basicConfig() +logger = logging.getLogger(__name__) + +ESC_PAT = re.compile(r'[\000-\037&<>()"\042\047\134\177-\377]') + + +def escape(s: Union[str, bytes]) -> str: + if isinstance(s, bytes): + us = str(s, "latin-1") + else: + us = s + return ESC_PAT.sub(lambda m: "&#%d;" % ord(m.group(0)), us) + + +def dumpxml(out: TextIO, obj: object, codec: Optional[str] = None) -> None: + if obj is None: + out.write("") + return + + if isinstance(obj, dict): + out.write('\n' % len(obj)) + for (k, v) in obj.items(): + out.write("%s\n" % k) + out.write("") + dumpxml(out, v) + out.write("\n") + out.write("") + return + + if isinstance(obj, list): + out.write('\n' % len(obj)) + for v in obj: + dumpxml(out, v) + out.write("\n") + out.write("") + return + + if isinstance(obj, (str, bytes)): + out.write('%s' % (len(obj), escape(obj))) + return + + if isinstance(obj, PDFStream): + if codec == "raw": + # Bug: writing bytes to text I/O. This will raise TypeError. + out.write(obj.get_rawdata()) # type: ignore [arg-type] + elif codec == "binary": + # Bug: writing bytes to text I/O. This will raise TypeError. + out.write(obj.get_data()) # type: ignore [arg-type] + else: + out.write("\n\n") + dumpxml(out, obj.attrs) + out.write("\n\n") + if codec == "text": + data = obj.get_data() + out.write('%s\n' % (len(data), escape(data))) + out.write("") + return + + if isinstance(obj, PDFObjRef): + out.write('' % obj.objid) + return + + if isinstance(obj, PSKeyword): + # Likely bug: obj.name is bytes, not str + out.write("%s" % obj.name) # type: ignore [str-bytes-safe] + return + + if isinstance(obj, PSLiteral): + # Likely bug: obj.name may be bytes, not str + out.write("%s" % obj.name) # type: ignore [str-bytes-safe] + return + + if isnumber(obj): + out.write("%s" % obj) + return + + raise TypeError(obj) + + +def dumptrailers( + out: TextIO, doc: PDFDocument, show_fallback_xref: bool = False +) -> None: + for xref in doc.xrefs: + if not isinstance(xref, PDFXRefFallback) or show_fallback_xref: + out.write("\n") + dumpxml(out, xref.get_trailer()) + out.write("\n\n\n") + no_xrefs = all(isinstance(xref, PDFXRefFallback) for xref in doc.xrefs) + if no_xrefs and not show_fallback_xref: + msg = ( + "This PDF does not have an xref. Use --show-fallback-xref if " + "you want to display the content of a fallback xref that " + "contains all objects." + ) + logger.warning(msg) + return + + +def dumpallobjs( + out: TextIO, + doc: PDFDocument, + codec: Optional[str] = None, + show_fallback_xref: bool = False, +) -> None: + visited = set() + out.write("") + for xref in doc.xrefs: + for objid in xref.get_objids(): + if objid in visited: + continue + visited.add(objid) + try: + obj = doc.getobj(objid) + if obj is None: + continue + out.write('\n' % objid) + dumpxml(out, obj, codec=codec) + out.write("\n\n\n") + except PDFObjectNotFound as e: + print("not found: %r" % e) + dumptrailers(out, doc, show_fallback_xref) + out.write("") + return + + +def dumpoutline( + outfp: TextIO, + fname: str, + objids: Any, + pagenos: Container[int], + password: str = "", + dumpall: bool = False, + codec: Optional[str] = None, + extractdir: Optional[str] = None, +) -> None: + fp = open(fname, "rb") + parser = PDFParser(fp) + doc = PDFDocument(parser, password) + pages = { + page.pageid: pageno + for (pageno, page) in enumerate(PDFPage.create_pages(doc), 1) + } + + def resolve_dest(dest: object) -> Any: + if isinstance(dest, (str, bytes)): + dest = resolve1(doc.get_dest(dest)) + elif isinstance(dest, PSLiteral): + dest = resolve1(doc.get_dest(dest.name)) + if isinstance(dest, dict): + dest = dest["D"] + if isinstance(dest, PDFObjRef): + dest = dest.resolve() + return dest + + try: + outlines = doc.get_outlines() + outfp.write("\n") + for (level, title, dest, a, se) in outlines: + pageno = None + if dest: + dest = resolve_dest(dest) + pageno = pages[dest[0].objid] + elif a: + action = a + if isinstance(action, dict): + subtype = action.get("S") + if subtype and repr(subtype) == "/'GoTo'" and action.get("D"): + dest = resolve_dest(action["D"]) + pageno = pages[dest[0].objid] + s = escape(title) + outfp.write('\n'.format(level, s)) + if dest is not None: + outfp.write("") + dumpxml(outfp, dest) + outfp.write("\n") + if pageno is not None: + outfp.write("%r\n" % pageno) + outfp.write("\n") + outfp.write("\n") + except PDFNoOutlines: + pass + parser.close() + fp.close() + return + + +LITERAL_FILESPEC = LIT("Filespec") +LITERAL_EMBEDDEDFILE = LIT("EmbeddedFile") + + +def extractembedded(fname: str, password: str, extractdir: str) -> None: + def extract1(objid: int, obj: Dict[str, Any]) -> None: + filename = os.path.basename(obj.get("UF") or cast(bytes, obj.get("F")).decode()) + fileref = obj["EF"].get("UF") or obj["EF"].get("F") + fileobj = doc.getobj(fileref.objid) + if not isinstance(fileobj, PDFStream): + error_msg = ( + "unable to process PDF: reference for %r is not a " + "PDFStream" % filename + ) + raise PDFValueError(error_msg) + if fileobj.get("Type") is not LITERAL_EMBEDDEDFILE: + raise PDFValueError( + "unable to process PDF: reference for %r " + "is not an EmbeddedFile" % (filename) + ) + path = os.path.join(extractdir, "%.6d-%s" % (objid, filename)) + if os.path.exists(path): + raise IOError("file exists: %r" % path) + print("extracting: %r" % path) + os.makedirs(os.path.dirname(path), exist_ok=True) + out = open(path, "wb") + out.write(fileobj.get_data()) + out.close() + return + + with open(fname, "rb") as fp: + parser = PDFParser(fp) + doc = PDFDocument(parser, password) + extracted_objids = set() + for xref in doc.xrefs: + for objid in xref.get_objids(): + obj = doc.getobj(objid) + if ( + objid not in extracted_objids + and isinstance(obj, dict) + and obj.get("Type") is LITERAL_FILESPEC + ): + extracted_objids.add(objid) + extract1(objid, obj) + return + + +def dumppdf( + outfp: TextIO, + fname: str, + objids: Iterable[int], + pagenos: Container[int], + password: str = "", + dumpall: bool = False, + codec: Optional[str] = None, + extractdir: Optional[str] = None, + show_fallback_xref: bool = False, +) -> None: + fp = open(fname, "rb") + parser = PDFParser(fp) + doc = PDFDocument(parser, password) + if objids: + for objid in objids: + obj = doc.getobj(objid) + dumpxml(outfp, obj, codec=codec) + if pagenos: + for (pageno, page) in enumerate(PDFPage.create_pages(doc)): + if pageno in pagenos: + if codec: + for obj in page.contents: + obj = stream_value(obj) + dumpxml(outfp, obj, codec=codec) + else: + dumpxml(outfp, page.attrs) + if dumpall: + dumpallobjs(outfp, doc, codec, show_fallback_xref) + if (not objids) and (not pagenos) and (not dumpall): + dumptrailers(outfp, doc, show_fallback_xref) + fp.close() + if codec not in ("raw", "binary"): + outfp.write("\n") + return + + +def create_parser() -> ArgumentParser: + parser = ArgumentParser(description=__doc__, add_help=True) + parser.add_argument( + "files", + type=str, + default=None, + nargs="+", + help="One or more paths to PDF files.", + ) + + parser.add_argument( + "--version", + "-v", + action="version", + version="pdfminer.six v{}".format(pdfminer.__version__), + ) + parser.add_argument( + "--debug", + "-d", + default=False, + action="store_true", + help="Use debug logging level.", + ) + procedure_parser = parser.add_mutually_exclusive_group() + procedure_parser.add_argument( + "--extract-toc", + "-T", + default=False, + action="store_true", + help="Extract structure of outline", + ) + procedure_parser.add_argument( + "--extract-embedded", "-E", type=str, help="Extract embedded files" + ) + + parse_params = parser.add_argument_group( + "Parser", description="Used during PDF parsing" + ) + parse_params.add_argument( + "--page-numbers", + type=int, + default=None, + nargs="+", + help="A space-seperated list of page numbers to parse.", + ) + parse_params.add_argument( + "--pagenos", + "-p", + type=str, + help="A comma-separated list of page numbers to parse. Included for " + "legacy applications, use --page-numbers for more idiomatic " + "argument entry.", + ) + parse_params.add_argument( + "--objects", + "-i", + type=str, + help="Comma separated list of object numbers to extract", + ) + parse_params.add_argument( + "--all", + "-a", + default=False, + action="store_true", + help="If the structure of all objects should be extracted", + ) + parse_params.add_argument( + "--show-fallback-xref", + action="store_true", + help="Additionally show the fallback xref. Use this if the PDF " + "has zero or only invalid xref's. This setting is ignored if " + "--extract-toc or --extract-embedded is used.", + ) + parse_params.add_argument( + "--password", + "-P", + type=str, + default="", + help="The password to use for decrypting PDF file.", + ) + + output_params = parser.add_argument_group( + "Output", description="Used during output generation." + ) + output_params.add_argument( + "--outfile", + "-o", + type=str, + default="-", + help='Path to file where output is written. Or "-" (default) to ' + "write to stdout.", + ) + codec_parser = output_params.add_mutually_exclusive_group() + codec_parser.add_argument( + "--raw-stream", + "-r", + default=False, + action="store_true", + help="Write stream objects without encoding", + ) + codec_parser.add_argument( + "--binary-stream", + "-b", + default=False, + action="store_true", + help="Write stream objects with binary encoding", + ) + codec_parser.add_argument( + "--text-stream", + "-t", + default=False, + action="store_true", + help="Write stream objects as plain text", + ) + + return parser + + +def main(argv: Optional[List[str]] = None) -> None: + parser = create_parser() + args = parser.parse_args(args=argv) + + if args.debug: + logging.getLogger().setLevel(logging.DEBUG) + + if args.outfile == "-": + outfp = sys.stdout + else: + outfp = open(args.outfile, "w") + + if args.objects: + objids = [int(x) for x in args.objects.split(",")] + else: + objids = [] + + if args.page_numbers: + pagenos = {x - 1 for x in args.page_numbers} + elif args.pagenos: + pagenos = {int(x) - 1 for x in args.pagenos.split(",")} + else: + pagenos = set() + + password = args.password + + if args.raw_stream: + codec: Optional[str] = "raw" + elif args.binary_stream: + codec = "binary" + elif args.text_stream: + codec = "text" + else: + codec = None + + for fname in args.files: + if args.extract_toc: + dumpoutline( + outfp, + fname, + objids, + pagenos, + password=password, + dumpall=args.all, + codec=codec, + extractdir=None, + ) + elif args.extract_embedded: + extractembedded(fname, password=password, extractdir=args.extract_embedded) + else: + dumppdf( + outfp, + fname, + objids, + pagenos, + password=password, + dumpall=args.all, + codec=codec, + extractdir=None, + show_fallback_xref=args.show_fallback_xref, + ) + + outfp.close() + + +if __name__ == "__main__": + main() diff --git a/clara_env/bin/email_validator b/clara_env/bin/email_validator new file mode 100644 index 0000000000000000000000000000000000000000..2822c1fd4e4307602c159fc33ea067c8bf235fb6 --- /dev/null +++ b/clara_env/bin/email_validator @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/f2py b/clara_env/bin/f2py new file mode 100644 index 0000000000000000000000000000000000000000..5f6fb6b0279070f261d1a022d9162ba6b5491bc6 --- /dev/null +++ b/clara_env/bin/f2py @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/fastapi b/clara_env/bin/fastapi new file mode 100644 index 0000000000000000000000000000000000000000..b0ffe54eb686864d2d8f29c230d28345fd0c9660 --- /dev/null +++ b/clara_env/bin/fastapi @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/fonttools b/clara_env/bin/fonttools new file mode 100644 index 0000000000000000000000000000000000000000..49045349114f9c58606757534daaf302a04969be --- /dev/null +++ b/clara_env/bin/fonttools @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.__main__ import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/gradio b/clara_env/bin/gradio new file mode 100644 index 0000000000000000000000000000000000000000..2e217582b0d0d002cda9a3372c0363be2735e09f --- /dev/null +++ b/clara_env/bin/gradio @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from gradio.cli import cli +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli()) diff --git a/clara_env/bin/httpx b/clara_env/bin/httpx new file mode 100644 index 0000000000000000000000000000000000000000..7c5215aae72176dc65d07fde5d948baee816fe4a --- /dev/null +++ b/clara_env/bin/httpx @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/huggingface-cli b/clara_env/bin/huggingface-cli new file mode 100644 index 0000000000000000000000000000000000000000..76e387719c0b7c767f82de537f2e373b84c965d3 --- /dev/null +++ b/clara_env/bin/huggingface-cli @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from huggingface_hub.commands.huggingface_cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/ipython b/clara_env/bin/ipython new file mode 100644 index 0000000000000000000000000000000000000000..56cf107c4fc446b3b3e2cb9c9f7f775747d1e78e --- /dev/null +++ b/clara_env/bin/ipython @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from IPython import start_ipython +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(start_ipython()) diff --git a/clara_env/bin/ipython3 b/clara_env/bin/ipython3 new file mode 100644 index 0000000000000000000000000000000000000000..56cf107c4fc446b3b3e2cb9c9f7f775747d1e78e --- /dev/null +++ b/clara_env/bin/ipython3 @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from IPython import start_ipython +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(start_ipython()) diff --git a/clara_env/bin/isympy b/clara_env/bin/isympy new file mode 100644 index 0000000000000000000000000000000000000000..bb3d1060561e3c6d70fd33988e2dd241b559aeaf --- /dev/null +++ b/clara_env/bin/isympy @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from isympy import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/jsondiff b/clara_env/bin/jsondiff new file mode 100644 index 0000000000000000000000000000000000000000..efd0b5cd8aca69c54b93911e035f0995edcedeea --- /dev/null +++ b/clara_env/bin/jsondiff @@ -0,0 +1,41 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- + +from __future__ import print_function + +import sys +import json +import jsonpatch +import argparse + + +parser = argparse.ArgumentParser(description='Diff two JSON files') +parser.add_argument('FILE1', type=argparse.FileType('r')) +parser.add_argument('FILE2', type=argparse.FileType('r')) +parser.add_argument('--indent', type=int, default=None, + help='Indent output by n spaces') +parser.add_argument('-u', '--preserve-unicode', action='store_true', + help='Output Unicode character as-is without using Code Point') +parser.add_argument('-v', '--version', action='version', + version='%(prog)s ' + jsonpatch.__version__) + + +def main(): + try: + diff_files() + except KeyboardInterrupt: + sys.exit(1) + + +def diff_files(): + """ Diffs two JSON files and prints a patch """ + args = parser.parse_args() + doc1 = json.load(args.FILE1) + doc2 = json.load(args.FILE2) + patch = jsonpatch.make_patch(doc1, doc2) + if patch.patch: + print(json.dumps(patch.patch, indent=args.indent, ensure_ascii=not(args.preserve_unicode))) + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/clara_env/bin/jsonpatch b/clara_env/bin/jsonpatch new file mode 100644 index 0000000000000000000000000000000000000000..7d93e26bad9a50d64241ff14f8dc83924364c8f7 --- /dev/null +++ b/clara_env/bin/jsonpatch @@ -0,0 +1,107 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- + +import sys +import os.path +import json +import jsonpatch +import tempfile +import argparse + + +parser = argparse.ArgumentParser( + description='Apply a JSON patch on a JSON file') +parser.add_argument('ORIGINAL', type=argparse.FileType('r'), + help='Original file') +parser.add_argument('PATCH', type=argparse.FileType('r'), + nargs='?', default=sys.stdin, + help='Patch file (read from stdin if omitted)') +parser.add_argument('--indent', type=int, default=None, + help='Indent output by n spaces') +parser.add_argument('-b', '--backup', action='store_true', + help='Back up ORIGINAL if modifying in-place') +parser.add_argument('-i', '--in-place', action='store_true', + help='Modify ORIGINAL in-place instead of to stdout') +parser.add_argument('-v', '--version', action='version', + version='%(prog)s ' + jsonpatch.__version__) +parser.add_argument('-u', '--preserve-unicode', action='store_true', + help='Output Unicode character as-is without using Code Point') + +def main(): + try: + patch_files() + except KeyboardInterrupt: + sys.exit(1) + + +def patch_files(): + """ Diffs two JSON files and prints a patch """ + args = parser.parse_args() + doc = json.load(args.ORIGINAL) + patch = json.load(args.PATCH) + result = jsonpatch.apply_patch(doc, patch) + + if args.in_place: + dirname = os.path.abspath(os.path.dirname(args.ORIGINAL.name)) + + try: + # Attempt to replace the file atomically. We do this by + # creating a temporary file in the same directory as the + # original file so we can atomically move the new file over + # the original later. (This is done in the same directory + # because atomic renames do not work across mount points.) + + fd, pathname = tempfile.mkstemp(dir=dirname) + fp = os.fdopen(fd, 'w') + atomic = True + + except OSError: + # We failed to create the temporary file for an atomic + # replace, so fall back to non-atomic mode by backing up + # the original (if desired) and writing a new file. + + if args.backup: + os.rename(args.ORIGINAL.name, args.ORIGINAL.name + '.orig') + fp = open(args.ORIGINAL.name, 'w') + atomic = False + + else: + # Since we're not replacing the original file in-place, write + # the modified JSON to stdout instead. + + fp = sys.stdout + + # By this point we have some sort of file object we can write the + # modified JSON to. + + json.dump(result, fp, indent=args.indent, ensure_ascii=not(args.preserve_unicode)) + fp.write('\n') + + if args.in_place: + # Close the new file. If we aren't replacing atomically, this + # is our last step, since everything else is already in place. + + fp.close() + + if atomic: + try: + # Complete the atomic replace by linking the original + # to a backup (if desired), fixing up the permissions + # on the temporary file, and moving it into place. + + if args.backup: + os.link(args.ORIGINAL.name, args.ORIGINAL.name + '.orig') + os.chmod(pathname, os.stat(args.ORIGINAL.name).st_mode) + os.rename(pathname, args.ORIGINAL.name) + + except OSError: + # In the event we could not actually do the atomic + # replace, unlink the original to move it out of the + # way and finally move the temporary file into place. + + os.unlink(args.ORIGINAL.name) + os.rename(pathname, args.ORIGINAL.name) + + +if __name__ == "__main__": + main() diff --git a/clara_env/bin/jsonpointer b/clara_env/bin/jsonpointer new file mode 100644 index 0000000000000000000000000000000000000000..8d0cf21eb44cc5ab707d15ba7d52d2e1fb00b962 --- /dev/null +++ b/clara_env/bin/jsonpointer @@ -0,0 +1,69 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- + +from __future__ import print_function + +import sys +import os.path +import json +import jsonpointer +import argparse + + +parser = argparse.ArgumentParser( + description='Resolve a JSON pointer on JSON files') + +# Accept pointer as argument or as file +ptr_group = parser.add_mutually_exclusive_group(required=True) + +ptr_group.add_argument('-f', '--pointer-file', type=argparse.FileType('r'), + nargs='?', + help='File containing a JSON pointer expression') + +ptr_group.add_argument('POINTER', type=str, nargs='?', + help='A JSON pointer expression') + +parser.add_argument('FILE', type=argparse.FileType('r'), nargs='+', + help='Files for which the pointer should be resolved') +parser.add_argument('--indent', type=int, default=None, + help='Indent output by n spaces') +parser.add_argument('-v', '--version', action='version', + version='%(prog)s ' + jsonpointer.__version__) + + +def main(): + try: + resolve_files() + except KeyboardInterrupt: + sys.exit(1) + + +def parse_pointer(args): + if args.POINTER: + ptr = args.POINTER + elif args.pointer_file: + ptr = args.pointer_file.read().strip() + else: + parser.print_usage() + sys.exit(1) + + return ptr + + +def resolve_files(): + """ Resolve a JSON pointer on JSON files """ + args = parser.parse_args() + + ptr = parse_pointer(args) + + for f in args.FILE: + doc = json.load(f) + try: + result = jsonpointer.resolve_pointer(doc, ptr) + print(json.dumps(result, indent=args.indent)) + except jsonpointer.JsonPointerException as e: + print('Could not resolve pointer: %s' % str(e), file=sys.stderr) + + +if __name__ == "__main__": + main() diff --git a/clara_env/bin/jsonschema b/clara_env/bin/jsonschema new file mode 100644 index 0000000000000000000000000000000000000000..dbe1dea924f9c10429ba39d0bc3ad38610a0bd67 --- /dev/null +++ b/clara_env/bin/jsonschema @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from jsonschema.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/langchain-server b/clara_env/bin/langchain-server new file mode 100644 index 0000000000000000000000000000000000000000..e6cb6d3ccad6ed8e71b53e3f00856ab4b6aed859 --- /dev/null +++ b/clara_env/bin/langchain-server @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from langchain.server import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/langsmith b/clara_env/bin/langsmith new file mode 100644 index 0000000000000000000000000000000000000000..c16993ff01e28905f2c3ef28b36389867b18cd80 --- /dev/null +++ b/clara_env/bin/langsmith @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from langsmith.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/clara_env/bin/markdown-it b/clara_env/bin/markdown-it new file mode 100644 index 0000000000000000000000000000000000000000..b02fb453067eab434bc9572241daba609a9ed8cf --- /dev/null +++ b/clara_env/bin/markdown-it @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/normalizer b/clara_env/bin/normalizer new file mode 100644 index 0000000000000000000000000000000000000000..b78ea7bc5900db381f0b7d2d0f56d20b5ea3f7fa --- /dev/null +++ b/clara_env/bin/normalizer @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/clara_env/bin/openai b/clara_env/bin/openai new file mode 100644 index 0000000000000000000000000000000000000000..d6335f2e558ed04d159e24c13bac0110a858ccbf --- /dev/null +++ b/clara_env/bin/openai @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/pdf2txt.py b/clara_env/bin/pdf2txt.py new file mode 100644 index 0000000000000000000000000000000000000000..677f8a8c880868c3c74d4bef3e5ea388f05808b4 --- /dev/null +++ b/clara_env/bin/pdf2txt.py @@ -0,0 +1,317 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +"""A command line tool for extracting text and images from PDF and +output it to plain text, html, xml or tags.""" +import argparse +import logging +import sys +from typing import Any, Container, Iterable, List, Optional + +import pdfminer.high_level +from pdfminer.layout import LAParams +from pdfminer.utils import AnyIO + +logging.basicConfig() + +OUTPUT_TYPES = ((".htm", "html"), (".html", "html"), (".xml", "xml"), (".tag", "tag")) + + +def float_or_disabled(x: str) -> Optional[float]: + if x.lower().strip() == "disabled": + return None + try: + return float(x) + except ValueError: + raise argparse.ArgumentTypeError("invalid float value: {}".format(x)) + + +def extract_text( + files: Iterable[str] = [], + outfile: str = "-", + laparams: Optional[LAParams] = None, + output_type: str = "text", + codec: str = "utf-8", + strip_control: bool = False, + maxpages: int = 0, + page_numbers: Optional[Container[int]] = None, + password: str = "", + scale: float = 1.0, + rotation: int = 0, + layoutmode: str = "normal", + output_dir: Optional[str] = None, + debug: bool = False, + disable_caching: bool = False, + **kwargs: Any +) -> AnyIO: + if not files: + raise ValueError("Must provide files to work upon!") + + if output_type == "text" and outfile != "-": + for override, alttype in OUTPUT_TYPES: + if outfile.endswith(override): + output_type = alttype + + if outfile == "-": + outfp: AnyIO = sys.stdout + if sys.stdout.encoding is not None: + codec = "utf-8" + else: + outfp = open(outfile, "wb") + + for fname in files: + with open(fname, "rb") as fp: + pdfminer.high_level.extract_text_to_fp(fp, **locals()) + return outfp + + +def create_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser(description=__doc__, add_help=True) + parser.add_argument( + "files", + type=str, + default=None, + nargs="+", + help="One or more paths to PDF files.", + ) + + parser.add_argument( + "--version", + "-v", + action="version", + version="pdfminer.six v{}".format(pdfminer.__version__), + ) + parser.add_argument( + "--debug", + "-d", + default=False, + action="store_true", + help="Use debug logging level.", + ) + parser.add_argument( + "--disable-caching", + "-C", + default=False, + action="store_true", + help="If caching or resources, such as fonts, should be disabled.", + ) + + parse_params = parser.add_argument_group( + "Parser", description="Used during PDF parsing" + ) + parse_params.add_argument( + "--page-numbers", + type=int, + default=None, + nargs="+", + help="A space-seperated list of page numbers to parse.", + ) + parse_params.add_argument( + "--pagenos", + "-p", + type=str, + help="A comma-separated list of page numbers to parse. " + "Included for legacy applications, use --page-numbers " + "for more idiomatic argument entry.", + ) + parse_params.add_argument( + "--maxpages", + "-m", + type=int, + default=0, + help="The maximum number of pages to parse.", + ) + parse_params.add_argument( + "--password", + "-P", + type=str, + default="", + help="The password to use for decrypting PDF file.", + ) + parse_params.add_argument( + "--rotation", + "-R", + default=0, + type=int, + help="The number of degrees to rotate the PDF " + "before other types of processing.", + ) + + la_params = LAParams() # will be used for defaults + la_param_group = parser.add_argument_group( + "Layout analysis", description="Used during layout analysis." + ) + la_param_group.add_argument( + "--no-laparams", + "-n", + default=False, + action="store_true", + help="If layout analysis parameters should be ignored.", + ) + la_param_group.add_argument( + "--detect-vertical", + "-V", + default=la_params.detect_vertical, + action="store_true", + help="If vertical text should be considered during layout analysis", + ) + la_param_group.add_argument( + "--line-overlap", + type=float, + default=la_params.line_overlap, + help="If two characters have more overlap than this they " + "are considered to be on the same line. The overlap is specified " + "relative to the minimum height of both characters.", + ) + la_param_group.add_argument( + "--char-margin", + "-M", + type=float, + default=la_params.char_margin, + help="If two characters are closer together than this margin they " + "are considered to be part of the same line. The margin is " + "specified relative to the width of the character.", + ) + la_param_group.add_argument( + "--word-margin", + "-W", + type=float, + default=la_params.word_margin, + help="If two characters on the same line are further apart than this " + "margin then they are considered to be two separate words, and " + "an intermediate space will be added for readability. The margin " + "is specified relative to the width of the character.", + ) + la_param_group.add_argument( + "--line-margin", + "-L", + type=float, + default=la_params.line_margin, + help="If two lines are close together they are considered to " + "be part of the same paragraph. The margin is specified " + "relative to the height of a line.", + ) + la_param_group.add_argument( + "--boxes-flow", + "-F", + type=float_or_disabled, + default=la_params.boxes_flow, + help="Specifies how much a horizontal and vertical position of a " + "text matters when determining the order of lines. The value " + "should be within the range of -1.0 (only horizontal position " + "matters) to +1.0 (only vertical position matters). You can also " + "pass `disabled` to disable advanced layout analysis, and " + "instead return text based on the position of the bottom left " + "corner of the text box.", + ) + la_param_group.add_argument( + "--all-texts", + "-A", + default=la_params.all_texts, + action="store_true", + help="If layout analysis should be performed on text in figures.", + ) + + output_params = parser.add_argument_group( + "Output", description="Used during output generation." + ) + output_params.add_argument( + "--outfile", + "-o", + type=str, + default="-", + help="Path to file where output is written. " + 'Or "-" (default) to write to stdout.', + ) + output_params.add_argument( + "--output_type", + "-t", + type=str, + default="text", + help="Type of output to generate {text,html,xml,tag}.", + ) + output_params.add_argument( + "--codec", + "-c", + type=str, + default="utf-8", + help="Text encoding to use in output file.", + ) + output_params.add_argument( + "--output-dir", + "-O", + default=None, + help="The output directory to put extracted images in. If not given, " + "images are not extracted.", + ) + output_params.add_argument( + "--layoutmode", + "-Y", + default="normal", + type=str, + help="Type of layout to use when generating html " + "{normal,exact,loose}. If normal,each line is" + " positioned separately in the html. If exact" + ", each character is positioned separately in" + " the html. If loose, same result as normal " + "but with an additional newline after each " + "text line. Only used when output_type is html.", + ) + output_params.add_argument( + "--scale", + "-s", + type=float, + default=1.0, + help="The amount of zoom to use when generating html file. " + "Only used when output_type is html.", + ) + output_params.add_argument( + "--strip-control", + "-S", + default=False, + action="store_true", + help="Remove control statement from text. " + "Only used when output_type is xml.", + ) + + return parser + + +def parse_args(args: Optional[List[str]]) -> argparse.Namespace: + parsed_args = create_parser().parse_args(args=args) + + # Propagate parsed layout parameters to LAParams object + if parsed_args.no_laparams: + parsed_args.laparams = None + else: + parsed_args.laparams = LAParams( + line_overlap=parsed_args.line_overlap, + char_margin=parsed_args.char_margin, + line_margin=parsed_args.line_margin, + word_margin=parsed_args.word_margin, + boxes_flow=parsed_args.boxes_flow, + detect_vertical=parsed_args.detect_vertical, + all_texts=parsed_args.all_texts, + ) + + if parsed_args.page_numbers: + parsed_args.page_numbers = {x - 1 for x in parsed_args.page_numbers} + + if parsed_args.pagenos: + parsed_args.page_numbers = {int(x) - 1 for x in parsed_args.pagenos.split(",")} + + if parsed_args.output_type == "text" and parsed_args.outfile != "-": + for override, alttype in OUTPUT_TYPES: + if parsed_args.outfile.endswith(override): + parsed_args.output_type = alttype + + return parsed_args + + +def main(args: Optional[List[str]] = None) -> int: + parsed_args = parse_args(args) + outfp = extract_text(**vars(parsed_args)) + outfp.close() + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/clara_env/bin/pdfplumber b/clara_env/bin/pdfplumber new file mode 100644 index 0000000000000000000000000000000000000000..44672f44bd13aef162f7829316156e91cd91be82 --- /dev/null +++ b/clara_env/bin/pdfplumber @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pdfplumber.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/pip b/clara_env/bin/pip new file mode 100644 index 0000000000000000000000000000000000000000..6bf72f3d9c166b18e07e4677158f485929247768 --- /dev/null +++ b/clara_env/bin/pip @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/pip3 b/clara_env/bin/pip3 new file mode 100644 index 0000000000000000000000000000000000000000..6bf72f3d9c166b18e07e4677158f485929247768 --- /dev/null +++ b/clara_env/bin/pip3 @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/pip3.10 b/clara_env/bin/pip3.10 new file mode 100644 index 0000000000000000000000000000000000000000..6bf72f3d9c166b18e07e4677158f485929247768 --- /dev/null +++ b/clara_env/bin/pip3.10 @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/pyftmerge b/clara_env/bin/pyftmerge new file mode 100644 index 0000000000000000000000000000000000000000..eeb5d17963566a3e1ac80b290e444c1f0008711e --- /dev/null +++ b/clara_env/bin/pyftmerge @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.merge import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/pyftsubset b/clara_env/bin/pyftsubset new file mode 100644 index 0000000000000000000000000000000000000000..063571e62290915be331e205a525491e12e5a0d0 --- /dev/null +++ b/clara_env/bin/pyftsubset @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.subset import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/pygmentize b/clara_env/bin/pygmentize new file mode 100644 index 0000000000000000000000000000000000000000..693ce5a95848acea10dea377607d469128ae7246 --- /dev/null +++ b/clara_env/bin/pygmentize @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/pypdfium2 b/clara_env/bin/pypdfium2 new file mode 100644 index 0000000000000000000000000000000000000000..63c902f7857d7635c1bdc70b4e39ec74f250b3c7 --- /dev/null +++ b/clara_env/bin/pypdfium2 @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pypdfium2.__main__ import cli_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_main()) diff --git a/clara_env/bin/pyrsa-decrypt b/clara_env/bin/pyrsa-decrypt new file mode 100644 index 0000000000000000000000000000000000000000..da084a4826be13769196647419034661bc2525a5 --- /dev/null +++ b/clara_env/bin/pyrsa-decrypt @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import decrypt +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(decrypt()) diff --git a/clara_env/bin/pyrsa-encrypt b/clara_env/bin/pyrsa-encrypt new file mode 100644 index 0000000000000000000000000000000000000000..fbce08b7d9a62b1c8f5e2a6e096b279841c07040 --- /dev/null +++ b/clara_env/bin/pyrsa-encrypt @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import encrypt +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(encrypt()) diff --git a/clara_env/bin/pyrsa-keygen b/clara_env/bin/pyrsa-keygen new file mode 100644 index 0000000000000000000000000000000000000000..bf67d11c8afcf6130a52018c9a331135343362bc --- /dev/null +++ b/clara_env/bin/pyrsa-keygen @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import keygen +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(keygen()) diff --git a/clara_env/bin/pyrsa-priv2pub b/clara_env/bin/pyrsa-priv2pub new file mode 100644 index 0000000000000000000000000000000000000000..af83288c34bfc74b2342f9d2254826d59c1c9a0d --- /dev/null +++ b/clara_env/bin/pyrsa-priv2pub @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.util import private_to_public +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(private_to_public()) diff --git a/clara_env/bin/pyrsa-sign b/clara_env/bin/pyrsa-sign new file mode 100644 index 0000000000000000000000000000000000000000..fb9ef65ef2cdc3a850584f3803dd79654d2a09d9 --- /dev/null +++ b/clara_env/bin/pyrsa-sign @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import sign +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(sign()) diff --git a/clara_env/bin/pyrsa-verify b/clara_env/bin/pyrsa-verify new file mode 100644 index 0000000000000000000000000000000000000000..d6bbb23198180073083a30de55ae1385bbef0690 --- /dev/null +++ b/clara_env/bin/pyrsa-verify @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from rsa.cli import verify +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(verify()) diff --git a/clara_env/bin/python b/clara_env/bin/python new file mode 100644 index 0000000000000000000000000000000000000000..10418f514f3e2855280e48b1f2bf9f69e6cf4fb7 Binary files /dev/null and b/clara_env/bin/python differ diff --git a/clara_env/bin/python3 b/clara_env/bin/python3 new file mode 100644 index 0000000000000000000000000000000000000000..10418f514f3e2855280e48b1f2bf9f69e6cf4fb7 Binary files /dev/null and b/clara_env/bin/python3 differ diff --git a/clara_env/bin/python3.10 b/clara_env/bin/python3.10 new file mode 100644 index 0000000000000000000000000000000000000000..10418f514f3e2855280e48b1f2bf9f69e6cf4fb7 Binary files /dev/null and b/clara_env/bin/python3.10 differ diff --git a/clara_env/bin/ruff b/clara_env/bin/ruff new file mode 100644 index 0000000000000000000000000000000000000000..94bf0202bbbf4ae79f5a38b0043c94ba5ce3ec55 --- /dev/null +++ b/clara_env/bin/ruff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de19d5eaffe9b251eb65ad787557d8a6b8a59acfa01e494e9e44b8f74fab5d48 +size 21805272 diff --git a/clara_env/bin/torchrun b/clara_env/bin/torchrun new file mode 100644 index 0000000000000000000000000000000000000000..7477efcf0ad10cbdff5d78242dc240f73db69bbe --- /dev/null +++ b/clara_env/bin/torchrun @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from torch.distributed.run import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/tqdm b/clara_env/bin/tqdm new file mode 100644 index 0000000000000000000000000000000000000000..7fd00db59206772820ce4cb71770125086069b8c --- /dev/null +++ b/clara_env/bin/tqdm @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/transformers-cli b/clara_env/bin/transformers-cli new file mode 100644 index 0000000000000000000000000000000000000000..3f09a418a96328d16ae74439c52a6dd1ce15db9b --- /dev/null +++ b/clara_env/bin/transformers-cli @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from transformers.commands.transformers_cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/ttx b/clara_env/bin/ttx new file mode 100644 index 0000000000000000000000000000000000000000..66008b34ebbb18ee7f91ac1558b10acd962a8531 --- /dev/null +++ b/clara_env/bin/ttx @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from fontTools.ttx import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/typer b/clara_env/bin/typer new file mode 100644 index 0000000000000000000000000000000000000000..081dda0a2576e060af5495e861b590a033f8dea7 --- /dev/null +++ b/clara_env/bin/typer @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/upload_theme b/clara_env/bin/upload_theme new file mode 100644 index 0000000000000000000000000000000000000000..269e4cbf3c35f3007f1e17faa6030a934b336b1f --- /dev/null +++ b/clara_env/bin/upload_theme @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from gradio.themes.upload_theme import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/clara_env/bin/uvicorn b/clara_env/bin/uvicorn new file mode 100644 index 0000000000000000000000000000000000000000..398e8ab5c5cb6c5338990c30985e6e274f6180c7 --- /dev/null +++ b/clara_env/bin/uvicorn @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/bin/watchfiles b/clara_env/bin/watchfiles new file mode 100644 index 0000000000000000000000000000000000000000..ef0e73e4073c4934a93b36931233d4888b86f538 --- /dev/null +++ b/clara_env/bin/watchfiles @@ -0,0 +1,8 @@ +#!/Users/lucas.s/Dev/clara/clara_env/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/clara_env/include/site/python3.10/greenlet/greenlet.h b/clara_env/include/site/python3.10/greenlet/greenlet.h new file mode 100644 index 0000000000000000000000000000000000000000..d02a16e43426fb1c1bb286f1cda463cb9b1185ad --- /dev/null +++ b/clara_env/include/site/python3.10/greenlet/greenlet.h @@ -0,0 +1,164 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */ + +/* Greenlet object interface */ + +#ifndef Py_GREENLETOBJECT_H +#define Py_GREENLETOBJECT_H + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* This is deprecated and undocumented. It does not change. */ +#define GREENLET_VERSION "1.0.0" + +#ifndef GREENLET_MODULE +#define implementation_ptr_t void* +#endif + +typedef struct _greenlet { + PyObject_HEAD + PyObject* weakreflist; + PyObject* dict; + implementation_ptr_t pimpl; +} PyGreenlet; + +#define PyGreenlet_Check(op) (op && PyObject_TypeCheck(op, &PyGreenlet_Type)) + + +/* C API functions */ + +/* Total number of symbols that are exported */ +#define PyGreenlet_API_pointers 12 + +#define PyGreenlet_Type_NUM 0 +#define PyExc_GreenletError_NUM 1 +#define PyExc_GreenletExit_NUM 2 + +#define PyGreenlet_New_NUM 3 +#define PyGreenlet_GetCurrent_NUM 4 +#define PyGreenlet_Throw_NUM 5 +#define PyGreenlet_Switch_NUM 6 +#define PyGreenlet_SetParent_NUM 7 + +#define PyGreenlet_MAIN_NUM 8 +#define PyGreenlet_STARTED_NUM 9 +#define PyGreenlet_ACTIVE_NUM 10 +#define PyGreenlet_GET_PARENT_NUM 11 + +#ifndef GREENLET_MODULE +/* This section is used by modules that uses the greenlet C API */ +static void** _PyGreenlet_API = NULL; + +# define PyGreenlet_Type \ + (*(PyTypeObject*)_PyGreenlet_API[PyGreenlet_Type_NUM]) + +# define PyExc_GreenletError \ + ((PyObject*)_PyGreenlet_API[PyExc_GreenletError_NUM]) + +# define PyExc_GreenletExit \ + ((PyObject*)_PyGreenlet_API[PyExc_GreenletExit_NUM]) + +/* + * PyGreenlet_New(PyObject *args) + * + * greenlet.greenlet(run, parent=None) + */ +# define PyGreenlet_New \ + (*(PyGreenlet * (*)(PyObject * run, PyGreenlet * parent)) \ + _PyGreenlet_API[PyGreenlet_New_NUM]) + +/* + * PyGreenlet_GetCurrent(void) + * + * greenlet.getcurrent() + */ +# define PyGreenlet_GetCurrent \ + (*(PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM]) + +/* + * PyGreenlet_Throw( + * PyGreenlet *greenlet, + * PyObject *typ, + * PyObject *val, + * PyObject *tb) + * + * g.throw(...) + */ +# define PyGreenlet_Throw \ + (*(PyObject * (*)(PyGreenlet * self, \ + PyObject * typ, \ + PyObject * val, \ + PyObject * tb)) \ + _PyGreenlet_API[PyGreenlet_Throw_NUM]) + +/* + * PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args) + * + * g.switch(*args, **kwargs) + */ +# define PyGreenlet_Switch \ + (*(PyObject * \ + (*)(PyGreenlet * greenlet, PyObject * args, PyObject * kwargs)) \ + _PyGreenlet_API[PyGreenlet_Switch_NUM]) + +/* + * PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent) + * + * g.parent = new_parent + */ +# define PyGreenlet_SetParent \ + (*(int (*)(PyGreenlet * greenlet, PyGreenlet * nparent)) \ + _PyGreenlet_API[PyGreenlet_SetParent_NUM]) + +/* + * PyGreenlet_GetParent(PyObject* greenlet) + * + * return greenlet.parent; + * + * This could return NULL even if there is no exception active. + * If it does not return NULL, you are responsible for decrementing the + * reference count. + */ +# define PyGreenlet_GetParent \ + (*(PyGreenlet* (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_GET_PARENT_NUM]) + +/* + * deprecated, undocumented alias. + */ +# define PyGreenlet_GET_PARENT PyGreenlet_GetParent + +# define PyGreenlet_MAIN \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_MAIN_NUM]) + +# define PyGreenlet_STARTED \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_STARTED_NUM]) + +# define PyGreenlet_ACTIVE \ + (*(int (*)(PyGreenlet*)) \ + _PyGreenlet_API[PyGreenlet_ACTIVE_NUM]) + + + + +/* Macro that imports greenlet and initializes C API */ +/* NOTE: This has actually moved to ``greenlet._greenlet._C_API``, but we + keep the older definition to be sure older code that might have a copy of + the header still works. */ +# define PyGreenlet_Import() \ + { \ + _PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \ + } + +#endif /* GREENLET_MODULE */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GREENLETOBJECT_H */ diff --git a/clara_env/pyvenv.cfg b/clara_env/pyvenv.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4be680c0fea97b7f7dab9d6abeaf44838f874346 --- /dev/null +++ b/clara_env/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /Users/lucas.s/.pyenv/versions/3.10.8/bin +include-system-site-packages = false +version = 3.10.8 diff --git a/clara_env/share/man/man1/ipython.1 b/clara_env/share/man/man1/ipython.1 new file mode 100644 index 0000000000000000000000000000000000000000..0f4a191f3fa4c5678013589be9c9254e3f791c9c --- /dev/null +++ b/clara_env/share/man/man1/ipython.1 @@ -0,0 +1,60 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH IPYTHON 1 "July 15, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) and groff_man(7) +.\" .SH section heading +.\" .SS secondary section heading +.\" +.\" +.\" To preview this page as plain text: nroff -man ipython.1 +.\" +.SH NAME +ipython \- Tools for Interactive Computing in Python. +.SH SYNOPSIS +.B ipython +.RI [ options ] " files" ... + +.B ipython subcommand +.RI [ options ] ... + +.SH DESCRIPTION +An interactive Python shell with automatic history (input and output), dynamic +object introspection, easier configuration, command completion, access to the +system shell, integration with numerical and scientific computing tools, +web notebook, Qt console, and more. + +For more information on how to use IPython, see 'ipython \-\-help', +or 'ipython \-\-help\-all' for all available command\(hyline options. + +.SH "ENVIRONMENT VARIABLES" +.sp +.PP +\fIIPYTHONDIR\fR +.RS 4 +This is the location where IPython stores all its configuration files. The default +is $HOME/.ipython if IPYTHONDIR is not defined. + +You can see the computed value of IPYTHONDIR with `ipython locate`. + +.SH FILES + +IPython uses various configuration files stored in profiles within IPYTHONDIR. +To generate the default configuration files and start configuring IPython, +do 'ipython profile create', and edit '*_config.py' files located in +IPYTHONDIR/profile_default. + +.SH AUTHORS +IPython is written by the IPython Development Team . diff --git a/clara_env/share/man/man1/isympy.1 b/clara_env/share/man/man1/isympy.1 new file mode 100644 index 0000000000000000000000000000000000000000..0ff966158a28c5ad1a6cd954e454842b25fdd999 --- /dev/null +++ b/clara_env/share/man/man1/isympy.1 @@ -0,0 +1,188 @@ +'\" -*- coding: us-ascii -*- +.if \n(.g .ds T< \\FC +.if \n(.g .ds T> \\F[\n[.fam]] +.de URL +\\$2 \(la\\$1\(ra\\$3 +.. +.if \n(.g .mso www.tmac +.TH isympy 1 2007-10-8 "" "" +.SH NAME +isympy \- interactive shell for SymPy +.SH SYNOPSIS +'nh +.fi +.ad l +\fBisympy\fR \kx +.if (\nx>(\n(.l/2)) .nr x (\n(.l/5) +'in \n(.iu+\nxu +[\fB-c\fR | \fB--console\fR] [\fB-p\fR ENCODING | \fB--pretty\fR ENCODING] [\fB-t\fR TYPE | \fB--types\fR TYPE] [\fB-o\fR ORDER | \fB--order\fR ORDER] [\fB-q\fR | \fB--quiet\fR] [\fB-d\fR | \fB--doctest\fR] [\fB-C\fR | \fB--no-cache\fR] [\fB-a\fR | \fB--auto\fR] [\fB-D\fR | \fB--debug\fR] [ +-- | PYTHONOPTIONS] +'in \n(.iu-\nxu +.ad b +'hy +'nh +.fi +.ad l +\fBisympy\fR \kx +.if (\nx>(\n(.l/2)) .nr x (\n(.l/5) +'in \n(.iu+\nxu +[ +{\fB-h\fR | \fB--help\fR} +| +{\fB-v\fR | \fB--version\fR} +] +'in \n(.iu-\nxu +.ad b +'hy +.SH DESCRIPTION +isympy is a Python shell for SymPy. It is just a normal python shell +(ipython shell if you have the ipython package installed) that executes +the following commands so that you don't have to: +.PP +.nf +\*(T< +>>> from __future__ import division +>>> from sympy import * +>>> x, y, z = symbols("x,y,z") +>>> k, m, n = symbols("k,m,n", integer=True) + \*(T> +.fi +.PP +So starting isympy is equivalent to starting python (or ipython) and +executing the above commands by hand. It is intended for easy and quick +experimentation with SymPy. For more complicated programs, it is recommended +to write a script and import things explicitly (using the "from sympy +import sin, log, Symbol, ..." idiom). +.SH OPTIONS +.TP +\*(T<\fB\-c \fR\*(T>\fISHELL\fR, \*(T<\fB\-\-console=\fR\*(T>\fISHELL\fR +Use the specified shell (python or ipython) as +console backend instead of the default one (ipython +if present or python otherwise). + +Example: isympy -c python + +\fISHELL\fR could be either +\&'ipython' or 'python' +.TP +\*(T<\fB\-p \fR\*(T>\fIENCODING\fR, \*(T<\fB\-\-pretty=\fR\*(T>\fIENCODING\fR +Setup pretty printing in SymPy. By default, the most pretty, unicode +printing is enabled (if the terminal supports it). You can use less +pretty ASCII printing instead or no pretty printing at all. + +Example: isympy -p no + +\fIENCODING\fR must be one of 'unicode', +\&'ascii' or 'no'. +.TP +\*(T<\fB\-t \fR\*(T>\fITYPE\fR, \*(T<\fB\-\-types=\fR\*(T>\fITYPE\fR +Setup the ground types for the polys. By default, gmpy ground types +are used if gmpy2 or gmpy is installed, otherwise it falls back to python +ground types, which are a little bit slower. You can manually +choose python ground types even if gmpy is installed (e.g., for testing purposes). + +Note that sympy ground types are not supported, and should be used +only for experimental purposes. + +Note that the gmpy1 ground type is primarily intended for testing; it the +use of gmpy even if gmpy2 is available. + +This is the same as setting the environment variable +SYMPY_GROUND_TYPES to the given ground type (e.g., +SYMPY_GROUND_TYPES='gmpy') + +The ground types can be determined interactively from the variable +sympy.polys.domains.GROUND_TYPES inside the isympy shell itself. + +Example: isympy -t python + +\fITYPE\fR must be one of 'gmpy', +\&'gmpy1' or 'python'. +.TP +\*(T<\fB\-o \fR\*(T>\fIORDER\fR, \*(T<\fB\-\-order=\fR\*(T>\fIORDER\fR +Setup the ordering of terms for printing. The default is lex, which +orders terms lexicographically (e.g., x**2 + x + 1). You can choose +other orderings, such as rev-lex, which will use reverse +lexicographic ordering (e.g., 1 + x + x**2). + +Note that for very large expressions, ORDER='none' may speed up +printing considerably, with the tradeoff that the order of the terms +in the printed expression will have no canonical order + +Example: isympy -o rev-lax + +\fIORDER\fR must be one of 'lex', 'rev-lex', 'grlex', +\&'rev-grlex', 'grevlex', 'rev-grevlex', 'old', or 'none'. +.TP +\*(T<\fB\-q\fR\*(T>, \*(T<\fB\-\-quiet\fR\*(T> +Print only Python's and SymPy's versions to stdout at startup, and nothing else. +.TP +\*(T<\fB\-d\fR\*(T>, \*(T<\fB\-\-doctest\fR\*(T> +Use the same format that should be used for doctests. This is +equivalent to '\fIisympy -c python -p no\fR'. +.TP +\*(T<\fB\-C\fR\*(T>, \*(T<\fB\-\-no\-cache\fR\*(T> +Disable the caching mechanism. Disabling the cache may slow certain +operations down considerably. This is useful for testing the cache, +or for benchmarking, as the cache can result in deceptive benchmark timings. + +This is the same as setting the environment variable SYMPY_USE_CACHE +to 'no'. +.TP +\*(T<\fB\-a\fR\*(T>, \*(T<\fB\-\-auto\fR\*(T> +Automatically create missing symbols. Normally, typing a name of a +Symbol that has not been instantiated first would raise NameError, +but with this option enabled, any undefined name will be +automatically created as a Symbol. This only works in IPython 0.11. + +Note that this is intended only for interactive, calculator style +usage. In a script that uses SymPy, Symbols should be instantiated +at the top, so that it's clear what they are. + +This will not override any names that are already defined, which +includes the single character letters represented by the mnemonic +QCOSINE (see the "Gotchas and Pitfalls" document in the +documentation). You can delete existing names by executing "del +name" in the shell itself. You can see if a name is defined by typing +"'name' in globals()". + +The Symbols that are created using this have default assumptions. +If you want to place assumptions on symbols, you should create them +using symbols() or var(). + +Finally, this only works in the top level namespace. So, for +example, if you define a function in isympy with an undefined +Symbol, it will not work. +.TP +\*(T<\fB\-D\fR\*(T>, \*(T<\fB\-\-debug\fR\*(T> +Enable debugging output. This is the same as setting the +environment variable SYMPY_DEBUG to 'True'. The debug status is set +in the variable SYMPY_DEBUG within isympy. +.TP +-- \fIPYTHONOPTIONS\fR +These options will be passed on to \fIipython (1)\fR shell. +Only supported when ipython is being used (standard python shell not supported). + +Two dashes (--) are required to separate \fIPYTHONOPTIONS\fR +from the other isympy options. + +For example, to run iSymPy without startup banner and colors: + +isympy -q -c ipython -- --colors=NoColor +.TP +\*(T<\fB\-h\fR\*(T>, \*(T<\fB\-\-help\fR\*(T> +Print help output and exit. +.TP +\*(T<\fB\-v\fR\*(T>, \*(T<\fB\-\-version\fR\*(T> +Print isympy version information and exit. +.SH FILES +.TP +\*(T<\fI${HOME}/.sympy\-history\fR\*(T> +Saves the history of commands when using the python +shell as backend. +.SH BUGS +The upstreams BTS can be found at \(lahttps://github.com/sympy/sympy/issues\(ra +Please report all bugs that you find in there, this will help improve +the overall quality of SymPy. +.SH "SEE ALSO" +\fBipython\fR(1), \fBpython\fR(1) diff --git a/clara_env/share/man/man1/ttx.1 b/clara_env/share/man/man1/ttx.1 new file mode 100644 index 0000000000000000000000000000000000000000..bba23b5e51629509a499f4471fc8196e9863d211 --- /dev/null +++ b/clara_env/share/man/man1/ttx.1 @@ -0,0 +1,225 @@ +.Dd May 18, 2004 +.\" ttx is not specific to any OS, but contrary to what groff_mdoc(7) +.\" seems to imply, entirely omitting the .Os macro causes 'BSD' to +.\" be used, so I give a zero-width space as its argument. +.Os \& +.\" The "FontTools Manual" argument apparently has no effect in +.\" groff 1.18.1. I think it is a bug in the -mdoc groff package. +.Dt TTX 1 "FontTools Manual" +.Sh NAME +.Nm ttx +.Nd tool for manipulating TrueType and OpenType fonts +.Sh SYNOPSIS +.Nm +.Bk +.Op Ar option ... +.Ek +.Bk +.Ar file ... +.Ek +.Sh DESCRIPTION +.Nm +is a tool for manipulating TrueType and OpenType fonts. It can convert +TrueType and OpenType fonts to and from an +.Tn XML Ns -based format called +.Tn TTX . +.Tn TTX +files have a +.Ql .ttx +extension. +.Pp +For each +.Ar file +argument it is given, +.Nm +detects whether it is a +.Ql .ttf , +.Ql .otf +or +.Ql .ttx +file and acts accordingly: if it is a +.Ql .ttf +or +.Ql .otf +file, it generates a +.Ql .ttx +file; if it is a +.Ql .ttx +file, it generates a +.Ql .ttf +or +.Ql .otf +file. +.Pp +By default, every output file is created in the same directory as the +corresponding input file and with the same name except for the +extension, which is substituted appropriately. +.Nm +never overwrites existing files; if necessary, it appends a suffix to +the output file name before the extension, as in +.Pa Arial#1.ttf . +.Ss "General options" +.Bl -tag -width ".Fl t Ar table" +.It Fl h +Display usage information. +.It Fl d Ar dir +Write the output files to directory +.Ar dir +instead of writing every output file to the same directory as the +corresponding input file. +.It Fl o Ar file +Write the output to +.Ar file +instead of writing it to the same directory as the +corresponding input file. +.It Fl v +Be verbose. Write more messages to the standard output describing what +is being done. +.It Fl a +Allow virtual glyphs ID's on compile or decompile. +.El +.Ss "Dump options" +The following options control the process of dumping font files +(TrueType or OpenType) to +.Tn TTX +files. +.Bl -tag -width ".Fl t Ar table" +.It Fl l +List table information. Instead of dumping the font to a +.Tn TTX +file, display minimal information about each table. +.It Fl t Ar table +Dump table +.Ar table . +This option may be given multiple times to dump several tables at +once. When not specified, all tables are dumped. +.It Fl x Ar table +Exclude table +.Ar table +from the list of tables to dump. This option may be given multiple +times to exclude several tables from the dump. The +.Fl t +and +.Fl x +options are mutually exclusive. +.It Fl s +Split tables. Dump each table to a separate +.Tn TTX +file and write (under the name that would have been used for the output +file if the +.Fl s +option had not been given) one small +.Tn TTX +file containing references to the individual table dump files. This +file can be used as input to +.Nm +as long as the referenced files can be found in the same directory. +.It Fl i +.\" XXX: I suppose OpenType programs (exist and) are also affected. +Don't disassemble TrueType instructions. When this option is specified, +all TrueType programs (glyph programs, the font program and the +pre-program) are written to the +.Tn TTX +file as hexadecimal data instead of +assembly. This saves some time and results in smaller +.Tn TTX +files. +.It Fl y Ar n +When decompiling a TrueType Collection (TTC) file, +decompile font number +.Ar n , +starting from 0. +.El +.Ss "Compilation options" +The following options control the process of compiling +.Tn TTX +files into font files (TrueType or OpenType): +.Bl -tag -width ".Fl t Ar table" +.It Fl m Ar fontfile +Merge the input +.Tn TTX +file +.Ar file +with +.Ar fontfile . +No more than one +.Ar file +argument can be specified when this option is used. +.It Fl b +Don't recalculate glyph bounding boxes. Use the values in the +.Tn TTX +file as is. +.El +.Sh "THE TTX FILE FORMAT" +You can find some information about the +.Tn TTX +file format in +.Pa documentation.html . +In particular, you will find in that file the list of tables understood by +.Nm +and the relations between TrueType GlyphIDs and the glyph names used in +.Tn TTX +files. +.Sh EXAMPLES +In the following examples, all files are read from and written to the +current directory. Additionally, the name given for the output file +assumes in every case that it did not exist before +.Nm +was invoked. +.Pp +Dump the TrueType font contained in +.Pa FreeSans.ttf +to +.Pa FreeSans.ttx : +.Pp +.Dl ttx FreeSans.ttf +.Pp +Compile +.Pa MyFont.ttx +into a TrueType or OpenType font file: +.Pp +.Dl ttx MyFont.ttx +.Pp +List the tables in +.Pa FreeSans.ttf +along with some information: +.Pp +.Dl ttx -l FreeSans.ttf +.Pp +Dump the +.Sq cmap +table from +.Pa FreeSans.ttf +to +.Pa FreeSans.ttx : +.Pp +.Dl ttx -t cmap FreeSans.ttf +.Sh NOTES +On MS\-Windows and MacOS, +.Nm +is available as a graphical application to which files can be dropped. +.Sh SEE ALSO +.Pa documentation.html +.Pp +.Xr fontforge 1 , +.Xr ftinfo 1 , +.Xr gfontview 1 , +.Xr xmbdfed 1 , +.Xr Font::TTF 3pm +.Sh AUTHORS +.Nm +was written by +.An -nosplit +.An "Just van Rossum" Aq just@letterror.com . +.Pp +This manual page was written by +.An "Florent Rougon" Aq f.rougon@free.fr +for the Debian GNU/Linux system based on the existing FontTools +documentation. It may be freely used, modified and distributed without +restrictions. +.\" For Emacs: +.\" Local Variables: +.\" fill-column: 72 +.\" sentence-end: "[.?!][]\"')}]*\\($\\| $\\| \\| \\)[ \n]*" +.\" sentence-end-double-space: t +.\" End: \ No newline at end of file