Skip to content

Commit

Permalink
Fix typing failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain-S committed May 16, 2024
1 parent 67f360c commit 14a9dca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 2 additions & 4 deletions controller_function/controller/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ def __init__(self) -> None:

def create_access_token(self):
"""Create an access token."""
token_claims = {"sub": "controller-app"}
access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)

expire = datetime.utcnow() + access_token_expires
token_claims.update({"exp": expire})
token_claims = {"sub": "controller-app", "exp": expire}

return jwt.encode(token_claims, self.private_key, algorithm=ALGORITHM)
return jwt.encode(token_claims, self.private_key, algorithm=ALGORITHM) # type: ignore

def __call__(self, r: requests.PreparedRequest) -> requests.PreparedRequest:
"""Attach Authorization Header to a request."""
Expand Down
2 changes: 1 addition & 1 deletion controller_function/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ status=$((status+$?))
echo "Running pylint..."
# shellcheck disable=SC2038
find . -type f -name "*.py" ! \( -path "./.venv/*" \) |
xargs pylint --init-hook='import sys; sys.setrecursionlimit(2000)' --rcfile=tests/pylintrc
xargs pylint --rcfile=tests/pylintrc
status=$((status+$?))

# Run our unit tests with code coverage
Expand Down
5 changes: 5 additions & 0 deletions controller_function/tests/mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
[mypy]
ignore_missing_imports = True
check_untyped_defs = True
plugins = pydantic.mypy

[pydantic-mypy]
init_forbid_extra = True

0 comments on commit 14a9dca

Please sign in to comment.