(element)
| 177 | |
| 178 | |
| 179 | def class_template(element): |
| 180 | out = '' |
| 181 | out += tmpl.class_mapping.substitute(element) |
| 182 | out += tmpl.class_def_head.substitute(element) |
| 183 | if element.required_children or element.required_attributes: |
| 184 | out += ' def _init(self):\n' |
| 185 | for child in element.required_children: |
| 186 | out += tmpl.reqd_child_constructor.substitute(child) |
| 187 | for attribute in element.required_attributes: |
| 188 | if ':' in attribute.name: |
| 189 | out += tmpl.ns_reqd_attr_constructor.substitute(attribute) |
| 190 | else: |
| 191 | out += tmpl.reqd_attr_constructor.substitute(attribute) |
| 192 | out += '\n' |
| 193 | if element.children: |
| 194 | out += ' # child accessors -----------------\n' |
| 195 | for child in element.required_children: |
| 196 | out += tmpl.reqd_child_accessor.substitute(child) |
| 197 | for child in element.optional_children: |
| 198 | out += tmpl.optional_child_accessor.substitute(child) |
| 199 | out += '\n' |
| 200 | if element.attributes: |
| 201 | out += ' # attribute accessors -------------\n' |
| 202 | for attribute in element.attributes: |
| 203 | if ':' in attribute.name: |
| 204 | out += tmpl.ns_attr_accessor.substitute(attribute) |
| 205 | else: |
| 206 | out += tmpl.attr_accessor.substitute(attribute) |
| 207 | out += '\n' |
| 208 | out += '\n' |
| 209 | return out |
| 210 | |
| 211 | |
| 212 |
no outgoing calls
no test coverage detected
searching dependent graphs…