Skip to content

Add @overload typing for get() and get_all()#6

Merged
MWals merged 4 commits into
Wals-pro:mainfrom
Sean-A-W:fix/overload-typing
Mar 6, 2026
Merged

Add @overload typing for get() and get_all()#6
MWals merged 4 commits into
Wals-pro:mainfrom
Sean-A-W:fix/overload-typing

Conversation

@Sean-A-W

Copy link
Copy Markdown
Contributor

Summary

  • Adds @overload signatures to get() and get_all() so static type checkers (Pylance, mypy, pyright) can narrow the return type based on return_weclapp_response
  • When return_weclapp_response=False (default): returns List[Any] / Dict[str, Any]
  • When return_weclapp_response=True: returns WeclappResponse
  • No runtime behavior change — only affects static type analysis

Problem

Without overloads, callers using the default get a Union[List, WeclappResponse] type, causing false errors like:

  • "extend" is not a known attribute of "WeclappResponse"
  • "WeclappResponse" is not iterable

Test plan

  • Verified locally with static type checkers — errors resolve correctly
  • Existing tests should pass unchanged (no runtime changes)

🤖 Generated with Claude Code

Sean-A-W and others added 4 commits February 23, 2026 12:48
Pylance/mypy cannot narrow the Union return type of get() and get_all()
based on the return_weclapp_response parameter. This causes false errors
when callers use the default (return_weclapp_response=False) and expect
a List or Dict.

Adding @overload signatures with Literal[True]/Literal[False] lets type
checkers correctly infer:
- List[Any] / Dict[str, Any] when return_weclapp_response is False (default)
- WeclappResponse when return_weclapp_response is True

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Preserve the overload typing improvement while avoiding a runtime import dependency on Literal so the module remains compatible with the project's documented older Python versions.

Made-with: Cursor
…t for Python 3.9+

- Updated README to state official support for Python 3.9 and newer, including CI details.
- Revised test documentation to reflect the new minimum Python version requirement.
@MWals

MWals commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Thanks a lot for the contribution, Sean. This is a genuinely useful improvement for editor and static type checker ergonomics, and I appreciate how clearly you described the problem and intended behavior.

I pulled the branch locally, reviewed it against the current main, and reran the full test suite plus our live validation against the test system on the resolved version. Everything looked good from my side. I still need to update the branch with the latest main changes so GitHub can merge it cleanly, but the overall approach looks solid.

Thanks again for taking the time to put this together.

@MWals

MWals commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Thanks a lot for the contribution, Sean. This is a genuinely useful improvement for editor and static type checker ergonomics, and I appreciate how clearly you described the problem and intended behavior.

I pulled the branch locally, reviewed it against the current main, and reran the full test suite plus our live validation against the test system on the resolved version. Everything looked good from my side. I still need to update the branch with the latest main changes so GitHub can merge it cleanly, but the overall approach looks solid.

Thanks again for taking the time to put this together.

It will be released now within version 0.4.1.

@MWals MWals merged commit 278fa74 into Wals-pro:main Mar 6, 2026
4 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.

2 participants