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/examples/expectations/regex_based_column_map_expectation_template.py b/examples/expectations/regex_based_column_map_expectation_template.py
--- a/examples/expectations/regex_based_column_map_expectation_template.py
+++ b/examples/expectations/regex_based_column_map_expectation_template.py
@@ -22,7 +22,6 @@ class ExpectColumnValuesToMatchSomeRegex(RegexBasedColumnMapExpectation):
     """TODO: Add a docstring here"""
 
     # These values will be used to configure the metric created by your expectation
-    regex_snake_name = "regex_name"
     regex_camel_name = "RegexName"
     regex = "regex pattern"
     semantic_type_name_plural = None
@@ -33,7 +32,6 @@ class ExpectColumnValuesToMatchSomeRegex(RegexBasedColumnMapExpectation):
 
     # Here your regex is used to create a custom metric for this expectation
     map_metric = RegexBasedColumnMapExpectation.register_metric(
-        regex_snake_name=regex_snake_name,
         regex_camel_name=regex_camel_name,
         regex_=regex,
     )
diff --git a/great_expectations/expectations/regex_based_column_map_expectation.py b/great_expectations/expectations/regex_based_column_map_expectation.py
--- a/great_expectations/expectations/regex_based_column_map_expectation.py
+++ b/great_expectations/expectations/regex_based_column_map_expectation.py
@@ -29,6 +29,7 @@
     parse_row_condition_string_pandas_engine,
     substitute_none_for_missing,
 )
+from great_expectations.util import camel_to_snake
 
 logger = logging.getLogger(__name__)
 
@@ -60,10 +61,10 @@ def _spark(cls, column, **kwargs):
 class RegexBasedColumnMapExpectation(ColumnMapExpectation, ABC):
     @staticmethod
     def register_metric(
-        regex_snake_name: str,
         regex_camel_name: str,
         regex_: str,
     ):
+        regex_snake_name = camel_to_snake(regex_camel_name)
         map_metric = "column_values.match_" + regex_snake_name + "_regex"
 
         # Define the class using `type`. This allows us to name it dynamically.


Test patch:
diff --git a/tests/integration/docusaurus/expectations/creating_custom_expectations/expect_column_values_to_only_contain_vowels.py b/tests/integration/docusaurus/expectations/creating_custom_expectations/expect_column_values_to_only_contain_vowels.py
--- a/tests/integration/docusaurus/expectations/creating_custom_expectations/expect_column_values_to_only_contain_vowels.py
+++ b/tests/integration/docusaurus/expectations/creating_custom_expectations/expect_column_values_to_only_contain_vowels.py
@@ -14,7 +14,6 @@
 class ExpectColumnValuesToOnlyContainVowels(RegexBasedColumnMapExpectation):
     """Values in this column should only contain vowels"""
 
-    regex_snake_name = "vowel"
     regex_camel_name = "Vowel"
     regex = "^[aeiouyAEIOUY]*$"
     semantic_type_name_plural = "vowels"
@@ -111,7 +110,6 @@ class ExpectColumnValuesToOnlyContainVowels(RegexBasedColumnMapExpectation):
     ]
 
     map_metric = RegexBasedColumnMapExpectation.register_metric(
-        regex_snake_name=regex_snake_name,
         regex_camel_name=regex_camel_name,
         regex_=regex,
     )