Logo Search packages:      
Sourcecode: pymol version File versions

def chempy::cex::CEXstream::readEntry (   self  ) 

Read one tag<value> entry from stream

Definition at line 41 of file cex.py.

00041                          :
            """Read one tag<value> entry from stream"""
            # find nonblank character
            str = ""
            p = 0
            while 1:
                  try:
                        if self.buff[p] not in string.whitespace:
                              break
                        p = p + 1
                  except IndexError:
                        self.buff = self.file.read(1000)
                        p = 0
                        if len(self.buff) == 0:
                              return (None, None)
            self.buff = self.buff[p:]
            if self.buff[0] == "|":
                  self.buff = self.buff[1:]
                  return ("|","")
            while 1:
                  try:
                        while 1:
                              p = string.index(self.buff,">") + 1
                              str = str + self.buff[:p]
                              self.buff = self.buff[p:]
                              if string.count(str,'"') %2 == 0:
                                    break
                  except (ValueError, IndexError):
                        str = str + self.buff
                        self.buff = self.file.read(1000)
                        if len(self.buff)==0:
                              if string.find(str,"|") >= 0:
                                    return ("|","")
                              else:
                                    return (None, None)
                  else: break 
            s = string.find(str,"<")
            if s < 0:
                  return (None, None)
            else:
                  return (str[:s],str[s+1:-1])
            
class CEXsmilesError(Exception):


Generated by  Doxygen 1.6.0   Back to index