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

Method getattr

deps/v8/third_party/jinja2/environment.py:480–491  ·  view source on GitHub ↗

Get an item or attribute of an object but prefer the attribute. Unlike :meth:`getitem` the attribute *must* be a string.

(self, obj: t.Any, attribute: str)

Source from the content-addressed store, hash-verified

478 return self.undefined(obj=obj, name=argument)
479
480 def getattr(self, obj: t.Any, attribute: str) -> t.Any:
481 """Get an item or attribute of an object but prefer the attribute.
482 Unlike :meth:`getitem` the attribute *must* be a string.
483 """
484 try:
485 return getattr(obj, attribute)
486 except AttributeError:
487 pass
488 try:
489 return obj[attribute]
490 except (TypeError, LookupError, AttributeError):
491 return self.undefined(obj=obj, name=attribute)
492
493 def _filter_test_common(
494 self,

Callers 15

box2d.jsFile · 0.45
copy.jsFile · 0.45
zlib.jsFile · 0.45
lua_binarytrees.jsFile · 0.45
fannkuch.jsFile · 0.45
primes.jsFile · 0.45
memops.jsFile · 0.45
fasta.jsFile · 0.45
corrections.jsFile · 0.45
box2d.jsFile · 0.45
copy.jsFile · 0.45
zlib.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected