2828
2929def fromstring (text , tag = "" , attrs = None , encoding = "" ):
3030 """
31- Parse's "HTML" document from a string into an element_tree .
31+ Parse's "HTML" document from a string into an element tree .
3232
3333 :param text: The "HTML" document to parse.
34- :type text: str, bytes
34+ :type text: str or bytes
3535
3636 :param str tag: (optional) see :class:`HTMLement` for details.
3737 :param dict attrs: (optional) see :class:`HTMLement` for details.
38- :param str encoding: (optional) The encoding used for/in *text*
38+ :param str encoding: (optional) The encoding used for *text*
3939
4040 :return: The root element of the element tree.
4141 :rtype: xml.etree.ElementTree.Element
@@ -49,10 +49,10 @@ def fromstring(text, tag="", attrs=None, encoding=""):
4949
5050def fromstringlist (sequence , tag = "" , attrs = None , encoding = "" ):
5151 """
52- Parses an HTML document from a sequence of "HTML sections" into an element tree.
52+ Parses an " HTML document" from a sequence of "HTML sections" into an element tree.
5353
5454 :param sequence: A sequence of "HTML sections" to parse.
55- :type sequence: list[ str, bytes]
55+ :type sequence: list( str or bytes)
5656
5757 :param str tag: (optional) see :class:`HTMLement` for details.
5858 :param dict attrs: (optional) see :class:`HTMLement` for details.
@@ -71,10 +71,10 @@ def fromstringlist(sequence, tag="", attrs=None, encoding=""):
7171
7272def parse (source , tag = "" , attrs = None , encoding = "" ):
7373 """
74- Load an external HTML document into element tree.
74+ Load an external " HTML document" into an element tree.
7575
7676 :param source: A filename or file like object containing HTML data.
77- :type source: str, io.TextIOBase
77+ :type source: str or io.TextIOBase
7878
7979 :param str tag: (optional) see :class:`HTMLement` for details.
8080 :param dict attrs: (optional) see :class:`HTMLement` for details.
@@ -123,15 +123,15 @@ class HTMLement(object):
123123 section is found, does the parser start parsing the "HTML document". The element that matches the search criteria
124124 will then become the new "root element".
125125
126- Attributes are given as a dict of {'name': 'value'}. Value can be the string to match, or `True` or `False.`
126+ Attributes are given as a dict of {'name': 'value'}. Value can be the string to match, `True` or `False.`
127127 `True` will match any attribute with given name and any value.
128- `False` will only give a match if given attribute does not exists in the element.
128+ `False` will only give a match if given attribute does not exist in the element.
129129
130- :type tag: str
131130 :param str tag: (optional) Name of "tag / element" which is used to filter down "the tree" to a required section.
131+ :type tag: str
132132
133- :type attrs: dict
134133 :param attrs: (optional) The attributes of the element, that will be used, when searchingfor the required section.
134+ :type attrs: dict(str, str)
135135
136136 :param encoding: (optional) Encoding used, when decoding the source data before feeding it to the parser.
137137 :type encoding: str
@@ -148,12 +148,12 @@ def feed(self, data):
148148 """
149149 Feeds data to the parser.
150150
151- If *data*, is of " type `bytes` and where no encoding was specified, then the encoding
152- will be extracted from *data* using "meta tags" if available.
151+ If *data*, is of type :class: `bytes` and where no encoding was specified, then the encoding
152+ will be extracted from *data* using "meta tags", if available.
153153 Otherwise encoding will default to "ISO-8859-1"
154154
155155 :param data: HTML data
156- :type data: str, bytes
156+ :type data: str or bytes
157157
158158 :raises UnicodeDecodeError: If decoding of *data* fails.
159159 """
@@ -182,18 +182,18 @@ def close(self):
182182 :return: The "root element" of the "element tree".
183183 :rtype: xml.etree.ElementTree.Element
184184
185- :raises RuntimeError: If no element, matching search criteria, was found when a filter is given .
185+ :raises RuntimeError: If no element matching search criteria was found.
186186 """
187187 return self ._parser .close ()
188188
189189 def _make_unicode (self , data ):
190190 """
191- Convert *data* from type `bytes` to type `str`.
191+ Convert *data* from type :class: `bytes` to type :class: `str`.
192192
193193 :param data: The html document.
194194 :type data: bytes
195195
196- :return: HTML data decoded into str(unicode) .
196+ :return: HTML data decoded.
197197 :rtype: str
198198 """
199199 # Atemp to find the encoding from the html source
0 commit comments