source: orange/Orange/fixes/fix_changed_names.py @ 11004:5ddd7631ebff

Revision 11004:5ddd7631ebff, 45.9 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 18 months ago (diff)

Removed network from Orange.

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