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

Fix mypy type checking errors #10

Merged
merged 2 commits into from
Feb 7, 2024
Merged

Conversation

attemoi
Copy link
Contributor

@attemoi attemoi commented Feb 6, 2024

Description

https://jira.lingsoft.fi/browse/SIMPLYE-202 - Enable Mypy type checks for ekirjasto-circulation in Github

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@@ -593,12 +594,14 @@ def create_bearer_token(
# Maybe we should use something custom instead.
iss=provider_name,
)
return jwt.encode(payload, self.bearer_token_signing_secret, algorithm="HS256")
return jwt.encode(
payload, cast(str, self.bearer_token_signing_secret), algorithm="HS256"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cast has been introduced in upstream as well.

@@ -469,10 +476,6 @@ def remote_refresh_token(self, token: str) -> (str, int):
# Do nothing if authentication fails, e.g. token expired.
return INVALID_EKIRJASTO_TOKEN, None
elif response.status_code != 200:
msg = "Got unexpected response code %d. Content: %s" % (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this msg is not referenced anywhere

@@ -311,19 +311,12 @@ def test_secrets(
):
provider = create_provider()

# Secrets are not set, so this will fail.
Copy link
Contributor Author

@attemoi attemoi Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case of secrets not being set are also covered by the other test cases, so removed from here to fix mypy errors.

@attemoi attemoi force-pushed the feature/simplye-202/enable-mypy branch 2 times, most recently from 6ce474b to f47fdd4 Compare February 6, 2024 14:26
@attemoi attemoi force-pushed the feature/simplye-202/enable-mypy branch 3 times, most recently from 83cdc06 to 12005a6 Compare February 7, 2024 06:56
Copy link
Contributor

@ttuovinen ttuovinen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍

@attemoi attemoi merged commit 4cd2607 into main Feb 7, 2024
17 checks passed
@attemoi attemoi deleted the feature/simplye-202/enable-mypy branch February 7, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants