Base
Module superwise.controller.base
Base controller class for superwise package
Classes
BaseController(client: superwise.utils.client.Client, sw)
Base class for controllers
Args:
client
: an instance of client object
sw`: superwise object
Ancestors (in MRO)
- abc.ABC
Descendants
- superwise.controller.dataentity.DataEntityController
- superwise.controller.dataset.DatasetController
- superwise.controller.model.ModelController
- superwise.controller.notification.NotificationController
- superwise.controller.policy.PolicyController
- superwise.controller.project.ProjectController
- superwise.controller.role.RoleController
- superwise.controller.segment.SegmentController
- superwise.controller.transaction.TransactionController
- superwise.controller.version.VersionController
Methods
create(self, model, return_model=True, **kwargs)
Description:
Create object from an instance of model
Args:
model
: model name (dataentity, version etc)
is_return_model
: return model if True or response.body if False
delete(self, model)
Description:
Delete an object
Args:
model
: a Superwise.Models object
Return:
parsed response from server (dict)
delete_by_id(self, idx)
Description:
Delete an object by a given id
Args:
idx
: id to delete
Return:
parsed response from server (dict)
get(self, fields={})
Description:
wrapper for requests.get()
Args:
fields
: optional fields for filtering
Return:
parsed data (dict) from backend
get_by_id(self, idx, timeout=None)
Description:
Get a specific resource by id
Args:
idx
: id of entity to fetch
Return:
parsed model data (dict) from backend
get_by_name(self, name)
"
Description:
Get entities by name, a syntactic sugar for get with name as filter
Args:
name
: a string represent the name to filter by
Return:
a list of entities
parse_response(self, response, model_name=None, is_return_model=True)
Description:
Format the response, change it from dict to be model based
Args:
response
: response object (created by requests package)
model_name
: model name (dataentity, version etc)
is_return_model
: return model if True or response.body if False
patch(self, path=None, params=None) ‑> requests.models.Response
Description:
Prepare data and call run API PATCH call
Return:
requests response object
post(self)
Description:
Prepare data and call run API POST call
Return:
requests response object
update(self, idx, params=None) ‑> requests.models.Response
Description:
Prepare data and call run API PATCH call using a dictionary as params
Return:
requests response object