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/core/expectation_suite.py b/great_expectations/core/expectation_suite.py
--- a/great_expectations/core/expectation_suite.py
+++ b/great_expectations/core/expectation_suite.py
@@ -562,7 +562,7 @@ def _add_expectation(
         """
         This is a private method for adding expectations that allows for usage_events to be suppressed when
         Expectations are added through internal processing (ie. while building profilers, rendering or validation). It
-        takes in send_usage_event boolean.
+        takes in send_usage_event boolean.  If successful, upserts ExpectationConfiguration into this ExpectationSuite.
 
         Args:
             expectation_configuration: The ExpectationConfiguration to add or update
@@ -642,7 +642,8 @@ def add_expectation_configurations(
         match_type: str = "domain",
         overwrite_existing: bool = True,
     ) -> List[ExpectationConfiguration]:
-        """
+        """Upsert a list of ExpectationConfigurations into this ExpectationSuite.
+
         Args:
             expectation_configurations: The List of candidate new/modifed "ExpectationConfiguration" objects for Suite.
             send_usage_event: Whether to send a usage_statistics event. When called through ExpectationSuite class'
@@ -680,7 +681,8 @@ def add_expectation(
         match_type: str = "domain",
         overwrite_existing: bool = True,
     ) -> ExpectationConfiguration:
-        """
+        """Upsert specified ExpectationConfiguration into this ExpectationSuite.
+
         Args:
             expectation_configuration: The ExpectationConfiguration to add or update
             send_usage_event: Whether to send a usage_statistics event. When called through ExpectationSuite class'
diff --git a/great_expectations/rule_based_profiler/parameter_container.py b/great_expectations/rule_based_profiler/parameter_container.py
--- a/great_expectations/rule_based_profiler/parameter_container.py
+++ b/great_expectations/rule_based_profiler/parameter_container.py
@@ -43,14 +43,14 @@
     f"{PARAMETER_KEY}{RAW_SUFFIX}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}"
 )
 
-FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY: str = "value"
 FULLY_QUALIFIED_PARAMETER_NAME_ATTRIBUTED_VALUE_KEY: str = "attributed_value"
 FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY: str = "details"
+FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY: str = "value"
 
 RESERVED_TERMINAL_LITERALS: Set[str] = {
-    FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY,
     FULLY_QUALIFIED_PARAMETER_NAME_ATTRIBUTED_VALUE_KEY,
     FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY,
+    FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY,
 }
 
 attribute_naming_pattern = Word(alphas, alphanums + "_.") + ZeroOrMore(
@@ -677,9 +677,12 @@ def _get_parameter_name_parts_up_to_including_reserved_literal(
     if not (set(attribute_name_as_list) & RESERVED_TERMINAL_LITERALS):
         return attribute_name_as_list
 
+    # TODO: <Alex>12/29/2022: Lexicographical order avoids collisions between regular keys and reserved literals.</Alex>
+    reserved_terminal_literals: List[str] = list(sorted(RESERVED_TERMINAL_LITERALS))
+
     idx: Optional[int] = None
     key: str
-    for key in RESERVED_TERMINAL_LITERALS:
+    for key in reserved_terminal_literals:
         try:
             idx = attribute_name_as_list.index(key)
             break


Test patch: