Skip to content

Commit

Permalink
Merge pull request #3340 from janezd/deprecations-in-sanitize-variable
Browse files Browse the repository at this point in the history
data.io.sanitize_variable: Remove deprecated arguments
  • Loading branch information
lanzagar authored Oct 27, 2018
2 parents ceb5df0 + d297e89 commit 7ee820f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
13 changes: 1 addition & 12 deletions Orange/data/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,9 @@ def guess_data_type(orig_values, namask=None):


def sanitize_variable(valuemap, values, orig_values, coltype, coltype_kwargs,
domain_vars=None, existing_var=None, new_var_name=None, data=None, name=None):
name=None):
assert issubclass(coltype, Variable)

if name is None or existing_var is not None or new_var_name is not None:
name = existing_var.strip() if existing_var else new_var_name
raise DeprecationWarning("Arguments 'existing_var' and 'new_var_name' are "\
"deprecated since 3.16; use 'name' instead")

if domain_vars is not None:
raise DeprecationWarning("Argument 'domain_vars' is deprecated since 3.16")

if data is not None:
raise DeprecationWarning("Argument 'data' is deprecated since 3.16")

def get_number_of_decimals(values):
len_ = len
ndecimals = max((len_(value) - value.find(".")
Expand Down
14 changes: 1 addition & 13 deletions Orange/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import shutil
import io

from Orange.data import ContinuousVariable
from Orange.data.io import FileFormat, TabReader, CSVReader, PickleReader, \
sanitize_variable
from Orange.data.io import FileFormat, TabReader, CSVReader, PickleReader
from Orange.data.table import get_sample_datasets_dir
from Orange.version import version


class WildcardReader(FileFormat):
Expand Down Expand Up @@ -118,12 +115,3 @@ def test_empty_columns(self):
self.assertEqual(len(table.domain.attributes), 2)
self.assertEqual(cm.warning.args[0],
"Columns with no headers were removed.")


class TestIo(unittest.TestCase):
def test_sanitize_variable_deprecated_params(self):
"""In version 3.18 deprecation warnings in function 'sanitize_variable'
should be removed along with unused parameters."""
if version > "3.18":
_, _ = sanitize_variable(None, None, None, ContinuousVariable,
{}, name="name", data="data")

0 comments on commit 7ee820f

Please sign in to comment.