fixml.modules.code_analyzer.analyzers.python
Classes
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
Functions
Module Contents
- fixml.modules.code_analyzer.analyzers.python.assert_have_read_content(f)
- class fixml.modules.code_analyzer.analyzers.python.CodeAnalyzer
Bases:
abc.ABCHelper class that provides a standard way to create an ABC using inheritance.
- abstract read(file_path: str | pathlib.Path) None
- abstract list_imported_packages()
- abstract list_all_functions()
- abstract contains_test()
- _determine_encodings(file_path: str | pathlib.Path) str
- class fixml.modules.code_analyzer.analyzers.python.PythonASTCodeAnalyzer
Bases:
CodeAnalyzerHelper class that provides a standard way to create an ABC using inheritance.
- read(file_path: str | pathlib.Path)
- _get_function_lineno_map()
- list_imported_packages()
- list_all_functions()
- contains_test() bool
Check if the loaded content contains tests.
This assumes the file would be a Python file, and the tests are written using either pytest or unittest module.
This will check the following conditions: 1. If unittest or pytest modules is loaded, returns true. 2. If unittest or pytest modules is not loaded, check if there is a function name that starts with test (case-insensitive). If found, further check if the content of this function contain assertions i.e. assert - returns true if found.
- class fixml.modules.code_analyzer.analyzers.python.PythonNaiveCodeAnalyzer
Bases:
CodeAnalyzerHelper class that provides a standard way to create an ABC using inheritance.
- read(file_path: str | pathlib.Path)
- _get_function_lineno_map()
- list_imported_packages()
- abstract list_all_functions()
- contains_test()