localstack-py-avro-schema 3.9.7__py3-none-any.whl → 3.9.8__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.
- {localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/METADATA +1 -1
- {localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/RECORD +7 -7
- py_avro_schema/_schemas.py +32 -1
- {localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/WHEEL +0 -0
- {localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/licenses/LICENSE +0 -0
- {localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/licenses/LICENSE_HEADER.txt +0 -0
- {localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/top_level.txt +0 -0
{localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: localstack-py-avro-schema
|
|
3
|
-
Version: 3.9.
|
|
3
|
+
Version: 3.9.8
|
|
4
4
|
Summary: Generate Apache Avro schemas for Python types including standard library data-classes and Pydantic data models.
|
|
5
5
|
Author-email: LocalStack Contributors <info@localstack.cloud>, "J.P. Morgan Chase & Co." <open_source@jpmorgan.com>
|
|
6
6
|
License: Apache License
|
{localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/RECORD
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
localstack_py_avro_schema-3.9.
|
|
2
|
-
localstack_py_avro_schema-3.9.
|
|
1
|
+
localstack_py_avro_schema-3.9.8.dist-info/licenses/LICENSE,sha256=zE1N4JILDTkSIDtdmqdnKKxKEQh_VdqeoAV2230eNOI,10141
|
|
2
|
+
localstack_py_avro_schema-3.9.8.dist-info/licenses/LICENSE_HEADER.txt,sha256=Nx3RGmYbJKjIKM8Y2yMrCPJgCw4oBt_H62PxDKlAsto,564
|
|
3
3
|
py_avro_schema/__init__.py,sha256=bK6hTw4XJy5bAP4lgIvJR5LHtEiyUWq4GNJ5w-uSEpc,2414
|
|
4
4
|
py_avro_schema/_alias.py,sha256=K_7aDBkLGF0PGixRNvV37VMBnmEoSX9-CbzAbj-c9hc,3823
|
|
5
|
-
py_avro_schema/_schemas.py,sha256=
|
|
5
|
+
py_avro_schema/_schemas.py,sha256=MwF-aSPlaZ8M83DxzN6F_H-DMuWC80DrsA2cQpxbJ5E,51121
|
|
6
6
|
py_avro_schema/_testing.py,sha256=3aSfMbNDDeatl3H7GEUcynxK81HFiF-WCLOZ3FCCLiw,2261
|
|
7
7
|
py_avro_schema/_typing.py,sha256=9kBlPA7C33zZP3nRhCvSJA_0m54uvUo0AQ4wJJmSxMk,3291
|
|
8
8
|
py_avro_schema/py.typed,sha256=HnEDkaznpgfRW07Qfogy4tFLu_4dcQ5YcOsI7pmU5rQ,52
|
|
9
|
-
localstack_py_avro_schema-3.9.
|
|
10
|
-
localstack_py_avro_schema-3.9.
|
|
11
|
-
localstack_py_avro_schema-3.9.
|
|
12
|
-
localstack_py_avro_schema-3.9.
|
|
9
|
+
localstack_py_avro_schema-3.9.8.dist-info/METADATA,sha256=YrpE6QS35aU-FR7U4oqpej0fn253ZPXuJRaEgOiSVPk,15164
|
|
10
|
+
localstack_py_avro_schema-3.9.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
+
localstack_py_avro_schema-3.9.8.dist-info/top_level.txt,sha256=0t4oO_5rsdfZGSk8iSzK4TjdyfVz-RE1IZ2TIz6YvI0,15
|
|
12
|
+
localstack_py_avro_schema-3.9.8.dist-info/RECORD,,
|
py_avro_schema/_schemas.py
CHANGED
|
@@ -33,6 +33,7 @@ from typing import (
|
|
|
33
33
|
Annotated,
|
|
34
34
|
Any,
|
|
35
35
|
Dict,
|
|
36
|
+
Final,
|
|
36
37
|
ForwardRef,
|
|
37
38
|
List,
|
|
38
39
|
Literal,
|
|
@@ -378,6 +379,31 @@ class LiteralSchema(Schema):
|
|
|
378
379
|
return self.literal_value_schema.data(names=names)
|
|
379
380
|
|
|
380
381
|
|
|
382
|
+
@register_schema
|
|
383
|
+
class FinalSchema(Schema):
|
|
384
|
+
"""An Avro schema for Python ``typing.Final``"""
|
|
385
|
+
|
|
386
|
+
def __init__(self, py_type: Type, namespace: Optional[str] = None, options: Option = Option(0)):
|
|
387
|
+
"""An Avro schema for Python ``typing.Final``"""
|
|
388
|
+
super().__init__(py_type, namespace, options)
|
|
389
|
+
py_type = _type_from_annotated(py_type)
|
|
390
|
+
try:
|
|
391
|
+
real_type = get_args(py_type)[0]
|
|
392
|
+
except IndexError:
|
|
393
|
+
raise TypeError("Can't generate Avro schema from Python typing.Final without a type parameter")
|
|
394
|
+
self.real_schema = _schema_obj(real_type, namespace=namespace, options=options)
|
|
395
|
+
|
|
396
|
+
def data(self, names: NamesType) -> JSONType:
|
|
397
|
+
"""Return the schema data"""
|
|
398
|
+
return self.real_schema.data(names=names)
|
|
399
|
+
|
|
400
|
+
@classmethod
|
|
401
|
+
def handles_type(cls, py_type: Type) -> bool:
|
|
402
|
+
"""Whether this schema class can represent a given Python class"""
|
|
403
|
+
py_type = _type_from_annotated(py_type)
|
|
404
|
+
return get_origin(py_type) is Final or py_type is Final
|
|
405
|
+
|
|
406
|
+
|
|
381
407
|
@register_schema
|
|
382
408
|
class DictAsJSONSchema(Schema):
|
|
383
409
|
"""An Avro string schema representing a Python Dict[str, Any] or List[Dict[str, Any]] assuming JSON serialization"""
|
|
@@ -1156,8 +1182,13 @@ class PlainClassSchema(RecordSchema):
|
|
|
1156
1182
|
super().__init__(py_type, namespace=namespace, options=options)
|
|
1157
1183
|
py_type = _type_from_annotated(py_type)
|
|
1158
1184
|
|
|
1185
|
+
# Try to get resolved type hints, but fall back to raw annotations if there are unresolved forward refs
|
|
1186
|
+
try:
|
|
1187
|
+
type_hints = get_type_hints(py_type, include_extras=True)
|
|
1188
|
+
except NameError:
|
|
1189
|
+
type_hints = py_type.__annotations__
|
|
1159
1190
|
self.py_fields: list[tuple[str, type]] = []
|
|
1160
|
-
for k, v in
|
|
1191
|
+
for k, v in type_hints.items():
|
|
1161
1192
|
self.py_fields.append((k, v))
|
|
1162
1193
|
# We store __init__ parameters with default values. They can be used as defaults for the record.
|
|
1163
1194
|
self.signature_fields = {
|
{localstack_py_avro_schema-3.9.7.dist-info → localstack_py_avro_schema-3.9.8.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|