Fixed B006 (mutable-argument-default): Do not use mutable data structures for argument defaults

This commit is contained in:
Teal Dulcet 2023-12-22 07:25:13 -08:00 committed by Joshua Tauberer
parent 922c59ddaf
commit d1d3d08d70
1 changed files with 3 additions and 1 deletions

View File

@ -108,11 +108,13 @@ def sort_email_addresses(email_addresses, env):
ret.extend(sorted(email_addresses)) # whatever is left ret.extend(sorted(email_addresses)) # whatever is left
return ret return ret
def shell(method, cmd_args, env={}, capture_stderr=False, return_bytes=False, trap=False, input=None): def shell(method, cmd_args, env=None, capture_stderr=False, return_bytes=False, trap=False, input=None):
# A safe way to execute processes. # A safe way to execute processes.
# Some processes like apt-get require being given a sane PATH. # Some processes like apt-get require being given a sane PATH.
import subprocess import subprocess
if env is None:
env = {}
env.update({ "PATH": "/sbin:/bin:/usr/sbin:/usr/bin" }) env.update({ "PATH": "/sbin:/bin:/usr/sbin:/usr/bin" })
kwargs = { kwargs = {
'env': env, 'env': env,