Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: ['--keep-runtime-typing', '--py39-plus']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
rev: v0.9.1
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
Expand Down
3 changes: 1 addition & 2 deletions flask_lastuser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 11 additions & 13 deletions flask_lastuser/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]


Expand Down Expand Up @@ -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):
Expand All @@ -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:
#
Expand Down