library_singleton.py 文件源码

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

项目:nimi-python 作者: ni 项目源码 文件源码
def get():
    '''get

    Returns the library.Library singleton for nidcpower.
    '''
    global _instance
    global _instance_lock

    with _instance_lock:
        if _instance is None:
            try:
                library_type = _get_library_type()
                if library_type == 'windll':
                    ctypes_library = ctypes.WinDLL(_get_library_name())
                else:
                    assert library_type == 'cdll'
                    ctypes_library = ctypes.CDLL(_get_library_name())
            except OSError:
                raise errors.DriverNotInstalledError()
            _instance = library.Library(ctypes_library)
        return _instance
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号