Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to ban multiple inheritance #334

Merged
merged 10 commits into from
May 8, 2024
Merged

Conversation

DetachHead
Copy link
Owner

fixes #120

This comment has been minimized.

This comment has been minimized.

README.md Outdated
@@ -143,6 +143,31 @@ unfortunately, this will cause a `reportInvalidCast` error when this rule is ena

this means that although casting between them is a common use case, `TypedDict`s and `dict`s technically do not overlap.

### `reportMultipleInheritance` - ban inheriting from multiple different base classes
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add it to the playground

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment has been minimized.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved

This comment has been minimized.

@DetachHead DetachHead force-pushed the ban-multiple-inheritance branch from 8706dd8 to a4618c1 Compare May 7, 2024 09:26

This comment has been minimized.

@DetachHead DetachHead force-pushed the ban-multiple-inheritance branch 2 times, most recently from 49f9fc8 to add3821 Compare May 7, 2024 09:43

This comment has been minimized.

@DetachHead DetachHead force-pushed the ban-multiple-inheritance branch from add3821 to 4b4f853 Compare May 8, 2024 07:13
@DetachHead DetachHead force-pushed the ban-multiple-inheritance branch from 4b4f853 to 4d3e7df Compare May 8, 2024 07:18
@DetachHead DetachHead force-pushed the ban-multiple-inheritance branch from 4d3e7df to 5d621d1 Compare May 8, 2024 07:21
Copy link
Contributor

github-actions bot commented May 8, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

pyp (https://github.com/hauntsaninja/pyp)
-   /tmp/mypy_primer/projects/pyp/pyp.py:240:9 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)
-   /tmp/mypy_primer/projects/pyp/pyp.py:298:9 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)
- 276 errors, 0 warnings, 0 notes
+ 274 errors, 0 warnings, 0 notes

pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+   /tmp/mypy_primer/projects/pytest-robotframework/tests/conftest.py:196:78 - error: Unnecessary "# pyright: ignore" rule: "reportMissingSuperCall"
- 2055 errors, 0 warnings, 0 notes
+ 2056 errors, 0 warnings, 0 notes

bidict (https://github.com/jab/bidict)
+   /tmp/mypy_primer/projects/bidict/bidict/_base.py:52:7 - error: Multiple inheritance is not allowed because the following base classes have `__init__` or `__new__` methods: ValuesView
+     Only the first base class is allowed to have a constructor. (reportUnsafeMultipleInheritance)
+ /tmp/mypy_primer/projects/bidict/bidict/_exc.py
+   /tmp/mypy_primer/projects/bidict/bidict/_exc.py:31:7 - error: Multiple inheritance is not allowed because the following base classes have `__init__` or `__new__` methods: BaseException
+     Only the first base class is allowed to have a constructor. (reportUnsafeMultipleInheritance)
-   /tmp/mypy_primer/projects/bidict/bidict/_orderedbase.py:44:9 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)
-   /tmp/mypy_primer/projects/bidict/bidict/_orderedbase.py:68:9 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)
+   /tmp/mypy_primer/projects/bidict/bidict/_orderedbidict.py:29:7 - error: Multiple inheritance is not allowed because the following base classes have `__init__` or `__new__` methods: BidictBase
+     Only the first base class is allowed to have a constructor. (reportUnsafeMultipleInheritance)
-   /tmp/mypy_primer/projects/bidict/tests/bidict_test_fixtures.py:38:9 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)

PyWinCtl (https://github.com/Kalmat/PyWinCtl)
-   /tmp/mypy_primer/projects/PyWinCtl/src/pywinctl/_main.py:447:9 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)
-   /tmp/mypy_primer/projects/PyWinCtl/src/pywinctl/_pywinctl_macos.py:1280:13 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)
-   /tmp/mypy_primer/projects/PyWinCtl/src/pywinctl/_pywinctl_win.py:1011:13 - error: Method "__init__" does not call the method of the same name in parent class (reportMissingSuperCall)
- 1358 errors, 0 warnings, 0 notes
+ 1355 errors, 0 warnings, 0 notes

@DetachHead DetachHead merged commit 774731b into main May 8, 2024
11 checks passed
@DetachHead DetachHead deleted the ban-multiple-inheritance branch May 8, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

option to ban multiple inheritance
1 participant