Skip to content

Commit c20952f

Browse files
committed
Clean up post-merge
1 parent 639eff2 commit c20952f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+250
-5594
lines changed

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
cache: "pip"
2020
cache-dependency-path: |
2121
**/*requirements*.txt
22+
2223
- name: Install apt deps
2324
run: sudo apt-get update && sudo apt-get install -qq -y libxml2-dev libxslt1-dev
2425
- name: Install dependencies

cloudbot/bot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ def __init__(
159159
db_path = self.config.get("database", "sqlite:///cloudbot.db")
160160
self.db_engine = create_engine(db_path)
161161
database.configure(self.db_engine)
162-
self.db_executor_pool = ExecutorPool(50, max_workers=1, thread_name_prefix='cloudbot-db')
162+
self.db_executor_pool = ExecutorPool(
163+
50, max_workers=1, thread_name_prefix="cloudbot-db"
164+
)
163165

164166
logger.debug("Database system initialised.")
165167

cloudbot/event.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import concurrent.futures
21
import enum
32
import logging
43
from functools import partial

cloudbot/util/async_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def run_coroutine_threadsafe(coro, loop):
5858
asyncio.run_coroutine_threadsafe(coro, loop)
5959

6060

61-
def create_future(loop):
61+
def create_future(loop=None):
62+
loop = loop if loop is not None else asyncio.get_event_loop()
6263
return loop.create_future()
6364

6465

cloudbot/util/backoff.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import random
2-
32
import time
43

54

@@ -17,7 +16,7 @@ def randfunc(self):
1716

1817
def __enter__(self):
1918
self._exp = min(self._exp + 1, self._max)
20-
wait = self.randfunc(0, self._base * (2 ** self._exp))
19+
wait = self.randfunc(0, self._base * (2**self._exp))
2120
time.sleep(wait)
2221
return self
2322

cloudbot/util/executor_pool.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from cloudbot.util.async_util import create_future
77

8-
logger = logging.getLogger('cloudbot')
8+
logger = logging.getLogger("cloudbot")
99

1010

1111
class ExecutorWrapper:
@@ -26,7 +26,9 @@ def __del__(self):
2626

2727

2828
class ExecutorPool:
29-
def __init__(self, max_executors=None, executor_type=ThreadPoolExecutor, **kwargs):
29+
def __init__(
30+
self, max_executors=None, executor_type=ThreadPoolExecutor, **kwargs
31+
):
3032
if max_executors is None:
3133
max_executors = (os.cpu_count() or 1) * 5
3234

cloudbot/util/web.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from typing import Dict, Optional, Union
2121

2222
import requests
23+
from pbincli import api as pb_api
24+
from pbincli.format import Paste as pb_Paste
2325
from requests import (
2426
HTTPError,
2527
PreparedRequest,
@@ -28,9 +30,6 @@
2830
Response,
2931
)
3032

31-
from pbincli import api as pb_api
32-
from pbincli.format import Paste as pb_Paste
33-
3433
# Constants
3534
DEFAULT_SHORTENER = "is.gd"
3635
DEFAULT_PASTEBIN = ""
@@ -376,16 +375,17 @@ class PrivateBin(Pastebin):
376375
def __init__(self, url):
377376
super().__init__()
378377
self.api_client = pb_api.PrivateBin(
379-
str(url), {'proxy': '', 'nocheckcert': False, 'noinsecurewarn': False}
378+
str(url),
379+
{"proxy": "", "nocheckcert": False, "noinsecurewarn": False},
380380
)
381381

382-
def paste(self, data, ext, password=None, expire='1day'):
383-
if ext in ('txt', 'text'):
384-
syntax = 'plaintext'
385-
elif ext in ('md', 'markdown'):
386-
syntax = 'markdown'
382+
def paste(self, data, ext, password=None, expire="1day"):
383+
if ext in ("txt", "text"):
384+
syntax = "plaintext"
385+
elif ext in ("md", "markdown"):
386+
syntax = "markdown"
387387
else:
388-
syntax = 'syntaxhighlighting'
388+
syntax = "syntaxhighlighting"
389389

390390
try:
391391
version = self.api_client.getVersion()
@@ -428,16 +428,16 @@ def paste(self, data, ext, password=None, expire='1day'):
428428
except RequestException as e:
429429
raise ServiceError(e.request, "Connection error occurred") from e
430430

431-
if result['status'] != 0:
432-
raise ServiceError(None, result['message'])
431+
if result["status"] != 0:
432+
raise ServiceError(None, result["message"])
433433

434434
return "{}?{}#{}".format(
435-
self.api_client.server, result['id'], _paste.getHash()
435+
self.api_client.server, result["id"], _paste.getHash()
436436
)
437437

438438

439-
pastebins.register('hastebin', Hastebin(HASTEBIN_SERVER))
440-
pastebins.register('privatebin', PrivateBin('https://privatebin.net/'))
439+
pastebins.register("hastebin", Hastebin(HASTEBIN_SERVER))
440+
pastebins.register("privatebin", PrivateBin("https://privatebin.net/"))
441441

442442
shorteners.register("git.io", Gitio())
443443
shorteners.register("goo.gl", Googl())

plugins/core/server_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def do_isupport(bot):
2424

2525

2626
@hook.connect()
27-
def clear_isupport(conn: 'IrcClient'):
27+
def clear_isupport(conn: "IrcClient"):
2828
serv_info = conn.memory.setdefault("server_info", {})
2929
statuses = get_status_modes(serv_info, clear=True)
3030
for s in DEFAULT_STATUS:

0 commit comments

Comments
 (0)