Open barneygale opened 1 month ago
In bottom-up mode, we can handle exceptions from
entry.is_symlink()
in the same block as those fromentry.is_dir()
, which avoids a few temporary variables.
Upon closer inspection, I think I was wrong. Symlinks to directories where is_symlink()
raises should still be categorised as dirs
.
There are a couple of minor performance improvements possible in
os.walk()
:os.scandir
iterator, given we handle exceptions fromnext()
like exceptions fromscandir()
itself, i.e. by ignoring the problematic directory and moving on. We can use afor
loop like filthy casuals.entry.is_symlink()
in the same block as those fromentry.is_dir()
, which avoids a few temporary variables.~os.path.join()
once on a parent directory rather than for each child path.Linked PRs