Changeset 8135:d95995631131 in orange


Ignore:
Timestamp:
08/02/11 12:27:55 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
b1afacab858cfacd9f899308bfe75ae5ffc0bbe0
Message:

Moved member_set from earth to Orange.misc

Location:
orange/Orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/misc/__init__.py

    r8042 r8135  
    171171    return decorating_function 
    172172 
     173#from Orange.misc.render import contextmanager 
     174from contextlib import contextmanager 
     175 
     176@contextmanager 
     177def member_set(obj, name, val): 
     178    """ A context manager that sets member ``name`` on ``obj`` to ``val`` 
     179    and restores the previous value on exit.  
     180    """ 
     181    old_val = getattr(obj, name, val) 
     182    setattr(obj, name, val) 
     183    yield 
     184    setattr(obj, name, old_val) 
     185     
    173186 
    174187class recursion_limit(object): 
  • orange/Orange/regression/earth.py

    r8128 r8135  
    274274----------------- 
    275275""" 
    276  
    277 from Orange.misc.render import contextmanager 
    278  
    279 @contextmanager  
    280 def member_set(obj, name, val): 
    281     """ A context manager that sets member ``name`` on ``obj`` to ``val`` 
    282     and restores the previous value on exit.  
    283     """ 
    284     old_val = getattr(obj, name, val) 
    285     setattr(obj, name, val) 
    286     yield 
    287     setattr(obj, name, old_val) 
    288      
    289276     
    290277def base_matrix(data, best_set, dirs, cuts): 
     
    685672 
    686673 
    687  
     674#from Orange.misc import member_set 
     675#  
    688676#class _EarthLearner(BaseEarthLearner): 
    689677#    """ An earth learner.  
Note: See TracChangeset for help on using the changeset viewer.