Skip to content
Snippets Groups Projects

Fixed bug where the functionality of inspect.ismethod changed in Python 3, not…

Open Ellert van der Velden requested to merge g-ellertvandervelden/mpi_dummy:master into master
1 file
+ 8
1
Compare changes
  • Side-by-side
  • Inline
+ 8
1
@@ -3,6 +3,7 @@
from __future__ import absolute_import
from builtins import object
import inspect
import sys
import copy
import numpy as np
@@ -11,11 +12,17 @@ from .op import SUM
__all__ = ['Comm', 'Intracomm', 'COMM_WORLD', 'COMM_SELF']
# Select function for detecting an instance method of a class
if(sys.version_info.major >= 3):
ismethod_func = inspect.isfunction
else:
ismethod_func = inspect.ismethod
SINGLE_THREADED_Q = None
def decorate_all_methods(decorator):
def decorate_the_class(cls):
for name, m in inspect.getmembers(cls, inspect.ismethod):
for name, m in inspect.getmembers(cls, ismethod_func):
if name != '__init__':
setattr(cls, name, decorator(m))
return cls
Loading