-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Enforce handling sys.std{in,out,err} is None
#12485
Conversation
As per the Python docs [1], these streams can be None (see [2] for a list of possible circumstances). The current usage of MaybeNone causes a false negative, which is a shame because spreading the little known knowledge that `sys.stderr.write()` is broken code is something that type checkers would otherwise be ideal at. [1]: https://docs.python.org/3/library/sys.html#sys.__stderr__ [2]: python/cpython#122633
Diff from mypy_primer, showing the effect of this PR on open source code: python-sop (https://gitlab.com/dkg/python-sop)
+ sop/__init__.py:441: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ sop/__init__.py:442: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
porcupine (https://github.com/Akuli/porcupine)
+ porcupine/__main__.py:156: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/addons/termlog.py:40: error: Incompatible types in assignment (expression has type "IO[str] | None", variable has type "IO[str]") [assignment]
+ mitmproxy/addons/save.py:117: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ mitmproxy/addons/readfile.py:91: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ mitmproxy/addons/errorcheck.py:35: error: Argument 1 to "ensure_supported" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ mitmproxy/tools/console/master.py:201: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ mitmproxy/addons/dumper.py:50: error: Incompatible types in assignment (expression has type "IO[str] | None", variable has type "IO[str]") [assignment]
+ mitmproxy/tools/main.py:93: error: Argument 2 to "dump_defaults" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
flake8 (https://github.com/pycqa/flake8)
+ src/flake8/utils.py:188: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ src/flake8/formatting/base.py:52: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ src/flake8/formatting/base.py:178: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
rich (https://github.com/Textualize/rich)
+ rich/syntax.py:931: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ rich/style.py:730: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ rich/markdown.py:757: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ rich/json.py:132: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ rich/live.py:182: error: Argument 2 to "FileProxy" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ rich/live.py:185: error: Argument 2 to "FileProxy" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
PyWinCtl (https://github.com/Kalmat/PyWinCtl)
+ src/pywinctl/_main.py:980: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ src/pywinctl/_main.py:981: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ src/pywinctl/_main.py:982: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ src/pywinctl/_main.py:983: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ src/pywinctl/_main.py:986: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ src/pywinctl/_main.py:987: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
xarray (https://github.com/pydata/xarray)
+ xarray/core/dataset.py: note: In member "info" of class "Dataset":
+ xarray/core/dataset.py:2613: error: Item "None" of "TextIO | IO[Any] | None" has no attribute "write" [union-attr]
+ xarray/core/dataset.py: note: At top level:
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/utils.py: note: In function "stdout":
+ schema_salad/utils.py:124:22: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
+ schema_salad/makedoc.py: note: In function "main":
+ schema_salad/makedoc.py:776:9: error: Argument 1 to "makedoc" has incompatible type "TextIO | None"; expected "IO[Any]" [arg-type]
+ schema_salad/codegen.py: note: In function "codegen":
+ schema_salad/codegen.py:69:20: error: Incompatible types in assignment (expression has type "TextIO | None", variable has type "TextIOWrapper[_WrappedBuffer] | TextIO") [assignment]
+ schema_salad/main.py: note: In function "main":
+ schema_salad/main.py:282:13: error: Argument 1 to "makedoc" has incompatible type "TextIO | None"; expected "IO[Any]" [arg-type]
+ schema_salad/main.py:296:34: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:300:58: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:355:40: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:363:32: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:369:25: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:378:39: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:382:46: error: Argument 2 to "print_inheritance" has incompatible type "TextIO | None"; expected "IO[Any]" [arg-type]
+ schema_salad/main.py:386:61: error: Argument 3 to "print_fieldrefs" has incompatible type "TextIO | None"; expected "IO[Any]" [arg-type]
+ schema_salad/main.py:412:36: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:416:60: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ schema_salad/main.py:442:40: error: Argument "fp" to "json_dump" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/socket.py:102: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
+ tools/validate-yaml.py:13: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ tools/validate-yaml.py:18: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ tools/validate-yaml.py:20: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/util.py:457: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/util.py:467: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/util.py:484: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/sources/DataSourceGCE.py:392: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/config/cc_ssh.py:194: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/config/cc_ansible.py:228: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/cmd/status.py:242: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/cmd/status.py:243: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ cloudinit/cmd/devel/render.py:114: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/cmd/cloud_id.py:70: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/cmd/cloud_id.py:73: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/cmd/cloud_id.py:95: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/cmd/cloud_id.py:104: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cloudinit/cmd/main.py:137: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
+ cloudinit/cmd/main.py:140: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
+ cloudinit/cmd/main.py:167: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/util/_print_versions.py:144: error: Item "None" of "TextIO | None" has no attribute "writelines" [union-attr]
+ pandas/_config/display.py:26: error: Item "None" of "TextIO | None" has no attribute "encoding" [union-attr]
+ pandas/io/formats/info.py:586: error: Argument 1 to "buffer_put_lines" has incompatible type "TextIO | WriteBuffer[str] | None"; expected "WriteBuffer[str]" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/command/subcommands/file_output.py: note: In function "write_file":
+ src/bokeh/command/subcommands/file_output.py:181:17: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
CPython (peg_generator) (https://github.com/python/cpython)
+ Tools/peg_generator/pegen/parser.py:294: error: Item "None" of "TextIO | None" has no attribute "readline" [union-attr]
+ Tools/peg_generator/pegen/parser.py:299: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ Tools/peg_generator/pegen/parser.py:302: error: Item "None" of "TextIO | None" has no attribute "tell" [union-attr]
+ Tools/peg_generator/pegen/parser.py:307: error: Item "None" of "TextIO | None" has no attribute "close" [union-attr]
+ Tools/peg_generator/pegen/__main__.py:47: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ Tools/peg_generator/pegen/__main__.py:72: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
mypy (https://github.com/python/mypy)
+ mypy/util.py:425: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/util.py:425: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-union-attr for more info
+ mypy/util.py:426: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/util.py:647: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mypy/config_parser.py:294: error: Argument 6 to "parse_section" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/config_parser.py:304: error: Argument 6 to "parse_section" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/config_parser.py:446: error: Incompatible default for argument "stderr" (default has type "Optional[TextIO]", argument has type "TextIO") [assignment]
+ mypy/test/testipc.py:114: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/build.py:194: error: Argument 6 to "_build" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/build.py:194: error: Argument 7 to "_build" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/stubtest.py:70: error: Argument 1 to "FancyFormatter" has incompatible type "Optional[TextIO]"; expected "IO[str]" [arg-type]
+ mypy/stubtest.py:70: error: Argument 2 to "FancyFormatter" has incompatible type "Optional[TextIO]"; expected "IO[str]" [arg-type]
+ mypy/stubgen.py:1479: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/stubgen.py:1605: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/main.py:51: error: Incompatible default for argument "stdout" (default has type "Optional[TextIO]", argument has type "TextIO") [assignment]
+ mypy/main.py:52: error: Incompatible default for argument "stderr" (default has type "Optional[TextIO]", argument has type "TextIO") [assignment]
+ mypy/main.py:1406: error: Argument 2 to "fail" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/main.py:1409: error: Argument 2 to "fail" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/main.py:1425: error: Argument 2 to "fail" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/main.py:1525: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/main.py:1530: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/__main__.py:16: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/__main__.py:17: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/__main__.py:22: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mypy/__main__.py:27: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/__main__.py:28: error: Argument 1 to "FancyFormatter" has incompatible type "Optional[TextIO]"; expected "IO[str]" [arg-type]
+ mypy/__main__.py:28: error: Argument 2 to "FancyFormatter" has incompatible type "Optional[TextIO]"; expected "IO[str]" [arg-type]
+ mypy/__main__.py:30: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/__main__.py:31: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/__main__.py:32: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/dmypy_server.py:83: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/dmypy_server.py:84: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/dmypy_server.py:203: error: Argument 1 to "FancyFormatter" has incompatible type "Optional[TextIO]"; expected "IO[str]" [arg-type]
+ mypy/dmypy_server.py:203: error: Argument 2 to "FancyFormatter" has incompatible type "Optional[TextIO]"; expected "IO[str]" [arg-type]
+ mypy/dmypy_server.py:224: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mypy/dmypy_server.py:225: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mypy/dmypy_server.py:345: error: Argument 3 to "load_plugins" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/dmypy/client.py:562: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/dmypy/client.py:563: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/dmypy/client.py:564: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/dmypy/client.py:565: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mypy/dmypy/client.py:660: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mypy/dmypy/client.py:676: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/dmypy/client.py:679: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:42: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:43: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:77: error: Incompatible default for argument "output" (default has type "Optional[TextIO]", argument has type "IO[str]") [assignment]
+ mypy/test/helpers.py:117: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:120: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:124: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:137: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:188: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:206: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:207: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:209: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:212: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:215: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/helpers.py:216: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ mypy/test/testgraph.py:55: error: Argument "stdout" to "BuildManager" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ mypy/test/testgraph.py:56: error: Argument "stderr" to "BuildManager" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
anyio (https://github.com/agronholm/anyio)
+ src/anyio/to_process.py:206: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ src/anyio/to_process.py:210: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ src/anyio/to_process.py:249: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ src/anyio/to_process.py:250: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
pip (https://github.com/pypa/pip)
+ src/pip/_internal/cli/spinners.py:40: error: Item "None" of "IO[str] | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/spinners.py:48: error: Item "None" of "IO[str] | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/spinners.py:50: error: Item "None" of "IO[str] | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/spinners.py:52: error: Item "None" of "IO[str] | None" has no attribute "flush" [union-attr]
+ src/pip/_internal/cli/spinners.py:66: error: Item "None" of "IO[str] | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/spinners.py:67: error: Item "None" of "IO[str] | None" has no attribute "flush" [union-attr]
+ src/pip/_internal/cli/spinners.py:122: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ src/pip/_internal/cli/spinners.py:127: error: Argument 1 to "hidden_cursor" has incompatible type "TextIO | None"; expected "IO[str]" [arg-type]
+ src/pip/_internal/cli/main_parser.py:109: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/main_parser.py:110: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/main.py:67: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/main.py:68: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/utils/entrypoints.py:35: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/operations/install/wheel.py:613: error: Argument 1 to "from_stream" of "StreamWrapper" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ src/pip/_internal/commands/completion.py:127: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/progress_bars.py:66: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/cli/progress_bars.py:67: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ src/pip/_internal/commands/freeze.py:108: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/pip/_internal/commands/search.py:60: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
beartype (https://github.com/beartype/beartype)
+ beartype/_util/os/utilostty.py:59: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
kornia (https://github.com/kornia/kornia)
+ kornia/feature/lightglue_onnx/utils/download.py:55: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/cli.py:229: error: Item "None" of "Optional[TextIO]" has no attribute "buffer" [union-attr]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/_cli/util/colour.py: note: In function "terminal_supports_colour":
+ sphinx/_cli/util/colour.py:24:16: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ sphinx/util/console.py: note: In function "color_terminal":
+ sphinx/util/console.py:103:12: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ sphinx/_cli/__init__.py: note: In member "error" of class "_RootArgumentParser":
+ sphinx/_cli/__init__.py:164:9: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ sphinx/_cli/__init__.py: note: In function "_parse_command":
+ sphinx/_cli/__init__.py:238:9: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ sphinx/_cli/__init__.py:244:9: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ sphinx/_cli/__init__.py:248:9: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ sphinx/ext/coverage.py: note: In member "write_py_coverage" of class "CoverageBuilder":
+ sphinx/ext/coverage.py:405:43: error: Argument 1 to "_write_py_statistics" of "CoverageBuilder" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ sphinx/_cli/util/errors.py: note: In function "handle_exception":
+ sphinx/_cli/util/errors.py:88:22: error: Incompatible default for argument "stderr" (default has type "TextIO | None", argument has type "TextIO") [assignment]
+ sphinx/cmd/build.py: note: In function "handle_exception":
+ sphinx/cmd/build.py:40:79: error: Incompatible default for argument "stderr" (default has type "TextIO | None", argument has type "TextIO") [assignment]
+ sphinx/cmd/build.py: note: In function "_parse_logging":
+ sphinx/cmd/build.py:281:12: error: Incompatible return value type (got "tuple[TextIO | None, TextIO | None, TextIO | None, TextIOWrapper[_WrappedBuffer] | None]", expected "tuple[TextIO | None, TextIO | None, TextIO, TextIO | None]") [return-value]
openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/coverstore/archive.py: note: In function "audit":
+ openlibrary/coverstore/archive.py:427: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ openlibrary/coverstore/archive.py:432: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ openlibrary/coverstore/archive.py:434: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ openlibrary/coverstore/archive.py:436: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ openlibrary/coverstore/archive.py:437: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ openlibrary/coverstore/archive.py:438: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/writer/writer.py:106: error: Incompatible default for argument "out" (default has type "TextIO | None", argument has type "TextIO") [assignment]
trio (https://github.com/python-trio/trio)
+ src/trio/_tools/mypy_annotate.py:111: error: Item "None" of "Optional[TextIO]" has no attribute "__iter__" (not iterable) [union-attr]
+ src/trio/_tools/mypy_annotate.py:118: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_io/terminalwriter.py:78: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ src/_pytest/_io/terminalwriter.py:84: error: Argument 1 to "AnsiToWin32" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ src/_pytest/_io/terminalwriter.py:87: error: Argument 1 to "should_do_markup" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ src/_pytest/_io/terminalwriter.py:165: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/_io/terminalwriter.py:174: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/_io/terminalwriter.py:184: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ src/_pytest/config/__init__.py:202: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ src/_pytest/config/__init__.py:208: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
+ src/_pytest/config/__init__.py:432: error: Incompatible types in assignment (expression has type "TextIO | None", variable has type "IO[str]") [assignment]
+ src/_pytest/config/__init__.py:1153: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/config/__init__.py:1176: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/config/__init__.py:1177: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ src/_pytest/terminal.py:383: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ src/_pytest/main.py:296: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/main.py:307: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/main.py:310: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/main.py:324: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/capture.py:141: error: Argument 1 to "_windowsconsoleio_workaround" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ src/_pytest/capture.py:159: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/capture.py:160: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/doctest.py:312: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/doctest.py:313: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/debugging.py:287: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/debugging.py:288: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/pytester.py:1176: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/pytester.py:1177: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/helpconfig.py:123: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/helpconfig.py:127: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/helpconfig.py:138: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/helpconfig.py:144: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/_pytest/helpconfig.py:146: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1029: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1034: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1038: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1055: error: Item "None" of "TextIO | None" has no attribute "mode" [union-attr]
+ testing/test_capture.py:1082: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1083: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1091: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1099: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1103: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1109: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1110: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1133: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1134: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1157: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1158: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1165: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1166: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1183: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ testing/test_capture.py:1226: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1227: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ testing/test_capture.py:1230: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1231: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ testing/test_capture.py:1331: error: Item "None" of "TextIO | None" has no attribute "encoding" [union-attr]
+ testing/test_capture.py:1338: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1339: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/test_capture.py:1619: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ testing/io/test_terminalwriter.py:51: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ src/_pytest/faulthandler.py:57: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/__init__.py:72: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
cki-lib (https://gitlab.com/cki-project/cki-lib)
- cki_lib/logger.py:118: error: Incompatible types in assignment (expression has type "StreamHandler[TextIO | Any]", variable has type "WatchedFileHandler") [assignment]
+ cki_lib/logger.py:118: error: Incompatible types in assignment (expression has type "StreamHandler[TextIO]", variable has type "WatchedFileHandler") [assignment]
+ cki_lib/logger.py:171: error: Incompatible default for argument "stream" (default has type "TextIO | None", argument has type "TextIO") [assignment]
+ cki_lib/yaml.py:217: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ cki_lib/yaml.py:235: error: Argument 2 to "dump" has incompatible type "TextIO | None"; expected "SupportsWrite[str]" [arg-type]
+ cki_lib/yaml.py:239: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ cki_lib/yaml.py:247: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ cki_lib/yaml.py:255: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/configuration/load_config.py:62: error: Item "None" of "TextIO | None" has no attribute "__enter__" [union-attr]
+ freqtrade/configuration/load_config.py:62: error: Item "None" of "TextIO | None" has no attribute "__exit__" [union-attr]
+ freqtrade/commands/list_commands.py:279: error: Argument 1 to "DictWriter" has incompatible type "TextIO | None"; expected "SupportsWrite[str]" [arg-type]
spark (https://github.com/apache/spark)
+ python/pyspark/profiler.py:471: error: Item "None" of "TextIO | Any | None" has no attribute "write" [union-attr]
+ python/pyspark/profiler.py:472: error: Item "None" of "TextIO | Any | None" has no attribute "write" [union-attr]
+ python/pyspark/profiler.py:473: error: Item "None" of "TextIO | Any | None" has no attribute "write" [union-attr]
+ python/pyspark/profiler.py:498: error: Item "None" of "TextIO | Any | None" has no attribute "write" [union-attr]
+ python/pyspark/profiler.py:499: error: Item "None" of "TextIO | Any | None" has no attribute "write" [union-attr]
+ python/pyspark/core/broadcast.py:187: error: Argument 1 to "print_exec" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ python/pyspark/ml/torch/distributor.py:494: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ python/pyspark/sql/connect/shell/progress.py:90: error: Incompatible default for argument "output" (default has type "TextIO | None", argument has type "IO[Any]") [assignment]
pyinstrument (https://github.com/joerick/pyinstrument)
+ pyinstrument/profiler.py:284: error: Incompatible default for argument "file" (default has type "TextIO | None", argument has type "IO[str]") [assignment]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/__main__.py:52: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/websockets/__main__.py:68: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ src/websockets/__main__.py:72: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/websockets/__main__.py:80: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
CPython (Argument Clinic) (https://github.com/python/cpython)
+ Tools/clinic/libclinic/cli.py:228: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
nox (https://github.com/wntrblm/nox)
+ nox/popen.py:86: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ nox/command.py:142: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ nox/sessions.py:245: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ nox/_options.py:214: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
tornado (https://github.com/tornadoweb/tornado)
+ tornado/log.py:57: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
- tornado/test/runtests.py:186: error: Unused "type: ignore" comment [unused-ignore]
pylint (https://github.com/pycqa/pylint)
+ pylint/reporters/ureports/base_writer.py:34: error: Incompatible default for argument "stream" (default has type "TextIO | None", argument has type "TextIO") [assignment]
+ pylint/utils/docs.py:91: error: Incompatible default for argument "stream" (default has type "TextIO | None", argument has type "TextIO") [assignment]
+ pylint/reporters/base_reporter.py:34: error: Incompatible types in assignment (expression has type "TextIO | None", variable has type "TextIO") [assignment]
+ pylint/config/arguments_manager.py:293: error: Argument 1 to "format_section" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
psycopg (https://github.com/psycopg/psycopg)
+ tests/fix_db.py:140: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
mypy-protobuf (https://github.com/dropbox/mypy-protobuf)
+ mypy_protobuf/main.py:1043: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ mypy_protobuf/main.py:1061: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/display.py:33: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
- scrapy/utils/log.py:131: error: Unused "type: ignore" comment [unused-ignore]
+ scrapy/cmdline.py:203: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ scrapy/commands/fetch.py:66: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ scrapy/commands/edit.py:27: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ scrapy/extensions/feedexport.py:182: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:73: error: Argument 1 to "AnsiToWin32" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ src/werkzeug/debug/console.py:196: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ tests/test_debug.py:196: error: Incompatible types in assignment (expression has type "HTMLStringO", variable has type "TextIO | None") [assignment]
+ tests/test_debug.py:199: error: Item "TextIO" of "TextIO | None" has no attribute "reset" [union-attr]
+ tests/test_debug.py:199: error: Item "None" of "TextIO | None" has no attribute "reset" [union-attr]
+ tests/test_debug.py:201: error: Item "TextIO" of "TextIO | None" has no attribute "reset" [union-attr]
+ tests/test_debug.py:201: error: Item "None" of "TextIO | None" has no attribute "reset" [union-attr]
+ tests/test_debug.py:213: error: Incompatible types in assignment (expression has type "HTMLStringO", variable has type "TextIO | None") [assignment]
+ tests/test_debug.py:216: error: Item "TextIO" of "TextIO | None" has no attribute "reset" [union-attr]
+ tests/test_debug.py:216: error: Item "None" of "TextIO | None" has no attribute "reset" [union-attr]
cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/run_job.py: note: In function "handle_software_environment":
+ cwltool/run_job.py:16:9: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ cwltool/run_job.py: note: In function "main":
+ cwltool/run_job.py:64:22: error: Incompatible types in assignment (expression has type "TextIO | None", variable has type "BinaryIO | TextIO") [assignment]
+ cwltool/run_job.py:68:22: error: Incompatible types in assignment (expression has type "TextIO | None", variable has type "BinaryIO | TextIO") [assignment]
+ cwltool/job.py: note: In function "_job_popen":
+ cwltool/job.py:941:13: error: Incompatible types in assignment (expression has type "IO[bytes] | TextIO | None", variable has type "IO[bytes] | TextIO") [assignment]
+ cwltool/job.py:947:13: error: Incompatible types in assignment (expression has type "IO[bytes] | TextIO | None", variable has type "IO[bytes] | TextIO") [assignment]
+ cwltool/main.py: note: In function "main":
+ cwltool/main.py:957:22: error: Incompatible default for argument "stdin" (default has type "TextIO | None", argument has type "IO[Any]") [assignment]
+ cwltool/main.py:959:23: error: Incompatible default for argument "stderr" (default has type "TextIO | None", argument has type "IO[Any]") [assignment]
+ cwltool/main.py:969:48: error: Item "None" of "TextIO | None" has no attribute "encoding" [union-attr]
+ cwltool/main.py:974:43: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ tests/test_context.py: note: In function "test_replace_default_stdout_stderr":
+ tests/test_context.py:17:18: error: Incompatible types in assignment (expression has type "str", variable has type "TextIO | None") [assignment]
+ tests/test_context.py:18:18: error: Incompatible types in assignment (expression has type "str", variable has type "TextIO | None") [assignment]
jax (https://github.com/google/jax)
+ jax/tools/build_utils.py:77: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/tools/build_utils.py:78: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/tools/build_utils.py:80: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/tools/build_utils.py:83: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/tools/build_utils.py:85: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/tools/build_utils.py:86: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/tools/build_utils.py:93: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/_src/pretty_printer.py:65: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ jax/_src/debugging.py:283: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ jax/_src/test_util.py:230: error: Argument 1 to "_capture_output" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
+ jax/_src/test_util.py:231: error: Argument 1 to "_capture_output" has incompatible type "TextIO | None"; expected "TextIO" [arg-type]
pywin32 (https://github.com/mhammond/pywin32)
+ Pythonwin/pywin/framework/stdin.py:171:17: error: Incompatible types in assignment (expression has type "Stdin", variable has type "Optional[TextIO]") [assignment]
+ AutoDuck/fixHelpCompression.py:13:5: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ pywin32_postinstall.py:45:14: error: Incompatible types in assignment (expression has type "Tee", variable has type "Optional[TextIO]") [assignment]
+ pywin32_postinstall.py:46:14: error: Incompatible types in assignment (expression has type "Tee", variable has type "Optional[TextIO]") [assignment]
spack (https://github.com/spack/spack)
+ lib/spack/llnl/util/argparsewriter.py:55: error: Incompatible default for argument "out" (default has type "TextIO | None", argument has type "IO[Any]") [assignment]
+ lib/spack/llnl/util/argparsewriter.py:201: error: Incompatible default for argument "out" (default has type "TextIO | None", argument has type "IO[Any]") [assignment]
+ lib/spack/llnl/util/tty/colify.py:150: error: Item "None" of "TextIO | IO[Any] | None" has no attribute "isatty" [union-attr]
+ lib/spack/llnl/util/tty/colify.py:174: error: Item "None" of "TextIO | IO[Any] | None" has no attribute "write" [union-attr]
+ lib/spack/llnl/util/tty/colify.py:180: error: Item "None" of "TextIO | IO[Any] | None" has no attribute "write" [union-attr]
+ lib/spack/llnl/util/tty/colify.py:184: error: Item "None" of "TextIO | IO[Any] | None" has no attribute "write" [union-attr]
+ lib/spack/llnl/util/tty/colify.py:186: error: Item "None" of "TextIO | IO[Any] | None" has no attribute "write" [union-attr]
+ lib/spack/spack/util/debug.py:58: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
+ lib/spack/spack/installer.py:132: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ lib/spack/spack/installer.py:136: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/installer.py:137: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ lib/spack/spack/installer.py:162: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ lib/spack/spack/installer.py:1979: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ lib/spack/spack/graph.py:572: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/graph.py:601: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/cmd/commands.py:113: error: Incompatible default for argument "out" (default has type "TextIO | None", argument has type "IO[Any]") [assignment]
+ lib/spack/spack/cmd/commands.py:874: error: Argument 2 to "prepend_header" has incompatible type "TextIO | None"; expected "IO[Any]" [arg-type]
+ lib/spack/spack/cmd/commands.py:875: error: Argument 2 has incompatible type "TextIO | None"; expected "IO[Any]" [arg-type]
+ lib/spack/spack/cmd/uninstall.py:112: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/cmd/uninstall.py:114: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/cmd/uninstall.py:115: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ lib/spack/spack/cmd/logs.py:30: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
+ lib/spack/spack/cmd/install.py:296: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/cmd/install.py:298: error: Argument 2 to "copyfileobj" has incompatible type "TextIO | None"; expected "SupportsWrite[str]" [arg-type]
+ lib/spack/spack/cmd/deconcretize.py:69: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/cmd/deconcretize.py:71: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ lib/spack/spack/cmd/deconcretize.py:72: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
+ lib/spack/spack/cmd/checksum.py:285: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/query_fitness/pick.py:25: error: Item "None" of "TextIO | None" has no attribute "__iter__" (not iterable) [union-attr]
+ misc/python/materialize/mzbuild.py:653: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ misc/python/materialize/mzbuild.py:663: error: Item "None" of "TextIO | None" has no attribute "buffer" [union-attr]
+ misc/python/materialize/scratch.py:110: error: Argument 1 to "writer" has incompatible type "TextIO | None"; expected "SupportsWrite[str]" [arg-type]
+ misc/python/materialize/cli/cloudbench.py:169: error: Argument 1 to "writer" has incompatible type "TextIO | None"; expected "SupportsWrite[str]" [arg-type]
+ misc/python/materialize/cli/scratch/create.py:132: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
+ misc/python/materialize/output_consistency/output/output_printer.py:77: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
core (https://github.com/home-assistant/core)
+ homeassistant/__main__.py:160: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ homeassistant/__main__.py:166: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
pegen (https://github.com/we-like-parsers/pegen)
+ src/pegen/parser.py:332: error: Item "None" of "TextIO | None" has no attribute "readline" [union-attr]
+ src/pegen/parser.py:337: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
+ src/pegen/parser.py:340: error: Item "None" of "TextIO | None" has no attribute "tell" [union-attr]
+ src/pegen/parser.py:345: error: Item "None" of "TextIO | None" has no attribute "close" [union-attr]
+ src/pegen/__main__.py:44: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/core.py:419: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/tests/test_filter.py: note: In member "setUp" of class "TestBandersnatchFilter":
+ src/bandersnatch/tests/test_filter.py:30: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ src/bandersnatch/tests/test_filter.py:31: error: Item "None" of "TextIO | None" has no attribute "flush" [union-attr]
aiohttp-devtools (https://github.com/aio-libs/aiohttp-devtools)
+ aiohttp_devtools/runserver/watch.py:129: error: Item "None" of "TextIO | None" has no attribute "fileno" [union-attr]
isort (https://github.com/pycqa/isort)
+ isort/format.py:109: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ isort/format.py:135: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ isort/api.py:413: error: Argument "output_stream" to "sort_stream" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ isort/main.py:1035: error: Argument 1 to "find_imports_in_stream" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ isort/main.py:1135: error: Argument "input_stream" to "check_stream" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ isort/main.py:1146: error: Argument "input_stream" to "sort_stream" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ isort/main.py:1147: error: Argument "output_stream" to "sort_stream" has incompatible type "Optional[TextIO]"; expected "TextIO" [arg-type]
+ isort/main.py:1155: error: Item "None" of "Optional[TextIO]" has no attribute "write" [union-attr]
+ isort/main.py:1155: error: Item "None" of "Optional[TextIO]" has no attribute "read" [union-attr]
mkosi (https://github.com/systemd/mkosi)
+ mkosi/log.py:18:30: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/log.py:19:34: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/log.py:20:27: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/log.py:21:30: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/log.py:22:26: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/run.py:91:9: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mkosi/run.py:92:9: error: Item "None" of "Optional[TextIO]" has no attribute "flush" [union-attr]
+ mkosi/config.py:3911:27: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/config.py:3913:20: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/qemu.py:1211:46: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mkosi/qemu.py:1213:13: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mkosi/qemu.py:1216:46: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mkosi/qemu.py:1218:13: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mkosi/qemu.py:1221:46: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mkosi/qemu.py:1223:13: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mkosi/__init__.py:2754:8: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
+ mkosi/__init__.py:2755:39: error: Item "None" of "Optional[TextIO]" has no attribute "fileno" [union-attr]
+ mkosi/__main__.py:41:16: error: Item "None" of "Optional[TextIO]" has no attribute "isatty" [union-attr]
black (https://github.com/psf/black)
+ src/blib2to3/pgen2/tokenize.py:1123:18: error: Item "None" of "Optional[TextIO]" has no attribute "readline" [union-attr]
+ src/black/__init__.py:973:17: error: Item "None" of "Optional[TextIO]" has no attribute "buffer" [union-attr]
+ src/black/__init__.py:1004:47: error: Item "None" of "Optional[TextIO]" has no attribute "buffer" [union-attr]
+ src/black/__init__.py:1018:13: error: Item "None" of "Optional[TextIO]" has no attribute "buffer" [union-attr]
typeshed-stats (https://github.com/AlexWaygood/typeshed-stats)
+ src/typeshed_stats/_cli.py:327: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
check-jsonschema (https://github.com/python-jsonschema/check-jsonschema)
+ src/check_jsonschema/schema_loader/readers.py:66: error: Argument 1 to "load" has incompatible type "TextIO | None"; expected "SupportsRead[str | bytes]" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/credentials.py: note: In function "email_prompt":
+ lib/streamlit/runtime/credentials.py:49:18: error: Item "None" of "Optional[TextIO]" has no attribute "encoding" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py: note: In member "tearDown" of class "BootstrapPrintTest":
+ lib/tests/streamlit/web/bootstrap_test.py:94:9: error: Item "None" of "Optional[TextIO]" has no attribute "close" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:110:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:110:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:110:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:127:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:127:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:127:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:149:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:149:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:149:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:174:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:174:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:174:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:199:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:199:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:199:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:220:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:220:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:220:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:244:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:244:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:244:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:269:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:269:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:269:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:294:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:294:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:294:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:311:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:311:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:311:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:332:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:332:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:332:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:341:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:341:15: error: Item "TextIO" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
+ lib/tests/streamlit/web/bootstrap_test.py:341:15: error: Item "None" of "Optional[TextIO]" has no attribute "getvalue" [union-attr]
manticore (https://github.com/trailofbits/manticore)
+ tests/native/test_integration_native.py:48: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
+ tests/native/test_integration_native.py:53: error: Item "None" of "TextIO | None" has no attribute "write" [union-attr]
optuna (https://github.com/optuna/optuna)
+ optuna/logging.py:52: error: Item "None" of "TextIO | None" has no attribute "isatty" [union-attr]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/cli/deployment.py:710: error: Item "None" of "TextIO | None" has no attribute "read" [union-attr]
|
The error with |
As you guessed, this is too disruptive for us to merge :) I'm not convinced that the |
Yeah, I agree although strangely, that doesn't stop people... |
Not sure if this will float but I thought I'd give it a go anyway...
As per the Python docs, the standard streams can be None (see python/cpython#122633 for a list of possible circumstances). The current usage of MaybeNone causes a false negative, which is a shame because spreading the little known knowledge that
sys.stderr.write()
is broken code is something that type checkers would otherwise be ideal at.