Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6ab4c9

Browse files
committed
Eliminate absolute imports in the library (tests get to keep them).
1 parent4b7db9b commite6ab4c9

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-
fromhtml5lib.constantsimportcdataElements,rcdataElements,voidElements
7+
from..constantsimportcdataElements,rcdataElements,voidElements
88

9-
fromhtml5lib.constantsimportspaceCharacters
9+
from..constantsimportspaceCharacters
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__importabsolute_import,division,unicode_literals
22

33
from .import_base
4-
fromhtml5lib.sanitizerimportHTMLSanitizerMixin
4+
from..sanitizerimportHTMLSanitizerMixin
55

66

77
classFilter(_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
importre
44

55
from .import_base
6-
fromhtml5lib.constantsimportrcdataElements,spaceCharacters
6+
from..constantsimportrcdataElements,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__importabsolute_import,division,unicode_literals
22

3-
fromhtml5libimporttreewalkers
3+
from..importtreewalkers
44

55
from .htmlserializerimportHTMLSerializer
66

‎html5lib/serializer/htmlserializer.py

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

13-
fromhtml5lib.constantsimportvoidElements,booleanAttributes,spaceCharacters
14-
fromhtml5lib.constantsimportrcdataElements,entities,xmlEntities
15-
fromhtml5libimportutils
13+
from..constantsimportvoidElements,booleanAttributes,spaceCharacters
14+
from..constantsimportrcdataElements,entities,xmlEntities
15+
from..importutils
1616
fromxml.sax.saxutilsimportescape
1717

1818
spaceCharacters="".join(spaceCharacters)
@@ -177,18 +177,18 @@ def serialize(self, treewalker, encoding=None):
177177
in_cdata=False
178178
self.errors= []
179179
ifencodingandself.inject_meta_charset:
180-
fromhtml5lib.filters.inject_meta_charsetimportFilter
180+
from..filters.inject_meta_charsetimportFilter
181181
treewalker=Filter(treewalker,encoding)
182182
# XXX: WhitespaceFilter should be used before OptionalTagFilter
183183
# for maximum efficiently of this latter filter
184184
ifself.strip_whitespace:
185-
fromhtml5lib.filters.whitespaceimportFilter
185+
from..filters.whitespaceimportFilter
186186
treewalker=Filter(treewalker)
187187
ifself.sanitize:
188-
fromhtml5lib.filters.sanitizerimportFilter
188+
from..filters.sanitizerimportFilter
189189
treewalker=Filter(treewalker)
190190
ifself.omit_optional_tags:
191-
fromhtml5lib.filters.optionaltagsimportFilter
191+
from..filters.optionaltagsimportFilter
192192
treewalker=Filter(treewalker)
193193
fortokenintreewalker:
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__importabsolute_import,division,unicode_literals
22
fromsiximporttext_type
33

4-
fromhtml5lib.constantsimportscopingElements,tableInsertModeElements,namespaces
4+
from..constantsimportscopingElements,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
importweakref
66

77
from .import_base
8-
fromhtml5libimportconstants
9-
fromhtml5lib.constantsimportnamespaces
10-
fromhtml5lib.utilsimportmoduleFactoryFactory
8+
from..importconstants
9+
from..constantsimportnamespaces
10+
from..utilsimportmoduleFactoryFactory
1111

1212

1313
defgetDomBuilder(DomImplementation):

‎html5lib/treebuilders/etree.py

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

66
from .import_base
7-
fromhtml5libimportihatexml
8-
fromhtml5libimportconstants
9-
fromhtml5lib.constantsimportnamespaces
10-
fromhtml5lib.utilsimportmoduleFactoryFactory
7+
from..importihatexml
8+
from..importconstants
9+
from..constantsimportnamespaces
10+
from..utilsimportmoduleFactoryFactory
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
importsys
1717

1818
from .import_base
19-
fromhtml5lib.constantsimportDataLossWarning
20-
importhtml5lib.constantsasconstants
19+
from..constantsimportDataLossWarning
20+
from ..importconstants
2121
from .importetreeasetree_builders
22-
fromhtml5libimportihatexml
22+
from ..importihatexml
23+
24+
importlxml.etreeasetree
2325

24-
try:
25-
importlxml.etreeasetree
26-
exceptImportError:
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
fromsiximporttext_type
33

44
from .import_base
5-
fromhtml5lib.constantsimportvoidElements,namespaces,prefixes
5+
from..constantsimportvoidElements,namespaces,prefixes
66
fromxml.sax.saxutilsimportescape
77

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

‎html5lib/treewalkers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def getTreeWalker(treeType, implementation=None, **kwargs):
3838
treeType=treeType.lower()
3939
iftreeTypenotintreeWalkerCache:
4040
iftreeTypein ("dom","pulldom","simpletree"):
41-
name="html5lib.treewalkers."+treeType
41+
name="%s.%s"% (__name__,treeType)
4242
__import__(name)
4343
mod=sys.modules[name]
4444
treeWalkerCache[treeType]=mod.TreeWalker

‎html5lib/treewalkers/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
importgettext
55
_=gettext.gettext
66

7-
fromhtml5lib.constantsimportvoidElements,spaceCharacters
7+
from..constantsimportvoidElements,spaceCharacters
88
spaceCharacters="".join(spaceCharacters)
99

1010

‎html5lib/treewalkers/genshistream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from .import_base
88

9-
fromhtml5lib.constantsimportvoidElements,namespaces
9+
from..constantsimportvoidElements,namespaces
1010

1111

1212
classTreeWalker(_base.TreeWalker):

‎html5lib/treewalkers/lxmletree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
fromsiximporttext_type
33

44
fromlxmlimportetree
5-
fromhtml5lib.treebuilders.etreeimporttag_regexp
5+
from..treebuilders.etreeimporttag_regexp
66

77
fromgettextimportgettext
88
_=gettext
99

1010
from .import_base
1111

12-
fromhtml5libimportihatexml
12+
from..importihatexml
1313

1414

1515
defensure_str(s):

‎html5lib/treewalkers/pulldom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from .import_base
77

8-
fromhtml5lib.constantsimportvoidElements
8+
from..constantsimportvoidElements
99

1010

1111
classTreeWalker(_base.TreeWalker):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp