Skip to content

Common

Resolver dataclass

Bidirectional lookup of types and modules

Parameters:

Name Type Description Default
proj_path pathlib.Path

Path to root directory containing the project's types

required
stdlib_path pathlib.Path

Path to standard library's directory of the Python binary, containing stdlib types

required
venv_path pathlib.Path

Path to project's virtual environment's directory containing third-party deps

required

Raises:

Type Description
ValueError

If any of the three specified paths is not a directory

type_lookup(module_name, type_name)

Create a type from a module path and qualified type name. Fails if the given paths lies outside of the module

Parameters:

Name Type Description Default
module_name str | None | pd._libs.missing.NAType

The module of the type e.g. pathlib

required
type_name str

The fully qualified name of the type, e.g. Path

required

Returns:

Type Description
type | None

The requested type if found, e.g. pathlib.Path, else None

get_module_and_name(ty)

Retrieve module path and qualified type name from a type. Fails if the type lies outside of the three paths specified in the constructor.

Parameters:

Name Type Description Default
ty type

Any given type whose defining file is relative to the specified paths

required

Returns:

Type Description
tuple[str | None, str] | None

a pair of (module name, type name) if successful, where module_name is None is the type is a builtin

PyTypes dataclass

Object representation of the [pytypes] section

TomlCfg dataclass

Object representation of the config file

load_config(config_path)

Load the config file

Parameters:

Name Type Description Default
config_path pathlib.Path

Path to the configuration file

required

Returns:

Type Description
TomlCfg

A config object

Raises:

Type Description
e

DaciteError when deserialising fails

write_config(config_path, pttoml)

Store the config file

Parameters:

Name Type Description Default
config_path pathlib.Path

Path to output config

required
pttoml TomlCfg

The object to be serialised

required

TraceDataCategory

Bases: enum.IntEnum

The trace data category. Used by the tracer to mark the semantic of each row

LOCAL_VARIABLE = 1 class-attribute

Signifies a local variable in the trace data

FUNCTION_PARAMETER = 2 class-attribute

Indicates that the traced instance is a function parameter

FUNCTION_RETURN = 3 class-attribute

Marks the return type of a callable

CLASS_MEMBER = 4 class-attribute

Indicates a class member / attribute

GLOBAL_VARIABLE = 5 class-attribute

Signifies a global variable

INVALID = 0 class-attribute

Denotes otherwise unknown category. Currently unused

DataFileCollector

Bases: ABC

Collects data files in a given path.

__init__(file_pattern)

Creates an instance of DataFileCollector.

Parameters:

Name Type Description Default
file_pattern str

The file pattern of the data files to be collected.

required

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