MCPcopy Index your code
hub / github.com/STIXProject/python-stix / iter_vars

Function iter_vars

stix/utils/__init__.py:244–257  ·  view source on GitHub ↗

Returns a generator which yields a ``(property name, property value)`` tuple with each iteration. Note: This will not yield vars that are attached during parse, such as ``__input_schemalocations__`` and ``__input_namespaces__``.

(obj)

Source from the content-addressed store, hash-verified

242
243
244def iter_vars(obj):
245 """Returns a generator which yields a ``(property name, property value)``
246 tuple with each iteration.
247
248 Note:
249 This will not yield vars that are attached during parse, such as
250 ``__input_schemalocations__`` and ``__input_namespaces__``.
251
252 """
253 def check(name):
254 return name not in ('__input_namespaces__', '__input_schemalocations__')
255
256 instance_vars = iteritems(vars(obj))
257 return ((attr_name(name), val) for name, val in instance_vars if check(name))
258
259
260def is_dictable(obj):

Callers 1

to_dictFunction · 0.85

Calls 2

attr_nameFunction · 0.85
checkFunction · 0.85

Tested by

no test coverage detected