From c6299aaaa0117e9d53ff3bc975c52f4549ad1f3b Mon Sep 17 00:00:00 2001 From: KikooDX Date: Wed, 6 Nov 2019 09:31:11 +0100 Subject: [PATCH] Deleted crappy verification process. --- locate2.py | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/locate2.py b/locate2.py index 1f7473b..66e4bb9 100644 --- a/locate2.py +++ b/locate2.py @@ -1,34 +1,15 @@ class Screen: - def _check(self, x, o, name): - if not isinstance(x, int): - raise TypeError("{} is not an int object".format(name)) - elif x < 1: - raise ValueError("{} is lower than 1".format(name)) - if o is None: - o = 0 - elif x > o and o: - raise ValueError("{} is greater than the height of this object: {} > {}". - format(name, x, o)) - def __init__(self, width=21, height=6, patern=" ", copy=None): if isinstance(copy, Screen): self._width = copy._width self._height = copy._height self._mat = copy._mat else: - self._check(width, None, "width") - self._check(height, None, "height") - if not isinstance(patern, str): - raise TypeError("patern is not a string") - elif len(patern) > 1: - raise ValueError("patern is too long (length = {})".format(len(patern))) self._width = width self._height = height self.fill(patern) def locate(self, x, y, string): - self._check(x, self._width, "x") - self._check(y, self._height, "y") string = str(string) i = -1 for char in string: @@ -37,8 +18,6 @@ class Screen: i += 1 def locate_v(self, x, y, string): - self._check(x, self._width, "x") - self._check(y, self._height, "y") string = str(string) i = -1 for char in string: @@ -64,8 +43,6 @@ class Screen: return None def get_cell(self, x, y): - self._check(x, self._width, "x") - self._check(y, self._width, "y") return self._mat[y - 1][x - 1] def get_dim(self): @@ -79,17 +56,13 @@ class Screen: return result def load(self, string): - if type(string) is not str: - raise TypeError("string is not a string type") - if len(string) != self._width * self._height: - raise ValueError("string lenght isn't equal to {}".format(self._width * self._height)) i = 0 s = 0 while i != self._height: self._mat[i] = list(string[s:s + self._width]) i += 1 s += self._width - + get_cell_content = get_cell # For retro-compability class Pad(Screen):