cleanup: Remove unused imports.

Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-18 16:00:35 -07:00 committed by Tim Abbott
parent 64d2f5ac32
commit 2f6623bbc4
61 changed files with 25 additions and 91 deletions

View file

@ -1,4 +1,4 @@
from typing import Any, Dict, List, Tuple from typing import List
from zulint.custom_rules import RuleList from zulint.custom_rules import RuleList
MYPY = False MYPY = False

View file

@ -9,7 +9,6 @@ import zipfile
import textwrap import textwrap
import requests import requests
import urllib.parse import urllib.parse
import json
from requests import Response from requests import Response
red = '\033[91m' # type: str red = '\033[91m' # type: str

View file

@ -2,7 +2,6 @@
# Original path: zulip/tools/linter_lib/pep8.py # Original path: zulip/tools/linter_lib/pep8.py
import subprocess import subprocess
import sys
from zulint.printer import print_err, colors from zulint.printer import print_err, colors

View file

@ -1,4 +1,3 @@
from importlib import import_module
import os import os
import sys import sys

View file

@ -1,14 +1,12 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from os.path import dirname, basename from os.path import dirname, basename
from importlib import import_module
import os import os
import sys import sys
import argparse import argparse
import glob import glob
import unittest import unittest
from unittest import TestCase, TestSuite
import pytest import pytest
def parse_args(): def parse_args():

View file

@ -8,7 +8,6 @@ import argparse
import zulip import zulip
import sys import sys
import traceback import traceback
from typing import Any, Dict
usage = """./irc-mirror.py --irc-server=IRC_SERVER --channel=<CHANNEL> --nick-prefix=<NICK> --stream=<STREAM> [optional args] usage = """./irc-mirror.py --irc-server=IRC_SERVER --channel=<CHANNEL> --nick-prefix=<NICK> --stream=<STREAM> [optional args]

View file

@ -1,6 +1,6 @@
import irc.bot import irc.bot
import irc.strings import irc.strings
from irc.client import ip_numstr_to_quad, ip_quad_to_numstr, Event, ServerConnection from irc.client import Event, ServerConnection, ip_numstr_to_quad
from irc.client_aio import AioReactor from irc.client_aio import AioReactor
import multiprocessing as mp import multiprocessing as mp
from typing import Any, Dict from typing import Any, Dict

View file

@ -1,6 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import datetime
import httplib2
import os import os
from oauth2client import client from oauth2client import client

View file

@ -10,13 +10,11 @@ import logging
import argparse import argparse
import os import os
import pytz import pytz
import urllib
import sys import sys
import time import time
import traceback from typing import List, Optional, Set, Tuple
from typing import List, Set, Tuple, Iterable, Optional
from oauth2client import client, tools from oauth2client import client
from oauth2client.file import Storage from oauth2client.file import Storage
try: try:
from googleapiclient import discovery from googleapiclient import discovery

View file

@ -7,7 +7,7 @@
import zulip import zulip
import sys import sys
from typing import Any, Optional, Text from typing import Text
from mercurial import ui, repository as repo from mercurial import ui, repository as repo
VERSION = "0.9" VERSION = "0.9"

View file

@ -6,7 +6,6 @@ import os
import traceback import traceback
import signal import signal
from types import FrameType from types import FrameType
from typing import Any
from zulip import RandomExponentialBackoff from zulip import RandomExponentialBackoff
def die(signal: int, frame: FrameType) -> None: def die(signal: int, frame: FrameType) -> None:

View file

@ -40,19 +40,14 @@
from typing import Dict, List, Set, Optional from typing import Dict, List, Set, Optional
import logging import logging
import threading
import optparse import optparse
from sleekxmpp import ClientXMPP, InvalidJID, JID from sleekxmpp import ClientXMPP, InvalidJID, JID
from sleekxmpp.stanza import Message as JabberMessage from sleekxmpp.stanza import Message as JabberMessage
from sleekxmpp.exceptions import IqError, IqTimeout
from configparser import SafeConfigParser from configparser import SafeConfigParser
import getpass
import os
import sys import sys
import zulip import zulip
from zulip import Client from zulip import Client
import re
from typing import Any, Callable from typing import Any, Callable
__version__ = "1.1" __version__ = "1.1"

View file

@ -6,7 +6,6 @@ import os
import platform import platform
import re import re
import sys import sys
import shutil
import subprocess import subprocess
import tempfile import tempfile
import traceback import traceback

View file

@ -2,7 +2,7 @@
import argparse import argparse
import zulip import zulip
from typing import List, Text, Dict, Any from typing import Any, Dict, Text
VERSION = "0.9" VERSION = "0.9"
# Nagios passes the notification details as command line options. # Nagios passes the notification details as command line options.

View file

@ -23,7 +23,7 @@ import git_p4
__version__ = "0.1" __version__ = "0.1"
sys.path.insert(0, os.path.dirname(__file__)) sys.path.insert(0, os.path.dirname(__file__))
from typing import Any, Dict, Optional, Text from typing import Any, Dict, Optional
import zulip_perforce_config as config import zulip_perforce_config as config
if config.ZULIP_API_PATH is not None: if config.ZULIP_API_PATH is not None:

View file

@ -13,7 +13,7 @@ import os
import sys import sys
import os.path import os.path
import pysvn import pysvn
from typing import Any, Dict, List, Optional, Text, Tuple, Union from typing import Any, Dict, Optional, Text, Tuple
sys.path.insert(0, os.path.dirname(__file__)) sys.path.insert(0, os.path.dirname(__file__))
import zulip_svn_config as config import zulip_svn_config as config

View file

@ -2,7 +2,6 @@
import sys import sys
import time import time
import optparse import optparse
import os
import random import random
import logging import logging
import subprocess import subprocess

View file

@ -12,7 +12,6 @@ from zephyr_mirror_backend import parse_args
(options, args) = parse_args() (options, args) = parse_args()
from types import FrameType from types import FrameType
from typing import Any
def die(signal: int, frame: FrameType) -> None: def die(signal: int, frame: FrameType) -> None:
@ -44,7 +43,6 @@ if options.forward_class_messages and not options.noshard:
return 0 return 0
for (status, job) in run_parallel(run_job, jobs, threads=16): for (status, job) in run_parallel(run_job, jobs, threads=16):
print("A mirroring shard died!") print("A mirroring shard died!")
pass
sys.exit(0) sys.exit(0)
backoff = RandomExponentialBackoff(timeout_success_equivalent=300) backoff = RandomExponentialBackoff(timeout_success_equivalent=300)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from typing import IO, Any, Dict, List, Text, Union, Set, Tuple, Optional, cast from typing import Any, Dict, IO, List, Optional, Set, Text, Tuple, cast
from types import FrameType from types import FrameType
import sys import sys
@ -10,7 +10,6 @@ import time
import subprocess import subprocess
import optparse import optparse
import os import os
import datetime
import textwrap import textwrap
import signal import signal
import logging import logging

View file

@ -1,6 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys
import argparse import argparse
usage = """subscribe [options] --streams=<streams> usage = """subscribe [options] --streams=<streams>

View file

@ -1,6 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys
import argparse import argparse
usage = """unsubscribe [options] --streams=<streams> usage = """unsubscribe [options] --streams=<streams>

View file

@ -5,7 +5,7 @@ import sys
import argparse import argparse
import logging import logging
from typing import Any, Dict, List, Optional from typing import Any, Dict
import zulip import zulip

View file

@ -2,8 +2,6 @@
import os import os
import sys import sys
import glob
import subprocess
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
ZULIP_BOTS_VERSION = "0.6.4" ZULIP_BOTS_VERSION = "0.6.4"

View file

@ -1,8 +1,7 @@
import requests import requests
import logging import logging
import json from typing import Any, Dict
from typing import Dict, Any, List from requests.exceptions import ConnectionError
from requests.exceptions import HTTPError, ConnectionError
help_message = ''' help_message = '''
You can add datapoints towards your beeminder goals \ You can add datapoints towards your beeminder goals \

View file

@ -1,4 +1,4 @@
from unittest.mock import patch, Mock from unittest.mock import patch
from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError

View file

@ -1,5 +1,4 @@
from copy import deepcopy from copy import deepcopy
from random import randint
from functools import reduce from functools import reduce
from zulip_bots.game_handler import BadMoveException from zulip_bots.game_handler import BadMoveException

View file

@ -1,10 +1,8 @@
# See readme.md for instructions on running this code. # See readme.md for instructions on running this code.
import copy import copy
import importlib
from math import log10, floor from math import log10, floor
import re
from zulip_bots.bots.converter import utils from zulip_bots.bots.converter import utils
from typing import Any, Dict, List from typing import Any, Dict, List

View file

@ -1,6 +1,5 @@
# See readme.md for instructions on running this code. # See readme.md for instructions on running this code.
import logging import logging
import json
import requests import requests
import html2text import html2text
import string import string

View file

@ -1,11 +1,10 @@
# See readme.md for instructions on running this code. # See readme.md for instructions on running this code.
import logging import logging
from urllib import parse
import json import json
import apiai import apiai
from typing import Dict, Any, List from typing import Any, Dict
help_message = '''DialogFlow bot help_message = '''DialogFlow bot
This bot will interact with dialogflow bots. This bot will interact with dialogflow bots.

View file

@ -1,4 +1,4 @@
from unittest.mock import patch, MagicMock, Mock from unittest.mock import Mock, patch
from zulip_bots.test_lib import ( from zulip_bots.test_lib import (
get_bot_message_handler, get_bot_message_handler,

View file

@ -1,6 +1,6 @@
import requests import requests
import re import re
from typing import Any, Dict, Optional from typing import Any, Dict
class FrontHandler: class FrontHandler:
FRONT_API = "https://api2.frontapp.com/conversations/{}" FRONT_API = "https://api2.frontapp.com/conversations/{}"

View file

@ -1,5 +1,4 @@
import copy import copy
import random
from typing import List, Any, Tuple, Dict from typing import List, Any, Tuple, Dict
from zulip_bots.game_handler import GameAdapter, BadMoveException from zulip_bots.game_handler import GameAdapter, BadMoveException

View file

@ -1,5 +1,5 @@
from unittest.mock import patch from unittest.mock import patch
from requests.exceptions import HTTPError, ConnectionError from requests.exceptions import ConnectionError
from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler

View file

@ -1,8 +1,5 @@
import re import re
import os
import sys
import logging import logging
import configparser
import requests import requests

View file

@ -1,12 +1,11 @@
# See readme.md for instructions on running this code. # See readme.md for instructions on running this code.
import logging import logging
from urllib import parse
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from typing import Dict, Any, Union, List from typing import Any, Dict, List
def google_search(keywords: str) -> List[Dict[str, str]]: def google_search(keywords: str) -> List[Dict[str, str]]:
query = {'q': keywords} query = {'q': keywords}

View file

@ -2,7 +2,6 @@
# googletranslate.conf in this (zulip_bots/bots/googletranslate/) directory. # googletranslate.conf in this (zulip_bots/bots/googletranslate/) directory.
import requests import requests
from requests.exceptions import HTTPError, ConnectionError
class GoogleTranslateHandler: class GoogleTranslateHandler:
''' '''

View file

@ -2,7 +2,6 @@ from unittest.mock import patch
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
from zulip_bots.bots.google_translate.google_translate import TranslateError
help_text = ''' help_text = '''
Google translate bot Google translate bot

View file

@ -19,7 +19,6 @@ class TeamNotFoundException(Exception):
class UnknownCommandSyntax(Exception): class UnknownCommandSyntax(Exception):
def __init__(self, detail: str) -> None: def __init__(self, detail: str) -> None:
self.detail = detail self.detail = detail
pass
class UnspecifiedProblemException(Exception): class UnspecifiedProblemException(Exception):
pass pass

View file

@ -1,10 +1,8 @@
import html
import json import json
import random
import re import re
from zulip_bots.lib import Any from zulip_bots.lib import Any
from typing import Optional, Any, Dict, Tuple from typing import Any, Dict, Tuple
QUESTION = 'How should we handle this?' QUESTION = 'How should we handle this?'

View file

@ -1,7 +1,7 @@
import base64 import base64
import re import re
import requests import requests
from typing import Any, Dict, Iterable, Optional from typing import Any, Dict, Optional
GET_REGEX = re.compile('get "(?P<issue_key>.+)"$') GET_REGEX = re.compile('get "(?P<issue_key>.+)"$')
CREATE_REGEX = re.compile( CREATE_REGEX = re.compile(

View file

@ -1,6 +1,5 @@
import re import re
import requests import requests
import logging
from typing import Any, Dict from typing import Any, Dict

View file

@ -2,7 +2,6 @@
import requests import requests
from typing import Any, List, Dict from typing import Any, List, Dict
import logging
class MentionHandler: class MentionHandler:
def initialize(self, bot_handler: Any) -> None: def initialize(self, bot_handler: Any) -> None:

View file

@ -10,8 +10,6 @@ finished yet so any matches that are finished will be removed.
import json import json
from .constants import EMPTY_BOARD
class MerelsStorage(): class MerelsStorage():
def __init__(self, topic_name, storage): def __init__(self, topic_name, storage):

View file

@ -5,7 +5,7 @@ from zulip_bots.bots.merels.libraries import (
database, database,
game_data game_data
) )
from zulip_bots.game_handler import GameAdapter, SamePlayerMove, GameInstance from zulip_bots.game_handler import GameAdapter, SamePlayerMove
class Storage: class Storage:
data = {} data = {}

View file

@ -1,11 +1,8 @@
import unittest
from libraries import database from libraries import database
from libraries import game_data from libraries import game_data
from zulip_bots.simple_lib import SimpleStorage from zulip_bots.simple_lib import SimpleStorage
from zulip_bots.test_lib import BotTestCase, DefaultTests from zulip_bots.test_lib import BotTestCase, DefaultTests
from zulip_bots.game_handler import GameInstance
from merels import MerelsHandler
class DatabaseTest(BotTestCase, DefaultTests): class DatabaseTest(BotTestCase, DefaultTests):
bot_name = 'merels' bot_name = 'merels'

View file

@ -2,10 +2,8 @@
import simple_salesforce import simple_salesforce
from typing import Dict, Any, List from typing import Dict, Any, List
import getpass
import re import re
import logging import logging
import json
from zulip_bots.bots.salesforce.utils import commands, object_types, link_query, default_query from zulip_bots.bots.salesforce.utils import commands, object_types, link_query, default_query
base_help_text = '''Salesforce bot base_help_text = '''Salesforce bot

View file

@ -1,7 +1,5 @@
import requests import requests
import logging import logging
import re
import urllib
from typing import Optional, Any, Dict from typing import Optional, Any, Dict

View file

@ -1,5 +1,5 @@
import requests import requests
from typing import Dict, Any, Tuple, Union from typing import Any, Dict
class SusiHandler: class SusiHandler:
''' '''

View file

@ -8,7 +8,6 @@ from zulip_bots.test_file_utils import (
read_bot_fixture_data, read_bot_fixture_data,
) )
from unittest.mock import patch from unittest.mock import patch
import tweepy
class TestTwitpostBot(BotTestCase, DefaultTests): class TestTwitpostBot(BotTestCase, DefaultTests):
bot_name = "twitpost" bot_name = "twitpost"

View file

@ -1,6 +1,5 @@
import zulip
import tweepy import tweepy
from typing import Dict, Any, Union, List, Tuple, Optional from typing import Any, Dict
class TwitpostBot: class TwitpostBot:

View file

@ -3,7 +3,7 @@
import re import re
import os import os
from typing import Any, Dict, List, Tuple, Callable, Set, Union from typing import Any, Dict, List, Set, Tuple, Union
class VirtualFsHandler: class VirtualFsHandler:
META = { META = {

View file

@ -1,7 +1,5 @@
# See readme.md for instructions on running this code. # See readme.md for instructions on running this code.
import requests import requests
import json
import logging
from typing import Any, Dict from typing import Any, Dict

View file

@ -1,7 +1,5 @@
import requests import requests
import logging import logging
import re
import urllib
from zulip_bots.lib import Any from zulip_bots.lib import Any
from typing import Optional, Any, Dict from typing import Optional, Any, Dict

View file

@ -2,7 +2,6 @@
from typing import Dict, Any, Optional, Callable from typing import Dict, Any, Optional, Callable
import wit import wit
import sys
import importlib.util import importlib.util
class WitaiHandler: class WitaiHandler:

View file

@ -1,7 +1,6 @@
# See readme.md for instructions on running this code. # See readme.md for instructions on running this code.
import logging import logging
import ssl import ssl
import sys
import requests import requests
from typing import Any, Dict from typing import Any, Dict

View file

@ -1,6 +1,5 @@
import requests import requests
import logging import logging
import sys
from requests.exceptions import HTTPError, ConnectionError from requests.exceptions import HTTPError, ConnectionError
from typing import Dict, Any, Union, List, Tuple, Optional from typing import Dict, Any, Union, List, Tuple, Optional

View file

@ -4,8 +4,6 @@ import random
import logging import logging
from copy import deepcopy from copy import deepcopy
from typing import Any, Dict, Tuple, List from typing import Any, Dict, Tuple, List
from zulip_bots.test_lib import BotTestCase
import operator
import random import random

View file

@ -11,7 +11,6 @@ import re
from typing import Any, Optional, List, Dict, IO, Text from typing import Any, Optional, List, Dict, IO, Text
from zulip import Client, ZulipError from zulip import Client, ZulipError
from zulip_bots.custom_exceptions import ConfigValidationError
class NoBotConfigException(Exception): class NoBotConfigException(Exception):

View file

@ -6,7 +6,6 @@ import os
import sys import sys
import subprocess import subprocess
import glob import glob
import pip
from typing import Iterator from typing import Iterator
def get_bot_paths() -> Iterator[str]: def get_bot_paths() -> Iterator[str]:

View file

@ -4,7 +4,6 @@ import logging
import argparse import argparse
import sys import sys
import os import os
from os.path import basename, splitext
from zulip_bots.lib import ( from zulip_bots.lib import (
zulip_env_vars_are_present, zulip_env_vars_are_present,

View file

@ -10,7 +10,7 @@ import importlib.util
from configparser import MissingSectionHeaderError, NoOptionError from configparser import MissingSectionHeaderError, NoOptionError
from flask import Flask, request from flask import Flask, request
from importlib import import_module from importlib import import_module
from typing import Any, Dict, Union, List, Optional from typing import Any, Dict, List, Optional
from types import ModuleType from types import ModuleType
from werkzeug.exceptions import BadRequest, Unauthorized from werkzeug.exceptions import BadRequest, Unauthorized