From bbe4fb454b21a32869ffd807d1a6ea8e31ba8a48 Mon Sep 17 00:00:00 2001 From: Sebastian Mohr Date: Sat, 8 Feb 2025 22:12:55 +0100 Subject: [PATCH] Renamed ignore to _ignore to prevent mypy error --- beets/util/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index e13b67604..411202075 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -210,7 +210,9 @@ def sorted_walk( """ # Make sure the paths aren't Unicode strings. bytes_path = bytestring_path(path) - ignore = [bytestring_path(i) for i in ignore] + _ignore = [ # rename prevents mypy variable shadowing issue + bytestring_path(i) for i in ignore + ] # Get all the directories and files at this level. try: @@ -230,7 +232,7 @@ def sorted_walk( # Skip ignored filenames. skip = False - for pat in ignore: + for pat in _ignore: if fnmatch.fnmatch(base, pat): if logger: logger.debug( @@ -257,7 +259,7 @@ def sorted_walk( # Recurse into directories. for base in dirs: cur = os.path.join(bytes_path, base) - yield from sorted_walk(cur, ignore, ignore_hidden, logger) + yield from sorted_walk(cur, _ignore, ignore_hidden, logger) def path_as_posix(path: bytes) -> bytes: