Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123170
D2960.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D2960.diff
View Options
diff --git a/swh/model/from_disk.py b/swh/model/from_disk.py
--- a/swh/model/from_disk.py
+++ b/swh/model/from_disk.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 The Software Heritage developers
+# Copyright (C) 2017-2020 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
@@ -8,7 +8,7 @@
import stat
import attr
-from typing import List, Optional
+from typing import List, Optional, Iterable, Any
from .hashutil import MultiHash
from .merkle import MerkleLeaf, MerkleNode
@@ -196,7 +196,8 @@
return DiskBackedContent.from_dict(data)
-def accept_all_directories(dirname, entries):
+def accept_all_directories(
+ dirpath: str, dirname: str, entries: Iterable[Any]) -> bool:
"""Default filter for :func:`Directory.from_disk` accepting all
directories
@@ -207,7 +208,8 @@
return True
-def ignore_empty_directories(dirname, entries):
+def ignore_empty_directories(
+ dirpath: str, dirname: str, entries: Iterable[Any]) -> bool:
"""Filter for :func:`directory_to_objects` ignoring empty directories
Args:
@@ -233,8 +235,10 @@
if not case_sensitive:
names = [name.lower() for name in names]
- def named_filter(dirname, entries,
- names=names, case_sensitive=case_sensitive):
+ def named_filter(dirpath: str, dirname: str,
+ entries: Iterable[Any],
+ names: Iterable[Any] = names,
+ case_sensitive: bool = case_sensitive):
if case_sensitive:
return dirname not in names
else:
@@ -282,7 +286,6 @@
max_content_length (Optional[int]): if given, all contents larger
than this will be skipped.
"""
-
top_path = path
dirs = {}
@@ -297,7 +300,7 @@
path=path, max_content_length=max_content_length)
entries[name] = content
else:
- if dir_filter(name, dirs[path].entries):
+ if dir_filter(path, name, dirs[path].entries):
entries[name] = dirs[path]
dirs[root] = cls({'name': os.path.basename(root)})
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 18, 1:19 AM (2 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220127
Attached To
D2960: swh-model: exclude path support for the function from_disk in Directory
Event Timeline
Log In to Comment