Skip to content

Commit 2c91752

Browse files
committed
Get rid of unnecessary elif statements
1 parent fec4c38 commit 2c91752

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

geoip2/webservice.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _exception_for_error(self, response, uri):
195195

196196
if 400 <= status < 500:
197197
return self._exception_for_4xx_status(response, status, uri)
198-
elif 500 <= status < 600:
198+
if 500 <= status < 600:
199199
return self._exception_for_5xx_status(status, uri)
200200
return self._exception_for_non_200_status(status, uri)
201201

@@ -206,7 +206,7 @@ def _exception_for_4xx_status(self, response, status, uri):
206206
status,
207207
uri,
208208
)
209-
elif response.headers["Content-Type"].find("json") == -1:
209+
if response.headers["Content-Type"].find("json") == -1:
210210
return HTTPError(
211211
"Received a %i for %s with the following "
212212
"body: %s" % (status, uri, response.content),
@@ -236,7 +236,7 @@ def _exception_for_4xx_status(self, response, status, uri):
236236
def _exception_for_web_service_error(self, message, code, status, uri):
237237
if code in ("IP_ADDRESS_NOT_FOUND", "IP_ADDRESS_RESERVED"):
238238
return AddressNotFoundError(message)
239-
elif code in (
239+
if code in (
240240
"ACCOUNT_ID_REQUIRED",
241241
"ACCOUNT_ID_UNKNOWN",
242242
"AUTHORIZATION_INVALID",
@@ -245,9 +245,9 @@ def _exception_for_web_service_error(self, message, code, status, uri):
245245
"USER_ID_UNKNOWN",
246246
):
247247
return AuthenticationError(message)
248-
elif code in ("INSUFFICIENT_FUNDS", "OUT_OF_QUERIES"):
248+
if code in ("INSUFFICIENT_FUNDS", "OUT_OF_QUERIES"):
249249
return OutOfQueriesError(message)
250-
elif code == "PERMISSION_REQUIRED":
250+
if code == "PERMISSION_REQUIRED":
251251
return PermissionRequiredError(message)
252252

253253
return InvalidRequestError(message, code, status, uri)

0 commit comments

Comments
 (0)