Skip to content

Annotate un-annotated functions and arguments across src/ and demo.py #66

Description

@tschm

Subcategory: Linting/style + Type safety
Score: linting 4 → ~7, type safety 3 → ~5

This is the highest-leverage single change in the batch: the missing annotations are counted by both gates — 17 ANN* errors in make fmt and 13 no-untyped-def/no-untyped-call errors in mypy --strict are the same defect seen by two tools.

What to change

  • src/pycharting/core/server.py:30NoCacheStaticFiles.get_response, arg scope
  • src/pycharting/core/server.py:207health_check return type
  • src/pycharting/core/server.py:213not_found_handler(request, exc)(request: Request, exc: Exception) -> JSONResponse
  • src/pycharting/core/server.py:220server_error_handler(request, exc) → same
  • src/pycharting/core/lifecycle.py:237__enter__-> "ChartServer"
  • src/pycharting/core/lifecycle.py:242__exit__, plus its three params (exc_type, exc_val, exc_tb)
  • src/pycharting/api/routes.py:96get_data return type
  • src/pycharting/data/ingestion.py:363slice_opt(arr)
  • demo.py:45generate_ohlc

done when

ruff reports no ANN001/ANN201/ANN202/ANN204, and mypy --strict reports no no-untyped-def or no-untyped-call.

Evidence

ANN204 Missing return type annotation for special method `__enter__`
  --> src/pycharting/core/lifecycle.py:237:9

Surfaced by the Rhiza quality gates during the template bump to jebel-quant/rhiza@v1.2.2, which enabled the stricter ruff rule families (ANN, A, BLE, ARG) and TYPECHECKER=both. Gate status at time of filing: make fmt FAIL, make typecheck FAIL, make docs-coverage FAIL, test-layout FAIL; make deptry, make security, make test PASS (154 tests, 100% coverage).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions