Skip to content

Commit

Permalink
fix(file): Fix recursive=False parameter in FileWalker
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Dec 21, 2020
1 parent e855efc commit c81fd76
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ddb/utils/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,6 @@ def _do_yield(self, source): # pylint:disable=no-self-use

def _walk(self, *args, recursive=True, **kwargs):
_walk_generator = os.walk(*args, **kwargs)
if not recursive:
try:
_walk_generator = next(_walk_generator)
except StopIteration:
return
for root, dirs, files in os.walk(*args, **kwargs):
for dirs_item in list(dirs):
dirpath = os.path.join(root, dirs_item)
Expand All @@ -215,6 +210,9 @@ def _walk(self, *args, recursive=True, **kwargs):
not self._is_excluded(filepath, *self.excludes):
yield filepath

if not recursive:
break

@staticmethod
def _braceexpand(includes, excludes):
expanded_includes = []
Expand Down

0 comments on commit c81fd76

Please sign in to comment.