"""File for Score classes""" import time class Score: """Parent class for Scores. Stores common information for a Score.""" # no user setter, it should never change. def __init__(self, user: str, score: int) -> None: self._user: str = user self._score: int = score def __str__(self) -> str: return f"{self.user}: {self.get_str()}" @property def user(self) -> str: """Getter for user.""" return self._user @property def score(self) -> int: """Getter for score value.""" return self._score @score.setter def score(self, score: int) -> None: """Setter for score value.""" self._score = score def get_str(self) -> str: """Gets score's value as a string.""" return str(self._score) class ScoreTime(Score): """Class for a time based score.""" def __init__(self, user: str, score: float) -> None: # pylint: disable=super-init-not-called # store time score as seconds. self._user: str = user self._score: float = score @property def score(self) -> float: """Getter for score value.""" return self._score @score.setter def score(self, score: float) -> None: """Setter for score value.""" self._score = score def get_str(self) -> str: """Gets score's value as a string. Returns in time format.""" milliseconds = round((self.score - int(self.score)) * 10) return time.strftime(f"%-M:%S.{milliseconds}", time.gmtime(self.score))