Printer๏ƒ

Inheritance diagram of musify.printer

The fundamental core printer classes for the entire package.

Classes:

PrettyPrinter()

Generic base class for pretty printing.

AttributePrinter()

Extends the functionality of a PrettyPrinter.

class musify.printer.PrettyPrinter๏ƒ

Bases: object

Generic base class for pretty printing. Classes can inherit this class to gain pretty print functionality.

Methods:

as_dict()

Return a dictionary representation of the key attributes of this object.

json()

Return a dictionary representation of the key attributes of this object that is safe to output to JSON

abstract as_dict()๏ƒ

Return a dictionary representation of the key attributes of this object.

Return type:

dict[str, Any]

The results of this function are used to produce the following:
  • A JSON representation of the object when calling json()

  • The string representation of the object when calling str() on the object

  • The representation of the object when calling repr() on the object

json()๏ƒ

Return a dictionary representation of the key attributes of this object that is safe to output to JSON

Return type:

dict[str, str | int | float | list | dict | bool | None]

class musify.printer.AttributePrinter๏ƒ

Bases: PrettyPrinter

Extends the functionality of a PrettyPrinter.

Adds functionality to automatically determine the key attributes that represent child objects and uses these for printer representations.

Methods:

as_dict()

Return a dictionary representation of the key attributes of this object.

as_dict()๏ƒ

Return a dictionary representation of the key attributes of this object.

Return type:

dict[str, Any]

The results of this function are used to produce the following:
  • A JSON representation of the object when calling json()

  • The string representation of the object when calling str() on the object

  • The representation of the object when calling repr() on the object