diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index b575d85976..dbf3799d2e 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -168,7 +168,7 @@ class Auth:
rights: str = "access",
allow_expired: bool = False,
) -> synapse.types.Requester:
- """ Get a registered user's ID.
+ """Get a registered user's ID.
Args:
request: An HTTP request with an access_token query parameter.
@@ -299,9 +299,12 @@ class Auth:
return user_id, app_service
async def get_user_by_access_token(
- self, token: str, rights: str = "access", allow_expired: bool = False,
+ self,
+ token: str,
+ rights: str = "access",
+ allow_expired: bool = False,
) -> TokenLookupResult:
- """ Validate access token and get user_id from it
+ """Validate access token and get user_id from it
Args:
token: The access token to get the user by
@@ -494,7 +497,7 @@ class Auth:
return service
async def is_server_admin(self, user: UserID) -> bool:
- """ Check if the given user is a local server admin.
+ """Check if the given user is a local server admin.
Args:
user: user to check
@@ -505,7 +508,10 @@ class Auth:
return await self.store.is_server_admin(user)
def compute_auth_events(
- self, event, current_state_ids: StateMap[str], for_verification: bool = False,
+ self,
+ event,
+ current_state_ids: StateMap[str],
+ for_verification: bool = False,
) -> List[str]:
"""Given an event and current state return the list of event IDs used
to auth an event.
diff --git a/synapse/api/constants.py b/synapse/api/constants.py
index 565a8cd76a..af8d59cf87 100644
--- a/synapse/api/constants.py
+++ b/synapse/api/constants.py
@@ -27,6 +27,11 @@ MAX_ALIAS_LENGTH = 255
# the maximum length for a user id is 255 characters
MAX_USERID_LENGTH = 255
+# The maximum length for a group id is 255 characters
+MAX_GROUPID_LENGTH = 255
+MAX_GROUP_CATEGORYID_LENGTH = 255
+MAX_GROUP_ROLEID_LENGTH = 255
+
class Membership:
@@ -128,8 +133,7 @@ class UserTypes:
class RelationTypes:
- """The types of relations known to this server.
- """
+ """The types of relations known to this server."""
ANNOTATION = "m.annotation"
REPLACE = "m.replace"
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index 90bb01f414..a71e518f90 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -391,8 +391,7 @@ class InvalidCaptchaError(SynapseError):
class LimitExceededError(SynapseError):
- """A client has sent too many requests and is being throttled.
- """
+ """A client has sent too many requests and is being throttled."""
def __init__(
self,
@@ -409,8 +408,7 @@ class LimitExceededError(SynapseError):
class RoomKeysVersionError(SynapseError):
- """A client has tried to upload to a non-current version of the room_keys store
- """
+ """A client has tried to upload to a non-current version of the room_keys store"""
def __init__(self, current_version: str):
"""
@@ -427,7 +425,9 @@ class UnsupportedRoomVersionError(SynapseError):
def __init__(self, msg: str = "Homeserver does not support this room version"):
super().__init__(
- code=400, msg=msg, errcode=Codes.UNSUPPORTED_ROOM_VERSION,
+ code=400,
+ msg=msg,
+ errcode=Codes.UNSUPPORTED_ROOM_VERSION,
)
@@ -462,8 +462,7 @@ class IncompatibleRoomVersionError(SynapseError):
class PasswordRefusedError(SynapseError):
- """A password has been refused, either during password reset/change or registration.
- """
+ """A password has been refused, either during password reset/change or registration."""
def __init__(
self,
@@ -471,7 +470,9 @@ class PasswordRefusedError(SynapseError):
errcode: str = Codes.WEAK_PASSWORD,
):
super().__init__(
- code=400, msg=msg, errcode=errcode,
+ code=400,
+ msg=msg,
+ errcode=errcode,
)
@@ -494,7 +495,7 @@ class RequestSendFailed(RuntimeError):
def cs_error(msg: str, code: str = Codes.UNKNOWN, **kwargs):
- """ Utility method for constructing an error response for client-server
+ """Utility method for constructing an error response for client-server
interactions.
Args:
@@ -511,7 +512,7 @@ def cs_error(msg: str, code: str = Codes.UNKNOWN, **kwargs):
class FederationError(RuntimeError):
- """ This class is used to inform remote homeservers about erroneous
+ """This class is used to inform remote homeservers about erroneous
PDUs they sent us.
FATAL: The remote server could not interpret the source event.
diff --git a/synapse/api/presence.py b/synapse/api/presence.py
index 18a462f0ee..b9a8e29460 100644
--- a/synapse/api/presence.py
+++ b/synapse/api/presence.py
@@ -56,8 +56,7 @@ class UserPresenceState(
@classmethod
def default(cls, user_id):
- """Returns a default presence state.
- """
+ """Returns a default presence state."""
return cls(
user_id=user_id,
state=PresenceState.OFFLINE,
|