TypeDAL 3.9.1__py3-none-any.whl → 3.9.3__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 TypeDAL might be problematic. Click here for more details.

typedal/__about__.py CHANGED
@@ -5,4 +5,4 @@ This file contains the Version info for this package.
5
5
  # SPDX-FileCopyrightText: 2023-present Robin van der Noord <robinvandernoord@gmail.com>
6
6
  #
7
7
  # SPDX-License-Identifier: MIT
8
- __version__ = "3.9.1"
8
+ __version__ = "3.9.3"
typedal/for_py4web.py CHANGED
@@ -2,9 +2,13 @@
2
2
  ONLY USE IN COMBINATION WITH PY4WEB!
3
3
  """
4
4
 
5
+ import typing
6
+
5
7
  import threadsafevariable
8
+ from configuraptor.abs import AnyType
6
9
  from py4web.core import ICECUBE
7
10
  from py4web.core import Fixture as _Fixture
11
+ from pydal.base import MetaDAL, hashlib_md5
8
12
 
9
13
  from .core import TypeDAL
10
14
  from .types import AnyDict
@@ -17,7 +21,21 @@ class Fixture(_Fixture): # type: ignore
17
21
  """
18
22
 
19
23
 
20
- class DAL(TypeDAL, Fixture): # pragma: no cover
24
+ class PY4WEB_DAL_SINGLETON(MetaDAL):
25
+ _instances: typing.ClassVar[typing.MutableMapping[str, AnyType]] = {}
26
+
27
+ def __call__(cls, uri: str, *args: typing.Any, **kwargs: typing.Any) -> AnyType:
28
+ db_uid = kwargs.get("db_uid", hashlib_md5(repr(uri)).hexdigest())
29
+ if db_uid not in cls._instances:
30
+ cls._instances[db_uid] = super().__call__(uri, *args, **kwargs)
31
+
32
+ return cls._instances[db_uid]
33
+
34
+ def _clear(cls) -> None:
35
+ cls._instances.clear()
36
+
37
+
38
+ class DAL(TypeDAL, Fixture, metaclass=PY4WEB_DAL_SINGLETON): # pragma: no cover
21
39
  """
22
40
  Fixture similar to the py4web pydal fixture, but for typedal.
23
41
  """
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: TypeDAL
3
- Version: 3.9.1
3
+ Version: 3.9.3
4
4
  Summary: Typing support for PyDAL
5
5
  Project-URL: Documentation, https://typedal.readthedocs.io/
6
6
  Project-URL: Issues, https://github.com/trialandsuccess/TypeDAL/issues
7
7
  Project-URL: Source, https://github.com/trialandsuccess/TypeDAL
8
8
  Author-email: Robin van der Noord <contact@trialandsuccess.nl>
9
- License-Expression: MIT
10
9
  Classifier: Development Status :: 4 - Beta
11
10
  Classifier: Programming Language :: Python
12
11
  Classifier: Programming Language :: Python :: 3.10
@@ -1,11 +1,11 @@
1
- typedal/__about__.py,sha256=B3nvfsy5sqV1qvJD-USMBUZp7Yxt_MntWJjHQpKTRp4,206
1
+ typedal/__about__.py,sha256=1UM5faaqWwuDvGwM1phck1IYGhiBNMkmGgIU-_A9xpI,206
2
2
  typedal/__init__.py,sha256=QQpLiVl9w9hm2LBxey49Y_tCF_VB2bScVaS_mCjYy54,366
3
3
  typedal/caching.py,sha256=SMcJsahLlZ79yykWCveERFx1ZJUNEKhA9SPmCTIuLp8,11798
4
4
  typedal/cli.py,sha256=wzyId6YwRyqfuJ2byxvl6YecDNaKpkLmo-R5HvRuTok,19265
5
5
  typedal/config.py,sha256=0qy1zrTUdtmXPM9jHzFnSR1DJsqGJqcdG6pvhzKQHe0,11625
6
6
  typedal/core.py,sha256=OBokUmNBvm83REIEKUjjIXna5UWSXC5H8M82LiAag0M,102729
7
7
  typedal/fields.py,sha256=A4qt0aK4F_-UeOY-xJ0ObVY-tFEoLFy7TYRMHnp4g6o,6516
8
- typedal/for_py4web.py,sha256=d07b8hL_PvNDUS26Z5fDH2OxWb-IETBuAFPSzrRwm04,1285
8
+ typedal/for_py4web.py,sha256=jFy-sB_0x8h7xYrYuXjB4FnBc4gTOywnYPkX_OrXtM8,1904
9
9
  typedal/for_web2py.py,sha256=xn7zo6ImsmTkH6LacbjLQl2oqyBvP0zLqRxEJvMQk1w,1929
10
10
  typedal/helpers.py,sha256=uej96exzJ9qVBd6LudP8uJ_7Cmq6vKraerdKvSRBVjc,8128
11
11
  typedal/mixins.py,sha256=6QfeVBAk7J4uHSR82Ek_Bhq43hzxnrmLn6xqxZqYtMk,5757
@@ -13,7 +13,7 @@ typedal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  typedal/types.py,sha256=1FIgv1s0be0E8r5Wd9E1nvDvK4ETV8u2NlfI7_P6UUY,6752
14
14
  typedal/web2py_py4web_shared.py,sha256=VK9T8P5UwVLvfNBsY4q79ANcABv-jX76YKADt1Zz_co,1539
15
15
  typedal/serializers/as_json.py,sha256=ffo152W-sARYXym4BzwX709rrO2-QwKk2KunWY8RNl4,2229
16
- typedal-3.9.1.dist-info/METADATA,sha256=Sq9mjfjvP1QgHSkb5HMpTkmsoxqyAZe7vFHTU-KXeQc,10463
17
- typedal-3.9.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
- typedal-3.9.1.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
19
- typedal-3.9.1.dist-info/RECORD,,
16
+ typedal-3.9.3.dist-info/METADATA,sha256=B7ZYk4T7UQ2lxTFa4oELN5Z3qV_1soCBCz0HzUWW7bg,10439
17
+ typedal-3.9.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
+ typedal-3.9.3.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
19
+ typedal-3.9.3.dist-info/RECORD,,