summaryrefslogtreecommitdiff
path: root/bs4/__init__.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2020-05-17 11:58:31 -0400
committerLeonard Richardson <leonardr@segfault.org>2020-05-17 11:58:31 -0400
commit329fc7fd408388ac7b62e8703962f28aae0f3a9d (patch)
treefb4e71d7acb9a9f6f6e9a7a3062fface659ef512 /bs4/__init__.py
parent83c8c3a029d29fd833a8137b205f4ca78a4b1c26 (diff)
Added docstring for BeautifulSoup.new_tag.
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r--bs4/__init__.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/bs4/__init__.py b/bs4/__init__.py
index 04dcffc..e2d0d61 100644
--- a/bs4/__init__.py
+++ b/bs4/__init__.py
@@ -450,7 +450,21 @@ class BeautifulSoup(Tag):
def new_tag(self, name, namespace=None, nsprefix=None, attrs={},
sourceline=None, sourcepos=None, **kwattrs):
- """Create a new Tag associated with this BeautifulSoup object."""
+ """Create a new Tag associated with this BeautifulSoup object.
+
+ :param name: The name of the new Tag.
+ :param namespace: The URI of the new Tag's XML namespace, if any.
+ :param prefix: The prefix for the new Tag's XML namespace, if any.
+ :param attrs: A dictionary of this Tag's attribute values; can
+ be used instead of `kwattrs` for attributes like 'class'
+ that are reserved words in Python.
+ :param sourceline: The line number where this tag was
+ (purportedly) found in its source document.
+ :param sourcepos: The character position within `sourceline` where this
+ tag was (purportedly) found.
+ :param kwattrs: Keyword arguments for the new Tag's attribute values.
+
+ """
kwattrs.update(attrs)
return self.element_classes.get(Tag, Tag)(
None, self.builder, name, namespace, nsprefix, kwattrs,