Skip to content

Commit

Permalink
Updating script.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysrevans3 committed Nov 12, 2024
1 parent 53f9c5a commit ffd220b
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions stac_generator/scripts/stac_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
import logging

import click
import pkg_resources
import yaml

from stac_generator.core.exceptions import NoPluginsError
from stac_generator.core.generator import Generator
from stac_generator.core.utils import load_plugins


def setup_logging(conf):
Expand All @@ -28,43 +25,6 @@ def setup_logging(conf):
logging.basicConfig(**config)


def load_config(path):
with open(path) as reader:
conf = yaml.safe_load(reader)
return conf


def load_generator(conf: dict) -> BaseGenerator:
"""
Load the generator.
Looks for generator defined in the configuration in preference
and falls back to the first defined entry point
at ``stac_generator.generators``
:param conf: Configuration dict
:return: Generator
"""

generator = None

if conf.get("generator"):
entry_points = pkg_resources.iter_entry_points(
"stac_generator.generators", conf.get("generator")
)

for entry_point in entry_points:
generator = entry_point.load()

# Only load the first one
break

if not generator:
raise NoPluginsError("No extraction plugins have been loaded")

return generator(conf)


@click.command()
@click.option(
"--conf",
Expand Down

0 comments on commit ffd220b

Please sign in to comment.