-
Notifications
You must be signed in to change notification settings - Fork 30
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
eliminate some false positives on reportUninitializedInstanceVariable
#975
Merged
Conversation
This file contains 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
beauxq
commented
Jan 3, 2025
This comment has been minimized.
This comment has been minimized.
DetachHead
reviewed
Jan 4, 2025
packages/pyright-internal/src/tests/samples/uninitializedVariableBased2.py
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
DetachHead
force-pushed
the
init-methods
branch
from
January 5, 2025 04:06
ca8769f
to
fe88f2e
Compare
DetachHead
approved these changes
Jan 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the contribution
Diff from mypy_primer, showing the effect of this PR on open source code: kornia (https://github.com/kornia/kornia)
- /tmp/mypy_primer/projects/kornia/kornia/contrib/visual_prompter.py:150:14 - error: Instance variable "_tfs_params" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/kornia/kornia/contrib/visual_prompter.py:157:14 - error: Instance variable "image_embeddings" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/kornia/kornia/contrib/visual_prompter.py:158:14 - error: Instance variable "is_image_set" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/kornia/kornia/metrics/average_meter.py:35:5 - error: Instance variable "val" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/kornia/kornia/metrics/average_meter.py:36:5 - error: Instance variable "_avg" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/kornia/kornia/metrics/average_meter.py:37:5 - error: Instance variable "sum" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/kornia/kornia/metrics/average_meter.py:38:5 - error: Instance variable "count" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 6236 errors, 46951 warnings, 0 notes
+ 6229 errors, 46951 warnings, 0 notes
starlette (https://github.com/encode/starlette)
- /tmp/mypy_primer/projects/starlette/starlette/responses.py:80:14 - error: Instance variable "raw_headers" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 201 errors, 4288 warnings, 0 notes
+ 200 errors, 4288 warnings, 0 notes
pytest (https://github.com/pytest-dev/pytest)
- /tmp/mypy_primer/projects/pytest/src/_pytest/logging.py:912:14 - error: Instance variable "_first_record_emitted" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/pytest/src/_pytest/logging.py:916:14 - error: Instance variable "_when" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/pytest/src/_pytest/logging.py:917:14 - error: Instance variable "_section_name_shown" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 1156 errors, 17298 warnings, 0 notes
+ 1153 errors, 17298 warnings, 0 notes
paasta (https://github.com/yelp/paasta)
- /tmp/mypy_primer/projects/paasta/paasta_tools/contrib/mock_patch_checker.py:12:14 - error: Instance variable "imported_patch" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/paasta/paasta_tools/contrib/mock_patch_checker.py:13:14 - error: Instance variable "imported_mock" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 1536 errors, 23751 warnings, 0 notes
+ 1534 errors, 23751 warnings, 0 notes
pyodide (https://github.com/pyodide/pyodide)
- /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/buildall.py:227:14 - error: Instance variable "top_grid" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/buildall.py:232:14 - error: Instance variable "main_grid" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 967 errors, 10000 warnings, 0 notes
+ 965 errors, 10000 warnings, 0 notes
psycopg (https://github.com/psycopg/psycopg)
- /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_cursor_base.py:71:14 - error: Instance variable "_results" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_cursor_base.py:72:14 - error: Instance variable "pgresult" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_cursor_base.py:73:14 - error: Instance variable "_pos" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_cursor_base.py:74:14 - error: Instance variable "_iresult" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_cursor_base.py:75:14 - error: Instance variable "_rowcount" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_cursor_base.py:76:14 - error: Instance variable "_query" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_cursor_base.py:78:14 - error: Instance variable "_execmany_returning" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 1934 errors, 38567 warnings, 0 notes
+ 1927 errors, 38567 warnings, 0 notes
openlibrary (https://github.com/internetarchive/openlibrary)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:31:14 - error: Instance variable "store" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:38:14 - error: Instance variable "account_manager" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:40:14 - error: Instance variable "_cache" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:41:14 - error: Instance variable "docs" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:42:14 - error: Instance variable "docs_historical" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:43:14 - error: Instance variable "changesets" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:44:14 - error: Instance variable "index" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_infobase.py:45:14 - error: Instance variable "keys" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/mocks/mock_ol.py:89:14 - error: Instance variable "sentmail" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/utils/processors.py:30:14 - error: Instance variable "window" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/openlibrary/openlibrary/utils/processors.py:31:14 - error: Instance variable "window_timestamp" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 1907 errors, 33625 warnings, 0 notes
+ 1896 errors, 33625 warnings, 0 notes
sympy (https://github.com/sympy/sympy)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:166:28 - error: Instance variable "T" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:166:33 - error: Instance variable "D" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:166:50 - error: Instance variable "Tfuncs" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:166:60 - error: Instance variable "backsubs" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:167:9 - error: Instance variable "exts" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:167:17 - error: Instance variable "extargs" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:167:28 - error: Instance variable "cases" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:167:37 - error: Instance variable "case" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:167:45 - error: Instance variable "t" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:167:50 - error: Instance variable "d" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:167:63 - error: Instance variable "level" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/integrals/risch.py:168:9 - error: Instance variable "ts" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/logic/algorithms/dpll2.py:144:14 - error: Instance variable "sentinels" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/logic/algorithms/dpll2.py:145:14 - error: Instance variable "occurrence_count" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/logic/algorithms/dpll2.py:146:14 - error: Instance variable "variable_set" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/logic/algorithms/dpll2.py:156:14 - error: Instance variable "clauses" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/secondquant.py:1515:14 - error: Instance variable "basis" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/secondquant.py:1518:14 - error: Instance variable "n_basis" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/secondquant.py:1598:14 - error: Instance variable "particle_locations" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/secondquant.py:1601:14 - error: Instance variable "basis" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/secondquant.py:1607:14 - error: Instance variable "n_basis" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/quantum/circuitplot.py:82:14 - error: Instance variable "_wire_grid" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/quantum/circuitplot.py:83:14 - error: Instance variable "_gate_grid" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/quantum/circuitplot.py:87:14 - error: Instance variable "_figure" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/physics/quantum/circuitplot.py:101:14 - error: Instance variable "_axes" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_axes.py:84:14 - error: Instance variable "label_font" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_axes.py:87:14 - error: Instance variable "_bounding_box" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_axes.py:88:14 - error: Instance variable "_axis_ticks" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_camera.py:34:14 - error: Instance variable "_rot" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_camera.py:48:14 - error: Instance variable "_dist" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_camera.py:49:14 - error: Instance variable "_x" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_camera.py:49:23 - error: Instance variable "_y" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:116:9 - warning: Return type, "Unknown | Zero | One | Probability | Self@Expr | tuple[Unknown, ...] | Sum | Expr | Any | NaN | Piecewise | Basic | Equality | int | NegativeOne | Integer | Rational | ComplexInfinity | Half | Infinity | Number | NegativeInfinity", is partially unknown (reportUnknownParameterType)
+ /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:116:9 - warning: Return type, "Unknown | Zero | One | Probability | Self@Expr | tuple[Unknown, ...] | Sum | Expr | Any | NaN | Piecewise | Basic | Equality | int | NegativeOne | Integer | Rational | ComplexInfinity | Half | Infinity | NegativeInfinity | Float | Number", is partially unknown (reportUnknownParameterType)
- Type of "probability" is "((condition: Unknown, **kwargs: Unknown) -> Unknown) | ((condition: Unknown) -> (Zero | One | Probability | Self@Expr | tuple[Unknown, ...] | Unknown | Sum | Expr | Any | NaN | Piecewise | Basic | Equality | int | NegativeOne | Integer | Rational | ComplexInfinity | Half | Infinity | Number | NegativeInfinity)) | ((condition: Unknown) -> (NaN | Unknown | Piecewise | Integer | Literal[0]))" (reportUnknownMemberType)
+ Type of "probability" is "((condition: Unknown, **kwargs: Unknown) -> Unknown) | ((condition: Unknown) -> (Zero | One | Probability | Self@Expr | tuple[Unknown, ...] | Unknown | Sum | Expr | Any | NaN | Piecewise | Basic | Equality | int | NegativeOne | Integer | Rational | ComplexInfinity | Half | Infinity | NegativeInfinity | Float | Number)) | ((condition: Unknown) -> (NaN | Unknown | Piecewise | Integer | Literal[0]))" (reportUnknownMemberType)
- /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:119:16 - warning: Return type, "Unknown | Zero | One | Probability | Self@Expr | tuple[Unknown, ...] | Sum | Expr | Any | NaN | Piecewise | Basic | Equality | int | NegativeOne | Integer | Rational | ComplexInfinity | Half | Infinity | Number | NegativeInfinity", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:119:16 - warning: Return type, "Unknown | Zero | One | Probability | Self@Expr | tuple[Unknown, ...] | Sum | Expr | Any | NaN | Piecewise | Basic | Equality | int | NegativeOne | Integer | Rational | ComplexInfinity | Half | Infinity | NegativeInfinity | Float | Number", is partially unknown (reportUnknownVariableType)
- Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> NaN) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Expr | Any | Zero | NaN | Piecewise | Basic | Equality | None)) | ((**hints: Unknown) -> Unknown)" (reportUnknownMemberType)
+ Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> NaN) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Expr | Any | Zero | NaN | Piecewise | Basic | None)) | ((**hints: Unknown) -> Unknown)" (reportUnknownMemberType)
- Type of "summation" is "(f: Unknown, ...) -> (tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Expr | Any | Zero | NaN | Piecewise | Basic | Equality | Sum | None)" (reportUnknownVariableType)
... (truncated 3875 lines) ...
janus (https://github.com/aio-libs/janus)
- /tmp/mypy_primer/projects/janus/janus/__init__.py:225:14 - error: Instance variable "_queue" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 25 errors, 1297 warnings, 0 notes
+ 24 errors, 1297 warnings, 0 notes
black (https://github.com/psf/black)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:582:14 - error: Instance variable "visit_assert_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:583:14 - error: Instance variable "visit_if_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:586:14 - error: Instance variable "visit_while_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:587:14 - error: Instance variable "visit_for_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:588:14 - error: Instance variable "visit_try_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:591:14 - error: Instance variable "visit_except_clause" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:592:14 - error: Instance variable "visit_with_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:593:14 - error: Instance variable "visit_classdef" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:595:14 - error: Instance variable "visit_expr_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:596:14 - error: Instance variable "visit_return_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:597:14 - error: Instance variable "visit_import_from" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:598:14 - error: Instance variable "visit_del_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:599:14 - error: Instance variable "visit_async_funcdef" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:600:14 - error: Instance variable "visit_decorated" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:603:14 - error: Instance variable "visit_match_stmt" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:604:14 - error: Instance variable "visit_case_block" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/black/linegen.py:606:18 - error: Instance variable "visit_guard" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/blib2to3/pytree.py:356:14 - error: Instance variable "prev_sibling_map" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/blib2to3/pytree.py:357:14 - error: Instance variable "next_sibling_map" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:351:14 - error: Instance variable "type" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:351:25 - error: Instance variable "value" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:351:37 - error: Instance variable "begin" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:351:49 - error: Instance variable "end" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:351:59 - error: Instance variable "line" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 248 errors, 1266 warnings, 0 notes
+ 224 errors, 1266 warnings, 0 notes
dulwich (https://github.com/dulwich/dulwich)
- /tmp/mypy_primer/projects/dulwich/dulwich/index.py:412:5 - error: Instance variable "_byname" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/dulwich/dulwich/lru_cache.py:296:14 - error: Instance variable "_max_cache" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/dulwich/dulwich/lru_cache.py:298:18 - error: Instance variable "_after_cleanup_count" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/dulwich/dulwich/lru_cache.py:409:14 - error: Instance variable "_max_size" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/dulwich/dulwich/lru_cache.py:411:18 - error: Instance variable "_after_cleanup_size" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 385 errors, 12497 warnings, 0 notes
+ 380 errors, 12497 warnings, 0 notes
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- /tmp/mypy_primer/projects/mongo-python-driver/pymongo/asynchronous/mongo_client.py:904:14 - error: Instance variable "_topology" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/mongo-python-driver/pymongo/asynchronous/mongo_client.py:926:14 - error: Instance variable "_kill_cursors_executor" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/mongo-python-driver/pymongo/synchronous/mongo_client.py:902:14 - error: Instance variable "_topology" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/mongo-python-driver/pymongo/synchronous/mongo_client.py:924:14 - error: Instance variable "_kill_cursors_executor" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 4090 errors, 52005 warnings, 0 notes
+ 4086 errors, 52005 warnings, 0 notes
apprise (https://github.com/caronc/apprise)
- /tmp/mypy_primer/projects/apprise/apprise/plugins/email/base.py:450:34 - error: Instance variable "user" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/apprise/apprise/plugins/fcm/oauth.py:95:14 - error: Instance variable "encoding" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/apprise/apprise/plugins/fcm/oauth.py:98:14 - error: Instance variable "content" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/apprise/apprise/plugins/fcm/oauth.py:101:14 - error: Instance variable "private_key" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/apprise/apprise/plugins/fcm/oauth.py:104:14 - error: Instance variable "__refresh_token" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/apprise/apprise/plugins/fcm/oauth.py:105:14 - error: Instance variable "__access_token" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/apprise/apprise/plugins/fcm/oauth.py:106:14 - error: Instance variable "__access_token_expiry" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 8907 errors, 45170 warnings, 0 notes
+ 8900 errors, 45170 warnings, 0 notes
pydantic (https://github.com/pydantic/pydantic)
- /tmp/mypy_primer/projects/pydantic/pydantic/deprecated/decorator.py:283:14 - error: Instance variable "model" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 493 errors, 7098 warnings, 0 notes
+ 492 errors, 7098 warnings, 0 notes
pyppeteer (https://github.com/pyppeteer/pyppeteer)
- /tmp/mypy_primer/projects/pyppeteer/pyppeteer/frame_manager.py:276:18 - error: Instance variable "_contextPromise" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/pyppeteer/pyppeteer/navigator_watcher.py:82:14 - error: Instance variable "_expectedLifecycle" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 1607 errors, 7932 warnings, 0 notes
+ 1605 errors, 7932 warnings, 0 notes
asynq (https://github.com/quora/asynq)
- /tmp/mypy_primer/projects/asynq/asynq/scheduler.py:59:14 - error: Instance variable "_batches" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/asynq/asynq/scheduler.py:60:14 - error: Instance variable "_tasks" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/asynq/asynq/scheduler.py:61:14 - error: Instance variable "active_task" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/asynq/asynq/scheduler.py:307:14 - error: Instance variable "current" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 210 errors, 3561 warnings, 0 notes
+ 206 errors, 3561 warnings, 0 notes
scikit-learn (https://github.com/scikit-learn/scikit-learn)
- /tmp/mypy_primer/projects/scikit-learn/sklearn/ensemble/_hist_gradient_boosting/grower.py:129:14 - error: Instance variable "children_lower_bound" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/scikit-learn/sklearn/ensemble/_hist_gradient_boosting/grower.py:130:14 - error: Instance variable "children_upper_bound" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/scikit-learn/sklearn/ensemble/_hist_gradient_boosting/grower.py:413:14 - error: Instance variable "root" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- 17045 errors, 198421 warnings, 0 notes
+ 17042 errors, 198421 warnings, 0 notes
bokeh (https://github.com/bokeh/bokeh)
- /tmp/mypy_primer/projects/bokeh/src/bokeh/application/handlers/code_runner.py:68:5 - error: Instance variable "_failed" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
- /tmp/mypy_primer/projects/bokeh/src/bokeh/application/handlers/code_runner.py:69:5 - error: Instance variable "_error" is not initialized in the class body or __init__ method (reportUninitializedInstanceVariable)
... (truncated 402 lines) ...``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a common and good pattern that
reportUninitializedInstanceVariable
currently fails with.Often we want a class to have a "reset" method to reset it back to its initial state.
But if we initialize everything in
__init__
, that means we're duplicating code, putting it in both__init__
and in thereset
method.So it's better to just put the initializing code in the
reset
method and__init__
can call thereset
method.But the current implementation of
reportUninitializedInstanceVariable
doesn't seex
as initialized.This is a fix for this problem.