Activate more mypy checks
This commit is contained in:
parent
298674649d
commit
42cf11044e
@ -205,8 +205,6 @@ class Memo2Parser(JubeatAnalyserParser):
|
|||||||
"offset increase command (r=...) found outside of the file "
|
"offset increase command (r=...) found outside of the file "
|
||||||
"header, this is not supported by jubeatools"
|
"header, this is not supported by jubeatools"
|
||||||
)
|
)
|
||||||
elif self.offset is None:
|
|
||||||
super().do_o(value)
|
|
||||||
else:
|
else:
|
||||||
super().do_r(value)
|
super().do_r(value)
|
||||||
|
|
||||||
@ -264,13 +262,7 @@ class Memo2Parser(JubeatAnalyserParser):
|
|||||||
"Chart contains a pause that's not happening at the "
|
"Chart contains a pause that's not happening at the "
|
||||||
"very first beat, these are not supported by jubeatools"
|
"very first beat, these are not supported by jubeatools"
|
||||||
)
|
)
|
||||||
if self.offset is None:
|
self.offset += event.duration
|
||||||
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)]
|
bar_notes = [e for e in bar if isinstance(e, str)]
|
||||||
line = Memo2ChartLine(raw_line.position, bar_notes)
|
line = Memo2ChartLine(raw_line.position, bar_notes)
|
||||||
|
@ -30,7 +30,7 @@ def dump_and_load(
|
|||||||
filename, contents = list(files.items())[0]
|
filename, contents = list(files.items())[0]
|
||||||
file.write(contents)
|
file.write(contents)
|
||||||
file.seek(0)
|
file.seek(0)
|
||||||
actual_song = load_function(file.name)
|
actual_song = load_function(Path(file.name))
|
||||||
|
|
||||||
assert expected_song == actual_song
|
assert expected_song == actual_song
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
from pathlib import Path
|
||||||
from typing import Any, Callable, Dict, Protocol
|
from typing import Any, Callable, Dict, Protocol
|
||||||
|
|
||||||
from path import Path
|
|
||||||
|
|
||||||
from jubeatools.song import Song
|
from jubeatools.song import Song
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ Hypothesis strategies to generate notes and charts
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from enum import Enum, Flag, auto
|
from enum import Enum, Flag, auto
|
||||||
from itertools import product
|
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
|
import hypothesis.strategies as st
|
||||||
from multidict import MultiDict
|
from multidict import MultiDict
|
||||||
@ -118,7 +118,9 @@ def notes(draw: DrawFunc, options: NoteOption) -> Set[Union[TapNote, LongNote]]:
|
|||||||
if NoteOption.COLLISIONS in options:
|
if NoteOption.COLLISIONS in options:
|
||||||
return raw_notes
|
return raw_notes
|
||||||
else:
|
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()
|
notes: Set[Union[TapNote, LongNote]] = set()
|
||||||
for note in sorted(raw_notes, key=lambda n: (n.time, n.position)):
|
for note in sorted(raw_notes, key=lambda n: (n.time, n.position)):
|
||||||
last_note_time = last_notes[note.position]
|
last_note_time = last_notes[note.position]
|
||||||
|
15
mypy.ini
15
mypy.ini
@ -1,11 +1,20 @@
|
|||||||
[mypy]
|
[mypy]
|
||||||
#disallow_untyped_calls = True
|
disallow_untyped_calls = True
|
||||||
disallow_untyped_defs = True
|
disallow_untyped_defs = True
|
||||||
disallow_incomplete_defs = True
|
disallow_incomplete_defs = True
|
||||||
check_untyped_defs = True
|
check_untyped_defs = True
|
||||||
#disallow_untyped_decorator = True
|
#disallow_untyped_decorators = True
|
||||||
no_implicit_optional = True
|
no_implicit_optional = True
|
||||||
|
warn_redundant_casts = True
|
||||||
warn_unused_ignores = True
|
warn_unused_ignores = True
|
||||||
warn_return_any = 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
|
ignore_missing_imports = True
|
Loading…
Reference in New Issue
Block a user