Remove the rest of `import six` outside zerver.lib.

We no longer need the six module, now that we're Python 3 only.
This commit is contained in:
rht 2017-09-27 10:16:35 +02:00 committed by Tim Abbott
parent daef6a7dbc
commit b937e1fede
5 changed files with 6 additions and 9 deletions

View File

@ -14,9 +14,9 @@ import scripts.lib.setup_path_on_import
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings' os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
from django.utils.crypto import get_random_string from django.utils.crypto import get_random_string
import six
import argparse import argparse
import uuid import uuid
import configparser
from zerver.lib.str_utils import force_str from zerver.lib.str_utils import force_str
from zerver.lib.utils import generate_random_token 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): if not os.path.exists(output_filename):
return {} return {}
secrets_file = six.moves.configparser.RawConfigParser() secrets_file = configparser.RawConfigParser()
secrets_file.read(output_filename) secrets_file.read(output_filename)
return dict(secrets_file.items("secrets")) return dict(secrets_file.items("secrets"))

View File

@ -9,7 +9,6 @@ import os
import subprocess import subprocess
import argparse import argparse
import sys import sys
import six
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--prev-deploy', metavar='DIR', 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/') MAP_DIR = os.path.join(STATIC_PATH, 'source-map/')
subprocess.check_call(['mkdir', '-p', MIN_DIR, MAP_DIR]) 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_SPECS is not typed, so forcefully type keys and values being read from JS_SPECS
js_group = js_group_filespec_pair[0] # type: str js_group = js_group_filespec_pair[0] # type: str
filespec = js_group_filespec_pair[1] # type: Dict[str, Any] filespec = js_group_filespec_pair[1] # type: Dict[str, Any]

View File

@ -2,7 +2,7 @@
from __future__ import print_function from __future__ import print_function
import six import io
import sys import sys
import tarfile import tarfile
@ -29,6 +29,6 @@ with tarfile.open(fileobj=stdin, mode='r|*') as in_tar, \
assert info.size == len(data) assert info.size == len(data)
data = new_shebang_bytes + data[len(old_shebang_bytes):] data = new_shebang_bytes + data[len(old_shebang_bytes):]
info.size = len(data) info.size = len(data)
out_tar.addfile(info, six.BytesIO(data)) out_tar.addfile(info, io.BytesIO(data))
else: else:
out_tar.addfile(info) out_tar.addfile(info)

View File

@ -7,7 +7,6 @@ import os
import sys import sys
import argparse import argparse
import subprocess import subprocess
import six
import lister import lister
from typing import cast, Dict, List from typing import cast, Dict, List

View File

@ -20,7 +20,6 @@ import six.moves.configparser
from zerver.lib.db import TimeTrackingConnection from zerver.lib.db import TimeTrackingConnection
import zerver.lib.logging_util import zerver.lib.logging_util
import six
######################################################################## ########################################################################
# INITIAL SETTINGS # INITIAL SETTINGS
@ -219,7 +218,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
'PUSH_NOTIFICATION_BOUNCER_URL': None, '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(): if setting_name not in vars():
vars()[setting_name] = setting_val vars()[setting_name] = setting_val