Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 278167
Collapse All | Expand All

(-)file_not_specified_in_diff (-25 / +25 lines)
Line  Link Here
0
-- HTMLcalendar.py
0
++ HTMLcalendar.py
Lines 212-223 Link Here
212
            return value
212
            return value
213
        else:
213
        else:
214
            raise TypeError, ('cannot convert to int', value)
214
            raise TypeError, ('cannot convert to int', value)
215
import regex
215
import re
216
datepat = regex.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field
216
datepat = re.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field
217
                        '\([0-9][0-9]?\)[/-]?'    #second 2 char date field
217
                        '\([0-9][0-9]?\)[/-]?'    #second 2 char date field
218
                        '\([12][0-9][0-9][0-9]\)?[ \t]*:') #optional year field
218
                        '\([12][0-9][0-9][0-9]\)?[ \t]*:') #optional year field
219
daypat  = regex.compile('^ *\('+string.join(day_name,'\|')+'\)')
219
daypat  = re.compile('^ *\('+string.join(day_name,'\|')+'\)')
220
timepat = regex.compile('\([0-9][0-9]?\):\([0-9][0-9]\)')
220
timepat = re.compile('\([0-9][0-9]?\):\([0-9][0-9]\)')
221
221
222
def read_appt_file(filename):
222
def read_appt_file(filename):
223
    """Parsing function.
223
    """Parsing function.
224
-- HTMLgen.py
224
++ HTMLgen.py
Lines 924-930 Link Here
924
    def antispam(self, address):
924
    def antispam(self, address):
925
        """Process a string with HTML encodings to defeat address spiders.
925
        """Process a string with HTML encodings to defeat address spiders.
926
        """
926
        """
927
        from whrandom import choice
927
        from random import choice
928
        buffer = map(None, address)
928
        buffer = map(None, address)
929
        for i in range(0, len(address), choice((2,3,4))):
929
        for i in range(0, len(address), choice((2,3,4))):
930
            buffer[i] = '&#%d;' % ord(buffer[i])
930
            buffer[i] = '&#%d;' % ord(buffer[i])
931
-- HTMLtest.py
931
++ HTMLtest.py
Lines 2-8 Link Here
2
2
3
"""Test script which generates the online documentation for HTMLgen.
3
"""Test script which generates the online documentation for HTMLgen.
4
"""
4
"""
5
import string, regex, regsub, os, time, glob
5
import string, re, re, os, time, glob
6
from HTMLcolors import *
6
from HTMLcolors import *
7
from HTMLgen import *
7
from HTMLgen import *
8
import HTMLgen  #only so I can pick off the __version__
8
import HTMLgen  #only so I can pick off the __version__
Lines 232-242 Link Here
232
    doc.email = 'jefferson@montecello.virginia.gov'
232
    doc.email = 'jefferson@montecello.virginia.gov'
233
    doc.logo = ('../image/eagle21.gif', 64, 54)
233
    doc.logo = ('../image/eagle21.gif', 64, 54)
234
    # parse Declaration of Independence
234
    # parse Declaration of Independence
235
    re_hline = regex.compile('^--+$')
235
    re_hline = re.compile('^--+$')
236
    re_title = regex.compile('^Title:\(.*$\)')
236
    re_title = re.compile('^Title:\(.*$\)')
237
    font2 = Font(size='+2')
237
    font2 = Font(size='+2')
238
    s = open(os.path.join(datadir, 'DoI.txt')).read()
238
    s = open(os.path.join(datadir, 'DoI.txt')).read()
239
    paragraphs = regsub.split(s, '\n\([\t ]*\n\)+')
239
    paragraphs = re.split(s, '\n\([\t ]*\n\)+')
240
    for para in paragraphs:
240
    for para in paragraphs:
241
        if not para: continue
241
        if not para: continue
242
        if re_title.search(para) > -1:
242
        if re_title.search(para) > -1:
Lines 263-269 Link Here
263
    #Ok parse that file
263
    #Ok parse that file
264
    f = open(mpath(os.path.join(datadir, 'parrot.txt')))
264
    f = open(mpath(os.path.join(datadir, 'parrot.txt')))
265
    line = f.readline()
265
    line = f.readline()
266
    re_dialog = regex.compile('\(^[OC].*:\)\(.*\)')
266
    re_dialog = re.compile('\(^[OC].*:\)\(.*\)')
267
    while line:
267
    while line:
268
        if re_dialog.search(line) > -1:
268
        if re_dialog.search(line) > -1:
269
            role, prose = re_dialog.group(1,2)
269
            role, prose = re_dialog.group(1,2)
270
-- HTMLutil.py
270
++ HTMLutil.py
Lines 19-25 Link Here
19
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
# PERFORMANCE OF THIS SOFTWARE.
20
# PERFORMANCE OF THIS SOFTWARE.
21
__version__ = '$Id: HTMLutil.py,v 1.3 1998/05/28 20:14:52 friedric Exp $'
21
__version__ = '$Id: HTMLutil.py,v 1.3 1998/05/28 20:14:52 friedric Exp $'
22
import string, regex, os
22
import string, re, os
23
import HTMLgen, HTMLcolors
23
import HTMLgen, HTMLcolors
24
from types import *
24
from types import *
25
25
Lines 79-85 Link Here
79
    """Determine if the text have been marked by a previous gsub.
79
    """Determine if the text have been marked by a previous gsub.
80
    (ugly hack but it works)
80
    (ugly hack but it works)
81
    """
81
    """
82
    if regex.search('\(</?FONT\)\|\(</?STRONG\)', text) > -1:
82
    if re.search('\(</?FONT\)\|\(</?STRONG\)', text) > -1:
83
        return 1
83
        return 1
84
    else: 
84
    else: 
85
        return 0
85
        return 0
Lines 125-137 Link Here
125
not_backslash = "[^\\\\]"
125
not_backslash = "[^\\\\]"
126
triple_single = "'''"
126
triple_single = "'''"
127
triple_double = '"""'
127
triple_double = '"""'
128
_doc_start_re = regex.compile(
128
_doc_start_re = re.compile(
129
    "\(^\|" + not_backslash + "\)" # bol or not backslash
129
    "\(^\|" + not_backslash + "\)" # bol or not backslash
130
    + "\(" + triple_single + "\|" + triple_double + "\)" )
130
    + "\(" + triple_single + "\|" + triple_double + "\)" )
131
single_re = not_backslash + triple_single
131
single_re = not_backslash + triple_single
132
double_re = not_backslash + triple_double
132
double_re = not_backslash + triple_double
133
_triple_re = { triple_single : regex.compile(single_re),
133
_triple_re = { triple_single : re.compile(single_re),
134
               triple_double : regex.compile(double_re) }
134
               triple_double : re.compile(double_re) }
135
135
136
del not_backslash, triple_single, triple_double, \
136
del not_backslash, triple_single, triple_double, \
137
    single_re, double_re
137
    single_re, double_re
Lines 150-162 Link Here
150
        return (None, None)
150
        return (None, None)
151
    return startquote, quotefinder.regs[0][1]
151
    return startquote, quotefinder.regs[0][1]
152
152
153
string_re = regex.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)')
153
string_re = re.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)')
154
def find_string_literal( s, begin=0 ):
154
def find_string_literal( s, begin=0 ):
155
    if string_re.search(s, begin) > -1:
155
    if string_re.search(s, begin) > -1:
156
        return string_re.regs[1]
156
        return string_re.regs[1]
157
    return (None, None)
157
    return (None, None)
158
158
159
comment_re = regex.compile('#.*$')
159
comment_re = re.compile('#.*$')
160
def find_comment( s, begin=0 ):
160
def find_comment( s, begin=0 ):
161
    while comment_re.search(s, begin) > -1:
161
    while comment_re.search(s, begin) > -1:
162
        if been_marked(comment_re.group(0)):
162
        if been_marked(comment_re.group(0)):
Lines 166-178 Link Here
166
    return (None, None)
166
    return (None, None)
167
167
168
Name = '[a-zA-Z_][a-zA-Z0-9_]*'
168
Name = '[a-zA-Z_][a-zA-Z0-9_]*'
169
func_re = regex.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*(') 
169
func_re = re.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*(') 
170
def find_function( s, begin=0 ):
170
def find_function( s, begin=0 ):
171
    if func_re.search(s, begin) > -1:
171
    if func_re.search(s, begin) > -1:
172
        return func_re.regs[1]
172
        return func_re.regs[1]
173
    return (None, None)
173
    return (None, None)
174
174
175
class_re = regex.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]')
175
class_re = re.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]')
176
def find_class( s, begin=0 ):
176
def find_class( s, begin=0 ):
177
    if class_re.search(s, begin) > -1:
177
    if class_re.search(s, begin) > -1:
178
        return class_re.regs[1]
178
        return class_re.regs[1]
179
-- ImagePaletteH.py
179
++ ImagePaletteH.py
Lines 70-76 Link Here
70
    return ImagePalette(mode, palette * len(mode))
70
    return ImagePalette(mode, palette * len(mode))
71
71
72
def random(mode = "RGB"):
72
def random(mode = "RGB"):
73
    from whrandom import randint
73
    from random import randint
74
    palette = map(lambda a: randint(0, 255), [0]*256*len(mode))
74
    palette = map(lambda a: randint(0, 255), [0]*256*len(mode))
75
    return ImagePalette(mode, palette)
75
    return ImagePalette(mode, palette)
76
76

Return to bug 278167