codeset 0.1.0a12__tar.gz → 0.1.0a14__tar.gz
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.
Potentially problematic release.
This version of codeset might be problematic. Click here for more details.
- {codeset-0.1.0a12 → codeset-0.1.0a14}/.gitignore +0 -1
- codeset-0.1.0a14/.release-please-manifest.json +3 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/CHANGELOG.md +45 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/PKG-INFO +1 -1
- {codeset-0.1.0a12 → codeset-0.1.0a14}/api.md +1 -1
- {codeset-0.1.0a12 → codeset-0.1.0a14}/pyproject.toml +55 -3
- {codeset-0.1.0a12 → codeset-0.1.0a14}/requirements-dev.lock +5 -3
- {codeset-0.1.0a12 → codeset-0.1.0a14}/requirements.lock +5 -2
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/__init__.py +3 -1
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_base_client.py +16 -13
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_client.py +8 -8
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_compat.py +48 -48
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_files.py +4 -4
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_models.py +51 -45
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_qs.py +7 -7
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_types.py +53 -12
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/__init__.py +9 -2
- codeset-0.1.0a14/src/codeset/_utils/_compat.py +45 -0
- codeset-0.1.0a14/src/codeset/_utils/_datetime_parse.py +136 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_transform.py +13 -3
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_typing.py +6 -1
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_utils.py +4 -5
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_version.py +1 -1
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/resources/health.py +3 -3
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/resources/samples.py +48 -12
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/resources/sessions/sessions.py +17 -17
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/resources/sessions/verify.py +5 -5
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/__init__.py +1 -0
- codeset-0.1.0a14/src/codeset/types/sample_list_params.py +13 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session.py +3 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/api_resources/sessions/test_verify.py +16 -16
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/api_resources/test_health.py +6 -6
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/api_resources/test_samples.py +32 -16
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/api_resources/test_sessions.py +48 -48
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_client.py +6 -47
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_models.py +24 -24
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_transform.py +17 -10
- codeset-0.1.0a14/tests/test_utils/test_datetime_parse.py +110 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/utils.py +13 -5
- codeset-0.1.0a12/.release-please-manifest.json +0 -3
- codeset-0.1.0a12/mypy.ini +0 -50
- {codeset-0.1.0a12 → codeset-0.1.0a14}/CONTRIBUTING.md +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/LICENSE +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/README.md +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/SECURITY.md +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/bin/check-release-environment +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/bin/publish-pypi +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/examples/.keep +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/noxfile.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/release-please-config.json +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_constants.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_exceptions.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_resource.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_streaming.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_logs.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_proxy.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_reflection.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_resources_proxy.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_streams.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/_utils/_sync.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/lib/.keep +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/py.typed +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/resources/__init__.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/resources/sessions/__init__.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/container_info.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/error_info.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/health_check_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/sample_download_params.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/sample_list_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_close_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_create_params.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_create_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_execute_command_params.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_execute_command_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_list_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_status.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_str_replace_params.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/session_str_replace_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/sessions/__init__.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/sessions/job_status.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/sessions/verify_start_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/src/codeset/types/sessions/verify_status_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/__init__.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/api_resources/__init__.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/api_resources/sessions/__init__.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/conftest.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/sample_file.txt +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_deepcopy.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_extract_files.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_files.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_qs.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_required_args.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_response.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_streaming.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_utils/test_proxy.py +0 -0
- {codeset-0.1.0a12 → codeset-0.1.0a14}/tests/test_utils/test_typing.py +0 -0
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.14 (2025-10-09)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/codeset-ai/codeset-sdk/compare/v0.1.0-alpha.13...v0.1.0-alpha.14)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([b6ae1e4](https://github.com/codeset-ai/codeset-sdk/commit/b6ae1e422ff911f8f5cf79662238edd487be3c8b))
|
|
10
|
+
* improve future compat with pydantic v3 ([b987901](https://github.com/codeset-ai/codeset-sdk/commit/b9879013868363f7fb8550dd0e9aecfdd121dd71))
|
|
11
|
+
* **types:** replace List[str] with SequenceNotStr in params ([e66585e](https://github.com/codeset-ai/codeset-sdk/commit/e66585e6292e1a7b9213007700830027ea14902b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* avoid newer type syntax ([e1f6c99](https://github.com/codeset-ai/codeset-sdk/commit/e1f6c990fc5bc4881066a4c34b4b8ad678ce7ee6))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
|
|
21
|
+
* do not install brew dependencies in ./scripts/bootstrap by default ([ba313c2](https://github.com/codeset-ai/codeset-sdk/commit/ba313c2dbd4f9f78fe65055d1f5a0d9fccb3b1a9))
|
|
22
|
+
* **internal:** add Sequence related utils ([1c138c5](https://github.com/codeset-ai/codeset-sdk/commit/1c138c599956cac4963c88bffe794671c7c48e34))
|
|
23
|
+
* **internal:** change ci workflow machines ([b394c99](https://github.com/codeset-ai/codeset-sdk/commit/b394c997d82a77c247f836bd3971f3e72cf65754))
|
|
24
|
+
* **internal:** codegen related update ([7920ab8](https://github.com/codeset-ai/codeset-sdk/commit/7920ab8bddc81b691941e72035dee53378687fe2))
|
|
25
|
+
* **internal:** fix ruff target version ([ca3fb98](https://github.com/codeset-ai/codeset-sdk/commit/ca3fb983d4369ac2590309f82d6e6139b612bbbd))
|
|
26
|
+
* **internal:** move mypy configurations to `pyproject.toml` file ([0291768](https://github.com/codeset-ai/codeset-sdk/commit/02917689405adc9ea8733caa64cd21a9d344a95a))
|
|
27
|
+
* **internal:** update comment in script ([0e878ee](https://github.com/codeset-ai/codeset-sdk/commit/0e878ee55035ba152f235230d6e0d8235c671000))
|
|
28
|
+
* **internal:** update pydantic dependency ([cf3d9ef](https://github.com/codeset-ai/codeset-sdk/commit/cf3d9efbe0ec2d5a56bb38b5a55e835a772e2cb8))
|
|
29
|
+
* **internal:** update pyright exclude list ([012ed02](https://github.com/codeset-ai/codeset-sdk/commit/012ed02d18e581c55fd6aad400db8165ca44b0b6))
|
|
30
|
+
* **tests:** simplify `get_platform` test ([b6dc1e5](https://github.com/codeset-ai/codeset-sdk/commit/b6dc1e5f48b09d44ad0561089cfccb839a52c590))
|
|
31
|
+
* **types:** change optional parameter type from NotGiven to Omit ([030c521](https://github.com/codeset-ai/codeset-sdk/commit/030c521a4cedac4cb98d2cf324f3196f9d771a8b))
|
|
32
|
+
* update @stainless-api/prism-cli to v5.15.0 ([aefef64](https://github.com/codeset-ai/codeset-sdk/commit/aefef64d5c4d4b9cae7fd89b593734d7a4c173c5))
|
|
33
|
+
* update github action ([9b84ce1](https://github.com/codeset-ai/codeset-sdk/commit/9b84ce19164583a2df871deb9ec8c4cdd55940a0))
|
|
34
|
+
|
|
35
|
+
## 0.1.0-alpha.13 (2025-07-31)
|
|
36
|
+
|
|
37
|
+
Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/codeset-ai/codeset-sdk/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* **client:** support file upload requests ([dc5d6ec](https://github.com/codeset-ai/codeset-sdk/commit/dc5d6ecd367c436d22ec66da68a906abc978382f))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Chores
|
|
45
|
+
|
|
46
|
+
* **project:** add settings file for vscode ([31f4a90](https://github.com/codeset-ai/codeset-sdk/commit/31f4a909e7e7e9699a47c15c9cbee3536929e512))
|
|
47
|
+
|
|
3
48
|
## 0.1.0-alpha.12 (2025-07-23)
|
|
4
49
|
|
|
5
50
|
Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/codeset-ai/codeset-sdk/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: codeset
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a14
|
|
4
4
|
Summary: The official Python library for the codeset API
|
|
5
5
|
Project-URL: Homepage, https://github.com/codeset-ai/codeset-sdk
|
|
6
6
|
Project-URL: Repository, https://github.com/codeset-ai/codeset-sdk
|
|
@@ -20,7 +20,7 @@ from codeset.types import SampleListResponse
|
|
|
20
20
|
|
|
21
21
|
Methods:
|
|
22
22
|
|
|
23
|
-
- <code title="get /samples">client.samples.<a href="./src/codeset/resources/samples.py">list</a>() -> <a href="./src/codeset/types/sample_list_response.py">SampleListResponse</a></code>
|
|
23
|
+
- <code title="get /samples">client.samples.<a href="./src/codeset/resources/samples.py">list</a>(\*\*<a href="src/codeset/types/sample_list_params.py">params</a>) -> <a href="./src/codeset/types/sample_list_response.py">SampleListResponse</a></code>
|
|
24
24
|
- <code title="get /samples/{dataset}/{sample_id}/download">client.samples.<a href="./src/codeset/resources/samples.py">download</a>(sample_id, \*, dataset, \*\*<a href="src/codeset/types/sample_download_params.py">params</a>) -> object</code>
|
|
25
25
|
|
|
26
26
|
# Sessions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "codeset"
|
|
3
|
-
version = "0.1.0-alpha.
|
|
3
|
+
version = "0.1.0-alpha.14"
|
|
4
4
|
description = "The official Python library for the codeset API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -56,7 +56,6 @@ dev-dependencies = [
|
|
|
56
56
|
"dirty-equals>=0.6.0",
|
|
57
57
|
"importlib-metadata>=6.7.0",
|
|
58
58
|
"rich>=13.7.1",
|
|
59
|
-
"nest_asyncio==1.6.0",
|
|
60
59
|
"pytest-xdist>=3.6.1",
|
|
61
60
|
]
|
|
62
61
|
|
|
@@ -148,6 +147,7 @@ exclude = [
|
|
|
148
147
|
"_dev",
|
|
149
148
|
".venv",
|
|
150
149
|
".nox",
|
|
150
|
+
".git",
|
|
151
151
|
]
|
|
152
152
|
|
|
153
153
|
reportImplicitOverride = true
|
|
@@ -156,10 +156,62 @@ reportOverlappingOverload = false
|
|
|
156
156
|
reportImportCycles = false
|
|
157
157
|
reportPrivateUsage = false
|
|
158
158
|
|
|
159
|
+
[tool.mypy]
|
|
160
|
+
pretty = true
|
|
161
|
+
show_error_codes = true
|
|
162
|
+
|
|
163
|
+
# Exclude _files.py because mypy isn't smart enough to apply
|
|
164
|
+
# the correct type narrowing and as this is an internal module
|
|
165
|
+
# it's fine to just use Pyright.
|
|
166
|
+
#
|
|
167
|
+
# We also exclude our `tests` as mypy doesn't always infer
|
|
168
|
+
# types correctly and Pyright will still catch any type errors.
|
|
169
|
+
exclude = ['src/codeset/_files.py', '_dev/.*.py', 'tests/.*']
|
|
170
|
+
|
|
171
|
+
strict_equality = true
|
|
172
|
+
implicit_reexport = true
|
|
173
|
+
check_untyped_defs = true
|
|
174
|
+
no_implicit_optional = true
|
|
175
|
+
|
|
176
|
+
warn_return_any = true
|
|
177
|
+
warn_unreachable = true
|
|
178
|
+
warn_unused_configs = true
|
|
179
|
+
|
|
180
|
+
# Turn these options off as it could cause conflicts
|
|
181
|
+
# with the Pyright options.
|
|
182
|
+
warn_unused_ignores = false
|
|
183
|
+
warn_redundant_casts = false
|
|
184
|
+
|
|
185
|
+
disallow_any_generics = true
|
|
186
|
+
disallow_untyped_defs = true
|
|
187
|
+
disallow_untyped_calls = true
|
|
188
|
+
disallow_subclassing_any = true
|
|
189
|
+
disallow_incomplete_defs = true
|
|
190
|
+
disallow_untyped_decorators = true
|
|
191
|
+
cache_fine_grained = true
|
|
192
|
+
|
|
193
|
+
# By default, mypy reports an error if you assign a value to the result
|
|
194
|
+
# of a function call that doesn't return anything. We do this in our test
|
|
195
|
+
# cases:
|
|
196
|
+
# ```
|
|
197
|
+
# result = ...
|
|
198
|
+
# assert result is None
|
|
199
|
+
# ```
|
|
200
|
+
# Changing this codegen to make mypy happy would increase complexity
|
|
201
|
+
# and would not be worth it.
|
|
202
|
+
disable_error_code = "func-returns-value,overload-cannot-match"
|
|
203
|
+
|
|
204
|
+
# https://github.com/python/mypy/issues/12162
|
|
205
|
+
[[tool.mypy.overrides]]
|
|
206
|
+
module = "black.files.*"
|
|
207
|
+
ignore_errors = true
|
|
208
|
+
ignore_missing_imports = true
|
|
209
|
+
|
|
210
|
+
|
|
159
211
|
[tool.ruff]
|
|
160
212
|
line-length = 120
|
|
161
213
|
output-format = "grouped"
|
|
162
|
-
target-version = "
|
|
214
|
+
target-version = "py38"
|
|
163
215
|
|
|
164
216
|
[tool.ruff.format]
|
|
165
217
|
docstring-code-format = true
|
|
@@ -75,7 +75,6 @@ multidict==6.4.4
|
|
|
75
75
|
mypy==1.14.1
|
|
76
76
|
mypy-extensions==1.0.0
|
|
77
77
|
# via mypy
|
|
78
|
-
nest-asyncio==1.6.0
|
|
79
78
|
nodeenv==1.8.0
|
|
80
79
|
# via pyright
|
|
81
80
|
nox==2023.4.22
|
|
@@ -89,9 +88,9 @@ pluggy==1.5.0
|
|
|
89
88
|
propcache==0.3.1
|
|
90
89
|
# via aiohttp
|
|
91
90
|
# via yarl
|
|
92
|
-
pydantic==2.
|
|
91
|
+
pydantic==2.11.9
|
|
93
92
|
# via codeset
|
|
94
|
-
pydantic-core==2.
|
|
93
|
+
pydantic-core==2.33.2
|
|
95
94
|
# via pydantic
|
|
96
95
|
pygments==2.18.0
|
|
97
96
|
# via rich
|
|
@@ -127,6 +126,9 @@ typing-extensions==4.12.2
|
|
|
127
126
|
# via pydantic
|
|
128
127
|
# via pydantic-core
|
|
129
128
|
# via pyright
|
|
129
|
+
# via typing-inspection
|
|
130
|
+
typing-inspection==0.4.1
|
|
131
|
+
# via pydantic
|
|
130
132
|
virtualenv==20.24.5
|
|
131
133
|
# via nox
|
|
132
134
|
yarl==1.20.0
|
|
@@ -55,9 +55,9 @@ multidict==6.4.4
|
|
|
55
55
|
propcache==0.3.1
|
|
56
56
|
# via aiohttp
|
|
57
57
|
# via yarl
|
|
58
|
-
pydantic==2.
|
|
58
|
+
pydantic==2.11.9
|
|
59
59
|
# via codeset
|
|
60
|
-
pydantic-core==2.
|
|
60
|
+
pydantic-core==2.33.2
|
|
61
61
|
# via pydantic
|
|
62
62
|
sniffio==1.3.0
|
|
63
63
|
# via anyio
|
|
@@ -68,5 +68,8 @@ typing-extensions==4.12.2
|
|
|
68
68
|
# via multidict
|
|
69
69
|
# via pydantic
|
|
70
70
|
# via pydantic-core
|
|
71
|
+
# via typing-inspection
|
|
72
|
+
typing-inspection==0.4.1
|
|
73
|
+
# via pydantic
|
|
71
74
|
yarl==1.20.0
|
|
72
75
|
# via aiohttp
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import typing as _t
|
|
4
4
|
|
|
5
5
|
from . import types
|
|
6
|
-
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
|
|
6
|
+
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
|
|
7
7
|
from ._utils import file_from_path
|
|
8
8
|
from ._client import Client, Stream, Codeset, Timeout, Transport, AsyncClient, AsyncStream, AsyncCodeset, RequestOptions
|
|
9
9
|
from ._models import BaseModel
|
|
@@ -38,7 +38,9 @@ __all__ = [
|
|
|
38
38
|
"ProxiesTypes",
|
|
39
39
|
"NotGiven",
|
|
40
40
|
"NOT_GIVEN",
|
|
41
|
+
"not_given",
|
|
41
42
|
"Omit",
|
|
43
|
+
"omit",
|
|
42
44
|
"CodesetError",
|
|
43
45
|
"APIError",
|
|
44
46
|
"APIStatusError",
|
|
@@ -42,7 +42,6 @@ from . import _exceptions
|
|
|
42
42
|
from ._qs import Querystring
|
|
43
43
|
from ._files import to_httpx_files, async_to_httpx_files
|
|
44
44
|
from ._types import (
|
|
45
|
-
NOT_GIVEN,
|
|
46
45
|
Body,
|
|
47
46
|
Omit,
|
|
48
47
|
Query,
|
|
@@ -57,9 +56,10 @@ from ._types import (
|
|
|
57
56
|
RequestOptions,
|
|
58
57
|
HttpxRequestFiles,
|
|
59
58
|
ModelBuilderProtocol,
|
|
59
|
+
not_given,
|
|
60
60
|
)
|
|
61
61
|
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
|
|
62
|
-
from ._compat import
|
|
62
|
+
from ._compat import PYDANTIC_V1, model_copy, model_dump
|
|
63
63
|
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
|
|
64
64
|
from ._response import (
|
|
65
65
|
APIResponse,
|
|
@@ -145,9 +145,9 @@ class PageInfo:
|
|
|
145
145
|
def __init__(
|
|
146
146
|
self,
|
|
147
147
|
*,
|
|
148
|
-
url: URL | NotGiven =
|
|
149
|
-
json: Body | NotGiven =
|
|
150
|
-
params: Query | NotGiven =
|
|
148
|
+
url: URL | NotGiven = not_given,
|
|
149
|
+
json: Body | NotGiven = not_given,
|
|
150
|
+
params: Query | NotGiven = not_given,
|
|
151
151
|
) -> None:
|
|
152
152
|
self.url = url
|
|
153
153
|
self.json = json
|
|
@@ -232,7 +232,7 @@ class BaseSyncPage(BasePage[_T], Generic[_T]):
|
|
|
232
232
|
model: Type[_T],
|
|
233
233
|
options: FinalRequestOptions,
|
|
234
234
|
) -> None:
|
|
235
|
-
if
|
|
235
|
+
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
|
236
236
|
self.__pydantic_private__ = {}
|
|
237
237
|
|
|
238
238
|
self._model = model
|
|
@@ -320,7 +320,7 @@ class BaseAsyncPage(BasePage[_T], Generic[_T]):
|
|
|
320
320
|
client: AsyncAPIClient,
|
|
321
321
|
options: FinalRequestOptions,
|
|
322
322
|
) -> None:
|
|
323
|
-
if
|
|
323
|
+
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
|
324
324
|
self.__pydantic_private__ = {}
|
|
325
325
|
|
|
326
326
|
self._model = model
|
|
@@ -532,7 +532,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
532
532
|
is_body_allowed = options.method.lower() != "get"
|
|
533
533
|
|
|
534
534
|
if is_body_allowed:
|
|
535
|
-
|
|
535
|
+
if isinstance(json_data, bytes):
|
|
536
|
+
kwargs["content"] = json_data
|
|
537
|
+
else:
|
|
538
|
+
kwargs["json"] = json_data if is_given(json_data) else None
|
|
536
539
|
kwargs["files"] = files
|
|
537
540
|
else:
|
|
538
541
|
headers.pop("Content-Type", None)
|
|
@@ -592,7 +595,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
592
595
|
# we internally support defining a temporary header to override the
|
|
593
596
|
# default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response`
|
|
594
597
|
# see _response.py for implementation details
|
|
595
|
-
override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER,
|
|
598
|
+
override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given)
|
|
596
599
|
if is_given(override_cast_to):
|
|
597
600
|
options.headers = headers
|
|
598
601
|
return cast(Type[ResponseT], override_cast_to)
|
|
@@ -822,7 +825,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
822
825
|
version: str,
|
|
823
826
|
base_url: str | URL,
|
|
824
827
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
825
|
-
timeout: float | Timeout | None | NotGiven =
|
|
828
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
826
829
|
http_client: httpx.Client | None = None,
|
|
827
830
|
custom_headers: Mapping[str, str] | None = None,
|
|
828
831
|
custom_query: Mapping[str, object] | None = None,
|
|
@@ -1353,7 +1356,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1353
1356
|
base_url: str | URL,
|
|
1354
1357
|
_strict_response_validation: bool,
|
|
1355
1358
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
1356
|
-
timeout: float | Timeout | None | NotGiven =
|
|
1359
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
1357
1360
|
http_client: httpx.AsyncClient | None = None,
|
|
1358
1361
|
custom_headers: Mapping[str, str] | None = None,
|
|
1359
1362
|
custom_query: Mapping[str, object] | None = None,
|
|
@@ -1815,8 +1818,8 @@ def make_request_options(
|
|
|
1815
1818
|
extra_query: Query | None = None,
|
|
1816
1819
|
extra_body: Body | None = None,
|
|
1817
1820
|
idempotency_key: str | None = None,
|
|
1818
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
1819
|
-
post_parser: PostParser | NotGiven =
|
|
1821
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1822
|
+
post_parser: PostParser | NotGiven = not_given,
|
|
1820
1823
|
) -> RequestOptions:
|
|
1821
1824
|
"""Create a dict of type RequestOptions without keys of NotGiven values."""
|
|
1822
1825
|
options: RequestOptions = {}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Mapping
|
|
7
7
|
from typing_extensions import Self, override
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
@@ -11,7 +11,6 @@ import httpx
|
|
|
11
11
|
from . import _exceptions
|
|
12
12
|
from ._qs import Querystring
|
|
13
13
|
from ._types import (
|
|
14
|
-
NOT_GIVEN,
|
|
15
14
|
Omit,
|
|
16
15
|
Headers,
|
|
17
16
|
Timeout,
|
|
@@ -19,6 +18,7 @@ from ._types import (
|
|
|
19
18
|
Transport,
|
|
20
19
|
ProxiesTypes,
|
|
21
20
|
RequestOptions,
|
|
21
|
+
not_given,
|
|
22
22
|
)
|
|
23
23
|
from ._utils import is_given, get_async_library
|
|
24
24
|
from ._version import __version__
|
|
@@ -50,7 +50,7 @@ class Codeset(SyncAPIClient):
|
|
|
50
50
|
*,
|
|
51
51
|
api_key: str | None = None,
|
|
52
52
|
base_url: str | httpx.URL | None = None,
|
|
53
|
-
timeout:
|
|
53
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
54
54
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
55
55
|
default_headers: Mapping[str, str] | None = None,
|
|
56
56
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -136,9 +136,9 @@ class Codeset(SyncAPIClient):
|
|
|
136
136
|
*,
|
|
137
137
|
api_key: str | None = None,
|
|
138
138
|
base_url: str | httpx.URL | None = None,
|
|
139
|
-
timeout: float | Timeout | None | NotGiven =
|
|
139
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
140
140
|
http_client: httpx.Client | None = None,
|
|
141
|
-
max_retries: int | NotGiven =
|
|
141
|
+
max_retries: int | NotGiven = not_given,
|
|
142
142
|
default_headers: Mapping[str, str] | None = None,
|
|
143
143
|
set_default_headers: Mapping[str, str] | None = None,
|
|
144
144
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -231,7 +231,7 @@ class AsyncCodeset(AsyncAPIClient):
|
|
|
231
231
|
*,
|
|
232
232
|
api_key: str | None = None,
|
|
233
233
|
base_url: str | httpx.URL | None = None,
|
|
234
|
-
timeout:
|
|
234
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
235
235
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
236
236
|
default_headers: Mapping[str, str] | None = None,
|
|
237
237
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -317,9 +317,9 @@ class AsyncCodeset(AsyncAPIClient):
|
|
|
317
317
|
*,
|
|
318
318
|
api_key: str | None = None,
|
|
319
319
|
base_url: str | httpx.URL | None = None,
|
|
320
|
-
timeout: float | Timeout | None | NotGiven =
|
|
320
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
321
321
|
http_client: httpx.AsyncClient | None = None,
|
|
322
|
-
max_retries: int | NotGiven =
|
|
322
|
+
max_retries: int | NotGiven = not_given,
|
|
323
323
|
default_headers: Mapping[str, str] | None = None,
|
|
324
324
|
set_default_headers: Mapping[str, str] | None = None,
|
|
325
325
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -12,14 +12,13 @@ from ._types import IncEx, StrBytesIntFloat
|
|
|
12
12
|
_T = TypeVar("_T")
|
|
13
13
|
_ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel)
|
|
14
14
|
|
|
15
|
-
# --------------- Pydantic v2 compatibility ---------------
|
|
15
|
+
# --------------- Pydantic v2, v3 compatibility ---------------
|
|
16
16
|
|
|
17
17
|
# Pyright incorrectly reports some of our functions as overriding a method when they don't
|
|
18
18
|
# pyright: reportIncompatibleMethodOverride=false
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
PYDANTIC_V1 = pydantic.VERSION.startswith("1.")
|
|
21
21
|
|
|
22
|
-
# v1 re-exports
|
|
23
22
|
if TYPE_CHECKING:
|
|
24
23
|
|
|
25
24
|
def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001
|
|
@@ -44,90 +43,92 @@ if TYPE_CHECKING:
|
|
|
44
43
|
...
|
|
45
44
|
|
|
46
45
|
else:
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
# v1 re-exports
|
|
47
|
+
if PYDANTIC_V1:
|
|
48
|
+
from pydantic.typing import (
|
|
49
49
|
get_args as get_args,
|
|
50
50
|
is_union as is_union,
|
|
51
51
|
get_origin as get_origin,
|
|
52
52
|
is_typeddict as is_typeddict,
|
|
53
53
|
is_literal_type as is_literal_type,
|
|
54
54
|
)
|
|
55
|
-
from pydantic.
|
|
55
|
+
from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
|
|
56
56
|
else:
|
|
57
|
-
from
|
|
57
|
+
from ._utils import (
|
|
58
58
|
get_args as get_args,
|
|
59
59
|
is_union as is_union,
|
|
60
60
|
get_origin as get_origin,
|
|
61
|
+
parse_date as parse_date,
|
|
61
62
|
is_typeddict as is_typeddict,
|
|
63
|
+
parse_datetime as parse_datetime,
|
|
62
64
|
is_literal_type as is_literal_type,
|
|
63
65
|
)
|
|
64
|
-
from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
# refactored config
|
|
68
69
|
if TYPE_CHECKING:
|
|
69
70
|
from pydantic import ConfigDict as ConfigDict
|
|
70
71
|
else:
|
|
71
|
-
if
|
|
72
|
-
from pydantic import ConfigDict
|
|
73
|
-
else:
|
|
72
|
+
if PYDANTIC_V1:
|
|
74
73
|
# TODO: provide an error message here?
|
|
75
74
|
ConfigDict = None
|
|
75
|
+
else:
|
|
76
|
+
from pydantic import ConfigDict as ConfigDict
|
|
76
77
|
|
|
77
78
|
|
|
78
79
|
# renamed methods / properties
|
|
79
80
|
def parse_obj(model: type[_ModelT], value: object) -> _ModelT:
|
|
80
|
-
if
|
|
81
|
-
return model.model_validate(value)
|
|
82
|
-
else:
|
|
81
|
+
if PYDANTIC_V1:
|
|
83
82
|
return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
|
|
83
|
+
else:
|
|
84
|
+
return model.model_validate(value)
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
def field_is_required(field: FieldInfo) -> bool:
|
|
87
|
-
if
|
|
88
|
-
return field.
|
|
89
|
-
return field.
|
|
88
|
+
if PYDANTIC_V1:
|
|
89
|
+
return field.required # type: ignore
|
|
90
|
+
return field.is_required()
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
def field_get_default(field: FieldInfo) -> Any:
|
|
93
94
|
value = field.get_default()
|
|
94
|
-
if
|
|
95
|
-
from pydantic_core import PydanticUndefined
|
|
96
|
-
|
|
97
|
-
if value == PydanticUndefined:
|
|
98
|
-
return None
|
|
95
|
+
if PYDANTIC_V1:
|
|
99
96
|
return value
|
|
97
|
+
from pydantic_core import PydanticUndefined
|
|
98
|
+
|
|
99
|
+
if value == PydanticUndefined:
|
|
100
|
+
return None
|
|
100
101
|
return value
|
|
101
102
|
|
|
102
103
|
|
|
103
104
|
def field_outer_type(field: FieldInfo) -> Any:
|
|
104
|
-
if
|
|
105
|
-
return field.
|
|
106
|
-
return field.
|
|
105
|
+
if PYDANTIC_V1:
|
|
106
|
+
return field.outer_type_ # type: ignore
|
|
107
|
+
return field.annotation
|
|
107
108
|
|
|
108
109
|
|
|
109
110
|
def get_model_config(model: type[pydantic.BaseModel]) -> Any:
|
|
110
|
-
if
|
|
111
|
-
return model.
|
|
112
|
-
return model.
|
|
111
|
+
if PYDANTIC_V1:
|
|
112
|
+
return model.__config__ # type: ignore
|
|
113
|
+
return model.model_config
|
|
113
114
|
|
|
114
115
|
|
|
115
116
|
def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
|
|
116
|
-
if
|
|
117
|
-
return model.
|
|
118
|
-
return model.
|
|
117
|
+
if PYDANTIC_V1:
|
|
118
|
+
return model.__fields__ # type: ignore
|
|
119
|
+
return model.model_fields
|
|
119
120
|
|
|
120
121
|
|
|
121
122
|
def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
|
|
122
|
-
if
|
|
123
|
-
return model.
|
|
124
|
-
return model.
|
|
123
|
+
if PYDANTIC_V1:
|
|
124
|
+
return model.copy(deep=deep) # type: ignore
|
|
125
|
+
return model.model_copy(deep=deep)
|
|
125
126
|
|
|
126
127
|
|
|
127
128
|
def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
|
|
128
|
-
if
|
|
129
|
-
return model.
|
|
130
|
-
return model.
|
|
129
|
+
if PYDANTIC_V1:
|
|
130
|
+
return model.json(indent=indent) # type: ignore
|
|
131
|
+
return model.model_dump_json(indent=indent)
|
|
131
132
|
|
|
132
133
|
|
|
133
134
|
def model_dump(
|
|
@@ -139,14 +140,14 @@ def model_dump(
|
|
|
139
140
|
warnings: bool = True,
|
|
140
141
|
mode: Literal["json", "python"] = "python",
|
|
141
142
|
) -> dict[str, Any]:
|
|
142
|
-
if
|
|
143
|
+
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
|
|
143
144
|
return model.model_dump(
|
|
144
145
|
mode=mode,
|
|
145
146
|
exclude=exclude,
|
|
146
147
|
exclude_unset=exclude_unset,
|
|
147
148
|
exclude_defaults=exclude_defaults,
|
|
148
149
|
# warnings are not supported in Pydantic v1
|
|
149
|
-
warnings=
|
|
150
|
+
warnings=True if PYDANTIC_V1 else warnings,
|
|
150
151
|
)
|
|
151
152
|
return cast(
|
|
152
153
|
"dict[str, Any]",
|
|
@@ -159,9 +160,9 @@ def model_dump(
|
|
|
159
160
|
|
|
160
161
|
|
|
161
162
|
def model_parse(model: type[_ModelT], data: Any) -> _ModelT:
|
|
162
|
-
if
|
|
163
|
-
return model.
|
|
164
|
-
return model.
|
|
163
|
+
if PYDANTIC_V1:
|
|
164
|
+
return model.parse_obj(data) # pyright: ignore[reportDeprecated]
|
|
165
|
+
return model.model_validate(data)
|
|
165
166
|
|
|
166
167
|
|
|
167
168
|
# generic models
|
|
@@ -170,17 +171,16 @@ if TYPE_CHECKING:
|
|
|
170
171
|
class GenericModel(pydantic.BaseModel): ...
|
|
171
172
|
|
|
172
173
|
else:
|
|
173
|
-
if
|
|
174
|
+
if PYDANTIC_V1:
|
|
175
|
+
import pydantic.generics
|
|
176
|
+
|
|
177
|
+
class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
|
|
178
|
+
else:
|
|
174
179
|
# there no longer needs to be a distinction in v2 but
|
|
175
180
|
# we still have to create our own subclass to avoid
|
|
176
181
|
# inconsistent MRO ordering errors
|
|
177
182
|
class GenericModel(pydantic.BaseModel): ...
|
|
178
183
|
|
|
179
|
-
else:
|
|
180
|
-
import pydantic.generics
|
|
181
|
-
|
|
182
|
-
class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
|
|
183
|
-
|
|
184
184
|
|
|
185
185
|
# cached properties
|
|
186
186
|
if TYPE_CHECKING:
|
|
@@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
69
69
|
return file
|
|
70
70
|
|
|
71
71
|
if is_tuple_t(file):
|
|
72
|
-
return (file[0],
|
|
72
|
+
return (file[0], read_file_content(file[1]), *file[2:])
|
|
73
73
|
|
|
74
74
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
def
|
|
77
|
+
def read_file_content(file: FileContent) -> HttpxFileContent:
|
|
78
78
|
if isinstance(file, os.PathLike):
|
|
79
79
|
return pathlib.Path(file).read_bytes()
|
|
80
80
|
return file
|
|
@@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
111
111
|
return file
|
|
112
112
|
|
|
113
113
|
if is_tuple_t(file):
|
|
114
|
-
return (file[0], await
|
|
114
|
+
return (file[0], await async_read_file_content(file[1]), *file[2:])
|
|
115
115
|
|
|
116
116
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
async def
|
|
119
|
+
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
|
|
120
120
|
if isinstance(file, os.PathLike):
|
|
121
121
|
return await anyio.Path(file).read_bytes()
|
|
122
122
|
|