docopt.py 文件源码

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

项目:alfred-mpd 作者: deanishe 项目源码 文件源码
def fix_repeating_arguments(self):
        """Fix elements that should accumulate/increment values."""
        either = [list(c.children) for c in self.either.children]
        for case in either:
            for e in [c for c in case if case.count(c) > 1]:
                if type(e) is Argument or type(e) is Option and e.argcount:
                    if e.value is None:
                        e.value = []
                    elif type(e.value) is not list:
                        e.value = e.value.split()
                if type(e) is Command or type(e) is Option and e.argcount == 0:
                    e.value = 0
        return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号