naming.py 文件源码

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

项目:microcosm-flask 作者: globality-corp 项目源码 文件源码
def name_for(obj):
    """
    Get a name for something.

    Allows overriding of default names using the `__alias__` attribute.

    """
    if isinstance(obj, string_types):
        return obj

    cls = obj if isclass(obj) else obj.__class__

    if hasattr(cls, "__alias__"):
        return underscore(cls.__alias__)
    else:
        return underscore(cls.__name__)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号