From 80ecabf2198040812b9c2e38e956c2d96d8fba5b Mon Sep 17 00:00:00 2001 From: Scoder12 <34356756+Scoder12@users.noreply.github.com> Date: Tue, 11 Aug 2020 15:48:23 -0700 Subject: [PATCH] Remove unnecessarily duplicated methods --- src/replit/database/__init__.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/replit/database/__init__.py b/src/replit/database/__init__.py index e3308ce..28a16d0 100644 --- a/src/replit/database/__init__.py +++ b/src/replit/database/__init__.py @@ -310,7 +310,7 @@ class AsyncReplitDb: return f"<{self.__class__.__name__}(db_url={self.db_url!r})>" -class JSONKey: +class JSONKey(AsyncJSONKey): """Represents a key in the database that holds a JSON value. db.jsonkey() will initialize an instance for you, @@ -348,19 +348,6 @@ class JSONKey: self.discard_bad_data = discard_bad_data self.do_raise = do_raise - def _default(self) -> JSON_TYPE: - get_default_func = self.get_default or self.dtype - return get_default_func() - - def _is_valid_type(self, data: JSON_TYPE) -> bool: - return self.dtype is Any or isinstance(data, self.dtype) - - def _type_mismatch_msg(self, data: Any) -> str: - return ( - f"Type mismatch: Got type {type(data).__name__}," - "expected {self.dtype.__name__}" - ) - def get(self) -> JSON_TYPE: """Get the value of the key.