pythagoras 0.24.4__py3-none-any.whl → 0.24.6__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.
- pythagoras/_060_autonomous_code_portals/autonomous_decorators.py +31 -4
- pythagoras/_060_autonomous_code_portals/autonomous_portal_core_classes.py +94 -14
- pythagoras/_060_autonomous_code_portals/names_usage_analyzer.py +133 -4
- pythagoras/_070_protected_code_portals/list_flattener.py +45 -7
- pythagoras/_070_protected_code_portals/package_manager.py +99 -24
- pythagoras/_070_protected_code_portals/protected_portal_core_classes.py +70 -0
- pythagoras/_070_protected_code_portals/system_utils.py +85 -12
- pythagoras/_070_protected_code_portals/validation_succesful_const.py +12 -7
- pythagoras/_800_signatures_and_converters/base_16_32_convertors.py +55 -20
- pythagoras/_800_signatures_and_converters/current_date_gmt_str.py +20 -5
- pythagoras/_800_signatures_and_converters/hash_signatures.py +46 -10
- pythagoras/_800_signatures_and_converters/node_signature.py +27 -12
- pythagoras/_800_signatures_and_converters/random_signatures.py +14 -3
- {pythagoras-0.24.4.dist-info → pythagoras-0.24.6.dist-info}/METADATA +1 -1
- {pythagoras-0.24.4.dist-info → pythagoras-0.24.6.dist-info}/RECORD +16 -16
- {pythagoras-0.24.4.dist-info → pythagoras-0.24.6.dist-info}/WHEEL +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import getpass
|
|
2
|
+
import platform
|
|
3
|
+
import uuid
|
|
2
4
|
from functools import cache
|
|
3
5
|
|
|
4
6
|
from .hash_signatures import get_hash_signature
|
|
@@ -6,15 +8,28 @@ from .hash_signatures import get_hash_signature
|
|
|
6
8
|
|
|
7
9
|
@cache
|
|
8
10
|
def get_node_signature() -> str:
|
|
9
|
-
"""
|
|
11
|
+
"""Return a stable signature for the current computing node and user.
|
|
12
|
+
|
|
13
|
+
The signature is derived from a concatenation of multiple system- and
|
|
14
|
+
user-specific attributes (MAC address, OS info, CPU, username) and then
|
|
15
|
+
hashed using Pythagoras' short base32 digest. The result is intended to
|
|
16
|
+
uniquely identify the node within logs and distributed systems.
|
|
17
|
+
|
|
18
|
+
Caching:
|
|
19
|
+
The result is cached for the lifetime of the process using
|
|
20
|
+
functools.cache, as the underlying attributes are not expected to
|
|
21
|
+
change while the process is running.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
str: A short base32 signature string representing this node.
|
|
10
25
|
"""
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return get_hash_signature(
|
|
26
|
+
id_parts = [
|
|
27
|
+
str(uuid.getnode()),
|
|
28
|
+
platform.system(),
|
|
29
|
+
platform.release(),
|
|
30
|
+
platform.version(),
|
|
31
|
+
platform.machine(),
|
|
32
|
+
platform.processor(),
|
|
33
|
+
getpass.getuser(),
|
|
34
|
+
]
|
|
35
|
+
return get_hash_signature("".join(id_parts))
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import uuid
|
|
2
|
+
from typing import Final
|
|
2
3
|
|
|
3
4
|
from .base_16_32_convertors import convert_int_to_base32
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
_MAX_SIGNATURE_LENGTH: Final[int] = 22
|
|
6
7
|
|
|
7
8
|
def get_random_signature() -> str:
|
|
8
|
-
|
|
9
|
+
"""Generate a short, random base32 signature string.
|
|
10
|
+
|
|
11
|
+
The randomness is sourced from uuid.uuid4(), which uses a cryptographically
|
|
12
|
+
strong RNG provided by the OS. The resulting large integer is encoded with
|
|
13
|
+
Pythagoras' base32 alphabet and truncated to max_signature_length
|
|
14
|
+
characters.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
str: A random, URL-safe base32 string of length up to
|
|
18
|
+
max_signature_length.
|
|
19
|
+
"""
|
|
9
20
|
random_int = uuid.uuid4().int
|
|
10
21
|
random_str = convert_int_to_base32(random_int)
|
|
11
|
-
return random_str[:
|
|
22
|
+
return random_str[:_MAX_SIGNATURE_LENGTH]
|
|
@@ -27,18 +27,18 @@ pythagoras/_050_safe_code_portals/__init__.py,sha256=YR-V6W2WZ17SjqmTyY2xdY16xTV
|
|
|
27
27
|
pythagoras/_050_safe_code_portals/safe_decorator.py,sha256=AYvX7-km2reRMZ55ndO_2IS2SfHbnpyFv79AVwGg7Po,1681
|
|
28
28
|
pythagoras/_050_safe_code_portals/safe_portal_core_classes.py,sha256=naY4R91N5bcCq8C_-YeBqhrr6UG8zkEQ5t8C3O8ytOw,5673
|
|
29
29
|
pythagoras/_060_autonomous_code_portals/__init__.py,sha256=hnv_dxxRx8c7IDf1QgVYHfYoeVAz8oD9K0oWI_o9N20,1704
|
|
30
|
-
pythagoras/_060_autonomous_code_portals/autonomous_decorators.py,sha256=
|
|
31
|
-
pythagoras/_060_autonomous_code_portals/autonomous_portal_core_classes.py,sha256=
|
|
32
|
-
pythagoras/_060_autonomous_code_portals/names_usage_analyzer.py,sha256=
|
|
30
|
+
pythagoras/_060_autonomous_code_portals/autonomous_decorators.py,sha256=Y5zKrCK7ROY3_0RAIz6yf47Udsr0m3Co1f1isdybBcQ,4042
|
|
31
|
+
pythagoras/_060_autonomous_code_portals/autonomous_portal_core_classes.py,sha256=Nj4TPML94eS0WThoOfaqZhlPJu6RttvDg69VT86WPlg,9881
|
|
32
|
+
pythagoras/_060_autonomous_code_portals/names_usage_analyzer.py,sha256=arfAuFBY4Dx9Zmf0b3x-axrd35QY2Kg_2jHJC8ek3p8,11977
|
|
33
33
|
pythagoras/_070_protected_code_portals/__init__.py,sha256=TvGcJaz20Qqsmv8m2pA4duBtFn_CdCKfkSbOSFoJS8k,989
|
|
34
34
|
pythagoras/_070_protected_code_portals/basic_pre_validators.py,sha256=6wrWKumBr2eyEhqpzZv8UlcX0WwUnAUzQ9D4cFyx1OE,2067
|
|
35
35
|
pythagoras/_070_protected_code_portals/fn_arg_names_checker.py,sha256=6FjOUJmGgDCjkFcXf5Ook-E9eiEFguarY2qqzOyJj7A,1230
|
|
36
|
-
pythagoras/_070_protected_code_portals/list_flattener.py,sha256=
|
|
37
|
-
pythagoras/_070_protected_code_portals/package_manager.py,sha256=
|
|
36
|
+
pythagoras/_070_protected_code_portals/list_flattener.py,sha256=9V1Xj_y5nOCXS2V9mcBFX6UsyDdOR108SBqxbC-Ziyk,1604
|
|
37
|
+
pythagoras/_070_protected_code_portals/package_manager.py,sha256=KbvEGfeKQsWIz0UogVUHfW6enbBmnqo1OjJz1xMTL4o,5437
|
|
38
38
|
pythagoras/_070_protected_code_portals/protected_decorators.py,sha256=5Y62rswuD7CD1duXd54_rhMb6-lLh7YvgdDgojP577g,1598
|
|
39
|
-
pythagoras/_070_protected_code_portals/protected_portal_core_classes.py,sha256=
|
|
40
|
-
pythagoras/_070_protected_code_portals/system_utils.py,sha256=
|
|
41
|
-
pythagoras/_070_protected_code_portals/validation_succesful_const.py,sha256=
|
|
39
|
+
pythagoras/_070_protected_code_portals/protected_portal_core_classes.py,sha256=pYuAxDEZKmxAN6CnqjHzFKq_5XoLZ6sEBpnJcwBPJQo,17034
|
|
40
|
+
pythagoras/_070_protected_code_portals/system_utils.py,sha256=Uv111FaO33xAA9wZ2iwtW8Gf-FXJBP2ld1sMBmvsHdo,5124
|
|
41
|
+
pythagoras/_070_protected_code_portals/validation_succesful_const.py,sha256=DrM-Mf6dDLFJ7AmfzntD39Z23YMFfF6am78XU54AlnM,577
|
|
42
42
|
pythagoras/_080_pure_code_portals/__init__.py,sha256=OI7836lLHT51SYdFfmWp4GdGRgcAkpLiAj-Zj_g2Gxo,1052
|
|
43
43
|
pythagoras/_080_pure_code_portals/pure_core_classes.py,sha256=6AjtE9QdiG84e9WuJtsrvkuHTRC4MovC31xItGn2PD8,20455
|
|
44
44
|
pythagoras/_080_pure_code_portals/pure_decorator.py,sha256=WHZQzmyxgCpALHrqfeiOMrM6TDkZcv0Y2b756ez4Q2k,2279
|
|
@@ -50,15 +50,15 @@ pythagoras/_100_top_level_API/__init__.py,sha256=s5LtwskY2nwkRPFKzP0PrCzQ1c9oScZ
|
|
|
50
50
|
pythagoras/_100_top_level_API/default_local_portal.py,sha256=SnykTpTXg1KuT1qwDnrAZ63lYshMy-0nNiUgoOVMxCs,339
|
|
51
51
|
pythagoras/_100_top_level_API/top_level_API.py,sha256=S2NXW4bfL98o6Txn6NM0EeBb1nzwFtPSl-yWNevAQIE,906
|
|
52
52
|
pythagoras/_800_signatures_and_converters/__init__.py,sha256=WAzpPe8fsh_w_7HhVxJZLBid7gxnW3pmPZW86fYnJjk,166
|
|
53
|
-
pythagoras/_800_signatures_and_converters/base_16_32_convertors.py,sha256
|
|
54
|
-
pythagoras/_800_signatures_and_converters/current_date_gmt_str.py,sha256=
|
|
55
|
-
pythagoras/_800_signatures_and_converters/hash_signatures.py,sha256
|
|
56
|
-
pythagoras/_800_signatures_and_converters/node_signature.py,sha256=
|
|
57
|
-
pythagoras/_800_signatures_and_converters/random_signatures.py,sha256=
|
|
53
|
+
pythagoras/_800_signatures_and_converters/base_16_32_convertors.py,sha256=-E67xY0zUUMyn-xeRpwz7-sZfFXaaiVFLKQf2OHgNw0,2146
|
|
54
|
+
pythagoras/_800_signatures_and_converters/current_date_gmt_str.py,sha256=jMBQaUj_33Yto415IxuiRrNoiuxbORZS-En7bPP1JZU,841
|
|
55
|
+
pythagoras/_800_signatures_and_converters/hash_signatures.py,sha256=-RDExpYwXCWXtjgIfS3xiCYAJxGuiFSZzJ4p2pAvdmc,2278
|
|
56
|
+
pythagoras/_800_signatures_and_converters/node_signature.py,sha256=W5Rg6q0jBRRJzHnnemt8mVapoy2jIswOEg9xIm4poXo,1090
|
|
57
|
+
pythagoras/_800_signatures_and_converters/random_signatures.py,sha256=IpZ7uwReCd-K9Yq1IZoubxn7kidnRfpB9-GBKXdqYdA,719
|
|
58
58
|
pythagoras/_900_project_stats_collector/__init__.py,sha256=Eagt-BhPPtBGgpMywx2lkLDK1603Y9t_QBdtHKUHHFY,71
|
|
59
59
|
pythagoras/_900_project_stats_collector/project_analyzer.py,sha256=uhycFKjUIXEpYcZYnak3yn4JFhchl-oZ7wt6spFxhoY,3574
|
|
60
60
|
pythagoras/__init__.py,sha256=TMPtJdSi_WShCpJnsVVdO48Wcvs78GMbUi5gHc1eMLw,1233
|
|
61
61
|
pythagoras/core/__init__.py,sha256=cXtQ-Vbm8TqzazvkFws5cV3AEEYbEKzNXYeuHeLGFK0,328
|
|
62
|
-
pythagoras-0.24.
|
|
63
|
-
pythagoras-0.24.
|
|
64
|
-
pythagoras-0.24.
|
|
62
|
+
pythagoras-0.24.6.dist-info/WHEEL,sha256=X16MKk8bp2DRsAuyteHJ-9qOjzmnY0x1aj0P1ftqqWA,78
|
|
63
|
+
pythagoras-0.24.6.dist-info/METADATA,sha256=uBQsa9SitAVOruwJdT0dxnjU6rO4fiB7BEOIh4g9D3U,7467
|
|
64
|
+
pythagoras-0.24.6.dist-info/RECORD,,
|
|
File without changes
|