Changeset 10232:2ed7bebf2e9d in orange


Ignore:
Timestamp:
02/15/12 11:11:03 (2 years ago)
Author:
anzeh <anze.staric@…>
Branch:
default
rebase_source:
9430f53af0f11b5d27e84ab6b47412d192b8498b
Message:

Underscored attributes are now tried before camelCase so deprecation warnings are not emitted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/corn/corn.cpp

    r9998 r10232  
    217217 
    218218TestedExample::TestedExample(PyObject *obj) 
    219 : actualClass(getIntegerAttr(obj, "actualClass", "actual_class")), 
     219: actualClass(getIntegerAttr(obj, "actual_class", "actualClass")), 
    220220  iterationNumber(getIntegerAttr(obj, "iteration_number", "iterationNumber")), 
    221221  weight(getFloatAttr(obj, "weight")) 
     
    276276 
    277277ExperimentResults::ExperimentResults(PyObject *obj) 
    278 : numberOfIterations(getIntegerAttr(obj, "numberOfIterations", "number_of_iterations")), 
    279   numberOfLearners(getIntegerAttr(obj, "numberOfLearners", "number_of_learners")) 
     278: numberOfIterations(getIntegerAttr(obj, "number_of_iterations", "numberOfIterations")), 
     279  numberOfLearners(getIntegerAttr(obj, "number_of_learners", "numberOfLearners")) 
    280280{  
    281281  PyObject *temp = PyObject_GetAttrString(obj, "weights"); 
     
    283283  Py_XDECREF(temp); 
    284284 
    285   temp = PyObject_GetAttrString(obj, "baseClass"); 
     285  temp = PyObject_GetAttrString(obj, "base_class"); 
    286286  PyErr_Clear(); 
    287287  if (!temp) 
    288       temp = PyObject_GetAttrString(obj, "base_class"); 
     288      temp = PyObject_GetAttrString(obj, "baseClass"); 
    289289  baseClass = temp ? PyInt_AsLong(temp) : -1; 
    290290  Py_XDECREF(temp); 
    291291 
    292   temp = PyObject_GetAttrString(obj, "classValues"); 
     292  temp = PyObject_GetAttrString(obj, "class_values"); 
    293293  PyErr_Clear(); 
    294294  if (!temp) 
    295       temp = PyObject_GetAttrString(obj, "class_values"); 
     295      temp = PyObject_GetAttrString(obj, "classValues"); 
    296296  if (!temp) 
    297     throw CornException("no 'classValues' attribute"); 
     297    throw CornException("no 'class_values' attribute"); 
    298298  numberOfClasses = PySequence_Size(temp); 
    299299  Py_DECREF(temp); 
    300300  if (numberOfClasses == -1) 
    301     throw CornException("'classValues' should contain a list of class names"); 
     301    throw CornException("'class_values' should contain a list of class names"); 
    302302 
    303303  PyObject *pyresults = PyObject_GetAttrString(obj, "results"); 
Note: See TracChangeset for help on using the changeset viewer.