Skip to content

Commit

Permalink
generate_secrets: Fix mypy errors.
Browse files Browse the repository at this point in the history
I'm pretty sure these errors reflect a problem with Typeshed, but
don't have time to investigate.
  • Loading branch information
timabbott committed May 17, 2017
1 parent 45a4aea commit b01ba5f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/setup/generate_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os.path
from os.path import dirname, abspath
if False:
from typing import Dict, Optional, Text
from typing import Dict, List, Optional, Text

BASE_DIR = dirname(dirname(dirname(abspath(__file__))))
sys.path.append(BASE_DIR)
Expand Down Expand Up @@ -58,8 +58,8 @@ def get_old_conf(output_filename):
if not os.path.exists(output_filename):
return {}

secrets_file = six.moves.configparser.RawConfigParser() # type: ignore # https://github.com/python/typeshed/issues/307
secrets_file.read(output_filename)
secrets_file = six.moves.configparser.RawConfigParser()
secrets_file.read(output_filename) # type: ignore

return dict(secrets_file.items("secrets"))

Expand All @@ -71,16 +71,16 @@ def generate_secrets(development=False):
OUTPUT_SETTINGS_FILENAME = "/etc/zulip/zulip-secrets.conf"
current_conf = get_old_conf(OUTPUT_SETTINGS_FILENAME)

lines = []
lines = [] # type: List[Text]
if len(current_conf) == 0:
lines = [u'[secrets]\n']

def need_secret(name):
# type: (Text) -> bool
# type: (str) -> bool
return name not in current_conf

def add_secret(name, value):
# type: (Text, Text) -> None
# type: (str, Text) -> None
lines.append("%s = %s\n" % (name, value))
current_conf[name] = value

Expand Down

0 comments on commit b01ba5f

Please sign in to comment.