Report unnecessary (always True) assertions

That’s exactly something that gets flagged for removal. Ruff flags T201 (“print found”) for this exact reason.

So you agree that you should reminded to remove it before committing the change? In that case, Ruff should absolutely flag it—especially in the pre-commit.

No. Print calls are flagged because users might see them, not because they only exist as a debugging tool. Would Ruff attempt to remove a Logger.debug(...) call?!

Again, no! I don’t know how you are possibly reaching this conclusion based on my statements. Please refrain from making such ‘gotcha’ style claims.

Just because the purpose of something is only intended to assist when debugging doesn’t mean it should be removed from the source code! You leave the assert statements in the code to assist you with debugging in the future. You shouldn’t have to put them back in if you need to go and debug something again!

2 Likes

The question is whether the line belongs in released code. Just as print statements probably don’t (but might) belong in released code, it’s the same for statically-true assertions. There’s no way to know, and it’s reasonable to warn the user that this line might be superfluous.

Yes, the outcome is different: print statements might be seen by a user, and unnecessary assertions might pollute code. However, there are good reasons to possibly want to remove both.

You may do that. You may not want to leave them in. That’s the point. Linters help you by asking you to confirm that you do want that through noqa statements. Statements that may have been added for debugging purposes should be flagged, in my opinion.

Flagging things doesn’t mean that they need to be removed. And if you don’t like every linter rule, you can turn it off.

Some projects (especially big ones) are not going to want debugging code to be committed at all. Yes, if you need them again, you can add them again.

I do not consider it useful if I have to litter code with # noqa statements just to ‘appease the linter’. If a linter is forcing me to add # noqa statements on correct code I am more likely to stop using the linter.

Outside of debugging, All asserts should be superfluous. The point is that the compiler[1] will remove them for you when you’re not running in debug mode so you don’t need to remove them yourself from the source code when you’re not debugging.

Anyway I’ve already spent far too much time arguing about this so I’m going to have to mute the thread to stop myself spending any more time on this. I think I’ve made any point I was trying to make and don’t see any purpose on arguing further.


  1. to .pyc files in this case ↩︎

1 Like

I would not remove asserts from production or released code because folks should be using python -O in production. But then again, I leave print statements in code. If I used ruff, I’d try to configure it so it doesn’t emit warnings that I don’t care about.

1 Like

… when the code is used with the original intension for which it was written. The asserts make explicit aspects of that intension. Code doesn’t need to live in a fixed environment, or with a fixed intent.

Apparently in Pyright it used to warn on always true assert statements but it was changed awhile ago, see related issue.

Got curious and tried to run mypy-primer for pyright but with reports for assert statements enabled. Below are the results if anyone interested too.
It seems most of the cases for always-true assert statements are indeed in tests to double-check the type defined by typing.

bidict (https://github.com/jab/bidict)
+   /tmp/mypy_primer/projects/bidict/tests/bidict_test_fixtures.py:97:57 - error: Class overlaps "Reversible" unsafely and could produce a match at runtime
+     Attributes of "bidict" have the same names as the protocol
+     Attributes of "frozenbidict" have the same names as the protocol
+     Attributes of "BidictBase" have the same names as the protocol (reportGeneralTypeIssues)
- 33 errors, 3 warnings, 0 informations 
+ 34 errors, 3 warnings, 0 informations 

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_menu.py:59:12 - error: Unnecessary isinstance call; "MenuCommand[Mock, Unknown]" is always an instance of "MenuCommand[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_menu.py:77:12 - error: Unnecessary isinstance call; "MenuCommand[Mock, Unknown]" is always an instance of "MenuCommand[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_menu.py:123:12 - error: Unnecessary isinstance call; "MenuCommand[SlashCommand[Any] | MessageCommand[Any] | MenuCommand[Any, Any], Unknown]" is always an instance of "MenuCommand[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_menu.py:139:12 - error: Unnecessary isinstance call; "MenuCommand[Mock, Unknown]" is always an instance of "MenuCommand[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_menu.py:158:12 - error: Unnecessary isinstance call; "MenuCommand[Mock, Unknown]" is always an instance of "MenuCommand[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_menu.py:203:12 - error: Unnecessary isinstance call; "MenuCommand[SlashCommand[Any] | MessageCommand[Any] | MenuCommand[Any, Any], Unknown]" is always an instance of "MenuCommand[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:90:12 - error: Unnecessary isinstance call; "SlashCommandGroup" is always an instance of "SlashCommandGroup" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:102:12 - error: Unnecessary isinstance call; "SlashCommandGroup" is always an instance of "SlashCommandGroup" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:130:12 - error: Unnecessary isinstance call; "SlashCommand[Mock]" is always an instance of "SlashCommand[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:170:12 - error: Unnecessary isinstance call; "SlashCommand[SlashCommand[Any] | MessageCommand[Any] | MenuCommand[Any, Any]]" is always an instance of "SlashCommand[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:185:12 - error: Unnecessary isinstance call; "SlashCommand[Mock]" is always an instance of "SlashCommand[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:935:16 - error: Unnecessary isinstance call; "BaseSlashCommand" is always an instance of "BaseSlashCommand" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1166:16 - error: Unnecessary isinstance call; "SlashCommand[(ctx: SlashContext) -> CoroutineType[Any, Any, None]]" is always an instance of "SlashCommand[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1190:16 - error: Unnecessary isinstance call; "SlashCommand[(ctx: SlashContext) -> CoroutineType[Any, Any, None]]" is always an instance of "SlashCommand[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1204:16 - error: Unnecessary isinstance call; "SlashCommandGroup" is always an instance of "SlashCommandGroup" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1215:16 - error: Unnecessary isinstance call; "SlashCommandGroup" is always an instance of "SlashCommandGroup" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/test__internal/test_init.py:156:16 - error: Unnecessary isinstance call; "str" is always an instance of "str" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Tanjun/tests/test_schedules.py:154:12 - error: Unnecessary isinstance call; "IntervalSchedule[Mock]" is always an instance of "IntervalSchedule[Unknown]" (reportUnnecessaryIsInstance)
- 2486 errors, 6744 warnings, 0 informations 
+ 2504 errors, 6744 warnings, 0 informations 

sympy (https://github.com/sympy/sympy)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:608:47 - error: "__getitem__" method not defined on type "set[Unknown]" (reportIndexIssue)
+     "__iter__" method not defined (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:622:34 - error: "Relational" is not iterable
+     "__iter__" method not defined (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:622:34 - error: "Unequality" is not iterable
+     "__iter__" method not defined (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/codegen.py:622:34 - error: "Integer" is not iterable
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/matchpy_connector.py:288:16 - error: Type "Basic" is not assignable to declared type "Expr"
+     "Basic" is not assignable to "Expr" (reportAssignmentType)
+ /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_autowrap.py
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_autowrap.py:267:14 - error: Cannot access attribute "_imp_" for class "type[AppliedUndef]"
+     Attribute "_imp_" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_autowrap.py:267:14 - error: Cannot access attribute "_imp_" for class "UndefinedFunction"
+     Attribute "_imp_" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_lambdify.py:2032:45 - error: Argument of type "(e: Unknown) -> (tuple[Unknown, str] | tuple[Unknown | list[tuple[Unknown, Unknown]], list[Unknown] | set[Unknown] | tuple[Unknown, ...]] | tuple[Unknown | list[tuple[Unknown, Unknown]], dict[Unknown, Unknown]] | tuple[Unknown | list[tuple[Unknown, Unknown]], Unknown] | tuple[list[Unknown], Unknown] | tuple[list[tuple[Unknown, Unknown]], list[Unknown]] | Unknown)" cannot be assigned to parameter "cse" of type "bool" in function "lambdify"
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_lambdify.py:2032:45 - error: Argument of type "(e: Unknown) -> (Unknown | tuple[list[tuple[Unknown, Unknown]], list[Unknown]])" cannot be assigned to parameter "cse" of type "bool" in function "lambdify"
- 33004 errors, 72 warnings, 0 informations 
+ 33009 errors, 72 warnings, 0 informations 

Expression (https://github.com/cognitedata/Expression)
+ /tmp/mypy_primer/projects/Expression/README.py
+   /tmp/mypy_primer/projects/Expression/README.py:461:8 - error: Unnecessary isinstance call; "Result[int, Exception]" is always an instance of "Result[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_array.py:161:12 - error: Unnecessary isinstance call; "TypedArray[int]" is always an instance of "TypedArray[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_block.py:128:12 - error: Unnecessary isinstance call; "Block[int]" is always an instance of "Block[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_block.py:140:12 - error: Unnecessary isinstance call; "Block[int]" is always an instance of "Block[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_block.py:152:12 - error: Unnecessary isinstance call; "Block[int]" is always an instance of "Block[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_block.py:164:12 - error: Unnecessary isinstance call; "Block[int]" is always an instance of "Block[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_block.py:176:12 - error: Unnecessary isinstance call; "Block[int]" is always an instance of "Block[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_cancellation.py:13:12 - error: Unnecessary isinstance call; "CancellationToken" is always an instance of "CancellationToken" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_cancellation.py:24:16 - error: Unnecessary isinstance call; "Disposable" is always an instance of "Disposable" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_cancellation.py:29:12 - error: Unnecessary isinstance call; "CancellationTokenSource" is always an instance of "CancellationTokenSource" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_option.py:27:12 - error: Unnecessary isinstance call; "Option[int]" is always an instance of "Option[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_option.py:75:12 - error: Unnecessary isinstance call; "Option[Any]" is always an instance of "Option[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_result.py:30:12 - error: Unnecessary isinstance call; "Result[int, str]" is always an instance of "Result[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_result.py:71:12 - error: Unnecessary isinstance call; "Result[Any, CustomException]" is always an instance of "Result[Unknown, Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_seq.py:22:12 - error: Unnecessary isinstance call; "Iterable[int]" is always an instance of "Iterable[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_seq.py:67:12 - error: Unnecessary isinstance call; "Iterable[int]" is always an instance of "Iterable[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_seq.py:76:12 - error: Unnecessary isinstance call; "Iterable[int]" is always an instance of "Iterable[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_seq.py:85:12 - error: Unnecessary isinstance call; "Iterable[int]" is always an instance of "Iterable[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_seq.py:94:12 - error: Unnecessary isinstance call; "Iterable[int]" is always an instance of "Iterable[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_seq.py:103:12 - error: Unnecessary isinstance call; "Iterable[int]" is always an instance of "Iterable[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_typing.py:28:12 - error: Unnecessary isinstance call; "Base" is always an instance of "Base" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_typing.py:51:12 - error: Unnecessary isinstance call; "Derived" is always an instance of "Base" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/Expression/tests/test_typing.py:52:12 - error: Unnecessary isinstance call; "Derived" is always an instance of "Derived" (reportUnnecessaryIsInstance)
- 478 errors, 12 warnings, 0 informations 
+ 501 errors, 12 warnings, 0 informations 

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_api_types.py:388:16 - error: Unnecessary issubclass call; "type[ExtensionDtype]" is always a subclass of "ExtensionDtype" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_frame.py:1861:16 - error: Unnecessary isinstance call; "Resampler[DataFrame]" is always an instance of "Resampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_groupby.py:294:20 - error: Unnecessary isinstance call; "Resampler[DataFrame]" is always an instance of "Resampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_groupby.py:300:20 - error: Unnecessary isinstance call; "Resampler[DataFrame]" is always an instance of "Resampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_groupby.py:306:20 - error: Unnecessary isinstance call; "Resampler[DataFrame]" is always an instance of "Resampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_groupby.py:457:16 - error: Unnecessary isinstance call; "Resampler[Series[Unknown]]" is always an instance of "Resampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_interval_index.py:78:12 - error: Unnecessary issubclass call; "type[IntervalIndex[IntervalT@IntervalIndex]]" is always a subclass of "Index[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:161:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[DataFrame]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:167:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[DataFrame]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:173:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[DataFrame]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:179:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[DataFrame]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:193:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[DataFrame]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:253:16 - error: Unnecessary isinstance call; "int" is always an instance of "int" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:375:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[Series[Unknown]]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:381:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[Series[Unknown]]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_resampler.py:387:16 - error: Unnecessary isinstance call; "DatetimeIndexResampler[Series[Unknown]]" is always an instance of "DatetimeIndexResampler[Unknown]" (reportUnnecessaryIsInstance)
- 1862 errors, 0 warnings, 0 informations 
+ 1878 errors, 0 warnings, 0 informations 

trio (https://github.com/python-trio/trio)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_run.py:2333:12 - error: Unnecessary isinstance call; "None" is never an instance of "Task" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_abc.py:41:16 - error: Unnecessary isinstance call; "MyAR" is always an instance of "MyAR" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_file_io.py:53:12 - error: Unnecessary isinstance call; "AsyncIOWrapper[FakeFile]" is always an instance of "AsyncIOWrapper[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_file_io.py:220:12 - error: Unnecessary isinstance call; "AsyncIOWrapper[TextIOWrapper[_WrappedBuffer]]" is always an instance of "AsyncIOWrapper[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_file_io.py:227:16 - error: Unnecessary isinstance call; "AsyncIOWrapper[TextIOWrapper[_WrappedBuffer]]" is always an instance of "AsyncIOWrapper[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_file_io.py:268:16 - error: Unnecessary isinstance call; "AsyncIOWrapper[RawIOBase]" is always an instance of "AsyncIOWrapper[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_tcp_listeners.py:38:12 - error: Unnecessary isinstance call; "list[SocketListener]" is always an instance of "list[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_tcp_listeners.py:40:16 - error: Unnecessary isinstance call; "SocketListener" is always an instance of "SocketListener" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_socket.py:62:20 - error: Unnecessary isinstance call; "bytes" is always an instance of "bytes" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_socket.py:194:12 - error: Unnecessary isinstance call; "SocketStream" is always an instance of "SocketStream" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_ssl_helpers.py:131:24 - error: Unnecessary isinstance call; "SSLStream[SocketStream]" is always an instance of "SSLStream[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_ssl_helpers.py:156:16 - error: Unnecessary isinstance call; "SSLListener[SocketStream]" is always an instance of "SSLListener[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:42:16 - error: Unnecessary isinstance call; "AsyncIOWrapper[TextIOWrapper[_WrappedBuffer]]" is always an instance of "AsyncIOWrapper[Unknown]" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:161:12 - error: Unnecessary isinstance call; "Path" is always an instance of "Path" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:163:12 - error: Unnecessary isinstance call; "Path" is always an instance of "Path" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:168:12 - error: Unnecessary isinstance call; "Path" is always an instance of "Path" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:221:20 - error: Unnecessary isinstance call; "Path" is always an instance of "Path" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:229:16 - error: Unnecessary isinstance call; "Path" is always an instance of "Path" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:243:16 - error: Unnecessary isinstance call; "Path" is always an instance of "Path" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_path.py:250:12 - error: Unnecessary isinstance call; "Path" is always an instance of "Path" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:307:16 - error: Unnecessary isinstance call; "SocketType" is always an instance of "SocketType" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:363:16 - error: Unnecessary isinstance call; "SocketType" is always an instance of "SocketType" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:370:16 - error: Unnecessary isinstance call; "SocketType" is always an instance of "SocketType" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:412:16 - error: Unnecessary isinstance call; "int" is always an instance of "int" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:503:20 - error: Unnecessary isinstance call; "SocketType" is always an instance of "SocketType" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_subprocess.py:128:12 - error: Unnecessary isinstance call; "Process" is always an instance of "Process" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_subprocess.py:148:16 - error: Unnecessary isinstance call; "Process" is always an instance of "Process" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_subprocess.py:755:16 - error: Unnecessary isinstance call; "None" is never an instance of "Event" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_testing_raisesgroup.py:1118:12 - error: Unnecessary isinstance call; "TracebackType" is always an instance of "TracebackType" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_threads.py:900:12 - error: Unnecessary isinstance call; "TrioToken" is always an instance of "TrioToken" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_util.py:201:12 - error: Unnecessary isinstance call; "SpecialClass" is always an instance of "SpecialClass" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/testing/_check_streams.py:97:16 - error: Unnecessary isinstance call; "SendStream" is always an instance of "SendStream" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/testing/_check_streams.py:98:16 - error: Unnecessary isinstance call; "ReceiveStream" is always an instance of "ReceiveStream" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/testing/_check_streams.py:457:16 - error: Unnecessary isinstance call; "Stream" is always an instance of "Stream" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/testing/_check_streams.py:458:16 - error: Unnecessary isinstance call; "Stream" is always an instance of "Stream" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/testing/_check_streams.py:523:16 - error: Unnecessary isinstance call; "HalfCloseableStream" is always an instance of "HalfCloseableStream" (reportUnnecessaryIsInstance)
+   /tmp/mypy_primer/projects/trio/src/trio/testing/_check_streams.py:524:16 - error: Unnecessary isinstance call; "HalfCloseableStream" is always an instance of "HalfCloseableStream" (reportUnnecessaryIsInstance)
- 4221 errors, 48 warnings, 0 informations 
+ 4258 errors, 48 warnings, 0 informations