pydantic-avro 0.7.2__py3-none-any.whl → 0.7.3__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.
@@ -39,13 +39,19 @@ def list_type_handler(t: dict) -> str:
39
39
 
40
40
  def map_type_handler(t: dict) -> str:
41
41
  """Get the Python type of a given Avro map type"""
42
+ type_field = t["type"]
43
+ value_type = None
44
+ if isinstance(type_field, dict):
45
+ avro_value_type = type_field.get("values")
46
+ if avro_value_type is None:
47
+ raise AttributeError(f"Values are required for map type. Received: {t}")
48
+ value_type = get_pydantic_type(avro_value_type)
49
+ if isinstance(type_field, str):
50
+ value_type = t.get("values")
51
+
52
+ if value_type is None:
53
+ raise AttributeError(f"Values are required for map type. Received: {t}")
42
54
 
43
- avro_value_type = t["type"].get("values")
44
-
45
- if avro_value_type is None:
46
- raise AttributeError("Values are required for map type")
47
-
48
- value_type = get_pydantic_type(avro_value_type)
49
55
  return f"Dict[str, {value_type}]"
50
56
 
51
57
 
@@ -129,7 +135,7 @@ def get_pydantic_type(t: Union[str, dict]) -> str:
129
135
  if isinstance(t, str):
130
136
  t = {"type": t}
131
137
 
132
- if isinstance(t["type"], str):
138
+ if isinstance(t.get("type"), str):
133
139
  if ClassRegistry().has_class(t["type"]):
134
140
  return t["type"]
135
141
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pydantic-avro
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: Converting pydantic classes to avro schemas
5
5
  Home-page: https://github.com/godatadriven/pydantic-avro
6
6
  License: MIT
@@ -5,14 +5,14 @@ pydantic_avro/base.py,sha256=i1wco_T6FXFdtlxzbzXt3Jv93TmTzTfJ493KCfZh1dc,78
5
5
  pydantic_avro/from_avro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  pydantic_avro/from_avro/avro_to_pydantic.py,sha256=FOEd_6TqoHSlLALgyveb456B3f7TEPGw2ByRgRcigqc,1356
7
7
  pydantic_avro/from_avro/class_registery.py,sha256=n_8yELp-Eux9bAs4CJOV78bQ061VV_-2FuvowOQpWCg,864
8
- pydantic_avro/from_avro/types.py,sha256=OIvadvTZJEbUDbTn2To6CqRpJhV8Un_jNqG5NKhqnkY,4864
8
+ pydantic_avro/from_avro/types.py,sha256=lt-L0mVAflSrpFxQKtjxx1lUCWICdSaXlwGfeJkfXgI,5167
9
9
  pydantic_avro/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  pydantic_avro/to_avro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  pydantic_avro/to_avro/base.py,sha256=Y8QOGTpXO3BwJ6arrRK-k2JniK5kLTvlDpQ0PyZojmg,1409
12
12
  pydantic_avro/to_avro/config.py,sha256=R9HLkWiXs7YZ02te8CQt5Kf2rbsE8Fx-hjqv3tBSFJU,152
13
13
  pydantic_avro/to_avro/types.py,sha256=gY-4ay0IF1dDIxtVsLyzH-AkzcE_dHpnyCrd00cj3TE,7755
14
- pydantic_avro-0.7.2.dist-info/entry_points.txt,sha256=gwHiQfbGLO8Np2sa1bZ_bpxU7sEufx6IachViBE_Fnw,66
15
- pydantic_avro-0.7.2.dist-info/LICENSE,sha256=gBlYCG1yxb0vGlsmek0lMPVOK5YDxQope4F54jzeqoY,1069
16
- pydantic_avro-0.7.2.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
17
- pydantic_avro-0.7.2.dist-info/METADATA,sha256=uy2VasYG9obxrtyy8AEyDuv_rMOiKQ64oRsiue3bt4g,2571
18
- pydantic_avro-0.7.2.dist-info/RECORD,,
14
+ pydantic_avro-0.7.3.dist-info/entry_points.txt,sha256=gwHiQfbGLO8Np2sa1bZ_bpxU7sEufx6IachViBE_Fnw,66
15
+ pydantic_avro-0.7.3.dist-info/LICENSE,sha256=gBlYCG1yxb0vGlsmek0lMPVOK5YDxQope4F54jzeqoY,1069
16
+ pydantic_avro-0.7.3.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
17
+ pydantic_avro-0.7.3.dist-info/METADATA,sha256=VjWuNTHhxRSdRGjK0j-XuOr52IeQwZYvrVSzVKAje1U,2571
18
+ pydantic_avro-0.7.3.dist-info/RECORD,,