Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9345574
D6313.id22925.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6313.id22925.diff
View Options
diff --git a/swh/lister/gnu/lister.py b/swh/lister/gnu/lister.py
--- a/swh/lister/gnu/lister.py
+++ b/swh/lister/gnu/lister.py
@@ -4,7 +4,7 @@
# See top-level LICENSE file for more information
import logging
-from typing import Any, Iterator, Mapping
+from typing import Any, Iterator, Mapping, Optional
import iso8601
@@ -36,12 +36,16 @@
instance="GNU",
credentials=credentials,
)
- self.gnu_tree = GNUTree(f"{self.url}/tree.json.gz")
+ # no side-effect calls in constructor, if extra state is needed, as preconized
+ # by the pattern docstring, this must happen in the get_pages method.
+ self.gnu_tree: Optional[GNUTree] = None
def get_pages(self) -> Iterator[GNUPageType]:
"""
Yield a single page listing all GNU projects.
"""
+ # first fetch the manifest to parse
+ self.gnu_tree = GNUTree(f"{self.url}/tree.json.gz")
yield self.gnu_tree.projects
def get_origins_from_page(self, page: GNUPageType) -> Iterator[ListedOrigin]:
@@ -49,6 +53,7 @@
Iterate on all GNU projects and yield ListedOrigin instances.
"""
assert self.lister_obj.id is not None
+ assert self.gnu_tree is not None
artifacts = self.gnu_tree.artifacts
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 3:25 PM (1 w, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3231093
Attached To
D6313: gnu: Respect the pattern docstring about extra state initialization
Event Timeline
Log In to Comment