records.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:python-netsgiro 作者: otovo 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号