sapx 0.2.2__tar.gz → 0.2.4__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 (54) hide show
  1. {sapx-0.2.2 → sapx-0.2.4}/PKG-INFO +1 -1
  2. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/document.py +2 -15
  3. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/serializers.py +2 -1
  4. {sapx-0.2.2 → sapx-0.2.4}/sap/rest/client.py +2 -0
  5. {sapx-0.2.2 → sapx-0.2.4}/sapx.egg-info/PKG-INFO +1 -1
  6. {sapx-0.2.2 → sapx-0.2.4}/setup.py +1 -1
  7. {sapx-0.2.2 → sapx-0.2.4}/README.md +0 -0
  8. {sapx-0.2.2 → sapx-0.2.4}/pyproject.toml +0 -0
  9. {sapx-0.2.2 → sapx-0.2.4}/sap/__init__.py +0 -0
  10. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/__init__.py +0 -0
  11. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/client.py +0 -0
  12. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/exceptions.py +0 -0
  13. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/link.py +0 -0
  14. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/mixins.py +0 -0
  15. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/patch.py +0 -0
  16. {sapx-0.2.2 → sapx-0.2.4}/sap/beanie/query.py +0 -0
  17. {sapx-0.2.2 → sapx-0.2.4}/sap/chart/__init__.py +0 -0
  18. {sapx-0.2.2 → sapx-0.2.4}/sap/chart/serializers.py +0 -0
  19. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/__init__.py +0 -0
  20. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/auth.py +0 -0
  21. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/exceptions.py +0 -0
  22. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/forms.py +0 -0
  23. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/middleware.py +0 -0
  24. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/pagination.py +0 -0
  25. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/user.py +0 -0
  26. {sapx-0.2.2 → sapx-0.2.4}/sap/fastapi/utils.py +0 -0
  27. {sapx-0.2.2 → sapx-0.2.4}/sap/loggers.py +0 -0
  28. {sapx-0.2.2 → sapx-0.2.4}/sap/py.typed +0 -0
  29. {sapx-0.2.2 → sapx-0.2.4}/sap/pydantic/__init__.py +0 -0
  30. {sapx-0.2.2 → sapx-0.2.4}/sap/rest/__init__.py +0 -0
  31. {sapx-0.2.2 → sapx-0.2.4}/sap/rest/rest_exceptions.py +0 -0
  32. {sapx-0.2.2 → sapx-0.2.4}/sap/settings.py +0 -0
  33. {sapx-0.2.2 → sapx-0.2.4}/sap/tests/__init__.py +0 -0
  34. {sapx-0.2.2 → sapx-0.2.4}/sap/tests/crons.py +0 -0
  35. {sapx-0.2.2 → sapx-0.2.4}/sap/tests/rest.py +0 -0
  36. {sapx-0.2.2 → sapx-0.2.4}/sap/tests/utils.py +0 -0
  37. {sapx-0.2.2 → sapx-0.2.4}/sap/typing/__init__.py +0 -0
  38. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/__init__.py +0 -0
  39. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/amqp.py +0 -0
  40. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/config.py +0 -0
  41. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/crons.py +0 -0
  42. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/crons_airtable.py +0 -0
  43. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/debug.py +0 -0
  44. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/exceptions.py +0 -0
  45. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/lambdas.py +0 -0
  46. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/packet.py +0 -0
  47. {sapx-0.2.2 → sapx-0.2.4}/sap/worker/utils.py +0 -0
  48. {sapx-0.2.2 → sapx-0.2.4}/sapx.egg-info/SOURCES.txt +0 -0
  49. {sapx-0.2.2 → sapx-0.2.4}/sapx.egg-info/dependency_links.txt +0 -0
  50. {sapx-0.2.2 → sapx-0.2.4}/sapx.egg-info/requires.txt +0 -0
  51. {sapx-0.2.2 → sapx-0.2.4}/sapx.egg-info/top_level.txt +0 -0
  52. {sapx-0.2.2 → sapx-0.2.4}/setup.cfg +0 -0
  53. {sapx-0.2.2 → sapx-0.2.4}/tests/test_fastapi_utils.py +0 -0
  54. {sapx-0.2.2 → sapx-0.2.4}/tests/test_rest_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sapx
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Library of re-usable utilities for python web apps.
5
5
  Home-page: https://github.com/trellixio/sap
6
6
  Author: Trellix Dev
@@ -30,7 +30,7 @@ class DocSourceEnum(Enum):
30
30
  CRON: str = "cron"
31
31
 
32
32
 
33
- class _DocMeta(pydantic.BaseModel):
33
+ class DocMeta(pydantic.BaseModel):
34
34
  """Meta Data allowing to keep trace of Documents versioning and updates."""
35
35
 
36
36
  version: int = 0 # version of the document being imported
@@ -40,23 +40,10 @@ class _DocMeta(pydantic.BaseModel):
40
40
  deleted: Optional[datetime] = None # when the document was deleted, (deleted document may be retained for logging)
41
41
 
42
42
 
43
- # class DocMeta(pydantic.BaseModel):
44
- # """Manage meta data and ensure that it's correctly set."""
45
-
46
- # doc_meta: _DocMeta = _DocMeta()
47
-
48
- # @pydantic.model_validator(mode='after')
49
- # def validate_doc_meta(self) -> 'DocMeta':
50
- # """Validate doc meta on each model update."""
51
- # self.doc_meta.updated = datetime.now(timezone.utc)
52
- # self.doc_meta.created = self.doc_meta.created or self.doc_meta.updated
53
- # return self
54
-
55
-
56
43
  class Document(beanie.Document):
57
44
  """Subclass beanie.Document that add handy methods."""
58
45
 
59
- doc_meta: _DocMeta = _DocMeta()
46
+ doc_meta: DocMeta = DocMeta()
60
47
 
61
48
  def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-parent-delegation
62
49
  """Silent mypy."""
@@ -78,7 +78,8 @@ class ObjectSerializer(BaseModel, Generic[ModelT]):
78
78
  and inspect.isclass(args[0])
79
79
  and issubclass(args[0], ObjectSerializer)
80
80
  ):
81
- return args[0].read(related_object, exclude=exclude) if related_object else []
81
+ value_default = [] if origin == List else None
82
+ return args[0].read(related_object, exclude=exclude) if related_object else value_default
82
83
 
83
84
  return getattr(instance, field_name)
84
85
 
@@ -87,6 +87,8 @@ class RestClient:
87
87
 
88
88
  async with self._get_client() as client:
89
89
  response = await client.request(method, url, json=json, params=params, files=files)
90
+
91
+ print(f"{method} {url} {response}")
90
92
  return await self.get_response_data(response)
91
93
 
92
94
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sapx
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Library of re-usable utilities for python web apps.
5
5
  Home-page: https://github.com/trellixio/sap
6
6
  Author: Trellix Dev
@@ -10,7 +10,7 @@ long_description = (this_directory / "README.md").read_text()
10
10
  # allow setup.py to be run from any path
11
11
  os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
12
12
 
13
- VERSION = "0.2.2"
13
+ VERSION = "0.2.4"
14
14
 
15
15
  setup(
16
16
  name="sapx",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes