chiark / gitweb /
*.pyx: Add some rather laconic docstrings.
[mLib-python] / ident.pyx
index 1c2789e48ceeb9b841da5df3c6cb37205058ac6f..9a522bdfae29855ecf31135ff5ecbcec79dc8b35 100644 (file)
--- a/ident.pyx
+++ b/ident.pyx
@@ -41,6 +41,12 @@ cdef _inaddr_topy(sockaddr_in *sin):
   return inet_ntoa(sin.sin_addr), ntohs(sin.sin_port)
 
 cdef class SelIdentify:
+  """
+  SelIdentify(SK, [userproc = None], [bogusproc = None],
+                  [badproc = None], [errorproc = None],)
+
+  Asynchronously enquire about remote user of socket SK.
+  """
   cdef ident_request irq
   cdef int _activep
   cdef readonly localaddr
@@ -80,9 +86,11 @@ cdef class SelIdentify:
     if me._activep:
       ident_abort(&me.irq)
   property activep:
+    """I.activep -> BOOL: query still in progress?"""
     def __get__(me):
       return _tobool(me._activep)
   property userproc:
+    """I.userproc -> FUNC: call FUNC(OS, USER) if server replied"""
     def __get__(me):
       return me._user
     def __set__(me, proc):
@@ -90,6 +98,7 @@ cdef class SelIdentify:
     def __del__(me):
       me._user = None
   property badproc:
+    """I.badproc -> FUNC: call FUNC() if server's reply was broken"""
     def __get__(me):
       return me._bad
     def __set__(me, proc):
@@ -97,6 +106,7 @@ cdef class SelIdentify:
     def __del__(me):
       me._bad = None
   property errorproc:
+    """I.errorproc -> FUNC: call FUNC(ERR) if server reported error"""
     def __get__(me):
       return me._error
     def __set__(me, proc):
@@ -104,6 +114,7 @@ cdef class SelIdentify:
     def __del__(me):
       me._error = None
   property bogusproc:
+    """I.bogusproc -> FUNC: call FUNC() on failure if no specific handler"""
     def __get__(me):
       return me._bogus
     def __set__(me, proc):
@@ -111,6 +122,7 @@ cdef class SelIdentify:
     def __del__(me):
       me._bogus = None
   def kill(me):
+    """I.kill(): cancel ident query"""
     if not me._activep:
       raise ValueError, 'already disabled'
     ident_abort(&me.irq)
@@ -119,18 +131,23 @@ cdef class SelIdentify:
     me._activep = 0
     me.dead()
   def dead(me):
+    """I.dead(): called when operation completes or fails"""
     pass
   def user(me, os, user):
+    """I.user(OS, USER): called if server returns user name"""
     return _maybecall(me._user, (os, user))
   def bad(me):
+    """I.bad(): called if server's reply is invalid"""
     if me._bad is not None:
       return me._bad()
     return me.bogus()
   def error(me, error):
+    """I.error(ERR): called if server returns an error"""
     if me._error is not None:
       return me._error(error)
     return me.bogus()
   def bogus(me):
+    """I.bogus(): called on failure if there's no more specific handler"""
     return _maybecall(me._bogus, ())
 
 cdef void _identfunc(ident_reply *i, void *arg):