[Tools] Eliminate default value modification
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.
This commit is contained in:
@@ -100,12 +100,15 @@ class copier:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user