source: orange/Orange/fixes/fix_changed_names.py @ 10580:c4cbae8dcf8b

Revision 10580:c4cbae8dcf8b, 46.4 KB checked in by markotoplak, 2 years ago (diff)

Moved deprecation functions, progress bar support and environ into Orange.utils. Orange imports cleanly, although it is not tested yet.

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