Line¶
-
class
abjad.segments.Line.
Line
(string='')¶ Line in a LilyPond file.
>>> string = ' %@% \with-color %! MEASURE_NUMBER_MARKUP:SM31' >>> abjad.Line(string) Line(string=' %@% \\with-color %! MEASURE_NUMBER_MARKUP:SM31')
Attributes Summary
__str__
Gets string representation of line. get_tags
Gets tags. is_active
Is true when line is active. is_deactivated
Is true when line is deactivated. match
Is true when predicate
matches tags.string
Gets string. 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.
-
__str__
()¶ Gets string representation of line.
>>> string = ' %@% \with-color %! MEASURE_NUMBER_MARKUP:SM31' >>> str(abjad.Line(string)) ' %@% \\with-color %! MEASURE_NUMBER_MARKUP:SM31'
Returns string.
Methods
Gets tags.
>>> string = ' %@% \with-color %! MEASURE_NUMBER_MARKUP:SM31' >>> abjad.Line(string).get_tags() ['MEASURE_NUMBER_MARKUP', 'SM31']
Returns list of zero or more strings.
-
is_active
()¶ Is true when line is active.
>>> string = ' \\clef "treble" %! EXPLICT_CLEF' >>> abjad.Line(string).is_active() True
>>> string = ' %@% \\clef "treble" %! EXPLICT_CLEF' >>> abjad.Line(string).is_active() False
>>> string = ' %%% \\clef "treble" %! EXPLICT_CLEF' >>> abjad.Line(string).is_active() False
Returns true or false.
-
is_deactivated
()¶ Is true when line is deactivated.
>>> string = ' \\clef "treble" %! EXPLICT_CLEF' >>> abjad.Line(string).is_deactivated() False
>>> string = ' %@% \\clef "treble" %! EXPLICT_CLEF' >>> abjad.Line(string).is_deactivated() True
>>> string = ' %%% \\clef "treble" %! EXPLICT_CLEF' >>> abjad.Line(string).is_deactivated() True
Returns true or false.
-
match
(predicate)¶ Is true when
predicate
matches tags.>>> string = ' %@% \with-color %! MEASURE_NUMBER_MARKUP:SM31' >>> line = abjad.Line(string)
Strings:
>>> line.match('MEASURE_NUMBER_MARKUP') True
>>> line.match('SM31') True
>>> line.match(['MEASURE_NUMBER_MARKUP', 'SM31']) False
>>> line.match('%@%') False
>>> line.match('with-color') False
>>> line.match('%!') False
Lambdas:
>>> line.match(lambda x: any(_ for _ in x if _.startswith('M'))) True
>>> line.match(lambda x: any(_ for _ in x if _.startswith('S'))) True
>>> line.match(lambda x: any(_ for _ in x if _[0] in 'SM')) True
Functions:
>>> def predicate(tags): ... if 'SM31' in tags and 'MEASURE_NUMBER_MARKUP' in tags: ... return True ... else: ... return False
>>> line.match(predicate) True
>>> def predicate(tags): ... if 'SM31' in tags and 'MEASURE_NUMBER_MARKUP' not in tags: ... return True ... else: ... return False
>>> line.match(predicate) False
Returns true or false.
Read-only properties
-
string
¶ Gets string.
>>> string = ' %@% \with-color %! MEASURE_NUMBER_MARKUP:SM31' >>> abjad.Line(string).string ' %@% \\with-color %! MEASURE_NUMBER_MARKUP:SM31'
Returns string.
-