MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / validate

Function validate

src/licensedcode/_vendor/attr/_make.py:2085–2099  ·  view source on GitHub ↗

Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with ``attrs`` attributes.

(inst)

Source from the content-addressed store, hash-verified

2083
2084
2085def validate(inst):
2086 """
2087 Validate all attributes on *inst* that have a validator.
2088
2089 Leaves all exceptions through.
2090
2091 :param inst: Instance of a class with ``attrs`` attributes.
2092 """
2093 if _config._run_validators is False:
2094 return
2095
2096 for a in fields(inst.__class__):
2097 v = a.validator
2098 if v is not None:
2099 v(inst, a, getattr(inst, a.name))
2100
2101
2102def _is_slot_cls(cls):

Callers

nothing calls this directly

Calls 2

fieldsFunction · 0.85
vFunction · 0.50

Tested by

no test coverage detected