(self, instance, _schema=None)
| 347 | return NewValidator(**changes) |
| 348 | |
| 349 | def iter_errors(self, instance, _schema=None): |
| 350 | if _schema is not None: |
| 351 | warnings.warn( |
| 352 | ( |
| 353 | "Passing a schema to Validator.iter_errors " |
| 354 | "is deprecated and will be removed in a future " |
| 355 | "release. Call validator.evolve(schema=new_schema)." |
| 356 | "iter_errors(...) instead." |
| 357 | ), |
| 358 | DeprecationWarning, |
| 359 | stacklevel=2, |
| 360 | ) |
| 361 | validators = [ |
| 362 | (self.VALIDATORS[k], k, v) |
| 363 | for k, v in applicable_validators(_schema) |
| 364 | if k in self.VALIDATORS |
| 365 | ] |
| 366 | else: |
| 367 | _schema, validators = self.schema, self._validators |
| 368 | |
| 369 | if _schema is True: |
| 370 | return |
| 371 | elif _schema is False: |
| 372 | yield exceptions.ValidationError( |
| 373 | f"False schema does not allow {instance!r}", |
| 374 | validator=None, |
| 375 | validator_value=None, |
| 376 | instance=instance, |
| 377 | schema=_schema, |
| 378 | ) |
| 379 | return |
| 380 | |
| 381 | for validator, k, v in validators: |
| 382 | errors = validator(self, v, instance, _schema) or () |
| 383 | for error in errors: |
| 384 | # set details if not already set by the called fn |
| 385 | error._set( |
| 386 | validator=k, |
| 387 | validator_value=v, |
| 388 | instance=instance, |
| 389 | schema=_schema, |
| 390 | type_checker=self.TYPE_CHECKER, |
| 391 | ) |
| 392 | if k not in {"if", "$ref"}: |
| 393 | error.schema_path.appendleft(k) |
| 394 | yield error |
| 395 | |
| 396 | def descend( |
| 397 | self, |
no test coverage detected