Skip to content

Base

cognite.neat._issues #

This is module contains all the Neat Exceptions (Errors) and Warnings as well as some helper classes to handle them like NeatIssueList

DefaultWarning dataclass #

Bases: NeatWarning

{category}: {warning}

IssueList #

Bases: NeatIssueList[NeatIssue]

This is a list of NeatIssues.

MultiValueError #

Bases: ValueError

This is a container for multiple errors.

It is used in the pydantic field_validator/model_validator to collect multiple errors, which can then be caught in a try-except block and returned as an IssueList.

NeatError dataclass #

Bases: NeatIssue, Exception

This is the base class for all exceptions (errors) used in Neat.

from_errors(errors, **kwargs) classmethod #

Convert a list of pydantic errors to a list of Error instances.

This is intended to be overridden in subclasses to handle specific error types.

NeatIssue dataclass #

This is the base class for all exceptions and warnings (issues) used in Neat.

as_message(include_type=True) #

Return a human-readable message for the issue.

dump() #

Return a dictionary representation of the issue.

load(data) classmethod #

Create an instance of the issue from a dictionary.

NeatIssueList #

Bases: list, Sequence[T_NeatIssue], ABC

This is a generic list of NeatIssues.

errors: Self property #

Return all the errors in this list.

has_errors: bool property #

Return True if this list contains any errors.

has_warnings: bool property #

Return True if this list contains any warnings.

warnings: Self property #

Return all the warnings in this list.

has_error_type(error_type) #

Return True if this list contains any errors of the given type.

has_warning_type(warning_type) #

Return True if this list contains any warnings of the given type.

as_errors(operation='Operation failed') #

Return an ExceptionGroup with all the errors in this list.

trigger_warnings() #

Trigger all warnings in this list.

to_pandas() #

Return a pandas DataFrame representation of this list.

as_exception() #

Return a MultiValueError with all the errors in this list.

NeatWarning dataclass #

Bases: NeatIssue, UserWarning

This is the base class for all warnings used in Neat.

from_warning(warning) classmethod #

Create a NeatWarning from a WarningMessage.

catch_issues(error_args=None) #

This is an internal help function to handle issues and warnings.

Parameters:

Name Type Description Default
error_args dict[str, Any] | None

Additional arguments to pass to the error class. The only use case as of (2025-01-03) is to pass the read_info_by_sheet to the error class such that the row numbers can be adjusted to match the source spreadsheet.

None

Returns:

Name Type Description
IssueList Iterator[IssueList]

The list of issues.

catch_warnings() #

Catch warnings and append them to the issues list.