Skip to content

Commit

Permalink
Use setdefault insted if key not in dict set key
Browse files Browse the repository at this point in the history
  • Loading branch information
cdonovick committed May 14, 2019
1 parent ecc71ff commit a85ef34
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions magma/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,14 @@ def __new__(metacls, name, bases, dct):
#print('CircuitKind new:', name)

# override circuit class name
if 'name' not in dct:
dct['name'] = name
name = dct['name']
name = dct.setdefault('name', name)

dct.setdefault('renamed_ports', {})

if 'renamed_ports' not in dct:
dct['renamed_ports'] = {}
dct.setdefault('primitive', False)

if 'primitive' not in dct:
dct['primitive'] = False
dct.setdefault('coreir_lib', 'global')

if 'coreir_lib' not in dct:
dct['coreir_lib'] = "global"
if get_debug_mode():
if not dct.get("debug_info", False):
callee_frame = inspect.getframeinfo(inspect.currentframe().f_back.f_back)
Expand Down

0 comments on commit a85ef34

Please sign in to comment.