1
0
mirror of synced 2024-12-04 19:17:55 +01:00

Activate more mypy checks

This commit is contained in:
Stepland 2021-05-02 13:52:07 +02:00
parent 298674649d
commit 42cf11044e
5 changed files with 19 additions and 17 deletions

View File

@ -205,8 +205,6 @@ class Memo2Parser(JubeatAnalyserParser):
"offset increase command (r=...) found outside of the file "
"header, this is not supported by jubeatools"
)
elif self.offset is None:
super().do_o(value)
else:
super().do_r(value)
@ -264,12 +262,6 @@ class Memo2Parser(JubeatAnalyserParser):
"Chart contains a pause that's not happening at the "
"very first beat, these are not supported by jubeatools"
)
if self.offset is None:
self.offset = event.duration
else:
# This could happen if several pauses exist at the first
# beat of the chart or if both an in-bar pause and an
# o=... command exist
self.offset += event.duration
bar_notes = [e for e in bar if isinstance(e, str)]

View File

@ -30,7 +30,7 @@ def dump_and_load(
filename, contents = list(files.items())[0]
file.write(contents)
file.seek(0)
actual_song = load_function(file.name)
actual_song = load_function(Path(file.name))
assert expected_song == actual_song

View File

@ -1,7 +1,6 @@
from pathlib import Path
from typing import Any, Callable, Dict, Protocol
from path import Path
from jubeatools.song import Song

View File

@ -4,7 +4,7 @@ Hypothesis strategies to generate notes and charts
from decimal import Decimal
from enum import Enum, Flag, auto
from itertools import product
from typing import Any, Callable, List, Optional, Set, TypeVar, Union
from typing import Any, Callable, Dict, List, Optional, Set, TypeVar, Union
import hypothesis.strategies as st
from multidict import MultiDict
@ -118,7 +118,9 @@ def notes(draw: DrawFunc, options: NoteOption) -> Set[Union[TapNote, LongNote]]:
if NoteOption.COLLISIONS in options:
return raw_notes
else:
last_notes = {NotePosition(x, y): None for y, x in product(range(4), range(4))}
last_notes: Dict[NotePosition, Optional[BeatsTime]] = {
NotePosition(x, y): None for y, x in product(range(4), range(4))
}
notes: Set[Union[TapNote, LongNote]] = set()
for note in sorted(raw_notes, key=lambda n: (n.time, n.position)):
last_note_time = last_notes[note.position]

View File

@ -1,11 +1,20 @@
[mypy]
#disallow_untyped_calls = True
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
#disallow_untyped_decorator = True
#disallow_untyped_decorators = True
no_implicit_optional = True
warn_redundant_casts = True
warn_unused_ignores = True
warn_return_any = True
warn_redundant_casts = True
warn_unreachable = True
[mypy-constraint]
ignore_missing_imports = True
[mypy-parsimonious.*]
ignore_missing_imports = True
[mypy-sortedcontainers]
ignore_missing_imports = True