0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 13:39:22 +01:00
posthog/mypy.ini

26 lines
530 B
INI
Raw Permalink Normal View History

2020-01-24 20:00:25 +01:00
[mypy]
2024-06-27 23:16:27 +02:00
python_version = 3.11
2020-01-24 20:00:25 +01:00
plugins =
mypy_django_plugin.main,
mypy_drf_plugin.main,
pydantic.mypy
2020-01-24 20:00:25 +01:00
strict_optional = True
Configure mypy (#562) * server/mypy: Enable no_implicit_optional no_implicit_optional Changes the treatment of arguments with a default value of None by not implicitly making their type Optional. Ref: https://mypy.readthedocs.io/en/stable/config_file.html#none-and-optional-handling * server/mypy: Enable warn_unused_ignores warn_unused_ignores: Warns about unneeded # type: ignore comments. Ref: https://mypy.readthedocs.io/en/stable/config_file.html#configuring-warnings It's best to exclude packages with no typing in mypy.ini rather than in the code. This waym if tin the future these packages add types it's can easily be disabled (by removing the exclusion in mypy.ini). * api/user: Fix user password was not really validated * api/test/base: Remove unreachable code Team is created in setup, so no reason for it not to be there (unless setUp is overriden by child, which as far as I can see is currently not happening), * server/mypy: Enable check_untyped_defs check_untyped_defs: Type-checks the interior of functions without type annotations. Ref: https://mypy.readthedocs.io/en/stable/config_file.html#untyped-definitions-and-calls * server/mypy: Enable strict_equality strict_equality: Prohibit equality checks, identity checks, and container checks between non-overlapping types. Ref: https://mypy.readthedocs.io/en/stable/config_file.html#miscellaneous-strictness-flags * server/mypy: Enable warn_unreachable Added a fixme for a possible oversight in function that parses JSON. warn_unreachable: Shows a warning when encountering any code inferred to be unreachable or redundant after performing type analysis. Ref: https://mypy.readthedocs.io/en/stable/config_file.html#configuring-warnings * api/posthog: fix possible bug when batch is not a list Current code assumes batch is a valid list. If batch is not a list, the capture handling will cause a 500 error. * fix stricter mypy * Use response.json instead of .data Co-authored-by: Haki Benita <hakibenita@gmail.com>
2020-04-14 12:05:45 +02:00
no_implicit_optional = True
warn_unused_ignores = True
check_untyped_defs = True
warn_unreachable = True
strict_equality = True
ignore_missing_imports = True
[mypy-bin.*]
ignore_errors = True
[mypy-posthog.hogql.grammar.*]
ignore_errors = True
2020-01-24 20:00:25 +01:00
[mypy-posthog.tasks.*]
disallow_untyped_defs = True
check_untyped_defs = True
2020-01-24 20:00:25 +01:00
[mypy.plugins.django-stubs]
django_settings_module = posthog.settings