harbor run -t openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-0452harbor download openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-0452Title: Implement a lightweight Data base class and GrowFactors utility for test-driven year advancement and simple growth extrapolation (taxcalc.py)
Body: I'm writing a small, test-focused data handling module used by a pytest suite. I need to implement a minimal taxcalc module (taxcalc.py) that provides two classes: Data and GrowFactors. The tests derive from Data (e.g., a Recs subclass) and rely on a simple year-advancement and extrapolation mechanism. Here are the exact requirements I need to satisfy.
What to implement (functional spec)
taxcalc.py should provide:
Behavior and API that the tests depend on:
Data should be instantiable as a base class, and a subclass (like Recs) will implement _extrapolate(year).
Data.init(data, start_year, gfactors, weights) must:
Data.increment_year()
Data._read_data(self, data)
Data._read_weights(self, weights)
Data._extrapolate(self, year)
GrowFactors
Validation rules (to satisfy the specific ValueError tests)
data
start_year
gfactors
weights
Notes about tests and expected behavior
The tests include a derived Recs class (in the test suite) that defines VARINFO_FILE_NAME and uses _extrapolate(year) to scale e00300 by gfactors.factor_value('AINTS', year). Your Data.increment_year should call this _extrapolate(year) when aging, so that e00300 updates accordingly.
Without gfactors (aging disabled), increment_year should not change e00300 (the test confirms this).
The tests call Recs(data, start_year, gfactors, weights) and then inspect:
The tests rely on:
Your implementation should not hard-code dataset specifics; instead, rely on the provided data shape to extract MARS, e00300, and s006 columns.
Acceptance criteria
Implementation hints (for guidance, not required in the question)
If you’ve implemented taxcalc.py with these specs, please share a link or paste your approach. I’m aiming for clean, test-friendly code that supports straightforward instantiation, input validation, year advancement, and simple year-over-year extrapolation logic.