moose-lib 0.4.260__py3-none-any.whl → 0.4.261__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.

Potentially problematic release.


This version of moose-lib might be problematic. Click here for more details.

moose_lib/data_models.py CHANGED
@@ -15,8 +15,6 @@ import ipaddress
15
15
  type Key[T: (str, int)] = T
16
16
  type JWT[T] = T
17
17
 
18
- type Aggregated[T, agg_func] = Annotated[T, agg_func]
19
-
20
18
 
21
19
  @dataclasses.dataclass # a BaseModel in the annotations will confuse pydantic
22
20
  class ClickhousePrecision:
@@ -41,8 +39,16 @@ def clickhouse_datetime64(precision: int) -> Type[datetime]:
41
39
  return Annotated[datetime, ClickhousePrecision(precision=precision)]
42
40
 
43
41
 
44
- class AggregateFunction(BaseModel):
45
- model_config = ConfigDict(arbitrary_types_allowed=True)
42
+ def aggregated[T](
43
+ result_type: Type[T],
44
+ agg_func: str,
45
+ param_types: list[type | GenericAlias | _BaseGenericAlias]
46
+ ) -> Type[T]:
47
+ return Annotated[result_type, AggregateFunction(agg_func=agg_func, param_types=param_types)]
48
+
49
+
50
+ @dataclasses.dataclass
51
+ class AggregateFunction:
46
52
  agg_func: str
47
53
  param_types: list[type | GenericAlias | _BaseGenericAlias]
48
54
 
@@ -120,12 +126,6 @@ def handle_annotation(t: type, md: list[Any]) -> Tuple[type, list[Any]]:
120
126
  return handle_annotation(t.__value__, md)
121
127
  if get_origin(t) is Annotated:
122
128
  return handle_annotation(t.__origin__, md + list(t.__metadata__)) # type: ignore
123
- if get_origin(t) is Aggregated:
124
- args = get_args(t)
125
- agg_func = args[1]
126
- if not isinstance(agg_func, AggregateFunction):
127
- raise ValueError("Pass an AggregateFunction to Aggregated")
128
- return handle_annotation(args[0], md + [agg_func])
129
129
  return t, md
130
130
 
131
131
 
@@ -285,8 +285,8 @@ class StringToEnumMixin:
285
285
  def is_array_nested_type(data_type: DataType) -> bool:
286
286
  """Type guard to check if a data type is Array(Nested(...))."""
287
287
  return (
288
- isinstance(data_type, ArrayType) and
289
- isinstance(data_type.element_type, Nested)
288
+ isinstance(data_type, ArrayType) and
289
+ isinstance(data_type.element_type, Nested)
290
290
  )
291
291
 
292
292
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.4.260
3
+ Version: 0.4.261
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=4eoo68DXQBCy6XS0p_UPoxT9jc42LuKisuFxcDfMunM,9912
4
+ moose_lib/data_models.py,sha256=FjFNd88WWCGMG5p5gV-Vjgp1cXARBeFapEHqDy0-WX8,9792
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
@@ -31,7 +31,7 @@ tests/__init__.py,sha256=0Gh4yzPkkC3TzBGKhenpMIxJcRhyrrCfxLSfpTZnPMQ,53
31
31
  tests/conftest.py,sha256=ZVJNbnr4DwbcqkTmePW6U01zAzE6QD0kNAEZjPG1f4s,169
32
32
  tests/test_moose.py,sha256=mBsx_OYWmL8ppDzL_7Bd7xR6qf_i3-pCIO3wm2iQNaA,2136
33
33
  tests/test_redis_client.py,sha256=d9_MLYsJ4ecVil_jPB2gW3Q5aWnavxmmjZg2uYI3LVo,3256
34
- moose_lib-0.4.260.dist-info/METADATA,sha256=xGG6yxNyxB6zAXQIzqOtm45nFVOu9wwMRuofpr5VjVs,729
35
- moose_lib-0.4.260.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- moose_lib-0.4.260.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
37
- moose_lib-0.4.260.dist-info/RECORD,,
34
+ moose_lib-0.4.261.dist-info/METADATA,sha256=9Sx5EgU0W3ueeO9XI91mBrYUKMK1XJAmSSU27zC33YQ,729
35
+ moose_lib-0.4.261.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ moose_lib-0.4.261.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
37
+ moose_lib-0.4.261.dist-info/RECORD,,