Skip to content

Refactor data.py: split the 808-LOC module and decompose its B(10) blocks #871

Description

@tschm

Subcategory: Code complexity (9→10) and Overall architecture (9→10)

src/jquantstats/data.py is the largest module in the codebase at 808 LOC and trends toward a god-module. It also contains the worst-ranking complexity blocks in src/.

What to change

  • Split src/jquantstats/data.py (currently 808 LOC) so the module drops below ~500 LOC.
  • Decompose the B(10) blocks: Data.from_prices (L414), _apply_null_strategy (L36); also review Data._truncate_integer (L753, B/8) and interpolate (L89, B/7).
  • Move construction/interpolation helpers out of data.py into _utils/ to reduce coupling.

Evidence

radon cc src -s:  Data.from_prices - B (10),  _apply_null_strategy - B (10)
wc -l:            src/jquantstats/data.py = 808 (largest module in src/)

Average CC across src/ is A (2.86) and there are zero C-or-worse blocks — this is the sole complexity/architecture edge.

Done when

  • src/jquantstats/data.py is < 500 LOC, and
  • no block in data.py exceeds CC B(7), and
  • make test / make typecheck / make docs-coverage remain green at 100%.

Context: PR #870

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions