MCPcopy Create free account
hub / github.com/ampproject/amphtml / IsTrivialAttrSpec

Function IsTrivialAttrSpec

validator/validator_gen_js.py:543–552  ·  view source on GitHub ↗

Determines whether a given attr only has its name field set. Args: attr: an AttrSpec instance. Returns: true iff the only field that is set is the name field.

(attr)

Source from the content-addressed store, hash-verified

541
542
543def IsTrivialAttrSpec(attr):
544 """Determines whether a given attr only has its name field set.
545
546 Args:
547 attr: an AttrSpec instance.
548 Returns:
549 true iff the only field that is set is the name field.
550 """
551 return (attr.DESCRIPTOR.full_name == 'amp.validator.AttrSpec' and
552 attr.HasField('name') and len(attr.ListFields()) == 1)
553
554
555def AssignedValueFor(descriptor, field_desc, field_val, registry, out):

Callers 2

InternOrReferenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected