changeset 1309:23b6edabac78

util: remove support for VIFF_NO_WRAP
author Martin Geisler <mg@cs.au.dk>
date Mon, 19 Oct 2009 17:03:49 +0200
parents 85fd0fbfdb5a
children 698b1359b788
files doc/util.txt viff/util.py
diffstat 2 files changed, 8 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/doc/util.txt	Mon Oct 19 17:02:50 2009 +0200
+++ b/doc/util.txt	Mon Oct 19 17:03:49 2009 +0200
@@ -21,11 +21,6 @@
       :envvar:`VIFF_SEED` is defined, but empty, then no seed is used
       and a protocol run cannot be reproduced exactly.
 
-   .. envvar:: VIFF_NO_WRAP
-
-      Setting this environment variable to any value will turn
-      :func:`wrapper` into a no-op.
-
    .. envvar:: VIFF_PROFILE
 
       Defining this variable will change :func:`profile` from a no-op
--- a/viff/util.py	Mon Oct 19 17:02:50 2009 +0200
+++ b/viff/util.py	Mon Oct 19 17:03:49 2009 +0200
@@ -64,29 +64,15 @@
     It is important to use this decorator on any wrapper functions in
     order to ensure that they end up with correct :attr:`__name__` and
     :attr:`__doc__` attributes.
-
-    In addition, if the environment variable :envvar:`VIFF_NO_WRAP` is
-    defined, then the wrapper functions will be turned into functions
-    that *do not* wrap -- instead they let their argument function
-    through unchanged. This is done so that epydoc and Sphinx can see
-    the true function arguments when generating documentation. Just
-    remember that your code will break if :envvar:`VIFF_NO_WRAP` is
-    set, so it should only be used when documentation is being
-    generated.
     """
-    if os.environ.get('VIFF_NO_WRAP'):
-        # Return a decorator which ignores the functions it is asked
-        # to decorate and instead returns func:
-        return lambda _: func
-    else:
-        # Return a decorator which does nothing to the function it is
-        # asked to decorate, except update the __name__ and __doc__
-        # attributes to match the original wrapped function.
-        def decorator(f):
-            f.__name__ = func.__name__
-            f.__doc__ = func.__doc__
-            return f
-        return decorator
+    # Return a decorator which does nothing to the function it is
+    # asked to decorate, except update the __name__ and __doc__
+    # attributes to match the original wrapped function.
+    def decorator(f):
+        f.__name__ = func.__name__
+        f.__doc__ = func.__doc__
+        return f
+    return decorator
 
 def fake(replacement):
     """Replace a function with a fake version.