Fix E721: do not compare types, for exact checks use is / is not
Description
This splits out a controvertial part of #581 code cleanup. See https://github.com/pymc-devs/pytensor/pull/581#discussion_r1448620228.
This runs a risk of breaking something extremely subtle, so I think we will not want to merge this, but I wanted to at least give this its own PR number for reference.
Checklist
- [ ] Checked that the pre-commit linting/style checks pass
- [ ] Included tests that prove the fix is effective or that the new feature works
- [ ] Added necessary documentation (docstrings and/or example notebooks)
- [ ] If you are a pro: each commit corresponds to a relevant logical change
Type of change
- [ ] New feature / enhancement
- [ ] Bug fix
- [ ] Documentation
- [X] Maintenance
- [ ] Other (please specify):
Codecov Report
Attention: Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.
Project coverage is 80.83%. Comparing base (
4b6a444) to head (e4d207b). Report is 170 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #596 +/- ##
=======================================
Coverage 80.83% 80.83%
=======================================
Files 163 163
Lines 46897 46897
Branches 11468 11468
=======================================
Hits 37910 37910
Misses 6774 6774
Partials 2213 2213
| Files with missing lines | Coverage Δ | |
|---|---|---|
| pytensor/compile/debugmode.py | 61.33% <100.00%> (ø) |
|
| pytensor/compile/ops.py | 83.57% <100.00%> (ø) |
|
| pytensor/graph/basic.py | 88.61% <ø> (ø) |
|
| pytensor/graph/rewriting/unify.py | 99.33% <100.00%> (ø) |
|
| pytensor/ifelse.py | 51.70% <100.00%> (ø) |
|
| pytensor/link/c/params_type.py | 80.41% <ø> (ø) |
|
| pytensor/link/c/type.py | 75.98% <ø> (ø) |
|
| pytensor/scalar/math.py | 87.34% <100.00%> (ø) |
|
| pytensor/scan/op.py | 84.71% <100.00%> (ø) |
|
| pytensor/sparse/basic.py | 82.53% <ø> (ø) |
|
| ... and 9 more |
I think we can go ahead with this one @maresb
Can you rebase?
@ricardoV94, rebase is complete.
@maresb were we suppressing this pre-commit rule, should we reactivate it?
@maresb were we suppressing this pre-commit rule, should we reactivate it?
No we weren't, it's just totally broken in Ruff: https://github.com/astral-sh/ruff/issues/6465
But now E721 passes with flake8