diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 262eb09..66a4030 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,18 +2,18 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.19.0 + rev: v3.21.0 hooks: - id: pyupgrade args: ['--keep-runtime-typing', '--py39-plus'] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.1 + rev: v0.14.3 hooks: - id: ruff args: ['--fix', '--exit-non-zero-on-fix'] - id: ruff-format - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer 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: #