Skip to content

Commit

Permalink
[pylint] Re-enable redefined-outer-name
Browse files Browse the repository at this point in the history
Signed-off-by: Ponnuvel Palaniyappan <[email protected]>
  • Loading branch information
pponnuvel authored and TurboTurtle committed Jul 23, 2024
1 parent d21d558 commit be489ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ disable=
W0108, # unnecessary-lambda
W0222, # signature-differs
W0223, # abstract-method
W0621, # redefined-outer-name
W0640, # cell-var-from-loop
W1509, # subprocess-popen-preexec-fn
W4701, # modified-iterating-list
6 changes: 3 additions & 3 deletions sos/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,13 @@ def is_special(mode):
def _copy_attributes(self, src, dest):
# copy file attributes, skip SELinux xattrs for /sys and /proc
try:
stat = os.stat(src)
_stat = os.stat(src)
if src.startswith("/sys/") or src.startswith("/proc/"):
shutil.copymode(src, dest)
os.utime(dest, ns=(stat.st_atime_ns, stat.st_mtime_ns))
os.utime(dest, ns=(_stat.st_atime_ns, _stat.st_mtime_ns))
else:
shutil.copystat(src, dest)
os.chown(dest, stat.st_uid, stat.st_gid)
os.chown(dest, _stat.st_uid, _stat.st_gid)
except Exception as e:
self.log_debug(f"caught '{e}' setting attributes of '{dest}'")

Expand Down
4 changes: 2 additions & 2 deletions sos/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
except ImportError:
from pkg_resources import parse_version

log = logging.getLogger('sos')

# try loading magic>=0.4.20 which implements detect_from_filename method
magic_mod = False
try:
import magic
magic.detect_from_filename(__file__)
magic_mod = True
except (ImportError, AttributeError):
log = logging.getLogger('sos')
from textwrap import fill
msg = ("""\
WARNING: Failed to load 'magic' module version >= 0.4.20 which sos aims to \
Expand Down Expand Up @@ -114,7 +115,6 @@ def fileobj(path_or_file, mode='r'):
try:
return open(path_or_file, mode)
except IOError:
log = logging.getLogger('sos')
log.debug(f"fileobj: {path_or_file} could not be opened")
return closing(io.StringIO())
else:
Expand Down
6 changes: 3 additions & 3 deletions tests/sos_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,10 @@ def manifest(self):
def encrypted_path(self):
return self.get_encrypted_path()

def _decrypt_archive(self, archive):
_archive = archive.strip('.gpg')
def _decrypt_archive(self, archive_arg):
_archive = archive_arg.strip('.gpg')
cmd = (f"gpg --batch --passphrase {self.encrypt_pass} -o {_archive} "
f"--decrypt {archive}")
f"--decrypt {archive_arg}")
try:
process.run(cmd, timeout=10)
except Exception as err:
Expand Down

0 comments on commit be489ae

Please sign in to comment.