parameter.py 文件源码

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

项目:flopymetascript 作者: bdestombe 项目源码 文件源码
def parse_list_str(ar, compres):
        """
        -1: unable to reduce in size
        1:  broadcastable array

        todo:
        for multiline array strings add extra space in line 2, 3..
        use array2string-prefix for this
        """
        # max_line_width = 80  # might set this to something different later
        # precision = 8
        # suppress_small = True  # to mask some rounding issues

        if compres == -1:
            pre = '['
            post = ']'
            ar_str = ', '.join([item.string for item in ar])
            string = pre + ar_str + post

        elif compres == 1:
            # l = np.unique(ar).size
            if len(ar) == 1:
                string = ar[0].string

            else:
                pre = str(len(ar)) + ' * ['
                post = ']'
                ar_str = ar[0].string
                string = pre + ar_str + post

        return string
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号