Skip to content

Commit dd4d4b1

Browse files
committed
Rearrange source tree for easier packaging
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40269
1 parent 8645e30 commit dd4d4b1

File tree

10 files changed

+24
-16
lines changed

10 files changed

+24
-16
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

parser.py renamed to src/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import tokenizer
22

3-
from utils import utils
3+
import utils
44
from constants import contentModelFlags, spaceCharacters
55
from constants import scopingElements, formattingElements, specialElements
66
from constants import headingElements, tableInsertModeElements

tokenizer.py renamed to src/tokenizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def entitiesStartingWith(name):
325325
entityName = possibleEntityName
326326
break
327327

328-
if entityName:
328+
if entityName is not None:
329329
char = entities[entityName]
330330

331331
# Check whether or not the last character returned can be
File renamed without changes.

mockParser.py renamed to tests/mockParser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import sys, hotshot, hotshot.stats
2+
import os
3+
4+
#Allow us to import from the src directory
5+
os.chdir(os.path.split(os.path.abspath(__file__))[0])
6+
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
27

38
from tokenizer import HTMLTokenizer
49

tests/simple_parser.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
2-
from test_parser import *
3-
import sys, os
1+
2+
from test_parser import *
3+
import sys, os
4+
45
os.chdir(os.path.split(os.path.abspath(__file__))[0])
5-
sys.path.insert(0, os.path.abspath(os.pardir))
6-
import parser
7-
6+
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
7+
8+
9+
import parser
10+
811
if __name__ == "__main__":
9-
x = ""
12+
x = ""
1013
if len(sys.argv) > 1:
11-
x = sys.argv[1]
12-
else:
13-
x = "x"
14+
x = sys.argv[1]
15+
else:
16+
x = "x"
1417
p = parser.HTMLParser()
15-
document = p.parse(StringIO.StringIO(x))
16-
print convertTreeDump(document.printTree())
18+
document = p.parse(StringIO.StringIO(x))
19+
print convertTreeDump(document.printTree())

tests/test_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ def main():
8888
if __name__ == "__main__":
8989
#Allow us to import the parent module
9090
os.chdir(os.path.split(os.path.abspath(__file__))[0])
91-
sys.path.insert(0, os.path.abspath(os.pardir))
91+
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
9292

9393
main()

tests/test_tokenizer.py

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

1010
#Allow us to import the parent module
1111
os.chdir(os.path.split(os.path.abspath(__file__))[0])
12-
sys.path.insert(0, os.path.abspath(os.pardir))
12+
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
1313

1414
from tokenizer import HTMLTokenizer
1515

0 commit comments

Comments
 (0)