def clean_model_targets(self): start_row = 4 end_row = self.schema( IntCell(find_row("INPUTS!A", "Model End Row", target="B"))) raw_targets = self.schema_list(schema=self.MODEL_SCHEMA, start=start_row, end=end_row) # Add the end dates for each of the targets for target in raw_targets: start = target["start"] target["end"] = start + timedelta(days=7) # Fix up the total investment targets for raw_target in raw_targets: for category in ["acq", "ret"]: raw_target[f"target_{category}_investment"] = ( raw_target[f"target_{category}_expenses"] ["demand_creation"] + raw_target[f"target_{category}_expenses"] ["leasing_enablement"] + raw_target[f"target_{category}_expenses"] ["market_intelligence"] + raw_target[f"target_{category}_expenses"] ["reputation_building"]) # Drop the extraneous period. return raw_targets
def find_overview(predicate): """Return a locator that scans column A of the overview sheet for header values.""" return find_row("Overview!A", predicate, target="B")
def find(predicate): return find_row("OUTPUT!A", predicate, target="B")
def find_meta(predicate): """Return a locator that scans the META!A column for header values and returns contents of column B.""" return find_row("META!A", predicate, target="B")
def locate_overview_header_cell(self, predicate): predicate = predicate if callable(predicate) else matchp( iexact=predicate) return find_row("Overview!A", predicate)(self.workbook)
def find_version(predicate): """Return a locator that scans the VERSION!A column for header values and returns values in VERSION!B""" return find_row("VERSION!A", predicate, target="B")
def find(predicate, target="B"): """Return a locator that scans the Output!A column for header values and returns target column.""" return find_row("Output!A", predicate, target=target)
def _find(predicate): return find_row("Output!A", predicate, start_row=row)