MCPcopy Create free account
hub / github.com/nodejs/node / iter_fields

Method iter_fields

deps/v8/third_party/jinja2/nodes.py:145–165  ·  view source on GitHub ↗

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: t.Optional[t.Container[str]] = None,
        only: t.Optional[t.Container[str]] = None,
    )

Source from the content-addressed store, hash-verified

143 raise TypeError(f"unknown attribute {next(iter(attributes))!r}")
144
145 def iter_fields(
146 self,
147 exclude: t.Optional[t.Container[str]] = None,
148 only: t.Optional[t.Container[str]] = None,
149 ) -> t.Iterator[t.Tuple[str, t.Any]]:
150 """This method iterates over all fields that are defined and yields
151 ``(key, value)`` tuples. Per default all fields are returned, but
152 it's possible to limit that to some fields by providing the `only`
153 parameter or to exclude some using the `exclude` parameter. Both
154 should be sets or tuples of field names.
155 """
156 for name in self.fields:
157 if (
158 (exclude is None and only is None)
159 or (exclude is not None and name not in exclude)
160 or (only is not None and name in only)
161 ):
162 try:
163 yield name, getattr(self, name)
164 except AttributeError:
165 pass
166
167 def iter_child_nodes(
168 self,

Callers 3

iter_child_nodesMethod · 0.95
__eq__Method · 0.95
generic_visitMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected