1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """MakeStatic and MakeClass
23
24 These functions are used to make all the instance methods in a class
25 into static or class methods.
26
27 """
28
30
32 """turn instance methods into static ones
33
34 The methods (that don't begin with _) of any class that
35 subclasses this will be turned into static methods.
36
37 """
38 for name in dir(cls):
39 if name[0] != "_":
40 cls.__dict__[name] = staticmethod(cls.__dict__[name])
41
43 """Turn instance methods into classmethods. Ignore _ like above"""
44 for name in dir(cls):
45 if name[0] != "_":
46 cls.__dict__[name] = classmethod(cls.__dict__[name])
47