-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[autodoc] add support for singledispatchmethod class methods (#11284)
- Loading branch information
Showing
4 changed files
with
87 additions
and
1 deletion.
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
31 changes: 31 additions & 0 deletions
31
tests/roots/test-ext-autodoc/target/singledispatchmethod_classmethod.py
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,31 @@ | ||
from functools import singledispatchmethod | ||
|
||
|
||
class Foo: | ||
"""docstring""" | ||
|
||
@singledispatchmethod | ||
@classmethod | ||
def class_meth(cls, arg, kwarg=None): | ||
"""A class method for general use.""" | ||
pass | ||
|
||
@class_meth.register(int) | ||
@class_meth.register(float) | ||
@classmethod | ||
def _class_meth_int(cls, arg, kwarg=None): | ||
"""A class method for numbers.""" | ||
pass | ||
|
||
@class_meth.register(str) | ||
@classmethod | ||
def _class_meth_str(cls, arg, kwarg=None): | ||
"""A class method for str.""" | ||
pass | ||
|
||
@class_meth.register | ||
@classmethod | ||
def _class_meth_dict(cls, arg: dict, kwarg=None): | ||
"""A class method for dict.""" | ||
# This function tests for specifying type through annotations | ||
pass |
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