From 146d1040290069886ce7a6c74c7589d75e01efef Mon Sep 17 00:00:00 2001 From: NoMoor Date: Mon, 14 Nov 2022 09:18:50 -0800 Subject: [PATCH] Allow multiple Chart files at once Currently, two calls to chparse.load(file) will return two separate Chart files backed by the same instruments dict resulting in a Chart object that may have incorrect values in the instruments. Fix this by making instruments part of each instance instead of a class field. --- chparse/chart.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/chparse/chart.py b/chparse/chart.py index e86319b..948fc1d 100644 --- a/chparse/chart.py +++ b/chparse/chart.py @@ -3,14 +3,6 @@ from . import flags class Chart: - """Represents an entire chart.""" - instruments = { - flags.EXPERT: {}, - flags.HARD: {}, - flags.MEDIUM: {}, - flags.EASY: {}, - flags.NA: {} - } @property def events(self): @@ -31,6 +23,14 @@ def sync_track(self): def __init__(self, metadata): self.__dict__.update(metadata) + self.instruments = { + flags.EXPERT: {}, + flags.HARD: {}, + flags.MEDIUM: {}, + flags.EASY: {}, + flags.NA: {} + } + @staticmethod def _check_type(obj, cls):