| 1449 | category=None, |
| 1450 | ) |
| 1451 | def parse_file( # noqa: D102 |
| 1452 | cls, |
| 1453 | path: str | Path, |
| 1454 | *, |
| 1455 | content_type: str | None = None, |
| 1456 | encoding: str = 'utf8', |
| 1457 | proto: DeprecatedParseProtocol | None = None, |
| 1458 | allow_pickle: bool = False, |
| 1459 | ) -> Self: |
| 1460 | warnings.warn( |
| 1461 | 'The `parse_file` method is deprecated; load the data from file, then if your data is JSON ' |
| 1462 | 'use `model_validate_json`, otherwise `model_validate` instead.', |
| 1463 | category=PydanticDeprecatedSince20, |
| 1464 | stacklevel=2, |
| 1465 | ) |
| 1466 | from .deprecated import parse |
| 1467 | |
| 1468 | obj = parse.load_file( |
| 1469 | path, |
| 1470 | proto=proto, |
| 1471 | content_type=content_type, |
| 1472 | encoding=encoding, |
| 1473 | allow_pickle=allow_pickle, |
| 1474 | ) |
| 1475 | return cls.parse_obj(obj) |
| 1476 | |
| 1477 | @classmethod |
| 1478 | @typing_extensions.deprecated( |