Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +100 -0
- .venv/.gitignore +1 -0
- .venv/.lock +0 -0
- .venv/CACHEDIR.TAG +1 -0
- .venv/bin/activate +130 -0
- .venv/bin/activate.bat +71 -0
- .venv/bin/activate.csh +76 -0
- .venv/bin/activate.fish +124 -0
- .venv/bin/activate.nu +102 -0
- .venv/bin/activate.ps1 +82 -0
- .venv/bin/activate_this.py +59 -0
- .venv/bin/deactivate.bat +39 -0
- .venv/bin/f2py +10 -0
- .venv/bin/fastapi +10 -0
- .venv/bin/gradio +10 -0
- .venv/bin/hf +10 -0
- .venv/bin/httpx +10 -0
- .venv/bin/markdown-it +10 -0
- .venv/bin/numpy-config +10 -0
- .venv/bin/pydoc.bat +22 -0
- .venv/bin/pygmentize +10 -0
- .venv/bin/python +0 -0
- .venv/bin/python3 +0 -0
- .venv/bin/python3.12 +0 -0
- .venv/bin/tiny-agents +10 -0
- .venv/bin/tqdm +10 -0
- .venv/bin/typer +10 -0
- .venv/bin/upload_theme +10 -0
- .venv/bin/uvicorn +10 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libXau.6.dylib +0 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libavif.16.3.0.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libbrotlicommon.1.2.0.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libbrotlidec.1.2.0.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libfreetype.6.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libharfbuzz.0.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libjpeg.62.4.0.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/liblcms2.2.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/liblzma.5.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libopenjp2.2.5.4.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libpng16.16.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libsharpyuv.0.dylib +0 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libtiff.6.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libwebp.7.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libwebpdemux.2.dylib +0 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libwebpmux.3.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/.dylibs/libz.1.3.1.zlib-ng.dylib +3 -0
- .venv/lib/python3.12/site-packages/PIL/AvifImagePlugin.py +293 -0
- .venv/lib/python3.12/site-packages/PIL/BdfFontFile.py +122 -0
- .venv/lib/python3.12/site-packages/PIL/BlpImagePlugin.py +498 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,103 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libavif.16.3.0.dylib filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libbrotlicommon.1.2.0.dylib filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libbrotlidec.1.2.0.dylib filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libfreetype.6.dylib filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libharfbuzz.0.dylib filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libjpeg.62.4.0.dylib filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/liblcms2.2.dylib filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/liblzma.5.dylib filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libopenjp2.2.5.4.dylib filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libpng16.16.dylib filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libtiff.6.dylib filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libwebp.7.dylib filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libwebpmux.3.dylib filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
.venv/lib/python3.12/site-packages/PIL/.dylibs/libz.1.3.1.zlib-ng.dylib filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
.venv/lib/python3.12/site-packages/PIL/_imaging.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
.venv/lib/python3.12/site-packages/PIL/_imagingft.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
.venv/lib/python3.12/site-packages/_brotli.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/audio/cantina.wav filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/audio/recording1.wav filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/audio/sax.wav filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/images/groot.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/images/tower.jpg filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/models3d/Duck.glb filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/models3d/sofia.stl filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/videos/a.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/videos/b.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
.venv/lib/python3.12/site-packages/gradio/media_assets/videos/world.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
.venv/lib/python3.12/site-packages/gradio/templates/frontend/static/fonts/Source[[:space:]]Sans[[:space:]]Pro/SourceSansPro-Bold.woff2 filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
.venv/lib/python3.12/site-packages/gradio/templates/frontend/static/fonts/Source[[:space:]]Sans[[:space:]]Pro/SourceSansPro-Regular.woff2 filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/assets/Index.HGCvQmEP.css.br filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/5J0xJHOV.js.br filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/BA2s8bW3.js.br filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/BEl3c0yv.js.br filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/BRkJo6_0.js.br filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/BWYBsjhu.js.br filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/BY7JZjr7.js.br filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Bu-Kutci.js.br filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/CXUrHmJd.js.br filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/CkHu5l1j.js.br filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Cm_3xJ8N.js.br filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/D2RdMstj.js.br filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/PLQWw3Sm.js.br filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/_iZc-SbZ.js.br filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
.venv/lib/python3.12/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/ulKw_RWj.js.br filter=lfs diff=lfs merge=lfs -text
|
| 81 |
+
.venv/lib/python3.12/site-packages/hf_xet/hf_xet.abi3.so filter=lfs diff=lfs merge=lfs -text
|
| 82 |
+
.venv/lib/python3.12/site-packages/numpy/_core/_multiarray_tests.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 83 |
+
.venv/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 84 |
+
.venv/lib/python3.12/site-packages/numpy/_core/_simd.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 85 |
+
.venv/lib/python3.12/site-packages/numpy/fft/_pocketfft_umath.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 86 |
+
.venv/lib/python3.12/site-packages/numpy/linalg/_umath_linalg.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 87 |
+
.venv/lib/python3.12/site-packages/numpy/random/_bounded_integers.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 88 |
+
.venv/lib/python3.12/site-packages/numpy/random/_common.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 89 |
+
.venv/lib/python3.12/site-packages/numpy/random/_generator.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 90 |
+
.venv/lib/python3.12/site-packages/numpy/random/_mt19937.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 91 |
+
.venv/lib/python3.12/site-packages/numpy/random/_pcg64.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 92 |
+
.venv/lib/python3.12/site-packages/numpy/random/_philox.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 93 |
+
.venv/lib/python3.12/site-packages/numpy/random/bit_generator.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
.venv/lib/python3.12/site-packages/numpy/random/mtrand.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
.venv/lib/python3.12/site-packages/orjson/orjson.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/_cyutility.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/algos.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/arrays.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/groupby.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/hashing.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/hashtable.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 102 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/index.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 103 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/internals.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 104 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/interval.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 105 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/join.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 106 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/lib.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 107 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/missing.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 108 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/ops.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 109 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/parsers.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 110 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/properties.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 111 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/reshape.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 112 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/sas.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 113 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/sparse.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 114 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/testing.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 115 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslib.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 116 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/ccalendar.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 117 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/conversion.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 118 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/dtypes.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 119 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/fields.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 120 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/nattype.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 121 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/np_datetime.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 122 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/offsets.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 123 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/parsing.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 124 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/period.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 125 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/strptime.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 126 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/timedeltas.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 127 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/timestamps.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 128 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/timezones.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 129 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/tzconversion.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 130 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/tslibs/vectorized.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 131 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/window/aggregations.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 132 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/window/indexers.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 133 |
+
.venv/lib/python3.12/site-packages/pandas/_libs/writers.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 134 |
+
.venv/lib/python3.12/site-packages/pydantic_core/_pydantic_core.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
| 135 |
+
.venv/lib/python3.12/site-packages/yaml/_yaml.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
|
.venv/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*
|
.venv/.lock
ADDED
|
File without changes
|
.venv/CACHEDIR.TAG
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
.venv/bin/activate
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# This file must be used with "source bin/activate" *from bash*
|
| 23 |
+
# you cannot run it directly
|
| 24 |
+
|
| 25 |
+
if ! [ -z "${SCRIPT_PATH+_}" ] ; then
|
| 26 |
+
_OLD_SCRIPT_PATH="$SCRIPT_PATH"
|
| 27 |
+
fi
|
| 28 |
+
|
| 29 |
+
# Get script path (only used if environment is relocatable).
|
| 30 |
+
if [ -n "${BASH_VERSION:+x}" ] ; then
|
| 31 |
+
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
| 32 |
+
if [ "$SCRIPT_PATH" = "$0" ]; then
|
| 33 |
+
# Only bash has a reasonably robust check for source'dness.
|
| 34 |
+
echo "You must source this script: \$ source $0" >&2
|
| 35 |
+
exit 33
|
| 36 |
+
fi
|
| 37 |
+
elif [ -n "${ZSH_VERSION:+x}" ] ; then
|
| 38 |
+
SCRIPT_PATH="${(%):-%x}"
|
| 39 |
+
elif [ -n "${KSH_VERSION:+x}" ] ; then
|
| 40 |
+
SCRIPT_PATH="${.sh.file}"
|
| 41 |
+
fi
|
| 42 |
+
|
| 43 |
+
deactivate () {
|
| 44 |
+
unset -f pydoc >/dev/null 2>&1 || true
|
| 45 |
+
|
| 46 |
+
# reset old environment variables
|
| 47 |
+
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
|
| 48 |
+
if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
|
| 49 |
+
PATH="$_OLD_VIRTUAL_PATH"
|
| 50 |
+
export PATH
|
| 51 |
+
unset _OLD_VIRTUAL_PATH
|
| 52 |
+
fi
|
| 53 |
+
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
|
| 54 |
+
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
|
| 55 |
+
export PYTHONHOME
|
| 56 |
+
unset _OLD_VIRTUAL_PYTHONHOME
|
| 57 |
+
fi
|
| 58 |
+
|
| 59 |
+
# The hash command must be called to get it to forget past
|
| 60 |
+
# commands. Without forgetting past commands the $PATH changes
|
| 61 |
+
# we made may not be respected
|
| 62 |
+
hash -r 2>/dev/null
|
| 63 |
+
|
| 64 |
+
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
|
| 65 |
+
PS1="$_OLD_VIRTUAL_PS1"
|
| 66 |
+
export PS1
|
| 67 |
+
unset _OLD_VIRTUAL_PS1
|
| 68 |
+
fi
|
| 69 |
+
|
| 70 |
+
unset VIRTUAL_ENV
|
| 71 |
+
unset VIRTUAL_ENV_PROMPT
|
| 72 |
+
if [ ! "${1-}" = "nondestructive" ] ; then
|
| 73 |
+
# Self destruct!
|
| 74 |
+
unset -f deactivate
|
| 75 |
+
fi
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
# unset irrelevant variables
|
| 79 |
+
deactivate nondestructive
|
| 80 |
+
|
| 81 |
+
VIRTUAL_ENV='/Users/alleon_g/code/nvidia_certif/.venv'
|
| 82 |
+
if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
|
| 83 |
+
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
|
| 84 |
+
fi
|
| 85 |
+
export VIRTUAL_ENV
|
| 86 |
+
|
| 87 |
+
# Unset the `SCRIPT_PATH` variable, now that the `VIRTUAL_ENV` variable
|
| 88 |
+
# has been set. This is important for relocatable environments.
|
| 89 |
+
if ! [ -z "${_OLD_SCRIPT_PATH+_}" ] ; then
|
| 90 |
+
SCRIPT_PATH="$_OLD_SCRIPT_PATH"
|
| 91 |
+
export SCRIPT_PATH
|
| 92 |
+
unset _OLD_SCRIPT_PATH
|
| 93 |
+
else
|
| 94 |
+
unset SCRIPT_PATH
|
| 95 |
+
fi
|
| 96 |
+
|
| 97 |
+
_OLD_VIRTUAL_PATH="$PATH"
|
| 98 |
+
PATH="$VIRTUAL_ENV/bin:$PATH"
|
| 99 |
+
export PATH
|
| 100 |
+
|
| 101 |
+
if [ "xnvidia-certification-quiz" != x ] ; then
|
| 102 |
+
VIRTUAL_ENV_PROMPT="nvidia-certification-quiz"
|
| 103 |
+
else
|
| 104 |
+
VIRTUAL_ENV_PROMPT=$(basename "$VIRTUAL_ENV")
|
| 105 |
+
fi
|
| 106 |
+
export VIRTUAL_ENV_PROMPT
|
| 107 |
+
|
| 108 |
+
# unset PYTHONHOME if set
|
| 109 |
+
if ! [ -z "${PYTHONHOME+_}" ] ; then
|
| 110 |
+
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
|
| 111 |
+
unset PYTHONHOME
|
| 112 |
+
fi
|
| 113 |
+
|
| 114 |
+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
|
| 115 |
+
_OLD_VIRTUAL_PS1="${PS1-}"
|
| 116 |
+
PS1="(${VIRTUAL_ENV_PROMPT}) ${PS1-}"
|
| 117 |
+
export PS1
|
| 118 |
+
fi
|
| 119 |
+
|
| 120 |
+
# Make sure to unalias pydoc if it's already there
|
| 121 |
+
alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
|
| 122 |
+
|
| 123 |
+
pydoc () {
|
| 124 |
+
python -m pydoc "$@"
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
# The hash command must be called to get it to forget past
|
| 128 |
+
# commands. Without forgetting past commands the $PATH changes
|
| 129 |
+
# we made may not be respected
|
| 130 |
+
hash -r 2>/dev/null || true
|
.venv/bin/activate.bat
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@REM Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
@REM
|
| 3 |
+
@REM Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
@REM a copy of this software and associated documentation files (the
|
| 5 |
+
@REM "Software"), to deal in the Software without restriction, including
|
| 6 |
+
@REM without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
@REM distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
@REM permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
@REM the following conditions:
|
| 10 |
+
@REM
|
| 11 |
+
@REM The above copyright notice and this permission notice shall be
|
| 12 |
+
@REM included in all copies or substantial portions of the Software.
|
| 13 |
+
@REM
|
| 14 |
+
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
@REM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
@REM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
@REM NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
@REM LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
@REM OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
@REM WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
@REM This file is UTF-8 encoded, so we need to update the current code page while executing it
|
| 23 |
+
@for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do @set _OLD_CODEPAGE=%%a
|
| 24 |
+
|
| 25 |
+
@if defined _OLD_CODEPAGE (
|
| 26 |
+
"%SystemRoot%\System32\chcp.com" 65001 > nul
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
@for %%i in ("/Users/alleon_g/code/nvidia_certif/.venv") do @set "VIRTUAL_ENV=%%~fi"
|
| 30 |
+
|
| 31 |
+
@set "VIRTUAL_ENV_PROMPT=nvidia-certification-quiz"
|
| 32 |
+
@if NOT DEFINED VIRTUAL_ENV_PROMPT (
|
| 33 |
+
@for %%d in ("%VIRTUAL_ENV%") do @set "VIRTUAL_ENV_PROMPT=%%~nxd"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
@if defined _OLD_VIRTUAL_PROMPT (
|
| 37 |
+
@set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
| 38 |
+
) else (
|
| 39 |
+
@if not defined PROMPT (
|
| 40 |
+
@set "PROMPT=$P$G"
|
| 41 |
+
)
|
| 42 |
+
@if not defined VIRTUAL_ENV_DISABLE_PROMPT (
|
| 43 |
+
@set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
|
| 44 |
+
)
|
| 45 |
+
)
|
| 46 |
+
@if not defined VIRTUAL_ENV_DISABLE_PROMPT (
|
| 47 |
+
@set "PROMPT=(%VIRTUAL_ENV_PROMPT%) %PROMPT%"
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
@REM Don't use () to avoid problems with them in %PATH%
|
| 51 |
+
@if defined _OLD_VIRTUAL_PYTHONHOME @goto ENDIFVHOME
|
| 52 |
+
@set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
|
| 53 |
+
:ENDIFVHOME
|
| 54 |
+
|
| 55 |
+
@set PYTHONHOME=
|
| 56 |
+
|
| 57 |
+
@REM if defined _OLD_VIRTUAL_PATH (
|
| 58 |
+
@if not defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH1
|
| 59 |
+
@set "PATH=%_OLD_VIRTUAL_PATH%"
|
| 60 |
+
:ENDIFVPATH1
|
| 61 |
+
@REM ) else (
|
| 62 |
+
@if defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH2
|
| 63 |
+
@set "_OLD_VIRTUAL_PATH=%PATH%"
|
| 64 |
+
:ENDIFVPATH2
|
| 65 |
+
|
| 66 |
+
@set "PATH=%VIRTUAL_ENV%\bin;%PATH%"
|
| 67 |
+
|
| 68 |
+
@if defined _OLD_CODEPAGE (
|
| 69 |
+
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
|
| 70 |
+
@set _OLD_CODEPAGE=
|
| 71 |
+
)
|
.venv/bin/activate.csh
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# This file must be used with "source bin/activate.csh" *from csh*.
|
| 23 |
+
# You cannot run it directly.
|
| 24 |
+
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
| 25 |
+
|
| 26 |
+
set newline='\
|
| 27 |
+
'
|
| 28 |
+
|
| 29 |
+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
|
| 30 |
+
|
| 31 |
+
# Unset irrelevant variables.
|
| 32 |
+
deactivate nondestructive
|
| 33 |
+
|
| 34 |
+
setenv VIRTUAL_ENV '/Users/alleon_g/code/nvidia_certif/.venv'
|
| 35 |
+
|
| 36 |
+
set _OLD_VIRTUAL_PATH="$PATH:q"
|
| 37 |
+
setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if ('nvidia-certification-quiz' != "") then
|
| 42 |
+
setenv VIRTUAL_ENV_PROMPT 'nvidia-certification-quiz'
|
| 43 |
+
else
|
| 44 |
+
setenv VIRTUAL_ENV_PROMPT "$VIRTUAL_ENV:t:q"
|
| 45 |
+
endif
|
| 46 |
+
|
| 47 |
+
if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
|
| 48 |
+
if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
|
| 49 |
+
set do_prompt = "1"
|
| 50 |
+
else
|
| 51 |
+
set do_prompt = "0"
|
| 52 |
+
endif
|
| 53 |
+
else
|
| 54 |
+
set do_prompt = "1"
|
| 55 |
+
endif
|
| 56 |
+
|
| 57 |
+
if ( $do_prompt == "1" ) then
|
| 58 |
+
# Could be in a non-interactive environment,
|
| 59 |
+
# in which case, $prompt is undefined and we wouldn't
|
| 60 |
+
# care about the prompt anyway.
|
| 61 |
+
if ( $?prompt ) then
|
| 62 |
+
set _OLD_VIRTUAL_PROMPT="$prompt:q"
|
| 63 |
+
if ( "$prompt:q" =~ *"$newline:q"* ) then
|
| 64 |
+
:
|
| 65 |
+
else
|
| 66 |
+
set prompt = '('"$VIRTUAL_ENV_PROMPT:q"') '"$prompt:q"
|
| 67 |
+
endif
|
| 68 |
+
endif
|
| 69 |
+
endif
|
| 70 |
+
|
| 71 |
+
unset env_name
|
| 72 |
+
unset do_prompt
|
| 73 |
+
|
| 74 |
+
alias pydoc python -m pydoc
|
| 75 |
+
|
| 76 |
+
rehash
|
.venv/bin/activate.fish
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
|
| 23 |
+
# Do not run it directly.
|
| 24 |
+
|
| 25 |
+
function _bashify_path -d "Converts a fish path to something bash can recognize"
|
| 26 |
+
set fishy_path $argv
|
| 27 |
+
set bashy_path $fishy_path[1]
|
| 28 |
+
for path_part in $fishy_path[2..-1]
|
| 29 |
+
set bashy_path "$bashy_path:$path_part"
|
| 30 |
+
end
|
| 31 |
+
echo $bashy_path
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
function _fishify_path -d "Converts a bash path to something fish can recognize"
|
| 35 |
+
echo $argv | tr ':' '\n'
|
| 36 |
+
end
|
| 37 |
+
|
| 38 |
+
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
|
| 39 |
+
# reset old environment variables
|
| 40 |
+
if test -n "$_OLD_VIRTUAL_PATH"
|
| 41 |
+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
|
| 42 |
+
if test (string sub -s 1 -l 1 $FISH_VERSION) -lt 3
|
| 43 |
+
set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
|
| 44 |
+
else
|
| 45 |
+
set -gx PATH $_OLD_VIRTUAL_PATH
|
| 46 |
+
end
|
| 47 |
+
set -e _OLD_VIRTUAL_PATH
|
| 48 |
+
end
|
| 49 |
+
|
| 50 |
+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
| 51 |
+
set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
|
| 52 |
+
set -e _OLD_VIRTUAL_PYTHONHOME
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
| 56 |
+
and functions -q _old_fish_prompt
|
| 57 |
+
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
|
| 58 |
+
set -l fish_function_path
|
| 59 |
+
|
| 60 |
+
# Erase virtualenv's `fish_prompt` and restore the original.
|
| 61 |
+
functions -e fish_prompt
|
| 62 |
+
functions -c _old_fish_prompt fish_prompt
|
| 63 |
+
functions -e _old_fish_prompt
|
| 64 |
+
set -e _OLD_FISH_PROMPT_OVERRIDE
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
set -e VIRTUAL_ENV
|
| 68 |
+
set -e VIRTUAL_ENV_PROMPT
|
| 69 |
+
|
| 70 |
+
if test "$argv[1]" != 'nondestructive'
|
| 71 |
+
# Self-destruct!
|
| 72 |
+
functions -e pydoc
|
| 73 |
+
functions -e deactivate
|
| 74 |
+
functions -e _bashify_path
|
| 75 |
+
functions -e _fishify_path
|
| 76 |
+
end
|
| 77 |
+
end
|
| 78 |
+
|
| 79 |
+
# Unset irrelevant variables.
|
| 80 |
+
deactivate nondestructive
|
| 81 |
+
|
| 82 |
+
set -gx VIRTUAL_ENV '/Users/alleon_g/code/nvidia_certif/.venv'
|
| 83 |
+
|
| 84 |
+
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
|
| 85 |
+
if test (string sub -s 1 -l 1 $FISH_VERSION) -lt 3
|
| 86 |
+
set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
|
| 87 |
+
else
|
| 88 |
+
set -gx _OLD_VIRTUAL_PATH $PATH
|
| 89 |
+
end
|
| 90 |
+
set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH
|
| 91 |
+
|
| 92 |
+
# Prompt override provided?
|
| 93 |
+
# If not, just use the environment name.
|
| 94 |
+
if test -n 'nvidia-certification-quiz'
|
| 95 |
+
set -gx VIRTUAL_ENV_PROMPT 'nvidia-certification-quiz'
|
| 96 |
+
else
|
| 97 |
+
set -gx VIRTUAL_ENV_PROMPT (basename "$VIRTUAL_ENV")
|
| 98 |
+
end
|
| 99 |
+
|
| 100 |
+
# Unset `$PYTHONHOME` if set.
|
| 101 |
+
if set -q PYTHONHOME
|
| 102 |
+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
| 103 |
+
set -e PYTHONHOME
|
| 104 |
+
end
|
| 105 |
+
|
| 106 |
+
function pydoc
|
| 107 |
+
python -m pydoc $argv
|
| 108 |
+
end
|
| 109 |
+
|
| 110 |
+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
| 111 |
+
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
|
| 112 |
+
functions -c fish_prompt _old_fish_prompt
|
| 113 |
+
|
| 114 |
+
function fish_prompt
|
| 115 |
+
# Run the user's prompt first; it might depend on (pipe)status.
|
| 116 |
+
set -l prompt (_old_fish_prompt)
|
| 117 |
+
|
| 118 |
+
printf '(%s) ' $VIRTUAL_ENV_PROMPT
|
| 119 |
+
|
| 120 |
+
string join -- \n $prompt # handle multi-line prompts
|
| 121 |
+
end
|
| 122 |
+
|
| 123 |
+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
| 124 |
+
end
|
.venv/bin/activate.nu
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
# virtualenv activation module:
|
| 23 |
+
# - Activate with `overlay use activate.nu`
|
| 24 |
+
# - Deactivate with `deactivate`, as usual
|
| 25 |
+
#
|
| 26 |
+
# To customize the overlay name, you can call `overlay use activate.nu as foo`, but then simply `deactivate` won't work
|
| 27 |
+
# because it is just an alias to hide the "activate" overlay. You'd need to call `overlay hide foo` manually.
|
| 28 |
+
|
| 29 |
+
module warning {
|
| 30 |
+
export-env {
|
| 31 |
+
const file = path self
|
| 32 |
+
error make -u {
|
| 33 |
+
msg: $"`($file | path basename)` is meant to be used with `overlay use`, not `source`"
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
use warning
|
| 40 |
+
|
| 41 |
+
export-env {
|
| 42 |
+
|
| 43 |
+
let nu_ver = (version | get version | split row '.' | take 2 | each { into int })
|
| 44 |
+
if $nu_ver.0 == 0 and $nu_ver.1 < 106 {
|
| 45 |
+
error make {
|
| 46 |
+
msg: 'virtualenv Nushell activation requires Nushell 0.106 or greater.'
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
def is-string [x] {
|
| 51 |
+
($x | describe) == 'string'
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
def has-env [...names] {
|
| 55 |
+
$names | each {|n| $n in $env } | all {|i| $i }
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
def is-env-true [name: string] {
|
| 59 |
+
if (has-env $name) {
|
| 60 |
+
let val = ($env | get --optional $name)
|
| 61 |
+
if ($val | describe) == 'bool' {
|
| 62 |
+
$val
|
| 63 |
+
} else {
|
| 64 |
+
not ($val | is-empty)
|
| 65 |
+
}
|
| 66 |
+
} else {
|
| 67 |
+
false
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
let virtual_env = '/Users/alleon_g/code/nvidia_certif/.venv'
|
| 72 |
+
let bin = 'bin'
|
| 73 |
+
let path_name = if (has-env 'Path') { 'Path' } else { 'PATH' }
|
| 74 |
+
let venv_path = ([$virtual_env $bin] | path join)
|
| 75 |
+
let new_path = ($env | get $path_name | prepend $venv_path)
|
| 76 |
+
let virtual_env_prompt = if ('nvidia-certification-quiz' | is-empty) {
|
| 77 |
+
($virtual_env | path basename)
|
| 78 |
+
} else {
|
| 79 |
+
'nvidia-certification-quiz'
|
| 80 |
+
}
|
| 81 |
+
let new_env = { $path_name: $new_path VIRTUAL_ENV: $virtual_env VIRTUAL_ENV_PROMPT: $virtual_env_prompt }
|
| 82 |
+
let old_prompt_command = if (has-env 'PROMPT_COMMAND') { $env.PROMPT_COMMAND } else { '' }
|
| 83 |
+
let new_env = if (is-env-true 'VIRTUAL_ENV_DISABLE_PROMPT') {
|
| 84 |
+
$new_env
|
| 85 |
+
} else {
|
| 86 |
+
let virtual_prefix = $'(char lparen)($virtual_env_prompt)(char rparen) '
|
| 87 |
+
let new_prompt = if (has-env 'PROMPT_COMMAND') {
|
| 88 |
+
if ('closure' in ($old_prompt_command | describe)) {
|
| 89 |
+
{|| $'($virtual_prefix)(do $old_prompt_command)' }
|
| 90 |
+
} else {
|
| 91 |
+
{|| $'($virtual_prefix)($old_prompt_command)' }
|
| 92 |
+
}
|
| 93 |
+
} else {
|
| 94 |
+
{|| $'($virtual_prefix)' }
|
| 95 |
+
}
|
| 96 |
+
$new_env | merge { PROMPT_COMMAND: $new_prompt VIRTUAL_PREFIX: $virtual_prefix }
|
| 97 |
+
}
|
| 98 |
+
load-env $new_env
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
export alias pydoc = python -m pydoc
|
| 102 |
+
export alias deactivate = overlay hide activate
|
.venv/bin/activate.ps1
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
$script:THIS_PATH = $myinvocation.mycommand.path
|
| 23 |
+
$script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent
|
| 24 |
+
|
| 25 |
+
function global:deactivate([switch] $NonDestructive) {
|
| 26 |
+
if (Test-Path variable:_OLD_VIRTUAL_PATH) {
|
| 27 |
+
$env:PATH = $variable:_OLD_VIRTUAL_PATH
|
| 28 |
+
Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if (Test-Path function:_old_virtual_prompt) {
|
| 32 |
+
$function:prompt = $function:_old_virtual_prompt
|
| 33 |
+
Remove-Item function:\_old_virtual_prompt
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if ($env:VIRTUAL_ENV) {
|
| 37 |
+
Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
if ($env:VIRTUAL_ENV_PROMPT) {
|
| 41 |
+
Remove-Item env:VIRTUAL_ENV_PROMPT -ErrorAction SilentlyContinue
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if (!$NonDestructive) {
|
| 45 |
+
# Self destruct!
|
| 46 |
+
Remove-Item function:deactivate
|
| 47 |
+
Remove-Item function:pydoc
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function global:pydoc {
|
| 52 |
+
python -m pydoc $args
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
# unset irrelevant variables
|
| 56 |
+
deactivate -nondestructive
|
| 57 |
+
|
| 58 |
+
$VIRTUAL_ENV = $BASE_DIR
|
| 59 |
+
$env:VIRTUAL_ENV = $VIRTUAL_ENV
|
| 60 |
+
|
| 61 |
+
if ("nvidia-certification-quiz" -ne "") {
|
| 62 |
+
$env:VIRTUAL_ENV_PROMPT = "nvidia-certification-quiz"
|
| 63 |
+
}
|
| 64 |
+
else {
|
| 65 |
+
$env:VIRTUAL_ENV_PROMPT = $( Split-Path $env:VIRTUAL_ENV -Leaf )
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH
|
| 69 |
+
|
| 70 |
+
$env:PATH = "$env:VIRTUAL_ENV/bin:" + $env:PATH
|
| 71 |
+
if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
| 72 |
+
function global:_old_virtual_prompt {
|
| 73 |
+
""
|
| 74 |
+
}
|
| 75 |
+
$function:_old_virtual_prompt = $function:prompt
|
| 76 |
+
|
| 77 |
+
function global:prompt {
|
| 78 |
+
# Add the custom prefix to the existing prompt
|
| 79 |
+
$previous_prompt_value = & $function:_old_virtual_prompt
|
| 80 |
+
("(" + $env:VIRTUAL_ENV_PROMPT + ") " + $previous_prompt_value)
|
| 81 |
+
}
|
| 82 |
+
}
|
.venv/bin/activate_this.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
# a copy of this software and associated documentation files (the
|
| 5 |
+
# "Software"), to deal in the Software without restriction, including
|
| 6 |
+
# without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
# permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
# the following conditions:
|
| 10 |
+
#
|
| 11 |
+
# The above copyright notice and this permission notice shall be
|
| 12 |
+
# included in all copies or substantial portions of the Software.
|
| 13 |
+
#
|
| 14 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
"""
|
| 23 |
+
Activate virtualenv for current interpreter:
|
| 24 |
+
|
| 25 |
+
import runpy
|
| 26 |
+
runpy.run_path(this_file)
|
| 27 |
+
|
| 28 |
+
This can be used when you must use an existing Python interpreter, not the virtualenv bin/python.
|
| 29 |
+
""" # noqa: D415
|
| 30 |
+
|
| 31 |
+
from __future__ import annotations
|
| 32 |
+
|
| 33 |
+
import os
|
| 34 |
+
import site
|
| 35 |
+
import sys
|
| 36 |
+
|
| 37 |
+
try:
|
| 38 |
+
abs_file = os.path.abspath(__file__)
|
| 39 |
+
except NameError as exc:
|
| 40 |
+
msg = "You must use import runpy; runpy.run_path(this_file)"
|
| 41 |
+
raise AssertionError(msg) from exc
|
| 42 |
+
|
| 43 |
+
bin_dir = os.path.dirname(abs_file)
|
| 44 |
+
base = bin_dir[: -len("bin") - 1] # strip away the bin part from the __file__, plus the path separator
|
| 45 |
+
|
| 46 |
+
# prepend bin to PATH (this file is inside the bin directory)
|
| 47 |
+
os.environ["PATH"] = os.pathsep.join([bin_dir, *os.environ.get("PATH", "").split(os.pathsep)])
|
| 48 |
+
os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory
|
| 49 |
+
os.environ["VIRTUAL_ENV_PROMPT"] = "nvidia-certification-quiz" or os.path.basename(base) # noqa: SIM222
|
| 50 |
+
|
| 51 |
+
# add the virtual environments libraries to the host python import mechanism
|
| 52 |
+
prev_length = len(sys.path)
|
| 53 |
+
for lib in "../lib/python3.12/site-packages".split(os.pathsep):
|
| 54 |
+
path = os.path.realpath(os.path.join(bin_dir, lib))
|
| 55 |
+
site.addsitedir(path)
|
| 56 |
+
sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
|
| 57 |
+
|
| 58 |
+
sys.real_prefix = sys.prefix
|
| 59 |
+
sys.prefix = base
|
.venv/bin/deactivate.bat
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@REM Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
@REM
|
| 3 |
+
@REM Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
@REM a copy of this software and associated documentation files (the
|
| 5 |
+
@REM "Software"), to deal in the Software without restriction, including
|
| 6 |
+
@REM without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
@REM distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
@REM permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
@REM the following conditions:
|
| 10 |
+
@REM
|
| 11 |
+
@REM The above copyright notice and this permission notice shall be
|
| 12 |
+
@REM included in all copies or substantial portions of the Software.
|
| 13 |
+
@REM
|
| 14 |
+
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
@REM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
@REM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
@REM NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
@REM LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
@REM OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
@REM WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
@set VIRTUAL_ENV=
|
| 23 |
+
@set VIRTUAL_ENV_PROMPT=
|
| 24 |
+
|
| 25 |
+
@REM Don't use () to avoid problems with them in %PATH%
|
| 26 |
+
@if not defined _OLD_VIRTUAL_PROMPT @goto ENDIFVPROMPT
|
| 27 |
+
@set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
| 28 |
+
@set _OLD_VIRTUAL_PROMPT=
|
| 29 |
+
:ENDIFVPROMPT
|
| 30 |
+
|
| 31 |
+
@if not defined _OLD_VIRTUAL_PYTHONHOME @goto ENDIFVHOME
|
| 32 |
+
@set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
|
| 33 |
+
@set _OLD_VIRTUAL_PYTHONHOME=
|
| 34 |
+
:ENDIFVHOME
|
| 35 |
+
|
| 36 |
+
@if not defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH
|
| 37 |
+
@set "PATH=%_OLD_VIRTUAL_PATH%"
|
| 38 |
+
@set _OLD_VIRTUAL_PATH=
|
| 39 |
+
:ENDIFVPATH
|
.venv/bin/f2py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from numpy.f2py.f2py2e import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/fastapi
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from fastapi.cli import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/gradio
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from gradio.cli import cli
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(cli())
|
.venv/bin/hf
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from huggingface_hub.cli.hf import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/httpx
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from httpx import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/markdown-it
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from markdown_it.cli.parse import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/numpy-config
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from numpy._configtool import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/pydoc.bat
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@REM Copyright (c) 2020-202x The virtualenv developers
|
| 2 |
+
@REM
|
| 3 |
+
@REM Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
@REM a copy of this software and associated documentation files (the
|
| 5 |
+
@REM "Software"), to deal in the Software without restriction, including
|
| 6 |
+
@REM without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
@REM distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
@REM permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
@REM the following conditions:
|
| 10 |
+
@REM
|
| 11 |
+
@REM The above copyright notice and this permission notice shall be
|
| 12 |
+
@REM included in all copies or substantial portions of the Software.
|
| 13 |
+
@REM
|
| 14 |
+
@REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
@REM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
@REM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
@REM NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
@REM LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
@REM OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
@REM WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 21 |
+
|
| 22 |
+
python.exe -m pydoc %*
|
.venv/bin/pygmentize
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from pygments.cmdline import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/python
ADDED
|
Binary file (50 kB). View file
|
|
|
.venv/bin/python3
ADDED
|
Binary file (50 kB). View file
|
|
|
.venv/bin/python3.12
ADDED
|
Binary file (50 kB). View file
|
|
|
.venv/bin/tiny-agents
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from huggingface_hub.inference._mcp.cli import app
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(app())
|
.venv/bin/tqdm
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from tqdm.cli import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/typer
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from typer.cli import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/upload_theme
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from gradio.themes.upload_theme import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/bin/uvicorn
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/Users/alleon_g/code/nvidia_certif/.venv/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import sys
|
| 4 |
+
from uvicorn.main import main
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
if sys.argv[0].endswith("-script.pyw"):
|
| 7 |
+
sys.argv[0] = sys.argv[0][:-11]
|
| 8 |
+
elif sys.argv[0].endswith(".exe"):
|
| 9 |
+
sys.argv[0] = sys.argv[0][:-4]
|
| 10 |
+
sys.exit(main())
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libXau.6.dylib
ADDED
|
Binary file (70 kB). View file
|
|
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libavif.16.3.0.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e1c6658e5c4f7d05bd81acfae4530a7bea6b1271da323417c95ea3fe033ba800
|
| 3 |
+
size 2983120
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libbrotlicommon.1.2.0.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:851cb0b0e16b970aa6b53fbf36daa629e62f10e3a906537ac772cc7c90d82265
|
| 3 |
+
size 201184
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libbrotlidec.1.2.0.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:800767d7e41e89a33a9ce8d4bcd2e24f01cbd4634d1b56d199a4de73d0e34f99
|
| 3 |
+
size 104560
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libfreetype.6.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5613ea09621a02368135ec414290d4b2af82bacfabd88404479540b8ecd1c8c8
|
| 3 |
+
size 1143856
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libharfbuzz.0.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0883a885642b606a478a3d0f5524767fbf13fe262226f5d47d32b0d03afa628
|
| 3 |
+
size 1779344
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libjpeg.62.4.0.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bf0a0ddd2e212dc2c7c54b4da26508ffe0f2cb8059292402e324e17304725f0
|
| 3 |
+
size 653536
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/liblcms2.2.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e1979d4195d1bbf5b8d69b4279ab156d14546e536597a5094341ec787beeb18f
|
| 3 |
+
size 524672
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/liblzma.5.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b071b28b11445f47db4851b185241487c65d83373962881e06067526dc1bb4fe
|
| 3 |
+
size 325120
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libopenjp2.2.5.4.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f296c969caed39463463caf2252cf4c85190302d079532845aa4e4cd4dd38e29
|
| 3 |
+
size 666432
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libpng16.16.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:193d44b758266e849295578d95773aa8ee8aa469ad157a1cfde6c61e1b448b30
|
| 3 |
+
size 344368
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libsharpyuv.0.dylib
ADDED
|
Binary file (86.2 kB). View file
|
|
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libtiff.6.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b89af19d441878b376d925e3af4bdd4c4b08556b13ff369b6bf54147043c8197
|
| 3 |
+
size 770432
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libwebp.7.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:20d91a95e56c0906a77f64d649569f3dcffdd5b104ed05dd10ee9f0877dec2c9
|
| 3 |
+
size 515712
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libwebpdemux.2.dylib
ADDED
|
Binary file (69.9 kB). View file
|
|
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libwebpmux.3.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d406917fded24e5054c38199e6bcc182e04f8ef7efaf624f94b6a5d95e267491
|
| 3 |
+
size 106368
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libxcb.1.1.0.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6e5a6c64a7a332a03490c015fea8381abc209bc2e0c26564c785c12468a9c539
|
| 3 |
+
size 277664
|
.venv/lib/python3.12/site-packages/PIL/.dylibs/libz.1.3.1.zlib-ng.dylib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d98508d8cdc78e09ede96dce052544e408a457fe65125ccb53ee58f0d3f53a16
|
| 3 |
+
size 177344
|
.venv/lib/python3.12/site-packages/PIL/AvifImagePlugin.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
from io import BytesIO
|
| 5 |
+
from typing import IO
|
| 6 |
+
|
| 7 |
+
from . import ExifTags, Image, ImageFile
|
| 8 |
+
|
| 9 |
+
try:
|
| 10 |
+
from . import _avif
|
| 11 |
+
|
| 12 |
+
SUPPORTED = True
|
| 13 |
+
except ImportError:
|
| 14 |
+
SUPPORTED = False
|
| 15 |
+
|
| 16 |
+
# Decoder options as module globals, until there is a way to pass parameters
|
| 17 |
+
# to Image.open (see https://github.com/python-pillow/Pillow/issues/569)
|
| 18 |
+
DECODE_CODEC_CHOICE = "auto"
|
| 19 |
+
DEFAULT_MAX_THREADS = 0
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_codec_version(codec_name: str) -> str | None:
|
| 23 |
+
versions = _avif.codec_versions()
|
| 24 |
+
for version in versions.split(", "):
|
| 25 |
+
if version.split(" [")[0] == codec_name:
|
| 26 |
+
return version.split(":")[-1].split(" ")[0]
|
| 27 |
+
return None
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def _accept(prefix: bytes) -> bool | str:
|
| 31 |
+
if prefix[4:8] != b"ftyp":
|
| 32 |
+
return False
|
| 33 |
+
major_brand = prefix[8:12]
|
| 34 |
+
if major_brand in (
|
| 35 |
+
# coding brands
|
| 36 |
+
b"avif",
|
| 37 |
+
b"avis",
|
| 38 |
+
# We accept files with AVIF container brands; we can't yet know if
|
| 39 |
+
# the ftyp box has the correct compatible brands, but if it doesn't
|
| 40 |
+
# then the plugin will raise a SyntaxError which Pillow will catch
|
| 41 |
+
# before moving on to the next plugin that accepts the file.
|
| 42 |
+
#
|
| 43 |
+
# Also, because this file might not actually be an AVIF file, we
|
| 44 |
+
# don't raise an error if AVIF support isn't properly compiled.
|
| 45 |
+
b"mif1",
|
| 46 |
+
b"msf1",
|
| 47 |
+
):
|
| 48 |
+
if not SUPPORTED:
|
| 49 |
+
return (
|
| 50 |
+
"image file could not be identified because AVIF support not installed"
|
| 51 |
+
)
|
| 52 |
+
return True
|
| 53 |
+
return False
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def _get_default_max_threads() -> int:
|
| 57 |
+
if DEFAULT_MAX_THREADS:
|
| 58 |
+
return DEFAULT_MAX_THREADS
|
| 59 |
+
if hasattr(os, "sched_getaffinity"):
|
| 60 |
+
return len(os.sched_getaffinity(0))
|
| 61 |
+
else:
|
| 62 |
+
return os.cpu_count() or 1
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
class AvifImageFile(ImageFile.ImageFile):
|
| 66 |
+
format = "AVIF"
|
| 67 |
+
format_description = "AVIF image"
|
| 68 |
+
__frame = -1
|
| 69 |
+
|
| 70 |
+
def _open(self) -> None:
|
| 71 |
+
if not SUPPORTED:
|
| 72 |
+
msg = "image file could not be opened because AVIF support not installed"
|
| 73 |
+
raise SyntaxError(msg)
|
| 74 |
+
|
| 75 |
+
if DECODE_CODEC_CHOICE != "auto" and not _avif.decoder_codec_available(
|
| 76 |
+
DECODE_CODEC_CHOICE
|
| 77 |
+
):
|
| 78 |
+
msg = "Invalid opening codec"
|
| 79 |
+
raise ValueError(msg)
|
| 80 |
+
|
| 81 |
+
assert self.fp is not None
|
| 82 |
+
self._decoder = _avif.AvifDecoder(
|
| 83 |
+
self.fp.read(),
|
| 84 |
+
DECODE_CODEC_CHOICE,
|
| 85 |
+
_get_default_max_threads(),
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
# Get info from decoder
|
| 89 |
+
self._size, self.n_frames, self._mode, icc, exif, exif_orientation, xmp = (
|
| 90 |
+
self._decoder.get_info()
|
| 91 |
+
)
|
| 92 |
+
self.is_animated = self.n_frames > 1
|
| 93 |
+
|
| 94 |
+
if icc:
|
| 95 |
+
self.info["icc_profile"] = icc
|
| 96 |
+
if xmp:
|
| 97 |
+
self.info["xmp"] = xmp
|
| 98 |
+
|
| 99 |
+
if exif_orientation != 1 or exif:
|
| 100 |
+
exif_data = Image.Exif()
|
| 101 |
+
if exif:
|
| 102 |
+
exif_data.load(exif)
|
| 103 |
+
original_orientation = exif_data.get(ExifTags.Base.Orientation, 1)
|
| 104 |
+
else:
|
| 105 |
+
original_orientation = 1
|
| 106 |
+
if exif_orientation != original_orientation:
|
| 107 |
+
exif_data[ExifTags.Base.Orientation] = exif_orientation
|
| 108 |
+
exif = exif_data.tobytes()
|
| 109 |
+
if exif:
|
| 110 |
+
self.info["exif"] = exif
|
| 111 |
+
self.seek(0)
|
| 112 |
+
|
| 113 |
+
def seek(self, frame: int) -> None:
|
| 114 |
+
if not self._seek_check(frame):
|
| 115 |
+
return
|
| 116 |
+
|
| 117 |
+
# Set tile
|
| 118 |
+
self.__frame = frame
|
| 119 |
+
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.mode)]
|
| 120 |
+
|
| 121 |
+
def load(self) -> Image.core.PixelAccess | None:
|
| 122 |
+
if self.tile:
|
| 123 |
+
# We need to load the image data for this frame
|
| 124 |
+
data, timescale, pts_in_timescales, duration_in_timescales = (
|
| 125 |
+
self._decoder.get_frame(self.__frame)
|
| 126 |
+
)
|
| 127 |
+
self.info["timestamp"] = round(1000 * (pts_in_timescales / timescale))
|
| 128 |
+
self.info["duration"] = round(1000 * (duration_in_timescales / timescale))
|
| 129 |
+
|
| 130 |
+
if self.fp and self._exclusive_fp:
|
| 131 |
+
self.fp.close()
|
| 132 |
+
self.fp = BytesIO(data)
|
| 133 |
+
|
| 134 |
+
return super().load()
|
| 135 |
+
|
| 136 |
+
def load_seek(self, pos: int) -> None:
|
| 137 |
+
pass
|
| 138 |
+
|
| 139 |
+
def tell(self) -> int:
|
| 140 |
+
return self.__frame
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
| 144 |
+
_save(im, fp, filename, save_all=True)
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
def _save(
|
| 148 |
+
im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False
|
| 149 |
+
) -> None:
|
| 150 |
+
info = im.encoderinfo.copy()
|
| 151 |
+
if save_all:
|
| 152 |
+
append_images = list(info.get("append_images", []))
|
| 153 |
+
else:
|
| 154 |
+
append_images = []
|
| 155 |
+
|
| 156 |
+
total = 0
|
| 157 |
+
for ims in [im] + append_images:
|
| 158 |
+
total += getattr(ims, "n_frames", 1)
|
| 159 |
+
|
| 160 |
+
quality = info.get("quality", 75)
|
| 161 |
+
if not isinstance(quality, int) or quality < 0 or quality > 100:
|
| 162 |
+
msg = "Invalid quality setting"
|
| 163 |
+
raise ValueError(msg)
|
| 164 |
+
|
| 165 |
+
duration = info.get("duration", 0)
|
| 166 |
+
subsampling = info.get("subsampling", "4:2:0")
|
| 167 |
+
speed = info.get("speed", 6)
|
| 168 |
+
max_threads = info.get("max_threads", _get_default_max_threads())
|
| 169 |
+
codec = info.get("codec", "auto")
|
| 170 |
+
if codec != "auto" and not _avif.encoder_codec_available(codec):
|
| 171 |
+
msg = "Invalid saving codec"
|
| 172 |
+
raise ValueError(msg)
|
| 173 |
+
range_ = info.get("range", "full")
|
| 174 |
+
tile_rows_log2 = info.get("tile_rows", 0)
|
| 175 |
+
tile_cols_log2 = info.get("tile_cols", 0)
|
| 176 |
+
alpha_premultiplied = bool(info.get("alpha_premultiplied", False))
|
| 177 |
+
autotiling = bool(info.get("autotiling", tile_rows_log2 == tile_cols_log2 == 0))
|
| 178 |
+
|
| 179 |
+
icc_profile = info.get("icc_profile", im.info.get("icc_profile"))
|
| 180 |
+
exif_orientation = 1
|
| 181 |
+
if exif := info.get("exif"):
|
| 182 |
+
if isinstance(exif, Image.Exif):
|
| 183 |
+
exif_data = exif
|
| 184 |
+
else:
|
| 185 |
+
exif_data = Image.Exif()
|
| 186 |
+
exif_data.load(exif)
|
| 187 |
+
if ExifTags.Base.Orientation in exif_data:
|
| 188 |
+
exif_orientation = exif_data.pop(ExifTags.Base.Orientation)
|
| 189 |
+
exif = exif_data.tobytes() if exif_data else b""
|
| 190 |
+
elif isinstance(exif, Image.Exif):
|
| 191 |
+
exif = exif_data.tobytes()
|
| 192 |
+
|
| 193 |
+
xmp = info.get("xmp")
|
| 194 |
+
|
| 195 |
+
if isinstance(xmp, str):
|
| 196 |
+
xmp = xmp.encode("utf-8")
|
| 197 |
+
|
| 198 |
+
advanced = info.get("advanced")
|
| 199 |
+
if advanced is not None:
|
| 200 |
+
if isinstance(advanced, dict):
|
| 201 |
+
advanced = advanced.items()
|
| 202 |
+
try:
|
| 203 |
+
advanced = tuple(advanced)
|
| 204 |
+
except TypeError:
|
| 205 |
+
invalid = True
|
| 206 |
+
else:
|
| 207 |
+
invalid = any(not isinstance(v, tuple) or len(v) != 2 for v in advanced)
|
| 208 |
+
if invalid:
|
| 209 |
+
msg = (
|
| 210 |
+
"advanced codec options must be a dict of key-value string "
|
| 211 |
+
"pairs or a series of key-value two-tuples"
|
| 212 |
+
)
|
| 213 |
+
raise ValueError(msg)
|
| 214 |
+
|
| 215 |
+
# Setup the AVIF encoder
|
| 216 |
+
enc = _avif.AvifEncoder(
|
| 217 |
+
im.size,
|
| 218 |
+
subsampling,
|
| 219 |
+
quality,
|
| 220 |
+
speed,
|
| 221 |
+
max_threads,
|
| 222 |
+
codec,
|
| 223 |
+
range_,
|
| 224 |
+
tile_rows_log2,
|
| 225 |
+
tile_cols_log2,
|
| 226 |
+
alpha_premultiplied,
|
| 227 |
+
autotiling,
|
| 228 |
+
icc_profile or b"",
|
| 229 |
+
exif or b"",
|
| 230 |
+
exif_orientation,
|
| 231 |
+
xmp or b"",
|
| 232 |
+
advanced,
|
| 233 |
+
)
|
| 234 |
+
|
| 235 |
+
# Add each frame
|
| 236 |
+
frame_idx = 0
|
| 237 |
+
frame_duration = 0
|
| 238 |
+
cur_idx = im.tell()
|
| 239 |
+
is_single_frame = total == 1
|
| 240 |
+
try:
|
| 241 |
+
for ims in [im] + append_images:
|
| 242 |
+
# Get number of frames in this image
|
| 243 |
+
nfr = getattr(ims, "n_frames", 1)
|
| 244 |
+
|
| 245 |
+
for idx in range(nfr):
|
| 246 |
+
ims.seek(idx)
|
| 247 |
+
|
| 248 |
+
# Make sure image mode is supported
|
| 249 |
+
frame = ims
|
| 250 |
+
rawmode = ims.mode
|
| 251 |
+
if ims.mode not in {"RGB", "RGBA"}:
|
| 252 |
+
rawmode = "RGBA" if ims.has_transparency_data else "RGB"
|
| 253 |
+
frame = ims.convert(rawmode)
|
| 254 |
+
|
| 255 |
+
# Update frame duration
|
| 256 |
+
if isinstance(duration, (list, tuple)):
|
| 257 |
+
frame_duration = duration[frame_idx]
|
| 258 |
+
else:
|
| 259 |
+
frame_duration = duration
|
| 260 |
+
|
| 261 |
+
# Append the frame to the animation encoder
|
| 262 |
+
enc.add(
|
| 263 |
+
frame.tobytes("raw", rawmode),
|
| 264 |
+
frame_duration,
|
| 265 |
+
frame.size,
|
| 266 |
+
rawmode,
|
| 267 |
+
is_single_frame,
|
| 268 |
+
)
|
| 269 |
+
|
| 270 |
+
# Update frame index
|
| 271 |
+
frame_idx += 1
|
| 272 |
+
|
| 273 |
+
if not save_all:
|
| 274 |
+
break
|
| 275 |
+
|
| 276 |
+
finally:
|
| 277 |
+
im.seek(cur_idx)
|
| 278 |
+
|
| 279 |
+
# Get the final output from the encoder
|
| 280 |
+
data = enc.finish()
|
| 281 |
+
if data is None:
|
| 282 |
+
msg = "cannot write file as AVIF (encoder returned None)"
|
| 283 |
+
raise OSError(msg)
|
| 284 |
+
|
| 285 |
+
fp.write(data)
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
Image.register_open(AvifImageFile.format, AvifImageFile, _accept)
|
| 289 |
+
if SUPPORTED:
|
| 290 |
+
Image.register_save(AvifImageFile.format, _save)
|
| 291 |
+
Image.register_save_all(AvifImageFile.format, _save_all)
|
| 292 |
+
Image.register_extensions(AvifImageFile.format, [".avif", ".avifs"])
|
| 293 |
+
Image.register_mime(AvifImageFile.format, "image/avif")
|
.venv/lib/python3.12/site-packages/PIL/BdfFontFile.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# The Python Imaging Library
|
| 3 |
+
# $Id$
|
| 4 |
+
#
|
| 5 |
+
# bitmap distribution font (bdf) file parser
|
| 6 |
+
#
|
| 7 |
+
# history:
|
| 8 |
+
# 1996-05-16 fl created (as bdf2pil)
|
| 9 |
+
# 1997-08-25 fl converted to FontFile driver
|
| 10 |
+
# 2001-05-25 fl removed bogus __init__ call
|
| 11 |
+
# 2002-11-20 fl robustification (from Kevin Cazabon, Dmitry Vasiliev)
|
| 12 |
+
# 2003-04-22 fl more robustification (from Graham Dumpleton)
|
| 13 |
+
#
|
| 14 |
+
# Copyright (c) 1997-2003 by Secret Labs AB.
|
| 15 |
+
# Copyright (c) 1997-2003 by Fredrik Lundh.
|
| 16 |
+
#
|
| 17 |
+
# See the README file for information on usage and redistribution.
|
| 18 |
+
#
|
| 19 |
+
|
| 20 |
+
"""
|
| 21 |
+
Parse X Bitmap Distribution Format (BDF)
|
| 22 |
+
"""
|
| 23 |
+
from __future__ import annotations
|
| 24 |
+
|
| 25 |
+
from typing import BinaryIO
|
| 26 |
+
|
| 27 |
+
from . import FontFile, Image
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def bdf_char(
|
| 31 |
+
f: BinaryIO,
|
| 32 |
+
) -> (
|
| 33 |
+
tuple[
|
| 34 |
+
str,
|
| 35 |
+
int,
|
| 36 |
+
tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]],
|
| 37 |
+
Image.Image,
|
| 38 |
+
]
|
| 39 |
+
| None
|
| 40 |
+
):
|
| 41 |
+
# skip to STARTCHAR
|
| 42 |
+
while True:
|
| 43 |
+
s = f.readline()
|
| 44 |
+
if not s:
|
| 45 |
+
return None
|
| 46 |
+
if s.startswith(b"STARTCHAR"):
|
| 47 |
+
break
|
| 48 |
+
id = s[9:].strip().decode("ascii")
|
| 49 |
+
|
| 50 |
+
# load symbol properties
|
| 51 |
+
props = {}
|
| 52 |
+
while True:
|
| 53 |
+
s = f.readline()
|
| 54 |
+
if not s or s.startswith(b"BITMAP"):
|
| 55 |
+
break
|
| 56 |
+
i = s.find(b" ")
|
| 57 |
+
props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")
|
| 58 |
+
|
| 59 |
+
# load bitmap
|
| 60 |
+
bitmap = bytearray()
|
| 61 |
+
while True:
|
| 62 |
+
s = f.readline()
|
| 63 |
+
if not s or s.startswith(b"ENDCHAR"):
|
| 64 |
+
break
|
| 65 |
+
bitmap += s[:-1]
|
| 66 |
+
|
| 67 |
+
# The word BBX
|
| 68 |
+
# followed by the width in x (BBw), height in y (BBh),
|
| 69 |
+
# and x and y displacement (BBxoff0, BByoff0)
|
| 70 |
+
# of the lower left corner from the origin of the character.
|
| 71 |
+
width, height, x_disp, y_disp = (int(p) for p in props["BBX"].split())
|
| 72 |
+
|
| 73 |
+
# The word DWIDTH
|
| 74 |
+
# followed by the width in x and y of the character in device pixels.
|
| 75 |
+
dwx, dwy = (int(p) for p in props["DWIDTH"].split())
|
| 76 |
+
|
| 77 |
+
bbox = (
|
| 78 |
+
(dwx, dwy),
|
| 79 |
+
(x_disp, -y_disp - height, width + x_disp, -y_disp),
|
| 80 |
+
(0, 0, width, height),
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
try:
|
| 84 |
+
im = Image.frombytes("1", (width, height), bitmap, "hex", "1")
|
| 85 |
+
except ValueError:
|
| 86 |
+
# deal with zero-width characters
|
| 87 |
+
im = Image.new("1", (width, height))
|
| 88 |
+
|
| 89 |
+
return id, int(props["ENCODING"]), bbox, im
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
class BdfFontFile(FontFile.FontFile):
|
| 93 |
+
"""Font file plugin for the X11 BDF format."""
|
| 94 |
+
|
| 95 |
+
def __init__(self, fp: BinaryIO) -> None:
|
| 96 |
+
super().__init__()
|
| 97 |
+
|
| 98 |
+
s = fp.readline()
|
| 99 |
+
if not s.startswith(b"STARTFONT 2.1"):
|
| 100 |
+
msg = "not a valid BDF file"
|
| 101 |
+
raise SyntaxError(msg)
|
| 102 |
+
|
| 103 |
+
props = {}
|
| 104 |
+
comments = []
|
| 105 |
+
|
| 106 |
+
while True:
|
| 107 |
+
s = fp.readline()
|
| 108 |
+
if not s or s.startswith(b"ENDPROPERTIES"):
|
| 109 |
+
break
|
| 110 |
+
i = s.find(b" ")
|
| 111 |
+
props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")
|
| 112 |
+
if s[:i] in [b"COMMENT", b"COPYRIGHT"]:
|
| 113 |
+
if s.find(b"LogicalFontDescription") < 0:
|
| 114 |
+
comments.append(s[i + 1 : -1].decode("ascii"))
|
| 115 |
+
|
| 116 |
+
while True:
|
| 117 |
+
c = bdf_char(fp)
|
| 118 |
+
if not c:
|
| 119 |
+
break
|
| 120 |
+
id, ch, (xy, dst, src), im = c
|
| 121 |
+
if 0 <= ch < len(self.glyph):
|
| 122 |
+
self.glyph[ch] = xy, dst, src, im
|
.venv/lib/python3.12/site-packages/PIL/BlpImagePlugin.py
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Blizzard Mipmap Format (.blp)
|
| 3 |
+
Jerome Leclanche <jerome@leclan.ch>
|
| 4 |
+
|
| 5 |
+
The contents of this file are hereby released in the public domain (CC0)
|
| 6 |
+
Full text of the CC0 license:
|
| 7 |
+
https://creativecommons.org/publicdomain/zero/1.0/
|
| 8 |
+
|
| 9 |
+
BLP1 files, used mostly in Warcraft III, are not fully supported.
|
| 10 |
+
All types of BLP2 files used in World of Warcraft are supported.
|
| 11 |
+
|
| 12 |
+
The BLP file structure consists of a header, up to 16 mipmaps of the
|
| 13 |
+
texture
|
| 14 |
+
|
| 15 |
+
Texture sizes must be powers of two, though the two dimensions do
|
| 16 |
+
not have to be equal; 512x256 is valid, but 512x200 is not.
|
| 17 |
+
The first mipmap (mipmap #0) is the full size image; each subsequent
|
| 18 |
+
mipmap halves both dimensions. The final mipmap should be 1x1.
|
| 19 |
+
|
| 20 |
+
BLP files come in many different flavours:
|
| 21 |
+
* JPEG-compressed (type == 0) - only supported for BLP1.
|
| 22 |
+
* RAW images (type == 1, encoding == 1). Each mipmap is stored as an
|
| 23 |
+
array of 8-bit values, one per pixel, left to right, top to bottom.
|
| 24 |
+
Each value is an index to the palette.
|
| 25 |
+
* DXT-compressed (type == 1, encoding == 2):
|
| 26 |
+
- DXT1 compression is used if alpha_encoding == 0.
|
| 27 |
+
- An additional alpha bit is used if alpha_depth == 1.
|
| 28 |
+
- DXT3 compression is used if alpha_encoding == 1.
|
| 29 |
+
- DXT5 compression is used if alpha_encoding == 7.
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
from __future__ import annotations
|
| 33 |
+
|
| 34 |
+
import abc
|
| 35 |
+
import os
|
| 36 |
+
import struct
|
| 37 |
+
from enum import IntEnum
|
| 38 |
+
from io import BytesIO
|
| 39 |
+
from typing import IO
|
| 40 |
+
|
| 41 |
+
from . import Image, ImageFile
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class Format(IntEnum):
|
| 45 |
+
JPEG = 0
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class Encoding(IntEnum):
|
| 49 |
+
UNCOMPRESSED = 1
|
| 50 |
+
DXT = 2
|
| 51 |
+
UNCOMPRESSED_RAW_BGRA = 3
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class AlphaEncoding(IntEnum):
|
| 55 |
+
DXT1 = 0
|
| 56 |
+
DXT3 = 1
|
| 57 |
+
DXT5 = 7
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def unpack_565(i: int) -> tuple[int, int, int]:
|
| 61 |
+
return ((i >> 11) & 0x1F) << 3, ((i >> 5) & 0x3F) << 2, (i & 0x1F) << 3
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def decode_dxt1(
|
| 65 |
+
data: bytes, alpha: bool = False
|
| 66 |
+
) -> tuple[bytearray, bytearray, bytearray, bytearray]:
|
| 67 |
+
"""
|
| 68 |
+
input: one "row" of data (i.e. will produce 4*width pixels)
|
| 69 |
+
"""
|
| 70 |
+
|
| 71 |
+
blocks = len(data) // 8 # number of blocks in row
|
| 72 |
+
ret = (bytearray(), bytearray(), bytearray(), bytearray())
|
| 73 |
+
|
| 74 |
+
for block_index in range(blocks):
|
| 75 |
+
# Decode next 8-byte block.
|
| 76 |
+
idx = block_index * 8
|
| 77 |
+
color0, color1, bits = struct.unpack_from("<HHI", data, idx)
|
| 78 |
+
|
| 79 |
+
r0, g0, b0 = unpack_565(color0)
|
| 80 |
+
r1, g1, b1 = unpack_565(color1)
|
| 81 |
+
|
| 82 |
+
# Decode this block into 4x4 pixels
|
| 83 |
+
# Accumulate the results onto our 4 row accumulators
|
| 84 |
+
for j in range(4):
|
| 85 |
+
for i in range(4):
|
| 86 |
+
# get next control op and generate a pixel
|
| 87 |
+
|
| 88 |
+
control = bits & 3
|
| 89 |
+
bits = bits >> 2
|
| 90 |
+
|
| 91 |
+
a = 0xFF
|
| 92 |
+
if control == 0:
|
| 93 |
+
r, g, b = r0, g0, b0
|
| 94 |
+
elif control == 1:
|
| 95 |
+
r, g, b = r1, g1, b1
|
| 96 |
+
elif control == 2:
|
| 97 |
+
if color0 > color1:
|
| 98 |
+
r = (2 * r0 + r1) // 3
|
| 99 |
+
g = (2 * g0 + g1) // 3
|
| 100 |
+
b = (2 * b0 + b1) // 3
|
| 101 |
+
else:
|
| 102 |
+
r = (r0 + r1) // 2
|
| 103 |
+
g = (g0 + g1) // 2
|
| 104 |
+
b = (b0 + b1) // 2
|
| 105 |
+
elif control == 3:
|
| 106 |
+
if color0 > color1:
|
| 107 |
+
r = (2 * r1 + r0) // 3
|
| 108 |
+
g = (2 * g1 + g0) // 3
|
| 109 |
+
b = (2 * b1 + b0) // 3
|
| 110 |
+
else:
|
| 111 |
+
r, g, b, a = 0, 0, 0, 0
|
| 112 |
+
|
| 113 |
+
if alpha:
|
| 114 |
+
ret[j].extend([r, g, b, a])
|
| 115 |
+
else:
|
| 116 |
+
ret[j].extend([r, g, b])
|
| 117 |
+
|
| 118 |
+
return ret
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
def decode_dxt3(data: bytes) -> tuple[bytearray, bytearray, bytearray, bytearray]:
|
| 122 |
+
"""
|
| 123 |
+
input: one "row" of data (i.e. will produce 4*width pixels)
|
| 124 |
+
"""
|
| 125 |
+
|
| 126 |
+
blocks = len(data) // 16 # number of blocks in row
|
| 127 |
+
ret = (bytearray(), bytearray(), bytearray(), bytearray())
|
| 128 |
+
|
| 129 |
+
for block_index in range(blocks):
|
| 130 |
+
idx = block_index * 16
|
| 131 |
+
block = data[idx : idx + 16]
|
| 132 |
+
# Decode next 16-byte block.
|
| 133 |
+
bits = struct.unpack_from("<8B", block)
|
| 134 |
+
color0, color1 = struct.unpack_from("<HH", block, 8)
|
| 135 |
+
|
| 136 |
+
(code,) = struct.unpack_from("<I", block, 12)
|
| 137 |
+
|
| 138 |
+
r0, g0, b0 = unpack_565(color0)
|
| 139 |
+
r1, g1, b1 = unpack_565(color1)
|
| 140 |
+
|
| 141 |
+
for j in range(4):
|
| 142 |
+
high = False # Do we want the higher bits?
|
| 143 |
+
for i in range(4):
|
| 144 |
+
alphacode_index = (4 * j + i) // 2
|
| 145 |
+
a = bits[alphacode_index]
|
| 146 |
+
if high:
|
| 147 |
+
high = False
|
| 148 |
+
a >>= 4
|
| 149 |
+
else:
|
| 150 |
+
high = True
|
| 151 |
+
a &= 0xF
|
| 152 |
+
a *= 17 # We get a value between 0 and 15
|
| 153 |
+
|
| 154 |
+
color_code = (code >> 2 * (4 * j + i)) & 0x03
|
| 155 |
+
|
| 156 |
+
if color_code == 0:
|
| 157 |
+
r, g, b = r0, g0, b0
|
| 158 |
+
elif color_code == 1:
|
| 159 |
+
r, g, b = r1, g1, b1
|
| 160 |
+
elif color_code == 2:
|
| 161 |
+
r = (2 * r0 + r1) // 3
|
| 162 |
+
g = (2 * g0 + g1) // 3
|
| 163 |
+
b = (2 * b0 + b1) // 3
|
| 164 |
+
elif color_code == 3:
|
| 165 |
+
r = (2 * r1 + r0) // 3
|
| 166 |
+
g = (2 * g1 + g0) // 3
|
| 167 |
+
b = (2 * b1 + b0) // 3
|
| 168 |
+
|
| 169 |
+
ret[j].extend([r, g, b, a])
|
| 170 |
+
|
| 171 |
+
return ret
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
def decode_dxt5(data: bytes) -> tuple[bytearray, bytearray, bytearray, bytearray]:
|
| 175 |
+
"""
|
| 176 |
+
input: one "row" of data (i.e. will produce 4 * width pixels)
|
| 177 |
+
"""
|
| 178 |
+
|
| 179 |
+
blocks = len(data) // 16 # number of blocks in row
|
| 180 |
+
ret = (bytearray(), bytearray(), bytearray(), bytearray())
|
| 181 |
+
|
| 182 |
+
for block_index in range(blocks):
|
| 183 |
+
idx = block_index * 16
|
| 184 |
+
block = data[idx : idx + 16]
|
| 185 |
+
# Decode next 16-byte block.
|
| 186 |
+
a0, a1 = struct.unpack_from("<BB", block)
|
| 187 |
+
|
| 188 |
+
bits = struct.unpack_from("<6B", block, 2)
|
| 189 |
+
alphacode1 = bits[2] | (bits[3] << 8) | (bits[4] << 16) | (bits[5] << 24)
|
| 190 |
+
alphacode2 = bits[0] | (bits[1] << 8)
|
| 191 |
+
|
| 192 |
+
color0, color1 = struct.unpack_from("<HH", block, 8)
|
| 193 |
+
|
| 194 |
+
(code,) = struct.unpack_from("<I", block, 12)
|
| 195 |
+
|
| 196 |
+
r0, g0, b0 = unpack_565(color0)
|
| 197 |
+
r1, g1, b1 = unpack_565(color1)
|
| 198 |
+
|
| 199 |
+
for j in range(4):
|
| 200 |
+
for i in range(4):
|
| 201 |
+
# get next control op and generate a pixel
|
| 202 |
+
alphacode_index = 3 * (4 * j + i)
|
| 203 |
+
|
| 204 |
+
if alphacode_index <= 12:
|
| 205 |
+
alphacode = (alphacode2 >> alphacode_index) & 0x07
|
| 206 |
+
elif alphacode_index == 15:
|
| 207 |
+
alphacode = (alphacode2 >> 15) | ((alphacode1 << 1) & 0x06)
|
| 208 |
+
else: # alphacode_index >= 18 and alphacode_index <= 45
|
| 209 |
+
alphacode = (alphacode1 >> (alphacode_index - 16)) & 0x07
|
| 210 |
+
|
| 211 |
+
if alphacode == 0:
|
| 212 |
+
a = a0
|
| 213 |
+
elif alphacode == 1:
|
| 214 |
+
a = a1
|
| 215 |
+
elif a0 > a1:
|
| 216 |
+
a = ((8 - alphacode) * a0 + (alphacode - 1) * a1) // 7
|
| 217 |
+
elif alphacode == 6:
|
| 218 |
+
a = 0
|
| 219 |
+
elif alphacode == 7:
|
| 220 |
+
a = 255
|
| 221 |
+
else:
|
| 222 |
+
a = ((6 - alphacode) * a0 + (alphacode - 1) * a1) // 5
|
| 223 |
+
|
| 224 |
+
color_code = (code >> 2 * (4 * j + i)) & 0x03
|
| 225 |
+
|
| 226 |
+
if color_code == 0:
|
| 227 |
+
r, g, b = r0, g0, b0
|
| 228 |
+
elif color_code == 1:
|
| 229 |
+
r, g, b = r1, g1, b1
|
| 230 |
+
elif color_code == 2:
|
| 231 |
+
r = (2 * r0 + r1) // 3
|
| 232 |
+
g = (2 * g0 + g1) // 3
|
| 233 |
+
b = (2 * b0 + b1) // 3
|
| 234 |
+
elif color_code == 3:
|
| 235 |
+
r = (2 * r1 + r0) // 3
|
| 236 |
+
g = (2 * g1 + g0) // 3
|
| 237 |
+
b = (2 * b1 + b0) // 3
|
| 238 |
+
|
| 239 |
+
ret[j].extend([r, g, b, a])
|
| 240 |
+
|
| 241 |
+
return ret
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
class BLPFormatError(NotImplementedError):
|
| 245 |
+
pass
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def _accept(prefix: bytes) -> bool:
|
| 249 |
+
return prefix.startswith((b"BLP1", b"BLP2"))
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
class BlpImageFile(ImageFile.ImageFile):
|
| 253 |
+
"""
|
| 254 |
+
Blizzard Mipmap Format
|
| 255 |
+
"""
|
| 256 |
+
|
| 257 |
+
format = "BLP"
|
| 258 |
+
format_description = "Blizzard Mipmap Format"
|
| 259 |
+
|
| 260 |
+
def _open(self) -> None:
|
| 261 |
+
assert self.fp is not None
|
| 262 |
+
self.magic = self.fp.read(4)
|
| 263 |
+
if not _accept(self.magic):
|
| 264 |
+
msg = f"Bad BLP magic {repr(self.magic)}"
|
| 265 |
+
raise BLPFormatError(msg)
|
| 266 |
+
|
| 267 |
+
compression = struct.unpack("<i", self.fp.read(4))[0]
|
| 268 |
+
if self.magic == b"BLP1":
|
| 269 |
+
alpha = struct.unpack("<I", self.fp.read(4))[0] != 0
|
| 270 |
+
else:
|
| 271 |
+
encoding = struct.unpack("<b", self.fp.read(1))[0]
|
| 272 |
+
alpha = struct.unpack("<b", self.fp.read(1))[0] != 0
|
| 273 |
+
alpha_encoding = struct.unpack("<b", self.fp.read(1))[0]
|
| 274 |
+
self.fp.seek(1, os.SEEK_CUR) # mips
|
| 275 |
+
|
| 276 |
+
self._size = struct.unpack("<II", self.fp.read(8))
|
| 277 |
+
|
| 278 |
+
args: tuple[int, int, bool] | tuple[int, int, bool, int]
|
| 279 |
+
if self.magic == b"BLP1":
|
| 280 |
+
encoding = struct.unpack("<i", self.fp.read(4))[0]
|
| 281 |
+
self.fp.seek(4, os.SEEK_CUR) # subtype
|
| 282 |
+
|
| 283 |
+
args = (compression, encoding, alpha)
|
| 284 |
+
offset = 28
|
| 285 |
+
else:
|
| 286 |
+
args = (compression, encoding, alpha, alpha_encoding)
|
| 287 |
+
offset = 20
|
| 288 |
+
|
| 289 |
+
decoder = self.magic.decode()
|
| 290 |
+
|
| 291 |
+
self._mode = "RGBA" if alpha else "RGB"
|
| 292 |
+
self.tile = [ImageFile._Tile(decoder, (0, 0) + self.size, offset, args)]
|
| 293 |
+
|
| 294 |
+
|
| 295 |
+
class _BLPBaseDecoder(abc.ABC, ImageFile.PyDecoder):
|
| 296 |
+
_pulls_fd = True
|
| 297 |
+
|
| 298 |
+
def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]:
|
| 299 |
+
try:
|
| 300 |
+
self._read_header()
|
| 301 |
+
self._load()
|
| 302 |
+
except struct.error as e:
|
| 303 |
+
msg = "Truncated BLP file"
|
| 304 |
+
raise OSError(msg) from e
|
| 305 |
+
return -1, 0
|
| 306 |
+
|
| 307 |
+
@abc.abstractmethod
|
| 308 |
+
def _load(self) -> None:
|
| 309 |
+
pass
|
| 310 |
+
|
| 311 |
+
def _read_header(self) -> None:
|
| 312 |
+
self._offsets = struct.unpack("<16I", self._safe_read(16 * 4))
|
| 313 |
+
self._lengths = struct.unpack("<16I", self._safe_read(16 * 4))
|
| 314 |
+
|
| 315 |
+
def _safe_read(self, length: int) -> bytes:
|
| 316 |
+
assert self.fd is not None
|
| 317 |
+
return ImageFile._safe_read(self.fd, length)
|
| 318 |
+
|
| 319 |
+
def _read_palette(self) -> list[tuple[int, int, int, int]]:
|
| 320 |
+
ret = []
|
| 321 |
+
for i in range(256):
|
| 322 |
+
try:
|
| 323 |
+
b, g, r, a = struct.unpack("<4B", self._safe_read(4))
|
| 324 |
+
except struct.error:
|
| 325 |
+
break
|
| 326 |
+
ret.append((b, g, r, a))
|
| 327 |
+
return ret
|
| 328 |
+
|
| 329 |
+
def _read_bgra(
|
| 330 |
+
self, palette: list[tuple[int, int, int, int]], alpha: bool
|
| 331 |
+
) -> bytearray:
|
| 332 |
+
data = bytearray()
|
| 333 |
+
_data = BytesIO(self._safe_read(self._lengths[0]))
|
| 334 |
+
while True:
|
| 335 |
+
try:
|
| 336 |
+
(offset,) = struct.unpack("<B", _data.read(1))
|
| 337 |
+
except struct.error:
|
| 338 |
+
break
|
| 339 |
+
b, g, r, a = palette[offset]
|
| 340 |
+
d: tuple[int, ...] = (r, g, b)
|
| 341 |
+
if alpha:
|
| 342 |
+
d += (a,)
|
| 343 |
+
data.extend(d)
|
| 344 |
+
return data
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
class BLP1Decoder(_BLPBaseDecoder):
|
| 348 |
+
def _load(self) -> None:
|
| 349 |
+
self._compression, self._encoding, alpha = self.args
|
| 350 |
+
|
| 351 |
+
if self._compression == Format.JPEG:
|
| 352 |
+
self._decode_jpeg_stream()
|
| 353 |
+
|
| 354 |
+
elif self._compression == 1:
|
| 355 |
+
if self._encoding in (4, 5):
|
| 356 |
+
palette = self._read_palette()
|
| 357 |
+
data = self._read_bgra(palette, alpha)
|
| 358 |
+
self.set_as_raw(data)
|
| 359 |
+
else:
|
| 360 |
+
msg = f"Unsupported BLP encoding {repr(self._encoding)}"
|
| 361 |
+
raise BLPFormatError(msg)
|
| 362 |
+
else:
|
| 363 |
+
msg = f"Unsupported BLP compression {repr(self._encoding)}"
|
| 364 |
+
raise BLPFormatError(msg)
|
| 365 |
+
|
| 366 |
+
def _decode_jpeg_stream(self) -> None:
|
| 367 |
+
from .JpegImagePlugin import JpegImageFile
|
| 368 |
+
|
| 369 |
+
(jpeg_header_size,) = struct.unpack("<I", self._safe_read(4))
|
| 370 |
+
jpeg_header = self._safe_read(jpeg_header_size)
|
| 371 |
+
assert self.fd is not None
|
| 372 |
+
self._safe_read(self._offsets[0] - self.fd.tell()) # What IS this?
|
| 373 |
+
data = self._safe_read(self._lengths[0])
|
| 374 |
+
data = jpeg_header + data
|
| 375 |
+
image = JpegImageFile(BytesIO(data))
|
| 376 |
+
Image._decompression_bomb_check(image.size)
|
| 377 |
+
if image.mode == "CMYK":
|
| 378 |
+
args = image.tile[0].args
|
| 379 |
+
assert isinstance(args, tuple)
|
| 380 |
+
image.tile = [image.tile[0]._replace(args=(args[0], "CMYK"))]
|
| 381 |
+
self.set_as_raw(image.convert("RGB").tobytes(), "BGR")
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
class BLP2Decoder(_BLPBaseDecoder):
|
| 385 |
+
def _load(self) -> None:
|
| 386 |
+
self._compression, self._encoding, alpha, self._alpha_encoding = self.args
|
| 387 |
+
|
| 388 |
+
palette = self._read_palette()
|
| 389 |
+
|
| 390 |
+
assert self.fd is not None
|
| 391 |
+
self.fd.seek(self._offsets[0])
|
| 392 |
+
|
| 393 |
+
if self._compression == 1:
|
| 394 |
+
# Uncompressed or DirectX compression
|
| 395 |
+
|
| 396 |
+
if self._encoding == Encoding.UNCOMPRESSED:
|
| 397 |
+
data = self._read_bgra(palette, alpha)
|
| 398 |
+
|
| 399 |
+
elif self._encoding == Encoding.DXT:
|
| 400 |
+
data = bytearray()
|
| 401 |
+
if self._alpha_encoding == AlphaEncoding.DXT1:
|
| 402 |
+
linesize = (self.state.xsize + 3) // 4 * 8
|
| 403 |
+
for yb in range((self.state.ysize + 3) // 4):
|
| 404 |
+
for d in decode_dxt1(self._safe_read(linesize), alpha):
|
| 405 |
+
data += d
|
| 406 |
+
|
| 407 |
+
elif self._alpha_encoding == AlphaEncoding.DXT3:
|
| 408 |
+
linesize = (self.state.xsize + 3) // 4 * 16
|
| 409 |
+
for yb in range((self.state.ysize + 3) // 4):
|
| 410 |
+
for d in decode_dxt3(self._safe_read(linesize)):
|
| 411 |
+
data += d
|
| 412 |
+
|
| 413 |
+
elif self._alpha_encoding == AlphaEncoding.DXT5:
|
| 414 |
+
linesize = (self.state.xsize + 3) // 4 * 16
|
| 415 |
+
for yb in range((self.state.ysize + 3) // 4):
|
| 416 |
+
for d in decode_dxt5(self._safe_read(linesize)):
|
| 417 |
+
data += d
|
| 418 |
+
else:
|
| 419 |
+
msg = f"Unsupported alpha encoding {repr(self._alpha_encoding)}"
|
| 420 |
+
raise BLPFormatError(msg)
|
| 421 |
+
else:
|
| 422 |
+
msg = f"Unknown BLP encoding {repr(self._encoding)}"
|
| 423 |
+
raise BLPFormatError(msg)
|
| 424 |
+
|
| 425 |
+
else:
|
| 426 |
+
msg = f"Unknown BLP compression {repr(self._compression)}"
|
| 427 |
+
raise BLPFormatError(msg)
|
| 428 |
+
|
| 429 |
+
self.set_as_raw(data)
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
class BLPEncoder(ImageFile.PyEncoder):
|
| 433 |
+
_pushes_fd = True
|
| 434 |
+
|
| 435 |
+
def _write_palette(self) -> bytes:
|
| 436 |
+
data = b""
|
| 437 |
+
assert self.im is not None
|
| 438 |
+
palette = self.im.getpalette("RGBA", "RGBA")
|
| 439 |
+
for i in range(len(palette) // 4):
|
| 440 |
+
r, g, b, a = palette[i * 4 : (i + 1) * 4]
|
| 441 |
+
data += struct.pack("<4B", b, g, r, a)
|
| 442 |
+
while len(data) < 256 * 4:
|
| 443 |
+
data += b"\x00" * 4
|
| 444 |
+
return data
|
| 445 |
+
|
| 446 |
+
def encode(self, bufsize: int) -> tuple[int, int, bytes]:
|
| 447 |
+
palette_data = self._write_palette()
|
| 448 |
+
|
| 449 |
+
offset = 20 + 16 * 4 * 2 + len(palette_data)
|
| 450 |
+
data = struct.pack("<16I", offset, *((0,) * 15))
|
| 451 |
+
|
| 452 |
+
assert self.im is not None
|
| 453 |
+
w, h = self.im.size
|
| 454 |
+
data += struct.pack("<16I", w * h, *((0,) * 15))
|
| 455 |
+
|
| 456 |
+
data += palette_data
|
| 457 |
+
|
| 458 |
+
for y in range(h):
|
| 459 |
+
for x in range(w):
|
| 460 |
+
data += struct.pack("<B", self.im.getpixel((x, y)))
|
| 461 |
+
|
| 462 |
+
return len(data), 0, data
|
| 463 |
+
|
| 464 |
+
|
| 465 |
+
def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
| 466 |
+
if im.mode != "P":
|
| 467 |
+
msg = "Unsupported BLP image mode"
|
| 468 |
+
raise ValueError(msg)
|
| 469 |
+
|
| 470 |
+
magic = b"BLP1" if im.encoderinfo.get("blp_version") == "BLP1" else b"BLP2"
|
| 471 |
+
fp.write(magic)
|
| 472 |
+
|
| 473 |
+
assert im.palette is not None
|
| 474 |
+
fp.write(struct.pack("<i", 1)) # Uncompressed or DirectX compression
|
| 475 |
+
|
| 476 |
+
alpha_depth = 1 if im.palette.mode == "RGBA" else 0
|
| 477 |
+
if magic == b"BLP1":
|
| 478 |
+
fp.write(struct.pack("<L", alpha_depth))
|
| 479 |
+
else:
|
| 480 |
+
fp.write(struct.pack("<b", Encoding.UNCOMPRESSED))
|
| 481 |
+
fp.write(struct.pack("<b", alpha_depth))
|
| 482 |
+
fp.write(struct.pack("<b", 0)) # alpha encoding
|
| 483 |
+
fp.write(struct.pack("<b", 0)) # mips
|
| 484 |
+
fp.write(struct.pack("<II", *im.size))
|
| 485 |
+
if magic == b"BLP1":
|
| 486 |
+
fp.write(struct.pack("<i", 5))
|
| 487 |
+
fp.write(struct.pack("<i", 0))
|
| 488 |
+
|
| 489 |
+
ImageFile._save(im, fp, [ImageFile._Tile("BLP", (0, 0) + im.size, 0, im.mode)])
|
| 490 |
+
|
| 491 |
+
|
| 492 |
+
Image.register_open(BlpImageFile.format, BlpImageFile, _accept)
|
| 493 |
+
Image.register_extension(BlpImageFile.format, ".blp")
|
| 494 |
+
Image.register_decoder("BLP1", BLP1Decoder)
|
| 495 |
+
Image.register_decoder("BLP2", BLP2Decoder)
|
| 496 |
+
|
| 497 |
+
Image.register_save(BlpImageFile.format, _save)
|
| 498 |
+
Image.register_encoder("BLP", BLPEncoder)
|