[jubeat-analyser] simplify the cod ethat reads lines
This commit is contained in:
parent
e564229f4f
commit
02f917e6be
@ -324,11 +324,11 @@ class MemoParser(JubeatAnalyserParser):
|
|||||||
|
|
||||||
def _load_memo_file(lines: List[str]) -> Song:
|
def _load_memo_file(lines: List[str]) -> Song:
|
||||||
parser = MemoParser()
|
parser = MemoParser()
|
||||||
for i, raw_line in enumerate(lines):
|
for i, raw_line in enumerate(lines, start=1):
|
||||||
try:
|
try:
|
||||||
parser.load_line(raw_line)
|
parser.load_line(raw_line)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise SyntaxError(f"On line {i+1}\n{e}")
|
raise SyntaxError(f"On line {i}\n{e}")
|
||||||
|
|
||||||
parser.finish_last_few_notes()
|
parser.finish_last_few_notes()
|
||||||
metadata = Metadata(
|
metadata = Metadata(
|
||||||
|
@ -317,13 +317,11 @@ class Memo1Parser(JubeatAnalyserParser):
|
|||||||
|
|
||||||
def _load_memo1_file(lines: List[str]) -> Song:
|
def _load_memo1_file(lines: List[str]) -> Song:
|
||||||
parser = Memo1Parser()
|
parser = Memo1Parser()
|
||||||
for i, raw_line in enumerate(lines):
|
for i, raw_line in enumerate(lines, start=1):
|
||||||
try:
|
try:
|
||||||
parser.load_line(raw_line)
|
parser.load_line(raw_line)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise SyntaxError(
|
raise SyntaxError(f"On line {i}\n{e}")
|
||||||
f"Error while parsing memo line {i} :\n" f"{type(e).__name__}: {e}"
|
|
||||||
) from None
|
|
||||||
|
|
||||||
parser.finish_last_few_notes()
|
parser.finish_last_few_notes()
|
||||||
metadata = Metadata(
|
metadata = Metadata(
|
||||||
|
@ -438,13 +438,11 @@ class Memo2Parser(JubeatAnalyserParser):
|
|||||||
|
|
||||||
def _load_memo2_file(lines: List[str]) -> Song:
|
def _load_memo2_file(lines: List[str]) -> Song:
|
||||||
parser = Memo2Parser()
|
parser = Memo2Parser()
|
||||||
for i, raw_line in enumerate(lines):
|
for i, raw_line in enumerate(lines, start=1):
|
||||||
try:
|
try:
|
||||||
parser.load_line(raw_line)
|
parser.load_line(raw_line)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise SyntaxError(
|
raise SyntaxError(f"On line {i}\n{e}")
|
||||||
f"Error while parsing memo line {i} :\n" f"{type(e).__name__}: {e}"
|
|
||||||
) from None
|
|
||||||
|
|
||||||
parser.finish_last_few_notes()
|
parser.finish_last_few_notes()
|
||||||
metadata = Metadata(
|
metadata = Metadata(
|
||||||
|
@ -258,14 +258,11 @@ def load_mono_column(path: Path) -> Song:
|
|||||||
|
|
||||||
def _load_mono_column_file(lines: List[str]) -> Song:
|
def _load_mono_column_file(lines: List[str]) -> Song:
|
||||||
parser = MonoColumnParser()
|
parser = MonoColumnParser()
|
||||||
for i, raw_line in enumerate(lines):
|
for i, raw_line in enumerate(lines, start=1):
|
||||||
try:
|
try:
|
||||||
parser.load_line(raw_line)
|
parser.load_line(raw_line)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise SyntaxError(
|
raise SyntaxError(f"On line {i}\n{e}")
|
||||||
f"Error while parsing mono column line {i} :\n"
|
|
||||||
f"{type(e).__name__}: {e}"
|
|
||||||
) from None
|
|
||||||
|
|
||||||
metadata = Metadata(
|
metadata = Metadata(
|
||||||
title=parser.title,
|
title=parser.title,
|
||||||
|
@ -2,7 +2,6 @@ import unicodedata
|
|||||||
from functools import reduce
|
from functools import reduce
|
||||||
from math import gcd
|
from math import gcd
|
||||||
from typing import Callable, Iterable, Optional, TypeVar
|
from typing import Callable, Iterable, Optional, TypeVar
|
||||||
from numbers import Number
|
|
||||||
|
|
||||||
|
|
||||||
def single_lcm(a: int, b: int) -> int:
|
def single_lcm(a: int, b: int) -> int:
|
||||||
|
Loading…
Reference in New Issue
Block a user