Skip to content

Commit 1c23015

Browse files
committed
pytrap: doc: updated help for UnirecIPList
1 parent 87845ab commit 1c23015

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pytrap/src/iplist.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,23 @@ PyTypeObject pytrap_UnirecIPList = {
339339
0, /* tp_as_buffer */
340340
Py_TPFLAGS_DEFAULT |
341341
Py_TPFLAGS_BASETYPE, /* tp_flags */
342-
"UnirecIPAddr(ip)\n"
343-
" Class for UniRec IP Address storage and base data access.\n\n"
342+
"UnirecIPList(dict)\n"
343+
" Class for list of UniRec IP Address Ranges that allows look-up.\n"
344+
" The list is created from a dictionary with UnirecIPAddrRange as key and any object as value.\n"
345+
" After initialization, find() or __contains__() can be used to find UnirecIPAddr in the list.\n\n"
346+
" Example:\n"
347+
" >>> import pytrap\n"
348+
" >>> iplist = pytrap.UnirecIPList({\n"
349+
" ... pytrap.UnirecIPAddrRange(\"192.168.1.0/24\"): \"ip4\",\n"
350+
" ... pytrap.UnirecIPAddrRange(\"2001::1/48\"): \"ipv6\"})\n"
351+
" >>> pytrap.UnirecIPAddr(\"192.168.1.255\") in iplist\n"
352+
" True\n"
353+
" >>> print(iplist.find(pytrap.UnirecIPAddr(\"192.168.1.255\")))\n"
354+
" ip4\n"
355+
" >>> print(iplist.find(pytrap.UnirecIPAddr(\"10.0.0.1\")))\n"
356+
" None\n\n"
344357
" Args:\n"
345-
" ip (str): text represented IPv4 or IPv6 address\n", /* tp_doc */
358+
" dict(UnirecIPAddrRange: object): dictionary with IP range as key and any object as value\n", /* tp_doc */
346359
0, /* tp_traverse */
347360
0, /* tp_clear */
348361
(richcmpfunc) UnirecIPList_compare, /* tp_richcompare */

0 commit comments

Comments
 (0)