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