Changeset 1691


Ignore:
Timestamp:
02/10/10 13:18:11 (14 years ago)
Author:
Malte Marquarding
Message:

Add compatibility.py for functools.wraps which doesn't exist in python <2.5

Location:
trunk/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/__init__.py

    r1689 r1691  
    44"""
    55import os,sys,shutil, platform
    6 import functools
     6try:
     7    from functools import wraps as wraps_dec
     8except ImportError:
     9    from asap.compatibility import wraps as wraps_dec
    710
    811# Set up AIPSPATH and first time use of asap i.e. ~/.asap/*
     
    357360
    358361def print_log_dec(f):
    359     @functools.wraps(f)
     362    @wraps_dec(f)
    360363    def wrap_it(*args, **kw):
    361364        val = f(*args, **kw)
     
    398401            import matplotlib
    399402            matplotlib.use("TkAgg")
    400         import pylab
     403        from matplotlib import pylab
    401404        xyplotter = pylab
    402405        plotter = asapplotter(gui)
  • trunk/python/scantable.py

    r1689 r1691  
    1 import functools
     1try:
     2    from functools import wraps as wraps_dec
     3except ImportError:
     4    from asap.compatibility import wraps as wraps_dec
     5
    26from asap._asap import Scantable
    37from asap import rcParams
     
    1115
    1216def preserve_selection(func):
    13     @functools.wraps(func)
     17    @wraps_dec(func)
    1418    def wrap(obj, *args, **kw):
    1519        basesel = obj.get_selection()
Note: See TracChangeset for help on using the changeset viewer.