isort: Reformat using isort.

This commit is contained in:
PIG208 2021-05-28 17:00:04 +08:00 committed by Tim Abbott
parent 37e2596124
commit 5580c68ae5
162 changed files with 539 additions and 444 deletions

View file

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

View file

@ -1,14 +1,14 @@
#!/usr/bin/env python3
from typing import Any, List, Dict, Callable
import argparse
import os
import sys
import argparse
import zipfile
import textwrap
import requests
import urllib.parse
import zipfile
from typing import Any, Callable, Dict, List
import requests
from requests import Response
red = '\033[91m' # type: str

View file

@ -3,9 +3,9 @@
import argparse
import sys
from zulint.command import add_default_linter_arguments, LinterConfig
from zulint.command import LinterConfig, add_default_linter_arguments
from custom_check import python_rules, non_py_rules
from custom_check import non_py_rules, python_rules
EXCLUDED_FILES = [
# This is an external file that doesn't comply with our codestyle

View file

@ -1,10 +1,10 @@
#!/usr/bin/env python3
import os
import sys
import argparse
import subprocess
import glob
import os
import subprocess
import sys
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
ZULIP_BOTS_DIR = os.path.join(CURRENT_DIR, '..', 'zulip_bots')

View file

@ -1,15 +1,15 @@
#!/usr/bin/env python3
from contextlib import contextmanager
import os
import argparse
import glob
import os
import shutil
import tempfile
from contextlib import contextmanager
import crayons
import twine.commands.upload
import setuptools.sandbox
import twine.commands.upload
REPO_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

View file

@ -3,6 +3,7 @@
import subprocess
import sys
def exit(message: str) -> None:
print('PROBLEM!')
print(message)

View file

@ -1,14 +1,14 @@
#!/usr/bin/env python3
import os
import sys
import argparse
import os
import subprocess
import sys
from collections import OrderedDict
from pathlib import PurePath
from typing import Dict, List, cast
from zulint import lister
from typing import cast, Dict, List
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.dirname(TOOLS_DIR))

View file

@ -1,10 +1,11 @@
import os
import sys
import argparse
import unittest
import pytest
import os
import shutil
import sys
import unittest
import pytest
TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.chdir(os.path.dirname(TOOLS_DIR))

View file

@ -1,14 +1,15 @@
#!/usr/bin/env python3
from os.path import dirname, basename
import os
import sys
import argparse
import glob
import os
import sys
import unittest
from os.path import basename, dirname
import pytest
def parse_args():
description = """
Script to run test_<bot_name>.py files in the

View file

@ -1,13 +1,14 @@
#!/usr/bin/env python3
import sys
import os
import argparse
import multiprocessing as mp
import zulip
import os
import sys
from typing import Any, Callable, Dict
import interrealm_bridge_config
from typing import Any, Callable, Dict
import zulip
def create_pipe_event(to_client: zulip.Client, from_bot: Dict[str, Any],

View file

@ -5,10 +5,11 @@
#
import argparse
import zulip
import sys
import traceback
import zulip
usage = """./irc-mirror.py --irc-server=IRC_SERVER --channel=<CHANNEL> --nick-prefix=<NICK> --stream=<STREAM> [optional args]
Example:

View file

@ -1,9 +1,10 @@
import multiprocessing as mp
from typing import Any, Dict
import irc.bot
import irc.strings
from irc.client import Event, ServerConnection, ip_numstr_to_quad
from irc.client_aio import AioReactor
import multiprocessing as mp
from typing import Any, Dict
class IRCBot(irc.bot.SingleServerIRCBot):

View file

@ -1,23 +1,22 @@
#!/usr/bin/env python3
import os
import logging
import signal
import traceback
import zulip
import sys
import argparse
import re
import configparser
import logging
import os
import re
import signal
import sys
import traceback
from collections import OrderedDict
from types import FrameType
from typing import Any, Callable, Dict, Optional
from matrix_client.errors import MatrixRequestError
from matrix_client.client import MatrixClient
from matrix_client.errors import MatrixRequestError
from requests.exceptions import MissingSchema
import zulip
GENERAL_NETWORK_USERNAME_REGEX = '@_?[a-zA-Z0-9]+_([a-zA-Z0-9-_]+):[a-zA-Z0-9.]+'
MATRIX_USERNAME_REGEX = '@([a-zA-Z0-9-_]+):matrix.org'

View file

@ -1,22 +1,17 @@
from .matrix_bridge import (
check_zulip_message_validity,
zulip_to_matrix,
)
from unittest import TestCase, mock
from subprocess import Popen, PIPE
import os
import shutil
from contextlib import contextmanager
from subprocess import PIPE, Popen
from tempfile import mkdtemp
from unittest import TestCase, mock
from .matrix_bridge import check_zulip_message_validity, zulip_to_matrix
script_file = "matrix_bridge.py"
script_dir = os.path.dirname(__file__)
script = os.path.join(script_dir, script_file)
from typing import List, Iterator
from typing import Iterator, List
sample_config_path = "matrix_test.conf"

View file

@ -8,11 +8,11 @@ import threading
import traceback
from typing import Any, Callable, Dict
import bridge_with_slack_config
import slack_sdk
import zulip
from slack_sdk.rtm import RTMClient
import bridge_with_slack_config
import zulip
# change these templates to change the format of displayed message
ZULIP_MESSAGE_TEMPLATE = "**{username}**: {message}"

View file

@ -8,15 +8,15 @@
#
# python-dateutil is a dependency for this script.
import requests
import logging
import pytz
import time
import sys
import os
import sys
import time
from datetime import datetime, timedelta
import pytz
import requests
try:
import dateutil.parser
except ImportError as e:
@ -26,12 +26,14 @@ except ImportError as e:
sys.path.insert(0, os.path.dirname(__file__))
import zulip_codebase_config as config
VERSION = "0.9"
if config.ZULIP_API_PATH is not None:
sys.path.append(config.ZULIP_API_PATH)
from typing import Any, Dict, List, Optional
import zulip
from typing import Any, List, Dict, Optional
client = zulip.Client(
email=config.ZULIP_USER,

View file

@ -9,20 +9,22 @@
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
from typing import Text
import os
import sys
import subprocess
import os.path
import subprocess
import sys
from typing import Text
sys.path.insert(0, os.path.dirname(__file__))
import zulip_git_config as config
VERSION = "0.9"
if config.ZULIP_API_PATH is not None:
sys.path.append(config.ZULIP_API_PATH)
import zulip
client = zulip.Client(
email=config.ZULIP_USER,
site=config.ZULIP_SITE,

View file

@ -1,5 +1,5 @@
#
from typing import Dict, Text, Optional
from typing import Dict, Optional, Text
# Name of the stream to send notifications to, default is "commits"
STREAM_NAME = 'commits'

View file

@ -1,12 +1,10 @@
#!/usr/bin/env python3
import os
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from typing import Optional
from oauth2client import client, tools
from oauth2client.file import Storage
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args() # type: Optional[argparse.Namespace]

View file

@ -2,20 +2,21 @@
#
# This script depends on python-dateutil and python-pytz for properly handling
# times and time zones of calendar events.
import argparse
import datetime
import dateutil.parser
import httplib2
import itertools
import logging
import argparse
import os
import pytz
import sys
import time
from typing import List, Optional, Set, Tuple
import dateutil.parser
import httplib2
import pytz
from oauth2client import client
from oauth2client.file import Storage
try:
from googleapiclient import discovery
except ImportError:

View file

@ -5,10 +5,13 @@
# This hook is called when changesets are pushed to the master repository (ie
# `hg push`). See https://zulip.com/integrations for installation instructions.
import zulip
import sys
from typing import Text
from mercurial import ui, repository as repo
from mercurial import repository as repo
from mercurial import ui
import zulip
VERSION = "0.9"

View file

@ -1,13 +1,15 @@
#!/usr/bin/env python3
import sys
import subprocess
import os
import traceback
import signal
import subprocess
import sys
import traceback
from types import FrameType
from zulip import RandomExponentialBackoff
def die(signal: int, frame: FrameType) -> None:
"""We actually want to exit, so run os._exit (so as not to be caught and restarted)"""
os._exit(1)

View file

@ -23,6 +23,11 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import logging
import optparse
import sys
from configparser import SafeConfigParser
# The following is a table showing which kinds of messages are handled by the
# mirror in each mode:
#
@ -37,18 +42,13 @@
# | other sender| x | | |
# public mode +-------------+-----+----+--------+----
# | self sender | | | |
from typing import Dict, List, Set, Optional
from typing import Any, Callable, Dict, List, Optional, Set
import logging
import optparse
from sleekxmpp import ClientXMPP, InvalidJID, JID
from sleekxmpp import JID, ClientXMPP, InvalidJID
from sleekxmpp.stanza import Message as JabberMessage
from configparser import SafeConfigParser
import sys
import zulip
from zulip import Client
from typing import Any, Callable
__version__ = "1.1"

View file

@ -5,8 +5,8 @@ import errno
import os
import platform
import re
import sys
import subprocess
import sys
import tempfile
import traceback
@ -25,9 +25,10 @@ except ImportError:
import json
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../"))
import zulip
from typing import List
import zulip
temp_dir = "/var/tmp/" if os.name == "posix" else tempfile.gettempdir()
def mkdir_p(path: str) -> None:

View file

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import argparse
import zulip
from typing import Any, Dict, Text
import zulip
VERSION = "0.9"
# Nagios passes the notification details as command line options.
# In Nagios, "output" means "first line of output", and "long

View file

@ -9,12 +9,14 @@ from typing import Dict
sys.path.insert(0, os.path.dirname(__file__))
import zulip_openshift_config as config
VERSION = '0.1'
if config.ZULIP_API_PATH is not None:
sys.path.append(config.ZULIP_API_PATH)
import zulip
client = zulip.Client(
email=config.ZULIP_USER,
site=config.ZULIP_SITE,

View file

@ -1,5 +1,5 @@
# https://github.com/python/mypy/issues/1141
from typing import Dict, Text, Optional
from typing import Dict, Optional, Text
# Change these values to configure authentication for the plugin
ZULIP_USER = 'openshift-bot@example.com'

View file

@ -15,8 +15,8 @@ For example:
'''
import os
import sys
import os.path
import sys
import git_p4
@ -24,12 +24,14 @@ __version__ = "0.1"
sys.path.insert(0, os.path.dirname(__file__))
from typing import Any, Dict, Optional
import zulip_perforce_config as config
if config.ZULIP_API_PATH is not None:
sys.path.append(config.ZULIP_API_PATH)
import zulip
client = zulip.Client(
email=config.ZULIP_USER,
site=config.ZULIP_SITE,

View file

@ -3,21 +3,23 @@
# RSS integration for Zulip
#
import argparse
import calendar
import errno
import hashlib
from html.parser import HTMLParser
import logging
import argparse
import os
import re
import sys
import time
import urllib.parse
from typing import Dict, List, Tuple, Any
from html.parser import HTMLParser
from typing import Any, Dict, List, Tuple
import feedparser
import zulip
VERSION = "0.9" # type: str
RSS_DATA_DIR = os.path.expanduser(os.path.join('~', '.cache', 'zulip-rss')) # type: str
OLDNESS_THRESHOLD = 30 # type: int

View file

@ -10,19 +10,22 @@
# /srv/svn/carols 1843
import os
import sys
import os.path
import pysvn
import sys
from typing import Any, Dict, Optional, Text, Tuple
import pysvn
sys.path.insert(0, os.path.dirname(__file__))
import zulip_svn_config as config
VERSION = "0.9"
if config.ZULIP_API_PATH is not None:
sys.path.append(config.ZULIP_API_PATH)
import zulip
client = zulip.Client(
email=config.ZULIP_USER,
site=config.ZULIP_SITE,

View file

@ -11,12 +11,15 @@
# You may then need to restart trac (or restart Apache) for the bot
# (or changes to the bot) to actually be loaded by trac.
import os.path
import sys
from trac.core import Component, implements
from trac.ticket import ITicketChangeListener
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
import zulip_trac_config as config
VERSION = "0.9"
from typing import Any, Dict
@ -25,6 +28,7 @@ if config.ZULIP_API_PATH is not None:
sys.path.append(config.ZULIP_API_PATH)
import zulip
client = zulip.Client(
email=config.ZULIP_USER,
site=config.ZULIP_SITE,

View file

@ -3,8 +3,8 @@
# An easy Trello integration for Zulip.
import sys
import argparse
import sys
try:
import requests

View file

@ -2,12 +2,13 @@
# Twitter integration for Zulip
import argparse
import os
import sys
import argparse
from configparser import ConfigParser, NoSectionError, NoOptionError
from configparser import ConfigParser, NoOptionError, NoSectionError
import zulip
VERSION = "0.9"
CONFIGFILE = os.path.expanduser("~/.zulip_twitterrc")
INSTRUCTIONS = r"""

View file

@ -1,16 +1,17 @@
#!/usr/bin/env python3
import sys
import time
import hashlib
import logging
import optparse
import random
import logging
import subprocess
import hashlib
import zephyr
import zulip
import sys
import time
from typing import Dict, List, Set, Tuple
import zephyr
import zulip
parser = optparse.OptionParser()
parser.add_option('--verbose',
dest='verbose',

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python3
import os
import sys
import subprocess
import base64
import os
import subprocess
import sys
short_user = sys.argv[1]
api_key = sys.argv[2]

View file

@ -1,14 +1,15 @@
#!/usr/bin/env python3
import sys
import os
import logging
import argparse
import json
import logging
import os
import sys
import unicodedata
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'api'))
import zulip
def write_public_streams() -> None:
public_streams = set()

View file

@ -1,10 +1,10 @@
#!/usr/bin/env python3
import sys
import subprocess
import os
import traceback
import signal
import subprocess
import sys
import traceback
sys.path[:0] = [os.path.dirname(__file__)]
from zephyr_mirror_backend import parse_args
@ -13,6 +13,7 @@ from zephyr_mirror_backend import parse_args
from types import FrameType
def die(signal: int, frame: FrameType) -> None:
# We actually want to exit, so run os._exit (so as not to be caught and restarted)

View file

@ -1,21 +1,20 @@
#!/usr/bin/env python3
from typing import Any, Dict, IO, List, NoReturn, Optional, Set, Tuple, Union
from types import FrameType
import sys
import hashlib
import json
import re
import time
import subprocess
import logging
import optparse
import os
import textwrap
import signal
import logging
import hashlib
import tempfile
import re
import select
import signal
import subprocess
import sys
import tempfile
import textwrap
import time
from types import FrameType
from typing import IO, Any, Dict, List, NoReturn, Optional, Set, Tuple, Union
from typing_extensions import Literal, TypedDict

View file

@ -1,11 +1,9 @@
#!/usr/bin/env python3
from typing import Any, Dict, Generator, List, Tuple
import itertools
import os
import sys
import itertools
from typing import Any, Dict, Generator, List, Tuple
with open("README.md") as fh:
long_description = fh.read()
@ -73,13 +71,14 @@ setuptools_info = dict(
)
try:
from setuptools import setup, find_packages
from setuptools import find_packages, setup
package_info.update(setuptools_info)
package_info['packages'] = find_packages(exclude=['tests'])
except ImportError:
from distutils.core import setup
from distutils.version import LooseVersion
# Manual dependency check
try:
import requests

View file

@ -1,15 +1,16 @@
#!/usr/bin/env python3
import argparse
import os
import io
import os
import unittest
import zulip
from unittest import TestCase
from zulip import ZulipError
from unittest.mock import patch
import zulip
from zulip import ZulipError
class TestDefaultArguments(TestCase):
def test_invalid_arguments(self) -> None:

View file

@ -1,9 +1,10 @@
#!/usr/bin/env python3
import unittest
from unittest import TestCase
import zulip
from unittest import TestCase
class TestHashUtilDecode(TestCase):
def test_hash_util_decode(self) -> None:

View file

@ -1,21 +1,34 @@
import json
import requests
import time
import traceback
import sys
import os
import optparse
import argparse
import json
import logging
import optparse
import os
import platform
import random
import sys
import time
import traceback
import types
import urllib.parse
from configparser import SafeConfigParser
from distutils.version import LooseVersion
from typing import (
IO,
Any,
Callable,
Dict,
Iterable,
List,
Mapping,
Optional,
Sequence,
Text,
Tuple,
Union,
)
import distro
from configparser import SafeConfigParser
import urllib.parse
import logging
from typing import Any, Callable, Dict, Iterable, IO, List, Mapping, Optional, Text, Tuple, Union, Sequence
import requests
__version__ = "0.8.0"

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python3
import argparse
import os
import zulip
import argparse
def main() -> None:
usage = """zulip-api-examples [script_name]

View file

@ -1,12 +1,12 @@
#!/usr/bin/env python3
import logging
import sys
from typing import Any, Dict, List
import zulip
import click
import zulip
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
log = logging.getLogger("zulip-cli")

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import argparse
import json
from typing import Dict, List, Any
from typing import Any, Dict, List
import zulip

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python3
import argparse
from typing import Any, Dict
usage = """print-events [options]

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python3
import argparse
from typing import Any, Dict
usage = """print-messages [options]

View file

@ -1,11 +1,12 @@
#!/usr/bin/env python3
import argparse
from io import StringIO as _StringIO
from typing import IO, Any
import zulip
class StringIO(_StringIO):
name = '' # https://github.com/python/typeshed/issues/598

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python3
from typing import Any, Dict, List
import zulip
from typing import Any, List, Dict
welcome_text = 'Hello {}, Welcome to Zulip!\n \
* The first thing you should do is to install the development environment. \

View file

@ -1,10 +1,9 @@
#!/usr/bin/env python3
# zulip-send -- Sends a message to the specified recipients.
import sys
import argparse
import logging
import sys
from typing import Any, Dict
import zulip

View file

@ -70,7 +70,7 @@ setuptools_info = dict(
)
try:
from setuptools import setup, find_packages
from setuptools import find_packages, setup
package_info.update(setuptools_info)
package_info['packages'] = find_packages()
package_info['package_data'] = package_data

View file

@ -1,9 +1,12 @@
# See readme.md for instructions on running this code.
from typing import Any, List, Dict
from zulip_bots.lib import BotHandler
from typing import Any, Dict, List
import requests
from zulip_bots.lib import BotHandler
class BaremetricsHandler:
def initialize(self, bot_handler: BotHandler) -> None:
self.config_info = bot_handler.get_config_info('baremetrics')

View file

@ -1,7 +1,8 @@
from unittest.mock import patch
from zulip_bots.test_lib import BotTestCase, DefaultTests
from zulip_bots.test_lib import StubBotHandler
from zulip_bots.bots.baremetrics.baremetrics import BaremetricsHandler
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
class TestBaremetricsBot(BotTestCase, DefaultTests):
bot_name = "baremetrics"

View file

@ -1,9 +1,11 @@
import requests
import logging
from typing import Dict
from zulip_bots.lib import BotHandler
import requests
from requests.exceptions import ConnectionError
from zulip_bots.lib import BotHandler
help_message = '''
You can add datapoints towards your beeminder goals \
following the syntax shown below :smile:.\n \

View file

@ -1,7 +1,10 @@
from unittest.mock import patch
from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler
from requests.exceptions import ConnectionError
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
class TestBeeminderBot(BotTestCase, DefaultTests):
bot_name = "beeminder"
normal_config = {

View file

@ -1,8 +1,10 @@
import copy
import re
from typing import Any, Dict, Optional
import chess
import chess.uci
import re
import copy
from typing import Any, Optional, Dict
from zulip_bots.lib import BotHandler
START_REGEX = re.compile('start with other user$')

View file

@ -1,5 +1,6 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestChessBot(BotTestCase, DefaultTests):
bot_name = "chessbot"

View file

@ -1,7 +1,8 @@
from zulip_bots.game_handler import GameAdapter
from zulip_bots.bots.connect_four.controller import ConnectFourModel
from typing import Any
from zulip_bots.bots.connect_four.controller import ConnectFourModel
from zulip_bots.game_handler import GameAdapter
class ConnectFourMessageHandler:
tokens = [':blue_circle:', ':red_circle:']

View file

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

View file

@ -1,8 +1,8 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
from typing import Dict, List
from zulip_bots.bots.connect_four.connect_four import ConnectFourModel
from zulip_bots.game_handler import BadMoveException
from typing import Dict, List
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestConnectFourBot(BotTestCase, DefaultTests):

View file

@ -1,13 +1,13 @@
# See readme.md for instructions on running this code.
import copy
from math import log10, floor
from math import floor, log10
from typing import Any, Dict, List
from zulip_bots.bots.converter import utils
from typing import Any, Dict, List
from zulip_bots.lib import BotHandler
def is_float(value: Any) -> bool:
try:
float(value)

View file

@ -1,6 +1,6 @@
from zulip_bots.bots.converter import utils
from zulip_bots.test_lib import BotTestCase, DefaultTests
from zulip_bots.bots.converter import utils
class TestConverterBot(BotTestCase, DefaultTests):
bot_name = "converter"

View file

@ -1,12 +1,14 @@
# See readme.md for instructions on running this code.
import logging
import requests
import html2text
import string
from typing import Dict
import html2text
import requests
from zulip_bots.lib import BotHandler
class DefineHandler:
'''
This plugin define a word that the user inputs. It

View file

@ -1,6 +1,8 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
from unittest.mock import patch
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestDefineBot(BotTestCase, DefaultTests):
bot_name = "define"

View file

@ -1,10 +1,10 @@
# See readme.md for instructions on running this code.
import logging
import json
import logging
from typing import Dict
import apiai
from typing import Dict
from zulip_bots.lib import BotHandler
help_message = '''DialogFlow bot

View file

@ -1,12 +1,10 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests, read_bot_fixture_data
import json
from contextlib import contextmanager
from typing import ByteString, Iterator
from unittest.mock import patch
from typing import Iterator, ByteString
from zulip_bots.test_lib import BotTestCase, DefaultTests, read_bot_fixture_data
import json
class MockHttplibRequest():
def __init__(self, response: str) -> None:

View file

@ -1,7 +1,9 @@
from dropbox import Dropbox
from typing import Any, Dict, List, Tuple
from zulip_bots.lib import BotHandler
import re
from typing import Any, Dict, List, Tuple
from dropbox import Dropbox
from zulip_bots.lib import BotHandler
URL = "[{name}](https://www.dropbox.com/home{path})"

View file

@ -1,14 +1,15 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
from unittest.mock import patch
from zulip_bots.bots.dropbox_share.test_util import (
MockFileMetadata,
MockHttpResponse,
MockListFolderResult,
MockPathLinkMetadata,
MockSearchMatch,
MockSearchResult,
MockPathLinkMetadata,
MockHttpResponse
)
from zulip_bots.test_lib import BotTestCase, DefaultTests
def get_root_files_list(*args, **kwargs):
return MockListFolderResult(

View file

@ -1,5 +1,6 @@
from typing import List
class MockFileMetadata:
def __init__(self, name: str, path_lower: str):
self.name = name

View file

@ -1,6 +1,8 @@
from typing import Dict
from zulip_bots.lib import BotHandler
def encrypt(text: str) -> str:
# This is where the actual ROT13 is applied
# WHY IS .JOIN NOT WORKING?!

View file

@ -1,5 +1,6 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestEncryptBot(BotTestCase, DefaultTests):
bot_name = "encrypt"

View file

@ -1,8 +1,9 @@
from typing import Dict
from zulip_bots.lib import BotHandler
import os
from pathlib import Path
from typing import Dict
from zulip_bots.lib import BotHandler
class FileUploaderHandler:
def usage(self) -> str:

View file

@ -1,11 +1,8 @@
from pathlib import Path
from unittest.mock import Mock, patch
from zulip_bots.test_lib import (
BotTestCase,
DefaultTests,
)
from zulip_bots.test_lib import BotTestCase, DefaultTests
from pathlib import Path
class TestFileUploaderBot(BotTestCase, DefaultTests):
bot_name = "file_uploader"

View file

@ -1,9 +1,11 @@
import logging
from typing import Any, Dict, List, Optional, Tuple
import requests
from typing import Any, Dict, List, Tuple, Optional
from zulip_bots.lib import BotHandler
from requests.exceptions import ConnectionError
from zulip_bots.lib import BotHandler
USERS_LIST_URL = 'https://api.flock.co/v1/roster.listContacts'
SEND_MESSAGE_URL = 'https://api.flock.co/v1/chat.sendMessage'

View file

@ -1,7 +1,10 @@
from unittest.mock import patch
from zulip_bots.test_lib import BotTestCase, DefaultTests
from requests.exceptions import ConnectionError
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestFlockBot(BotTestCase, DefaultTests):
bot_name = "flock"
normal_config = {"token": "12345"}

View file

@ -1,7 +1,9 @@
# See readme.md for instructions on running this code.
from typing import Dict
from zulip_bots.lib import BotHandler
class FollowupHandler:
'''
This plugin facilitates creating follow-up tasks when

View file

@ -1,7 +1,4 @@
from zulip_bots.test_lib import (
BotTestCase,
DefaultTests,
)
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestFollowUpBot(BotTestCase, DefaultTests):

View file

@ -1,8 +1,11 @@
import requests
import re
from typing import Any, Dict
import requests
from zulip_bots.lib import BotHandler
class FrontHandler:
FRONT_API = "https://api2.frontapp.com/conversations/{}"
COMMANDS = [

View file

@ -2,6 +2,7 @@ from typing import Any, Dict, Optional
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestFrontBot(BotTestCase, DefaultTests):
bot_name = 'front'

View file

@ -1,5 +1,6 @@
from zulip_bots.game_handler import GameAdapter, BadMoveException
from typing import List, Any
from typing import Any, List
from zulip_bots.game_handler import BadMoveException, GameAdapter
class GameHandlerBotMessageHandler:

View file

@ -1,9 +1,9 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
from zulip_bots.game_handler import GameInstance
from typing import Any, Dict, List
from mock import patch
from typing import Any, Dict, List
from zulip_bots.game_handler import GameInstance
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestGameHandlerBot(BotTestCase, DefaultTests):

View file

@ -1,7 +1,8 @@
import copy
from typing import Any, Dict, List, Tuple
from zulip_bots.game_handler import BadMoveException, GameAdapter
from typing import List, Any, Tuple, Dict
from zulip_bots.game_handler import GameAdapter, BadMoveException
class GameOfFifteenModel:

View file

@ -1,8 +1,8 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
from typing import Dict, List, Tuple
from zulip_bots.bots.game_of_fifteen.game_of_fifteen import GameOfFifteenModel
from zulip_bots.game_handler import BadMoveException
from typing import Dict, List, Tuple
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestGameOfFifteenBot(BotTestCase, DefaultTests):

View file

@ -1,10 +1,11 @@
from typing import Dict, Union
from zulip_bots.lib import BotHandler
import requests
import logging
from requests.exceptions import HTTPError, ConnectionError
from typing import Dict, Union
import requests
from requests.exceptions import ConnectionError, HTTPError
from zulip_bots.custom_exceptions import ConfigValidationError
from zulip_bots.lib import BotHandler
GIPHY_TRANSLATE_API = 'http://api.giphy.com/v1/gifs/translate'
GIPHY_RANDOM_API = 'http://api.giphy.com/v1/gifs/random'

View file

@ -1,7 +1,9 @@
from unittest.mock import patch
from requests.exceptions import ConnectionError
from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
class TestGiphyBot(BotTestCase, DefaultTests):
bot_name = "giphy"

View file

@ -1,11 +1,12 @@
import re
import logging
import re
from typing import Any, Dict, Tuple, Union
import requests
from typing import Dict, Any, Tuple, Union
from zulip_bots.lib import BotHandler
class GithubHandler:
'''
This bot provides details on github issues and pull requests when they're

View file

@ -1,9 +1,5 @@
from zulip_bots.test_lib import (
StubBotHandler,
BotTestCase,
DefaultTests,
get_bot_message_handler,
)
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
class TestGithubDetailBot(BotTestCase, DefaultTests):
bot_name = "github_detail"

View file

@ -1,13 +1,13 @@
# See readme.md for instructions on running this code.
import logging
from typing import Dict, List
import requests
from bs4 import BeautifulSoup
from typing import Dict, List
from zulip_bots.lib import BotHandler
def google_search(keywords: str) -> List[Dict[str, str]]:
query = {'q': keywords}
# Gets the page

View file

@ -1,6 +1,7 @@
from unittest.mock import patch
from zulip_bots.test_lib import BotTestCase, DefaultTests
from unittest.mock import patch
class TestGoogleSearchBot(BotTestCase, DefaultTests):
bot_name = 'google_search'

View file

@ -3,6 +3,7 @@
import requests
class GoogleTranslateHandler:
'''
This bot will translate any messages sent to it using google translate.

View file

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

View file

@ -1,8 +1,10 @@
# See readme.md for instructions on running this code.
from typing import Any, Dict
from zulip_bots.lib import BotHandler
class HelloWorldHandler:
def usage(self) -> str:
return '''

View file

@ -1,5 +1,6 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestHelpBot(BotTestCase, DefaultTests):
bot_name = "helloworld" # type: str

View file

@ -1,7 +1,9 @@
# See readme.md for instructions on running this code.
from typing import Dict
from zulip_bots.lib import BotHandler
class HelpHandler:
def usage(self) -> str:
return '''

View file

@ -1,5 +1,6 @@
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestHelpBot(BotTestCase, DefaultTests):
bot_name = "help"

View file

@ -1,8 +1,9 @@
import requests
import logging
import re
from typing import Any, Dict, List, Optional
import requests
from typing import Any, Dict, Optional, List
from zulip_bots.lib import BotHandler
API_BASE_URL = "https://beta.idonethis.com/api/v2"

View file

@ -2,6 +2,7 @@ from unittest.mock import patch
from zulip_bots.test_lib import BotTestCase, DefaultTests
class TestIDoneThisBot(BotTestCase, DefaultTests):
bot_name = "idonethis" # type: str

View file

@ -1,6 +1,7 @@
import json
import re
from typing import Any, Dict, Tuple
from zulip_bots.lib import BotHandler
QUESTION = 'How should we handle this?'

View file

@ -1,8 +1,10 @@
# See readme.md for instructions on running this code.
from typing import Dict
from zulip_bots.lib import BotHandler, use_storage
class IncrementorHandler:
META = {
'name': 'Incrementor',

View file

@ -1,11 +1,7 @@
from unittest.mock import patch
from zulip_bots.test_lib import (
get_bot_message_handler,
StubBotHandler,
DefaultTests,
BotTestCase,
)
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
class TestIncrementorBot(BotTestCase, DefaultTests):
bot_name = "incrementor"

Some files were not shown because too many files have changed in this diff Show more