Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary code of dirsnapshot.py #930

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/watchdog/utils/dirsnapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ def __init__(self, path, recursive=True,

def walk(self, root):
try:
paths = [os.path.join(root, entry if isinstance(entry, str) else entry.name)
for entry in self.listdir(root)]
paths = [os.path.join(root, entry.name) for entry in self.listdir(root)]
except OSError as e:
# Directory may have been deleted between finding it in the directory
# list of its parent and trying to delete its contents. If this
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snapshot_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def listdir_fcn(path):
if path == p("root", "dir"):
rm(path, recursive=True)
touch(path)
return os.listdir(path)
return os.scandir(path)

mkdir(p('root'))
mkdir(p('root', 'dir'))
Expand Down