Back to index

python-biopython  1.60
Classes | Public Member Functions | Private Attributes
Bio.File.SGMLStripper Class Reference

List of all members.

Classes

class  MyParser

Public Member Functions

def __init__
def strip

Private Attributes

 _parser

Detailed Description

Object to strip SGML tags (OBSOLETE).

Definition at line 161 of file File.py.


Constructor & Destructor Documentation

Definition at line 170 of file File.py.

00170 
00171         def __init__(self):
00172             import warnings
00173             import Bio
00174             warnings.warn("This class is deprecated, and is likely to be removed in a future version of Biopython", Bio.BiopythonDeprecationWarning)
00175             self._parser = SGMLStripper.MyParser()

Here is the caller graph for this function:


Member Function Documentation

def Bio.File.SGMLStripper.strip (   self,
  str 
)
S.strip(str) -> string

Strip the SGML tags from str.

Definition at line 176 of file File.py.

00176 
00177         def strip(self, str):
00178             """S.strip(str) -> string
00179 
00180             Strip the SGML tags from str.
00181 
00182             """
00183             if not str:  # empty string, don't do anything.
00184                 return ''
00185             # I need to make sure that I don't return an empty string if
00186             # the buffer is not empty.  This can happen if there's a newline
00187             # character embedded within a tag.  Thus, I'll first check to
00188             # see if the last character is a newline.  If it is, and it's stripped
00189             # away, I'll add it back.
00190             is_newline = str[-1] in ['\n', '\r']
00191 
00192             self._parser.data = ''    # clear the parser's data (don't reset)
00193             self._parser.feed(str)
00194             if self._parser.data:
00195                 str = self._parser.data
00196             elif is_newline:
00197                 str = '\n'
00198             else:
00199                 str = ''
00200             return str
00201 
00202 

Member Data Documentation

Definition at line 174 of file File.py.


The documentation for this class was generated from the following file: