Skip to content

Commit

Permalink
Adding new query_string parameter to delete API methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerce committed Apr 11, 2023
1 parent bc620ab commit 5789669
Show file tree
Hide file tree
Showing 53 changed files with 200 additions and 70 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Expand Up @@ -3,6 +3,11 @@
History
-------

9.2.0 (2023-04-11)
------------------

- Extending all delete methods to allow additional query strings.

9.1.4 (2023-02-10)
------------------

Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/anomalyhandler.py
Expand Up @@ -103,13 +103,13 @@ def update_anomaly(self, anomaly, changes):
message="An anomaly detector id is needed.")
return self.update_resource(anomaly, changes)

def delete_anomaly(self, anomaly):
def delete_anomaly(self, anomaly, query_string=''):
"""Deletes an anomaly detector.
"""
check_resource_type(anomaly, ANOMALY_PATH,
message="An anomaly detector id is needed.")
return self.delete_resource(anomaly)
return self.delete_resource(anomaly, query_string=query_string)

def clone_anomaly(self, anomaly,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/anomalyscorehandler.py
Expand Up @@ -115,10 +115,10 @@ def update_anomaly_score(self, anomaly_score, changes):
message="An anomaly_score id is needed.")
return self.update_resource(anomaly_score, changes)

def delete_anomaly_score(self, anomaly_score):
def delete_anomaly_score(self, anomaly_score, query_string=''):
"""Deletes an anomaly_score.
"""
check_resource_type(anomaly_score, ANOMALY_SCORE_PATH,
message="An anomaly_score id is needed.")
return self.delete_resource(anomaly_score)
return self.delete_resource(anomaly_score, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/associationhandler.py
Expand Up @@ -85,13 +85,13 @@ def update_association(self, association, changes):
message="An association id is needed.")
return self.update_resource(association, changes)

def delete_association(self, association):
def delete_association(self, association, query_string=''):
"""Deletes an association.
"""
check_resource_type(association, ASSOCIATION_PATH,
message="An association id is needed.")
return self.delete_resource(association)
return self.delete_resource(association, query_string=query_string)

def clone_association(self, association,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/associationsethandler.py
Expand Up @@ -115,10 +115,10 @@ def update_association_set(self, association_set, changes):
message="An association set id is needed.")
return self.update_resource(association_set, changes)

def delete_association_set(self, association_set):
def delete_association_set(self, association_set, query_string=''):
"""Deletes an association set.
"""
check_resource_type(association_set, ASSOCIATION_SET_PATH,
message="An association set id is needed.")
return self.delete_resource(association_set)
return self.delete_resource(association_set, query_string=query_string)
5 changes: 3 additions & 2 deletions bigml/api_handlers/batchanomalyscorehandler.py
Expand Up @@ -110,10 +110,11 @@ def update_batch_anomaly_score(self, batch_anomaly_score, changes):
message="A batch anomaly score id is needed.")
return self.update_resource(batch_anomaly_score, changes)

def delete_batch_anomaly_score(self, batch_anomaly_score):
def delete_batch_anomaly_score(self, batch_anomaly_score, query_string=''):
"""Deletes a batch anomaly score.
"""
check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH,
message="A batch anomaly score id is needed.")
return self.delete_resource(batch_anomaly_score)
return self.delete_resource(batch_anomaly_score,
query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/batchcentroidhandler.py
Expand Up @@ -107,10 +107,10 @@ def update_batch_centroid(self, batch_centroid, changes):
message="A batch centroid id is needed.")
return self.update_resource(batch_centroid, changes)

def delete_batch_centroid(self, batch_centroid):
def delete_batch_centroid(self, batch_centroid, query_string=''):
"""Deletes a batch centroid.
"""
check_resource_type(batch_centroid, BATCH_CENTROID_PATH,
message="A batch centroid id is needed.")
return self.delete_resource(batch_centroid)
return self.delete_resource(batch_centroid, query_string=query_string)
5 changes: 3 additions & 2 deletions bigml/api_handlers/batchpredictionhandler.py
Expand Up @@ -109,10 +109,11 @@ def update_batch_prediction(self, batch_prediction, changes):
message="A batch prediction id is needed.")
return self.update_resource(batch_prediction, changes)

def delete_batch_prediction(self, batch_prediction):
def delete_batch_prediction(self, batch_prediction, query_string=''):
"""Deletes a batch prediction.
"""
check_resource_type(batch_prediction, BATCH_PREDICTION_PATH,
message="A batch prediction id is needed.")
return self.delete_resource(batch_prediction)
return self.delete_resource(batch_prediction,
query_string=query_string)
5 changes: 3 additions & 2 deletions bigml/api_handlers/batchprojectionhandler.py
Expand Up @@ -107,10 +107,11 @@ def update_batch_projection(self, batch_projection, changes):
message="A batch projection id is needed.")
return self.update_resource(batch_projection, changes)

def delete_batch_projection(self, batch_projection):
def delete_batch_projection(self, batch_projection, query_string=''):
"""Deletes a batch projection.
"""
check_resource_type(batch_projection, BATCH_PROJECTION_PATH,
message="A batch projection id is needed.")
return self.delete_resource(batch_projection)
return self.delete_resource(batch_projection,
query_string=query_string)
6 changes: 4 additions & 2 deletions bigml/api_handlers/batchtopicdistributionhandler.py
Expand Up @@ -115,11 +115,13 @@ def update_batch_topic_distribution(self, batch_topic_distribution,
message="A batch topic distribution id is needed.")
return self.update_resource(batch_topic_distribution, changes)

def delete_batch_topic_distribution(self, batch_topic_distribution):
def delete_batch_topic_distribution(self, batch_topic_distribution,
query_string=''):
"""Deletes a batch topic distribution.
"""
check_resource_type(batch_topic_distribution,
BATCH_TOPIC_DISTRIBUTION_PATH,
message="A batch topic distribution id is needed.")
return self.delete_resource(batch_topic_distribution)
return self.delete_resource(batch_topic_distribution,
query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/centroidhandler.py
Expand Up @@ -114,10 +114,10 @@ def update_centroid(self, centroid, changes):
message="A centroid id is needed.")
return self.update_resource(centroid, changes)

def delete_centroid(self, centroid):
def delete_centroid(self, centroid, query_string=''):
"""Deletes a centroid.
"""
check_resource_type(centroid, CENTROID_PATH,
message="A centroid id is needed.")
return self.delete_resource(centroid)
return self.delete_resource(centroid, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/clusterhandler.py
Expand Up @@ -102,13 +102,13 @@ def update_cluster(self, cluster, changes):
message="A cluster id is needed.")
return self.update_resource(cluster, changes)

def delete_cluster(self, cluster):
def delete_cluster(self, cluster, query_string=''):
"""Deletes a cluster.
"""
check_resource_type(cluster, CLUSTER_PATH,
message="A cluster id is needed.")
return self.delete_resource(cluster)
return self.delete_resource(cluster, query_string=query_string)

def clone_cluster(self, cluster,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/configurationhandler.py
Expand Up @@ -87,10 +87,10 @@ def update_configuration(self, configuration, changes):
message="A configuration id is needed.")
return self.update_resource(configuration, changes)

def delete_configuration(self, configuration):
def delete_configuration(self, configuration, query_string=''):
"""Deletes a configuration.
"""
check_resource_type(configuration, CONFIGURATION_PATH,
message="A configuration id is needed.")
return self.delete_resource(configuration)
return self.delete_resource(configuration, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/correlationhandler.py
Expand Up @@ -102,10 +102,10 @@ def update_correlation(self, correlation, changes):
message="A correlation id is needed.")
return self.update_resource(correlation, changes)

def delete_correlation(self, correlation):
def delete_correlation(self, correlation, query_string=''):
"""Deletes a correlation.
"""
check_resource_type(correlation, CORRELATION_PATH,
message="A correlation id is needed.")
return self.delete_resource(correlation)
return self.delete_resource(correlation, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/datasethandler.py
Expand Up @@ -159,13 +159,13 @@ def update_dataset(self, dataset, changes):
message="A dataset id is needed.")
return self.update_resource(dataset, changes)

def delete_dataset(self, dataset):
def delete_dataset(self, dataset, query_string=''):
"""Deletes a dataset.
"""
check_resource_type(dataset, DATASET_PATH,
message="A dataset id is needed.")
return self.delete_resource(dataset)
return self.delete_resource(dataset, query_string=query_string)

def error_counts(self, dataset, raise_on_error=True):
"""Returns the ids of the fields that contain errors and their number.
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/deepnethandler.py
Expand Up @@ -105,13 +105,13 @@ def update_deepnet(self, deepnet, changes):
message="A deepnet id is needed.")
return self.update_resource(deepnet, changes)

def delete_deepnet(self, deepnet):
def delete_deepnet(self, deepnet, query_string=''):
"""Deletes a deepnet.
"""
check_resource_type(deepnet, DEEPNET_PATH,
message="A deepnet id is needed.")
return self.delete_resource(deepnet)
return self.delete_resource(deepnet, query_string=query_string)

def clone_deepnet(self, deepnet,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/ensemblehandler.py
Expand Up @@ -99,13 +99,13 @@ def update_ensemble(self, ensemble, changes):
message="An ensemble id is needed.")
return self.update_resource(ensemble, changes)

def delete_ensemble(self, ensemble):
def delete_ensemble(self, ensemble, query_string=''):
"""Deletes a ensemble.
"""
check_resource_type(ensemble, ENSEMBLE_PATH,
message="An ensemble id is needed.")
return self.delete_resource(ensemble)
return self.delete_resource(ensemble, query_string=query_string)

def clone_ensemble(self, ensemble,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/evaluationhandler.py
Expand Up @@ -96,10 +96,10 @@ def update_evaluation(self, evaluation, changes):
message="An evaluation id is needed.")
return self.update_resource(evaluation, changes)

def delete_evaluation(self, evaluation):
def delete_evaluation(self, evaluation, query_string=''):
"""Deletes an evaluation.
"""
check_resource_type(evaluation, EVALUATION_PATH,
message="An evaluation id is needed.")
return self.delete_resource(evaluation)
return self.delete_resource(evaluation, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/forecasthandler.py
Expand Up @@ -100,10 +100,10 @@ def update_forecast(self, forecast, changes):
message="A forecast id is needed.")
return self.update_resource(forecast, changes)

def delete_forecast(self, forecast):
def delete_forecast(self, forecast, query_string=''):
"""Deletes a forecast.
"""
check_resource_type(forecast, FORECAST_PATH,
message="A forecast id is needed.")
return self.delete_resource(forecast)
return self.delete_resource(forecast, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/fusionhandler.py
Expand Up @@ -105,10 +105,10 @@ def update_fusion(self, fusion, changes):
message="A fusion id is needed.")
return self.update_resource(fusion, changes)

def delete_fusion(self, fusion):
def delete_fusion(self, fusion, query_string=''):
"""Deletes a fusion.
"""
check_resource_type(fusion, FUSION_PATH,
message="A fusion id is needed.")
return self.delete_resource(fusion)
return self.delete_resource(fusion, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/libraryhandler.py
Expand Up @@ -121,10 +121,10 @@ def update_library(self, library, changes):
message="A library id is needed.")
return self.update_resource(library, changes)

def delete_library(self, library):
def delete_library(self, library, query_string=''):
"""Deletes a library.
"""
check_resource_type(library, LIBRARY_PATH,
message="A library id is needed.")
return self.delete_resource(library)
return self.delete_resource(library, query_string=query_string)
5 changes: 3 additions & 2 deletions bigml/api_handlers/linearhandler.py
Expand Up @@ -105,13 +105,14 @@ def update_linear_regression(self, linear_regression, changes):
message="A linear regression id is needed.")
return self.update_resource(linear_regression, changes)

def delete_linear_regression(self, linear_regression):
def delete_linear_regression(self, linear_regression, query_string=''):
"""Deletes a linear regression.
"""
check_resource_type(linear_regression, LINEAR_REGRESSION_PATH,
message="A linear regression id is needed.")
return self.delete_resource(linear_regression)
return self.delete_resource(linear_regression,
query_string=query_string)

def clone_linear_regression(self, linear_regression,
args=None, wait_time=3, retries=10):
Expand Down
5 changes: 3 additions & 2 deletions bigml/api_handlers/logistichandler.py
Expand Up @@ -105,13 +105,14 @@ def update_logistic_regression(self, logistic_regression, changes):
message="A logistic regression id is needed.")
return self.update_resource(logistic_regression, changes)

def delete_logistic_regression(self, logistic_regression):
def delete_logistic_regression(self, logistic_regression, query_string=''):
"""Deletes a logistic regression.
"""
check_resource_type(logistic_regression, LOGISTIC_REGRESSION_PATH,
message="A logistic regression id is needed.")
return self.delete_resource(logistic_regression)
return self.delete_resource(logistic_regression,
query_string=query_string)

def clone_logistic_regression(self, logistic_regression,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/modelhandler.py
Expand Up @@ -153,13 +153,13 @@ def update_model(self, model, changes):
message="A model id is needed.")
return self.update_resource(model, changes)

def delete_model(self, model):
def delete_model(self, model, query_string=''):
"""Deletes a model.
"""
check_resource_type(model, MODEL_PATH,
message="A model id is needed.")
return self.delete_resource(model)
return self.delete_resource(model, query_string=query_string)

def clone_model(self, model,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/optimlhandler.py
Expand Up @@ -105,10 +105,10 @@ def update_optiml(self, optiml, changes):
message="An optiml id is needed.")
return self.update_resource(optiml, changes)

def delete_optiml(self, optiml):
def delete_optiml(self, optiml, query_string=''):
"""Deletes an optiml.
"""
check_resource_type(optiml, OPTIML_PATH,
message="An optiml id is needed.")
return self.delete_resource(optiml)
return self.delete_resource(optiml, query_string=query_string)
4 changes: 2 additions & 2 deletions bigml/api_handlers/pcahandler.py
Expand Up @@ -103,13 +103,13 @@ def update_pca(self, pca, changes):
message="A PCA id is needed.")
return self.update_resource(pca, changes)

def delete_pca(self, pca):
def delete_pca(self, pca, query_string=''):
"""Deletes a PCA.
"""
check_resource_type(pca, PCA_PATH,
message="A PCA id is needed.")
return self.delete_resource(pca)
return self.delete_resource(pca, query_string=query_string)

def clone_pca(self, pca,
args=None, wait_time=3, retries=10):
Expand Down
4 changes: 2 additions & 2 deletions bigml/api_handlers/predictionhandler.py
Expand Up @@ -125,10 +125,10 @@ def update_prediction(self, prediction, changes):
message="A prediction id is needed.")
return self.update_resource(prediction, changes)

def delete_prediction(self, prediction):
def delete_prediction(self, prediction, query_string=''):
"""Deletes a prediction.
"""
check_resource_type(prediction, PREDICTION_PATH,
message="A prediction id is needed.")
return self.delete_resource(prediction)
return self.delete_resource(prediction, query_string=query_string)

0 comments on commit 5789669

Please sign in to comment.