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/assets/scripts/build_package_gallery.py b/assets/scripts/build_package_gallery.py
--- a/assets/scripts/build_package_gallery.py
+++ b/assets/scripts/build_package_gallery.py
@@ -6,7 +6,6 @@
 import json
 import logging
 import os
-from dataclasses import asdict
 from typing import List
 
 import pip
@@ -65,7 +64,7 @@ def gather_all_package_manifests(package_paths: List[str]) -> List[dict]:
             sync_package(package, package_path)
 
             # Serialize to dict to append to payload
-            json_data: dict = asdict(package)
+            json_data: dict = package.to_json_dict()
             payload.append(json_data)
             logger.info(
                 f"Successfully serialized {package.package_name} to dict and appended to manifest list"
@@ -108,6 +107,9 @@ def write_results_to_disk(path: str, package_manifests: List[dict]) -> None:
         os.chdir(root)
         package_paths = gather_all_contrib_package_paths()
         payload = gather_all_package_manifests(package_paths)
+        assert (
+            len(payload) > 0
+        ), "Something went wrong; there should packages in the payload!"
         write_results_to_disk(os.path.join(pwd, "./package_manifests.json"), payload)
     finally:
         os.chdir(pwd)
diff --git a/contrib/cli/great_expectations_contrib/commands.py b/contrib/cli/great_expectations_contrib/commands.py
--- a/contrib/cli/great_expectations_contrib/commands.py
+++ b/contrib/cli/great_expectations_contrib/commands.py
@@ -176,7 +176,7 @@ def write_package_to_disk(
         package: The GreatExpectationsContribPackageManifest you wish to serialize.
         path: The relative path to the target package JSON file.
     """
-    json_dict = asdict(package)
+    json_dict = package.to_json_dict()
     data = json.dumps(json_dict, indent=4)
     with open(path, "w") as f:
         f.write(data)
diff --git a/contrib/cli/great_expectations_contrib/package.py b/contrib/cli/great_expectations_contrib/package.py
--- a/contrib/cli/great_expectations_contrib/package.py
+++ b/contrib/cli/great_expectations_contrib/package.py
@@ -3,7 +3,7 @@
 import logging
 import os
 import sys
-from dataclasses import dataclass
+from dataclasses import asdict, dataclass
 from enum import Enum
 from typing import Any, Dict, List, Optional, Type
 
@@ -94,6 +94,14 @@ class GreatExpectationsContribPackageManifest(SerializableDictDot):
     # Metadata
     version: Optional[str] = None
 
+    def to_json_dict(self) -> dict:
+        # Chetan - 20220511 - this is a TEMPORARY patch to pop non-serializable values from the result dict
+        json_dict = asdict(self)
+        for value in json_dict["expectations"].values():
+            for test in value["tests"]:
+                test.pop("validation_result")
+        return json_dict
+
     def update_package_state(self) -> None:
         """
         Parses diagnostic reports from package Expectations and uses them to update JSON state


Test patch: