From 4ce20bcf669f48699771f6254531c1e8c4518d87 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:27:19 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- flask_lastuser/__init__.py | 3 +-- flask_lastuser/sqlalchemy.py | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/flask_lastuser/__init__.py b/flask_lastuser/__init__.py index 572af4f..1681011 100644 --- a/flask_lastuser/__init__.py +++ b/flask_lastuser/__init__.py @@ -486,8 +486,7 @@ def permissions(self): return ( current_auth.lastuserinfo is not None and current_auth.lastuserinfo.permissions - or [] - ) + ) or [] def has_permission(self, permission): """Returns True if the current user has the specified permission. diff --git a/flask_lastuser/sqlalchemy.py b/flask_lastuser/sqlalchemy.py index 0587abb..7809c4b 100644 --- a/flask_lastuser/sqlalchemy.py +++ b/flask_lastuser/sqlalchemy.py @@ -34,17 +34,17 @@ from . import UserInfo, UserManagerBase, __, signal_user_looked_up __all__ = [ - 'UserBase', - 'UserBase2', - 'TeamMixin', - 'TeamMembersMixin', - 'TeamBase', - 'TeamBase2', + 'IncompleteUserMigrationError', + 'ProfileBase', 'ProfileMixin', 'ProfileMixin2', - 'ProfileBase', + 'TeamBase', + 'TeamBase2', + 'TeamMembersMixin', + 'TeamMixin', + 'UserBase', + 'UserBase2', 'UserManager', - 'IncompleteUserMigrationError', ] @@ -140,10 +140,8 @@ def timezone(self): # Stored in userinfo since it was introduced later and a new column # will require migrations in downstream apps. return ( - self.userinfo - and self.userinfo.get('timezone') - or current_app.config.get('TIMEZONE') - ) + self.userinfo and self.userinfo.get('timezone') + ) or current_app.config.get('TIMEZONE') @property def oldids(self): @@ -152,7 +150,7 @@ def oldids(self): # will require migrations in downstream apps. Also, this is an array # and will require (a) a joined table, (b) Postgres-specific arrays, or (c) data massaging # by joining with spaces, like "access_scope" above. - return self.userinfo and self.userinfo.get('oldids') or [] + return (self.userinfo and self.userinfo.get('oldids')) or [] # Use cached_property here because pytz.timezone is relatively slow: #