This method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the `exclude` parameter. Both sho
(self, exclude=None, only=None)
| 146 | next(iter(attributes))) |
| 147 | |
| 148 | def iter_fields(self, exclude=None, only=None): |
| 149 | """This method iterates over all fields that are defined and yields |
| 150 | ``(key, value)`` tuples. Per default all fields are returned, but |
| 151 | it's possible to limit that to some fields by providing the `only` |
| 152 | parameter or to exclude some using the `exclude` parameter. Both |
| 153 | should be sets or tuples of field names. |
| 154 | """ |
| 155 | for name in self.fields: |
| 156 | if (exclude is only is None) or \ |
| 157 | (exclude is not None and name not in exclude) or \ |
| 158 | (only is not None and name in only): |
| 159 | try: |
| 160 | yield name, getattr(self, name) |
| 161 | except AttributeError: |
| 162 | pass |
| 163 | |
| 164 | def iter_child_nodes(self, exclude=None, only=None): |
| 165 | """Iterates over all direct child nodes of the node. This iterates |
no outgoing calls
no test coverage detected