mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Use re in stead of regex, so we get rid of the annoying warning during startup.
This commit is contained in:
parent
2d0589be67
commit
9ad2752381
5 changed files with 54 additions and 47 deletions
|
@ -2,7 +2,7 @@ import aetools
|
|||
import Standard_Suite
|
||||
import Required_Suite
|
||||
import WWW_Suite
|
||||
import regex
|
||||
import re
|
||||
import W
|
||||
import macfs
|
||||
import os
|
||||
|
@ -29,16 +29,16 @@ app = W.getapplication()
|
|||
#SIGNATURE='MSIE' # MS Explorer
|
||||
SIGNATURE='MOSS' # Netscape
|
||||
|
||||
_titlepat = regex.compile('<title>\([^<]*\)</title>')
|
||||
_titlepat = re.compile('<title>\([^<]*\)</title>')
|
||||
|
||||
def sucktitle(path):
|
||||
f = open(path)
|
||||
text = f.read(1024) # assume the title is in the first 1024 bytes
|
||||
f.close()
|
||||
lowertext = string.lower(text)
|
||||
if _titlepat.search(lowertext) > 0:
|
||||
a, b = _titlepat.regs[1]
|
||||
return text[a:b]
|
||||
matcher = _titlepat.search(lowertext)
|
||||
if matcher:
|
||||
return matcher.group(1)
|
||||
return path
|
||||
|
||||
def verifydocpath(docpath):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue