1
0
mirror of synced 2024-12-12 15:01:09 +01:00

[jubeat-analyser] simplify the cod ethat reads lines

This commit is contained in:
Stepland 2021-05-04 12:13:28 +02:00
parent e564229f4f
commit 02f917e6be
5 changed files with 8 additions and 16 deletions

View File

@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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,

View File

@ -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: