ParentageInterface — Abjad v1.1.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »

# ParentageInterface

class `abjad.parentage.interface.` `ParentageInterface`(_client)

  Bases: `abjad.core.interface._Interface`

  Bundle attributes relating to the containers within which any Abjad component nests.

  Handle no LilyPond grob.

  `depth`

    Nonnegative integer number of components in the proper parentage of component.

        abjad> tuplet = FixedDurationTuplet((2, 8), construct.scale(3))
        abjad> staff = Staff([tuplet])
        abjad> note = staff.leaves[0]
        abjad> note.parentage.depth
        2

    Defined equal to `len(component.parentage.proper)`.

  `depth_tuplet`

    Nonnegative integer number of tuplets in the proper parentage of component.

        abjad> tuplet = FixedDurationTuplet((2, 8), construct.scale(3))
        abjad> staff = Staff([tuplet])
        abjad> note = staff.leaves[0]
        abjad> note.parentage.depth_tuplet
        1

    Tuplets do not count as containing themselves.

        abjad> tuplet.parentage.depth_tuplet
        0

    Zero when there is no tuplet in the proper parentage of component.

        abjad> staff.parentage.depth_tuplet
        0

  `governor`

    Reference to first sequential container Q in the parentage of component such that the parent of Q is either a parallel container or `None`.

        abjad> t = Voice([Container(Voice(construct.run(2)) * 2)])
        abjad> t[0].parallel = True
        abjad> pitchtools.diatonicize(t)
        abjad> t[0][0].name = 'voice 1'
        abjad> t[0][1].name = 'voice 2'

        abjad> print t.format
        \new Voice {
           <<
              \context Voice = "voice 1" {
                 c'8
                 d'8
              }
              \context Voice = "voice 2" {
                 e'8
                 f'8
              }
           >>
        }

        abjad> note = t.leaves[1]
        abjad> note.parentage.governor is t[0][0]
        True

    In the case that no such container exists in the parentage of component, return `None`.

        abjad> note = Note(0, (1, 4))
        abjad> note.parentage.governor is None
        True

    Note

    Governor is an old and probably nonoptimal idea in the codebase. The concept is used only in the clonewp module to clone components with parentage.

  `orphan`

    `True` when component has no parent, otherwise `False`.

        abjad> note = Note(0, (1, 4))
        abjad> note.parentage.orphan
        True

    Defined equal to `len(component.parentage.proper) == 0`.

  `parent`

    Read-only reference to immediate parent of component.

        abjad> tuplet = FixedDurationTuplet((2, 8), construct.scale(3))
        abjad> staff = Staff([tuplet])
        abjad> note = staff.leaves[0]
        abjad> note.parentage.parent
        FixedDurationTuplet(1/4, [c'8, d'8, e'8])

    Equivalent to `component.parentage.proper[0]` for those components with proper parentage. Otherwise `None`.

  `parentage`

    Read-only list of all of components in the parentage of component, including component.

        abjad> tuplet = FixedDurationTuplet((2, 8), construct.scale(3))
        abjad> staff = Staff([tuplet])
        abjad> note = staff.leaves[0]
        abjad> note.parentage.parentage
        [Note(c', 8), FixedDurationTuplet(1/4, [c'8, d'8, e'8]), Staff{1}]

    Changed in version 1.1.1: Returns (immutable) tuple instead of (mutable) list.

  `proper`

    New in version 1.1.1.

    Read-only tuple of all of components in the parentage of component, excluding component.

        abjad> tuplet = FixedDurationTuplet((2, 8), construct.scale(3))
        abjad> staff = Staff([tuplet])
        abjad> note = staff.leaves[0]
        abjad> note.parentage.proper
        (FixedDurationTuplet(1/4, [c'8, d'8, e'8]), Staff{1})

    Defined equal to `component.parentage.parentage[1:]`.

  `root`

    Reference to root-level component in parentage of component.

        abjad> tuplet = FixedDurationTuplet((2, 8), construct.scale(3))
        abjad> staff = Staff([tuplet])
        abjad> note = staff.leaves[0]
        abjad> note.parentage.root
        Staff{1}

    Defined equal to `component.parentage.parentage[-1]`.

  `signature`

    Containment signature of component.

    Containment signature defined equal to first voice, first staff, first staffgroup, first score and root in parentage.

        abjad> tuplet = FixedDurationTuplet((2, 8), construct.scale(3))
        abjad> staff = Staff([tuplet])
        abjad> note = staff.leaves[0]
        abjad> print note.parentage.signature
              root: Staff-18830800 (18830800)
             score:
        staffgroup:
             staff: Staff-18830800
             voice:
              self: Note-18619728

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »