From 3fa4361dcd106026a1687589ccb0bac2e0c9b31b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:28:14 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- funnel/auth.py | 2 +- funnel/cli/lint/__init__.py | 2 +- funnel/cli/periodic/__init__.py | 2 +- funnel/cli/refresh/__init__.py | 2 +- funnel/forms/__init__.py | 18 +++++++++--------- funnel/forms/account.py | 18 +++++++++--------- funnel/forms/auth_client.py | 2 +- funnel/forms/login.py | 6 +++--- funnel/forms/notification.py | 4 ++-- funnel/forms/profile.py | 4 ++-- funnel/forms/project.py | 10 +++++----- funnel/forms/proposal.py | 4 ++-- funnel/geoip.py | 2 +- funnel/models/__init__.py | 18 +++++++++--------- funnel/models/__init__.pyi | 18 +++++++++--------- funnel/models/account.py | 8 ++++---- funnel/models/auth_client.py | 6 +++--- funnel/models/base.py | 24 ++++++++++++------------ funnel/models/email_address.py | 6 +++--- funnel/models/geoname.py | 2 +- funnel/models/helpers.py | 27 +++++++++++++-------------- funnel/models/login_session.py | 4 ++-- funnel/models/mailer.py | 2 +- funnel/models/membership_mixin.py | 4 ++-- funnel/models/notification.py | 14 +++++++------- funnel/models/notification_types.py | 12 ++++++------ funnel/models/phone_number.py | 14 +++++++------- funnel/models/project.py | 2 +- funnel/models/rsvp.py | 2 +- funnel/models/types.py | 20 ++++++++++---------- funnel/models/typing.py | 6 +++--- funnel/models/update.py | 2 +- funnel/models/utils.py | 2 +- funnel/models/video_mixin.py | 2 +- funnel/proxies/request.py | 2 +- funnel/transports/__init__.py | 4 ++-- funnel/transports/sms/send.py | 6 +++--- funnel/typing.py | 10 +++++----- funnel/utils/__init__.py | 2 +- funnel/utils/markdown/base.py | 4 ++-- funnel/utils/markdown/escape.py | 2 +- funnel/utils/misc.py | 8 ++++---- funnel/views/notification.py | 2 +- tests/unit/models/helpers_test.py | 2 +- 44 files changed, 156 insertions(+), 157 deletions(-) diff --git a/funnel/auth.py b/funnel/auth.py index d43f2e3d9..da08def40 100644 --- a/funnel/auth.py +++ b/funnel/auth.py @@ -13,8 +13,8 @@ __all__ = [ 'CurrentAuth', - 'add_auth_attribute', 'add_auth_anchor', + 'add_auth_attribute', 'current_auth', 'request_has_auth', ] diff --git a/funnel/cli/lint/__init__.py b/funnel/cli/lint/__init__.py index 655d4caad..9db3f1505 100644 --- a/funnel/cli/lint/__init__.py +++ b/funnel/cli/lint/__init__.py @@ -10,4 +10,4 @@ app.cli.add_command(lint) -__all__ = ['lint', 'jinja'] +__all__ = ['jinja', 'lint'] diff --git a/funnel/cli/periodic/__init__.py b/funnel/cli/periodic/__init__.py index 767ea880e..6b2bc7bd4 100644 --- a/funnel/cli/periodic/__init__.py +++ b/funnel/cli/periodic/__init__.py @@ -12,4 +12,4 @@ app.cli.add_command(periodic) -__all__ = ['periodic', 'mnrl', 'notification', 'stats'] +__all__ = ['mnrl', 'notification', 'periodic', 'stats'] diff --git a/funnel/cli/refresh/__init__.py b/funnel/cli/refresh/__init__.py index 3221d93d1..068a2593d 100644 --- a/funnel/cli/refresh/__init__.py +++ b/funnel/cli/refresh/__init__.py @@ -10,4 +10,4 @@ app.cli.add_command(refresh) -__all__ = ['refresh', 'markdown'] +__all__ = ['markdown', 'refresh'] diff --git a/funnel/forms/__init__.py b/funnel/forms/__init__.py index b9117ff85..1e2496ef7 100644 --- a/funnel/forms/__init__.py +++ b/funnel/forms/__init__.py @@ -136,6 +136,15 @@ from .venue import VenueForm, VenuePrimaryForm, VenueRoomForm __all__ = [ + "FORM_SCHEMA_PLACEHOLDER", + "MSG_EMAIL_BLOCKED", + "MSG_EMAIL_INVALID", + "MSG_INCORRECT_OTP", + "MSG_INCORRECT_PASSWORD", + "MSG_NO_ACCOUNT", + "MSG_NO_LOGIN_SESSION", + "MSG_PHONE_BLOCKED", + "MSG_PHONE_NO_SMS", "AccountDeleteForm", "AccountForm", "AccountSelectField", @@ -148,7 +157,6 @@ "EmailAddressAvailable", "EmailOtpForm", "EmailPrimaryForm", - "FORM_SCHEMA_PLACEHOLDER", "FollowForm", "LabelForm", "LabelOptionForm", @@ -157,14 +165,6 @@ "LoginPasswordWeakException", "LoginWithOtp", "LogoutForm", - "MSG_EMAIL_BLOCKED", - "MSG_EMAIL_INVALID", - "MSG_INCORRECT_OTP", - "MSG_INCORRECT_PASSWORD", - "MSG_NO_ACCOUNT", - "MSG_NO_LOGIN_SESSION", - "MSG_PHONE_BLOCKED", - "MSG_PHONE_NO_SMS", "ModeratorReportForm", "NewEmailAddressForm", "NewPhoneForm", diff --git a/funnel/forms/account.py b/funnel/forms/account.py index 2fd5da9c6..8040e8ccf 100644 --- a/funnel/forms/account.py +++ b/funnel/forms/account.py @@ -34,23 +34,23 @@ ) __all__ = [ - 'PasswordForm', - 'PasswordCreateForm', - 'PasswordPolicyForm', - 'PasswordResetRequestForm', - 'PasswordResetForm', - 'PasswordChangeForm', - 'AccountForm', 'AccountDeleteForm', - 'UsernameAvailableForm', + 'AccountForm', 'EmailPrimaryForm', 'ModeratorReportForm', 'NewEmailAddressForm', 'NewPhoneForm', + 'PasswordChangeForm', + 'PasswordCreateForm', + 'PasswordForm', + 'PasswordPolicyForm', + 'PasswordResetForm', + 'PasswordResetRequestForm', 'PhonePrimaryForm', + 'UsernameAvailableForm', + 'pwned_password_validator', 'supported_locales', 'timezone_identifiers', - 'pwned_password_validator', ] diff --git a/funnel/forms/auth_client.py b/funnel/forms/auth_client.py index 7b4dab649..6b55c820d 100644 --- a/funnel/forms/auth_client.py +++ b/funnel/forms/auth_client.py @@ -16,8 +16,8 @@ from .helpers import strip_filters __all__ = [ - 'AuthClientForm', 'AuthClientCredentialForm', + 'AuthClientForm', 'AuthClientPermissionEditForm', 'UserPermissionAssignForm', ] diff --git a/funnel/forms/login.py b/funnel/forms/login.py index 767528c18..a1dc9bdd8 100644 --- a/funnel/forms/login.py +++ b/funnel/forms/login.py @@ -32,15 +32,15 @@ ) __all__ = [ + 'EmailOtpForm', + 'LoginForm', 'LoginPasswordResetException', 'LoginPasswordWeakException', 'LoginWithOtp', - 'LoginForm', 'LogoutForm', - 'RegisterWithOtp', 'OtpForm', - 'EmailOtpForm', 'RegisterOtpForm', + 'RegisterWithOtp', ] diff --git a/funnel/forms/notification.py b/funnel/forms/notification.py index c620cf91a..d275c97f3 100644 --- a/funnel/forms/notification.py +++ b/funnel/forms/notification.py @@ -14,9 +14,9 @@ from ..transports import platform_transports __all__ = [ - 'transport_labels', - 'UnsubscribeForm', 'SetNotificationPreferenceForm', + 'UnsubscribeForm', + 'transport_labels', ] diff --git a/funnel/forms/profile.py b/funnel/forms/profile.py index 71610cdc8..b5ffc652d 100644 --- a/funnel/forms/profile.py +++ b/funnel/forms/profile.py @@ -9,11 +9,11 @@ from .organization import OrganizationForm __all__ = [ + 'FollowForm', + 'ProfileBannerForm', 'ProfileForm', 'ProfileLogoForm', - 'ProfileBannerForm', 'ProfileTransitionForm', - 'FollowForm', ] diff --git a/funnel/forms/project.py b/funnel/forms/project.py index e2f812d1e..79f9846b4 100644 --- a/funnel/forms/project.py +++ b/funnel/forms/project.py @@ -21,18 +21,18 @@ __all__ = [ 'CfpForm', + 'ProjectAssignParentForm', + 'ProjectBannerForm', 'ProjectCfpTransitionForm', + 'ProjectFeaturedForm', 'ProjectForm', 'ProjectLivestreamForm', 'ProjectNameForm', - 'ProjectFeaturedForm', - 'ProjectTransitionForm', - 'ProjectBannerForm', + 'ProjectRegisterForm', 'ProjectSponsorForm', + 'ProjectTransitionForm', 'RsvpTransitionForm', 'SavedProjectForm', - 'ProjectRegisterForm', - 'ProjectAssignParentForm', ] double_quote_re = re.compile(r'["“”]') diff --git a/funnel/forms/proposal.py b/funnel/forms/proposal.py index a0c46c07b..449c703db 100644 --- a/funnel/forms/proposal.py +++ b/funnel/forms/proposal.py @@ -9,13 +9,13 @@ from .helpers import nullable_strip_filters, video_url_validator __all__ = [ - 'ProposalForm', 'ProposalFeaturedForm', + 'ProposalForm', 'ProposalLabelsAdminForm', 'ProposalLabelsForm', + 'ProposalMemberForm', 'ProposalMoveForm', 'ProposalTransitionForm', - 'ProposalMemberForm', ] # FIXME: As labels are user generated content (UGC), these form constructors will diff --git a/funnel/geoip.py b/funnel/geoip.py index 0c15a5854..86dbc63ca 100644 --- a/funnel/geoip.py +++ b/funnel/geoip.py @@ -8,7 +8,7 @@ from geoip2.errors import AddressNotFoundError, GeoIP2Error from geoip2.models import ASN, City -__all__ = ['GeoIP', 'geoip', 'GeoIP2Error', 'AddressNotFoundError'] +__all__ = ['AddressNotFoundError', 'GeoIP', 'GeoIP2Error', 'geoip'] @dataclass diff --git a/funnel/models/__init__.py b/funnel/models/__init__.py index 773fe8e6b..34f9567b2 100644 --- a/funnel/models/__init__.py +++ b/funnel/models/__init__.py @@ -18,6 +18,15 @@ __all__ = [ "ACCOUNT_STATE", + "EMAIL_DELIVERY_STATE", + "LOGIN_SESSION_VALIDITY_PERIOD", + "MODERATOR_REPORT_TYPE", + "PASSWORD_MAX_LENGTH", + "PASSWORD_MIN_LENGTH", + "PROPOSAL_STATE", + "RESERVED_NAMES", + "RSVP_STATUS", + "VISIBILITY_STATE", "Account", "AccountAdminNotification", "AccountAdminRevokedNotification", @@ -57,7 +66,6 @@ "Draft", "DuckTypeAccount", "DynamicMapped", - "EMAIL_DELIVERY_STATE", "EmailAddress", "EmailAddressBlockedError", "EmailAddressError", @@ -73,7 +81,6 @@ "ImgeeType", "IncompleteUserMigrationError", "IntTitle", - "LOGIN_SESSION_VALIDITY_PERIOD", "Label", "LocaleType", "LoginSession", @@ -81,7 +88,6 @@ "LoginSessionExpiredError", "LoginSessionInactiveUserError", "LoginSessionRevokedError", - "MODERATOR_REPORT_TYPE", "Mailer", "MailerDraft", "MailerRecipient", @@ -114,9 +120,6 @@ "OptionalEmailAddressMixin", "OptionalPhoneNumberMixin", "Organization", - "PASSWORD_MAX_LENGTH", - "PASSWORD_MIN_LENGTH", - "PROPOSAL_STATE", "PhoneNumber", "PhoneNumberBlockedError", "PhoneNumberError", @@ -146,8 +149,6 @@ "ProposalSuuidRedirect", "Query", "QueryProperty", - "RESERVED_NAMES", - "RSVP_STATUS", "RegistrationCancellationNotification", "RegistrationConfirmationNotification", "RegistryMixin", @@ -176,7 +177,6 @@ "UrlType", "User", "UuidMixin", - "VISIBILITY_STATE", "Venue", "VenueRoom", "VideoError", diff --git a/funnel/models/__init__.pyi b/funnel/models/__init__.pyi index f9bd501d5..834db9b05 100644 --- a/funnel/models/__init__.pyi +++ b/funnel/models/__init__.pyi @@ -247,6 +247,15 @@ from .video_mixin import VideoError, VideoMixin, parse_video_url __all__ = [ "ACCOUNT_STATE", + "EMAIL_DELIVERY_STATE", + "LOGIN_SESSION_VALIDITY_PERIOD", + "MODERATOR_REPORT_TYPE", + "PASSWORD_MAX_LENGTH", + "PASSWORD_MIN_LENGTH", + "PROPOSAL_STATE", + "RESERVED_NAMES", + "RSVP_STATUS", + "VISIBILITY_STATE", "Account", "AccountAdminNotification", "AccountAdminRevokedNotification", @@ -286,7 +295,6 @@ __all__ = [ "Draft", "DuckTypeAccount", "DynamicMapped", - "EMAIL_DELIVERY_STATE", "EmailAddress", "EmailAddressBlockedError", "EmailAddressError", @@ -302,7 +310,6 @@ __all__ = [ "ImgeeType", "IncompleteUserMigrationError", "IntTitle", - "LOGIN_SESSION_VALIDITY_PERIOD", "Label", "LocaleType", "LoginSession", @@ -310,7 +317,6 @@ __all__ = [ "LoginSessionExpiredError", "LoginSessionInactiveUserError", "LoginSessionRevokedError", - "MODERATOR_REPORT_TYPE", "Mailer", "MailerDraft", "MailerRecipient", @@ -343,9 +349,6 @@ __all__ = [ "OptionalEmailAddressMixin", "OptionalPhoneNumberMixin", "Organization", - "PASSWORD_MAX_LENGTH", - "PASSWORD_MIN_LENGTH", - "PROPOSAL_STATE", "PhoneNumber", "PhoneNumberBlockedError", "PhoneNumberError", @@ -375,8 +378,6 @@ __all__ = [ "ProposalSuuidRedirect", "Query", "QueryProperty", - "RESERVED_NAMES", - "RSVP_STATUS", "RegistrationCancellationNotification", "RegistrationConfirmationNotification", "RegistryMixin", @@ -405,7 +406,6 @@ __all__ = [ "UrlType", "User", "UuidMixin", - "VISIBILITY_STATE", "Venue", "VenueRoom", "VideoError", diff --git a/funnel/models/account.py b/funnel/models/account.py index a13fdcf2a..d419537ce 100644 --- a/funnel/models/account.py +++ b/funnel/models/account.py @@ -83,23 +83,23 @@ __all__ = [ 'ACCOUNT_STATE', - 'AccountNameProblem', 'Account', 'AccountEmail', 'AccountEmailClaim', 'AccountExternalId', + 'AccountNameProblem', 'AccountOldId', 'AccountPhone', 'Anchor', 'Community', - 'deleted_account', 'DuckTypeAccount', 'Organization', 'Placeholder', - 'removed_account', 'Team', - 'unknown_account', 'User', + 'deleted_account', + 'removed_account', + 'unknown_account', ] diff --git a/funnel/models/auth_client.py b/funnel/models/auth_client.py index 07331c9eb..93470146c 100644 --- a/funnel/models/auth_client.py +++ b/funnel/models/auth_client.py @@ -36,12 +36,12 @@ from .login_session import LoginSession, auth_client_login_session __all__ = [ - 'AuthCode', - 'AuthToken', 'AuthClient', 'AuthClientCredential', - 'AuthClientTeamPermissions', 'AuthClientPermissions', + 'AuthClientTeamPermissions', + 'AuthCode', + 'AuthToken', ] diff --git a/funnel/models/base.py b/funnel/models/base.py index fe3e10f0e..26330f7dd 100644 --- a/funnel/models/base.py +++ b/funnel/models/base.py @@ -82,7 +82,6 @@ def _emit_engine_directives( __all__ = [ 'AppenderQuery', - 'backref', 'BaseIdNameMixin', 'BaseMixin', 'BaseNameMixin', @@ -90,31 +89,32 @@ def _emit_engine_directives( 'BaseScopedIdNameMixin', 'BaseScopedNameMixin', 'CoordinatesMixin', - 'db', - 'declarative_mixin', - 'declared_attr', 'DynamicMapped', 'GeonameModel', - 'hybrid_method', - 'hybrid_property', 'LocaleType', 'Mapped', 'Model', 'ModelBase', 'NoIdMixin', - 'postgresql', 'Query', 'QueryProperty', 'RegistryMixin', - 'relationship', 'RoleMixin', - 'sa_exc', - 'sa_orm', - 'sa', + 'TSVectorType', 'TimestampMixin', 'TimezoneType', - 'TSVectorType', 'UrlType', 'UuidMixin', + 'backref', + 'db', + 'declarative_mixin', + 'declared_attr', + 'hybrid_method', + 'hybrid_property', + 'postgresql', + 'relationship', + 'sa', + 'sa_exc', + 'sa_orm', 'with_roles', ] diff --git a/funnel/models/email_address.py b/funnel/models/email_address.py index 056fb95fd..80bbc3b84 100644 --- a/funnel/models/email_address.py +++ b/funnel/models/email_address.py @@ -44,12 +44,12 @@ __all__ = [ 'EMAIL_DELIVERY_STATE', - 'EmailAddressError', + 'EmailAddress', 'EmailAddressBlockedError', + 'EmailAddressError', 'EmailAddressInUseError', - 'EmailAddress', - 'OptionalEmailAddressMixin', 'EmailAddressMixin', + 'OptionalEmailAddressMixin', ] diff --git a/funnel/models/geoname.py b/funnel/models/geoname.py index da7eef54d..6d5380b90 100644 --- a/funnel/models/geoname.py +++ b/funnel/models/geoname.py @@ -26,7 +26,7 @@ ) from .helpers import quote_autocomplete_like -__all__ = ['GeoName', 'GeoCountryInfo', 'GeoAdmin1Code', 'GeoAdmin2Code', 'GeoAltName'] +__all__ = ['GeoAdmin1Code', 'GeoAdmin2Code', 'GeoAltName', 'GeoCountryInfo', 'GeoName'] NOWORDS_RE = re.compile(r'(\W+)', re.UNICODE) diff --git a/funnel/models/helpers.py b/funnel/models/helpers.py index 4ace8bf80..0d08d3d42 100644 --- a/funnel/models/helpers.py +++ b/funnel/models/helpers.py @@ -30,25 +30,25 @@ from .base import Model, UrlType, sa, sa_orm __all__ = [ - 'RESERVED_NAMES', - 'PASSWORD_MIN_LENGTH', 'PASSWORD_MAX_LENGTH', - 'IntTitle', - 'check_password_strength', - 'profanity', - 'add_to_class', - 'add_search_trigger', - 'visual_field_delimiter', - 'valid_name', - 'valid_account_name', - 'quote_autocomplete_like', - 'quote_autocomplete_tsquery', + 'PASSWORD_MIN_LENGTH', + 'RESERVED_NAMES', 'ImgeeFurl', 'ImgeeType', + 'IntTitle', 'MarkdownCompositeBase', 'MarkdownCompositeBasic', 'MarkdownCompositeDocument', 'MarkdownCompositeInline', + 'add_search_trigger', + 'add_to_class', + 'check_password_strength', + 'profanity', + 'quote_autocomplete_like', + 'quote_autocomplete_tsquery', + 'valid_account_name', + 'valid_name', + 'visual_field_delimiter', ] RESERVED_NAMES: set[str] = { @@ -697,8 +697,7 @@ def __eq__(self, other: object) -> bool: return ( isinstance(other, self.__class__) and (self.__composite_values__() == other.__composite_values__()) - or self._text == other - ) + ) or self._text == other def __ne__(self, other: object) -> bool: """Compare for inequality.""" diff --git a/funnel/models/login_session.py b/funnel/models/login_session.py index 885658821..4e9d03cf5 100644 --- a/funnel/models/login_session.py +++ b/funnel/models/login_session.py @@ -22,13 +22,13 @@ ) __all__ = [ + 'LOGIN_SESSION_VALIDITY_PERIOD', 'LoginSession', 'LoginSessionError', 'LoginSessionExpiredError', - 'LoginSessionRevokedError', 'LoginSessionInactiveUserError', + 'LoginSessionRevokedError', 'auth_client_login_session', - 'LOGIN_SESSION_VALIDITY_PERIOD', ] diff --git a/funnel/models/mailer.py b/funnel/models/mailer.py index 3d87c9ce7..588af54d2 100644 --- a/funnel/models/mailer.py +++ b/funnel/models/mailer.py @@ -35,10 +35,10 @@ from .helpers import IntTitle __all__ = [ - 'MailerState', 'Mailer', 'MailerDraft', 'MailerRecipient', + 'MailerState', ] NAMESPLIT_RE = re.compile(r'[\W\.]+') diff --git a/funnel/models/membership_mixin.py b/funnel/models/membership_mixin.py index 85f0f6ce5..598a2f4f7 100644 --- a/funnel/models/membership_mixin.py +++ b/funnel/models/membership_mixin.py @@ -34,10 +34,10 @@ # Export only symbols needed in views. __all__ = [ - 'MembershipRecordTypeEnum', 'MembershipError', - 'MembershipRevokedError', + 'MembershipRecordTypeEnum', 'MembershipRecordTypeError', + 'MembershipRevokedError', ] # MARK: Typing ------------------------------------------------------------------------- diff --git a/funnel/models/notification.py b/funnel/models/notification.py index cc72ffcc7..98710fb43 100644 --- a/funnel/models/notification.py +++ b/funnel/models/notification.py @@ -139,15 +139,15 @@ from .typing import ModelUuidProtocol __all__ = [ - 'SmsStatusEnum', - 'notification_categories', - 'SmsMessage', - 'NotificationType', 'Notification', - 'PreviewNotification', + 'NotificationFor', 'NotificationPreferences', 'NotificationRecipient', - 'NotificationFor', + 'NotificationType', + 'PreviewNotification', + 'SmsMessage', + 'SmsStatusEnum', + 'notification_categories', 'notification_type_registry', 'notification_web_types', ] @@ -795,7 +795,7 @@ def is_not_deleted(self, revoke: bool = False) -> bool: is missing """ with suppress(NoResultFound): - return bool(self.fragment and self.document or self.document) + return bool((self.fragment and self.document) or self.document) if revoke: self.is_revoked = True # Do not set `self.rollupid` because this is not a rollup diff --git a/funnel/models/notification_types.py b/funnel/models/notification_types.py index a3a501539..23170a488 100644 --- a/funnel/models/notification_types.py +++ b/funnel/models/notification_types.py @@ -22,21 +22,21 @@ from .update import Update __all__ = [ + 'AccountAdminNotification', + 'AccountAdminRevokedNotification', 'AccountPasswordNotification', - 'ProjectUpdateNotification', - 'CommentReportReceivedNotification', 'CommentReplyNotification', + 'CommentReportReceivedNotification', 'NewCommentNotification', 'ProjectCrewNotification', 'ProjectCrewRevokedNotification', + 'ProjectStartingNotification', + 'ProjectTomorrowNotification', + 'ProjectUpdateNotification', 'ProposalReceivedNotification', 'ProposalSubmittedNotification', 'RegistrationCancellationNotification', 'RegistrationConfirmationNotification', - 'ProjectStartingNotification', - 'ProjectTomorrowNotification', - 'AccountAdminNotification', - 'AccountAdminRevokedNotification', ] # MARK: Protocol and Mixin classes ----------------------------------------------------- diff --git a/funnel/models/phone_number.py b/funnel/models/phone_number.py index f59cc08c4..508291513 100644 --- a/funnel/models/phone_number.py +++ b/funnel/models/phone_number.py @@ -34,17 +34,17 @@ ) __all__ = [ - 'PhoneNumberError', - 'PhoneNumberInvalidError', + 'OptionalPhoneNumberMixin', + 'PhoneNumber', 'PhoneNumberBlockedError', + 'PhoneNumberError', 'PhoneNumberInUseError', - 'parse_phone_number', - 'validate_phone_number', + 'PhoneNumberInvalidError', + 'PhoneNumberMixin', 'canonical_phone_number', + 'parse_phone_number', 'phone_blake2b160_hash', - 'PhoneNumber', - 'OptionalPhoneNumberMixin', - 'PhoneNumberMixin', + 'validate_phone_number', ] # MARK: Enums and constants ------------------------------------------------------------ diff --git a/funnel/models/project.py b/funnel/models/project.py index 26a5578e1..7b68199b6 100644 --- a/funnel/models/project.py +++ b/funnel/models/project.py @@ -58,7 +58,7 @@ visual_field_delimiter, ) -__all__ = ['ProjectRsvpStateEnum', 'Project', 'ProjectLocation', 'ProjectRedirect'] +__all__ = ['Project', 'ProjectLocation', 'ProjectRedirect', 'ProjectRsvpStateEnum'] # MARK: Constants ------------------------------------------------------------- diff --git a/funnel/models/rsvp.py b/funnel/models/rsvp.py index 30e51e7d4..4dca60897 100644 --- a/funnel/models/rsvp.py +++ b/funnel/models/rsvp.py @@ -28,7 +28,7 @@ from .project import Project from .project_membership import project_child_role_map -__all__ = ['RSVP_STATUS', 'RsvpStateEnum', 'Rsvp'] +__all__ = ['RSVP_STATUS', 'Rsvp', 'RsvpStateEnum'] class RSVP_STATUS(LabeledEnum): # noqa: N801 diff --git a/funnel/models/types.py b/funnel/models/types.py index 66ba382d8..ce327799d 100644 --- a/funnel/models/types.py +++ b/funnel/models/types.py @@ -18,20 +18,20 @@ ) __all__ = [ - 'int_pkey', - 'uuid4_pkey', - 'bigint', - 'smallint', - 'timestamp', - 'timestamp_now', - 'Unicode', - 'Text', - 'Jsonb', - 'JsonbDict', 'Char2', 'Char3', + 'Jsonb', + 'JsonbDict', 'Str3', 'Str16', + 'Text', + 'Unicode', + 'bigint', + 'int_pkey', + 'smallint', + 'timestamp', + 'timestamp_now', + 'uuid4_pkey', ] Unicode: TypeAlias = Annotated[str, mapped_column(sa.Unicode())] diff --git a/funnel/models/typing.py b/funnel/models/typing.py index 8ac7fdc27..7043148d4 100644 --- a/funnel/models/typing.py +++ b/funnel/models/typing.py @@ -14,13 +14,13 @@ from coaster.utils import InspectableSet __all__ = [ + 'ModelIdProtocol', 'ModelProtocol', + 'ModelRoleProtocol', + 'ModelSearchProtocol', 'ModelTimestampProtocol', 'ModelUrlProtocol', - 'ModelRoleProtocol', - 'ModelIdProtocol', 'ModelUuidProtocol', - 'ModelSearchProtocol', ] diff --git a/funnel/models/update.py b/funnel/models/update.py index 66427ebef..bbfa9022c 100644 --- a/funnel/models/update.py +++ b/funnel/models/update.py @@ -31,7 +31,7 @@ ) from .project import Project -__all__ = ['Update', 'VISIBILITY_STATE'] +__all__ = ['VISIBILITY_STATE', 'Update'] class UPDATE_STATE(LabeledEnum): # noqa: N801 diff --git a/funnel/models/utils.py b/funnel/models/utils.py index 8a77ddda1..9e708193b 100644 --- a/funnel/models/utils.py +++ b/funnel/models/utils.py @@ -23,8 +23,8 @@ from .typing import ModelIdProtocol __all__ = [ - 'IncompleteUserMigrationError', 'AccountAndAnchor', + 'IncompleteUserMigrationError', 'getextid', 'getuser', 'merge_accounts', diff --git a/funnel/models/video_mixin.py b/funnel/models/video_mixin.py index 729716456..611eac3a6 100644 --- a/funnel/models/video_mixin.py +++ b/funnel/models/video_mixin.py @@ -6,7 +6,7 @@ from .base import Mapped, declarative_mixin, sa, sa_orm -__all__ = ['VideoMixin', 'VideoError', 'parse_video_url'] +__all__ = ['VideoError', 'VideoMixin', 'parse_video_url'] class VideoError(Exception): diff --git a/funnel/proxies/request.py b/funnel/proxies/request.py index 16158269f..cea747939 100644 --- a/funnel/proxies/request.py +++ b/funnel/proxies/request.py @@ -13,7 +13,7 @@ from ..typing import ResponseType, T -__all__ = ['request_wants', 'RequestWants'] +__all__ = ['RequestWants', 'request_wants'] RequestWantsType = TypeVar('RequestWantsType', bound='RequestWants') diff --git a/funnel/transports/__init__.py b/funnel/transports/__init__.py index 311c30ea8..2f8b77b04 100644 --- a/funnel/transports/__init__.py +++ b/funnel/transports/__init__.py @@ -13,13 +13,13 @@ ) __all__ = [ - 'TransportError', 'TransportConnectionError', + 'TransportError', 'TransportRecipientError', 'TransportTransactionError', + 'email', 'init', 'platform_transports', - 'email', 'sms', 'telegram', 'webpush', diff --git a/funnel/transports/sms/send.py b/funnel/transports/sms/send.py index fdb25435b..348a0faf8 100644 --- a/funnel/transports/sms/send.py +++ b/funnel/transports/sms/send.py @@ -28,12 +28,12 @@ from .template import SmsPriority, SmsTemplate __all__ = [ + 'init', 'make_exotel_token', - 'validate_exotel_token', + 'send_sms', 'send_via_exotel', 'send_via_twilio', - 'send_sms', - 'init', + 'validate_exotel_token', ] DND_END_HOUR = 9 diff --git a/funnel/typing.py b/funnel/typing.py index 4e0aced06..364319c42 100644 --- a/funnel/typing.py +++ b/funnel/typing.py @@ -10,15 +10,15 @@ from coaster.views import ReturnRenderWith __all__ = [ - 'T', - 'T_co', - 'P', 'OptionalMigratedTables', + 'P', + 'ResponseReturnValue', + 'ResponseType', 'ReturnRenderWith', 'ReturnResponse', 'ReturnView', - 'ResponseType', - 'ResponseReturnValue', + 'T', + 'T_co', ] #: Type used to indicate type continuity within a block of code diff --git a/funnel/utils/__init__.py b/funnel/utils/__init__.py index 6868353a7..93b480fcd 100644 --- a/funnel/utils/__init__.py +++ b/funnel/utils/__init__.py @@ -33,12 +33,12 @@ from .mustache import mustache_html, mustache_md __all__ = [ + "TIMEDELTA_1DAY", "DictCache", "JinjaTemplateBase", "MarkdownConfig", "MarkdownPlugin", "MarkdownString", - "TIMEDELTA_1DAY", "abort_null", "blake2b160_hex", "cache", diff --git a/funnel/utils/markdown/base.py b/funnel/utils/markdown/base.py index c37611f28..7d4fda55e 100644 --- a/funnel/utils/markdown/base.py +++ b/funnel/utils/markdown/base.py @@ -38,12 +38,12 @@ from .tabs import render_tab __all__ = [ - 'MarkdownPlugin', 'MarkdownConfig', + 'MarkdownPlugin', 'markdown_basic', 'markdown_document', - 'markdown_mailer', 'markdown_inline', + 'markdown_mailer', ] diff --git a/funnel/utils/markdown/escape.py b/funnel/utils/markdown/escape.py index 27a760086..772fb4ae4 100644 --- a/funnel/utils/markdown/escape.py +++ b/funnel/utils/markdown/escape.py @@ -62,7 +62,7 @@ def format_field(self, value: Any, format_spec: str) -> str: class _MarkdownEscapeHelper: """Helper for :meth:`MarkdownString.__mod__`.""" - __slots__ = ('obj', 'escape') + __slots__ = ('escape', 'obj') def __init__(self, obj: Any, escape: Callable[[Any], MarkdownString]) -> None: self.obj = obj diff --git a/funnel/utils/misc.py b/funnel/utils/misc.py index 96fe4797c..651dc1775 100644 --- a/funnel/utils/misc.py +++ b/funnel/utils/misc.py @@ -15,15 +15,15 @@ __all__ = [ 'TIMEDELTA_1DAY', - 'blake2b160_hex', 'abort_null', + 'blake2b160_hex', + 'extract_twitter_handle', + 'format_twitter_handle', + 'make_qrcode', 'make_redirect_url', 'mask_email', 'mask_phone', - 'extract_twitter_handle', - 'format_twitter_handle', 'split_name', - 'make_qrcode', ] TIMEDELTA_1DAY = timedelta(days=1) diff --git a/funnel/views/notification.py b/funnel/views/notification.py index 3dfaf3432..a3ef18292 100644 --- a/funnel/views/notification.py +++ b/funnel/views/notification.py @@ -38,8 +38,8 @@ from .jobs import rqjob __all__ = [ - 'DecisionFactorBase', 'DecisionBranchBase', + 'DecisionFactorBase', 'RenderNotification', 'dispatch_notification', ] diff --git a/tests/unit/models/helpers_test.py b/tests/unit/models/helpers_test.py index a2625f92a..043b121a0 100644 --- a/tests/unit/models/helpers_test.py +++ b/tests/unit/models/helpers_test.py @@ -131,7 +131,7 @@ class HasMetaclass(metaclass=TestMetaclass): # pylint: disable=unused-variable @mhelpers.reopen(OriginalClass) class HasSlots: # pylint: disable=unused-variable - __slots__ = ['spam', 'eggs'] + __slots__ = ['eggs', 'spam'] def test_add_to_class() -> None: