cardo-python-utils 0.5.dev13__tar.gz → 0.5.dev14__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 (35) hide show
  1. {cardo_python_utils-0.5.dev13/cardo_python_utils.egg-info → cardo_python_utils-0.5.dev14}/PKG-INFO +1 -1
  2. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14/cardo_python_utils.egg-info}/PKG-INFO +1 -1
  3. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/pyproject.toml +1 -1
  4. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/choices.py +4 -3
  5. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/api/ninja.py +3 -3
  6. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/api/utils.py +2 -2
  7. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/LICENSE +0 -0
  8. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/MANIFEST.in +0 -0
  9. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/README.rst +0 -0
  10. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/cardo_python_utils.egg-info/SOURCES.txt +0 -0
  11. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/cardo_python_utils.egg-info/dependency_links.txt +0 -0
  12. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/cardo_python_utils.egg-info/requires.txt +0 -0
  13. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/cardo_python_utils.egg-info/top_level.txt +0 -0
  14. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/__init__.py +0 -0
  15. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/data_structures.py +0 -0
  16. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/db.py +0 -0
  17. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/__init__.py +0 -0
  18. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/admin/__init__.py +0 -0
  19. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/admin/auth.py +0 -0
  20. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/admin/user_group.py +0 -0
  21. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/admin/user_groups_changelist.html +0 -0
  22. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/api/__init__.py +0 -0
  23. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/api/drf.py +0 -0
  24. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/models/__init__.py +0 -0
  25. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/models/user_group.py +0 -0
  26. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/keycloak/service.py +0 -0
  27. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/django/utils.py +0 -0
  28. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/esma_choices.py +0 -0
  29. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/exceptions.py +0 -0
  30. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/imports.py +0 -0
  31. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/math.py +0 -0
  32. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/text.py +0 -0
  33. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/time.py +0 -0
  34. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/python_utils/types_hinting.py +0 -0
  35. {cardo_python_utils-0.5.dev13 → cardo_python_utils-0.5.dev14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cardo-python-utils
3
- Version: 0.5.dev13
3
+ Version: 0.5.dev14
4
4
  Summary: Python library enhanced with a wide range of functions for different scenarios.
5
5
  Author-email: CardoAI <hello@cardoai.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cardo-python-utils
3
- Version: 0.5.dev13
3
+ Version: 0.5.dev14
4
4
  Summary: Python library enhanced with a wide range of functions for different scenarios.
5
5
  Author-email: CardoAI <hello@cardoai.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cardo-python-utils"
7
- version = "0.5.dev13"
7
+ version = "0.5.dev14"
8
8
  description = "Python library enhanced with a wide range of functions for different scenarios."
9
9
  readme = "README.rst"
10
10
  requires-python = ">=3.8"
@@ -9,6 +9,7 @@ It adds some useful methods to the Enum class, such as:
9
9
 
10
10
  from abc import ABC, abstractmethod
11
11
  from enum import EnumMeta, Enum
12
+ from typing import Union
12
13
 
13
14
 
14
15
  class IChoice(ABC):
@@ -41,7 +42,7 @@ class ChoiceEnumMeta(EnumMeta, IChoice, ABC):
41
42
 
42
43
  return new_cls
43
44
 
44
- def __contains__(cls, item: int | str) -> bool:
45
+ def __contains__(cls, item: Union[int, str]) -> bool:
45
46
  if isinstance(item, int):
46
47
  member_values = [v.value[0] for v in cls.__members__.values()]
47
48
  elif isinstance(item, str):
@@ -75,12 +76,12 @@ class ChoiceEnum(Enum, metaclass=ChoiceEnumMeta):
75
76
  return {elm.value[0]: elm.value[1] for elm in cls}
76
77
 
77
78
  @classmethod
78
- def get_by_value(cls, value: str | int):
79
+ def get_by_value(cls, value: Union[str, int]):
79
80
  value_index = 0 if isinstance(value, int) else 1
80
81
  return next((v for v in cls.__members__.values() if v.value[value_index] == value), None)
81
82
 
82
83
  @classmethod
83
- def list_as(cls, item_type) -> list[int | str]:
84
+ def list_as(cls, item_type) -> list[Union[int, str]]:
84
85
  if item_type not in [int, str]:
85
86
  raise TypeError('Invalid item type')
86
87
  return list(map(item_type, cls))
@@ -1,5 +1,5 @@
1
1
  import logging
2
- from typing import Literal, Optional
2
+ from typing import Literal, Optional, Union
3
3
 
4
4
  from jwt.exceptions import InvalidTokenError
5
5
 
@@ -93,7 +93,7 @@ class AuthBearer(HttpBearer):
93
93
 
94
94
  if scopes is None:
95
95
  raise Exception(
96
- f"No allowed_scopes defined on the view {view_function.__name__}."
96
+ f"No allowed_scopes defined on the view {view_function.__name__}. "
97
97
  "Add the decorator @allowed_scopes([...]) or @allowed_scopes('*') to the view."
98
98
  )
99
99
 
@@ -138,7 +138,7 @@ class AuthBearerAsync(AuthBearer):
138
138
  return payload
139
139
 
140
140
 
141
- def allowed_scopes(scopes: list[str] | Literal["*"]):
141
+ def allowed_scopes(scopes: Union[list[str], Literal["*"]]):
142
142
  """
143
143
  A decorator that attaches a list of required scopes to a view function
144
144
  in the attribute `_allowed_scopes`.
@@ -1,4 +1,4 @@
1
- from typing import TypedDict
1
+ from typing import TypedDict, Union
2
2
 
3
3
  from django.conf import settings
4
4
  from django.contrib.auth import get_user_model
@@ -13,7 +13,7 @@ class TokenPayload(TypedDict, total=False):
13
13
  iat: int
14
14
  jti: str
15
15
  iss: str
16
- aud: str | list[str]
16
+ aud: Union[str, list[str]]
17
17
  typ: str
18
18
  azp: str
19
19
  sid: str