Skip to content

Commit 86f0d21

Browse files
authored
Merge pull request #1 from Mic92/python2.7-removal
Only support python versions that receive security update
2 parents fd4f032 + 29d3072 commit 86f0d21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+45
-173
lines changed

.appveyor.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/python-tox.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
os: [ubuntu-latest, windows-latest]
1313
deps: [base, optional]
1414
include:
15-
- python: "pypy-2.7"
16-
os: ubuntu-latest
17-
deps: base
1815
- python: "pypy-3.10"
1916
os: ubuntu-latest
2017
deps: base

README.rst

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ or:
2929
3030
By default, the ``document`` will be an ``xml.etree`` element instance.
3131
Whenever possible, html5lib chooses the accelerated ``ElementTree``
32-
implementation (i.e. ``xml.etree.cElementTree`` on Python 2.x).
32+
implementation.
3333

3434
Two other tree types are supported: ``xml.dom.minidom`` and
3535
``lxml.etree``. To use an alternative format, specify the name of
@@ -41,18 +41,6 @@ a treebuilder:
4141
with open("mydocument.html", "rb") as f:
4242
lxml_etree_document = html5lib.parse(f, treebuilder="lxml")
4343
44-
When using with ``urllib2`` (Python 2), the charset from HTTP should be
45-
pass into html5lib as follows:
46-
47-
.. code-block:: python
48-
49-
from contextlib import closing
50-
from urllib2 import urlopen
51-
import html5lib
52-
53-
with closing(urlopen("http://example.com/")) as f:
54-
document = html5lib.parse(f, transport_encoding=f.info().getparam("charset"))
55-
5644
When using with ``urllib.request`` (Python 3), the charset from HTTP
5745
should be pass into html5lib as follows:
5846

@@ -90,7 +78,7 @@ More documentation is available at https://html5lib.readthedocs.io/.
9078
Installation
9179
------------
9280

93-
html5lib works on CPython 2.7+, CPython 3.5+ and PyPy. To install:
81+
html5lib works on CPython 3.8+ and PyPy. To install:
9482

9583
.. code-block:: bash
9684

debug-info.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function, unicode_literals
21

32
import platform
43
import sys

doc/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
32
#
43
# html5lib documentation build configuration file, created by
54
# sphinx-quickstart on Wed May 8 00:04:49 2013.
@@ -100,7 +99,7 @@
10099
}
101100

102101

103-
class CExtMock(object):
102+
class CExtMock:
104103
"""Required for autodoc on readthedocs.org where you cannot build C extensions."""
105104
def __init__(self, *args, **kwargs):
106105
pass

html5lib/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* :func:`~.serializer.serialize`
2121
"""
2222

23-
from __future__ import absolute_import, division, unicode_literals
2423

2524
from .html5parser import HTMLParser, parse, parseFragment
2625
from .treebuilders import getTreeBuilder

html5lib/_ihatexml.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import, division, unicode_literals
21

32
import re
43
import warnings
@@ -181,7 +180,7 @@ def escapeRegexp(string):
181180
nonPubidCharRegexp = re.compile("[^\x20\x0D\x0Aa-zA-Z0-9\\-'()+,./:=?;!*#@$_%]")
182181

183182

184-
class InfosetFilter(object):
183+
class InfosetFilter:
185184
replacementRegexp = re.compile(r"U[\dA-F]{5,5}")
186185

187186
def __init__(self,

html5lib/_inputstream.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import, division, unicode_literals
21

32
from six import text_type
43
from six.moves import http_client, urllib
@@ -48,7 +47,7 @@
4847
charsUntilRegEx = {}
4948

5049

51-
class BufferedStream(object):
50+
class BufferedStream:
5251
"""Buffering for streams that do not have buffering of their own
5352
5453
The buffer is implemented as a list of chunks on the assumption that
@@ -145,7 +144,7 @@ def HTMLInputStream(source, **kwargs):
145144
return HTMLBinaryInputStream(source, **kwargs)
146145

147146

148-
class HTMLUnicodeInputStream(object):
147+
class HTMLUnicodeInputStream:
149148
"""Provides a unicode stream of characters to the HTMLTokenizer.
150149
151150
This class takes care of character encoding and removing or replacing
@@ -673,7 +672,7 @@ def jumpTo(self, bytes):
673672
return True
674673

675674

676-
class EncodingParser(object):
675+
class EncodingParser:
677676
"""Mini parser for detecting character encoding from meta elements"""
678677

679678
def __init__(self, data):
@@ -861,7 +860,7 @@ def getAttribute(self):
861860
attrValue.append(c)
862861

863862

864-
class ContentAttrParser(object):
863+
class ContentAttrParser:
865864
def __init__(self, data):
866865
assert isinstance(data, bytes)
867866
self.data = data

html5lib/_tokenizer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import, division, unicode_literals
21

32
from six import unichr as chr
43

@@ -24,7 +23,7 @@
2423
attributeMap = OrderedDict
2524

2625

27-
class HTMLTokenizer(object):
26+
class HTMLTokenizer:
2827
""" This class takes care of tokenizing HTML.
2928
3029
* self.currentToken

html5lib/_trie/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import, division, unicode_literals
21

32
from .py import Trie
43

0 commit comments

Comments
 (0)