Skip to content

Conversation

@willmcgugan
Copy link
Member

@willmcgugan willmcgugan commented Nov 9, 2017

Work in progress.

Adds a max_depth parameter to fs.walk.

@coveralls
Copy link

coveralls commented Nov 9, 2017

Coverage Status

Coverage increased (+0.0002%) to 99.951% when pulling e8bb2ea on walk-levels into 34824b2 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0002%) to 99.951% when pulling 02accb5 on walk-levels into 34824b2 on master.

1 similar comment
@coveralls
Copy link

coveralls commented Nov 9, 2017

Coverage Status

Coverage increased (+0.0002%) to 99.951% when pulling 02accb5 on walk-levels into 34824b2 on master.

@coveralls
Copy link

coveralls commented Nov 9, 2017

Coverage Status

Coverage increased (+0.0002%) to 99.951% when pulling be36d32 on walk-levels into 34824b2 on master.

return "{}/{}".format(path1.rstrip('/'), path2.lstrip('/'))


def parts(path):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coveralls
Copy link

coveralls commented Nov 9, 2017

Coverage Status

Coverage increased (+0.0002%) to 99.951% when pulling 8decbf9 on walk-levels into 34824b2 on master.

@willmcgugan
Copy link
Member Author

@althonos any thoughts?

@althonos
Copy link
Member

althonos commented Nov 9, 2017

Fine by me, kudos on the non-recursive implementation !

One remark though: the user may expect max_depths to work even if check_scan_dir is overriden, which will not be the case here.

A workaround would be:

class BaseWalker(object):

    def _check_scan_dir(self, fs, path, info, depth):
        return (self.max_depth is None or depth < self.max_depth) \
           and self.check_scan_dir(fs, path, info, depth)

    def check_scan_dir(self, fs, path, info, depth)
        """Override me !
        """
        return True

That way, check_scan_dir would be easier to override. (This may apply to the other check functions as well).

@coveralls
Copy link

coveralls commented Nov 11, 2017

Coverage Status

Coverage increased (+0.0003%) to 99.951% when pulling 5a4a0c0 on walk-levels into 34824b2 on master.

@coveralls
Copy link

coveralls commented Nov 11, 2017

Coverage Status

Coverage increased (+0.0003%) to 99.951% when pulling 323dace on walk-levels into 34824b2 on master.

1 similar comment
@coveralls
Copy link

coveralls commented Nov 11, 2017

Coverage Status

Coverage increased (+0.0003%) to 99.951% when pulling 323dace on walk-levels into 34824b2 on master.

@willmcgugan willmcgugan merged commit 2c2489e into master Nov 11, 2017
@willmcgugan willmcgugan deleted the walk-levels branch November 11, 2017 16:06
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.

4 participants