udl-sdk 0.1.0a13__py3-none-any.whl → 0.1.0a15__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: udl-sdk
3
- Version: 0.1.0a13
3
+ Version: 0.1.0a15
4
4
  Summary: The official Python library for the unifieddatalibrary API
5
5
  Project-URL: Homepage, https://github.com/Bluestaq/udl-python-sdk
6
6
  Project-URL: Repository, https://github.com/Bluestaq/udl-python-sdk
@@ -5,13 +5,13 @@ unifieddatalibrary/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw
5
5
  unifieddatalibrary/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
6
6
  unifieddatalibrary/_exceptions.py,sha256=rkk8r4oyqb4bxjMtx0OFWsh1m8gsMfrnIGnNPO6zRz0,3244
7
7
  unifieddatalibrary/_files.py,sha256=FZ264pl2ebvWlVztvuAE8hl1yitTQIT-2Bi6GMwMReA,3619
8
- unifieddatalibrary/_models.py,sha256=viD5E6aDMhxslcFHDYvkHaKzE8YLcNmsPsMe8STixvs,29294
8
+ unifieddatalibrary/_models.py,sha256=KvjsMfb88XZlFUKVoOxr8OyDj47MhoH2OKqWNEbBhk4,30010
9
9
  unifieddatalibrary/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
10
10
  unifieddatalibrary/_resource.py,sha256=Ik-pULzkvFIY2OgB9Ra7mIQKCle38FSP36dWWCH9vxk,1172
11
11
  unifieddatalibrary/_response.py,sha256=hdekMRMvxTvYdKfYIPvAxSpdiuRILRCYd5Dwcye-icg,28890
12
12
  unifieddatalibrary/_streaming.py,sha256=LwKrocz7ZRmYd47TA3q-PLXwgdTgjANE-TCIRZB958s,10148
13
13
  unifieddatalibrary/_types.py,sha256=mslWUKYM1Q3bMXxgq4Mr9fo3QvAwzQJrscV44EPbmGA,6209
14
- unifieddatalibrary/_version.py,sha256=4xoSZ-FMWPBL5-DynK0nN9F1JSHXcetMW2_4yc6quMk,179
14
+ unifieddatalibrary/_version.py,sha256=qj6R1E-b9FtSg55qL6LjJuTicsxV-V8jfOay2LSs040,179
15
15
  unifieddatalibrary/pagination.py,sha256=jRNsKPCwBHKIHIIX5V5yB7NUsvfy-k7UqnpPGrGyFNU,5758
16
16
  unifieddatalibrary/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  unifieddatalibrary/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
@@ -2610,7 +2610,7 @@ unifieddatalibrary/types/weather_report/history_count_params.py,sha256=KFXFsL7q4
2610
2610
  unifieddatalibrary/types/weather_report/history_count_response.py,sha256=ZAHTF5IoOvMAg9GyvtMvgeowh-ythtIJhcWtMbcM8wk,202
2611
2611
  unifieddatalibrary/types/weather_report/history_list_params.py,sha256=JUd53E70wjtn7HlQ7LOZ7lUJREDJkaDYHv2eYW60T3Q,1019
2612
2612
  unifieddatalibrary/types/weather_report/weather_report_full.py,sha256=iv7fHg9aQh6ztvl0ztve5Z3_8Ww-efPMBgrS0n5gXvM,20751
2613
- udl_sdk-0.1.0a13.dist-info/METADATA,sha256=c8rfYagi-Yyvx5QmrHo8w20z1Nf1SwowVLNvbkTf_2Y,17014
2614
- udl_sdk-0.1.0a13.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
2615
- udl_sdk-0.1.0a13.dist-info/licenses/LICENSE,sha256=YBMC8KbJHXtxIo1-d_G5WdWjtiwFyrcZ5jAsRwN4POI,11348
2616
- udl_sdk-0.1.0a13.dist-info/RECORD,,
2613
+ udl_sdk-0.1.0a15.dist-info/METADATA,sha256=EQgYycKxMLu9M8saR16tlRf8iga8wRak9hANjpZHkJc,17014
2614
+ udl_sdk-0.1.0a15.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
2615
+ udl_sdk-0.1.0a15.dist-info/licenses/LICENSE,sha256=YBMC8KbJHXtxIo1-d_G5WdWjtiwFyrcZ5jAsRwN4POI,11348
2616
+ udl_sdk-0.1.0a15.dist-info/RECORD,,
@@ -208,14 +208,18 @@ class BaseModel(pydantic.BaseModel):
208
208
  else:
209
209
  fields_values[name] = field_get_default(field)
210
210
 
211
+ extra_field_type = _get_extra_fields_type(__cls)
212
+
211
213
  _extra = {}
212
214
  for key, value in values.items():
213
215
  if key not in model_fields:
216
+ parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
217
+
214
218
  if PYDANTIC_V2:
215
- _extra[key] = value
219
+ _extra[key] = parsed
216
220
  else:
217
221
  _fields_set.add(key)
218
- fields_values[key] = value
222
+ fields_values[key] = parsed
219
223
 
220
224
  object.__setattr__(m, "__dict__", fields_values)
221
225
 
@@ -370,6 +374,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
370
374
  return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
371
375
 
372
376
 
377
+ def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
378
+ if not PYDANTIC_V2:
379
+ # TODO
380
+ return None
381
+
382
+ schema = cls.__pydantic_core_schema__
383
+ if schema["type"] == "model":
384
+ fields = schema["schema"]
385
+ if fields["type"] == "model-fields":
386
+ extras = fields.get("extras_schema")
387
+ if extras and "cls" in extras:
388
+ # mypy can't narrow the type
389
+ return extras["cls"] # type: ignore[no-any-return]
390
+
391
+ return None
392
+
393
+
373
394
  def is_basemodel(type_: type) -> bool:
374
395
  """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`"""
375
396
  if is_union(type_):
@@ -439,7 +460,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]
439
460
  type_ = type_.__value__ # type: ignore[unreachable]
440
461
 
441
462
  # unwrap `Annotated[T, ...]` -> `T`
442
- if metadata is not None:
463
+ if metadata is not None and len(metadata) > 0:
443
464
  meta: tuple[Any, ...] = tuple(metadata)
444
465
  elif is_annotated_type(type_):
445
466
  meta = get_args(type_)[1:]
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "unifieddatalibrary"
4
- __version__ = "0.1.0-alpha.13" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.15" # x-release-please-version