diff --git a/changelog.d/10197.misc b/changelog.d/10197.misc
new file mode 100644
index 0000000000..cbb3b454be
--- /dev/null
+++ b/changelog.d/10197.misc
@@ -0,0 +1 @@
+Upgrade `black` linting tool to 21.6b0.
diff --git a/contrib/experiments/cursesio.py b/contrib/experiments/cursesio.py
index cff73650e6..7695cc77ca 100644
--- a/contrib/experiments/cursesio.py
+++ b/contrib/experiments/cursesio.py
@@ -46,14 +46,14 @@ class CursesStdIO:
self.callback = callback
def fileno(self):
- """ We want to select on FD 0 """
+ """We want to select on FD 0"""
return 0
def connectionLost(self, reason):
self.close()
def print_line(self, text):
- """ add a line to the internal list of lines"""
+ """add a line to the internal list of lines"""
self.lines.append(text)
self.redraw()
@@ -92,7 +92,7 @@ class CursesStdIO:
)
def doRead(self):
- """ Input is ready! """
+ """Input is ready!"""
curses.noecho()
c = self.stdscr.getch() # read a character
@@ -132,7 +132,7 @@ class CursesStdIO:
return "CursesStdIO"
def close(self):
- """ clean up """
+ """clean up"""
curses.nocbreak()
self.stdscr.keypad(0)
diff --git a/setup.py b/setup.py
index e2e488761d..1081548e00 100755
--- a/setup.py
+++ b/setup.py
@@ -97,7 +97,7 @@ CONDITIONAL_REQUIREMENTS["all"] = list(ALL_OPTIONAL_REQUIREMENTS)
# We pin black so that our tests don't start failing on new releases.
CONDITIONAL_REQUIREMENTS["lint"] = [
"isort==5.7.0",
- "black==20.8b1",
+ "black==21.6b0",
"flake8-comprehensions",
"flake8-bugbear==21.3.2",
"flake8",
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 1ecdafaadd..0bfb25802a 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -1961,7 +1961,7 @@ class FederationHandler(BaseHandler):
return event
async def on_send_leave_request(self, origin: str, pdu: EventBase) -> None:
- """ We have received a leave event for a room. Fully process it."""
+ """We have received a leave event for a room. Fully process it."""
event = pdu
logger.debug(
diff --git a/synapse/http/servlet.py b/synapse/http/servlet.py
index 3c43f32586..fda8da21b7 100644
--- a/synapse/http/servlet.py
+++ b/synapse/http/servlet.py
@@ -454,7 +454,7 @@ class RestServlet:
"""
def register(self, http_server):
- """ Register this servlet with the given HTTP server. """
+ """Register this servlet with the given HTTP server."""
patterns = getattr(self, "PATTERNS", None)
if patterns:
for method in ("GET", "PUT", "POST", "DELETE"):
diff --git a/synapse/replication/tcp/handler.py b/synapse/replication/tcp/handler.py
index 7ced4c543c..2ad7a200bb 100644
--- a/synapse/replication/tcp/handler.py
+++ b/synapse/replication/tcp/handler.py
@@ -571,7 +571,7 @@ class ReplicationCommandHandler:
def on_REMOTE_SERVER_UP(
self, conn: IReplicationConnection, cmd: RemoteServerUpCommand
):
- """"Called when get a new REMOTE_SERVER_UP command."""
+ """Called when get a new REMOTE_SERVER_UP command."""
self._replication_data_handler.on_remote_server_up(cmd.data)
self._notifier.notify_remote_server_up(cmd.data)
diff --git a/synapse/types.py b/synapse/types.py
index e52cd7ffd4..0bdf32659c 100644
--- a/synapse/types.py
+++ b/synapse/types.py
@@ -284,14 +284,14 @@ class RoomAlias(DomainSpecificString):
@attr.s(slots=True, frozen=True, repr=False)
class RoomID(DomainSpecificString):
- """Structure representing a room id. """
+ """Structure representing a room id."""
SIGIL = "!"
@attr.s(slots=True, frozen=True, repr=False)
class EventID(DomainSpecificString):
- """Structure representing an event id. """
+ """Structure representing an event id."""
SIGIL = "$"
diff --git a/tests/handlers/test_appservice.py b/tests/handlers/test_appservice.py
index 5d6cc2885f..024c5e963c 100644
--- a/tests/handlers/test_appservice.py
+++ b/tests/handlers/test_appservice.py
@@ -26,7 +26,7 @@ from .. import unittest
class AppServiceHandlerTestCase(unittest.TestCase):
- """ Tests the ApplicationServicesHandler. """
+ """Tests the ApplicationServicesHandler."""
def setUp(self):
self.mock_store = Mock()
diff --git a/tests/handlers/test_directory.py b/tests/handlers/test_directory.py
index 1908d3c2c6..7a8041ab44 100644
--- a/tests/handlers/test_directory.py
+++ b/tests/handlers/test_directory.py
@@ -27,7 +27,7 @@ from tests.test_utils import make_awaitable
class DirectoryTestCase(unittest.HomeserverTestCase):
- """ Tests the directory service. """
+ """Tests the directory service."""
def make_homeserver(self, reactor, clock):
self.mock_federation = Mock()
diff --git a/tests/handlers/test_profile.py b/tests/handlers/test_profile.py
index 5330a9b34e..cdb41101b3 100644
--- a/tests/handlers/test_profile.py
+++ b/tests/handlers/test_profile.py
@@ -23,7 +23,7 @@ from tests.test_utils import make_awaitable
class ProfileTestCase(unittest.HomeserverTestCase):
- """ Tests profile management. """
+ """Tests profile management."""
def make_homeserver(self, reactor, clock):
self.mock_federation = Mock()
diff --git a/tests/handlers/test_register.py b/tests/handlers/test_register.py
index bd43190523..c51763f41a 100644
--- a/tests/handlers/test_register.py
+++ b/tests/handlers/test_register.py
@@ -28,7 +28,7 @@ from .. import unittest
class RegistrationTestCase(unittest.HomeserverTestCase):
- """ Tests the RegistrationHandler. """
+ """Tests the RegistrationHandler."""
def make_homeserver(self, reactor, clock):
hs_config = self.default_config()
diff --git a/tests/handlers/test_sync.py b/tests/handlers/test_sync.py
index c8b43305f4..84f05f6c58 100644
--- a/tests/handlers/test_sync.py
+++ b/tests/handlers/test_sync.py
@@ -22,7 +22,7 @@ import tests.utils
class SyncTestCase(tests.unittest.HomeserverTestCase):
- """ Tests Sync Handler. """
+ """Tests Sync Handler."""
def prepare(self, reactor, clock, hs):
self.hs = hs
diff --git a/tests/rest/client/v1/test_events.py b/tests/rest/client/v1/test_events.py
index 852bda408c..2789d51546 100644
--- a/tests/rest/client/v1/test_events.py
+++ b/tests/rest/client/v1/test_events.py
@@ -23,7 +23,7 @@ from tests import unittest
class EventStreamPermissionsTestCase(unittest.HomeserverTestCase):
- """ Tests event streaming (GET /events). """
+ """Tests event streaming (GET /events)."""
servlets = [
events.register_servlets,
diff --git a/tests/rest/client/v1/test_presence.py b/tests/rest/client/v1/test_presence.py
index 409f3949dc..597e4c67de 100644
--- a/tests/rest/client/v1/test_presence.py
+++ b/tests/rest/client/v1/test_presence.py
@@ -24,7 +24,7 @@ from tests import unittest
class PresenceTestCase(unittest.HomeserverTestCase):
- """ Tests presence REST API. """
+ """Tests presence REST API."""
user_id = "@sid:red"
diff --git a/tests/rest/client/v1/test_rooms.py b/tests/rest/client/v1/test_rooms.py
index 5b1096d091..e94566ffd7 100644
--- a/tests/rest/client/v1/test_rooms.py
+++ b/tests/rest/client/v1/test_rooms.py
@@ -64,7 +64,7 @@ class RoomBase(unittest.HomeserverTestCase):
class RoomPermissionsTestCase(RoomBase):
- """ Tests room permissions. """
+ """Tests room permissions."""
user_id = "@sid1:red"
rmcreator_id = "@notme:red"
@@ -377,7 +377,7 @@ class RoomPermissionsTestCase(RoomBase):
class RoomsMemberListTestCase(RoomBase):
- """ Tests /rooms/$room_id/members/list REST events."""
+ """Tests /rooms/$room_id/members/list REST events."""
user_id = "@sid1:red"
@@ -416,7 +416,7 @@ class RoomsMemberListTestCase(RoomBase):
class RoomsCreateTestCase(RoomBase):
- """ Tests /rooms and /rooms/$room_id REST events. """
+ """Tests /rooms and /rooms/$room_id REST events."""
user_id = "@sid1:red"
@@ -502,7 +502,7 @@ class RoomsCreateTestCase(RoomBase):
class RoomTopicTestCase(RoomBase):
- """ Tests /rooms/$room_id/topic REST events. """
+ """Tests /rooms/$room_id/topic REST events."""
user_id = "@sid1:red"
@@ -566,7 +566,7 @@ class RoomTopicTestCase(RoomBase):
class RoomMemberStateTestCase(RoomBase):
- """ Tests /rooms/$room_id/members/$user_id/state REST events. """
+ """Tests /rooms/$room_id/members/$user_id/state REST events."""
user_id = "@sid1:red"
@@ -790,7 +790,7 @@ class RoomJoinRatelimitTestCase(RoomBase):
class RoomMessagesTestCase(RoomBase):
- """ Tests /rooms/$room_id/messages/$user_id/$msg_id REST events. """
+ """Tests /rooms/$room_id/messages/$user_id/$msg_id REST events."""
user_id = "@sid1:red"
@@ -838,7 +838,7 @@ class RoomMessagesTestCase(RoomBase):
class RoomInitialSyncTestCase(RoomBase):
- """ Tests /rooms/$room_id/initialSync. """
+ """Tests /rooms/$room_id/initialSync."""
user_id = "@sid1:red"
@@ -879,7 +879,7 @@ class RoomInitialSyncTestCase(RoomBase):
class RoomMessageListTestCase(RoomBase):
- """ Tests /rooms/$room_id/messages REST events. """
+ """Tests /rooms/$room_id/messages REST events."""
user_id = "@sid1:red"
diff --git a/tests/rest/client/v1/test_typing.py b/tests/rest/client/v1/test_typing.py
index 0aad48a162..44e22ca999 100644
--- a/tests/rest/client/v1/test_typing.py
+++ b/tests/rest/client/v1/test_typing.py
@@ -26,7 +26,7 @@ PATH_PREFIX = "/_matrix/client/api/v1"
class RoomTypingTestCase(unittest.HomeserverTestCase):
- """ Tests /rooms/$room_id/typing/$user_id REST API. """
+ """Tests /rooms/$room_id/typing/$user_id REST API."""
user_id = "@sid:red"
diff --git a/tests/storage/test_base.py b/tests/storage/test_base.py
index 3b45a7efd8..ddad44bd6c 100644
--- a/tests/storage/test_base.py
+++ b/tests/storage/test_base.py
@@ -27,7 +27,7 @@ from tests.utils import TestHomeServer, default_config
class SQLBaseStoreTestCase(unittest.TestCase):
- """ Test the "simple" SQL generating methods in SQLBaseStore. """
+ """Test the "simple" SQL generating methods in SQLBaseStore."""
def setUp(self):
self.db_pool = Mock(spec=["runInteraction"])
|