Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions openml/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import openml._api_calls
from .data_feature import OpenMLDataFeature
from ..exceptions import PyOpenMLError
from ..utils import _tag_entity


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -284,8 +285,7 @@ def push_tag(self, tag):
tag : str
Tag to attach to the dataset.
"""
data = {'data_id': self.dataset_id, 'tag': tag}
openml._api_calls._perform_api_call("/data/tag", 'post', data=data)
_tag_entity('data', self.dataset_id, tag)

def remove_tag(self, tag):
"""Removes a tag from this dataset on the server.
Expand All @@ -295,8 +295,7 @@ def remove_tag(self, tag):
tag : str
Tag to attach to the dataset.
"""
data = {'data_id': self.dataset_id, 'tag': tag}
openml._api_calls._perform_api_call("/data/untag", 'post', data=data)
_tag_entity('data', self.dataset_id, tag, untag=True)

def __eq__(self, other):

Expand Down
10 changes: 3 additions & 7 deletions openml/flows/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

import xmltodict

import openml._api_calls
import openml.exceptions
from ..extensions import get_extension_by_flow
from ..utils import extract_xml_tags
from ..utils import extract_xml_tags, _tag_entity


class OpenMLFlow(object):
Expand Down Expand Up @@ -455,8 +453,7 @@ def push_tag(self, tag):
tag : str
Tag to attach to the flow.
"""
data = {'flow_id': self.flow_id, 'tag': tag}
openml._api_calls._perform_api_call("/flow/tag", 'post', data=data)
_tag_entity('flow', self.flow_id, tag)

def remove_tag(self, tag):
"""Removes a tag from this flow on the server.
Expand All @@ -466,8 +463,7 @@ def remove_tag(self, tag):
tag : str
Tag to attach to the flow.
"""
data = {'flow_id': self.flow_id, 'tag': tag}
openml._api_calls._perform_api_call("/flow/untag", 'post', data=data)
_tag_entity('flow', self.flow_id, tag, untag=True)


def _copy_server_fields(source_flow, target_flow):
Expand Down
9 changes: 4 additions & 5 deletions openml/runs/run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections import OrderedDict
import pickle
import time
from typing import Any, IO, Optional, TextIO, TYPE_CHECKING # noqa: F401
from typing import Any, IO, TextIO
import os

import arff
Expand All @@ -13,6 +13,7 @@
from ..exceptions import PyOpenMLError
from ..flows import get_flow
from ..tasks import get_task, TaskTypeEnum
from ..utils import _tag_entity


class OpenMLRun(object):
Expand Down Expand Up @@ -468,8 +469,7 @@ def push_tag(self, tag):
tag : str
Tag to attach to the run.
"""
data = {'run_id': self.run_id, 'tag': tag}
openml._api_calls._perform_api_call("/run/tag", 'post', data=data)
_tag_entity('run', self.run_id, tag)

def remove_tag(self, tag):
"""Removes a tag from this run on the server.
Expand All @@ -479,8 +479,7 @@ def remove_tag(self, tag):
tag : str
Tag to attach to the run.
"""
data = {'run_id': self.run_id, 'tag': tag}
openml._api_calls._perform_api_call("/run/untag", 'post', data=data)
_tag_entity('run', self.run_id, tag, untag=True)


###############################################################################
Expand Down
8 changes: 3 additions & 5 deletions openml/tasks/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .. import datasets
from .split import OpenMLSplit
import openml._api_calls
from ..utils import _create_cache_directory_for_id
from ..utils import _create_cache_directory_for_id, _tag_entity


class OpenMLTask(object):
Expand Down Expand Up @@ -76,8 +76,7 @@ def push_tag(self, tag):
tag : str
Tag to attach to the task.
"""
data = {'task_id': self.task_id, 'tag': tag}
openml._api_calls._perform_api_call("/task/tag", 'post', data=data)
_tag_entity('task', self.task_id, tag)

def remove_tag(self, tag):
"""Removes a tag from this task on the server.
Expand All @@ -87,8 +86,7 @@ def remove_tag(self, tag):
tag : str
Tag to attach to the task.
"""
data = {'task_id': self.task_id, 'tag': tag}
openml._api_calls._perform_api_call("/task/untag", 'post', data=data)
_tag_entity('task', self.task_id, tag, untag=True)


class OpenMLSupervisedTask(OpenMLTask):
Expand Down