From 0bb1ada4d39ea9c47e282dce5b7d532f4c0fe713 Mon Sep 17 00:00:00 2001 From: Scoder12 <34356756+Scoder12@users.noreply.github.com> Date: Tue, 11 Aug 2020 16:33:20 -0700 Subject: [PATCH] Rename key() as it conflicts with key variable; fix docsting --- src/replit/database/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/replit/database/__init__.py b/src/replit/database/__init__.py index 8190e48..3b348ac 100644 --- a/src/replit/database/__init__.py +++ b/src/replit/database/__init__.py @@ -447,13 +447,16 @@ class JSONKey(AsyncJSONKey): ) return self.get()[name] - def key(self, name: str, default: Any = None) -> Any: + def read(self, name: str, default: Any = None) -> Any: """Shorthand for self.get().get(name, default) if datatype is dict. Args: name (str): The name to get. default (Any): The default if the key doesn't exist. Defaults to None. + Raises: + TypeError: The datatype is not dict. + Returns: Any: The value read or the default. """