MCPcopy
hub / github.com/unclecode/crawl4ai / finish

Method finish

crawl4ai/html2text/__init__.py:168–186  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

166 self.lastWasNL = s[-1] == "\n"
167
168 def finish(self) -> str:
169 self.close()
170
171 self.pbr()
172 self.o("", force="end")
173
174 outtext = "".join(self.outtextlist)
175
176 if self.unicode_snob:
177 nbsp = html.entities.html5["nbsp;"]
178 else:
179 nbsp = " "
180 outtext = outtext.replace("&nbsp_place_holder;", nbsp)
181
182 # Clear self.outtextlist to avoid memory leak of its content to
183 # the next handling.
184 self.outtextlist = []
185
186 return outtext
187
188 def handle_charref(self, c: str) -> None:
189 self.handle_data(self.charref(c), True)

Callers 1

handleMethod · 0.95

Calls 3

pbrMethod · 0.95
oMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected