refactor: Remove six.moves.configparser import.

This commit is contained in:
rht
2017-11-06 03:10:47 +01:00
committed by Tim Abbott
parent de319b4558
commit ccf2792c1c
8 changed files with 13 additions and 18 deletions

View File

@@ -25,7 +25,7 @@ import psycopg2.extensions
import select
import time
import logging
import six.moves.configparser
import configparser
import sys
import os
@@ -80,7 +80,7 @@ except ImportError as e:
#
# However, we still also check the `USING_PGROONGA` variable, since
# that's all we have in development.
config_file = six.moves.configparser.RawConfigParser()
config_file = configparser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")
if config_file.has_option('machine', 'pgroonga'):
USING_PGROONGA = True

View File

@@ -50,7 +50,7 @@ import json
from six.moves.urllib.parse import urljoin, urlencode
from six.moves.urllib.request import Request, urlopen
from six.moves.urllib.error import HTTPError
from six.moves.configparser import RawConfigParser
from configparser import RawConfigParser
from six import text_type

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import os
from six.moves import configparser
import configparser
import sys
import subprocess
import logging

View File

@@ -3,7 +3,7 @@
import os
import sys
import subprocess
import six.moves.configparser as configparser
import configparser
import re
force = False

View File

@@ -6,7 +6,7 @@ import argparse
import sys
import os
from six.moves.configparser import ConfigParser
import ConfigParser
from typing import Any, Dict, MutableMapping, Optional, Text
# Scans zulip repositary for issues that don't have any `area` labels.

View File

@@ -12,7 +12,7 @@ from zerver.lib.bot_storage import get_bot_state, set_bot_state, \
is_key_in_bot_state, get_bot_state_size, remove_bot_state
from zerver.lib.integrations import EMBEDDED_BOTS
from six.moves import configparser
import configparser
if False:
from mypy_extensions import NoReturn

View File

@@ -3,7 +3,7 @@ from typing import Any
from django.core.management.base import BaseCommand
from zerver.models import get_realm, get_user, UserProfile
import os
from six.moves.configparser import ConfigParser
from configparser import ConfigParser
class Command(BaseCommand):
help = """Sync your API key from ~/.zuliprc into your development instance"""
@@ -15,12 +15,7 @@ class Command(BaseCommand):
raise RuntimeError("No ~/.zuliprc found")
config = ConfigParser()
with open(config_file, 'r') as f:
# Apparently, six.moves.configparser.ConfigParser is not
# consistent between Python 2 and 3!
if hasattr(config, 'read_file'):
config.read_file(f, config_file)
else:
config.readfp(f, config_file)
api_key = config.get("api", "key")
email = config.get("api", "email")

View File

@@ -15,7 +15,7 @@ import os
import platform
import time
import sys
import six.moves.configparser
import configparser
from zerver.lib.db import TimeTrackingConnection
import zerver.lib.logging_util
@@ -26,14 +26,14 @@ import zerver.lib.logging_util
DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..')
config_file = six.moves.configparser.RawConfigParser()
config_file = configparser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")
# Whether this instance of Zulip is running in a production environment.
PRODUCTION = config_file.has_option('machine', 'deploy_type')
DEVELOPMENT = not PRODUCTION
secrets_file = six.moves.configparser.RawConfigParser()
secrets_file = configparser.RawConfigParser()
if PRODUCTION:
secrets_file.read("/etc/zulip/zulip-secrets.conf")
else:
@@ -586,7 +586,7 @@ try:
# For get_updates hostname sharding.
domain = config_file.get('django', 'cookie_domain')
CSRF_COOKIE_DOMAIN = '.' + domain
except six.moves.configparser.Error:
except configparser.Error:
# Failing here is OK
pass