Skip to content

Commit

Permalink
[MAINTENANCE] Some fluent datasource methods should be private (#7437)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilo59 authored Mar 23, 2023
1 parent 492fb1e commit 0151852
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion great_expectations/datasource/fluent/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def get_asset(self, asset_name: str) -> _DataAssetT:
f"'{asset_name}' not found. Available assets are {list(self.assets.keys())}"
) from exc

def add_asset(
def _add_asset(
self, asset: _DataAssetT, connect_options: dict | None = None
) -> _DataAssetT:
"""Adds an asset to a datasource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def add_csv_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_excel_asset(
self,
Expand Down Expand Up @@ -232,7 +232,7 @@ def add_excel_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_json_asset(
self,
Expand Down Expand Up @@ -288,7 +288,7 @@ def add_json_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_parquet_asset(
self,
Expand Down Expand Up @@ -342,7 +342,7 @@ def add_parquet_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

# attr-defined issue
# https://github.com/python/mypy/issues/12472
Expand Down
40 changes: 20 additions & 20 deletions great_expectations/datasource/fluent/pandas_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def add_dataframe_asset(self, name: str, dataframe: pd.DataFrame) -> DataFrameAs
name=name,
dataframe=dataframe,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_dataframe(
self, dataframe: pd.DataFrame, asset_name: Optional[str] = None
Expand All @@ -529,7 +529,7 @@ def add_clipboard_asset(self, name: str, **kwargs) -> ClipboardAsset: # type: i
name=name,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_clipboard(self, asset_name: Optional[str] = None, **kwargs) -> Validator:
if not asset_name:
Expand All @@ -548,7 +548,7 @@ def add_csv_asset(
filepath_or_buffer=filepath_or_buffer,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_csv(
self,
Expand All @@ -573,7 +573,7 @@ def add_excel_asset(
io=io,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_excel(
self,
Expand All @@ -598,7 +598,7 @@ def add_feather_asset(
path=path,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_feather(
self,
Expand All @@ -623,7 +623,7 @@ def add_gbq_asset(
query=query,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_gbq(
self,
Expand All @@ -648,7 +648,7 @@ def add_hdf_asset(
path_or_buf=path_or_buf,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_hdf(
self,
Expand All @@ -673,7 +673,7 @@ def add_html_asset(
io=io,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_html(
self,
Expand Down Expand Up @@ -701,7 +701,7 @@ def add_json_asset(
path_or_buf=path_or_buf,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_json(
self,
Expand All @@ -726,7 +726,7 @@ def add_orc_asset(
path=path,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_orc(
self,
Expand All @@ -751,7 +751,7 @@ def add_parquet_asset(
path=path,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_parquet(
self,
Expand Down Expand Up @@ -779,7 +779,7 @@ def add_pickle_asset(
filepath_or_buffer=filepath_or_buffer,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_pickle(
self,
Expand Down Expand Up @@ -807,7 +807,7 @@ def add_sas_asset(
filepath_or_buffer=filepath_or_buffer,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_sas(
self,
Expand All @@ -832,7 +832,7 @@ def add_spss_asset(
path=path,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_spss(
self,
Expand Down Expand Up @@ -862,7 +862,7 @@ def add_sql_asset(
con=con,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_sql(
self,
Expand Down Expand Up @@ -894,7 +894,7 @@ def add_sql_query_asset(
con=con,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_sql_query(
self,
Expand Down Expand Up @@ -922,7 +922,7 @@ def add_sql_table_asset(
con=con,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_sql_table(
self,
Expand Down Expand Up @@ -952,7 +952,7 @@ def add_stata_asset(
filepath_or_buffer=filepath_or_buffer,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_stata(
self,
Expand Down Expand Up @@ -980,7 +980,7 @@ def add_table_asset(
filepath_or_buffer=filepath_or_buffer,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_table(
self,
Expand All @@ -1005,7 +1005,7 @@ def add_xml_asset(
path_or_buffer=path_or_buffer,
**kwargs,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def read_xml(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def add_csv_asset(
base_directory=self.base_directory,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

@public_api
def add_excel_asset(
Expand Down Expand Up @@ -130,7 +130,7 @@ def add_excel_asset(
base_directory=self.base_directory,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

@public_api
def add_json_asset(
Expand Down Expand Up @@ -179,7 +179,7 @@ def add_json_asset(
base_directory=self.base_directory,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

@public_api
def add_parquet_asset(
Expand Down Expand Up @@ -228,7 +228,7 @@ def add_parquet_asset(
base_directory=self.base_directory,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

# attr-defined issue
# https://github.com/python/mypy/issues/12472
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def add_csv_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_excel_asset(
self,
Expand Down Expand Up @@ -236,7 +236,7 @@ def add_excel_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_json_asset(
self,
Expand Down Expand Up @@ -289,7 +289,7 @@ def add_json_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_parquet_asset(
self,
Expand Down Expand Up @@ -342,7 +342,7 @@ def add_parquet_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

# attr-defined issue
# https://github.com/python/mypy/issues/12472
Expand Down
8 changes: 4 additions & 4 deletions great_expectations/datasource/fluent/pandas_s3_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def add_csv_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_excel_asset(
self,
Expand Down Expand Up @@ -208,7 +208,7 @@ def add_excel_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_json_asset(
self,
Expand Down Expand Up @@ -261,7 +261,7 @@ def add_json_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

def add_parquet_asset(
self,
Expand Down Expand Up @@ -314,7 +314,7 @@ def add_parquet_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)

# attr-defined issue
# https://github.com/python/mypy/issues/12472
Expand Down
4 changes: 2 additions & 2 deletions great_expectations/datasource/fluent/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def _add_asset_factory(
connect_options = {}

asset = asset_type(name=name, **kwargs)
return self.add_asset(asset, connect_options=connect_options)
return self._add_asset(asset, connect_options=connect_options)

# attr-defined issue
# https://github.com/python/mypy/issues/12472
Expand All @@ -309,7 +309,7 @@ def _read_asset_factory(
) -> Validator:
name = asset_name or DEFAULT_PANDAS_DATA_ASSET_NAME
asset = asset_type(name=name, **kwargs)
self.add_asset(asset)
self._add_asset(asset)
batch_request = asset.build_batch_request()
return self._data_context.get_validator(batch_request=batch_request) # type: ignore[attr-defined]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ def add_csv_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)
2 changes: 1 addition & 1 deletion great_expectations/datasource/fluent/spark_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ def add_dataframe_asset(self, name: str, dataframe: DataFrame) -> DataFrameAsset
name=name,
dataframe=dataframe,
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ def add_csv_asset(
base_directory=self.base_directory,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ def add_csv_asset(
base_directory=self.base_directory,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ def add_csv_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ def add_csv_asset(
delimiter=delimiter,
)
)
return self.add_asset(asset=asset)
return self._add_asset(asset=asset)
Loading

0 comments on commit 0151852

Please sign in to comment.