Skip to content

Commit 71384d4

Browse files
committed
Try cElementTree
1 parent 3c836e7 commit 71384d4

File tree

18 files changed

+75
-23
lines changed

18 files changed

+75
-23
lines changed

scan/client/data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
44
@author: Yongxiang Qiu, Kay Kasemir
55
'''
6-
import xml.etree.ElementTree as ET
6+
try:
7+
import xml.etree.cElementTree as ET
8+
except:
9+
import xml.etree.ElementTree as ET
710
from datetime import datetime
811

912
def getTimeSeries(data, name, convert='plain'):

scan/client/logdata.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
"""Log Data Support
22
"""
33

4-
import xml.etree.ElementTree as ET
4+
try:
5+
import xml.etree.cElementTree as ET
6+
except:
7+
import xml.etree.ElementTree as ET
58

69
from datetime import datetime
710

scan/client/scanclient.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
'''
66

77
import time
8-
import xml.etree.ElementTree as ET
8+
try:
9+
import xml.etree.cElementTree as ET
10+
except:
11+
import xml.etree.ElementTree as ET
912
import urllib
1013
from scan.client.logdata import parseXMLData
1114
from scan.commands.commandsequence import CommandSequence

scan/commands/commandsequence.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
44
@author: qiuyx
55
'''
6-
import xml.etree.ElementTree as ET
6+
try:
7+
import xml.etree.cElementTree as ET
8+
except:
9+
import xml.etree.ElementTree as ET
710

811
from scan.commands.command import Command
912
from scan.util.xml_helper import indent

scan/commands/comment.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
@author: qiuyx
55
'''
66
from scan.commands.command import Command
7-
import xml.etree.ElementTree as ET
7+
try:
8+
import xml.etree.cElementTree as ET
9+
except:
10+
import xml.etree.ElementTree as ET
811

912
class Comment(Command):
1013
"""Comment
@@ -26,4 +29,4 @@ def __repr__(self):
2629
return "Comment('%s')" % self.__text
2730

2831

29-
32+

scan/commands/configlog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
'''
55
from string import lower
66
from scan.commands.command import Command
7-
import xml.etree.ElementTree as ET
7+
try:
8+
import xml.etree.cElementTree as ET
9+
except:
10+
import xml.etree.ElementTree as ET
811

912
class ConfigLog(Command):
1013
"""Config automatic logging.

scan/commands/delay.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
@author: qiuyx
55
'''
66
from scan.commands.command import Command
7-
import xml.etree.ElementTree as ET
7+
try:
8+
import xml.etree.cElementTree as ET
9+
except:
10+
import xml.etree.ElementTree as ET
811

912
class Delay(Command):
1013
"""Delay for a fixed amount of time

scan/commands/iff.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from scan.commands.command import Command
2-
import xml.etree.ElementTree as ET
2+
try:
3+
import xml.etree.cElementTree as ET
4+
except:
5+
import xml.etree.ElementTree as ET
36

47
class If(Command):
58
"""Conditionally execute commands.

scan/commands/include.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
@author: qiuyx
55
'''
66
from scan.commands.command import Command
7-
import xml.etree.ElementTree as ET
7+
try:
8+
import xml.etree.cElementTree as ET
9+
except:
10+
import xml.etree.ElementTree as ET
811

912
class Include(Command):
1013
"""Include another scan.
@@ -45,4 +48,4 @@ def __repr__(self):
4548
result += ", errhandler='%s'" % self.__errHandler
4649
result += ")"
4750
return result
48-
51+

scan/commands/log.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
@author: qiuyx
55
'''
66
from scan.commands.command import Command
7-
import xml.etree.ElementTree as ET
7+
try:
8+
import xml.etree.cElementTree as ET
9+
except:
10+
import xml.etree.ElementTree as ET
811

912
class Log(Command):
1013
"""Log current value of one or more devices.
@@ -59,4 +62,4 @@ def __repr__(self):
5962
result += ", errhandler='%s'" % self.__errHandler
6063
result += ')'
6164
return result
62-
65+

0 commit comments

Comments
 (0)