pythagoras 0.23.7__tar.gz → 0.23.8__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.
- {pythagoras-0.23.7 → pythagoras-0.23.8}/PKG-INFO +1 -1
- {pythagoras-0.23.7 → pythagoras-0.23.8}/pyproject.toml +1 -1
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_030_data_portals/data_portal_core_classes.py +1 -1
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/logging_portal_core_classes.py +1 -1
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_050_safe_code_portals/safe_portal_core_classes.py +1 -1
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_060_autonomous_code_portals/autonomous_portal_core_classes.py +16 -11
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/protected_portal_core_classes.py +31 -21
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_080_pure_code_portals/pure_core_classes.py +1 -1
- {pythagoras-0.23.7 → pythagoras-0.23.8}/README.md +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/.DS_Store +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/basic_portal_core_classes.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/exceptions.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/long_infoname.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/not_picklable_class.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/portal_tester.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/post_init_metaclass.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_020_ordinary_code_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_020_ordinary_code_portals/code_normalizer.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_020_ordinary_code_portals/function_processing.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_020_ordinary_code_portals/ordinary_decorator.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_020_ordinary_code_portals/ordinary_portal_core_classes.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_030_data_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_030_data_portals/ready_and_get.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_030_data_portals/storable_decorator.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/exception_processing_tracking.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/execution_environment_summary.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/kw_args.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/logging_decorator.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/notebook_checker.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/output_capturer.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/uncaught_exceptions.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_050_safe_code_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_050_safe_code_portals/safe_decorator.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_060_autonomous_code_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_060_autonomous_code_portals/autonomous_decorators.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_060_autonomous_code_portals/names_usage_analyzer.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/basic_pre_validators.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/fn_arg_names_checker.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/list_flattener.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/package_manager.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/protected_decorators.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/system_utils.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/validation_succesful_const.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/validator_fn_classes.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_080_pure_code_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_080_pure_code_portals/pure_decorator.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_090_swarming_portals/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_090_swarming_portals/output_suppressor.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_090_swarming_portals/swarming_portals.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_100_top_level_API/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_100_top_level_API/default_local_portal.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_100_top_level_API/top_level_API.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_800_signatures_and_converters/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_800_signatures_and_converters/base_16_32_convertors.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_800_signatures_and_converters/current_date_gmt_str.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_800_signatures_and_converters/hash_signatures.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_800_signatures_and_converters/node_signature.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_800_signatures_and_converters/random_signatures.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_900_project_stats_collector/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_900_project_stats_collector/project_analyzer.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/__init__.py +0 -0
- {pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/core/__init__.py +0 -0
|
@@ -4,6 +4,8 @@ import builtins
|
|
|
4
4
|
from typing import Callable, Any
|
|
5
5
|
|
|
6
6
|
from persidict import PersiDict, Joker, KEEP_CURRENT
|
|
7
|
+
|
|
8
|
+
from .._010_basic_portals import PortalAwareClass
|
|
7
9
|
from .._020_ordinary_code_portals.code_normalizer import _pythagoras_decorator_names
|
|
8
10
|
from .._030_data_portals import DataPortal
|
|
9
11
|
from .._040_logging_code_portals import KwArgs
|
|
@@ -29,7 +31,7 @@ class AutonomousCodePortal(SafeCodePortal):
|
|
|
29
31
|
|
|
30
32
|
class AutonomousFn(SafeFn):
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
_fixed_kwargs_cache: KwArgs | None
|
|
33
35
|
_fixed_kwargs_packed: KwArgs | None
|
|
34
36
|
|
|
35
37
|
def __init__(self, fn: Callable|str|SafeFn
|
|
@@ -46,9 +48,9 @@ class AutonomousFn(SafeFn):
|
|
|
46
48
|
|
|
47
49
|
if isinstance(fn, AutonomousFn):
|
|
48
50
|
self._fixed_kwargs_packed.update(fixed_kwargs_packed)
|
|
49
|
-
self.
|
|
51
|
+
self._fixed_kwargs_cache = KwArgs(**{**fn.fixed_kwargs, **fixed_kwargs})
|
|
50
52
|
else:
|
|
51
|
-
self.
|
|
53
|
+
self._fixed_kwargs_cache = fixed_kwargs
|
|
52
54
|
self._fixed_kwargs_packed = fixed_kwargs_packed
|
|
53
55
|
|
|
54
56
|
fn_name = self.name
|
|
@@ -88,10 +90,10 @@ class AutonomousFn(SafeFn):
|
|
|
88
90
|
|
|
89
91
|
@property
|
|
90
92
|
def fixed_kwargs(self) -> KwArgs:
|
|
91
|
-
if not hasattr(self, "
|
|
93
|
+
if not hasattr(self, "_fixed_kwargs_cache"):
|
|
92
94
|
with self.portal:
|
|
93
|
-
self.
|
|
94
|
-
return self.
|
|
95
|
+
self._fixed_kwargs_cache = self._fixed_kwargs_packed.unpack()
|
|
96
|
+
return self._fixed_kwargs_cache
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
def execute(self, **kwargs) -> Any:
|
|
@@ -120,9 +122,12 @@ class AutonomousFn(SafeFn):
|
|
|
120
122
|
|
|
121
123
|
def _first_visit_to_portal(self, portal: DataPortal) -> None:
|
|
122
124
|
super()._first_visit_to_portal(portal)
|
|
123
|
-
if hasattr(self,"
|
|
125
|
+
if hasattr(self,"_fixed_kwargs_cache"):
|
|
124
126
|
with portal:
|
|
125
|
-
|
|
127
|
+
for v in self._fixed_kwargs_cache.values():
|
|
128
|
+
if isinstance(v, PortalAwareClass):
|
|
129
|
+
v._first_visit_to_portal(portal)
|
|
130
|
+
_ = self._fixed_kwargs_cache.pack()
|
|
126
131
|
|
|
127
132
|
|
|
128
133
|
def __getstate__(self):
|
|
@@ -140,7 +145,7 @@ class AutonomousFn(SafeFn):
|
|
|
140
145
|
|
|
141
146
|
@property
|
|
142
147
|
def portal(self) -> AutonomousCodePortal:
|
|
143
|
-
return
|
|
148
|
+
return super().portal
|
|
144
149
|
|
|
145
150
|
|
|
146
151
|
def _invalidate_cache(self):
|
|
@@ -151,8 +156,8 @@ class AutonomousFn(SafeFn):
|
|
|
151
156
|
This method should delete all such attributes.
|
|
152
157
|
"""
|
|
153
158
|
super()._invalidate_cache()
|
|
154
|
-
if hasattr(self, "
|
|
159
|
+
if hasattr(self, "_fixed_kwargs_cache"):
|
|
155
160
|
if not hasattr(self, "_fixed_kwargs_packed"):
|
|
156
161
|
raise AttributeError("Premature cache invalidation: "
|
|
157
162
|
"fixed_kwargs_packed is missing.")
|
|
158
|
-
del self.
|
|
163
|
+
del self._fixed_kwargs_cache
|
|
@@ -48,8 +48,8 @@ class ProtectedCodePortal(AutonomousCodePortal):
|
|
|
48
48
|
|
|
49
49
|
class ProtectedFn(AutonomousFn):
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
_pre_validators_cache: list[ValidatorFn] | None
|
|
52
|
+
_post_validators_cache: list[ValidatorFn] | None
|
|
53
53
|
_pre_validators_addrs: list[ValueAddr]
|
|
54
54
|
_post_validators_addrs: list[ValueAddr]
|
|
55
55
|
|
|
@@ -84,12 +84,12 @@ class ProtectedFn(AutonomousFn):
|
|
|
84
84
|
pre_validators = self._normalize_validators(pre_validators, PreValidatorFn)
|
|
85
85
|
post_validators = self._normalize_validators(post_validators, PostValidatorFn)
|
|
86
86
|
|
|
87
|
-
self.
|
|
88
|
-
self.
|
|
87
|
+
self._pre_validators_cache = pre_validators
|
|
88
|
+
self._post_validators_cache = post_validators
|
|
89
89
|
self._pre_validators_addrs = [ValueAddr(g, store=False)
|
|
90
|
-
for g in self.
|
|
90
|
+
for g in self._pre_validators_cache]
|
|
91
91
|
self._post_validators_addrs = [ValueAddr(v, store=False)
|
|
92
|
-
for v in self.
|
|
92
|
+
for v in self._post_validators_cache]
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
def __getstate__(self):
|
|
@@ -112,27 +112,37 @@ class ProtectedFn(AutonomousFn):
|
|
|
112
112
|
"""Register an object in a portal that the object has not seen before."""
|
|
113
113
|
super()._first_visit_to_portal(portal)
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
for f in self.pre_validators:
|
|
116
|
+
f._first_visit_to_portal(portal)
|
|
117
|
+
for f in self.post_validators:
|
|
118
|
+
f._first_visit_to_portal(portal)
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
|
|
121
|
+
# if hasattr(self,"_pre_validators_cache"):
|
|
122
|
+
# with portal:
|
|
123
|
+
# _ = [ValueAddr(g) for g in self._pre_validators_cache]
|
|
124
|
+
# else:
|
|
125
|
+
# raise AttributeError("Missing pre-validators: ")
|
|
126
|
+
#
|
|
127
|
+
# if hasattr(self,"_post_validators_cache"):
|
|
128
|
+
# with portal:
|
|
129
|
+
# _ = [ValueAddr(g) for g in self._post_validators_cache]
|
|
130
|
+
# else:
|
|
131
|
+
# raise AttributeError("Missing post-validators: ")
|
|
122
132
|
|
|
123
133
|
|
|
124
134
|
@property
|
|
125
135
|
def pre_validators(self) -> list[AutonomousFn]:
|
|
126
|
-
if not hasattr(self, "
|
|
127
|
-
self.
|
|
128
|
-
return self.
|
|
136
|
+
if not hasattr(self, "_pre_validators_cache"):
|
|
137
|
+
self._pre_validators_cache = [addr.get() for addr in self._pre_validators_addrs]
|
|
138
|
+
return self._pre_validators_cache
|
|
129
139
|
|
|
130
140
|
|
|
131
141
|
@property
|
|
132
142
|
def post_validators(self) -> list[AutonomousFn]:
|
|
133
|
-
if not hasattr(self, "
|
|
134
|
-
self.
|
|
135
|
-
return self.
|
|
143
|
+
if not hasattr(self, "_post_validators_cache"):
|
|
144
|
+
self._post_validators_cache = [addr.get() for addr in self._post_validators_addrs]
|
|
145
|
+
return self._post_validators_cache
|
|
136
146
|
|
|
137
147
|
|
|
138
148
|
def can_be_executed(self, kw_args: KwArgs) -> bool:
|
|
@@ -210,7 +220,7 @@ class ProtectedFn(AutonomousFn):
|
|
|
210
220
|
|
|
211
221
|
@property
|
|
212
222
|
def portal(self) -> ProtectedCodePortal:
|
|
213
|
-
return
|
|
223
|
+
return super().portal
|
|
214
224
|
|
|
215
225
|
|
|
216
226
|
def _invalidate_cache(self):
|
|
@@ -225,9 +235,9 @@ class ProtectedFn(AutonomousFn):
|
|
|
225
235
|
if not hasattr(self, "_post_validators_addrs"):
|
|
226
236
|
raise AttributeError("Premature cache invalidation: "
|
|
227
237
|
"_post_validators_addrs is missing.")
|
|
228
|
-
del self.
|
|
238
|
+
del self._post_validators_cache
|
|
229
239
|
if hasattr(self, "_pre_validators_cached"):
|
|
230
240
|
if not hasattr(self, "_pre_validators_addrs"):
|
|
231
241
|
raise AttributeError("Premature cache invalidation: "
|
|
232
242
|
"_pre_validators_addrs is missing.")
|
|
233
|
-
del self.
|
|
243
|
+
del self._pre_validators_cache
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/not_picklable_class.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_010_basic_portals/post_init_metaclass.py
RENAMED
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_020_ordinary_code_portals/__init__.py
RENAMED
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_020_ordinary_code_portals/code_normalizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_030_data_portals/storable_decorator.py
RENAMED
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/notebook_checker.py
RENAMED
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_040_logging_code_portals/output_capturer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_050_safe_code_portals/safe_decorator.py
RENAMED
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_060_autonomous_code_portals/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/list_flattener.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_070_protected_code_portals/system_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_080_pure_code_portals/pure_decorator.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_090_swarming_portals/output_suppressor.py
RENAMED
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_090_swarming_portals/swarming_portals.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_100_top_level_API/default_local_portal.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_800_signatures_and_converters/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.23.7 → pythagoras-0.23.8}/src/pythagoras/_900_project_stats_collector/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|