Remove unused code

This commit is contained in:
Kovid Goyal 2025-11-17 17:23:40 +05:30
parent 1240a17b2d
commit 4ea6862dd3
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 30 deletions

View file

@ -775,6 +775,7 @@ disk_cache_num_cached_in_ram(PyObject *self_) {
}
// The Python interface used only for testing {{{
#define PYWRAP(name) static PyObject* py##name(DiskCache *self, PyObject *args)
#define PA(fmt, ...) if (!PyArg_ParseTuple(args, fmt, __VA_ARGS__)) return NULL;
PYWRAP(ensure_state) {
@ -783,19 +784,6 @@ PYWRAP(ensure_state) {
Py_RETURN_NONE;
}
PYWRAP(read_from_cache_file) {
Py_ssize_t pos = 0, sz = -1;
PA("|nn", &pos, &sz);
mutex(lock);
if (sz < 0) sz = self->end_of_data_offset;
mutex(unlock);
PyObject *ans = PyBytes_FromStringAndSize(NULL, sz);
if (ans) {
read_from_cache_file(self, pos, sz, PyBytes_AS_STRING(ans));
}
return ans;
}
static PyObject*
wait_for_write(PyObject *self, PyObject *args) {
double timeout = 0;
@ -913,7 +901,6 @@ num_cached_in_ram(PyObject *self, PyObject *args UNUSED) {
#define MW(name, arg_type) {#name, (PyCFunction)py##name, arg_type, NULL}
static PyMethodDef methods[] = {
MW(ensure_state, METH_NOARGS),
MW(read_from_cache_file, METH_VARARGS),
{"add", add, METH_VARARGS, NULL},
{"remove", pyremove, METH_VARARGS, NULL},
{"remove_from_ram", remove_from_ram, METH_O, NULL},
@ -949,3 +936,4 @@ PyTypeObject DiskCache_Type = {
INIT_TYPE(DiskCache)
PyObject* create_disk_cache(void) { return new_diskcache_object(&DiskCache_Type, NULL, NULL); }
// }}}

View file

@ -1798,19 +1798,3 @@ class StreamingBase64Encodeer:
def reset(self) -> bytes: ...
# encode the specified data, return number of bytes written dest should be at least 4/3 *src + 2 bytes in size
def encode_into(self, dest: WriteableBuffer, src: ReadableBuffer) -> int: ...
class DiskCache:
small_hole_threshold: int
defrag_factor: int
@property
def total_size(self) -> int: ...
def add(self, key: bytes, data: bytes) -> None: ...
def remove(self, key: bytes) -> bool: ...
def remove_from_ram(self, predicate: Callable[[bytes], bool]) -> int: ...
def num_cached_in_ram(self) -> int: ...
def get(self, key: bytes, store_in_ram: bool = False) -> bytes: ... # raises KeyError if not found
def end_of_data_offset(self) -> int: ...
def clear(self) -> None: ...