def to_text(cls, records: Sequence['TransactionSpecification']) -> str:
"""Get a text string from a sequence of specification records."""
if len(records) > cls._MAX_RECORDS:
raise ValueError(
'Max {} specification records allowed, got {}'
.format(cls._MAX_RECORDS, len(records)))
tuples = sorted([
(r.line_number, r.column_number, r)
for r in records
])
text = ''
for _, column, specification in tuples:
text += specification.text
if column == cls._MAX_COLUMNS:
text += '\n'
return text
评论列表
文章目录