Skip to content
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

Fix mypy discovery & all type errors across source #507

Merged
merged 3 commits into from
Sep 24, 2023
Merged

Conversation

cmyui
Copy link
Member

@cmyui cmyui commented Sep 24, 2023

Describe your changes

Related Issues / Projects

Checklist

  • I've manually tested my code
  • The changes pass pre-commit checks (make lint)
  • The changes follow coding style

@@ -1,19 +1,28 @@
[mypy]
strict = True
disallow_untyped_calls = False
exclude = ["tests"]
Copy link
Member Author

Choose a reason for hiding this comment

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

turns out, this is a regex field and was making mypy avoid running on most source files.

mypy was reporting to be running on 3 source files; after these adjustments, it is reporting to run on 70 source files, and pointed out all the additional issues fixed in this PR.

if meta is None:
meta = {}
data = {"status": "success", "data": content, "meta": meta}
return json.ORJSONResponse(data, status_code, headers)
# XXX:HACK to make typing work
return cast(Success[T], json.ORJSONResponse(data, status_code, headers))
Copy link
Member Author

Choose a reason for hiding this comment

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

@tsunyoku rate the based hacks

@@ -22,7 +22,7 @@
import app.settings
import app.state
import app.utils
from app.api import api_router
from app.api import api_router # type: ignore[attr-defined]
Copy link
Member Author

Choose a reason for hiding this comment

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

i think this is a result of a circular import, but i'm not 100% sure

if not (
ctx.player in match.refs
or ctx.player.priv & Privileges.TOURNEY_MANAGER
or f is mp_help.__wrapped__ # type: ignore[attr-defined]
Copy link
Member Author

Choose a reason for hiding this comment

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

pretty funny find

@cmyui cmyui marked this pull request as ready for review September 24, 2023 07:12
@cmyui cmyui self-assigned this Sep 24, 2023
@cmyui cmyui added bug Something isn't working code quality Something is implemented poorly labels Sep 24, 2023
@cmyui cmyui changed the title Fix mypy discovery & all errors across source Fix mypy discovery & all type errors across source Sep 24, 2023
@cmyui cmyui merged commit 33b90a8 into master Sep 24, 2023
5 of 6 checks passed
@cmyui cmyui deleted the fix-mypy-coverage branch September 24, 2023 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code quality Something is implemented poorly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant