source: orange/Orange/fixes/fix_changed_names.py @ 10238:d58af84b3ee5

Revision 10238:d58af84b3ee5, 46.7 KB checked in by anzeh <anze.staric@…>, 2 years ago (diff)

Changed references to feature.continuization to data.continuization.

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