Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 88da5ef

Browse files
authored
Merge pull request #113 from blablatdinov/use-contextlib-suppress
Use contextlib.suppress instead of except: pass
2 parents b653923 + d50b2e3 commit 88da5ef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎gitdb/db/loose.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# This module is part of GitDB and is released under
44
# the New BSD License: https://opensource.org/license/bsd-3-clause/
5+
from contextlib import suppress
6+
57
from gitdb.db.base import (
68
FileDBBase,
79
ObjectDBR,
@@ -90,10 +92,8 @@ def readable_db_object_path(self, hexsha):
9092
"""
9193
:return: readable object path to the object identified by hexsha
9294
:raise BadObject: If the object file does not exist"""
93-
try:
95+
withsuppress(KeyError):
9496
return self._hexsha_to_file[hexsha]
95-
except KeyError:
96-
pass
9797
# END ignore cache misses
9898

9999
# try filesystem

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /