Add some docstrings.

portnov [2008-06-05 14:39:26]
Add some docstrings.
Filename
hooks.py
modules.py
diff --git a/hooks.py b/hooks.py
index 1e35cf4..f991423 100755
--- a/hooks.py
+++ b/hooks.py
@@ -1,10 +1,15 @@
 #!/usr/bin/python

+"""
+Each `hook' is actually event. You mark some function with @hook decorator, then call that function when you need it. Other modules can intercept that event, marking function with @intercept('hook_name') decorator. When you call function `hook_name()', all functions, marked with @intercept('hook_name'), will be called.
+"""
+
 from debug import *

 hooks = dict()

 def call_hooks(hook,*args):
+  "Call all functions, intercepting given hook."
   global hooks
   debug("Test <%s> in %s" % (hook,hooks))
   if hook in hooks:
@@ -21,6 +26,7 @@ def call_hooks(hook,*args):
     return args

 def hook(func):
+  "Mark given function as a hook."
   global hooks
   name = func.__name__
   def wrapper(*args):
@@ -34,6 +40,7 @@ def hook(func):


 def intercept(hook):
+  "Intercept some hook."
   def decorator(func):
     global hooks
     if hook in hooks:
diff --git a/modules.py b/modules.py
index 7232d85..0e429d5 100644
--- a/modules.py
+++ b/modules.py
@@ -1,4 +1,11 @@

+"""
+This module imports all mods from modules/ directory. Each module must be a *.py file of form:
+
+def init():
+  ... Here goes definitions.
+"""
+
 import os
 import os.path
ViewGit