Skip to content

Commit

Permalink
Clean up unused config error creation. (#50)
Browse files Browse the repository at this point in the history
The logic introduced in #47 was overly complex. There is never an active
`DocConfig` outside a `science doc ...` command invocation.
  • Loading branch information
jsirois authored Sep 24, 2023
1 parent cd5d573 commit 8ca0c07
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions science/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from typing import BinaryIO

from science.build_info import BuildInfo
from science.context import DocConfig, active_context_config
from science.data import Data
from science.dataclass import Dataclass
from science.dataclass.deserializer import parse as parse_dataclass
from science.doc import DOC_SITE_URL
from science.errors import InputError
from science.frozendict import FrozenDict
from science.hashing import Digest, Provenance
Expand Down Expand Up @@ -113,12 +113,6 @@ def parse_interpreter_group(ig_data: Data) -> InterpreterGroup:

unused_items = list(lift.iter_unused_items())
if unused_items:
doc_config = active_context_config(DocConfig)
doc_url = (
f"{doc_config.site}/manifest.html"
if doc_config
else "https://science.scie.app/manifest.html"
)
raise InputError(
dedent(
"""\
Expand All @@ -131,7 +125,7 @@ def parse_interpreter_group(ig_data: Data) -> InterpreterGroup:
.format(
manifest_source=data.provenance.source,
unrecognized_fields="\n".join(key for key, _ in unused_items),
doc_url=doc_url,
doc_url=f"{DOC_SITE_URL}/manifest.html",
)
.strip()
)
Expand Down

0 comments on commit 8ca0c07

Please sign in to comment.