MisterAI's picture
download
raw
669 Bytes
"""Utils for interoperability with other libraries.
Just CFFI pointer casting for now.
"""
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
from typing import Any
def cast_int_addr(n: Any) -> int:
"""Cast an address to a Python int
This could be a Python integer or a CFFI pointer
"""
if isinstance(n, int):
return n
try:
import cffi
except ImportError:
pass
else:
# from pyzmq, this is an FFI void *
ffi = cffi.FFI()
if isinstance(n, ffi.CData):
return int(ffi.cast("size_t", n))
raise ValueError(f"Cannot cast {n!r} to int")

Xet Storage Details

Size:
669 Bytes
·
Xet hash:
db3c9b267a4d1b21a5fe680195c0cc678eab54f955683989ee62453460dd0f6c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.