Skip to content

Commit c158cf6

Browse files
committed
Doc improve
1 parent b3b2dbc commit c158cf6

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

src/cachemap.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,13 @@ static PyObject *CacheMap_clear(CtsCacheMap *self) {
686686
/* tp_methods */
687687
static PyMethodDef CacheMap_methods[] = {
688688
{"evict", (PyCFunction)CacheMap_evict, METH_NOARGS,
689-
"evict()\n--\n\nEvict a item. raise error if no item in cache."
690-
"no item in cache."},
691-
{"set_capacity", (PyCFunction)CacheMap_set_capacity, METH_O,
692-
"set_capacity(capacity, /)\n--\n\n Reset capacity of cache."},
689+
"evict()\n--\n\nEvict a item. raise error if no item in cache."},
690+
{
691+
"set_capacity",
692+
(PyCFunction)CacheMap_set_capacity,
693+
METH_O,
694+
"set_capacity(capacity, /)\n--\n\n Reset capacity of cache.",
695+
},
693696
{"hit_info", (PyCFunction)CacheMap_hit_info, METH_NOARGS,
694697
"hit_info()\n--\n\nReturn capacity, hits, and misses count."},
695698
{"next_evict_key", (PyCFunction)CacheMap_NextEvictKey, METH_NOARGS,
@@ -703,9 +706,13 @@ static PyMethodDef CacheMap_methods[] = {
703706
{"pop", (PyCFunction)CacheMap_pop, METH_VARARGS | METH_KEYWORDS,
704707
"pop(key, default=None, /)\n--\n\nPop an item from cache, if key not "
705708
"exists return default."},
706-
{"popitem", (PyCFunction)CacheMap_popitem, METH_NOARGS,
707-
"popitem()\n--\n\nRemove and return some (key, value) pair"
708-
"as a 2-tuple; but raise KeyError if mapping is empty."},
709+
{
710+
"popitem",
711+
(PyCFunction)CacheMap_popitem,
712+
METH_NOARGS,
713+
"popitem()\n--\n\nRemove and return some (key, value) pair"
714+
"as a 2-tuple; but raise KeyError if mapping is empty.",
715+
},
709716
{"keys", (PyCFunction)CacheMap_keys, METH_NOARGS,
710717
"keys()\n--\n\nIter keys."},
711718
{"values", (PyCFunction)CacheMap_values, METH_NOARGS,
@@ -755,12 +762,12 @@ static PyObject *CacheMap_tp_richcompare(PyObject *self, PyObject *other,
755762
}
756763

757764
PyDoc_STRVAR(CacheMap__doc__,
758-
"CacheMap(maxsize=None, )\n--\n\n"
765+
"CacheMap(capacity=None, )\n--\n\n"
759766
"A fast LFU (least frequently used) mapping.\n"
760767
"\n"
761768
"Parameters\n"
762769
"----------\n"
763-
"maxsize : int\n"
770+
"capacity : int, optional\n"
764771
" Max size of cache, default is C ``INT32_MAX``.\n"
765772
"\n"
766773
"Examples\n"

src/channel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ PyDoc_STRVAR(Channel_safe_consume__doc__,
432432
"Safe consume with a callable.\n\n"
433433
"Parameters\n"
434434
"----------\n"
435-
"fn : Callable[[Any], bool]\n"
435+
"fn : typing.Callable[[typing.Any], bool]\n"
436436
" The `fn` receive an item as only one argument and must return "
437437
"True on success, False on fail.\n"
438438
"\n"

src/pydoc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"----------\n" \
99
"key : object\n" \
1010
" Hash key.\n" \
11-
"fn : Typing.Callable[[typing.Any], typing.Any]\n" \
11+
"fn : typing.Callable[[typing.Any], typing.Any], optional\n" \
1212
" It's a callable that accept key as only one argument, called when key " \
1313
"not exists.\n" \
1414
"\n" \

src/rbtree.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,11 +1227,11 @@ PyDoc_STRVAR(RBTree__doc__,
12271227
"\n"
12281228
"Parameters\n"
12291229
"----------\n"
1230-
"cmp : typing.Callable[[typing.Any], int]\n"
1231-
" A optional callable receive two keys, that\n"
1232-
" return negative integer if `k1 < k2`, \n"
1233-
" return positive integer if `k1 > k2`, \n"
1234-
" return 0 if `k1 == k2`.\n"
1230+
"cmp : typing.Callable[[typing.Any], int], optional\n"
1231+
" A optional callable receive two keys, that\n\n"
1232+
" return negative integer if `k1 < k2`, \n\n"
1233+
" return positive integer if `k1 > k2`, \n\n"
1234+
" return 0 if `k1 == k2`.\n\n"
12351235
" It's every similar to standard C library qsort comparator.\n"
12361236
"\n"
12371237
"Examples\n"

src/ttlcache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ PyDoc_STRVAR(
692692
"\n"
693693
"Parameters\n"
694694
"----------\n"
695-
"ttl : int\n"
695+
"ttl : int, optional\n"
696696
" Key will expire after this many seconds, default is 60 (1 minute).\n"
697697
"\n"
698698
"Examples\n"

0 commit comments

Comments
 (0)