pythagoras 0.21.4__tar.gz → 0.22.1__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.21.4 → pythagoras-0.22.1}/PKG-INFO +1 -1
- {pythagoras-0.21.4 → pythagoras-0.22.1}/pyproject.toml +1 -1
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/__init__.py +2 -3
- pythagoras-0.22.1/src/pythagoras/_070_protected_code_portals/basic_pre_validators.py +47 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/core/__init__.py +1 -1
- pythagoras-0.21.4/src/pythagoras/_070_protected_code_portals/GPU_pre_validators.py +0 -0
- pythagoras-0.21.4/src/pythagoras/_070_protected_code_portals/RAM_pre_validators.py +0 -59
- pythagoras-0.21.4/src/pythagoras/_070_protected_code_portals/python_packages_pre_validators.py +0 -29
- {pythagoras-0.21.4 → pythagoras-0.22.1}/README.md +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/.DS_Store +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/basic_portal_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/exceptions.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/long_infoname.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/not_picklable_class.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/portal_tester.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/post_init_metaclass.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_020_ordinary_code_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_020_ordinary_code_portals/code_normalizer.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_020_ordinary_code_portals/function_processing.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_020_ordinary_code_portals/ordinary_decorator.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_020_ordinary_code_portals/ordinary_portal_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_030_data_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_030_data_portals/data_portal_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_030_data_portals/ready_and_get.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_030_data_portals/storable_decorator.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/exception_processing_tracking.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/execution_environment_summary.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/kw_args.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/logging_decorator.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/logging_portal_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/notebook_checker.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/output_capturer.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/uncaught_exceptions.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_050_safe_code_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_050_safe_code_portals/safe_decorator.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_050_safe_code_portals/safe_portal_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_060_autonomous_code_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_060_autonomous_code_portals/autonomous_decorators.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_060_autonomous_code_portals/autonomous_portal_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_060_autonomous_code_portals/names_usage_analyzer.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/OK_const.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/fn_arg_names_checker.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/list_flattener.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/package_manager.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/protected_decorators.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/protected_portal_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/system_utils.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/validator_fn_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_080_pure_code_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_080_pure_code_portals/pure_core_classes.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_080_pure_code_portals/pure_decorator.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_090_swarming_portals/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_090_swarming_portals/output_suppressor.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_090_swarming_portals/swarming_portals.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_100_top_level_API/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_100_top_level_API/default_local_portal.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_100_top_level_API/top_level_API.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_800_signatures_and_converters/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_800_signatures_and_converters/base_16_32_convertors.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_800_signatures_and_converters/current_date_gmt_str.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_800_signatures_and_converters/hash_signatures.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_800_signatures_and_converters/node_signatures.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_800_signatures_and_converters/random_signatures.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_900_project_stats_collector/__init__.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_900_project_stats_collector/project_analyzer.py +0 -0
- {pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/__init__.py +0 -0
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/__init__.py
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from .OK_const import *
|
|
2
2
|
from .protected_portal_core_classes import *
|
|
3
3
|
from .protected_decorators import *
|
|
4
|
-
from .GPU_pre_validators import *
|
|
5
|
-
from .python_packages_pre_validators import *
|
|
6
|
-
from .RAM_pre_validators import *
|
|
7
4
|
from .system_utils import *
|
|
5
|
+
from .basic_pre_validators import *
|
|
6
|
+
from .package_manager import *
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from .._070_protected_code_portals import SimplePreValidatorFn
|
|
2
|
+
from .OK_const import OKClass
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def _at_least_X_CPU_cores_free_check(n:int)-> OKClass | None:
|
|
6
|
+
cores = pth.get_unused_cpu_cores()
|
|
7
|
+
if cores >= n-0.1:
|
|
8
|
+
return pth.OK
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def unused_cpu(cores:int) -> SimplePreValidatorFn:
|
|
12
|
+
assert isinstance(cores, int)
|
|
13
|
+
assert cores > 0
|
|
14
|
+
return SimplePreValidatorFn(_at_least_X_CPU_cores_free_check).fix_kwargs(n=cores)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _at_least_X_G_RAM_free_check(x:int)-> OKClass | None:
|
|
18
|
+
ram = pth.get_unused_ram_mb() / 1024
|
|
19
|
+
if ram >= x-0.1:
|
|
20
|
+
return pth.OK
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def unused_ram(Gb:int) -> SimplePreValidatorFn:
|
|
24
|
+
assert isinstance(Gb, int)
|
|
25
|
+
assert Gb > 0
|
|
26
|
+
return SimplePreValidatorFn(_at_least_X_G_RAM_free_check).fix_kwargs(x=Gb)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _check_python_package_and_install_if_needed(package_name)-> OKClass | None:
|
|
30
|
+
assert isinstance(package_name, str)
|
|
31
|
+
import importlib
|
|
32
|
+
try:
|
|
33
|
+
importlib.import_module(package_name)
|
|
34
|
+
return pth.OK
|
|
35
|
+
except:
|
|
36
|
+
pth.install_package(package_name)
|
|
37
|
+
return pth.OK
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def installed_packages(*args) -> list[SimplePreValidatorFn]:
|
|
41
|
+
validators = []
|
|
42
|
+
for package_name in args:
|
|
43
|
+
assert isinstance(package_name, str)
|
|
44
|
+
new_validator = SimplePreValidatorFn(_check_python_package_and_install_if_needed)
|
|
45
|
+
new_validator = new_validator.fix_kwargs(package_name=package_name)
|
|
46
|
+
validators.append(new_validator)
|
|
47
|
+
return validators
|
|
@@ -3,4 +3,4 @@ from .._060_autonomous_code_portals import autonomous
|
|
|
3
3
|
from .._080_pure_code_portals import pure
|
|
4
4
|
from .._090_swarming_portals import SwarmingPortal
|
|
5
5
|
from .._100_top_level_API import get_portal
|
|
6
|
-
from .._070_protected_code_portals import unused_ram
|
|
6
|
+
from .._070_protected_code_portals import unused_ram, unused_cpu, installed_packages
|
|
File without changes
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
from .._070_protected_code_portals import SimplePreValidatorFn
|
|
2
|
-
from .._060_autonomous_code_portals import autonomous
|
|
3
|
-
from .OK_const import OK, OKClass
|
|
4
|
-
from .system_utils import *
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# def free_ram_bytes(packed_kwargs, fn_addr, required_memory):
|
|
8
|
-
# import psutil
|
|
9
|
-
# mem_info = psutil.virtual_memory()
|
|
10
|
-
# if mem_info.available >= required_memory:
|
|
11
|
-
# return OK
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
# def RAM_K(limit:int) -> AutonomousFn:
|
|
15
|
-
# global free_ram_bytes
|
|
16
|
-
# if not isinstance(free_ram_bytes, AutonomousFn):
|
|
17
|
-
# free_ram_bytes = autonomous()(free_ram_bytes)
|
|
18
|
-
# limit = int(limit/1024)
|
|
19
|
-
# assert limit > 0
|
|
20
|
-
# return free_ram_bytes.fix_kwargs(required_memory = limit)
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
# def RAM_M(limit:int) -> AutonomousFn:
|
|
24
|
-
# limit = int(limit/1024)
|
|
25
|
-
# return RAM_K(limit)
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# def RAM_G(limit:int) -> AutonomousFn:
|
|
29
|
-
# limit = int(limit/1024)
|
|
30
|
-
# return RAM_M(limit)
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
# def RAM_T(limit:int) -> AutonomousFn:
|
|
34
|
-
# limit = int(limit/1024)
|
|
35
|
-
# return RAM_G(limit)
|
|
36
|
-
|
|
37
|
-
@autonomous()
|
|
38
|
-
def at_least_X_G_RAM_free_check(x:int)->bool|OKClass:
|
|
39
|
-
ram = pth.get_unused_ram_mb() / 1024
|
|
40
|
-
if ram >= x:
|
|
41
|
-
return pth.OK
|
|
42
|
-
else:
|
|
43
|
-
return False
|
|
44
|
-
|
|
45
|
-
def unused_ram(Gb:int):
|
|
46
|
-
assert isinstance(Gb, int)
|
|
47
|
-
assert Gb > 0
|
|
48
|
-
return SimplePreValidatorFn(at_least_X_G_RAM_free_check.fix_kwargs(x=Gb))
|
|
49
|
-
|
|
50
|
-
at_least_1_G_RAM_free = unused_ram(Gb=1)
|
|
51
|
-
at_least_2_G_RAM_free = unused_ram(Gb=2)
|
|
52
|
-
at_least_4_G_RAM_free = unused_ram(Gb=4)
|
|
53
|
-
at_least_8_G_RAM_free = unused_ram(Gb=8)
|
|
54
|
-
at_least_16_G_RAM_free = unused_ram(Gb=16)
|
|
55
|
-
at_least_32_G_RAM_free = unused_ram(Gb=32)
|
|
56
|
-
at_least_64_G_RAM_free = unused_ram(Gb=64)
|
|
57
|
-
at_least_128_G_RAM_free = unused_ram(Gb=128)
|
|
58
|
-
at_least_256_G_RAM_free = unused_ram(Gb=256)
|
|
59
|
-
at_least_512_G_RAM_free = unused_ram(Gb=512)
|
pythagoras-0.21.4/src/pythagoras/_070_protected_code_portals/python_packages_pre_validators.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from .._060_autonomous_code_portals import AutonomousFn, autonomous
|
|
2
|
-
from .OK_const import OK
|
|
3
|
-
from .package_manager import install_package
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def check_python_package_and_install_if_needed(packed_kwargs, package_name):
|
|
7
|
-
assert isinstance(package_name, str)
|
|
8
|
-
import importlib
|
|
9
|
-
try:
|
|
10
|
-
importlib.import_module(package_name)
|
|
11
|
-
return OK
|
|
12
|
-
except:
|
|
13
|
-
install_package(package_name)
|
|
14
|
-
return OK
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def installed_packages(package_names:list[str]|str) -> list[AutonomousFn]:
|
|
18
|
-
global check_python_package_and_install_if_needed
|
|
19
|
-
if not isinstance(check_python_package_and_install_if_needed, AutonomousFn):
|
|
20
|
-
check_python_package_and_install_if_needed = autonomous()(
|
|
21
|
-
check_python_package_and_install_if_needed)
|
|
22
|
-
|
|
23
|
-
result = []
|
|
24
|
-
if isinstance(package_names, str):
|
|
25
|
-
package_names = [package_names]
|
|
26
|
-
for package_name in package_names:
|
|
27
|
-
result.append(check_python_package_and_install_if_needed.fix_kwargs(
|
|
28
|
-
package_name=package_name))
|
|
29
|
-
return result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/not_picklable_class.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_010_basic_portals/post_init_metaclass.py
RENAMED
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_020_ordinary_code_portals/__init__.py
RENAMED
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/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
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_030_data_portals/data_portal_core_classes.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_030_data_portals/storable_decorator.py
RENAMED
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/notebook_checker.py
RENAMED
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_040_logging_code_portals/output_capturer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_050_safe_code_portals/safe_decorator.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_060_autonomous_code_portals/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/OK_const.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/list_flattener.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_070_protected_code_portals/system_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_080_pure_code_portals/pure_core_classes.py
RENAMED
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_080_pure_code_portals/pure_decorator.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_090_swarming_portals/output_suppressor.py
RENAMED
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_090_swarming_portals/swarming_portals.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/src/pythagoras/_100_top_level_API/default_local_portal.py
RENAMED
|
File without changes
|
|
File without changes
|
{pythagoras-0.21.4 → pythagoras-0.22.1}/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.21.4 → pythagoras-0.22.1}/src/pythagoras/_900_project_stats_collector/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|