MCPcopy
hub / github.com/pydantic/pydantic / parse_raw

Method parse_raw

pydantic/v1/main.py:552–572  ·  view source on GitHub ↗
(
        cls: Type['Model'],
        b: StrBytes,
        *,
        content_type: str = None,
        encoding: str = 'utf8',
        proto: Protocol = None,
        allow_pickle: bool = False,
    )

Source from the content-addressed store, hash-verified

550
551 @classmethod
552 def parse_raw(
553 cls: Type['Model'],
554 b: StrBytes,
555 *,
556 content_type: str = None,
557 encoding: str = 'utf8',
558 proto: Protocol = None,
559 allow_pickle: bool = False,
560 ) -> 'Model':
561 try:
562 obj = load_str_bytes(
563 b,
564 proto=proto,
565 content_type=content_type,
566 encoding=encoding,
567 allow_pickle=allow_pickle,
568 json_loads=cls.__config__.json_loads,
569 )
570 except (ValueError, TypeError, UnicodeDecodeError) as e:
571 raise ValidationError([ErrorWrapper(e, loc=ROOT_KEY)], cls)
572 return cls.parse_obj(obj)
573
574 @classmethod
575 def parse_file(

Callers

nothing calls this directly

Calls 4

load_str_bytesFunction · 0.90
ValidationErrorClass · 0.90
ErrorWrapperClass · 0.90
parse_objMethod · 0.45

Tested by

no test coverage detected