harbor run -t openthoughts/tasktrove-exp-rpt-curriculum-medium-curriculum-medium-0452harbor download openthoughts/tasktrove-exp-rpt-curriculum-medium-curriculum-medium-0452Goal
Re-implement a small configuration system as a Python package under /app/ that tests can import as:
from analyzer import configfrom analyzer.config import DEFAULT_RECIPE_SERVER, RecipeStatsConfigYou must place the package at /app/analyzer/ with at least:
__init__.pyconfig.pyThe implementation should be lightweight, dependency-free, and robust enough to handle a few edge cases described below. Do not modify the tests.
What to implement
/app/analyzer containing:
__init__.py (can be empty or contain a short docstring)config.py (the real implementation)analyzer.config, define:
DEFAULT_RECIPE_SERVER: strRecipeStatsConfig: class"default".__new__ so that every instantiation returns the same single instance.__init__ does not reset values on subsequent creations (guard re-initialization if needed).RECIPE_SERVER: str
RECIPE_SERVER should be initialized to DEFAULT_RECIPE_SERVER.make_config(self) -> None
config.yml exists in the current working directory, read it and interpret a very small YAML-like mapping to override RECIPE_SERVER.self.RECIPE_SERVER (i.e., the key matches the default server string), then set self.RECIPE_SERVER to the corresponding value from the mapping.RECIPE_SERVER as-is (the default or previously set value).config.yml gracefully (no change).#).RECIPE_SERVER).RecipeStatsConfig() and calling make_config() leaves RECIPE_SERVER as DEFAULT_RECIPE_SERVER.config.yml containing a single line like "<DEFAULT_RECIPE_SERVER>: ahost:123" exists, calling make_config() updates RECIPE_SERVER to "ahost:123". After the test, config.yml is removed.analyzer.config (e.g., _parse_simple_yaml(lines: List[str]) -> dict) to keep parsing logic organized.make_config is the explicit trigger to read config.yml.from analyzer import configfrom analyzer.config import DEFAULT_RECIPE_SERVER, RecipeStatsConfiganalyzer must be a package (not a bare module) and exist under /app/ so imports work as shown.config.yml and only override when the expected mapping key exists._instance) and return it from __new__.Deliverable
/app/analyzer/__init__.py/app/analyzer/config.pyDEFAULT_RECIPE_SERVER = "default" and implement RecipeStatsConfig with the behaviors described.Optional but recommended
make_config and provide clear no-op behavior if parsing fails.