Renamed ignore to _ignore to prevent mypy error

This commit is contained in:
Sebastian Mohr 2025-02-08 22:12:55 +01:00
parent 10c0aa3f6a
commit bbe4fb454b

View file

@ -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: