Skip to content

Commit 7b51784

Browse files
committed
Apply ruff unsafe fixes
1 parent aeaeb39 commit 7b51784

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

geoip2/database.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,15 @@ def isp(self, ip_address: IPAddress) -> ISP:
252252
def _get(self, database_type: str, ip_address: IPAddress) -> Any:
253253
if database_type not in self._db_type:
254254
caller = inspect.stack()[2][3]
255+
msg = f"The {caller} method cannot be used with the {self._db_type} database"
255256
raise TypeError(
256-
f"The {caller} method cannot be used with the {self._db_type} database",
257+
msg,
257258
)
258259
(record, prefix_len) = self._db_reader.get_with_prefix_len(ip_address)
259260
if record is None:
261+
msg = f"The address {ip_address} is not in the database."
260262
raise geoip2.errors.AddressNotFoundError(
261-
f"The address {ip_address} is not in the database.",
263+
msg,
262264
str(ip_address),
263265
prefix_len,
264266
)

tests/models_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def test_city_full(self) -> None:
395395
r"^geoip2.models.City\(\[.*en.*\], .*geoname_id.*\)",
396396
)
397397

398-
self.assertFalse(model == True, "__eq__ does not blow up on weird input")
398+
self.assertFalse(model is True, "__eq__ does not blow up on weird input")
399399

400400
def test_unknown_keys(self) -> None:
401401
model = geoip2.models.City(

0 commit comments

Comments
 (0)