astreum 0.2.45__py3-none-any.whl → 0.2.46__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 astreum might be problematic. Click here for more details.

@@ -1,5 +1,5 @@
1
- from typing import List, Tuple
2
- from src.astreum._lispeum import Expr
1
+ from typing import List, Tuple
2
+ from . import Expr
3
3
 
4
4
  class ParseError(Exception):
5
5
  pass
@@ -27,30 +27,30 @@ def _parse_one(tokens: List[str], pos: int = 0) -> Tuple[Expr, int]:
27
27
  if tok == ')':
28
28
  raise ParseError("unexpected ')'")
29
29
 
30
- # try integer → Bytes (variable-length two's complement)
31
- try:
32
- n = int(tok)
33
- # encode as minimal-width signed two's complement, big-endian
34
- def int_to_min_tc(v: int) -> bytes:
35
- """Return the minimal-width signed two's complement big-endian
36
- byte encoding of integer v. Width expands just enough so that
37
- decoding with signed=True yields the same value and sign.
38
- Example: 0 -> b"\x00", 127 -> b"\x7f", 128 -> b"\x00\x80".
39
- """
40
- if v == 0:
41
- return b"\x00"
42
- w = 1
43
- while True:
44
- try:
45
- return v.to_bytes(w, "big", signed=True)
46
- except OverflowError:
47
- w += 1
48
-
49
- return Expr.Bytes(int_to_min_tc(n)), pos + 1
50
- except ValueError:
51
- return Expr.Symbol(tok), pos + 1
30
+ # try integer → Bytes (variable-length two's complement)
31
+ try:
32
+ n = int(tok)
33
+ # encode as minimal-width signed two's complement, big-endian
34
+ def int_to_min_tc(v: int) -> bytes:
35
+ """Return the minimal-width signed two's complement big-endian
36
+ byte encoding of integer v. Width expands just enough so that
37
+ decoding with signed=True yields the same value and sign.
38
+ Example: 0 -> b"\x00", 127 -> b"\x7f", 128 -> b"\x00\x80".
39
+ """
40
+ if v == 0:
41
+ return b"\x00"
42
+ w = 1
43
+ while True:
44
+ try:
45
+ return v.to_bytes(w, "big", signed=True)
46
+ except OverflowError:
47
+ w += 1
48
+
49
+ return Expr.Bytes(int_to_min_tc(n)), pos + 1
50
+ except ValueError:
51
+ return Expr.Symbol(tok), pos + 1
52
52
 
53
53
  def parse(tokens: List[str]) -> Tuple[Expr, List[str]]:
54
54
  """Parse tokens into an Expr and return (expr, remaining_tokens)."""
55
55
  expr, next_pos = _parse_one(tokens, 0)
56
- return expr, tokens[next_pos:]
56
+ return expr, tokens[next_pos:]
astreum/_node.py CHANGED
@@ -3,8 +3,8 @@ from typing import Dict, Optional
3
3
  import uuid
4
4
  import threading
5
5
 
6
- from src.astreum._storage.atom import Atom
7
- from src.astreum._lispeum import Env, Expr, low_eval, parse, tokenize, ParseError
6
+ from ._storage.atom import Atom
7
+ from ._lispeum import Env, Expr, low_eval, parse, tokenize, ParseError
8
8
 
9
9
  def bytes_touched(*vals: bytes) -> int:
10
10
  """For metering: how many bytes were manipulated (max of operands)."""
@@ -21,16 +21,16 @@ class Node:
21
21
  self.machine_environments_lock = threading.RLock()
22
22
  self.low_eval = low_eval
23
23
  # Communication and Validation Setup (import lazily to avoid heavy deps during parsing tests)
24
- try:
25
- from astreum._communication import communication_setup # type: ignore
26
- communication_setup(node=self, config=config)
27
- except Exception:
28
- pass
29
- try:
30
- from astreum._consensus import consensus_setup # type: ignore
31
- consensus_setup(node=self, config=config)
32
- except Exception:
33
- pass
24
+ try:
25
+ from astreum._communication import communication_setup # type: ignore
26
+ communication_setup(node=self, config=config)
27
+ except Exception:
28
+ pass
29
+ try:
30
+ from astreum._consensus import consensus_setup # type: ignore
31
+ consensus_setup(node=self, config=config)
32
+ except Exception:
33
+ pass
34
34
 
35
35
 
36
36
 
@@ -75,7 +75,7 @@ class Node:
75
75
  def _network_set(self, atom: Atom) -> None:
76
76
  """Advertise an atom to the closest known peer so they can fetch it from us."""
77
77
  try:
78
- from src.astreum._communication.message import Message, MessageTopic
78
+ from ._communication.message import Message, MessageTopic
79
79
  except Exception:
80
80
  return
81
81
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astreum
3
- Version: 0.2.45
3
+ Version: 0.2.46
4
4
  Summary: Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
5
5
  Author-email: "Roy R. O. Okello" <roy@stelar.xyz>
6
6
  Project-URL: Homepage, https://github.com/astreum/lib
@@ -1,5 +1,5 @@
1
1
  astreum/__init__.py,sha256=9tzA27B_eG5wRF1SAWJIV7xTmCcR1QFc123b_cvFOa4,345
2
- astreum/_node.py,sha256=KC_TSaOq7zmOE8baS4gNuoQAI8NxEMsz5rlH29nLN20,3819
2
+ astreum/_node.py,sha256=dTwXjnCJZHjUw8dPmH7neaL1-M4rso77Aogo0935vsY,3796
3
3
  astreum/format.py,sha256=X4tG5GGPweNCE54bHYkLFiuLTbmpy5upO_s1Cef-MGA,2711
4
4
  astreum/node.py,sha256=MmlK3jaANTMB3ZAxR8IaSc82OS9meJmVawYIVURADbg,39689
5
5
  astreum/_communication/__init__.py,sha256=XJui0yOcfAur4HKt-8sSRlwB-MSU1rchkuOAY-nKDOE,207
@@ -29,7 +29,7 @@ astreum/_lispeum/expression.py,sha256=io8tbCer_1TJee77yRbcNI5q-DPFGa8xZiC80tGvRR
29
29
  astreum/_lispeum/high_evaluation.py,sha256=7MwIeVZMPumYvKXn6Lkn-GrZhRNB6MjnUUWdiYT7Ei0,7952
30
30
  astreum/_lispeum/low_evaluation.py,sha256=HgyCSAmL5K5SKq3Xw_BtbTZZUJbMg4-bVZW-A12glQ0,4373
31
31
  astreum/_lispeum/meter.py,sha256=5q2PFW7_jmgKVM1-vwE4RRjMfPEthUA4iu1CwR-Axws,505
32
- astreum/_lispeum/parser.py,sha256=WOW3sSZWkIzPEy3fYTyl0lrtkMxHL9zRrNSYztPDemQ,2271
32
+ astreum/_lispeum/parser.py,sha256=rpxznlILbGruCS8wS_SQajYs7MlNPoMPbQ48XEjLeRo,2277
33
33
  astreum/_lispeum/tokenizer.py,sha256=P68uIj4aPKzjuCJ85jfzRi67QztpuXIOC1vvLQueBI4,552
34
34
  astreum/_storage/__init__.py,sha256=EmKZNAZmo3UVE3ekOOuckwFnBVjpa0Sy8Oxg72Lgdxc,53
35
35
  astreum/_storage/atom.py,sha256=YFjvfMhniInch13iaKGpw4CCxxgyWonniryb-Rfse4A,4177
@@ -48,8 +48,8 @@ astreum/storage/object.py,sha256=knFlvw_tpcC4twSu1DGNpHX31wlANN8E5dgEqIfU--Q,204
48
48
  astreum/storage/setup.py,sha256=1-9ztEFI_BvRDvAA0lAn4mFya8iq65THTArlj--M3Hg,626
49
49
  astreum/utils/bytes.py,sha256=9QTWC2JCdwWLB5R2mPtmjPro0IUzE58DL3uEul4AheE,846
50
50
  astreum/utils/integer.py,sha256=iQt-klWOYVghu_NOT341MmHbOle4FDT3by4PNKNXscg,736
51
- astreum-0.2.45.dist-info/licenses/LICENSE,sha256=gYBvRDP-cPLmTyJhvZ346QkrYW_eleke4Z2Yyyu43eQ,1089
52
- astreum-0.2.45.dist-info/METADATA,sha256=poHQQVqPXQLxXZ-j_4EAtw5R6QA2s_Ps9URrpFvmWDg,6181
53
- astreum-0.2.45.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
- astreum-0.2.45.dist-info/top_level.txt,sha256=1EG1GmkOk3NPmUA98FZNdKouhRyget-KiFiMk0i2Uz0,8
55
- astreum-0.2.45.dist-info/RECORD,,
51
+ astreum-0.2.46.dist-info/licenses/LICENSE,sha256=gYBvRDP-cPLmTyJhvZ346QkrYW_eleke4Z2Yyyu43eQ,1089
52
+ astreum-0.2.46.dist-info/METADATA,sha256=o454zFl45Clnos8EwXm0PCSivnHw8fkoOC3C2mCFXYo,6181
53
+ astreum-0.2.46.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
+ astreum-0.2.46.dist-info/top_level.txt,sha256=1EG1GmkOk3NPmUA98FZNdKouhRyget-KiFiMk0i2Uz0,8
55
+ astreum-0.2.46.dist-info/RECORD,,