Base

Provides KicadExpr class which we use as a base for all KiCad s-expression related dataclasses.

edea.kicad.base.custom_serializer(field_name: str)

Creates a decorator for customizing the serialization behavior of a data model field.

Parameters:

field_name – The name of the field in the data model that the decorator is associated with.

Returns:

A decorator function for custom serialization.

edea.kicad.base.custom_parser(field_name: str)

Creates a decorator for customizing the parsing behavior of a Pydantic data model field.

Parameters:

field_name – The name of the field in the data model that the decorator is associated with.

Returns:

The decorated function with an attached attribute for field name reference.

class edea.kicad.base.CustomizationDataTransformRegistry(name: str, bases: tuple, dct: dict[str, Any])

Bases: type

class edea.kicad.base.KicadExpr

Bases: object

A KiCad Expression element.

Variables:

_is_edea_kicad_expr – A class variable indicating that this class is an EDeA KiCad expression.

kicad_expr_tag_name: ClassVar
classmethod from_list(exprs: list[str | QuotedStr | list[str | QuotedStr | SExprList]]) KicadExprClass

Turns an s-expression list of arguments into an EDeA dataclass. Note that you omit the tag name in the s-expression so e.g. for (symbol “foo” (pin 1)) you would pass [“foo”, [“pin”, 1]] to this method.

Returns:

An instance of the ‘KicadExpr’ created from the KiCad expression data.

to_list() list[str | QuotedStr | list[str | QuotedStr | SExprList]]

Turns a a KicadExpr into an s-expression list. Note that the initial keyword is omitted in the return of this function. It can be retrieved by accessing .kicad_expr_tag_name.

Returns:

A list representing the KiCad expression data structure generated from the object.

classmethod check_version(v: Any) str

Checks the file format version. This should be implemented by subclasses to check the file format version”

Parameters:

v – The version number to be checked.

raises NotImplementedError: by default.