Skip to content

Commit 6e18deb

Browse files
committed
Don't inherit from object
We don't need to, since we don't support Python 2
1 parent 3f5fc86 commit 6e18deb

11 files changed

+38
-28
lines changed

pygit2/blame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def wrap_signature(csig):
3737
ffi.string(csig.email).decode('utf-8'),
3838
csig.when.time, csig.when.offset, 'utf-8')
3939

40-
class BlameHunk(object):
40+
class BlameHunk:
4141

4242
@classmethod
4343
def _from_c(cls, blame, ptr):
@@ -95,7 +95,7 @@ def orig_path(self):
9595
return ffi.string(path).decode('utf-8')
9696

9797

98-
class Blame(object):
98+
class Blame:
9999

100100
@classmethod
101101
def _from_c(cls, repo, ptr):

pygit2/callbacks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def _update_tips_cb(refname, a, b, data):
303303
# outside.
304304
#
305305

306-
class RemoteCallbacks(object):
306+
class RemoteCallbacks:
307307
"""Base class for pygit2 remote callbacks.
308308
309309
Inherit from this class and override the callbacks which you want to use

pygit2/config.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def assert_string(v, desc):
3636
raise TypeError("%s must be a string" % desc)
3737

3838

39-
class ConfigIterator(object):
39+
class ConfigIterator:
4040

4141
def __init__(self, config, ptr):
4242
self._iter = ptr
@@ -68,8 +68,9 @@ def __next__(self):
6868
return entry.value
6969

7070

71-
class Config(object):
72-
"""Git configuration management"""
71+
class Config:
72+
"""Git configuration management.
73+
"""
7374

7475
def __init__(self, path=None):
7576
cconfig = ffi.new('git_config **')
@@ -285,8 +286,9 @@ def get_xdg_config():
285286
"""
286287
return Config._from_found_config(C.git_config_find_xdg)
287288

288-
class ConfigEntry(object):
289-
"""An entry in a configuation object
289+
290+
class ConfigEntry:
291+
"""An entry in a configuation object.
290292
"""
291293

292294
@classmethod

pygit2/credentials.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
GIT_CREDTYPE_SSH_MEMORY = C.GIT_CREDTYPE_SSH_MEMORY
3232

3333

34-
class Username(object):
34+
class Username:
3535
"""Username credentials
3636
3737
This is an object suitable for passing to a remote's credentials
@@ -53,7 +53,7 @@ def __call__(self, _url, _username, _allowed):
5353
return self
5454

5555

56-
class UserPass(object):
56+
class UserPass:
5757
"""Username/Password credentials
5858
5959
This is an object suitable for passing to a remote's credentials
@@ -76,7 +76,7 @@ def __call__(self, _url, _username, _allowed):
7676
return self
7777

7878

79-
class Keypair(object):
79+
class Keypair:
8080
"""
8181
SSH key pair credentials.
8282

pygit2/index.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from .utils import GenericIterator, StrArray
3434

3535

36-
class Index(object):
36+
class Index:
3737

3838
def __init__(self, path=None):
3939
"""Create a new Index
@@ -332,7 +332,7 @@ def conflicts(self):
332332
return self._conflicts()
333333

334334

335-
class IndexEntry(object):
335+
class IndexEntry:
336336
__slots__ = ['id', 'path', 'mode']
337337

338338
def __init__(self, path, object_id, mode):
@@ -381,7 +381,7 @@ def _from_c(cls, centry):
381381
return entry
382382

383383

384-
class ConflictCollection(object):
384+
class ConflictCollection:
385385

386386
def __init__(self, index):
387387
self._index = index
@@ -409,7 +409,7 @@ def __iter__(self):
409409
return ConflictIterator(self._index)
410410

411411

412-
class ConflictIterator(object):
412+
class ConflictIterator:
413413

414414
def __init__(self, index):
415415
citer = ffi.new('git_index_conflict_iterator **')

pygit2/refspec.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
from .utils import to_bytes
3030

3131

32-
class Refspec(object):
33-
"""The constructor is for internal use only"""
32+
class Refspec:
33+
"""The constructor is for internal use only.
34+
"""
35+
3436
def __init__(self, owner, ptr):
3537
self._owner = owner
3638
self._refspec = ptr

pygit2/remote.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
from .utils import maybe_string, to_bytes, strarray_to_strings, StrArray
3333

3434

35-
class TransferProgress(object):
36-
"""Progress downloading and indexing data during a fetch"""
35+
class TransferProgress:
36+
"""Progress downloading and indexing data during a fetch.
37+
"""
3738

3839
def __init__(self, tp):
3940

@@ -59,9 +60,11 @@ def __init__(self, tp):
5960
""""Number of bytes received up to now"""
6061

6162

62-
class Remote(object):
63+
class Remote:
64+
6365
def __init__(self, repo, ptr):
64-
"""The constructor is for internal use only"""
66+
"""The constructor is for internal use only.
67+
"""
6568

6669
self._repo = repo
6770
self._remote = ptr
@@ -217,7 +220,7 @@ def push(self, specs, callbacks=None):
217220
check_error(err, cb)
218221

219222

220-
class RemoteCollection(object):
223+
class RemoteCollection:
221224
"""Collection of configured remotes
222225
223226
You can use this class to look up and manage the remotes configured

pygit2/repository.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,8 @@ def revert_commit(self, revert_commit, our_commit, mainline=0):
11711171
return Index.from_c(self, cindex)
11721172

11731173

1174-
class Branches(object):
1174+
class Branches:
1175+
11751176
def __init__(self, repository, flag=GIT_BRANCH_ALL, commit=None):
11761177
self._repository = repository
11771178
self._flag = flag
@@ -1234,7 +1235,8 @@ def __contains__(self, name):
12341235
return self.get(name) is not None
12351236

12361237

1237-
class References(object):
1238+
class References:
1239+
12381240
def __init__(self, repository):
12391241
self._repository = repository
12401242

pygit2/submodule.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from .ffi import ffi, C
2929

3030

31-
class Submodule(object):
31+
class Submodule:
3232

3333
@classmethod
3434
def _from_c(cls, repo, cptr):

pygit2/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def strarray_to_strings(arr):
7070
return l
7171

7272

73-
class StrArray(object):
73+
class StrArray:
7474
"""A git_strarray wrapper
7575
7676
Use this in order to get a git_strarray* to pass to libgit2 out of a
@@ -108,7 +108,7 @@ def __exit__(self, type, value, traceback):
108108
pass
109109

110110

111-
class GenericIterator(object):
111+
class GenericIterator:
112112
"""Helper to easily implement an iterator.
113113
114114
The constructor gets a container which must implement __len__ and

test/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def rmtree(path):
8787
shutil.rmtree(path, onerror=onerror)
8888

8989

90-
class TemporaryRepository(object):
90+
class TemporaryRepository:
91+
9192
def __init__(self, repo_spec):
9293
self.repo_spec = repo_spec
9394

0 commit comments

Comments
 (0)