muffin-rest 7.3.1__tar.gz → 7.3.3__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 (37) hide show
  1. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/PKG-INFO +2 -1
  2. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/filters.py +4 -4
  3. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/options.py +3 -3
  4. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/sorting.py +5 -4
  5. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/sqlalchemy/__init__.py +2 -2
  6. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/pyproject.toml +1 -1
  7. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/LICENSE +0 -0
  8. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/README.rst +0 -0
  9. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/__init__.py +0 -0
  10. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/api.py +0 -0
  11. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/errors.py +0 -0
  12. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/handler.py +0 -0
  13. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/marshmallow.py +0 -0
  14. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/mongo/__init__.py +0 -0
  15. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/mongo/filters.py +0 -0
  16. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/mongo/schema.py +0 -0
  17. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/mongo/sorting.py +0 -0
  18. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/mongo/types.py +0 -0
  19. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/mongo/utils.py +0 -0
  20. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/openapi.py +0 -0
  21. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/options.py +0 -0
  22. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/__init__.py +0 -0
  23. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/filters.py +0 -0
  24. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/handler.py +0 -0
  25. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/openapi.py +0 -0
  26. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/schemas.py +0 -0
  27. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/sorting.py +0 -0
  28. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/types.py +0 -0
  29. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/peewee/utils.py +0 -0
  30. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/py.typed +0 -0
  31. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/redoc.html +0 -0
  32. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/sqlalchemy/filters.py +0 -0
  33. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/sqlalchemy/sorting.py +0 -0
  34. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/sqlalchemy/types.py +0 -0
  35. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/swagger.html +0 -0
  36. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/types.py +0 -0
  37. {muffin_rest-7.3.1 → muffin_rest-7.3.3}/muffin_rest/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: muffin-rest
3
- Version: 7.3.1
3
+ Version: 7.3.3
4
4
  Summary: The package provides enhanced support for writing REST APIs with Muffin framework
5
5
  Home-page: https://github.com/klen/muffin-rest
6
6
  License: MIT
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.8
19
19
  Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
22
23
  Classifier: Topic :: Internet :: WWW/HTTP
23
24
  Provides-Extra: peewee
24
25
  Provides-Extra: sqlalchemy
@@ -38,9 +38,9 @@ class Filter(Mutate):
38
38
  "$nor": lambda v, c: not any(f(v, c) for f in v),
39
39
  }
40
40
  operators["<"] = operators["$lt"]
41
- operators["<="] = operators["$le"]
41
+ operators["<="] = operators["$lte"] = operators["$le"]
42
42
  operators[">"] = operators["$gt"]
43
- operators[">="] = operators["$ge"]
43
+ operators[">="] = operators["$gte"] = operators["$ge"]
44
44
  operators["=="] = operators["$eq"]
45
45
  operators["!="] = operators["$ne"]
46
46
  operators["<<"] = operators["$in"]
@@ -138,8 +138,8 @@ class Filters(Mutator):
138
138
  data = json_loads(raw_data)
139
139
  assert isinstance(data, dict)
140
140
  mutations = self.mutations
141
- for name in data:
142
- if name in mutations:
141
+ for name in mutations:
142
+ if name in data:
143
143
  ops, collection = await mutations[name].apply(collection, data)
144
144
  filters[name] = ops
145
145
 
@@ -1,4 +1,4 @@
1
- from typing import Optional, Type
1
+ from typing import Type
2
2
 
3
3
  import peewee as pw
4
4
  from marshmallow_peewee import ModelSchema
@@ -27,7 +27,7 @@ class PWRESTOptions(RESTOptions):
27
27
  base_property: str = "model"
28
28
 
29
29
  model: Type[pw.Model]
30
- model_pk: Optional[pw.Field] = None
30
+ model_pk: pw.Field
31
31
 
32
32
  manager: Manager
33
33
 
@@ -38,7 +38,7 @@ class PWRESTOptions(RESTOptions):
38
38
  """Prepare meta options."""
39
39
  meta = self.model._meta # type: ignore[]
40
40
  self.name = self.name or meta.table_name.lower()
41
- self.model_pk = self.model_pk or meta.primary_key
41
+ self.model_pk = getattr(self, "model_pk", None) or meta.primary_key
42
42
  manager = getattr(self, "manager", getattr(self.model, "_manager", None))
43
43
  if manager is None:
44
44
  raise RuntimeError("Peewee-AIO ORM Manager is not available")
@@ -35,7 +35,6 @@ class Sort(Mutate):
35
35
 
36
36
 
37
37
  class Sorting(Mutator):
38
-
39
38
  """Build sorters for handlers."""
40
39
 
41
40
  MUTATE_CLASS = Sort
@@ -54,9 +53,11 @@ class Sorting(Mutator):
54
53
  sorting = {}
55
54
  if data:
56
55
  collection = self.prepare(collection)
57
- for name, desc in to_sort(data.split(",")):
58
- sort = self.mutations.get(name)
59
- if sort:
56
+ sorting = dict(to_sort(data.split(",")))
57
+ for name in self.mutations:
58
+ sort = self.mutations[name]
59
+ if name in sorting:
60
+ desc = sorting[name]
60
61
  collection = await sort.apply(collection, desc=desc)
61
62
  sorting[sort.name] = desc
62
63
 
@@ -77,7 +77,7 @@ class SARESTOptions(RESTOptions):
77
77
  schema_base: Type[SQLAlchemyAutoSchema] = SQLAlchemyAutoSchema
78
78
 
79
79
  table: sa.Table
80
- table_pk: Optional[sa.Column] = None
80
+ table_pk: sa.Column
81
81
  database: Database
82
82
 
83
83
  base_property = "table"
@@ -88,7 +88,7 @@ class SARESTOptions(RESTOptions):
88
88
  raise ValueError("'SARESTHandler.Meta.database' is required")
89
89
 
90
90
  self.name = self.name or self.table.name
91
- self.table_pk = self.table_pk or self.table.c.id
91
+ self.table_pk = getattr(self, "table_pk", None) or self.table.c.id
92
92
 
93
93
  super().setup(cls)
94
94
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "muffin-rest"
3
- version = "7.3.1"
3
+ version = "7.3.3"
4
4
  description = "The package provides enhanced support for writing REST APIs with Muffin framework"
5
5
  readme = "README.rst"
6
6
  homepage = "https://github.com/klen/muffin-rest"
File without changes
File without changes