Skip to content

Commit a2e49d9

Browse files
committed
style(listuple): use literals for empty lists/tuples
1 parent 79a754a commit a2e49d9

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

gitdb/db/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class CompoundDB(ObjectDBR, LazyMixin, CachingDB):
166166

167167
def _set_cache_(self, attr):
168168
if attr == '_dbs':
169-
self._dbs = list()
169+
self._dbs = []
170170
elif attr == '_db_cache':
171171
self._db_cache = dict()
172172
else:
@@ -237,7 +237,7 @@ def partial_to_complete_sha_hex(self, partial_hexsha):
237237
:return: 20 byte binary sha1 from the given less-than-40 byte hexsha (bytes or str)
238238
:param partial_hexsha: hexsha with less than 40 byte
239239
:raise AmbiguousObjectName: """
240-
databases = list()
240+
databases = []
241241
_databases_recursive(self, databases)
242242
partial_hexsha = force_text(partial_hexsha)
243243
len_partial_hexsha = len(partial_hexsha)

gitdb/db/git.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, root_path):
4343

4444
def _set_cache_(self, attr):
4545
if attr == '_dbs' or attr == '_loose_db':
46-
self._dbs = list()
46+
self._dbs = []
4747
loose_db = None
4848
for subpath, dbcls in ((self.packs_dir, self.PackDBCls),
4949
(self.loose_dir, self.LooseDBCls),

gitdb/db/ref.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, ref_file):
2424

2525
def _set_cache_(self, attr):
2626
if attr == '_dbs':
27-
self._dbs = list()
27+
self._dbs = []
2828
self._update_dbs_from_ref_file()
2929
else:
3030
super(ReferenceDB, self)._set_cache_(attr)
@@ -39,7 +39,7 @@ def _update_dbs_from_ref_file(self):
3939
# END get db type
4040

4141
# try to get as many as possible, don't fail if some are unavailable
42-
ref_paths = list()
42+
ref_paths = []
4343
try:
4444
with open(self._ref_file, 'r') as f:
4545
ref_paths = [l.strip() for l in f]

gitdb/fun.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class DeltaChunkList(list):
222222
latest delta down to the earliest ancestor. This attribute is queryable
223223
after all processing with is_reversed."""
224224

225-
__slots__ = tuple()
225+
__slots__ = ()
226226

227227
def rbound(self):
228228
""":return: rightmost extend in bytes, absolute"""
@@ -323,7 +323,7 @@ class TopdownDeltaChunkList(DeltaChunkList):
323323

324324
"""Represents a list which is generated by feeding its ancestor streams one by
325325
one"""
326-
__slots__ = tuple()
326+
__slots__ = ()
327327

328328
def connect_with_next_base(self, bdcl):
329329
"""Connect this chain with the next level of our base delta chunklist.

gitdb/test/performance/test_stream.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class TestObjDBPerformance(TestBigRepoR):
4848
@with_rw_directory
4949
def test_large_data_streaming(self, path):
5050
ldb = LooseObjectDB(path)
51-
string_ios = list() # list of streams we previously created
51+
string_ios = [] # list of streams we previously created
5252

5353
# serial mode
5454
for randomize in range(2):
@@ -85,7 +85,7 @@ def test_large_data_streaming(self, path):
8585

8686
# reading in chunks of 1 MiB
8787
cs = 512 * 1000
88-
chunks = list()
88+
chunks = []
8989
st = time()
9090
with ldb.stream(sha) as ostream:
9191
while True:

gitdb/test/test_pack.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_pack(self):
149149
# because it is being used by another process: 'sss\\index_cc_wll5'
150150
@with_rw_directory
151151
def test_pack_entity(self, rw_dir):
152-
pack_objs = list()
152+
pack_objs = []
153153
for packinfo, indexinfo in ((self.packfile_v2_1, self.packindexfile_v1),
154154
(self.packfile_v2_2, self.packindexfile_v2),
155155
(self.packfile_v2_3_ascii, self.packindexfile_v2_3_ascii)):

gitdb/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class LazyMixin(object):
293293
return the cached value as stored in the Instance's dict or slot.
294294
"""
295295

296-
__slots__ = tuple()
296+
__slots__ = ()
297297

298298
def __getattr__(self, attr):
299299
"""

0 commit comments

Comments
 (0)