API details.
class A:
  def __init__(self, a=''):
    self.a = a
  pass

add_method

add_method[source]

add_method()

a decorator that allows you to add methods to a class

test

@add_method(A)
def printHello(self):
  '''this function prints hello'''
  print('hello')

print(A().printHello())
print(A().printHello.__name__)
print(A().printHello.__doc__)
hello
None
printHello
this function prints hello

add_static_method[source]

add_static_method()

a decorator that allows you to add static methods to a class

@add_static_method(A)
def printHelloStatic(inputString):
  print(inputString)

A.printHelloStatic(inputString='hello')
A.printHelloStatic('hello')
hello
hello

add_class_method[source]

add_class_method()

a decorator that allows you to add class method to a class

@add_class_method(A)
def printHelloClass(cls,a):
  return cls(a).a

A.printHelloClass('hi')
'hi'
lst = [1,2,2]
lst.remove(2)
print(lst)
[1, 2]