Skip to content

Commit 9949b94

Browse files
committed
Fixed deprecated env vars
1 parent c0c10fa commit 9949b94

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

service/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Global Configuration for Application
33
"""
4+
45
import os
56
import logging
67

@@ -16,4 +17,4 @@
1617
API_KEY = os.getenv("API_KEY")
1718

1819
# Turn off helpful error messages that interfere with REST API messages
19-
ERROR_404_HELP = False
20+
RESTX_ERROR_404_HELP = False

service/models.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Pet:
8484
client: Cloudant = None
8585
database: CloudantDatabase = None
8686

87-
# pylint: disable=too-many-arguments
87+
# pylint: disable=too-many-positional-arguments too-many-arguments
8888
def __init__(
8989
self,
9090
name: str = None,
@@ -185,13 +185,20 @@ def deserialize(self, data: dict) -> None:
185185
if isinstance(data["available"], bool):
186186
self.available = data["available"]
187187
else:
188-
raise DataValidationError("Invalid type for boolean [available]: " + str(type(data["available"])))
188+
raise DataValidationError(
189+
"Invalid type for boolean [available]: "
190+
+ str(type(data["available"]))
191+
)
189192
self.gender = getattr(Gender, data["gender"]) # create enum from string
190193
self.birthday = date.fromisoformat(data["birthday"])
191194
except KeyError as error:
192-
raise DataValidationError("Invalid pet: missing " + error.args[0]) from error
195+
raise DataValidationError(
196+
"Invalid pet: missing " + error.args[0]
197+
) from error
193198
except TypeError as error:
194-
raise DataValidationError("Invalid pet: body of request contained bad or no data") from error
199+
raise DataValidationError(
200+
"Invalid pet: body of request contained bad or no data"
201+
) from error
195202

196203
# if there is no id and the data has one, assign it
197204
if not self.id and "_id" in data:
@@ -424,7 +431,9 @@ def init_db(dbname: str = "pets"):
424431
)
425432

426433
except ConnectionError as exc:
427-
raise DatabaseConnectionError("Cloudant service could not be reached") from exc
434+
raise DatabaseConnectionError(
435+
"Cloudant service could not be reached"
436+
) from exc
428437

429438
# Create database if it doesn't exist
430439
try:

0 commit comments

Comments
 (0)