Skip to content

Commit a7a662c

Browse files
committed
Addressed some typing and linter complaints
1 parent 4d3bda5 commit a7a662c

File tree

8 files changed

+11
-17
lines changed

8 files changed

+11
-17
lines changed

db/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
Float,
4040
Sequence,
4141
Boolean,
42-
DateTime, # type: ignore # Imported for re-export
42+
DateTime, # type: ignore # noqa: F401 # Imported for re-export
4343
UniqueConstraint,
4444
Index,
4545
ForeignKey,

main.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
QUERIES_UTIL_GRAMMAR_DIR,
6464
)
6565

66-
from reynir.version import __version__ as greynir_version
66+
from reynir import __version__ as greynir_version
6767
from tokenizer import __version__ as tokenizer_version
6868

6969

@@ -101,7 +101,7 @@
101101
app.config["CACHE"] = Cache(app, config={"CACHE_TYPE": cache_type})
102102

103103
# Register blueprint routes
104-
from routes import routes, max_age # type: ignore
104+
from routes import routes, max_age # type: ignore # noqa: E402
105105

106106
app.register_blueprint(routes)
107107

@@ -288,8 +288,7 @@ def inject_nn_bools() -> Dict[str, Union[str, bool]]:
288288
except socket_error as e:
289289
if e.errno == errno.EADDRINUSE: # Address already in use
290290
logging.error(
291-
f"Another application is already running at"
292-
" host {Settings.HOST}:{Settings.PORT}"
291+
f"Another application is already running at host {Settings.HOST}:{Settings.PORT}"
293292
)
294293
sys.exit(1)
295294
else:

queries/builtin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
2727
"""
2828

29-
from typing import Callable, Dict, Iterable, Optional, List, Any, Tuple, cast
30-
from typing_extensions import TypedDict
29+
from typing import Callable, Dict, Iterable, Optional, List, Any, Tuple, cast, TypedDict
3130

3231
import math
3332
from datetime import datetime, timezone

queries/flights.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
# TODO: Map country to capital city, e.g. "Svíþjóð" -> "Stokkhólmur"
2727
# TODO: Fetch more than one flight using "flight_count"?
2828

29-
from typing import Any, List, Dict, Optional, cast
30-
from typing_extensions import TypedDict
29+
from typing import Any, List, Dict, Optional, cast, TypedDict
3130

3231
import re
3332
import random

queries/schedules.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
# TODO: Channels provided by Síminn
2828
# TODO: "Rás tveir" vandamál, ætti að vera "Rás tvö"
2929

30-
from typing import List, Dict, Optional, Tuple, Any, cast
31-
from typing_extensions import TypedDict
30+
from typing import List, Dict, Optional, Tuple, Any, cast, TypedDict
3231
from queries import Query, QueryStateDict
3332
from tree import Node, TerminalNode, ParamList, Result
3433

routes/loc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
2222
"""
2323

24-
from typing import Dict, Iterable, List, NamedTuple, Optional, Tuple, Union, cast
25-
from typing_extensions import TypedDict
24+
from typing import Dict, Iterable, List, NamedTuple, Optional, Tuple, Union, cast, TypedDict
2625

2726
from . import routes, better_jsonify, cache, days_from_period_arg
2827

@@ -269,7 +268,7 @@ def staticmap():
269268
lat = float(request.args.get("lat", "0.0"))
270269
lon = float(request.args.get("lon", "0.0"))
271270
zoom = int(request.args.get("z", "7"))
272-
except:
271+
except Exception:
273272
return abort(400)
274273

275274
imgdata = get_staticmap_image(lat, lon, zoom=zoom)

search.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
2727
"""
2828

29-
from typing import Iterable, Iterator, Optional, List, Tuple
30-
from typing_extensions import TypedDict
29+
from typing import Iterable, Iterator, Optional, List, Tuple, TypedDict
3130

3231
from datetime import datetime, timedelta
3332

tnttagger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def tag(self, sentence: List[str]) -> List[Tuple[str, str]]:
434434
_C = self._C
435435

436436
current_state: StateList = [(0.0, [("BOS", False), ("BOS", False)])]
437-
keyfunc: Callable[[Any], float] = lambda x: x[0]
437+
keyfunc: Callable[[Any], float] = lambda x: x[0] # noqa: E731
438438

439439
for index, word in enumerate(sent):
440440

0 commit comments

Comments
 (0)