Repository: great-expectations/great_expectations

Issue:
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`


Discussion:
Done inline during improve_partitions push.

Resolving patch:
diff --git a/great_expectations/experimental/datasources/dynamic_pandas.py b/great_expectations/experimental/datasources/dynamic_pandas.py
--- a/great_expectations/experimental/datasources/dynamic_pandas.py
+++ b/great_expectations/experimental/datasources/dynamic_pandas.py
@@ -257,6 +257,8 @@ def _get_annotation_type(param: inspect.Parameter) -> Union[Type, str, object]:
             types.append(type_str)
         else:
             NEED_SPECIAL_HANDLING[param.name].add(type_str)
+            logger.debug(f"skipping {param.name} type - {type_str}")
+            continue
     if not types:
         return UNSUPPORTED_TYPE
     if len(types) > 1:
@@ -370,12 +372,11 @@ def _generate_pandas_data_asset_models(
             logger.info(f"{model_name} - {type(err).__name__}:{err}")
             continue
         except TypeError as err:
-            # may fail on python <3.10 due to use of builtin as generic
             logger.warning(
-                f"{model_name} could not be created normally - {type(err).__name__}:{err}"
+                f"pandas {pd.__version__}  {model_name} could not be created normally - {type(err).__name__}:{err} , skipping"
             )
-            logger.warning(f"{model_name} fields\n{pf(fields)}")
-            raise
+            logger.info(f"{model_name} fields\n{pf(fields)}")
+            continue
 
         data_asset_models[type_name] = asset_model
         asset_model.update_forward_refs(**_TYPE_REF_LOCALS)
diff --git a/great_expectations/experimental/datasources/pandas_datasource.py b/great_expectations/experimental/datasources/pandas_datasource.py
--- a/great_expectations/experimental/datasources/pandas_datasource.py
+++ b/great_expectations/experimental/datasources/pandas_datasource.py
@@ -56,79 +56,32 @@ class PandasDatasourceError(Exception):
     blacklist=_BLACK_LIST,
     use_docstring_from_method=True,
 )
-
-ClipboardAsset = _ASSET_MODELS["clipboard"]
-CSVAsset = _ASSET_MODELS["csv"]
-ExcelAsset = _ASSET_MODELS["excel"]
-FeatherAsset = _ASSET_MODELS["feather"]
-GBQAsset = _ASSET_MODELS["gbq"]
-HDFAsset = _ASSET_MODELS["hdf"]
-HTMLAsset = _ASSET_MODELS["html"]
-JSONAsset = _ASSET_MODELS["json"]
-ORCAsset = _ASSET_MODELS["orc"]
-ParquetAsset = _ASSET_MODELS["parquet"]
-PickleAsset = _ASSET_MODELS["pickle"]
-SASAsset = _ASSET_MODELS["sas"]
-SPSSAsset = _ASSET_MODELS["spss"]
-# SqlAsset = _ASSET_MODELS["sql"]
-SQLQueryAsset = _ASSET_MODELS["sql_query"]
-SQLTableAsset = _ASSET_MODELS["sql_table"]
-STATAAsset = _ASSET_MODELS["stata"]
-# TableAsset = _ASSET_MODELS["table"]
-XMLAsset = _ASSET_MODELS["xml"]
+try:
+    # variables only needed for type-hinting
+    CSVAsset = _ASSET_MODELS["csv"]
+    ExcelAsset = _ASSET_MODELS["excel"]
+    JSONAsset = _ASSET_MODELS["json"]
+    ORCAsset = _ASSET_MODELS["orc"]
+    ParquetAsset = _ASSET_MODELS["parquet"]
+except KeyError as key_err:
+    logger.info(f"zep - {key_err} asset model could not be generated")
+    CSVAsset = _FilesystemDataAsset
+    ExcelAsset = _FilesystemDataAsset
+    JSONAsset = _FilesystemDataAsset
+    ORCAsset = _FilesystemDataAsset
+    ParquetAsset = _FilesystemDataAsset
 
 
 class PandasDatasource(Datasource):
     # class attributes
-    asset_types: ClassVar[List[Type[DataAsset]]] = [
-        ClipboardAsset,
-        CSVAsset,
-        ExcelAsset,
-        FeatherAsset,
-        GBQAsset,
-        HDFAsset,
-        HTMLAsset,
-        JSONAsset,
-        ORCAsset,
-        ParquetAsset,
-        PickleAsset,
-        SASAsset,
-        SPSSAsset,
-        SQLQueryAsset,
-        # SqlAsset,
-        SQLTableAsset,
-        STATAAsset,
-        # TableAsset,
-        XMLAsset,
-    ]
+    asset_types: ClassVar[List[Type[DataAsset]]] = list(_ASSET_MODELS.values())
 
     # instance attributes
     type: Literal["pandas"] = "pandas"
     name: str
-    assets: Dict[  # type: ignore[valid-type]
+    assets: Dict[
         str,
-        Union[
-            _FilesystemDataAsset,
-            ClipboardAsset,
-            CSVAsset,
-            ExcelAsset,
-            FeatherAsset,
-            GBQAsset,
-            HDFAsset,
-            HTMLAsset,
-            JSONAsset,
-            ORCAsset,
-            ParquetAsset,
-            PickleAsset,
-            SASAsset,
-            SPSSAsset,
-            SQLQueryAsset,
-            # SqlAsset,
-            SQLTableAsset,
-            STATAAsset,
-            # TableAsset,
-            XMLAsset,
-        ],
+        _FilesystemDataAsset,
     ] = {}
 
     @property
@@ -152,7 +105,7 @@ def test_connection(self, test_assets: bool = True) -> None:
         # Only self.assets can be tested for PandasDatasource
         if self.assets and test_assets:
             for asset in self.assets.values():
-                asset.test_connection()  # type: ignore[union-attr]
+                asset.test_connection()
 
     def add_csv_asset(
         self,


Test patch:
diff --git a/tests/experimental/datasources/test_pandas_datasource.py b/tests/experimental/datasources/test_pandas_datasource.py
--- a/tests/experimental/datasources/test_pandas_datasource.py
+++ b/tests/experimental/datasources/test_pandas_datasource.py
@@ -83,20 +83,6 @@ def reader_fn_spy(*args, **kwargs):
 
 @pytest.mark.unit
 class TestDynamicPandasAssets:
-    def test_asset_types_and_asset_annotations_match(self):
-        asset_class_names: set[str] = {t.__name__ for t in PandasDatasource.asset_types}
-        assert asset_class_names
-
-        assets_field: pydantic.fields.ModelField = PandasDatasource.__dict__[
-            "__fields__"
-        ]["assets"]
-        asset_field_union_members: set[str] = {
-            t.__name__
-            for t in assets_field.type_.__args__  # accessing the `Union` members with `__args__`
-        }
-
-        assert asset_class_names.issubset(asset_field_union_members)
-
     @pytest.mark.parametrize(
         "method_name",
         [