Skip to content

Commit 5cf05de

Browse files
committed
Merge remote-tracking branch 'PeterJCLaw/master' into file-auth-backend
2 parents a0d411c + d062a47 commit 5cf05de

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

code_submitter/auth.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from typing_extensions import TypedDict
2-
3-
import httpx
41
import base64
52
import logging
63
import secrets
74
import binascii
85
from typing import cast, Dict, List, Tuple, Optional, Sequence
6+
from typing_extensions import TypedDict
7+
8+
import httpx
99
from ruamel.yaml import YAML
1010
from starlette.requests import HTTPConnection
1111
from starlette.responses import Response
@@ -109,22 +109,22 @@ def __init__(
109109

110110
async def load_user(self, username: str, password: str) -> NemesisUserInfo:
111111
async with self.client as client:
112-
respone = await client.get(
112+
response = await client.get(
113113
'user/{}'.format(username),
114114
auth=(username, password),
115115
)
116116

117117
try:
118-
respone.raise_for_status()
118+
response.raise_for_status()
119119
except httpx.HTTPError as e:
120-
if e.response.status_code != 403:
120+
if response.status_code != 403:
121121
logger.exception(
122122
"Failed to contact nemesis while trying to authenticate %r",
123123
username,
124124
)
125125
raise AuthenticationError(e) from e
126126

127-
return cast(NemesisUserInfo, respone.json())
127+
return cast(NemesisUserInfo, response.json())
128128

129129
def strip_team(self, team: str) -> str:
130130
# All teams from nemesis *should* start with this prefix...

script/linting/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ flake8-isort
88
flake8-mutable
99
flake8-todo
1010
flake8-tuple
11+
12+
isort>5

setup.cfg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ multi_line_output = 3
2929
order_by_type = False
3030

3131
default_section = THIRDPARTY
32-
known_standard_library = typing_extensions
32+
extra_standard_library = typing_extensions
3333
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
3434

35-
not_skip =
36-
__init__.py,
37-
3835

3936
[mypy]
4037
disallow_any_explicit = True

tests/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from sqlalchemy import create_engine
1010
from alembic.config import Config # type: ignore[import]
1111
from starlette.config import environ
12+
1213
from code_submitter.auth import NemesisUserInfo, DummyNemesisBackend
1314

1415
T = TypeVar('T')

tests/tests_app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import test_utils
77
from starlette.testclient import TestClient
8+
89
from code_submitter.tables import Archive, ChoiceHistory
910

1011

tests/tests_auth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
import test_utils
34
from starlette.requests import Request
45
from starlette.responses import Response, JSONResponse

tests/tests_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime
44

55
import test_utils
6+
67
from code_submitter import utils
78
from code_submitter.tables import Archive, ChoiceHistory
89

0 commit comments

Comments
 (0)