proxies¶
Output Proxies
CodeOutputProxy |
A code output proxy. |
GraphvizOutputProxy |
A Graphviz output proxy. |
ImageOutputProxy |
Abstract base class for image output proxies. |
LilyPondOutputProxy |
A LilyPond output proxy. |
RawLilyPondOutputProxy |
A raw LilyPond output proxy. |
-
class
abjadext.book.proxies.
CodeOutputProxy
(payload, code_block_specifier=None)¶ A code output proxy.
>>> import abjadext.book >>> proxy = abjadext.book.CodeOutputProxy([ ... ">>> print('Hello, world!')", ... 'Hello, world!', ... '>>> 1 + 1', ... '2', ... ]) >>> print(format(proxy)) abjadext.proxies.CodeOutputProxy( ( ">>> print('Hello, world!')", 'Hello, world!', '>>> 1 + 1', '2', ) )
>>> for line in proxy.as_latex(): ... line ... '\\begin{lstlisting}' ">>> print('Hello, world!')" 'Hello, world!' '\\end{lstlisting}' '\\begin{lstlisting}' '>>> 1 + 1' '2' '\\end{lstlisting}'
Attributes Summary
as_docutils
Creates a docutils node representation of the code output proxy. as_latex
Creates a LaTeX representation of the code output proxy. code_block_specifier
Gets code block specifier. payload
Gets code output proxy payload. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadObject
).__format__
(format_specification='')¶ Formats Abjad object.
Set
format_specification
to''
or'storage'
. Interprets''
equal to'storage'
.Returns string.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Methods
-
as_docutils
(configuration=None, output_directory=None)¶ Creates a docutils node representation of the code output proxy.
Returns list of docutils nodes.
-
as_latex
(configuration=None, output_directory=None, relative_output_directory=None)¶ Creates a LaTeX representation of the code output proxy.
Returns list of strings.
Read-only properties
-
code_block_specifier
¶ Gets code block specifier.
-
payload
¶ Gets code output proxy payload.
Returns tuple of strings.
-
-
class
abjadext.book.proxies.
GraphvizOutputProxy
(payload, layout='dot', image_layout_specifier=None, image_render_specifier=None)¶ A Graphviz output proxy.
>>> import abjadext.book >>> meter = abjad.Meter((4, 4)) >>> proxy = abjadext.book.GraphvizOutputProxy(meter) >>> print(format(proxy)) abjadext.proxies.GraphvizOutputProxy( <uqbar.graphs.Graph.Graph object at 0x1154e9128>, layout='dot', )
>>>
>>> print(format(proxy.payload, 'graphviz')) digraph G { graph [bgcolor=transparent, fontname=Arial, penwidth=2, truecolor=true]; node [fontname=Arial, fontsize=12, penwidth=2]; edge [penwidth=2]; node_0 [label="4/4", shape=triangle]; node_1 [label="1/4", shape=box]; node_2 [label="1/4", shape=box]; node_3 [label="1/4", shape=box]; node_4 [label="1/4", shape=box]; subgraph cluster_offsets { graph [style=rounded]; node_5_0 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 0 | <f_0_1> ++ }", shape=Mrecord, style=filled]; node_5_1 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 1/4 | <f_0_1> + }", shape=Mrecord, style=filled]; node_5_2 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 1/2 | <f_0_1> + }", shape=Mrecord, style=filled]; node_5_3 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 3/4 | <f_0_1> + }", shape=Mrecord, style=filled]; node_5_4 [label="{ <f_0_0> 1 | <f_0_1> ++ }", shape=Mrecord]; } node_0 -> node_1; node_0 -> node_2; node_0 -> node_3; node_0 -> node_4; node_1 -> node_5_0 [style=dotted]; node_1 -> node_5_1 [style=dotted]; node_2 -> node_5_1 [style=dotted]; node_2 -> node_5_2 [style=dotted]; node_3 -> node_5_2 [style=dotted]; node_3 -> node_5_3 [style=dotted]; node_4 -> node_5_3 [style=dotted]; node_4 -> node_5_4 [style=dotted]; }
>>> proxy.as_latex(relative_output_directory='assets') ['\\noindent\\includegraphics{assets/graphviz-a20bf977ab8d78c92f80a64305ccbe7b.pdf}']
Attributes Summary
as_docutils
Creates a docutils node representation of the output proxy. file_name_prefix
Gets file name prefix of Graphviz output proxy. file_name_without_extension
Gets file name extension of Graphviz output proxy. layout
Gets layout engine name of Graphviz output. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadObject
).__format__
(format_specification='')¶ Formats Abjad object.
Set
format_specification
to''
or'storage'
. Interprets''
equal to'storage'
.Returns string.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Methods
-
as_docutils
(configuration=None, output_directory=None)¶ Creates a docutils node representation of the output proxy.
>>> import abjadext.book >>> meter = abjad.Meter((4, 4)) >>> proxy = abjadext.book.GraphvizOutputProxy(meter) >>> for node in proxy.as_docutils(): ... print(node.pformat()) ... <abjad_output_block image_layout_specifier="True" image_render_specifier="True" layout="dot" renderer="graphviz" xml:space="preserve"> digraph G { graph [bgcolor=transparent, fontname=Arial, penwidth=2, truecolor=true]; node [fontname=Arial, fontsize=12, penwidth=2]; edge [penwidth=2]; node_0 [label="4/4", shape=triangle]; node_1 [label="1/4", shape=box]; node_2 [label="1/4", shape=box]; node_3 [label="1/4", shape=box]; node_4 [label="1/4", shape=box]; subgraph cluster_offsets { graph [style=rounded]; node_5_0 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 0 | <f_0_1> ++ }", shape=Mrecord, style=filled]; node_5_1 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 1/4 | <f_0_1> + }", shape=Mrecord, style=filled]; node_5_2 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 1/2 | <f_0_1> + }", shape=Mrecord, style=filled]; node_5_3 [color=white, fillcolor=black, fontcolor=white, fontname="Arial bold", label="{ <f_0_0> 3/4 | <f_0_1> + }", shape=Mrecord, style=filled]; node_5_4 [label="{ <f_0_0> 1 | <f_0_1> ++ }", shape=Mrecord]; } node_0 -> node_1; node_0 -> node_2; node_0 -> node_3; node_0 -> node_4; node_1 -> node_5_0 [style=dotted]; node_1 -> node_5_1 [style=dotted]; node_2 -> node_5_1 [style=dotted]; node_2 -> node_5_2 [style=dotted]; node_3 -> node_5_2 [style=dotted]; node_3 -> node_5_3 [style=dotted]; node_4 -> node_5_3 [style=dotted]; node_4 -> node_5_4 [style=dotted]; }
Returns list of docutils nodes.
-
(
ImageOutputProxy
).as_latex
(configuration=None, output_directory=None, relative_output_directory=None)¶ Creates a LaTeX representation of the image output proxy.
-
(
ImageOutputProxy
).render_for_latex
(absolute_output_directory)¶ Renders the image output proxy payload for LaTeX inclusion.
Read-only properties
-
file_name_prefix
¶ Gets file name prefix of Graphviz output proxy.
Returns string.
-
file_name_without_extension
¶ Gets file name extension of Graphviz output proxy.
Returns string.
-
(
ImageOutputProxy
).image_layout_specifier
¶ Gets image specifier.
-
(
ImageOutputProxy
).image_render_specifier
¶ Gets image specifier.
-
layout
¶ Gets layout engine name of Graphviz output.
Returns string.
-
(
ImageOutputProxy
).options
¶
-
(
ImageOutputProxy
).payload
¶ Gets images output proxy payload.
Returns string.
-
-
abstract class
abjadext.book.proxies.
ImageOutputProxy
(image_layout_specifier=None, image_render_specifier=None, **options)¶ Abstract base class for image output proxies.
Attributes Summary
as_latex
Creates a LaTeX representation of the image output proxy. file_name_prefix
Gets image output proxy file name prefix. file_name_without_extension
Gets image output proxy filename without file extension. image_layout_specifier
Gets image specifier. image_render_specifier
Gets image specifier. options
payload
Gets images output proxy payload. render_for_latex
Renders the image output proxy payload for LaTeX inclusion. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadObject
).__format__
(format_specification='')¶ Formats Abjad object.
Set
format_specification
to''
or'storage'
. Interprets''
equal to'storage'
.Returns string.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Methods
-
as_latex
(configuration=None, output_directory=None, relative_output_directory=None)¶ Creates a LaTeX representation of the image output proxy.
-
render_for_latex
(absolute_output_directory)¶ Renders the image output proxy payload for LaTeX inclusion.
Read-only properties
-
abstract
file_name_prefix
¶ Gets image output proxy file name prefix.
Returns string.
-
file_name_without_extension
¶ Gets image output proxy filename without file extension.
Returns string.
-
image_layout_specifier
¶ Gets image specifier.
-
image_render_specifier
¶ Gets image specifier.
-
options
¶
-
payload
¶ Gets images output proxy payload.
Returns string.
-
-
class
abjadext.book.proxies.
LilyPondOutputProxy
(payload, image_layout_specifier=None, image_render_specifier=None, strict=None)¶ A LilyPond output proxy.
>>> import abjadext.book >>> staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> proxy = abjadext.book.LilyPondOutputProxy(staff) >>> print(format(proxy)) abjadext.proxies.LilyPondOutputProxy( abjad.LilyPondFile( comments=[], includes=[], items=[ abjad.Block( name='score', ), ], lilypond_language_token=abjad.LilyPondLanguageToken(), lilypond_version_token=abjad.LilyPondVersionToken( version_string='2.19.0', ), ) )
>>> proxy.as_latex(relative_output_directory='assets') ['\\noindent\\includegraphics{assets/lilypond-d3ecbde01b2f252633e28953dae06eea.pdf}']
Attributes Summary
as_docutils
Creates a docutils node representation of the output proxy. file_name_prefix
Gets file name prefix of LilyPond output proxy. strict
Is true when LilyPond file should format strict. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadObject
).__format__
(format_specification='')¶ Formats Abjad object.
Set
format_specification
to''
or'storage'
. Interprets''
equal to'storage'
.Returns string.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Methods
-
as_docutils
(configuration=None, output_directory=None)¶ Creates a docutils node representation of the output proxy.
>>> import abjadext.book >>> staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> proxy = abjadext.book.LilyPondOutputProxy(staff) >>> for node in proxy.as_docutils(): ... print(node.pformat()) ... <abjad_output_block image_layout_specifier="True" image_render_specifier="True" renderer="lilypond" xml:space="preserve"> \version "2.19.0" \language "english" \score { \new Staff { c'4 d'4 e'4 f'4 } }
Returns list of docutils nodes.
-
(
ImageOutputProxy
).as_latex
(configuration=None, output_directory=None, relative_output_directory=None)¶ Creates a LaTeX representation of the image output proxy.
-
(
ImageOutputProxy
).render_for_latex
(absolute_output_directory)¶ Renders the image output proxy payload for LaTeX inclusion.
Read-only properties
-
file_name_prefix
¶ Gets file name prefix of LilyPond output proxy.
Returns string.
-
(
ImageOutputProxy
).file_name_without_extension
¶ Gets image output proxy filename without file extension.
Returns string.
-
(
ImageOutputProxy
).image_layout_specifier
¶ Gets image specifier.
-
(
ImageOutputProxy
).image_render_specifier
¶ Gets image specifier.
-
(
ImageOutputProxy
).options
¶
-
(
ImageOutputProxy
).payload
¶ Gets images output proxy payload.
Returns string.
-
strict
¶ Is true when LilyPond file should format strict.
Returns true, false or none.
-
-
class
abjadext.book.proxies.
RawLilyPondOutputProxy
(payload, image_layout_specifier=None, image_render_specifier=None, **options)¶ A raw LilyPond output proxy.
>>> import abjadext.book >>> raw_lilypond = '{ c d e f }' >>> proxy = abjadext.book.RawLilyPondOutputProxy(raw_lilypond) >>> print(format(proxy)) abjadext.proxies.RawLilyPondOutputProxy( '\\version "2.19.0"\n\n{ c d e f }' )
>>> proxy.as_latex(relative_output_directory='assets') ['\\noindent\\includegraphics{assets/lilypond-678fb46ce202b3d770361f814e6e1946.pdf}']
Attributes Summary
file_name_prefix
Gets file name prefix of LilyPond output proxy. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadObject
).__format__
(format_specification='')¶ Formats Abjad object.
Set
format_specification
to''
or'storage'
. Interprets''
equal to'storage'
.Returns string.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Methods
-
(
ImageOutputProxy
).as_latex
(configuration=None, output_directory=None, relative_output_directory=None)¶ Creates a LaTeX representation of the image output proxy.
-
(
ImageOutputProxy
).render_for_latex
(absolute_output_directory)¶ Renders the image output proxy payload for LaTeX inclusion.
Read-only properties
-
file_name_prefix
¶ Gets file name prefix of LilyPond output proxy.
Returns string.
-
(
ImageOutputProxy
).file_name_without_extension
¶ Gets image output proxy filename without file extension.
Returns string.
-
(
ImageOutputProxy
).image_layout_specifier
¶ Gets image specifier.
-
(
ImageOutputProxy
).image_render_specifier
¶ Gets image specifier.
-
(
ImageOutputProxy
).options
¶
-
(
ImageOutputProxy
).payload
¶ Gets images output proxy payload.
Returns string.
-