Skip to content

Commit 8740ebd

Browse files
Apply ruff/pyupgrade rule UP008
UP008 Use `super()` instead of `super(__class__, self)`
1 parent 3621823 commit 8740ebd

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/cffi/backend_ctypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def _arg_to_ctypes(cls, *value):
564564
if value and isinstance(value[0], bytes):
565565
return ctypes.c_char_p(value[0])
566566
else:
567-
return super(CTypesPtr, cls)._arg_to_ctypes(*value)
567+
return super()._arg_to_ctypes(*value)
568568

569569
if kind == 'charp' or kind == 'bytep':
570570
def _to_string(self, maxlen):
@@ -581,7 +581,7 @@ def _get_own_repr(self):
581581
if getattr(self, '_own', False):
582582
return 'owning %d bytes' % (
583583
ctypes.sizeof(self._as_ctype_ptr.contents),)
584-
return super(CTypesPtr, self)._get_own_repr()
584+
return super()._get_own_repr()
585585
#
586586
if (BItem is self.ffi._get_cached_btype(model.void_type) or
587587
BItem is self.ffi._get_cached_btype(model.PrimitiveType('char'))):
@@ -677,7 +677,7 @@ def _to_string(self, maxlen):
677677
def _get_own_repr(self):
678678
if getattr(self, '_own', False):
679679
return 'owning %d bytes' % (ctypes.sizeof(self._blob),)
680-
return super(CTypesArray, self)._get_own_repr()
680+
return super()._get_own_repr()
681681

682682
def _convert_to_address(self, BClass):
683683
if BClass in (CTypesPtr, None) or BClass._automatic_casts:
@@ -917,7 +917,7 @@ def __repr__(self):
917917
def _get_own_repr(self):
918918
if getattr(self, '_own_callback', None) is not None:
919919
return 'calling %r' % (self._own_callback,)
920-
return super(CTypesFunctionPtr, self)._get_own_repr()
920+
return super()._get_own_repr()
921921

922922
def __call__(self, *args):
923923
if has_varargs:

src/cffi/recompiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ class NativeIO(io.BytesIO):
14171417
def write(self, s):
14181418
if isinstance(s, unicode):
14191419
s = s.encode('ascii')
1420-
super(NativeIO, self).write(s)
1420+
super().write(s)
14211421

14221422
def _is_file_like(maybefile):
14231423
# compare to xml.etree.ElementTree._get_writer

src/cffi/verifier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class NativeIO(io.BytesIO):
2424
def write(self, s):
2525
if isinstance(s, unicode):
2626
s = s.encode('ascii')
27-
super(NativeIO, self).write(s)
27+
super().write(s)
2828

2929

3030
class Verifier:

testing/cffi0/test_verify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
else:
2323
class FFI(FFI):
2424
def verify(self, *args, **kwds):
25-
return super(FFI, self).verify(
25+
return super().verify(
2626
*args, extra_compile_args=extra_compile_args, **kwds)
2727

2828
def setup_module():

0 commit comments

Comments
 (0)