blob: 039fada89774bd3b8a56e4404cc258c0e1b11d5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
|