[Zope-Checkins] CVS: Zope/lib/python/HelpSys - APIHelpTopic.py:1.14 HelpTopic.py:1.16 HelpUtil.py:1.11 ObjectRef.py:1.9
Andreas Jung
andreas@digicool.com
Thu, 7 Feb 2002 12:54:13 -0500
Update of /cvs-repository/Zope/lib/python/HelpSys
In directory cvs.zope.org:/tmp/cvs-serv22156
Modified Files:
APIHelpTopic.py HelpTopic.py HelpUtil.py ObjectRef.py
Log Message:
replaced string module calls by string methods
=== Zope/lib/python/HelpSys/APIHelpTopic.py 1.13 => 1.14 ===
import types
-import string
import HelpTopic
from Globals import DTMLFile, Persistent
@@ -59,12 +58,12 @@
# try to get title from first non-blank line
# of module docstring
if not self.title:
- lines=string.split(self.doc,'\n')
+ lines=self.doc.split('\n')
while 1:
- line=string.strip(lines[0])
+ line=lines[0].strip()
if line:
# get rid of anything after a colon in the line
- self.title=string.split(line, ':')[0]
+ self.title=line.split(':')[0]
break
lines.pop(0)
if not lines:
@@ -140,7 +139,7 @@
if hasattr(klass,'__extends__'):
self.extends=[]
for base in klass.__extends__:
- names=string.split(base, '.')
+ names=base.split( '.')
url="%s/Help/%s.py#%s" % (names[0], names[1], names[2])
self.extends.append((names[2], url))
@@ -255,20 +254,20 @@
Trims a doc string to make it format
correctly with structured text.
"""
- text=string.strip(text)
- text=string.replace(text, '\r\n', '\n')
- lines=string.split(text, '\n')
+ text=text.strip()
+ text=text.replace( '\r\n', '\n')
+ lines=text.split('\n')
nlines=[lines[0]]
if len(lines) > 1:
min_indent=None
for line in lines[1:]:
if not line:
continue
- indent=len(line) - len(string.lstrip(line))
+ indent=len(line) - len(line.lstrip())
if indent < min_indent or min_indent is None:
min_indent=indent
for line in lines[1:]:
nlines.append(line[min_indent:])
- return string.join(nlines, '\n')
+ return '\n'.join(nlines)
=== Zope/lib/python/HelpSys/HelpTopic.py 1.15 => 1.16 ===
from OFS.PropertyManager import PropertyManager
import os.path
-import string
import Globals
class HelpTopicBase:
@@ -71,7 +70,7 @@
def url(self):
"URL for indexing purposes"
- return string.join(self.getPhysicalPath(), '/')
+ return '/'.join(self.getPhysicalPath())
# Private indexing methods
# ------------------------
=== Zope/lib/python/HelpSys/HelpUtil.py 1.10 => 1.11 ===
import Globals, Acquisition
import StructuredText.StructuredText
-import sys, os, string, re
+import sys, os, re
stx_class=StructuredText.StructuredText.HTML
@@ -70,11 +70,11 @@
def get_docstring_html(self):
doc=self.get_docstring()
- if string.find(doc, '\n\n') > -1:
- doc=string.split(doc, '\n\n')
+ if doc.find('\n\n') > -1:
+ doc=doc.split('\n\n')
if len(doc) > 1:
- doc[1]=string.strip(doc[1])
- doc=string.join(doc, '\n\n')
+ doc[1]=doc[1].strip()
+ doc='\n\n'.join(doc)
return str(stx_class(doc))
@@ -233,7 +233,7 @@
if hasattr(func, '__doc__'):
doc=func.__doc__
if not doc: doc=''
- doc=string.strip(doc)
+ doc=doc.strip()
if hasattr(func, 'func_code'):
if hasattr(func.func_code, 'co_varnames'):
return doc
@@ -268,14 +268,14 @@
if method: args=args[1:]
if name=='__call__':
name='Call Operation'
- return '%s(%s)' % (name, string.join(args,', '))
+ return '%s(%s)' % (name, ', '.join(args))
# Other functions - look for something that smells like
# a signature at the beginning of the docstring.
if hasattr(func, '__doc__'):
doc=func.__doc__
if not doc: doc=''
- doc=string.strip(doc)
+ doc=doc.strip()
mo=sig_match(doc)
if mo is not None:
return doc[:mo.end(0)]
=== Zope/lib/python/HelpSys/ObjectRef.py 1.8 => 1.9 ===
-import sys, os, string, Globals, Acquisition
+import sys, os, Globals, Acquisition
from HelpUtil import HelpBase, classobject
from HelpUtil import is_class, is_module
from Globals import DTMLFile