More removal of mutable default arguments.

I've left a few that clearly aren't being passed and aren't being mutated, but
I think I've gotten the rest of them.
This commit is contained in:
Nathan Florea
2016-06-02 16:43:28 -07:00
committed by Tim Abbott
parent 5fe9076631
commit 04c71fadc6
3 changed files with 10 additions and 6 deletions

View File

@@ -110,14 +110,14 @@ REPO_STOPWORDS_PATH = os.path.join(
LOUD = dict(_out=sys.stdout, _err=sys.stderr) LOUD = dict(_out=sys.stdout, _err=sys.stderr)
def setup_virtualenv(target_venv_path, requirements_file, virtualenv_args=[]): def setup_virtualenv(target_venv_path, requirements_file, virtualenv_args=None):
# Check if a cached version already exists # Check if a cached version already exists
output = subprocess.check_output(['sha1sum', requirements_file]) output = subprocess.check_output(['sha1sum', requirements_file])
sha1sum = output.split()[0] sha1sum = output.split()[0]
cached_venv_path = os.path.join(VENV_CACHE_PATH, sha1sum, os.path.basename(target_venv_path)) cached_venv_path = os.path.join(VENV_CACHE_PATH, sha1sum, os.path.basename(target_venv_path))
success_stamp = os.path.join(cached_venv_path, "success-stamp") success_stamp = os.path.join(cached_venv_path, "success-stamp")
if not os.path.exists(success_stamp): if not os.path.exists(success_stamp):
do_setup_virtualenv(cached_venv_path, requirements_file, virtualenv_args) do_setup_virtualenv(cached_venv_path, requirements_file, virtualenv_args or [])
run(["touch", success_stamp]) run(["touch", success_stamp])
print("Using cached Python venv from %s" % (cached_venv_path,)) print("Using cached Python venv from %s" % (cached_venv_path,))

View File

@@ -220,6 +220,6 @@ class CodeHiliteExtension(markdown.Extension):
md.registerExtension(self) md.registerExtension(self)
def makeExtension(configs={}): def makeExtension(configs=None):
return CodeHiliteExtension(configs=configs) return CodeHiliteExtension(configs=configs or [])

View File

@@ -22,9 +22,13 @@ from zproject.backends import ZulipDummyBackend, EmailAuthBackend, \
import ujson import ujson
class AuthBackendTest(TestCase): class AuthBackendTest(TestCase):
def verify_backend(self, backend, good_args={}, def verify_backend(self, backend, good_args=None,
good_kwargs={}, bad_kwargs=None, good_kwargs=None, bad_kwargs=None,
email_to_username=None): email_to_username=None):
if good_args is None:
good_args = []
if good_kwargs is None:
good_kwargs = {}
email = "hamlet@zulip.com" email = "hamlet@zulip.com"
user_profile = get_user_profile_by_email(email) user_profile = get_user_profile_by_email(email)