Repository: astral-sh/ruff
Pull request #17149: [red-knot] Type narrowing for assertions
Author: login: MatthewMckee4
Labels: name: ty
description: Multi-file analysis & type inference
Created: 2025-04-02T12:25:57Z | Merged: 2025-04-10T14:15:52Z

<!--
Thank you for contributing to Ruff! To help us out with reviewing, please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Fixes #17147 

## Test Plan

Add new narrow/assert.md test file


Linked issue #17147: [red-knot] Type narrowing for assertions
It is fairly common (often in test code, but also in regular code) to use `assert`ions to encode invariants that are hard/impossible to detect statically. So we should be able to perform type narrowing via `assert` statements:

```py
def f(x: str | None):
    assert x is not None
    reveal_type(x)  # Should be 'str'
```
(https://playknot.ruff.rs/d44edb95-1204-484c-b6c8-2a11ba6cef51)
Linked issue comments: user: login: MatthewMckee4
created_at: 2025-04-02T11:43:28Z
body: I'd like to take this on if this is okay for a contributor?
author_association: CONTRIBUTOR

Diff:
diff --git a/crates/red_knot_python_semantic/resources/mdtest/narrow/assert.md b/crates/red_knot_python_semantic/resources/mdtest/narrow/assert.md
new file mode 100644
index 0000000000000..1fad9290a5115
--- /dev/null
+++ b/crates/red_knot_python_semantic/resources/mdtest/narrow/assert.md
@@ -0,0 +1,53 @@
+# Narrowing with assert statements
+
+## `assert` a value `is None` or `is not None`
+
+```py
+def _(x: str | None, y: str | None):
+    assert x is not None
+    reveal_type(x)  # revealed: str
+    assert y is None
+    reveal_type(y)  # revealed: None
+```
+
+## `assert` a value is truthy or falsy
+
+```py
+def _(x: bool, y: bool):
+    assert x
+    reveal_type(x)  # revealed: Literal[True]
+    assert not y
+    reveal_type(y)  # revealed: Literal[False]
+```
+
+## `assert` with `is` and `==` for literals
+
+```py
+from typing import Literal
+
+def _(x: Literal[1, 2, 3], y: Literal[1, 2, 3]):
+    assert x is 2
+    reveal_type(x)  # revealed: Literal[2]
+    assert y == 2
+    reveal_type(y)  # revealed: Literal[1, 2, 3]
+```
+
+## `assert` with `isinstance`
+
+```py
+def _(x: int | str):
+    assert isinstance(x, int)
+    reveal_type(x)  # revealed: int
+```
+
+## `assert` a value `in` a tuple
+
+```py
+from typing import Literal
+
+def _(x: Literal[1, 2, 3], y: Literal[1, 2, 3]):
+    assert x in (1, 2)
+    reveal_type(x)  # revealed: Literal[1, 2]
+    assert y not in (1, 2)
+    reveal_type(y)  # revealed: Literal[3]
+```
diff --git a/crates/red_knot_python_semantic/src/semantic_index/builder.rs b/crates/red_knot_python_semantic/src/semantic_index/builder.rs
index af4c4b83c60e5..9db4ea1b9aaf2 100644
--- a/crates/red_knot_python_semantic/src/semantic_index/builder.rs
+++ b/crates/red_knot_python_semantic/src/semantic_index/builder.rs
@@ -534,7 +534,6 @@ impl<'db> SemanticIndexBuilder<'db> {
     }
 
     /// Records a visibility constraint by applying it to all live bindings and declarations.
-    #[must_use = "A visibility constraint must always be negated after it is added"]
     fn record_visibility_constraint(
         &mut self,
         predicate: Predicate<'db>,
@@ -1292,6 +1291,17 @@ where
                     );
                 }
             }
+
+            ast::Stmt::Assert(node) => {
+                self.visit_expr(&node.test);
+                let predicate = self.record_expression_narrowing_constraint(&node.test);
+                self.record_visibility_constraint(predicate);
+
+                if let Some(msg) = &node.msg {
+                    self.visit_expr(msg);
+                }
+            }
+
             ast::Stmt::Assign(node) => {
                 debug_assert_eq!(&self.current_assignments, &[]);
 
diff --git a/crates/red_knot_python_semantic/src/types/infer.rs b/crates/red_knot_python_semantic/src/types/infer.rs
index 8f8d9b2f46e3f..f81a156b3910f 100644
--- a/crates/red_knot_python_semantic/src/types/infer.rs
+++ b/crates/red_knot_python_semantic/src/types/infer.rs
@@ -3188,7 +3188,7 @@ impl<'db> TypeInferenceBuilder<'db> {
             msg,
         } = assert;
 
-        let test_ty = self.infer_expression(test);
+        let test_ty = self.infer_standalone_expression(test);
 
         if let Err(err) = test_ty.try_bool(self.db()) {
             err.report_diagnostic(&self.context, &**test);


Reviews:
user: login: MatthewMckee4
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-02T12:26:31Z
user: login: carljm
body: Oh oops, yeah I did! Mostly looks great though. 
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T18:17:32Z
user: login: carljm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T04:55:13Z
user: login: AlexWaygood
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-10T07:42:48Z
user: login: carljm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T13:05:30Z
user: login: AlexWaygood
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-10T14:13:57Z

Review comments:
diff_hunk: @@ -3068,7 +3068,7 @@ impl<'db> TypeInferenceBuilder<'db> {
             msg,
         } = assert;
 
-        let test_ty = self.infer_expression(test);
+        let test_ty = self.infer_standalone_expression(test);
path: crates/red_knot_python_semantic/src/types/infer.rs
user: login: MatthewMckee4
body: There was a panic here
```bash
assertion `left == right` failed: Calling `self.infer_expression` on a standalone-expression is not allowed because it can lead to double-inference. Use `self.infer_standalone_expression` instead.
```
created_at: 2025-04-02T12:26:31Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,51 @@
+# Narrowing with assert statements
+
+## `assert` a value `is None` or `is not None`
+
+```py
+def _(x: str | None, y: str | None):
+    assert x is not None
+    reveal_type(x)  # revealed: str
+    assert y is None
+    reveal_type(y)  # revealed: None
+```
+
+## `assert` a value is truthy or falsy
+
+```py
+def _(x: bool, y: bool):
+    assert x
+    reveal_type(x)  # revealed: Literal[True]
+    assert not y
+    reveal_type(y)  # revealed: Literal[False]
+```
+
+## `assert` a value `is` a literal
+
+```py
+from typing import Literal
+
+def _(x: Literal[1, 2, 3]):
+    assert x is 2
path: crates/red_knot_python_semantic/resources/mdtest/narrow/assert.md
user: login: carljm
body: Can we also add a test for `x == 2` narrowing? That's the better practice; `is` really shouldn't be used with non-singletons.

(I realize this diff doesn't make any changes at all to what narrowing predicates we support or don't support; just want to make sure we test the most important ones here.)
created_at: 2025-04-04T21:08:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1181,6 +1181,20 @@ where
                     );
                 }
             }
+
+            ast::Stmt::Assert(node) => {
+                self.visit_expr(&node.test);
+                let no_branch_taken = self.flow_snapshot();
+                let last_predicate = self.record_expression_narrowing_constraint(&node.test);
+                self.record_visibility_constraint(last_predicate);
+
+                if let Some(msg) = &node.msg {
+                    self.visit_expr(msg);
+                }
+
+                self.simplify_visibility_constraints(no_branch_taken);
path: crates/red_knot_python_semantic/src/semantic_index/builder.rs
user: login: carljm
body: The "simplify visibility constraints" stuff only makes sense for conditional branches, where we simplify the constraints when two different branches with different visibility constraints merge back together, and a symbol wasn't redefined in either branch.

There's no branching here, so there are no branches merging back together, so there's nothing to simplify.

(Also the name `last_predicate` doesn't make much sense when there's only one predicate.)

```suggestion
                let predicate = self.record_expression_narrowing_constraint(&node.test);
                self.record_visibility_constraint(predicate);

                if let Some(msg) = &node.msg {
                    self.visit_expr(msg);
                }
```
created_at: 2025-04-04T21:14:43Z
author_association: CONTRIBUTOR
diff_hunk: @@ -519,7 +519,6 @@ impl<'db> SemanticIndexBuilder<'db> {
     }
 
     /// Records a visibility constraint by applying it to all live bindings and declarations.
-    #[must_use = "A visibility constraint must always be negated after it is added"]
path: crates/red_knot_python_semantic/src/semantic_index/builder.rs
user: login: carljm
body: Removed this because it is not true, and this PR is an example of where it is not true; the "other branch" for an assert statement is an exception, which exits the scope, so there is no other branch in which the visibility constraint should be negated.
created_at: 2025-04-10T04:55:13Z
author_association: CONTRIBUTOR
diff_hunk: @@ -519,7 +519,6 @@ impl<'db> SemanticIndexBuilder<'db> {
     }
 
     /// Records a visibility constraint by applying it to all live bindings and declarations.
-    #[must_use = "A visibility constraint must always be negated after it is added"]
path: crates/red_knot_python_semantic/src/semantic_index/builder.rs
user: login: AlexWaygood
body: Oops, I introduced that in a recent PR — thanks for the correction!
created_at: 2025-04-10T07:42:47Z
author_association: MEMBER
diff_hunk: @@ -519,7 +519,6 @@ impl<'db> SemanticIndexBuilder<'db> {
     }
 
     /// Records a visibility constraint by applying it to all live bindings and declarations.
-    #[must_use = "A visibility constraint must always be negated after it is added"]
path: crates/red_knot_python_semantic/src/semantic_index/builder.rs
user: login: carljm
body: No problem. It was a good idea, and it was true for all our uses at the time!
created_at: 2025-04-10T13:05:30Z
author_association: CONTRIBUTOR

PR comments:
user: login: MatthewMckee4
created_at: 2025-04-02T12:42:01Z
body: ```py
assert "", b"hi"  # [assert-on-string-literal]
```
This is panicking, not exactly sure why, and its because of `b"hi"`
author_association: CONTRIBUTOR
user: login: MatthewMckee4
created_at: 2025-04-03T13:43:12Z
body: Tests are failing because
```py
class ClassWithBool(list):
    def __bool__(self):
        return True


class ChildClassWithBool(ClassWithBool):
    pass


assert len(ClassWithBool())
assert len(ChildClassWithBool())
```
with
```bash
thread '<unnamed>' panicked at /home/matthew/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/d758691/src/function/fetch.rs:154:25:
dependency graph cycle querying member_lookup_with_policy_(Id(2816)); set cycle_fn/cycle_initial to fixpoint iterate
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Rayon: detected unexpected panic; aborting
Aborted (core dumped)
```

But, weirdly, if i comment out either assert statement, this runs just fine, it only panics when both of the assert statements are there
author_association: CONTRIBUTOR
user: login: MatthewMckee4
created_at: 2025-04-03T23:10:06Z
body: If any is able to look into this that would be great.

The bug is happening around

https://github.com/astral-sh/ruff/blob/4f924bb97524c217d743d9244e76651e1d7cafc7/crates/red_knot_python_semantic/src/types/class.rs#L253-L256
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-03T23:13:28Z
body: <!-- generated-comment mypy_primer -->
## `mypy_primer` results
<details>
<summary>Changes were detected when running on open source projects</summary>

```diff
pyinstrument (https://github.com/joerick/pyinstrument)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_cmdline_main.py:52:12: Type `None` has no attribute `time`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_cmdline_main.py:76:12: Type `None` has no attribute `processor_options`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_cmdline_main.py:100:12: Type `None` has no attribute `processor_options`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:69:5: Attribute `self_check` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:71:12: Attribute `total_self_time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:72:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:73:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:74:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:75:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:76:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:77:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:79:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:80:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:81:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:123:5: Attribute `self_check` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:125:12: Attribute `total_self_time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:126:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:127:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:128:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:129:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:130:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:131:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:159:5: Attribute `self_check` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:161:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:162:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:163:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:164:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:165:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:166:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:167:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:168:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:207:5: Attribute `self_check` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:208:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:210:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:211:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:212:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:213:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:214:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:215:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:216:12: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:252:5: Attribute `self_check` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:253:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:255:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:256:60: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:288:5: Attribute `self_check` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:289:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:290:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:292:28: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:347:5: Attribute `self_check` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:348:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_processors.py:349:18: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:51:12: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:52:12: Attribute `await_time` on type `Frame | None` is possibly unbound
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:54:47: Object of type `Frame | None` cannot be assigned to parameter 1 (`frame`) of function `walk_frames`; expected type `Frame`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:74:16: Attribute `time` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:75:16: Attribute `await_time` on type `Frame | None` is possibly unbound
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:77:51: Object of type `Frame | None` cannot be assigned to parameter 1 (`frame`) of function `walk_frames`; expected type `Frame`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:158:18: Attribute `root_frame` on type `None | @Todo(Support for `typing.TypeVar` instances in type expressions)` is possibly unbound
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:166:44: Object of type `Frame | None` cannot be assigned to parameter 1 (`frame`) of function `walk_frames`; expected type `Frame`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:199:12: Attribute `time` on type `Frame | None` is possibly unbound
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:201:44: Object of type `Frame | None` cannot be assigned to parameter 1 (`frame`) of function `walk_frames`; expected type `Frame`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:231:12: Attribute `time` on type `Frame | None` is possibly unbound
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:233:44: Object of type `Frame | None` cannot be assigned to parameter 1 (`frame`) of function `walk_frames`; expected type `Frame`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:238:32: Object of type `Frame | None` cannot be assigned to parameter 1 (`frame`) of function `walk_frames`; expected type `Frame`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/context_manager.py:76:17: Attribute `f_code` on type `FrameType | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/context_manager.py:76:50: Attribute `f_lineno` on type `FrameType | None` is possibly unbound
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/test/test_pstats_renderer.py:125:43: Object of type `Session | None` cannot be assigned to parameter 2 (`session`) of bound method `render`; expected type `Session`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_threading.py:20:48: Attribute `frame_records` on type `Unknown | ActiveProfilerSession | None` is possibly unbound
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_threading.py:44:12: Type `None` has no attribute `args`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pyinstrument/pyinstrument/stack_sampler.py:249:53: Object of type `int | float | None` cannot be assigned to parameter 1 (`value`) of function `format_float_with_sig_figs`; expected type `int | float`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:90:12: Attribute `function` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:91:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:112:12: Attribute `function` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:113:16: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:115:31: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:115:31: Attribute `children` on type `Frame | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:115:31: Attribute `children` on type `Frame | None` is possibly unbound
- Found 292 diagnostics
+ Found 215 diagnostics

packaging (https://github.com/pypa/packaging)
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:97:22: Attribute `rsplit` on type `str | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:97:22: Attribute `rsplit` on type `str | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:97:22: Attribute `rsplit` on type `str | None` is possibly unbound
- Found 348 diagnostics
+ Found 345 diagnostics

pybind11 (https://github.com/pybind/pybind11)
+ 
+ thread '<unnamed>' panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/87bf6b6/src/function/fetch.rs:167:25:
+ dependency graph cycle querying try_metaclass_(Id(28402)); set cycle_fn/cycle_initial to fixpoint iterate
+ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+ 
+ thread '<unnamed>' panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/87bf6b6/src/function/fetch.rs:167:25:
+ dependency graph cycle querying member_lookup_with_policy_(Id(1c8b1)); set cycle_fn/cycle_initial to fixpoint iterate
+ 
+ thread '<unnamed>' panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/87bf6b6/src/function/fetch.rs:167:25:
+ dependency graph cycle querying try_metaclass_(Id(2e02d)); set cycle_fn/cycle_initial to fixpoint iterate
+ Rayon: detected unexpected panic; aborting
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_tagbased_polymorphic.py:3:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_unique_ptr.py:3:8: Cannot resolve import `pybind11_tests.class_sh_trampoline_unique_ptr`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_custom_type_casters.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_custom_type_casters.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_custom_type_casters.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_constants_and_functions.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_mi_thunks.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_mi_thunks.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_property_non_owning.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_property_non_owning.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_release_gil_before_calling_cpp_dtor.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_release_gil_before_calling_cpp_dtor.py:7:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_cmake_build/test.py:5:8: Cannot resolve import `test_cmake_build`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_warnings.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_warnings.py:7:8: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_warnings.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_operator_overloading.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_operator_overloading.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_operator_overloading.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_operator_overloading.py:7:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_basic.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_basic.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:7:6: Cannot resolve import `pybind11_tests`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:58:5: Cannot create a consistent method resolution order (MRO) for class `MI1` with bases list `[Unknown, Unknown]`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:67:5: Cannot create a consistent method resolution order (MRO) for class `MI2` with bases list `[<class 'B1'>, Unknown, Unknown]`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:83:5: Cannot create a consistent method resolution order (MRO) for class `MI5` with bases list `[Unknown, <class 'B1'>, Unknown]`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:163:5: Cannot create a consistent method resolution order (MRO) for class `MIMany14` with bases list `[Unknown, Unknown, Unknown, Unknown]`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:170:5: Cannot create a consistent method resolution order (MRO) for class `MIMany58` with bases list `[Unknown, Unknown, Unknown, Unknown]`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_multiple_inheritance.py:177:5: Cannot create a consistent method resolution order (MRO) for class `MIMany916` with bases list `[Unknown, Unknown, Unknown, Unknown, Unknown, Unknown, Unknown, Unknown]`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_docs_advanced_cast_custom.py:6:10: Cannot resolve import `conftest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_docs_advanced_cast_custom.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_embed/test_trampoline.py:3:8: Cannot resolve import `trampoline_module`
- warning[lint:possibly-unresolved-reference] /tmp/mypy_primer/projects/pybind11/pybind11/__main__.py:23:22: Name `UNSAFE` used when possibly not defined
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pickling.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pickling.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pickling.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pickling.py:80:10: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_self_life_support.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_self_life_support.py:5:8: Cannot resolve import `pybind11_tests.class_sh_trampoline_self_life_support`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:10:6: Cannot resolve import `pybind11_tests`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:218:5: Cannot create a consistent method resolution order (MRO) for class `RabbitHamster` with bases list `[Unknown, Unknown]`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class.py:529:10: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_shared_ptr_copy_move.py:3:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eigen_tensor.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eigen_tensor.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eigen_tensor.py:13:12: Cannot resolve import `eigen_tensor_avoid_stl_array`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/env.py:7:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_methods_and_attributes.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_methods_and_attributes.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_methods_and_attributes.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_methods_and_attributes.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_methods_and_attributes.py:243:10: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_methods_and_attributes.py:375:10: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_dtypes.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_dtypes.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_dtypes.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_python_multiple_inheritance.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:7:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:168:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:168:10: Object of type `Literal[redirect_stdout]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:176:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:176:10: Object of type `Literal[redirect_stdout]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:187:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:187:10: Object of type `Literal[redirect_stderr]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:195:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:195:10: Object of type `Literal[redirect_stderr]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:205:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:205:10: Object of type `Literal[redirect_stdout]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:225:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:225:10: Object of type `Literal[redirect_stdout]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:232:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:232:10: Object of type `Literal[redirect_stdout]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:239:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:239:10: Object of type `Literal[redirect_stdout]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:251:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:251:10: Object of type `Literal[redirect_stderr]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:266:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:266:10: Object of type `Literal[redirect_stdout]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:266:35: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_iostream.py:266:35: Object of type `Literal[redirect_stderr]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_unnamed_namespace_a.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_unnamed_namespace_a.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_unnamed_namespace_a.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_custom_type_setup.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_custom_type_setup.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_custom_type_setup.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tools/make_changelog.py:11:8: Cannot resolve import `ghapi.all`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_unique_ptr_custom_deleter.py:3:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:10:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:28:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:53:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:66:12: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:76:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:110:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:136:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:178:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:186:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_local_bindings.py:208:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_embed/test_interpreter.py:5:6: Cannot resolve import `widget_module`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_union.py:3:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_const_name.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_const_name.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_inheritance.py:3:6: Cannot resolve import `pybind11_tests`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_inheritance.py:54:5: Cannot create a consistent method resolution order (MRO) for class `Drvd2` with bases list `[Unknown, Unknown]`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_basic.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_basic.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_vector_unique_ptr_member.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_vector_unique_ptr_member.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_copy_move.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_copy_move.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_copy_move.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_sequences_and_iterators.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_sequences_and_iterators.py:6:6: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_sequences_and_iterators.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_sequences_and_iterators.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_sequences_and_iterators.py:10:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_chrono.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_chrono.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_chrono.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_opaque_types.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_opaque_types.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_opaque_types.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_opaque_types.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_opaque_types.py:7:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_virtual_functions.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_virtual_functions.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_virtual_functions.py:10:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_exceptions.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_exceptions.py:6:6: Cannot resolve import `custom_exceptions`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_exceptions.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_exceptions.py:9:8: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_exceptions.py:10:8: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_exceptions.py:11:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_virtual_py_cpp_mix.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_virtual_py_cpp_mix.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_factory_constructors.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_factory_constructors.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_factory_constructors.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_factory_constructors.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_factory_constructors.py:10:6: Cannot resolve import `pybind11_tests.factory_constructors`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_factory_constructors.py:230:10: Cannot resolve import `pybind11_tests.factory_constructors`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_factory_constructors.py:338:5: Cannot create a consistent method resolution order (MRO) for class `MITest` with bases list `[Unknown, Unknown]`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:10:6: Cannot resolve import `pybind11_tests.modules`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:14:12: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:69:10: Cannot resolve import `pybind11_tests.modules`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_modules.py:78:12: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_array.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_array.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_array.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_unnamed_namespace_b.py:3:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/conftest.py:20:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/conftest.py:24:12: Cannot resolve import `pybind11_tests`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/conftest.py:222:14: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/conftest.py:222:14: Object of type `Literal[suppress]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py:6:8: Cannot resolve import `pybind11_tests.class_sh_trampoline_shared_ptr_cpp_arg`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_vectorize.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_numpy_vectorize.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_native_enum.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_native_enum.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_native_enum.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/pybind11/tests/test_native_enum.py:114:41: Type `IntEnum` has no attribute `mem`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_smart_ptr.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_smart_ptr.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_smart_ptr.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_gil_scoped.py:8:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_gil_scoped.py:10:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_gil_scoped.py:11:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_type_caster_pyobject_ptr.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_type_caster_pyobject_ptr.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eval.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eval.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eval.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl.py:7:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl.py:391:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_factory_constructors.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_factory_constructors.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_type_caster_std_function_specializations.py:3:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_from_this.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_from_this.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_from_this.py:9:8: Cannot resolve import `pybind11_tests.class_sh_trampoline_shared_from_this`
- warning[lint:possibly-unresolved-reference] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_from_this.py:213:20: Name `obj0_wr` used when possibly not defined
- warning[lint:possibly-unresolved-reference] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_trampoline_shared_from_this.py:216:20: Name `obj0_wr` used when possibly not defined
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_thread.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_thread.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_async.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning_mi.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning_mi.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning_mi.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning_mi.py:72:1: Cannot create a consistent method resolution order (MRO) for class `MI1` with bases list `[Unknown, Unknown]`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning_mi.py:83:1: Cannot create a consistent method resolution order (MRO) for class `MI2` with bases list `[<class 'B1'>, Unknown, Unknown]`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_disowning_mi.py:102:1: Cannot create a consistent method resolution order (MRO) for class `MI5` with bases list `[Unknown, <class 'B1'>, Unknown]`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_unique_ptr_member.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_unique_ptr_member.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_docstring_options.py:3:6: Cannot resolve import `pybind11_tests`
- warning[lint:unresolved-reference] /tmp/mypy_primer/projects/pybind11/tests/test_eval_call.py:5:5: Name `call_test2` used when not defined
- warning[lint:unresolved-reference] /tmp/mypy_primer/projects/pybind11/tests/test_eval_call.py:5:16: Name `y` used when not defined
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_enum.py:6:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_enum.py:8:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_enum.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_kwargs_and_defaults.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_kwargs_and_defaults.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_kwargs_and_defaults.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_call_policies.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_call_policies.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_call_policies.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_call_policies.py:7:6: Cannot resolve import `pybind11_tests`
- error[lint:inconsistent-mro] /tmp/mypy_primer/projects/pybind11/tests/test_call_policies.py:168:5: Cannot create a consistent method resolution order (MRO) for class `Derived` with bases list `[Unknown, Unknown]`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_cpp_conduit.py:5:8: Cannot resolve import `exo_planet_c_api`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_cpp_conduit.py:6:8: Cannot resolve import `exo_planet_pybind11`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_cpp_conduit.py:7:8: Cannot resolve import `home_planet_very_lonely_traveler`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_cpp_conduit.py:8:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_cpp_conduit.py:10:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_cpp_conduit.py:11:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl_binders.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl_binders.py:5:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_stl_binders.py:130:12: Cannot resolve import `pybind11_cross_module_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_property.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_property.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_class_sh_property.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_callbacks.py:7:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_callbacks.py:9:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_callbacks.py:10:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_callbacks.py:11:6: Cannot resolve import `pybind11_tests`
- warning[lint:unused-ignore-comment] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:69:48: Unused blanket `type: ignore` directive
- warning[lint:unused-ignore-comment] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:72:62: Unused blanket `type: ignore` directive
- error[lint:invalid-base] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:89:25: Invalid class base with type `Literal[Extension, Extension]` (all bases must be a class, `Any`, `Unknown` or `Todo`)
- error[lint:invalid-base] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:271:17: Invalid class base with type `Literal[build_ext, build_ext]` (all bases must be a class, `Any`, `Unknown` or `Todo`)
- warning[lint:possibly-unresolved-reference] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:471:31: Name `multiprocessing` used when possibly not defined
- warning[lint:possibly-unresolved-reference] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:477:22: Name `ThreadPool` used when possibly not defined
- warning[lint:unused-ignore-comment] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:492:66: Unused blanket `type: ignore` directive
- warning[lint:unused-ignore-comment] /tmp/mypy_primer/projects/pybind11/pybind11/setup_helpers.py:500:66: Unused blanket `type: ignore` directive
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_builtin_casters.py:5:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_builtin_casters.py:7:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_builtin_casters.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_builtin_casters.py:8:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_builtin_casters.py:9:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:7:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:9:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:10:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:11:6: Cannot resolve import `pybind11_tests`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:182:15: Operator `*` is unsupported between objects of type `Literal[c_char]` and `Literal[10]`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:183:14: Operator `*` is unsupported between objects of type `Literal[c_int]` and `Literal[15]`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:184:15: Operator `*` is unsupported between objects of type `Literal[c_long]` and `Literal[7]`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:197:16: Operator `*` is unsupported between objects of type `Literal[c_char]` and `Literal[10]`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:198:15: Operator `*` is unsupported between objects of type `Literal[c_int]` and `Literal[15]`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:199:16: Operator `*` is unsupported between objects of type `Literal[c_long]` and `Literal[7]`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:217:23: Operator `*` is unsupported between objects of type `Literal[c_char]` and `int`
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/pybind11/tests/test_buffers.py:220:23: Operator `*` is unsupported between objects of type `Literal[c_char]` and `int`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eigen_matrix.py:3:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eigen_matrix.py:5:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_eigen_matrix.py:6:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/extra_setuptools/test_setuphelper.py:8:8: Cannot resolve import `pytest`
- warning[lint:possibly-unresolved-reference] /tmp/mypy_primer/projects/pybind11/setup.py:47:48: Name `patch` used when possibly not defined
- warning[lint:possibly-unresolved-reference] /tmp/mypy_primer/projects/pybind11/setup.py:47:59: Name `level` used when possibly not defined
- warning[lint:unused-ignore-comment] /tmp/mypy_primer/projects/pybind11/setup.py:109:36: Unused blanket `type: ignore` directive
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/extra_python_package/test_files.py:158:10: No argument provided for required parameter `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/extra_python_package/test_files.py:158:10: Object of type `Literal[closing]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pytypes.py:7:8: Cannot resolve import `pytest`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pytypes.py:9:8: Cannot resolve import `env`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pytypes.py:10:6: Cannot resolve import `pybind11_tests`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pytypes.py:11:6: Cannot resolve import `pybind11_tests`
- error[lint:missing-argument] /tmp/mypy_primer/projects/pybind11/tests/test_pytypes.py:777:14: No arguments provided for required parameters `bases`, `namespace` of bound method `__new__`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/pybind11/tests/test_pytypes.py:777:14: Object of type `Literal[nullcontext]` cannot be assigned to parameter 2 (`name`) of bound method `__new__`; expected type `str`
- error[lint:unresolved-import] /tmp/mypy_primer/projects/pybind11/tests/test_pytypes.py:1175:25: Module `inspect` has no member `get_annotations`
- Found 287 diagnostics

black (https://github.com/psf/black)
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/driver.py:291:13: Object of type `bytes | None` cannot be assigned to parameter 2 (`pkl`) of bound method `loads`; expected type `bytes`
- error[lint:invalid-return-type] /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/pgen.py:187:16: Object of type `tuple[dict, None | Unknown]` is not assignable to return type `tuple[@Todo(generics), str]`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/blib2to3/pytree.py:564:17: Attribute `update` on type `@Todo(Support for `typing.GenericAlias` instances in type expressions) | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:203:29: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:210:30: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:267:41: Attribute `parent` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:267:54: Attribute `parent` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:277:8: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:282:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:287:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:304:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:311:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:323:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:336:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:340:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:348:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:355:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:358:20: Attribute `parent` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:359:16: Attribute `parent` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:370:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:375:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:380:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:402:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:414:10: Attribute `type` on type `Node | None` is possibly unbound
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/black/src/black/nodes.py:417:10: Attribute `type` on type `Node | None` is possibly unbound
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/black/src/black/__init__.py:672:17: Object of type `@Todo(return type of overloaded function) | None` cannot be assigned to parameter `root` of function `get_sources`; expected type `Path`
- Found 258 diagnostics
+ Found 232 diagnostics

werkzeug (https://github.com/pallets/werkzeug)
- warning[lint:possibly-unbound-attribute] /tmp/mypy_primer/projects/werkzeug/tests/test_http.py:728:12: Attribute `to_header` on type `@Todo(Support for `typing.Self`) | None` is possibly unbound
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/werkzeug/tests/sansio/test_multipart.py:127:16: Type `Event` has no attribute `more_data`
+ error[lint:unsupported-operator] /tmp/mypy_primer/projects/werkzeug/tests/test_local.py:208:12: Operator `in` is not supported for types `str` and `None`, in comparing `Literal["int("]` with `@Todo(generics) & Unknown & str | @Todo(generics) & Any & str | @Todo(generics) & str | @Todo(generics) & Unknown & None | @Todo(generics) & Any & None | @Todo(generics) & None`
- Found 769 diagnostics
+ Found 768 diagnostics

rich (https://github.com/Textualize/rich)
- error[lint:unresolved-attribute] /tmp/mypy_primer/projects/rich/tests/test_logging.py:122:25: Type `None` has no attribute `msg`
- error[lint:invalid-argument-type] /tmp/mypy_primer/projects/rich/rich/traceback.py:760:34: Object of type `None | range` cannot be assigned to parameter 1 (`obj`) of function `len`; expected type `Sized`
- warning[lint:possibly-unbound-attribute] /tmp/mypy_...*[Comment body truncated]*
author_association: CONTRIBUTOR
user: login: MatthewMckee4
created_at: 2025-04-03T23:23:15Z
body: I think the error is coming from me changing the `infer_expression` call to `infer_standalone_expression`, but this seems to be the right change.
author_association: CONTRIBUTOR
user: login: carljm
created_at: 2025-04-04T23:39:43Z
body: A few comments here. Generally looks good!

The cycle failure here in the corpus tests is a symptom of a larger problem, which I discussed (along with some possible fixes) in Discord. We could probably paper over it by adding fixpoint cycle handling to `Class::try_metaclass` query, but given that this is a smaller PR and not likely to accumulate many conflicts, it may make sense to just hold off for a more general fix, which I should be able to land soon (and already verified eliminates this cycle.)
author_association: CONTRIBUTOR
user: login: MatthewMckee4
created_at: 2025-04-05T16:10:20Z
body: @carljm did you mean to add review comments?
author_association: CONTRIBUTOR
user: login: MatthewMckee4
created_at: 2025-04-05T18:25:51Z
body: Thanks!
author_association: CONTRIBUTOR
user: login: MatthewMckee4
created_at: 2025-04-05T18:26:43Z
body: Something isnt implemented for some literal values
```py
from typing import Literal

def _(x: Literal[1, 2, 3], y: Literal[1, 2, 3]):
    assert x is 2
    reveal_type(x)  # revealed: Literal[2]
    assert y == 2
    reveal_type(y)  # revealed: Literal[1, 2, 3]
```
This passes
author_association: CONTRIBUTOR
user: login: MatthewMckee4
created_at: 2025-04-05T18:29:40Z
body: Maybe i remove this test and make a new PR for literal ints, bools strings and bytes?
author_association: CONTRIBUTOR
user: login: carljm
created_at: 2025-04-05T18:33:35Z
body: Nah just leave it as is, it's fine.
author_association: CONTRIBUTOR
user: login: carljm
created_at: 2025-04-10T04:04:38Z
body: Rebased this on top of https://github.com/astral-sh/ruff/pull/17326, which eliminates the cycle panic previously seen here.

That PR can't land until https://github.com/salsa-rs/salsa/pull/790 lands in Salsa.
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-10T04:13:55Z
body: <!-- generated-comment ecosystem -->
## `ruff-ecosystem` results
### Linter (stable)
✅ ecosystem check detected no linter changes.

### Linter (preview)
✅ ecosystem check detected no linter changes.

### Formatter (stable)
✅ ecosystem check detected no format changes.

### Formatter (preview)
✅ ecosystem check detected no format changes.



author_association: CONTRIBUTOR