Skip to content

Commit

Permalink
Revise iovec_t.__eq__ and vfu_dma_info_t.__eq__ to fix flake8 E721
Browse files Browse the repository at this point in the history
The newer flake8 version in the arch linux job of the pull request
workflow fails due to:

E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

Both `__eq__` functions now use `is not` instead of `!=` for the type
initial check.

Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
  • Loading branch information
gierens committed Aug 15, 2023
1 parent 32d6812 commit 6c44af3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/py/libvfio_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class iovec_t(Structure):
]

def __eq__(self, other):
if type(self) != type(other):
if type(self) is not type(other):
return False
return self.iov_base == other.iov_base \
and self.iov_len == other.iov_len
Expand Down Expand Up @@ -484,7 +484,7 @@ class vfu_dma_info_t(Structure):
]

def __eq__(self, other):
if type(self) != type(other):
if type(self) is not type(other):
return False
return self.iova == other.iova \
and self.vaddr == other.vaddr \
Expand Down

0 comments on commit 6c44af3

Please sign in to comment.