Commits

Aleš Erjavec committed c1df210

Fix uses of deprecated_members class decorator.

We no longer support python 2.5 so we can use the class decorator syntax.

  • Participants
  • Parent commits bcf9fe1

Comments (0)

Files changed (23)

Orange/classification/bayes.py

 from Orange.core import BayesLearner as _BayesLearner
 
 
+@Orange.utils.deprecated_members(
+    {"adjustThreshold": "adjust_threshold",
+     "estimatorConstructor": "estimator_constructor",
+     "conditionalEstimatorConstructor": "conditional_estimator_constructor",
+     "conditionalEstimatorConstructorContinuous": "conditional_estimator_constructor_continuous",
+     "weightID": "weight_id"})
 class NaiveLearner(Orange.classification.Learner):
     """
     Probabilistic classifier based on applying Bayes' theorem (from Bayesian
         if self.adjust_threshold:
             bayes.adjust_threshold = self.adjust_threshold
         return NaiveClassifier(bayes(data, weight))
-NaiveLearner = Orange.utils.deprecated_members(
-{     "adjustThreshold": "adjust_threshold",
-      "estimatorConstructor": "estimator_constructor",
-      "conditionalEstimatorConstructor": "conditional_estimator_constructor",
-      "conditionalEstimatorConstructorContinuous":"conditional_estimator_constructor_continuous",
-      "weightID": "weight_id"
-})(NaiveLearner)
 
 
 class NaiveClassifier(Orange.classification.Classifier):

Orange/classification/logreg.py

                for at in domain.features)
 
 
+@deprecated_members(
+    {"removeSingular": "remove_singular",
+     "weightID": "weight_id",
+     "stepwiseLR": "stepwise_lr",
+     "addCrit": "add_crit",
+     "deleteCrit": "delete_crit",
+     "numFeatures": "num_features",
+     "removeMissing": "remove_missing"})
 class LogRegLearner(Orange.classification.Learner):
     """ Logistic regression learner.
 
             lr = learner.fit_model(data, weight)
         return lr
 
-LogRegLearner = deprecated_members({"removeSingular": "remove_singular",
-                                    "weightID": "weight_id",
-                                    "stepwiseLR": "stepwise_lr",
-                                    "addCrit": "add_crit",
-                                    "deleteCrit": "delete_crit",
-                                    "numFeatures": "num_features",
-                                    "removeMissing": "remove_missing"
-                                    })(LogRegLearner)
 
 class UnivariateLogRegLearner(Orange.classification.Learner):
     def __new__(cls, data=None, **argkw):
         # classification not implemented yet. For now its use is only to
         # provide regression coefficients and its statistics
         raise NotImplemented
-    
 
+
+@deprecated_members({"removeSingular": "remove_singular"})
 class LogRegLearnerGetPriors(object):
     def __new__(cls, data=None, weight_id=0, **argkw):
         self = object.__new__(cls)
         return (orig_model, betas_ap)
         #return (bayes_prior,orig_model.beta[examples.domain.class_var],logistic_prior)
 
-LogRegLearnerGetPriors = deprecated_members({"removeSingular":
-                                                 "remove_singular"}
-)(LogRegLearnerGetPriors)
 
+@deprecated_members({"removeSingular": "remove_singular"})
 class LogRegLearnerGetPriorsOneTable:
     @deprecated_keywords({"removeSingular": "remove_singular"})
     def __init__(self, remove_singular=0, **kwds):
         return (orig_model, betas_ap)
         #return (bayes_prior,orig_model.beta[data.domain.class_var],logistic_prior)
 
-LogRegLearnerGetPriorsOneTable = deprecated_members({"removeSingular":
-                                                         "remove_singular"}
-)(LogRegLearnerGetPriorsOneTable)
-
 
 ######################################
 #### Fitters for logistic regression (logreg) learner ####
        return likelihood
     else:
        return -100*len(data)
-        
 
 
+@deprecated_members(
+    {"addCrit": "add_crit",
+     "deleteCrit": "delete_crit",
+     "numFeatures": "num_features"})
 class StepWiseFSS(object):
   """
   A learning algorithm for logistic regression that implements a
 
     return attr
 
-StepWiseFSS = deprecated_members({"addCrit": "add_crit",
-                                   "deleteCrit": "delete_crit",
-                                   "numFeatures": "num_features"})(StepWiseFSS)
 
-
+@deprecated_members(
+    {"addCrit": "add_crit",
+     "deleteCrit": "delete_crit",
+     "numFeatures": "num_features"})
 class StepWiseFSSFilter(object):
     def __new__(cls, data=None, **argkw):
         self = object.__new__(cls)
             delete_crit= self.delete_crit, num_features= self.num_features)
         return data.select(Orange.data.Domain(attr, data.domain.class_var))
 
-StepWiseFSSFilter = deprecated_members({"addCrit": "add_crit",
-                                        "deleteCrit": "delete_crit",
-                                        "numFeatures": "num_features"})\
-    (StepWiseFSSFilter)
-
 
 ####################################
 ##  PROBABILITY CALCULATIONS

Orange/classification/rules.py

 from Orange.utils import deprecated_members
 
 
-
+@deprecated_members({"weightID": "weight_id", "targetClass": "target_class"})
 class LaplaceEvaluator(Evaluator):
     """
     Laplace's rule of succession.
         else:
             return (max(rule.class_distribution) + 1) / (sumDist + len(data.domain.class_var.values))
 
-LaplaceEvaluator = deprecated_members({"weightID": "weight_id",
-                                       "targetClass": "target_class"})(LaplaceEvaluator)
 
-
+@deprecated_members({"weightID": "weight_id", "targetClass": "target_class"})
 class WRACCEvaluator(Evaluator):
     """
     Weighted relative accuracy.
             return pRule * (pTruePositive - pClass)
         else: return (pTruePositive - pClass) / max(pRule, 1e-6)
 
-WRACCEvaluator = deprecated_members({"weightID": "weight_id",
-                                     "targetClass": "target_class"})(WRACCEvaluator)
 
-
+@deprecated_members({"weightID": "weight_id", "targetClass": "target_class"})
 class MEstimateEvaluator(Evaluator):
     """
     Rule evaluator using m-estimate of probability rule evaluation function.
             p = p / (rule.class_distribution.abs + self.m)
         return p
 
-MEstimateEvaluator = deprecated_members({"weightID": "weight_id",
-                                         "targetClass": "target_class"})(MEstimateEvaluator)
 
-
+@deprecated_members(
+    {"beamWidth": "beam_width",
+     "ruleFinder": "rule_finder",
+     "ruleStopping": "rule_stopping",
+     "dataStopping": "data_stopping",
+     "coverAndRemove": "cover_and_remove",
+     "storeInstances": "store_instances",
+     "targetClass": "target_class",
+     "baseRules": "base_rules",
+     "weightID": "weight_id"})
 class CN2Learner(RuleLearner):
     """
     Classical CN2 inducer (Clark and Niblett; 1988) that constructs a
         rules = cl.rules
         return CN2Classifier(rules, instances, weight)
 
-CN2Learner = deprecated_members({"beamWidth": "beam_width",
-                     "ruleFinder": "rule_finder",
-                     "ruleStopping": "rule_stopping",
-                     "dataStopping": "data_stopping",
-                     "coverAndRemove": "cover_and_remove",
-                     "storeInstances": "store_instances",
-                     "targetClass": "target_class",
-                     "baseRules": "base_rules",
-                     "weightID": "weight_id"})(CN2Learner)
 
-
+@deprecated_members({"resultType": "result_type", "beamWidth": "beam_width"})
 class CN2Classifier(RuleClassifier):
     """
     Classical CN2 classifier (Clark and Niblett; 1988) that predicts a
             ret_str += "ELSE " + rule_to_string(r) + " " + str(r.class_distribution) + "\n"
         return ret_str
 
-CN2Classifier = deprecated_members({"resultType": "result_type",
-                                    "beamWidth": "beam_width"})(CN2Classifier)
 
-
+@deprecated_members(
+    {"beamWidth": "beam_width",
+     "ruleFinder": "rule_finder",
+     "ruleStopping": "rule_stopping",
+     "dataStopping": "data_stopping",
+     "coverAndRemove": "cover_and_remove",
+     "storeInstances": "store_instances",
+     "targetClass": "target_class",
+     "baseRules": "base_rules",
+     "weightID": "weight_id"})
 class CN2UnorderedLearner(RuleLearner):
     """
     Unordered CN2 (Clark and Boswell; 1991) induces a set of unordered
             progress(1.0, None)
         return CN2UnorderedClassifier(rules, instances, weight_id)
 
-CN2UnorderedLearner = deprecated_members({"beamWidth": "beam_width",
-                     "ruleFinder": "rule_finder",
-                     "ruleStopping": "rule_stopping",
-                     "dataStopping": "data_stopping",
-                     "coverAndRemove": "cover_and_remove",
-                     "storeInstances": "store_instances",
-                     "targetClass": "target_class",
-                     "baseRules": "base_rules",
-                     "weightID": "weight_id"})(CN2UnorderedLearner)
-
 
 class CN2UnorderedClassifier(RuleClassifier):
     """
         return classifier
 
 
+@deprecated_members(
+    {"beamWidth": "beam_width",
+     "ruleFinder": "rule_finder",
+     "ruleStopping": "rule_stopping",
+     "dataStopping": "data_stopping",
+     "coverAndRemove": "cover_and_remove",
+     "storeInstances": "store_instances",
+     "targetClass": "target_class",
+     "baseRules": "base_rules",
+     "weightID": "weight_id",
+     "argumentID": "argument_id"})
 class ABCN2(RuleLearner):
     """
     Argument-based CN2 that uses EVC for evaluation
         rule = cn2_learner.rule_finder(examples, weight_id, 0, RuleList())
         return rule.filter.conditions
 
-ABCN2 = deprecated_members({"beamWidth": "beam_width",
-                     "ruleFinder": "rule_finder",
-                     "ruleStopping": "rule_stopping",
-                     "dataStopping": "data_stopping",
-                     "coverAndRemove": "cover_and_remove",
-                     "storeInstances": "store_instances",
-                     "targetClass": "target_class",
-                     "baseRules": "base_rules",
-                     "weightID": "weight_id",
-                     "argumentID": "argument_id"})(ABCN2)
 
 class CN2EVCUnorderedLearner(ABCN2):
     """
     oneSelectorToCover = staticmethod(oneSelectorToCover)
 
 
+@deprecated_members(
+    {"notAllowedSelectors": "not_allowed_selectors",
+     "argumentID": "argument_id"})
 class SelectorAdder(BeamRefiner):
     """
     Selector adder, this function is a refiner function:
         tempRule.filterAndStore(oldRule.examples, oldRule.weightID, target_class)
         return tempRule
 
-SelectorAdder = deprecated_members({"notAllowedSelectors": "not_allowed_selectors",
-                     "argumentID": "argument_id"})(SelectorAdder)
 
 # This filter is the ugliest code ever! Problem is with Orange, I had some problems with inheriting deepCopy
 # I should take another look at it.
+@deprecated_members({"argumentID": "argument_id"})
 class ArgFilter(Orange.core.Filter):
     """ This class implements AB-covering principle. """
     def __init__(self, argument_id=None, filter = Orange.core.Filter_values(), arg_example = None):
         newFilter.indices = self.indices[:]
         newFilter.arg_example = self.arg_example
         return newFilter
-ArgFilter = deprecated_members({"argumentID": "argument_id"})(ArgFilter)
+
 
 class SelectorArgConditions(BeamRefiner):
     """
         return prob_dist
 
 
+@deprecated_members({"sortRules": "sort_rules"})
 class PILAR:
     """
     PILAR (Probabilistic improvement of learning algorithms with rules).
                 new_rules.append(bestRule)
         return new_rules
 
-PILAR = deprecated_members({"sortRules": "sort_rules"})(PILAR)
 
-
+@deprecated_members({"defaultClassIndex": "default_class_index"})
 class RuleClassifier_bestRule(RuleClassifier):
     """
     A very simple classifier, it takes the best rule of each class and
         if result_type == Orange.classification.Classifier.GetProbabilities:
           return final_dist
         return (final_dist.modus(), final_dist)
-
-RuleClassifier_bestRule = deprecated_members({"defaultClassIndex": "default_class_index"})(RuleClassifier_bestRule)

Orange/classification/svm/__init__.py

 
 import Orange.core
 import Orange.data
-import Orange.misc
+import Orange.utils
 import Orange.feature
 
 import kernels
     return isinstance(feature, Orange.feature.Continuous)
 
 
+@Orange.utils.deprecated_members(
+    {"learnClassifier": "learn_classifier",
+     "tuneParameters": "tune_parameters",
+     "kernelFunc": "kernel_func"},
+    wrap_methods=["__init__", "tune_parameters"])
 class SVMLearner(_SVMLearner):
     """
     :param svm_type: the SVM type
         return data.translate(newdomain)
 
 
-SVMLearner = Orange.utils.deprecated_members({
-    "learnClassifier": "learn_classifier",
-    "tuneParameters": "tune_parameters",
-    "kernelFunc": "kernel_func",
-    },
-    wrap_methods=["__init__", "tune_parameters"])(SVMLearner)
-
-
+@Orange.utils.deprecated_members(
+    {"classDistribution": "class_distribution",
+     "getDecisionValues": "get_decision_values",
+     "getModel": "get_model",
+    }, wrap_methods=[])
 class SVMClassifier(_SVMClassifier):
     def __new__(cls, *args, **kwargs):
         if args and isinstance(args[0], _SVMClassifier):
         return "\n".join(model)
 
 
-SVMClassifier = Orange.utils.deprecated_members({
-    "classDistribution": "class_distribution",
-    "getDecisionValues": "get_decision_values",
-    "getModel" : "get_model",
-    }, wrap_methods=[])(SVMClassifier)
-
-
 # Backwards compatibility (pickling)
 SVMClassifierWrapper = SVMClassifier
 
 MeasureAttribute_SVMWeights = ScoreSVMWeights
 
 
+@Orange.utils.deprecated_members(
+    {"getAttrScores": "get_attr_scores"},
+    wrap_methods=["get_attr_scores", "__call__"])
 class RFE(object):
     """
     Iterative feature elimination based on weights computed by a
         return data
 
 
-RFE = Orange.utils.deprecated_members({
-    "getAttrScores": "get_attr_scores"},
-    wrap_methods=["get_attr_scores", "__call__"])(RFE)
-
-
 def example_table_to_svm_format(table, file):
     warnings.warn("Deprecated. Use table_to_svm_format", DeprecationWarning)
     table_to_svm_format(table, file)

Orange/classification/tree.py

 
 import Orange.feature.scoring as fscoring
 
+
+@Orange.utils.deprecated_members(
+    {"mForPruning": "m_pruning",
+     "sameMajorityPruning": "same_majority_pruning",
+     "reliefM": "relief_m",
+     "reliefK": "relief_k",
+     "storeDistributions": "store_distributions",
+     "storeContingencies": "store_contingencies",
+     "storeExamples": "store_instances",
+     "store_examples": "store_instances",
+     "storeNodeClassifier": "store_node_classifier",
+     "worstAcceptable": "worst_acceptable",
+     "minSubset": "min_subset",
+     "maxMajority": "max_majority",
+     "minExamples": "min_instances",
+     "maxDepth": "max_depth",
+     "nodeLearner": "node_learner",
+     "min_examples": "min_instances"},
+    wrap_methods=[])
 class TreeLearner(Orange.core.Learner):
     """
     A classification or regression tree learner. If a set of instances
         }
 
 
-
-TreeLearner = Orange.utils.deprecated_members({
-          "mForPruning": "m_pruning",
-          "sameMajorityPruning": "same_majority_pruning",
-          "reliefM": "relief_m",
-          "reliefK": "relief_k",
-          "storeDistributions": "store_distributions",
-          "storeContingencies": "store_contingencies",
-          "storeExamples": "store_instances",
-          "store_examples": "store_instances",
-          "storeNodeClassifier": "store_node_classifier",
-          "worstAcceptable": "worst_acceptable",
-          "minSubset": "min_subset",
-          "maxMajority": "max_majority",
-          "minExamples": "min_instances",
-          "maxDepth": "max_depth",
-          "nodeLearner": "node_learner",
-          "min_examples": "min_instances"
-}, wrap_methods=[])(TreeLearner)
-
 #
 # the following is for the output
 #

Orange/classification/wrappers.py

 
 from Orange.utils import deprecated_members
 
+
+@deprecated_members(
+    {"removeThreshold": "remove_threshold",
+     "addThreshold": "add_threshold"})
 class StepwiseLearner(Orange.core.Learner):
   def __new__(cls, data=None, weight_id=None, **kwargs):
       self = Orange.core.Learner.__new__(cls, **kwargs)
             print "added", bestAttr.name
 
     return self.learner(Orange.data.Table(domain, data), weight_id)
-
-StepwiseLearner = deprecated_members(
-                    {"removeThreshold": "remove_threshold",
-                     "addThreshold": "add_threshold"},
-                    )(StepwiseLearner)

Orange/data/outliers.py

 import Orange
 from Orange import statc
 
+
+@Orange.utils.deprecated_members(
+    {"setKNN": "set_knn",
+     "setExamples": "set_examples",
+     "setDistanceMatrix": "set_distance_matrix",
+     "distanceMatrix": "distance_matrix",
+     "zValues": "z_values"})
 class OutlierDetection:
     """
     A class for detecting outliers.
         """
         list = self._average_means()
         return [statc.z(list, e) for e in list]
-
-Orange.utils.deprecated_members(
-    {"setKNN": "set_knn",
-    "setExamples": "set_examples",
-    "setDistanceMatrix": "set_distance_matrix",
-    "distanceMatrix": "distance_matrix",
-    "zValues": "z_values"
-    })(OutlierDetection)
-

Orange/data/preprocess/scaling.py

     return d2
 
 
+@deprecated_members(
+    {"rawData": "raw_data",
+     "rawSubsetData": "raw_subset_data",
+     "attributeNames": "attribute_names",
+     "attributeNameIndex": "attribute_name_index",
+     "attributeFlipInfo": "attribute_flip_info",
+     "dataHasClass": "data_has_class",
+     "dataHasContinuousClass": "data_has_continuous_class",
+     "dataHasDiscreteClass": "data_has_discrete_class",
+     "dataClassName": "data_class_name",
+     "dataDomain": "data_domain",
+     "dataClassIndex": "data_class_index",
+     "haveData": "have_data",
+     "haveSubsetData": "have_subset_data",
+     "jitterSize": "jitter_size",
+     "jitterContinuous": "jitter_continuous",
+     "attrValues": "attr_values",
+     "domainDataStat": "domain_data_stat",
+     "originalData": "original_data",
+     "originalSubsetData": "original_subset_data",
+     "scaledData": "scaled_data",
+     "scaledSubsetData": "scaled_subset_data",
+     "noJitteringScaledData": "no_jittering_scaled_data",
+     "noJitteringScaledSubsetData": "no_jittering_scaled_subset_data",
+     "validDataArray": "valid_data_array",
+     "validSubsetDataArray": "valid_subset_data_array",
+     "mergeDataSets": "merge_data_sets",
+     "rescaleData": "rescale_data",
+     "setData": "set_data",
+     "scaleExampleValue": "scale_example_value",
+     "getAttributeLabel": "get_attribute_label",
+     "flipAttribute": "flip_attribute",
+     "getMinMaxVal": "get_min_max_val",
+     "getValidList": "get_valid_list",
+     "getValidSubsetList": "get_valid_subset_list",
+     "getValidIndices": "get_valid_indices",
+     "getValidSubsetIndices": "get_valid_subset_indices",
+     "rndCorrection": "rnd_correction"})
 class ScaleData:
     def __init__(self):
         self.raw_data = None           # input data
     
     rndCorrection = rnd_correction
 
-ScaleData = deprecated_members({"rawData": "raw_data",
-                                "rawSubsetData": "raw_subset_data",
-                                "attributeNames": "attribute_names",
-                                "attributeNameIndex": "attribute_name_index",
-                                "attributeFlipInfo": "attribute_flip_info",
-                                "dataHasClass": "data_has_class",
-                                "dataHasContinuousClass": "data_has_continuous_class",
-                                "dataHasDiscreteClass": "data_has_discrete_class",
-                                "dataClassName": "data_class_name",
-                                "dataDomain": "data_domain",
-                                "dataClassIndex": "data_class_index",
-                                "haveData": "have_data",
-                                "haveSubsetData": "have_subset_data",
-                                "jitterSize": "jitter_size",
-                                "jitterContinuous": "jitter_continuous",
-                                "attrValues": "attr_values",
-                                "domainDataStat": "domain_data_stat",
-                                "originalData": "original_data",
-                                "originalSubsetData": "original_subset_data",
-                                "scaledData": "scaled_data",
-                                "scaledSubsetData": "scaled_subset_data",
-                                "noJitteringScaledData": "no_jittering_scaled_data",
-                                "noJitteringScaledSubsetData": "no_jittering_scaled_subset_data",
-                                "validDataArray": "valid_data_array",
-                                "validSubsetDataArray": "valid_subset_data_array",
-                                "mergeDataSets": "merge_data_sets",
-                                "rescaleData": "rescale_data",
-                                "setData": "set_data",
-                                "scaleExampleValue": "scale_example_value",
-                                "getAttributeLabel": "get_attribute_label",
-                                "flipAttribute": "flip_attribute",
-                                "getMinMaxVal": "get_min_max_val",
-                                "getValidList": "get_valid_list",
-                                "getValidSubsetList": "get_valid_subset_list",
-                                "getValidIndices": "get_valid_indices",
-                                "getValidSubsetIndices": "get_valid_subset_indices",
-                                "rndCorrection": "rnd_correction",
-                                })(ScaleData)
-
 
 def jitter_array(array, ratio=0.01, axis=0, rand_seed=None):
     """
     return array
 
 
+@deprecated_members(
+    {"setAnchors": "set_anchors",
+     "createAnchors": "create_anchors",
+     "createXAnchors": "create_xanchors",
+     "createYAnchors": "create_yanchors",
+     "saveProjectionAsTabData": "save_projection_as_tab_data",
+     "getProjectedPointPosition": "get_projected_point_position",
+     "createProjectionAsExampleTable": "create_projection_as_example_table",
+     "createProjectionAsNumericArray": "create_projection_as_numeric_array",
+     "_getSum_i": "_getsum_i",
+     "normalizeExamples": "normalize_examples",
+     "anchorData": "anchor_data",
+     "lastAttrIndices": "last_attr_indices",
+     "anchorDict": "anchor_dict"})
 class ScaleLinProjData(ScaleData):
     def __init__(self):
         ScaleData.__init__(self)
                                        "updateData": "update_data",
                                        "scaleFactor": "scale_factor"})
 
-ScaleLinProjData = deprecated_members({"setAnchors": "set_anchors",
-                                       "createAnchors": "create_anchors",
-                                       "createXAnchors": "create_xanchors",
-                                       "createYAnchors": "create_yanchors",
-                                       "saveProjectionAsTabData": "save_projection_as_tab_data",
-                                       "getProjectedPointPosition":
-                                           "get_projected_point_position",
-                                       "createProjectionAsExampleTable":
-                                           "create_projection_as_example_table",
-                                       "createProjectionAsNumericArray":
-                                           "create_projection_as_numeric_array",
-                                       "_getSum_i": "_getsum_i",
-                                       "normalizeExamples": "normalize_examples",
-                                       "anchorData": "anchor_data",
-                                       "lastAttrIndices": "last_attr_indices",
-                                       "anchorDict": "anchor_dict"})(ScaleLinProjData)
 
+@deprecated_members(
+    {"setAnchors": "set_anchors",
+     "createAnchors": "create_anchors",
+     "saveProjectionAsTabData": "save_projection_as_tab_data",
+     "getProjectedPointPosition": "get_projected_point_position",
+     "createProjectionAsExampleTable": "create_projection_as_example_table",
+     "createProjectionAsNumericArray": "create_projection_as_numeric_array",
+     "_getSum_i": "_getsum_i",
+     "normalizeExamples": "normalize_examples",
+     "anchorData": "anchor_data",
+     "lastAttrIndices": "last_attr_indices",
+     "anchorDict": "anchor_dict",
+     "trueScaleFactor": "true_scale_factor"})
 class ScaleLinProjData3D(ScaleData):
     def __init__(self):
         ScaleData.__init__(self)
     
     _getSum_i = _getsum_i
 
-ScaleLinProjData3D = deprecated_members({"setAnchors": "set_anchors",
-                                       "createAnchors": "create_anchors",
-                                       "saveProjectionAsTabData": "save_projection_as_tab_data",
-                                       "getProjectedPointPosition":
-                                           "get_projected_point_position",
-                                       "createProjectionAsExampleTable":
-                                           "create_projection_as_example_table",
-                                       "createProjectionAsNumericArray":
-                                           "create_projection_as_numeric_array",
-                                       "_getSum_i": "_getsum_i",
-                                       "normalizeExamples": "normalize_examples",
-                                       "anchorData": "anchor_data",
-                                       "lastAttrIndices": "last_attr_indices",
-                                       "anchorDict": "anchor_dict",
-                                       "trueScaleFactor": "true_scale_factor"
-                                      })(ScaleLinProjData3D)
 
+@deprecated_members(
+    {"createProjectionAsExampleTable": "create_projection_as_example_table",
+     "createProjectionAsNumericArray": "create_projection_as_numeric_array",
+     "getProjectedPointPosition": "get_projected_point_position"})
 class ScalePolyvizData(ScaleLinProjData):
     def __init__(self):
         ScaleLinProjData.__init__(self)
     
     getProjectedPointPosition = get_projected_point_position
 
-ScalePolyvizData = deprecated_members({"createProjectionAsExampleTable":
-                                           "create_projection_as_example_table",
-                                       "createProjectionAsNumericArray":
-                                           "create_projection_as_numeric_array",
-                                       "getProjectedPointPosition":
-                                           "get_projected_point_position"
-                                       })(ScalePolyvizData)
 
+@deprecated_members(
+    {"getOriginalData": "get_original_data",
+     "getOriginalSubsetData": "get_original_subset_data",
+     "getXYDataPositions": "get_xy_data_positions",
+     "getXYSubsetDataPositions": "get_xy_subset_data_positions",
+     "getProjectedPointPosition": "get_projected_point_position",
+     "createProjectionAsExampleTable": "create_projection_as_example_table",
+     "createProjectionAsExampleTable3D": "create_projection_as_example_table_3D",
+     "createProjectionAsNumericArray": "create_projection_as_numeric_array",
+     "createProjectionAsNumericArray3D": "create_projection_as_numeric_array_3D",
+     "getOptimalClusters": "get_optimal_clusters"})
 class ScaleScatterPlotData(ScaleData):
     def get_original_data(self, indices):
         data = self.original_data.take(indices, axis = 0)
         self.scatterWidget.progressBarFinished()
     
     getOptimalClusters = get_optimal_clusters
-
-ScaleScatterPlotData = deprecated_members({"getOriginalData": "get_original_data",
-                                           "getOriginalSubsetData": "get_original_subset_data",
-                                           "getXYDataPositions": "get_xy_data_positions",
-                                           "getXYSubsetDataPositions": "get_xy_subset_data_positions",
-                                           "getProjectedPointPosition": "get_projected_point_position",
-                                           "createProjectionAsExampleTable": "create_projection_as_example_table",
-                                           "createProjectionAsExampleTable3D": "create_projection_as_example_table_3D",
-                                           "createProjectionAsNumericArray": "create_projection_as_numeric_array",
-                                           "createProjectionAsNumericArray3D": "create_projection_as_numeric_array_3D",
-                                           "getOptimalClusters": "get_optimal_clusters"
-                                           })(ScaleScatterPlotData)

Orange/data/sql.py

             #print connectionString, dbArgDict
             return (quirks, dbmod.connect(connectionString,**dbArgDict))
 
+
+@deprecated_members(
+    {"discreteNames": "discrete_names",
+     "metaName": "meta_names",
+     "className": "class_name"})
 class SQLReader(object):
     """
     :obj:`~SQLReader` establishes a connection with a database and provides the methods needed
             return self.exampleTable
         return None
 
-SQLReader = deprecated_members({"discreteNames":"discrete_names", "metaName":"meta_names"\
-    , "className":"class_name"})(SQLReader)
 
 class SQLWriter(object):
     """

Orange/ensemble/bagging.py

 import Orange.classification
 
 
+@Orange.utils.deprecated_members(
+    {"weightId": "weight_id", "examples": "instances"})
 class BaggedLearner(Orange.core.Learner):
     """
     BaggedLearner takes a learner and returns a bagged learner, which is
     def __reduce__(self):
         return type(self), (self.learner,), dict(self.__dict__)
 
-BaggedLearner = Orange.utils.deprecated_members(
-    {"weightId": "weight_id", "examples": "instances"}
-    )(BaggedLearner)
 
-
+@Orange.utils.deprecated_members(
+    {"example": "instance",
+     "classVar": "class_var",
+     "resultType": "result_type"})
 class BaggedClassifier(Orange.core.Classifier):
     """
     A classifier that uses a bagging technique. Usually the learner
     def __reduce__(self):
         return (type(self), (self.classifiers, self.name, self.class_var),
                 dict(self.__dict__))
-
-BaggedClassifier = Orange.utils.deprecated_members(
-    {"example": "instance", "classVar": "class_var",
-     "resultType": "result_type"}
-    )(BaggedClassifier)

Orange/ensemble/boosting.py

 
 _inf = 100000
 
+
+@Orange.utils.deprecated_members(
+    {"examples": "instances",
+     "classVar": "class_var",
+     "weightId": "weigth_id",
+     "origWeight": "orig_weight"})
 class BoostedLearner(Orange.core.Learner):
     """
     Instead of drawing a series of bootstrap samples from the training set,
     :rtype: :class:`Orange.ensemble.boosting.BoostedClassifier` or 
             :class:`Orange.ensemble.boosting.BoostedLearner`
     """
+    @Orange.utils.deprecated_keywords(
+        {"examples": "instances", "weightId": "weigth_id"})
     def __new__(cls, learner, instances=None, weight_id=None, **kwargs):
         self = Orange.core.Learner.__new__(cls, **kwargs)
         if instances is not None:
         self.name = name
         self.learner = learner
 
+    @Orange.utils.deprecated_keywords(
+        {"examples": "instances", "origWeight": "orig_weight"})
     def __call__(self, instances, orig_weight = 0):
         """
         Learn from the given table of data instances.
     def __reduce__(self):
         return type(self), (self.learner,), dict(self.__dict__)
 
-BoostedLearner = Orange.utils.deprecated_members({"examples":"instances", "classVar":"class_var", "weightId":"weigth_id", "origWeight":"orig_weight"})(BoostedLearner)
 
+@Orange.utils.deprecated_members({"classVar": "class_var"})
 class BoostedClassifier(Orange.core.Classifier):
     """
     A classifier that uses a boosting technique. Usually the learner
         self.class_var = class_var
         self.__dict__.update(kwds)
 
+    @Orange.utils.deprecated_keywords({"resultType": "result_type"})
     def __call__(self, instance, result_type = Orange.classification.Classifier.GetValue):
         """
         :param instance: instance to be classified.
         
     def __reduce__(self):
         return type(self), (self.classifiers, self.name, self.class_var), dict(self.__dict__)
-
-BoostedClassifier = Orange.utils.deprecated_members({"classVar":"class_var", "resultType":"result_type"})(BoostedClassifier)

Orange/ensemble/forest.py

         return _default_small_learner(None, rand, base)
     else:
         notRightLearnerToWrap()
- 
+
+
 class _RandomForestSimpleTreeLearner(Orange.core.Learner):
     """A learner which wraps an ordinary SimpleTreeLearner.  Sets the
     skip_prob so that the number of randomly chosen features for each
         self.base = base
         self.attributes = None
         self.rand = rand
-    
+
+    @deprecated_keywords({"examples": "instances", "weightID": "weight"})
     def __call__(self, instances, weight=0):
         osp,orand = self.base.skip_prob, self.base.random_generator
         self.base.skip_prob = 1-float(self.attributes)/len(instances.domain.attributes)
         self.base.skip_prob, self.base.random_generator = osp, orand
         return r
 
-_RandomForestSimpleTreeLearner = Orange.utils.deprecated_members({"weightID":"weight_id", "examples":"instances"})(_RandomForestSimpleTreeLearner)
 
 class _RandomForestTreeLearner(Orange.core.Learner):
     """ A learner which wraps an ordinary TreeLearner with
         if not self.rand: #for all the built trees
             self.rand = random.Random(0)
 
-    @deprecated_keywords({"examples":"instances"})
+    @deprecated_keywords({"examples": "instances"})
     def __call__(self, instances, weight=0):
         """ A current tree learner is copied, modified and then used.
         Modification: set a different split constructor, which uses
         return bcopy(instances, weight=weight)
 
 
-
 class RandomForestLearner(Orange.core.Learner):
     """
     Trains an ensemble predictor consisting of trees trained
            
         self.randstate = self.rand.getstate() #original state
 
+    @deprecated_keywords({"examples": "instances"})
     def __call__(self, instances, weight=0):
         """
         Learn from the given table of data instances.
                     class_vars=instances.domain.class_vars)
 
 
-RandomForestLearner = Orange.utils.deprecated_members({"examples":"instances"})(RandomForestLearner)
-
+@Orange.utils.deprecated_members({"classVar": "class_var"})
 class RandomForestClassifier(Orange.core.Classifier):
     """
     Uses the trees induced by the :obj:`RandomForestLearner`. An input
         self.__dict__.update(kwds)
         self.single_class = True if not class_vars else False
 
+    @Orange.utils.deprecated_keywords(
+        {"example": "instance", "resultType": "result_type"})
     def __call__(self, instance, result_type = Orange.classification.Classifier.GetValue):
         """
         :param instance: instance to be classified.
     def __reduce__(self):
         return type(self), (self.classifiers, self.name, self.domain, self.class_var, self.class_vars), dict(self.__dict__)
 
-RandomForestClassifier = Orange.utils.deprecated_members({"resultType":"result_type", "classVar":"class_var", "example":"instance"})(RandomForestClassifier)
 ### MeasureAttribute_randomForests
 
 class ScoreFeature(Orange.feature.scoring.Score):

Orange/evaluation/testing.py

 TEST_TYPE_MLC = 1
 TEST_TYPE_MULTITARGET = 2
 
+
+@deprecated_members(
+    {"iterationNumber": "iteration_number", "actualClass": "actual_class"})
 class TestedExample:
     """
     TestedExample stores predictions of different classifiers for a
     def __repr__(self):
         return str(self.__dict__)
 
-TestedExample = deprecated_members({"iterationNumber": "iteration_number",
-                                    "actualClass": "actual_class"
-                                    })(TestedExample)
 
 def mt_vals(vals):
     """
     return [val if val.is_DK() else int(val) if val.variable.var_type == Orange.feature.Type.Discrete
                                             else float(val) for val in vals]
 
+
+@deprecated_members(
+    {"classValues": "class_values",
+     "classifierNames": "classifier_names",
+     "baseClass": "base_class",
+     "numberOfIterations": "number_of_iterations",
+     "numberOfLearners": "number_of_learners"})
 class ExperimentResults(object):
     """
     ``ExperimentResults`` stores results of one or more repetitions of
     def __repr__(self):
         return str(self.__dict__)
 
-ExperimentResults = deprecated_members({"classValues": "class_values",
-                                        "classifierNames": "classifier_names",
-                                        "baseClass": "base_class",
-                                        "numberOfIterations": "number_of_iterations",
-                                        "numberOfLearners": "number_of_learners"
-})(ExperimentResults)
 
-    
 class Evaluation(object):
     """Common methods for learner evaluation."""
 

Orange/feature/imputation.py

 import Orange.misc
 import Orange
 
+
+@Orange.utils.deprecated_members(
+  {"dontImputeClassifier": "dont_impute_classifier",
+   "imputerConstructor": "imputer_constructor",
+   "baseLearner": "base_learner"})
 class ImputeLearner(Orange.classification.Learner):
     def __new__(cls, data=None, weight_id=0, **keyw):
         self = Orange.classification.Learner.__new__(cls, **keyw)
             return self.__call__(data, weight_id)
         else:
             return self
-        
+
+    @Orange.utils.deprecated_keywords({"weightID": "weight_id"})
     def __call__(self, data, weight=0):
         trained_imputer = self.imputer_constructor(data, weight)
         imputed_data = trained_imputer(data, weight)
         else:
             return ImputeClassifier(base_classifier, trained_imputer)
 
-ImputeLearner = Orange.utils.deprecated_members(
-  {
-      "dontImputeClassifier": "dont_impute_classifier",
-      "imputerConstructor": "imputer_constructor",
-      "baseLearner": "base_learner",
-      "weightID": "weight_id"
-  })(ImputeLearner)
 
-
+@Orange.utils.deprecated_members({"baseClassifier": "base_classifier"})
 class ImputeClassifier(Orange.classification.Classifier):
     def __init__(self, base_classifier, imputer, **argkw):
         self.base_classifier = base_classifier
 
     def __call__(self, i, what=Orange.classification.Classifier.GetValue):
         return self.base_classifier(self.imputer(i), what)
-
-ImputeClassifier = Orange.utils.deprecated_members(
-  {
-      "baseClassifier": "base_classifier"
-  })(ImputeClassifier)

Orange/feature/scoring.py

 ######
 # from orngEvalAttr.py
 
+
+@deprecated_members({"measure": "score"}, wrap_methods=[])
 class OrderAttributes:
     """Orders features by their scores.
     
         measured.sort(lambda x, y: cmp(x[1], y[1]))
         return [x[0] for x in measured]
 
-OrderAttributes = deprecated_members({
-          "measure": "score",
-}, wrap_methods=[])(OrderAttributes)
 
 class Distance(Score):
     """The :math:`1-D` distance is defined as information gain divided

Orange/misc/__init__.py

 are :obj:`Orange.evaluation.testing` and :obj:`Orange.data.Table`.
 
 """
-from functools import wraps
+
 from Orange.core import RandomGenerator as Random
 from Orange.core import SymMatrix
 from Orange.core import CostMatrix

Orange/projection/linear.py

                                                                      axis=0)
 
 
+@deprecated_members(
+    {"attractG": "attract_g",
+     "repelG": "repel_g",
+     "forceBalancing": "force_balancing",
+     "forceSigma": "force_sigma",
+     "mirrorSymmetry": "mirror_symmetry",
+     "useGeneralizedEigenvectors": "use_generalized_eigenvectors",
+     "stepsBeforeUpdate": "steps_before_update",
+     "s2nSpread": "s2n_spread",
+     "s2nPlaceAttributes": "s2n_place_attributes",
+     "s2nMixData": "s2n_mix_data",
+     "autoSetParameters": "auto_set_parameters",
+     "classPermutationList": "class_permutation_list",
+     "attrsNum": "attrs_num",
+     "cancelOptimization": "cancel_optimization"})
 class FreeViz:
     """
     Contains an easy-to-use interface to the core of the method, which is
     findProjection = find_projection
 
 
-FreeViz = deprecated_members({"attractG": "attract_g",
-                              "repelG": "repel_g",
-                              "forceBalancing": "force_balancing",
-                              "forceSigma": "force_sigma",
-                              "mirrorSymmetry": "mirror_symmetry",
-                              "useGeneralizedEigenvectors": "use_generalized_eigenvectors",
-                              "stepsBeforeUpdate": "steps_before_update",
-                              "s2nSpread": "s2n_spread",
-                              "s2nPlaceAttributes": "s2n_place_attributes",
-                              "s2nMixData": "s2n_mix_data",
-                              "autoSetParameters": "auto_set_parameters",
-                              "classPermutationList": "class_permutation_list",
-                              "attrsNum": "attrs_num",
-                              "cancelOptimization": "cancel_optimization"})(FreeViz)
-
-
 @deprecated_keywords({"X": "x", "Y": "y", "Ncomp": "ncomp"})
 def create_pls_projection(x, y, ncomp=2):
     """Predict y from x using first ncomp principal components"""
 
 createPLSProjection = create_pls_projection
 
+
 # #############################################################################
 # class that represents freeviz classifier
+@deprecated_members({"FreeViz": "freeviz"})
 class FreeVizClassifier(classification.Classifier):
     """
     A kNN classifier on the 2D projection of the data, optimized by FreeViz.
     def __call__(self, instance, return_type=classification.Classifier.GetValue):
         return self.classifier(instance, return_type)
 
-FreeVizClassifier = deprecated_members({"FreeViz": "freeviz"})(FreeVizClassifier)
 
+@deprecated_members({"FreeViz": "freeviz"})
 class FreeVizLearner(classification.Learner):
     """
     A learner that builds a :class:`FreeVizClassifier` on given data. An
     def __call__(self, instances, weight_id=0):
         return FreeVizClassifier(instances, self.freeviz)
 
-FreeVizLearner = deprecated_members({"FreeViz": "freeviz"})(FreeVizLearner)
 
-
+@deprecated_members({"FreeViz": "freeviz"})
 class S2NHeuristicLearner(classification.Learner):
     """
     This class is not documented yet.
     def __call__(self, instances, weight_id=0):
         return S2NHeuristicClassifier(instances, self.freeviz)
 
-S2NHeuristicLearner = deprecated_members({"FreeViz":
-                                              "freeviz"})(S2NHeuristicLearner)
 
 class Projector(object):
     """

Orange/projection/mds.py

         x = numpy.dot(C, v1)
         y = numpy.dot(C, v2)
         return x, y
-        
-        
+
+
+@deprecated_members(
+    {"projectedDistances": "projected_distances",
+     "originalDistances": "original_distances",
+     "avgStress": "avg_stress",
+     "progressCallback": "progress_callback",
+     "getStress": "calc_stress",
+     "get_stress": "calc_stress",
+     "calcStress": "calc_stress",
+     "getDistance": "calc_distance",
+     "get_distance": "calc_distance",
+     "calcDistance": "calc_distance",
+     "Torgerson": "torgerson",
+     "SMACOFstep": "smacof_step",
+     "LSMT": "lsmt"})
 class MDS(object):
     """
     Main class for performing multidimensional scaling.
         assert(len(o) == k)
         self.freshD = 0
         return effect
-    
-MDS = deprecated_members({"projectedDistances": "projected_distances",
-                     "originalDistances": "original_distances",
-                     "avgStress": "avg_stress",
-                     "progressCallback": "progress_callback",
-                     "getStress": "calc_stress",
-                     "get_stress": "calc_stress",
-                     "calcStress": "calc_stress",
-                     "getDistance": "calc_distance",
-                     "get_distance": "calc_distance",
-                     "calcDistance": "calc_distance",
-                     "Torgerson": "torgerson",
-                     "SMACOFstep": "smacof_step",
-                     "LSMT": "lsmt"})(MDS)

Orange/regression/lasso.py

         perm_data[i].set_class(data[perm[i]].get_class())
     return perm_data
 
+
+@deprecated_members({"nBoot": "n_boot", "nPerm": "n_perm"},
+                    wrap_methods=["__init__"])
 class LassoRegressionLearner(Orange.regression.base.BaseRegressionLearner):
     """Fits the lasso regression model using FISTA
     (Fast Iterative Shrinkage-Thresholding Algorithm).
             coef0=coef0, coefficients=coefficients, std_errors=std_errors,
             p_vals=p_vals, model=model, mu_x=mu_x)
 
-deprecated_members({"nBoot": "n_boot",
-                    "nPerm": "n_perm"},
-                   wrap_methods=["__init__"],
-                   in_place=True)(LassoRegressionLearner)
 
+@deprecated_members(
+    {"muX": "mu_x",
+     "stdErrorsFixedT": "std_errors",
+     "pVals": "p_vals",
+     "dictModel": "model"},
+    wrap_methods=["__init__"])
 class LassoRegression(Orange.classification.Classifier):
     """Lasso regression predicts the value of the response variable
     based on the values of independent variables.
     def __str__(self):
         return self.to_string(skip_zero=True)
 
-deprecated_members({"muX": "mu_x",
-                    "stdErrorsFixedT": "std_errors",
-                    "pVals": "p_vals",
-                    "dictModel": "model"},
-                   wrap_methods=["__init__"],
-                   in_place=True)(LassoRegression)
 
 if __name__ == "__main__":
     data = Orange.data.Table('housing')

Orange/regression/linear.py

 
 from Orange.utils import deprecated_members, deprecated_keywords
 
+
+@deprecated_members(
+    {"ridgeLambda": "ridge_lambda",
+     "computeStats": "compute_stats",
+     "useVars": "use_vars",
+     "addSig": "add_sig",
+     "removeSig": "remove_sig"},
+    wrap_methods=["__init__"])
 class LinearRegressionLearner(base.BaseRegressionLearner):
 
     """Fits the linear regression model, i.e. learns the regression parameters
                  ssr=ssr, std_coefficients=std_coefficients,
                  intercept=self.intercept)
 
-deprecated_members({"ridgeLambda": "ridge_lambda",
-                    "computeStats": "compute_stats",
-                    "useVars": "use_vars",
-                    "addSig": "add_sig",
-                    "removeSig": "remove_sig",
-                    }
-                   , ["__init__"],
-                   in_place=True)(LinearRegressionLearner)
 
 class LinearRegression(Orange.classification.Classifier):
 

Orange/regression/pls.py

     return Orange.data.Table(domain, table)
 
 
+@deprecated_members(
+    {"nComp": "n_comp",
+     "deflationMode": "deflation_mode",
+     "maxIter": "max_iter"},
+    wrap_methods=["__init__"])
 class PLSRegressionLearner(base.BaseRegressionLearner):
     """
     Fit the partial least squares regression model, i.e. learn the
                 "C": C, "P":P, "Q":Q, "x_rotations": xRotations,
                 "y_rotations": yRotations, "coefs": coefs}
 
-deprecated_members({"nComp": "n_comp",
-                    "deflationMode": "deflation_mode",
-                    "maxIter": "max_iter"},
-                   wrap_methods=["__init__"],
-                   in_place=True)(PLSRegressionLearner)
 
+@deprecated_members(
+    {"xVars": "x_vars",
+     "yVars": "y_vars",
+     "muX": "mu_x",
+     "muY": "mu_y",
+     "sigmaX": "sigma_x",
+     "sigmaY": "sigma_y"},
+    wrap_methods=["__init__"])
 class PLSRegression(Orange.classification.Classifier):
     """ Predict values of the response variables
     based on the values of independent variables.
 
         return xScores
     """
-              
-deprecated_members({"xVars": "x_vars", 
-                    "yVars": "y_vars",
-                    "muX": "mu_x",
-                    "muY": "mu_y",
-                    "sigmaX": "sigma_x",
-                    "sigmaY": "sigma_y"},
-                   wrap_methods=["__init__"],
-                   in_place=True)(PLSRegression)
-                   
+
 if __name__ == "__main__":
 
     import Orange

Orange/tuning/__init__.py

 from Orange.utils import deprecated_class_attribute, deprecated_keywords, \
                          deprecated_members
 
+
+@deprecated_members({"returnWhat": "return_what", "object": "learner"})
 class TuneParameters(Orange.classification.Learner):
 
     """.. attribute:: data
             lastobj = getattr(lastobj, i)
         return lastobj, names[-1]
 
-TuneParameters = deprecated_members(
-    {"returnWhat": "return_what",
-     "object": "learner"},
-    )(TuneParameters)
-
 
 class Tune1Parameter(TuneParameters):
 
             classifier.setattr("fitted_parameter", bestpar)
             return classifier
 
+
+@deprecated_members({"progressCallback": "progress_callback"})
 class TuneMParameters(TuneParameters):
 
     """The use of :obj:`Orange.optimization.TuneMParameters` differs from 
             classifier.fitted_parameters = bestpar
             return classifier
 
-TuneMParameters = deprecated_members(
-    {"progressCallback": "progress_callback"},
-    )(TuneMParameters)
 
+@deprecated_members({"storeCurve": "store_curve"}, wrap_methods=["__init__"])
 class ThresholdLearner(Orange.classification.Learner):
 
     """:obj:`Orange.optimization.ThresholdLearner` is a class that wraps 
         else:
             return ThresholdClassifier(classifier, threshold)
 
-ThresholdLearner = deprecated_members(
-    {"storeCurve": "store_curve"},
-    wrap_methods=["__init__"]
-    )(ThresholdLearner)
 
 class ThresholdClassifier(Orange.classification.Classifier):
 

Orange/utils/selection.py

 from Orange.utils import deprecated_members, deprecated_function_name, \
                         deprecated_keywords
 
+
+@deprecated_members(
+    {"callCompareOn1st": "call_compare_on_1st",
+     "winnerIndex": "winner_index",
+     "randomGenerator": "random_generator",
+     "bestIndex": "best_index"},
+    wrap_methods=["__init__"])
 class BestOnTheFly:
     """
     Finds the optimal object in a sequence of objects. The class is fed the
         else:
             return None
 
-BestOnTheFly = deprecated_members({"callCompareOn1st": "call_compare_on_1st",
-                                   "winnerIndex": "winner_index",
-                                   "randomGenerator": "random_generator",
-                                   "bestIndex": "best_index"
-                                   },
-                                   wrap_methods=["__init__"])(BestOnTheFly)
-
 
 @deprecated_keywords({"callCompareOn1st": "call_compare_on_1st"})
 def select_best(x, compare=cmp, seed = 0, call_compare_on_1st = False):