Skip to content

Commit b353feb

Browse files
committed
make sure logging options are applied when calling populators directly
1 parent eeeb6ae commit b353feb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

STACpopulator/cli.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
import sys
66
from types import ModuleType
77
import warnings
8-
from typing import Callable
98

109
from STACpopulator import __version__, implementations
1110
from STACpopulator.exceptions import STACPopulatorError
1211
from STACpopulator.log import setup_logging
1312

1413

15-
def add_parser_args(parser: argparse.ArgumentParser) -> dict[str, Callable]:
14+
def add_parser_args(parser: argparse.ArgumentParser) -> None:
1615
parser.add_argument(
1716
"--version",
1817
"-V",

STACpopulator/implementations/CMIP6_UofT/add_CMIP6.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pystac.extensions.datacube import DatacubeExtension
1010
from requests.sessions import Session
1111

12+
from STACpopulator import cli
1213
from STACpopulator.log import add_logging_options
1314
from STACpopulator.request_utils import add_request_options, apply_request_options
1415
from STACpopulator.extensions.cmip6 import CMIP6Helper, CMIP6Properties
@@ -131,8 +132,8 @@ def main(*args: str) -> int:
131132
parser = argparse.ArgumentParser()
132133
add_parser_args(parser)
133134
ns = parser.parse_args(args or None)
134-
return runner(ns)
135-
135+
ns.populator = "CMIP6_UofT"
136+
return cli.run(ns)
136137

137138
if __name__ == "__main__":
138139
sys.exit(main())

STACpopulator/implementations/DirectoryLoader/crawl_directory.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from requests.sessions import Session
88

9+
from STACpopulator import cli
910
from STACpopulator.log import add_logging_options
1011
from STACpopulator.request_utils import add_request_options, apply_request_options
1112
from STACpopulator.input import STACDirectoryLoader
@@ -72,7 +73,8 @@ def main(*args: str) -> int:
7273
parser = argparse.ArgumentParser()
7374
add_parser_args(parser)
7475
ns = parser.parse_args(args or None)
75-
return runner(ns)
76+
ns.populator = "DirectoryLoader"
77+
return cli.run(ns)
7678

7779

7880
if __name__ == "__main__":

0 commit comments

Comments
 (0)