Skip to content

Commit d8ba0c2

Browse files
committed
Remove many .data property calls
1 parent 5484dcf commit d8ba0c2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

htmltools/_core.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def insert(self, i: SupportsIndex, item: TagChild) -> None:
293293
Insert tag children before a given index.
294294
"""
295295

296-
self.data[i:i] = _tagchilds_to_tagnodes([item])
296+
self[i:i] = _tagchilds_to_tagnodes([item])
297297

298298
def tagify(self) -> "TagList":
299299
"""
@@ -305,16 +305,16 @@ def tagify(self) -> "TagList":
305305
# Iterate backwards because if we hit a Tagifiable object, it may be replaced
306306
# with 0, 1, or more items (if it returns TagList).
307307
for i in reversed(range(len(cp))):
308-
child = cp.data[i]
308+
child = cp[i]
309309

310310
if isinstance(child, Tagifiable):
311311
tagified_child = child.tagify()
312312
if isinstance(tagified_child, TagList):
313313
# If the Tagifiable object returned a TagList, flatten it into this
314314
# one.
315-
cp.data[i : i + 1] = _tagchilds_to_tagnodes(tagified_child)
315+
cp[i : i + 1] = _tagchilds_to_tagnodes(tagified_child)
316316
else:
317-
cp.data[i] = tagified_child
317+
cp[i] = tagified_child
318318

319319
elif isinstance(child, MetadataNode):
320320
cp[i] = copy(child)
@@ -341,7 +341,7 @@ def save_html(
341341
The path to the generated HTML file.
342342
"""
343343

344-
return HTMLDocument(self.data).save_html(
344+
return HTMLDocument(self).save_html(
345345
file, libdir=libdir, include_version=include_version
346346
)
347347

@@ -381,7 +381,7 @@ def get_html_string(
381381
first_child = True
382382
prev_was_add_ws = add_ws
383383

384-
for child in self.data:
384+
for child in self:
385385
if isinstance(child, MetadataNode):
386386
continue
387387

@@ -446,7 +446,7 @@ def get_dependencies(self, *, dedup: bool = True) -> list["HTMLDependency"]:
446446
"""
447447

448448
deps: list[HTMLDependency] = []
449-
for x in self.data:
449+
for x in self:
450450
if isinstance(x, HTMLDependency):
451451
deps.append(x)
452452
elif isinstance(x, Tag):

0 commit comments

Comments
 (0)