From fa23889ae9be56bf8eea984fdb06a21781ac3a9a Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sun, 11 Sep 2022 15:03:33 -0500 Subject: [PATCH] pylint: replace multiple errno comparisons with "in" Signed-off-by: Rob Browning --- lib/bup/helpers.py | 2 +- lib/bup/metadata.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/bup/helpers.py b/lib/bup/helpers.py index 3636c13..8177033 100644 --- a/lib/bup/helpers.py +++ b/lib/bup/helpers.py @@ -856,7 +856,7 @@ if _mincore: try: m = io.mmap(fd, msize, mmap.MAP_PRIVATE, 0, 0, pos) except mmap.error as ex: - if ex.errno == errno.EINVAL or ex.errno == errno.ENODEV: + if ex.errno in (errno.EINVAL, errno.ENODEV): # Perhaps the file was a pipe, i.e. "... | bup split ..." return None raise ex diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index 7e8329c..b2e3ed9 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -573,7 +573,7 @@ class Metadata: # (or group) doesn't exist raise ApplyError("POSIX1e ACL: can't create %r for %r" % (acls, path_msg(path))) - elif e.errno == errno.EPERM or e.errno == errno.EOPNOTSUPP: + elif e.errno in (errno.EPERM, errno.EOPNOTSUPP): raise ApplyError('POSIX1e ACL applyto: %s' % e) else: raise @@ -695,8 +695,7 @@ class Metadata: try: xattr.set(path, k, v, nofollow=True) except IOError as e: - if e.errno == errno.EPERM \ - or e.errno == errno.EOPNOTSUPP: + if e.errno in (errno.EPERM, errno.EOPNOTSUPP): raise ApplyError('xattr.set %r: %s' % (path_msg(path), e)) else: raise -- 2.39.2