MCPcopy Create free account
hub / github.com/python/mypy / load_bytes_from_str_literal

Method load_bytes_from_str_literal

mypyc/irbuild/builder.py:360–367  ·  view source on GitHub ↗

Load bytes object from a string literal. The literal characters of BytesExpr (the characters inside b'') are stored in BytesExpr.value, whose type is 'str' not 'bytes'. Thus we perform a special conversion here.

(self, value: str, line: int = -1)

Source from the content-addressed store, hash-verified

358 return self.builder.load_str(value, line)
359
360 def load_bytes_from_str_literal(self, value: str, line: int = -1) -> Value:
361 """Load bytes object from a string literal.
362
363 The literal characters of BytesExpr (the characters inside b'')
364 are stored in BytesExpr.value, whose type is 'str' not 'bytes'.
365 Thus we perform a special conversion here.
366 """
367 return self.builder.load_bytes(bytes_from_str(value), line)
368
369 def load_int(self, value: int, line: int = -1) -> Value:
370 return self.builder.load_int(value, line)

Callers 2

join_formatted_bytesFunction · 0.80
transform_bytes_exprFunction · 0.80

Calls 2

bytes_from_strFunction · 0.90
load_bytesMethod · 0.80

Tested by

no test coverage detected