Skip to content

Commit e6ab4c9

Browse files
committed
Eliminate absolute imports in the library (tests get to keep them).
1 parent 4b7db9b commit e6ab4c9

File tree

15 files changed

+32
-34
lines changed

15 files changed

+32
-34
lines changed

html5lib/filters/lint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
_ = gettext
55

66
from . import _base
7-
from html5lib.constants import cdataElements, rcdataElements, voidElements
7+
from ..constants import cdataElements, rcdataElements, voidElements
88

9-
from html5lib.constants import spaceCharacters
9+
from ..constants import spaceCharacters
1010
spaceCharacters = "".join(spaceCharacters)
1111

1212

html5lib/filters/sanitizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import, division, unicode_literals
22

33
from . import _base
4-
from html5lib.sanitizer import HTMLSanitizerMixin
4+
from ..sanitizer import HTMLSanitizerMixin
55

66

77
class Filter(_base.Filter, HTMLSanitizerMixin):

html5lib/filters/whitespace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44

55
from . import _base
6-
from html5lib.constants import rcdataElements, spaceCharacters
6+
from ..constants import rcdataElements, spaceCharacters
77
spaceCharacters = "".join(spaceCharacters)
88

99
SPACES_REGEX = re.compile("[%s]+" % spaceCharacters)

html5lib/serializer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import absolute_import, division, unicode_literals
22

3-
from html5lib import treewalkers
3+
from .. import treewalkers
44

55
from .htmlserializer import HTMLSerializer
66

html5lib/serializer/htmlserializer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
except ImportError:
1111
pass
1212

13-
from html5lib.constants import voidElements, booleanAttributes, spaceCharacters
14-
from html5lib.constants import rcdataElements, entities, xmlEntities
15-
from html5lib import utils
13+
from ..constants import voidElements, booleanAttributes, spaceCharacters
14+
from ..constants import rcdataElements, entities, xmlEntities
15+
from .. import utils
1616
from xml.sax.saxutils import escape
1717

1818
spaceCharacters = "".join(spaceCharacters)
@@ -177,18 +177,18 @@ def serialize(self, treewalker, encoding=None):
177177
in_cdata = False
178178
self.errors = []
179179
if encoding and self.inject_meta_charset:
180-
from html5lib.filters.inject_meta_charset import Filter
180+
from ..filters.inject_meta_charset import Filter
181181
treewalker = Filter(treewalker, encoding)
182182
# XXX: WhitespaceFilter should be used before OptionalTagFilter
183183
# for maximum efficiently of this latter filter
184184
if self.strip_whitespace:
185-
from html5lib.filters.whitespace import Filter
185+
from ..filters.whitespace import Filter
186186
treewalker = Filter(treewalker)
187187
if self.sanitize:
188-
from html5lib.filters.sanitizer import Filter
188+
from ..filters.sanitizer import Filter
189189
treewalker = Filter(treewalker)
190190
if self.omit_optional_tags:
191-
from html5lib.filters.optionaltags import Filter
191+
from ..filters.optionaltags import Filter
192192
treewalker = Filter(treewalker)
193193
for token in treewalker:
194194
type = token["type"]

html5lib/treebuilders/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import, division, unicode_literals
22
from six import text_type
33

4-
from html5lib.constants import scopingElements, tableInsertModeElements, namespaces
4+
from ..constants import scopingElements, tableInsertModeElements, namespaces
55

66
# The scope markers are inserted when entering object elements,
77
# marquees, table cells, and table captions, and are used to prevent formatting

html5lib/treebuilders/dom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import weakref
66

77
from . import _base
8-
from html5lib import constants
9-
from html5lib.constants import namespaces
10-
from html5lib.utils import moduleFactoryFactory
8+
from .. import constants
9+
from ..constants import namespaces
10+
from ..utils import moduleFactoryFactory
1111

1212

1313
def getDomBuilder(DomImplementation):

html5lib/treebuilders/etree.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import re
55

66
from . import _base
7-
from html5lib import ihatexml
8-
from html5lib import constants
9-
from html5lib.constants import namespaces
10-
from html5lib.utils import moduleFactoryFactory
7+
from .. import ihatexml
8+
from .. import constants
9+
from ..constants import namespaces
10+
from ..utils import moduleFactoryFactory
1111

1212
tag_regexp = re.compile("{([^}]*)}(.*)")
1313

html5lib/treebuilders/etree_lxml.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
import sys
1717

1818
from . import _base
19-
from html5lib.constants import DataLossWarning
20-
import html5lib.constants as constants
19+
from ..constants import DataLossWarning
20+
from .. import constants
2121
from . import etree as etree_builders
22-
from html5lib import ihatexml
22+
from .. import ihatexml
23+
24+
import lxml.etree as etree
2325

24-
try:
25-
import lxml.etree as etree
26-
except ImportError:
27-
pass
2826

2927
fullTree = True
3028
tag_regexp = re.compile("{([^}]*)}(.*)")

html5lib/treebuilders/simpletree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from six import text_type
33

44
from . import _base
5-
from html5lib.constants import voidElements, namespaces, prefixes
5+
from ..constants import voidElements, namespaces, prefixes
66
from xml.sax.saxutils import escape
77

88
# Really crappy basic implementation of a DOM-core like thing

0 commit comments

Comments
 (0)