def _unwatchFD(self, fd, descr, flag):
        """
        Unregister a file descriptor with the L{CFRunLoop}, or modify its state
        so that it's listening for only one notification (read or write) as
        opposed to both; used to implement C{removeReader} and C{removeWriter}.

        @param fd: a file descriptor

        @type fd: C{int}

        @param descr: an L{IReadDescriptor} or L{IWriteDescriptor}

        @param flag: L{kCFSocketWriteCallBack} L{kCFSocketReadCallBack}
        """
        if self._idmap not in id(descr):
            return
        if fd == -1:
            # need to deal with it in this case, I think.
            realfd = self._idmap[id(descr)]
        else:
            realfd = fd
        src, cfs, descr, rw = self._fdmap[realfd]
        CFSocketDisableCallBacks(cfs, flag)
        rw[self._flag2idx(flag)] = False
        if not rw[_READ] and not rw[_WRITE]:
            del self._idmap[id(descr)]
            del self._fdmap[realfd]
            CFRunLoopRemoveSource(self._cfrunloop, src, kCFRunLoopCommonModes)
            CFSocketInvalidate(cfs)
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/internet/cfreactor.py/CFReactor._unwatchFD/swapped operands of `not in`