Skip to content

docs: narrow Optional radiated_noise in autocomplete example#15

Merged
IanMayo merged 1 commit into
mainfrom
claude/wonderful-noether-ycnjwz
Jun 20, 2026
Merged

docs: narrow Optional radiated_noise in autocomplete example#15
IanMayo merged 1 commit into
mainfrom
claude/wonderful-noether-ycnjwz

Conversation

@IanMayo

@IanMayo IanMayo commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What

The examples/explore_platform.py scratch file (added for Adventure 2) triggered a Pylance reportOptionalMemberAccess warning: radiated_noise is Optional on the generated model (the schema allows it to be absent), so .band is flagged as a possible None access. The pipeline's verification gates guarantee it's populated, but the type checker can't know that statically — so the shipped learning file showed a red squiggle.

Changes

  • Add assert platform.radiated_noise is not None after the build — the same Optional-narrowing idiom the pipeline code uses (cli.py). After it, .band is a clean, fully-typed access, and it's an instructive moment about working with Optional.
  • Point the in-file TODO at # platform.radiated_noise. and sync the README walkthrough (mentions trying platform. for top-level attributes too).

Verification

  • python examples/explore_platform.py runs and prints the platform type and first band centre frequency.
  • mypy reports no issues on the file.

🤖 Generated with Claude Code


Generated by Claude Code

The shipped scratch file triggered a Pylance reportOptionalMemberAccess
warning because radiated_noise is Optional on the schema. Add an assert
to narrow it (the same idiom the pipeline uses, and an instructive one),
so learners see clean, fully-typed access. Sync the README walkthrough.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AHAkhfmfcCdWTHZuvRcJNF
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-20 18:17 UTC

@IanMayo IanMayo merged commit 7cf840d into main Jun 20, 2026
3 checks passed
@IanMayo IanMayo deleted the claude/wonderful-noether-ycnjwz branch June 20, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants