Skip to content

Commit 8ddfb0e

Browse files
committed
style(data source): format code
1 parent 3aa4d62 commit 8ddfb0e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

alias/src/alias/agent/agents/data_source/_data_profiler_factory.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2+
# pylint: disable=R1702,R0912,R0915
3+
24
import os
35
import json
46
from abc import ABC, abstractmethod
@@ -167,9 +169,6 @@ def _call_model(
167169

168170

169171
class StructuredDataProfiler(BaseDataProfiler):
170-
def __init__(self, api_key, path, source_type):
171-
super().__init__(api_key, path, source_type)
172-
173172
def _generate_content(self, prompt: str, data: Any) -> str:
174173
return prompt.format(data=data)
175174

@@ -403,9 +402,6 @@ def _extract_irregular_table(
403402

404403

405404
class RelationalDatabaseProfiler(StructuredDataProfiler):
406-
def __init__(self, api_key, path, source_type):
407-
super().__init__(api_key, path, source_type)
408-
409405
def _read_data(self):
410406
"""
411407
Extracts metadata (schema) for all tables in a relational db.
@@ -432,7 +428,7 @@ def _read_data(self):
432428
connection = engine.connect()
433429
except Exception as e:
434430
print(f"Connection to {self.path} failed: {e}")
435-
raise Exception(f"Failed to connect to database: {e}")
431+
raise ConnectionError(f"Failed to connect to database: {e}") from e
436432

437433
# Use DSN as the db identifier (can parsed cleaner)
438434
database_name = self.path

alias/src/alias/agent/agents/data_source/data_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ async def prepare(self, toolkit: AliasToolkit):
173173
)
174174

175175
def get_coarse_desc(self):
176-
return f"{self.source_desc}. {self.source_access_desc}: {self._general_profile()}"
176+
return (
177+
f"{self.source_desc}. {self.source_access_desc}: "
178+
+ f"{self._general_profile()}"
179+
)
177180

178181
def _get_profile(self, sandbox) -> Optional[Dict[str, Any]]:
179182
"""Run type-specific profiling."""

0 commit comments

Comments
 (0)