summaryrefslogtreecommitdiff
blob: 7bdff6815011188e173e414cb2697ee9020f3769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
--- HTMLcalendar.py
+++ HTMLcalendar.py
@@ -212,12 +212,12 @@
             return value
         else:
             raise TypeError, ('cannot convert to int', value)
-import regex
-datepat = regex.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field
+import re
+datepat = re.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field
                         '\([0-9][0-9]?\)[/-]?'    #second 2 char date field
                         '\([12][0-9][0-9][0-9]\)?[ \t]*:') #optional year field
-daypat  = regex.compile('^ *\('+string.join(day_name,'\|')+'\)')
-timepat = regex.compile('\([0-9][0-9]?\):\([0-9][0-9]\)')
+daypat  = re.compile('^ *\('+string.join(day_name,'\|')+'\)')
+timepat = re.compile('\([0-9][0-9]?\):\([0-9][0-9]\)')
 
 def read_appt_file(filename):
     """Parsing function.
--- HTMLgen.py
+++ HTMLgen.py
@@ -924,7 +924,7 @@
     def antispam(self, address):
         """Process a string with HTML encodings to defeat address spiders.
         """
-        from whrandom import choice
+        from random import choice
         buffer = map(None, address)
         for i in range(0, len(address), choice((2,3,4))):
             buffer[i] = '&#%d;' % ord(buffer[i])
--- HTMLtest.py
+++ HTMLtest.py
@@ -2,7 +2,7 @@
 
 """Test script which generates the online documentation for HTMLgen.
 """
-import string, regex, regsub, os, time, glob
+import string, re, re, os, time, glob
 from HTMLcolors import *
 from HTMLgen import *
 import HTMLgen  #only so I can pick off the __version__
@@ -232,11 +232,11 @@
     doc.email = 'jefferson@montecello.virginia.gov'
     doc.logo = ('../image/eagle21.gif', 64, 54)
     # parse Declaration of Independence
-    re_hline = regex.compile('^--+$')
-    re_title = regex.compile('^Title:\(.*$\)')
+    re_hline = re.compile('^--+$')
+    re_title = re.compile('^Title:\(.*$\)')
     font2 = Font(size='+2')
     s = open(os.path.join(datadir, 'DoI.txt')).read()
-    paragraphs = regsub.split(s, '\n\([\t ]*\n\)+')
+    paragraphs = re.split(s, '\n\([\t ]*\n\)+')
     for para in paragraphs:
         if not para: continue
         if re_title.search(para) > -1:
@@ -263,7 +263,7 @@
     #Ok parse that file
     f = open(mpath(os.path.join(datadir, 'parrot.txt')))
     line = f.readline()
-    re_dialog = regex.compile('\(^[OC].*:\)\(.*\)')
+    re_dialog = re.compile('\(^[OC].*:\)\(.*\)')
     while line:
         if re_dialog.search(line) > -1:
             role, prose = re_dialog.group(1,2)
--- HTMLutil.py
+++ HTMLutil.py
@@ -19,7 +19,7 @@
 # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 __version__ = '$Id: HTMLutil.py,v 1.3 1998/05/28 20:14:52 friedric Exp $'
-import string, regex, os
+import string, re, os
 import HTMLgen, HTMLcolors
 from types import *
 
@@ -79,7 +79,7 @@
     """Determine if the text have been marked by a previous gsub.
     (ugly hack but it works)
     """
-    if regex.search('\(</?FONT\)\|\(</?STRONG\)', text) > -1:
+    if re.search('\(</?FONT\)\|\(</?STRONG\)', text) > -1:
         return 1
     else: 
         return 0
@@ -125,13 +125,13 @@
 not_backslash = "[^\\\\]"
 triple_single = "'''"
 triple_double = '"""'
-_doc_start_re = regex.compile(
+_doc_start_re = re.compile(
     "\(^\|" + not_backslash + "\)" # bol or not backslash
     + "\(" + triple_single + "\|" + triple_double + "\)" )
 single_re = not_backslash + triple_single
 double_re = not_backslash + triple_double
-_triple_re = { triple_single : regex.compile(single_re),
-               triple_double : regex.compile(double_re) }
+_triple_re = { triple_single : re.compile(single_re),
+               triple_double : re.compile(double_re) }
 
 del not_backslash, triple_single, triple_double, \
     single_re, double_re
@@ -150,13 +150,13 @@
         return (None, None)
     return startquote, quotefinder.regs[0][1]
 
-string_re = regex.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)')
+string_re = re.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)')
 def find_string_literal( s, begin=0 ):
     if string_re.search(s, begin) > -1:
         return string_re.regs[1]
     return (None, None)
 
-comment_re = regex.compile('#.*$')
+comment_re = re.compile('#.*$')
 def find_comment( s, begin=0 ):
     while comment_re.search(s, begin) > -1:
         if been_marked(comment_re.group(0)):
@@ -166,13 +166,13 @@
     return (None, None)
 
 Name = '[a-zA-Z_][a-zA-Z0-9_]*'
-func_re = regex.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*(') 
+func_re = re.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*(') 
 def find_function( s, begin=0 ):
     if func_re.search(s, begin) > -1:
         return func_re.regs[1]
     return (None, None)
 
-class_re = regex.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]')
+class_re = re.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]')
 def find_class( s, begin=0 ):
     if class_re.search(s, begin) > -1:
         return class_re.regs[1]
--- ImagePaletteH.py
+++ ImagePaletteH.py
@@ -70,7 +70,7 @@
     return ImagePalette(mode, palette * len(mode))
 
 def random(mode = "RGB"):
-    from whrandom import randint
+    from random import randint
     palette = map(lambda a: randint(0, 255), [0]*256*len(mode))
     return ImagePalette(mode, palette)