Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066501
D4700.id16665.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
942 B
Subscribers
None
D4700.id16665.diff
View Options
diff --git a/swh/lister/pattern.py b/swh/lister/pattern.py
--- a/swh/lister/pattern.py
+++ b/swh/lister/pattern.py
@@ -6,6 +6,7 @@
from dataclasses import dataclass
from typing import Any, Dict, Generic, Iterable, Iterator, List, Optional, TypeVar
+from swh.core.config import load_from_envvar
from swh.scheduler import get_scheduler, model
from swh.scheduler.interface import SchedulerInterface
@@ -246,3 +247,14 @@
scheduler_instance = get_scheduler(**scheduler)
return cls(scheduler=scheduler_instance, **config)
+
+ @classmethod
+ def from_configfile(cls, **kwargs: Any):
+ """Instantiate a lister from the configuration loaded from the
+ SWH_CONFIG_FILENAME envvar, with potential extra keyword arguments.
+
+ Args:
+ kwargs: kwargs passed to the lister instantiation
+ """
+ config = load_from_envvar()
+ return cls.from_config(**config, **kwargs)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 12:47 PM (12 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3222448
Attached To
D4700: Add a helper to instantiate a new-style lister from a config file
Event Timeline
Log In to Comment