maite.testing.project.ModuleScan#

class maite.testing.project.ModuleScan[source]#

Uses pyright’s type completeness scan to summarize a module’s contents.

By default, ModuleScan’s __call__ is cached to reduce overhead for getting scan results for a module multiple times. Each ModuleScan instance has an independent cache.

Examples

>>> from maite.testing.project import ModuleScan
>>> scanner = ModuleScan()
>>> results = scanner("maite")
>>> results["summary"]
{'filesAnalyzed': ..., 'errorCount': ..., 'warningCount': ..., 'informationCount': ..., 'timeInSec': ...}
>>> results["typeCompleteness"]["packageName"]
'maite'
>>> results["typeCompleteness"]["symbols"]     # will change as MAITE changes --> 
[{'category': 'class',
  'name': 'maite.errors.MaiteException',
  'referenceCount': 3,
  'isExported': True,
  'isTypeKnown': True,
  'isTypeAmbiguous': False,
  'diagnostics': []},
 {'category': 'class',
  'name': 'maite.errors.InternalError',
  'referenceCount': 1,
  'isExported': True,
  'isTypeKnown': True,
  'isTypeAmbiguous': False,
  'diagnostics': []},
 ...]

Methods

__call__(module_name, *, path_to_pyright=PYRIGHT_PATH, cached=True)

Perform a scan on the specified module or submodule.

cache_info()

Return a CacheInfo object with statistics about the cache of this instance.