muffin-rest 13.1.0__tar.gz → 13.1.1__tar.gz

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.
Files changed (38) hide show
  1. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/PKG-INFO +1 -1
  2. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/filters.py +3 -3
  3. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/filters.py +4 -2
  4. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/pyproject.toml +2 -2
  5. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/README.md +0 -0
  6. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/__init__.py +0 -0
  7. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/api.py +0 -0
  8. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/errors.py +0 -0
  9. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/handler.py +0 -0
  10. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/limits.py +0 -0
  11. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/marshmallow.py +0 -0
  12. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/mongo/__init__.py +0 -0
  13. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/mongo/filters.py +0 -0
  14. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/mongo/schema.py +0 -0
  15. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/mongo/sorting.py +0 -0
  16. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/mongo/types.py +0 -0
  17. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/mongo/utils.py +0 -0
  18. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/openapi.py +0 -0
  19. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/options.py +0 -0
  20. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/__init__.py +0 -0
  21. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/handler.py +0 -0
  22. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/openapi.py +0 -0
  23. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/options.py +0 -0
  24. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/schemas.py +0 -0
  25. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/sorting.py +0 -0
  26. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/types.py +0 -0
  27. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/peewee/utils.py +0 -0
  28. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/py.typed +0 -0
  29. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/redoc.html +0 -0
  30. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/schemas.py +0 -0
  31. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/sorting.py +0 -0
  32. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/sqlalchemy/__init__.py +0 -0
  33. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/sqlalchemy/filters.py +0 -0
  34. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/sqlalchemy/sorting.py +0 -0
  35. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/sqlalchemy/types.py +0 -0
  36. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/swagger.html +0 -0
  37. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/types.py +0 -0
  38. {muffin_rest-13.1.0 → muffin_rest-13.1.1}/muffin_rest/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: muffin-rest
3
- Version: 13.1.0
3
+ Version: 13.1.1
4
4
  Summary: The package provides enhanced support for writing REST APIs with Muffin framework
5
5
  Keywords: rest,api,muffin,asgi,asyncio,trio
6
6
  Author: Kirill Klenov
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import operator
6
- from typing import TYPE_CHECKING, Any, Callable, ClassVar, Iterable, Mapping
6
+ from typing import TYPE_CHECKING, Any, Callable, ClassVar, Iterable, Mapping, cast
7
7
 
8
8
  import marshmallow as ma
9
9
  from asgi_tools._compat import json_loads
@@ -90,13 +90,13 @@ class Filter(Mutate):
90
90
 
91
91
  return ops, collection
92
92
 
93
- async def filter(self, collection, *ops: TFilterValue) -> Any:
93
+ async def filter(self, collection: TVCollection, *ops: TFilterValue) -> TVCollection:
94
94
  """Apply the filter to collection."""
95
95
 
96
96
  def validator(obj):
97
97
  return all(op(get_value(obj, self.name), val) for op, val in ops)
98
98
 
99
- return [item for item in collection if validator(item)]
99
+ return cast("TVCollection", [item for item in collection if validator(item)])
100
100
 
101
101
  def get_simple_value(self, ops: TFilterOps) -> Any:
102
102
  """Get simple value from filter's data.
@@ -6,7 +6,7 @@ import operator
6
6
  from functools import reduce
7
7
  from typing import TYPE_CHECKING, ClassVar, cast
8
8
 
9
- from peewee import ColumnBase, Field, ModelSelect
9
+ from peewee import ColumnBase, Field
10
10
 
11
11
  from muffin_rest.filters import Filter, Filters
12
12
 
@@ -39,11 +39,13 @@ class PWFilter(Filter):
39
39
 
40
40
  list_ops = (*Filter.list_ops, "$between")
41
41
 
42
- async def filter(self, collection: ModelSelect, *ops: TFilterValue) -> ModelSelect:
42
+ async def filter(self, collection, *ops: TFilterValue):
43
43
  """Apply the filters to Peewee QuerySet.."""
44
44
  column = self.field
45
+
45
46
  if isinstance(column, ColumnBase):
46
47
  collection = collection.where(*[op(column, val) for op, val in ops])
48
+
47
49
  return collection
48
50
 
49
51
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "muffin-rest"
3
- version = "13.1.0"
3
+ version = "13.1.1"
4
4
  description = "The package provides enhanced support for writing REST APIs with Muffin framework"
5
5
  authors = [{ name = "Kirill Klenov", email = "horneds@gmail.com" }]
6
6
  requires-python = ">=3.10,<4"
@@ -114,7 +114,7 @@ ignore = [
114
114
  ]
115
115
 
116
116
  [tool.bumpversion]
117
- current_version = "13.1.0"
117
+ current_version = "13.1.1"
118
118
  commit = false
119
119
  tag = false
120
120
 
File without changes