From 45b53eb686cddc2b3b75f30e6526f7c5d0ce6cec Mon Sep 17 00:00:00 2001 From: Stepland <16676308+Stepland@users.noreply.github.com> Date: Sat, 1 May 2021 13:17:09 +0200 Subject: [PATCH] Fix the subtle bug caused by using Vs as symbols for symbol definitions --- CHANGELOG.md | 7 ++++++- jubeatools/formats/jubeat_analyser/dump_tools.py | 6 ++++-- jubeatools/formats/jubeat_analyser/memo/dump.py | 2 +- jubeatools/formats/jubeat_analyser/memo1/dump.py | 2 +- jubeatools/formats/jubeat_analyser/memo2/dump.py | 2 +- jubeatools/formats/jubeat_analyser/mono_column/dump.py | 2 +- jubeatools/formats/jubeat_analyser/tests/memo/example1.py | 3 ++- jubeatools/formats/jubeat_analyser/tests/memo/test_memo.py | 6 +++--- jubeatools/song.py | 1 + 9 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9fc9c1..ccc3bc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ +# v0.1.2 +## Fixed +- jubeat analyser + - Fix decimal -> fraction conversion to correctly handle numbers with only 3 decimal places #1 + - Remove Vs from the allowed extra symbols lists as it would clash with long note arrows + # v0.1.1 ## Fixed - Loading a #memo2 file that did not specify any offset (neither by `o=...`, `r=...` nor `[...]` commands) would trigger a TypeError, not anymore ! Offset now defaults to zero. - # v0.1.0 - Initial Release \ No newline at end of file diff --git a/jubeatools/formats/jubeat_analyser/dump_tools.py b/jubeatools/formats/jubeat_analyser/dump_tools.py index 205f9d7..e55fa9e 100644 --- a/jubeatools/formats/jubeat_analyser/dump_tools.py +++ b/jubeatools/formats/jubeat_analyser/dump_tools.py @@ -83,9 +83,11 @@ DIFFICULTIES = {"BSC": 1, "ADV": 2, "EXT": 3} # I put a FUCKTON of extra characters just in case some insane chart uses # loads of unusual beat divisions +# The Vs are left out on purpose since they would be mistaken for long note +# arrows DEFAULT_EXTRA_SYMBOLS = ( - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUWXYZ" + "abcdefghijklmnopqrstuwxyz" "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん" "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン" ) diff --git a/jubeatools/formats/jubeat_analyser/memo/dump.py b/jubeatools/formats/jubeat_analyser/memo/dump.py index 895ff1e..9329ac3 100644 --- a/jubeatools/formats/jubeat_analyser/memo/dump.py +++ b/jubeatools/formats/jubeat_analyser/memo/dump.py @@ -13,7 +13,6 @@ from typing import Callable, Dict, Iterator, List, Optional, Set, Tuple, Union, from more_itertools import chunked, collapse, intersperse, mark_ends, windowed from sortedcontainers import SortedKeyList -from jubeatools import __version__ from jubeatools.formats.filetypes import ChartFile, JubeatFile from jubeatools.song import ( BeatsTime, @@ -25,6 +24,7 @@ from jubeatools.song import ( TapNote, Timing, ) +from jubeatools.version import __version__ from ..command import dump_command from ..dump_tools import ( diff --git a/jubeatools/formats/jubeat_analyser/memo1/dump.py b/jubeatools/formats/jubeat_analyser/memo1/dump.py index e457f69..6117f86 100644 --- a/jubeatools/formats/jubeat_analyser/memo1/dump.py +++ b/jubeatools/formats/jubeat_analyser/memo1/dump.py @@ -13,7 +13,6 @@ from typing import Dict, Iterator, List, Optional, Set, Tuple, Union from more_itertools import chunked, collapse, intersperse, mark_ends, windowed from sortedcontainers import SortedKeyList -from jubeatools import __version__ from jubeatools.formats.filetypes import ChartFile, JubeatFile from jubeatools.song import ( BeatsTime, @@ -26,6 +25,7 @@ from jubeatools.song import ( Timing, ) from jubeatools.utils import lcm +from jubeatools.version import __version__ from ..command import dump_command from ..dump_tools import ( diff --git a/jubeatools/formats/jubeat_analyser/memo2/dump.py b/jubeatools/formats/jubeat_analyser/memo2/dump.py index 150fe8e..3a4b68b 100644 --- a/jubeatools/formats/jubeat_analyser/memo2/dump.py +++ b/jubeatools/formats/jubeat_analyser/memo2/dump.py @@ -13,7 +13,6 @@ from typing import Dict, Iterator, List, Optional, Set, Tuple, Union from more_itertools import chunked, collapse, intersperse, mark_ends, windowed from sortedcontainers import SortedKeyList -from jubeatools import __version__ from jubeatools.formats.filetypes import ChartFile, JubeatFile from jubeatools.song import ( BeatsTime, @@ -28,6 +27,7 @@ from jubeatools.song import ( Timing, ) from jubeatools.utils import lcm +from jubeatools.version import __version__ from ..command import dump_command from ..dump_tools import ( diff --git a/jubeatools/formats/jubeat_analyser/mono_column/dump.py b/jubeatools/formats/jubeat_analyser/mono_column/dump.py index 09defb3..a2cac7c 100644 --- a/jubeatools/formats/jubeat_analyser/mono_column/dump.py +++ b/jubeatools/formats/jubeat_analyser/mono_column/dump.py @@ -12,7 +12,6 @@ from typing import Dict, Iterator, List, Mapping, Optional, Tuple from more_itertools import collapse, intersperse, mark_ends, windowed from sortedcontainers import SortedKeyList -from jubeatools import __version__ from jubeatools.formats.filetypes import ChartFile, JubeatFile from jubeatools.song import ( BeatsTime, @@ -24,6 +23,7 @@ from jubeatools.song import ( TapNote, Timing, ) +from jubeatools.version import __version__ from ..dump_tools import ( BEATS_TIME_TO_SYMBOL, diff --git a/jubeatools/formats/jubeat_analyser/tests/memo/example1.py b/jubeatools/formats/jubeat_analyser/tests/memo/example1.py index 3688a0f..0609804 100644 --- a/jubeatools/formats/jubeat_analyser/tests/memo/example1.py +++ b/jubeatools/formats/jubeat_analyser/tests/memo/example1.py @@ -1,6 +1,7 @@ -from jubeatools.song import TapNote, LongNote, NotePosition from fractions import Fraction +from jubeatools.song import LongNote, NotePosition, TapNote + notes = { TapNote(time=Fraction(0, 1), position=NotePosition(x=0, y=0)), TapNote(time=Fraction(0, 1), position=NotePosition(x=0, y=1)), diff --git a/jubeatools/formats/jubeat_analyser/tests/memo/test_memo.py b/jubeatools/formats/jubeat_analyser/tests/memo/test_memo.py index 21a9d7b..1f7cd73 100644 --- a/jubeatools/formats/jubeat_analyser/tests/memo/test_memo.py +++ b/jubeatools/formats/jubeat_analyser/tests/memo/test_memo.py @@ -3,8 +3,10 @@ from fractions import Fraction from pathlib import Path from typing import Set, Union -from hypothesis import given, example +from hypothesis import example, given +from jubeatools.formats.jubeat_analyser.memo.dump import _dump_memo_chart +from jubeatools.formats.jubeat_analyser.memo.load import MemoParser from jubeatools.song import ( BeatsTime, BPMEvent, @@ -18,8 +20,6 @@ from jubeatools.song import ( ) from jubeatools.testutils.strategies import NoteOption from jubeatools.testutils.strategies import notes as notes_strat -from jubeatools.formats.jubeat_analyser.memo.dump import _dump_memo_chart -from jubeatools.formats.jubeat_analyser.memo.load import MemoParser from . import example1 diff --git a/jubeatools/song.py b/jubeatools/song.py index 474be0d..ff29d1b 100644 --- a/jubeatools/song.py +++ b/jubeatools/song.py @@ -7,6 +7,7 @@ Most timing-related info is stored as beat fractions, otherwise a decimal number of seconds is used """ from __future__ import annotations + from collections import UserList, namedtuple from dataclasses import astuple, dataclass, field from decimal import Decimal