def __call__(self, *args): from abjad.tools import spannertools if len(args) == 1: spanner_classes = ( spannertools.DynamicTextSpanner, spannertools.HairpinSpanner, ) parentage = args[0]._get_parentage() dynamic_spanners = parentage._get_spanners(spanner_classes) for dynamic_spanner in dynamic_spanners: if not dynamic_spanner._is_exterior_leaf(args[0]): message = 'can not attach dynamic mark' message += ' to interior component of dynamic spanner.' raise WellFormednessError(message) return ContextMark.__call__(self, *args)