Stop sub-classing object (#8249)

This commit is contained in:
Patrick Cloke 2020-09-04 06:54:56 -04:00 committed by GitHub
parent 9f8abdcc38
commit c619253db8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
168 changed files with 293 additions and 292 deletions

View file

@ -58,7 +58,7 @@ class _InvalidMacaroonException(Exception):
pass
class Auth(object):
class Auth:
"""
FIXME: This class contains a mix of functions for authenticating users
of our client-server API and authenticating events added to room graphs.

View file

@ -22,7 +22,7 @@ from synapse.config.server import is_threepid_reserved
logger = logging.getLogger(__name__)
class AuthBlocking(object):
class AuthBlocking:
def __init__(self, hs):
self.store = hs.get_datastore()

View file

@ -28,7 +28,7 @@ MAX_ALIAS_LENGTH = 255
MAX_USERID_LENGTH = 255
class Membership(object):
class Membership:
"""Represents the membership states of a user in a room."""
@ -40,7 +40,7 @@ class Membership(object):
LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN)
class PresenceState(object):
class PresenceState:
"""Represents the presence state of a user."""
OFFLINE = "offline"
@ -48,14 +48,14 @@ class PresenceState(object):
ONLINE = "online"
class JoinRules(object):
class JoinRules:
PUBLIC = "public"
KNOCK = "knock"
INVITE = "invite"
PRIVATE = "private"
class LoginType(object):
class LoginType:
PASSWORD = "m.login.password"
EMAIL_IDENTITY = "m.login.email.identity"
MSISDN = "m.login.msisdn"
@ -65,7 +65,7 @@ class LoginType(object):
DUMMY = "m.login.dummy"
class EventTypes(object):
class EventTypes:
Member = "m.room.member"
Create = "m.room.create"
Tombstone = "m.room.tombstone"
@ -96,17 +96,17 @@ class EventTypes(object):
Presence = "m.presence"
class RejectedReason(object):
class RejectedReason:
AUTH_ERROR = "auth_error"
class RoomCreationPreset(object):
class RoomCreationPreset:
PRIVATE_CHAT = "private_chat"
PUBLIC_CHAT = "public_chat"
TRUSTED_PRIVATE_CHAT = "trusted_private_chat"
class ThirdPartyEntityKind(object):
class ThirdPartyEntityKind:
USER = "user"
LOCATION = "location"
@ -115,7 +115,7 @@ ServerNoticeMsgType = "m.server_notice"
ServerNoticeLimitReached = "m.server_notice.usage_limit_reached"
class UserTypes(object):
class UserTypes:
"""Allows for user type specific behaviour. With the benefit of hindsight
'admin' and 'guest' users should also be UserTypes. Normal users are type None
"""
@ -125,7 +125,7 @@ class UserTypes(object):
ALL_USER_TYPES = (SUPPORT, BOT)
class RelationTypes(object):
class RelationTypes:
"""The types of relations known to this server.
"""
@ -134,14 +134,14 @@ class RelationTypes(object):
REFERENCE = "m.reference"
class LimitBlockingTypes(object):
class LimitBlockingTypes:
"""Reasons that a server may be blocked"""
MONTHLY_ACTIVE_USER = "monthly_active_user"
HS_DISABLED = "hs_disabled"
class EventContentFields(object):
class EventContentFields:
"""Fields found in events' content, regardless of type."""
# Labels for the event, cf https://github.com/matrix-org/matrix-doc/pull/2326
@ -152,6 +152,6 @@ class EventContentFields(object):
SELF_DESTRUCT_AFTER = "org.matrix.self_destruct_after"
class RoomEncryptionAlgorithms(object):
class RoomEncryptionAlgorithms:
MEGOLM_V1_AES_SHA2 = "m.megolm.v1.aes-sha2"
DEFAULT = MEGOLM_V1_AES_SHA2

View file

@ -31,7 +31,7 @@ if typing.TYPE_CHECKING:
logger = logging.getLogger(__name__)
class Codes(object):
class Codes:
UNRECOGNIZED = "M_UNRECOGNIZED"
UNAUTHORIZED = "M_UNAUTHORIZED"
FORBIDDEN = "M_FORBIDDEN"

View file

@ -130,7 +130,7 @@ def matrix_user_id_validator(user_id_str):
return UserID.from_string(user_id_str)
class Filtering(object):
class Filtering:
def __init__(self, hs):
super(Filtering, self).__init__()
self.store = hs.get_datastore()
@ -168,7 +168,7 @@ class Filtering(object):
raise SynapseError(400, str(e))
class FilterCollection(object):
class FilterCollection:
def __init__(self, filter_json):
self._filter_json = filter_json
@ -249,7 +249,7 @@ class FilterCollection(object):
)
class Filter(object):
class Filter:
def __init__(self, filter_json):
self.filter_json = filter_json

View file

@ -21,7 +21,7 @@ from synapse.types import Requester
from synapse.util import Clock
class Ratelimiter(object):
class Ratelimiter:
"""
Ratelimit actions marked by arbitrary keys.

View file

@ -18,7 +18,7 @@ from typing import Dict
import attr
class EventFormatVersions(object):
class EventFormatVersions:
"""This is an internal enum for tracking the version of the event format,
independently from the room version.
"""
@ -35,20 +35,20 @@ KNOWN_EVENT_FORMAT_VERSIONS = {
}
class StateResolutionVersions(object):
class StateResolutionVersions:
"""Enum to identify the state resolution algorithms"""
V1 = 1 # room v1 state res
V2 = 2 # MSC1442 state res: room v2 and later
class RoomDisposition(object):
class RoomDisposition:
STABLE = "stable"
UNSTABLE = "unstable"
@attr.s(slots=True, frozen=True)
class RoomVersion(object):
class RoomVersion:
"""An object which describes the unique attributes of a room version."""
identifier = attr.ib() # str; the identifier for this version
@ -69,7 +69,7 @@ class RoomVersion(object):
limit_notifications_power_levels = attr.ib(type=bool)
class RoomVersions(object):
class RoomVersions:
V1 = RoomVersion(
"1",
RoomDisposition.STABLE,

View file

@ -33,7 +33,7 @@ MEDIA_PREFIX = "/_matrix/media/r0"
LEGACY_MEDIA_PREFIX = "/_matrix/media/v1"
class ConsentURIBuilder(object):
class ConsentURIBuilder:
def __init__(self, hs_config):
"""
Args: