usb1.py 文件源码

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

项目:sc-controller 作者: kozec 项目源码 文件源码
def __init__(self, context, handle, device):
        """
        You should not instanciate this class directly.
        Call "open" method on an USBDevice instance to get an USBDeviceHandle
        instance.
        """
        self.__context = context
        # Weak reference to transfers about this device so we can clean up
        # before closing device.
        self.__transfer_set = WeakSet()
        # Strong references to inflight transfers so they do not get freed
        # even if user drops all strong references to them. If this instance
        # is garbage-collected, we close all transfers, so it's fine.
        self.__inflight = inflight = set()
        # XXX: For some reason, doing self.__inflight.{add|remove} inside
        # getTransfer causes extra intermediate python objects for each
        # allocated transfer. Storing them as properties solves this. Found
        # with objgraph.
        self.__inflight_add = inflight.add
        self.__inflight_remove = inflight.remove
        self.__handle = handle
        self.__device = device
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号