-
Notifications
You must be signed in to change notification settings - Fork 70
chore: bring codebase to 100% clean mypy compliance across core modules #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mishrak5j
wants to merge
7
commits into
PostHog:main
Choose a base branch
from
mishrak5j:feature/fix-sdk-type-errors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e7e3668
fix(consumer): remove legacy Python 2 imports and type-guard retry st…
mishrak5j 4025388
fix(request): resolve type-shifting assignment, secure path concatena…
mishrak5j 01810bc
fix(client, flags): handle optional before_send type variance and dro…
mishrak5j b5fba9b
Merge branch 'main' into feature/fix-sdk-type-errors
marandaneto 30b00c9
fix: type external imports for mypy
marandaneto dce6a1c
fix: keep request payload behavior unchanged
marandaneto 10e97a6
test: preserve request payload behavior
marandaneto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| pypi/posthog: patch | ||
| --- | ||
|
|
||
| Improve mypy coverage for core SDK modules without changing runtime behavior. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +0,0 @@ | ||
| posthog/request.py:0: error: Library stubs not installed for "requests" [import-untyped] | ||
| posthog/request.py:0: note: Hint: "python3 -m pip install types-requests" | ||
| posthog/request.py:0: note: (or run "mypy --install-types" to install all missing stub packages) | ||
| posthog/request.py:0: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports | ||
| posthog/request.py:0: error: Incompatible types in assignment (expression has type "bytes", variable has type "str") [assignment] | ||
| posthog/consumer.py:0: error: Name "Empty" already defined (possibly by an import) [no-redef] | ||
| posthog/consumer.py:0: error: Unsupported operand types for <= ("int" and "str") [operator] | ||
| posthog/consumer.py:0: note: Right operand is of type "int | str" | ||
| posthog/consumer.py:0: error: Unsupported operand types for < ("str" and "int") [operator] | ||
| posthog/consumer.py:0: note: Left operand is of type "int | str" | ||
| posthog/feature_flags.py:0: error: Unused "type: ignore" comment [unused-ignore] | ||
| posthog/client.py:0: error: Name "queue" already defined (by an import) [no-redef] | ||
| posthog/client.py:0: error: Need type annotation for "queue" [var-annotated] | ||
| posthog/client.py:0: error: Incompatible types in assignment (expression has type "Any | list[Any]", variable has type "None") [assignment] | ||
| posthog/client.py:0: error: Incompatible types in assignment (expression has type "dict[Any, Any]", variable has type "None") [assignment] | ||
| posthog/client.py:0: error: "None" has no attribute "__iter__" (not iterable) [attr-defined] | ||
| posthog/client.py:0: error: Statement is unreachable [unreachable] | ||
| posthog/client.py:0: error: Statement is unreachable [unreachable] | ||
| posthog/client.py:0: error: Name "parse_qs" already defined (possibly by an import) [no-redef] | ||
| posthog/client.py:0: error: Name "urlparse" already defined (possibly by an import) [no-redef] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from datetime import datetime | ||
| from typing import Any | ||
|
|
||
| def parse(timestr: str, *args: Any, **kwargs: Any) -> datetime: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| from typing import Any | ||
|
|
||
| from . import adapters as adapters, exceptions as exceptions | ||
|
|
||
| class Response: | ||
| status_code: int | ||
| ok: bool | ||
| text: str | ||
| headers: dict[str, str] | ||
| def json(self) -> Any: ... | ||
|
|
||
| class Session: | ||
| def mount(self, prefix: str, adapter: adapters.HTTPAdapter) -> None: ... | ||
| def close(self) -> None: ... | ||
| def post( | ||
| self, | ||
| url: str, | ||
| *, | ||
| data: str | bytes, | ||
| headers: dict[str, str], | ||
| timeout: int, | ||
| ) -> Response: ... | ||
| def get( | ||
| self, | ||
| url: str, | ||
| *, | ||
| headers: dict[str, str], | ||
| timeout: int | None = ..., | ||
| ) -> Response: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from typing import Any | ||
|
|
||
| class HTTPAdapter: | ||
| def __init__(self, *args: Any, **kwargs: Any) -> None: ... | ||
| def init_poolmanager(self, *args: Any, **kwargs: Any) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| class Timeout(Exception): ... | ||
| class ConnectionError(Exception): ... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.