Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Jul 1, 2024
1 parent a50144a commit aa8711f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
1 change: 1 addition & 0 deletions funnel/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Provide configuration for models and import all into a common `models` namespace."""

# pyright: reportUnsupportedDunderAll=false
# ruff: noqa: F811

# The second half of this file is dynamically generated. Run `make initpy` to
# regenerate. Since lazy_loader is opaque to static type checkers, there's an overriding
Expand Down
4 changes: 1 addition & 3 deletions funnel/models/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,7 @@ def is_valid(self) -> bool:
if self.validity == 0:
return True # This token is perpetually valid
now = utcnow()
if self.created_at < now - timedelta(seconds=self.validity):
return False
return True
return not self.created_at < now - timedelta(seconds=self.validity)

@classmethod
def revoke_all_for(cls, account: Account) -> None:
Expand Down
4 changes: 1 addition & 3 deletions funnel/transports/sms/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ def validate_exotel_token(token: str, to: str) -> bool:
def okay_to_message_in_india_right_now() -> bool:
"""Report if it's currently within messaging hours in India (9 AM to 7PM IST)."""
now = utcnow().astimezone(indian_timezone)
if now.hour >= DND_END_HOUR and now.hour < DND_START_HOUR:
return True
return False
return bool(now.hour >= DND_END_HOUR and now.hour < DND_START_HOUR)


def send_via_exotel(
Expand Down
8 changes: 2 additions & 6 deletions funnel/views/account_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ def decorator(func: ValidatorFunc) -> ValidatorFunc:
)
def profile_is_protected(user: Account) -> bool:
"""Block deletion if the user has a protected account."""
if user.is_protected:
return False
return True
return not user.is_protected


@delete_validator(
Expand Down Expand Up @@ -91,9 +89,7 @@ def profile_has_projects(user: Account) -> bool:
)
def user_owns_apps(user: Account) -> bool:
"""Fail if user is the owner of client apps."""
if user.clients:
return False
return True
return not user.clients


# MARK: Delete validator view helper ---------------------------------------------------
Expand Down

0 comments on commit aa8711f

Please sign in to comment.