Skip to content

Conversation

@danloveg
Copy link

I saw a "TODO" in the code regarding a redundant os.walk operation when checking whether a Bag can actually be created or not, which this pull request addresses.

I've combined _can_bag and _can_read into one function that walk()s through the bag directory at most once (instead of twice). Additionally, I am raising an exception when an unreadable/unwriteable file/dir is encountered. This is opposed to the previous method of compiling a complete list of all unreadable/unwriteable items, printing them, and then throwing an exception. The offending file name is now included in the exception rather than returned in a tuple.

danloveg added 4 commits July 18, 2025 15:09
Combines _can_bag and _can_read into one function. Instead of compiling
a list of every single file and directory that cannot be read/written
to, this new function throws an Exception as soon as a problematic file
or directory comes up.

At most, one walk() operation is completed now, instead of two.
This message said to do do permission checks before changing
directories, which is already how the code behaves.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant