datalad_next.commands.CommandResult

class datalad_next.commands.CommandResult(action: str, status: CommandResultStatus, path: str | Path, message: str | tuple | None = None, exception: CapturedException | None = None, error_message: str | tuple | None = None, type: str | None = None, logger: logging.Logger | None = None, refds: str | Path | Dataset = None)[source]

Bases: object

Base data class for result records emitted by DataLad commands.

Historically, such results records have taken the form of a Python dict. This class provides some API for its instances to be compatible with legacy code that expects a dict.

action: str

A string label identifying which type of operation a result is associated with. Labels must not contain white space. They should be compact, and lower-cases, and use _ (underscore) to separate words in compound labels.

error_message: str | tuple | None = None
exception: CapturedException | None = None
get(key, default=None)[source]
items()[source]
logger: logging.Logger | None = None
message: str | tuple | None = None
path: str | Path

An absolute path describing the local entity a result is associated with (the subject of the result record). Paths must be platform-specific (e.g., Windows paths on Windows, and POSIX paths on other operating systems). When a result is about an entity that has no meaningful relation to the local file system (e.g., a URL to be downloaded), the path value should be determined with respect to the potential impact of the result on any local entity (e.g., a URL downloaded to a local file path, a local dataset modified based on remote information).

pop(key, default=None)[source]
refds: str | Path | Dataset = None
status: CommandResultStatus

This field indicates the nature of a result in terms of four categories, identified by a CommandResultStatus value. The result status is used by user communication, but also for decision making on the overall success or failure of a command operation.

type: str | None = None