mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
refactor: Remove six.moves.configparser import.
This commit is contained in:
@@ -25,7 +25,7 @@ import psycopg2.extensions
|
|||||||
import select
|
import select
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
import six.moves.configparser
|
import configparser
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ except ImportError as e:
|
|||||||
#
|
#
|
||||||
# However, we still also check the `USING_PGROONGA` variable, since
|
# However, we still also check the `USING_PGROONGA` variable, since
|
||||||
# that's all we have in development.
|
# that's all we have in development.
|
||||||
config_file = six.moves.configparser.RawConfigParser()
|
config_file = configparser.RawConfigParser()
|
||||||
config_file.read("/etc/zulip/zulip.conf")
|
config_file.read("/etc/zulip/zulip.conf")
|
||||||
if config_file.has_option('machine', 'pgroonga'):
|
if config_file.has_option('machine', 'pgroonga'):
|
||||||
USING_PGROONGA = True
|
USING_PGROONGA = True
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import json
|
|||||||
from six.moves.urllib.parse import urljoin, urlencode
|
from six.moves.urllib.parse import urljoin, urlencode
|
||||||
from six.moves.urllib.request import Request, urlopen
|
from six.moves.urllib.request import Request, urlopen
|
||||||
from six.moves.urllib.error import HTTPError
|
from six.moves.urllib.error import HTTPError
|
||||||
from six.moves.configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
from six import text_type
|
from six import text_type
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
from six.moves import configparser
|
import configparser
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import six.moves.configparser as configparser
|
import configparser
|
||||||
import re
|
import re
|
||||||
|
|
||||||
force = False
|
force = False
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import argparse
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from six.moves.configparser import ConfigParser
|
import ConfigParser
|
||||||
from typing import Any, Dict, MutableMapping, Optional, Text
|
from typing import Any, Dict, MutableMapping, Optional, Text
|
||||||
|
|
||||||
# Scans zulip repositary for issues that don't have any `area` labels.
|
# Scans zulip repositary for issues that don't have any `area` labels.
|
||||||
|
|||||||
@@ -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
|
is_key_in_bot_state, get_bot_state_size, remove_bot_state
|
||||||
from zerver.lib.integrations import EMBEDDED_BOTS
|
from zerver.lib.integrations import EMBEDDED_BOTS
|
||||||
|
|
||||||
from six.moves import configparser
|
import configparser
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
from mypy_extensions import NoReturn
|
from mypy_extensions import NoReturn
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from typing import Any
|
|||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from zerver.models import get_realm, get_user, UserProfile
|
from zerver.models import get_realm, get_user, UserProfile
|
||||||
import os
|
import os
|
||||||
from six.moves.configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Sync your API key from ~/.zuliprc into your development instance"""
|
help = """Sync your API key from ~/.zuliprc into your development instance"""
|
||||||
@@ -15,12 +15,7 @@ class Command(BaseCommand):
|
|||||||
raise RuntimeError("No ~/.zuliprc found")
|
raise RuntimeError("No ~/.zuliprc found")
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
with open(config_file, 'r') as f:
|
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)
|
config.read_file(f, config_file)
|
||||||
else:
|
|
||||||
config.readfp(f, config_file)
|
|
||||||
api_key = config.get("api", "key")
|
api_key = config.get("api", "key")
|
||||||
email = config.get("api", "email")
|
email = config.get("api", "email")
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import os
|
|||||||
import platform
|
import platform
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import six.moves.configparser
|
import configparser
|
||||||
|
|
||||||
from zerver.lib.db import TimeTrackingConnection
|
from zerver.lib.db import TimeTrackingConnection
|
||||||
import zerver.lib.logging_util
|
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__)), '..')
|
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")
|
config_file.read("/etc/zulip/zulip.conf")
|
||||||
|
|
||||||
# Whether this instance of Zulip is running in a production environment.
|
# Whether this instance of Zulip is running in a production environment.
|
||||||
PRODUCTION = config_file.has_option('machine', 'deploy_type')
|
PRODUCTION = config_file.has_option('machine', 'deploy_type')
|
||||||
DEVELOPMENT = not PRODUCTION
|
DEVELOPMENT = not PRODUCTION
|
||||||
|
|
||||||
secrets_file = six.moves.configparser.RawConfigParser()
|
secrets_file = configparser.RawConfigParser()
|
||||||
if PRODUCTION:
|
if PRODUCTION:
|
||||||
secrets_file.read("/etc/zulip/zulip-secrets.conf")
|
secrets_file.read("/etc/zulip/zulip-secrets.conf")
|
||||||
else:
|
else:
|
||||||
@@ -586,7 +586,7 @@ try:
|
|||||||
# For get_updates hostname sharding.
|
# For get_updates hostname sharding.
|
||||||
domain = config_file.get('django', 'cookie_domain')
|
domain = config_file.get('django', 'cookie_domain')
|
||||||
CSRF_COOKIE_DOMAIN = '.' + domain
|
CSRF_COOKIE_DOMAIN = '.' + domain
|
||||||
except six.moves.configparser.Error:
|
except configparser.Error:
|
||||||
# Failing here is OK
|
# Failing here is OK
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user