Skip to content

Commit

Permalink
Merge pull request #1166 from lsst-sqre/tickets/DM-47716
Browse files Browse the repository at this point in the history
DM-47716: Update for Ruff 0.8.0
  • Loading branch information
rra authored Nov 22, 2024
2 parents e52e7d9 + f92e954 commit fca52c7
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
6 changes: 3 additions & 3 deletions ruff-shared.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ ignore = [
"S607", # using PATH is not a security vulnerability
"SIM102", # sometimes the formatting of nested if statements is clearer
"SIM117", # sometimes nested with contexts are clearer
"TCH001", # we decided to not maintain separate TYPE_CHECKING blocks
"TCH002", # we decided to not maintain separate TYPE_CHECKING blocks
"TCH003", # we decided to not maintain separate TYPE_CHECKING blocks
"TC001", # we decided to not maintain separate TYPE_CHECKING blocks
"TC002", # we decided to not maintain separate TYPE_CHECKING blocks
"TC003", # we decided to not maintain separate TYPE_CHECKING blocks
"TD003", # we don't require issues be created for TODOs
"TID252", # if we're going to use relative imports, use them always
"TRY003", # good general advice but lint is way too aggressive
Expand Down
2 changes: 1 addition & 1 deletion src/gafaelfawr/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
"BaseCache",
"IdCache",
"InternalTokenCache",
"PerUserCache",
"LDAPCache",
"NotebookTokenCache",
"PerUserCache",
"S",
"TokenCache",
"UserLockManager",
Expand Down
2 changes: 1 addition & 1 deletion src/gafaelfawr/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
"HttpsUrl",
"LDAPConfig",
"NotebookQuota",
"OIDCConfig",
"OIDCClient",
"OIDCConfig",
"OIDCServerConfig",
"QuotaConfig",
"QuotaGrant",
Expand Down
10 changes: 5 additions & 5 deletions src/gafaelfawr/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
"CONFIG_PATH",
"COOKIE_NAME",
"CURSOR_REGEX",
"GID_MIN",
"GID_MAX",
"GID_MIN",
"GROUPNAME_REGEX",
"HTTP_TIMEOUT",
"ID_CACHE_SIZE",
"KUBERNETES_WATCH_TIMEOUT",
"KUBERNETES_TIMER_DELAY",
"KUBERNETES_TOKEN_INTERVAL",
"LDAP_CACHE_SIZE",
"KUBERNETES_WATCH_TIMEOUT",
"LDAP_CACHE_LIFETIME",
"LDAP_CACHE_SIZE",
"LDAP_TIMEOUT",
"MINIMUM_LIFETIME",
"NGINX_SNIPPET",
"OIDC_AUTHORIZATION_LIFETIME",
"REDIS_BACKOFF_START",
"REDIS_BACKOFF_MAX",
"REDIS_BACKOFF_START",
"REDIS_POOL_SIZE",
"REDIS_POOL_TIMEOUT",
"REDIS_RETRIES",
"REDIS_TIMEOUT",
"SCOPE_REGEX",
"TOKEN_CACHE_SIZE",
"UID_BOT_MIN",
"UID_BOT_MAX",
"UID_BOT_MIN",
"UID_USER_MIN",
"USERNAME_REGEX",
]
Expand Down
4 changes: 2 additions & 2 deletions src/gafaelfawr/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"GitHubWebError",
"InputValidationError",
"InsufficientScopeError",
"InvalidCSRFError",
"InvalidClientError",
"InvalidClientIdError",
"InvalidCSRFError",
"InvalidCursorError",
"InvalidDelegateToError",
"InvalidExpiresError",
Expand All @@ -49,8 +49,8 @@
"NoScopesError",
"NotConfiguredError",
"NotFoundError",
"OAuthError",
"OAuthBearerError",
"OAuthError",
"OIDCError",
"OIDCNotEnrolledError",
"OIDCWebError",
Expand Down
9 changes: 0 additions & 9 deletions src/gafaelfawr/handlers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
@router.get(
"/auth/api/v1/admins",
dependencies=[Depends(authenticate_admin_read)],
response_model=list[Admin],
summary="List all administrators",
tags=["admin"],
)
Expand Down Expand Up @@ -271,7 +270,6 @@ async def get_admin_token_change_history(
"Used by the JavaScript UI to obtain a CSRF token, user metadata,"
" and server configuration. Not used with regular API calls."
),
response_model=APILoginResponse,
summary="Initialize UI",
tags=["browser"],
)
Expand All @@ -298,7 +296,6 @@ async def get_login(
@router.get(
"/auth/api/v1/token-info",
description="Return metadata about the authentication token",
response_model=TokenInfo,
response_model_exclude_none=True,
responses={404: {"description": "Token not found", "model": ErrorModel}},
summary="Get token details",
Expand Down Expand Up @@ -334,7 +331,6 @@ async def get_token_info(
}
}
},
response_model=NewToken,
status_code=201,
summary="Create a token",
tags=["admin"],
Expand All @@ -359,7 +355,6 @@ async def post_admin_tokens(
@router.get(
"/auth/api/v1/user-info",
description="Get metadata about the autheticated user",
response_model=UserInfo,
response_model_exclude_none=True,
summary="Get user metadata",
tags=["user"],
Expand Down Expand Up @@ -495,7 +490,6 @@ async def get_user_token_change_history(

@router.get(
"/auth/api/v1/users/{username}/tokens",
response_model=list[TokenInfo],
response_model_exclude_none=True,
summary="List tokens",
tags=["user"],
Expand Down Expand Up @@ -531,7 +525,6 @@ async def get_tokens(
}
}
},
response_model=NewToken,
status_code=201,
summary="Create user token",
tags=["user"],
Expand Down Expand Up @@ -569,7 +562,6 @@ async def post_tokens(

@router.get(
"/auth/api/v1/users/{username}/tokens/{key}",
response_model=TokenInfo,
response_model_exclude_none=True,
responses={404: {"description": "Token not found", "model": ErrorModel}},
summary="Get token metadata",
Expand Down Expand Up @@ -655,7 +647,6 @@ async def delete_token(
" own tokens and should instead create a new token and delete the"
" old one."
),
response_model=TokenInfo,
response_model_exclude_none=True,
responses={404: {"description": "Token not found", "model": ErrorModel}},
status_code=200,
Expand Down
1 change: 0 additions & 1 deletion src/gafaelfawr/handlers/cadc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
" be temporary and to be merged into a different route in a future"
" version."
),
response_model=CADCUserInfo,
response_model_exclude_none=True,
responses={
401: {"description": "Unauthenticated"},
Expand Down
2 changes: 0 additions & 2 deletions src/gafaelfawr/handlers/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
" exposed outside the cluster and therefore cannot be used by"
" external clients."
),
response_model=Metadata,
response_model_exclude_none=True,
summary="Application metadata",
tags=["internal"],
Expand All @@ -35,7 +34,6 @@ async def get_index() -> Metadata:
@router.get(
"/health",
description="Perform an internal health check",
response_model=HealthCheck,
summary="Health check",
tags=["internal"],
)
Expand Down
2 changes: 1 addition & 1 deletion src/gafaelfawr/models/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"TokenInfo",
"TokenType",
"TokenUserInfo",
"UserTokenRequest",
"UserTokenModifyRequest",
"UserTokenRequest",
]


Expand Down
2 changes: 1 addition & 1 deletion src/gafaelfawr/operator/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..exceptions import DatabaseSchemaError
from ..factory import Factory

__all__ = ["startup", "shutdown"]
__all__ = ["shutdown", "startup"]


@kopf.on.startup()
Expand Down
2 changes: 1 addition & 1 deletion tests/support/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from gafaelfawr.keypair import RSAKeyPair

__all__ = [
"TEST_KEYPAIR",
"TEST_HOSTNAME",
"TEST_KEYPAIR",
]

TEST_HOSTNAME = "example.com"
Expand Down

0 comments on commit fca52c7

Please sign in to comment.