PersistenceManager

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=1]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.PersistenceManager.PersistenceManager" [URL="../api/abjad/system/PersistenceManager.html#abjad.system.PersistenceManager.PersistenceManager", color=black, fontcolor=white, label="Persistence\nManager", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.PersistenceManager.PersistenceManager"; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.system.PersistenceManager.PersistenceManager(client=None)

Persistence manager.

>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> abjad.show(staff) 
>>> abjad.persist(staff)
PersistenceManager(client=Staff("c'4 e'4 d'4 f'4"))

Attributes Summary

as_ly Persists client as LilyPond file.
as_midi Persists client as MIDI file.
as_module Persists client as Python module.
as_pdf Persists client as PDF.
as_png Persists client as PNG.
client Client of persistence manager.

Special methods

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Methods

as_ly(ly_file_path=None, illustrate_function=None, strict=None, **keywords)

Persists client as LilyPond file.

Autogenerates file path when ly_file_path is none.

>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> for x in persist(staff).as_ly('~/example.ly'): 
...     x
... 
'/Users/josiah/example.ly'
0.004524707794189453

Returns output path and elapsed formatting time when LilyPond output is written.

as_midi(midi_file_path=None, remove_ly=False, **keywords)

Persists client as MIDI file.

Autogenerates file path when midi_file_path is none.

>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> for x in persist(staff).as_midi(): 
...     x
... 
'/Users/josiah/.abjad/output/0153.midi'
0.006804943084716797
1.4692070484161377
True

Returns output path, elapsed formatting time and elapsed rendering time.

as_module(module_file_path, object_name)

Persists client as Python module.

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 1),
...     abjad.Timespan(2, 4),
...     abjad.Timespan(6, 8),
...     ])
>>> abjad.persist(timespans).as_module( 
...     '~/example.py',
...     'timespans',
...     )

Returns none.

as_pdf(pdf_file_path=None, illustrate_function=None, remove_ly=False, strict=None, **keywords)

Persists client as PDF.

Autogenerates file path when pdf_file_path is none.

>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> for x in persist(staff).as_pdf(): 
...     x
... 
'/Users/josiah/.abjad/output/0154.pdf'
0.005944013595581055
1.1021740436553955
True

Returns output path, elapsed formatting time and elapsed rendering time when PDF output is written.

as_png(png_file_path=None, remove_ly=False, illustrate_function=None, **keywords)

Persists client as PNG.

>>> staff = abjad.Staff()
>>> measure = abjad.Measure((4, 4), "c'4 d'4 e'4 f'4")
>>> command = abjad.LilyPondLiteral(r'reak', 'after')
>>> abjad.attach(command, measure[-1])
>>> staff.extend(measure * 200)
>>> result = persist(staff).as_png() 
>>> for x in result[0]: 
...     x
... 
'/Users/josiah/.abjad/output/0155-page1.png'
'/Users/josiah/.abjad/output/0155-page2.png'
'/Users/josiah/.abjad/output/0155-page3.png'

Autogenerates file path when png_file_path is none.

Returns output path(s), elapsed formatting time and elapsed rendering time.


Read-only properties

client

Client of persistence manager.

Returns component or selection.