Peter Justin 4 лет назад
Родитель
Сommit
584ec9cef5

+ 1 - 1
flaskbb/auth/services/registration.py

@@ -43,7 +43,7 @@ __all__ = (
 )
 
 
-@attr.s(hash=False, repr=True, frozen=True, cmp=False)
+@attr.s(hash=False, repr=True, frozen=True, eq=False, order=False)
 class UsernameRequirements(object):
     """
     Configuration for username requirements, minimum and maximum length

+ 1 - 1
flaskbb/core/auth/registration.py

@@ -17,7 +17,7 @@ import attr
 from ..._compat import ABC
 
 
-@attr.s(hash=True, cmp=False, repr=True, frozen=True)
+@attr.s(hash=True, eq=False, order=False, repr=True, frozen=True)
 class UserRegistrationInfo(object):
     """
     User registration object, contains all relevant information for validating

+ 1 - 1
flaskbb/core/tokens.py

@@ -72,7 +72,7 @@ class TokenActions:
     ACTIVATE_ACCOUNT = 'activate_account'
 
 
-@attr.s(frozen=True, cmp=True, hash=True)
+@attr.s(frozen=True, eq=True, order=True, hash=True)
 class Token(object):
     """
     :param int user_id:

+ 4 - 4
flaskbb/core/user/update.py

@@ -22,7 +22,7 @@ def _should_assign(current, new):
     return not is_empty(new) and current != new
 
 
-@attr.s(hash=True, cmp=True, repr=True, frozen=True)
+@attr.s(hash=True, eq=True, order=True, repr=True, frozen=True)
 class UserDetailsChange(object):
     """
     Object representing a change user details.
@@ -42,7 +42,7 @@ class UserDetailsChange(object):
                 setattr(user, name, value)
 
 
-@attr.s(hash=True, cmp=True, repr=False, frozen=True)
+@attr.s(hash=True, eq=True, order=True, repr=False, frozen=True)
 class PasswordUpdate(object):
     """
     Object representing an update to a user's password.
@@ -52,7 +52,7 @@ class PasswordUpdate(object):
     new_password = attr.ib()
 
 
-@attr.s(hash=True, cmp=True, repr=True, frozen=True)
+@attr.s(hash=True, eq=True, order=True, repr=True, frozen=True)
 class EmailUpdate(object):
     """
     Object representing a change to a user's email address.
@@ -63,7 +63,7 @@ class EmailUpdate(object):
     new_email = attr.ib(converter=lambda x: x.lower())
 
 
-@attr.s(hash=True, cmp=True, repr=True, frozen=True)
+@attr.s(hash=True, eq=True, order=True, repr=True, frozen=True)
 class SettingsUpdate(object):
     """
     Object representing an update to a user's settings.

+ 4 - 4
flaskbb/display/navigation.py

@@ -44,7 +44,7 @@ class NavigationItem(ABC):
     content_type = abstractproperty(lambda: None)
 
 
-@attr.s(cmp=True, hash=True, repr=True, frozen=True, slots=True)
+@attr.s(eq=True, order=True, hash=True, repr=True, frozen=True, slots=True)
 class NavigationLink(NavigationItem):
     """
     Representation of an internal FlaskBB navigation link::
@@ -66,7 +66,7 @@ class NavigationLink(NavigationItem):
     content_type = NavigationContentType.link
 
 
-@attr.s(cmp=True, hash=True, repr=True, frozen=True, slots=True)
+@attr.s(eq=True, order=True, hash=True, repr=True, frozen=True, slots=True)
 class NavigationExternalLink(NavigationItem):
     """
     Representation of an external navigation link::
@@ -83,7 +83,7 @@ class NavigationExternalLink(NavigationItem):
     content_type = NavigationContentType.external_link
 
 
-@attr.s(cmp=True, hash=True, repr=True, frozen=True, slots=True)
+@attr.s(eq=True, order=True, hash=True, repr=True, frozen=True, slots=True)
 class NavigationHeader(NavigationItem):
     """
     Representation of header text shown in a navigation bar::
@@ -99,7 +99,7 @@ class NavigationHeader(NavigationItem):
     content_type = NavigationContentType.header
 
 
-@attr.s(cmp=False, hash=True, repr=True, frozen=True, slots=True)
+@attr.s(eq=True, order=True, hash=True, repr=True, frozen=True, slots=True)
 class NavigationDivider(NavigationItem):
     """
     Representation of a divider in a navigation bar::

+ 4 - 4
flaskbb/user/services/update.py

@@ -16,7 +16,7 @@ from ...core.changesets import ChangeSetHandler
 from ...utils.database import try_commit
 
 
-@attr.s(cmp=False, frozen=True, repr=True, hash=False)
+@attr.s(eq=False, order=False, frozen=True, repr=True, hash=False)
 class DefaultDetailsUpdateHandler(ChangeSetHandler):
     """
     Validates and updates a user's details and persists the changes to the database.
@@ -37,7 +37,7 @@ class DefaultDetailsUpdateHandler(ChangeSetHandler):
         )
 
 
-@attr.s(cmp=False, frozen=True, repr=True, hash=False)
+@attr.s(eq=False, order=False, frozen=True, repr=True, hash=False)
 class DefaultPasswordUpdateHandler(ChangeSetHandler):
     """
     Validates and updates a user's password and persists the changes to the database.
@@ -56,7 +56,7 @@ class DefaultPasswordUpdateHandler(ChangeSetHandler):
         self.plugin_manager.hook.flaskbb_password_updated(user=model)
 
 
-@attr.s(cmp=False, frozen=True, repr=True, hash=False)
+@attr.s(eq=False, order=False, frozen=True, repr=True, hash=False)
 class DefaultEmailUpdateHandler(ChangeSetHandler):
     """
     Validates and updates a user's email and persists the changes to the database.
@@ -75,7 +75,7 @@ class DefaultEmailUpdateHandler(ChangeSetHandler):
         )
 
 
-@attr.s(cmp=False, frozen=True, repr=True, hash=False)
+@attr.s(eq=False, order=False, frozen=True, repr=True, hash=False)
 class DefaultSettingsUpdateHandler(ChangeSetHandler):
     """
     Updates a user's settings and persists the changes to the database.

+ 1 - 1
flaskbb/user/services/validators.py

@@ -19,7 +19,7 @@ from ...core.exceptions import StopValidation, ValidationError
 from ...utils.helpers import check_image
 
 
-@attr.s(cmp=False, hash=False, frozen=True, repr=True)
+@attr.s(eq=False, order=False, hash=False, frozen=True, repr=True)
 class CantShareEmailValidator(ChangeSetValidator):
     """
     Validates that the new email for the user isn't currently registered by

+ 4 - 4
flaskbb/user/views.py

@@ -38,7 +38,7 @@ impl = HookimplMarker("flaskbb")
 logger = logging.getLogger(__name__)
 
 
-@attr.s(frozen=True, cmp=False, hash=False, repr=True)
+@attr.s(frozen=True, eq=False, order=False, hash=False, repr=True)
 class UserSettings(MethodView):
     form = attr.ib(factory=settings_form_factory)
     settings_update_handler = attr.ib(factory=settings_update_handler)
@@ -73,7 +73,7 @@ class UserSettings(MethodView):
         return redirect(url_for("user.settings"))
 
 
-@attr.s(frozen=True, hash=False, cmp=False, repr=True)
+@attr.s(frozen=True, hash=False, eq=False, order=False, repr=True)
 class ChangePassword(MethodView):
     form = attr.ib(factory=change_password_form_factory)
     password_update_handler = attr.ib(factory=password_update_handler)
@@ -107,7 +107,7 @@ class ChangePassword(MethodView):
         return redirect(url_for("user.change_password"))
 
 
-@attr.s(frozen=True, cmp=False, hash=False, repr=True)
+@attr.s(frozen=True, eq=False, order=False, hash=False, repr=True)
 class ChangeEmail(MethodView):
     form = attr.ib(factory=change_email_form_factory)
     update_email_handler = attr.ib(factory=email_update_handler)
@@ -141,7 +141,7 @@ class ChangeEmail(MethodView):
         return redirect(url_for("user.change_email"))
 
 
-@attr.s(frozen=True, repr=True, cmp=False, hash=False)
+@attr.s(frozen=True, repr=True, eq=False, order=False, hash=False)
 class ChangeUserDetails(MethodView):
     form = attr.ib(factory=change_details_form_factory)
     details_update_handler = attr.ib(factory=details_update_factory)

+ 2 - 2
flaskbb/utils/settings.py

@@ -9,12 +9,12 @@
     :copyright: (c) 2014 by the FlaskBB Team.
     :license: BSD, see LICENSE for more details.
 """
-import collections
+from collections.abc import MutableMapping
 
 from flaskbb.management.models import Setting
 
 
-class FlaskBBConfig(collections.MutableMapping):
+class FlaskBBConfig(MutableMapping):
     """Provides a dictionary like interface for interacting with FlaskBB's
     Settings cache.
     """