MCPcopy Index your code
hub / github.com/csev/py4e / encode_contents

Method encode_contents

code3/bs4/element.py:1206–1221  ·  view source on GitHub ↗

Renders the contents of this tag as a bytestring. :param indent_level: Each line of the rendering will be indented this many spaces. :param eventual_encoding: The bytestring will be in this encoding. :param formatter: The output formatter responsible for convert

(
        self, indent_level=None, encoding=DEFAULT_OUTPUT_ENCODING,
        formatter="minimal")

Source from the content-addressed store, hash-verified

1204 return ''.join(s)
1205
1206 def encode_contents(
1207 self, indent_level=None, encoding=DEFAULT_OUTPUT_ENCODING,
1208 formatter="minimal"):
1209 """Renders the contents of this tag as a bytestring.
1210
1211 :param indent_level: Each line of the rendering will be
1212 indented this many spaces.
1213
1214 :param eventual_encoding: The bytestring will be in this encoding.
1215
1216 :param formatter: The output formatter responsible for converting
1217 entities to Unicode characters.
1218 """
1219
1220 contents = self.decode_contents(indent_level, encoding, formatter)
1221 return contents.encode(encoding)
1222
1223 # Old method for BS3 compatibility
1224 def renderContents(self, encoding=DEFAULT_OUTPUT_ENCODING,

Callers 2

renderContentsMethod · 0.95
test_encode_contentsMethod · 0.45

Calls 2

decode_contentsMethod · 0.95
encodeMethod · 0.45

Tested by 1

test_encode_contentsMethod · 0.36