@steerable/runtime-darwin-arm64 0.0.0-stage → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2192) hide show
  1. package/bin/steerable-egress-proxy +0 -0
  2. package/package.json +25 -4
  3. package/python-runtime/manifest.json +8 -0
  4. package/python-runtime/python/bin/2to3 +7 -0
  5. package/python-runtime/python/bin/2to3-3.12 +7 -0
  6. package/python-runtime/python/bin/cffi-gen-src +6 -0
  7. package/python-runtime/python/bin/dotenv +6 -0
  8. package/python-runtime/python/bin/httpx +6 -0
  9. package/python-runtime/python/bin/idle3 +7 -0
  10. package/python-runtime/python/bin/idle3.12 +7 -0
  11. package/python-runtime/python/bin/idna +6 -0
  12. package/python-runtime/python/bin/jsonschema +6 -0
  13. package/python-runtime/python/bin/mcp +6 -0
  14. package/python-runtime/python/bin/pydoc3 +7 -0
  15. package/python-runtime/python/bin/pydoc3.12 +7 -0
  16. package/python-runtime/python/bin/python +0 -0
  17. package/python-runtime/python/bin/python3 +0 -0
  18. package/python-runtime/python/bin/python3-config +76 -0
  19. package/python-runtime/python/bin/python3.12 +0 -0
  20. package/python-runtime/python/bin/python3.12-config +76 -0
  21. package/python-runtime/python/bin/steerable-sidecar +6 -0
  22. package/python-runtime/python/bin/steerable-sidecar-acp +6 -0
  23. package/python-runtime/python/bin/steerable-sidecar-headless +6 -0
  24. package/python-runtime/python/bin/uvicorn +6 -0
  25. package/python-runtime/python/include/python3.12/Python.h +109 -0
  26. package/python-runtime/python/include/python3.12/abstract.h +899 -0
  27. package/python-runtime/python/include/python3.12/bltinmodule.h +14 -0
  28. package/python-runtime/python/include/python3.12/boolobject.h +42 -0
  29. package/python-runtime/python/include/python3.12/bytearrayobject.h +44 -0
  30. package/python-runtime/python/include/python3.12/bytesobject.h +69 -0
  31. package/python-runtime/python/include/python3.12/ceval.h +168 -0
  32. package/python-runtime/python/include/python3.12/codecs.h +248 -0
  33. package/python-runtime/python/include/python3.12/compile.h +22 -0
  34. package/python-runtime/python/include/python3.12/complexobject.h +30 -0
  35. package/python-runtime/python/include/python3.12/cpython/abstract.h +206 -0
  36. package/python-runtime/python/include/python3.12/cpython/bytearrayobject.h +34 -0
  37. package/python-runtime/python/include/python3.12/cpython/bytesobject.h +133 -0
  38. package/python-runtime/python/include/python3.12/cpython/cellobject.h +44 -0
  39. package/python-runtime/python/include/python3.12/cpython/ceval.h +35 -0
  40. package/python-runtime/python/include/python3.12/cpython/classobject.h +71 -0
  41. package/python-runtime/python/include/python3.12/cpython/code.h +389 -0
  42. package/python-runtime/python/include/python3.12/cpython/compile.h +69 -0
  43. package/python-runtime/python/include/python3.12/cpython/complexobject.h +44 -0
  44. package/python-runtime/python/include/python3.12/cpython/context.h +78 -0
  45. package/python-runtime/python/include/python3.12/cpython/descrobject.h +64 -0
  46. package/python-runtime/python/include/python3.12/cpython/dictobject.h +118 -0
  47. package/python-runtime/python/include/python3.12/cpython/fileobject.h +19 -0
  48. package/python-runtime/python/include/python3.12/cpython/fileutils.h +8 -0
  49. package/python-runtime/python/include/python3.12/cpython/floatobject.h +27 -0
  50. package/python-runtime/python/include/python3.12/cpython/frameobject.h +29 -0
  51. package/python-runtime/python/include/python3.12/cpython/funcobject.h +190 -0
  52. package/python-runtime/python/include/python3.12/cpython/genobject.h +89 -0
  53. package/python-runtime/python/include/python3.12/cpython/import.h +46 -0
  54. package/python-runtime/python/include/python3.12/cpython/initconfig.h +256 -0
  55. package/python-runtime/python/include/python3.12/cpython/interpreteridobject.h +11 -0
  56. package/python-runtime/python/include/python3.12/cpython/listobject.h +47 -0
  57. package/python-runtime/python/include/python3.12/cpython/longintrepr.h +133 -0
  58. package/python-runtime/python/include/python3.12/cpython/longobject.h +100 -0
  59. package/python-runtime/python/include/python3.12/cpython/memoryobject.h +52 -0
  60. package/python-runtime/python/include/python3.12/cpython/methodobject.h +66 -0
  61. package/python-runtime/python/include/python3.12/cpython/modsupport.h +109 -0
  62. package/python-runtime/python/include/python3.12/cpython/object.h +575 -0
  63. package/python-runtime/python/include/python3.12/cpython/objimpl.h +95 -0
  64. package/python-runtime/python/include/python3.12/cpython/odictobject.h +43 -0
  65. package/python-runtime/python/include/python3.12/cpython/picklebufobject.h +31 -0
  66. package/python-runtime/python/include/python3.12/cpython/pthread_stubs.h +88 -0
  67. package/python-runtime/python/include/python3.12/cpython/pyctype.h +39 -0
  68. package/python-runtime/python/include/python3.12/cpython/pydebug.h +38 -0
  69. package/python-runtime/python/include/python3.12/cpython/pyerrors.h +178 -0
  70. package/python-runtime/python/include/python3.12/cpython/pyfpe.h +15 -0
  71. package/python-runtime/python/include/python3.12/cpython/pyframe.h +35 -0
  72. package/python-runtime/python/include/python3.12/cpython/pylifecycle.h +111 -0
  73. package/python-runtime/python/include/python3.12/cpython/pymem.h +98 -0
  74. package/python-runtime/python/include/python3.12/cpython/pystate.h +456 -0
  75. package/python-runtime/python/include/python3.12/cpython/pythonrun.h +121 -0
  76. package/python-runtime/python/include/python3.12/cpython/pythread.h +42 -0
  77. package/python-runtime/python/include/python3.12/cpython/pytime.h +331 -0
  78. package/python-runtime/python/include/python3.12/cpython/setobject.h +72 -0
  79. package/python-runtime/python/include/python3.12/cpython/sysmodule.h +16 -0
  80. package/python-runtime/python/include/python3.12/cpython/traceback.h +16 -0
  81. package/python-runtime/python/include/python3.12/cpython/tupleobject.h +39 -0
  82. package/python-runtime/python/include/python3.12/cpython/unicodeobject.h +976 -0
  83. package/python-runtime/python/include/python3.12/cpython/warnings.h +20 -0
  84. package/python-runtime/python/include/python3.12/cpython/weakrefobject.h +56 -0
  85. package/python-runtime/python/include/python3.12/datetime.h +267 -0
  86. package/python-runtime/python/include/python3.12/descrobject.h +100 -0
  87. package/python-runtime/python/include/python3.12/dictobject.h +97 -0
  88. package/python-runtime/python/include/python3.12/dynamic_annotations.h +499 -0
  89. package/python-runtime/python/include/python3.12/enumobject.h +17 -0
  90. package/python-runtime/python/include/python3.12/errcode.h +38 -0
  91. package/python-runtime/python/include/python3.12/exports.h +36 -0
  92. package/python-runtime/python/include/python3.12/fileobject.h +49 -0
  93. package/python-runtime/python/include/python3.12/fileutils.h +26 -0
  94. package/python-runtime/python/include/python3.12/floatobject.h +54 -0
  95. package/python-runtime/python/include/python3.12/frameobject.h +20 -0
  96. package/python-runtime/python/include/python3.12/genericaliasobject.h +14 -0
  97. package/python-runtime/python/include/python3.12/import.h +98 -0
  98. package/python-runtime/python/include/python3.12/internal/pycore_abstract.h +25 -0
  99. package/python-runtime/python/include/python3.12/internal/pycore_asdl.h +112 -0
  100. package/python-runtime/python/include/python3.12/internal/pycore_ast.h +922 -0
  101. package/python-runtime/python/include/python3.12/internal/pycore_ast_state.h +265 -0
  102. package/python-runtime/python/include/python3.12/internal/pycore_atexit.h +57 -0
  103. package/python-runtime/python/include/python3.12/internal/pycore_atomic.h +557 -0
  104. package/python-runtime/python/include/python3.12/internal/pycore_atomic_funcs.h +94 -0
  105. package/python-runtime/python/include/python3.12/internal/pycore_bitutils.h +186 -0
  106. package/python-runtime/python/include/python3.12/internal/pycore_blocks_output_buffer.h +317 -0
  107. package/python-runtime/python/include/python3.12/internal/pycore_bytes_methods.h +73 -0
  108. package/python-runtime/python/include/python3.12/internal/pycore_bytesobject.h +47 -0
  109. package/python-runtime/python/include/python3.12/internal/pycore_call.h +133 -0
  110. package/python-runtime/python/include/python3.12/internal/pycore_ceval.h +164 -0
  111. package/python-runtime/python/include/python3.12/internal/pycore_ceval_state.h +103 -0
  112. package/python-runtime/python/include/python3.12/internal/pycore_code.h +496 -0
  113. package/python-runtime/python/include/python3.12/internal/pycore_compile.h +118 -0
  114. package/python-runtime/python/include/python3.12/internal/pycore_condvar.h +99 -0
  115. package/python-runtime/python/include/python3.12/internal/pycore_context.h +71 -0
  116. package/python-runtime/python/include/python3.12/internal/pycore_descrobject.h +26 -0
  117. package/python-runtime/python/include/python3.12/internal/pycore_dict.h +199 -0
  118. package/python-runtime/python/include/python3.12/internal/pycore_dict_state.h +50 -0
  119. package/python-runtime/python/include/python3.12/internal/pycore_dtoa.h +69 -0
  120. package/python-runtime/python/include/python3.12/internal/pycore_emscripten_signal.h +25 -0
  121. package/python-runtime/python/include/python3.12/internal/pycore_exceptions.h +37 -0
  122. package/python-runtime/python/include/python3.12/internal/pycore_faulthandler.h +99 -0
  123. package/python-runtime/python/include/python3.12/internal/pycore_fileutils.h +292 -0
  124. package/python-runtime/python/include/python3.12/internal/pycore_fileutils_windows.h +98 -0
  125. package/python-runtime/python/include/python3.12/internal/pycore_floatobject.h +71 -0
  126. package/python-runtime/python/include/python3.12/internal/pycore_flowgraph.h +120 -0
  127. package/python-runtime/python/include/python3.12/internal/pycore_format.h +27 -0
  128. package/python-runtime/python/include/python3.12/internal/pycore_frame.h +283 -0
  129. package/python-runtime/python/include/python3.12/internal/pycore_function.h +26 -0
  130. package/python-runtime/python/include/python3.12/internal/pycore_gc.h +211 -0
  131. package/python-runtime/python/include/python3.12/internal/pycore_genobject.h +49 -0
  132. package/python-runtime/python/include/python3.12/internal/pycore_getopt.h +22 -0
  133. package/python-runtime/python/include/python3.12/internal/pycore_gil.h +50 -0
  134. package/python-runtime/python/include/python3.12/internal/pycore_global_objects.h +105 -0
  135. package/python-runtime/python/include/python3.12/internal/pycore_global_objects_fini_generated.h +1517 -0
  136. package/python-runtime/python/include/python3.12/internal/pycore_global_strings.h +777 -0
  137. package/python-runtime/python/include/python3.12/internal/pycore_hamt.h +134 -0
  138. package/python-runtime/python/include/python3.12/internal/pycore_hashtable.h +149 -0
  139. package/python-runtime/python/include/python3.12/internal/pycore_import.h +183 -0
  140. package/python-runtime/python/include/python3.12/internal/pycore_initconfig.h +179 -0
  141. package/python-runtime/python/include/python3.12/internal/pycore_instruments.h +106 -0
  142. package/python-runtime/python/include/python3.12/internal/pycore_interp.h +275 -0
  143. package/python-runtime/python/include/python3.12/internal/pycore_intrinsics.h +32 -0
  144. package/python-runtime/python/include/python3.12/internal/pycore_list.h +83 -0
  145. package/python-runtime/python/include/python3.12/internal/pycore_long.h +258 -0
  146. package/python-runtime/python/include/python3.12/internal/pycore_memoryobject.h +18 -0
  147. package/python-runtime/python/include/python3.12/internal/pycore_moduleobject.h +45 -0
  148. package/python-runtime/python/include/python3.12/internal/pycore_namespace.h +20 -0
  149. package/python-runtime/python/include/python3.12/internal/pycore_object.h +455 -0
  150. package/python-runtime/python/include/python3.12/internal/pycore_object_state.h +42 -0
  151. package/python-runtime/python/include/python3.12/internal/pycore_obmalloc.h +700 -0
  152. package/python-runtime/python/include/python3.12/internal/pycore_obmalloc_init.h +73 -0
  153. package/python-runtime/python/include/python3.12/internal/pycore_opcode.h +587 -0
  154. package/python-runtime/python/include/python3.12/internal/pycore_opcode_utils.h +92 -0
  155. package/python-runtime/python/include/python3.12/internal/pycore_parser.h +66 -0
  156. package/python-runtime/python/include/python3.12/internal/pycore_pathconfig.h +24 -0
  157. package/python-runtime/python/include/python3.12/internal/pycore_pyarena.h +64 -0
  158. package/python-runtime/python/include/python3.12/internal/pycore_pyerrors.h +129 -0
  159. package/python-runtime/python/include/python3.12/internal/pycore_pyhash.h +40 -0
  160. package/python-runtime/python/include/python3.12/internal/pycore_pylifecycle.h +99 -0
  161. package/python-runtime/python/include/python3.12/internal/pycore_pymath.h +205 -0
  162. package/python-runtime/python/include/python3.12/internal/pycore_pymem.h +98 -0
  163. package/python-runtime/python/include/python3.12/internal/pycore_pymem_init.h +85 -0
  164. package/python-runtime/python/include/python3.12/internal/pycore_pystate.h +180 -0
  165. package/python-runtime/python/include/python3.12/internal/pycore_pythread.h +81 -0
  166. package/python-runtime/python/include/python3.12/internal/pycore_range.h +21 -0
  167. package/python-runtime/python/include/python3.12/internal/pycore_runtime.h +235 -0
  168. package/python-runtime/python/include/python3.12/internal/pycore_runtime_init.h +188 -0
  169. package/python-runtime/python/include/python3.12/internal/pycore_runtime_init_generated.h +1511 -0
  170. package/python-runtime/python/include/python3.12/internal/pycore_signal.h +98 -0
  171. package/python-runtime/python/include/python3.12/internal/pycore_sliceobject.h +22 -0
  172. package/python-runtime/python/include/python3.12/internal/pycore_strhex.h +36 -0
  173. package/python-runtime/python/include/python3.12/internal/pycore_structseq.h +39 -0
  174. package/python-runtime/python/include/python3.12/internal/pycore_symtable.h +160 -0
  175. package/python-runtime/python/include/python3.12/internal/pycore_sysmodule.h +34 -0
  176. package/python-runtime/python/include/python3.12/internal/pycore_time.h +25 -0
  177. package/python-runtime/python/include/python3.12/internal/pycore_token.h +108 -0
  178. package/python-runtime/python/include/python3.12/internal/pycore_traceback.h +101 -0
  179. package/python-runtime/python/include/python3.12/internal/pycore_tracemalloc.h +123 -0
  180. package/python-runtime/python/include/python3.12/internal/pycore_tuple.h +79 -0
  181. package/python-runtime/python/include/python3.12/internal/pycore_typeobject.h +151 -0
  182. package/python-runtime/python/include/python3.12/internal/pycore_typevarobject.h +24 -0
  183. package/python-runtime/python/include/python3.12/internal/pycore_ucnhash.h +34 -0
  184. package/python-runtime/python/include/python3.12/internal/pycore_unicodeobject.h +86 -0
  185. package/python-runtime/python/include/python3.12/internal/pycore_unicodeobject_generated.h +2832 -0
  186. package/python-runtime/python/include/python3.12/internal/pycore_unionobject.h +23 -0
  187. package/python-runtime/python/include/python3.12/internal/pycore_warnings.h +29 -0
  188. package/python-runtime/python/include/python3.12/interpreteridobject.h +17 -0
  189. package/python-runtime/python/include/python3.12/intrcheck.h +30 -0
  190. package/python-runtime/python/include/python3.12/iterobject.h +27 -0
  191. package/python-runtime/python/include/python3.12/listobject.h +52 -0
  192. package/python-runtime/python/include/python3.12/longobject.h +108 -0
  193. package/python-runtime/python/include/python3.12/marshal.h +31 -0
  194. package/python-runtime/python/include/python3.12/memoryobject.h +34 -0
  195. package/python-runtime/python/include/python3.12/methodobject.h +132 -0
  196. package/python-runtime/python/include/python3.12/modsupport.h +168 -0
  197. package/python-runtime/python/include/python3.12/moduleobject.h +119 -0
  198. package/python-runtime/python/include/python3.12/object.h +993 -0
  199. package/python-runtime/python/include/python3.12/objimpl.h +234 -0
  200. package/python-runtime/python/include/python3.12/opcode.h +271 -0
  201. package/python-runtime/python/include/python3.12/osdefs.h +51 -0
  202. package/python-runtime/python/include/python3.12/osmodule.h +17 -0
  203. package/python-runtime/python/include/python3.12/patchlevel.h +35 -0
  204. package/python-runtime/python/include/python3.12/py_curses.h +99 -0
  205. package/python-runtime/python/include/python3.12/pybuffer.h +145 -0
  206. package/python-runtime/python/include/python3.12/pycapsule.h +59 -0
  207. package/python-runtime/python/include/python3.12/pyconfig.h +1943 -0
  208. package/python-runtime/python/include/python3.12/pydtrace.h +59 -0
  209. package/python-runtime/python/include/python3.12/pyerrors.h +337 -0
  210. package/python-runtime/python/include/python3.12/pyexpat.h +62 -0
  211. package/python-runtime/python/include/python3.12/pyframe.h +26 -0
  212. package/python-runtime/python/include/python3.12/pyhash.h +144 -0
  213. package/python-runtime/python/include/python3.12/pylifecycle.h +78 -0
  214. package/python-runtime/python/include/python3.12/pymacconfig.h +99 -0
  215. package/python-runtime/python/include/python3.12/pymacro.h +172 -0
  216. package/python-runtime/python/include/python3.12/pymath.h +62 -0
  217. package/python-runtime/python/include/python3.12/pymem.h +104 -0
  218. package/python-runtime/python/include/python3.12/pyport.h +782 -0
  219. package/python-runtime/python/include/python3.12/pystate.h +132 -0
  220. package/python-runtime/python/include/python3.12/pystats.h +110 -0
  221. package/python-runtime/python/include/python3.12/pystrcmp.h +23 -0
  222. package/python-runtime/python/include/python3.12/pystrtod.h +46 -0
  223. package/python-runtime/python/include/python3.12/pythonrun.h +49 -0
  224. package/python-runtime/python/include/python3.12/pythread.h +135 -0
  225. package/python-runtime/python/include/python3.12/pytypedefs.h +30 -0
  226. package/python-runtime/python/include/python3.12/rangeobject.h +27 -0
  227. package/python-runtime/python/include/python3.12/setobject.h +49 -0
  228. package/python-runtime/python/include/python3.12/sliceobject.h +65 -0
  229. package/python-runtime/python/include/python3.12/structmember.h +56 -0
  230. package/python-runtime/python/include/python3.12/structseq.h +49 -0
  231. package/python-runtime/python/include/python3.12/sysmodule.h +54 -0
  232. package/python-runtime/python/include/python3.12/traceback.h +26 -0
  233. package/python-runtime/python/include/python3.12/tracemalloc.h +77 -0
  234. package/python-runtime/python/include/python3.12/tupleobject.h +46 -0
  235. package/python-runtime/python/include/python3.12/typeslots.h +88 -0
  236. package/python-runtime/python/include/python3.12/unicodeobject.h +1020 -0
  237. package/python-runtime/python/include/python3.12/warnings.h +45 -0
  238. package/python-runtime/python/include/python3.12/weakrefobject.h +42 -0
  239. package/python-runtime/python/lib/itcl4.3.5/itcl.tcl +151 -0
  240. package/python-runtime/python/lib/itcl4.3.5/itclConfig.sh +67 -0
  241. package/python-runtime/python/lib/itcl4.3.5/itclHullCmds.tcl +562 -0
  242. package/python-runtime/python/lib/itcl4.3.5/itclWidget.tcl +447 -0
  243. package/python-runtime/python/lib/itcl4.3.5/libitcl4.3.5.dylib +0 -0
  244. package/python-runtime/python/lib/itcl4.3.5/libitclstub.a +0 -0
  245. package/python-runtime/python/lib/itcl4.3.5/libitclstub4.3.5.a +0 -0
  246. package/python-runtime/python/lib/itcl4.3.5/libtcl9itcl4.3.5.dylib +0 -0
  247. package/python-runtime/python/lib/itcl4.3.5/pkgIndex.tcl +14 -0
  248. package/python-runtime/python/lib/libpython3.12.dylib +0 -0
  249. package/python-runtime/python/lib/libtcl9.0.dylib +0 -0
  250. package/python-runtime/python/lib/libtcl9tk9.0.dylib +0 -0
  251. package/python-runtime/python/lib/pkgconfig/python-3.12-embed.pc +13 -0
  252. package/python-runtime/python/lib/pkgconfig/python-3.12.pc +13 -0
  253. package/python-runtime/python/lib/pkgconfig/python3-embed.pc +13 -0
  254. package/python-runtime/python/lib/pkgconfig/python3.pc +13 -0
  255. package/python-runtime/python/lib/python3.12/LICENSE.txt +279 -0
  256. package/python-runtime/python/lib/python3.12/__future__.py +147 -0
  257. package/python-runtime/python/lib/python3.12/__hello__.py +16 -0
  258. package/python-runtime/python/lib/python3.12/__phello__/__init__.py +7 -0
  259. package/python-runtime/python/lib/python3.12/__phello__/spam.py +7 -0
  260. package/python-runtime/python/lib/python3.12/_aix_support.py +108 -0
  261. package/python-runtime/python/lib/python3.12/_collections_abc.py +1173 -0
  262. package/python-runtime/python/lib/python3.12/_compat_pickle.py +252 -0
  263. package/python-runtime/python/lib/python3.12/_compression.py +162 -0
  264. package/python-runtime/python/lib/python3.12/_markupbase.py +396 -0
  265. package/python-runtime/python/lib/python3.12/_osx_support.py +579 -0
  266. package/python-runtime/python/lib/python3.12/_py_abc.py +147 -0
  267. package/python-runtime/python/lib/python3.12/_pydatetime.py +2643 -0
  268. package/python-runtime/python/lib/python3.12/_pydecimal.py +6339 -0
  269. package/python-runtime/python/lib/python3.12/_pyio.py +2698 -0
  270. package/python-runtime/python/lib/python3.12/_pylong.py +329 -0
  271. package/python-runtime/python/lib/python3.12/_sitebuiltins.py +103 -0
  272. package/python-runtime/python/lib/python3.12/_strptime.py +664 -0
  273. package/python-runtime/python/lib/python3.12/_sysconfigdata__darwin_darwin.py +984 -0
  274. package/python-runtime/python/lib/python3.12/_threading_local.py +242 -0
  275. package/python-runtime/python/lib/python3.12/_weakrefset.py +205 -0
  276. package/python-runtime/python/lib/python3.12/abc.py +188 -0
  277. package/python-runtime/python/lib/python3.12/aifc.py +984 -0
  278. package/python-runtime/python/lib/python3.12/antigravity.py +17 -0
  279. package/python-runtime/python/lib/python3.12/argparse.py +2650 -0
  280. package/python-runtime/python/lib/python3.12/ast.py +1840 -0
  281. package/python-runtime/python/lib/python3.12/asyncio/__init__.py +47 -0
  282. package/python-runtime/python/lib/python3.12/asyncio/__main__.py +128 -0
  283. package/python-runtime/python/lib/python3.12/asyncio/base_events.py +2024 -0
  284. package/python-runtime/python/lib/python3.12/asyncio/base_futures.py +67 -0
  285. package/python-runtime/python/lib/python3.12/asyncio/base_subprocess.py +285 -0
  286. package/python-runtime/python/lib/python3.12/asyncio/base_tasks.py +94 -0
  287. package/python-runtime/python/lib/python3.12/asyncio/constants.py +41 -0
  288. package/python-runtime/python/lib/python3.12/asyncio/coroutines.py +109 -0
  289. package/python-runtime/python/lib/python3.12/asyncio/events.py +868 -0
  290. package/python-runtime/python/lib/python3.12/asyncio/exceptions.py +62 -0
  291. package/python-runtime/python/lib/python3.12/asyncio/format_helpers.py +76 -0
  292. package/python-runtime/python/lib/python3.12/asyncio/futures.py +430 -0
  293. package/python-runtime/python/lib/python3.12/asyncio/locks.py +586 -0
  294. package/python-runtime/python/lib/python3.12/asyncio/log.py +7 -0
  295. package/python-runtime/python/lib/python3.12/asyncio/mixins.py +21 -0
  296. package/python-runtime/python/lib/python3.12/asyncio/proactor_events.py +897 -0
  297. package/python-runtime/python/lib/python3.12/asyncio/protocols.py +216 -0
  298. package/python-runtime/python/lib/python3.12/asyncio/queues.py +244 -0
  299. package/python-runtime/python/lib/python3.12/asyncio/runners.py +216 -0
  300. package/python-runtime/python/lib/python3.12/asyncio/selector_events.py +1324 -0
  301. package/python-runtime/python/lib/python3.12/asyncio/sslproto.py +929 -0
  302. package/python-runtime/python/lib/python3.12/asyncio/staggered.py +174 -0
  303. package/python-runtime/python/lib/python3.12/asyncio/streams.py +770 -0
  304. package/python-runtime/python/lib/python3.12/asyncio/subprocess.py +229 -0
  305. package/python-runtime/python/lib/python3.12/asyncio/taskgroups.py +268 -0
  306. package/python-runtime/python/lib/python3.12/asyncio/tasks.py +1065 -0
  307. package/python-runtime/python/lib/python3.12/asyncio/threads.py +25 -0
  308. package/python-runtime/python/lib/python3.12/asyncio/timeouts.py +168 -0
  309. package/python-runtime/python/lib/python3.12/asyncio/transports.py +335 -0
  310. package/python-runtime/python/lib/python3.12/asyncio/trsock.py +98 -0
  311. package/python-runtime/python/lib/python3.12/asyncio/unix_events.py +1500 -0
  312. package/python-runtime/python/lib/python3.12/asyncio/windows_events.py +901 -0
  313. package/python-runtime/python/lib/python3.12/asyncio/windows_utils.py +173 -0
  314. package/python-runtime/python/lib/python3.12/base64.py +586 -0
  315. package/python-runtime/python/lib/python3.12/bdb.py +920 -0
  316. package/python-runtime/python/lib/python3.12/bisect.py +118 -0
  317. package/python-runtime/python/lib/python3.12/bz2.py +344 -0
  318. package/python-runtime/python/lib/python3.12/cProfile.py +195 -0
  319. package/python-runtime/python/lib/python3.12/calendar.py +808 -0
  320. package/python-runtime/python/lib/python3.12/cgi.py +1014 -0
  321. package/python-runtime/python/lib/python3.12/cgitb.py +332 -0
  322. package/python-runtime/python/lib/python3.12/chunk.py +173 -0
  323. package/python-runtime/python/lib/python3.12/cmd.py +401 -0
  324. package/python-runtime/python/lib/python3.12/code.py +324 -0
  325. package/python-runtime/python/lib/python3.12/codecs.py +1129 -0
  326. package/python-runtime/python/lib/python3.12/codeop.py +161 -0
  327. package/python-runtime/python/lib/python3.12/collections/__init__.py +1592 -0
  328. package/python-runtime/python/lib/python3.12/collections/abc.py +3 -0
  329. package/python-runtime/python/lib/python3.12/colorsys.py +166 -0
  330. package/python-runtime/python/lib/python3.12/compileall.py +469 -0
  331. package/python-runtime/python/lib/python3.12/concurrent/__init__.py +1 -0
  332. package/python-runtime/python/lib/python3.12/concurrent/futures/__init__.py +54 -0
  333. package/python-runtime/python/lib/python3.12/concurrent/futures/_base.py +654 -0
  334. package/python-runtime/python/lib/python3.12/concurrent/futures/process.py +876 -0
  335. package/python-runtime/python/lib/python3.12/concurrent/futures/thread.py +240 -0
  336. package/python-runtime/python/lib/python3.12/configparser.py +1333 -0
  337. package/python-runtime/python/lib/python3.12/contextlib.py +800 -0
  338. package/python-runtime/python/lib/python3.12/contextvars.py +4 -0
  339. package/python-runtime/python/lib/python3.12/copy.py +292 -0
  340. package/python-runtime/python/lib/python3.12/copyreg.py +217 -0
  341. package/python-runtime/python/lib/python3.12/crypt.py +124 -0
  342. package/python-runtime/python/lib/python3.12/csv.py +451 -0
  343. package/python-runtime/python/lib/python3.12/ctypes/__init__.py +582 -0
  344. package/python-runtime/python/lib/python3.12/ctypes/_aix.py +327 -0
  345. package/python-runtime/python/lib/python3.12/ctypes/_endian.py +78 -0
  346. package/python-runtime/python/lib/python3.12/ctypes/macholib/README.ctypes +7 -0
  347. package/python-runtime/python/lib/python3.12/ctypes/macholib/__init__.py +9 -0
  348. package/python-runtime/python/lib/python3.12/ctypes/macholib/dyld.py +165 -0
  349. package/python-runtime/python/lib/python3.12/ctypes/macholib/dylib.py +42 -0
  350. package/python-runtime/python/lib/python3.12/ctypes/macholib/fetch_macholib +2 -0
  351. package/python-runtime/python/lib/python3.12/ctypes/macholib/fetch_macholib.bat +1 -0
  352. package/python-runtime/python/lib/python3.12/ctypes/macholib/framework.py +42 -0
  353. package/python-runtime/python/lib/python3.12/ctypes/util.py +379 -0
  354. package/python-runtime/python/lib/python3.12/ctypes/wintypes.py +202 -0
  355. package/python-runtime/python/lib/python3.12/curses/__init__.py +101 -0
  356. package/python-runtime/python/lib/python3.12/curses/ascii.py +99 -0
  357. package/python-runtime/python/lib/python3.12/curses/has_key.py +192 -0
  358. package/python-runtime/python/lib/python3.12/curses/panel.py +6 -0
  359. package/python-runtime/python/lib/python3.12/curses/textpad.py +204 -0
  360. package/python-runtime/python/lib/python3.12/dataclasses.py +1588 -0
  361. package/python-runtime/python/lib/python3.12/datetime.py +9 -0
  362. package/python-runtime/python/lib/python3.12/dbm/__init__.py +190 -0
  363. package/python-runtime/python/lib/python3.12/dbm/dumb.py +317 -0
  364. package/python-runtime/python/lib/python3.12/dbm/gnu.py +3 -0
  365. package/python-runtime/python/lib/python3.12/dbm/ndbm.py +3 -0
  366. package/python-runtime/python/lib/python3.12/decimal.py +108 -0
  367. package/python-runtime/python/lib/python3.12/difflib.py +2056 -0
  368. package/python-runtime/python/lib/python3.12/dis.py +805 -0
  369. package/python-runtime/python/lib/python3.12/doctest.py +2845 -0
  370. package/python-runtime/python/lib/python3.12/email/__init__.py +61 -0
  371. package/python-runtime/python/lib/python3.12/email/_encoded_words.py +233 -0
  372. package/python-runtime/python/lib/python3.12/email/_header_value_parser.py +3108 -0
  373. package/python-runtime/python/lib/python3.12/email/_parseaddr.py +557 -0
  374. package/python-runtime/python/lib/python3.12/email/_policybase.py +382 -0
  375. package/python-runtime/python/lib/python3.12/email/architecture.rst +216 -0
  376. package/python-runtime/python/lib/python3.12/email/base64mime.py +115 -0
  377. package/python-runtime/python/lib/python3.12/email/charset.py +398 -0
  378. package/python-runtime/python/lib/python3.12/email/contentmanager.py +251 -0
  379. package/python-runtime/python/lib/python3.12/email/encoders.py +65 -0
  380. package/python-runtime/python/lib/python3.12/email/errors.py +117 -0
  381. package/python-runtime/python/lib/python3.12/email/feedparser.py +534 -0
  382. package/python-runtime/python/lib/python3.12/email/generator.py +530 -0
  383. package/python-runtime/python/lib/python3.12/email/header.py +573 -0
  384. package/python-runtime/python/lib/python3.12/email/headerregistry.py +604 -0
  385. package/python-runtime/python/lib/python3.12/email/iterators.py +68 -0
  386. package/python-runtime/python/lib/python3.12/email/message.py +1215 -0
  387. package/python-runtime/python/lib/python3.12/email/mime/__init__.py +0 -0
  388. package/python-runtime/python/lib/python3.12/email/mime/application.py +37 -0
  389. package/python-runtime/python/lib/python3.12/email/mime/audio.py +100 -0
  390. package/python-runtime/python/lib/python3.12/email/mime/base.py +29 -0
  391. package/python-runtime/python/lib/python3.12/email/mime/image.py +152 -0
  392. package/python-runtime/python/lib/python3.12/email/mime/message.py +33 -0
  393. package/python-runtime/python/lib/python3.12/email/mime/multipart.py +47 -0
  394. package/python-runtime/python/lib/python3.12/email/mime/nonmultipart.py +21 -0
  395. package/python-runtime/python/lib/python3.12/email/mime/text.py +40 -0
  396. package/python-runtime/python/lib/python3.12/email/parser.py +127 -0
  397. package/python-runtime/python/lib/python3.12/email/policy.py +232 -0
  398. package/python-runtime/python/lib/python3.12/email/quoprimime.py +300 -0
  399. package/python-runtime/python/lib/python3.12/email/utils.py +486 -0
  400. package/python-runtime/python/lib/python3.12/encodings/__init__.py +174 -0
  401. package/python-runtime/python/lib/python3.12/encodings/aliases.py +551 -0
  402. package/python-runtime/python/lib/python3.12/encodings/ascii.py +50 -0
  403. package/python-runtime/python/lib/python3.12/encodings/base64_codec.py +55 -0
  404. package/python-runtime/python/lib/python3.12/encodings/big5.py +39 -0
  405. package/python-runtime/python/lib/python3.12/encodings/big5hkscs.py +39 -0
  406. package/python-runtime/python/lib/python3.12/encodings/bz2_codec.py +78 -0
  407. package/python-runtime/python/lib/python3.12/encodings/charmap.py +69 -0
  408. package/python-runtime/python/lib/python3.12/encodings/cp037.py +307 -0
  409. package/python-runtime/python/lib/python3.12/encodings/cp1006.py +307 -0
  410. package/python-runtime/python/lib/python3.12/encodings/cp1026.py +307 -0
  411. package/python-runtime/python/lib/python3.12/encodings/cp1125.py +698 -0
  412. package/python-runtime/python/lib/python3.12/encodings/cp1140.py +307 -0
  413. package/python-runtime/python/lib/python3.12/encodings/cp1250.py +307 -0
  414. package/python-runtime/python/lib/python3.12/encodings/cp1251.py +307 -0
  415. package/python-runtime/python/lib/python3.12/encodings/cp1252.py +307 -0
  416. package/python-runtime/python/lib/python3.12/encodings/cp1253.py +307 -0
  417. package/python-runtime/python/lib/python3.12/encodings/cp1254.py +307 -0
  418. package/python-runtime/python/lib/python3.12/encodings/cp1255.py +307 -0
  419. package/python-runtime/python/lib/python3.12/encodings/cp1256.py +307 -0
  420. package/python-runtime/python/lib/python3.12/encodings/cp1257.py +307 -0
  421. package/python-runtime/python/lib/python3.12/encodings/cp1258.py +307 -0
  422. package/python-runtime/python/lib/python3.12/encodings/cp273.py +307 -0
  423. package/python-runtime/python/lib/python3.12/encodings/cp424.py +307 -0
  424. package/python-runtime/python/lib/python3.12/encodings/cp437.py +698 -0
  425. package/python-runtime/python/lib/python3.12/encodings/cp500.py +307 -0
  426. package/python-runtime/python/lib/python3.12/encodings/cp720.py +309 -0
  427. package/python-runtime/python/lib/python3.12/encodings/cp737.py +698 -0
  428. package/python-runtime/python/lib/python3.12/encodings/cp775.py +697 -0
  429. package/python-runtime/python/lib/python3.12/encodings/cp850.py +698 -0
  430. package/python-runtime/python/lib/python3.12/encodings/cp852.py +698 -0
  431. package/python-runtime/python/lib/python3.12/encodings/cp855.py +698 -0
  432. package/python-runtime/python/lib/python3.12/encodings/cp856.py +307 -0
  433. package/python-runtime/python/lib/python3.12/encodings/cp857.py +694 -0
  434. package/python-runtime/python/lib/python3.12/encodings/cp858.py +698 -0
  435. package/python-runtime/python/lib/python3.12/encodings/cp860.py +698 -0
  436. package/python-runtime/python/lib/python3.12/encodings/cp861.py +698 -0
  437. package/python-runtime/python/lib/python3.12/encodings/cp862.py +698 -0
  438. package/python-runtime/python/lib/python3.12/encodings/cp863.py +698 -0
  439. package/python-runtime/python/lib/python3.12/encodings/cp864.py +690 -0
  440. package/python-runtime/python/lib/python3.12/encodings/cp865.py +698 -0
  441. package/python-runtime/python/lib/python3.12/encodings/cp866.py +698 -0
  442. package/python-runtime/python/lib/python3.12/encodings/cp869.py +689 -0
  443. package/python-runtime/python/lib/python3.12/encodings/cp874.py +307 -0
  444. package/python-runtime/python/lib/python3.12/encodings/cp875.py +307 -0
  445. package/python-runtime/python/lib/python3.12/encodings/cp932.py +39 -0
  446. package/python-runtime/python/lib/python3.12/encodings/cp949.py +39 -0
  447. package/python-runtime/python/lib/python3.12/encodings/cp950.py +39 -0
  448. package/python-runtime/python/lib/python3.12/encodings/euc_jis_2004.py +39 -0
  449. package/python-runtime/python/lib/python3.12/encodings/euc_jisx0213.py +39 -0
  450. package/python-runtime/python/lib/python3.12/encodings/euc_jp.py +39 -0
  451. package/python-runtime/python/lib/python3.12/encodings/euc_kr.py +39 -0
  452. package/python-runtime/python/lib/python3.12/encodings/gb18030.py +39 -0
  453. package/python-runtime/python/lib/python3.12/encodings/gb2312.py +39 -0
  454. package/python-runtime/python/lib/python3.12/encodings/gbk.py +39 -0
  455. package/python-runtime/python/lib/python3.12/encodings/hex_codec.py +55 -0
  456. package/python-runtime/python/lib/python3.12/encodings/hp_roman8.py +314 -0
  457. package/python-runtime/python/lib/python3.12/encodings/hz.py +39 -0
  458. package/python-runtime/python/lib/python3.12/encodings/idna.py +317 -0
  459. package/python-runtime/python/lib/python3.12/encodings/iso2022_jp.py +39 -0
  460. package/python-runtime/python/lib/python3.12/encodings/iso2022_jp_1.py +39 -0
  461. package/python-runtime/python/lib/python3.12/encodings/iso2022_jp_2.py +39 -0
  462. package/python-runtime/python/lib/python3.12/encodings/iso2022_jp_2004.py +39 -0
  463. package/python-runtime/python/lib/python3.12/encodings/iso2022_jp_3.py +39 -0
  464. package/python-runtime/python/lib/python3.12/encodings/iso2022_jp_ext.py +39 -0
  465. package/python-runtime/python/lib/python3.12/encodings/iso2022_kr.py +39 -0
  466. package/python-runtime/python/lib/python3.12/encodings/iso8859_1.py +307 -0
  467. package/python-runtime/python/lib/python3.12/encodings/iso8859_10.py +307 -0
  468. package/python-runtime/python/lib/python3.12/encodings/iso8859_11.py +307 -0
  469. package/python-runtime/python/lib/python3.12/encodings/iso8859_13.py +307 -0
  470. package/python-runtime/python/lib/python3.12/encodings/iso8859_14.py +307 -0
  471. package/python-runtime/python/lib/python3.12/encodings/iso8859_15.py +307 -0
  472. package/python-runtime/python/lib/python3.12/encodings/iso8859_16.py +307 -0
  473. package/python-runtime/python/lib/python3.12/encodings/iso8859_2.py +307 -0
  474. package/python-runtime/python/lib/python3.12/encodings/iso8859_3.py +307 -0
  475. package/python-runtime/python/lib/python3.12/encodings/iso8859_4.py +307 -0
  476. package/python-runtime/python/lib/python3.12/encodings/iso8859_5.py +307 -0
  477. package/python-runtime/python/lib/python3.12/encodings/iso8859_6.py +307 -0
  478. package/python-runtime/python/lib/python3.12/encodings/iso8859_7.py +307 -0
  479. package/python-runtime/python/lib/python3.12/encodings/iso8859_8.py +307 -0
  480. package/python-runtime/python/lib/python3.12/encodings/iso8859_9.py +307 -0
  481. package/python-runtime/python/lib/python3.12/encodings/johab.py +39 -0
  482. package/python-runtime/python/lib/python3.12/encodings/koi8_r.py +307 -0
  483. package/python-runtime/python/lib/python3.12/encodings/koi8_t.py +308 -0
  484. package/python-runtime/python/lib/python3.12/encodings/koi8_u.py +307 -0
  485. package/python-runtime/python/lib/python3.12/encodings/kz1048.py +307 -0
  486. package/python-runtime/python/lib/python3.12/encodings/latin_1.py +50 -0
  487. package/python-runtime/python/lib/python3.12/encodings/mac_arabic.py +698 -0
  488. package/python-runtime/python/lib/python3.12/encodings/mac_croatian.py +307 -0
  489. package/python-runtime/python/lib/python3.12/encodings/mac_cyrillic.py +307 -0
  490. package/python-runtime/python/lib/python3.12/encodings/mac_farsi.py +307 -0
  491. package/python-runtime/python/lib/python3.12/encodings/mac_greek.py +307 -0
  492. package/python-runtime/python/lib/python3.12/encodings/mac_iceland.py +307 -0
  493. package/python-runtime/python/lib/python3.12/encodings/mac_latin2.py +312 -0
  494. package/python-runtime/python/lib/python3.12/encodings/mac_roman.py +307 -0
  495. package/python-runtime/python/lib/python3.12/encodings/mac_romanian.py +307 -0
  496. package/python-runtime/python/lib/python3.12/encodings/mac_turkish.py +307 -0
  497. package/python-runtime/python/lib/python3.12/encodings/mbcs.py +47 -0
  498. package/python-runtime/python/lib/python3.12/encodings/oem.py +41 -0
  499. package/python-runtime/python/lib/python3.12/encodings/palmos.py +308 -0
  500. package/python-runtime/python/lib/python3.12/encodings/ptcp154.py +312 -0
  501. package/python-runtime/python/lib/python3.12/encodings/punycode.py +237 -0
  502. package/python-runtime/python/lib/python3.12/encodings/quopri_codec.py +56 -0
  503. package/python-runtime/python/lib/python3.12/encodings/raw_unicode_escape.py +46 -0
  504. package/python-runtime/python/lib/python3.12/encodings/rot_13.py +113 -0
  505. package/python-runtime/python/lib/python3.12/encodings/shift_jis.py +39 -0
  506. package/python-runtime/python/lib/python3.12/encodings/shift_jis_2004.py +39 -0
  507. package/python-runtime/python/lib/python3.12/encodings/shift_jisx0213.py +39 -0
  508. package/python-runtime/python/lib/python3.12/encodings/tis_620.py +307 -0
  509. package/python-runtime/python/lib/python3.12/encodings/undefined.py +49 -0
  510. package/python-runtime/python/lib/python3.12/encodings/unicode_escape.py +46 -0
  511. package/python-runtime/python/lib/python3.12/encodings/utf_16.py +155 -0
  512. package/python-runtime/python/lib/python3.12/encodings/utf_16_be.py +42 -0
  513. package/python-runtime/python/lib/python3.12/encodings/utf_16_le.py +42 -0
  514. package/python-runtime/python/lib/python3.12/encodings/utf_32.py +150 -0
  515. package/python-runtime/python/lib/python3.12/encodings/utf_32_be.py +37 -0
  516. package/python-runtime/python/lib/python3.12/encodings/utf_32_le.py +37 -0
  517. package/python-runtime/python/lib/python3.12/encodings/utf_7.py +38 -0
  518. package/python-runtime/python/lib/python3.12/encodings/utf_8.py +42 -0
  519. package/python-runtime/python/lib/python3.12/encodings/utf_8_sig.py +130 -0
  520. package/python-runtime/python/lib/python3.12/encodings/uu_codec.py +103 -0
  521. package/python-runtime/python/lib/python3.12/encodings/zlib_codec.py +77 -0
  522. package/python-runtime/python/lib/python3.12/enum.py +2108 -0
  523. package/python-runtime/python/lib/python3.12/filecmp.py +315 -0
  524. package/python-runtime/python/lib/python3.12/fileinput.py +442 -0
  525. package/python-runtime/python/lib/python3.12/fnmatch.py +185 -0
  526. package/python-runtime/python/lib/python3.12/fractions.py +990 -0
  527. package/python-runtime/python/lib/python3.12/ftplib.py +966 -0
  528. package/python-runtime/python/lib/python3.12/functools.py +1009 -0
  529. package/python-runtime/python/lib/python3.12/genericpath.py +176 -0
  530. package/python-runtime/python/lib/python3.12/getopt.py +215 -0
  531. package/python-runtime/python/lib/python3.12/getpass.py +185 -0
  532. package/python-runtime/python/lib/python3.12/gettext.py +646 -0
  533. package/python-runtime/python/lib/python3.12/glob.py +252 -0
  534. package/python-runtime/python/lib/python3.12/graphlib.py +250 -0
  535. package/python-runtime/python/lib/python3.12/gzip.py +711 -0
  536. package/python-runtime/python/lib/python3.12/hashlib.py +253 -0
  537. package/python-runtime/python/lib/python3.12/heapq.py +603 -0
  538. package/python-runtime/python/lib/python3.12/hmac.py +219 -0
  539. package/python-runtime/python/lib/python3.12/html/__init__.py +132 -0
  540. package/python-runtime/python/lib/python3.12/html/entities.py +2513 -0
  541. package/python-runtime/python/lib/python3.12/html/parser.py +535 -0
  542. package/python-runtime/python/lib/python3.12/http/__init__.py +200 -0
  543. package/python-runtime/python/lib/python3.12/http/client.py +1570 -0
  544. package/python-runtime/python/lib/python3.12/http/cookiejar.py +2121 -0
  545. package/python-runtime/python/lib/python3.12/http/cookies.py +615 -0
  546. package/python-runtime/python/lib/python3.12/http/server.py +1335 -0
  547. package/python-runtime/python/lib/python3.12/imaplib.py +1641 -0
  548. package/python-runtime/python/lib/python3.12/imghdr.py +180 -0
  549. package/python-runtime/python/lib/python3.12/importlib/__init__.py +138 -0
  550. package/python-runtime/python/lib/python3.12/importlib/_abc.py +39 -0
  551. package/python-runtime/python/lib/python3.12/importlib/_bootstrap.py +1551 -0
  552. package/python-runtime/python/lib/python3.12/importlib/_bootstrap_external.py +1749 -0
  553. package/python-runtime/python/lib/python3.12/importlib/abc.py +239 -0
  554. package/python-runtime/python/lib/python3.12/importlib/machinery.py +20 -0
  555. package/python-runtime/python/lib/python3.12/importlib/metadata/__init__.py +966 -0
  556. package/python-runtime/python/lib/python3.12/importlib/metadata/_adapters.py +89 -0
  557. package/python-runtime/python/lib/python3.12/importlib/metadata/_collections.py +30 -0
  558. package/python-runtime/python/lib/python3.12/importlib/metadata/_functools.py +104 -0
  559. package/python-runtime/python/lib/python3.12/importlib/metadata/_itertools.py +73 -0
  560. package/python-runtime/python/lib/python3.12/importlib/metadata/_meta.py +63 -0
  561. package/python-runtime/python/lib/python3.12/importlib/metadata/_text.py +99 -0
  562. package/python-runtime/python/lib/python3.12/importlib/readers.py +12 -0
  563. package/python-runtime/python/lib/python3.12/importlib/resources/__init__.py +38 -0
  564. package/python-runtime/python/lib/python3.12/importlib/resources/_adapters.py +168 -0
  565. package/python-runtime/python/lib/python3.12/importlib/resources/_common.py +208 -0
  566. package/python-runtime/python/lib/python3.12/importlib/resources/_itertools.py +38 -0
  567. package/python-runtime/python/lib/python3.12/importlib/resources/_legacy.py +98 -0
  568. package/python-runtime/python/lib/python3.12/importlib/resources/abc.py +173 -0
  569. package/python-runtime/python/lib/python3.12/importlib/resources/readers.py +146 -0
  570. package/python-runtime/python/lib/python3.12/importlib/resources/simple.py +106 -0
  571. package/python-runtime/python/lib/python3.12/importlib/simple.py +14 -0
  572. package/python-runtime/python/lib/python3.12/importlib/util.py +270 -0
  573. package/python-runtime/python/lib/python3.12/inspect.py +3433 -0
  574. package/python-runtime/python/lib/python3.12/io.py +99 -0
  575. package/python-runtime/python/lib/python3.12/ipaddress.py +2430 -0
  576. package/python-runtime/python/lib/python3.12/json/__init__.py +359 -0
  577. package/python-runtime/python/lib/python3.12/json/decoder.py +357 -0
  578. package/python-runtime/python/lib/python3.12/json/encoder.py +443 -0
  579. package/python-runtime/python/lib/python3.12/json/scanner.py +73 -0
  580. package/python-runtime/python/lib/python3.12/json/tool.py +85 -0
  581. package/python-runtime/python/lib/python3.12/keyword.py +64 -0
  582. package/python-runtime/python/lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so +0 -0
  583. package/python-runtime/python/lib/python3.12/lib-dynload/_dbm.cpython-312-darwin.so +0 -0
  584. package/python-runtime/python/lib/python3.12/lib-dynload/_tkinter.cpython-312-darwin.so +0 -0
  585. package/python-runtime/python/lib/python3.12/linecache.py +185 -0
  586. package/python-runtime/python/lib/python3.12/locale.py +1779 -0
  587. package/python-runtime/python/lib/python3.12/logging/__init__.py +2345 -0
  588. package/python-runtime/python/lib/python3.12/logging/config.py +1078 -0
  589. package/python-runtime/python/lib/python3.12/logging/handlers.py +1624 -0
  590. package/python-runtime/python/lib/python3.12/lzma.py +356 -0
  591. package/python-runtime/python/lib/python3.12/mailbox.py +2153 -0
  592. package/python-runtime/python/lib/python3.12/mailcap.py +302 -0
  593. package/python-runtime/python/lib/python3.12/mimetypes.py +656 -0
  594. package/python-runtime/python/lib/python3.12/modulefinder.py +666 -0
  595. package/python-runtime/python/lib/python3.12/multiprocessing/__init__.py +37 -0
  596. package/python-runtime/python/lib/python3.12/multiprocessing/connection.py +1178 -0
  597. package/python-runtime/python/lib/python3.12/multiprocessing/context.py +377 -0
  598. package/python-runtime/python/lib/python3.12/multiprocessing/dummy/__init__.py +126 -0
  599. package/python-runtime/python/lib/python3.12/multiprocessing/dummy/connection.py +75 -0
  600. package/python-runtime/python/lib/python3.12/multiprocessing/forkserver.py +350 -0
  601. package/python-runtime/python/lib/python3.12/multiprocessing/heap.py +337 -0
  602. package/python-runtime/python/lib/python3.12/multiprocessing/managers.py +1387 -0
  603. package/python-runtime/python/lib/python3.12/multiprocessing/pool.py +957 -0
  604. package/python-runtime/python/lib/python3.12/multiprocessing/popen_fork.py +83 -0
  605. package/python-runtime/python/lib/python3.12/multiprocessing/popen_forkserver.py +74 -0
  606. package/python-runtime/python/lib/python3.12/multiprocessing/popen_spawn_posix.py +72 -0
  607. package/python-runtime/python/lib/python3.12/multiprocessing/popen_spawn_win32.py +145 -0
  608. package/python-runtime/python/lib/python3.12/multiprocessing/process.py +439 -0
  609. package/python-runtime/python/lib/python3.12/multiprocessing/queues.py +401 -0
  610. package/python-runtime/python/lib/python3.12/multiprocessing/reduction.py +281 -0
  611. package/python-runtime/python/lib/python3.12/multiprocessing/resource_sharer.py +154 -0
  612. package/python-runtime/python/lib/python3.12/multiprocessing/resource_tracker.py +294 -0
  613. package/python-runtime/python/lib/python3.12/multiprocessing/shared_memory.py +534 -0
  614. package/python-runtime/python/lib/python3.12/multiprocessing/sharedctypes.py +240 -0
  615. package/python-runtime/python/lib/python3.12/multiprocessing/spawn.py +307 -0
  616. package/python-runtime/python/lib/python3.12/multiprocessing/synchronize.py +404 -0
  617. package/python-runtime/python/lib/python3.12/multiprocessing/util.py +494 -0
  618. package/python-runtime/python/lib/python3.12/netrc.py +192 -0
  619. package/python-runtime/python/lib/python3.12/nntplib.py +1093 -0
  620. package/python-runtime/python/lib/python3.12/ntpath.py +869 -0
  621. package/python-runtime/python/lib/python3.12/nturl2path.py +69 -0
  622. package/python-runtime/python/lib/python3.12/numbers.py +418 -0
  623. package/python-runtime/python/lib/python3.12/opcode.py +493 -0
  624. package/python-runtime/python/lib/python3.12/operator.py +467 -0
  625. package/python-runtime/python/lib/python3.12/optparse.py +1681 -0
  626. package/python-runtime/python/lib/python3.12/os.py +1159 -0
  627. package/python-runtime/python/lib/python3.12/pathlib.py +1435 -0
  628. package/python-runtime/python/lib/python3.12/pdb.py +1987 -0
  629. package/python-runtime/python/lib/python3.12/pickle.py +1866 -0
  630. package/python-runtime/python/lib/python3.12/pickletools.py +2904 -0
  631. package/python-runtime/python/lib/python3.12/pipes.py +250 -0
  632. package/python-runtime/python/lib/python3.12/pkgutil.py +529 -0
  633. package/python-runtime/python/lib/python3.12/platform.py +1359 -0
  634. package/python-runtime/python/lib/python3.12/plistlib.py +920 -0
  635. package/python-runtime/python/lib/python3.12/poplib.py +478 -0
  636. package/python-runtime/python/lib/python3.12/posixpath.py +577 -0
  637. package/python-runtime/python/lib/python3.12/pprint.py +658 -0
  638. package/python-runtime/python/lib/python3.12/profile.py +615 -0
  639. package/python-runtime/python/lib/python3.12/pstats.py +778 -0
  640. package/python-runtime/python/lib/python3.12/pty.py +211 -0
  641. package/python-runtime/python/lib/python3.12/py_compile.py +212 -0
  642. package/python-runtime/python/lib/python3.12/pyclbr.py +314 -0
  643. package/python-runtime/python/lib/python3.12/pydoc.py +2950 -0
  644. package/python-runtime/python/lib/python3.12/queue.py +326 -0
  645. package/python-runtime/python/lib/python3.12/quopri.py +237 -0
  646. package/python-runtime/python/lib/python3.12/random.py +996 -0
  647. package/python-runtime/python/lib/python3.12/re/__init__.py +385 -0
  648. package/python-runtime/python/lib/python3.12/re/_casefix.py +106 -0
  649. package/python-runtime/python/lib/python3.12/re/_compiler.py +770 -0
  650. package/python-runtime/python/lib/python3.12/re/_constants.py +220 -0
  651. package/python-runtime/python/lib/python3.12/re/_parser.py +1080 -0
  652. package/python-runtime/python/lib/python3.12/reprlib.py +214 -0
  653. package/python-runtime/python/lib/python3.12/rlcompleter.py +219 -0
  654. package/python-runtime/python/lib/python3.12/runpy.py +319 -0
  655. package/python-runtime/python/lib/python3.12/sched.py +167 -0
  656. package/python-runtime/python/lib/python3.12/secrets.py +71 -0
  657. package/python-runtime/python/lib/python3.12/selectors.py +623 -0
  658. package/python-runtime/python/lib/python3.12/shelve.py +243 -0
  659. package/python-runtime/python/lib/python3.12/shlex.py +345 -0
  660. package/python-runtime/python/lib/python3.12/shutil.py +1566 -0
  661. package/python-runtime/python/lib/python3.12/signal.py +94 -0
  662. package/python-runtime/python/lib/python3.12/site-packages/PIL/AvifImagePlugin.py +299 -0
  663. package/python-runtime/python/lib/python3.12/site-packages/PIL/BdfFontFile.py +122 -0
  664. package/python-runtime/python/lib/python3.12/site-packages/PIL/BlpImagePlugin.py +503 -0
  665. package/python-runtime/python/lib/python3.12/site-packages/PIL/BmpImagePlugin.py +526 -0
  666. package/python-runtime/python/lib/python3.12/site-packages/PIL/BufrStubImagePlugin.py +70 -0
  667. package/python-runtime/python/lib/python3.12/site-packages/PIL/ContainerIO.py +177 -0
  668. package/python-runtime/python/lib/python3.12/site-packages/PIL/CurImagePlugin.py +105 -0
  669. package/python-runtime/python/lib/python3.12/site-packages/PIL/DcxImagePlugin.py +88 -0
  670. package/python-runtime/python/lib/python3.12/site-packages/PIL/DdsImagePlugin.py +637 -0
  671. package/python-runtime/python/lib/python3.12/site-packages/PIL/EpsImagePlugin.py +494 -0
  672. package/python-runtime/python/lib/python3.12/site-packages/PIL/ExifTags.py +383 -0
  673. package/python-runtime/python/lib/python3.12/site-packages/PIL/FitsImagePlugin.py +171 -0
  674. package/python-runtime/python/lib/python3.12/site-packages/PIL/FliImagePlugin.py +188 -0
  675. package/python-runtime/python/lib/python3.12/site-packages/PIL/FontFile.py +163 -0
  676. package/python-runtime/python/lib/python3.12/site-packages/PIL/FpxImagePlugin.py +264 -0
  677. package/python-runtime/python/lib/python3.12/site-packages/PIL/FtexImagePlugin.py +119 -0
  678. package/python-runtime/python/lib/python3.12/site-packages/PIL/GbrImagePlugin.py +101 -0
  679. package/python-runtime/python/lib/python3.12/site-packages/PIL/GdImageFile.py +109 -0
  680. package/python-runtime/python/lib/python3.12/site-packages/PIL/GifImagePlugin.py +1152 -0
  681. package/python-runtime/python/lib/python3.12/site-packages/PIL/GimpGradientFile.py +156 -0
  682. package/python-runtime/python/lib/python3.12/site-packages/PIL/GimpPaletteFile.py +77 -0
  683. package/python-runtime/python/lib/python3.12/site-packages/PIL/GribStubImagePlugin.py +70 -0
  684. package/python-runtime/python/lib/python3.12/site-packages/PIL/Hdf5StubImagePlugin.py +70 -0
  685. package/python-runtime/python/lib/python3.12/site-packages/PIL/IcnsImagePlugin.py +406 -0
  686. package/python-runtime/python/lib/python3.12/site-packages/PIL/IcoImagePlugin.py +418 -0
  687. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImImagePlugin.py +401 -0
  688. package/python-runtime/python/lib/python3.12/site-packages/PIL/Image.py +4390 -0
  689. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageChops.py +278 -0
  690. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageCms.py +1069 -0
  691. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageColor.py +321 -0
  692. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageDraw.py +1003 -0
  693. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageDraw2.py +250 -0
  694. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageEnhance.py +112 -0
  695. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageFile.py +944 -0
  696. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageFilter.py +596 -0
  697. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageFont.py +1335 -0
  698. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageGrab.py +229 -0
  699. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageMath.py +314 -0
  700. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageMode.py +85 -0
  701. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageMorph.py +317 -0
  702. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageOps.py +803 -0
  703. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImagePalette.py +314 -0
  704. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImagePath.py +20 -0
  705. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageQt.py +229 -0
  706. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageSequence.py +89 -0
  707. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageShow.py +372 -0
  708. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageStat.py +169 -0
  709. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageText.py +512 -0
  710. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageTk.py +269 -0
  711. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageTransform.py +138 -0
  712. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImageWin.py +247 -0
  713. package/python-runtime/python/lib/python3.12/site-packages/PIL/ImtImagePlugin.py +103 -0
  714. package/python-runtime/python/lib/python3.12/site-packages/PIL/IptcImagePlugin.py +228 -0
  715. package/python-runtime/python/lib/python3.12/site-packages/PIL/Jpeg2KImagePlugin.py +472 -0
  716. package/python-runtime/python/lib/python3.12/site-packages/PIL/JpegImagePlugin.py +913 -0
  717. package/python-runtime/python/lib/python3.12/site-packages/PIL/JpegPresets.py +240 -0
  718. package/python-runtime/python/lib/python3.12/site-packages/PIL/McIdasImagePlugin.py +80 -0
  719. package/python-runtime/python/lib/python3.12/site-packages/PIL/MicImagePlugin.py +105 -0
  720. package/python-runtime/python/lib/python3.12/site-packages/PIL/MpegImagePlugin.py +89 -0
  721. package/python-runtime/python/lib/python3.12/site-packages/PIL/MpoImagePlugin.py +211 -0
  722. package/python-runtime/python/lib/python3.12/site-packages/PIL/MspImagePlugin.py +206 -0
  723. package/python-runtime/python/lib/python3.12/site-packages/PIL/PSDraw.py +249 -0
  724. package/python-runtime/python/lib/python3.12/site-packages/PIL/PaletteFile.py +58 -0
  725. package/python-runtime/python/lib/python3.12/site-packages/PIL/PalmImagePlugin.py +220 -0
  726. package/python-runtime/python/lib/python3.12/site-packages/PIL/PcdImagePlugin.py +68 -0
  727. package/python-runtime/python/lib/python3.12/site-packages/PIL/PcfFontFile.py +258 -0
  728. package/python-runtime/python/lib/python3.12/site-packages/PIL/PcxImagePlugin.py +237 -0
  729. package/python-runtime/python/lib/python3.12/site-packages/PIL/PdfImagePlugin.py +313 -0
  730. package/python-runtime/python/lib/python3.12/site-packages/PIL/PdfParser.py +1129 -0
  731. package/python-runtime/python/lib/python3.12/site-packages/PIL/PixarImagePlugin.py +74 -0
  732. package/python-runtime/python/lib/python3.12/site-packages/PIL/PngImagePlugin.py +1616 -0
  733. package/python-runtime/python/lib/python3.12/site-packages/PIL/PpmImagePlugin.py +380 -0
  734. package/python-runtime/python/lib/python3.12/site-packages/PIL/PsdImagePlugin.py +340 -0
  735. package/python-runtime/python/lib/python3.12/site-packages/PIL/QoiImagePlugin.py +248 -0
  736. package/python-runtime/python/lib/python3.12/site-packages/PIL/SgiImagePlugin.py +236 -0
  737. package/python-runtime/python/lib/python3.12/site-packages/PIL/SpiderImagePlugin.py +329 -0
  738. package/python-runtime/python/lib/python3.12/site-packages/PIL/SunImagePlugin.py +147 -0
  739. package/python-runtime/python/lib/python3.12/site-packages/PIL/TarIO.py +68 -0
  740. package/python-runtime/python/lib/python3.12/site-packages/PIL/TgaImagePlugin.py +295 -0
  741. package/python-runtime/python/lib/python3.12/site-packages/PIL/TiffImagePlugin.py +2410 -0
  742. package/python-runtime/python/lib/python3.12/site-packages/PIL/TiffTags.py +571 -0
  743. package/python-runtime/python/lib/python3.12/site-packages/PIL/WalImageFile.py +134 -0
  744. package/python-runtime/python/lib/python3.12/site-packages/PIL/WebPImagePlugin.py +352 -0
  745. package/python-runtime/python/lib/python3.12/site-packages/PIL/WmfImagePlugin.py +189 -0
  746. package/python-runtime/python/lib/python3.12/site-packages/PIL/XVThumbImagePlugin.py +83 -0
  747. package/python-runtime/python/lib/python3.12/site-packages/PIL/XbmImagePlugin.py +128 -0
  748. package/python-runtime/python/lib/python3.12/site-packages/PIL/XpmImagePlugin.py +175 -0
  749. package/python-runtime/python/lib/python3.12/site-packages/PIL/__init__.py +87 -0
  750. package/python-runtime/python/lib/python3.12/site-packages/PIL/__main__.py +7 -0
  751. package/python-runtime/python/lib/python3.12/site-packages/PIL/_avif.cpython-312-darwin.so +0 -0
  752. package/python-runtime/python/lib/python3.12/site-packages/PIL/_avif.pyi +3 -0
  753. package/python-runtime/python/lib/python3.12/site-packages/PIL/_binary.py +115 -0
  754. package/python-runtime/python/lib/python3.12/site-packages/PIL/_deprecate.py +74 -0
  755. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imaging.cpython-312-darwin.so +0 -0
  756. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imaging.pyi +31 -0
  757. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingcms.cpython-312-darwin.so +0 -0
  758. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingcms.pyi +143 -0
  759. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingft.cpython-312-darwin.so +0 -0
  760. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingft.pyi +70 -0
  761. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingmath.cpython-312-darwin.so +0 -0
  762. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingmath.pyi +3 -0
  763. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingmorph.cpython-312-darwin.so +0 -0
  764. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingmorph.pyi +3 -0
  765. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingtk.cpython-312-darwin.so +0 -0
  766. package/python-runtime/python/lib/python3.12/site-packages/PIL/_imagingtk.pyi +3 -0
  767. package/python-runtime/python/lib/python3.12/site-packages/PIL/_tkinter_finder.py +20 -0
  768. package/python-runtime/python/lib/python3.12/site-packages/PIL/_typing.py +46 -0
  769. package/python-runtime/python/lib/python3.12/site-packages/PIL/_util.py +29 -0
  770. package/python-runtime/python/lib/python3.12/site-packages/PIL/_version.py +4 -0
  771. package/python-runtime/python/lib/python3.12/site-packages/PIL/_webp.cpython-312-darwin.so +0 -0
  772. package/python-runtime/python/lib/python3.12/site-packages/PIL/_webp.pyi +3 -0
  773. package/python-runtime/python/lib/python3.12/site-packages/PIL/features.py +347 -0
  774. package/python-runtime/python/lib/python3.12/site-packages/PIL/py.typed +0 -0
  775. package/python-runtime/python/lib/python3.12/site-packages/PIL/report.py +5 -0
  776. package/python-runtime/python/lib/python3.12/site-packages/README.txt +2 -0
  777. package/python-runtime/python/lib/python3.12/site-packages/_cffi_backend.cpython-312-darwin.so +0 -0
  778. package/python-runtime/python/lib/python3.12/site-packages/acp/__init__.py +247 -0
  779. package/python-runtime/python/lib/python3.12/site-packages/acp/_cookies.py +53 -0
  780. package/python-runtime/python/lib/python3.12/site-packages/acp/_deserialize.py +62 -0
  781. package/python-runtime/python/lib/python3.12/site-packages/acp/_jsonrpc.py +28 -0
  782. package/python-runtime/python/lib/python3.12/site-packages/acp/_protocol_adapters.py +72 -0
  783. package/python-runtime/python/lib/python3.12/site-packages/acp/_schema_base.py +79 -0
  784. package/python-runtime/python/lib/python3.12/site-packages/acp/_sse.py +98 -0
  785. package/python-runtime/python/lib/python3.12/site-packages/acp/_transport.py +145 -0
  786. package/python-runtime/python/lib/python3.12/site-packages/acp/agent/__init__.py +3 -0
  787. package/python-runtime/python/lib/python3.12/site-packages/acp/agent/connection.py +367 -0
  788. package/python-runtime/python/lib/python3.12/site-packages/acp/agent/router.py +10 -0
  789. package/python-runtime/python/lib/python3.12/site-packages/acp/client/__init__.py +3 -0
  790. package/python-runtime/python/lib/python3.12/site-packages/acp/client/connection.py +626 -0
  791. package/python-runtime/python/lib/python3.12/site-packages/acp/client/router.py +10 -0
  792. package/python-runtime/python/lib/python3.12/site-packages/acp/connection.py +344 -0
  793. package/python-runtime/python/lib/python3.12/site-packages/acp/contrib/__init__.py +27 -0
  794. package/python-runtime/python/lib/python3.12/site-packages/acp/contrib/permissions.py +105 -0
  795. package/python-runtime/python/lib/python3.12/site-packages/acp/contrib/session_state.py +274 -0
  796. package/python-runtime/python/lib/python3.12/site-packages/acp/contrib/tool_calls.py +290 -0
  797. package/python-runtime/python/lib/python3.12/site-packages/acp/core.py +111 -0
  798. package/python-runtime/python/lib/python3.12/site-packages/acp/exceptions.py +50 -0
  799. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/__init__.py +13 -0
  800. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/negotiation.py +214 -0
  801. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/__init__.py +18 -0
  802. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/_connection.py +24 -0
  803. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/_initialization.py +67 -0
  804. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/_methods.py +58 -0
  805. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/_params.py +65 -0
  806. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/_router.py +74 -0
  807. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/_schema_base.py +60 -0
  808. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/agent.py +287 -0
  809. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/client.py +463 -0
  810. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/interfaces.py +314 -0
  811. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/meta.py +41 -0
  812. package/python-runtime/python/lib/python3.12/site-packages/acp/experimental/v2/schema.py +6018 -0
  813. package/python-runtime/python/lib/python3.12/site-packages/acp/http/__init__.py +30 -0
  814. package/python-runtime/python/lib/python3.12/site-packages/acp/http/asgi.py +97 -0
  815. package/python-runtime/python/lib/python3.12/site-packages/acp/http/client.py +266 -0
  816. package/python-runtime/python/lib/python3.12/site-packages/acp/http/protocol.py +115 -0
  817. package/python-runtime/python/lib/python3.12/site-packages/acp/http/server.py +374 -0
  818. package/python-runtime/python/lib/python3.12/site-packages/acp/interfaces.py +468 -0
  819. package/python-runtime/python/lib/python3.12/site-packages/acp/meta.py +50 -0
  820. package/python-runtime/python/lib/python3.12/site-packages/acp/py.typed +1 -0
  821. package/python-runtime/python/lib/python3.12/site-packages/acp/router.py +239 -0
  822. package/python-runtime/python/lib/python3.12/site-packages/acp/schema.py +5846 -0
  823. package/python-runtime/python/lib/python3.12/site-packages/acp/stdio.py +208 -0
  824. package/python-runtime/python/lib/python3.12/site-packages/acp/task/__init__.py +4 -0
  825. package/python-runtime/python/lib/python3.12/site-packages/acp/task/sender.py +63 -0
  826. package/python-runtime/python/lib/python3.12/site-packages/acp/task/supervisor.py +80 -0
  827. package/python-runtime/python/lib/python3.12/site-packages/acp/telemetry.py +41 -0
  828. package/python-runtime/python/lib/python3.12/site-packages/acp/transports.py +112 -0
  829. package/python-runtime/python/lib/python3.12/site-packages/acp/utils.py +265 -0
  830. package/python-runtime/python/lib/python3.12/site-packages/acp/ws/__init__.py +23 -0
  831. package/python-runtime/python/lib/python3.12/site-packages/acp/ws/client.py +124 -0
  832. package/python-runtime/python/lib/python3.12/site-packages/acp/ws/server.py +75 -0
  833. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/__init__.py +0 -0
  834. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/_generated/__init__.py +9 -0
  835. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/_generated/models.py +2825 -0
  836. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/_generated/version.py +12 -0
  837. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/core/__init__.py +242 -0
  838. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/core/capabilities.py +64 -0
  839. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/core/deprecated.py +46 -0
  840. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/core/events.py +131 -0
  841. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/core/token_usage.py +210 -0
  842. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/core/types.py +162 -0
  843. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/core/version.py +38 -0
  844. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/encoder/__init__.py +7 -0
  845. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/encoder/encoder.py +36 -0
  846. package/python-runtime/python/lib/python3.12/site-packages/ag_ui/py.typed +0 -0
  847. package/python-runtime/python/lib/python3.12/site-packages/ag_ui_protocol-1.0.0.dist-info/INSTALLER +1 -0
  848. package/python-runtime/python/lib/python3.12/site-packages/ag_ui_protocol-1.0.0.dist-info/METADATA +114 -0
  849. package/python-runtime/python/lib/python3.12/site-packages/ag_ui_protocol-1.0.0.dist-info/RECORD +32 -0
  850. package/python-runtime/python/lib/python3.12/site-packages/ag_ui_protocol-1.0.0.dist-info/WHEEL +4 -0
  851. package/python-runtime/python/lib/python3.12/site-packages/agent_client_protocol-1.0.0.dist-info/INSTALLER +1 -0
  852. package/python-runtime/python/lib/python3.12/site-packages/agent_client_protocol-1.0.0.dist-info/METADATA +106 -0
  853. package/python-runtime/python/lib/python3.12/site-packages/agent_client_protocol-1.0.0.dist-info/RECORD +115 -0
  854. package/python-runtime/python/lib/python3.12/site-packages/agent_client_protocol-1.0.0.dist-info/WHEEL +4 -0
  855. package/python-runtime/python/lib/python3.12/site-packages/agent_client_protocol-1.0.0.dist-info/entry_points.txt +4 -0
  856. package/python-runtime/python/lib/python3.12/site-packages/annotated_types/__init__.py +416 -0
  857. package/python-runtime/python/lib/python3.12/site-packages/annotated_types/py.typed +0 -0
  858. package/python-runtime/python/lib/python3.12/site-packages/annotated_types/test_cases.py +146 -0
  859. package/python-runtime/python/lib/python3.12/site-packages/annotated_types-0.8.0.dist-info/INSTALLER +1 -0
  860. package/python-runtime/python/lib/python3.12/site-packages/annotated_types-0.8.0.dist-info/METADATA +295 -0
  861. package/python-runtime/python/lib/python3.12/site-packages/annotated_types-0.8.0.dist-info/RECORD +10 -0
  862. package/python-runtime/python/lib/python3.12/site-packages/annotated_types-0.8.0.dist-info/WHEEL +4 -0
  863. package/python-runtime/python/lib/python3.12/site-packages/anyio/__init__.py +154 -0
  864. package/python-runtime/python/lib/python3.12/site-packages/anyio/_backends/__init__.py +0 -0
  865. package/python-runtime/python/lib/python3.12/site-packages/anyio/_backends/_asyncio.py +3300 -0
  866. package/python-runtime/python/lib/python3.12/site-packages/anyio/_backends/_trio.py +1489 -0
  867. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/__init__.py +0 -0
  868. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_asyncio_selector_thread.py +167 -0
  869. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_concurrency_utils.py +156 -0
  870. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_contextmanagers.py +200 -0
  871. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_eventloop.py +244 -0
  872. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_exceptions.py +205 -0
  873. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_fileio.py +1047 -0
  874. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_futures.py +191 -0
  875. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_resources.py +18 -0
  876. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_signals.py +29 -0
  877. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_sockets.py +1032 -0
  878. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_streams.py +52 -0
  879. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_subprocesses.py +196 -0
  880. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_synchronization.py +780 -0
  881. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_tasks.py +464 -0
  882. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_tempfile.py +623 -0
  883. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_testing.py +82 -0
  884. package/python-runtime/python/lib/python3.12/site-packages/anyio/_core/_typedattr.py +90 -0
  885. package/python-runtime/python/lib/python3.12/site-packages/anyio/_lazyimport.py +176 -0
  886. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/__init__.py +63 -0
  887. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/_eventloop.py +443 -0
  888. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/_resources.py +39 -0
  889. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/_sockets.py +401 -0
  890. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/_streams.py +237 -0
  891. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/_subprocesses.py +82 -0
  892. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/_tasks.py +223 -0
  893. package/python-runtime/python/lib/python3.12/site-packages/anyio/abc/_testing.py +79 -0
  894. package/python-runtime/python/lib/python3.12/site-packages/anyio/from_thread.py +689 -0
  895. package/python-runtime/python/lib/python3.12/site-packages/anyio/functools.py +400 -0
  896. package/python-runtime/python/lib/python3.12/site-packages/anyio/itertools.py +632 -0
  897. package/python-runtime/python/lib/python3.12/site-packages/anyio/lowlevel.py +228 -0
  898. package/python-runtime/python/lib/python3.12/site-packages/anyio/py.typed +0 -0
  899. package/python-runtime/python/lib/python3.12/site-packages/anyio/pytest_plugin.py +408 -0
  900. package/python-runtime/python/lib/python3.12/site-packages/anyio/streams/__init__.py +0 -0
  901. package/python-runtime/python/lib/python3.12/site-packages/anyio/streams/buffered.py +212 -0
  902. package/python-runtime/python/lib/python3.12/site-packages/anyio/streams/file.py +162 -0
  903. package/python-runtime/python/lib/python3.12/site-packages/anyio/streams/memory.py +365 -0
  904. package/python-runtime/python/lib/python3.12/site-packages/anyio/streams/stapled.py +160 -0
  905. package/python-runtime/python/lib/python3.12/site-packages/anyio/streams/text.py +189 -0
  906. package/python-runtime/python/lib/python3.12/site-packages/anyio/streams/tls.py +450 -0
  907. package/python-runtime/python/lib/python3.12/site-packages/anyio/to_interpreter.py +246 -0
  908. package/python-runtime/python/lib/python3.12/site-packages/anyio/to_process.py +269 -0
  909. package/python-runtime/python/lib/python3.12/site-packages/anyio/to_thread.py +80 -0
  910. package/python-runtime/python/lib/python3.12/site-packages/anyio-4.16.0.dist-info/INSTALLER +1 -0
  911. package/python-runtime/python/lib/python3.12/site-packages/anyio-4.16.0.dist-info/METADATA +108 -0
  912. package/python-runtime/python/lib/python3.12/site-packages/anyio-4.16.0.dist-info/RECORD +100 -0
  913. package/python-runtime/python/lib/python3.12/site-packages/anyio-4.16.0.dist-info/WHEEL +5 -0
  914. package/python-runtime/python/lib/python3.12/site-packages/anyio-4.16.0.dist-info/entry_points.txt +2 -0
  915. package/python-runtime/python/lib/python3.12/site-packages/attr/__init__.py +104 -0
  916. package/python-runtime/python/lib/python3.12/site-packages/attr/__init__.pyi +389 -0
  917. package/python-runtime/python/lib/python3.12/site-packages/attr/_cmp.py +160 -0
  918. package/python-runtime/python/lib/python3.12/site-packages/attr/_cmp.pyi +13 -0
  919. package/python-runtime/python/lib/python3.12/site-packages/attr/_compat.py +99 -0
  920. package/python-runtime/python/lib/python3.12/site-packages/attr/_config.py +31 -0
  921. package/python-runtime/python/lib/python3.12/site-packages/attr/_funcs.py +497 -0
  922. package/python-runtime/python/lib/python3.12/site-packages/attr/_make.py +3406 -0
  923. package/python-runtime/python/lib/python3.12/site-packages/attr/_next_gen.py +674 -0
  924. package/python-runtime/python/lib/python3.12/site-packages/attr/_typing_compat.pyi +15 -0
  925. package/python-runtime/python/lib/python3.12/site-packages/attr/_version_info.py +89 -0
  926. package/python-runtime/python/lib/python3.12/site-packages/attr/_version_info.pyi +9 -0
  927. package/python-runtime/python/lib/python3.12/site-packages/attr/converters.py +162 -0
  928. package/python-runtime/python/lib/python3.12/site-packages/attr/converters.pyi +19 -0
  929. package/python-runtime/python/lib/python3.12/site-packages/attr/exceptions.py +95 -0
  930. package/python-runtime/python/lib/python3.12/site-packages/attr/exceptions.pyi +17 -0
  931. package/python-runtime/python/lib/python3.12/site-packages/attr/filters.py +72 -0
  932. package/python-runtime/python/lib/python3.12/site-packages/attr/filters.pyi +6 -0
  933. package/python-runtime/python/lib/python3.12/site-packages/attr/py.typed +0 -0
  934. package/python-runtime/python/lib/python3.12/site-packages/attr/setters.py +79 -0
  935. package/python-runtime/python/lib/python3.12/site-packages/attr/setters.pyi +20 -0
  936. package/python-runtime/python/lib/python3.12/site-packages/attr/validators.py +750 -0
  937. package/python-runtime/python/lib/python3.12/site-packages/attr/validators.pyi +140 -0
  938. package/python-runtime/python/lib/python3.12/site-packages/attrs/__init__.py +72 -0
  939. package/python-runtime/python/lib/python3.12/site-packages/attrs/__init__.pyi +314 -0
  940. package/python-runtime/python/lib/python3.12/site-packages/attrs/converters.py +3 -0
  941. package/python-runtime/python/lib/python3.12/site-packages/attrs/exceptions.py +3 -0
  942. package/python-runtime/python/lib/python3.12/site-packages/attrs/filters.py +3 -0
  943. package/python-runtime/python/lib/python3.12/site-packages/attrs/py.typed +0 -0
  944. package/python-runtime/python/lib/python3.12/site-packages/attrs/setters.py +3 -0
  945. package/python-runtime/python/lib/python3.12/site-packages/attrs/validators.py +3 -0
  946. package/python-runtime/python/lib/python3.12/site-packages/attrs-26.1.0.dist-info/INSTALLER +1 -0
  947. package/python-runtime/python/lib/python3.12/site-packages/attrs-26.1.0.dist-info/METADATA +199 -0
  948. package/python-runtime/python/lib/python3.12/site-packages/attrs-26.1.0.dist-info/RECORD +55 -0
  949. package/python-runtime/python/lib/python3.12/site-packages/attrs-26.1.0.dist-info/WHEEL +4 -0
  950. package/python-runtime/python/lib/python3.12/site-packages/certifi/__init__.py +4 -0
  951. package/python-runtime/python/lib/python3.12/site-packages/certifi/__main__.py +12 -0
  952. package/python-runtime/python/lib/python3.12/site-packages/certifi/cacert.pem +3885 -0
  953. package/python-runtime/python/lib/python3.12/site-packages/certifi/core.py +83 -0
  954. package/python-runtime/python/lib/python3.12/site-packages/certifi/py.typed +0 -0
  955. package/python-runtime/python/lib/python3.12/site-packages/certifi-2026.10.23.dist-info/INSTALLER +1 -0
  956. package/python-runtime/python/lib/python3.12/site-packages/certifi-2026.10.23.dist-info/METADATA +79 -0
  957. package/python-runtime/python/lib/python3.12/site-packages/certifi-2026.10.23.dist-info/RECORD +18 -0
  958. package/python-runtime/python/lib/python3.12/site-packages/certifi-2026.10.23.dist-info/WHEEL +5 -0
  959. package/python-runtime/python/lib/python3.12/site-packages/cffi/__init__.py +14 -0
  960. package/python-runtime/python/lib/python3.12/site-packages/cffi/_cffi_errors.h +135 -0
  961. package/python-runtime/python/lib/python3.12/site-packages/cffi/_cffi_gen_src.py +216 -0
  962. package/python-runtime/python/lib/python3.12/site-packages/cffi/_cffi_include.h +397 -0
  963. package/python-runtime/python/lib/python3.12/site-packages/cffi/_embedding.h +512 -0
  964. package/python-runtime/python/lib/python3.12/site-packages/cffi/_imp_emulation.py +83 -0
  965. package/python-runtime/python/lib/python3.12/site-packages/cffi/_shimmed_dist_utils.py +45 -0
  966. package/python-runtime/python/lib/python3.12/site-packages/cffi/api.py +960 -0
  967. package/python-runtime/python/lib/python3.12/site-packages/cffi/backend_ctypes.py +1120 -0
  968. package/python-runtime/python/lib/python3.12/site-packages/cffi/cffi_opcode.py +187 -0
  969. package/python-runtime/python/lib/python3.12/site-packages/cffi/commontypes.py +82 -0
  970. package/python-runtime/python/lib/python3.12/site-packages/cffi/cparser.py +1014 -0
  971. package/python-runtime/python/lib/python3.12/site-packages/cffi/error.py +31 -0
  972. package/python-runtime/python/lib/python3.12/site-packages/cffi/ffiplatform.py +113 -0
  973. package/python-runtime/python/lib/python3.12/site-packages/cffi/gen_src.py +5 -0
  974. package/python-runtime/python/lib/python3.12/site-packages/cffi/lock.py +30 -0
  975. package/python-runtime/python/lib/python3.12/site-packages/cffi/model.py +617 -0
  976. package/python-runtime/python/lib/python3.12/site-packages/cffi/parse_c_type.h +181 -0
  977. package/python-runtime/python/lib/python3.12/site-packages/cffi/pkgconfig.py +121 -0
  978. package/python-runtime/python/lib/python3.12/site-packages/cffi/recompiler.py +1586 -0
  979. package/python-runtime/python/lib/python3.12/site-packages/cffi/setuptools_ext.py +231 -0
  980. package/python-runtime/python/lib/python3.12/site-packages/cffi/vengine_cpy.py +1058 -0
  981. package/python-runtime/python/lib/python3.12/site-packages/cffi/vengine_gen.py +679 -0
  982. package/python-runtime/python/lib/python3.12/site-packages/cffi/verifier.py +306 -0
  983. package/python-runtime/python/lib/python3.12/site-packages/cffi-2.1.1.dist-info/INSTALLER +1 -0
  984. package/python-runtime/python/lib/python3.12/site-packages/cffi-2.1.1.dist-info/METADATA +67 -0
  985. package/python-runtime/python/lib/python3.12/site-packages/cffi-2.1.1.dist-info/RECORD +53 -0
  986. package/python-runtime/python/lib/python3.12/site-packages/cffi-2.1.1.dist-info/WHEEL +6 -0
  987. package/python-runtime/python/lib/python3.12/site-packages/cffi-2.1.1.dist-info/entry_points.txt +5 -0
  988. package/python-runtime/python/lib/python3.12/site-packages/click/__init__.py +144 -0
  989. package/python-runtime/python/lib/python3.12/site-packages/click/_compat.py +590 -0
  990. package/python-runtime/python/lib/python3.12/site-packages/click/_termui_impl.py +970 -0
  991. package/python-runtime/python/lib/python3.12/site-packages/click/_textwrap.py +188 -0
  992. package/python-runtime/python/lib/python3.12/site-packages/click/_utils.py +45 -0
  993. package/python-runtime/python/lib/python3.12/site-packages/click/_winconsole.py +292 -0
  994. package/python-runtime/python/lib/python3.12/site-packages/click/core.py +3825 -0
  995. package/python-runtime/python/lib/python3.12/site-packages/click/decorators.py +625 -0
  996. package/python-runtime/python/lib/python3.12/site-packages/click/exceptions.py +378 -0
  997. package/python-runtime/python/lib/python3.12/site-packages/click/formatting.py +320 -0
  998. package/python-runtime/python/lib/python3.12/site-packages/click/globals.py +67 -0
  999. package/python-runtime/python/lib/python3.12/site-packages/click/parser.py +533 -0
  1000. package/python-runtime/python/lib/python3.12/site-packages/click/py.typed +0 -0
  1001. package/python-runtime/python/lib/python3.12/site-packages/click/shell_completion.py +796 -0
  1002. package/python-runtime/python/lib/python3.12/site-packages/click/termui.py +1024 -0
  1003. package/python-runtime/python/lib/python3.12/site-packages/click/testing.py +796 -0
  1004. package/python-runtime/python/lib/python3.12/site-packages/click/types.py +1437 -0
  1005. package/python-runtime/python/lib/python3.12/site-packages/click/utils.py +676 -0
  1006. package/python-runtime/python/lib/python3.12/site-packages/click-8.5.1.dist-info/INSTALLER +1 -0
  1007. package/python-runtime/python/lib/python3.12/site-packages/click-8.5.1.dist-info/METADATA +83 -0
  1008. package/python-runtime/python/lib/python3.12/site-packages/click-8.5.1.dist-info/RECORD +40 -0
  1009. package/python-runtime/python/lib/python3.12/site-packages/click-8.5.1.dist-info/WHEEL +4 -0
  1010. package/python-runtime/python/lib/python3.12/site-packages/cryptography/__about__.py +17 -0
  1011. package/python-runtime/python/lib/python3.12/site-packages/cryptography/__init__.py +13 -0
  1012. package/python-runtime/python/lib/python3.12/site-packages/cryptography/cobblestone.py +21 -0
  1013. package/python-runtime/python/lib/python3.12/site-packages/cryptography/exceptions.py +52 -0
  1014. package/python-runtime/python/lib/python3.12/site-packages/cryptography/fernet.py +240 -0
  1015. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/__init__.py +13 -0
  1016. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/_oid.py +373 -0
  1017. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/asn1/__init__.py +47 -0
  1018. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/asn1/asn1.py +533 -0
  1019. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/backends/__init__.py +13 -0
  1020. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/__init__.py +9 -0
  1021. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/backend.py +309 -0
  1022. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/__init__.py +5 -0
  1023. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi +67 -0
  1024. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi +8 -0
  1025. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi +7 -0
  1026. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/cobblestone.pyi +33 -0
  1027. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/declarative_asn1.pyi +133 -0
  1028. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi +17 -0
  1029. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi +117 -0
  1030. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi +82 -0
  1031. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/aead.pyi +189 -0
  1032. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ciphers.pyi +38 -0
  1033. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/cmac.pyi +18 -0
  1034. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi +51 -0
  1035. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi +41 -0
  1036. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ec.pyi +52 -0
  1037. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi +13 -0
  1038. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi +13 -0
  1039. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi +30 -0
  1040. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi +22 -0
  1041. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/hpke.pyi +109 -0
  1042. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi +205 -0
  1043. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/keys.pyi +34 -0
  1044. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/keywrap.pyi +28 -0
  1045. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/mldsa.pyi +35 -0
  1046. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/mlkem.pyi +18 -0
  1047. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi +15 -0
  1048. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/rsa.pyi +55 -0
  1049. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi +13 -0
  1050. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/x448.pyi +13 -0
  1051. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/pkcs12.pyi +52 -0
  1052. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi +50 -0
  1053. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/test_support.pyi +23 -0
  1054. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi +313 -0
  1055. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust.abi3.so +0 -0
  1056. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/openssl/__init__.py +5 -0
  1057. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/openssl/_conditional.py +199 -0
  1058. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/openssl/binding.py +107 -0
  1059. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/decrepit/__init__.py +5 -0
  1060. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/decrepit/ciphers/__init__.py +5 -0
  1061. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/decrepit/ciphers/algorithms.py +145 -0
  1062. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/decrepit/ciphers/modes.py +53 -0
  1063. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/__init__.py +5 -0
  1064. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/_asymmetric.py +19 -0
  1065. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/_cipheralgorithm.py +60 -0
  1066. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/_modes.py +105 -0
  1067. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/_serialization.py +136 -0
  1068. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/__init__.py +5 -0
  1069. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/dh.py +253 -0
  1070. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/dsa.py +179 -0
  1071. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/ec.py +369 -0
  1072. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.py +116 -0
  1073. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/ed448.py +143 -0
  1074. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/mldsa.py +505 -0
  1075. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/mlkem.py +278 -0
  1076. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py +141 -0
  1077. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py +295 -0
  1078. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/types.py +94 -0
  1079. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/utils.py +28 -0
  1080. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.py +134 -0
  1081. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/x448.py +137 -0
  1082. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/__init__.py +27 -0
  1083. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/aead.py +23 -0
  1084. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py +138 -0
  1085. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/base.py +146 -0
  1086. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/modes.py +192 -0
  1087. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/cmac.py +10 -0
  1088. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/constant_time.py +14 -0
  1089. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/hashes.py +357 -0
  1090. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/hmac.py +13 -0
  1091. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/hpke.py +27 -0
  1092. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/__init__.py +32 -0
  1093. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/argon2.py +17 -0
  1094. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/concatkdf.py +16 -0
  1095. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/hkdf.py +16 -0
  1096. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/kbkdf.py +26 -0
  1097. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/pbkdf2.py +13 -0
  1098. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py +19 -0
  1099. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/x963kdf.py +13 -0
  1100. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/keywrap.py +25 -0
  1101. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/padding.py +69 -0
  1102. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/poly1305.py +11 -0
  1103. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/__init__.py +85 -0
  1104. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/base.py +16 -0
  1105. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/pkcs12.py +176 -0
  1106. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/pkcs7.py +412 -0
  1107. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/ssh.py +1615 -0
  1108. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/twofactor/__init__.py +9 -0
  1109. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/twofactor/hotp.py +101 -0
  1110. package/python-runtime/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/twofactor/totp.py +56 -0
  1111. package/python-runtime/python/lib/python3.12/site-packages/cryptography/py.typed +0 -0
  1112. package/python-runtime/python/lib/python3.12/site-packages/cryptography/utils.py +136 -0
  1113. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/__init__.py +270 -0
  1114. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/base.py +834 -0
  1115. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/certificate_transparency.py +35 -0
  1116. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/extensions.py +2533 -0
  1117. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/general_name.py +281 -0
  1118. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/name.py +489 -0
  1119. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/ocsp.py +379 -0
  1120. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/oid.py +37 -0
  1121. package/python-runtime/python/lib/python3.12/site-packages/cryptography/x509/verification.py +34 -0
  1122. package/python-runtime/python/lib/python3.12/site-packages/cryptography-50.0.2.dist-info/INSTALLER +1 -0
  1123. package/python-runtime/python/lib/python3.12/site-packages/cryptography-50.0.2.dist-info/METADATA +111 -0
  1124. package/python-runtime/python/lib/python3.12/site-packages/cryptography-50.0.2.dist-info/RECORD +199 -0
  1125. package/python-runtime/python/lib/python3.12/site-packages/cryptography-50.0.2.dist-info/WHEEL +4 -0
  1126. package/python-runtime/python/lib/python3.12/site-packages/dotenv/__init__.py +51 -0
  1127. package/python-runtime/python/lib/python3.12/site-packages/dotenv/__main__.py +6 -0
  1128. package/python-runtime/python/lib/python3.12/site-packages/dotenv/cli.py +246 -0
  1129. package/python-runtime/python/lib/python3.12/site-packages/dotenv/ipython.py +50 -0
  1130. package/python-runtime/python/lib/python3.12/site-packages/dotenv/main.py +487 -0
  1131. package/python-runtime/python/lib/python3.12/site-packages/dotenv/parser.py +191 -0
  1132. package/python-runtime/python/lib/python3.12/site-packages/dotenv/py.typed +1 -0
  1133. package/python-runtime/python/lib/python3.12/site-packages/dotenv/variables.py +86 -0
  1134. package/python-runtime/python/lib/python3.12/site-packages/dotenv/version.py +1 -0
  1135. package/python-runtime/python/lib/python3.12/site-packages/h11/__init__.py +62 -0
  1136. package/python-runtime/python/lib/python3.12/site-packages/h11/_abnf.py +132 -0
  1137. package/python-runtime/python/lib/python3.12/site-packages/h11/_connection.py +659 -0
  1138. package/python-runtime/python/lib/python3.12/site-packages/h11/_events.py +369 -0
  1139. package/python-runtime/python/lib/python3.12/site-packages/h11/_headers.py +282 -0
  1140. package/python-runtime/python/lib/python3.12/site-packages/h11/_readers.py +250 -0
  1141. package/python-runtime/python/lib/python3.12/site-packages/h11/_receivebuffer.py +153 -0
  1142. package/python-runtime/python/lib/python3.12/site-packages/h11/_state.py +365 -0
  1143. package/python-runtime/python/lib/python3.12/site-packages/h11/_util.py +135 -0
  1144. package/python-runtime/python/lib/python3.12/site-packages/h11/_version.py +16 -0
  1145. package/python-runtime/python/lib/python3.12/site-packages/h11/_writers.py +145 -0
  1146. package/python-runtime/python/lib/python3.12/site-packages/h11/py.typed +1 -0
  1147. package/python-runtime/python/lib/python3.12/site-packages/h11-0.16.0.dist-info/INSTALLER +1 -0
  1148. package/python-runtime/python/lib/python3.12/site-packages/h11-0.16.0.dist-info/METADATA +202 -0
  1149. package/python-runtime/python/lib/python3.12/site-packages/h11-0.16.0.dist-info/RECORD +29 -0
  1150. package/python-runtime/python/lib/python3.12/site-packages/h11-0.16.0.dist-info/WHEEL +5 -0
  1151. package/python-runtime/python/lib/python3.12/site-packages/httpcore/__init__.py +141 -0
  1152. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_api.py +94 -0
  1153. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/__init__.py +39 -0
  1154. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/connection.py +222 -0
  1155. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/connection_pool.py +420 -0
  1156. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/http11.py +379 -0
  1157. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/http2.py +592 -0
  1158. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/http_proxy.py +367 -0
  1159. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/interfaces.py +137 -0
  1160. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_async/socks_proxy.py +341 -0
  1161. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_backends/__init__.py +0 -0
  1162. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_backends/anyio.py +146 -0
  1163. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_backends/auto.py +52 -0
  1164. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_backends/base.py +101 -0
  1165. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_backends/mock.py +143 -0
  1166. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_backends/sync.py +241 -0
  1167. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_backends/trio.py +159 -0
  1168. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_exceptions.py +81 -0
  1169. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_models.py +516 -0
  1170. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_ssl.py +9 -0
  1171. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/__init__.py +39 -0
  1172. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/connection.py +222 -0
  1173. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py +420 -0
  1174. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/http11.py +379 -0
  1175. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/http2.py +592 -0
  1176. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/http_proxy.py +367 -0
  1177. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/interfaces.py +137 -0
  1178. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_sync/socks_proxy.py +341 -0
  1179. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_synchronization.py +318 -0
  1180. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_trace.py +107 -0
  1181. package/python-runtime/python/lib/python3.12/site-packages/httpcore/_utils.py +37 -0
  1182. package/python-runtime/python/lib/python3.12/site-packages/httpcore/py.typed +0 -0
  1183. package/python-runtime/python/lib/python3.12/site-packages/httpcore-1.0.9.dist-info/INSTALLER +1 -0
  1184. package/python-runtime/python/lib/python3.12/site-packages/httpcore-1.0.9.dist-info/METADATA +625 -0
  1185. package/python-runtime/python/lib/python3.12/site-packages/httpcore-1.0.9.dist-info/RECORD +68 -0
  1186. package/python-runtime/python/lib/python3.12/site-packages/httpcore-1.0.9.dist-info/WHEEL +4 -0
  1187. package/python-runtime/python/lib/python3.12/site-packages/httpx/__init__.py +105 -0
  1188. package/python-runtime/python/lib/python3.12/site-packages/httpx/__version__.py +3 -0
  1189. package/python-runtime/python/lib/python3.12/site-packages/httpx/_api.py +438 -0
  1190. package/python-runtime/python/lib/python3.12/site-packages/httpx/_auth.py +348 -0
  1191. package/python-runtime/python/lib/python3.12/site-packages/httpx/_client.py +2019 -0
  1192. package/python-runtime/python/lib/python3.12/site-packages/httpx/_config.py +248 -0
  1193. package/python-runtime/python/lib/python3.12/site-packages/httpx/_content.py +240 -0
  1194. package/python-runtime/python/lib/python3.12/site-packages/httpx/_decoders.py +393 -0
  1195. package/python-runtime/python/lib/python3.12/site-packages/httpx/_exceptions.py +379 -0
  1196. package/python-runtime/python/lib/python3.12/site-packages/httpx/_main.py +506 -0
  1197. package/python-runtime/python/lib/python3.12/site-packages/httpx/_models.py +1277 -0
  1198. package/python-runtime/python/lib/python3.12/site-packages/httpx/_multipart.py +300 -0
  1199. package/python-runtime/python/lib/python3.12/site-packages/httpx/_status_codes.py +162 -0
  1200. package/python-runtime/python/lib/python3.12/site-packages/httpx/_transports/__init__.py +15 -0
  1201. package/python-runtime/python/lib/python3.12/site-packages/httpx/_transports/asgi.py +187 -0
  1202. package/python-runtime/python/lib/python3.12/site-packages/httpx/_transports/base.py +86 -0
  1203. package/python-runtime/python/lib/python3.12/site-packages/httpx/_transports/default.py +406 -0
  1204. package/python-runtime/python/lib/python3.12/site-packages/httpx/_transports/mock.py +43 -0
  1205. package/python-runtime/python/lib/python3.12/site-packages/httpx/_transports/wsgi.py +149 -0
  1206. package/python-runtime/python/lib/python3.12/site-packages/httpx/_types.py +114 -0
  1207. package/python-runtime/python/lib/python3.12/site-packages/httpx/_urlparse.py +527 -0
  1208. package/python-runtime/python/lib/python3.12/site-packages/httpx/_urls.py +641 -0
  1209. package/python-runtime/python/lib/python3.12/site-packages/httpx/_utils.py +242 -0
  1210. package/python-runtime/python/lib/python3.12/site-packages/httpx/py.typed +0 -0
  1211. package/python-runtime/python/lib/python3.12/site-packages/httpx-0.28.1.dist-info/INSTALLER +1 -0
  1212. package/python-runtime/python/lib/python3.12/site-packages/httpx-0.28.1.dist-info/METADATA +203 -0
  1213. package/python-runtime/python/lib/python3.12/site-packages/httpx-0.28.1.dist-info/RECORD +54 -0
  1214. package/python-runtime/python/lib/python3.12/site-packages/httpx-0.28.1.dist-info/WHEEL +4 -0
  1215. package/python-runtime/python/lib/python3.12/site-packages/httpx-0.28.1.dist-info/entry_points.txt +2 -0
  1216. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse/__init__.py +14 -0
  1217. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse/_api.py +93 -0
  1218. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse/_decoders.py +139 -0
  1219. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse/_exceptions.py +5 -0
  1220. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse/_models.py +54 -0
  1221. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse/py.typed +0 -0
  1222. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse-0.4.3.dist-info/INSTALLER +1 -0
  1223. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse-0.4.3.dist-info/METADATA +351 -0
  1224. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse-0.4.3.dist-info/RECORD +17 -0
  1225. package/python-runtime/python/lib/python3.12/site-packages/httpx_sse-0.4.3.dist-info/WHEEL +5 -0
  1226. package/python-runtime/python/lib/python3.12/site-packages/idna/__init__.py +47 -0
  1227. package/python-runtime/python/lib/python3.12/site-packages/idna/__main__.py +6 -0
  1228. package/python-runtime/python/lib/python3.12/site-packages/idna/cli.py +132 -0
  1229. package/python-runtime/python/lib/python3.12/site-packages/idna/codec.py +225 -0
  1230. package/python-runtime/python/lib/python3.12/site-packages/idna/compat.py +43 -0
  1231. package/python-runtime/python/lib/python3.12/site-packages/idna/core.py +863 -0
  1232. package/python-runtime/python/lib/python3.12/site-packages/idna/idnadata.py +1933 -0
  1233. package/python-runtime/python/lib/python3.12/site-packages/idna/intranges.py +55 -0
  1234. package/python-runtime/python/lib/python3.12/site-packages/idna/package_data.py +1 -0
  1235. package/python-runtime/python/lib/python3.12/site-packages/idna/py.typed +0 -0
  1236. package/python-runtime/python/lib/python3.12/site-packages/idna/uts46data.py +17117 -0
  1237. package/python-runtime/python/lib/python3.12/site-packages/idna-3.20.dist-info/INSTALLER +1 -0
  1238. package/python-runtime/python/lib/python3.12/site-packages/idna-3.20.dist-info/METADATA +176 -0
  1239. package/python-runtime/python/lib/python3.12/site-packages/idna-3.20.dist-info/RECORD +28 -0
  1240. package/python-runtime/python/lib/python3.12/site-packages/idna-3.20.dist-info/WHEEL +4 -0
  1241. package/python-runtime/python/lib/python3.12/site-packages/idna-3.20.dist-info/entry_points.txt +3 -0
  1242. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/__init__.py +120 -0
  1243. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/__main__.py +6 -0
  1244. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/_format.py +546 -0
  1245. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/_keywords.py +449 -0
  1246. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/_legacy_keywords.py +449 -0
  1247. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/_types.py +204 -0
  1248. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/_typing.py +29 -0
  1249. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/_utils.py +355 -0
  1250. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/__init__.py +5 -0
  1251. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/const_vs_enum.py +30 -0
  1252. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/contains.py +28 -0
  1253. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/import_benchmark.py +31 -0
  1254. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/issue232/issue.json +2653 -0
  1255. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/issue232.py +25 -0
  1256. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/json_schema_test_suite.py +12 -0
  1257. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/nested_schemas.py +56 -0
  1258. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/subcomponents.py +42 -0
  1259. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/unused_registry.py +35 -0
  1260. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/useless_applicator_schemas.py +106 -0
  1261. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/useless_keywords.py +32 -0
  1262. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/benchmarks/validator_creation.py +14 -0
  1263. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/cli.py +292 -0
  1264. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/exceptions.py +490 -0
  1265. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/protocols.py +230 -0
  1266. package/python-runtime/python/lib/python3.12/site-packages/jsonschema/validators.py +1410 -0
  1267. package/python-runtime/python/lib/python3.12/site-packages/jsonschema-4.26.0.dist-info/INSTALLER +1 -0
  1268. package/python-runtime/python/lib/python3.12/site-packages/jsonschema-4.26.0.dist-info/METADATA +170 -0
  1269. package/python-runtime/python/lib/python3.12/site-packages/jsonschema-4.26.0.dist-info/RECORD +82 -0
  1270. package/python-runtime/python/lib/python3.12/site-packages/jsonschema-4.26.0.dist-info/WHEEL +4 -0
  1271. package/python-runtime/python/lib/python3.12/site-packages/jsonschema-4.26.0.dist-info/entry_points.txt +2 -0
  1272. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/__init__.py +12 -0
  1273. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/_core.py +38 -0
  1274. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft201909/metaschema.json +42 -0
  1275. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft201909/vocabularies/applicator +56 -0
  1276. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft201909/vocabularies/content +17 -0
  1277. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft201909/vocabularies/core +57 -0
  1278. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft201909/vocabularies/format +14 -0
  1279. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft201909/vocabularies/meta-data +37 -0
  1280. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft201909/vocabularies/validation +98 -0
  1281. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/metaschema.json +58 -0
  1282. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/applicator +48 -0
  1283. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/content +17 -0
  1284. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/core +51 -0
  1285. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/format-annotation +14 -0
  1286. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/format-assertion +14 -0
  1287. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/meta-data +37 -0
  1288. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/unevaluated +15 -0
  1289. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft202012/vocabularies/validation +98 -0
  1290. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft3/metaschema.json +172 -0
  1291. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft4/metaschema.json +149 -0
  1292. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft6/metaschema.json +153 -0
  1293. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications/schemas/draft7/metaschema.json +166 -0
  1294. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications-2025.9.1.dist-info/INSTALLER +1 -0
  1295. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications-2025.9.1.dist-info/METADATA +54 -0
  1296. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications-2025.9.1.dist-info/RECORD +33 -0
  1297. package/python-runtime/python/lib/python3.12/site-packages/jsonschema_specifications-2025.9.1.dist-info/WHEEL +4 -0
  1298. package/python-runtime/python/lib/python3.12/site-packages/jwt/__init__.py +78 -0
  1299. package/python-runtime/python/lib/python3.12/site-packages/jwt/algorithms.py +1121 -0
  1300. package/python-runtime/python/lib/python3.12/site-packages/jwt/api_jwk.py +196 -0
  1301. package/python-runtime/python/lib/python3.12/site-packages/jwt/api_jws.py +485 -0
  1302. package/python-runtime/python/lib/python3.12/site-packages/jwt/api_jwt.py +595 -0
  1303. package/python-runtime/python/lib/python3.12/site-packages/jwt/exceptions.py +113 -0
  1304. package/python-runtime/python/lib/python3.12/site-packages/jwt/help.py +66 -0
  1305. package/python-runtime/python/lib/python3.12/site-packages/jwt/jwk_set_cache.py +47 -0
  1306. package/python-runtime/python/lib/python3.12/site-packages/jwt/jwks_client.py +333 -0
  1307. package/python-runtime/python/lib/python3.12/site-packages/jwt/py.typed +0 -0
  1308. package/python-runtime/python/lib/python3.12/site-packages/jwt/types.py +69 -0
  1309. package/python-runtime/python/lib/python3.12/site-packages/jwt/utils.py +146 -0
  1310. package/python-runtime/python/lib/python3.12/site-packages/jwt/warnings.py +11 -0
  1311. package/python-runtime/python/lib/python3.12/site-packages/mcp/__init__.py +135 -0
  1312. package/python-runtime/python/lib/python3.12/site-packages/mcp/cli/__init__.py +6 -0
  1313. package/python-runtime/python/lib/python3.12/site-packages/mcp/cli/claude.py +148 -0
  1314. package/python-runtime/python/lib/python3.12/site-packages/mcp/cli/cli.py +488 -0
  1315. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/__init__.py +0 -0
  1316. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/__main__.py +85 -0
  1317. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/auth/__init__.py +21 -0
  1318. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/auth/exceptions.py +10 -0
  1319. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/auth/extensions/__init__.py +0 -0
  1320. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/auth/extensions/client_credentials.py +567 -0
  1321. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/auth/oauth2.py +682 -0
  1322. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/auth/utils.py +395 -0
  1323. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/experimental/__init__.py +9 -0
  1324. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/experimental/task_handlers.py +290 -0
  1325. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/experimental/tasks.py +224 -0
  1326. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/session.py +640 -0
  1327. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/session_group.py +447 -0
  1328. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/sse.py +177 -0
  1329. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/stdio/__init__.py +278 -0
  1330. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/streamable_http.py +747 -0
  1331. package/python-runtime/python/lib/python3.12/site-packages/mcp/client/websocket.py +94 -0
  1332. package/python-runtime/python/lib/python3.12/site-packages/mcp/os/__init__.py +1 -0
  1333. package/python-runtime/python/lib/python3.12/site-packages/mcp/os/posix/__init__.py +1 -0
  1334. package/python-runtime/python/lib/python3.12/site-packages/mcp/os/posix/utilities.py +60 -0
  1335. package/python-runtime/python/lib/python3.12/site-packages/mcp/os/win32/__init__.py +1 -0
  1336. package/python-runtime/python/lib/python3.12/site-packages/mcp/os/win32/utilities.py +338 -0
  1337. package/python-runtime/python/lib/python3.12/site-packages/mcp/py.typed +0 -0
  1338. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/__init__.py +5 -0
  1339. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/__main__.py +50 -0
  1340. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/__init__.py +3 -0
  1341. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/errors.py +5 -0
  1342. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/handlers/__init__.py +3 -0
  1343. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/handlers/authorize.py +224 -0
  1344. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/handlers/metadata.py +29 -0
  1345. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/handlers/register.py +136 -0
  1346. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/handlers/revoke.py +91 -0
  1347. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/handlers/token.py +241 -0
  1348. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/json_response.py +10 -0
  1349. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/middleware/__init__.py +3 -0
  1350. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/middleware/auth_context.py +48 -0
  1351. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/middleware/bearer_auth.py +173 -0
  1352. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/middleware/client_auth.py +115 -0
  1353. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/provider.py +314 -0
  1354. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/routes.py +254 -0
  1355. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/auth/settings.py +56 -0
  1356. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/elicitation.py +190 -0
  1357. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/experimental/__init__.py +12 -0
  1358. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/experimental/request_context.py +285 -0
  1359. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/experimental/session_features.py +226 -0
  1360. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/experimental/task_context.py +614 -0
  1361. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/experimental/task_result_handler.py +243 -0
  1362. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/experimental/task_scope.py +75 -0
  1363. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/experimental/task_support.py +128 -0
  1364. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/__init__.py +11 -0
  1365. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/exceptions.py +21 -0
  1366. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/prompts/__init__.py +4 -0
  1367. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/prompts/base.py +183 -0
  1368. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/prompts/manager.py +60 -0
  1369. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/resources/__init__.py +23 -0
  1370. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/resources/base.py +50 -0
  1371. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/resources/resource_manager.py +115 -0
  1372. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/resources/templates.py +122 -0
  1373. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/resources/types.py +203 -0
  1374. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/server.py +1390 -0
  1375. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/tools/__init__.py +4 -0
  1376. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/tools/base.py +126 -0
  1377. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/tools/tool_manager.py +93 -0
  1378. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/utilities/__init__.py +1 -0
  1379. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/utilities/context_injection.py +68 -0
  1380. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/utilities/func_metadata.py +560 -0
  1381. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/utilities/logging.py +43 -0
  1382. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/fastmcp/utilities/types.py +101 -0
  1383. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/lowlevel/__init__.py +3 -0
  1384. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/lowlevel/experimental.py +342 -0
  1385. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/lowlevel/func_inspection.py +54 -0
  1386. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/lowlevel/helper_types.py +11 -0
  1387. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/lowlevel/server.py +830 -0
  1388. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/models.py +20 -0
  1389. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/session.py +701 -0
  1390. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/sse.py +299 -0
  1391. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/stdio.py +88 -0
  1392. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/streamable_http.py +1131 -0
  1393. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/streamable_http_manager.py +425 -0
  1394. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/transport_security.py +194 -0
  1395. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/validation.py +104 -0
  1396. package/python-runtime/python/lib/python3.12/site-packages/mcp/server/websocket.py +89 -0
  1397. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/__init__.py +0 -0
  1398. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/_httpx_utils.py +219 -0
  1399. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/auth.py +180 -0
  1400. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/auth_utils.py +80 -0
  1401. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/context.py +32 -0
  1402. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/exceptions.py +71 -0
  1403. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/__init__.py +7 -0
  1404. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/__init__.py +12 -0
  1405. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/capabilities.py +115 -0
  1406. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/context.py +101 -0
  1407. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/helpers.py +181 -0
  1408. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/in_memory_task_store.py +219 -0
  1409. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/message_queue.py +241 -0
  1410. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/polling.py +45 -0
  1411. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/resolver.py +60 -0
  1412. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/experimental/tasks/store.py +156 -0
  1413. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/memory.py +98 -0
  1414. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/message.py +50 -0
  1415. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/metadata_utils.py +45 -0
  1416. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/progress.py +58 -0
  1417. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/response_router.py +63 -0
  1418. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/session.py +552 -0
  1419. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/tool_name_validation.py +129 -0
  1420. package/python-runtime/python/lib/python3.12/site-packages/mcp/shared/version.py +3 -0
  1421. package/python-runtime/python/lib/python3.12/site-packages/mcp/types.py +1999 -0
  1422. package/python-runtime/python/lib/python3.12/site-packages/mcp-1.30.0.dist-info/INSTALLER +1 -0
  1423. package/python-runtime/python/lib/python3.12/site-packages/mcp-1.30.0.dist-info/METADATA +239 -0
  1424. package/python-runtime/python/lib/python3.12/site-packages/mcp-1.30.0.dist-info/RECORD +228 -0
  1425. package/python-runtime/python/lib/python3.12/site-packages/mcp-1.30.0.dist-info/WHEEL +4 -0
  1426. package/python-runtime/python/lib/python3.12/site-packages/mcp-1.30.0.dist-info/entry_points.txt +2 -0
  1427. package/python-runtime/python/lib/python3.12/site-packages/multipart/__init__.py +38 -0
  1428. package/python-runtime/python/lib/python3.12/site-packages/multipart/decoders.py +1 -0
  1429. package/python-runtime/python/lib/python3.12/site-packages/multipart/exceptions.py +1 -0
  1430. package/python-runtime/python/lib/python3.12/site-packages/multipart/multipart.py +1 -0
  1431. package/python-runtime/python/lib/python3.12/site-packages/pillow-13.0.0.dist-info/INSTALLER +1 -0
  1432. package/python-runtime/python/lib/python3.12/site-packages/pillow-13.0.0.dist-info/METADATA +182 -0
  1433. package/python-runtime/python/lib/python3.12/site-packages/pillow-13.0.0.dist-info/RECORD +236 -0
  1434. package/python-runtime/python/lib/python3.12/site-packages/pillow-13.0.0.dist-info/WHEEL +6 -0
  1435. package/python-runtime/python/lib/python3.12/site-packages/pycparser/__init__.py +98 -0
  1436. package/python-runtime/python/lib/python3.12/site-packages/pycparser/_ast_gen.py +385 -0
  1437. package/python-runtime/python/lib/python3.12/site-packages/pycparser/_c_ast.cfg +268 -0
  1438. package/python-runtime/python/lib/python3.12/site-packages/pycparser/ast_transforms.py +201 -0
  1439. package/python-runtime/python/lib/python3.12/site-packages/pycparser/c_ast.py +1670 -0
  1440. package/python-runtime/python/lib/python3.12/site-packages/pycparser/c_generator.py +866 -0
  1441. package/python-runtime/python/lib/python3.12/site-packages/pycparser/c_lexer.py +861 -0
  1442. package/python-runtime/python/lib/python3.12/site-packages/pycparser/c_parser.py +2759 -0
  1443. package/python-runtime/python/lib/python3.12/site-packages/pycparser-3.12.dist-info/INSTALLER +1 -0
  1444. package/python-runtime/python/lib/python3.12/site-packages/pycparser-3.12.dist-info/METADATA +286 -0
  1445. package/python-runtime/python/lib/python3.12/site-packages/pycparser-3.12.dist-info/RECORD +21 -0
  1446. package/python-runtime/python/lib/python3.12/site-packages/pycparser-3.12.dist-info/WHEEL +5 -0
  1447. package/python-runtime/python/lib/python3.12/site-packages/pydantic/__init__.py +461 -0
  1448. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/__init__.py +0 -0
  1449. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_config.py +408 -0
  1450. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_contextlib.py +84 -0
  1451. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_core_metadata.py +97 -0
  1452. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_core_utils.py +156 -0
  1453. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_dataclasses.py +327 -0
  1454. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_decorators.py +906 -0
  1455. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_decorators_v1.py +174 -0
  1456. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_discriminated_union.py +510 -0
  1457. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_docs_extraction.py +128 -0
  1458. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_fields.py +910 -0
  1459. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_forward_ref.py +23 -0
  1460. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py +3053 -0
  1461. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_generics.py +556 -0
  1462. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_git.py +27 -0
  1463. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_import_utils.py +20 -0
  1464. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_known_annotated_metadata.py +412 -0
  1465. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_mock_val_ser.py +241 -0
  1466. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py +833 -0
  1467. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_namespace_utils.py +300 -0
  1468. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_repr.py +122 -0
  1469. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_schema_gather.py +49 -0
  1470. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_schema_generation_shared.py +126 -0
  1471. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_serializers.py +59 -0
  1472. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_signature.py +193 -0
  1473. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_type_refs.py +128 -0
  1474. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_typing_extra.py +506 -0
  1475. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_utils.py +433 -0
  1476. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_validate_call.py +141 -0
  1477. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_internal/_validators.py +541 -0
  1478. package/python-runtime/python/lib/python3.12/site-packages/pydantic/_migration.py +317 -0
  1479. package/python-runtime/python/lib/python3.12/site-packages/pydantic/alias_generators.py +62 -0
  1480. package/python-runtime/python/lib/python3.12/site-packages/pydantic/aliases.py +136 -0
  1481. package/python-runtime/python/lib/python3.12/site-packages/pydantic/annotated_handlers.py +123 -0
  1482. package/python-runtime/python/lib/python3.12/site-packages/pydantic/class_validators.py +5 -0
  1483. package/python-runtime/python/lib/python3.12/site-packages/pydantic/color.py +605 -0
  1484. package/python-runtime/python/lib/python3.12/site-packages/pydantic/config.py +1295 -0
  1485. package/python-runtime/python/lib/python3.12/site-packages/pydantic/dataclasses.py +385 -0
  1486. package/python-runtime/python/lib/python3.12/site-packages/pydantic/datetime_parse.py +5 -0
  1487. package/python-runtime/python/lib/python3.12/site-packages/pydantic/decorator.py +5 -0
  1488. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/__init__.py +0 -0
  1489. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/class_validators.py +257 -0
  1490. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/config.py +72 -0
  1491. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/copy_internals.py +224 -0
  1492. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/decorator.py +286 -0
  1493. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/json.py +142 -0
  1494. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/parse.py +81 -0
  1495. package/python-runtime/python/lib/python3.12/site-packages/pydantic/deprecated/tools.py +104 -0
  1496. package/python-runtime/python/lib/python3.12/site-packages/pydantic/env_settings.py +5 -0
  1497. package/python-runtime/python/lib/python3.12/site-packages/pydantic/error_wrappers.py +5 -0
  1498. package/python-runtime/python/lib/python3.12/site-packages/pydantic/errors.py +185 -0
  1499. package/python-runtime/python/lib/python3.12/site-packages/pydantic/experimental/__init__.py +1 -0
  1500. package/python-runtime/python/lib/python3.12/site-packages/pydantic/experimental/arguments_schema.py +44 -0
  1501. package/python-runtime/python/lib/python3.12/site-packages/pydantic/experimental/missing_sentinel.py +29 -0
  1502. package/python-runtime/python/lib/python3.12/site-packages/pydantic/experimental/pipeline.py +684 -0
  1503. package/python-runtime/python/lib/python3.12/site-packages/pydantic/fields.py +2065 -0
  1504. package/python-runtime/python/lib/python3.12/site-packages/pydantic/functional_serializers.py +461 -0
  1505. package/python-runtime/python/lib/python3.12/site-packages/pydantic/functional_validators.py +920 -0
  1506. package/python-runtime/python/lib/python3.12/site-packages/pydantic/generics.py +5 -0
  1507. package/python-runtime/python/lib/python3.12/site-packages/pydantic/json.py +5 -0
  1508. package/python-runtime/python/lib/python3.12/site-packages/pydantic/json_schema.py +3281 -0
  1509. package/python-runtime/python/lib/python3.12/site-packages/pydantic/main.py +1947 -0
  1510. package/python-runtime/python/lib/python3.12/site-packages/pydantic/mypy.py +1469 -0
  1511. package/python-runtime/python/lib/python3.12/site-packages/pydantic/networks.py +1417 -0
  1512. package/python-runtime/python/lib/python3.12/site-packages/pydantic/parse.py +5 -0
  1513. package/python-runtime/python/lib/python3.12/site-packages/pydantic/plugin/__init__.py +190 -0
  1514. package/python-runtime/python/lib/python3.12/site-packages/pydantic/plugin/_loader.py +56 -0
  1515. package/python-runtime/python/lib/python3.12/site-packages/pydantic/plugin/_schema_validator.py +152 -0
  1516. package/python-runtime/python/lib/python3.12/site-packages/pydantic/py.typed +0 -0
  1517. package/python-runtime/python/lib/python3.12/site-packages/pydantic/root_model.py +189 -0
  1518. package/python-runtime/python/lib/python3.12/site-packages/pydantic/schema.py +5 -0
  1519. package/python-runtime/python/lib/python3.12/site-packages/pydantic/tools.py +5 -0
  1520. package/python-runtime/python/lib/python3.12/site-packages/pydantic/type_adapter.py +780 -0
  1521. package/python-runtime/python/lib/python3.12/site-packages/pydantic/types.py +3405 -0
  1522. package/python-runtime/python/lib/python3.12/site-packages/pydantic/typing.py +5 -0
  1523. package/python-runtime/python/lib/python3.12/site-packages/pydantic/utils.py +5 -0
  1524. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/__init__.py +131 -0
  1525. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/_hypothesis_plugin.py +391 -0
  1526. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/annotated_types.py +72 -0
  1527. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/class_validators.py +361 -0
  1528. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/color.py +494 -0
  1529. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/config.py +191 -0
  1530. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/dataclasses.py +503 -0
  1531. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/datetime_parse.py +248 -0
  1532. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/decorator.py +264 -0
  1533. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/env_settings.py +350 -0
  1534. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/error_wrappers.py +161 -0
  1535. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/errors.py +646 -0
  1536. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/fields.py +1253 -0
  1537. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/generics.py +400 -0
  1538. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/json.py +112 -0
  1539. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/main.py +1130 -0
  1540. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/mypy.py +950 -0
  1541. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/networks.py +747 -0
  1542. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/parse.py +66 -0
  1543. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/py.typed +0 -0
  1544. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/schema.py +1163 -0
  1545. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/tools.py +92 -0
  1546. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/types.py +1213 -0
  1547. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/typing.py +627 -0
  1548. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/utils.py +807 -0
  1549. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/validators.py +768 -0
  1550. package/python-runtime/python/lib/python3.12/site-packages/pydantic/v1/version.py +38 -0
  1551. package/python-runtime/python/lib/python3.12/site-packages/pydantic/validate_call_decorator.py +121 -0
  1552. package/python-runtime/python/lib/python3.12/site-packages/pydantic/validators.py +5 -0
  1553. package/python-runtime/python/lib/python3.12/site-packages/pydantic/version.py +113 -0
  1554. package/python-runtime/python/lib/python3.12/site-packages/pydantic/warnings.py +130 -0
  1555. package/python-runtime/python/lib/python3.12/site-packages/pydantic-2.14.3.dist-info/INSTALLER +1 -0
  1556. package/python-runtime/python/lib/python3.12/site-packages/pydantic-2.14.3.dist-info/METADATA +1646 -0
  1557. package/python-runtime/python/lib/python3.12/site-packages/pydantic-2.14.3.dist-info/RECORD +219 -0
  1558. package/python-runtime/python/lib/python3.12/site-packages/pydantic-2.14.3.dist-info/WHEEL +4 -0
  1559. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core/__init__.py +194 -0
  1560. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core/_pydantic_core/__init__.pyi +1114 -0
  1561. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core/_pydantic_core/_schema_gather.pyi +34 -0
  1562. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core/_pydantic_core.cpython-312-darwin.so +0 -0
  1563. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core/core_schema.py +5093 -0
  1564. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core/py.typed +0 -0
  1565. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core-2.50.4.dist-info/INSTALLER +1 -0
  1566. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core-2.50.4.dist-info/METADATA +172 -0
  1567. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core-2.50.4.dist-info/RECORD +14 -0
  1568. package/python-runtime/python/lib/python3.12/site-packages/pydantic_core-2.50.4.dist-info/WHEEL +4 -0
  1569. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/__init__.py +74 -0
  1570. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/exceptions.py +10 -0
  1571. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/main.py +1133 -0
  1572. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/py.typed +0 -0
  1573. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/__init__.py +91 -0
  1574. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/base.py +767 -0
  1575. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/__init__.py +48 -0
  1576. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/aws.py +158 -0
  1577. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/azure.py +246 -0
  1578. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/cli.py +1942 -0
  1579. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/dotenv.py +226 -0
  1580. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/env.py +423 -0
  1581. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/gcp.py +365 -0
  1582. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/json.py +61 -0
  1583. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/nested_secrets.py +220 -0
  1584. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/pyproject.py +64 -0
  1585. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/secrets.py +146 -0
  1586. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/toml.py +72 -0
  1587. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/providers/yaml.py +147 -0
  1588. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/types.py +109 -0
  1589. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/sources/utils.py +515 -0
  1590. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/utils.py +46 -0
  1591. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings/version.py +1 -0
  1592. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings-2.16.2.dist-info/INSTALLER +1 -0
  1593. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings-2.16.2.dist-info/METADATA +72 -0
  1594. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings-2.16.2.dist-info/RECORD +50 -0
  1595. package/python-runtime/python/lib/python3.12/site-packages/pydantic_settings-2.16.2.dist-info/WHEEL +4 -0
  1596. package/python-runtime/python/lib/python3.12/site-packages/pyjwt-2.15.1.dist-info/INSTALLER +1 -0
  1597. package/python-runtime/python/lib/python3.12/site-packages/pyjwt-2.15.1.dist-info/METADATA +94 -0
  1598. package/python-runtime/python/lib/python3.12/site-packages/pyjwt-2.15.1.dist-info/RECORD +32 -0
  1599. package/python-runtime/python/lib/python3.12/site-packages/pyjwt-2.15.1.dist-info/WHEEL +5 -0
  1600. package/python-runtime/python/lib/python3.12/site-packages/python_dotenv-1.2.4.dist-info/INSTALLER +1 -0
  1601. package/python-runtime/python/lib/python3.12/site-packages/python_dotenv-1.2.4.dist-info/METADATA +835 -0
  1602. package/python-runtime/python/lib/python3.12/site-packages/python_dotenv-1.2.4.dist-info/RECORD +25 -0
  1603. package/python-runtime/python/lib/python3.12/site-packages/python_dotenv-1.2.4.dist-info/WHEEL +5 -0
  1604. package/python-runtime/python/lib/python3.12/site-packages/python_dotenv-1.2.4.dist-info/entry_points.txt +2 -0
  1605. package/python-runtime/python/lib/python3.12/site-packages/python_multipart/__init__.py +35 -0
  1606. package/python-runtime/python/lib/python3.12/site-packages/python_multipart/decoders.py +185 -0
  1607. package/python-runtime/python/lib/python3.12/site-packages/python_multipart/exceptions.py +34 -0
  1608. package/python-runtime/python/lib/python3.12/site-packages/python_multipart/multipart.py +2005 -0
  1609. package/python-runtime/python/lib/python3.12/site-packages/python_multipart/py.typed +0 -0
  1610. package/python-runtime/python/lib/python3.12/site-packages/python_multipart-0.0.33.dist-info/INSTALLER +1 -0
  1611. package/python-runtime/python/lib/python3.12/site-packages/python_multipart-0.0.33.dist-info/METADATA +179 -0
  1612. package/python-runtime/python/lib/python3.12/site-packages/python_multipart-0.0.33.dist-info/RECORD +22 -0
  1613. package/python-runtime/python/lib/python3.12/site-packages/python_multipart-0.0.33.dist-info/WHEEL +4 -0
  1614. package/python-runtime/python/lib/python3.12/site-packages/referencing/__init__.py +7 -0
  1615. package/python-runtime/python/lib/python3.12/site-packages/referencing/_attrs.py +31 -0
  1616. package/python-runtime/python/lib/python3.12/site-packages/referencing/_attrs.pyi +21 -0
  1617. package/python-runtime/python/lib/python3.12/site-packages/referencing/_core.py +739 -0
  1618. package/python-runtime/python/lib/python3.12/site-packages/referencing/exceptions.py +165 -0
  1619. package/python-runtime/python/lib/python3.12/site-packages/referencing/jsonschema.py +642 -0
  1620. package/python-runtime/python/lib/python3.12/site-packages/referencing/py.typed +0 -0
  1621. package/python-runtime/python/lib/python3.12/site-packages/referencing/retrieval.py +94 -0
  1622. package/python-runtime/python/lib/python3.12/site-packages/referencing/typing.py +61 -0
  1623. package/python-runtime/python/lib/python3.12/site-packages/referencing-0.37.0.dist-info/INSTALLER +1 -0
  1624. package/python-runtime/python/lib/python3.12/site-packages/referencing-0.37.0.dist-info/METADATA +64 -0
  1625. package/python-runtime/python/lib/python3.12/site-packages/referencing-0.37.0.dist-info/RECORD +33 -0
  1626. package/python-runtime/python/lib/python3.12/site-packages/referencing-0.37.0.dist-info/WHEEL +4 -0
  1627. package/python-runtime/python/lib/python3.12/site-packages/rpds/__init__.py +5 -0
  1628. package/python-runtime/python/lib/python3.12/site-packages/rpds/__init__.pyi +79 -0
  1629. package/python-runtime/python/lib/python3.12/site-packages/rpds/py.typed +0 -0
  1630. package/python-runtime/python/lib/python3.12/site-packages/rpds/rpds.cpython-312-darwin.so +0 -0
  1631. package/python-runtime/python/lib/python3.12/site-packages/rpds_py-2026.9.1.dist-info/INSTALLER +1 -0
  1632. package/python-runtime/python/lib/python3.12/site-packages/rpds_py-2026.9.1.dist-info/METADATA +99 -0
  1633. package/python-runtime/python/lib/python3.12/site-packages/rpds_py-2026.9.1.dist-info/RECORD +11 -0
  1634. package/python-runtime/python/lib/python3.12/site-packages/rpds_py-2026.9.1.dist-info/WHEEL +4 -0
  1635. package/python-runtime/python/lib/python3.12/site-packages/socksio/__init__.py +46 -0
  1636. package/python-runtime/python/lib/python3.12/site-packages/socksio/_types.py +3 -0
  1637. package/python-runtime/python/lib/python3.12/site-packages/socksio/compat.py +86 -0
  1638. package/python-runtime/python/lib/python3.12/site-packages/socksio/exceptions.py +6 -0
  1639. package/python-runtime/python/lib/python3.12/site-packages/socksio/py.typed +0 -0
  1640. package/python-runtime/python/lib/python3.12/site-packages/socksio/socks4.py +253 -0
  1641. package/python-runtime/python/lib/python3.12/site-packages/socksio/socks5.py +399 -0
  1642. package/python-runtime/python/lib/python3.12/site-packages/socksio/utils.py +95 -0
  1643. package/python-runtime/python/lib/python3.12/site-packages/socksio-1.0.0.dist-info/INSTALLER +1 -0
  1644. package/python-runtime/python/lib/python3.12/site-packages/socksio-1.0.0.dist-info/METADATA +182 -0
  1645. package/python-runtime/python/lib/python3.12/site-packages/socksio-1.0.0.dist-info/RECORD +20 -0
  1646. package/python-runtime/python/lib/python3.12/site-packages/socksio-1.0.0.dist-info/WHEEL +4 -0
  1647. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette/__init__.py +5 -0
  1648. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette/_utils.py +36 -0
  1649. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette/event.py +96 -0
  1650. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette/py.typed +0 -0
  1651. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette/sse.py +602 -0
  1652. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette-3.7.0.dist-info/INSTALLER +1 -0
  1653. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette-3.7.0.dist-info/METADATA +493 -0
  1654. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette-3.7.0.dist-info/RECORD +16 -0
  1655. package/python-runtime/python/lib/python3.12/site-packages/sse_starlette-3.7.0.dist-info/WHEEL +5 -0
  1656. package/python-runtime/python/lib/python3.12/site-packages/starlette/__init__.py +1 -0
  1657. package/python-runtime/python/lib/python3.12/site-packages/starlette/_exception_handler.py +67 -0
  1658. package/python-runtime/python/lib/python3.12/site-packages/starlette/_utils.py +152 -0
  1659. package/python-runtime/python/lib/python3.12/site-packages/starlette/applications.py +124 -0
  1660. package/python-runtime/python/lib/python3.12/site-packages/starlette/authentication.py +157 -0
  1661. package/python-runtime/python/lib/python3.12/site-packages/starlette/background.py +36 -0
  1662. package/python-runtime/python/lib/python3.12/site-packages/starlette/concurrency.py +59 -0
  1663. package/python-runtime/python/lib/python3.12/site-packages/starlette/config.py +142 -0
  1664. package/python-runtime/python/lib/python3.12/site-packages/starlette/convertors.py +89 -0
  1665. package/python-runtime/python/lib/python3.12/site-packages/starlette/datastructures.py +717 -0
  1666. package/python-runtime/python/lib/python3.12/site-packages/starlette/endpoints.py +128 -0
  1667. package/python-runtime/python/lib/python3.12/site-packages/starlette/exceptions.py +43 -0
  1668. package/python-runtime/python/lib/python3.12/site-packages/starlette/formparsers.py +289 -0
  1669. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/__init__.py +37 -0
  1670. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/authentication.py +52 -0
  1671. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/base.py +254 -0
  1672. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/body_limit.py +132 -0
  1673. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/cors.py +177 -0
  1674. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/errors.py +259 -0
  1675. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/exceptions.py +73 -0
  1676. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/gzip.py +230 -0
  1677. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/httpsredirect.py +22 -0
  1678. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/opentelemetry.py +126 -0
  1679. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/sessions.py +139 -0
  1680. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/trustedhost.py +66 -0
  1681. package/python-runtime/python/lib/python3.12/site-packages/starlette/middleware/wsgi.py +157 -0
  1682. package/python-runtime/python/lib/python3.12/site-packages/starlette/py.typed +0 -0
  1683. package/python-runtime/python/lib/python3.12/site-packages/starlette/requests.py +357 -0
  1684. package/python-runtime/python/lib/python3.12/site-packages/starlette/responses.py +616 -0
  1685. package/python-runtime/python/lib/python3.12/site-packages/starlette/routing.py +772 -0
  1686. package/python-runtime/python/lib/python3.12/site-packages/starlette/schemas.py +152 -0
  1687. package/python-runtime/python/lib/python3.12/site-packages/starlette/staticfiles.py +231 -0
  1688. package/python-runtime/python/lib/python3.12/site-packages/starlette/status.py +211 -0
  1689. package/python-runtime/python/lib/python3.12/site-packages/starlette/templating.py +156 -0
  1690. package/python-runtime/python/lib/python3.12/site-packages/starlette/testclient.py +624 -0
  1691. package/python-runtime/python/lib/python3.12/site-packages/starlette/types.py +26 -0
  1692. package/python-runtime/python/lib/python3.12/site-packages/starlette/websockets.py +202 -0
  1693. package/python-runtime/python/lib/python3.12/site-packages/starlette-1.10.0.dist-info/INSTALLER +1 -0
  1694. package/python-runtime/python/lib/python3.12/site-packages/starlette-1.10.0.dist-info/METADATA +181 -0
  1695. package/python-runtime/python/lib/python3.12/site-packages/starlette-1.10.0.dist-info/RECORD +78 -0
  1696. package/python-runtime/python/lib/python3.12/site-packages/starlette-1.10.0.dist-info/WHEEL +4 -0
  1697. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/__init__.py +49 -0
  1698. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/budget.py +70 -0
  1699. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/completion.py +13 -0
  1700. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/generated.py +250 -0
  1701. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/policy.py +35 -0
  1702. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/retry.py +21 -0
  1703. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/safety.py +170 -0
  1704. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness/tracing.py +138 -0
  1705. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness-0.9.1.dist-info/INSTALLER +1 -0
  1706. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness-0.9.1.dist-info/METADATA +13 -0
  1707. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness-0.9.1.dist-info/RECORD +23 -0
  1708. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_harness-0.9.1.dist-info/WHEEL +5 -0
  1709. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_protocol/__init__.py +1 -0
  1710. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_protocol/generated.py +250 -0
  1711. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_protocol-0.9.1.dist-info/INSTALLER +1 -0
  1712. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_protocol-0.9.1.dist-info/METADATA +12 -0
  1713. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_protocol-0.9.1.dist-info/RECORD +11 -0
  1714. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_protocol-0.9.1.dist-info/WHEEL +5 -0
  1715. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/__init__.py +529 -0
  1716. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/antihallucination.py +644 -0
  1717. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/approval.py +730 -0
  1718. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/approval_policy.py +243 -0
  1719. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/ask_user.py +324 -0
  1720. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/branch.py +419 -0
  1721. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/cache_control.py +254 -0
  1722. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/calibration.py +318 -0
  1723. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/compaction.py +737 -0
  1724. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/compaction_policy.py +97 -0
  1725. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/config.py +225 -0
  1726. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/default.harness.json +32 -0
  1727. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/default.harness.yaml +38 -0
  1728. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/delegation_gate.py +100 -0
  1729. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/errors.py +58 -0
  1730. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/gateway_catalog.py +397 -0
  1731. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/handoff.py +147 -0
  1732. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/harness.py +922 -0
  1733. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/harness_spec.py +339 -0
  1734. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/history.py +962 -0
  1735. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/hooks.py +541 -0
  1736. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/__init__.py +204 -0
  1737. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/anthropic_native.py +392 -0
  1738. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/compat.py +316 -0
  1739. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/errors.py +207 -0
  1740. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/google_genai.py +454 -0
  1741. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/openai_compat.py +769 -0
  1742. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/openai_responses.py +554 -0
  1743. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/parts.py +69 -0
  1744. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/presets.py +259 -0
  1745. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/llm/system_proxy.py +309 -0
  1746. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/loop.py +1040 -0
  1747. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/maintenance.py +238 -0
  1748. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/mcp.py +673 -0
  1749. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/mcp_server.py +319 -0
  1750. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/model_catalog.py +7742 -0
  1751. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/model_info.py +472 -0
  1752. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/model_resolve.py +271 -0
  1753. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/native_bridge.py +1034 -0
  1754. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/observation_aging.py +196 -0
  1755. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/orchestration.py +462 -0
  1756. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/otel.py +384 -0
  1757. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/plugins.py +487 -0
  1758. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/pool.py +438 -0
  1759. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/pricing.py +88 -0
  1760. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/pseudo.py +713 -0
  1761. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/recording.py +454 -0
  1762. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/reminders.py +339 -0
  1763. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/replay.py +222 -0
  1764. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/resume.py +343 -0
  1765. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/retry.py +163 -0
  1766. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/sandboxed.py +201 -0
  1767. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/skills.py +730 -0
  1768. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/spill.py +127 -0
  1769. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/storage/__init__.py +138 -0
  1770. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/storage/in_memory.py +215 -0
  1771. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/storage/sqlalchemy_store.py +472 -0
  1772. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/storage/sqlite_store.py +497 -0
  1773. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/storage/write_lease.py +173 -0
  1774. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/subagent.py +564 -0
  1775. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/todo.py +348 -0
  1776. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/tokens.py +162 -0
  1777. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/tool_presentation.py +132 -0
  1778. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/tool_schema.py +124 -0
  1779. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/tool_search.py +177 -0
  1780. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/tools.py +457 -0
  1781. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/tracing.py +285 -0
  1782. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/transport/__init__.py +39 -0
  1783. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/transport/fastapi_sse.py +116 -0
  1784. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/transport/stdio_jsonrpc.py +431 -0
  1785. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime/world_state.py +345 -0
  1786. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime-0.9.1.dist-info/INSTALLER +1 -0
  1787. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime-0.9.1.dist-info/METADATA +72 -0
  1788. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime-0.9.1.dist-info/RECORD +147 -0
  1789. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime-0.9.1.dist-info/WHEEL +5 -0
  1790. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime_native/__init__.py +5 -0
  1791. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime_native/steerable_agent_runtime_native.abi3.so +0 -0
  1792. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime_native-1.0.7.dist-info/INSTALLER +1 -0
  1793. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime_native-1.0.7.dist-info/METADATA +7 -0
  1794. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime_native-1.0.7.dist-info/RECORD +9 -0
  1795. package/python-runtime/python/lib/python3.12/site-packages/steerable_agent_runtime_native-1.0.7.dist-info/WHEEL +4 -0
  1796. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/__init__.py +28 -0
  1797. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/__main__.py +119 -0
  1798. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/_version.py +14 -0
  1799. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/acp_adapter.py +890 -0
  1800. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/acp_fs.py +64 -0
  1801. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/acp_terminal.py +147 -0
  1802. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/ag_ui.py +223 -0
  1803. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/delivery.py +2933 -0
  1804. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/display.py +308 -0
  1805. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/egress_ask.py +183 -0
  1806. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/file_edit.py +251 -0
  1807. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/headless.py +760 -0
  1808. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/host_spawn.py +137 -0
  1809. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/host_tools.py +255 -0
  1810. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/jpeg_ascii.py +314 -0
  1811. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/landlock.py +353 -0
  1812. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/landlock_run.py +35 -0
  1813. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/loop_limits.py +85 -0
  1814. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/multi_file_edit.py +109 -0
  1815. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/png_ascii.py +294 -0
  1816. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/ptc_js.py +986 -0
  1817. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/ptc_js_worker.cjs +579 -0
  1818. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/run_code.py +634 -0
  1819. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/run_code_driver.py +229 -0
  1820. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/sandbox.py +771 -0
  1821. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/search_tools.py +173 -0
  1822. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/shell_session.py +301 -0
  1823. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/sidecar.py +3785 -0
  1824. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/stream_chunks.py +115 -0
  1825. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/todo_tools.py +49 -0
  1826. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/tool_contract.json +352 -0
  1827. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/tool_contract.py +62 -0
  1828. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/web_tools.py +1375 -0
  1829. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/workspace_fs.py +71 -0
  1830. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar/workspace_tools.py +1472 -0
  1831. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar-0.9.1.dist-info/INSTALLER +1 -0
  1832. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar-0.9.1.dist-info/METADATA +58 -0
  1833. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar-0.9.1.dist-info/RECORD +79 -0
  1834. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar-0.9.1.dist-info/WHEEL +5 -0
  1835. package/python-runtime/python/lib/python3.12/site-packages/steerable_sidecar-0.9.1.dist-info/entry_points.txt +4 -0
  1836. package/python-runtime/python/lib/python3.12/site-packages/typing_extensions-4.16.0.dist-info/INSTALLER +1 -0
  1837. package/python-runtime/python/lib/python3.12/site-packages/typing_extensions-4.16.0.dist-info/METADATA +73 -0
  1838. package/python-runtime/python/lib/python3.12/site-packages/typing_extensions-4.16.0.dist-info/RECORD +7 -0
  1839. package/python-runtime/python/lib/python3.12/site-packages/typing_extensions-4.16.0.dist-info/WHEEL +4 -0
  1840. package/python-runtime/python/lib/python3.12/site-packages/typing_extensions.py +4422 -0
  1841. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection/__init__.py +0 -0
  1842. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection/introspection.py +604 -0
  1843. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection/py.typed +0 -0
  1844. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection/typing_objects.py +620 -0
  1845. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection/typing_objects.pyi +421 -0
  1846. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection-0.4.5.dist-info/INSTALLER +1 -0
  1847. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection-0.4.5.dist-info/METADATA +49 -0
  1848. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection-0.4.5.dist-info/RECORD +13 -0
  1849. package/python-runtime/python/lib/python3.12/site-packages/typing_inspection-0.4.5.dist-info/WHEEL +4 -0
  1850. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/__init__.py +5 -0
  1851. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/__main__.py +4 -0
  1852. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/_ansi.py +29 -0
  1853. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/_compat.py +91 -0
  1854. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/_subprocess.py +84 -0
  1855. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/_types.py +280 -0
  1856. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/config.py +618 -0
  1857. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/importer.py +34 -0
  1858. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/lifespan/__init__.py +0 -0
  1859. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/lifespan/off.py +17 -0
  1860. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/lifespan/on.py +137 -0
  1861. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/logging.py +117 -0
  1862. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/loops/__init__.py +0 -0
  1863. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/loops/asyncio.py +11 -0
  1864. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/loops/auto.py +17 -0
  1865. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/loops/uvloop.py +10 -0
  1866. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/loops/zuvloop.py +10 -0
  1867. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/main.py +656 -0
  1868. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/middleware/__init__.py +0 -0
  1869. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/middleware/asgi2.py +15 -0
  1870. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/middleware/message_logger.py +87 -0
  1871. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py +187 -0
  1872. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/middleware/wsgi.py +199 -0
  1873. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/__init__.py +0 -0
  1874. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/__init__.py +0 -0
  1875. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/auto.py +15 -0
  1876. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/auto_zttp_impl.py +89 -0
  1877. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/flow_control.py +54 -0
  1878. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py +540 -0
  1879. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py +581 -0
  1880. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/zttp_h2_impl.py +559 -0
  1881. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/http/zttp_impl.py +537 -0
  1882. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/utils.py +62 -0
  1883. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/websockets/__init__.py +0 -0
  1884. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/websockets/auto.py +21 -0
  1885. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py +390 -0
  1886. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_sansio_impl.py +556 -0
  1887. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/protocols/websockets/wsproto_impl.py +500 -0
  1888. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/py.typed +1 -0
  1889. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/server.py +356 -0
  1890. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/supervisors/__init__.py +16 -0
  1891. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/supervisors/basereload.py +124 -0
  1892. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/supervisors/multiprocess.py +282 -0
  1893. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/supervisors/statreload.py +52 -0
  1894. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/supervisors/watchfilesreload.py +86 -0
  1895. package/python-runtime/python/lib/python3.12/site-packages/uvicorn/workers.py +111 -0
  1896. package/python-runtime/python/lib/python3.12/site-packages/uvicorn-0.54.0.dist-info/INSTALLER +1 -0
  1897. package/python-runtime/python/lib/python3.12/site-packages/uvicorn-0.54.0.dist-info/METADATA +189 -0
  1898. package/python-runtime/python/lib/python3.12/site-packages/uvicorn-0.54.0.dist-info/RECORD +98 -0
  1899. package/python-runtime/python/lib/python3.12/site-packages/uvicorn-0.54.0.dist-info/WHEEL +4 -0
  1900. package/python-runtime/python/lib/python3.12/site-packages/uvicorn-0.54.0.dist-info/entry_points.txt +2 -0
  1901. package/python-runtime/python/lib/python3.12/site.py +693 -0
  1902. package/python-runtime/python/lib/python3.12/smtplib.py +1109 -0
  1903. package/python-runtime/python/lib/python3.12/sndhdr.py +271 -0
  1904. package/python-runtime/python/lib/python3.12/socket.py +983 -0
  1905. package/python-runtime/python/lib/python3.12/socketserver.py +863 -0
  1906. package/python-runtime/python/lib/python3.12/sqlite3/__init__.py +70 -0
  1907. package/python-runtime/python/lib/python3.12/sqlite3/__main__.py +127 -0
  1908. package/python-runtime/python/lib/python3.12/sqlite3/dbapi2.py +108 -0
  1909. package/python-runtime/python/lib/python3.12/sqlite3/dump.py +89 -0
  1910. package/python-runtime/python/lib/python3.12/sre_compile.py +7 -0
  1911. package/python-runtime/python/lib/python3.12/sre_constants.py +7 -0
  1912. package/python-runtime/python/lib/python3.12/sre_parse.py +7 -0
  1913. package/python-runtime/python/lib/python3.12/ssl.py +1488 -0
  1914. package/python-runtime/python/lib/python3.12/stat.py +195 -0
  1915. package/python-runtime/python/lib/python3.12/statistics.py +1454 -0
  1916. package/python-runtime/python/lib/python3.12/string.py +309 -0
  1917. package/python-runtime/python/lib/python3.12/stringprep.py +272 -0
  1918. package/python-runtime/python/lib/python3.12/struct.py +15 -0
  1919. package/python-runtime/python/lib/python3.12/subprocess.py +2216 -0
  1920. package/python-runtime/python/lib/python3.12/sunau.py +533 -0
  1921. package/python-runtime/python/lib/python3.12/symtable.py +362 -0
  1922. package/python-runtime/python/lib/python3.12/sysconfig.py +894 -0
  1923. package/python-runtime/python/lib/python3.12/tabnanny.py +340 -0
  1924. package/python-runtime/python/lib/python3.12/tarfile.py +3031 -0
  1925. package/python-runtime/python/lib/python3.12/telnetlib.py +680 -0
  1926. package/python-runtime/python/lib/python3.12/tempfile.py +956 -0
  1927. package/python-runtime/python/lib/python3.12/textwrap.py +491 -0
  1928. package/python-runtime/python/lib/python3.12/this.py +28 -0
  1929. package/python-runtime/python/lib/python3.12/threading.py +1708 -0
  1930. package/python-runtime/python/lib/python3.12/timeit.py +381 -0
  1931. package/python-runtime/python/lib/python3.12/token.py +143 -0
  1932. package/python-runtime/python/lib/python3.12/tokenize.py +594 -0
  1933. package/python-runtime/python/lib/python3.12/tomllib/__init__.py +10 -0
  1934. package/python-runtime/python/lib/python3.12/tomllib/_parser.py +691 -0
  1935. package/python-runtime/python/lib/python3.12/tomllib/_re.py +107 -0
  1936. package/python-runtime/python/lib/python3.12/tomllib/_types.py +10 -0
  1937. package/python-runtime/python/lib/python3.12/trace.py +748 -0
  1938. package/python-runtime/python/lib/python3.12/traceback.py +1187 -0
  1939. package/python-runtime/python/lib/python3.12/tracemalloc.py +560 -0
  1940. package/python-runtime/python/lib/python3.12/tty.py +73 -0
  1941. package/python-runtime/python/lib/python3.12/turtle.py +4207 -0
  1942. package/python-runtime/python/lib/python3.12/types.py +333 -0
  1943. package/python-runtime/python/lib/python3.12/typing.py +3494 -0
  1944. package/python-runtime/python/lib/python3.12/unittest/__init__.py +85 -0
  1945. package/python-runtime/python/lib/python3.12/unittest/__main__.py +18 -0
  1946. package/python-runtime/python/lib/python3.12/unittest/_log.py +86 -0
  1947. package/python-runtime/python/lib/python3.12/unittest/async_case.py +143 -0
  1948. package/python-runtime/python/lib/python3.12/unittest/case.py +1456 -0
  1949. package/python-runtime/python/lib/python3.12/unittest/loader.py +497 -0
  1950. package/python-runtime/python/lib/python3.12/unittest/main.py +291 -0
  1951. package/python-runtime/python/lib/python3.12/unittest/mock.py +3054 -0
  1952. package/python-runtime/python/lib/python3.12/unittest/result.py +256 -0
  1953. package/python-runtime/python/lib/python3.12/unittest/runner.py +292 -0
  1954. package/python-runtime/python/lib/python3.12/unittest/signals.py +71 -0
  1955. package/python-runtime/python/lib/python3.12/unittest/suite.py +379 -0
  1956. package/python-runtime/python/lib/python3.12/unittest/util.py +170 -0
  1957. package/python-runtime/python/lib/python3.12/urllib/__init__.py +0 -0
  1958. package/python-runtime/python/lib/python3.12/urllib/error.py +74 -0
  1959. package/python-runtime/python/lib/python3.12/urllib/parse.py +1262 -0
  1960. package/python-runtime/python/lib/python3.12/urllib/request.py +2816 -0
  1961. package/python-runtime/python/lib/python3.12/urllib/response.py +84 -0
  1962. package/python-runtime/python/lib/python3.12/urllib/robotparser.py +275 -0
  1963. package/python-runtime/python/lib/python3.12/uu.py +216 -0
  1964. package/python-runtime/python/lib/python3.12/uuid.py +793 -0
  1965. package/python-runtime/python/lib/python3.12/warnings.py +598 -0
  1966. package/python-runtime/python/lib/python3.12/wave.py +653 -0
  1967. package/python-runtime/python/lib/python3.12/weakref.py +674 -0
  1968. package/python-runtime/python/lib/python3.12/webbrowser.py +689 -0
  1969. package/python-runtime/python/lib/python3.12/xdrlib.py +242 -0
  1970. package/python-runtime/python/lib/python3.12/xml/__init__.py +20 -0
  1971. package/python-runtime/python/lib/python3.12/xml/dom/NodeFilter.py +27 -0
  1972. package/python-runtime/python/lib/python3.12/xml/dom/__init__.py +140 -0
  1973. package/python-runtime/python/lib/python3.12/xml/dom/domreg.py +99 -0
  1974. package/python-runtime/python/lib/python3.12/xml/dom/expatbuilder.py +962 -0
  1975. package/python-runtime/python/lib/python3.12/xml/dom/minicompat.py +109 -0
  1976. package/python-runtime/python/lib/python3.12/xml/dom/minidom.py +2008 -0
  1977. package/python-runtime/python/lib/python3.12/xml/dom/pulldom.py +336 -0
  1978. package/python-runtime/python/lib/python3.12/xml/dom/xmlbuilder.py +389 -0
  1979. package/python-runtime/python/lib/python3.12/xml/etree/ElementInclude.py +186 -0
  1980. package/python-runtime/python/lib/python3.12/xml/etree/ElementPath.py +423 -0
  1981. package/python-runtime/python/lib/python3.12/xml/etree/ElementTree.py +2085 -0
  1982. package/python-runtime/python/lib/python3.12/xml/etree/__init__.py +33 -0
  1983. package/python-runtime/python/lib/python3.12/xml/etree/cElementTree.py +3 -0
  1984. package/python-runtime/python/lib/python3.12/xml/parsers/__init__.py +8 -0
  1985. package/python-runtime/python/lib/python3.12/xml/parsers/expat.py +8 -0
  1986. package/python-runtime/python/lib/python3.12/xml/sax/__init__.py +94 -0
  1987. package/python-runtime/python/lib/python3.12/xml/sax/_exceptions.py +127 -0
  1988. package/python-runtime/python/lib/python3.12/xml/sax/expatreader.py +454 -0
  1989. package/python-runtime/python/lib/python3.12/xml/sax/handler.py +387 -0
  1990. package/python-runtime/python/lib/python3.12/xml/sax/saxutils.py +369 -0
  1991. package/python-runtime/python/lib/python3.12/xml/sax/xmlreader.py +378 -0
  1992. package/python-runtime/python/lib/python3.12/zipapp.py +206 -0
  1993. package/python-runtime/python/lib/python3.12/zipfile/__init__.py +2340 -0
  1994. package/python-runtime/python/lib/python3.12/zipfile/__main__.py +4 -0
  1995. package/python-runtime/python/lib/python3.12/zipfile/_path/__init__.py +412 -0
  1996. package/python-runtime/python/lib/python3.12/zipfile/_path/glob.py +53 -0
  1997. package/python-runtime/python/lib/python3.12/zipimport.py +712 -0
  1998. package/python-runtime/python/lib/python3.12/zoneinfo/__init__.py +31 -0
  1999. package/python-runtime/python/lib/python3.12/zoneinfo/_common.py +164 -0
  2000. package/python-runtime/python/lib/python3.12/zoneinfo/_tzpath.py +181 -0
  2001. package/python-runtime/python/lib/python3.12/zoneinfo/_zoneinfo.py +772 -0
  2002. package/python-runtime/python/lib/tcl9/9.0/http-2.10.1.tm +5475 -0
  2003. package/python-runtime/python/lib/tcl9/9.0/msgcat-1.7.1.tm +1349 -0
  2004. package/python-runtime/python/lib/tcl9/9.0/platform/shell-1.1.4.tm +241 -0
  2005. package/python-runtime/python/lib/tcl9/9.0/platform-1.1.0.tm +443 -0
  2006. package/python-runtime/python/lib/tcl9/9.0/tcltest-2.5.10.tm +3588 -0
  2007. package/python-runtime/python/lib/tcl9.0/auto.tcl +711 -0
  2008. package/python-runtime/python/lib/tcl9.0/clock.tcl +2110 -0
  2009. package/python-runtime/python/lib/tcl9.0/cookiejar0.2/cookiejar.tcl +746 -0
  2010. package/python-runtime/python/lib/tcl9.0/cookiejar0.2/idna.tcl +292 -0
  2011. package/python-runtime/python/lib/tcl9.0/cookiejar0.2/pkgIndex.tcl +3 -0
  2012. package/python-runtime/python/lib/tcl9.0/cookiejar0.2/public_suffix_list.dat.gz +0 -0
  2013. package/python-runtime/python/lib/tcl9.0/encoding/ascii.enc +20 -0
  2014. package/python-runtime/python/lib/tcl9.0/encoding/big5.enc +1516 -0
  2015. package/python-runtime/python/lib/tcl9.0/encoding/cns11643.enc +1584 -0
  2016. package/python-runtime/python/lib/tcl9.0/encoding/cp1250.enc +20 -0
  2017. package/python-runtime/python/lib/tcl9.0/encoding/cp1251.enc +20 -0
  2018. package/python-runtime/python/lib/tcl9.0/encoding/cp1252.enc +20 -0
  2019. package/python-runtime/python/lib/tcl9.0/encoding/cp1253.enc +20 -0
  2020. package/python-runtime/python/lib/tcl9.0/encoding/cp1254.enc +20 -0
  2021. package/python-runtime/python/lib/tcl9.0/encoding/cp1255.enc +20 -0
  2022. package/python-runtime/python/lib/tcl9.0/encoding/cp1256.enc +20 -0
  2023. package/python-runtime/python/lib/tcl9.0/encoding/cp1257.enc +20 -0
  2024. package/python-runtime/python/lib/tcl9.0/encoding/cp1258.enc +20 -0
  2025. package/python-runtime/python/lib/tcl9.0/encoding/cp165.enc +20 -0
  2026. package/python-runtime/python/lib/tcl9.0/encoding/cp437.enc +20 -0
  2027. package/python-runtime/python/lib/tcl9.0/encoding/cp737.enc +20 -0
  2028. package/python-runtime/python/lib/tcl9.0/encoding/cp775.enc +20 -0
  2029. package/python-runtime/python/lib/tcl9.0/encoding/cp850.enc +20 -0
  2030. package/python-runtime/python/lib/tcl9.0/encoding/cp852.enc +20 -0
  2031. package/python-runtime/python/lib/tcl9.0/encoding/cp855.enc +20 -0
  2032. package/python-runtime/python/lib/tcl9.0/encoding/cp857.enc +20 -0
  2033. package/python-runtime/python/lib/tcl9.0/encoding/cp860.enc +20 -0
  2034. package/python-runtime/python/lib/tcl9.0/encoding/cp861.enc +20 -0
  2035. package/python-runtime/python/lib/tcl9.0/encoding/cp862.enc +20 -0
  2036. package/python-runtime/python/lib/tcl9.0/encoding/cp863.enc +20 -0
  2037. package/python-runtime/python/lib/tcl9.0/encoding/cp864.enc +20 -0
  2038. package/python-runtime/python/lib/tcl9.0/encoding/cp865.enc +20 -0
  2039. package/python-runtime/python/lib/tcl9.0/encoding/cp866.enc +20 -0
  2040. package/python-runtime/python/lib/tcl9.0/encoding/cp869.enc +20 -0
  2041. package/python-runtime/python/lib/tcl9.0/encoding/cp874.enc +20 -0
  2042. package/python-runtime/python/lib/tcl9.0/encoding/cp932.enc +801 -0
  2043. package/python-runtime/python/lib/tcl9.0/encoding/cp936.enc +2162 -0
  2044. package/python-runtime/python/lib/tcl9.0/encoding/cp949.enc +2128 -0
  2045. package/python-runtime/python/lib/tcl9.0/encoding/cp950.enc +1499 -0
  2046. package/python-runtime/python/lib/tcl9.0/encoding/dingbats.enc +20 -0
  2047. package/python-runtime/python/lib/tcl9.0/encoding/ebcdic.enc +20 -0
  2048. package/python-runtime/python/lib/tcl9.0/encoding/euc-cn.enc +1397 -0
  2049. package/python-runtime/python/lib/tcl9.0/encoding/euc-jp.enc +1353 -0
  2050. package/python-runtime/python/lib/tcl9.0/encoding/euc-kr.enc +1533 -0
  2051. package/python-runtime/python/lib/tcl9.0/encoding/gb12345.enc +1414 -0
  2052. package/python-runtime/python/lib/tcl9.0/encoding/gb1988.enc +20 -0
  2053. package/python-runtime/python/lib/tcl9.0/encoding/gb2312-raw.enc +1380 -0
  2054. package/python-runtime/python/lib/tcl9.0/encoding/gb2312.enc +1397 -0
  2055. package/python-runtime/python/lib/tcl9.0/encoding/iso2022-jp.enc +12 -0
  2056. package/python-runtime/python/lib/tcl9.0/encoding/iso2022-kr.enc +7 -0
  2057. package/python-runtime/python/lib/tcl9.0/encoding/iso2022.enc +14 -0
  2058. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-1.enc +20 -0
  2059. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-10.enc +20 -0
  2060. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-11.enc +20 -0
  2061. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-13.enc +20 -0
  2062. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-14.enc +20 -0
  2063. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-15.enc +20 -0
  2064. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-16.enc +20 -0
  2065. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-2.enc +20 -0
  2066. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-3.enc +20 -0
  2067. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-4.enc +20 -0
  2068. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-5.enc +20 -0
  2069. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-6.enc +20 -0
  2070. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-7.enc +20 -0
  2071. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-8.enc +20 -0
  2072. package/python-runtime/python/lib/tcl9.0/encoding/iso8859-9.enc +20 -0
  2073. package/python-runtime/python/lib/tcl9.0/encoding/jis0201.enc +20 -0
  2074. package/python-runtime/python/lib/tcl9.0/encoding/jis0208.enc +1319 -0
  2075. package/python-runtime/python/lib/tcl9.0/encoding/jis0212.enc +1159 -0
  2076. package/python-runtime/python/lib/tcl9.0/encoding/koi8-r.enc +20 -0
  2077. package/python-runtime/python/lib/tcl9.0/encoding/koi8-ru.enc +20 -0
  2078. package/python-runtime/python/lib/tcl9.0/encoding/koi8-t.enc +20 -0
  2079. package/python-runtime/python/lib/tcl9.0/encoding/koi8-u.enc +20 -0
  2080. package/python-runtime/python/lib/tcl9.0/encoding/ksc5601.enc +1516 -0
  2081. package/python-runtime/python/lib/tcl9.0/encoding/macCentEuro.enc +20 -0
  2082. package/python-runtime/python/lib/tcl9.0/encoding/macCroatian.enc +20 -0
  2083. package/python-runtime/python/lib/tcl9.0/encoding/macCyrillic.enc +20 -0
  2084. package/python-runtime/python/lib/tcl9.0/encoding/macDingbats.enc +20 -0
  2085. package/python-runtime/python/lib/tcl9.0/encoding/macGreek.enc +20 -0
  2086. package/python-runtime/python/lib/tcl9.0/encoding/macIceland.enc +20 -0
  2087. package/python-runtime/python/lib/tcl9.0/encoding/macJapan.enc +785 -0
  2088. package/python-runtime/python/lib/tcl9.0/encoding/macRoman.enc +20 -0
  2089. package/python-runtime/python/lib/tcl9.0/encoding/macRomania.enc +20 -0
  2090. package/python-runtime/python/lib/tcl9.0/encoding/macThai.enc +20 -0
  2091. package/python-runtime/python/lib/tcl9.0/encoding/macTurkish.enc +20 -0
  2092. package/python-runtime/python/lib/tcl9.0/encoding/macUkraine.enc +20 -0
  2093. package/python-runtime/python/lib/tcl9.0/encoding/shiftjis.enc +690 -0
  2094. package/python-runtime/python/lib/tcl9.0/encoding/symbol.enc +20 -0
  2095. package/python-runtime/python/lib/tcl9.0/encoding/tis-620.enc +20 -0
  2096. package/python-runtime/python/lib/tcl9.0/foreachline.tcl +25 -0
  2097. package/python-runtime/python/lib/tcl9.0/history.tcl +335 -0
  2098. package/python-runtime/python/lib/tcl9.0/icu.tcl +145 -0
  2099. package/python-runtime/python/lib/tcl9.0/init.tcl +773 -0
  2100. package/python-runtime/python/lib/tcl9.0/install.tcl +275 -0
  2101. package/python-runtime/python/lib/tcl9.0/opt0.4/optparse.tcl +1069 -0
  2102. package/python-runtime/python/lib/tcl9.0/opt0.4/pkgIndex.tcl +12 -0
  2103. package/python-runtime/python/lib/tcl9.0/package.tcl +767 -0
  2104. package/python-runtime/python/lib/tcl9.0/parray.tcl +28 -0
  2105. package/python-runtime/python/lib/tcl9.0/readfile.tcl +23 -0
  2106. package/python-runtime/python/lib/tcl9.0/safe.tcl +1461 -0
  2107. package/python-runtime/python/lib/tcl9.0/tclAppInit.c +183 -0
  2108. package/python-runtime/python/lib/tcl9.0/tclIndex +112 -0
  2109. package/python-runtime/python/lib/tcl9.0/tm.tcl +378 -0
  2110. package/python-runtime/python/lib/tcl9.0/word.tcl +155 -0
  2111. package/python-runtime/python/lib/tcl9.0/writefile.tcl +37 -0
  2112. package/python-runtime/python/lib/thread3.0.4/libtcl9thread3.0.4.dylib +0 -0
  2113. package/python-runtime/python/lib/thread3.0.4/libthread3.0.4.dylib +0 -0
  2114. package/python-runtime/python/lib/thread3.0.4/pkgIndex.tcl +52 -0
  2115. package/python-runtime/python/lib/thread3.0.4/ttrace.tcl +943 -0
  2116. package/python-runtime/python/lib/tk9.0/bgerror.tcl +282 -0
  2117. package/python-runtime/python/lib/tk9.0/button.tcl +782 -0
  2118. package/python-runtime/python/lib/tk9.0/choosedir.tcl +310 -0
  2119. package/python-runtime/python/lib/tk9.0/clrpick.tcl +696 -0
  2120. package/python-runtime/python/lib/tk9.0/comdlg.tcl +322 -0
  2121. package/python-runtime/python/lib/tk9.0/console.tcl +1148 -0
  2122. package/python-runtime/python/lib/tk9.0/dialog.tcl +175 -0
  2123. package/python-runtime/python/lib/tk9.0/entry.tcl +720 -0
  2124. package/python-runtime/python/lib/tk9.0/focus.tcl +178 -0
  2125. package/python-runtime/python/lib/tk9.0/fontchooser.tcl +512 -0
  2126. package/python-runtime/python/lib/tk9.0/iconbadges.tcl +253 -0
  2127. package/python-runtime/python/lib/tk9.0/iconlist.tcl +705 -0
  2128. package/python-runtime/python/lib/tk9.0/icons.tcl +54 -0
  2129. package/python-runtime/python/lib/tk9.0/images/README +7 -0
  2130. package/python-runtime/python/lib/tk9.0/images/logo.eps +2091 -0
  2131. package/python-runtime/python/lib/tk9.0/images/logo100.gif +0 -0
  2132. package/python-runtime/python/lib/tk9.0/images/logo64.gif +0 -0
  2133. package/python-runtime/python/lib/tk9.0/images/logoLarge.gif +0 -0
  2134. package/python-runtime/python/lib/tk9.0/images/logoMed.gif +0 -0
  2135. package/python-runtime/python/lib/tk9.0/images/pwrdLogo.eps +1897 -0
  2136. package/python-runtime/python/lib/tk9.0/images/pwrdLogo100.gif +0 -0
  2137. package/python-runtime/python/lib/tk9.0/images/pwrdLogo150.gif +0 -0
  2138. package/python-runtime/python/lib/tk9.0/images/pwrdLogo175.gif +0 -0
  2139. package/python-runtime/python/lib/tk9.0/images/pwrdLogo200.gif +0 -0
  2140. package/python-runtime/python/lib/tk9.0/images/pwrdLogo75.gif +0 -0
  2141. package/python-runtime/python/lib/tk9.0/images/tai-ku.gif +0 -0
  2142. package/python-runtime/python/lib/tk9.0/listbox.tcl +522 -0
  2143. package/python-runtime/python/lib/tk9.0/megawidget.tcl +297 -0
  2144. package/python-runtime/python/lib/tk9.0/menu.tcl +1376 -0
  2145. package/python-runtime/python/lib/tk9.0/mkpsenc.tcl +1488 -0
  2146. package/python-runtime/python/lib/tk9.0/msgbox.tcl +454 -0
  2147. package/python-runtime/python/lib/tk9.0/optMenu.tcl +43 -0
  2148. package/python-runtime/python/lib/tk9.0/palette.tcl +283 -0
  2149. package/python-runtime/python/lib/tk9.0/panedwindow.tcl +194 -0
  2150. package/python-runtime/python/lib/tk9.0/pkgIndex.tcl +3 -0
  2151. package/python-runtime/python/lib/tk9.0/print.tcl +1460 -0
  2152. package/python-runtime/python/lib/tk9.0/safetk.tcl +262 -0
  2153. package/python-runtime/python/lib/tk9.0/scale.tcl +299 -0
  2154. package/python-runtime/python/lib/tk9.0/scaling.tcl +232 -0
  2155. package/python-runtime/python/lib/tk9.0/scrlbar.tcl +500 -0
  2156. package/python-runtime/python/lib/tk9.0/spinbox.tcl +580 -0
  2157. package/python-runtime/python/lib/tk9.0/systray.tcl +483 -0
  2158. package/python-runtime/python/lib/tk9.0/tclIndex +252 -0
  2159. package/python-runtime/python/lib/tk9.0/tearoff.tcl +155 -0
  2160. package/python-runtime/python/lib/tk9.0/text.tcl +1295 -0
  2161. package/python-runtime/python/lib/tk9.0/tk.tcl +853 -0
  2162. package/python-runtime/python/lib/tk9.0/tkAppInit.c +200 -0
  2163. package/python-runtime/python/lib/tk9.0/tkfbox.tcl +1251 -0
  2164. package/python-runtime/python/lib/tk9.0/ttk/altTheme.tcl +153 -0
  2165. package/python-runtime/python/lib/tk9.0/ttk/aquaTheme.tcl +178 -0
  2166. package/python-runtime/python/lib/tk9.0/ttk/button.tcl +83 -0
  2167. package/python-runtime/python/lib/tk9.0/ttk/clamTheme.tcl +196 -0
  2168. package/python-runtime/python/lib/tk9.0/ttk/classicTheme.tcl +145 -0
  2169. package/python-runtime/python/lib/tk9.0/ttk/combobox.tcl +555 -0
  2170. package/python-runtime/python/lib/tk9.0/ttk/cursors.tcl +205 -0
  2171. package/python-runtime/python/lib/tk9.0/ttk/defaults.tcl +231 -0
  2172. package/python-runtime/python/lib/tk9.0/ttk/entry.tcl +678 -0
  2173. package/python-runtime/python/lib/tk9.0/ttk/fonts.tcl +152 -0
  2174. package/python-runtime/python/lib/tk9.0/ttk/menubutton.tcl +237 -0
  2175. package/python-runtime/python/lib/tk9.0/ttk/notebook.tcl +255 -0
  2176. package/python-runtime/python/lib/tk9.0/ttk/panedwindow.tcl +89 -0
  2177. package/python-runtime/python/lib/tk9.0/ttk/progress.tcl +55 -0
  2178. package/python-runtime/python/lib/tk9.0/ttk/scale.tcl +94 -0
  2179. package/python-runtime/python/lib/tk9.0/ttk/scrollbar.tcl +119 -0
  2180. package/python-runtime/python/lib/tk9.0/ttk/sizegrip.tcl +102 -0
  2181. package/python-runtime/python/lib/tk9.0/ttk/spinbox.tcl +204 -0
  2182. package/python-runtime/python/lib/tk9.0/ttk/treeview.tcl +464 -0
  2183. package/python-runtime/python/lib/tk9.0/ttk/ttk.tcl +223 -0
  2184. package/python-runtime/python/lib/tk9.0/ttk/utils.tcl +317 -0
  2185. package/python-runtime/python/lib/tk9.0/ttk/vistaTheme.tcl +259 -0
  2186. package/python-runtime/python/lib/tk9.0/ttk/winTheme.tcl +119 -0
  2187. package/python-runtime/python/lib/tk9.0/ttk/xpTheme.tcl +95 -0
  2188. package/python-runtime/python/lib/tk9.0/xmfbox.tcl +982 -0
  2189. package/python-runtime/python/share/man/man1/python3.1 +630 -0
  2190. package/python-runtime/python/share/man/man1/python3.12.1 +630 -0
  2191. package/runtime.json +8768 -0
  2192. package/README.md +0 -3
@@ -0,0 +1,4390 @@
1
+ #
2
+ # The Python Imaging Library.
3
+ # $Id$
4
+ #
5
+ # the Image class wrapper
6
+ #
7
+ # partial release history:
8
+ # 1995-09-09 fl Created
9
+ # 1996-03-11 fl PIL release 0.0 (proof of concept)
10
+ # 1996-04-30 fl PIL release 0.1b1
11
+ # 1999-07-28 fl PIL release 1.0 final
12
+ # 2000-06-07 fl PIL release 1.1
13
+ # 2000-10-20 fl PIL release 1.1.1
14
+ # 2001-05-07 fl PIL release 1.1.2
15
+ # 2002-03-15 fl PIL release 1.1.3
16
+ # 2003-05-10 fl PIL release 1.1.4
17
+ # 2005-03-28 fl PIL release 1.1.5
18
+ # 2006-12-02 fl PIL release 1.1.6
19
+ # 2009-11-15 fl PIL release 1.1.7
20
+ #
21
+ # Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved.
22
+ # Copyright (c) 1995-2009 by Fredrik Lundh.
23
+ #
24
+ # See the README file for information on usage and redistribution.
25
+ #
26
+
27
+ from __future__ import annotations
28
+
29
+ __lazy_modules__ = {
30
+ "PIL._binary",
31
+ "PIL._deprecate",
32
+ "PIL._util",
33
+ "io",
34
+ "math",
35
+ "re",
36
+ "struct",
37
+ }
38
+
39
+ import abc
40
+ import atexit
41
+ import builtins
42
+ import io
43
+ import math
44
+ import os
45
+ import re
46
+ import struct
47
+ import sys
48
+ import warnings
49
+ from collections.abc import MutableMapping
50
+ from enum import IntEnum
51
+ from typing import IO, Protocol, cast
52
+
53
+ # VERSION was removed in Pillow 6.0.0.
54
+ # PILLOW_VERSION was removed in Pillow 9.0.0.
55
+ # Use __version__ instead.
56
+ from . import (
57
+ ExifTags,
58
+ ImageMode,
59
+ TiffTags,
60
+ UnidentifiedImageError,
61
+ __version__,
62
+ _plugins,
63
+ )
64
+ from ._binary import i32le, o32be, o32le
65
+ from ._deprecate import deprecate
66
+ from ._util import DeferredError, is_path
67
+
68
+ TYPE_CHECKING = False
69
+ if TYPE_CHECKING:
70
+ from collections.abc import Callable, Iterator, Sequence
71
+ from typing import Any, Literal, Self
72
+
73
+
74
+ class DecompressionBombWarning(RuntimeWarning):
75
+ pass
76
+
77
+
78
+ class DecompressionBombError(Exception):
79
+ pass
80
+
81
+
82
+ WARN_POSSIBLE_FORMATS: bool = False
83
+
84
+ # Limit to around a quarter gigabyte for a 24-bit (3 bpp) image
85
+ MAX_IMAGE_PIXELS: int | None = int(1024 * 1024 * 1024 // 4 // 3)
86
+
87
+
88
+ try:
89
+ # If the _imaging C module is not present, Pillow will not load.
90
+ # Note that other modules should not refer to _imaging directly;
91
+ # import Image and use the Image.core variable instead.
92
+ # Also note that Image.core is not a publicly documented interface,
93
+ # and should be considered private and subject to change.
94
+ from . import _imaging as core
95
+
96
+ if __version__ != getattr(core, "PILLOW_VERSION", None):
97
+ msg = (
98
+ "The _imaging extension was built for another version of Pillow or PIL:\n"
99
+ f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n"
100
+ f"Pillow version: {__version__}"
101
+ )
102
+ raise ImportError(msg)
103
+
104
+ except ImportError as v:
105
+ # Explanations for ways that we know we might have an import error
106
+ if str(v).startswith("Module use of python"):
107
+ # The _imaging C module is present, but not compiled for
108
+ # the right version (windows only). Print a warning, if
109
+ # possible.
110
+ warnings.warn(
111
+ "The _imaging extension was built for another version of Python.",
112
+ RuntimeWarning,
113
+ )
114
+ elif str(v).startswith("The _imaging extension"):
115
+ warnings.warn(str(v), RuntimeWarning)
116
+ # Fail here anyway. Don't let people run with a mostly broken Pillow.
117
+ # see docs/porting.rst
118
+ raise
119
+
120
+
121
+ #
122
+ # Constants
123
+
124
+
125
+ # transpose
126
+ class Transpose(IntEnum):
127
+ FLIP_LEFT_RIGHT = 0
128
+ FLIP_TOP_BOTTOM = 1
129
+ ROTATE_90 = 2
130
+ ROTATE_180 = 3
131
+ ROTATE_270 = 4
132
+ TRANSPOSE = 5
133
+ TRANSVERSE = 6
134
+
135
+
136
+ # transforms (also defined in Imaging.h)
137
+ class Transform(IntEnum):
138
+ AFFINE = 0
139
+ EXTENT = 1
140
+ PERSPECTIVE = 2
141
+ QUAD = 3
142
+ MESH = 4
143
+
144
+
145
+ # resampling filters (also defined in Imaging.h)
146
+ class Resampling(IntEnum):
147
+ NEAREST = 0
148
+ BOX = 4
149
+ BILINEAR = 2
150
+ HAMMING = 5
151
+ BICUBIC = 3
152
+ LANCZOS = 1
153
+ MKS2013 = 6
154
+ MKS2021 = 7
155
+
156
+
157
+ _filters_support = {
158
+ Resampling.BOX: 0.5,
159
+ Resampling.BILINEAR: 1.0,
160
+ Resampling.HAMMING: 1.0,
161
+ Resampling.BICUBIC: 2.0,
162
+ Resampling.LANCZOS: 3.0,
163
+ Resampling.MKS2013: 2.5,
164
+ Resampling.MKS2021: 4.5,
165
+ }
166
+
167
+
168
+ # dithers
169
+ class Dither(IntEnum):
170
+ NONE = 0
171
+ ORDERED = 1 # Not yet implemented
172
+ RASTERIZE = 2 # Not yet implemented
173
+ FLOYDSTEINBERG = 3 # default
174
+
175
+
176
+ # palettes/quantizers
177
+ class Palette(IntEnum):
178
+ WEB = 0
179
+ ADAPTIVE = 1
180
+
181
+
182
+ class Quantize(IntEnum):
183
+ MEDIANCUT = 0
184
+ MAXCOVERAGE = 1
185
+ FASTOCTREE = 2
186
+ LIBIMAGEQUANT = 3
187
+
188
+
189
+ module = sys.modules[__name__]
190
+ for enum in (Transpose, Transform, Resampling, Dither, Palette, Quantize):
191
+ for item in enum:
192
+ setattr(module, item.name, item.value)
193
+
194
+
195
+ if hasattr(core, "DEFAULT_STRATEGY"):
196
+ DEFAULT_STRATEGY = core.DEFAULT_STRATEGY
197
+ FILTERED = core.FILTERED
198
+ HUFFMAN_ONLY = core.HUFFMAN_ONLY
199
+ RLE = core.RLE
200
+ FIXED = core.FIXED
201
+
202
+
203
+ # --------------------------------------------------------------------
204
+ # Registries
205
+
206
+ TYPE_CHECKING = False
207
+ if TYPE_CHECKING:
208
+ import mmap
209
+ from xml.etree.ElementTree import Element
210
+
211
+ from IPython.lib.pretty import PrettyPrinter
212
+
213
+ from . import ImageFile, ImageFilter, ImagePalette, ImageQt, TiffImagePlugin
214
+ from ._typing import CapsuleType, NumpyArray, StrOrBytesPath
215
+ ID: list[str] = []
216
+ OPEN: dict[
217
+ str,
218
+ tuple[
219
+ Callable[[IO[bytes], str | bytes], ImageFile.ImageFile],
220
+ Callable[[bytes], bool | str] | None,
221
+ ],
222
+ ] = {}
223
+ MIME: dict[str, str] = {}
224
+ SAVE: dict[str, Callable[[Image, IO[bytes], str | bytes], None]] = {}
225
+ SAVE_ALL: dict[str, Callable[[Image, IO[bytes], str | bytes], None]] = {}
226
+ EXTENSION: dict[str, str] = {}
227
+ DECODERS: dict[str, type[ImageFile.PyDecoder]] = {}
228
+ ENCODERS: dict[str, type[ImageFile.PyEncoder]] = {}
229
+
230
+ # --------------------------------------------------------------------
231
+ # Modes
232
+
233
+ _ENDIAN = "<" if sys.byteorder == "little" else ">"
234
+
235
+
236
+ def _conv_type_shape(im: Image) -> tuple[tuple[int, ...], str]:
237
+ m = ImageMode.getmode(im.mode)
238
+ shape: tuple[int, ...] = (im.height, im.width)
239
+ extra = len(m.bands)
240
+ if extra != 1:
241
+ shape += (extra,)
242
+ return shape, m.typestr
243
+
244
+
245
+ MODES = [
246
+ "1",
247
+ "CMYK",
248
+ "F",
249
+ "HSV",
250
+ "I",
251
+ "I;16",
252
+ "I;16B",
253
+ "I;16L",
254
+ "I;16N",
255
+ "L",
256
+ "LA",
257
+ "La",
258
+ "LAB",
259
+ "P",
260
+ "PA",
261
+ "RGB",
262
+ "RGBA",
263
+ "RGBa",
264
+ "RGBX",
265
+ "YCbCr",
266
+ ]
267
+
268
+ # raw modes that may be memory mapped. NOTE: if you change this, you
269
+ # may have to modify the stride calculation in map.c too!
270
+ _MAPMODES = ("L", "P", "RGBX", "RGBA", "CMYK", "I;16", "I;16L", "I;16B")
271
+
272
+
273
+ def getmodebase(mode: str) -> str:
274
+ """
275
+ Gets the "base" mode for given mode. This function returns "L" for
276
+ images that contain grayscale data, and "RGB" for images that
277
+ contain color data.
278
+
279
+ :param mode: Input mode.
280
+ :returns: "L" or "RGB".
281
+ :exception KeyError: If the input mode was not a standard mode.
282
+ """
283
+ return ImageMode.getmode(mode).basemode
284
+
285
+
286
+ def getmodetype(mode: str) -> str:
287
+ """
288
+ Gets the storage type mode. Given a mode, this function returns a
289
+ single-layer mode suitable for storing individual bands.
290
+
291
+ :param mode: Input mode.
292
+ :returns: "L", "I", or "F".
293
+ :exception KeyError: If the input mode was not a standard mode.
294
+ """
295
+ return ImageMode.getmode(mode).basetype
296
+
297
+
298
+ def getmodebandnames(mode: str) -> tuple[str, ...]:
299
+ """
300
+ Gets a list of individual band names. Given a mode, this function returns
301
+ a tuple containing the names of individual bands (use
302
+ :py:method:`~PIL.Image.getmodetype` to get the mode used to store each
303
+ individual band.
304
+
305
+ :param mode: Input mode.
306
+ :returns: A tuple containing band names. The length of the tuple
307
+ gives the number of bands in an image of the given mode.
308
+ :exception KeyError: If the input mode was not a standard mode.
309
+ """
310
+ return ImageMode.getmode(mode).bands
311
+
312
+
313
+ def getmodebands(mode: str) -> int:
314
+ """
315
+ Gets the number of individual bands for this mode.
316
+
317
+ :param mode: Input mode.
318
+ :returns: The number of bands in this mode.
319
+ :exception KeyError: If the input mode was not a standard mode.
320
+ """
321
+ return len(ImageMode.getmode(mode).bands)
322
+
323
+
324
+ # --------------------------------------------------------------------
325
+ # Helpers
326
+
327
+ _initialized = 0
328
+
329
+ # Mapping from file extension to plugin module name for lazy importing
330
+ _EXTENSION_PLUGIN: dict[str, str] = {
331
+ # Common formats (preinit)
332
+ ".bmp": "BmpImagePlugin",
333
+ ".dib": "BmpImagePlugin",
334
+ ".gif": "GifImagePlugin",
335
+ ".jfif": "JpegImagePlugin",
336
+ ".jpe": "JpegImagePlugin",
337
+ ".jpg": "JpegImagePlugin",
338
+ ".jpeg": "JpegImagePlugin",
339
+ ".pbm": "PpmImagePlugin",
340
+ ".pgm": "PpmImagePlugin",
341
+ ".pnm": "PpmImagePlugin",
342
+ ".ppm": "PpmImagePlugin",
343
+ ".pfm": "PpmImagePlugin",
344
+ ".png": "PngImagePlugin",
345
+ ".apng": "PngImagePlugin",
346
+ # Less common formats (init)
347
+ ".avif": "AvifImagePlugin",
348
+ ".avifs": "AvifImagePlugin",
349
+ ".blp": "BlpImagePlugin",
350
+ ".bufr": "BufrStubImagePlugin",
351
+ ".cur": "CurImagePlugin",
352
+ ".dcx": "DcxImagePlugin",
353
+ ".dds": "DdsImagePlugin",
354
+ ".ps": "EpsImagePlugin",
355
+ ".eps": "EpsImagePlugin",
356
+ ".fit": "FitsImagePlugin",
357
+ ".fits": "FitsImagePlugin",
358
+ ".fli": "FliImagePlugin",
359
+ ".flc": "FliImagePlugin",
360
+ ".fpx": "FpxImagePlugin",
361
+ ".ftc": "FtexImagePlugin",
362
+ ".ftu": "FtexImagePlugin",
363
+ ".gbr": "GbrImagePlugin",
364
+ ".grib": "GribStubImagePlugin",
365
+ ".h5": "Hdf5StubImagePlugin",
366
+ ".hdf": "Hdf5StubImagePlugin",
367
+ ".icns": "IcnsImagePlugin",
368
+ ".ico": "IcoImagePlugin",
369
+ ".im": "ImImagePlugin",
370
+ ".iim": "IptcImagePlugin",
371
+ ".jp2": "Jpeg2KImagePlugin",
372
+ ".j2k": "Jpeg2KImagePlugin",
373
+ ".jpc": "Jpeg2KImagePlugin",
374
+ ".jpf": "Jpeg2KImagePlugin",
375
+ ".jpx": "Jpeg2KImagePlugin",
376
+ ".j2c": "Jpeg2KImagePlugin",
377
+ ".mic": "MicImagePlugin",
378
+ ".mpg": "MpegImagePlugin",
379
+ ".mpeg": "MpegImagePlugin",
380
+ ".mpo": "MpoImagePlugin",
381
+ ".msp": "MspImagePlugin",
382
+ ".palm": "PalmImagePlugin",
383
+ ".pcd": "PcdImagePlugin",
384
+ ".pcx": "PcxImagePlugin",
385
+ ".pdf": "PdfImagePlugin",
386
+ ".pxr": "PixarImagePlugin",
387
+ ".psd": "PsdImagePlugin",
388
+ ".qoi": "QoiImagePlugin",
389
+ ".bw": "SgiImagePlugin",
390
+ ".rgb": "SgiImagePlugin",
391
+ ".rgba": "SgiImagePlugin",
392
+ ".sgi": "SgiImagePlugin",
393
+ ".ras": "SunImagePlugin",
394
+ ".tga": "TgaImagePlugin",
395
+ ".icb": "TgaImagePlugin",
396
+ ".vda": "TgaImagePlugin",
397
+ ".vst": "TgaImagePlugin",
398
+ ".tif": "TiffImagePlugin",
399
+ ".tiff": "TiffImagePlugin",
400
+ ".webp": "WebPImagePlugin",
401
+ ".wmf": "WmfImagePlugin",
402
+ ".emf": "WmfImagePlugin",
403
+ ".xbm": "XbmImagePlugin",
404
+ ".xpm": "XpmImagePlugin",
405
+ }
406
+
407
+
408
+ def _import_plugin_for_extension(ext: str | bytes) -> bool:
409
+ """Import only the plugin needed for a specific file extension."""
410
+ if not ext:
411
+ return False
412
+
413
+ if isinstance(ext, bytes):
414
+ ext = ext.decode()
415
+ ext = ext.lower()
416
+ if ext in EXTENSION:
417
+ return True
418
+
419
+ plugin = _EXTENSION_PLUGIN.get(ext)
420
+ if plugin is None:
421
+ return False
422
+
423
+ try:
424
+ __import__(f"{__spec__.parent}.{plugin}", globals(), locals(), [])
425
+ return True
426
+ except ImportError:
427
+ return False
428
+
429
+
430
+ def preinit() -> None:
431
+ """
432
+ Explicitly loads BMP, GIF, JPEG, PPM and PNG file format drivers.
433
+
434
+ It is called when opening or saving images.
435
+ """
436
+
437
+ global _initialized
438
+ if _initialized >= 1:
439
+ return
440
+
441
+ try:
442
+ from . import BmpImagePlugin
443
+
444
+ assert BmpImagePlugin
445
+ except ImportError:
446
+ pass
447
+ try:
448
+ from . import GifImagePlugin
449
+
450
+ assert GifImagePlugin
451
+ except ImportError:
452
+ pass
453
+ try:
454
+ from . import JpegImagePlugin
455
+
456
+ assert JpegImagePlugin
457
+ except ImportError:
458
+ pass
459
+ try:
460
+ from . import PpmImagePlugin
461
+
462
+ assert PpmImagePlugin
463
+ except ImportError:
464
+ pass
465
+ try:
466
+ from . import PngImagePlugin
467
+
468
+ assert PngImagePlugin
469
+ except ImportError:
470
+ pass
471
+
472
+ _initialized = 1
473
+
474
+
475
+ def init() -> bool:
476
+ """
477
+ Explicitly initializes the Python Imaging Library. This function
478
+ loads all available file format drivers.
479
+
480
+ It is called when opening or saving images if :py:meth:`~preinit()` is
481
+ insufficient, and by :py:meth:`~PIL.features.pilinfo`.
482
+ """
483
+
484
+ global _initialized
485
+ if _initialized >= 2:
486
+ return False
487
+
488
+ for plugin in _plugins:
489
+ try:
490
+ __import__(f"{__spec__.parent}.{plugin}", globals(), locals(), [])
491
+ except ImportError:
492
+ pass
493
+
494
+ if OPEN or SAVE:
495
+ _initialized = 2
496
+ return True
497
+ return False
498
+
499
+
500
+ # --------------------------------------------------------------------
501
+ # Codec factories (used by tobytes/frombytes and ImageFile.load)
502
+
503
+
504
+ def _getdecoder(
505
+ mode: str, decoder_name: str, args: Any, extra: tuple[Any, ...] = ()
506
+ ) -> core.ImagingDecoder | ImageFile.PyDecoder:
507
+ # tweak arguments
508
+ if args is None:
509
+ args = ()
510
+ elif not isinstance(args, tuple):
511
+ args = (args,)
512
+
513
+ try:
514
+ decoder = DECODERS[decoder_name]
515
+ except KeyError:
516
+ pass
517
+ else:
518
+ return decoder(mode, *args + extra)
519
+
520
+ try:
521
+ # get decoder
522
+ decoder = getattr(core, f"{decoder_name}_decoder")
523
+ except AttributeError as e:
524
+ msg = f"decoder {decoder_name} not available"
525
+ raise OSError(msg) from e
526
+ return decoder(mode, *args + extra)
527
+
528
+
529
+ def _getencoder(
530
+ mode: str, encoder_name: str, args: Any, extra: tuple[Any, ...] = ()
531
+ ) -> core.ImagingEncoder | ImageFile.PyEncoder:
532
+ # tweak arguments
533
+ if args is None:
534
+ args = ()
535
+ elif not isinstance(args, tuple):
536
+ args = (args,)
537
+
538
+ try:
539
+ encoder = ENCODERS[encoder_name]
540
+ except KeyError:
541
+ pass
542
+ else:
543
+ return encoder(mode, *args + extra)
544
+
545
+ try:
546
+ # get encoder
547
+ encoder = getattr(core, f"{encoder_name}_encoder")
548
+ except AttributeError as e:
549
+ msg = f"encoder {encoder_name} not available"
550
+ raise OSError(msg) from e
551
+ return encoder(mode, *args + extra)
552
+
553
+
554
+ # --------------------------------------------------------------------
555
+ # Simple expression analyzer
556
+
557
+
558
+ class ImagePointTransform:
559
+ """
560
+ Used with :py:meth:`~PIL.Image.Image.point` for single band images with more than
561
+ 8 bits, this represents an affine transformation, where the value is multiplied by
562
+ ``scale`` and ``offset`` is added.
563
+ """
564
+
565
+ def __init__(self, scale: float, offset: float) -> None:
566
+ self.scale = scale
567
+ self.offset = offset
568
+
569
+ def __neg__(self) -> ImagePointTransform:
570
+ return ImagePointTransform(-self.scale, -self.offset)
571
+
572
+ def __add__(self, other: ImagePointTransform | float) -> ImagePointTransform:
573
+ if isinstance(other, ImagePointTransform):
574
+ return ImagePointTransform(
575
+ self.scale + other.scale, self.offset + other.offset
576
+ )
577
+ return ImagePointTransform(self.scale, self.offset + other)
578
+
579
+ __radd__ = __add__
580
+
581
+ def __sub__(self, other: ImagePointTransform | float) -> ImagePointTransform:
582
+ return self + -other
583
+
584
+ def __rsub__(self, other: ImagePointTransform | float) -> ImagePointTransform:
585
+ return other + -self
586
+
587
+ def __mul__(self, other: ImagePointTransform | float) -> ImagePointTransform:
588
+ if isinstance(other, ImagePointTransform):
589
+ return NotImplemented
590
+ return ImagePointTransform(self.scale * other, self.offset * other)
591
+
592
+ __rmul__ = __mul__
593
+
594
+ def __truediv__(self, other: ImagePointTransform | float) -> ImagePointTransform:
595
+ if isinstance(other, ImagePointTransform):
596
+ return NotImplemented
597
+ return ImagePointTransform(self.scale / other, self.offset / other)
598
+
599
+
600
+ def _getscaleoffset(
601
+ expr: Callable[[ImagePointTransform], ImagePointTransform | float],
602
+ ) -> tuple[float, float]:
603
+ a = expr(ImagePointTransform(1, 0))
604
+ return (a.scale, a.offset) if isinstance(a, ImagePointTransform) else (0, a)
605
+
606
+
607
+ # --------------------------------------------------------------------
608
+ # Implementation wrapper
609
+
610
+
611
+ class SupportsGetData(Protocol):
612
+ def getdata(
613
+ self,
614
+ ) -> tuple[Transform, Sequence[int]]: ...
615
+
616
+
617
+ class Image:
618
+ """
619
+ This class represents an image object. To create
620
+ :py:class:`~PIL.Image.Image` objects, use the appropriate factory
621
+ functions. There's hardly ever any reason to call the Image constructor
622
+ directly.
623
+
624
+ * :py:func:`~PIL.Image.open`
625
+ * :py:func:`~PIL.Image.new`
626
+ * :py:func:`~PIL.Image.frombytes`
627
+ """
628
+
629
+ format: str | None = None
630
+ format_description: str | None = None
631
+ _close_exclusive_fp_after_loading = True
632
+
633
+ def __init__(self) -> None:
634
+ # FIXME: take "new" parameters / other image?
635
+ self._im: core.ImagingCore | DeferredError | None = None
636
+ self._mode = ""
637
+ self._size = (0, 0)
638
+ self.palette: ImagePalette.ImagePalette | None = None
639
+ self.info: dict[str | tuple[int, int], Any] = {}
640
+ self.readonly = 0
641
+ self._exif: Exif | None = None
642
+
643
+ @property
644
+ def im(self) -> core.ImagingCore:
645
+ if isinstance(self._im, DeferredError):
646
+ raise self._im.ex
647
+ assert self._im is not None
648
+ return self._im
649
+
650
+ @im.setter
651
+ def im(self, im: core.ImagingCore) -> None:
652
+ self._im = im
653
+
654
+ @property
655
+ def width(self) -> int:
656
+ return self.size[0]
657
+
658
+ @property
659
+ def height(self) -> int:
660
+ return self.size[1]
661
+
662
+ @property
663
+ def size(self) -> tuple[int, int]:
664
+ return self._size
665
+
666
+ @property
667
+ def mode(self) -> str:
668
+ return self._mode
669
+
670
+ @property
671
+ def readonly(self) -> int:
672
+ return (self._im and self._im.readonly) or self._readonly
673
+
674
+ @readonly.setter
675
+ def readonly(self, readonly: int) -> None:
676
+ self._readonly = readonly
677
+
678
+ def _copy_info(self) -> dict[str | tuple[int, int], Any]:
679
+ return {k: v.copy() if isinstance(v, list) else v for k, v in self.info.items()}
680
+
681
+ def _new(self, im: core.ImagingCore) -> Image:
682
+ new = Image()
683
+ new.im = im
684
+ new._mode = im.mode
685
+ new._size = im.size
686
+ if im.mode in ("P", "PA"):
687
+ if self.palette:
688
+ new.palette = self.palette.copy()
689
+ else:
690
+ from . import ImagePalette
691
+
692
+ new.palette = ImagePalette.ImagePalette()
693
+ new.info = self._copy_info()
694
+ return new
695
+
696
+ # Context manager support
697
+ def __enter__(self) -> Self:
698
+ return self
699
+
700
+ def __exit__(self, *args: object) -> None:
701
+ pass
702
+
703
+ def close(self) -> None:
704
+ """
705
+ This operation will destroy the image core and release its memory.
706
+ The image data will be unusable afterward.
707
+
708
+ This function is required to close images that have multiple frames or
709
+ have not had their file read and closed by the
710
+ :py:meth:`~PIL.Image.Image.load` method. See :ref:`file-handling` for
711
+ more information.
712
+ """
713
+ if getattr(self, "map", None):
714
+ if sys.platform == "win32" and sys.implementation.name == "pypy":
715
+ self.map.close()
716
+ self.map: mmap.mmap | None = None
717
+
718
+ # Instead of simply setting to None, we're setting up a
719
+ # deferred error that will better explain that the core image
720
+ # object is gone.
721
+ self._im = DeferredError(ValueError("Operation on closed image"))
722
+
723
+ def _copy(self) -> None:
724
+ self.load()
725
+ self.im = self.im.copy()
726
+ self.readonly = 0
727
+
728
+ def _ensure_mutable(self) -> None:
729
+ if self.readonly:
730
+ self._copy()
731
+ else:
732
+ self.load()
733
+
734
+ def _dump(
735
+ self, file: str | None = None, format: str | None = None, **options: Any
736
+ ) -> str:
737
+ suffix = f".{format}" if format else ""
738
+
739
+ if file:
740
+ filename = file
741
+ if not filename.endswith(suffix):
742
+ filename += suffix
743
+ else:
744
+ import tempfile
745
+
746
+ f, filename = tempfile.mkstemp(suffix)
747
+ os.close(f)
748
+
749
+ self.save(filename, format or "PPM", **options)
750
+
751
+ return filename
752
+
753
+ def __eq__(self, other: object) -> bool:
754
+ if self.__class__ is not other.__class__:
755
+ return False
756
+ assert isinstance(other, Image)
757
+ return (
758
+ self.mode == other.mode
759
+ and self.size == other.size
760
+ and self.info == other.info
761
+ and self.getpalette() == other.getpalette()
762
+ and self.tobytes() == other.tobytes()
763
+ )
764
+
765
+ def __repr__(self) -> str:
766
+ return (
767
+ f"<{self.__class__.__module__}.{self.__class__.__name__} "
768
+ f"image mode={self.mode} size={self.size[0]}x{self.size[1]} "
769
+ f"at 0x{id(self):X}>"
770
+ )
771
+
772
+ def _repr_pretty_(self, p: PrettyPrinter, cycle: bool) -> None:
773
+ """IPython plain text display support"""
774
+
775
+ # Same as __repr__ but without unpredictable id(self),
776
+ # to keep Jupyter notebook `text/plain` output stable.
777
+ p.text(
778
+ f"<{self.__class__.__module__}.{self.__class__.__name__} "
779
+ f"image mode={self.mode} size={self.size[0]}x{self.size[1]}>"
780
+ )
781
+
782
+ def _repr_image(self, image_format: str, **kwargs: Any) -> bytes | None:
783
+ """Helper function for iPython display hook.
784
+
785
+ :param image_format: Image format.
786
+ :returns: image as bytes, saved into the given format.
787
+ """
788
+ b = io.BytesIO()
789
+ try:
790
+ self.save(b, image_format, **kwargs)
791
+ except Exception:
792
+ return None
793
+ return b.getvalue()
794
+
795
+ def _repr_png_(self) -> bytes | None:
796
+ """iPython display hook support for PNG format.
797
+
798
+ :returns: PNG version of the image as bytes
799
+ """
800
+ return self._repr_image("PNG", compress_level=1)
801
+
802
+ def _repr_jpeg_(self) -> bytes | None:
803
+ """iPython display hook support for JPEG format.
804
+
805
+ :returns: JPEG version of the image as bytes
806
+ """
807
+ return self._repr_image("JPEG")
808
+
809
+ @property
810
+ def __array_interface__(self) -> dict[str, str | bytes | int | tuple[int, ...]]:
811
+ # numpy array interface support
812
+ new: dict[str, str | bytes | int | tuple[int, ...]] = {"version": 3}
813
+ if self.mode == "1":
814
+ # Binary images need to be extended from bits to bytes
815
+ # See: https://github.com/python-pillow/Pillow/issues/350
816
+ new["data"] = self.tobytes("raw", "L")
817
+ else:
818
+ new["data"] = self.tobytes()
819
+ new["shape"], new["typestr"] = _conv_type_shape(self)
820
+ return new
821
+
822
+ def __arrow_c_schema__(self) -> object:
823
+ self.load()
824
+ return self.im.__arrow_c_schema__()
825
+
826
+ def __arrow_c_array__(
827
+ self, requested_schema: object | None = None
828
+ ) -> tuple[object, object]:
829
+ self.load()
830
+ return (self.im.__arrow_c_schema__(), self.im.__arrow_c_array__())
831
+
832
+ def __getstate__(self) -> list[Any]:
833
+ im_data = self.tobytes() # load image first
834
+ return [self.info, self.mode, self.size, self.getpalette(), im_data]
835
+
836
+ def __setstate__(self, state: list[Any]) -> None:
837
+ Image.__init__(self)
838
+ info, mode, size, palette, data = state[:5]
839
+ self.info = info
840
+ self._mode = mode
841
+ self._size = size
842
+ self.im = core.new(mode, size)
843
+ if mode in ("L", "LA", "P", "PA") and palette:
844
+ self.putpalette(palette)
845
+ self.frombytes(data)
846
+
847
+ def tobytes(self, encoder_name: str = "raw", *args: Any) -> bytes:
848
+ """
849
+ Return image as a bytes object.
850
+
851
+ .. warning::
852
+
853
+ This method returns raw image data derived from Pillow's internal
854
+ storage. For compressed image data (e.g. PNG, JPEG) use
855
+ :meth:`~.save`, with a BytesIO parameter for in-memory data.
856
+
857
+ :param encoder_name: What encoder to use.
858
+
859
+ The default is to use the standard "raw" encoder.
860
+ To see how this packs pixel data into the returned
861
+ bytes, see :file:`libImaging/Pack.c`.
862
+
863
+ A list of C encoders can be seen under codecs
864
+ section of the function array in
865
+ :file:`_imaging.c`. Python encoders are registered
866
+ within the relevant plugins.
867
+ :param args: Extra arguments to the encoder.
868
+ :returns: A :py:class:`bytes` object.
869
+ """
870
+
871
+ encoder_args: Any = args
872
+ if len(encoder_args) == 1 and isinstance(encoder_args[0], tuple):
873
+ # may pass tuple instead of argument list
874
+ encoder_args = encoder_args[0]
875
+
876
+ if encoder_name == "raw" and encoder_args == ():
877
+ encoder_args = self.mode
878
+
879
+ self.load()
880
+
881
+ if self.width == 0 or self.height == 0:
882
+ return b""
883
+
884
+ # unpack data
885
+ e = _getencoder(self.mode, encoder_name, encoder_args)
886
+ try:
887
+ e.setimage(self.im, (0, 0, *self.size))
888
+
889
+ from . import ImageFile
890
+
891
+ bufsize = max(ImageFile.MAXBLOCK, self.size[0] * 4) # see RawEncode.c
892
+
893
+ output = []
894
+ while True:
895
+ bytes_consumed, errcode, data = e.encode(bufsize)
896
+ output.append(data)
897
+ if errcode:
898
+ break
899
+ if errcode < 0:
900
+ msg = f"encoder error {errcode} in tobytes"
901
+ raise RuntimeError(msg)
902
+ finally:
903
+ e.cleanup()
904
+
905
+ return b"".join(output)
906
+
907
+ def tobitmap(self, name: str = "image") -> bytes:
908
+ """
909
+ Returns the image converted to an X11 bitmap.
910
+
911
+ .. note:: This method only works for mode "1" images.
912
+
913
+ :param name: The name prefix to use for the bitmap variables.
914
+ :returns: A string containing an X11 bitmap.
915
+ :raises ValueError: If the mode is not "1"
916
+ """
917
+
918
+ self.load()
919
+ if self.mode != "1":
920
+ msg = "not a bitmap"
921
+ raise ValueError(msg)
922
+ data = self.tobytes("xbm")
923
+ return b"".join(
924
+ [
925
+ f"#define {name}_width {self.size[0]}\n".encode("ascii"),
926
+ f"#define {name}_height {self.size[1]}\n".encode("ascii"),
927
+ f"static char {name}_bits[] = {{\n".encode("ascii"),
928
+ data,
929
+ b"};",
930
+ ]
931
+ )
932
+
933
+ def frombytes(
934
+ self,
935
+ data: DecoderInput,
936
+ decoder_name: str = "raw",
937
+ *args: Any,
938
+ ) -> None:
939
+ """
940
+ Loads this image with pixel data from a bytes object.
941
+
942
+ This method is similar to the :py:func:`~PIL.Image.frombytes` function,
943
+ but loads data into this image instead of creating a new image object.
944
+ """
945
+
946
+ if self.width == 0 or self.height == 0:
947
+ return
948
+
949
+ decoder_args: Any = args
950
+ if len(decoder_args) == 1 and isinstance(decoder_args[0], tuple):
951
+ # may pass tuple instead of argument list
952
+ decoder_args = decoder_args[0]
953
+
954
+ # default format
955
+ if decoder_name == "raw" and decoder_args == ():
956
+ decoder_args = self.mode
957
+
958
+ # unpack data
959
+ d = _getdecoder(self.mode, decoder_name, decoder_args)
960
+ d.setimage(self.im, (0, 0, *self.size))
961
+ s = d.decode(data)
962
+
963
+ if s[0] >= 0:
964
+ msg = "not enough image data"
965
+ raise ValueError(msg)
966
+ if s[1] != 0:
967
+ msg = "cannot decode image data"
968
+ raise ValueError(msg)
969
+
970
+ def load(self) -> core.PixelAccess | None:
971
+ """
972
+ Allocates storage for the image and loads the pixel data. In
973
+ normal cases, you don't need to call this method, since the
974
+ Image class automatically loads an opened image when it is
975
+ accessed for the first time.
976
+
977
+ If the file associated with the image was opened by Pillow, then this
978
+ method will close it. The exception to this is if the image has
979
+ multiple frames, in which case the file will be left open for seek
980
+ operations. See :ref:`file-handling` for more information.
981
+
982
+ :returns: An image access object.
983
+ """
984
+ if self._im is not None and self.palette and self.palette.dirty:
985
+ # realize palette
986
+ mode, arr = self.palette.getdata()
987
+ self.im.putpalette(self.palette.mode, mode, arr)
988
+ self.palette.dirty = 0
989
+ self.palette.rawmode = None
990
+ if "transparency" in self.info and mode in ("LA", "PA"):
991
+ if isinstance(self.info["transparency"], int):
992
+ self.im.putpalettealpha(self.info["transparency"], 0)
993
+ else:
994
+ self.im.putpalettealphas(self.info["transparency"])
995
+ self.palette.mode = "RGBA"
996
+ elif self.palette.mode != mode:
997
+ # If the palette rawmode is different to the mode,
998
+ # then update the Python palette data
999
+ self.palette.palette = self.im.getpalette(self.palette.mode)
1000
+
1001
+ if self._im is not None:
1002
+ return self.im.pixel_access(self.readonly)
1003
+ return None
1004
+
1005
+ def verify(self) -> None:
1006
+ """
1007
+ Verifies the contents of a file. For data read from a file, this
1008
+ method attempts to determine if the file is broken, without
1009
+ actually decoding the image data. If this method finds any
1010
+ problems, it raises suitable exceptions. If you need to load
1011
+ the image after using this method, you must reopen the image
1012
+ file.
1013
+ """
1014
+ pass
1015
+
1016
+ def convert(
1017
+ self,
1018
+ mode: str | None = None,
1019
+ matrix: list[float] | tuple[float, ...] | None = None,
1020
+ dither: Dither | None = None,
1021
+ palette: Palette = Palette.WEB,
1022
+ colors: int = 256,
1023
+ ) -> Image:
1024
+ """
1025
+ Returns a converted copy of this image. For the "P" mode, this
1026
+ method translates pixels through the palette. If mode is
1027
+ omitted, a mode is chosen so that all information in the image
1028
+ and the palette can be represented without a palette.
1029
+
1030
+ This supports all possible conversions between "L", "RGB" and "CMYK". The
1031
+ ``matrix`` argument only supports "L" and "RGB".
1032
+
1033
+ When translating a color image to grayscale (mode "L"),
1034
+ the library uses the ITU-R 601-2 luma transform::
1035
+
1036
+ L = R * 299/1000 + G * 587/1000 + B * 114/1000
1037
+
1038
+ The default method of converting a grayscale ("L") or "RGB"
1039
+ image into a bilevel (mode "1") image uses Floyd-Steinberg
1040
+ dither to approximate the original image luminosity levels. If
1041
+ dither is ``None``, all values larger than 127 are set to 255 (white),
1042
+ all other values to 0 (black). To use other thresholds, use the
1043
+ :py:meth:`~PIL.Image.Image.point` method.
1044
+
1045
+ When converting from "RGBA" to "P" without a ``matrix`` argument,
1046
+ this passes the operation to :py:meth:`~PIL.Image.Image.quantize`,
1047
+ and ``dither`` and ``palette`` are ignored.
1048
+
1049
+ When converting from "PA", if an "RGBA" palette is present, the alpha
1050
+ channel from the image will be used instead of the values from the palette.
1051
+
1052
+ :param mode: The requested mode. See: :ref:`concept-modes`.
1053
+ :param matrix: An optional conversion matrix. If given, this
1054
+ should be 4- or 12-sequence containing floating point values.
1055
+ :param dither: Dithering method, used when converting from
1056
+ mode "RGB" to "P" or from "RGB" or "L" to "1".
1057
+ Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG`
1058
+ (default). Note that this is not used when ``matrix`` is supplied.
1059
+ :param palette: Palette to use when converting from mode "RGB"
1060
+ to "P". Available palettes are :data:`Palette.WEB` or
1061
+ :data:`Palette.ADAPTIVE`.
1062
+ :param colors: Number of colors to use for the :data:`Palette.ADAPTIVE`
1063
+ palette. Defaults to 256.
1064
+ :returns: An :py:class:`~PIL.Image.Image` object.
1065
+ """
1066
+
1067
+ self.load()
1068
+
1069
+ has_transparency = "transparency" in self.info
1070
+ if not mode and self.mode == "P":
1071
+ # determine default mode
1072
+ if self.palette:
1073
+ mode = self.palette.mode
1074
+ else:
1075
+ mode = "RGB"
1076
+ if mode == "RGB" and has_transparency:
1077
+ mode = "RGBA"
1078
+ if not mode or (mode == self.mode and not matrix):
1079
+ return self.copy()
1080
+
1081
+ if matrix:
1082
+ # matrix conversion
1083
+ if mode not in ("L", "RGB"):
1084
+ msg = "illegal conversion"
1085
+ raise ValueError(msg)
1086
+ im = self.im.convert_matrix(mode, matrix)
1087
+ new_im = self._new(im)
1088
+ if has_transparency and self.im.bands == 3:
1089
+ transparency = new_im.info["transparency"]
1090
+
1091
+ def convert_transparency(
1092
+ m: list[float] | tuple[float, ...], v: tuple[int, int, int]
1093
+ ) -> int:
1094
+ value = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * 0.5
1095
+ return max(0, min(255, int(value)))
1096
+
1097
+ if mode == "L":
1098
+ transparency = convert_transparency(matrix, transparency)
1099
+ elif len(mode) == 3:
1100
+ transparency = tuple(
1101
+ convert_transparency(matrix[i * 4 : i * 4 + 4], transparency)
1102
+ for i in range(len(transparency))
1103
+ )
1104
+ new_im.info["transparency"] = transparency
1105
+ return new_im
1106
+
1107
+ if self.mode == "RGBA":
1108
+ if mode == "P":
1109
+ return self.quantize(colors)
1110
+ elif mode == "PA":
1111
+ r, g, b, a = self.split()
1112
+ rgb = merge("RGB", (r, g, b))
1113
+ p = rgb.quantize(colors)
1114
+ return merge("PA", (p, a))
1115
+
1116
+ trns = None
1117
+ delete_trns = False
1118
+ # transparency handling
1119
+ if has_transparency:
1120
+ if (self.mode in ("1", "L", "I", "I;16") and mode in ("LA", "RGBA")) or (
1121
+ self.mode == "RGB" and mode in ("La", "LA", "RGBa", "RGBA")
1122
+ ):
1123
+ # Use transparent conversion to promote from transparent
1124
+ # color to an alpha channel.
1125
+ new_im = self._new(
1126
+ self.im.convert_transparent(mode, self.info["transparency"])
1127
+ )
1128
+ del new_im.info["transparency"]
1129
+ return new_im
1130
+ elif self.mode in ("L", "RGB", "P") and mode in ("L", "RGB", "P"):
1131
+ t = self.info["transparency"]
1132
+ if isinstance(t, bytes):
1133
+ # Dragons. This can't be represented by a single color
1134
+ warnings.warn(
1135
+ "Palette images with Transparency expressed in bytes should be "
1136
+ "converted to RGBA images"
1137
+ )
1138
+ delete_trns = True
1139
+ else:
1140
+ # get the new transparency color.
1141
+ # use existing conversions
1142
+ trns_im = new(self.mode, (1, 1))
1143
+ if self.mode == "P":
1144
+ assert self.palette is not None
1145
+ trns_im.putpalette(self.palette, self.palette.mode)
1146
+ if isinstance(t, tuple):
1147
+ err = "Couldn't allocate a palette color for transparency"
1148
+ assert trns_im.palette is not None
1149
+ try:
1150
+ t = trns_im.palette.getcolor(t, self)
1151
+ except ValueError as e:
1152
+ if str(e) == "cannot allocate more than 256 colors":
1153
+ # If all 256 colors are in use,
1154
+ # then there is no need for transparency
1155
+ t = None
1156
+ else:
1157
+ raise ValueError(err) from e
1158
+ if t is None:
1159
+ trns = None
1160
+ else:
1161
+ trns_im.putpixel((0, 0), t)
1162
+
1163
+ if mode in ("L", "RGB"):
1164
+ trns_im = trns_im.convert(mode)
1165
+ else:
1166
+ # can't just retrieve the palette number, got to do it
1167
+ # after quantization.
1168
+ trns_im = trns_im.convert("RGB")
1169
+ trns = trns_im.getpixel((0, 0))
1170
+
1171
+ elif self.mode == "P" and mode in ("LA", "PA", "RGBA"):
1172
+ t = self.info["transparency"]
1173
+ delete_trns = True
1174
+
1175
+ if isinstance(t, bytes):
1176
+ self.im.putpalettealphas(t)
1177
+ elif isinstance(t, int):
1178
+ self.im.putpalettealpha(t, 0)
1179
+ else:
1180
+ msg = "Transparency for P mode should be bytes or int"
1181
+ raise ValueError(msg)
1182
+
1183
+ if mode == "P" and palette == Palette.ADAPTIVE:
1184
+ im = self.im.quantize(colors)
1185
+ new_im = self._new(im)
1186
+ from . import ImagePalette
1187
+
1188
+ new_im.palette = ImagePalette.ImagePalette(
1189
+ "RGB", new_im.im.getpalette("RGB")
1190
+ )
1191
+ if delete_trns:
1192
+ # This could possibly happen if we requantize to fewer colors.
1193
+ # The transparency would be totally off in that case.
1194
+ del new_im.info["transparency"]
1195
+ if trns is not None:
1196
+ try:
1197
+ new_im.info["transparency"] = new_im.palette.getcolor(
1198
+ cast("tuple[int, ...]", trns), # trns was converted to RGB
1199
+ new_im,
1200
+ )
1201
+ except Exception:
1202
+ # if we can't make a transparent color, don't leave the old
1203
+ # transparency hanging around to mess us up.
1204
+ del new_im.info["transparency"]
1205
+ warnings.warn("Couldn't allocate palette entry for transparency")
1206
+ return new_im
1207
+
1208
+ if "LAB" in (self.mode, mode):
1209
+ im = self
1210
+ if mode == "LAB":
1211
+ if im.mode not in ("RGB", "RGBA", "RGBX"):
1212
+ im = im.convert("RGBA")
1213
+ other_mode = im.mode
1214
+ else:
1215
+ other_mode = mode
1216
+ if other_mode in ("RGB", "RGBA", "RGBX"):
1217
+ from . import ImageCms
1218
+
1219
+ srgb = ImageCms.createProfile("sRGB")
1220
+ lab = ImageCms.createProfile("LAB")
1221
+ profiles = [lab, srgb] if im.mode == "LAB" else [srgb, lab]
1222
+ transform = ImageCms.buildTransform(
1223
+ profiles[0], profiles[1], im.mode, mode
1224
+ )
1225
+ return transform.apply(im)
1226
+
1227
+ # colorspace conversion
1228
+ if dither is None:
1229
+ dither = Dither.FLOYDSTEINBERG
1230
+
1231
+ try:
1232
+ im = self.im.convert(mode, dither)
1233
+ except ValueError:
1234
+ try:
1235
+ # normalize source image and try again
1236
+ modebase = getmodebase(self.mode)
1237
+ if modebase == self.mode:
1238
+ raise
1239
+ im = self.im.convert(modebase)
1240
+ im = im.convert(mode, dither)
1241
+ except KeyError as e:
1242
+ msg = "illegal conversion"
1243
+ raise ValueError(msg) from e
1244
+
1245
+ new_im = self._new(im)
1246
+ if mode in ("P", "PA") and palette != Palette.ADAPTIVE:
1247
+ from . import ImagePalette
1248
+
1249
+ new_im.palette = ImagePalette.raw("RGB", im.getpalette("RGB"))
1250
+ if delete_trns:
1251
+ # crash fail if we leave a bytes transparency in an rgb/l mode.
1252
+ del new_im.info["transparency"]
1253
+ if trns is not None:
1254
+ if new_im.mode == "P" and new_im.palette:
1255
+ try:
1256
+ new_im.info["transparency"] = new_im.palette.getcolor(
1257
+ cast("tuple[int, ...]", trns), # trns was converted to RGB
1258
+ new_im,
1259
+ )
1260
+ except ValueError as e:
1261
+ del new_im.info["transparency"]
1262
+ if str(e) != "cannot allocate more than 256 colors":
1263
+ # If all 256 colors are in use,
1264
+ # then there is no need for transparency
1265
+ warnings.warn(
1266
+ "Couldn't allocate palette entry for transparency"
1267
+ )
1268
+ else:
1269
+ new_im.info["transparency"] = trns
1270
+ return new_im
1271
+
1272
+ def quantize(
1273
+ self,
1274
+ colors: int = 256,
1275
+ method: int | None = None,
1276
+ kmeans: int = 0,
1277
+ palette: Image | None = None,
1278
+ dither: Dither = Dither.FLOYDSTEINBERG,
1279
+ ) -> Image:
1280
+ """
1281
+ Convert the image to 'P' mode with the specified number
1282
+ of colors.
1283
+
1284
+ :param colors: The desired number of colors, <= 256
1285
+ :param method: :data:`Quantize.MEDIANCUT` (median cut),
1286
+ :data:`Quantize.MAXCOVERAGE` (maximum coverage),
1287
+ :data:`Quantize.FASTOCTREE` (fast octree),
1288
+ :data:`Quantize.LIBIMAGEQUANT` (libimagequant; check support
1289
+ using :py:func:`PIL.features.check_feature` with
1290
+ ``feature="libimagequant"``).
1291
+
1292
+ By default, :data:`Quantize.MEDIANCUT` will be used.
1293
+
1294
+ The exception to this is RGBA images. :data:`Quantize.MEDIANCUT`
1295
+ and :data:`Quantize.MAXCOVERAGE` do not support RGBA images, so
1296
+ :data:`Quantize.FASTOCTREE` is used by default instead.
1297
+ :param kmeans: Integer greater than or equal to zero.
1298
+ :param palette: Quantize to the palette of given
1299
+ :py:class:`PIL.Image.Image`.
1300
+ :param dither: Dithering method, used when converting from
1301
+ mode "RGB" to "P" or from "RGB" or "L" to "1".
1302
+ Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG`
1303
+ (default).
1304
+ :returns: A new image
1305
+ """
1306
+
1307
+ self.load()
1308
+
1309
+ if method is None:
1310
+ # defaults:
1311
+ method = Quantize.MEDIANCUT
1312
+ if self.mode == "RGBA":
1313
+ method = Quantize.FASTOCTREE
1314
+
1315
+ if self.mode == "RGBA" and method not in (
1316
+ Quantize.FASTOCTREE,
1317
+ Quantize.LIBIMAGEQUANT,
1318
+ ):
1319
+ # Caller specified an invalid mode.
1320
+ msg = (
1321
+ "Fast Octree (method == 2) and libimagequant (method == 3) "
1322
+ "are the only valid methods for quantizing RGBA images"
1323
+ )
1324
+ raise ValueError(msg)
1325
+
1326
+ if palette:
1327
+ # use palette from reference image
1328
+ palette.load()
1329
+ if palette.mode != "P":
1330
+ msg = "bad mode for palette image"
1331
+ raise ValueError(msg)
1332
+ if self.mode not in {"RGB", "L"}:
1333
+ msg = "only RGB or L mode images can be quantized to a palette"
1334
+ raise ValueError(msg)
1335
+ im = self.im.convert("P", dither, palette.im)
1336
+ new_im = self._new(im)
1337
+ assert palette.palette is not None
1338
+ new_im.palette = palette.palette.copy()
1339
+ return new_im
1340
+
1341
+ if kmeans < 0:
1342
+ msg = "kmeans must not be negative"
1343
+ raise ValueError(msg)
1344
+
1345
+ im = self._new(self.im.quantize(colors, method, kmeans))
1346
+
1347
+ from . import ImagePalette
1348
+
1349
+ mode = im.im.getpalettemode()
1350
+ palette_data = im.im.getpalette(mode)[: colors * len(mode)]
1351
+ im.palette = ImagePalette.ImagePalette(mode, palette_data)
1352
+
1353
+ return im
1354
+
1355
+ def copy(self) -> Image:
1356
+ """
1357
+ Copies this image. Use this method if you wish to paste things
1358
+ into an image, but still retain the original.
1359
+
1360
+ :returns: An :py:class:`~PIL.Image.Image` object.
1361
+ """
1362
+ self.load()
1363
+ return self._new(self.im.copy())
1364
+
1365
+ __copy__ = copy
1366
+
1367
+ def crop(self, box: tuple[float, float, float, float] | None = None) -> Image:
1368
+ """
1369
+ Returns a rectangular region from this image. The box is a
1370
+ 4-tuple defining the left, upper, right, and lower pixel
1371
+ coordinate. See :ref:`coordinate-system`.
1372
+
1373
+ Note: Prior to Pillow 3.4.0, this was a lazy operation.
1374
+
1375
+ :param box: The crop rectangle, as a (left, upper, right, lower)-tuple.
1376
+ :returns: An :py:class:`~PIL.Image.Image` object.
1377
+ """
1378
+
1379
+ if box is None or box == (0, 0, *self.size):
1380
+ return self.copy()
1381
+
1382
+ if box[2] < box[0]:
1383
+ msg = "Coordinate 'right' is less than 'left'"
1384
+ raise ValueError(msg)
1385
+ elif box[3] < box[1]:
1386
+ msg = "Coordinate 'lower' is less than 'upper'"
1387
+ raise ValueError(msg)
1388
+
1389
+ self.load()
1390
+ return self._new(self._crop(self.im, box))
1391
+
1392
+ def _crop(
1393
+ self, im: core.ImagingCore, box: tuple[float, float, float, float]
1394
+ ) -> core.ImagingCore:
1395
+ """
1396
+ Returns a rectangular region from the core image object im.
1397
+
1398
+ This is equivalent to calling im.crop((x0, y0, x1, y1)), but
1399
+ includes additional sanity checks.
1400
+
1401
+ :param im: a core image object
1402
+ :param box: The crop rectangle, as a (left, upper, right, lower)-tuple.
1403
+ :returns: A core image object.
1404
+ """
1405
+
1406
+ x0, y0, x1, y1 = map(int, map(round, box))
1407
+
1408
+ absolute_values = (abs(x1 - x0), abs(y1 - y0))
1409
+
1410
+ _decompression_bomb_check(absolute_values)
1411
+
1412
+ return im.crop((x0, y0, x1, y1))
1413
+
1414
+ def draft(
1415
+ self, mode: str | None, size: tuple[int, int] | None
1416
+ ) -> tuple[str, tuple[int, int, float, float]] | None:
1417
+ """
1418
+ Configures the image file loader so it returns a version of the
1419
+ image that as closely as possible matches the given mode and
1420
+ size. For example, you can use this method to convert a color
1421
+ JPEG to grayscale while loading it.
1422
+
1423
+ If any changes are made, returns a tuple with the chosen ``mode`` and
1424
+ ``box`` with coordinates of the original image within the altered one.
1425
+
1426
+ Note that this method modifies the :py:class:`~PIL.Image.Image` object
1427
+ in place. If the image has already been loaded, this method has no
1428
+ effect.
1429
+
1430
+ Note: This method is not implemented for most images. It is
1431
+ currently implemented only for JPEG and MPO images.
1432
+
1433
+ :param mode: The requested mode.
1434
+ :param size: The requested size in pixels, as a 2-tuple:
1435
+ (width, height).
1436
+ """
1437
+ pass
1438
+
1439
+ def filter(self, filter: ImageFilter.Filter | type[ImageFilter.Filter]) -> Image:
1440
+ """
1441
+ Filters this image using the given filter. For a list of
1442
+ available filters, see the :py:mod:`~PIL.ImageFilter` module.
1443
+
1444
+ :param filter: Filter kernel.
1445
+ :returns: An :py:class:`~PIL.Image.Image` object."""
1446
+
1447
+ from . import ImageFilter
1448
+
1449
+ self.load()
1450
+
1451
+ if callable(filter):
1452
+ filter = filter()
1453
+ if not hasattr(filter, "filter"):
1454
+ msg = "filter argument should be ImageFilter.Filter instance or class"
1455
+ raise TypeError(msg)
1456
+
1457
+ multiband = isinstance(filter, ImageFilter.MultibandFilter)
1458
+ if self.im.bands == 1 or multiband:
1459
+ return self._new(filter.filter(self.im))
1460
+
1461
+ ims = [
1462
+ self._new(filter.filter(self.im.getband(c))) for c in range(self.im.bands)
1463
+ ]
1464
+ return merge(self.mode, ims)
1465
+
1466
+ def getbands(self) -> tuple[str, ...]:
1467
+ """
1468
+ Returns a tuple containing the name of each band in this image.
1469
+ For example, ``getbands`` on an RGB image returns ("R", "G", "B").
1470
+
1471
+ :returns: A tuple containing band names.
1472
+ """
1473
+ return ImageMode.getmode(self.mode).bands
1474
+
1475
+ def getbbox(self, *, alpha_only: bool = True) -> tuple[int, int, int, int] | None:
1476
+ """
1477
+ Calculates the bounding box of the non-zero regions in the
1478
+ image.
1479
+
1480
+ :param alpha_only: Optional flag, defaulting to ``True``.
1481
+ If ``True`` and the image has an alpha channel, trim transparent pixels.
1482
+ Otherwise, trim pixels when all channels are zero.
1483
+ Keyword-only argument.
1484
+ :returns: The bounding box is returned as a 4-tuple defining the
1485
+ left, upper, right, and lower pixel coordinate. See
1486
+ :ref:`coordinate-system`. If the image is completely empty, this
1487
+ method returns None.
1488
+
1489
+ """
1490
+
1491
+ self.load()
1492
+ return self.im.getbbox(alpha_only)
1493
+
1494
+ def getcolors(
1495
+ self, maxcolors: int = 256
1496
+ ) -> list[tuple[int, tuple[int, ...]]] | list[tuple[int, float]] | None:
1497
+ """
1498
+ Returns a list of colors used in this image.
1499
+
1500
+ The colors will be in the image's mode. For example, an RGB image will
1501
+ return a tuple of (red, green, blue) color values, and a P image will
1502
+ return the index of the color in the palette.
1503
+
1504
+ :param maxcolors: Maximum number of colors. If this number is
1505
+ exceeded, this method returns None. The default limit is
1506
+ 256 colors.
1507
+ :returns: An unsorted list of (count, pixel) values.
1508
+ """
1509
+
1510
+ self.load()
1511
+ if self.mode in ("1", "L", "P"):
1512
+ h = self.im.histogram()
1513
+ out: list[tuple[int, float]] = [(h[i], i) for i in range(256) if h[i]]
1514
+ if len(out) > maxcolors:
1515
+ return None
1516
+ return out
1517
+ return self.im.getcolors(maxcolors)
1518
+
1519
+ def getdata(self, band: int | None = None) -> core.ImagingCore:
1520
+ """
1521
+ Returns the contents of this image as a sequence object
1522
+ containing pixel values. The sequence object is flattened, so
1523
+ that values for line one follow directly after the values of
1524
+ line zero, and so on.
1525
+
1526
+ Note that the sequence object returned by this method is an
1527
+ internal PIL data type, which only supports certain sequence
1528
+ operations. To convert it to an ordinary sequence (e.g. for
1529
+ printing), use ``list(im.getdata())``.
1530
+
1531
+ :param band: What band to return. The default is to return
1532
+ all bands. To return a single band, pass in the index
1533
+ value (e.g. 0 to get the "R" band from an "RGB" image).
1534
+ :returns: A sequence-like object.
1535
+ """
1536
+ deprecate("Image.Image.getdata", 14, "get_flattened_data")
1537
+
1538
+ self.load()
1539
+ if band is not None:
1540
+ return self.im.getband(band)
1541
+ return self.im # could be abused
1542
+
1543
+ def get_flattened_data(
1544
+ self, band: int | None = None
1545
+ ) -> tuple[tuple[int, ...], ...] | tuple[float, ...]:
1546
+ """
1547
+ Returns the contents of this image as a tuple containing pixel values.
1548
+ The sequence object is flattened, so that values for line one follow
1549
+ directly after the values of line zero, and so on.
1550
+
1551
+ :param band: What band to return. The default is to return
1552
+ all bands. To return a single band, pass in the index
1553
+ value (e.g. 0 to get the "R" band from an "RGB" image).
1554
+ :returns: A tuple containing pixel values.
1555
+ """
1556
+ self.load()
1557
+ if band is not None:
1558
+ return tuple(self.im.getband(band))
1559
+ return tuple(self.im)
1560
+
1561
+ def getextrema(self) -> tuple[float, float] | tuple[tuple[int, int], ...]:
1562
+ """
1563
+ Gets the minimum and maximum pixel values for each band in
1564
+ the image.
1565
+
1566
+ :returns: For a single-band image, a 2-tuple containing the
1567
+ minimum and maximum pixel value. For a multi-band image,
1568
+ a tuple containing one 2-tuple for each band.
1569
+ """
1570
+
1571
+ self.load()
1572
+ if self.im.bands > 1:
1573
+ return tuple(self.im.getband(i).getextrema() for i in range(self.im.bands))
1574
+ return self.im.getextrema()
1575
+
1576
+ def getxmp(self, *, strip_namespaces: bool = True) -> dict[str, Any]:
1577
+ """
1578
+ Returns a dictionary containing the XMP tags.
1579
+ Requires defusedxml to be installed.
1580
+
1581
+ :param strip_namespaces: If ``False``, keep each tag's full
1582
+ ``{namespace-uri}local-name`` form instead of stripping the namespace
1583
+ prefix.
1584
+
1585
+ .. versionadded:: 13.0.0
1586
+
1587
+ :returns: XMP tags in a dictionary.
1588
+ """
1589
+ try:
1590
+ from defusedxml import ElementTree
1591
+ except ImportError:
1592
+ warnings.warn("XMP data cannot be read without defusedxml dependency")
1593
+ return {}
1594
+
1595
+ if strip_namespaces:
1596
+
1597
+ def get_name(tag: str) -> str:
1598
+ return re.sub("^{[^}]+}", "", tag)
1599
+
1600
+ else:
1601
+
1602
+ def get_name(tag: str) -> str:
1603
+ return tag
1604
+
1605
+ def get_value(element: Element) -> str | dict[str, Any] | None:
1606
+ value: dict[str, Any] = {get_name(k): v for k, v in element.attrib.items()}
1607
+ children = list(element)
1608
+ if children:
1609
+ for child in children:
1610
+ name = get_name(child.tag)
1611
+ child_value = get_value(child)
1612
+ if name in value:
1613
+ if not isinstance(value[name], list):
1614
+ value[name] = [value[name]]
1615
+ value[name].append(child_value)
1616
+ else:
1617
+ value[name] = child_value
1618
+ elif value:
1619
+ if element.text:
1620
+ value["text"] = element.text
1621
+ else:
1622
+ return element.text
1623
+ return value
1624
+
1625
+ if "xmp" not in self.info:
1626
+ return {}
1627
+ root = ElementTree.fromstring(self.info["xmp"].rstrip(b"\x00 "))
1628
+ return {get_name(root.tag): get_value(root)}
1629
+
1630
+ def getexif(self) -> Exif:
1631
+ """
1632
+ Gets EXIF data from the image.
1633
+
1634
+ :returns: an :py:class:`~PIL.Image.Exif` object.
1635
+ """
1636
+ if self._exif is None:
1637
+ self._exif = Exif()
1638
+ elif self._exif._loaded:
1639
+ return self._exif
1640
+ self._exif._loaded = True
1641
+
1642
+ exif_info = self.info.get("exif")
1643
+ if exif_info is None:
1644
+ if "Raw profile type exif" in self.info:
1645
+ exif_info = bytes.fromhex(
1646
+ "".join(self.info["Raw profile type exif"].split("\n")[3:])
1647
+ )
1648
+ elif hasattr(self, "tag_v2"):
1649
+ from . import TiffImagePlugin
1650
+
1651
+ assert isinstance(self, TiffImagePlugin.TiffImageFile)
1652
+ self._exif.bigtiff = self.tag_v2._bigtiff
1653
+ self._exif.endian = self.tag_v2._endian
1654
+
1655
+ assert self.fp is not None
1656
+ self._exif.load_from_fp(self.fp, self.tag_v2._offset)
1657
+ if exif_info is not None:
1658
+ self._exif.load(exif_info)
1659
+
1660
+ # XMP tags
1661
+ if ExifTags.Base.Orientation not in self._exif:
1662
+ xmp_tags = self.info.get("XML:com.adobe.xmp")
1663
+ pattern: str | bytes = r'tiff:Orientation(="|>)([0-9])'
1664
+ if not xmp_tags and (xmp_tags := self.info.get("xmp")):
1665
+ pattern = rb'tiff:Orientation(="|>)([0-9])'
1666
+ if xmp_tags:
1667
+ match = re.search(pattern, xmp_tags)
1668
+ if match:
1669
+ self._exif[ExifTags.Base.Orientation] = int(match[2])
1670
+
1671
+ return self._exif
1672
+
1673
+ def _reload_exif(self) -> None:
1674
+ if self._exif is None or not self._exif._loaded:
1675
+ return
1676
+ self._exif._loaded = False
1677
+ self.getexif()
1678
+
1679
+ def getim(self) -> CapsuleType:
1680
+ """
1681
+ Returns a capsule that points to the internal image memory.
1682
+
1683
+ :returns: A capsule object.
1684
+ """
1685
+
1686
+ self.load()
1687
+ return self.im.ptr
1688
+
1689
+ def getpalette(self, rawmode: str | None = "RGB") -> list[int] | None:
1690
+ """
1691
+ Returns the image palette as a list.
1692
+
1693
+ :param rawmode: The mode in which to return the palette. ``None`` will
1694
+ return the palette in its current mode.
1695
+
1696
+ .. versionadded:: 9.1.0
1697
+
1698
+ :returns: A list of color values [r, g, b, ...], or None if the
1699
+ image has no palette.
1700
+ """
1701
+
1702
+ self.load()
1703
+ try:
1704
+ mode = self.im.getpalettemode()
1705
+ except ValueError:
1706
+ return None # no palette
1707
+ if rawmode is None:
1708
+ rawmode = mode
1709
+ return list(self.im.getpalette(mode, rawmode))
1710
+
1711
+ @property
1712
+ def has_transparency_data(self) -> bool:
1713
+ """
1714
+ Determine if an image has transparency data, whether in the form of an
1715
+ alpha channel, a palette with an alpha channel, or a "transparency" key
1716
+ in the info dictionary.
1717
+
1718
+ Note the image might still appear solid, if all of the values shown
1719
+ within are opaque.
1720
+
1721
+ :returns: A boolean.
1722
+ """
1723
+ if (
1724
+ self.mode in ("LA", "La", "PA", "RGBA", "RGBa")
1725
+ or "transparency" in self.info
1726
+ ):
1727
+ return True
1728
+ if self.mode == "P":
1729
+ assert self.palette is not None
1730
+ return self.palette.mode.endswith("A")
1731
+ return False
1732
+
1733
+ def apply_transparency(self) -> None:
1734
+ """
1735
+ If a P mode image has a "transparency" key in the info dictionary,
1736
+ remove the key and instead apply the transparency to the palette.
1737
+ Otherwise, the image is unchanged.
1738
+ """
1739
+ if self.mode != "P" or "transparency" not in self.info:
1740
+ return
1741
+
1742
+ from . import ImagePalette
1743
+
1744
+ palette = self.getpalette("RGBA")
1745
+ assert palette is not None
1746
+ transparency = self.info["transparency"]
1747
+ if isinstance(transparency, bytes):
1748
+ for i, alpha in enumerate(transparency):
1749
+ palette[i * 4 + 3] = alpha
1750
+ else:
1751
+ palette[transparency * 4 + 3] = 0
1752
+ self.palette = ImagePalette.ImagePalette("RGBA", bytes(palette))
1753
+ self.palette.dirty = 1
1754
+
1755
+ del self.info["transparency"]
1756
+
1757
+ def getpixel(
1758
+ self, xy: tuple[int, int] | list[int]
1759
+ ) -> float | tuple[int, ...] | None:
1760
+ """
1761
+ Returns the pixel value at a given position.
1762
+
1763
+ :param xy: The coordinate, given as (x, y). See
1764
+ :ref:`coordinate-system`.
1765
+ :returns: The pixel value. If the image is a multi-layer image,
1766
+ this method returns a tuple.
1767
+ """
1768
+
1769
+ self.load()
1770
+ return self.im.getpixel(tuple(xy))
1771
+
1772
+ def getprojection(self) -> tuple[list[int], list[int]]:
1773
+ """
1774
+ Get projection to x and y axes
1775
+
1776
+ :returns: Two sequences, indicating where there are non-zero
1777
+ pixels along the X-axis and the Y-axis, respectively.
1778
+ """
1779
+
1780
+ self.load()
1781
+ x, y = self.im.getprojection()
1782
+ return list(x), list(y)
1783
+
1784
+ def histogram(
1785
+ self, mask: Image | None = None, extrema: tuple[float, float] | None = None
1786
+ ) -> list[int]:
1787
+ """
1788
+ Returns a histogram for the image. The histogram is returned as a
1789
+ list of pixel counts, one for each pixel value in the source
1790
+ image. Counts are grouped into 256 bins for each band, even if
1791
+ the image has more than 8 bits per band. If the image has more
1792
+ than one band, the histograms for all bands are concatenated (for
1793
+ example, the histogram for an "RGB" image contains 768 values).
1794
+
1795
+ A bilevel image (mode "1") is treated as a grayscale ("L") image
1796
+ by this method.
1797
+
1798
+ If a mask is provided, the method returns a histogram for those
1799
+ parts of the image where the mask image is non-zero. The mask
1800
+ image must have the same size as the image, and be either a
1801
+ bi-level image (mode "1") or a grayscale image ("L").
1802
+
1803
+ :param mask: An optional mask.
1804
+ :param extrema: An optional tuple of manually-specified extrema.
1805
+ :returns: A list containing pixel counts.
1806
+ """
1807
+ self.load()
1808
+ if mask:
1809
+ mask.load()
1810
+ return self.im.histogram((0, 0), mask.im)
1811
+ if self.mode in ("I", "F"):
1812
+ return self.im.histogram(
1813
+ extrema if extrema is not None else self.getextrema()
1814
+ )
1815
+ return self.im.histogram()
1816
+
1817
+ def entropy(
1818
+ self, mask: Image | None = None, extrema: tuple[float, float] | None = None
1819
+ ) -> float:
1820
+ """
1821
+ Calculates and returns the entropy for the image.
1822
+
1823
+ A bilevel image (mode "1") is treated as a grayscale ("L")
1824
+ image by this method.
1825
+
1826
+ If a mask is provided, the method employs the histogram for
1827
+ those parts of the image where the mask image is non-zero.
1828
+ The mask image must have the same size as the image, and be
1829
+ either a bi-level image (mode "1") or a grayscale image ("L").
1830
+
1831
+ :param mask: An optional mask.
1832
+ :param extrema: An optional tuple of manually-specified extrema.
1833
+ :returns: A float value representing the image entropy
1834
+ """
1835
+ self.load()
1836
+ if mask:
1837
+ mask.load()
1838
+ return self.im.entropy((0, 0), mask.im)
1839
+ if self.mode in ("I", "F"):
1840
+ return self.im.entropy(
1841
+ extrema if extrema is not None else self.getextrema()
1842
+ )
1843
+ return self.im.entropy()
1844
+
1845
+ def paste(
1846
+ self,
1847
+ im: Image | str | float | tuple[float, ...],
1848
+ box: Image | tuple[int, int, int, int] | tuple[int, int] | None = None,
1849
+ mask: Image | None = None,
1850
+ ) -> None:
1851
+ """
1852
+ Pastes another image into this image. The box argument is either
1853
+ a 2-tuple giving the upper left corner, a 4-tuple defining the
1854
+ left, upper, right, and lower pixel coordinate, or None (same as
1855
+ (0, 0)). See :ref:`coordinate-system`. If a 4-tuple is given, the size
1856
+ of the pasted image must match the size of the region.
1857
+
1858
+ If the modes don't match, the pasted image is converted to the mode of
1859
+ this image (see the :py:meth:`~PIL.Image.Image.convert` method for
1860
+ details).
1861
+
1862
+ Instead of an image, the source can be a integer or tuple
1863
+ containing pixel values. The method then fills the region
1864
+ with the given color. When creating RGB images, you can
1865
+ also use color strings as supported by the ImageColor module. See
1866
+ :ref:`colors` for more information.
1867
+
1868
+ If a mask is given, this method updates only the regions
1869
+ indicated by the mask. You can use either "1", "L", "LA", "RGBA"
1870
+ or "RGBa" images (if present, the alpha band is used as mask).
1871
+ Where the mask is 255, the given image is copied as is. Where
1872
+ the mask is 0, the current value is preserved. Intermediate
1873
+ values will mix the two images together, including their alpha
1874
+ channels if they have them.
1875
+
1876
+ See :py:meth:`~PIL.Image.Image.alpha_composite` if you want to
1877
+ combine images with respect to their alpha channels.
1878
+
1879
+ :param im: Source image or pixel value (integer, float or tuple).
1880
+ :param box: An optional 4-tuple giving the region to paste into.
1881
+ If a 2-tuple is used instead, it's treated as the upper left
1882
+ corner. If omitted or None, the source is pasted into the
1883
+ upper left corner.
1884
+
1885
+ If an image is given as the second argument and there is no
1886
+ third, the box defaults to (0, 0), and the second argument
1887
+ is interpreted as a mask image.
1888
+ :param mask: An optional mask image.
1889
+ """
1890
+
1891
+ if isinstance(box, Image):
1892
+ if mask is not None:
1893
+ msg = "If using second argument as mask, third argument must be None"
1894
+ raise ValueError(msg)
1895
+ # abbreviated paste(im, mask) syntax
1896
+ mask = box
1897
+ box = None
1898
+
1899
+ if box is None:
1900
+ box = (0, 0)
1901
+
1902
+ if len(box) == 2:
1903
+ # upper left corner given; get size from image or mask
1904
+ if isinstance(im, Image):
1905
+ size = im.size
1906
+ elif isinstance(mask, Image):
1907
+ size = mask.size
1908
+ else:
1909
+ # FIXME: use self.size here?
1910
+ msg = "cannot determine region size; use 4-item box"
1911
+ raise ValueError(msg)
1912
+ box += (box[0] + size[0], box[1] + size[1])
1913
+
1914
+ source: core.ImagingCore | str | float | tuple[float, ...]
1915
+ if isinstance(im, str):
1916
+ from . import ImageColor
1917
+
1918
+ source = ImageColor.getcolor(im, self.mode)
1919
+ elif isinstance(im, Image):
1920
+ im.load()
1921
+ if self.mode != im.mode:
1922
+ if self.mode != "RGB" or im.mode not in ("LA", "RGBA", "RGBa"):
1923
+ # should use an adapter for this!
1924
+ im = im.convert(self.mode)
1925
+ source = im.im
1926
+ else:
1927
+ source = im
1928
+
1929
+ self._ensure_mutable()
1930
+
1931
+ if mask:
1932
+ mask.load()
1933
+ self.im.paste(source, box, mask.im)
1934
+ else:
1935
+ self.im.paste(source, box)
1936
+
1937
+ def alpha_composite(
1938
+ self, im: Image, dest: Sequence[int] = (0, 0), source: Sequence[int] = (0, 0)
1939
+ ) -> None:
1940
+ """'In-place' analog of Image.alpha_composite. Composites an image
1941
+ onto this image.
1942
+
1943
+ :param im: image to composite over this one
1944
+ :param dest: Optional 2 tuple (left, top) specifying the upper
1945
+ left corner in this (destination) image.
1946
+ :param source: Optional 2 (left, top) tuple for the upper left
1947
+ corner in the overlay source image, or 4 tuple (left, top, right,
1948
+ bottom) for the bounds of the source rectangle
1949
+
1950
+ Performance Note: Not currently implemented in-place in the core layer.
1951
+ """
1952
+
1953
+ if not isinstance(source, (list, tuple)):
1954
+ msg = "Source must be a list or tuple"
1955
+ raise ValueError(msg)
1956
+ if not isinstance(dest, (list, tuple)):
1957
+ msg = "Destination must be a list or tuple"
1958
+ raise ValueError(msg)
1959
+
1960
+ if len(source) == 4:
1961
+ overlay_crop_box = tuple(source)
1962
+ elif len(source) == 2:
1963
+ overlay_crop_box = tuple(source) + im.size
1964
+ else:
1965
+ msg = "Source must be a sequence of length 2 or 4"
1966
+ raise ValueError(msg)
1967
+
1968
+ if not len(dest) == 2:
1969
+ msg = "Destination must be a sequence of length 2"
1970
+ raise ValueError(msg)
1971
+ if min(source) < 0:
1972
+ msg = "Source must be non-negative"
1973
+ raise ValueError(msg)
1974
+
1975
+ # over image, crop if it's not the whole image.
1976
+ if overlay_crop_box == (0, 0, *im.size):
1977
+ overlay = im
1978
+ else:
1979
+ overlay = im.crop(overlay_crop_box)
1980
+
1981
+ # target for the paste
1982
+ box = tuple(dest) + (dest[0] + overlay.width, dest[1] + overlay.height)
1983
+
1984
+ # destination image. don't copy if we're using the whole image.
1985
+ if box == (0, 0, *self.size):
1986
+ background = self
1987
+ else:
1988
+ background = self.crop(box)
1989
+
1990
+ result = alpha_composite(background, overlay)
1991
+ self.paste(result, box)
1992
+
1993
+ def point(
1994
+ self,
1995
+ lut: (
1996
+ Sequence[float]
1997
+ | NumpyArray
1998
+ | Callable[[int], float]
1999
+ | Callable[[ImagePointTransform], ImagePointTransform | float]
2000
+ | ImagePointHandler
2001
+ ),
2002
+ mode: str | None = None,
2003
+ ) -> Image:
2004
+ """
2005
+ Maps this image through a lookup table or function.
2006
+
2007
+ :param lut: A lookup table, containing 256 (or 65536 if
2008
+ self.mode=="I" and mode == "L") values per band in the
2009
+ image. A function can be used instead, it should take a
2010
+ single argument. The function is called once for each
2011
+ possible pixel value, and the resulting table is applied to
2012
+ all bands of the image.
2013
+
2014
+ It may also be an :py:class:`~PIL.Image.ImagePointHandler`
2015
+ object::
2016
+
2017
+ class Example(Image.ImagePointHandler):
2018
+ def point(self, im: Image) -> Image:
2019
+ # Return result
2020
+ :param mode: Output mode (default is same as input). This can only be used if
2021
+ the source image has mode "L" or "P", and the output has mode "1" or the
2022
+ source image mode is "I" and the output mode is "L".
2023
+ :returns: An :py:class:`~PIL.Image.Image` object.
2024
+ """
2025
+
2026
+ self.load()
2027
+
2028
+ if isinstance(lut, ImagePointHandler):
2029
+ return lut.point(self)
2030
+
2031
+ if callable(lut):
2032
+ # if it isn't a list, it should be a function
2033
+ if self.mode in ("I", "I;16", "F"):
2034
+ # check if the function can be used with point_transform
2035
+ # UNDONE wiredfool -- I think this prevents us from ever doing
2036
+ # a gamma function point transform on > 8bit images.
2037
+ scale, offset = _getscaleoffset(lut) # type: ignore[arg-type]
2038
+ return self._new(self.im.point_transform(scale, offset))
2039
+ # for other modes, convert the function to a table
2040
+ flatLut = [lut(i) for i in range(256)] * self.im.bands # type: ignore[arg-type]
2041
+ else:
2042
+ flatLut = lut
2043
+
2044
+ if self.mode == "F":
2045
+ # FIXME: _imaging returns a confusing error message for this case
2046
+ msg = "point operation not supported for this mode"
2047
+ raise ValueError(msg)
2048
+
2049
+ if mode != "F":
2050
+ flatLut = [round(i) for i in flatLut]
2051
+ return self._new(self.im.point(flatLut, mode))
2052
+
2053
+ def putalpha(self, alpha: Image | int) -> None:
2054
+ """
2055
+ Adds or replaces the alpha layer in this image. If the image
2056
+ does not have an alpha layer, it's converted to "LA" or "RGBA".
2057
+ The new layer must be either "L" or "1".
2058
+
2059
+ :param alpha: The new alpha layer. This can either be an "L" or "1"
2060
+ image having the same size as this image, or an integer.
2061
+ """
2062
+
2063
+ self._ensure_mutable()
2064
+
2065
+ if self.mode in ("RGB", "RGBX"):
2066
+ # promote self to RGBA
2067
+ self.im.setalpha()
2068
+ self._mode = "RGBA"
2069
+ elif self.mode not in ("LA", "PA", "RGBA"):
2070
+ try:
2071
+ # do things the hard way
2072
+ mode = getmodebase(self.mode) + "A"
2073
+ im = self.im.convert(mode)
2074
+ if im.mode not in ("LA", "PA", "RGBA"):
2075
+ msg = "alpha channel could not be added"
2076
+ raise ValueError(msg) # sanity check
2077
+ self.im = im
2078
+ self._mode = self.im.mode
2079
+ except KeyError as e:
2080
+ msg = "illegal image mode"
2081
+ raise ValueError(msg) from e
2082
+
2083
+ if self.mode in ("LA", "PA"):
2084
+ band = 1
2085
+ else:
2086
+ band = 3
2087
+
2088
+ if isinstance(alpha, Image):
2089
+ # alpha layer
2090
+ if alpha.mode not in ("1", "L"):
2091
+ msg = "illegal image mode"
2092
+ raise ValueError(msg)
2093
+ alpha.load()
2094
+ if alpha.mode == "1":
2095
+ alpha = alpha.convert("L")
2096
+ else:
2097
+ # constant alpha
2098
+ try:
2099
+ self.im.fillband(band, alpha)
2100
+ except (AttributeError, ValueError):
2101
+ # do things the hard way
2102
+ alpha = new("L", self.size, alpha)
2103
+ else:
2104
+ return
2105
+
2106
+ self.im.putband(alpha.im, band)
2107
+
2108
+ def putdata(
2109
+ self,
2110
+ data: Sequence[float] | Sequence[Sequence[int]] | NumpyArray,
2111
+ scale: float = 1.0,
2112
+ offset: float = 0.0,
2113
+ ) -> None:
2114
+ """
2115
+ Copies pixel data from a flattened sequence object into the image. The
2116
+ values should start at the upper left corner (0, 0), continue to the
2117
+ end of the line, followed directly by the first value of the second
2118
+ line, and so on. Data will be read until either the image or the
2119
+ sequence ends. The scale and offset values are used to adjust the
2120
+ sequence values: **pixel = value*scale + offset**.
2121
+
2122
+ :param data: A flattened sequence object. See :ref:`colors` for more
2123
+ information about values.
2124
+ :param scale: An optional scale value. The default is 1.0.
2125
+ :param offset: An optional offset value. The default is 0.0.
2126
+ """
2127
+
2128
+ self._ensure_mutable()
2129
+
2130
+ self.im.putdata(data, scale, offset)
2131
+
2132
+ def putpalette(
2133
+ self,
2134
+ data: ImagePalette.ImagePalette | bytes | Sequence[int],
2135
+ rawmode: str = "RGB",
2136
+ ) -> None:
2137
+ """
2138
+ Attaches a palette to this image. The image must be a "P", "PA", "L"
2139
+ or "LA" image.
2140
+
2141
+ The palette sequence must contain at most 256 colors, made up of one
2142
+ integer value for each channel in the raw mode.
2143
+ For example, if the raw mode is "RGB", then it can contain at most 768
2144
+ values, made up of red, green and blue values for the corresponding pixel
2145
+ index in the 256 colors.
2146
+ If the raw mode is "RGBA", then it can contain at most 1024 values,
2147
+ containing red, green, blue and alpha values.
2148
+
2149
+ Alternatively, an 8-bit string may be used instead of an integer sequence.
2150
+
2151
+ :param data: A palette sequence (either a list or a string).
2152
+ :param rawmode: The raw mode of the palette. Either "RGB", "RGBA", "CMYK", or a
2153
+ mode that can be transformed to one of those modes (e.g. "R", "RGBA;L").
2154
+ """
2155
+ from . import ImagePalette
2156
+
2157
+ if self.mode not in ("L", "LA", "P", "PA"):
2158
+ msg = "illegal image mode"
2159
+ raise ValueError(msg)
2160
+ if isinstance(data, ImagePalette.ImagePalette):
2161
+ palette = ImagePalette.raw(data.rawmode or "RGB", data.palette)
2162
+ else:
2163
+ palette = ImagePalette.raw(rawmode, data)
2164
+ self._mode = "PA" if "A" in self.mode else "P"
2165
+ self.palette = palette
2166
+ if rawmode.startswith("CMYK"):
2167
+ self.palette.mode = "CMYK"
2168
+ elif "A" in rawmode:
2169
+ self.palette.mode = "RGBA"
2170
+ if self.palette.mode == self.palette.rawmode:
2171
+ self.palette.rawmode = None
2172
+ if self.palette.rawmode or (
2173
+ self._im is not None and self._im.mode != self.mode
2174
+ ):
2175
+ # either raw palette data needs to be decoded,
2176
+ # or the core image needs its mode updated
2177
+ self.load()
2178
+
2179
+ def putpixel(
2180
+ self,
2181
+ xy: tuple[int, int] | list[int],
2182
+ value: float | tuple[int, ...] | list[int],
2183
+ ) -> None:
2184
+ """
2185
+ Modifies the pixel at the given position. The color is given as
2186
+ a single numerical value for single-band images, and a tuple for
2187
+ multi-band images. In addition to this, RGB and RGBA tuples are
2188
+ accepted for P and PA images. See :ref:`colors` for more information.
2189
+
2190
+ Note that this method is relatively slow. For more extensive changes,
2191
+ use :py:meth:`~PIL.Image.Image.paste` or the :py:mod:`~PIL.ImageDraw`
2192
+ module instead.
2193
+
2194
+ See:
2195
+
2196
+ * :py:meth:`~PIL.Image.Image.paste`
2197
+ * :py:meth:`~PIL.Image.Image.putdata`
2198
+ * :py:mod:`~PIL.ImageDraw`
2199
+
2200
+ :param xy: The pixel coordinate, given as (x, y). See
2201
+ :ref:`coordinate-system`.
2202
+ :param value: The pixel value.
2203
+ """
2204
+
2205
+ self._ensure_mutable()
2206
+
2207
+ if (
2208
+ self.mode in ("P", "PA")
2209
+ and isinstance(value, (list, tuple))
2210
+ and len(value) in [3, 4]
2211
+ ):
2212
+ # RGB or RGBA value for a P or PA image
2213
+ if self.mode == "PA":
2214
+ alpha = value[3] if len(value) == 4 else 255
2215
+ value = value[:3]
2216
+ assert self.palette is not None
2217
+ palette_index = self.palette.getcolor(tuple(value), self)
2218
+ value = (palette_index, alpha) if self.mode == "PA" else palette_index
2219
+ return self.im.putpixel(xy, value)
2220
+
2221
+ def remap_palette(
2222
+ self, dest_map: list[int], source_palette: bytes | bytearray | None = None
2223
+ ) -> Image:
2224
+ """
2225
+ Rewrites the image to reorder the palette.
2226
+
2227
+ :param dest_map: A list of indexes into the original palette.
2228
+ e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))``
2229
+ is the identity transform.
2230
+ :param source_palette: Bytes or None.
2231
+ :returns: An :py:class:`~PIL.Image.Image` object.
2232
+
2233
+ """
2234
+ from . import ImagePalette
2235
+
2236
+ if self.mode not in ("L", "P"):
2237
+ msg = "illegal image mode"
2238
+ raise ValueError(msg)
2239
+
2240
+ bands = 3
2241
+ palette_mode = "RGB"
2242
+ if source_palette is None:
2243
+ if self.mode == "P":
2244
+ self.load()
2245
+ palette_mode = self.im.getpalettemode()
2246
+ if palette_mode == "RGBA":
2247
+ bands = 4
2248
+ source_palette = self.im.getpalette(palette_mode)
2249
+ else: # L-mode
2250
+ source_palette = bytearray(i // 3 for i in range(768))
2251
+ elif len(source_palette) > 768:
2252
+ bands = 4
2253
+ palette_mode = "RGBA"
2254
+
2255
+ palette_bytes = b""
2256
+ new_positions = [0] * 256
2257
+
2258
+ # pick only the used colors from the palette
2259
+ for i, oldPosition in enumerate(dest_map):
2260
+ palette_bytes += source_palette[
2261
+ oldPosition * bands : oldPosition * bands + bands
2262
+ ]
2263
+ new_positions[oldPosition] = i
2264
+
2265
+ # replace the palette color id of all pixel with the new id
2266
+
2267
+ # Palette images are [0..255], mapped through a 1 or 3
2268
+ # byte/color map. We need to remap the whole image
2269
+ # from palette 1 to palette 2. New_positions is
2270
+ # an array of indexes into palette 1. Palette 2 is
2271
+ # palette 1 with any holes removed.
2272
+
2273
+ # We're going to leverage the convert mechanism to use the
2274
+ # C code to remap the image from palette 1 to palette 2,
2275
+ # by forcing the source image into 'L' mode and adding a
2276
+ # mapping 'L' mode palette, then converting back to 'L'
2277
+ # sans palette thus converting the image bytes, then
2278
+ # assigning the optimized RGB palette.
2279
+
2280
+ # perf reference, 9500x4000 gif, w/~135 colors
2281
+ # 14 sec prepatch, 1 sec postpatch with optimization forced.
2282
+
2283
+ mapping_palette = bytearray(new_positions)
2284
+
2285
+ m_im = self.copy()
2286
+ m_im._mode = "P"
2287
+
2288
+ m_im.palette = ImagePalette.ImagePalette(
2289
+ palette_mode, palette=mapping_palette * bands
2290
+ )
2291
+ # possibly set palette dirty, then
2292
+ # m_im.putpalette(mapping_palette, 'L') # converts to 'P'
2293
+ # or just force it.
2294
+ # UNDONE -- this is part of the general issue with palettes
2295
+ m_im.im.putpalette(palette_mode, palette_mode + ";L", m_im.palette.tobytes())
2296
+
2297
+ m_im = m_im.convert("L")
2298
+
2299
+ m_im.putpalette(palette_bytes, palette_mode)
2300
+
2301
+ if "transparency" in self.info:
2302
+ try:
2303
+ m_im.info["transparency"] = dest_map.index(self.info["transparency"])
2304
+ except ValueError:
2305
+ if "transparency" in m_im.info:
2306
+ del m_im.info["transparency"]
2307
+
2308
+ return m_im
2309
+
2310
+ def _get_safe_box(
2311
+ self,
2312
+ size: tuple[int, int],
2313
+ resample: Resampling,
2314
+ box: tuple[float, float, float, float],
2315
+ ) -> tuple[int, int, int, int]:
2316
+ """Expands the box so it includes adjacent pixels
2317
+ that may be used by resampling with the given resampling filter.
2318
+ """
2319
+ filter_support = _filters_support[resample] - 0.5
2320
+ scale_x = (box[2] - box[0]) / size[0]
2321
+ scale_y = (box[3] - box[1]) / size[1]
2322
+ support_x = filter_support * scale_x
2323
+ support_y = filter_support * scale_y
2324
+
2325
+ return (
2326
+ max(0, int(box[0] - support_x)),
2327
+ max(0, int(box[1] - support_y)),
2328
+ min(self.size[0], math.ceil(box[2] + support_x)),
2329
+ min(self.size[1], math.ceil(box[3] + support_y)),
2330
+ )
2331
+
2332
+ def resize(
2333
+ self,
2334
+ size: tuple[int, int] | list[int] | NumpyArray,
2335
+ resample: int | None = None,
2336
+ box: tuple[float, float, float, float] | None = None,
2337
+ reducing_gap: float | None = None,
2338
+ ) -> Image:
2339
+ """
2340
+ Returns a resized copy of this image.
2341
+
2342
+ :param size: The requested size in pixels, as a tuple or array:
2343
+ (width, height).
2344
+ :param resample: An optional resampling filter. This can be
2345
+ one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
2346
+ :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
2347
+ :py:data:`Resampling.BICUBIC`, :py:data:`Resampling.LANCZOS`,
2348
+ :py:data:`Resampling.MKS2013`, or :py:data:`Resampling.MKS2021`.
2349
+ If the image has mode "1" or "P", it is always set to
2350
+ :py:data:`Resampling.NEAREST`. Otherwise, the default filter is
2351
+ :py:data:`Resampling.BICUBIC`. See: :ref:`concept-filters`.
2352
+ :param box: An optional 4-tuple of floats providing
2353
+ the source image region to be scaled.
2354
+ The values must be within (0, 0, width, height) rectangle.
2355
+ If omitted or None, the entire source is used.
2356
+ :param reducing_gap: Apply optimization by resizing the image
2357
+ in two steps. First, reducing the image by integer times
2358
+ using :py:meth:`~PIL.Image.Image.reduce`.
2359
+ Second, resizing using regular resampling. The last step
2360
+ changes size no less than by ``reducing_gap`` times.
2361
+ ``reducing_gap`` may be None (no first step is performed)
2362
+ or should be greater than 1.0. The bigger ``reducing_gap``,
2363
+ the closer the result to the fair resampling.
2364
+ The smaller ``reducing_gap``, the faster resizing.
2365
+ With ``reducing_gap`` greater or equal to 3.0, the result is
2366
+ indistinguishable from fair resampling in most cases.
2367
+ The default value is None (no optimization).
2368
+ :returns: An :py:class:`~PIL.Image.Image` object.
2369
+ """
2370
+
2371
+ if resample is None:
2372
+ resample = Resampling.BICUBIC
2373
+ elif resample not in (
2374
+ Resampling.NEAREST,
2375
+ Resampling.BILINEAR,
2376
+ Resampling.BICUBIC,
2377
+ Resampling.LANCZOS,
2378
+ Resampling.BOX,
2379
+ Resampling.HAMMING,
2380
+ Resampling.MKS2013,
2381
+ Resampling.MKS2021,
2382
+ ):
2383
+ msg = f"Unknown resampling filter ({resample})."
2384
+
2385
+ filters = [
2386
+ f"{filter[1]} ({filter[0]})"
2387
+ for filter in (
2388
+ (Resampling.NEAREST, "Image.Resampling.NEAREST"),
2389
+ (Resampling.LANCZOS, "Image.Resampling.LANCZOS"),
2390
+ (Resampling.BILINEAR, "Image.Resampling.BILINEAR"),
2391
+ (Resampling.BICUBIC, "Image.Resampling.BICUBIC"),
2392
+ (Resampling.BOX, "Image.Resampling.BOX"),
2393
+ (Resampling.HAMMING, "Image.Resampling.HAMMING"),
2394
+ (Resampling.MKS2013, "Image.Resampling.MKS2013"),
2395
+ (Resampling.MKS2021, "Image.Resampling.MKS2021"),
2396
+ )
2397
+ ]
2398
+ msg += f" Use {', '.join(filters[:-1])} or {filters[-1]}"
2399
+ raise ValueError(msg)
2400
+
2401
+ if reducing_gap is not None and reducing_gap < 1.0:
2402
+ msg = "reducing_gap must be 1.0 or greater"
2403
+ raise ValueError(msg)
2404
+
2405
+ if box is None:
2406
+ box = (0, 0, *self.size)
2407
+
2408
+ size = tuple(size)
2409
+ if self.size == size and box == (0, 0, *self.size):
2410
+ return self.copy()
2411
+
2412
+ if self.mode in ("1", "P"):
2413
+ resample = Resampling.NEAREST
2414
+
2415
+ if self.mode in ["LA", "RGBA"] and resample != Resampling.NEAREST:
2416
+ im = self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode])
2417
+ im = im.resize(size, resample, box, reducing_gap)
2418
+ return im.convert(self.mode)
2419
+
2420
+ self.load()
2421
+
2422
+ if reducing_gap is not None and resample != Resampling.NEAREST:
2423
+ factor_x = int((box[2] - box[0]) / size[0] / reducing_gap) or 1
2424
+ factor_y = int((box[3] - box[1]) / size[1] / reducing_gap) or 1
2425
+ if factor_x > 1 or factor_y > 1:
2426
+ reduce_box = self._get_safe_box(size, cast("Resampling", resample), box)
2427
+ factor = (factor_x, factor_y)
2428
+ self = (
2429
+ self.reduce(factor, box=reduce_box)
2430
+ if callable(self.reduce)
2431
+ else Image.reduce(self, factor, box=reduce_box)
2432
+ )
2433
+ box = (
2434
+ (box[0] - reduce_box[0]) / factor_x,
2435
+ (box[1] - reduce_box[1]) / factor_y,
2436
+ (box[2] - reduce_box[0]) / factor_x,
2437
+ (box[3] - reduce_box[1]) / factor_y,
2438
+ )
2439
+
2440
+ return self._new(self.im.resize(size, resample, box))
2441
+
2442
+ def reduce(
2443
+ self,
2444
+ factor: int | tuple[int, int],
2445
+ box: tuple[int, int, int, int] | None = None,
2446
+ ) -> Image:
2447
+ """
2448
+ Returns a copy of the image reduced ``factor`` times.
2449
+ If the size of the image is not dividable by ``factor``,
2450
+ the resulting size will be rounded up.
2451
+
2452
+ :param factor: A greater than 0 integer or tuple of two integers
2453
+ for width and height separately.
2454
+ :param box: An optional 4-tuple of ints providing
2455
+ the source image region to be reduced.
2456
+ The values must be within ``(0, 0, width, height)`` rectangle.
2457
+ If omitted or ``None``, the entire source is used.
2458
+ """
2459
+ if not isinstance(factor, (list, tuple)):
2460
+ factor = (factor, factor)
2461
+
2462
+ if factor == (1, 1):
2463
+ return self.crop(box)
2464
+
2465
+ if box is None:
2466
+ box = (0, 0, *self.size)
2467
+
2468
+ if self.mode in ["LA", "RGBA"]:
2469
+ im = self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode])
2470
+ im = im.reduce(factor, box)
2471
+ return im.convert(self.mode)
2472
+
2473
+ self.load()
2474
+
2475
+ return self._new(self.im.reduce(factor, box))
2476
+
2477
+ def rotate(
2478
+ self,
2479
+ angle: float,
2480
+ resample: Resampling = Resampling.NEAREST,
2481
+ expand: int | bool = False,
2482
+ center: tuple[float, float] | None = None,
2483
+ translate: tuple[int, int] | None = None,
2484
+ fillcolor: float | tuple[float, ...] | str | None = None,
2485
+ ) -> Image:
2486
+ """
2487
+ Returns a rotated copy of this image. This method returns a
2488
+ copy of this image, rotated the given number of degrees counter
2489
+ clockwise around its centre.
2490
+
2491
+ :param angle: In degrees counterclockwise.
2492
+ :param resample: An optional resampling filter. This can be
2493
+ one of :py:data:`Resampling.NEAREST` (use nearest neighbour),
2494
+ :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2
2495
+ environment), or :py:data:`Resampling.BICUBIC` (cubic spline
2496
+ interpolation in a 4x4 environment). If omitted, or if the image has
2497
+ mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`.
2498
+ See :ref:`concept-filters`.
2499
+ :param expand: Optional expansion flag. If true, expands the output
2500
+ image to make it large enough to hold the entire rotated image.
2501
+ If false or omitted, make the output image the same size as the
2502
+ input image. Note that the expand flag assumes rotation around
2503
+ the center and no translation.
2504
+ :param center: Optional center of rotation (a 2-tuple). Origin is
2505
+ the upper left corner. Default is the center of the image.
2506
+ :param translate: An optional post-rotate translation (a 2-tuple).
2507
+ :param fillcolor: An optional color for area outside the rotated image.
2508
+ :returns: An :py:class:`~PIL.Image.Image` object.
2509
+ """
2510
+
2511
+ angle = angle % 360.0
2512
+
2513
+ # Fast paths regardless of filter, as long as we're not
2514
+ # translating or changing the center.
2515
+ if not (center or translate):
2516
+ if angle == 0:
2517
+ return self.copy()
2518
+ if angle == 180:
2519
+ return self.transpose(Transpose.ROTATE_180)
2520
+ if angle in (90, 270) and (expand or self.width == self.height):
2521
+ return self.transpose(
2522
+ Transpose.ROTATE_90 if angle == 90 else Transpose.ROTATE_270
2523
+ )
2524
+
2525
+ # Calculate the affine matrix. Note that this is the reverse
2526
+ # transformation (from destination image to source) because we
2527
+ # want to interpolate the (discrete) destination pixel from
2528
+ # the local area around the (floating) source pixel.
2529
+
2530
+ # The matrix we actually want (note that it operates from the right):
2531
+ # (1, 0, tx) (1, 0, cx) ( cos a, sin a, 0) (1, 0, -cx)
2532
+ # (0, 1, ty) * (0, 1, cy) * (-sin a, cos a, 0) * (0, 1, -cy)
2533
+ # (0, 0, 1) (0, 0, 1) ( 0, 0, 1) (0, 0, 1)
2534
+
2535
+ # The reverse matrix is thus:
2536
+ # (1, 0, cx) ( cos -a, sin -a, 0) (1, 0, -cx) (1, 0, -tx)
2537
+ # (0, 1, cy) * (-sin -a, cos -a, 0) * (0, 1, -cy) * (0, 1, -ty)
2538
+ # (0, 0, 1) ( 0, 0, 1) (0, 0, 1) (0, 0, 1)
2539
+
2540
+ # In any case, the final translation may be updated at the end to
2541
+ # compensate for the expand flag.
2542
+
2543
+ w, h = self.size
2544
+
2545
+ if translate is None:
2546
+ post_trans = (0, 0)
2547
+ else:
2548
+ post_trans = translate
2549
+ if center is None:
2550
+ center = (w / 2, h / 2)
2551
+
2552
+ angle = -math.radians(angle)
2553
+ matrix = [
2554
+ round(math.cos(angle), 15),
2555
+ round(math.sin(angle), 15),
2556
+ 0.0,
2557
+ round(-math.sin(angle), 15),
2558
+ round(math.cos(angle), 15),
2559
+ 0.0,
2560
+ ]
2561
+
2562
+ def transform(x: float, y: float, matrix: list[float]) -> tuple[float, float]:
2563
+ a, b, c, d, e, f = matrix
2564
+ return a * x + b * y + c, d * x + e * y + f
2565
+
2566
+ matrix[2], matrix[5] = transform(
2567
+ -center[0] - post_trans[0], -center[1] - post_trans[1], matrix
2568
+ )
2569
+ matrix[2] += center[0]
2570
+ matrix[5] += center[1]
2571
+
2572
+ if expand:
2573
+ # calculate output size
2574
+ xx = []
2575
+ yy = []
2576
+ for x, y in ((0, 0), (w, 0), (w, h), (0, h)):
2577
+ transformed_x, transformed_y = transform(x, y, matrix)
2578
+ xx.append(transformed_x)
2579
+ yy.append(transformed_y)
2580
+ nw = math.ceil(max(xx)) - math.floor(min(xx))
2581
+ nh = math.ceil(max(yy)) - math.floor(min(yy))
2582
+
2583
+ # We multiply a translation matrix from the right. Because of its
2584
+ # special form, this is the same as taking the image of the
2585
+ # translation vector as new translation vector.
2586
+ matrix[2], matrix[5] = transform(-(nw - w) / 2.0, -(nh - h) / 2.0, matrix)
2587
+ w, h = nw, nh
2588
+
2589
+ return self.transform(
2590
+ (w, h), Transform.AFFINE, matrix, resample, fillcolor=fillcolor
2591
+ )
2592
+
2593
+ def save(
2594
+ self, fp: StrOrBytesPath | IO[bytes], format: str | None = None, **params: Any
2595
+ ) -> None:
2596
+ """
2597
+ Saves this image under the given filename. If no format is
2598
+ specified, the format to use is determined from the filename
2599
+ extension, if possible.
2600
+
2601
+ Keyword options can be used to provide additional instructions
2602
+ to the writer. If a writer doesn't recognise an option, it is
2603
+ silently ignored. The available options are described in the
2604
+ :doc:`image format documentation
2605
+ <../handbook/image-file-formats>` for each writer.
2606
+
2607
+ You can use a file object instead of a filename. In this case,
2608
+ you must always specify the format. The file object must
2609
+ implement the ``seek``, ``tell``, and ``write``
2610
+ methods, and be opened in binary mode.
2611
+
2612
+ :param fp: A filename (string), os.PathLike object or file object.
2613
+ :param format: Optional format override. If omitted, the
2614
+ format to use is determined from the filename extension.
2615
+ If a file object was used instead of a filename, this
2616
+ parameter should always be used.
2617
+ :param params: Extra parameters to the image writer. These can also be
2618
+ set on the image itself through ``encoderinfo``. This is useful when
2619
+ saving multiple images::
2620
+
2621
+ # Saving XMP data to a single image
2622
+ from PIL import Image
2623
+ red = Image.new("RGB", (1, 1), "#f00")
2624
+ red.save("out.mpo", xmp=b"test")
2625
+
2626
+ # Saving XMP data to the second frame of an image
2627
+ from PIL import Image
2628
+ black = Image.new("RGB", (1, 1))
2629
+ red = Image.new("RGB", (1, 1), "#f00")
2630
+ red.encoderinfo = {"xmp": b"test"}
2631
+ black.save("out.mpo", save_all=True, append_images=[red])
2632
+ :returns: None
2633
+ :exception ValueError: If the output format could not be determined
2634
+ from the file name. Use the format option to solve this.
2635
+ :exception OSError: If the file could not be written. The file
2636
+ may have been created, and may contain partial data.
2637
+ """
2638
+
2639
+ filename: str | bytes = ""
2640
+ open_fp = False
2641
+ if is_path(fp):
2642
+ filename = os.fspath(fp)
2643
+ open_fp = True
2644
+ elif fp == sys.stdout and isinstance(sys.stdout, io.TextIOWrapper):
2645
+ fp = sys.stdout.buffer
2646
+ if not filename and hasattr(fp, "name") and is_path(fp.name):
2647
+ # only set the name for metadata purposes
2648
+ filename = os.fspath(fp.name)
2649
+
2650
+ if format:
2651
+ preinit()
2652
+ else:
2653
+ filename_ext = os.path.splitext(filename)[1].lower()
2654
+ ext = (
2655
+ filename_ext.decode()
2656
+ if isinstance(filename_ext, bytes)
2657
+ else filename_ext
2658
+ )
2659
+
2660
+ # Try importing only the plugin for this extension first
2661
+ if not _import_plugin_for_extension(ext):
2662
+ preinit()
2663
+
2664
+ if ext not in EXTENSION:
2665
+ init()
2666
+ try:
2667
+ format = EXTENSION[ext]
2668
+ except KeyError as e:
2669
+ msg = f"unknown file extension: {ext}"
2670
+ raise ValueError(msg) from e
2671
+
2672
+ from . import ImageFile
2673
+
2674
+ # may mutate self!
2675
+ if isinstance(self, ImageFile.ImageFile) and os.path.abspath(
2676
+ filename
2677
+ ) == os.path.abspath(self.filename):
2678
+ self._ensure_mutable()
2679
+ else:
2680
+ self.load()
2681
+
2682
+ save_all = params.pop("save_all", None)
2683
+ self._default_encoderinfo = params
2684
+ encoderinfo = getattr(self, "encoderinfo", {})
2685
+ self._attach_default_encoderinfo(self)
2686
+ self.encoderconfig: tuple[Any, ...] = ()
2687
+
2688
+ if format.upper() not in SAVE:
2689
+ init()
2690
+ if save_all or (
2691
+ save_all is None
2692
+ and params.get("append_images")
2693
+ and format.upper() in SAVE_ALL
2694
+ ):
2695
+ save_handler = SAVE_ALL[format.upper()]
2696
+ else:
2697
+ save_handler = SAVE[format.upper()]
2698
+
2699
+ created = False
2700
+ if open_fp:
2701
+ created = not os.path.exists(filename)
2702
+ if params.get("append", False):
2703
+ # Open also for reading ("+"), because TIFF save_all
2704
+ # writer needs to go back and edit the written data.
2705
+ fp = builtins.open(filename, "r+b")
2706
+ else:
2707
+ fp = builtins.open(filename, "w+b")
2708
+ else:
2709
+ fp = cast("IO[bytes]", fp)
2710
+
2711
+ try:
2712
+ save_handler(self, fp, filename)
2713
+ except Exception:
2714
+ if open_fp:
2715
+ fp.close()
2716
+ if created:
2717
+ try:
2718
+ os.remove(filename)
2719
+ except PermissionError:
2720
+ pass
2721
+ raise
2722
+ finally:
2723
+ self.encoderinfo = encoderinfo
2724
+ if open_fp:
2725
+ fp.close()
2726
+
2727
+ def _attach_default_encoderinfo(self, im: Image) -> dict[str, Any]:
2728
+ encoderinfo = getattr(self, "encoderinfo", {})
2729
+ self.encoderinfo = {**im._default_encoderinfo, **encoderinfo}
2730
+ return encoderinfo
2731
+
2732
+ def seek(self, frame: int) -> None:
2733
+ """
2734
+ Seeks to the given frame in this sequence file. If you seek
2735
+ beyond the end of the sequence, the method raises an
2736
+ ``EOFError`` exception. When a sequence file is opened, the
2737
+ library automatically seeks to frame 0.
2738
+
2739
+ See :py:meth:`~PIL.Image.Image.tell`.
2740
+
2741
+ If defined, :attr:`~PIL.Image.Image.n_frames` refers to the
2742
+ number of available frames.
2743
+
2744
+ :param frame: Frame number, starting at 0.
2745
+ :exception EOFError: If the call attempts to seek beyond the end
2746
+ of the sequence.
2747
+ """
2748
+
2749
+ # overridden by file handlers
2750
+ if frame != self.tell():
2751
+ # The file handler likely did not override this method
2752
+ msg = "no more images in file"
2753
+ raise EOFError(msg)
2754
+
2755
+ if self._im is not None and (
2756
+ self.im.size != self.size or self.im.mode != self.mode
2757
+ ):
2758
+ self._im = None
2759
+
2760
+ def show(self, title: str | None = None) -> None:
2761
+ """
2762
+ Displays this image. This method is mainly intended for debugging purposes.
2763
+
2764
+ This method calls :py:func:`PIL.ImageShow.show` internally. You can use
2765
+ :py:func:`PIL.ImageShow.register` to override its default behaviour.
2766
+
2767
+ The image is first saved to a temporary file. By default, it will be in
2768
+ PNG format.
2769
+
2770
+ On Unix, the image is then opened using the **xdg-open**, **display**,
2771
+ **gm**, **eog** or **xv** utility, depending on which one can be found.
2772
+
2773
+ On macOS, the image is opened with the native Preview application.
2774
+
2775
+ On Windows, the image is opened with the standard PNG display utility.
2776
+
2777
+ :param title: Optional title to use for the image window, where possible.
2778
+ """
2779
+
2780
+ from . import ImageShow
2781
+
2782
+ ImageShow.show(self, title)
2783
+
2784
+ def split(self) -> tuple[Image, ...]:
2785
+ """
2786
+ Split this image into individual bands. This method returns a
2787
+ tuple of individual image bands from an image. For example,
2788
+ splitting an "RGB" image creates three new images each
2789
+ containing a copy of one of the original bands (red, green,
2790
+ blue).
2791
+
2792
+ If you need only one band, :py:meth:`~PIL.Image.Image.getchannel`
2793
+ method can be more convenient and faster.
2794
+
2795
+ :returns: A tuple containing bands.
2796
+ """
2797
+
2798
+ self.load()
2799
+ if self.im.bands == 1:
2800
+ return (self.copy(),)
2801
+ return tuple(map(self._new, self.im.split()))
2802
+
2803
+ def getchannel(self, channel: int | str) -> Image:
2804
+ """
2805
+ Returns an image containing a single channel of the source image.
2806
+
2807
+ :param channel: What channel to return. Could be index
2808
+ (0 for "R" channel of "RGB") or channel name
2809
+ ("A" for alpha channel of "RGBA").
2810
+ :returns: An image in "L" mode.
2811
+
2812
+ .. versionadded:: 4.3.0
2813
+ """
2814
+ self.load()
2815
+
2816
+ if isinstance(channel, str):
2817
+ try:
2818
+ channel = self.getbands().index(channel)
2819
+ except ValueError as e:
2820
+ msg = f'The image has no channel "{channel}"'
2821
+ raise ValueError(msg) from e
2822
+
2823
+ return self._new(self.im.getband(channel))
2824
+
2825
+ def tell(self) -> int:
2826
+ """
2827
+ Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`.
2828
+
2829
+ If defined, :attr:`~PIL.Image.Image.n_frames` refers to the
2830
+ number of available frames.
2831
+
2832
+ :returns: Frame number, starting with 0.
2833
+ """
2834
+ return 0
2835
+
2836
+ def thumbnail(
2837
+ self,
2838
+ size: tuple[float, float],
2839
+ resample: Resampling = Resampling.BICUBIC,
2840
+ reducing_gap: float | None = 2.0,
2841
+ ) -> None:
2842
+ """
2843
+ Make this image into a thumbnail. This method modifies the
2844
+ image to contain a thumbnail version of itself, no larger than
2845
+ the given size. This method calculates an appropriate thumbnail
2846
+ size to preserve the aspect of the image, calls the
2847
+ :py:meth:`~PIL.Image.Image.draft` method to configure the file reader
2848
+ (where applicable), and finally resizes the image.
2849
+
2850
+ Note that this function modifies the :py:class:`~PIL.Image.Image`
2851
+ object in place. If you need to use the full resolution image as well,
2852
+ apply this method to a :py:meth:`~PIL.Image.Image.copy` of the original
2853
+ image.
2854
+
2855
+ :param size: The requested size in pixels, as a 2-tuple:
2856
+ (width, height).
2857
+ :param resample: Optional resampling filter. This can be one
2858
+ of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
2859
+ :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
2860
+ :py:data:`Resampling.BICUBIC`, :py:data:`Resampling.LANCZOS`,
2861
+ :py:data:`Resampling.MKS2013`, or :py:data:`Resampling.MKS2021`.
2862
+ If omitted, it defaults to :py:data:`Resampling.BICUBIC`.
2863
+ (was :py:data:`Resampling.NEAREST` prior to version 2.5.0).
2864
+ See: :ref:`concept-filters`.
2865
+ :param reducing_gap: Apply optimization by resizing the image
2866
+ in two steps. First, reducing the image by integer times
2867
+ using :py:meth:`~PIL.Image.Image.reduce` or
2868
+ :py:meth:`~PIL.Image.Image.draft` for JPEG images.
2869
+ Second, resizing using regular resampling. The last step
2870
+ changes size no less than by ``reducing_gap`` times.
2871
+ ``reducing_gap`` may be None (no first step is performed)
2872
+ or should be greater than 1.0. The bigger ``reducing_gap``,
2873
+ the closer the result to the fair resampling.
2874
+ The smaller ``reducing_gap``, the faster resizing.
2875
+ With ``reducing_gap`` greater or equal to 3.0, the result is
2876
+ indistinguishable from fair resampling in most cases.
2877
+ The default value is 2.0 (very close to fair resampling
2878
+ while still being faster in many cases).
2879
+ :returns: None
2880
+ """
2881
+
2882
+ provided_size = tuple(map(math.floor, size))
2883
+
2884
+ def preserve_aspect_ratio() -> tuple[int, int] | None:
2885
+ def round_aspect(number: float, key: Callable[[int], float]) -> int:
2886
+ return max(min(math.floor(number), math.ceil(number), key=key), 1)
2887
+
2888
+ x, y = provided_size
2889
+ if x >= self.width and y >= self.height:
2890
+ return None
2891
+
2892
+ aspect = self.width / self.height
2893
+ if x / y >= aspect:
2894
+ x = round_aspect(y * aspect, key=lambda n: abs(aspect - n / y))
2895
+ else:
2896
+ y = round_aspect(
2897
+ x / aspect, key=lambda n: 0 if n == 0 else abs(aspect - x / n)
2898
+ )
2899
+ return x, y
2900
+
2901
+ preserved_size = preserve_aspect_ratio()
2902
+ if preserved_size is None:
2903
+ return
2904
+ final_size = preserved_size
2905
+
2906
+ box = None
2907
+ if reducing_gap is not None:
2908
+ res = self.draft(
2909
+ None, (int(size[0] * reducing_gap), int(size[1] * reducing_gap))
2910
+ )
2911
+ if res is not None:
2912
+ box = res[1]
2913
+
2914
+ if self.size != final_size:
2915
+ im = self.resize(final_size, resample, box=box, reducing_gap=reducing_gap)
2916
+
2917
+ self.im = im.im
2918
+ self._size = final_size
2919
+ self._mode = self.im.mode
2920
+
2921
+ self.readonly = 0
2922
+
2923
+ # FIXME: the different transform methods need further explanation
2924
+ # instead of bloating the method docs, add a separate chapter.
2925
+ def transform(
2926
+ self,
2927
+ size: tuple[int, int],
2928
+ method: Transform | ImageTransformHandler | SupportsGetData,
2929
+ data: Sequence[Any] | None = None,
2930
+ resample: int = Resampling.NEAREST,
2931
+ fill: int = 1,
2932
+ fillcolor: float | tuple[float, ...] | str | None = None,
2933
+ ) -> Image:
2934
+ """
2935
+ Transforms this image. This method creates a new image with the
2936
+ given size, and the same mode as the original, and copies data
2937
+ to the new image using the given transform.
2938
+
2939
+ :param size: The output size in pixels, as a 2-tuple:
2940
+ (width, height).
2941
+ :param method: The transformation method. This is one of
2942
+ :py:data:`Transform.EXTENT` (cut out a rectangular subregion),
2943
+ :py:data:`Transform.AFFINE` (affine transform),
2944
+ :py:data:`Transform.PERSPECTIVE` (perspective transform),
2945
+ :py:data:`Transform.QUAD` (map a quadrilateral to a rectangle), or
2946
+ :py:data:`Transform.MESH` (map a number of source quadrilaterals
2947
+ in one operation).
2948
+
2949
+ It may also be an :py:class:`~PIL.Image.ImageTransformHandler`
2950
+ object::
2951
+
2952
+ class Example(Image.ImageTransformHandler):
2953
+ def transform(self, size, data, resample, fill=1):
2954
+ # Return result
2955
+
2956
+ Implementations of :py:class:`~PIL.Image.ImageTransformHandler`
2957
+ for some of the :py:class:`Transform` methods are provided
2958
+ in :py:mod:`~PIL.ImageTransform`.
2959
+
2960
+ It may also be an object with a ``method.getdata`` method
2961
+ that returns a tuple supplying new ``method`` and ``data`` values::
2962
+
2963
+ class Example:
2964
+ def getdata(self):
2965
+ method = Image.Transform.EXTENT
2966
+ data = (0, 0, 100, 100)
2967
+ return method, data
2968
+ :param data: Extra data to the transformation method.
2969
+ :param resample: Optional resampling filter. It can be one of
2970
+ :py:data:`Resampling.NEAREST` (use nearest neighbour),
2971
+ :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2
2972
+ environment), or :py:data:`Resampling.BICUBIC` (cubic spline
2973
+ interpolation in a 4x4 environment). If omitted, or if the image
2974
+ has mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`.
2975
+ See: :ref:`concept-filters`.
2976
+ :param fill: If ``method`` is an
2977
+ :py:class:`~PIL.Image.ImageTransformHandler` object, this is one of
2978
+ the arguments passed to it. Otherwise, it is unused.
2979
+ :param fillcolor: Optional fill color for the area outside the
2980
+ transform in the output image.
2981
+ :returns: An :py:class:`~PIL.Image.Image` object.
2982
+ """
2983
+
2984
+ if self.mode in ("LA", "RGBA") and resample != Resampling.NEAREST:
2985
+ return (
2986
+ self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode])
2987
+ .transform(size, method, data, resample, fill, fillcolor)
2988
+ .convert(self.mode)
2989
+ )
2990
+
2991
+ if isinstance(method, ImageTransformHandler):
2992
+ return method.transform(size, self, resample=resample, fill=fill)
2993
+
2994
+ if hasattr(method, "getdata"):
2995
+ # compatibility w. old-style transform objects
2996
+ method, data = method.getdata()
2997
+
2998
+ if data is None:
2999
+ msg = "missing method data"
3000
+ raise ValueError(msg)
3001
+
3002
+ im = new(self.mode, size, fillcolor)
3003
+ if self.mode in ("P", "PA") and self.palette:
3004
+ im.palette = self.palette.copy()
3005
+ im.info = self._copy_info()
3006
+ if method == Transform.MESH:
3007
+ # list of quads
3008
+ for box, quad in data:
3009
+ im.__transformer(
3010
+ box, self, Transform.QUAD, quad, resample, fillcolor is None
3011
+ )
3012
+ else:
3013
+ im.__transformer(
3014
+ (0, 0, *size), self, method, data, resample, fillcolor is None
3015
+ )
3016
+
3017
+ return im
3018
+
3019
+ def __transformer(
3020
+ self,
3021
+ box: tuple[int, int, int, int],
3022
+ image: Image,
3023
+ method: Transform,
3024
+ data: Sequence[float],
3025
+ resample: int = Resampling.NEAREST,
3026
+ fill: bool = True,
3027
+ ) -> None:
3028
+ w = box[2] - box[0]
3029
+ h = box[3] - box[1]
3030
+
3031
+ if method == Transform.AFFINE:
3032
+ data = data[:6]
3033
+
3034
+ elif method == Transform.EXTENT:
3035
+ # convert extent to an affine transform
3036
+ x0, y0, x1, y1 = data
3037
+ xs = (x1 - x0) / w
3038
+ ys = (y1 - y0) / h
3039
+ method = Transform.AFFINE
3040
+ data = (xs, 0, x0, 0, ys, y0)
3041
+
3042
+ elif method == Transform.PERSPECTIVE:
3043
+ data = data[:8]
3044
+
3045
+ elif method == Transform.QUAD:
3046
+ # quadrilateral warp. data specifies the four corners
3047
+ # given as NW, SW, SE, and NE.
3048
+ nw = data[:2]
3049
+ sw = data[2:4]
3050
+ se = data[4:6]
3051
+ ne = data[6:8]
3052
+ x0, y0 = nw
3053
+ As = 1.0 / w
3054
+ At = 1.0 / h
3055
+ data = (
3056
+ x0,
3057
+ (ne[0] - x0) * As,
3058
+ (sw[0] - x0) * At,
3059
+ (se[0] - sw[0] - ne[0] + x0) * As * At,
3060
+ y0,
3061
+ (ne[1] - y0) * As,
3062
+ (sw[1] - y0) * At,
3063
+ (se[1] - sw[1] - ne[1] + y0) * As * At,
3064
+ )
3065
+
3066
+ else:
3067
+ msg = "unknown transformation method"
3068
+ raise ValueError(msg)
3069
+
3070
+ if resample not in (
3071
+ Resampling.NEAREST,
3072
+ Resampling.BILINEAR,
3073
+ Resampling.BICUBIC,
3074
+ ):
3075
+ if resample in (
3076
+ Resampling.BOX,
3077
+ Resampling.HAMMING,
3078
+ Resampling.LANCZOS,
3079
+ Resampling.MKS2013,
3080
+ Resampling.MKS2021,
3081
+ ):
3082
+ unusable: dict[int, str] = {
3083
+ Resampling.BOX: "Image.Resampling.BOX",
3084
+ Resampling.HAMMING: "Image.Resampling.HAMMING",
3085
+ Resampling.LANCZOS: "Image.Resampling.LANCZOS",
3086
+ Resampling.MKS2013: "Image.Resampling.MKS2013",
3087
+ Resampling.MKS2021: "Image.Resampling.MKS2021",
3088
+ }
3089
+ msg = unusable[resample] + f" ({resample}) cannot be used."
3090
+ else:
3091
+ msg = f"Unknown resampling filter ({resample})."
3092
+
3093
+ filters = [
3094
+ f"{filter[1]} ({filter[0]})"
3095
+ for filter in (
3096
+ (Resampling.NEAREST, "Image.Resampling.NEAREST"),
3097
+ (Resampling.BILINEAR, "Image.Resampling.BILINEAR"),
3098
+ (Resampling.BICUBIC, "Image.Resampling.BICUBIC"),
3099
+ )
3100
+ ]
3101
+ msg += f" Use {', '.join(filters[:-1])} or {filters[-1]}"
3102
+ raise ValueError(msg)
3103
+
3104
+ image.load()
3105
+
3106
+ self.load()
3107
+
3108
+ if image.mode in ("1", "P"):
3109
+ resample = Resampling.NEAREST
3110
+
3111
+ self.im.transform(box, image.im, method, data, resample, fill)
3112
+
3113
+ def transpose(self, method: Transpose) -> Image:
3114
+ """
3115
+ Transpose image (flip or rotate in 90 degree steps)
3116
+
3117
+ :param method: One of :py:data:`Transpose.FLIP_LEFT_RIGHT`,
3118
+ :py:data:`Transpose.FLIP_TOP_BOTTOM`, :py:data:`Transpose.ROTATE_90`,
3119
+ :py:data:`Transpose.ROTATE_180`, :py:data:`Transpose.ROTATE_270`,
3120
+ :py:data:`Transpose.TRANSPOSE` or :py:data:`Transpose.TRANSVERSE`.
3121
+ :returns: Returns a flipped or rotated copy of this image.
3122
+ """
3123
+
3124
+ self.load()
3125
+ return self._new(self.im.transpose(method))
3126
+
3127
+ def effect_spread(self, distance: int) -> Image:
3128
+ """
3129
+ Randomly spread pixels in an image.
3130
+
3131
+ :param distance: Distance to spread pixels.
3132
+ """
3133
+ self.load()
3134
+ return self._new(self.im.effect_spread(distance))
3135
+
3136
+ def toqimage(self) -> ImageQt.ImageQt:
3137
+ """Returns a QImage copy of this image"""
3138
+ from . import ImageQt
3139
+
3140
+ if not ImageQt.qt_is_installed:
3141
+ msg = "Qt bindings are not installed"
3142
+ raise ImportError(msg)
3143
+ return ImageQt.toqimage(self)
3144
+
3145
+ def toqpixmap(self) -> ImageQt.QPixmap:
3146
+ """Returns a QPixmap copy of this image"""
3147
+ from . import ImageQt
3148
+
3149
+ if not ImageQt.qt_is_installed:
3150
+ msg = "Qt bindings are not installed"
3151
+ raise ImportError(msg)
3152
+ return ImageQt.toqpixmap(self)
3153
+
3154
+
3155
+ # --------------------------------------------------------------------
3156
+ # Abstract handlers.
3157
+
3158
+
3159
+ class ImagePointHandler(abc.ABC):
3160
+ """
3161
+ Used as a mixin by point transforms
3162
+ (for use with :py:meth:`~PIL.Image.Image.point`)
3163
+ """
3164
+
3165
+ @abc.abstractmethod
3166
+ def point(self, im: Image) -> Image:
3167
+ pass
3168
+
3169
+
3170
+ class ImageTransformHandler(abc.ABC):
3171
+ """
3172
+ Used as a mixin by geometry transforms
3173
+ (for use with :py:meth:`~PIL.Image.Image.transform`)
3174
+ """
3175
+
3176
+ @abc.abstractmethod
3177
+ def transform(
3178
+ self,
3179
+ size: tuple[int, int],
3180
+ image: Image,
3181
+ **options: Any,
3182
+ ) -> Image:
3183
+ pass
3184
+
3185
+
3186
+ # --------------------------------------------------------------------
3187
+ # Factories
3188
+
3189
+
3190
+ def _check_size(size: Any) -> None:
3191
+ """
3192
+ Common check to enforce type and sanity check on size tuples
3193
+
3194
+ :param size: Should be a 2 tuple of (width, height)
3195
+ :returns: None, or raises a ValueError
3196
+ """
3197
+
3198
+ if not isinstance(size, (list, tuple)):
3199
+ msg = "Size must be a list or tuple"
3200
+ raise ValueError(msg)
3201
+ if len(size) != 2:
3202
+ msg = "Size must be a sequence of length 2"
3203
+ raise ValueError(msg)
3204
+ if size[0] < 0 or size[1] < 0:
3205
+ msg = "Width and height must be >= 0"
3206
+ raise ValueError(msg)
3207
+
3208
+
3209
+ def new(
3210
+ mode: str,
3211
+ size: tuple[int, int] | list[int],
3212
+ color: float | tuple[float, ...] | str | None = 0,
3213
+ ) -> Image:
3214
+ """
3215
+ Creates a new image with the given mode and size.
3216
+
3217
+ :param mode: The mode to use for the new image. See: :ref:`concept-modes`.
3218
+ :param size: A 2-tuple, containing (width, height) in pixels.
3219
+ :param color: What color to use for the image. If given, this should be a single
3220
+ integer or floating point value for single-band modes, and a tuple for
3221
+ multi-band modes (one value per band). When creating RGB or HSV images, you can
3222
+ also use color strings as supported by the ImageColor module. See :ref:`colors`
3223
+ for more information. The default color is zero, which appears as black in
3224
+ single band or RGB-based images. ``None`` is also treated as zero.
3225
+ :returns: An :py:class:`~PIL.Image.Image` object.
3226
+ """
3227
+
3228
+ _check_size(size)
3229
+
3230
+ if color is None:
3231
+ # core.new() returns zeroed memory, so there is nothing to fill
3232
+ return Image()._new(core.new(mode, size))
3233
+
3234
+ if isinstance(color, str):
3235
+ # css3-style specifier
3236
+
3237
+ from . import ImageColor
3238
+
3239
+ color = ImageColor.getcolor(color, mode)
3240
+
3241
+ im = Image()
3242
+ if (
3243
+ mode == "P"
3244
+ and isinstance(color, (list, tuple))
3245
+ and all(isinstance(i, int) for i in color)
3246
+ ):
3247
+ color_ints: tuple[int, ...] = cast("tuple[int, ...]", tuple(color))
3248
+ if len(color_ints) == 3 or len(color_ints) == 4:
3249
+ # RGB or RGBA value for a P image
3250
+ from . import ImagePalette
3251
+
3252
+ im.palette = ImagePalette.ImagePalette()
3253
+ color = im.palette.getcolor(color_ints)
3254
+ return im._new(core.fill(mode, size, color))
3255
+
3256
+
3257
+ def frombytes(
3258
+ mode: str,
3259
+ size: tuple[int, int],
3260
+ data: DecoderInput,
3261
+ decoder_name: str = "raw",
3262
+ *args: Any,
3263
+ ) -> Image:
3264
+ """
3265
+ Creates a copy of an image memory from pixel data in a buffer.
3266
+
3267
+ In its simplest form, this function takes three arguments
3268
+ (mode, size, and unpacked pixel data).
3269
+
3270
+ You can also use any pixel decoder supported by PIL. For more
3271
+ information on available decoders, see the section
3272
+ :ref:`Writing Your Own File Codec <file-codecs>`.
3273
+
3274
+ Note that this function decodes pixel data only, not entire images.
3275
+ If you have an entire image in a string, wrap it in a
3276
+ :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load
3277
+ it.
3278
+
3279
+ :param mode: The image mode. See: :ref:`concept-modes`.
3280
+ :param size: The image size.
3281
+ :param data: A byte buffer containing raw data for the given mode.
3282
+ :param decoder_name: What decoder to use.
3283
+ :param args: Additional parameters for the given decoder.
3284
+ :returns: An :py:class:`~PIL.Image.Image` object.
3285
+ """
3286
+
3287
+ _check_size(size)
3288
+
3289
+ im = new(mode, size)
3290
+ if im.width != 0 and im.height != 0:
3291
+ decoder_args: Any = args
3292
+ if len(decoder_args) == 1 and isinstance(decoder_args[0], tuple):
3293
+ # may pass tuple instead of argument list
3294
+ decoder_args = decoder_args[0]
3295
+
3296
+ if decoder_name == "raw" and decoder_args == ():
3297
+ decoder_args = mode
3298
+
3299
+ im.frombytes(data, decoder_name, decoder_args)
3300
+ return im
3301
+
3302
+
3303
+ def frombuffer(
3304
+ mode: str,
3305
+ size: tuple[int, int],
3306
+ data: bytes | bytearray | SupportsArrayInterface,
3307
+ decoder_name: str = "raw",
3308
+ *args: Any,
3309
+ ) -> Image:
3310
+ """
3311
+ Creates an image memory referencing pixel data in a byte buffer.
3312
+
3313
+ This function is similar to :py:func:`~PIL.Image.frombytes`, but uses data
3314
+ in the byte buffer, where possible. This means that changes to the
3315
+ original buffer object are reflected in this image). Not all modes can
3316
+ share memory; supported modes include "L", "RGBX", "RGBA", and "CMYK".
3317
+
3318
+ Note that this function decodes pixel data only, not entire images.
3319
+ If you have an entire image file in a string, wrap it in a
3320
+ :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it.
3321
+
3322
+ The default parameters used for the "raw" decoder differs from that used for
3323
+ :py:func:`~PIL.Image.frombytes`. This is a bug, and will probably be fixed in a
3324
+ future release. The current release issues a warning if you do this; to disable
3325
+ the warning, you should provide the full set of parameters. See below for details.
3326
+
3327
+ :param mode: The image mode. See: :ref:`concept-modes`.
3328
+ :param size: The image size.
3329
+ :param data: A bytes or other buffer object containing raw
3330
+ data for the given mode.
3331
+ :param decoder_name: What decoder to use.
3332
+ :param args: Additional parameters for the given decoder. For the
3333
+ default encoder ("raw"), it's recommended that you provide the
3334
+ full set of parameters::
3335
+
3336
+ frombuffer(mode, size, data, "raw", mode, 0, 1)
3337
+
3338
+ :returns: An :py:class:`~PIL.Image.Image` object.
3339
+
3340
+ .. versionadded:: 1.1.4
3341
+ """
3342
+
3343
+ _check_size(size)
3344
+
3345
+ # may pass tuple instead of argument list
3346
+ if len(args) == 1 and isinstance(args[0], tuple):
3347
+ args = args[0]
3348
+
3349
+ if decoder_name == "raw":
3350
+ if args == ():
3351
+ args = mode, 0, 1
3352
+ if args[0] in _MAPMODES:
3353
+ im = new(mode, (0, 0))
3354
+ im = im._new(core.map_buffer(data, size, decoder_name, 0, args))
3355
+ if mode == "P":
3356
+ from . import ImagePalette
3357
+
3358
+ im.palette = ImagePalette.ImagePalette("RGB", im.im.getpalette("RGB"))
3359
+ im.readonly = 1
3360
+ return im
3361
+
3362
+ return frombytes(mode, size, data, decoder_name, args)
3363
+
3364
+
3365
+ class SupportsArrayInterface(Protocol):
3366
+ """
3367
+ An object that has an ``__array_interface__`` dictionary.
3368
+ """
3369
+
3370
+ @property
3371
+ def __array_interface__(self) -> dict[str, Any]:
3372
+ raise NotImplementedError()
3373
+
3374
+
3375
+ DecoderInput = bytes | bytearray | memoryview | SupportsArrayInterface
3376
+
3377
+
3378
+ class SupportsArrowArrayInterface(Protocol):
3379
+ """
3380
+ An object that has an ``__arrow_c_array__`` method corresponding to the arrow c
3381
+ data interface.
3382
+ """
3383
+
3384
+ def __arrow_c_array__(
3385
+ self, requested_schema: PyCapsule = None # type: ignore[name-defined] # noqa: F821
3386
+ ) -> tuple[PyCapsule, PyCapsule]: # type: ignore[name-defined] # noqa: F821
3387
+ raise NotImplementedError()
3388
+
3389
+
3390
+ def fromarray(obj: SupportsArrayInterface, mode: str | None = None) -> Image:
3391
+ """
3392
+ Creates an image memory from an object exporting the array interface
3393
+ (using the buffer protocol)::
3394
+
3395
+ from PIL import Image
3396
+ import numpy as np
3397
+ a = np.zeros((5, 5))
3398
+ im = Image.fromarray(a)
3399
+
3400
+ If ``obj`` is not contiguous, then the ``tobytes`` method is called
3401
+ and :py:func:`~PIL.Image.frombuffer` is used.
3402
+
3403
+ In the case of NumPy, be aware that Pillow modes do not always correspond
3404
+ to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels,
3405
+ 32-bit signed integer pixels, and 32-bit floating point pixels.
3406
+
3407
+ Pillow images can also be converted to arrays::
3408
+
3409
+ from PIL import Image
3410
+ import numpy as np
3411
+ im = Image.open("hopper.jpg")
3412
+ a = np.asarray(im)
3413
+
3414
+ When converting Pillow images to arrays however, only pixel values are
3415
+ transferred. This means that P and PA mode images will lose their palette.
3416
+
3417
+ :param obj: Object with array interface
3418
+ :param mode: Optional mode to use when reading ``obj``. Since pixel values do not
3419
+ contain information about palettes or color spaces, this can be used to place
3420
+ grayscale L mode data within a P mode image, or read RGB data as YCbCr for
3421
+ example.
3422
+
3423
+ See: :ref:`concept-modes` for general information about modes.
3424
+ :returns: An image object.
3425
+
3426
+ .. versionadded:: 1.1.6
3427
+ """
3428
+ arr = obj.__array_interface__
3429
+ shape = arr["shape"]
3430
+ ndim = len(shape)
3431
+ strides = arr.get("strides", None)
3432
+ try:
3433
+ typekey = (1, 1) + shape[2:], arr["typestr"]
3434
+ except KeyError as e:
3435
+ if mode is not None:
3436
+ typekey = None
3437
+ color_modes: list[str] = []
3438
+ else:
3439
+ msg = "Cannot handle this data type"
3440
+ raise TypeError(msg) from e
3441
+ if typekey is not None:
3442
+ try:
3443
+ typemode, rawmode, color_modes = _fromarray_typemap[typekey]
3444
+ except KeyError as e:
3445
+ typekey_shape, typestr = typekey
3446
+ msg = f"Cannot handle this data type: {typekey_shape}, {typestr}"
3447
+ raise TypeError(msg) from e
3448
+ if mode is not None:
3449
+ if mode != typemode and mode not in color_modes:
3450
+ msg = "Invalid mode for data type"
3451
+ raise ValueError(msg)
3452
+ rawmode = mode
3453
+ else:
3454
+ mode = typemode
3455
+ if mode in ["1", "L", "I", "P", "F"]:
3456
+ ndmax = 2
3457
+ elif mode == "RGB":
3458
+ ndmax = 3
3459
+ else:
3460
+ ndmax = 4
3461
+ if ndim > ndmax:
3462
+ msg = f"Too many dimensions: {ndim} > {ndmax}."
3463
+ raise ValueError(msg)
3464
+
3465
+ size = 1 if ndim == 1 else shape[1], shape[0]
3466
+ if strides is not None:
3467
+ if hasattr(obj, "tobytes"):
3468
+ obj = obj.tobytes()
3469
+ elif hasattr(obj, "tostring"):
3470
+ obj = obj.tostring()
3471
+ else:
3472
+ msg = "'strides' requires either tobytes() or tostring()"
3473
+ raise ValueError(msg)
3474
+
3475
+ return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
3476
+
3477
+
3478
+ def fromarrow(
3479
+ obj: SupportsArrowArrayInterface, mode: str, size: tuple[int, int]
3480
+ ) -> Image:
3481
+ """Creates an image with zero-copy shared memory from an object exporting
3482
+ the arrow_c_array interface protocol::
3483
+
3484
+ from PIL import Image
3485
+ import pyarrow as pa
3486
+ arr = pa.array([0]*(5*5*4), type=pa.uint8())
3487
+ im = Image.fromarrow(arr, 'RGBA', (5, 5))
3488
+
3489
+ If the data representation of the ``obj`` is not compatible with
3490
+ Pillow internal storage, a ValueError is raised.
3491
+
3492
+ Pillow images can also be converted to Arrow objects::
3493
+
3494
+ from PIL import Image
3495
+ import pyarrow as pa
3496
+ im = Image.open('hopper.jpg')
3497
+ arr = pa.array(im)
3498
+
3499
+ As with array support, when converting Pillow images to arrays,
3500
+ only pixel values are transferred. This means that P and PA mode
3501
+ images will lose their palette.
3502
+
3503
+ :param obj: Object with an arrow_c_array interface
3504
+ :param mode: Image mode.
3505
+ :param size: Image size. This must match the storage of the arrow object.
3506
+ :returns: An Image object
3507
+
3508
+ Note that according to the Arrow spec, both the producer and the
3509
+ consumer should consider the exported array to be immutable, as
3510
+ unsynchronized updates will potentially cause inconsistent data.
3511
+
3512
+ See: :ref:`arrow-support` for more detailed information
3513
+
3514
+ .. versionadded:: 11.2.1
3515
+
3516
+ """
3517
+ if not hasattr(obj, "__arrow_c_array__"):
3518
+ msg = "arrow_c_array interface not found"
3519
+ raise ValueError(msg)
3520
+
3521
+ schema_capsule, array_capsule = obj.__arrow_c_array__()
3522
+ _im = core.new_arrow(mode, size, schema_capsule, array_capsule)
3523
+ if _im is not None:
3524
+ return Image()._new(_im)
3525
+
3526
+ msg = "new_arrow returned None without an exception"
3527
+ raise ValueError(msg)
3528
+
3529
+
3530
+ def fromqimage(im: ImageQt.QImage) -> ImageFile.ImageFile:
3531
+ """Creates an image instance from a QImage image"""
3532
+ from . import ImageQt
3533
+
3534
+ if not ImageQt.qt_is_installed:
3535
+ msg = "Qt bindings are not installed"
3536
+ raise ImportError(msg)
3537
+ return ImageQt.fromqimage(im)
3538
+
3539
+
3540
+ def fromqpixmap(im: ImageQt.QPixmap) -> ImageFile.ImageFile:
3541
+ """Creates an image instance from a QPixmap image"""
3542
+ from . import ImageQt
3543
+
3544
+ if not ImageQt.qt_is_installed:
3545
+ msg = "Qt bindings are not installed"
3546
+ raise ImportError(msg)
3547
+ return ImageQt.fromqpixmap(im)
3548
+
3549
+
3550
+ _fromarray_typemap = {
3551
+ # (shape, typestr) => mode, rawmode, color modes
3552
+ # first two members of shape are set to one
3553
+ ((1, 1), "|b1"): ("1", "1;8", []),
3554
+ ((1, 1), "|u1"): ("L", "L", ["P"]),
3555
+ ((1, 1), "|i1"): ("I", "I;8", []),
3556
+ ((1, 1), "<u2"): ("I", "I;16", []),
3557
+ ((1, 1), ">u2"): ("I", "I;16B", []),
3558
+ ((1, 1), "<i2"): ("I", "I;16S", []),
3559
+ ((1, 1), ">i2"): ("I", "I;16BS", []),
3560
+ ((1, 1), "<u4"): ("I", "I;32", []),
3561
+ ((1, 1), ">u4"): ("I", "I;32B", []),
3562
+ ((1, 1), "<i4"): ("I", "I;32S", []),
3563
+ ((1, 1), ">i4"): ("I", "I;32BS", []),
3564
+ ((1, 1), "<f4"): ("F", "F;32F", []),
3565
+ ((1, 1), ">f4"): ("F", "F;32BF", []),
3566
+ ((1, 1), "<f8"): ("F", "F;64F", []),
3567
+ ((1, 1), ">f8"): ("F", "F;64BF", []),
3568
+ ((1, 1, 2), "|u1"): ("LA", "LA", ["La", "PA"]),
3569
+ ((1, 1, 3), "|u1"): ("RGB", "RGB", ["YCbCr", "LAB", "HSV"]),
3570
+ ((1, 1, 4), "|u1"): ("RGBA", "RGBA", ["RGBa", "RGBX", "CMYK"]),
3571
+ # shortcuts:
3572
+ ((1, 1), f"{_ENDIAN}i4"): ("I", "I", []),
3573
+ ((1, 1), f"{_ENDIAN}f4"): ("F", "F", []),
3574
+ }
3575
+
3576
+
3577
+ def _decompression_bomb_check(
3578
+ size: tuple[int, int], *, error_only: bool = False
3579
+ ) -> None:
3580
+ if MAX_IMAGE_PIXELS is None:
3581
+ return
3582
+
3583
+ pixels = max(1, size[0]) * max(1, size[1])
3584
+
3585
+ if pixels > 2 * MAX_IMAGE_PIXELS:
3586
+ msg = (
3587
+ f"Image size ({pixels} pixels) exceeds limit of {2 * MAX_IMAGE_PIXELS} "
3588
+ "pixels, could be decompression bomb DOS attack."
3589
+ )
3590
+ raise DecompressionBombError(msg)
3591
+
3592
+ if not error_only and pixels > MAX_IMAGE_PIXELS:
3593
+ warnings.warn(
3594
+ f"Image size ({pixels} pixels) exceeds limit of {MAX_IMAGE_PIXELS} pixels, "
3595
+ "could be decompression bomb DOS attack.",
3596
+ DecompressionBombWarning,
3597
+ )
3598
+
3599
+
3600
+ def open(
3601
+ fp: StrOrBytesPath | IO[bytes],
3602
+ mode: Literal["r"] = "r",
3603
+ formats: list[str] | tuple[str, ...] | None = None,
3604
+ ) -> ImageFile.ImageFile:
3605
+ """
3606
+ Opens and identifies the given image file.
3607
+
3608
+ This is a lazy operation; this function identifies the file, but
3609
+ the file remains open and the actual image data is not read from
3610
+ the file until you try to process the data (or call the
3611
+ :py:meth:`~PIL.Image.Image.load` method). See
3612
+ :py:func:`~PIL.Image.new`. See :ref:`file-handling`.
3613
+
3614
+ :param fp: A filename (string), os.PathLike object or a file object.
3615
+ The file object must implement ``file.read``,
3616
+ ``file.seek``, and ``file.tell`` methods,
3617
+ and be opened in binary mode. The file object will also seek to zero
3618
+ before reading.
3619
+ :param mode: The mode. If given, this argument must be "r".
3620
+ :param formats: A list or tuple of formats to attempt to load the file in.
3621
+ This can be used to restrict the set of formats checked.
3622
+ Pass ``None`` to try all supported formats. You can print the set of
3623
+ available formats by running ``python3 -m PIL`` or using
3624
+ the :py:func:`PIL.features.pilinfo` function.
3625
+ :returns: An :py:class:`~PIL.Image.Image` object.
3626
+ :exception FileNotFoundError: If the file cannot be found.
3627
+ :exception PIL.UnidentifiedImageError: If the image cannot be opened and
3628
+ identified.
3629
+ :exception ValueError: If the ``mode`` is not "r", or if a ``StringIO``
3630
+ instance is used for ``fp``.
3631
+ :exception TypeError: If ``formats`` is not ``None``, a list or a tuple.
3632
+ """
3633
+
3634
+ if mode != "r":
3635
+ msg = f"bad mode {repr(mode)}" # type: ignore[unreachable]
3636
+ raise ValueError(msg)
3637
+ elif isinstance(fp, io.StringIO):
3638
+ msg = ( # type: ignore[unreachable]
3639
+ "StringIO cannot be used to open an image. "
3640
+ "Binary data must be used instead."
3641
+ )
3642
+ raise ValueError(msg)
3643
+
3644
+ if formats is None:
3645
+ formats = ID
3646
+ elif not isinstance(formats, (list, tuple)):
3647
+ msg = "formats must be a list or tuple" # type: ignore[unreachable]
3648
+ raise TypeError(msg)
3649
+
3650
+ exclusive_fp = False
3651
+ filename: str | bytes = ""
3652
+ if is_path(fp):
3653
+ filename = os.fspath(fp)
3654
+ fp = builtins.open(filename, "rb")
3655
+ exclusive_fp = True
3656
+ else:
3657
+ fp = cast("IO[bytes]", fp)
3658
+
3659
+ try:
3660
+ fp.seek(0)
3661
+ except (AttributeError, io.UnsupportedOperation):
3662
+ fp = io.BytesIO(fp.read())
3663
+ exclusive_fp = True
3664
+
3665
+ prefix = fp.read(16)
3666
+
3667
+ # Try to import just the plugin needed for this file extension
3668
+ # before falling back to preinit() which imports common plugins
3669
+ ext = os.path.splitext(filename)[1] if filename else ""
3670
+ if not _import_plugin_for_extension(ext):
3671
+ preinit()
3672
+
3673
+ warning_messages: list[str] = []
3674
+
3675
+ def _open_core(
3676
+ fp: IO[bytes],
3677
+ filename: str | bytes,
3678
+ prefix: bytes,
3679
+ formats: list[str] | tuple[str, ...],
3680
+ ) -> ImageFile.ImageFile | None:
3681
+ for i in formats:
3682
+ i = i.upper()
3683
+ if i not in OPEN:
3684
+ init()
3685
+ try:
3686
+ factory, accept = OPEN[i]
3687
+ result = not accept or accept(prefix)
3688
+ if isinstance(result, str):
3689
+ warning_messages.append(result)
3690
+ elif result:
3691
+ fp.seek(0)
3692
+ im = factory(fp, filename)
3693
+ _decompression_bomb_check(im.size)
3694
+ return im
3695
+ except (SyntaxError, IndexError, TypeError, struct.error) as e:
3696
+ if WARN_POSSIBLE_FORMATS:
3697
+ warning_messages.append(i + " opening failed. " + str(e))
3698
+ except BaseException:
3699
+ if exclusive_fp:
3700
+ fp.close()
3701
+ raise
3702
+ return None
3703
+
3704
+ im = _open_core(fp, filename, prefix, formats)
3705
+
3706
+ if im is None and formats is ID:
3707
+ # Try preinit (few common plugins) then init (all plugins)
3708
+ for loader in (preinit, init):
3709
+ checked_formats = ID.copy()
3710
+ loader()
3711
+ if formats != checked_formats:
3712
+ im = _open_core(
3713
+ fp,
3714
+ filename,
3715
+ prefix,
3716
+ tuple(f for f in formats if f not in checked_formats),
3717
+ )
3718
+ if im is not None:
3719
+ break
3720
+
3721
+ if im:
3722
+ im._exclusive_fp = exclusive_fp
3723
+ return im
3724
+
3725
+ if exclusive_fp:
3726
+ fp.close()
3727
+ for message in warning_messages:
3728
+ warnings.warn(message)
3729
+ msg = "cannot identify image file %r" % (filename if filename else fp)
3730
+ raise UnidentifiedImageError(msg)
3731
+
3732
+
3733
+ #
3734
+ # Image processing.
3735
+
3736
+
3737
+ def alpha_composite(im1: Image, im2: Image) -> Image:
3738
+ """
3739
+ Alpha composite im2 over im1.
3740
+
3741
+ :param im1: The first image. Must have mode RGBA or LA.
3742
+ :param im2: The second image. Must have the same mode and size as the first image.
3743
+ :returns: An :py:class:`~PIL.Image.Image` object.
3744
+ """
3745
+
3746
+ im1.load()
3747
+ im2.load()
3748
+ return im1._new(core.alpha_composite(im1.im, im2.im))
3749
+
3750
+
3751
+ def blend(im1: Image, im2: Image, alpha: float) -> Image:
3752
+ """
3753
+ Creates a new image by interpolating between two input images, using
3754
+ a constant alpha::
3755
+
3756
+ out = image1 * (1.0 - alpha) + image2 * alpha
3757
+
3758
+ :param im1: The first image.
3759
+ :param im2: The second image. Must have the same mode and size as
3760
+ the first image.
3761
+ :param alpha: The interpolation alpha factor. If alpha is 0.0, a
3762
+ copy of the first image is returned. If alpha is 1.0, a copy of
3763
+ the second image is returned. There are no restrictions on the
3764
+ alpha value. If necessary, the result is clipped to fit into
3765
+ the allowed output range.
3766
+ :returns: An :py:class:`~PIL.Image.Image` object.
3767
+ """
3768
+
3769
+ im1.load()
3770
+ im2.load()
3771
+ return im1._new(core.blend(im1.im, im2.im, alpha))
3772
+
3773
+
3774
+ def composite(image1: Image, image2: Image, mask: Image) -> Image:
3775
+ """
3776
+ Create composite image by blending images using a transparency mask.
3777
+
3778
+ :param image1: The first image.
3779
+ :param image2: The second image. Must have the same mode and
3780
+ size as the first image.
3781
+ :param mask: A mask image. This image can have mode
3782
+ "1", "L", or "RGBA", and must have the same size as the
3783
+ other two images.
3784
+ """
3785
+
3786
+ image = image2.copy()
3787
+ image.paste(image1, None, mask)
3788
+ return image
3789
+
3790
+
3791
+ def eval(image: Image, *args: Callable[[int], float]) -> Image:
3792
+ """
3793
+ Applies the function (which should take one argument) to each pixel
3794
+ in the given image. If the image has more than one band, the same
3795
+ function is applied to each band. Note that the function is
3796
+ evaluated once for each possible pixel value, so you cannot use
3797
+ random components or other generators.
3798
+
3799
+ :param image: The input image.
3800
+ :param function: A function object, taking one integer argument.
3801
+ :returns: An :py:class:`~PIL.Image.Image` object.
3802
+ """
3803
+
3804
+ return image.point(args[0])
3805
+
3806
+
3807
+ def merge(mode: str, bands: Sequence[Image]) -> Image:
3808
+ """
3809
+ Merge a set of single band images into a new multiband image.
3810
+
3811
+ :param mode: The mode to use for the output image. See:
3812
+ :ref:`concept-modes`.
3813
+ :param bands: A sequence containing one single-band image for
3814
+ each band in the output image. All bands must have the
3815
+ same size.
3816
+ :returns: An :py:class:`~PIL.Image.Image` object.
3817
+ """
3818
+
3819
+ if getmodebands(mode) != len(bands):
3820
+ msg = "wrong number of bands"
3821
+ raise ValueError(msg)
3822
+ for band in bands[1:]:
3823
+ if band.mode != getmodetype(mode):
3824
+ msg = "mode mismatch"
3825
+ raise ValueError(msg)
3826
+ if band.size != bands[0].size:
3827
+ msg = "size mismatch"
3828
+ raise ValueError(msg)
3829
+ for band in bands:
3830
+ band.load()
3831
+ return bands[0]._new(core.merge(mode, *[b.im for b in bands]))
3832
+
3833
+
3834
+ # --------------------------------------------------------------------
3835
+ # Plugin registry
3836
+
3837
+
3838
+ def register_open(
3839
+ id: str,
3840
+ factory: (
3841
+ Callable[[IO[bytes], str | bytes], ImageFile.ImageFile]
3842
+ | type[ImageFile.ImageFile]
3843
+ ),
3844
+ accept: Callable[[bytes], bool | str] | None = None,
3845
+ ) -> None:
3846
+ """
3847
+ Register an image file plugin. This function should not be used
3848
+ in application code.
3849
+
3850
+ :param id: An image format identifier.
3851
+ :param factory: An image file factory method.
3852
+ :param accept: An optional function that can be used to quickly
3853
+ reject images having another format.
3854
+ """
3855
+ id = id.upper()
3856
+ if id not in ID:
3857
+ ID.append(id)
3858
+ OPEN[id] = factory, accept
3859
+
3860
+
3861
+ def register_mime(id: str, mimetype: str) -> None:
3862
+ """
3863
+ Registers an image MIME type by populating ``Image.MIME``. This function
3864
+ should not be used in application code.
3865
+
3866
+ ``Image.MIME`` provides a mapping from image format identifiers to mime
3867
+ formats, but :py:meth:`~PIL.ImageFile.ImageFile.get_format_mimetype` can
3868
+ provide a different result for specific images.
3869
+
3870
+ :param id: An image format identifier.
3871
+ :param mimetype: The image MIME type for this format.
3872
+ """
3873
+ MIME[id.upper()] = mimetype
3874
+
3875
+
3876
+ def register_save(
3877
+ id: str, driver: Callable[[Image, IO[bytes], str | bytes], None]
3878
+ ) -> None:
3879
+ """
3880
+ Registers an image save function. This function should not be
3881
+ used in application code.
3882
+
3883
+ :param id: An image format identifier.
3884
+ :param driver: A function to save images in this format.
3885
+ """
3886
+ SAVE[id.upper()] = driver
3887
+
3888
+
3889
+ def register_save_all(
3890
+ id: str, driver: Callable[[Image, IO[bytes], str | bytes], None]
3891
+ ) -> None:
3892
+ """
3893
+ Registers an image function to save all the frames
3894
+ of a multiframe format. This function should not be
3895
+ used in application code.
3896
+
3897
+ :param id: An image format identifier.
3898
+ :param driver: A function to save images in this format.
3899
+ """
3900
+ SAVE_ALL[id.upper()] = driver
3901
+
3902
+
3903
+ def register_extension(id: str, extension: str) -> None:
3904
+ """
3905
+ Registers an image extension. This function should not be
3906
+ used in application code.
3907
+
3908
+ :param id: An image format identifier.
3909
+ :param extension: An extension used for this format.
3910
+ """
3911
+ EXTENSION[extension.lower()] = id.upper()
3912
+
3913
+
3914
+ def register_extensions(id: str, extensions: list[str]) -> None:
3915
+ """
3916
+ Registers image extensions. This function should not be
3917
+ used in application code.
3918
+
3919
+ :param id: An image format identifier.
3920
+ :param extensions: A list of extensions used for this format.
3921
+ """
3922
+ for extension in extensions:
3923
+ register_extension(id, extension)
3924
+
3925
+
3926
+ def registered_extensions() -> dict[str, str]:
3927
+ """
3928
+ Returns a dictionary containing all file extensions belonging
3929
+ to registered plugins
3930
+ """
3931
+ init()
3932
+ return EXTENSION
3933
+
3934
+
3935
+ def register_decoder(name: str, decoder: type[ImageFile.PyDecoder]) -> None:
3936
+ """
3937
+ Registers an image decoder. This function should not be
3938
+ used in application code.
3939
+
3940
+ :param name: The name of the decoder
3941
+ :param decoder: An ImageFile.PyDecoder object
3942
+
3943
+ .. versionadded:: 4.1.0
3944
+ """
3945
+ DECODERS[name] = decoder
3946
+
3947
+
3948
+ def register_encoder(name: str, encoder: type[ImageFile.PyEncoder]) -> None:
3949
+ """
3950
+ Registers an image encoder. This function should not be
3951
+ used in application code.
3952
+
3953
+ :param name: The name of the encoder
3954
+ :param encoder: An ImageFile.PyEncoder object
3955
+
3956
+ .. versionadded:: 4.1.0
3957
+ """
3958
+ ENCODERS[name] = encoder
3959
+
3960
+
3961
+ # --------------------------------------------------------------------
3962
+ # Effects
3963
+
3964
+
3965
+ def effect_mandelbrot(
3966
+ size: tuple[int, int], extent: tuple[float, float, float, float], quality: int
3967
+ ) -> Image:
3968
+ """
3969
+ Generate a Mandelbrot set covering the given extent.
3970
+
3971
+ :param size: The requested size in pixels, as a 2-tuple:
3972
+ (width, height).
3973
+ :param extent: The extent to cover, as a 4-tuple:
3974
+ (x0, y0, x1, y1).
3975
+ :param quality: Quality.
3976
+ """
3977
+ return Image()._new(core.effect_mandelbrot(size, extent, quality))
3978
+
3979
+
3980
+ def effect_noise(size: tuple[int, int], sigma: float) -> Image:
3981
+ """
3982
+ Generate Gaussian noise centered around 128.
3983
+
3984
+ :param size: The requested size in pixels, as a 2-tuple:
3985
+ (width, height).
3986
+ :param sigma: Standard deviation of noise.
3987
+ """
3988
+ return Image()._new(core.effect_noise(size, sigma))
3989
+
3990
+
3991
+ def linear_gradient(mode: str) -> Image:
3992
+ """
3993
+ Generate 256x256 linear gradient from black to white, top to bottom.
3994
+
3995
+ :param mode: Input mode.
3996
+ """
3997
+ return Image()._new(core.linear_gradient(mode))
3998
+
3999
+
4000
+ def radial_gradient(mode: str) -> Image:
4001
+ """
4002
+ Generate 256x256 radial gradient from black to white, centre to edge.
4003
+
4004
+ :param mode: Input mode.
4005
+ """
4006
+ return Image()._new(core.radial_gradient(mode))
4007
+
4008
+
4009
+ # --------------------------------------------------------------------
4010
+ # Resources
4011
+
4012
+
4013
+ def _apply_env_variables(env: dict[str, str] | None = None) -> None:
4014
+ env_dict = env if env is not None else os.environ
4015
+
4016
+ for var_name, setter in [
4017
+ ("PILLOW_ALIGNMENT", core.set_alignment),
4018
+ ("PILLOW_BLOCK_SIZE", core.set_block_size),
4019
+ ("PILLOW_BLOCKS_MAX", core.set_blocks_max),
4020
+ ]:
4021
+ if var_name not in env_dict:
4022
+ continue
4023
+
4024
+ var = env_dict[var_name].lower()
4025
+
4026
+ units = 1
4027
+ for postfix, mul in [("k", 1024), ("m", 1024 * 1024)]:
4028
+ if var.endswith(postfix):
4029
+ units = mul
4030
+ var = var[: -len(postfix)]
4031
+
4032
+ try:
4033
+ var_int = int(var) * units
4034
+ except ValueError:
4035
+ warnings.warn(f"{var_name} is not int")
4036
+ continue
4037
+
4038
+ try:
4039
+ setter(var_int)
4040
+ except ValueError as e:
4041
+ warnings.warn(f"{var_name}: {e}")
4042
+
4043
+
4044
+ _apply_env_variables()
4045
+ atexit.register(core.clear_cache)
4046
+
4047
+
4048
+ if TYPE_CHECKING:
4049
+ _ExifBase = MutableMapping[int, Any]
4050
+ else:
4051
+ _ExifBase = MutableMapping
4052
+
4053
+
4054
+ class Exif(_ExifBase):
4055
+ """
4056
+ This class provides read and write access to EXIF image data::
4057
+
4058
+ from PIL import Image
4059
+ im = Image.open("exif.png")
4060
+ exif = im.getexif() # Returns an instance of this class
4061
+
4062
+ Information can be read and written, iterated over or deleted::
4063
+
4064
+ print(exif[274]) # 1
4065
+ exif[274] = 2
4066
+ for k, v in exif.items():
4067
+ print("Tag", k, "Value", v) # Tag 274 Value 2
4068
+ del exif[274]
4069
+
4070
+ To access information beyond IFD0, :py:meth:`~PIL.Image.Exif.get_ifd`
4071
+ returns a dictionary::
4072
+
4073
+ from PIL import ExifTags
4074
+ im = Image.open("exif_gps.jpg")
4075
+ exif = im.getexif()
4076
+ gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo)
4077
+ print(gps_ifd)
4078
+
4079
+ Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.MakerNote``,
4080
+ ``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``.
4081
+
4082
+ :py:mod:`~PIL.ExifTags` also has enum classes to provide names for data::
4083
+
4084
+ print(exif[ExifTags.Base.Software]) # PIL
4085
+ print(gps_ifd[ExifTags.GPS.GPSDateStamp]) # 1999:99:99 99:99:99
4086
+ """
4087
+
4088
+ endian: str | None = None
4089
+ bigtiff = False
4090
+ _loaded = False
4091
+
4092
+ def __init__(self) -> None:
4093
+ self._data: dict[int, Any] = {}
4094
+ self._hidden_data: dict[int, Any] = {}
4095
+ self._ifds: dict[int, dict[int, Any]] = {}
4096
+ self._info: TiffImagePlugin.ImageFileDirectory_v2 | None = None
4097
+ self._loaded_exif: bytes | None = None
4098
+
4099
+ def _fixup(self, value: Any) -> Any:
4100
+ try:
4101
+ if len(value) == 1 and isinstance(value, tuple):
4102
+ return value[0]
4103
+ except Exception:
4104
+ pass
4105
+ return value
4106
+
4107
+ def _fixup_dict(self, src_dict: dict[int, Any]) -> dict[int, Any]:
4108
+ # Helper function
4109
+ # returns a dict with any single item tuples/lists as individual values
4110
+ return {k: self._fixup(v) for k, v in src_dict.items()}
4111
+
4112
+ def _get_ifd_dict(
4113
+ self, offset: int, group: int | None = None
4114
+ ) -> dict[int, Any] | None:
4115
+ try:
4116
+ # an offset pointer to the location of the nested embedded IFD.
4117
+ # It should be a long, but may be corrupted.
4118
+ self.fp.seek(offset)
4119
+ except (KeyError, TypeError):
4120
+ return None
4121
+ else:
4122
+ from . import TiffImagePlugin
4123
+
4124
+ info = TiffImagePlugin.ImageFileDirectory_v2(self.head, group=group)
4125
+ info.load(self.fp)
4126
+ return self._fixup_dict(dict(info))
4127
+
4128
+ def _get_head(self) -> bytes:
4129
+ version = b"\x2b" if self.bigtiff else b"\x2a"
4130
+ if self.endian == "<":
4131
+ head = b"II" + version + b"\x00" + o32le(8)
4132
+ else:
4133
+ head = b"MM\x00" + version + o32be(8)
4134
+ if self.bigtiff:
4135
+ head += o32le(8) if self.endian == "<" else o32be(8)
4136
+ head += b"\x00\x00\x00\x00"
4137
+ return head
4138
+
4139
+ def load(self, data: bytes) -> None:
4140
+ # Extract EXIF information. This is highly experimental,
4141
+ # and is likely to be replaced with something better in a future
4142
+ # version.
4143
+
4144
+ # The EXIF record consists of a TIFF file embedded in a JPEG
4145
+ # application marker (!).
4146
+ if data == self._loaded_exif:
4147
+ return
4148
+ self._loaded_exif = data
4149
+ self._data.clear()
4150
+ self._hidden_data.clear()
4151
+ self._ifds.clear()
4152
+ data = re.sub(b"^(Exif\x00\x00){1,2}", b"", data)
4153
+ if not data:
4154
+ self._info = None
4155
+ return
4156
+
4157
+ self.fp: IO[bytes] = io.BytesIO(data)
4158
+ self.head = self.fp.read(8)
4159
+ # process dictionary
4160
+ from . import TiffImagePlugin
4161
+
4162
+ self._info = TiffImagePlugin.ImageFileDirectory_v2(self.head)
4163
+ self.endian = self._info._endian
4164
+ self.fp.seek(self._info.next)
4165
+ self._info.load(self.fp)
4166
+
4167
+ def load_from_fp(self, fp: IO[bytes], offset: int | None = None) -> None:
4168
+ self._loaded_exif = None
4169
+ self._data.clear()
4170
+ self._hidden_data.clear()
4171
+ self._ifds.clear()
4172
+
4173
+ # process dictionary
4174
+ from . import TiffImagePlugin
4175
+
4176
+ self.fp = fp
4177
+ if offset is not None:
4178
+ self.head = self._get_head()
4179
+ else:
4180
+ self.head = self.fp.read(8)
4181
+ self._info = TiffImagePlugin.ImageFileDirectory_v2(self.head)
4182
+ if self.endian is None:
4183
+ self.endian = self._info._endian
4184
+ if offset is None:
4185
+ offset = self._info.next
4186
+ self.fp.tell()
4187
+ self.fp.seek(offset)
4188
+ self._info.load(self.fp)
4189
+
4190
+ def _get_merged_dict(self) -> dict[int, Any]:
4191
+ merged_dict = dict(self)
4192
+
4193
+ # get EXIF extension
4194
+ if ExifTags.IFD.Exif in self:
4195
+ ifd = self._get_ifd_dict(self[ExifTags.IFD.Exif], ExifTags.IFD.Exif)
4196
+ if ifd:
4197
+ merged_dict.update(ifd)
4198
+
4199
+ # GPS
4200
+ if ExifTags.IFD.GPSInfo in self:
4201
+ merged_dict[ExifTags.IFD.GPSInfo] = self._get_ifd_dict(
4202
+ self[ExifTags.IFD.GPSInfo], ExifTags.IFD.GPSInfo
4203
+ )
4204
+
4205
+ return merged_dict
4206
+
4207
+ def tobytes(self, offset: int = 8) -> bytes:
4208
+ from . import TiffImagePlugin
4209
+
4210
+ head = self._get_head()
4211
+ ifd = TiffImagePlugin.ImageFileDirectory_v2(ifh=head)
4212
+ for tag, ifd_dict in self._ifds.items():
4213
+ if tag in {ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo} and tag not in self:
4214
+ ifd[tag] = ifd_dict
4215
+ for tag, value in self.items():
4216
+ if tag in [
4217
+ ExifTags.IFD.Exif,
4218
+ ExifTags.IFD.GPSInfo,
4219
+ ] and not isinstance(value, dict):
4220
+ value = self.get_ifd(tag)
4221
+ if (
4222
+ tag == ExifTags.IFD.Exif
4223
+ and ExifTags.IFD.Interop in value
4224
+ and not isinstance(value[ExifTags.IFD.Interop], dict)
4225
+ ):
4226
+ value = value.copy()
4227
+ value[ExifTags.IFD.Interop] = self.get_ifd(ExifTags.IFD.Interop)
4228
+ ifd[tag] = value
4229
+ return b"Exif\x00\x00" + head + ifd.tobytes(offset)
4230
+
4231
+ def get_ifd(self, tag: int) -> dict[int, Any]:
4232
+ if tag not in self._ifds:
4233
+ if tag == ExifTags.IFD.IFD1:
4234
+ if self._info is not None and self._info.next != 0:
4235
+ ifd = self._get_ifd_dict(self._info.next)
4236
+ if ifd is not None:
4237
+ self._ifds[tag] = ifd
4238
+ elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]:
4239
+ offset = self._hidden_data.get(tag, self.get(tag))
4240
+ if offset is not None:
4241
+ ifd = self._get_ifd_dict(offset, tag)
4242
+ if ifd is not None:
4243
+ self._ifds[tag] = ifd
4244
+ elif tag in [ExifTags.IFD.Interop, ExifTags.IFD.MakerNote]:
4245
+ if ExifTags.IFD.Exif not in self._ifds:
4246
+ self.get_ifd(ExifTags.IFD.Exif)
4247
+ tag_data = self._ifds[ExifTags.IFD.Exif].get(tag)
4248
+ if tag_data is None:
4249
+ pass
4250
+ elif tag == ExifTags.IFD.MakerNote:
4251
+ from .TiffImagePlugin import ImageFileDirectory_v2
4252
+
4253
+ try:
4254
+ if tag_data.startswith(b"FUJIFILM"):
4255
+ ifd_offset = i32le(tag_data, 8)
4256
+ ifd_data = tag_data[ifd_offset:]
4257
+
4258
+ makernote = {}
4259
+ for i in range(struct.unpack("<H", ifd_data[:2])[0]):
4260
+ ifd_tag, typ, count, data = struct.unpack(
4261
+ "<HHL4s", ifd_data[i * 12 + 2 : (i + 1) * 12 + 2]
4262
+ )
4263
+ try:
4264
+ (
4265
+ unit_size,
4266
+ handler,
4267
+ ) = ImageFileDirectory_v2._load_dispatch[typ]
4268
+ except KeyError:
4269
+ continue
4270
+ size = count * unit_size
4271
+ if size > 4:
4272
+ (offset,) = struct.unpack("<L", data)
4273
+ data = ifd_data[offset - 12 : offset + size - 12]
4274
+ else:
4275
+ data = data[:size]
4276
+
4277
+ if len(data) != size:
4278
+ warnings.warn(
4279
+ "Possibly corrupt EXIF MakerNote data. "
4280
+ f"Expecting to read {size} bytes but only got "
4281
+ f"{len(data)}. Skipping tag {ifd_tag}"
4282
+ )
4283
+ continue
4284
+
4285
+ if not data:
4286
+ continue
4287
+
4288
+ makernote[ifd_tag] = handler(
4289
+ ImageFileDirectory_v2(), data, False
4290
+ )
4291
+ self._ifds[tag] = dict(self._fixup_dict(makernote))
4292
+ elif self.get(0x010F) == "Nintendo":
4293
+ makernote = {}
4294
+ for i in range(struct.unpack(">H", tag_data[:2])[0]):
4295
+ ifd_tag, typ, count, data = struct.unpack(
4296
+ ">HHL4s", tag_data[i * 12 + 2 : (i + 1) * 12 + 2]
4297
+ )
4298
+ if ifd_tag == 0x1101:
4299
+ # CameraInfo
4300
+ (offset,) = struct.unpack(">L", data)
4301
+ self.fp.seek(offset)
4302
+
4303
+ camerainfo: dict[str, int | bytes] = {
4304
+ "ModelID": self.fp.read(4)
4305
+ }
4306
+
4307
+ self.fp.read(4)
4308
+ # Seconds since 2000
4309
+ camerainfo["TimeStamp"] = i32le(self.fp.read(12))
4310
+
4311
+ self.fp.read(4)
4312
+ camerainfo["InternalSerialNumber"] = self.fp.read(4)
4313
+
4314
+ self.fp.read(12)
4315
+ parallax = self.fp.read(4)
4316
+ handler = ImageFileDirectory_v2._load_dispatch[
4317
+ TiffTags.FLOAT
4318
+ ][1]
4319
+ camerainfo["Parallax"] = handler(
4320
+ ImageFileDirectory_v2(), parallax, False
4321
+ )[0]
4322
+
4323
+ self.fp.read(4)
4324
+ camerainfo["Category"] = self.fp.read(2)
4325
+
4326
+ makernote = {0x1101: camerainfo}
4327
+ self._ifds[tag] = makernote
4328
+ except struct.error:
4329
+ pass
4330
+ else:
4331
+ # Interop
4332
+ ifd = self._get_ifd_dict(tag_data, tag)
4333
+ if ifd is not None:
4334
+ self._ifds[tag] = ifd
4335
+ ifd = self._ifds.setdefault(tag, {})
4336
+ if tag == ExifTags.IFD.Exif and self._hidden_data:
4337
+ ifd = {
4338
+ k: v
4339
+ for (k, v) in ifd.items()
4340
+ if k not in (ExifTags.IFD.Interop, ExifTags.IFD.MakerNote)
4341
+ }
4342
+ return ifd
4343
+
4344
+ def hide_offsets(self) -> None:
4345
+ for tag in (ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo):
4346
+ if tag in self:
4347
+ self._hidden_data[tag] = self[tag]
4348
+ del self[tag]
4349
+
4350
+ def __str__(self) -> str:
4351
+ if self._info is not None:
4352
+ # Load all keys into self._data
4353
+ for tag in self._info:
4354
+ self[tag]
4355
+
4356
+ return str(self._data)
4357
+
4358
+ def __len__(self) -> int:
4359
+ keys = set(self._data)
4360
+ if self._info is not None:
4361
+ keys.update(self._info)
4362
+ return len(keys)
4363
+
4364
+ def __getitem__(self, tag: int) -> Any:
4365
+ if self._info is not None and tag not in self._data and tag in self._info:
4366
+ self._data[tag] = self._fixup(self._info[tag])
4367
+ del self._info[tag]
4368
+ return self._data[tag]
4369
+
4370
+ def __contains__(self, tag: object) -> bool:
4371
+ return tag in self._data or (self._info is not None and tag in self._info)
4372
+
4373
+ def __setitem__(self, tag: int, value: Any) -> None:
4374
+ if self._info is not None and tag in self._info:
4375
+ del self._info[tag]
4376
+ self._data[tag] = value
4377
+
4378
+ def __delitem__(self, tag: int) -> None:
4379
+ if self._info is not None and tag in self._info:
4380
+ del self._info[tag]
4381
+ else:
4382
+ del self._data[tag]
4383
+ if tag in self._ifds:
4384
+ del self._ifds[tag]
4385
+
4386
+ def __iter__(self) -> Iterator[int]:
4387
+ keys = set(self._data)
4388
+ if self._info is not None:
4389
+ keys.update(self._info)
4390
+ return iter(keys)