Skip to content

refactor(run): Run.__init__ does not call super().__init__() #160

Description

@MAfarrag

Context

PR #149 added type annotations to `Run.init` which made an
existing inheritance defect more visible. `Run` inherits from
`Catchment` but its `init` only sets `self.Qsim` without
calling `super().init()`.

Problem / Current Behaviour

```python
class Run(Catchment):
def init(self, *args, **kwargs):
self.Qsim: np.ndarray | pd.DataFrame | None = None
```

Instantiating `Run()` directly creates an object missing all 45+
Catchment attributes. The class only works because callers construct
a `Catchment` first, populate its attributes via `read_*()` methods,
and then call `Run` methods on the same object.

Affected locations

File Symbol Notes
`src/Hapi/run.py:35-37` `Run.init` Missing `super().init()`

Proposed Solution

Either:

  1. Add `super().init(*args, **kwargs)` to `Run.init`
  2. Or document the intended usage pattern (construct Catchment, then
    call Run methods) and remove the misleading `init`

Effort Estimate

Size: `S`

Definition of Done

  • `Run.init` either calls `super().init()` or is removed
  • Direct `Run()` instantiation either works or raises a clear error
  • Existing tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions