Skip to content

Fixup Type Annotations - #55

Merged
gazpachoking merged 3 commits into
starfederation:developfrom
thomasmatecki:develop
Sep 27, 2026
Merged

gazpachoking merged 3 commits into
starfederation:developfrom
thomasmatecki:develop

Conversation

@thomasmatecki

@thomasmatecki thomasmatecki commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Refines type annotations in src/datastar_py/attributes.py.

  • Add type parameters to Mapping where appropriate. [1] [2] [3] [4]
  • Changed the BaseAttr super class to include type params: Mapping[str, str | Literal[True]]
  • Defined a JSObjectDict type alias for JavaScript object construction and updated the _js_object helper function to use it.
  • Added a _mods dictionary attribute type to the TimingMod, DelayMod, and ViewtransitionMod classes. These classes is always mixed in with BaseAttr [1] [2] [3]
  • Added type params to return type of _filter_dict.

Comment thread src/datastar_py/attributes.py Outdated
Comment on lines +731 to +732
def _filter_dict(include: str | None = None, exclude: str | None = None) -> dict[str, str | None]:
filter_dict: dict[str, str| None] = {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the return type should be dict[str, str], i.e. without the None. None will never be inserted by this function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call: f13a0f6

@gazpachoking

gazpachoking commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks! Mind running the linting on this? EDIT: I ran the lint locally.

@gazpachoking
gazpachoking merged commit 0bc1f65 into starfederation:develop Sep 27, 2026
1 of 2 checks passed
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.

3 participants