forked from cool-RR/python_toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabc_tools.py
More file actions
22 lines (16 loc) · 704 Bytes
/
abc_tools.py
File metadata and controls
22 lines (16 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
'''Defines tools related to abstract base classes from the `abc` module.'''
class AbstractStaticMethod(staticmethod):
'''
A combination of `abc.abstractmethod` and `staticmethod`.
A method which (a) doesn't take a `self` argument and (b) must be
overridden in any subclass if you want that subclass to be instanciable.
This class is good only for documentation; it doesn't enforce overriding
methods to be static.
'''
__slots__ = ()
__isabstractmethod__ = True
def __init__(self, function):
super().__init__(function)
function.__isabstractmethod__ = True