python: Modernize legacy Python 2 syntax with pyupgrade.

Generated by `pyupgrade --py3-plus --keep-percent-format` on all our
Python code except `zthumbor` and `zulip-ec2-configure-interfaces`,
followed by manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-04-09 12:51:58 -07:00
committed by Tim Abbott
parent fff2d3958a
commit c734bbd95d
567 changed files with 1877 additions and 2564 deletions

View File

@@ -171,7 +171,7 @@ def get_venv_packages(venv_path):
package index file.
"""
with open(get_index_filename(venv_path)) as reader:
return set(p.strip() for p in reader.read().split('\n') if p.strip())
return {p.strip() for p in reader.read().split('\n') if p.strip()}
def try_to_copy_venv(venv_path, new_packages):
# type: (str, Set[str]) -> bool
@@ -281,7 +281,7 @@ def do_patch_activate_script(venv_path):
# venv_path should be what we want to have in VIRTUAL_ENV after patching
script_path = os.path.join(venv_path, "bin", "activate")
with open(script_path, 'r') as f:
with open(script_path) as f:
lines = f.readlines()
for i, line in enumerate(lines):
if line.startswith('VIRTUAL_ENV='):