We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `great_expectations/expectations/core/expect_column_values_to_not_match_regex.py`
Content:
```
1 from typing import TYPE_CHECKING, List, Optional
2 
3 from great_expectations.core import (
4     ExpectationConfiguration,
5     ExpectationValidationResult,
6 )
7 from great_expectations.expectations.expectation import (
8     ColumnMapExpectation,
9     InvalidExpectationConfigurationError,
10     render_evaluation_parameter_string,
11 )
12 from great_expectations.render import (
13     LegacyDescriptiveRendererType,
14     LegacyRendererType,
15     RenderedStringTemplateContent,
16 )
17 from great_expectations.render.renderer.renderer import renderer
18 from great_expectations.render.renderer_configuration import (
19     RendererConfiguration,
20     RendererValueType,
21 )
22 from great_expectations.render.util import (
23     num_to_str,
24     parse_row_condition_string_pandas_engine,
25     substitute_none_for_missing,
26 )
27 from great_expectations.rule_based_profiler.config.base import (
28     ParameterBuilderConfig,
29     RuleBasedProfilerConfig,
30 )
31 from great_expectations.rule_based_profiler.parameter_container import (
32     DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
33     FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY,
34     FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER,
35     FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY,
36     PARAMETER_KEY,
37     VARIABLES_KEY,
38 )
39 
40 if TYPE_CHECKING:
41     from great_expectations.render.renderer_configuration import AddParamArgs
42 
43 try:
44     import sqlalchemy as sa  # noqa: F401
45 except ImportError:
46     pass
47 
48 
49 class ExpectColumnValuesToNotMatchRegex(ColumnMapExpectation):
50     """Expect the column entries to be strings that do NOT match a given regular expression.
51 
52     The regex must not match \
53     any portion of the provided string. For example, "[at]+" would identify the following strings as expected: \
54     "fish", "dog", and the following as unexpected: "cat", "hat".
55 
56     expect_column_values_to_not_match_regex is a \
57     [Column Map Expectation](https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations).
58 
59     Args:
60         column (str): \
61             The column name.
62         regex (str): \
63             The regular expression the column entries should NOT match.
64 
65     Keyword Args:
66         mostly (None or a float between 0 and 1): \
67             Successful if at least mostly fraction of values match the expectation. \
68             For more detail, see [mostly](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#mostly).
69 
70     Other Parameters:
71         result_format (str or None): \
72             Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. \
73             For more detail, see [result_format](https://docs.greatexpectations.io/docs/reference/expectations/result_format).
74         include_config (boolean): \
75             If True, then include the expectation config as part of the result object.
76         catch_exceptions (boolean or None): \
77             If True, then catch exceptions and include them as part of the result object. \
78             For more detail, see [catch_exceptions](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#catch_exceptions).
79         meta (dict or None): \
80             A JSON-serializable dictionary (nesting allowed) that will be included in the output without \
81             modification. For more detail, see [meta](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#meta).
82 
83     Returns:
84         An [ExpectationSuiteValidationResult](https://docs.greatexpectations.io/docs/terms/validation_result)
85 
86         Exact fields vary depending on the values passed to result_format, include_config, catch_exceptions, and meta.
87 
88     See Also:
89         [expect_column_values_to_match_regex](https://greatexpectations.io/expectations/expect_column_values_to_match_regex)
90         [expect_column_values_to_match_regex_list](https://greatexpectations.io/expectations/expect_column_values_to_match_regex_list)
91         [expect_column_values_to_not_match_regex_list](https://greatexpectations.io/expectations/expect_column_values_to_not_match_regex_list)
92         [expect_column_values_to_match_like_pattern](https://greatexpectations.io/expectations/expect_column_values_to_match_like_pattern)
93         [expect_column_values_to_match_like_pattern_list](https://greatexpectations.io/expectations/expect_column_values_to_match_like_pattern_list)
94         [expect_column_values_to_not_match_like_pattern](https://greatexpectations.io/expectations/expect_column_values_to_not_match_like_pattern)
95         [expect_column_values_to_not_match_like_pattern_list](https://greatexpectations.io/expectations/expect_column_values_to_not_match_like_pattern_list)
96     """
97 
98     library_metadata = {
99         "maturity": "production",
100         "tags": ["core expectation", "column map expectation"],
101         "contributors": [
102             "@great_expectations",
103         ],
104         "requirements": [],
105         "has_full_test_suite": True,
106         "manually_reviewed_code": True,
107     }
108 
109     map_metric = "column_values.not_match_regex"
110     success_keys = (
111         "regex",
112         "mostly",
113         "auto",
114         "profiler_config",
115     )
116 
117     regex_pattern_string_parameter_builder_config: ParameterBuilderConfig = (
118         ParameterBuilderConfig(
119             module_name="great_expectations.rule_based_profiler.parameter_builder",
120             class_name="RegexPatternStringParameterBuilder",
121             name="regex_pattern_string_parameter_builder",
122             metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
123             metric_value_kwargs=None,
124             evaluation_parameter_builder_configs=None,
125         )
126     )
127     validation_parameter_builder_configs: List[ParameterBuilderConfig] = [
128         regex_pattern_string_parameter_builder_config
129     ]
130     default_profiler_config = RuleBasedProfilerConfig(
131         name="expect_column_values_to_not_match_regex",  # Convention: use "expectation_type" as profiler name.
132         config_version=1.0,
133         variables={},
134         rules={
135             "default_expect_column_values_to_not_match_regex_rule": {
136                 "variables": {
137                     "mostly": 1.0,
138                 },
139                 "domain_builder": {
140                     "class_name": "ColumnDomainBuilder",
141                     "module_name": "great_expectations.rule_based_profiler.domain_builder",
142                 },
143                 "expectation_configuration_builders": [
144                     {
145                         "expectation_type": "expect_column_values_to_not_match_regex",
146                         "class_name": "DefaultExpectationConfigurationBuilder",
147                         "module_name": "great_expectations.rule_based_profiler.expectation_configuration_builder",
148                         "validation_parameter_builder_configs": validation_parameter_builder_configs,
149                         "column": f"{DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}column",
150                         "regex": f"{PARAMETER_KEY}{regex_pattern_string_parameter_builder_config.name}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}{FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY}",
151                         "mostly": f"{VARIABLES_KEY}mostly",
152                         "meta": {
153                             "profiler_details": f"{PARAMETER_KEY}{regex_pattern_string_parameter_builder_config.name}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}{FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY}",
154                         },
155                     },
156                 ],
157             },
158         },
159     )
160 
161     default_kwarg_values = {
162         "row_condition": None,
163         "condition_parser": None,  # we expect this to be explicitly set whenever a row_condition is passed
164         "mostly": 1,
165         "result_format": "BASIC",
166         "include_config": True,
167         "catch_exceptions": True,
168         "auto": False,
169         "profiler_config": default_profiler_config,
170     }
171     args_keys = (
172         "column",
173         "regex",
174     )
175 
176     def validate_configuration(
177         self, configuration: Optional[ExpectationConfiguration] = None
178     ) -> None:
179         super().validate_configuration(configuration)
180         configuration = configuration or self.configuration
181         try:
182             assert "regex" in configuration.kwargs, "regex is required"
183             assert isinstance(
184                 configuration.kwargs["regex"], (str, dict)
185             ), "regex must be a string"
186             if isinstance(configuration.kwargs["regex"], dict):
187                 assert (
188                     "$PARAMETER" in configuration.kwargs["regex"]
189                 ), 'Evaluation Parameter dict for regex kwarg must have "$PARAMETER" key.'
190         except AssertionError as e:
191             raise InvalidExpectationConfigurationError(str(e))
192 
193     @classmethod
194     def _prescriptive_template(
195         cls,
196         renderer_configuration: RendererConfiguration,
197     ) -> RendererConfiguration:
198         add_param_args: AddParamArgs = (
199             ("column", RendererValueType.STRING),
200             ("regex", RendererValueType.STRING),
201             ("mostly", RendererValueType.NUMBER),
202         )
203         for name, param_type in add_param_args:
204             renderer_configuration.add_param(name=name, param_type=param_type)
205 
206         params = renderer_configuration.params
207 
208         if not params.regex:
209             template_str = (
210                 "values must not match a regular expression but none was specified."
211             )
212         else:
213             if renderer_configuration.include_column_name:
214                 template_str = (
215                     "$column values must not match this regular expression: $regex"
216                 )
217             else:
218                 template_str = "values must not match this regular expression: $regex"
219 
220             if params.mostly and params.mostly.value < 1.0:
221                 renderer_configuration = cls._add_mostly_pct_param(
222                     renderer_configuration=renderer_configuration
223                 )
224                 template_str += ", at least $mostly_pct % of the time."
225             else:
226                 template_str += "."
227 
228         renderer_configuration.template_str = template_str
229 
230         return renderer_configuration
231 
232     @classmethod
233     @renderer(renderer_type=LegacyRendererType.PRESCRIPTIVE)
234     @render_evaluation_parameter_string
235     def _prescriptive_renderer(
236         cls,
237         configuration: Optional[ExpectationConfiguration] = None,
238         result: Optional[ExpectationValidationResult] = None,
239         runtime_configuration: Optional[dict] = None,
240         **kwargs,
241     ):
242         runtime_configuration = runtime_configuration or {}
243         include_column_name = (
244             False if runtime_configuration.get("include_column_name") is False else True
245         )
246         styling = runtime_configuration.get("styling")
247         params = substitute_none_for_missing(
248             configuration.kwargs,
249             ["column", "regex", "mostly", "row_condition", "condition_parser"],
250         )
251 
252         if not params.get("regex"):
253             template_str = (
254                 "values must not match a regular expression but none was specified."
255             )
256         else:
257             if params["mostly"] is not None and params["mostly"] < 1.0:
258                 params["mostly_pct"] = num_to_str(
259                     params["mostly"] * 100, precision=15, no_scientific=True
260                 )
261                 # params["mostly_pct"] = "{:.14f}".format(params["mostly"]*100).rstrip("0").rstrip(".")
262                 if include_column_name:
263                     template_str = "$column values must not match this regular expression: $regex, at least $mostly_pct % of the time."
264                 else:
265                     template_str = "values must not match this regular expression: $regex, at least $mostly_pct % of the time."
266             else:
267                 if include_column_name:
268                     template_str = (
269                         "$column values must not match this regular expression: $regex."
270                     )
271                 else:
272                     template_str = (
273                         "values must not match this regular expression: $regex."
274                     )
275 
276         if params["row_condition"] is not None:
277             (
278                 conditional_template_str,
279                 conditional_params,
280             ) = parse_row_condition_string_pandas_engine(params["row_condition"])
281             template_str = f"{conditional_template_str}, then {template_str}"
282             params.update(conditional_params)
283 
284         return [
285             RenderedStringTemplateContent(
286                 **{
287                     "content_block_type": "string_template",
288                     "string_template": {
289                         "template": template_str,
290                         "params": params,
291                         "styling": styling,
292                     },
293                 }
294             )
295         ]
296 
297     @classmethod
298     @renderer(
299         renderer_type=LegacyDescriptiveRendererType.COLUMN_PROPERTIES_TABLE_REGEX_COUNT_ROW
300     )
301     def _descriptive_column_properties_table_regex_count_row_renderer(
302         cls,
303         configuration: Optional[ExpectationConfiguration] = None,
304         result: Optional[ExpectationValidationResult] = None,
305         runtime_configuration: Optional[dict] = None,
306         **kwargs,
307     ):
308         assert result, "Must pass in result."
309         expectation_config = configuration or result.expectation_config
310         expectation_kwargs = expectation_config.kwargs
311         regex = expectation_kwargs.get("regex")
312         unexpected_count = result.result.get("unexpected_count", "--")
313         if regex == "^\\s+|\\s+$":
314             return ["Leading or trailing whitespace (n)", unexpected_count]
315         else:
316             return [f"Regex: {regex}", unexpected_count]
317
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py b/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py
--- a/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py
+++ b/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py
@@ -176,13 +176,28 @@
     def validate_configuration(
         self, configuration: Optional[ExpectationConfiguration] = None
     ) -> None:
+        """
+        Validates the configuration of an Expectation.
+
+        For `expect_column_values_to_not_match_regex` it is required that:
+            - 'regex' kwarg is of type str or dict
+            - if dict, assert a key "$PARAMETER" is present
+
+        Args:
+            configuration: An `ExpectationConfiguration` to validate. If no configuration is provided, it will be pulled
+                                  from the configuration attribute of the Expectation instance.
+
+        Raises:
+            `InvalidExpectationConfigurationError`: The configuration does not contain the values required by the
+                                  Expectation."
+        """
         super().validate_configuration(configuration)
         configuration = configuration or self.configuration
         try:
             assert "regex" in configuration.kwargs, "regex is required"
             assert isinstance(
                 configuration.kwargs["regex"], (str, dict)
-            ), "regex must be a string"
+            ), "regex must be a string or dict"
             if isinstance(configuration.kwargs["regex"], dict):
                 assert (
                     "$PARAMETER" in configuration.kwargs["regex"]

{"golden_diff": "diff --git a/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py b/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py\n--- a/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py\n+++ b/great_expectations/expectations/core/expect_column_values_to_not_match_regex.py\n@@ -176,13 +176,28 @@\n     def validate_configuration(\n         self, configuration: Optional[ExpectationConfiguration] = None\n     ) -> None:\n+        \"\"\"\n+        Validates the configuration of an Expectation.\n+\n+        For `expect_column_values_to_not_match_regex` it is required that:\n+            - 'regex' kwarg is of type str or dict\n+            - if dict, assert a key \"$PARAMETER\" is present\n+\n+        Args:\n+            configuration: An `ExpectationConfiguration` to validate. If no configuration is provided, it will be pulled\n+                                  from the configuration attribute of the Expectation instance.\n+\n+        Raises:\n+            `InvalidExpectationConfigurationError`: The configuration does not contain the values required by the\n+                                  Expectation.\"\n+        \"\"\"\n         super().validate_configuration(configuration)\n         configuration = configuration or self.configuration\n         try:\n             assert \"regex\" in configuration.kwargs, \"regex is required\"\n             assert isinstance(\n                 configuration.kwargs[\"regex\"], (str, dict)\n-            ), \"regex must be a string\"\n+            ), \"regex must be a string or dict\"\n             if isinstance(configuration.kwargs[\"regex\"], dict):\n                 assert (\n                     \"$PARAMETER\" in configuration.kwargs[\"regex\"]\n", "issue": "Use cleaner solution for non-truncating division in python 2\nPrefer `from __future__ import division` to `1.*x/y`\n", "before_files": [{"content": "from typing import TYPE_CHECKING, List, Optional\n\nfrom great_expectations.core import (\n    ExpectationConfiguration,\n    ExpectationValidationResult,\n)\nfrom great_expectations.expectations.expectation import (\n    ColumnMapExpectation,\n    InvalidExpectationConfigurationError,\n    render_evaluation_parameter_string,\n)\nfrom great_expectations.render import (\n    LegacyDescriptiveRendererType,\n    LegacyRendererType,\n    RenderedStringTemplateContent,\n)\nfrom great_expectations.render.renderer.renderer import renderer\nfrom great_expectations.render.renderer_configuration import (\n    RendererConfiguration,\n    RendererValueType,\n)\nfrom great_expectations.render.util import (\n    num_to_str,\n    parse_row_condition_string_pandas_engine,\n    substitute_none_for_missing,\n)\nfrom great_expectations.rule_based_profiler.config.base import (\n    ParameterBuilderConfig,\n    RuleBasedProfilerConfig,\n)\nfrom great_expectations.rule_based_profiler.parameter_container import (\n    DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n    FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY,\n    FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER,\n    FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY,\n    PARAMETER_KEY,\n    VARIABLES_KEY,\n)\n\nif TYPE_CHECKING:\n    from great_expectations.render.renderer_configuration import AddParamArgs\n\ntry:\n    import sqlalchemy as sa  # noqa: F401\nexcept ImportError:\n    pass\n\n\nclass ExpectColumnValuesToNotMatchRegex(ColumnMapExpectation):\n    \"\"\"Expect the column entries to be strings that do NOT match a given regular expression.\n\n    The regex must not match \\\n    any portion of the provided string. For example, \"[at]+\" would identify the following strings as expected: \\\n    \"fish\", \"dog\", and the following as unexpected: \"cat\", \"hat\".\n\n    expect_column_values_to_not_match_regex is a \\\n    [Column Map Expectation](https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations).\n\n    Args:\n        column (str): \\\n            The column name.\n        regex (str): \\\n            The regular expression the column entries should NOT match.\n\n    Keyword Args:\n        mostly (None or a float between 0 and 1): \\\n            Successful if at least mostly fraction of values match the expectation. \\\n            For more detail, see [mostly](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#mostly).\n\n    Other Parameters:\n        result_format (str or None): \\\n            Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. \\\n            For more detail, see [result_format](https://docs.greatexpectations.io/docs/reference/expectations/result_format).\n        include_config (boolean): \\\n            If True, then include the expectation config as part of the result object.\n        catch_exceptions (boolean or None): \\\n            If True, then catch exceptions and include them as part of the result object. \\\n            For more detail, see [catch_exceptions](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#catch_exceptions).\n        meta (dict or None): \\\n            A JSON-serializable dictionary (nesting allowed) that will be included in the output without \\\n            modification. For more detail, see [meta](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#meta).\n\n    Returns:\n        An [ExpectationSuiteValidationResult](https://docs.greatexpectations.io/docs/terms/validation_result)\n\n        Exact fields vary depending on the values passed to result_format, include_config, catch_exceptions, and meta.\n\n    See Also:\n        [expect_column_values_to_match_regex](https://greatexpectations.io/expectations/expect_column_values_to_match_regex)\n        [expect_column_values_to_match_regex_list](https://greatexpectations.io/expectations/expect_column_values_to_match_regex_list)\n        [expect_column_values_to_not_match_regex_list](https://greatexpectations.io/expectations/expect_column_values_to_not_match_regex_list)\n        [expect_column_values_to_match_like_pattern](https://greatexpectations.io/expectations/expect_column_values_to_match_like_pattern)\n        [expect_column_values_to_match_like_pattern_list](https://greatexpectations.io/expectations/expect_column_values_to_match_like_pattern_list)\n        [expect_column_values_to_not_match_like_pattern](https://greatexpectations.io/expectations/expect_column_values_to_not_match_like_pattern)\n        [expect_column_values_to_not_match_like_pattern_list](https://greatexpectations.io/expectations/expect_column_values_to_not_match_like_pattern_list)\n    \"\"\"\n\n    library_metadata = {\n        \"maturity\": \"production\",\n        \"tags\": [\"core expectation\", \"column map expectation\"],\n        \"contributors\": [\n            \"@great_expectations\",\n        ],\n        \"requirements\": [],\n        \"has_full_test_suite\": True,\n        \"manually_reviewed_code\": True,\n    }\n\n    map_metric = \"column_values.not_match_regex\"\n    success_keys = (\n        \"regex\",\n        \"mostly\",\n        \"auto\",\n        \"profiler_config\",\n    )\n\n    regex_pattern_string_parameter_builder_config: ParameterBuilderConfig = (\n        ParameterBuilderConfig(\n            module_name=\"great_expectations.rule_based_profiler.parameter_builder\",\n            class_name=\"RegexPatternStringParameterBuilder\",\n            name=\"regex_pattern_string_parameter_builder\",\n            metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n            metric_value_kwargs=None,\n            evaluation_parameter_builder_configs=None,\n        )\n    )\n    validation_parameter_builder_configs: List[ParameterBuilderConfig] = [\n        regex_pattern_string_parameter_builder_config\n    ]\n    default_profiler_config = RuleBasedProfilerConfig(\n        name=\"expect_column_values_to_not_match_regex\",  # Convention: use \"expectation_type\" as profiler name.\n        config_version=1.0,\n        variables={},\n        rules={\n            \"default_expect_column_values_to_not_match_regex_rule\": {\n                \"variables\": {\n                    \"mostly\": 1.0,\n                },\n                \"domain_builder\": {\n                    \"class_name\": \"ColumnDomainBuilder\",\n                    \"module_name\": \"great_expectations.rule_based_profiler.domain_builder\",\n                },\n                \"expectation_configuration_builders\": [\n                    {\n                        \"expectation_type\": \"expect_column_values_to_not_match_regex\",\n                        \"class_name\": \"DefaultExpectationConfigurationBuilder\",\n                        \"module_name\": \"great_expectations.rule_based_profiler.expectation_configuration_builder\",\n                        \"validation_parameter_builder_configs\": validation_parameter_builder_configs,\n                        \"column\": f\"{DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}column\",\n                        \"regex\": f\"{PARAMETER_KEY}{regex_pattern_string_parameter_builder_config.name}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}{FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY}\",\n                        \"mostly\": f\"{VARIABLES_KEY}mostly\",\n                        \"meta\": {\n                            \"profiler_details\": f\"{PARAMETER_KEY}{regex_pattern_string_parameter_builder_config.name}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}{FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY}\",\n                        },\n                    },\n                ],\n            },\n        },\n    )\n\n    default_kwarg_values = {\n        \"row_condition\": None,\n        \"condition_parser\": None,  # we expect this to be explicitly set whenever a row_condition is passed\n        \"mostly\": 1,\n        \"result_format\": \"BASIC\",\n        \"include_config\": True,\n        \"catch_exceptions\": True,\n        \"auto\": False,\n        \"profiler_config\": default_profiler_config,\n    }\n    args_keys = (\n        \"column\",\n        \"regex\",\n    )\n\n    def validate_configuration(\n        self, configuration: Optional[ExpectationConfiguration] = None\n    ) -> None:\n        super().validate_configuration(configuration)\n        configuration = configuration or self.configuration\n        try:\n            assert \"regex\" in configuration.kwargs, \"regex is required\"\n            assert isinstance(\n                configuration.kwargs[\"regex\"], (str, dict)\n            ), \"regex must be a string\"\n            if isinstance(configuration.kwargs[\"regex\"], dict):\n                assert (\n                    \"$PARAMETER\" in configuration.kwargs[\"regex\"]\n                ), 'Evaluation Parameter dict for regex kwarg must have \"$PARAMETER\" key.'\n        except AssertionError as e:\n            raise InvalidExpectationConfigurationError(str(e))\n\n    @classmethod\n    def _prescriptive_template(\n        cls,\n        renderer_configuration: RendererConfiguration,\n    ) -> RendererConfiguration:\n        add_param_args: AddParamArgs = (\n            (\"column\", RendererValueType.STRING),\n            (\"regex\", RendererValueType.STRING),\n            (\"mostly\", RendererValueType.NUMBER),\n        )\n        for name, param_type in add_param_args:\n            renderer_configuration.add_param(name=name, param_type=param_type)\n\n        params = renderer_configuration.params\n\n        if not params.regex:\n            template_str = (\n                \"values must not match a regular expression but none was specified.\"\n            )\n        else:\n            if renderer_configuration.include_column_name:\n                template_str = (\n                    \"$column values must not match this regular expression: $regex\"\n                )\n            else:\n                template_str = \"values must not match this regular expression: $regex\"\n\n            if params.mostly and params.mostly.value < 1.0:\n                renderer_configuration = cls._add_mostly_pct_param(\n                    renderer_configuration=renderer_configuration\n                )\n                template_str += \", at least $mostly_pct % of the time.\"\n            else:\n                template_str += \".\"\n\n        renderer_configuration.template_str = template_str\n\n        return renderer_configuration\n\n    @classmethod\n    @renderer(renderer_type=LegacyRendererType.PRESCRIPTIVE)\n    @render_evaluation_parameter_string\n    def _prescriptive_renderer(\n        cls,\n        configuration: Optional[ExpectationConfiguration] = None,\n        result: Optional[ExpectationValidationResult] = None,\n        runtime_configuration: Optional[dict] = None,\n        **kwargs,\n    ):\n        runtime_configuration = runtime_configuration or {}\n        include_column_name = (\n            False if runtime_configuration.get(\"include_column_name\") is False else True\n        )\n        styling = runtime_configuration.get(\"styling\")\n        params = substitute_none_for_missing(\n            configuration.kwargs,\n            [\"column\", \"regex\", \"mostly\", \"row_condition\", \"condition_parser\"],\n        )\n\n        if not params.get(\"regex\"):\n            template_str = (\n                \"values must not match a regular expression but none was specified.\"\n            )\n        else:\n            if params[\"mostly\"] is not None and params[\"mostly\"] < 1.0:\n                params[\"mostly_pct\"] = num_to_str(\n                    params[\"mostly\"] * 100, precision=15, no_scientific=True\n                )\n                # params[\"mostly_pct\"] = \"{:.14f}\".format(params[\"mostly\"]*100).rstrip(\"0\").rstrip(\".\")\n                if include_column_name:\n                    template_str = \"$column values must not match this regular expression: $regex, at least $mostly_pct % of the time.\"\n                else:\n                    template_str = \"values must not match this regular expression: $regex, at least $mostly_pct % of the time.\"\n            else:\n                if include_column_name:\n                    template_str = (\n                        \"$column values must not match this regular expression: $regex.\"\n                    )\n                else:\n                    template_str = (\n                        \"values must not match this regular expression: $regex.\"\n                    )\n\n        if params[\"row_condition\"] is not None:\n            (\n                conditional_template_str,\n                conditional_params,\n            ) = parse_row_condition_string_pandas_engine(params[\"row_condition\"])\n            template_str = f\"{conditional_template_str}, then {template_str}\"\n            params.update(conditional_params)\n\n        return [\n            RenderedStringTemplateContent(\n                **{\n                    \"content_block_type\": \"string_template\",\n                    \"string_template\": {\n                        \"template\": template_str,\n                        \"params\": params,\n                        \"styling\": styling,\n                    },\n                }\n            )\n        ]\n\n    @classmethod\n    @renderer(\n        renderer_type=LegacyDescriptiveRendererType.COLUMN_PROPERTIES_TABLE_REGEX_COUNT_ROW\n    )\n    def _descriptive_column_properties_table_regex_count_row_renderer(\n        cls,\n        configuration: Optional[ExpectationConfiguration] = None,\n        result: Optional[ExpectationValidationResult] = None,\n        runtime_configuration: Optional[dict] = None,\n        **kwargs,\n    ):\n        assert result, \"Must pass in result.\"\n        expectation_config = configuration or result.expectation_config\n        expectation_kwargs = expectation_config.kwargs\n        regex = expectation_kwargs.get(\"regex\")\n        unexpected_count = result.result.get(\"unexpected_count\", \"--\")\n        if regex == \"^\\\\s+|\\\\s+$\":\n            return [\"Leading or trailing whitespace (n)\", unexpected_count]\n        else:\n            return [f\"Regex: {regex}\", unexpected_count]\n", "path": "great_expectations/expectations/core/expect_column_values_to_not_match_regex.py"}], "after_files": [{"content": "from typing import TYPE_CHECKING, List, Optional\n\nfrom great_expectations.core import (\n    ExpectationConfiguration,\n    ExpectationValidationResult,\n)\nfrom great_expectations.expectations.expectation import (\n    ColumnMapExpectation,\n    InvalidExpectationConfigurationError,\n    render_evaluation_parameter_string,\n)\nfrom great_expectations.render import (\n    LegacyDescriptiveRendererType,\n    LegacyRendererType,\n    RenderedStringTemplateContent,\n)\nfrom great_expectations.render.renderer.renderer import renderer\nfrom great_expectations.render.renderer_configuration import (\n    RendererConfiguration,\n    RendererValueType,\n)\nfrom great_expectations.render.util import (\n    num_to_str,\n    parse_row_condition_string_pandas_engine,\n    substitute_none_for_missing,\n)\nfrom great_expectations.rule_based_profiler.config.base import (\n    ParameterBuilderConfig,\n    RuleBasedProfilerConfig,\n)\nfrom great_expectations.rule_based_profiler.parameter_container import (\n    DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n    FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY,\n    FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER,\n    FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY,\n    PARAMETER_KEY,\n    VARIABLES_KEY,\n)\n\nif TYPE_CHECKING:\n    from great_expectations.render.renderer_configuration import AddParamArgs\n\ntry:\n    import sqlalchemy as sa  # noqa: F401\nexcept ImportError:\n    pass\n\n\nclass ExpectColumnValuesToNotMatchRegex(ColumnMapExpectation):\n    \"\"\"Expect the column entries to be strings that do NOT match a given regular expression.\n\n    The regex must not match \\\n    any portion of the provided string. For example, \"[at]+\" would identify the following strings as expected: \\\n    \"fish\", \"dog\", and the following as unexpected: \"cat\", \"hat\".\n\n    expect_column_values_to_not_match_regex is a \\\n    [Column Map Expectation](https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations).\n\n    Args:\n        column (str): \\\n            The column name.\n        regex (str): \\\n            The regular expression the column entries should NOT match.\n\n    Keyword Args:\n        mostly (None or a float between 0 and 1): \\\n            Successful if at least mostly fraction of values match the expectation. \\\n            For more detail, see [mostly](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#mostly).\n\n    Other Parameters:\n        result_format (str or None): \\\n            Which output mode to use: BOOLEAN_ONLY, BASIC, COMPLETE, or SUMMARY. \\\n            For more detail, see [result_format](https://docs.greatexpectations.io/docs/reference/expectations/result_format).\n        include_config (boolean): \\\n            If True, then include the expectation config as part of the result object.\n        catch_exceptions (boolean or None): \\\n            If True, then catch exceptions and include them as part of the result object. \\\n            For more detail, see [catch_exceptions](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#catch_exceptions).\n        meta (dict or None): \\\n            A JSON-serializable dictionary (nesting allowed) that will be included in the output without \\\n            modification. For more detail, see [meta](https://docs.greatexpectations.io/docs/reference/expectations/standard_arguments/#meta).\n\n    Returns:\n        An [ExpectationSuiteValidationResult](https://docs.greatexpectations.io/docs/terms/validation_result)\n\n        Exact fields vary depending on the values passed to result_format, include_config, catch_exceptions, and meta.\n\n    See Also:\n        [expect_column_values_to_match_regex](https://greatexpectations.io/expectations/expect_column_values_to_match_regex)\n        [expect_column_values_to_match_regex_list](https://greatexpectations.io/expectations/expect_column_values_to_match_regex_list)\n        [expect_column_values_to_not_match_regex_list](https://greatexpectations.io/expectations/expect_column_values_to_not_match_regex_list)\n        [expect_column_values_to_match_like_pattern](https://greatexpectations.io/expectations/expect_column_values_to_match_like_pattern)\n        [expect_column_values_to_match_like_pattern_list](https://greatexpectations.io/expectations/expect_column_values_to_match_like_pattern_list)\n        [expect_column_values_to_not_match_like_pattern](https://greatexpectations.io/expectations/expect_column_values_to_not_match_like_pattern)\n        [expect_column_values_to_not_match_like_pattern_list](https://greatexpectations.io/expectations/expect_column_values_to_not_match_like_pattern_list)\n    \"\"\"\n\n    library_metadata = {\n        \"maturity\": \"production\",\n        \"tags\": [\"core expectation\", \"column map expectation\"],\n        \"contributors\": [\n            \"@great_expectations\",\n        ],\n        \"requirements\": [],\n        \"has_full_test_suite\": True,\n        \"manually_reviewed_code\": True,\n    }\n\n    map_metric = \"column_values.not_match_regex\"\n    success_keys = (\n        \"regex\",\n        \"mostly\",\n        \"auto\",\n        \"profiler_config\",\n    )\n\n    regex_pattern_string_parameter_builder_config: ParameterBuilderConfig = (\n        ParameterBuilderConfig(\n            module_name=\"great_expectations.rule_based_profiler.parameter_builder\",\n            class_name=\"RegexPatternStringParameterBuilder\",\n            name=\"regex_pattern_string_parameter_builder\",\n            metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n            metric_value_kwargs=None,\n            evaluation_parameter_builder_configs=None,\n        )\n    )\n    validation_parameter_builder_configs: List[ParameterBuilderConfig] = [\n        regex_pattern_string_parameter_builder_config\n    ]\n    default_profiler_config = RuleBasedProfilerConfig(\n        name=\"expect_column_values_to_not_match_regex\",  # Convention: use \"expectation_type\" as profiler name.\n        config_version=1.0,\n        variables={},\n        rules={\n            \"default_expect_column_values_to_not_match_regex_rule\": {\n                \"variables\": {\n                    \"mostly\": 1.0,\n                },\n                \"domain_builder\": {\n                    \"class_name\": \"ColumnDomainBuilder\",\n                    \"module_name\": \"great_expectations.rule_based_profiler.domain_builder\",\n                },\n                \"expectation_configuration_builders\": [\n                    {\n                        \"expectation_type\": \"expect_column_values_to_not_match_regex\",\n                        \"class_name\": \"DefaultExpectationConfigurationBuilder\",\n                        \"module_name\": \"great_expectations.rule_based_profiler.expectation_configuration_builder\",\n                        \"validation_parameter_builder_configs\": validation_parameter_builder_configs,\n                        \"column\": f\"{DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}column\",\n                        \"regex\": f\"{PARAMETER_KEY}{regex_pattern_string_parameter_builder_config.name}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}{FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY}\",\n                        \"mostly\": f\"{VARIABLES_KEY}mostly\",\n                        \"meta\": {\n                            \"profiler_details\": f\"{PARAMETER_KEY}{regex_pattern_string_parameter_builder_config.name}{FULLY_QUALIFIED_PARAMETER_NAME_SEPARATOR_CHARACTER}{FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY}\",\n                        },\n                    },\n                ],\n            },\n        },\n    )\n\n    default_kwarg_values = {\n        \"row_condition\": None,\n        \"condition_parser\": None,  # we expect this to be explicitly set whenever a row_condition is passed\n        \"mostly\": 1,\n        \"result_format\": \"BASIC\",\n        \"include_config\": True,\n        \"catch_exceptions\": True,\n        \"auto\": False,\n        \"profiler_config\": default_profiler_config,\n    }\n    args_keys = (\n        \"column\",\n        \"regex\",\n    )\n\n    def validate_configuration(\n        self, configuration: Optional[ExpectationConfiguration] = None\n    ) -> None:\n        \"\"\"\n        Validates the configuration of an Expectation.\n\n        For `expect_column_values_to_not_match_regex` it is required that:\n            - 'regex' kwarg is of type str or dict\n            - if dict, assert a key \"$PARAMETER\" is present\n\n        Args:\n            configuration: An `ExpectationConfiguration` to validate. If no configuration is provided, it will be pulled\n                                  from the configuration attribute of the Expectation instance.\n\n        Raises:\n            `InvalidExpectationConfigurationError`: The configuration does not contain the values required by the\n                                  Expectation.\"\n        \"\"\"\n        super().validate_configuration(configuration)\n        configuration = configuration or self.configuration\n        try:\n            assert \"regex\" in configuration.kwargs, \"regex is required\"\n            assert isinstance(\n                configuration.kwargs[\"regex\"], (str, dict)\n            ), \"regex must be a string or dict\"\n            if isinstance(configuration.kwargs[\"regex\"], dict):\n                assert (\n                    \"$PARAMETER\" in configuration.kwargs[\"regex\"]\n                ), 'Evaluation Parameter dict for regex kwarg must have \"$PARAMETER\" key.'\n        except AssertionError as e:\n            raise InvalidExpectationConfigurationError(str(e))\n\n    @classmethod\n    def _prescriptive_template(\n        cls,\n        renderer_configuration: RendererConfiguration,\n    ) -> RendererConfiguration:\n        add_param_args: AddParamArgs = (\n            (\"column\", RendererValueType.STRING),\n            (\"regex\", RendererValueType.STRING),\n            (\"mostly\", RendererValueType.NUMBER),\n        )\n        for name, param_type in add_param_args:\n            renderer_configuration.add_param(name=name, param_type=param_type)\n\n        params = renderer_configuration.params\n\n        if not params.regex:\n            template_str = (\n                \"values must not match a regular expression but none was specified.\"\n            )\n        else:\n            if renderer_configuration.include_column_name:\n                template_str = (\n                    \"$column values must not match this regular expression: $regex\"\n                )\n            else:\n                template_str = \"values must not match this regular expression: $regex\"\n\n            if params.mostly and params.mostly.value < 1.0:\n                renderer_configuration = cls._add_mostly_pct_param(\n                    renderer_configuration=renderer_configuration\n                )\n                template_str += \", at least $mostly_pct % of the time.\"\n            else:\n                template_str += \".\"\n\n        renderer_configuration.template_str = template_str\n\n        return renderer_configuration\n\n    @classmethod\n    @renderer(renderer_type=LegacyRendererType.PRESCRIPTIVE)\n    @render_evaluation_parameter_string\n    def _prescriptive_renderer(\n        cls,\n        configuration: Optional[ExpectationConfiguration] = None,\n        result: Optional[ExpectationValidationResult] = None,\n        runtime_configuration: Optional[dict] = None,\n        **kwargs,\n    ):\n        runtime_configuration = runtime_configuration or {}\n        include_column_name = (\n            False if runtime_configuration.get(\"include_column_name\") is False else True\n        )\n        styling = runtime_configuration.get(\"styling\")\n        params = substitute_none_for_missing(\n            configuration.kwargs,\n            [\"column\", \"regex\", \"mostly\", \"row_condition\", \"condition_parser\"],\n        )\n\n        if not params.get(\"regex\"):\n            template_str = (\n                \"values must not match a regular expression but none was specified.\"\n            )\n        else:\n            if params[\"mostly\"] is not None and params[\"mostly\"] < 1.0:\n                params[\"mostly_pct\"] = num_to_str(\n                    params[\"mostly\"] * 100, precision=15, no_scientific=True\n                )\n                # params[\"mostly_pct\"] = \"{:.14f}\".format(params[\"mostly\"]*100).rstrip(\"0\").rstrip(\".\")\n                if include_column_name:\n                    template_str = \"$column values must not match this regular expression: $regex, at least $mostly_pct % of the time.\"\n                else:\n                    template_str = \"values must not match this regular expression: $regex, at least $mostly_pct % of the time.\"\n            else:\n                if include_column_name:\n                    template_str = (\n                        \"$column values must not match this regular expression: $regex.\"\n                    )\n                else:\n                    template_str = (\n                        \"values must not match this regular expression: $regex.\"\n                    )\n\n        if params[\"row_condition\"] is not None:\n            (\n                conditional_template_str,\n                conditional_params,\n            ) = parse_row_condition_string_pandas_engine(params[\"row_condition\"])\n            template_str = f\"{conditional_template_str}, then {template_str}\"\n            params.update(conditional_params)\n\n        return [\n            RenderedStringTemplateContent(\n                **{\n                    \"content_block_type\": \"string_template\",\n                    \"string_template\": {\n                        \"template\": template_str,\n                        \"params\": params,\n                        \"styling\": styling,\n                    },\n                }\n            )\n        ]\n\n    @classmethod\n    @renderer(\n        renderer_type=LegacyDescriptiveRendererType.COLUMN_PROPERTIES_TABLE_REGEX_COUNT_ROW\n    )\n    def _descriptive_column_properties_table_regex_count_row_renderer(\n        cls,\n        configuration: Optional[ExpectationConfiguration] = None,\n        result: Optional[ExpectationValidationResult] = None,\n        runtime_configuration: Optional[dict] = None,\n        **kwargs,\n    ):\n        assert result, \"Must pass in result.\"\n        expectation_config = configuration or result.expectation_config\n        expectation_kwargs = expectation_config.kwargs\n        regex = expectation_kwargs.get(\"regex\")\n        unexpected_count = result.result.get(\"unexpected_count\", \"--\")\n        if regex == \"^\\\\s+|\\\\s+$\":\n            return [\"Leading or trailing whitespace (n)\", unexpected_count]\n        else:\n            return [f\"Regex: {regex}\", unexpected_count]\n", "path": "great_expectations/expectations/core/expect_column_values_to_not_match_regex.py"}]}