scripts.py.func.checks package

Submodules

scripts.py.func.checks.check_example_file_is_synced module

class scripts.py.func.checks.check_example_file_is_synced.ConfigKeyVisitor

Bases: NodeVisitor

An AST visitor that collects all assigned variable names and string keys from dictionaries, which represent configurable settings.

visit_Assign(node)
visit_Dict(node)
scripts.py.func.checks.check_example_file_is_synced.check_example_file_is_synced(project_root: Path)

Checks if the example file contains all keys from the local settings file. This ensures the public documentation for developers stays up-to-date with the settings currently in use. Runs in DEV_MODE only.

scripts.py.func.checks.integrity_checker module

scripts.py.func.checks.integrity_checker.check_code_integrity(project_root, logger)

Checks files for the presence of critical code fragments defined in integrity_rules.py. If a fragment is missing, logs a fatal error and exits the program.

scripts.py.func.checks.integrity_rules module

This file defines critical code fragments that must exist in specific files. The integrity checker will verify their presence on startup in DEV_MODE. If a check fails, the application will exit to prevent running with broken logic.

Format: {

“path/to/file_relative_to_project_root.py”: [

“exact_code_fragment_to_find”, “another_fragment_for_the_same_file”

]

}

scripts.py.func.checks.self_tester module

scripts.py.func.checks.setup_validator module

class scripts.py.func.checks.setup_validator.CallVisitor

Bases: NodeVisitor

Counts all function calls.

visit_Call(node)
class scripts.py.func.checks.setup_validator.DefinitionVisitor

Bases: NodeVisitor

Collects all function definitions.

visit_FunctionDef(node)
scripts.py.func.checks.setup_validator.check_for_frequent_calls(parsed_trees, logger, threshold=3)

Finds functions called more often than the threshold.

scripts.py.func.checks.setup_validator.check_for_unused_functions(parsed_trees, project_root, logger)

Finds unused functions using the pre-parsed ASTs.

scripts.py.func.checks.setup_validator.parse_all_files(project_root, logger)

Parses all relevant Python files ONCE and returns a dictionary of ASTs. This is efficient as we don’t re-read files for each check.

scripts.py.func.checks.setup_validator.validate_setup(project_root, logger)

Verifies that essential directories exist.

scripts.py.func.checks.validate_punctuation_map_keys module

scripts.py.func.checks.validate_punctuation_map_keys.validate_punctuation_map_keys(project_root, logger)

Scans all language maps and warns if any PUNCTUATION_MAP contains non-lowercase keys. This check only runs in DEV_MODE to help developers avoid common errors.

Module contents