Skip to content

Replace remaining assert isinstance(...) statements with proper TypeError exceptions across the codebase #1041

@suhaan-24

Description

@suhaan-24

Following the pattern from #1033, I noticed there are still several assert isinstance(...) statements used for runtime type checking across the codebase. These have the same problem: they're silently disabled when Python runs with optimisation flags (python -O) and produce generic AssertionError instead of a descriptive TypeError.
Affected files and locations:

  • frq_base.py — lines 275, 516
  • cnv_frq.py — lines 93, 263, 507
  • sample_metadata.py — lines 1167, 1280, 1329, 1431, 1695
  • util.py — lines 314, 378, 649, 1474, 1475, 1495, 1496, 1515, 1516
    Each should be replaced with an explicit if not isinstance(...): raise TypeError(...) that includes a message about what type was expected vs. what was received.
    Happy to submit a PR for this!

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