Annotating
Typegen API¶
AddImportTransformer
¶
Bases: cst.CSTTransformer
Transforms the CST by adding ImportFrom nodes to import the modules of the type hints according to the trace data.
TypeHintTransformer
¶
Bases: cst.CSTTransformer
Transforms the CST by adding the traced type hints without modifying the original type hints.
InlineGenerator
¶
Bases: TypeHintGenerator
Overwrites the files by adding the traced type hints to the variables. Does not overwrite existing type hints.
RemoveAllTypeHintsTransformer
¶
Bases: cst.CSTTransformer
Transforms the CST by removing all type hints.
EvaluationInlineGenerator
¶
Bases: InlineGenerator
Overwrites the files by removing the existing and then adding the traced type hints.
ImportUnionTransformer
¶
Bases: cst.CSTTransformer
Transforms the CST by adding the ImportFrom node (from typing import Union) if the corresponding code contains a union type hint.
MyPyHintTransformer
¶
Bases: cst.CSTTransformer
Replaces the CST with the corresponding stub CST, generated using mypy.stubgen.
StubFileGenerator
¶
TraceDataFilter
¶
Bases: abc.ABC
Base class for different trace data filters.
To implement a new filter class, inherit from this class and overwrite the abstract methods.
apply(trace_data)
abstractmethod
¶
Processes the provided trace data and returns the processed trace data and the difference between the old and new data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trace_data |
pd.DataFrame
|
The provided trace data to process. |
required |
Returns:
Type | Description |
---|---|
pd.DataFrame
|
The processed trace data. |
TraceDataFilterList
¶
Bases: TraceDataFilter
Applies the filters in this list on the trace data in the order they were appended
append(trace_data_filter)
¶
Appends a filter to the list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trace_data_filter |
TraceDataFilter
|
The filter to append. |
required |
apply(trace_data)
¶
Chains execution of filters on the provided trace data and returns the processed trace data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trace_data |
pd.DataFrame
|
The provided trace data to process. |
required |
Returns:
Type | Description |
---|---|
pd.DataFrame
|
The processed trace data. |
DropDuplicatesFilter
¶
MinThresholdFilter
¶
DropTestFunctionDataFilter
¶
DropVariablesOfMultipleTypesFilter
¶
Bases: TraceDataFilter
Drops rows containing variables the amount of the corresponding types is higher or equal than the specified min amount.
KeepOnlyFirstFilter
¶
UnifySubTypesFilter
¶
UnionFilter
¶
TraceDataFileCollector
¶
Bases: DataFileCollector
Collects trace data files in a given path.
__init__()
¶
Creates an instance of TraceDataFileCollector.
collect_data(path, include_also_files_in_subdirectories=True)
¶
Collects the data in a given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
pathlib.Path
|
The path of the folder containing the files. |
required |
include_also_files_in_subdirectories |
bool
|
Whether the data files in the subfolders should also be collected. |
True
|