MCPcopy
hub / github.com/danielgtaylor/python-betterproto / parse

Method parse

src/betterproto/__init__.py:1351–1367  ·  view source on GitHub ↗

Parse the binary encoded Protobuf into this message instance. This returns the instance itself and is therefore assignable and chainable. Parameters ----------- data: :class:`bytes` The data to parse the message from. Returns ---

(self: T, data: bytes)

Source from the content-addressed store, hash-verified

1349 return self
1350
1351 def parse(self: T, data: bytes) -> T:
1352 """
1353 Parse the binary encoded Protobuf into this message instance. This
1354 returns the instance itself and is therefore assignable and chainable.
1355
1356 Parameters
1357 -----------
1358 data: :class:`bytes`
1359 The data to parse the message from.
1360
1361 Returns
1362 --------
1363 :class:`Message`
1364 The initialized message.
1365 """
1366 with BytesIO(data) as stream:
1367 return self.load(stream)
1368
1369 # For compatibility with other libraries.
1370 @classmethod

Callers 15

__setstate__Method · 0.95
_postprocess_singleMethod · 0.80
FromStringMethod · 0.80
mainFunction · 0.80
test_has_fieldFunction · 0.80
test_unknown_fieldsFunction · 0.80
test_oneof_supportFunction · 0.80
test_optional_flagFunction · 0.80
test_regression_387Function · 0.80
test_datetime_clampingFunction · 0.80

Calls 1

loadMethod · 0.95

Tested by 10

test_has_fieldFunction · 0.64
test_unknown_fieldsFunction · 0.64
test_oneof_supportFunction · 0.64
test_optional_flagFunction · 0.64
test_regression_387Function · 0.64
test_datetime_clampingFunction · 0.64
test_full_cycleFunction · 0.64