python类c_longlong()的实例源码

misc.py 文件源码 项目:download-manager 作者: thispc 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def fsbsize(path):
    """
    Get optimal file system buffer size (in bytes) for I/O calls
    """
    path = encode(path)

    if os.name == "nt":
        import ctypes

        drive = "%s\\" % os.path.splitdrive(path)[0]
        cluster_sectors, sector_size = ctypes.c_longlong(0)

        ctypes.windll.kernel32.GetDiskFreeSpaceW(ctypes.c_wchar_p(drive),
                                                 ctypes.pointer(
                                                     cluster_sectors),
                                                 ctypes.pointer(sector_size),
                                                 None,
                                                 None)
        return cluster_sectors * sector_size

    else:
        return os.statvfs(path).f_frsize
misc.py 文件源码 项目:pyload-plugins 作者: pyload 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def fsbsize(path):
    """
    Get optimal file system buffer size (in bytes) for I/O calls
    """
    path = encode(path)

    if os.name == "nt":
        import ctypes

        drive = "%s\\" % os.path.splitdrive(path)[0]
        cluster_sectors, sector_size = ctypes.c_longlong(0)

        ctypes.windll.kernel32.GetDiskFreeSpaceW(ctypes.c_wchar_p(drive),
                                                 ctypes.pointer(
                                                     cluster_sectors),
                                                 ctypes.pointer(sector_size),
                                                 None,
                                                 None)
        return cluster_sectors * sector_size

    else:
        return os.statvfs(path).f_frsize
parallel.py 文件源码 项目:ucasAutoLog 作者: CheerL 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def kill_thread(thread=None, name=None, tid=0, exctype=SystemExit):
    """raises the exception, performs cleanup if needed"""
    if name:
        thread = search_thread(name=name, part=True)
    if thread and isinstance(thread, threading.Thread):
        if not thread.is_alive():
            return '??????'
        tid = thread.ident
    if not tid:
        return '?????'
    if not isinstance(tid, ctypes.c_longlong):
        tid = ctypes.c_longlong(tid)
    if not inspect.isclass(exctype):
        raise TypeError("Only types can be raised (not instances)")
    res = ctypes.pythonapi.PyThreadState_SetAsyncExc(
        tid, ctypes.py_object(exctype))
    if res == 0:
        raise ValueError("invalid thread id")
    elif res != 1:
        # """if it returns a number greater than one, you're in trouble,
        # and you should call it again with exc=NULL to revert the effect"""
        ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, 0)
        raise SystemError("PyThreadState_SetAsyncExc failed")
alttab.py 文件源码 项目:Packages 作者: Keypirinha 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def list_alttab_windows(cls):
        """
        Return the list of the windows handles that are currently guessed to be
        eligible to the Alt+Tab panel.
        Raises a OSError exception on error.
        """
        # LPARAM is defined as LONG_PTR (signed type)
        if ctypes.sizeof(ctypes.c_long) == ctypes.sizeof(ctypes.c_void_p):
            LPARAM = ctypes.c_long
        elif ctypes.sizeof(ctypes.c_longlong) == ctypes.sizeof(ctypes.c_void_p):
            LPARAM = ctypes.c_longlong
        EnumWindowsProc = ctypes.WINFUNCTYPE(
                                ctypes.c_bool, ctypes.c_void_p, LPARAM)

        def _enum_proc(hwnd, lparam):
            try:
                if cls.is_alttab_window(hwnd):
                    handles.append(hwnd)
            except OSError:
                pass
            return True

        handles = []
        ctypes.windll.user32.EnumWindows(EnumWindowsProc(_enum_proc), 0)
        return handles
recipe-578531.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _copyData(self, archiveR, archiveW):
    ''' '''
    r    = ctypes.c_int()
    buff = ctypes.c_void_p()
    size = ctypes.c_int()
    offs = ctypes.c_longlong()

    while True:
      # Read in a block
      r = self._readDataBlock(
        archiveR,           # Archive (reading)
        ctypes.byref(buff), # Buffer pointer
        ctypes.byref(size), # Size pointer
        ctypes.byref(offs)) # Offset pointer

      # Check ourselves
      if r == self.ARCH_EOF:
        return self.ARCH_OK
      if r != self.ARCH_OK:
        return r

      # Write out a block
      r = self._writeDataBlock(
        archiveW, # Archive (writing)
        buff,     # Buffer data
        size,     # Size data
        offs)     # Offset data

      # And check ourselves again
      if r != self.ARCH_OK:
        print(self._errorString(archiveB))
        return r
vlc.py 文件源码 项目:AlexaOPi 作者: dony71 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def libvlc_media_get_duration(p_md):
    '''Get duration (in ms) of media descriptor object item.
    @param p_md: media descriptor object.
    @return: duration of media item or -1 on error.
    '''
    f = _Cfunctions.get('libvlc_media_get_duration', None) or \
        _Cfunction('libvlc_media_get_duration', ((1,),), None,
                    ctypes.c_longlong, Media)
    return f(p_md)
vlc.py 文件源码 项目:AlexaOPi 作者: dony71 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_length(p_mi):
    '''Get the current movie length (in ms).
    @param p_mi: the Media Player.
    @return: the movie length (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_length', None) or \
        _Cfunction('libvlc_media_player_get_length', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:AlexaOPi 作者: dony71 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_time(p_mi):
    '''Get the current movie time (in ms).
    @param p_mi: the Media Player.
    @return: the movie time (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_time', None) or \
        _Cfunction('libvlc_media_player_get_time', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:AlexaOPi 作者: dony71 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def libvlc_media_player_set_time(p_mi, i_time):
    '''Set the movie time (in ms). This has no effect if no media is being played.
    Not all formats and protocols support this.
    @param p_mi: the Media Player.
    @param i_time: the movie time (in ms).
    '''
    f = _Cfunctions.get('libvlc_media_player_set_time', None) or \
        _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None,
                    None, MediaPlayer, ctypes.c_longlong)
    return f(p_mi, i_time)
_internal.py 文件源码 项目:radar 作者: amoose136 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _getintp_ctype():
    val = _getintp_ctype.cache
    if val is not None:
        return val
    char = dtype('p').char
    if (char == 'i'):
        val = ctypes.c_int
    elif char == 'l':
        val = ctypes.c_long
    elif char == 'q':
        val = ctypes.c_longlong
    else:
        val = ctypes.c_long
    _getintp_ctype.cache = val
    return val
ringbuffer.py 文件源码 项目:ringbuffer 作者: bslatkin 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self, slot_count, *, start=None):
        default = start if start is not None else 0
        self.counter = multiprocessing.RawValue(ctypes.c_longlong, default)
        self.position = Position(slot_count)
vlc.py 文件源码 项目:sublime-Mp3Player 作者: RachitKansal 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def libvlc_media_get_duration(p_md):
    '''Get duration (in ms) of media descriptor object item.
    @param p_md: media descriptor object.
    @return: duration of media item or -1 on error.
    '''
    f = _Cfunctions.get('libvlc_media_get_duration', None) or \
        _Cfunction('libvlc_media_get_duration', ((1,),), None,
                    ctypes.c_longlong, Media)
    return f(p_md)
vlc.py 文件源码 项目:sublime-Mp3Player 作者: RachitKansal 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_length(p_mi):
    '''Get the current movie length (in ms).
    @param p_mi: the Media Player.
    @return: the movie length (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_length', None) or \
        _Cfunction('libvlc_media_player_get_length', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:sublime-Mp3Player 作者: RachitKansal 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_time(p_mi):
    '''Get the current movie time (in ms).
    @param p_mi: the Media Player.
    @return: the movie time (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_time', None) or \
        _Cfunction('libvlc_media_player_get_time', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:sublime-Mp3Player 作者: RachitKansal 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def libvlc_media_player_set_time(p_mi, i_time):
    '''Set the movie time (in ms). This has no effect if no media is being played.
    Not all formats and protocols support this.
    @param p_mi: the Media Player.
    @param i_time: the movie time (in ms).
    '''
    f = _Cfunctions.get('libvlc_media_player_set_time', None) or \
        _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None,
                    None, MediaPlayer, ctypes.c_longlong)
    return f(p_mi, i_time)
vlc.py 文件源码 项目:YoutubeMusicBot 作者: Gr3atWh173 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def libvlc_media_get_duration(p_md):
    '''Get duration (in ms) of media descriptor object item.
    @param p_md: media descriptor object.
    @return: duration of media item or -1 on error.
    '''
    f = _Cfunctions.get('libvlc_media_get_duration', None) or \
        _Cfunction('libvlc_media_get_duration', ((1,),), None,
                    ctypes.c_longlong, Media)
    return f(p_md)
vlc.py 文件源码 项目:YoutubeMusicBot 作者: Gr3atWh173 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_length(p_mi):
    '''Get the current movie length (in ms).
    @param p_mi: the Media Player.
    @return: the movie length (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_length', None) or \
        _Cfunction('libvlc_media_player_get_length', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:YoutubeMusicBot 作者: Gr3atWh173 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_time(p_mi):
    '''Get the current movie time (in ms).
    @param p_mi: the Media Player.
    @return: the movie time (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_time', None) or \
        _Cfunction('libvlc_media_player_get_time', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:YoutubeMusicBot 作者: Gr3atWh173 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def libvlc_media_player_set_time(p_mi, i_time):
    '''Set the movie time (in ms). This has no effect if no media is being played.
    Not all formats and protocols support this.
    @param p_mi: the Media Player.
    @param i_time: the movie time (in ms).
    '''
    f = _Cfunctions.get('libvlc_media_player_set_time', None) or \
        _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None,
                    None, MediaPlayer, ctypes.c_longlong)
    return f(p_mi, i_time)
vlc.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def libvlc_media_get_duration(p_md):
    '''Get duration (in ms) of media descriptor object item.
    @param p_md: media descriptor object.
    @return: duration of media item or -1 on error.
    '''
    f = _Cfunctions.get('libvlc_media_get_duration', None) or \
        _Cfunction('libvlc_media_get_duration', ((1,),), None,
                    ctypes.c_longlong, Media)
    return f(p_md)
vlc.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_length(p_mi):
    '''Get the current movie length (in ms).
    @param p_mi: the Media Player.
    @return: the movie length (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_length', None) or \
        _Cfunction('libvlc_media_player_get_length', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_time(p_mi):
    '''Get the current movie time (in ms).
    @param p_mi: the Media Player.
    @return: the movie time (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_time', None) or \
        _Cfunction('libvlc_media_player_get_time', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def libvlc_media_player_set_time(p_mi, i_time):
    '''Set the movie time (in ms). This has no effect if no media is being played.
    Not all formats and protocols support this.
    @param p_mi: the Media Player.
    @param i_time: the movie time (in ms).
    '''
    f = _Cfunctions.get('libvlc_media_player_set_time', None) or \
        _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None,
                    None, MediaPlayer, ctypes.c_longlong)
    return f(p_mi, i_time)
vlc.py 文件源码 项目:smashMusic 作者: rukai 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def libvlc_media_get_duration(p_md):
    '''Get duration (in ms) of media descriptor object item.
    @param p_md: media descriptor object.
    @return: duration of media item or -1 on error.
    '''
    f = _Cfunctions.get('libvlc_media_get_duration', None) or \
        _Cfunction('libvlc_media_get_duration', ((1,),), None,
                    ctypes.c_longlong, Media)
    return f(p_md)
vlc.py 文件源码 项目:smashMusic 作者: rukai 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_length(p_mi):
    '''Get the current movie length (in ms).
    @param p_mi: the Media Player.
    @return: the movie length (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_length', None) or \
        _Cfunction('libvlc_media_player_get_length', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:smashMusic 作者: rukai 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def libvlc_media_player_get_time(p_mi):
    '''Get the current movie time (in ms).
    @param p_mi: the Media Player.
    @return: the movie time (in ms), or -1 if there is no media.
    '''
    f = _Cfunctions.get('libvlc_media_player_get_time', None) or \
        _Cfunction('libvlc_media_player_get_time', ((1,),), None,
                    ctypes.c_longlong, MediaPlayer)
    return f(p_mi)
vlc.py 文件源码 项目:smashMusic 作者: rukai 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def libvlc_media_player_set_time(p_mi, i_time):
    '''Set the movie time (in ms). This has no effect if no media is being played.
    Not all formats and protocols support this.
    @param p_mi: the Media Player.
    @param i_time: the movie time (in ms).
    '''
    f = _Cfunctions.get('libvlc_media_player_set_time', None) or \
        _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None,
                    None, MediaPlayer, ctypes.c_longlong)
    return f(p_mi, i_time)
awa_gateway_client_api_wrapper.py 文件源码 项目:creator-system-test-framework 作者: CreatorDev 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def AwaClientGetResponse_GetValueAsIntegerPointer(self, response, path, value):
        self._lib.AwaClientGetResponse_GetValueAsIntegerPointer.restype = c_int
        mem = cast(value, POINTER(POINTER(c_longlong)))
        ret = self._lib.AwaClientGetResponse_GetValueAsIntegerPointer(response, path, byref(mem))
        result = None
        if ret == 0:
            result = pickle.dumps(cast(mem, POINTER(c_longlong)).contents.value)  # serialise as XML-RPC only supports 32 bit integers
        return result, ret
awa_gateway_client_api_wrapper.py 文件源码 项目:creator-system-test-framework 作者: CreatorDev 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def AwaClientGetResponse_GetValueAsTimePointer(self, response, path, value):
        self._lib.AwaClientGetResponse_GetValueAsTimePointer.restype = c_int
        mem = cast(value, POINTER(POINTER(c_longlong)))
        ret = self._lib.AwaClientGetResponse_GetValueAsTimePointer(response, path, byref(mem))
        result = None
        if ret == 0:
            result = pickle.dumps(cast(mem, POINTER(c_longlong)).contents.value)  # serialise as XML-RPC only supports 32 bit integers
        return result, ret
awa_gateway_client_api_wrapper.py 文件源码 项目:creator-system-test-framework 作者: CreatorDev 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def AwaClientSetOperation_AddValueAsInteger(self, operation, path, value):
        self._lib.AwaClientSetOperation_AddValueAsInteger.restype = c_int
        self._lib.AwaClientSetOperation_AddValueAsInteger.argtypes = [c_void_p, c_char_p, c_longlong]
        return self._lib.AwaClientSetOperation_AddValueAsInteger(operation, path, value)


问题


面经


文章

微信
公众号

扫码关注公众号