| 1 |
from functools import singledispatchmethod |
| 2 |
|
| 3 |
|
| 4 |
class Foo: |
| 5 |
"""docstring""" |
| 6 |
|
| 7 |
@singledispatchmethod |
| 8 |
@classmethod |
| 9 |
def class_meth(cls, arg, kwarg=None): |
| 10 |
"""A class method for general use.""" |
| 11 |
pass |
| 12 |
|
| 13 |
@class_meth.register(int) |
| 14 |
@class_meth.register(float) |
| 15 |
@classmethod |
| 16 |
def _class_meth_int(cls, arg, kwarg=None): |
| 17 |
"""A class method for numbers.""" |
| 18 |
pass |
| 19 |
|
| 20 |
@class_meth.register(str) |
| 21 |
@classmethod |
| 22 |
def _class_meth_str(cls, arg, kwarg=None): |
| 23 |
"""A class method for str.""" |
| 24 |
pass |
| 25 |
|
| 26 |
@class_meth.register |
| 27 |
@classmethod |
| 28 |
def _class_meth_dict(cls, arg: dict, kwarg=None): |
| 29 |
"""A class method for dict.""" |
| 30 |
# This function tests for specifying type through annotations |
| 31 |
pass |