Skip to content

Commit

Permalink
Merge branch 'main' into mypie
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Nov 14, 2023
2 parents 89b1cfb + c4d3eac commit 5af95bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions clvm/op_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import types
from typing import Callable, Dict
from typing import Callable, Dict, Optional


def operators_for_dict(keyword_to_atom: Dict, op_dict: Dict[str, Callable], op_name_lookup: Dict = {}) -> Dict:
def operators_for_dict(keyword_to_atom: Dict, op_dict: Dict[str, Callable], op_name_lookup: Optional[Dict] = None) -> Dict:
if op_name_lookup is None:
op_name_lookup = {}

d = {}
for op in keyword_to_atom.keys():
op_name = "op_%s" % op_name_lookup.get(op, op)
Expand All @@ -12,5 +15,7 @@ def operators_for_dict(keyword_to_atom: Dict, op_dict: Dict[str, Callable], op_n
return d


def operators_for_module(keyword_to_atom: Dict, mod: types.ModuleType, op_name_lookup: Dict = {}) -> Dict:
def operators_for_module(keyword_to_atom: Dict, mod: types.ModuleType, op_name_lookup: Optional[Dict] = None) -> Dict:
if op_name_lookup is None:
op_name_lookup = {}
return operators_for_dict(keyword_to_atom, mod.__dict__, op_name_lookup)
2 changes: 1 addition & 1 deletion clvm/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def sexp_to_byte_iterator(sexp: SExp) -> typing.Iterator[bytes]:
todo_stack = [sexp]
while todo_stack:
sexp = todo_stack.pop()
pair = sexp.as_pair()
pair = sexp.pair
if pair:
yield bytes([CONS_BOX_MARKER])
todo_stack.append(pair[1])
Expand Down

0 comments on commit 5af95bc

Please sign in to comment.