From bfd0dffa8573c767721da454b199c5cb2bca402d Mon Sep 17 00:00:00 2001 From: Stepland <16676308+Stepland@users.noreply.github.com> Date: Sun, 9 May 2021 16:29:40 +0200 Subject: [PATCH] Code style ... --- jubeatools/formats/eve/tests/test_timemap.py | 2 +- jubeatools/formats/filetypes.py | 1 - jubeatools/formats/jubeat_analyser/dump_tools.py | 13 ++++++++----- jubeatools/formats/jubeat_analyser/memo/dump.py | 4 +--- jubeatools/formats/jubeat_analyser/memo/load.py | 2 +- jubeatools/formats/jubeat_analyser/memo1/dump.py | 4 +--- jubeatools/formats/jubeat_analyser/memo1/load.py | 2 +- jubeatools/formats/jubeat_analyser/memo2/dump.py | 4 +--- jubeatools/formats/jubeat_analyser/memo2/load.py | 2 +- .../formats/jubeat_analyser/mono_column/dump.py | 9 +++++---- .../formats/jubeat_analyser/mono_column/load.py | 2 +- jubeatools/formats/jubeat_analyser/typing.py | 2 +- jubeatools/formats/typing.py | 4 ++-- jubeatools/testutils/strategies.py | 2 +- jubeatools/utils.py | 4 ++-- 15 files changed, 27 insertions(+), 30 deletions(-) diff --git a/jubeatools/formats/eve/tests/test_timemap.py b/jubeatools/formats/eve/tests/test_timemap.py index 18a5620..e89a48f 100644 --- a/jubeatools/formats/eve/tests/test_timemap.py +++ b/jubeatools/formats/eve/tests/test_timemap.py @@ -5,7 +5,7 @@ from hypothesis import given from jubeatools import song from jubeatools.formats.eve.timemap import TimeMap from jubeatools.testutils import strategies as jbst -from jubeatools.utils import fraction_to_decimal, group_by +from jubeatools.utils import group_by @given(jbst.timing_info(bpm_changes=True), jbst.beat_time()) diff --git a/jubeatools/formats/filetypes.py b/jubeatools/formats/filetypes.py index 87eb76a..cbd10a4 100644 --- a/jubeatools/formats/filetypes.py +++ b/jubeatools/formats/filetypes.py @@ -1,5 +1,4 @@ from dataclasses import dataclass -from io import StringIO from jubeatools.song import Chart, Song diff --git a/jubeatools/formats/jubeat_analyser/dump_tools.py b/jubeatools/formats/jubeat_analyser/dump_tools.py index 8bb00dd..e9a45f9 100644 --- a/jubeatools/formats/jubeat_analyser/dump_tools.py +++ b/jubeatools/formats/jubeat_analyser/dump_tools.py @@ -22,21 +22,22 @@ from typing import ( from more_itertools import windowed from sortedcontainers import SortedDict, SortedKeyList -from jubeatools.formats.adapters import make_dumper_from_chart_file_dumper +from jubeatools.formats.dump_tools import ( + DIFFICULTY_NUMBER, + make_dumper_from_chart_file_dumper, +) from jubeatools.formats.filetypes import ChartFile from jubeatools.formats.typing import Dumper -from jubeatools.formats.dump_tools import DIFFICULTY_NUMBER from jubeatools.song import ( BeatsTime, Chart, + Direction, LongNote, Metadata, NotePosition, Song, TapNote, Timing, - Direction, - Difficulty, ) from jubeatools.utils import fraction_to_decimal @@ -263,7 +264,9 @@ def create_sections_from_chart( return sections -def make_full_dumper_from_jubeat_analyser_chart_dumper(chart_dumper: JubeatAnalyserChartDumper) -> Dumper: +def make_full_dumper_from_jubeat_analyser_chart_dumper( + chart_dumper: JubeatAnalyserChartDumper, +) -> Dumper: """Factory function to create a fully fledged song dumper from the internal chart dumper of jubeat analyser formats""" diff --git a/jubeatools/formats/jubeat_analyser/memo/dump.py b/jubeatools/formats/jubeat_analyser/memo/dump.py index d6299a4..c375d22 100644 --- a/jubeatools/formats/jubeat_analyser/memo/dump.py +++ b/jubeatools/formats/jubeat_analyser/memo/dump.py @@ -4,18 +4,16 @@ from fractions import Fraction from io import StringIO from itertools import zip_longest from math import ceil -from typing import Dict, Iterator, List, Union, Any +from typing import Dict, Iterator, List, Union from more_itertools import chunked, collapse, intersperse, mark_ends, windowed -from jubeatools.formats.filetypes import ChartFile from jubeatools.song import ( BeatsTime, Chart, LongNote, Metadata, NotePosition, - Song, TapNote, Timing, ) diff --git a/jubeatools/formats/jubeat_analyser/memo/load.py b/jubeatools/formats/jubeat_analyser/memo/load.py index 16163d3..4f05d28 100644 --- a/jubeatools/formats/jubeat_analyser/memo/load.py +++ b/jubeatools/formats/jubeat_analyser/memo/load.py @@ -24,7 +24,6 @@ from jubeatools.song import ( from jubeatools.utils import none_or from ..command import is_command, parse_command -from ..files import load_folder from ..load_tools import ( CIRCLE_FREE_TO_NOTE_SYMBOL, EMPTY_BEAT_SYMBOLS, @@ -35,6 +34,7 @@ from ..load_tools import ( find_long_note_candidates, is_double_column_chart_line, is_empty_line, + load_folder, parse_double_column_chart_line, pick_correct_long_note_candidates, ) diff --git a/jubeatools/formats/jubeat_analyser/memo1/dump.py b/jubeatools/formats/jubeat_analyser/memo1/dump.py index ecd0f3a..9b3ddfd 100644 --- a/jubeatools/formats/jubeat_analyser/memo1/dump.py +++ b/jubeatools/formats/jubeat_analyser/memo1/dump.py @@ -4,18 +4,16 @@ from fractions import Fraction from io import StringIO from itertools import zip_longest from math import ceil -from typing import Dict, Iterator, List, Union, Any +from typing import Dict, Iterator, List, Union from more_itertools import collapse, intersperse, mark_ends, windowed -from jubeatools.formats.filetypes import ChartFile from jubeatools.song import ( BeatsTime, Chart, LongNote, Metadata, NotePosition, - Song, TapNote, Timing, ) diff --git a/jubeatools/formats/jubeat_analyser/memo1/load.py b/jubeatools/formats/jubeat_analyser/memo1/load.py index 74093a2..f9bf027 100644 --- a/jubeatools/formats/jubeat_analyser/memo1/load.py +++ b/jubeatools/formats/jubeat_analyser/memo1/load.py @@ -23,7 +23,6 @@ from jubeatools.song import ( from jubeatools.utils import none_or from ..command import is_command, parse_command -from ..files import load_folder from ..load_tools import ( CIRCLE_FREE_TO_NOTE_SYMBOL, EMPTY_BEAT_SYMBOLS, @@ -34,6 +33,7 @@ from ..load_tools import ( find_long_note_candidates, is_double_column_chart_line, is_empty_line, + load_folder, parse_double_column_chart_line, pick_correct_long_note_candidates, ) diff --git a/jubeatools/formats/jubeat_analyser/memo2/dump.py b/jubeatools/formats/jubeat_analyser/memo2/dump.py index b4b3de1..d28730c 100644 --- a/jubeatools/formats/jubeat_analyser/memo2/dump.py +++ b/jubeatools/formats/jubeat_analyser/memo2/dump.py @@ -4,12 +4,11 @@ from decimal import Decimal from fractions import Fraction from io import StringIO from itertools import chain, zip_longest -from typing import Dict, Iterator, List, Optional, Union, Any +from typing import Dict, Iterator, List, Optional, Union from more_itertools import collapse, intersperse, mark_ends, windowed from sortedcontainers import SortedKeyList -from jubeatools.formats.filetypes import ChartFile from jubeatools.song import ( BeatsTime, BPMEvent, @@ -18,7 +17,6 @@ from jubeatools.song import ( Metadata, NotePosition, SecondsTime, - Song, TapNote, Timing, ) diff --git a/jubeatools/formats/jubeat_analyser/memo2/load.py b/jubeatools/formats/jubeat_analyser/memo2/load.py index b93e8c7..7e69162 100644 --- a/jubeatools/formats/jubeat_analyser/memo2/load.py +++ b/jubeatools/formats/jubeat_analyser/memo2/load.py @@ -24,7 +24,6 @@ from jubeatools.song import ( from jubeatools.utils import none_or from ..command import is_command, parse_command -from ..files import load_folder from ..load_tools import ( CIRCLE_FREE_TO_NOTE_SYMBOL, EMPTY_BEAT_SYMBOLS, @@ -32,6 +31,7 @@ from ..load_tools import ( UnfinishedLongNote, find_long_note_candidates, is_empty_line, + load_folder, pick_correct_long_note_candidates, ) from ..symbols import CIRCLE_FREE_SYMBOLS diff --git a/jubeatools/formats/jubeat_analyser/mono_column/dump.py b/jubeatools/formats/jubeat_analyser/mono_column/dump.py index 56c5eef..b3d01c4 100644 --- a/jubeatools/formats/jubeat_analyser/mono_column/dump.py +++ b/jubeatools/formats/jubeat_analyser/mono_column/dump.py @@ -1,17 +1,15 @@ from copy import deepcopy from io import StringIO -from typing import Dict, Iterator, List, Any +from typing import Dict, Iterator, List from more_itertools import collapse, intersperse, mark_ends -from jubeatools.formats.filetypes import ChartFile from jubeatools.song import ( BeatsTime, Chart, LongNote, Metadata, NotePosition, - Song, TapNote, Timing, ) @@ -151,4 +149,7 @@ def _dump_mono_column_chart( return file -dump_mono_column = make_full_dumper_from_jubeat_analyser_chart_dumper(_dump_mono_column_chart) + +dump_mono_column = make_full_dumper_from_jubeat_analyser_chart_dumper( + _dump_mono_column_chart +) diff --git a/jubeatools/formats/jubeat_analyser/mono_column/load.py b/jubeatools/formats/jubeat_analyser/mono_column/load.py index 1853b7b..7f3279f 100644 --- a/jubeatools/formats/jubeat_analyser/mono_column/load.py +++ b/jubeatools/formats/jubeat_analyser/mono_column/load.py @@ -24,7 +24,6 @@ from jubeatools.song import ( from jubeatools.utils import none_or from ..command import is_command, parse_command -from ..files import load_folder from ..load_tools import ( CIRCLE_FREE_TO_BEATS_TIME, JubeatAnalyserParser, @@ -32,6 +31,7 @@ from ..load_tools import ( find_long_note_candidates, is_empty_line, is_separator, + load_folder, pick_correct_long_note_candidates, split_double_byte_line, ) diff --git a/jubeatools/formats/jubeat_analyser/typing.py b/jubeatools/formats/jubeat_analyser/typing.py index fe5b320..eb8b949 100644 --- a/jubeatools/formats/jubeat_analyser/typing.py +++ b/jubeatools/formats/jubeat_analyser/typing.py @@ -1,5 +1,5 @@ -from typing import Protocol from io import StringIO +from typing import Protocol from jubeatools.song import Chart, Metadata, Timing diff --git a/jubeatools/formats/typing.py b/jubeatools/formats/typing.py index 5aea68e..37965ab 100644 --- a/jubeatools/formats/typing.py +++ b/jubeatools/formats/typing.py @@ -1,8 +1,8 @@ from pathlib import Path -from typing import Any, Callable, Dict, Protocol, List +from typing import Any, Callable, Dict, List, Protocol -from jubeatools.song import Song from jubeatools.formats.filetypes import ChartFile +from jubeatools.song import Song # Dumpers take a Song object and a Path hint and give back a dict that maps diff --git a/jubeatools/testutils/strategies.py b/jubeatools/testutils/strategies.py index 6d29ac4..5d5988e 100644 --- a/jubeatools/testutils/strategies.py +++ b/jubeatools/testutils/strategies.py @@ -15,6 +15,7 @@ from jubeatools.song import ( BeatsTime, BPMEvent, Chart, + Difficulty, LongNote, Metadata, NotePosition, @@ -22,7 +23,6 @@ from jubeatools.song import ( Song, TapNote, Timing, - Difficulty, ) from jubeatools.testutils.typing import DrawFunc diff --git a/jubeatools/utils.py b/jubeatools/utils.py index e26fc65..2478837 100644 --- a/jubeatools/utils.py +++ b/jubeatools/utils.py @@ -1,12 +1,12 @@ """General utility functions""" import unicodedata +from collections import defaultdict from decimal import Decimal from fractions import Fraction from functools import reduce from math import gcd -from typing import Callable, Optional, TypeVar, List, Dict -from collections import defaultdict +from typing import Callable, Dict, List, Optional, TypeVar def single_lcm(a: int, b: int) -> int: