Skip to content

Commit

Permalink
Simplifying code
Browse files Browse the repository at this point in the history
Suggestions from @martindurant in code review.

Co-authored-by: Martin Durant <[email protected]>
  • Loading branch information
johandahlberg and martindurant committed Aug 21, 2024
1 parent 25f306a commit 6629cc4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fsspec/implementations/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,15 @@ def _below_max_recursion_depth(path):
# from the file paths
if zip_info.is_dir():
if withdirs:
if not result.get(file_name) and _below_max_recursion_depth(
if not file_name in result and _below_max_recursion_depth(
file_name
):
result[file_name.strip("/")] = (
self.info(file_name) if detail else None
)
continue
else:
continue # Skip along to the next entry if we don't want to add the dirs
continue

if not result.get(file_name):
if file_name not in result:
if _below_max_recursion_depth(file_name):
result[file_name] = self.info(file_name) if detail else None

Expand All @@ -187,4 +185,4 @@ def _below_max_recursion_depth(path):
"type": "directory",
}

return result if detail else sorted(result.keys())
return result if detail else sorted(result)

0 comments on commit 6629cc4

Please sign in to comment.