moose-lib 0.4.219__py3-none-any.whl → 0.4.220__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.
moose_lib/data_models.py CHANGED
@@ -87,7 +87,12 @@ class NamedTupleType(BaseModel):
87
87
  fields: list[tuple[str, "DataType"]]
88
88
 
89
89
 
90
- type DataType = str | DataEnum | ArrayType | Nested | NamedTupleType
90
+ class MapType(BaseModel):
91
+ key_type: "DataType"
92
+ value_type: "DataType"
93
+
94
+
95
+ type DataType = str | DataEnum | ArrayType | Nested | NamedTupleType | MapType
91
96
 
92
97
 
93
98
  def handle_jwt(field_type: type) -> Tuple[bool, type]:
@@ -185,6 +190,15 @@ def py_type_to_column_type(t: type, mds: list[Any]) -> Tuple[bool, list[Any], Da
185
190
  elif get_origin(t) is list:
186
191
  inner_optional, _, inner_type = py_type_to_column_type(get_args(t)[0], [])
187
192
  data_type = ArrayType(element_type=inner_type, element_nullable=inner_optional)
193
+ elif get_origin(t) is dict:
194
+ args = get_args(t)
195
+ if len(args) == 2:
196
+ key_optional, _, key_type = py_type_to_column_type(args[0], [])
197
+ value_optional, _, value_type = py_type_to_column_type(args[1], [])
198
+ # For dict types, we assume keys are required and values match their type
199
+ data_type = MapType(key_type=key_type, value_type=value_type)
200
+ else:
201
+ raise ValueError(f"Dict type must have exactly 2 type arguments, got {len(args)}")
188
202
  elif t is UUID:
189
203
  data_type = "UUID"
190
204
  elif t is Any:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.4.219
3
+ Version: 0.4.220
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -1,7 +1,7 @@
1
1
  moose_lib/__init__.py,sha256=0MpzYNnjpqcBaXjR5CBr1b0M5YjXXjj9y1RKyNeOJQ8,183
2
2
  moose_lib/blocks.py,sha256=_wdvC2NC_Y3MMEnB71WTgWbeQ--zPNHk19xjToJW0C0,3185
3
3
  moose_lib/commons.py,sha256=BV5X78MuOWHiZV9bsWSN69JIvzTNWUi-gnuMiAtaO8A,2489
4
- moose_lib/data_models.py,sha256=hFXvIE2dQ88l4bC2yGNjdwLK8SWPL9_yUodcjMErym4,8911
4
+ moose_lib/data_models.py,sha256=8zYPNkOYi0o5Ut2llXwqdIqbXcg_jdv6M_nCEzJ2Onw,9512
5
5
  moose_lib/dmv2-serializer.py,sha256=CL_Pvvg8tJOT8Qk6hywDNzY8MYGhMVdTOw8arZi3jng,49
6
6
  moose_lib/internal.py,sha256=ezqTTWS3T6nAPAxcjMPGYs-6ZwZwxOTZVuVFHiSkEmw,14269
7
7
  moose_lib/main.py,sha256=In-u7yA1FsLDeP_2bhIgBtHY_BkXaZqDwf7BxwyC21c,8471
@@ -28,7 +28,7 @@ tests/__init__.py,sha256=0Gh4yzPkkC3TzBGKhenpMIxJcRhyrrCfxLSfpTZnPMQ,53
28
28
  tests/conftest.py,sha256=ZVJNbnr4DwbcqkTmePW6U01zAzE6QD0kNAEZjPG1f4s,169
29
29
  tests/test_moose.py,sha256=mBsx_OYWmL8ppDzL_7Bd7xR6qf_i3-pCIO3wm2iQNaA,2136
30
30
  tests/test_redis_client.py,sha256=d9_MLYsJ4ecVil_jPB2gW3Q5aWnavxmmjZg2uYI3LVo,3256
31
- moose_lib-0.4.219.dist-info/METADATA,sha256=bm7loQIsrsjYXKW_wSk-fsHdHm0WmV4MU_uTI2hKZH4,638
32
- moose_lib-0.4.219.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- moose_lib-0.4.219.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
34
- moose_lib-0.4.219.dist-info/RECORD,,
31
+ moose_lib-0.4.220.dist-info/METADATA,sha256=6o77lOZvWwgJi6St58m_nG1tDdWLduUwdsoUfztTQUc,638
32
+ moose_lib-0.4.220.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ moose_lib-0.4.220.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
34
+ moose_lib-0.4.220.dist-info/RECORD,,