source: orange/Orange/fixes/fix_changed_names.py @ 9857:d98d5b2edf95

Revision 9857:d98d5b2edf95, 46.5 KB checked in by blaz <blaz.zupan@…>, 2 years ago (diff)

EntropyDiscretization -> Entropy

Line 
1""" This fixer changes all occurrences of the form 'module.member' from the
2global dictionary MAPPING's keys and replaces them with the corresponding
3value. It adds the proper imports to make it available in the script.
4
5For example this code::
6    import orange
7    import orngSVM
8    data = orange.ExampleTable("iris")
9    learner = orngSVM.SVMLearner(name='svm')
10   
11will be replaced with::
12    import Orange.data
13    import Orange.classification.svm
14    data = Orange.data.Table('iris')
15    learner = Orange.classification.svm.SVMLearner(name='svm')
16   
17Try to add as much name mappings as possible (This fixer is prefered
18(and will run before) the fix_orange_imports 
19   
20"""
21from lib2to3 import fixer_base
22from lib2to3 import fixer_util
23from lib2to3 import pytree
24from lib2to3.fixer_util import Name, Dot, Node, attr_chain, touch_import
25
26# Keys must be in the form of 'orange.name' not name or orange.bla.name
27# If the values name a doted name inside of the package the package and name
28# must be separated by ':' e.g. Orange.classification:Classifier.GetValue
29# indicates Classifier.GetValue is a name inside package Orange.classification,
30# do not use Orange.classification.Classifier.GetValue as this is assumed that
31# Orange.classification.Classifier is a package
32#
33MAPPING = {"orange.ExampleTable": "Orange.data.Table",
34           "orange.Example": "Orange.data.Instance",
35           "orange.Domain": "Orange.data.Domain",
36           "orange.Value": "Orange.data.Value",
37           "orange.VarTypes": "Orange.data.Type",
38           "orange.Variable": "Orange.data.variable.Variable",
39           "orange.EnumVariable": "Orange.data.variable.Discrete",
40           "orange.FloatVariable": "Orange.data.variable.Continuous",
41           "orange.StringVariable": "Orange.data.variable.String",
42           "orange.PythonVariable": "Orange.data.variable.Python",
43           "orange.VarList": "Orange.data.variable.Variables",
44           "orange.SymMatrix": "Orange.data.SymMatrix",
45           "orange.GetValue": "Orange.classification:Classifier.GetValue",
46           "orange.GetProbabilities": "Orange.classification:Classifier.GetProbabilities",
47           "orange.GetBoth": "Orange.classification:Classifier.GetBoth",
48
49           "orange.newmetaid": "Orange.data.new_meta_id",
50
51           "orange.Distribution": "Orange.statistics.distribution.Distribution",
52           "orange.DiscDistribution": "Orange.statistics.distribution.Discrete",
53           "orange.ContDistribution": "Orange.statistics.distribution.Continuous",
54           "orange.GaussianDistribution": "Orange.statistics.distribution.Gaussian",
55           "orange.DomainDistributions": "Orange.statistics.distribution.Domain",
56
57           "orange.BasicAttrStat": "Orange.statistics.basic.Variable",
58           "orange.DomainBasicAttrStat": "Orange.statistics.basic.Domain",
59
60           "orange.ContingencyAttrAttr": "Orange.statistics.contingency.VarVar",
61           "orange.ContingencyClass": "Orange.statistics.contingency.Class",
62           "orange.ContingencyAttrClass": "Orange.statistics.contingency.VarClass",
63           "orange.ContingencyClassAttr": "Orange.statistics.contingency.ClassVar",
64           "orange.DomainContingency": "Orange.statistics.contingency.Domain",
65           "orange.Contingency": "Orange.statistics.contingency.Table",
66
67           "orange.MeasureAttribute": "Orange.feature.scoring.Score",
68           "orange.MeasureAttributeFromProbabilities": "Orange.feature.scoring.ScoreFromProbabilities",
69           "orange.MeasureAttribute_gainRatio": "Orange.feature.scoring.GainRatio",
70           "orange.MeasureAttribute_relief": "Orange.feature.scoring.Relief",
71           "orange.MeasureAttribute_info": "Orange.feature.scoring.InfoGain",
72           "orange.MeasureAttribute_gini": "Orange.feature.scoring.Gini",
73
74           "orange.MeasureAttribute_relevance": "Orange.feature.scoring.Relevance",
75           "orange.MeasureAttribute_cost": "Orange.feature.scoring.Cost",
76           "orange.MeasureAttribute_MSE": "Orange.feature.scoring.MSE",
77
78           "orange.EntropyDiscretization": "Orange.feature.discretization.Entropy",
79           "orange.EquiDistDiscretization": "Orange.feature.discretization.EqualWidth",
80           "orange.EquiNDiscretization": "Orange.feature.discretization.EqualFreq",
81           "orange.BiModalDiscretization": "Orange.feature.discretization.BiModal",
82
83           "orngFSS.attMeasure": "Orange.feature.scoring.score_all",
84           "orngFSS.bestNAtts": "Orange.feature.selection.best_n",
85           "orngFSS.attsAbovethreshold": "Orange.feature.selection.above_threshold",
86           "orngFSS.selectBestNAtts": "Orange.feature.selection.select_best_n",
87           "orngFSS.selectAttsAboveThresh": "Orange.feature.selection.select_above_threshold",
88           "orngFSS.filterRelieff": "Orange.feature.selection.select_relief",
89           "orngFSS.FilterAttsAboveThresh": "Orange.feature.selection.FilterAboveThreshold",
90           "orngFSS.FilterAttsAboveThresh_Class": "Orange.feature.selection.FilterAboveThreshold",
91           "orngFSS.FilterBestNAtts": "Orange.feature.selection.FilterBestN",
92           "orngFSS.FilterBestNAtts_Class": "Orange.feature.selection.FilterBestN",
93           "orngFSS.FilterRelief": "Orange.feature.selection.FilterRelief",
94           "orngFSS.FilterRelief_Class": "Orange.feature.selection.FilterRelief",
95           "orngFSS.FilteredLearner": "Orange.feature.selection.FilteredLearner",
96           "orngFSS.FilteredLearner_Class": "Orange.feature.selection.FilteredLearner",
97           "orngFSS.FilteredClassifier": "Orange.feature.selection.FilteredClassifier",
98           "orngFSS.StepwiseLearner_Class": "Orange.classification.wrappers.StepwiseLearner",
99           "orngFSS.StepwiseLearner": "Orange.classification.wrappers.StepwiseLearner",
100
101           "orange.ImputerConstructor_model": "Orange.feature.imputation.ImputerConstructor_model",
102           "orange.Imputer_model": "Orange.feature.imputation.Imputer_model",
103           "orange.Imputer_defaults": "Orange.feature.imputation.Imputer_defaults",
104           "orange.ImputerConstructor_asValue": "Orange.feature.imputation.ImputerConstructor_asValue",
105           "orange.ImputerConstructor_minimal": "Orange.feature.imputation.ImputerConstructor_minimal",
106           "orange.ImputerConstructor_maximal": "Orange.feature.imputation.ImputerConstructor_maximal",
107           "orange.ImputerConstructor_average": "Orange.feature.imputation.ImputerConstructor_average",
108
109           "orange.ExamplesDistance": "Orange.distance.Distance",
110           "orange.ExamplesDistance_Normalized": "Orange.distance.DistanceNormalized",
111           "orange.ExamplesDistanceConstructor": "Orange.distance.DistanceConstructor",
112           "orange.ExamplesDistance_Hamming": "Orange.distance.HammingDistance",
113           "orange.ExamplesDistance_DTW": "Orange.distance.DTWDistance",
114           "orange.ExamplesDistance_Euclidean": "Orange.distance.EuclideanDistance",
115           "orange.ExamplesDistance_Manhattan": "Orange.distance.ManhattanDistance",
116           "orange.ExamplesDistance_Maximal": "Orange.distance.MaximalDistance",
117           "orange.ExamplesDistance_Relief": "Orange.distance.ReliefDistance",
118
119           "orange.ExamplesDistanceConstructor_DTW": "Orange.distance.DTW",
120           "orange.ExamplesDistanceConstructor_Euclidean": "Orange.distance.Euclidean",
121           "orange.ExamplesDistanceConstructor_Hamming": "Orange.distance.Hamming",
122           "orange.ExamplesDistanceConstructor_Manhattan": "Orange.distance.Manhattan",
123           "orange.ExamplesDistanceConstructor_Maximal": "Orange.distance.Maximal",
124           "orange.ExamplesDistanceConstructor_Relief": "Orange.distance.Relief",
125
126           "orngClustering.ExamplesDistanceConstructor_PearsonR": "Orange.distance.PearsonR",
127           "orngClustering.ExamplesDistance_PearsonR": "Orange.distance.PearsonRDistance",
128           "orngClustering.ExamplesDistanceConstructor_SpearmanR": "Orange.distance.SpearmanR",
129           "orngClustering.ExamplesDistance_SpearmanR": "Orange.distance.SpearmanRDistance",
130
131           "orngClustering.KMeans": "Orange.clustering.kmeans.Clustering",
132           "orngClustering.kmeans_init_random": "Orange.clustering.kmeans.init_random",
133           "orngClustering.kmeans_init_diversity": "Orange.clustering.kmeans.init_diversity",
134           "orngClustering.KMeans_init_hierarchicalClustering": "Orange.clustering.kmeans.init_hclustering",
135           "orngClustering.data_center": "Orange.clustering.kmeans.data_center",
136           "orngClustering.plot_silhouette": "Orange.clustering.kmeans.plot_silhouette",
137           "orngClustering.score_distance_to_centroids": "Orange.clustering.kmeans.score_distance_to_centroids",
138           "orngClustering.score_silhouette": "Orange.clustering.kmeans.score_silhouette",
139
140           "orange.HierarchicalClustering": "Orange.clustering.hierarchical.HierarchicalClustering",
141           "orange.HierarchicalCluster": "Orange.clustering.hierarchical.HierarchicalCluster",
142           "orngClustering.hierarchicalClustering": "Orange.clustering.hierarchical.clustering",
143           "orngClustering.hierarchicalClustering_attributes": "Orange.clustering.hierarchical.clustering_features",
144           "orngClustering.hierarchicalClustering_clusterList": "Orange.clustering.hierarchical.cluster_to_list",
145           "orngClustering.hierarchicalClustering_topClusters": "Orange.clustering.hierarchical.top_clusters",
146           "orngClustering.hierarhicalClustering_topClustersMembership": "Orange.clustering.hierarchical.top_cluster_membership",
147           "orngClustering.orderLeaves": "Orange.clustering.hierarchical.order_leaves",
148           "orngClustering.dendrogram_draw": "Orange.clustering.hierarchical.dendrogram_draw",
149           "orngClustering.DendrogramPlot": "Orange.clustering.hierarchical.DendrogramPlot",
150           "orngClustering.DendrogramPlotPylab": "Orange.clustering.hierarchical.DendrogramPlotPylab",
151
152           "orngSVM.RBFKernelWrapper": "Orange.classification.svm.kernels.RBFKernelWrapper",
153           "orngSVM.CompositeKernelWrapper": "Orange.classification.svm.kernels.CompositeKernelWrapper",
154           "orngSVM.KernelWrapper": "Orange.classification.svm.kernels.KernelWrapper",
155           "orngSVM.DualKernelWrapper": "Orange.classification.svm.kernels.DualKernelWrapper",
156           "orngSVM.PolyKernelWrapper": "Orange.classification.svm.kernels.PolyKernelWrapper",
157           "orngSVM.AdditionKernelWrapper": "Orange.classification.svm.kernels.AdditionKernelWrapper",
158           "orngSVM.MultiplicationKernelWrapper": "Orange.classification.svm.kernels.MultiplicationKernelWrapper",
159           "orngSVM.SparseLinKernel": "Orange.classification.svm.kernels.SparseLinKernel",
160           "orngSVM.BagOfWords": "Orange.classification.svm.kernels.BagOfWords",
161           "orngSVM.SVMLearner": "Orange.classification.svm.SVMLearner",
162           "orngSVM.SVMLearnerEasy": "Orange.classification.svm.SVMLearnerEasy",
163           "orngSVM.SVMLearnerSparse": "Orange.classification.svm.SVMLearnerSparse",
164
165           "orange.kNNLearner":"Orange.classification.knn.kNNLearner",
166           "orange.kNNClassifier":"Orange.classification.knn.kNNClassifier",
167           "orange.FindNearest_BruteForce":"Orange.classification.knn.FindNearest",
168           "orange.FindNearestConstructor_BruteForce":"Orange.classification.knn.FindNearestConstructor",
169           "orange.P2NN":"Orange.classification.knn.P2NN",
170
171           "orange.BayesLearner":"Orange.classification.bayes.NaiveLearner",
172           "orange.BayesClassifier":"Orange.classification.bayes.NaiveClassifier",
173           "orngBayes.BayesLearner":"Orange.classification.bayes.NaiveLearner",
174           "orngBayes.BayesClassifier":"Orange.classification.bayes.NaiveClassifier",
175           "orngBayes.printModel": "Orange.classification.bayes.printModel",
176
177           "orngNetwork.MdsTypeClass":"Orange.network.MdsTypeClass",
178           "orngNetwork.Network":"Orange.network.Network",
179           "orngNetwork.NetworkOptimization":"Orange.network.NetworkOptimization",
180           "orngNetwork.NetworkClustering":"Orange.network.NetworkClustering",
181           "orange.Graph":"Orange.network.Graph",
182           "orange.GraphAsList":"Orange.network.GraphAsList",
183           "orange.GraphAsMatrix":"Orange.network.GraphAsMatrix",
184           "orange.GraphAsTree":"Orange.network.GraphAsTree",
185
186           "orngEnsemble.MeasureAttribute_randomForests":"Orange.ensemble.forest.ScoreFeature",
187
188           "orange.TreeLearner": "Orange.classification.tree.TreeLearner",
189           "orange.TreeClassifier": "Orange.classification.tree.TreeClassifier",
190           "orange.C45Learner": "Orange.classification.tree.C45Learner",
191           "orange.C45Classifier": "Orange.classification.tree.C45Classifier",
192           "orange.C45TreeNode": "Orange.classification.tree.C45Node",
193           "orange.C45TreeNodeList": "Orange.classification.tree.C45NodeList",
194           "orange.TreeDescender": "Orange.classification.tree.Descender",
195           "orange.TreeDescender_UnknownMergeAsBranchSizes": "Orange.classification.tree.Descender_UnknownMergeAsBranchSizes",
196           "orange.TreeDescender_UnknownMergeAsSelector": "Orange.classification.tree.Descender_UnknownMergeAsSelector",
197           "orange.TreeDescender_UnknownToBranch": "Orange.classification.tree.Descender_UnknownToBranch",
198           "orange.TreeDescender_UnknownToCommonBranch": "Orange.classification.tree.Descender_UnknownToCommonBranch",
199           "orange.TreeDescender_UnknownToCommonSelector":"Orange.classification.tree.Descender_UnknownToCommonSelector",
200           "orange.TreeExampleSplitter":"Orange.classification.tree.Splitter",
201           "orange.TreeExampleSplitter_IgnoreUnknowns":"Orange.classification.tree.Splitter_IgnoreUnknowns",
202           "orange.TreeExampleSplitter_UnknownsAsBranchSizes":"Orange.classification.tree.Splitter_UnknownsAsBranchSizes",
203           "orange.TreeExampleSplitter_UnknownsAsSelecto":"Orange.classification.tree.Splitter_UnknownsAsSelector",
204           "orange.TreeExampleSplitter_UnknownsToAll":"Orange.classification.tree.Splitter_UnknownsToAll",
205           "orange.TreeExampleSplitter_UnknownsToBranch":"Orange.classification.tree.Splitter_UnknownsToBranch",
206           "orange.TreeExampleSplitter_UnknownsToCommon":"Orange.classification.tree.Splitter_UnknownsToCommon",
207           "orange.TreeExampleSplitter_UnknownsToRandom":"Orange.classification.tree.Splitter_UnknownsToRandom",
208           "orange.TreeNode":"Orange.classification.tree.Node",
209           "orange.TreeNodeList":"Orange.classification.tree.NodeList",
210           "orange.TreePruner":"Orange.classification.tree.Pruner",
211           "orange.TreePruner_SameMajority":"Orange.classification.tree.Pruner_SameMajority",
212           "orange.TreePruner_m":"Orange.classification.tree.Pruner_m",
213           "orange.TreeSplitConstructor":"Orange.classification.tree.SplitConstructor",
214           "orange.TreeSplitConstructor_Combined":"Orange.classification.tree.SplitConstructor_Combined",
215           "orange.TreeSplitConstructor_Measure":"Orange.classification.tree.SplitConstructor_Score",
216           "orange.TreeSplitConstructor_Attribute":"Orange.classification.tree.SplitConstructor_Feature",
217           "orange.TreeSplitConstructor_ExhaustiveBinary":"Orange.classification.tree.SplitConstructor_ExhaustiveBinary",
218           "orange.TreeSplitConstructor_OneAgainstOthers":"Orange.classification.tree.SplitConstructor_OneAgainstOthers",
219           "orange.TreeSplitConstructor_Threshold":"Orange.classification.tree.SplitConstructor_Threshold",
220           "orange.TreeStopCriteria":"Orange.classification.tree.StopCriteria",
221           "orange.TreeStopCriteria_Python":"Orange.classification.tree.StopCriteria_Python",
222           "orange.TreeStopCriteria_common":"Orange.classification.tree.StopCriteria_common",
223
224           "orngTree.printTxt": "Orange.classification.tree:TreeClassifier.dump",
225           "orngTree.printTree": "Orange.classification.tree:TreeClassifier.dump",
226           "orngTree.dumpTree": "Orange.classification.tree:TreeClassifier.dump",
227           "orngTree.printDot": "Orange.classification.tree:TreeClassifier.dot",
228           "orngTree.dotTree": "Orange.classification.tree:TreeClassifier.dot",
229           "orngTree.dump": "Orange.classification.tree:TreeClassifier.dump",
230           "orngTree.dot": "Orange.classification.tree:TreeClassifier.dot",
231           "orngTree.countLeaves": "Orange.classification.tree:TreeClassifier.count_leaves",
232           "orngTree.countNodes": "Orange.classification.tree:TreeClassifier.count_nodes",
233           "orngTree.byWhom": "Orange.classification.tree.by_whom",
234           "orngTree.insertStr": "Orange.classification.tree.insert_str",
235           "orngTree.insertDot": "Orange.classification.tree.insert_dot",
236           "orngTree.insertNum": "Orange.classification.tree.insert_num",
237
238           "orange.MajorityLearner":"Orange.classification.majority.MajorityLearner",
239           "orange.DefaultClassifier":"Orange.classification.ConstantClassifier",
240
241           "orange.LookupLearner":"Orange.classification.lookup.LookupLearner",
242           "orange.ClassifierByLookupTable":"Orange.classification.lookup.ClassifierByLookupTable",
243           "orange.ClassifierByLookupTable1":"Orange.classification.lookup.ClassifierByLookupTable1",
244           "orange.ClassifierByLookupTable2":"Orange.classification.lookup.ClassifierByLookupTable2",
245           "orange.ClassifierByLookupTable3":"Orange.classification.lookup.ClassifierByLookupTable3",
246           "orange.ClassifierByExampleTable":"Orange.classification.lookup.ClassifierByDataTable",
247
248           "orngLookup.lookupFromBound":"Orange.classification.lookup.lookup_from_bound",
249           "orngLookup.lookupFromExamples":"Orange.classification.lookup.lookup_from_data",
250           "orngLookup.lookupFromFunction":"Orange.classification.lookup.lookup_from_function",
251           "orngLookup.printLookupFunction":"Orange.classification.lookup.dump_lookup_function",
252
253           "orange.AssociationRule" : "Orange.associate.AssociationRule",
254           "orange.AssociationRules" : "Orange.associate.AssociationRules",
255           "orange.AssociationRulesInducer" : "Orange.associate.AssociationRulesInducer",
256           "orange.AssociationRulesSparseInducer" : "Orange.associate.AssociationRulesSparseInducer",
257           "orange.ItemsetNodeProxy" : "Orange.associate.ItemsetNodeProxy",
258           "orange.ItemsetsSparseInducer" : "Orange.associate.ItemsetsSparseInducer",
259
260           "orngCN2.ruleToString": "Orange.classification.rules.rule_to_string",
261           "orngCN2.LaplaceEvaluator": "Orange.classification.rules.LaplaceEvaluator",
262           "orngCN2.WRACCEvaluator": "Orange.classification.rules.WRACCEvaluator",
263           "orngCN2.mEstimate": "Orange.classification.rules.MEstimateEvaluator",
264           "orngCN2.RuleStopping_apriori": "Orange.classification.rules.RuleStopping_Apriori",
265           "orngCN2.LengthValidator": "Orange.classification.rules.LengthValidator",
266           "orngCN2.supervisedClassCheck": "Orange.classification.rules.supervisedClassCheck",
267           "orngCN2.CN2Learner": "Orange.classification.rules.CN2Learner",
268           "orngCN2.CN2Classifier": "Orange.classification.rules.CN2Classifier",
269           "orngCN2.CN2UnorderedLearner": "Orange.classification.rules.CN2UnorderedLearner",
270           "orngCN2.CN2UnorderedClassifier": "Orange.classification.rules.CN2UnorderedClassifier",
271           "orngCN2.RuleClassifier_bestRule": "Orange.classification.rules.RuleClassifier_BestRule",
272           "orngCN2.CovererAndRemover_multWeights": "Orange.classification.rules.CovererAndRemover_MultWeights",
273           "orngCN2.CovererAndRemover_addWeights": "Orange.classification.rules.CovererAndRemover_AddWeights",
274           "orngCN2.rule_in_set": "Orange.classification.rules.rule_in_set",
275           "orngCN2.rules_equal": "Orange.classification.rules.rules_equal",
276           "orngCN2.noDuplicates_validator": "Orange.classification.rules.NoDuplicatesValidator",
277           "orngCN2.ruleSt_setRules": "Orange.classification.rules.RuleStopping_SetRules",
278           "orngCN2.CN2SDUnorderedLearner": "Orange.classification.rules.CN2SDUnorderedLearner",
279#           "orngCN2.avg": "Orange.classification.rules.avg",
280#           "orngCN2.var": "Orange.classification.rules.var",
281#           "orngCN2.median": "Orange.classification.rules.median",
282#           "orngCN2.perc": "Orange.classification.rules.perc",
283#           "orngCN2.createRandomDataSet": "Orange.classification.rules.createRandomDataSet",
284#           "orngCN2.compParameters": "Orange.classification.rules.compParameters",
285#           "orngCN2.computeDists": "Orange.classification.rules.computeDists",
286#           "orngCN2.createEVDistList": "Orange.classification.rules.createEVDistList",
287           "orngCN2.CovererAndRemover_Prob": "Orange.classification.rules.CovererAndRemover_Prob",
288           "orngCN2.add_sub_rules": "Orange.classification.rules.add_sub_rules",
289           "orngCN2.CN2EVCUnorderedLearner": "Orange.classification.rules.CN2EVCUnorderedLearner",
290
291           "orngMDS.KruskalStress": "Orange.projection.mds.KruskalStress",
292           "orngMDS.SammonStress": "Orange.projection.mds.SammonStress",
293           "orngMDS.SgnSammonStress": "Orange.projection.mds.SgnSammonStress",
294           "orngMDS.SgnRelStress": "Orange.projection.mds.SgnRelStress",
295           "orngMDS.PointList": "Orange.projection.mds.PointList",
296           "orngMDS.FloatListList": "Orange.projection.mds.FloatListList",
297           "orngMDS.PivotMDS": "Orange.projection.mds.PivotMDS",
298           "orngMDS.MDS": "Orange.projection.mds.MDS",
299
300           "orngStat.AP" : "Orange.evaluation.scoring.AP",
301           "orngStat.AROC" : "Orange.evaluation.scoring.AROC",
302           "orngStat.AROCFromCDT" : "Orange.evaluation.scoring.AROC_from_CDT",
303           "orngStat.AUC" : "Orange.evaluation.scoring.AUC",
304           "orngStat.AUCWilcoxon" : "Orange.evaluation.scoring.AUCWilcoxon",
305           "orngStat.AUC_binary" : "Orange.evaluation.scoring.AUC_binary",
306           "orngStat.AUC_i" : "Orange.evaluation.scoring.AUC_i",
307           "orngStat.AUC_ij" : "Orange.evaluation.scoring.AUC_ij",
308           "orngStat.AUC_iterations" : "Orange.evaluation.scoring.AUC_iterations",
309           "orngStat.AUC_matrix" : "Orange.evaluation.scoring.AUC_matrix",
310           "orngStat.AUC_multi" : "Orange.evaluation.scoring.AUC_multi",
311           "orngStat.AUC_pair" : "Orange.evaluation.scoring.AUC_pair",
312           "orngStat.AUC_single" : "Orange.evaluation.scoring.AUC_single",
313           "orngStat.AUC_x" : "Orange.evaluation.scoring.AUC_x",
314           "orngStat.BSS" : "Orange.evaluation.scoring.BSS",
315           "orngStat.BrierScore" : "Orange.evaluation.scoring.Brier_score",
316           "orngStat.CA" : "Orange.evaluation.scoring.CA",
317           "orngStat.CA_se" : "Orange.evaluation.scoring.CA_se",
318           "orngStat.CDT" : "Orange.evaluation.scoring.CDT",
319           "orngStat.ConfusionMatrix" : "Orange.evaluation.scoring.ConfusionMatrix",
320           "orngStat.F1" : "Orange.evaluation.scoring.F1",
321           "orngStat.Falpha" : "Orange.evaluation.scoring.Falpha",
322           "orngStat.Friedman" : "Orange.evaluation.scoring.Friedman",
323           "orngStat.IS" : "Orange.evaluation.scoring.IS",
324           "orngStat.IS_ex" : "Orange.evaluation.scoring.IS_ex",
325           "orngStat.MAE" : "Orange.evaluation.scoring.MAE",
326           "orngStat.MCC" : "Orange.evaluation.scoring.MCC",
327           "orngStat.ME" : "Orange.evaluation.scoring.ME",
328           "orngStat.MSE" : "Orange.evaluation.scoring.MSE",
329           "orngStat.MSE_old" : "Orange.evaluation.scoring.MSE_old",
330           "orngStat.McNemar" : "Orange.evaluation.scoring.McNemar",
331           "orngStat.McNemarOfTwo" : "Orange.evaluation.scoring.McNemar_of_two",
332           "orngStat.NPV" : "Orange.evaluation.scoring.NPV",
333           "orngStat.PPV" : "Orange.evaluation.scoring.PPV",
334           "orngStat.R2" : "Orange.evaluation.scoring.R2",
335           "orngStat.RAE" : "Orange.evaluation.scoring.RAE",
336           "orngStat.RMSE" : "Orange.evaluation.scoring.RMSE",
337           "orngStat.RMSE_old" : "Orange.evaluation.scoring.RMSE_old",
338           "orngStat.ROCaddPoint" : "Orange.evaluation.scoring.ROC_add_point",
339           "orngStat.ROCsFromCDT" : "Orange.evaluation.scoring.ROCs_from_CDT",
340           "orngStat.ROCslope" : "Orange.evaluation.scoring.ROC_slope",
341           "orngStat.RRSE" : "Orange.evaluation.scoring.RRSE",
342           "orngStat.RSE" : "Orange.evaluation.scoring.RSE",
343           "orngStat.TCbestThresholdsOnROCcurve" : "Orange.evaluation.scoring.TC_best_thresholds_on_ROC_curve",
344           "orngStat.TCcomputeROC" : "Orange.evaluation.scoring.TC_compute_ROC",
345           "orngStat.TCthresholdlAverageROC" : "Orange.evaluation.scoring.TC_threshold_average_ROC",
346           "orngStat.TCverticalAverageROC" : "Orange.evaluation.scoring.TC_vertical_average_ROC",
347           "orngStat.Wilcoxon" : "Orange.evaluation.scoring.Wilcoxon",
348           "orngStat.WilcoxonPairs" : "Orange.evaluation.scoring.Wilcoxon_pairs",
349#           "orngStat.add" : "Orange.evaluation.scoring.add",
350#           "orngStat.checkArgkw" : "Orange.evaluation.scoring.checkArgkw",
351#           "orngStat.checkNonZero" : "Orange.evaluation.scoring.checkNonZero",
352           "orngStat.classProbabilitiesFromRes" : "Orange.evaluation.scoring.class_probabilities_from_res",
353           "orngStat.compare2AROCs" : "Orange.evaluation.scoring.compare_2_AROCs",
354           "orngStat.compare2AUCs" : "Orange.evaluation.scoring.compare_2_AUCs",
355           "orngStat.computeCDT" : "Orange.evaluation.scoring.compute_CDT",
356           "orngStat.computeCalibrationCurve" : "Orange.evaluation.scoring.compute_calibration_curve",
357           "orngStat.computeConfusionMatrices" : "Orange.evaluation.scoring.compute_confusion_matrices",
358           "orngStat.computeLiftCurve" : "Orange.evaluation.scoring.compute_lift_curve",
359           "orngStat.computeROC" : "Orange.evaluation.scoring.compute_ROC",
360           "orngStat.compute_CD" : "Orange.evaluation.scoring.compute_CD",
361           "orngStat.compute_friedman" : "Orange.evaluation.scoring.compute_friedman",
362           "orngStat.confusionChiSquare" : "Orange.evaluation.scoring.confusion_chi_square",
363           "orngStat.confusionMatrices" : "Orange.evaluation.scoring.confusion_matrices",
364           "orngStat.defaultLineTypes" : "Orange.evaluation.scoring.default_line_types",
365           "orngStat.defaultPointTypes" : "Orange.evaluation.scoring.default_point_types",
366#           "orngStat.frange" : "Orange.evaluation.scoring.frange",
367#           "orngStat.gettotsize" : "Orange.evaluation.scoring.gettotsize",
368#           "orngStat.gettotweight" : "Orange.evaluation.scoring.gettotweight",
369           "orngStat.graph_ranks" : "Orange.evaluation.scoring.graph_ranks",
370           "orngStat.isCDTEmpty" : "Orange.evaluation.scoring.is_CDT_empty",
371           "orngStat.learningCurve2PiCTeX" : "Orange.evaluation.scoring.learning_curve_to_PiCTeX",
372           "orngStat.learningCurveLearners2PiCTeX" : "Orange.evaluation.scoring.learning_curve_learners_to_PiCTeX",
373           "orngStat.legend2PiCTeX" : "Orange.evaluation.scoring.legend_to_PiCTeX",
374           "orngStat.legendLearners2PiCTeX" : "Orange.evaluation.scoring.legend_learners_to_PiCTeX",
375#           "orngStat.log2" : "Orange.evaluation.scoring.log2",
376#           "orngStat.math" : "Orange.evaluation.scoring.math",
377#           "orngStat.numpy" : "Orange.evaluation.scoring.numpy",
378#           "orngStat.operator" : "Orange.evaluation.scoring.operator",
379           "orngStat.plotLearningCurve" : "Orange.evaluation.scoring.plot_learning_curve",
380           "orngStat.plotLearningCurveLearners" : "Orange.evaluation.scoring.plot_learning_curve_learners",
381           "orngStat.plotMcNemarCurve" : "Orange.evaluation.scoring.plot_McNemar_curve",
382           "orngStat.plotMcNemarCurveLearners" : "Orange.evaluation.scoring.plot_McNemar_curve_learners",
383           "orngStat.plotROC" : "Orange.evaluation.scoring.plot_ROC",
384           "orngStat.plotROCLearners" : "Orange.evaluation.scoring.plot_ROC_learners",
385           "orngStat.precision" : "Orange.evaluation.scoring.precision",
386           "orngStat.printSingleROCCurveCoordinates" : "Orange.evaluation.scoring.print_single_ROC_curve_coordinates",
387           "orngStat.rankDifference" : "Orange.evaluation.scoring.rank_difference",
388           "orngStat.recall" : "Orange.evaluation.scoring.recall",
389           "orngStat.regressionError" : "Orange.evaluation.scoring.regression_error",
390           "orngStat.scottsPi" : "Orange.evaluation.scoring.scotts_pi",
391           "orngStat.sens" : "Orange.evaluation.scoring.sens",
392           "orngStat.spec" : "Orange.evaluation.scoring.spec",
393           "orngStat.splitByIterations" : "Orange.evaluation.scoring.split_by_iterations",
394#           "orngStat.statc" : "Orange.evaluation.scoring.statc",
395           "orngStat.statisticsByFolds" : "Orange.evaluation.scoring.statistics_by_folds",
396#           "orngStat.x" : "Orange.evaluation.scoring.x",
397
398           # Orange.selection
399           "orngMisc.BestOnTheFly":"Orange.misc.selection.BestOnTheFly",
400           "orngMisc.selectBest":"Orange.misc.selection.select_best",
401           "orngMisc.selectBestIndex":"Orange.misc.selection.select_best_index",
402           "orngMisc.compare2_firstBigger":"Orange.misc.selection.compare_first_bigger",
403           "orngMisc.compare2_firstBigger":"Orange.misc.selection.compare_first_bigger",
404           "orngMisc.compare2_firstSmaller":"Orange.misc.selection.compare_first_smaller",
405           "orngMisc.compare2_lastBigger":"Orange.misc.selection.compare_last_bigger",
406           "orngMisc.compare2_lastSmaller":"Orange.misc.selection.compare_last_smaller",
407           "orngMisc.compare2_bigger":"Orange.misc.selection.compare_bigger",
408           "orngMisc.compare2_smaller":"Orange.misc.selection.compare_smaller",
409
410           "orngMisc.Renderer": "Orange.misc.render.Renderer",
411           "orngMisc.EPSRenderer": "Orange.misc.render.EPSRenderer",
412           "orngMisc.SVGRenderer": "Orange.misc.render.SVGRenderer",
413           "orngMisc.PILRenderer": "Orange.misc.render.PILRenderer",
414           # The rest of orngMisc is handled by fix_orange_imports (maps to Orange.misc)
415
416           "orngEnsemble.BaggedLearner":"Orange.ensemble.bagging.BaggedLearner",
417           "orngEnsemble.BaggedClassifier":"Orange.ensemble.bagging.BaggedClassifier",
418           "orngEnsemble.BoostedLearner":"Orange.ensemble.boosting.BoostedLearner",
419           "orngEnsemble.BoostedClassifier":"Orange.ensemble.boosting.BoostedClassifier",
420           "orngEnsemble.RandomForestClassifier":"Orange.ensemble.forest.RandomForestClassifier",
421           "orngEnsemble.RandomForestLearner":"Orange.ensemble.forest.RandomForestLearner",
422           "orngEnsemble.MeasureAttribute_randomForests":"Orange.ensemble.forest.ScoreFeature",
423           "orngEnsemble.SplitConstructor_AttributeSubset":"Orange.ensemble.forest.SplitConstructor_AttributeSubset",
424
425           "orngTest.proportionTest":"Orange.evaluation.testing.proportion_test",
426           "orngTest.leaveOneOut":"Orange.evaluation.testing.leave_one_out",
427           "orngTest.crossValidation":"Orange.evaluation.testing.cross_validation",
428           "orngTest.testWithIndices":"Orange.evaluation.testing.test_with_indices",
429           "orngTest.learningCurve":"Orange.evaluation.testing.learning_curve",
430           "orngTest.learningCurveN":"Orange.evaluation.testing.learning_curve_n",
431           "orngTest.learningCurveWithTestData":"Orange.evaluation.testing.learning_curve_with_test_data",
432           "orngTest.learnAndTestOnTestData":"Orange.evaluation.testing.learn_and_test_on_test_data",
433           "orngTest.learnAndTestOnLearnData":"Orange.evaluation.testing.learn_and_test_on_learn_data",
434           "orngTest.testOnData":"Orange.evaluation.testing.test_on_data",
435           "orngTest.TestedExample":"Orange.evaluation.testing.TestedExample",
436           "orngTest.ExperimentResults":"Orange.evaluation.testing.ExperimentResults",
437
438           "orngLR.dump":"Orange.classification.logreg.dump",
439           "orngLR.printOUT":"Orange.classification.logreg.dump",
440           "orngLR.printOut":"Orange.classification.logreg.dump",
441           "orngLR.hasDiscreteValues":"Orange.classification.logreg.has_discrete_values",
442           "orngLR.LogRegLearner":"Orange.classification.logreg.LogRegLearner",
443           "orngLR.LogRegLearnerClass":"Orange.classification.logreg.LogRegLearner",
444           "orngLR.Univariate_LogRegLearner":"Orange.classification.logreg.UnivariateLogRegLearner",
445           "orngLR.Univariate_LogRegLearner_Class":"Orange.classification.logreg.UnivariateLogRegLearner",
446           "orngLR.Univariate_LogRegClassifier":"Orange.classification.logreg.UnivariateLogRegClassifier",
447           "orngLR.LogRegLearner_getPriors":"Orange.classification.logreg.LogRegLearnerGetPriors",
448           "orngLR.LogRegLearnerClass_getPriors":"Orange.classification.logreg.LogRegLearnerGetPriors",
449           "orngLR.LogRegLearnerClass_getPriors_OneTable":"Orange.classification.logreg.LogRegLearnerGetPriorsOneTable",
450           "orngLR.Pr":"Orange.classification.logreg.pr",
451           "orngLR.lh":"Orange.classification.logreg.lh",
452           "orngLR.diag":"Orange.classification.logreg.diag",
453           "orngLR.simpleFitter":"Orange.classification.logreg.SimpleFitter",
454           "orngLR.Pr_bx":"Orange.classification.logreg.pr_bx",
455           "orngLR.bayesianFitter":"Orange.classification.logreg.BayesianFitter",
456           "orngLR.StepWiseFSS":"Orange.classification.logreg.StepWiseFSS",
457           "orngLR.getLikelihood":"Orange.classification.logreg.get_likelihood",
458           "orngLR.StepWiseFSS_class":"Orange.classification.logreg.StepWiseFSS",
459           "orngLR.StepWiseFSS_Filter":"Orange.classification.logreg.StepWiseFSSFilter",
460           "orngLR.StepWiseFSS_Filter_class":"Orange.classification.logreg.StepWiseFSSFilter",
461           "orngLR.lchisqprob":"Orange.classification.logreg.lchisqprob",
462           "orngLR.zprob":"Orange.classification.logreg.zprob",
463
464           "orange.Preprocessor": "Orange.preprocess.Preprocessor",
465           "orange.Preprocessor_addCensorWeight": "Orange.preprocess.Preprocessor_addCensorWeight",
466           "orange.Preprocessor_addClassNoise": "Orange.preprocess.Preprocessor_addClassNoise",
467           "orange.Preprocessor_addClassWeight": "Orange.preprocess.Preprocessor_addClassWeight",
468           "orange.Preprocessor_addGaussianClassNoise": "Orange.preprocess.Preprocessor_addGaussianClassNoise",
469           "orange.Preprocessor_addGaussianNoise": "Orange.preprocess.Preprocessor_addGaussianNoise",
470           "orange.Preprocessor_addMissing": "Orange.preprocess.Preprocessor_addMissing",
471           "orange.Preprocessor_addMissingClasses": "Orange.preprocess.Preprocessor_addMissingClasses",
472           "orange.Preprocessor_addNoise": "Orange.preprocess.Preprocessor_addNoise",
473           "orange.Preprocessor_discretize": "Orange.preprocess.Preprocessor_discretize",
474           "orange.Preprocessor_drop": "Orange.preprocess.Preprocessor_drop",
475           "orange.Preprocessor_dropMissing": "Orange.preprocess.Preprocessor_dropMissing",
476           "orange.Preprocessor_dropMissingClasses": "Orange.preprocess.Preprocessor_dropMissingClasses",
477           "orange.Preprocessor_filter": "Orange.preprocess.Preprocessor_filter",
478           "orange.Preprocessor_ignore": "Orange.preprocess.Preprocessor_ignore",
479           "orange.Preprocessor_imputeByLearner": "Orange.preprocess.Preprocessor_imputeByLearner",
480           "orange.Preprocessor_removeDuplicates": "Orange.preprocess.Preprocessor_removeDuplicates",
481           "orange.Preprocessor_select": "Orange.preprocess.Preprocessor_select",
482           "orange.Preprocessor_shuffle": "Orange.preprocess.Preprocessor_shuffle",
483           "orange.Preprocessor_take": "Orange.preprocess.Preprocessor_take",
484           "orange.Preprocessor_takeMissing": "Orange.preprocess.Preprocessor_takeMissing",
485           "orange.Preprocessor_takeMissingClasses": "Orange.preprocess.Preprocessor_takeMissingClasses",
486
487           "orange.Discretizer": "Orange.feature.discretization.Discretizer",
488           "orange.BiModalDiscretizer": "Orange.feature.discretization.BiModalDiscretizer",
489           "orange.EquiDistDiscretizer": "Orange.feature.discretization.EquiDistDiscretizer",
490           "orange.IntervalDiscretizer": "Orange.feature.discretization.IntervalDiscretizer",
491           "orange.ThresholdDiscretizer": "Orange.feature.discretization.ThresholdDiscretizer",
492           "orange.EntropyDiscretization": "Orange.feature.discretization.Entropy",
493           "orange.Discrete2Continuous": "Orange.feature.discretization.Discrete2Continuous",
494
495           "orange.DomainContinuizer": "Orange.feature.continuization.DomainContinuizer",
496
497           "orange.MakeRandomIndices": "Orange.data.sample.SubsetIndices",
498           "orange.MakeRandomIndicesN": "Orange.data.sample.SubsetIndicesN",
499           "orange.MakeRandomIndicesCV": "Orange.data.sample.SubsetIndicesCV",
500           "orange.MakeRandomIndicesMultiple": "Orange.data.sample.SubsetIndicesMultiple",
501           "orange.MakeRandomIndices2": "Orange.data.sample.SubsetIndices2",
502
503           "orngLinProj.FAST_IMPLEMENTATION": "Orange.projection.linear.FAST_IMPLEMENTATION",
504           "orngLinProj.SLOW_IMPLEMENTATION": "Orange.projection.linear.SLOW_IMPLEMENTATION",
505           "orngLinProj.LDA_IMPLEMENTATION": "Orange.projection.linear.LDA_IMPLEMENTATION",
506           "orngLinProj.LAW_LINEAR": "Orange.projection.linear.LAW_LINEAR",
507           "orngLinProj.LAW_SQUARE": "Orange.projection.linear.LAW_SQUARE",
508           "orngLinProj.LAW_GAUSSIAN": "Orange.projection.linear.LAW_GAUSSIAN",
509           "orngLinProj.LAW_KNN": "Orange.projection.linear.LAW_KNN",
510           "orngLinProj.LAW_LINEAR_PLUS": "Orange.projection.linear.LAW_LINEAR_PLUS",
511           "orngLinProj.DR_PCA": "Orange.projection.linear.DR_PCA",
512           "orngLinProj.DR_SPCA": "Orange.projection.linear.DR_SPCA",
513           "orngLinProj.DR_PLS": "Orange.projection.linear.DR_PLS",
514           "orngLinProj.normalize": "Orange.projection.linear.normalize",
515           "orngLinProj.center": "Orange.projection.linear.center",
516           "orngLinProj.FreeViz": "Orange.projection.linear.FreeViz",
517           "orngLinProj.createPLSProjection": "Orange.projection.linear.create_pls_projection",
518           "orngLinProj.createPCAProjection": "Orange.projection.linear.create_pca_projection",
519           "orngLinProj.FreeVizClassifier": "Orange.projection.linear.FreeVizClassifier",
520           "orngLinProj.FreeVizLearner": "Orange.projection.linear.FreeVizLearner",
521           "orngLinProj.S2NHeuristicLearner": "Orange.projection.linear.S2NHeuristicLearner",
522
523           "orngDisc.entropyDiscretization": "Orange.feature.discretization.entropyDiscretization_wrapper",
524           "orngDisc.EntropyDiscretization": "Orange.feature.discretization.EntropyDiscretization_wrapper",
525
526           "orange.ProbabilityEstimator": "Orange.statistics.estimate.ProbabilityEstimator",
527           "orange.ProbabilityEstimator_FromDistribution": "Orange.statistics.estimate.ProbabilityEstimator_FromDistribution",
528           "orange.ProbabilityEstimatorConstructor": "Orange.statistics.estimate.ProbabilityEstimatorConstructor",
529           "orange.ProbabilityEstimatorConstructor_Laplace": "Orange.statistics.estimate.ProbabilityEstimatorConstructor_Laplace",
530           "orange.ProbabilityEstimatorConstructor_kernel": "Orange.statistics.estimate.ProbabilityEstimatorConstructor_kernel",
531           "orange.ProbabilityEstimatorConstructor_loess": "Orange.statistics.estimate.ProbabilityEstimatorConstructor_loess",
532           "orange.ProbabilityEstimatorConstructor_m": "Orange.statistics.estimate.ProbabilityEstimatorConstructor_m",
533           "orange.ProbabilityEstimatorConstructor_relative": "Orange.statistics.estimate.ProbabilityEstimatorConstructor_relative",
534           "orange.ProbabilityEstimatorList": "Orange.statistics.estimate.ProbabilityEstimatorList",
535
536           "orange.FilterList": "Orange.preprocess.FilterList",
537           "orange.Filter": "Orange.preprocess.Filter",
538           "orange.Filter_conjunction": "Orange.preprocess.Filter_conjunction",
539           "orange.Filter_disjunction": "Orange.preprocess.Filter_disjunction",
540           "orange.Filter_hasClassValue": "Orange.preprocess.Filter_hasClassValue",
541           "orange.Filter_hasMeta": "Orange.preprocess.Filter_hasMeta",
542           "orange.Filter_hasSpecial": "Orange.preprocess.Filter_hasSpecial",
543           "orange.Filter_isDefined": "Orange.preprocess.Filter_isDefined",
544           "orange.Filter_random": "Orange.preprocess.Filter_random",
545           "orange.Filter_sameValue": "Orange.preprocess.Filter_sameValue",
546           "orange.Filter_values": "Orange.preprocess.Filter_values",
547
548           # orngEnviron
549
550           "orngEnviron.orangeDir": "Orange.misc.environ.install_dir",
551           "orngEnviron.orangeDocDir": "Orange.misc.environ.doc_install_dir",
552           "orngEnviron.orangeVer": "Orange.misc.environ.version",
553           "orngEnviron.canvasDir": "Orange.misc.environ.canvas_install_dir",
554           "orngEnviron.widgetDir": "Orange.misc.environ.widget_install_dir",
555           "orngEnviron.picsDir": "Orange.misc.environ.icons_install_dir",
556           "orngEnviron.addOnsDirSys": "Orange.misc.environ.add_ons_dir",
557           "orngEnviron.addOnsDirUser": "Orange.misc.environ.add_ons_dir_user",
558           "orngEnviron.applicationDir": "Orange.misc.environ.application_dir",
559           "orngEnviron.outputDir": "Orange.misc.environ.output_dir",
560           "orngEnviron.defaultReportsDir": "Orange.misc.environ.default_reports_dir",
561           "orngEnviron.orangeSettingsDir": "Orange.misc.environ.orange_settings_dir",
562           "orngEnviron.widgetSettingsDir": "Orange.misc.environ.widget_settings_dir",
563           "orngEnviron.canvasSettingsDir": "Orange.misc.environ.canvas_settings_dir",
564           "orngEnviron.bufferDir": "Orange.misc.environ.buffer_dir",
565           "orngEnviron.directoryNames": "Orange.misc.environ.directories",
566           "orngEnviron.samepath": "Orange.misc.environ.samepath",
567           "orngEnviron.addOrangeDirectoriesToPath": "Orange.misc.environ.add_orange_directories_to_path",
568
569           "orngScaleData.getVariableValuesSorted": "Orange.preprocess.scaling.get_variable_values_sorted",
570           "orngScaleData.getVariableValueIndices": "Orange.preprocess.scaling.get_variable_value_indices",
571           "orngScaleData.discretizeDomain": "Orange.preprocess.scaling.discretize_domain",
572           "orngScaleData.orngScaleData": "Orange.preprocess.scaling.ScaleData",
573           "orngScaleLinProjData.orngScaleLinProjData": "Orange.preprocess.scaling.ScaleLinProjData",
574           "orngScalePolyvizData.orngScalePolyvizData": "Orange.preprocess.scaling.ScalePolyvizData",
575           "orngScaleScatterPlotData.orngScaleScatterPlotData": "Orange.preprocess.scaling.ScaleScatterPlotData",
576
577           "orngEvalAttr.mergeAttrValues": "Orange.feature.scoring.merge_values",
578           "orngEvalAttr.MeasureAttribute_MDL": "Orange.feature.scoring.MDL",
579           "orngEvalAttr.MeasureAttribute_MDLClass": "Orange.feature.scoring.MDL",
580           "orngEvalAttr.MeasureAttribute_Distance": "Orange.feature.scoring.Distance",
581           "orngEvalAttr.MeasureAttribute_DistanceClass": "Orange.feature.scoring.Distance",
582           "orngEvalAttr.OrderAttributesByMeasure": "Orange.feature.scoring.OrderAttributes",
583
584           "orange.ProbabilityEstimator": "Orange.statistics.estimate.Estimator",
585           "orange.ProbabilityEstimator_FromDistribution": "Orange.statistics.estimate.EstimatorFromDistribution",
586           "orange.ProbabilityEstimatorConstructor": "Orange.statistics.estimate.EstimatorConstructor",
587           "orange.ProbabilityEstimatorConstructor_Laplace": "Orange.statistics.estimate.Laplace",
588           "orange.ProbabilityEstimatorConstructor_kernel": "Orange.statistics.estimate.Kernel",
589           "orange.ProbabilityEstimatorConstructor_loess": "Orange.statistics.estimate.Loess",
590           "orange.ProbabilityEstimatorConstructor_m": "Orange.statistics.estimate.M",
591           "orange.ProbabilityEstimatorConstructor_relative": "Orange.statistics.estimate.RelativeFrequency",
592           "orange.ConditionalProbabilityEstimator": "Orange.statistics.estimate.ConditionalEstimator",
593           "orange.ConditionalProbabilityEstimator_FromDistribution": "Orange.statistics.estimate.ConditionalEstimatorFromDistribution",
594           "orange.ConditionalProbabilityEstimator_ByRows": "Orange.statistics.estimate.ConditionalEstimatorByRows",
595           "orange.ConditionalProbabilityEstimatorConstructor_ByRows": "Orange.statistics.estimate.ConditionalByRows",
596           "orange.ConditionalProbabilityEstimatorConstructor_loess": "Orange.statistics.estimate.ConditionalLoess",
597
598           "orange.RandomGenerator": "Orange.misc.Random",
599
600           }
601
602def build_pattern(mapping=MAPPING):
603    PATTERN = """
604    power< head=any+
605         trailer< '.' member=(%s) >
606         tail=any*
607    >
608    """
609    return PATTERN % "|".join("'%s'" % key.split(".")[-1] for key in mapping.keys())
610
611class FixChangedNames(fixer_base.BaseFix):
612    mapping = MAPPING
613
614    run_order = 1
615
616    def compile_pattern(self):
617        self.PATTERN = build_pattern(self.mapping)
618        self._modules_to_change = [key.split(".", 1)[0] for key in self.mapping.keys()]
619        super(FixChangedNames, self).compile_pattern()
620
621    def package_tree(self, package):
622        """ Return pytree tree for accessing the package
623       
624        Example:
625            >>> package_tree("Orange.feature.scoring")
626            [Name('Orange'), trailer('.' 'feature'), trailer('.', 'scoring')]
627        """
628        path = package.split('.')
629        nodes = []
630        nodes.append(Name(path[0]))
631        for name in path[1:]:
632            new = pytree.Node(self.syms.trailer, [Dot(), Name(name)])
633            nodes.append(new)
634        return nodes
635
636
637    def transform(self, node, results):
638        member = results.get("member")
639        head = results.get("head")
640        tail = results.get("tail")
641        module = head[0].value
642
643        if member and module in self._modules_to_change:
644            node = member[0]
645            head = head[0]
646
647            old_name = module + "." + node.value
648            if old_name not in self.mapping:
649                return
650
651            new_name = unicode(self.mapping[old_name])
652
653            if ":" in new_name:
654                # ':' is the delimiter used to separate module namespace
655                package = new_name.split(":", 1)[0]
656                new_name = new_name.replace(":", ".")
657            else:
658                package = new_name.rsplit(".", 1)[0]
659
660            syms = self.syms
661
662            if tail:
663                tail = [t.clone() for t in  tail]
664            new = self.package_tree(new_name)
665            new = pytree.Node(syms.power, new + tail, prefix=head.prefix)
666
667            # Make sure the proper package is imported
668#            if ":" in new_name:
669#                package = new_name.split(":",1)[0]
670#            else:
671#                package = new_name.rsplit(".", 1)[0]
672
673            def orange_to_root(package):
674                return "Orange" if package.startswith("Orange.") else package
675
676            touch_import(None, orange_to_root(package), node)
677            return new
678
Note: See TracBrowser for help on using the repository browser.