Skip to content

Commit

Permalink
fix(linting): code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
azory-ydata committed Dec 14, 2023
1 parent f7e9ec7 commit 9f3030e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/ydata/sdk/common/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def post(self, endpoint: str, data: Optional[Dict] = None, json: Optional[Dict]
Returns:
Response object
"""
url_data = self.__build_url(endpoint, data=data, json=json, files=files, project=project)
url_data = self.__build_url(
endpoint, data=data, json=json, files=files, project=project)
response = self._http_client.post(**url_data)

if response.status_code != Client.codes.OK and raise_for_status:
Expand All @@ -94,7 +95,8 @@ def get(self, endpoint: str, params: Optional[Dict] = None,
Returns:
Response object
"""
url_data = self.__build_url(endpoint, params=params, cookies=cookies, project=project)
url_data = self.__build_url(endpoint, params=params,
cookies=cookies, project=project)
response = self._http_client.get(**url_data)

if response.status_code != Client.codes.OK and raise_for_status:
Expand Down
15 changes: 10 additions & 5 deletions src/ydata/sdk/synthesizers/synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class BaseSynthesizer(ABC, ModelFactoryMixin):

def __init__(self, uid: UID | None = None, name: str | None = None, project: Project | None = None, client: Client | None = None):
self._init_common(client=client)
self._model = mSynthesizer(uid=uid, name=name or str(uuid4())) if uid or project else None
self._model = mSynthesizer(uid=uid, name=name or str(
uuid4())) if uid or project else None
self.__project = project

@init_client
Expand Down Expand Up @@ -240,7 +241,8 @@ def _fit_from_datasource(
if condition_on is not None:
payload["extraData"]["condition_on"] = condition_on

response = self._client.post('/synthesizer/', json=payload, project=self.__project)
response = self._client.post(
'/synthesizer/', json=payload, project=self.__project)
data: list = response.json()
self._model, _ = self._model_from_api(X.datatype, data)
while self.status not in [Status.READY, Status.FAILED]:
Expand Down Expand Up @@ -271,14 +273,16 @@ def _sample(self, payload: Dict) -> pdDataFrame:
Returns:
pandas `DataFrame`
"""
response = self._client.post(f"/synthesizer/{self.uid}/sample", json=payload, project=self.__project)
response = self._client.post(
f"/synthesizer/{self.uid}/sample", json=payload, project=self.__project)

data: Dict = response.json()
sample_uid = data.get('uid')
sample_status = None
while sample_status not in ['finished', 'failed']:
self._logger.info('Sampling from the synthesizer...')
response = self._client.get(f'/synthesizer/{self.uid}/history', project=self.__project)
response = self._client.get(
f'/synthesizer/{self.uid}/history', project=self.__project)
history: Dict = response.json()
sample_data = next((s for s in history if s.get('uid') == sample_uid), None)
sample_status = sample_data.get('status', {}).get('state')
Expand Down Expand Up @@ -318,7 +322,8 @@ def status(self) -> Status:
return Status.UNKNOWN

def get(self):
assert self._is_initialized() and self._model.uid, InputError("Please provide the synthesizer `uid`")
assert self._is_initialized() and self._model.uid, InputError(
"Please provide the synthesizer `uid`")

response = self._client.get(f'/synthesizer/{self.uid}', project=self.__project)
data = filter_dict(mSynthesizer, response.json())
Expand Down

0 comments on commit 9f3030e

Please sign in to comment.