Skip to content

Commit 1e14175

Browse files
committed
ruff: pyupgrade to 3.8
ruff check --target-version py38 --select UP --fix .
1 parent fd4f032 commit 1e14175

Some content is hidden

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

56 files changed

+39
-97
lines changed

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

html5lib/_trie/_base.py

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

32
try:
43
from collections.abc import Mapping
54
except ImportError: # Python 2.7
6-
from collections import Mapping
5+
from collections.abc import Mapping
76

87

98
class Trie(Mapping):

html5lib/_trie/py.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
from six import text_type
32

43
from bisect import bisect_left

html5lib/_utils.py

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

32
from types import ModuleType
43

54
try:
65
from collections.abc import Mapping
76
except ImportError:
8-
from collections import Mapping
7+
from collections.abc import Mapping
98

109
from six import text_type, PY3
1110

1211
if PY3:
1312
import xml.etree.ElementTree as default_etree
1413
else:
1514
try:
16-
import xml.etree.cElementTree as default_etree
15+
import xml.etree.ElementTree as default_etree
1716
except ImportError:
1817
import xml.etree.ElementTree as default_etree
1918

@@ -122,7 +121,7 @@ def moduleFactoryFactory(factory):
122121
moduleCache = {}
123122

124123
def moduleFactory(baseModule, *args, **kwargs):
125-
if isinstance(ModuleType.__name__, type("")):
124+
if isinstance(ModuleType.__name__, str):
126125
name = "_%s_factory" % baseModule.__name__
127126
else:
128127
name = b"_%s_factory" % baseModule.__name__

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy