From b937e1fedee4d5fbe175472974d4936b5ed871a6 Mon Sep 17 00:00:00 2001 From: rht Date: Wed, 27 Sep 2017 10:16:35 +0200 Subject: [PATCH] Remove the rest of `import six` outside zerver.lib. We no longer need the six module, now that we're Python 3 only. --- scripts/setup/generate_secrets.py | 4 ++-- tools/minify-js | 3 +-- tools/replace-tarball-shebang | 4 ++-- tools/run-mypy | 1 - zproject/settings.py | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/setup/generate_secrets.py b/scripts/setup/generate_secrets.py index 95b92eff24..e22d5609be 100755 --- a/scripts/setup/generate_secrets.py +++ b/scripts/setup/generate_secrets.py @@ -14,9 +14,9 @@ import scripts.lib.setup_path_on_import os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings' from django.utils.crypto import get_random_string -import six import argparse import uuid +import configparser from zerver.lib.str_utils import force_str from zerver.lib.utils import generate_random_token @@ -56,7 +56,7 @@ def get_old_conf(output_filename): if not os.path.exists(output_filename): return {} - secrets_file = six.moves.configparser.RawConfigParser() + secrets_file = configparser.RawConfigParser() secrets_file.read(output_filename) return dict(secrets_file.items("secrets")) diff --git a/tools/minify-js b/tools/minify-js index e4fb070104..7d2f27e225 100755 --- a/tools/minify-js +++ b/tools/minify-js @@ -9,7 +9,6 @@ import os import subprocess import argparse import sys -import six parser = argparse.ArgumentParser() parser.add_argument('--prev-deploy', metavar='DIR', @@ -102,7 +101,7 @@ MIN_DIR = os.path.join(STATIC_PATH, 'min/') MAP_DIR = os.path.join(STATIC_PATH, 'source-map/') subprocess.check_call(['mkdir', '-p', MIN_DIR, MAP_DIR]) -for js_group_filespec_pair in six.iteritems(JS_SPECS): +for js_group_filespec_pair in JS_SPECS.items(): # JS_SPECS is not typed, so forcefully type keys and values being read from JS_SPECS js_group = js_group_filespec_pair[0] # type: str filespec = js_group_filespec_pair[1] # type: Dict[str, Any] diff --git a/tools/replace-tarball-shebang b/tools/replace-tarball-shebang index c20e645896..ea6b77151e 100755 --- a/tools/replace-tarball-shebang +++ b/tools/replace-tarball-shebang @@ -2,7 +2,7 @@ from __future__ import print_function -import six +import io import sys import tarfile @@ -29,6 +29,6 @@ with tarfile.open(fileobj=stdin, mode='r|*') as in_tar, \ assert info.size == len(data) data = new_shebang_bytes + data[len(old_shebang_bytes):] info.size = len(data) - out_tar.addfile(info, six.BytesIO(data)) + out_tar.addfile(info, io.BytesIO(data)) else: out_tar.addfile(info) diff --git a/tools/run-mypy b/tools/run-mypy index c9fc2238cf..54f4fb1302 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -7,7 +7,6 @@ import os import sys import argparse import subprocess -import six import lister from typing import cast, Dict, List diff --git a/zproject/settings.py b/zproject/settings.py index 3328fce5e2..91906df068 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -20,7 +20,6 @@ import six.moves.configparser from zerver.lib.db import TimeTrackingConnection import zerver.lib.logging_util -import six ######################################################################## # INITIAL SETTINGS @@ -219,7 +218,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', 'PUSH_NOTIFICATION_BOUNCER_URL': None, } -for setting_name, setting_val in six.iteritems(DEFAULT_SETTINGS): +for setting_name, setting_val in DEFAULT_SETTINGS.items(): if setting_name not in vars(): vars()[setting_name] = setting_val