Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jan 7, 2025
1 parent 5d3e8d7 commit 8911b09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/ogdc_runner/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ def is_url(recipe_path):
parsed = urlparse(recipe_path)
return parsed.scheme in ("http", "https") and parsed.netloc != ""


def format_url(recipe_path):
if "https://github.com/" not in recipe_path:
return "Invalid GitHub URL"
# remove first part of URL
base_url = recipe_path.replace("https://github.com/", "")

components = base_url.split("/")
owner = (f"{components[0]}:{components[1]}".lower())
owner = f"{components[0]}:{components[1]}".lower()
branch = components[3]
file_path = "/".join(components[4:])

Expand Down
10 changes: 5 additions & 5 deletions src/ogdc_runner/recipe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

from pathlib import Path
import fsspec

import fsspec
import yaml

from ogdc_runner.constants import RECIPE_CONFIG_FILENAME
Expand All @@ -11,14 +11,14 @@

def get_recipe_config(recipe_directory: str) -> RecipeConfig:
"""Extract config from a recipe configuration file (meta.yml)."""
if 'github' in recipe_directory:
fs = fsspec.filesystem("github", org='QGreenland-Net', repo='ogdc-recipes')
recipe_path = recipe_directory + '/' + RECIPE_CONFIG_FILENAME
if "github" in recipe_directory:
fs = fsspec.filesystem("github", org="QGreenland-Net", repo="ogdc-recipes")
recipe_path = recipe_directory + "/" + RECIPE_CONFIG_FILENAME
try:
with fs.open(recipe_path, "rt") as config_file:
config_dict = yaml.safe_load(config_file)
except FileNotFoundError:
raise FileNotFoundError(f"File not found at: {recipe_path}")
raise FileNotFoundError(f"File not found at: {recipe_path}")
else:
with (Path(recipe_directory) / RECIPE_CONFIG_FILENAME).open() as config_file:
config_dict = yaml.safe_load(config_file)
Expand Down

0 comments on commit 8911b09

Please sign in to comment.