componenttools.copy_governed_component_subtree_by_leaf_range

abjad.tools.componenttools.copy_governed_component_subtree_by_leaf_range.copy_governed_component_subtree_by_leaf_range(component, start=0, stop=None)[source]

New in version 1.1.

Clone governed component subtree by leaf range.

Governed subtree means component together with children of component.

Leaf range refers to the sequential parentage of component from start leaf index to stop leaf index:

abjad> t = Staff([Voice(tuplettools.FixedDurationTuplet(Duration(2, 8), notetools.make_repeated_notes(3)) * 2)])
abjad> pitchtools.set_ascending_named_diatonic_pitches_on_nontied_pitched_components_in_expr(t)
abjad> f(t)
\new Staff {
    \new Voice {
        \times 2/3 {
            c'8
            d'8
            e'8
        }
        \times 2/3 {
            f'8
            g'8
            a'8
        }
    }
}
abjad> u = componenttools.copy_governed_component_subtree_by_leaf_range(t, 1, 5)
abjad> f(u)
\new Staff {
    \new Voice {
        \times 2/3 {
            d'8
            e'8
        }
        \times 2/3 {
            f'8
            g'8
        }
    }
}

Clone sequential containers in leaves’ parentage up to the first parallel container in leaves’ parentage.

Trim and shrink cloned containers as necessary.

When stop is none copy all leaves from start forward.

Changed in version 2.0: renamed clonewp.by_leaf_range_with_parentage() to componenttools.copy_governed_component_subtree_by_leaf_range().

Changed in version 2.0: renamed componenttools.clone_governed_component_subtree_by_leaf_range() to componenttools.copy_governed_component_subtree_by_leaf_range().

This Page