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

Add Mypy? #27

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ verify_ssl = true
check-manifest = ">=0.25"
pre-commit = "*"
pytest-invenio = "*"
pytest-mypy = "*"

[packages]
ic-data-repo = {editable=true, path="./site"}
Expand Down
63 changes: 61 additions & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,20 @@ docstring-convention = "google"
line_length = 88
multi_line_output = 3
include_trailing_comma = true

[tool.mypy]
disallow_any_generics = true
warn_unreachable = true
warn_unused_ignores = true

[[tool.mypy.overrides]]
module = [
"flask_oauthlib.*",
"invenio_app.*",
"invenio_assets.*",
"invenio_oauthclient.*",
]
ignore_missing_imports = true

[tool.pytest.ini_options]
addopts = "--mypy --ignore=site/setup.py"
7 changes: 6 additions & 1 deletion site/ic_data_repo/auth/oauth.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"""Implement OAuth handlers."""

from typing import Any

import jwt
import requests
from flask import current_app
from flask_oauthlib import OAuthRemote


def info_handler(remote_app, response_data):
def info_handler(
remote_app: OAuthRemote, response_data: dict[str, Any]
) -> dict[str, Any]:
"""Extract account info from authorisation response.

Extracts and validates the id_token returned as part of the OIDC workflow using
Expand Down
Loading