diff options
author | Leonard Richardson <leonardr@segfault.org> | 2020-05-17 11:58:31 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2020-05-17 11:58:31 -0400 |
commit | 329fc7fd408388ac7b62e8703962f28aae0f3a9d (patch) | |
tree | fb4e71d7acb9a9f6f6e9a7a3062fface659ef512 | |
parent | 83c8c3a029d29fd833a8137b205f4ca78a4b1c26 (diff) |
Added docstring for BeautifulSoup.new_tag.
-rw-r--r-- | bs4/__init__.py | 16 | ||||
-rw-r--r-- | doc/source/index.rst | 12 |
2 files changed, 27 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, diff --git a/doc/source/index.rst b/doc/source/index.rst index f6a89de..87c04d9 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -3281,6 +3281,18 @@ on BS4 until you change them. * ``Tag.next`` -> ``Tag.next_element`` * ``Tag.previous`` -> ``Tag.previous_element`` +These methods are left over from the Beautiful Soup 2 API. They've +been deprecated since 2006, and should not be used at all: + +* ``Tag.fetchNextSiblings`` +* ``Tag.fetchPreviousSiblings`` +* ``Tag.fetchPrevious`` +* ``Tag.fetchPreviousSiblings`` +* ``Tag.fetchParents`` +* ``Tag.findChild`` +* ``Tag.findChildren`` + + Generators ^^^^^^^^^^ |