Skip to content

Commit 432a2a8

Browse files
committed
Eliminate sys.path side-effect
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40447
1 parent 0335f27 commit 432a2a8

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/treebuilders/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@
2929
of a full treebuilder and is a useful reference for the semantics of
3030
the various methods.
3131
"""
32+
33+
import os.path
34+
__path__.append(os.path.dirname(__path__[0]))
35+
36+
import dom, etree, simpletree

src/treebuilders/_base.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
import sys
2-
import os
3-
4-
#Insert the parent directory of the current file into the path
5-
_curDir = os.path.abspath(os.curdir)
6-
os.chdir(os.path.dirname(__file__))
7-
sys.path.insert(0, os.path.abspath(os.pardir))
8-
os.chdir(_curDir)
9-
del _curDir
10-
11-
from constants import contentModelFlags, spaceCharacters
12-
from constants import scopingElements, formattingElements, specialElements
13-
from constants import headingElements, tableInsertModeElements
1+
from constants import scopingElements, tableInsertModeElements
142

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

0 commit comments

Comments
 (0)