Skip to content

Commit

Permalink
[Tools] Eliminate default value modification
Browse files Browse the repository at this point in the history
LGTM catches a potential error with the mutation of default values:
implement their suggested workaround of using a None placeholder to
ensure the default itself is never modified.
  • Loading branch information
chennes committed Oct 12, 2021
1 parent fbdb4e2 commit 9cbfe83
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Tools/generateBase/generateTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ def repl(match, self=self):
except TypeError:
self.ouf.write(self.regex.sub(repl, line))
i=i+1
def __init__(self, regex=_never, dict={},
def __init__(self, regex=_never, dict=None,
restat=_never, restend=_never, recont=_never,
preproc=identity, handle=nohandle, ouf=sys.stdout):
"Initialize self's attributes"
self.regex = regex
self.globals = dict
if dict is not None:
self.globals = dict
else:
self.globals = {}
self.globals['sys'] = sys
self.locals = { '_cb':self.copyblock }
self.restat = restat
Expand Down

0 comments on commit 9cbfe83

Please sign in to comment.