Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions openml/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ def __init__(self, name, description, format=None,
paper_url=None, update_comment=None,
md5_checksum=None, data_file=None, features=None,
qualities=None, dataset=None):
if description and not re.match("^[\x00-\x7F]*$", description):
# not basiclatin (XSD complains)
raise ValueError("Invalid symbols in description: {}".format(
description))
if citation and not re.match("^[\x00-\x7F]*$", citation):
# not basiclatin (XSD complains)
raise ValueError("Invalid symbols in citation: {}".format(
citation))
if not re.match("^[a-zA-Z0-9_\\-\\.\\(\\),]+$", name):
# regex given by server in error message
raise ValueError("Invalid symbols in name: {}".format(name))
if dataset_id is None:
if description and not re.match("^[\x00-\x7F]*$", description):
# not basiclatin (XSD complains)
raise ValueError("Invalid symbols in description: {}".format(
description))
if citation and not re.match("^[\x00-\x7F]*$", citation):
# not basiclatin (XSD complains)
raise ValueError("Invalid symbols in citation: {}".format(
citation))
if not re.match("^[a-zA-Z0-9_\\-\\.\\(\\),]+$", name):
# regex given by server in error message
raise ValueError("Invalid symbols in name: {}".format(name))
# TODO add function to check if the name is casual_string128
# Attributes received by querying the RESTful API
self.dataset_id = int(dataset_id) if dataset_id is not None else None
Expand Down