summaryrefslogtreecommitdiff
path: root/gitdb/db
diff options
context:
space:
mode:
authorHugo van Kemenade <hugovk@users.noreply.github.com>2022-11-16 18:17:20 +0200
committerHugo van Kemenade <hugovk@users.noreply.github.com>2022-11-16 18:17:20 +0200
commit7a68270d6c78b81f577b433dc6351b26bc27b7cf (patch)
tree12f0a4ff8748c723e8fa750720b32037a4debe90 /gitdb/db
parentfaed217d14965932b333c07219ed401a661d2651 (diff)
downloadgitdb-7a68270d6c78b81f577b433dc6351b26bc27b7cf.tar.gz
Upgrade Python syntax with pyupgrade --py37-plus
Diffstat (limited to 'gitdb/db')
-rw-r--r--gitdb/db/base.py12
-rw-r--r--gitdb/db/git.py4
-rw-r--r--gitdb/db/loose.py4
-rw-r--r--gitdb/db/mem.py2
-rw-r--r--gitdb/db/pack.py2
-rw-r--r--gitdb/db/ref.py8
6 files changed, 16 insertions, 16 deletions
diff --git a/gitdb/db/base.py b/gitdb/db/base.py
index f0b8a05..e89052e 100644
--- a/gitdb/db/base.py
+++ b/gitdb/db/base.py
@@ -22,7 +22,7 @@ from functools import reduce
__all__ = ('ObjectDBR', 'ObjectDBW', 'FileDBBase', 'CompoundDB', 'CachingDB')
-class ObjectDBR(object):
+class ObjectDBR:
"""Defines an interface for object database lookup.
Objects are identified either by their 20 byte bin sha"""
@@ -63,7 +63,7 @@ class ObjectDBR(object):
#} END query interface
-class ObjectDBW(object):
+class ObjectDBW:
"""Defines an interface to create objects in the database"""
@@ -105,7 +105,7 @@ class ObjectDBW(object):
#} END edit interface
-class FileDBBase(object):
+class FileDBBase:
"""Provides basic facilities to retrieve files of interest, including
caching facilities to help mapping hexsha's to objects"""
@@ -117,7 +117,7 @@ class FileDBBase(object):
**Note:** The base will not perform any accessablity checking as the base
might not yet be accessible, but become accessible before the first
access."""
- super(FileDBBase, self).__init__()
+ super().__init__()
self._root_path = root_path
#{ Interface
@@ -133,7 +133,7 @@ class FileDBBase(object):
#} END interface
-class CachingDB(object):
+class CachingDB:
"""A database which uses caches to speed-up access"""
@@ -176,7 +176,7 @@ class CompoundDB(ObjectDBR, LazyMixin, CachingDB):
elif attr == '_db_cache':
self._db_cache = dict()
else:
- super(CompoundDB, self)._set_cache_(attr)
+ super()._set_cache_(attr)
def _db_query(self, sha):
""":return: database containing the given 20 byte sha
diff --git a/gitdb/db/git.py b/gitdb/db/git.py
index 7a43d72..e2cb468 100644
--- a/gitdb/db/git.py
+++ b/gitdb/db/git.py
@@ -39,7 +39,7 @@ class GitDB(FileDBBase, ObjectDBW, CompoundDB):
def __init__(self, root_path):
"""Initialize ourselves on a git objects directory"""
- super(GitDB, self).__init__(root_path)
+ super().__init__(root_path)
def _set_cache_(self, attr):
if attr == '_dbs' or attr == '_loose_db':
@@ -68,7 +68,7 @@ class GitDB(FileDBBase, ObjectDBW, CompoundDB):
# finally set the value
self._loose_db = loose_db
else:
- super(GitDB, self)._set_cache_(attr)
+ super()._set_cache_(attr)
# END handle attrs
#{ ObjectDBW interface
diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py
index a63a2ef..4ef7750 100644
--- a/gitdb/db/loose.py
+++ b/gitdb/db/loose.py
@@ -75,7 +75,7 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW):
new_objects_mode = int("644", 8)
def __init__(self, root_path):
- super(LooseObjectDB, self).__init__(root_path)
+ super().__init__(root_path)
self._hexsha_to_file = dict()
# Additional Flags - might be set to 0 after the first failure
# Depending on the root, this might work for some mounts, for others not, which
@@ -151,7 +151,7 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW):
""":raise TypeError: if the stream does not support the Sha1Writer interface"""
if stream is not None and not isinstance(stream, Sha1Writer):
raise TypeError("Output stream musst support the %s interface" % Sha1Writer.__name__)
- return super(LooseObjectDB, self).set_ostream(stream)
+ return super().set_ostream(stream)
def info(self, sha):
m = self._map_loose_object(sha)
diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py
index b2542ff..1b954cb 100644
--- a/gitdb/db/mem.py
+++ b/gitdb/db/mem.py
@@ -37,7 +37,7 @@ class MemoryDB(ObjectDBR, ObjectDBW):
exists in the target storage before introducing actual IO"""
def __init__(self):
- super(MemoryDB, self).__init__()
+ super().__init__()
self._db = LooseObjectDB("path/doesnt/matter")
# maps 20 byte shas to their OStream objects
diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py
index 90de02b..1ce786b 100644
--- a/gitdb/db/pack.py
+++ b/gitdb/db/pack.py
@@ -39,7 +39,7 @@ class PackedDB(FileDBBase, ObjectDBR, CachingDB, LazyMixin):
_sort_interval = 500
def __init__(self, root_path):
- super(PackedDB, self).__init__(root_path)
+ super().__init__(root_path)
# list of lists with three items:
# * hits - number of times the pack was hit with a request
# * entity - Pack entity instance
diff --git a/gitdb/db/ref.py b/gitdb/db/ref.py
index 2bb1de7..6bb2a64 100644
--- a/gitdb/db/ref.py
+++ b/gitdb/db/ref.py
@@ -20,7 +20,7 @@ class ReferenceDB(CompoundDB):
ObjectDBCls = None
def __init__(self, ref_file):
- super(ReferenceDB, self).__init__()
+ super().__init__()
self._ref_file = ref_file
def _set_cache_(self, attr):
@@ -28,7 +28,7 @@ class ReferenceDB(CompoundDB):
self._dbs = list()
self._update_dbs_from_ref_file()
else:
- super(ReferenceDB, self)._set_cache_(attr)
+ super()._set_cache_(attr)
# END handle attrs
def _update_dbs_from_ref_file(self):
@@ -44,7 +44,7 @@ class ReferenceDB(CompoundDB):
try:
with codecs.open(self._ref_file, 'r', encoding="utf-8") as f:
ref_paths = [l.strip() for l in f]
- except (OSError, IOError):
+ except OSError:
pass
# END handle alternates
@@ -79,4 +79,4 @@ class ReferenceDB(CompoundDB):
def update_cache(self, force=False):
# re-read alternates and update databases
self._update_dbs_from_ref_file()
- return super(ReferenceDB, self).update_cache(force)
+ return super().update_cache(force)