From 781d212a0174cb814fa654473d90bff77ed394f4 Mon Sep 17 00:00:00 2001 From: Mattt Zmuda Date: Tue, 19 Mar 2024 03:48:28 -0700 Subject: [PATCH 1/2] Disable R0913: Too many arguments (6/5) (too-many-arguments) Signed-off-by: Mattt Zmuda --- replicate/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replicate/exceptions.py b/replicate/exceptions.py index 4ac839c0..21bc7723 100644 --- a/replicate/exceptions.py +++ b/replicate/exceptions.py @@ -33,7 +33,7 @@ class ReplicateError(ReplicateException): instance: Optional[str] """A URI that identifies the specific occurrence of the error.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, type: Optional[str] = None, title: Optional[str] = None, From 1c29e9e3e0ae672c1fc8fadccea4307a619de633 Mon Sep 17 00:00:00 2001 From: Mattt Zmuda Date: Tue, 19 Mar 2024 03:48:41 -0700 Subject: [PATCH 2/2] Resolve C0116: Missing function or method docstring (missing-function-docstring) Signed-off-by: Mattt Zmuda --- replicate/exceptions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/replicate/exceptions.py b/replicate/exceptions.py index 21bc7723..6302d10f 100644 --- a/replicate/exceptions.py +++ b/replicate/exceptions.py @@ -50,6 +50,7 @@ def __init__( # pylint: disable=too-many-arguments @classmethod def from_response(cls, response: httpx.Response) -> "ReplicateError": """Create a ReplicateError from an HTTP response.""" + try: data = response.json() except ValueError: @@ -64,6 +65,8 @@ def from_response(cls, response: httpx.Response) -> "ReplicateError": ) def to_dict(self) -> dict: + """Get a dictionary representation of the error.""" + return { key: value for key, value in {