CodeBlock

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/abjadext/book/../../abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjadext/book/../../abjad/system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph "cluster_abjadext.book" { graph [label="abjadext.book"]; node [color=2]; "abjadext.book.CodeBlock.CodeBlock" [URL="../api/abjadext/book/CodeBlock.html#abjadext.book.CodeBlock.CodeBlock", color=black, fontcolor=white, label="Code\nBlock", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjadext.book.CodeBlock.CodeBlock"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjadext.book.CodeBlock.CodeBlock(input_file_contents, code_block_specifier=None, document_source=None, executed_lines=None, image_layout_specifier=None, image_render_specifier=None, starting_line_number=None)

A code block.


Attributes Summary

as_docutils
as_latex
code_block_specifier
current_lines
document_source
executed_lines
filter_output_proxies
flush
from_docutils_abjad_import_block
from_docutils_abjad_input_block
from_docutils_literal_block
from_latex_abjad_block
from_latex_abjadextract_block
graph Proxies Abjad’s toplevel graph() function.
image_layout_specifier
image_render_specifier
input_file_contents
interpret
output_proxies
play Proxies Abjad’s toplevel play() function.
print Proxies Python’s builtin print() function.
push_asset_output_proxy
push_code_output_proxy
push_line_to_console
quit Proxies Python’s builtin quit() function.
setup_capture_hooks
show Proxies Abjad’s toplevel show() function.
starting_line_number
write

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)
as_latex(configuration=None, output_directory=None, relative_output_directory=None)
filter_output_proxies()
flush()
graph(argument, layout='dot', graph_attributes=None, node_attributes=None, edge_attributes=None, **keywords)

Proxies Abjad’s toplevel graph() function.

interpret(console)
play(argument)

Proxies Abjad’s toplevel play() function.

print(*arguments, **keywords)

Proxies Python’s builtin print() function.

Proxying print() is necessary because the original print function makes multiple calls to sys.stdout.write() rather than one. In the context of abjad-book code block interpretation, each write operation adds a new line, hence the necessity of joining the print() arguments into a single string and then writing that.

Note that this will produce unexpected results if attempting to do fancy operations like overwriting the current line.

push_asset_output_proxy(asset_output_proxy)
push_code_output_proxy()
push_line_to_console(line, console, line_number)
quit()

Proxies Python’s builtin quit() function.

setup_capture_hooks(console)
show(argument, return_timing=False, **keywords)

Proxies Abjad’s toplevel show() function.

write(string)

Class & static methods

static from_docutils_abjad_import_block(block)
static from_docutils_abjad_input_block(block)
static from_docutils_literal_block(block)
static from_latex_abjad_block(input_file_contents, starting_line_number=None, **options)
static from_latex_abjadextract_block(source_line, starting_line_number=None, **options)

Read-only properties

code_block_specifier
current_lines
document_source
executed_lines
image_layout_specifier
image_render_specifier
input_file_contents
output_proxies
starting_line_number