Helper function to generate the right kind of Element given a spec.
(spec, parent, attributes=None)
| 112 | |
| 113 | |
| 114 | def _make_element(spec, parent, attributes=None): |
| 115 | """Helper function to generate the right kind of Element given a spec.""" |
| 116 | if (spec.name == constants.WORLDBODY |
| 117 | or (spec.name == constants.SITE |
| 118 | and (parent.tag == constants.BODY |
| 119 | or parent.tag == constants.WORLDBODY))): |
| 120 | return _AttachableElement(spec, parent, attributes) |
| 121 | elif isinstance(parent, _AttachmentFrame): |
| 122 | return _AttachmentFrameChild(spec, parent, attributes) |
| 123 | elif spec.name == constants.DEFAULT: |
| 124 | return _DefaultElement(spec, parent, attributes) |
| 125 | elif spec.name == constants.ACTUATOR: |
| 126 | return _ActuatorElement(spec, parent, attributes) |
| 127 | else: |
| 128 | return _ElementImpl(spec, parent, attributes) |
| 129 | |
| 130 | |
| 131 | _DEFAULT_NAME_FROM_FILENAME = frozenset(['mesh', 'hfield', 'texture']) |
no test coverage detected
searching dependent graphs…