source: orange/orange/fixes/fix_changed_names.py @ 9654:99bd681c0f33

Revision 9654:99bd681c0f33, 46.8 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

New names in feature.selection.

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