# psd_tools.psd.base

Base data structures intended for inheritance.

All the data objects in this subpackage inherit from the base classes here. That means, all the data structures in the `psd_tools.psd` subpackage implements the methods of `BaseElement` for serialization and decoding.

Objects that inherit from the `BaseElement` typically gets attrs decoration to have data fields.

## BaseElement

class psd_tools.psd.base.BaseElement

  Base element of various PSD file structs. All the data objects in `psd_tools.psd` subpackage inherit from this class.

  classmethod read(cls, fp)

    Read the element from a file-like object.

  write(self, fp)

    Write the element to a file-like object.

  classmethod frombytes(self, data, *args, **kwargs)

    Read the element from bytes.

  tobytes(self, *args, **kwargs)

    Write the element to bytes.

  validate(self)

    Validate the attribute.

## EmptyElement

class psd_tools.psd.base.EmptyElement

  Empty element that does not have a value.

## ValueElement

class psd_tools.psd.base.ValueElement(value: object = None)

  Single value wrapper that has a value attribute.

  Pretty printing shows the internal value by default. Inherit with @define(repr=False) decorator to keep this behavior.

  value

    Internal value.

## NumericElement

class psd_tools.psd.base.NumericElement(value=0.0)

  Single value element that has a numeric value attribute.

## IntegerElement

class psd_tools.psd.base.IntegerElement(value=0)

  Single integer value element that has a value attribute.

  Use with @define(repr=False) decorator.

## ShortIntegerElement

class psd_tools.psd.base.ShortIntegerElement(value=0)

  Single short integer element that has a value attribute.

  Use with @define(repr=False) decorator.

## ByteElement

class psd_tools.psd.base.ByteElement(value=0)

  Single 1-byte integer element that has a value attribute.

  Use with @define(repr=False) decorator.

## BooleanElement

class psd_tools.psd.base.BooleanElement(value=False)

  Single bool value element that has a value attribute.

  Use with @define(repr=False) decorator.

## StringElement

class psd_tools.psd.base.StringElement(value: str = '')

  Single unicode string.

  value

    str value

## ListElement

class psd_tools.psd.base.ListElement(items=NOTHING)

  List-like element that has items list.

## DictElement

class psd_tools.psd.base.DictElement(items=NOTHING)

  Dict-like element that has items OrderedDict.