kvstore_json.py 文件源码

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

项目:coretools 作者: iotile 项目源码 文件源码
def __init__(self, name, folder=None, respect_venv=False):
        if folder is None:
            folder = JSONKVStore.DefaultFolder

        #If we are relative to a virtual environment, place the registry into that virtual env
        #Support both virtualenv and pythnon 3 venv
        if respect_venv and hasattr(sys, 'real_prefix'):
            folder = sys.prefix
        elif respect_venv and hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix:
            folder = sys.prefix

        if not os.path.exists(folder):
            os.makedirs(folder, 0755)

        jsonfile = os.path.join(folder, name)

        self.file = jsonfile
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号