call.py 文件源码

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

项目:rcli 作者: contains-io 项目源码 文件源码
def _normalize(args):
    # type: (Dict[str, Any]) -> Generator[Tuple[str, str, Any], None, None]
    """Yield a 3-tuple containing the key, a normalized key, and the value.

    Args:
        args:  The arguments parsed by docopt.

    Yields:
        A 3-tuple that contains the docopt parameter name, the parameter name
        normalized to be a valid python identifier, and the value assigned to
        the parameter.
    """
    for k, v in six.iteritems(args):
        nk = re.sub(r'\W|^(?=\d)', '_', k).strip('_').lower()
        do_not_shadow = dir(six.moves.builtins)  # type: ignore
        if keyword.iskeyword(nk) or nk in do_not_shadow:
            nk += '_'
        _LOGGER.debug('Normalized "%s" to "%s".', k, nk)
        yield k, nk, v
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号