Skip to content

Commit

Permalink
Remove unnecessary code of dirsnapshot.py (#930)
Browse files Browse the repository at this point in the history
Co-authored-by: QuantumEnergyE <quantumenergye@gmail.com>
  • Loading branch information
QuantumEnergyE and QuantumEnergyE committed Nov 30, 2022
1 parent 78adc2f commit cf0a195
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/watchdog/utils/dirsnapshot.py
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
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

0 comments on commit cf0a195

Please sign in to comment.