Skip to content

Commit

Permalink
avoid use of mutable parameter default for operators_for_dict() and…
Browse files Browse the repository at this point in the history
… `operators_for_module()` (#137)
  • Loading branch information
altendky authored Nov 13, 2023
1 parent c8a1d82 commit 192fb78
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions clvm/op_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
def operators_for_dict(keyword_to_atom, op_dict, op_name_lookup={}):
def operators_for_dict(keyword_to_atom, op_dict, op_name_lookup=None):
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 @@ -8,5 +11,7 @@ def operators_for_dict(keyword_to_atom, op_dict, op_name_lookup={}):
return d


def operators_for_module(keyword_to_atom, mod, op_name_lookup={}):
def operators_for_module(keyword_to_atom, mod, op_name_lookup=None):
if op_name_lookup is None:
op_name_lookup = {}
return operators_for_dict(keyword_to_atom, mod.__dict__, op_name_lookup)

0 comments on commit 192fb78

Please sign in to comment.