def __openseen(self, ttype, tstring, lineno): if ((ttype == tokenize.OP and tstring == ')') or (ttype == tokenize.NAME and tstring == 'mapping')): # We've seen the last of the translatable strings. Record the # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. if self.__data or self.__msgid: if self.__default: msgid = self.__msgid default = self.__default elif self.__msgid: msgid = self.__msgid default = ''.join(self.__data) else: msgid = ''.join(self.__data) default = None self.__addentry(msgid, default) self.__state = self.__waiting elif ttype == tokenize.OP and tstring == ',': if not self.__msgid: self.__msgid = ''.join(self.__data) elif not self.__default: self.__default = ''.join(self.__data) self.__data = [] elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring))
def __openseen(self, ttype, tstring, lineno): if ((ttype == tokenize.OP and tstring == ')') or (ttype == tokenize.NAME and tstring == 'mapping')): # We've seen the last of the translatable strings. Record the # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. if self.__data or self.__msgid: if self.__default: msgid = self.__msgid default = self.__default elif self.__msgid: msgid = self.__msgid if self.__data: default = ''.join(self.__data) else: default = None else: msgid = ''.join(self.__data) default = None self.__addentry(msgid, default) self.__state = self.__waiting elif ttype == tokenize.OP and tstring == ',': if not self.__msgid: self.__msgid = ''.join(self.__data) elif not self.__default and self.__data: self.__default = ''.join(self.__data) self.__data = [] elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring))
def __suitedocstring(self, ttype, tstring, lineno): # ignore any intervening noise if ttype == tokenize.STRING: self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__state = self.__waiting elif ttype not in (tokenize.NEWLINE, tokenize.INDENT, tokenize.COMMENT): # there was no class docstring self.__state = self.__waiting