Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/INSTALLER +1 -0
- .venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/METADATA +133 -0
- .venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/RECORD +21 -0
- .venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/REQUESTED +0 -0
- .venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/WHEEL +5 -0
- .venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/licenses/LICENSE +73 -0
- .venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/top_level.txt +1 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/__init__.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_base_client.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_client.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_compat.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_constants.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_exceptions.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_files.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_legacy_response.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_models.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_module_client.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_qs.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_resource.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_response.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_streaming.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_types.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/_version.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/pagination.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/__pycache__/version.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__init__.py +68 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/__init__.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_compat.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_datetime_parse.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_json.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_logs.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_path.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_proxy.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_reflection.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_resources_proxy.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_streams.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_sync.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_transform.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_typing.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_utils.cpython-310.pyc +0 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_compat.py +45 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_datetime_parse.py +136 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_json.py +35 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_logs.py +42 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_path.py +127 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_proxy.py +65 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_reflection.py +45 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_resources_proxy.py +24 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_streams.py +12 -0
- .venv/lib/python3.10/site-packages/openai/_utils/_sync.py +58 -0
.venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
.venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/METADATA
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: importlib_metadata
|
| 3 |
+
Version: 8.7.1
|
| 4 |
+
Summary: Read metadata from Python packages
|
| 5 |
+
Author-email: "Jason R. Coombs" <jaraco@jaraco.com>
|
| 6 |
+
License-Expression: Apache-2.0
|
| 7 |
+
Project-URL: Source, https://github.com/python/importlib_metadata
|
| 8 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 9 |
+
Classifier: Intended Audience :: Developers
|
| 10 |
+
Classifier: Programming Language :: Python :: 3
|
| 11 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 12 |
+
Requires-Python: >=3.9
|
| 13 |
+
Description-Content-Type: text/x-rst
|
| 14 |
+
License-File: LICENSE
|
| 15 |
+
Requires-Dist: zipp>=3.20
|
| 16 |
+
Provides-Extra: test
|
| 17 |
+
Requires-Dist: pytest!=8.1.*,>=6; extra == "test"
|
| 18 |
+
Requires-Dist: packaging; extra == "test"
|
| 19 |
+
Requires-Dist: pyfakefs; extra == "test"
|
| 20 |
+
Requires-Dist: flufl.flake8; extra == "test"
|
| 21 |
+
Requires-Dist: pytest-perf>=0.9.2; extra == "test"
|
| 22 |
+
Requires-Dist: jaraco.test>=5.4; extra == "test"
|
| 23 |
+
Provides-Extra: doc
|
| 24 |
+
Requires-Dist: sphinx>=3.5; extra == "doc"
|
| 25 |
+
Requires-Dist: jaraco.packaging>=9.3; extra == "doc"
|
| 26 |
+
Requires-Dist: rst.linker>=1.9; extra == "doc"
|
| 27 |
+
Requires-Dist: furo; extra == "doc"
|
| 28 |
+
Requires-Dist: sphinx-lint; extra == "doc"
|
| 29 |
+
Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"
|
| 30 |
+
Provides-Extra: perf
|
| 31 |
+
Requires-Dist: ipython; extra == "perf"
|
| 32 |
+
Provides-Extra: check
|
| 33 |
+
Requires-Dist: pytest-checkdocs>=2.4; extra == "check"
|
| 34 |
+
Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"
|
| 35 |
+
Provides-Extra: cover
|
| 36 |
+
Requires-Dist: pytest-cov; extra == "cover"
|
| 37 |
+
Provides-Extra: enabler
|
| 38 |
+
Requires-Dist: pytest-enabler>=3.4; extra == "enabler"
|
| 39 |
+
Provides-Extra: type
|
| 40 |
+
Requires-Dist: pytest-mypy>=1.0.1; extra == "type"
|
| 41 |
+
Requires-Dist: mypy<1.19; platform_python_implementation == "PyPy" and extra == "type"
|
| 42 |
+
Dynamic: license-file
|
| 43 |
+
|
| 44 |
+
.. image:: https://img.shields.io/pypi/v/importlib_metadata.svg
|
| 45 |
+
:target: https://pypi.org/project/importlib_metadata
|
| 46 |
+
|
| 47 |
+
.. image:: https://img.shields.io/pypi/pyversions/importlib_metadata.svg
|
| 48 |
+
|
| 49 |
+
.. image:: https://github.com/python/importlib_metadata/actions/workflows/main.yml/badge.svg
|
| 50 |
+
:target: https://github.com/python/importlib_metadata/actions?query=workflow%3A%22tests%22
|
| 51 |
+
:alt: tests
|
| 52 |
+
|
| 53 |
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
| 54 |
+
:target: https://github.com/astral-sh/ruff
|
| 55 |
+
:alt: Ruff
|
| 56 |
+
|
| 57 |
+
.. image:: https://readthedocs.org/projects/importlib-metadata/badge/?version=latest
|
| 58 |
+
:target: https://importlib-metadata.readthedocs.io/en/latest/?badge=latest
|
| 59 |
+
|
| 60 |
+
.. image:: https://img.shields.io/badge/skeleton-2025-informational
|
| 61 |
+
:target: https://blog.jaraco.com/skeleton
|
| 62 |
+
|
| 63 |
+
.. image:: https://tidelift.com/badges/package/pypi/importlib-metadata
|
| 64 |
+
:target: https://tidelift.com/subscription/pkg/pypi-importlib-metadata?utm_source=pypi-importlib-metadata&utm_medium=readme
|
| 65 |
+
|
| 66 |
+
Library to access the metadata for a Python package.
|
| 67 |
+
|
| 68 |
+
This package supplies third-party access to the functionality of
|
| 69 |
+
`importlib.metadata <https://docs.python.org/3/library/importlib.metadata.html>`_
|
| 70 |
+
including improvements added to subsequent Python versions.
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
Compatibility
|
| 74 |
+
=============
|
| 75 |
+
|
| 76 |
+
New features are introduced in this third-party library and later merged
|
| 77 |
+
into CPython. The following table indicates which versions of this library
|
| 78 |
+
were contributed to different versions in the standard library:
|
| 79 |
+
|
| 80 |
+
.. list-table::
|
| 81 |
+
:header-rows: 1
|
| 82 |
+
|
| 83 |
+
* - importlib_metadata
|
| 84 |
+
- stdlib
|
| 85 |
+
* - 7.0
|
| 86 |
+
- 3.13
|
| 87 |
+
* - 6.5
|
| 88 |
+
- 3.12
|
| 89 |
+
* - 4.13
|
| 90 |
+
- 3.11
|
| 91 |
+
* - 4.6
|
| 92 |
+
- 3.10
|
| 93 |
+
* - 1.4
|
| 94 |
+
- 3.8
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
Usage
|
| 98 |
+
=====
|
| 99 |
+
|
| 100 |
+
See the `online documentation <https://importlib-metadata.readthedocs.io/>`_
|
| 101 |
+
for usage details.
|
| 102 |
+
|
| 103 |
+
`Finder authors
|
| 104 |
+
<https://docs.python.org/3/reference/import.html#finders-and-loaders>`_ can
|
| 105 |
+
also add support for custom package installers. See the above documentation
|
| 106 |
+
for details.
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
Caveats
|
| 110 |
+
=======
|
| 111 |
+
|
| 112 |
+
This project primarily supports third-party packages installed by PyPA
|
| 113 |
+
tools (or other conforming packages). It does not support:
|
| 114 |
+
|
| 115 |
+
- Packages in the stdlib.
|
| 116 |
+
- Packages installed without metadata.
|
| 117 |
+
|
| 118 |
+
Project details
|
| 119 |
+
===============
|
| 120 |
+
|
| 121 |
+
* Project home: https://github.com/python/importlib_metadata
|
| 122 |
+
* Report bugs at: https://github.com/python/importlib_metadata/issues
|
| 123 |
+
* Code hosting: https://github.com/python/importlib_metadata
|
| 124 |
+
* Documentation: https://importlib-metadata.readthedocs.io/
|
| 125 |
+
|
| 126 |
+
For Enterprise
|
| 127 |
+
==============
|
| 128 |
+
|
| 129 |
+
Available as part of the Tidelift Subscription.
|
| 130 |
+
|
| 131 |
+
This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
|
| 132 |
+
|
| 133 |
+
`Learn more <https://tidelift.com/subscription/pkg/pypi-importlib-metadata?utm_source=pypi-importlib-metadata&utm_medium=referral&utm_campaign=github>`_.
|
.venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/RECORD
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
importlib_metadata-8.7.1.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
importlib_metadata-8.7.1.dist-info/METADATA,sha256=o-OLnuQyYonUhkcE8w4pnudp4jCc6fSnXw3hpQrQo1Y,4670
|
| 3 |
+
importlib_metadata-8.7.1.dist-info/RECORD,,
|
| 4 |
+
importlib_metadata-8.7.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 5 |
+
importlib_metadata-8.7.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
| 6 |
+
importlib_metadata-8.7.1.dist-info/licenses/LICENSE,sha256=RYUC4S2Xu_ZEOGBqIARKqF6wX7CoqAe7NdvsJT_R_AQ,10278
|
| 7 |
+
importlib_metadata-8.7.1.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
|
| 8 |
+
importlib_metadata/__init__.py,sha256=u7Ew4-UkpzNY-ka6k-WRkDhQZS1akkLMfWs2eEnUmGo,37734
|
| 9 |
+
importlib_metadata/_adapters.py,sha256=r5i8XLrKT6xmrpoREZhZrfczOYDmrVZeJBW5u0HzIGU,3797
|
| 10 |
+
importlib_metadata/_collections.py,sha256=CxAhzlF3g1rwu_fMiB53JtRQiUFh0RgiMpoOvmK_ocg,760
|
| 11 |
+
importlib_metadata/_compat.py,sha256=VC5ZDLlT-BcshauCShdFJvMNLntJJfZzNK1meGa-enw,1313
|
| 12 |
+
importlib_metadata/_functools.py,sha256=0pA2OoiVK6wnsGq8HvVIzgdkvLiZ0nfnfw7IsndjoHk,3510
|
| 13 |
+
importlib_metadata/_itertools.py,sha256=nMvp9SfHAQ_JYwK4L2i64lr3GRXGlYlikGTVzWbys_E,5351
|
| 14 |
+
importlib_metadata/_meta.py,sha256=EtHyiJ5kGzWFDfKyQ2XQp6Vu113CeadKW1Vf6aGc1B4,1765
|
| 15 |
+
importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
|
| 16 |
+
importlib_metadata/_typing.py,sha256=EQKhhsEgz_Sa-FnePI-faC72rNOOQwopjA1i5pG8FDU,367
|
| 17 |
+
importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 18 |
+
importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608
|
| 19 |
+
importlib_metadata/compat/py39.py,sha256=J3W7PUVRPNYMmcvT12RF8ndBU9e8_T0Ac4U87Bsrq70,1187
|
| 20 |
+
importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379
|
| 21 |
+
importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
.venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/REQUESTED
ADDED
|
File without changes
|
.venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (80.9.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
.venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
| 10 |
+
|
| 11 |
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
| 12 |
+
|
| 13 |
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
| 14 |
+
|
| 15 |
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
| 16 |
+
|
| 17 |
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
| 18 |
+
|
| 19 |
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
| 20 |
+
|
| 21 |
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
| 22 |
+
|
| 23 |
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
| 24 |
+
|
| 25 |
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
| 26 |
+
|
| 27 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
| 28 |
+
|
| 29 |
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
| 30 |
+
|
| 31 |
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
| 32 |
+
|
| 33 |
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
| 34 |
+
|
| 35 |
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
| 36 |
+
|
| 37 |
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
| 38 |
+
|
| 39 |
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
| 40 |
+
|
| 41 |
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
| 42 |
+
|
| 43 |
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
| 44 |
+
|
| 45 |
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
| 46 |
+
|
| 47 |
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
| 48 |
+
|
| 49 |
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
| 50 |
+
|
| 51 |
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
| 52 |
+
|
| 53 |
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
| 54 |
+
|
| 55 |
+
END OF TERMS AND CONDITIONS
|
| 56 |
+
|
| 57 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 58 |
+
|
| 59 |
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
| 60 |
+
|
| 61 |
+
Copyright 2025 [name of copyright owner]
|
| 62 |
+
|
| 63 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 64 |
+
you may not use this file except in compliance with the License.
|
| 65 |
+
You may obtain a copy of the License at
|
| 66 |
+
|
| 67 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 68 |
+
|
| 69 |
+
Unless required by applicable law or agreed to in writing, software
|
| 70 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 71 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 72 |
+
See the License for the specific language governing permissions and
|
| 73 |
+
limitations under the License.
|
.venv/lib/python3.10/site-packages/importlib_metadata-8.7.1.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
importlib_metadata
|
.venv/lib/python3.10/site-packages/openai/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (9.38 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_base_client.cpython-310.pyc
ADDED
|
Binary file (47.9 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_client.cpython-310.pyc
ADDED
|
Binary file (40.8 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_compat.cpython-310.pyc
ADDED
|
Binary file (7 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_constants.cpython-310.pyc
ADDED
|
Binary file (639 Bytes). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_exceptions.cpython-310.pyc
ADDED
|
Binary file (7.8 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_files.cpython-310.pyc
ADDED
|
Binary file (4.54 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_legacy_response.cpython-310.pyc
ADDED
|
Binary file (15.3 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_models.cpython-310.pyc
ADDED
|
Binary file (25.4 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_module_client.cpython-310.pyc
ADDED
|
Binary file (7.76 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_qs.cpython-310.pyc
ADDED
|
Binary file (4.19 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_resource.cpython-310.pyc
ADDED
|
Binary file (1.56 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_response.cpython-310.pyc
ADDED
|
Binary file (25.6 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_streaming.cpython-310.pyc
ADDED
|
Binary file (11.6 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_types.cpython-310.pyc
ADDED
|
Binary file (7.38 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/_version.cpython-310.pyc
ADDED
|
Binary file (268 Bytes). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/pagination.cpython-310.pyc
ADDED
|
Binary file (4.69 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/__pycache__/version.cpython-310.pyc
ADDED
|
Binary file (316 Bytes). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__init__.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ._logs import SensitiveHeadersFilter as SensitiveHeadersFilter
|
| 2 |
+
from ._path import path_template as path_template
|
| 3 |
+
from ._sync import asyncify as asyncify
|
| 4 |
+
from ._proxy import LazyProxy as LazyProxy
|
| 5 |
+
from ._utils import (
|
| 6 |
+
flatten as flatten,
|
| 7 |
+
is_dict as is_dict,
|
| 8 |
+
is_list as is_list,
|
| 9 |
+
is_given as is_given,
|
| 10 |
+
is_tuple as is_tuple,
|
| 11 |
+
json_safe as json_safe,
|
| 12 |
+
lru_cache as lru_cache,
|
| 13 |
+
is_mapping as is_mapping,
|
| 14 |
+
is_tuple_t as is_tuple_t,
|
| 15 |
+
is_iterable as is_iterable,
|
| 16 |
+
is_sequence as is_sequence,
|
| 17 |
+
coerce_float as coerce_float,
|
| 18 |
+
is_mapping_t as is_mapping_t,
|
| 19 |
+
removeprefix as removeprefix,
|
| 20 |
+
removesuffix as removesuffix,
|
| 21 |
+
extract_files as extract_files,
|
| 22 |
+
is_sequence_t as is_sequence_t,
|
| 23 |
+
required_args as required_args,
|
| 24 |
+
coerce_boolean as coerce_boolean,
|
| 25 |
+
coerce_integer as coerce_integer,
|
| 26 |
+
file_from_path as file_from_path,
|
| 27 |
+
is_azure_client as is_azure_client,
|
| 28 |
+
strip_not_given as strip_not_given,
|
| 29 |
+
deepcopy_minimal as deepcopy_minimal,
|
| 30 |
+
get_async_library as get_async_library,
|
| 31 |
+
maybe_coerce_float as maybe_coerce_float,
|
| 32 |
+
get_required_header as get_required_header,
|
| 33 |
+
maybe_coerce_boolean as maybe_coerce_boolean,
|
| 34 |
+
maybe_coerce_integer as maybe_coerce_integer,
|
| 35 |
+
is_async_azure_client as is_async_azure_client,
|
| 36 |
+
)
|
| 37 |
+
from ._compat import (
|
| 38 |
+
get_args as get_args,
|
| 39 |
+
is_union as is_union,
|
| 40 |
+
get_origin as get_origin,
|
| 41 |
+
is_typeddict as is_typeddict,
|
| 42 |
+
is_literal_type as is_literal_type,
|
| 43 |
+
)
|
| 44 |
+
from ._typing import (
|
| 45 |
+
is_list_type as is_list_type,
|
| 46 |
+
is_union_type as is_union_type,
|
| 47 |
+
extract_type_arg as extract_type_arg,
|
| 48 |
+
is_iterable_type as is_iterable_type,
|
| 49 |
+
is_required_type as is_required_type,
|
| 50 |
+
is_sequence_type as is_sequence_type,
|
| 51 |
+
is_annotated_type as is_annotated_type,
|
| 52 |
+
is_type_alias_type as is_type_alias_type,
|
| 53 |
+
strip_annotated_type as strip_annotated_type,
|
| 54 |
+
extract_type_var_from_base as extract_type_var_from_base,
|
| 55 |
+
)
|
| 56 |
+
from ._streams import consume_sync_iterator as consume_sync_iterator, consume_async_iterator as consume_async_iterator
|
| 57 |
+
from ._transform import (
|
| 58 |
+
PropertyInfo as PropertyInfo,
|
| 59 |
+
transform as transform,
|
| 60 |
+
async_transform as async_transform,
|
| 61 |
+
maybe_transform as maybe_transform,
|
| 62 |
+
async_maybe_transform as async_maybe_transform,
|
| 63 |
+
)
|
| 64 |
+
from ._reflection import (
|
| 65 |
+
function_has_argument as function_has_argument,
|
| 66 |
+
assert_signatures_in_sync as assert_signatures_in_sync,
|
| 67 |
+
)
|
| 68 |
+
from ._datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.97 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_compat.cpython-310.pyc
ADDED
|
Binary file (1.89 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_datetime_parse.cpython-310.pyc
ADDED
|
Binary file (4.15 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_json.cpython-310.pyc
ADDED
|
Binary file (1.41 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_logs.cpython-310.pyc
ADDED
|
Binary file (1.65 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_path.cpython-310.pyc
ADDED
|
Binary file (3.83 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_proxy.cpython-310.pyc
ADDED
|
Binary file (2.47 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_reflection.cpython-310.pyc
ADDED
|
Binary file (1.55 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_resources_proxy.cpython-310.pyc
ADDED
|
Binary file (1.09 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_streams.cpython-310.pyc
ADDED
|
Binary file (664 Bytes). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_sync.cpython-310.pyc
ADDED
|
Binary file (2 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_transform.cpython-310.pyc
ADDED
|
Binary file (10.3 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_typing.cpython-310.pyc
ADDED
|
Binary file (4.22 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/__pycache__/_utils.cpython-310.pyc
ADDED
|
Binary file (13.9 kB). View file
|
|
|
.venv/lib/python3.10/site-packages/openai/_utils/_compat.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
import typing_extensions
|
| 5 |
+
from typing import Any, Type, Union, Literal, Optional
|
| 6 |
+
from datetime import date, datetime
|
| 7 |
+
from typing_extensions import get_args as _get_args, get_origin as _get_origin
|
| 8 |
+
|
| 9 |
+
from .._types import StrBytesIntFloat
|
| 10 |
+
from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime
|
| 11 |
+
|
| 12 |
+
_LITERAL_TYPES = {Literal, typing_extensions.Literal}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def get_args(tp: type[Any]) -> tuple[Any, ...]:
|
| 16 |
+
return _get_args(tp)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def get_origin(tp: type[Any]) -> type[Any] | None:
|
| 20 |
+
return _get_origin(tp)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def is_union(tp: Optional[Type[Any]]) -> bool:
|
| 24 |
+
if sys.version_info < (3, 10):
|
| 25 |
+
return tp is Union # type: ignore[comparison-overlap]
|
| 26 |
+
else:
|
| 27 |
+
import types
|
| 28 |
+
|
| 29 |
+
return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap]
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def is_typeddict(tp: Type[Any]) -> bool:
|
| 33 |
+
return typing_extensions.is_typeddict(tp)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def is_literal_type(tp: Type[Any]) -> bool:
|
| 37 |
+
return get_origin(tp) in _LITERAL_TYPES
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def parse_date(value: Union[date, StrBytesIntFloat]) -> date:
|
| 41 |
+
return _parse_date(value)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
|
| 45 |
+
return _parse_datetime(value)
|
.venv/lib/python3.10/site-packages/openai/_utils/_datetime_parse.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py
|
| 3 |
+
without the Pydantic v1 specific errors.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import re
|
| 9 |
+
from typing import Dict, Union, Optional
|
| 10 |
+
from datetime import date, datetime, timezone, timedelta
|
| 11 |
+
|
| 12 |
+
from .._types import StrBytesIntFloat
|
| 13 |
+
|
| 14 |
+
date_expr = r"(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})"
|
| 15 |
+
time_expr = (
|
| 16 |
+
r"(?P<hour>\d{1,2}):(?P<minute>\d{1,2})"
|
| 17 |
+
r"(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?"
|
| 18 |
+
r"(?P<tzinfo>Z|[+-]\d{2}(?::?\d{2})?)?$"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
date_re = re.compile(f"{date_expr}$")
|
| 22 |
+
datetime_re = re.compile(f"{date_expr}[T ]{time_expr}")
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
EPOCH = datetime(1970, 1, 1)
|
| 26 |
+
# if greater than this, the number is in ms, if less than or equal it's in seconds
|
| 27 |
+
# (in seconds this is 11th October 2603, in ms it's 20th August 1970)
|
| 28 |
+
MS_WATERSHED = int(2e10)
|
| 29 |
+
# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9
|
| 30 |
+
MAX_NUMBER = int(3e20)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]:
|
| 34 |
+
if isinstance(value, (int, float)):
|
| 35 |
+
return value
|
| 36 |
+
try:
|
| 37 |
+
return float(value)
|
| 38 |
+
except ValueError:
|
| 39 |
+
return None
|
| 40 |
+
except TypeError:
|
| 41 |
+
raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def _from_unix_seconds(seconds: Union[int, float]) -> datetime:
|
| 45 |
+
if seconds > MAX_NUMBER:
|
| 46 |
+
return datetime.max
|
| 47 |
+
elif seconds < -MAX_NUMBER:
|
| 48 |
+
return datetime.min
|
| 49 |
+
|
| 50 |
+
while abs(seconds) > MS_WATERSHED:
|
| 51 |
+
seconds /= 1000
|
| 52 |
+
dt = EPOCH + timedelta(seconds=seconds)
|
| 53 |
+
return dt.replace(tzinfo=timezone.utc)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]:
|
| 57 |
+
if value == "Z":
|
| 58 |
+
return timezone.utc
|
| 59 |
+
elif value is not None:
|
| 60 |
+
offset_mins = int(value[-2:]) if len(value) > 3 else 0
|
| 61 |
+
offset = 60 * int(value[1:3]) + offset_mins
|
| 62 |
+
if value[0] == "-":
|
| 63 |
+
offset = -offset
|
| 64 |
+
return timezone(timedelta(minutes=offset))
|
| 65 |
+
else:
|
| 66 |
+
return None
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
|
| 70 |
+
"""
|
| 71 |
+
Parse a datetime/int/float/string and return a datetime.datetime.
|
| 72 |
+
|
| 73 |
+
This function supports time zone offsets. When the input contains one,
|
| 74 |
+
the output uses a timezone with a fixed offset from UTC.
|
| 75 |
+
|
| 76 |
+
Raise ValueError if the input is well formatted but not a valid datetime.
|
| 77 |
+
Raise ValueError if the input isn't well formatted.
|
| 78 |
+
"""
|
| 79 |
+
if isinstance(value, datetime):
|
| 80 |
+
return value
|
| 81 |
+
|
| 82 |
+
number = _get_numeric(value, "datetime")
|
| 83 |
+
if number is not None:
|
| 84 |
+
return _from_unix_seconds(number)
|
| 85 |
+
|
| 86 |
+
if isinstance(value, bytes):
|
| 87 |
+
value = value.decode()
|
| 88 |
+
|
| 89 |
+
assert not isinstance(value, (float, int))
|
| 90 |
+
|
| 91 |
+
match = datetime_re.match(value)
|
| 92 |
+
if match is None:
|
| 93 |
+
raise ValueError("invalid datetime format")
|
| 94 |
+
|
| 95 |
+
kw = match.groupdict()
|
| 96 |
+
if kw["microsecond"]:
|
| 97 |
+
kw["microsecond"] = kw["microsecond"].ljust(6, "0")
|
| 98 |
+
|
| 99 |
+
tzinfo = _parse_timezone(kw.pop("tzinfo"))
|
| 100 |
+
kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None}
|
| 101 |
+
kw_["tzinfo"] = tzinfo
|
| 102 |
+
|
| 103 |
+
return datetime(**kw_) # type: ignore
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def parse_date(value: Union[date, StrBytesIntFloat]) -> date:
|
| 107 |
+
"""
|
| 108 |
+
Parse a date/int/float/string and return a datetime.date.
|
| 109 |
+
|
| 110 |
+
Raise ValueError if the input is well formatted but not a valid date.
|
| 111 |
+
Raise ValueError if the input isn't well formatted.
|
| 112 |
+
"""
|
| 113 |
+
if isinstance(value, date):
|
| 114 |
+
if isinstance(value, datetime):
|
| 115 |
+
return value.date()
|
| 116 |
+
else:
|
| 117 |
+
return value
|
| 118 |
+
|
| 119 |
+
number = _get_numeric(value, "date")
|
| 120 |
+
if number is not None:
|
| 121 |
+
return _from_unix_seconds(number).date()
|
| 122 |
+
|
| 123 |
+
if isinstance(value, bytes):
|
| 124 |
+
value = value.decode()
|
| 125 |
+
|
| 126 |
+
assert not isinstance(value, (float, int))
|
| 127 |
+
match = date_re.match(value)
|
| 128 |
+
if match is None:
|
| 129 |
+
raise ValueError("invalid date format")
|
| 130 |
+
|
| 131 |
+
kw = {k: int(v) for k, v in match.groupdict().items()}
|
| 132 |
+
|
| 133 |
+
try:
|
| 134 |
+
return date(**kw)
|
| 135 |
+
except ValueError:
|
| 136 |
+
raise ValueError("invalid date format") from None
|
.venv/lib/python3.10/site-packages/openai/_utils/_json.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from typing import Any
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
from typing_extensions import override
|
| 5 |
+
|
| 6 |
+
import pydantic
|
| 7 |
+
|
| 8 |
+
from .._compat import model_dump
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def openapi_dumps(obj: Any) -> bytes:
|
| 12 |
+
"""
|
| 13 |
+
Serialize an object to UTF-8 encoded JSON bytes.
|
| 14 |
+
|
| 15 |
+
Extends the standard json.dumps with support for additional types
|
| 16 |
+
commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc.
|
| 17 |
+
"""
|
| 18 |
+
return json.dumps(
|
| 19 |
+
obj,
|
| 20 |
+
cls=_CustomEncoder,
|
| 21 |
+
# Uses the same defaults as httpx's JSON serialization
|
| 22 |
+
ensure_ascii=False,
|
| 23 |
+
separators=(",", ":"),
|
| 24 |
+
allow_nan=False,
|
| 25 |
+
).encode()
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class _CustomEncoder(json.JSONEncoder):
|
| 29 |
+
@override
|
| 30 |
+
def default(self, o: Any) -> Any:
|
| 31 |
+
if isinstance(o, datetime):
|
| 32 |
+
return o.isoformat()
|
| 33 |
+
if isinstance(o, pydantic.BaseModel):
|
| 34 |
+
return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
|
| 35 |
+
return super().default(o)
|
.venv/lib/python3.10/site-packages/openai/_utils/_logs.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import logging
|
| 3 |
+
from typing_extensions import override
|
| 4 |
+
|
| 5 |
+
from ._utils import is_dict
|
| 6 |
+
|
| 7 |
+
logger: logging.Logger = logging.getLogger("openai")
|
| 8 |
+
httpx_logger: logging.Logger = logging.getLogger("httpx")
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
SENSITIVE_HEADERS = {"api-key", "authorization"}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def _basic_config() -> None:
|
| 15 |
+
# e.g. [2023-10-05 14:12:26 - openai._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK"
|
| 16 |
+
logging.basicConfig(
|
| 17 |
+
format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s",
|
| 18 |
+
datefmt="%Y-%m-%d %H:%M:%S",
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def setup_logging() -> None:
|
| 23 |
+
env = os.environ.get("OPENAI_LOG")
|
| 24 |
+
if env == "debug":
|
| 25 |
+
_basic_config()
|
| 26 |
+
logger.setLevel(logging.DEBUG)
|
| 27 |
+
httpx_logger.setLevel(logging.DEBUG)
|
| 28 |
+
elif env == "info":
|
| 29 |
+
_basic_config()
|
| 30 |
+
logger.setLevel(logging.INFO)
|
| 31 |
+
httpx_logger.setLevel(logging.INFO)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class SensitiveHeadersFilter(logging.Filter):
|
| 35 |
+
@override
|
| 36 |
+
def filter(self, record: logging.LogRecord) -> bool:
|
| 37 |
+
if is_dict(record.args) and "headers" in record.args and is_dict(record.args["headers"]):
|
| 38 |
+
headers = record.args["headers"] = {**record.args["headers"]}
|
| 39 |
+
for header in headers:
|
| 40 |
+
if str(header).lower() in SENSITIVE_HEADERS:
|
| 41 |
+
headers[header] = "<redacted>"
|
| 42 |
+
return True
|
.venv/lib/python3.10/site-packages/openai/_utils/_path.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
from typing import (
|
| 5 |
+
Any,
|
| 6 |
+
Mapping,
|
| 7 |
+
Callable,
|
| 8 |
+
)
|
| 9 |
+
from urllib.parse import quote
|
| 10 |
+
|
| 11 |
+
# Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E).
|
| 12 |
+
_DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$")
|
| 13 |
+
|
| 14 |
+
_PLACEHOLDER_RE = re.compile(r"\{(\w+)\}")
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _quote_path_segment_part(value: str) -> str:
|
| 18 |
+
"""Percent-encode `value` for use in a URI path segment.
|
| 19 |
+
|
| 20 |
+
Considers characters not in `pchar` set from RFC 3986 §3.3 to be unsafe.
|
| 21 |
+
https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
|
| 22 |
+
"""
|
| 23 |
+
# quote() already treats unreserved characters (letters, digits, and -._~)
|
| 24 |
+
# as safe, so we only need to add sub-delims, ':', and '@'.
|
| 25 |
+
# Notably, unlike the default `safe` for quote(), / is unsafe and must be quoted.
|
| 26 |
+
return quote(value, safe="!$&'()*+,;=:@")
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def _quote_query_part(value: str) -> str:
|
| 30 |
+
"""Percent-encode `value` for use in a URI query string.
|
| 31 |
+
|
| 32 |
+
Considers &, = and characters not in `query` set from RFC 3986 §3.4 to be unsafe.
|
| 33 |
+
https://datatracker.ietf.org/doc/html/rfc3986#section-3.4
|
| 34 |
+
"""
|
| 35 |
+
return quote(value, safe="!$'()*+,;:@/?")
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def _quote_fragment_part(value: str) -> str:
|
| 39 |
+
"""Percent-encode `value` for use in a URI fragment.
|
| 40 |
+
|
| 41 |
+
Considers characters not in `fragment` set from RFC 3986 §3.5 to be unsafe.
|
| 42 |
+
https://datatracker.ietf.org/doc/html/rfc3986#section-3.5
|
| 43 |
+
"""
|
| 44 |
+
return quote(value, safe="!$&'()*+,;=:@/?")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def _interpolate(
|
| 48 |
+
template: str,
|
| 49 |
+
values: Mapping[str, Any],
|
| 50 |
+
quoter: Callable[[str], str],
|
| 51 |
+
) -> str:
|
| 52 |
+
"""Replace {name} placeholders in `template`, quoting each value with `quoter`.
|
| 53 |
+
|
| 54 |
+
Placeholder names are looked up in `values`.
|
| 55 |
+
|
| 56 |
+
Raises:
|
| 57 |
+
KeyError: If a placeholder is not found in `values`.
|
| 58 |
+
"""
|
| 59 |
+
# re.split with a capturing group returns alternating
|
| 60 |
+
# [text, name, text, name, ..., text] elements.
|
| 61 |
+
parts = _PLACEHOLDER_RE.split(template)
|
| 62 |
+
|
| 63 |
+
for i in range(1, len(parts), 2):
|
| 64 |
+
name = parts[i]
|
| 65 |
+
if name not in values:
|
| 66 |
+
raise KeyError(f"a value for placeholder {{{name}}} was not provided")
|
| 67 |
+
val = values[name]
|
| 68 |
+
if val is None:
|
| 69 |
+
parts[i] = "null"
|
| 70 |
+
elif isinstance(val, bool):
|
| 71 |
+
parts[i] = "true" if val else "false"
|
| 72 |
+
else:
|
| 73 |
+
parts[i] = quoter(str(values[name]))
|
| 74 |
+
|
| 75 |
+
return "".join(parts)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def path_template(template: str, /, **kwargs: Any) -> str:
|
| 79 |
+
"""Interpolate {name} placeholders in `template` from keyword arguments.
|
| 80 |
+
|
| 81 |
+
Args:
|
| 82 |
+
template: The template string containing {name} placeholders.
|
| 83 |
+
**kwargs: Keyword arguments to interpolate into the template.
|
| 84 |
+
|
| 85 |
+
Returns:
|
| 86 |
+
The template with placeholders interpolated and percent-encoded.
|
| 87 |
+
|
| 88 |
+
Safe characters for percent-encoding are dependent on the URI component.
|
| 89 |
+
Placeholders in path and fragment portions are percent-encoded where the `segment`
|
| 90 |
+
and `fragment` sets from RFC 3986 respectively are considered safe.
|
| 91 |
+
Placeholders in the query portion are percent-encoded where the `query` set from
|
| 92 |
+
RFC 3986 §3.3 is considered safe except for = and & characters.
|
| 93 |
+
|
| 94 |
+
Raises:
|
| 95 |
+
KeyError: If a placeholder is not found in `kwargs`.
|
| 96 |
+
ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments).
|
| 97 |
+
"""
|
| 98 |
+
# Split the template into path, query, and fragment portions.
|
| 99 |
+
fragment_template: str | None = None
|
| 100 |
+
query_template: str | None = None
|
| 101 |
+
|
| 102 |
+
rest = template
|
| 103 |
+
if "#" in rest:
|
| 104 |
+
rest, fragment_template = rest.split("#", 1)
|
| 105 |
+
if "?" in rest:
|
| 106 |
+
rest, query_template = rest.split("?", 1)
|
| 107 |
+
path_template = rest
|
| 108 |
+
|
| 109 |
+
# Interpolate each portion with the appropriate quoting rules.
|
| 110 |
+
path_result = _interpolate(path_template, kwargs, _quote_path_segment_part)
|
| 111 |
+
|
| 112 |
+
# Reject dot-segments (. and ..) in the final assembled path. The check
|
| 113 |
+
# runs after interpolation so that adjacent placeholders or a mix of static
|
| 114 |
+
# text and placeholders that together form a dot-segment are caught.
|
| 115 |
+
# Also reject percent-encoded dot-segments to protect against incorrectly
|
| 116 |
+
# implemented normalization in servers/proxies.
|
| 117 |
+
for segment in path_result.split("/"):
|
| 118 |
+
if _DOT_SEGMENT_RE.match(segment):
|
| 119 |
+
raise ValueError(f"Constructed path {path_result!r} contains dot-segment {segment!r} which is not allowed")
|
| 120 |
+
|
| 121 |
+
result = path_result
|
| 122 |
+
if query_template is not None:
|
| 123 |
+
result += "?" + _interpolate(query_template, kwargs, _quote_query_part)
|
| 124 |
+
if fragment_template is not None:
|
| 125 |
+
result += "#" + _interpolate(fragment_template, kwargs, _quote_fragment_part)
|
| 126 |
+
|
| 127 |
+
return result
|
.venv/lib/python3.10/site-packages/openai/_utils/_proxy.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from abc import ABC, abstractmethod
|
| 4 |
+
from typing import Generic, TypeVar, Iterable, cast
|
| 5 |
+
from typing_extensions import override
|
| 6 |
+
|
| 7 |
+
T = TypeVar("T")
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class LazyProxy(Generic[T], ABC):
|
| 11 |
+
"""Implements data methods to pretend that an instance is another instance.
|
| 12 |
+
|
| 13 |
+
This includes forwarding attribute access and other methods.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
# Note: we have to special case proxies that themselves return proxies
|
| 17 |
+
# to support using a proxy as a catch-all for any random access, e.g. `proxy.foo.bar.baz`
|
| 18 |
+
|
| 19 |
+
def __getattr__(self, attr: str) -> object:
|
| 20 |
+
proxied = self.__get_proxied__()
|
| 21 |
+
if isinstance(proxied, LazyProxy):
|
| 22 |
+
return proxied # pyright: ignore
|
| 23 |
+
return getattr(proxied, attr)
|
| 24 |
+
|
| 25 |
+
@override
|
| 26 |
+
def __repr__(self) -> str:
|
| 27 |
+
proxied = self.__get_proxied__()
|
| 28 |
+
if isinstance(proxied, LazyProxy):
|
| 29 |
+
return proxied.__class__.__name__
|
| 30 |
+
return repr(self.__get_proxied__())
|
| 31 |
+
|
| 32 |
+
@override
|
| 33 |
+
def __str__(self) -> str:
|
| 34 |
+
proxied = self.__get_proxied__()
|
| 35 |
+
if isinstance(proxied, LazyProxy):
|
| 36 |
+
return proxied.__class__.__name__
|
| 37 |
+
return str(proxied)
|
| 38 |
+
|
| 39 |
+
@override
|
| 40 |
+
def __dir__(self) -> Iterable[str]:
|
| 41 |
+
proxied = self.__get_proxied__()
|
| 42 |
+
if isinstance(proxied, LazyProxy):
|
| 43 |
+
return []
|
| 44 |
+
return proxied.__dir__()
|
| 45 |
+
|
| 46 |
+
@property # type: ignore
|
| 47 |
+
@override
|
| 48 |
+
def __class__(self) -> type: # pyright: ignore
|
| 49 |
+
try:
|
| 50 |
+
proxied = self.__get_proxied__()
|
| 51 |
+
except Exception:
|
| 52 |
+
return type(self)
|
| 53 |
+
if issubclass(type(proxied), LazyProxy):
|
| 54 |
+
return type(proxied)
|
| 55 |
+
return proxied.__class__
|
| 56 |
+
|
| 57 |
+
def __get_proxied__(self) -> T:
|
| 58 |
+
return self.__load__()
|
| 59 |
+
|
| 60 |
+
def __as_proxied__(self) -> T:
|
| 61 |
+
"""Helper method that returns the current proxy, typed as the loaded object"""
|
| 62 |
+
return cast(T, self)
|
| 63 |
+
|
| 64 |
+
@abstractmethod
|
| 65 |
+
def __load__(self) -> T: ...
|
.venv/lib/python3.10/site-packages/openai/_utils/_reflection.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import inspect
|
| 4 |
+
from typing import Any, Callable
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool:
|
| 8 |
+
"""Returns whether or not the given function has a specific parameter"""
|
| 9 |
+
sig = inspect.signature(func)
|
| 10 |
+
return arg_name in sig.parameters
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def assert_signatures_in_sync(
|
| 14 |
+
source_func: Callable[..., Any],
|
| 15 |
+
check_func: Callable[..., Any],
|
| 16 |
+
*,
|
| 17 |
+
exclude_params: set[str] = set(),
|
| 18 |
+
description: str = "",
|
| 19 |
+
) -> None:
|
| 20 |
+
"""Ensure that the signature of the second function matches the first."""
|
| 21 |
+
|
| 22 |
+
check_sig = inspect.signature(check_func)
|
| 23 |
+
source_sig = inspect.signature(source_func)
|
| 24 |
+
|
| 25 |
+
errors: list[str] = []
|
| 26 |
+
|
| 27 |
+
for name, source_param in source_sig.parameters.items():
|
| 28 |
+
if name in exclude_params:
|
| 29 |
+
continue
|
| 30 |
+
|
| 31 |
+
custom_param = check_sig.parameters.get(name)
|
| 32 |
+
if not custom_param:
|
| 33 |
+
errors.append(f"the `{name}` param is missing")
|
| 34 |
+
continue
|
| 35 |
+
|
| 36 |
+
if custom_param.annotation != source_param.annotation:
|
| 37 |
+
errors.append(
|
| 38 |
+
f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}"
|
| 39 |
+
)
|
| 40 |
+
continue
|
| 41 |
+
|
| 42 |
+
if errors:
|
| 43 |
+
raise AssertionError(
|
| 44 |
+
f"{len(errors)} errors encountered when comparing signatures{description}:\n\n" + "\n\n".join(errors)
|
| 45 |
+
)
|
.venv/lib/python3.10/site-packages/openai/_utils/_resources_proxy.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import Any
|
| 4 |
+
from typing_extensions import override
|
| 5 |
+
|
| 6 |
+
from ._proxy import LazyProxy
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class ResourcesProxy(LazyProxy[Any]):
|
| 10 |
+
"""A proxy for the `openai.resources` module.
|
| 11 |
+
|
| 12 |
+
This is used so that we can lazily import `openai.resources` only when
|
| 13 |
+
needed *and* so that users can just import `openai` and reference `openai.resources`
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
@override
|
| 17 |
+
def __load__(self) -> Any:
|
| 18 |
+
import importlib
|
| 19 |
+
|
| 20 |
+
mod = importlib.import_module("openai.resources")
|
| 21 |
+
return mod
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
resources = ResourcesProxy().__as_proxied__()
|
.venv/lib/python3.10/site-packages/openai/_utils/_streams.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
from typing_extensions import Iterator, AsyncIterator
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def consume_sync_iterator(iterator: Iterator[Any]) -> None:
|
| 6 |
+
for _ in iterator:
|
| 7 |
+
...
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
async def consume_async_iterator(iterator: AsyncIterator[Any]) -> None:
|
| 11 |
+
async for _ in iterator:
|
| 12 |
+
...
|
.venv/lib/python3.10/site-packages/openai/_utils/_sync.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import asyncio
|
| 4 |
+
import functools
|
| 5 |
+
from typing import TypeVar, Callable, Awaitable
|
| 6 |
+
from typing_extensions import ParamSpec
|
| 7 |
+
|
| 8 |
+
import anyio
|
| 9 |
+
import sniffio
|
| 10 |
+
import anyio.to_thread
|
| 11 |
+
|
| 12 |
+
T_Retval = TypeVar("T_Retval")
|
| 13 |
+
T_ParamSpec = ParamSpec("T_ParamSpec")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
async def to_thread(
|
| 17 |
+
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
| 18 |
+
) -> T_Retval:
|
| 19 |
+
if sniffio.current_async_library() == "asyncio":
|
| 20 |
+
return await asyncio.to_thread(func, *args, **kwargs)
|
| 21 |
+
|
| 22 |
+
return await anyio.to_thread.run_sync(
|
| 23 |
+
functools.partial(func, *args, **kwargs),
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# inspired by `asyncer`, https://github.com/tiangolo/asyncer
|
| 28 |
+
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
|
| 29 |
+
"""
|
| 30 |
+
Take a blocking function and create an async one that receives the same
|
| 31 |
+
positional and keyword arguments.
|
| 32 |
+
|
| 33 |
+
Usage:
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
def blocking_func(arg1, arg2, kwarg1=None):
|
| 37 |
+
# blocking code
|
| 38 |
+
return result
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1)
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Arguments
|
| 45 |
+
|
| 46 |
+
`function`: a blocking regular callable (e.g. a function)
|
| 47 |
+
|
| 48 |
+
## Return
|
| 49 |
+
|
| 50 |
+
An async function that takes the same positional and keyword arguments as the
|
| 51 |
+
original one, that when called runs the same original function in a thread worker
|
| 52 |
+
and returns the result.
|
| 53 |
+
"""
|
| 54 |
+
|
| 55 |
+
async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval:
|
| 56 |
+
return await to_thread(function, *args, **kwargs)
|
| 57 |
+
|
| 58 |
+
return wrapper
|