comparison tincan.py @ 13:6de828de4409 draft

Fix an introspection error.
author David Barts <n5jrn@me.com>
date Thu, 16 May 2019 11:42:56 -0700
parents 496d43d551d2
children 9d0497dc19f8
comparison
equal deleted inserted replaced
12:496d43d551d2 13:6de828de4409
464 except Exception as e: 464 except Exception as e:
465 raise TinCanError("{0}: error importing".format(pycpath)) from e 465 raise TinCanError("{0}: error importing".format(pycpath)) from e
466 self._class = None 466 self._class = None
467 for i in dir(mod): 467 for i in dir(mod):
468 v = getattr(mod, i) 468 v = getattr(mod, i)
469 if isclass(v) and issubclass(v, klass): 469 if isclass(v) and issubclass(v, klass) and v is not klass:
470 if self._class is not None: 470 if self._class is not None and self._class is not klass:
471 raise TinCanError("{0}: contains multiple {1} classes".format(pypath, klass.__name__)) 471 raise TinCanError("{0}: contains multiple {1} classes".format(pypath, klass.__name__))
472 self._class = v 472 self._class = v
473 if self._class is None: 473 if self._class is None:
474 raise TinCanError("{0}: contains no {1} classes".format(pypath, klass.__name__)) 474 raise TinCanError("{0}: contains no {1} classes".format(pypath, klass.__name__))
475 475