Skip to content

Commit 679f808

Browse files
committed
Change to built in set type where avaliable
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40333
1 parent f0ae1bc commit 679f808

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

src/constants.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import string
22

33
try:
4+
type(frozenset)
5+
except NameError:
6+
#Import from the sets module for python 2.3
7+
from sets import Set as set
48
from sets import ImmutableSet as frozenset
5-
except:
6-
pass
79

810
EOF = None
911

@@ -127,14 +129,15 @@
127129
digits = frozenset(string.digits)
128130
hexDigits = frozenset(string.hexdigits)
129131

130-
headingElements = frozenset((
132+
#Heading elements need to be ordered
133+
headingElements = (
131134
"h1",
132135
"h2",
133136
"h3",
134137
"h4",
135138
"h5",
136139
"h6"
137-
))
140+
)
138141

139142
# XXX What about event-source and command?
140143
voidElements = frozenset((

src/tokenizer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
try:
2+
type(frozenset)
3+
except NameError:
4+
#Import from the sets module for python 2.3
5+
from sets import Set as set
26
from sets import ImmutableSet as frozenset
3-
except:
4-
pass
57

68
from constants import contentModelFlags, spaceCharacters
79
from constants import entitiesWindows1252, entities, voidElements

src/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
try:
2+
type(frozenset)
3+
except NameError:
4+
#Import from the sets module for python 2.3
5+
from sets import Set as set
26
from sets import ImmutableSet as frozenset
3-
except:
4-
pass
57

68
class MethodDispatcher(dict):
79
"""Dict with 2 special properties:

0 commit comments

Comments
 (0)