diff --git a/tools/check-issue-labels b/tools/check-issue-labels index 897c6b98fc..9c2c805f68 100755 --- a/tools/check-issue-labels +++ b/tools/check-issue-labels @@ -7,7 +7,7 @@ import sys import os import ConfigParser -from typing import Any, Dict, MutableMapping, Optional +from typing import Any, Dict, Optional # Scans zulip repositary for issues that don't have any `area` labels. # GitHub API token is required as GitHub limits unauthenticated diff --git a/tools/check-templates b/tools/check-templates index 54f341d449..ad3cae16e5 100755 --- a/tools/check-templates +++ b/tools/check-templates @@ -11,7 +11,7 @@ from lib import sanity_check sanity_check.check_venv(__file__) from zulint import lister -from typing import cast, Callable, Dict, Iterable, List +from typing import cast, Dict, Iterable, List EXCLUDED_FILES = [ ## Test data Files for testing modules in tests diff --git a/tools/create-test-api-docs b/tools/create-test-api-docs index ea5dc8d205..4507f91e26 100755 --- a/tools/create-test-api-docs +++ b/tools/create-test-api-docs @@ -5,12 +5,11 @@ from lib import sanity_check sanity_check.check_venv(__file__) from collections import defaultdict -from typing import Any, Dict, Iterable, List, Set +from typing import Any, Dict, List, Set import cgi import os import pprint -import re import ujson Call = Dict[str, Any] diff --git a/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py b/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py index 2cb04889e9..13f04fe332 100644 --- a/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py +++ b/tools/documentation_crawler/documentation_crawler/spiders/common/spiders.py @@ -7,7 +7,7 @@ from scrapy.linkextractors import IGNORED_EXTENSIONS from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor from scrapy.utils.url import url_has_any_extension -from typing import Any, Generator, List, Optional, Tuple +from typing import Any, Generator, List, Optional EXCLUDED_URLS = [ # Google calendar returns 404s on HEAD requests unconditionally diff --git a/tools/find-add-class b/tools/find-add-class index b3943fd81c..2a68b7c0bf 100755 --- a/tools/find-add-class +++ b/tools/find-add-class @@ -3,7 +3,6 @@ from lib.find_add_class import display, find import glob import argparse -import sys # check for the venv from lib import sanity_check diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py index d00870a963..75241c998d 100644 --- a/tools/lib/capitalization.py +++ b/tools/lib/capitalization.py @@ -1,5 +1,5 @@ -from typing import List, Tuple, Set, Pattern, Match +from typing import List, Tuple, Match import re from bs4 import BeautifulSoup diff --git a/tools/lib/pretty_print.py b/tools/lib/pretty_print.py index ae9ca8be0d..bcb53a9d31 100644 --- a/tools/lib/pretty_print.py +++ b/tools/lib/pretty_print.py @@ -3,7 +3,6 @@ from typing import Any, Dict, List from .template_parser import ( tokenize, - Token, is_django_block_tag, ) import subprocess diff --git a/tools/lib/provision.py b/tools/lib/provision.py index 84639a535f..32f394e3e6 100755 --- a/tools/lib/provision.py +++ b/tools/lib/provision.py @@ -7,17 +7,16 @@ import platform import subprocess import glob import hashlib -import traceback os.environ["PYTHONUNBUFFERED"] = "y" ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ZULIP_PATH) -from scripts.lib.zulip_tools import run, subprocess_text_output, OKBLUE, ENDC, WARNING, \ +from scripts.lib.zulip_tools import run, OKBLUE, ENDC, WARNING, \ get_dev_uuid_var_path, FAIL, parse_lsb_release, file_or_package_hash_updated from scripts.lib.setup_venv import ( - setup_virtualenv, VENV_DEPENDENCIES, REDHAT_VENV_DEPENDENCIES, + VENV_DEPENDENCIES, REDHAT_VENV_DEPENDENCIES, THUMBOR_VENV_DEPENDENCIES, YUM_THUMBOR_VENV_DEPENDENCIES, FEDORA_VENV_DEPENDENCIES ) diff --git a/tools/lib/test_server.py b/tools/lib/test_server.py index 224ca17706..1bba23f43c 100644 --- a/tools/lib/test_server.py +++ b/tools/lib/test_server.py @@ -6,7 +6,7 @@ import time from contextlib import contextmanager -from typing import (Any, Iterator, Optional) +from typing import Iterator, Optional # Verify the Zulip venv is available. from tools.lib import sanity_check diff --git a/tools/lint b/tools/lint index a8c0763476..49d5a9de56 100755 --- a/tools/lint +++ b/tools/lint @@ -12,7 +12,7 @@ sanity_check.check_venv(__file__) from zulint import lister from zulint.command import add_default_linter_arguments, LinterConfig -from typing import cast, Callable, Dict, Iterator, List +from typing import cast, Dict, List import random def run(): diff --git a/tools/linter_lib/pep8.py b/tools/linter_lib/pep8.py index b2ff0a6efb..c7daa2bb99 100644 --- a/tools/linter_lib/pep8.py +++ b/tools/linter_lib/pep8.py @@ -1,8 +1,6 @@ from __future__ import print_function from __future__ import absolute_import -import subprocess - from zulint.linters import run_pycodestyle from typing import List diff --git a/tools/linter_lib/pyflakes.py b/tools/linter_lib/pyflakes.py index 18fe4519f4..cbd61cf249 100644 --- a/tools/linter_lib/pyflakes.py +++ b/tools/linter_lib/pyflakes.py @@ -6,7 +6,7 @@ import subprocess from zulint.printer import print_err, colors -from typing import Any, Dict, List +from typing import List suppress_patterns = [ (b'', b'imported but unused'), diff --git a/tools/run-dev.py b/tools/run-dev.py index 04530864b5..bc427121e5 100755 --- a/tools/run-dev.py +++ b/tools/run-dev.py @@ -6,7 +6,6 @@ import pwd import signal import subprocess import sys -import time import traceback from urllib.parse import urlunparse diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emoji index 4a1ced3fcc..e7308b1d7d 100755 --- a/tools/setup/emoji/build_emoji +++ b/tools/setup/emoji/build_emoji @@ -11,7 +11,7 @@ from typing import Any, Dict, List, Optional from emoji_setup_utils import generate_emoji_catalog, generate_codepoint_to_name_map, \ get_emoji_code, generate_name_to_codepoint_map, emoji_names_for_picker, \ - EMOJISETS, EMOTICON_CONVERSIONS, REMAPPED_EMOJIS + EMOTICON_CONVERSIONS, REMAPPED_EMOJIS from emoji_names import EMOJI_NAME_MAPS ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../') diff --git a/tools/setup/setup_venvs.py b/tools/setup/setup_venvs.py index 08dffab0d3..11a37226b3 100755 --- a/tools/setup/setup_venvs.py +++ b/tools/setup/setup_venvs.py @@ -8,7 +8,7 @@ if ZULIP_PATH not in sys.path: sys.path.append(ZULIP_PATH) from scripts.lib.setup_venv import setup_virtualenv -from scripts.lib.zulip_tools import run, subprocess_text_output +from scripts.lib.zulip_tools import subprocess_text_output VENV_PATH = "/srv/zulip-py3-venv" diff --git a/tools/test-api b/tools/test-api index e9b5b6773b..14534721a4 100755 --- a/tools/test-api +++ b/tools/test-api @@ -16,9 +16,7 @@ from zulip import Client from tools.lib.test_script import get_provisioning_status from tools.lib.test_server import test_server_running -from zerver.lib.api_test_helpers import test_the_api, test_invalid_api_key, \ - test_update_message_edit_permission_error, \ - test_user_not_authorized_error, test_authorization_errors_fatal +from zerver.lib.api_test_helpers import test_the_api, test_invalid_api_key os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings' django.setup() diff --git a/tools/test-backend b/tools/test-backend index 500c462d25..ef448fd2c0 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -1,7 +1,6 @@ #!/usr/bin/env python3 from typing import List, Any -from mypy_extensions import NoReturn import glob import argparse import os diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 3b4a3af890..9bcfb2f3ce 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import argparse import os -import shutil import subprocess import sys from typing import Dict, Any diff --git a/tools/test-locked-requirements b/tools/test-locked-requirements index 21b80841d5..43649564c0 100755 --- a/tools/test-locked-requirements +++ b/tools/test-locked-requirements @@ -10,7 +10,7 @@ import sys import tempfile import ujson -from typing import Optional, List, Tuple +from typing import Optional, List TOOLS_DIR = os.path.abspath(os.path.dirname(__file__)) ZULIP_PATH = os.path.dirname(TOOLS_DIR) diff --git a/tools/tests/test_template_parser.py b/tools/tests/test_template_parser.py index c464fc5071..cfbff3cd22 100644 --- a/tools/tests/test_template_parser.py +++ b/tools/tests/test_template_parser.py @@ -1,4 +1,4 @@ -from typing import Optional, Any +from typing import Optional import sys import unittest diff --git a/tools/update-authors-json b/tools/update-authors-json index 387fc3f01d..1a3809fade 100755 --- a/tools/update-authors-json +++ b/tools/update-authors-json @@ -24,7 +24,6 @@ import json sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings' from django.conf import settings -from zerver.lib.utils import split_by FIXTURE_FILE = os.path.join(os.path.dirname(__file__), '../zerver/tests/fixtures/authors.json') duplicate_commits_file = os.path.join(os.path.dirname(__file__), diff --git a/tools/zulint/command.py b/tools/zulint/command.py index 45a932a52d..1f871b3aa3 100644 --- a/tools/zulint/command.py +++ b/tools/zulint/command.py @@ -11,7 +11,7 @@ import sys if False: # See https://zulip.readthedocs.io/en/latest/testing/mypy.html#mypy-in-production-scripts - from typing import Any, Callable, Dict, List, Optional + from typing import Any, Callable, Dict, List from zulint.printer import print_err, colors diff --git a/tools/zulint/printer.py b/tools/zulint/printer.py index 3d55360e46..e041e950bf 100644 --- a/tools/zulint/printer.py +++ b/tools/zulint/printer.py @@ -2,7 +2,6 @@ from __future__ import print_function from __future__ import absolute_import import sys -import os from itertools import cycle if False: # See https://zulip.readthedocs.io/en/latest/testing/mypy.html#mypy-in-production-scripts diff --git a/tools/zulip-export/zulip-export b/tools/zulip-export/zulip-export index 575a913ccb..e531354f2d 100755 --- a/tools/zulip-export/zulip-export +++ b/tools/zulip-export/zulip-export @@ -24,7 +24,6 @@ import sys import os import argparse -import time import json usage = """Export all messages on a given stream to a JSON dump.