Errors that occurred while trying to import something to document it.
| 386 | return result |
| 387 | |
| 388 | class ErrorDuringImport(Exception): |
| 389 | """Errors that occurred while trying to import something to document it.""" |
| 390 | def __init__(self, filename, exc_info): |
| 391 | if not isinstance(exc_info, tuple): |
| 392 | assert isinstance(exc_info, BaseException) |
| 393 | self.exc = type(exc_info) |
| 394 | self.value = exc_info |
| 395 | self.tb = exc_info.__traceback__ |
| 396 | else: |
| 397 | warnings.warn("A tuple value for exc_info is deprecated, use an exception instance", |
| 398 | DeprecationWarning) |
| 399 | |
| 400 | self.exc, self.value, self.tb = exc_info |
| 401 | self.filename = filename |
| 402 | |
| 403 | def __str__(self): |
| 404 | exc = self.exc.__name__ |
| 405 | return 'problem in %s - %s: %s' % (self.filename, exc, self.value) |
| 406 | |
| 407 | def importfile(path): |
| 408 | """Import a Python source file or compiled file given its path.""" |
no outgoing calls
no test coverage detected
searching dependent graphs…