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.
@@ -1,4 +1,6 @@
1
- import uuid, platform, getpass
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
- """Returns a globally-unique signature for the current computing node.
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
- mac = uuid.getnode()
12
- system = platform.system()
13
- release = platform.release()
14
- version = platform.version()
15
- machine = platform.machine()
16
- processor = platform.processor()
17
- user = getpass.getuser()
18
- id_string = f"{mac}{system}{release}{version}"
19
- id_string += f"{machine}{processor}{user}"
20
- return get_hash_signature(id_string)
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
- max_signature_length: int = 22
6
+ _MAX_SIGNATURE_LENGTH: Final[int] = 22
6
7
 
7
8
  def get_random_signature() -> str:
8
- # random_int = uuid.uuid4().int + uuid.uuid1().int
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[:max_signature_length]
22
+ return random_str[:_MAX_SIGNATURE_LENGTH]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pythagoras
3
- Version: 0.24.4
3
+ Version: 0.24.6
4
4
  Summary: Planet-scale distributed computing in Python.
5
5
  Keywords: cloud,ML,AI,serverless,distributed,parallel,machine-learning,deep-learning,pythagoras
6
6
  Author: Volodymyr (Vlad) Pavlov
@@ -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=diWX03jZaInc55jAg391ZRBh-St5exJRLDZiS7dqYvg,2895
31
- pythagoras/_060_autonomous_code_portals/autonomous_portal_core_classes.py,sha256=21JNwBgEoIHXwCrBPb_eN5vMaHTZ98LdFkHuaMHtkI0,6665
32
- pythagoras/_060_autonomous_code_portals/names_usage_analyzer.py,sha256=mqrzAQw3tGxPYXsMA8E0fhhIpJopvRFrzkc1MVSsPXQ,7474
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=mlS1Eq2dwgHbNI55CPXKXzbRca49pDNRHTgCOmuo1LU,331
37
- pythagoras/_070_protected_code_portals/package_manager.py,sha256=QRHXGIatzx6NKPPC06CMijUmASl_mrPwikVBWG7Z03Y,1965
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=ZTSD6m9HGTJDa9WuInb-0wqzP8NzaoIqWapg9XUXD-E,13583
40
- pythagoras/_070_protected_code_portals/system_utils.py,sha256=h4oiEQFAyFKzqvd0ywwAI0WDYKSuIh_vif86XQIXYwE,2360
41
- pythagoras/_070_protected_code_portals/validation_succesful_const.py,sha256=4NWGwN5Gu6kbbHTMkmJs8Ym0rFee_cIE2VlAPonmlJI,298
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=ZjVtKjjjMgMgHUhM-1Q9qLYWCDKhllqq9z4YgKL0qCg,1236
54
- pythagoras/_800_signatures_and_converters/current_date_gmt_str.py,sha256=K-rGHyrREsyBdYMq7vWrv3FdAacepWQpvOfT_mrZqNM,268
55
- pythagoras/_800_signatures_and_converters/hash_signatures.py,sha256=AsUID_Z7yeF06Jmk8kKAFXIuxoF0hN0OwOS1T5nu7_k,989
56
- pythagoras/_800_signatures_and_converters/node_signature.py,sha256=pSZ4yB4aXNH6yhizQ6Z3m4uRcuDNkr_-lZ8024NbZ7w,592
57
- pythagoras/_800_signatures_and_converters/random_signatures.py,sha256=wXTyjATM8IwMXq2vHhoAq6T-yI7DcN72Svyt05EjFBo,323
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.4.dist-info/WHEEL,sha256=X16MKk8bp2DRsAuyteHJ-9qOjzmnY0x1aj0P1ftqqWA,78
63
- pythagoras-0.24.4.dist-info/METADATA,sha256=o7l1zf9TCe9tz4nhG5KtKVU_z4qI9QQV-h0IHSitI_g,7467
64
- pythagoras-0.24.4.dist-info/RECORD,,
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,,