Skip to content

Commit

Permalink
chore(deps): update dependency dev/mypy to v1.10.0 (#165)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency dev/mypy to v1.10.0

* chore(mypy): cleanup types, remove ignores

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ivan Shcheklein <[email protected]>
  • Loading branch information
renovate[bot] and shcheklein authored May 1, 2024
1 parent 69f3ab4 commit c86e317
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tests = [
dev = [
"dvc-studio-client[tests,docs]",
"types-requests",
"mypy==1.9.0"
"mypy==1.10.0"
]

[tool.setuptools_scm]
Expand Down
20 changes: 11 additions & 9 deletions src/dvc_studio_client/auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from typing import Optional, TypedDict
from typing import Optional, TypedDict, Union
from urllib.parse import urljoin

import requests
Expand Down Expand Up @@ -136,20 +136,22 @@ def start_device_login(
"Starting device login for Studio%s",
f" ({base_url})" if base_url else "",
)
if invalid_scopes := list(
filter(lambda s: s.upper() not in AVAILABLE_SCOPES, scopes), # type: ignore[arg-type,attr-defined]
):
raise InvalidScopesError( # noqa: TRY003
f"Following scopes are not valid: {', '.join(invalid_scopes)}", # type: ignore[arg-type]
)
if scopes:
invalid_scopes: list[str]
if invalid_scopes := list(
filter(lambda s: s.upper() not in AVAILABLE_SCOPES, scopes),
):
raise InvalidScopesError( # noqa: TRY003
f"Following scopes are not valid: {', '.join(invalid_scopes)}",
)

body = {"client_name": client_name}
body: dict[str, Union[str, list[str]]] = {"client_name": client_name}

if token_name:
body["token_name"] = token_name

if scopes:
body["scopes"] = scopes # type: ignore[assignment]
body["scopes"] = scopes

logger.debug(f"JSON body `{body=}`")

Expand Down

0 comments on commit c86e317

Please sign in to comment.