Skip to content

Commit 5b0d4dc

Browse files
amuellermfeurer
authored andcommitted
only check strings for new datasets (#824)
1 parent 4853d7c commit 5b0d4dc

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

openml/datasets/dataset.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,18 @@ def __init__(self, name, description, format=None,
109109
paper_url=None, update_comment=None,
110110
md5_checksum=None, data_file=None, features=None,
111111
qualities=None, dataset=None):
112-
if description and not re.match("^[\x00-\x7F]*$", description):
113-
# not basiclatin (XSD complains)
114-
raise ValueError("Invalid symbols in description: {}".format(
115-
description))
116-
if citation and not re.match("^[\x00-\x7F]*$", citation):
117-
# not basiclatin (XSD complains)
118-
raise ValueError("Invalid symbols in citation: {}".format(
119-
citation))
120-
if not re.match("^[a-zA-Z0-9_\\-\\.\\(\\),]+$", name):
121-
# regex given by server in error message
122-
raise ValueError("Invalid symbols in name: {}".format(name))
112+
if dataset_id is None:
113+
if description and not re.match("^[\x00-\x7F]*$", description):
114+
# not basiclatin (XSD complains)
115+
raise ValueError("Invalid symbols in description: {}".format(
116+
description))
117+
if citation and not re.match("^[\x00-\x7F]*$", citation):
118+
# not basiclatin (XSD complains)
119+
raise ValueError("Invalid symbols in citation: {}".format(
120+
citation))
121+
if not re.match("^[a-zA-Z0-9_\\-\\.\\(\\),]+$", name):
122+
# regex given by server in error message
123+
raise ValueError("Invalid symbols in name: {}".format(name))
123124
# TODO add function to check if the name is casual_string128
124125
# Attributes received by querying the RESTful API
125126
self.dataset_id = int(dataset_id) if dataset_id is not None else None

0 commit comments

Comments
 (0)