io

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.io" { graph [label="abjad.io"]; node [color=1]; "abjad.io.AbjadGrapher" [URL="../api/abjad/io.html#abjad.io.AbjadGrapher", color=black, fontcolor=white, label="Abjad\nGrapher", target=_top]; "abjad.io.Illustrator" [URL="../api/abjad/io.html#abjad.io.Illustrator", color=black, fontcolor=white, label=Illustrator, target=_top]; "abjad.io.LilyPondIO" [URL="../api/abjad/io.html#abjad.io.LilyPondIO", color=black, fontcolor=white, label="Lily\nPond\nIO", target=_top]; "abjad.io.LilyPondIO" -> "abjad.io.Illustrator" [minlen=1]; "abjad.io.Player" [URL="../api/abjad/io.html#abjad.io.Player", color=black, fontcolor=white, label=Player, target=_top]; "abjad.io.LilyPondIO" -> "abjad.io.Player" [minlen=2]; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.10/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_uqbar.graphs.graphers" { graph [label="uqbar.graphs.graphers"]; node [color=3]; "uqbar.graphs.graphers.Grapher" [URL="http://josiahwolfoberholtzer.com/uqbar/api/uqbar/graphs/graphers.html#uqbar.graphs.graphers.Grapher", label=Grapher, target=_top]; } "builtins.object" -> "abjad.io.LilyPondIO"; "builtins.object" -> "uqbar.graphs.graphers.Grapher" [minlen=1]; "uqbar.graphs.graphers.Grapher" -> "abjad.io.AbjadGrapher" [minlen=1]; }


Classes

AbjadGrapher

Abjad grapher.

Illustrator

Illustrator.

LilyPondIO

LilyPond IO.

Player

Player.

class abjad.io.AbjadGrapher(graphable, format_='pdf', layout='dot')[source]

Abjad grapher.


Attributes Summary

get_output_directory

rtype:

Path

open_output_path


Special methods

(Grapher).__call__()

Call self as a function.


Methods

(Grapher).get_format()
Return type:

str

(Grapher).get_layout()
Return type:

str

(Grapher).get_openable_paths(format_, output_paths)
Return type:

Generator[Path, None, None]

overridden get_output_directory()[source]
Return type:

Path

(Grapher).get_render_command(format_, input_path, layout)
Return type:

str

(Grapher).get_render_directory()
(Grapher).get_render_prefix(string)
Return type:

str

(Grapher).get_string()
Return type:

str

(Grapher).migrate_assets(render_prefix, render_directory, output_directory)
Return type:

Sequence[Path]

overridden open_output_path(output_path)[source]
(Grapher).persist_log(string, input_path)
(Grapher).persist_string(string, input_path)
(Grapher).run_command(command)
Return type:

Tuple[str, int]

class abjad.io.Illustrator(illustrable, *, flags=None, output_directory=None, render_prefix=None, should_copy_stylesheets=False, should_open=True, should_persist_log=True, string=None, **keywords)[source]

Illustrator.


Attributes Summary

get_openable_paths

rtype:

Iterator[Path]


Special methods

(LilyPondIO).__call__()

Call self as a function.


Methods

(LilyPondIO).copy_stylesheets(render_directory)
(LilyPondIO).get_lilypond_path()
overridden get_openable_paths(output_paths)[source]
Return type:

Iterator[Path]

(LilyPondIO).get_output_directory()
Return type:

Path

(LilyPondIO).get_render_command(input_path, lilypond_path)
Return type:

str

(LilyPondIO).get_render_directory()
(LilyPondIO).get_render_prefix(string)
Return type:

str

(LilyPondIO).get_string()
Return type:

str

(LilyPondIO).get_stylesheets_directories()
Return type:

list[Path]

(LilyPondIO).migrate_assets(render_prefix, render_directory, output_directory)
Return type:

Sequence[Path]

(LilyPondIO).open_output_path(output_path)
(LilyPondIO).persist_log(string, input_path)
(LilyPondIO).persist_string(string, input_path)
(LilyPondIO).run_command(command)
class abjad.io.LilyPondIO(illustrable, *, flags=None, output_directory=None, render_prefix=None, should_copy_stylesheets=False, should_open=True, should_persist_log=True, string=None, **keywords)[source]

LilyPond IO.


Attributes Summary

__call__

Call self as a function.

copy_stylesheets

get_lilypond_path

get_openable_paths

rtype:

Iterator[Path]

get_output_directory

rtype:

Path

get_render_command

rtype:

str

get_render_directory

get_render_prefix

rtype:

str

get_string

rtype:

str

get_stylesheets_directories

rtype:

list[Path]

migrate_assets

rtype:

Sequence[Path]

open_output_path

persist_log

persist_string

run_command


Special methods

overridden __call__()[source]

Call self as a function.


Methods

copy_stylesheets(render_directory)[source]
get_lilypond_path()[source]
get_openable_paths(output_paths)[source]
Return type:

Iterator[Path]

get_output_directory()[source]
Return type:

Path

get_render_command(input_path, lilypond_path)[source]
Return type:

str

get_render_directory()[source]
get_render_prefix(string)[source]
Return type:

str

get_string()[source]
Return type:

str

get_stylesheets_directories()[source]
Return type:

list[Path]

migrate_assets(render_prefix, render_directory, output_directory)[source]
Return type:

Sequence[Path]

open_output_path(output_path)[source]
persist_log(string, input_path)[source]
persist_string(string, input_path)[source]
run_command(command)[source]
class abjad.io.Player(illustrable, *, flags=None, output_directory=None, render_prefix=None, should_copy_stylesheets=False, should_open=True, should_persist_log=True, string=None, **keywords)[source]

Player.


Attributes Summary

get_openable_paths

rtype:

Iterator[Path]

get_string

rtype:

str


Special methods

(LilyPondIO).__call__()

Call self as a function.


Methods

(LilyPondIO).copy_stylesheets(render_directory)
(LilyPondIO).get_lilypond_path()
overridden get_openable_paths(output_paths)[source]
Return type:

Iterator[Path]

(LilyPondIO).get_output_directory()
Return type:

Path

(LilyPondIO).get_render_command(input_path, lilypond_path)
Return type:

str

(LilyPondIO).get_render_directory()
(LilyPondIO).get_render_prefix(string)
Return type:

str

overridden get_string()[source]
Return type:

str

(LilyPondIO).get_stylesheets_directories()
Return type:

list[Path]

(LilyPondIO).migrate_assets(render_prefix, render_directory, output_directory)
Return type:

Sequence[Path]

(LilyPondIO).open_output_path(output_path)
(LilyPondIO).persist_log(string, input_path)
(LilyPondIO).persist_string(string, input_path)
(LilyPondIO).run_command(command)

Functions

compare_files

Compares file path_1 to file path_2.

count_function_calls

Counts function calls required to execute argument.

execute_file

Executes file path.

execute_string

Executes string.

find_executable

Finds executable name.

graph

Graphs argument.

make_subprocess

Makes Popen instance.

open_file

Opens file_path.

open_last_log

Opens LilyPond log file in operating system-specific text editor.

profile

Profiles string.

run_command

Runs command in subprocess.

run_lilypond

Runs LilyPond on ly_path.

show

Shows argument.

spawn_subprocess

Spawns subprocess and runs command.

abjad.io.compare_files(path_1, path_2)[source]

Compares file path_1 to file path_2.

For all file types:

* Performs line-by-line comparison
* Discards blank lines

For LilyPond files, additionally:

* Discards any LilyPond version statements
* Discards any lines beginning with ``%``

Returns true when files compare the same and false when files compare differently.

abjad.io.count_function_calls(argument, *, global_context=None, local_context=None, fixed_point=True)[source]

Counts function calls required to execute argument.

Return type:

int

abjad.io.execute_file(path=None, *, attribute_names=None)[source]

Executes file path.

Returns attribute_names from file.

Return type:

Optional[tuple[str]]

abjad.io.execute_string(string, *, attribute_names=None, local_namespace=None)[source]

Executes string.

>>> string = "foo = 23"
>>> attribute_names = ("foo", "bar")
>>> abjad.io.execute_string(
...     string,
...     attribute_names=attribute_names,
... )
(23, None)

Returns attribute_names from executed string.

abjad.io.find_executable(name, *, flags=1)[source]

Finds executable name.

Similar to Unix which command.

Returns list of zero or more full paths to name.

Return type:

list[Path]

abjad.io.graph(graphable, format_='pdf', layout='dot', return_timing=False, **keywords)[source]

Graphs argument.

Graphs staff:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.graph(staff)  

Graphs rhythm tree:

>>> rtm_syntax = "(3 ((2 (2 1)) 2))"
>>> parser = abjad.rhythmtrees.RhythmTreeParser()
>>> rhythm_tree = parser(rtm_syntax)[0]
>>> abjad.graph(rhythm_tree)  

Opens image in default image viewer.

abjad.io.make_subprocess(command)[source]

Makes Popen instance.

Defined equal to: :rtype: Popen

process = subprocess.Popen(

command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, )

Redirects stderr to stdout.

abjad.io.open_file(file_path, *, application=None, line_number=None, test=False)[source]

Opens file_path.

Uses application when application is not none.

Uses Abjad configuration file text_editor when application is none.

Takes best guess at operating system-specific file opener when both application and Abjad configuration file text_editor are none.

Respects line_number when file_path can be opened with text editor.

abjad.io.open_last_log()[source]

Opens LilyPond log file in operating system-specific text editor.

Return type:

None

abjad.io.profile(string, *, global_context=None, line_count=12, local_context=None, print_callers=False, print_callees=False, sort_by='cumulative', strip_dirs=True)[source]

Profiles string.

>>> string = 'abjad.Staff("c8 c8 c8 c8 c8 c8 c8 c8")'
>>> result = abjad.io.profile(string, global_context=globals())

Then print result.

Wraps Python’s built-in cProfile module.

Set sort_by to 'cumulative', 'time' or 'calls'.

See Python’s docs for more information.

Return type:

Optional[str]

abjad.io.run_command(command)[source]

Runs command in subprocess.

Returns list of strings read from subprocess stdout.

Return type:

list[str]

abjad.io.run_lilypond(ly_path, *, flags='', lilypond_log_file_path=None)[source]

Runs LilyPond on ly_path.

Writes redirected output of Unix date to top line of LilyPond log file.

Then appends redirected output of LilyPond output to the LilyPond log file.

Return type:

int

abjad.io.show(illustrable, return_timing=False, **keywords)[source]

Shows argument.

Shows note:

>>> note = abjad.Note("c'4")
>>> abjad.show(note)  

Shows staff:

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

Makes LilyPond input files and output PDF.

Writes LilyPond input file and output PDF to Abjad output directory.

Opens output PDF.

Returns none when return_timing is false.

Returns pair of abjad_formatting_time and lilypond_rendering_time when return_timing is true.

abjad.io.spawn_subprocess(command)[source]

Spawns subprocess and runs command.

The function is basically a reimplementation of the deprecated os.system() using Python’s subprocess module.

Redirects stderr to stdout.

Return type:

int