localstack-py-avro-schema 3.9.4__py3-none-any.whl → 3.9.6__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.4
2
2
  Name: localstack-py-avro-schema
3
- Version: 3.9.4
3
+ Version: 3.9.6
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
@@ -1,12 +1,12 @@
1
- localstack_py_avro_schema-3.9.4.dist-info/licenses/LICENSE,sha256=zE1N4JILDTkSIDtdmqdnKKxKEQh_VdqeoAV2230eNOI,10141
2
- localstack_py_avro_schema-3.9.4.dist-info/licenses/LICENSE_HEADER.txt,sha256=Nx3RGmYbJKjIKM8Y2yMrCPJgCw4oBt_H62PxDKlAsto,564
1
+ localstack_py_avro_schema-3.9.6.dist-info/licenses/LICENSE,sha256=zE1N4JILDTkSIDtdmqdnKKxKEQh_VdqeoAV2230eNOI,10141
2
+ localstack_py_avro_schema-3.9.6.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=nCQqtn7IbpjV0ibpJf9aMX9FvwVx2EDC1iKzwjQ7CqI,3412
5
- py_avro_schema/_schemas.py,sha256=L9_c-I1ihS9BJpXe1-foDMUppxY7PyTT544hMbrS1TM,48589
5
+ py_avro_schema/_schemas.py,sha256=OxSp5EFusu__X1PMA4O02nPN9c6LiAKwr-eavy5A1KY,49819
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.4.dist-info/METADATA,sha256=2VBFpx5j-KsRbwOmtIICNMNLSgB34kwkCra0Jh_WO5U,15164
10
- localstack_py_avro_schema-3.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- localstack_py_avro_schema-3.9.4.dist-info/top_level.txt,sha256=0t4oO_5rsdfZGSk8iSzK4TjdyfVz-RE1IZ2TIz6YvI0,15
12
- localstack_py_avro_schema-3.9.4.dist-info/RECORD,,
9
+ localstack_py_avro_schema-3.9.6.dist-info/METADATA,sha256=ee65BI7ff5JYA9XpIItNjNbOGSDDTtQlQa31WCbe3es,15164
10
+ localstack_py_avro_schema-3.9.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ localstack_py_avro_schema-3.9.6.dist-info/top_level.txt,sha256=0t4oO_5rsdfZGSk8iSzK4TjdyfVz-RE1IZ2TIz6YvI0,15
12
+ localstack_py_avro_schema-3.9.6.dist-info/RECORD,,
@@ -671,6 +671,33 @@ class SequenceSchema(Schema):
671
671
  return [self.items_schema.make_default(item) for item in py_default]
672
672
 
673
673
 
674
+ @register_schema
675
+ class SetSchema(SequenceSchema):
676
+ """An Avro array schema for a given Python set"""
677
+
678
+ @classmethod
679
+ def handles_type(cls, py_type: type) -> bool:
680
+ """Whether this schema class can represent a given Python class"""
681
+ py_type = _type_from_annotated(py_type)
682
+ origin = get_origin(py_type)
683
+ return _is_class(origin, collections.abc.MutableSet)
684
+
685
+ def __init__(
686
+ self,
687
+ py_type: type[collections.abc.MutableSet],
688
+ namespace: str | None = None,
689
+ options: Option = Option(0),
690
+ ):
691
+ """
692
+ An Avro array schema for a given Python sequence
693
+
694
+ :param py_type: The Python class to generate a schema for.
695
+ :param namespace: The Avro namespace to add to schemas.
696
+ :param options: Schema generation options.
697
+ """
698
+ super().__init__(py_type, namespace=namespace, options=options) # type: ignore
699
+
700
+
674
701
  @register_schema
675
702
  class DictSchema(Schema):
676
703
  """An Avro map schema for a given Python mapping"""
@@ -860,6 +887,13 @@ class EnumSchema(NamedSchema):
860
887
  return False
861
888
  return True
862
889
 
890
+ def data(self, names: NamesType) -> JSONType:
891
+ """Return the schema data"""
892
+ # For invalid enums we don't want to deduplicate the data
893
+ if not self._is_valid_enum():
894
+ return self.data_before_deduplication(names=names)
895
+ return super().data(names)
896
+
863
897
  def data_before_deduplication(self, names: NamesType) -> JSONObj:
864
898
  """Return the schema data"""
865
899
  if not self._is_valid_enum():
@@ -1141,7 +1175,7 @@ class PlainClassSchema(RecordSchema):
1141
1175
  if field := self.signature_fields.get(name):
1142
1176
  _annotation, _default = field
1143
1177
  if actual_type is _annotation:
1144
- default = _default
1178
+ default = _default or dataclasses.MISSING
1145
1179
  field_obj = RecordField(
1146
1180
  py_type=actual_type,
1147
1181
  name=name,