Segment

abstract class pitchtools.Segment(items=None, item_class=None)

Segment base class.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_datastructuretools { graph [label=datastructuretools]; "abjad.tools.datastructuretools.TypedCollection.TypedCollection" [color=3, group=2, label=TypedCollection, shape=oval, style=bold]; "abjad.tools.datastructuretools.TypedTuple.TypedTuple" [color=3, group=2, label=TypedTuple, shape=box]; "abjad.tools.datastructuretools.TypedCollection.TypedCollection" -> "abjad.tools.datastructuretools.TypedTuple.TypedTuple"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.IntervalClassSegment.IntervalClassSegment" [color=4, group=3, label=IntervalClassSegment, shape=box]; "abjad.tools.pitchtools.IntervalSegment.IntervalSegment" [color=4, group=3, label=IntervalSegment, shape=box]; "abjad.tools.pitchtools.PitchClassSegment.PitchClassSegment" [color=4, group=3, label=PitchClassSegment, shape=box]; "abjad.tools.pitchtools.PitchSegment.PitchSegment" [color=4, group=3, label=PitchSegment, shape=box]; "abjad.tools.pitchtools.Segment.Segment" [color=black, fontcolor=white, group=3, label=<<B>Segment</B>>, shape=oval, style="filled, rounded"]; "abjad.tools.pitchtools.TwelveToneRow.TwelveToneRow" [color=4, group=3, label=TwelveToneRow, shape=box]; "abjad.tools.pitchtools.PitchClassSegment.PitchClassSegment" -> "abjad.tools.pitchtools.TwelveToneRow.TwelveToneRow"; "abjad.tools.pitchtools.Segment.Segment" -> "abjad.tools.pitchtools.IntervalClassSegment.IntervalClassSegment"; "abjad.tools.pitchtools.Segment.Segment" -> "abjad.tools.pitchtools.IntervalSegment.IntervalSegment"; "abjad.tools.pitchtools.Segment.Segment" -> "abjad.tools.pitchtools.PitchClassSegment.PitchClassSegment"; "abjad.tools.pitchtools.Segment.Segment" -> "abjad.tools.pitchtools.PitchSegment.PitchSegment"; } subgraph cluster_tonalanalysistools { graph [label=tonalanalysistools]; "abjad.tools.tonalanalysistools.RootlessChordClass.RootlessChordClass" [color=5, group=4, label=RootlessChordClass, shape=box]; "abjad.tools.tonalanalysistools.Scale.Scale" [color=5, group=4, label=Scale, shape=box]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.datastructuretools.TypedCollection.TypedCollection"; "abjad.tools.datastructuretools.TypedTuple.TypedTuple" -> "abjad.tools.pitchtools.Segment.Segment"; "abjad.tools.pitchtools.IntervalSegment.IntervalSegment" -> "abjad.tools.tonalanalysistools.RootlessChordClass.RootlessChordClass"; "abjad.tools.pitchtools.PitchClassSegment.PitchClassSegment" -> "abjad.tools.tonalanalysistools.Scale.Scale"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Attribute summary

count(item) Counts item in collection.
from_selection(class_, selection[, item_class]) Makes segment from selection.
has_duplicates() Is true when segment has duplicates.
index(item) Gets index of item in collection.
item_class Gets item class of collection.
items Gets items in collection.
__add__(argument) Adds typed tuple to argument.
__contains__(item) Is true if typed tuple contains item.
__eq__(argument) Is true when argument is a typed collection with items that compare equal to those of this typed collection.
__format__([format_specification]) Formats Abjad object.
__getitem__(argument) Gets item or slice identified by argument.
__hash__() Hashes typed tuple.
__illustrate__([markup_direction, figure_name]) Illustrates segment.
__iter__() Iterates typed collection.
__len__() Gets length of typed collection.
__mul__(argument) Multiplies typed tuple by argument.
__ne__(argument) Is true when argument is not a typed collection with items equal to this typed collection.
__radd__(argument) Right-adds argument to typed tuple.
__repr__() Gets interpreter representation of Abjad object.
__rmul__(argument) Multiplies argument by typed tuple.
__str__() Gets string representation of segment.

Read-only properties

(TypedCollection).item_class

Gets item class of collection.

Collection coerces items according to item_class.

Returns class.

(TypedCollection).items

Gets items in collection.

Returns list.

Methods

(TypedTuple).count(item)

Counts item in collection.

Coerces item.

Returns nonnegative integer.

abstract Segment.from_selection(class_, selection, item_class=None)

Makes segment from selection.

Returns new segment.

abstract Segment.has_duplicates()

Is true when segment has duplicates. Otherwise false.

Returns true or false.

(TypedTuple).index(item)

Gets index of item in collection.

Coerces item.

Returns nonnegative integer.

Special methods

(TypedTuple).__add__(argument)

Adds typed tuple to argument.

Returns new typed tuple.

(TypedTuple).__contains__(item)

Is true if typed tuple contains item.

Coerces item.

Returns none.

(TypedCollection).__eq__(argument)

Is true when argument is a typed collection with items that compare equal to those of this typed collection. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(TypedTuple).__getitem__(argument)

Gets item or slice identified by argument.

Returns item or new typed tuple.

(TypedTuple).__hash__()

Hashes typed tuple.

Returns integer.

Segment.__illustrate__(markup_direction=Up, figure_name=None, **keywords)

Illustrates segment.

Returns LilyPond file.

(TypedCollection).__iter__()

Iterates typed collection.

Returns generator.

(TypedCollection).__len__()

Gets length of typed collection.

Returns nonnegative integer.

(TypedTuple).__mul__(argument)

Multiplies typed tuple by argument.

Returns new typed tuple.

(TypedCollection).__ne__(argument)

Is true when argument is not a typed collection with items equal to this typed collection. Otherwise false.

Returns true or false.

(TypedTuple).__radd__(argument)

Right-adds argument to typed tuple.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(TypedTuple).__rmul__(argument)

Multiplies argument by typed tuple.

Returns new typed tuple.

Segment.__str__()

Gets string representation of segment.

Returns string.