-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typing.overload
functions are exempted from ``too-many-function-a…
…rgs`` Close #3170
- Loading branch information
1 parent
3d6ddbe
commit 75ae5cc
Showing
4 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring | ||
# pylint: disable=too-few-public-methods | ||
from typing import overload | ||
|
||
|
||
class ClassA: | ||
@classmethod | ||
@overload | ||
def method(cls, arg1): | ||
pass | ||
|
||
@classmethod | ||
@overload | ||
def method(cls, arg1, arg2): | ||
pass | ||
|
||
@classmethod | ||
def method(cls, arg1, arg2=None): | ||
pass | ||
|
||
|
||
ClassA.method(1, 2) | ||
|
||
|
||
class ClassB: | ||
@overload | ||
def method(self, arg1): | ||
pass | ||
|
||
@overload | ||
def method(self, arg1, arg2): | ||
pass | ||
|
||
def method(self, arg1, arg2=None): | ||
pass | ||
|
||
|
||
ClassB().method(1, arg2=2) |