def __parse_stream(self, stream):
        """Generic method to parse mailmap streams"""

        nline = 0
        lines = stream.split('\n')

        for line in lines:
            nline += 1

            # Ignore blank lines and comments
            m = re.match(self.LINES_TO_IGNORE_REGEX, line, re.UNICODE)
            if m:
                continue

            line = line.strip('\n').strip(' ')
            parts = line.split('>')

            if len(parts) == 0:
                cause = "line %s: invalid format" % str(nline)
                raise InvalidFormatError(cause=cause)

            aliases = []

            for part in parts:
                part = part.replace(',', ' ')
                part = part.strip('\n').strip(' ')

                if len(part) == 0:
                    continue

                if part.find('<') < 0:
                    cause = "line %s: invalid format" % str(nline)
                    raise InvalidFormatError(cause=cause)

                alias = email.utils.parseaddr(part + '>')
                aliases.append(alias)

            yield aliases
def __parse_stream ( self , stream ) : nline = 0 lines = stream . split ( '\n' ) for line in lines : nline += 1 m = re . match ( self . LINES_TO_IGNORE_REGEX , line , re . UNICODE ) if m : continue line = line . strip ( '\n' ) . strip ( ' ' ) parts = line . split ( '>' ) if len ( parts ) == 0 : cause = "line %s: invalid format" % str ( nline ) raise InvalidFormatError ( cause = cause ) aliases = [ ] for part in parts : part = part . replace ( ',' , ' ' ) part = part . strip ( '\n' ) . strip ( ' ' ) if len ( part ) == 0 : continue if part . find ( '<' ) < 0 : cause = "line %s: invalid format" % str ( nline ) raise InvalidFormatError ( cause = cause ) alias = email . utils . parseaddr ( part + '>' ) aliases . append ( alias ) yield aliases
Generic method to parse mailmap streams