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/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py`
Content:
```
1 from typing import Any, Dict, List, Optional, Set
2 
3 import numpy as np
4 import pandas as pd
5 
6 import great_expectations.exceptions as ge_exceptions
7 from great_expectations.rule_based_profiler.config import ParameterBuilderConfig
8 from great_expectations.rule_based_profiler.domain import Domain
9 from great_expectations.rule_based_profiler.helpers.util import (
10     NP_EPSILON,
11     get_parameter_value_and_validate_return_type,
12 )
13 from great_expectations.rule_based_profiler.metric_computation_result import MetricValue
14 from great_expectations.rule_based_profiler.parameter_builder import (
15     MetricSingleBatchParameterBuilder,
16 )
17 from great_expectations.rule_based_profiler.parameter_container import (
18     DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
19     FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY,
20     FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY,
21     RAW_PARAMETER_KEY,
22     ParameterContainer,
23     ParameterNode,
24 )
25 from great_expectations.types.attributes import Attributes
26 
27 
28 class HistogramSingleBatchParameterBuilder(MetricSingleBatchParameterBuilder):
29     """
30     Compute histogram using specified metric for one Batch of data.
31     """
32 
33     exclude_field_names: Set[
34         str
35     ] = MetricSingleBatchParameterBuilder.exclude_field_names | {
36         "column_partition_metric_single_batch_parameter_builder_config",
37         "metric_name",
38         "metric_domain_kwargs",
39         "metric_value_kwargs",
40         "enforce_numeric_metric",
41         "replace_nan_with_zero",
42         "reduce_scalar_metric",
43     }
44 
45     def __init__(
46         self,
47         name: str,
48         bins: str = "uniform",
49         n_bins: int = 10,
50         allow_relative_error: bool = False,
51         evaluation_parameter_builder_configs: Optional[
52             List[ParameterBuilderConfig]
53         ] = None,
54         data_context: Optional["BaseDataContext"] = None,  # noqa: F821
55     ) -> None:
56         """
57         Args:
58             name: the name of this parameter -- this is user-specified parameter name (from configuration);
59             it is not the fully-qualified parameter name; a fully-qualified parameter name must start with "$parameter."
60             and may contain one or more subsequent parts (e.g., "$parameter.<my_param_from_config>.<metric_name>").
61             bins: Partitioning strategy (one of "uniform", "ntile", "quantile", "percentile", or "auto"); please refer
62             to "ColumnPartition" (great_expectations/expectations/metrics/column_aggregate_metrics/column_partition.py).
63             n_bins: Number of bins for histogram computation (ignored and recomputed if "bins" argument is "auto").
64             allow_relative_error: Used for partitionong strategy values that involve quantiles (all except "uniform").
65             evaluation_parameter_builder_configs: ParameterBuilder configurations, executing and making whose respective
66             ParameterBuilder objects' outputs available (as fully-qualified parameter names) is pre-requisite.
67             These "ParameterBuilder" configurations help build parameters needed for this "ParameterBuilder".
68             data_context: BaseDataContext associated with this ParameterBuilder
69         """
70 
71         self._column_partition_metric_single_batch_parameter_builder_config = (
72             ParameterBuilderConfig(
73                 module_name="great_expectations.rule_based_profiler.parameter_builder",
74                 class_name="MetricSingleBatchParameterBuilder",
75                 name="column_partition_metric_single_batch_parameter_builder",
76                 metric_name="column.partition",
77                 metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
78                 metric_value_kwargs={
79                     "bins": bins,
80                     "n_bins": n_bins,
81                     "allow_relative_error": allow_relative_error,
82                 },
83                 enforce_numeric_metric=False,
84                 replace_nan_with_zero=False,
85                 reduce_scalar_metric=False,
86                 evaluation_parameter_builder_configs=None,
87             )
88         )
89 
90         if evaluation_parameter_builder_configs is None:
91             evaluation_parameter_builder_configs = [
92                 self._column_partition_metric_single_batch_parameter_builder_config,
93             ]
94 
95         super().__init__(
96             name=name,
97             metric_name=None,
98             metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
99             metric_value_kwargs=None,
100             enforce_numeric_metric=False,
101             replace_nan_with_zero=False,
102             reduce_scalar_metric=False,
103             evaluation_parameter_builder_configs=evaluation_parameter_builder_configs,
104             data_context=data_context,
105         )
106 
107     def _build_parameters(
108         self,
109         domain: Domain,
110         variables: Optional[ParameterContainer] = None,
111         parameters: Optional[Dict[str, ParameterContainer]] = None,
112         recompute_existing_parameter_values: bool = False,
113     ) -> Attributes:
114         """
115         Builds ParameterContainer object that holds ParameterNode objects with attribute name-value pairs and details.
116 
117         Returns:
118             Attributes object, containing computed parameter values and parameter computation details metadata.
119         """
120         fully_qualified_column_partition_metric_single_batch_parameter_builder_name: str = f"{RAW_PARAMETER_KEY}{self._column_partition_metric_single_batch_parameter_builder_config.name}"
121         # Obtain "column.partition" from "rule state" (i.e., variables and parameters); from instance variable otherwise.
122         column_partition_parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(
123             domain=domain,
124             parameter_reference=fully_qualified_column_partition_metric_single_batch_parameter_builder_name,
125             expected_return_type=None,
126             variables=variables,
127             parameters=parameters,
128         )
129         bins: MetricValue = column_partition_parameter_node[
130             FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY
131         ]
132 
133         element: Any
134         if bins is None or all(pd.isnull(element) for element in bins):
135             raise ge_exceptions.ProfilerExecutionError(
136                 message=f"""Partitioning values for {self.__class__.__name__} by \
137 {self._column_partition_metric_single_batch_parameter_builder_config.name} into bins encountered empty or non-existent \
138 elements.
139 """
140             )
141 
142         if not np.issubdtype(bins.dtype, np.number):
143             raise ge_exceptions.ProfilerExecutionError(
144                 message=f"""Partitioning values for {self.__class__.__name__} by \
145 {self._column_partition_metric_single_batch_parameter_builder_config.name} did not yield bins of supported data type.
146 """
147             )
148 
149         # Only unique "bins" are necessary (hence, "n_bins" is potentially lowered to fit data distribution).
150         bins = sorted(set(bins))
151 
152         column_values_nonnull_count_metric_single_batch_parameter_builder = MetricSingleBatchParameterBuilder(
153             name="column_values_nonnull_count_metric_single_batch_parameter_builder",
154             metric_name="column_values.nonnull.count",
155             metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
156             metric_value_kwargs=None,
157             enforce_numeric_metric=False,
158             replace_nan_with_zero=False,
159             reduce_scalar_metric=False,
160             evaluation_parameter_builder_configs=None,
161             data_context=self.data_context,
162         )
163         column_values_nonnull_count_metric_single_batch_parameter_builder.build_parameters(
164             domain=domain,
165             variables=variables,
166             parameters=parameters,
167             batch_list=self.batch_list,
168             batch_request=self.batch_request,
169             recompute_existing_parameter_values=recompute_existing_parameter_values,
170         )
171         # Obtain "column_values.nonnull.count" from "rule state" (i.e., variables and parameters); from instance variable otherwise.
172         column_values_nonnull_count_parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(
173             domain=domain,
174             parameter_reference=column_values_nonnull_count_metric_single_batch_parameter_builder.raw_fully_qualified_parameter_name,
175             expected_return_type=None,
176             variables=variables,
177             parameters=parameters,
178         )
179 
180         self.metric_name = "column.histogram"
181         self.metric_value_kwargs = {
182             "bins": tuple(bins),
183         }
184 
185         # Compute metric value for one Batch object.
186         super().build_parameters(
187             domain=domain,
188             variables=variables,
189             parameters=parameters,
190             parameter_computation_impl=super()._build_parameters,
191             recompute_existing_parameter_values=recompute_existing_parameter_values,
192         )
193 
194         # Retrieve metric values for one Batch object.
195         parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(
196             domain=domain,
197             parameter_reference=self.raw_fully_qualified_parameter_name,
198             expected_return_type=None,
199             variables=variables,
200             parameters=parameters,
201         )
202 
203         weights: np.ndarray = np.asarray(
204             parameter_node[FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY]
205         ) / (
206             column_values_nonnull_count_parameter_node[
207                 FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY
208             ]
209             + NP_EPSILON
210         )
211         tail_weights: float = (1.0 - sum(weights)) / 2.0
212 
213         partition_object: dict = {
214             "bins": bins,
215             "weights": weights.tolist(),
216             "tail_weights": [tail_weights, tail_weights],
217         }
218         details: dict = parameter_node[FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY]
219 
220         return Attributes(
221             {
222                 FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY: partition_object,
223                 FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY: details,
224             }
225         )
226
```
--- 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/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py b/great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py
--- a/great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py
+++ b/great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py
@@ -1,7 +1,6 @@
-from typing import Any, Dict, List, Optional, Set
+from typing import Dict, List, Optional, Set
 
 import numpy as np
-import pandas as pd
 
 import great_expectations.exceptions as ge_exceptions
 from great_expectations.rule_based_profiler.config import ParameterBuilderConfig
@@ -130,8 +129,7 @@
             FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY
         ]
 
-        element: Any
-        if bins is None or all(pd.isnull(element) for element in bins):
+        if bins is None:
             raise ge_exceptions.ProfilerExecutionError(
                 message=f"""Partitioning values for {self.__class__.__name__} by \
 {self._column_partition_metric_single_batch_parameter_builder_config.name} into bins encountered empty or non-existent \

{"golden_diff": "diff --git a/great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py b/great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py\n--- a/great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py\n+++ b/great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py\n@@ -1,7 +1,6 @@\n-from typing import Any, Dict, List, Optional, Set\n+from typing import Dict, List, Optional, Set\n \n import numpy as np\n-import pandas as pd\n \n import great_expectations.exceptions as ge_exceptions\n from great_expectations.rule_based_profiler.config import ParameterBuilderConfig\n@@ -130,8 +129,7 @@\n             FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY\n         ]\n \n-        element: Any\n-        if bins is None or all(pd.isnull(element) for element in bins):\n+        if bins is None:\n             raise ge_exceptions.ProfilerExecutionError(\n                 message=f\"\"\"Partitioning values for {self.__class__.__name__} by \\\n {self._column_partition_metric_single_batch_parameter_builder_config.name} into bins encountered empty or non-existent \\\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 Any, Dict, List, Optional, Set\n\nimport numpy as np\nimport pandas as pd\n\nimport great_expectations.exceptions as ge_exceptions\nfrom great_expectations.rule_based_profiler.config import ParameterBuilderConfig\nfrom great_expectations.rule_based_profiler.domain import Domain\nfrom great_expectations.rule_based_profiler.helpers.util import (\n    NP_EPSILON,\n    get_parameter_value_and_validate_return_type,\n)\nfrom great_expectations.rule_based_profiler.metric_computation_result import MetricValue\nfrom great_expectations.rule_based_profiler.parameter_builder import (\n    MetricSingleBatchParameterBuilder,\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_VALUE_KEY,\n    RAW_PARAMETER_KEY,\n    ParameterContainer,\n    ParameterNode,\n)\nfrom great_expectations.types.attributes import Attributes\n\n\nclass HistogramSingleBatchParameterBuilder(MetricSingleBatchParameterBuilder):\n    \"\"\"\n    Compute histogram using specified metric for one Batch of data.\n    \"\"\"\n\n    exclude_field_names: Set[\n        str\n    ] = MetricSingleBatchParameterBuilder.exclude_field_names | {\n        \"column_partition_metric_single_batch_parameter_builder_config\",\n        \"metric_name\",\n        \"metric_domain_kwargs\",\n        \"metric_value_kwargs\",\n        \"enforce_numeric_metric\",\n        \"replace_nan_with_zero\",\n        \"reduce_scalar_metric\",\n    }\n\n    def __init__(\n        self,\n        name: str,\n        bins: str = \"uniform\",\n        n_bins: int = 10,\n        allow_relative_error: bool = False,\n        evaluation_parameter_builder_configs: Optional[\n            List[ParameterBuilderConfig]\n        ] = None,\n        data_context: Optional[\"BaseDataContext\"] = None,  # noqa: F821\n    ) -> None:\n        \"\"\"\n        Args:\n            name: the name of this parameter -- this is user-specified parameter name (from configuration);\n            it is not the fully-qualified parameter name; a fully-qualified parameter name must start with \"$parameter.\"\n            and may contain one or more subsequent parts (e.g., \"$parameter.<my_param_from_config>.<metric_name>\").\n            bins: Partitioning strategy (one of \"uniform\", \"ntile\", \"quantile\", \"percentile\", or \"auto\"); please refer\n            to \"ColumnPartition\" (great_expectations/expectations/metrics/column_aggregate_metrics/column_partition.py).\n            n_bins: Number of bins for histogram computation (ignored and recomputed if \"bins\" argument is \"auto\").\n            allow_relative_error: Used for partitionong strategy values that involve quantiles (all except \"uniform\").\n            evaluation_parameter_builder_configs: ParameterBuilder configurations, executing and making whose respective\n            ParameterBuilder objects' outputs available (as fully-qualified parameter names) is pre-requisite.\n            These \"ParameterBuilder\" configurations help build parameters needed for this \"ParameterBuilder\".\n            data_context: BaseDataContext associated with this ParameterBuilder\n        \"\"\"\n\n        self._column_partition_metric_single_batch_parameter_builder_config = (\n            ParameterBuilderConfig(\n                module_name=\"great_expectations.rule_based_profiler.parameter_builder\",\n                class_name=\"MetricSingleBatchParameterBuilder\",\n                name=\"column_partition_metric_single_batch_parameter_builder\",\n                metric_name=\"column.partition\",\n                metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n                metric_value_kwargs={\n                    \"bins\": bins,\n                    \"n_bins\": n_bins,\n                    \"allow_relative_error\": allow_relative_error,\n                },\n                enforce_numeric_metric=False,\n                replace_nan_with_zero=False,\n                reduce_scalar_metric=False,\n                evaluation_parameter_builder_configs=None,\n            )\n        )\n\n        if evaluation_parameter_builder_configs is None:\n            evaluation_parameter_builder_configs = [\n                self._column_partition_metric_single_batch_parameter_builder_config,\n            ]\n\n        super().__init__(\n            name=name,\n            metric_name=None,\n            metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n            metric_value_kwargs=None,\n            enforce_numeric_metric=False,\n            replace_nan_with_zero=False,\n            reduce_scalar_metric=False,\n            evaluation_parameter_builder_configs=evaluation_parameter_builder_configs,\n            data_context=data_context,\n        )\n\n    def _build_parameters(\n        self,\n        domain: Domain,\n        variables: Optional[ParameterContainer] = None,\n        parameters: Optional[Dict[str, ParameterContainer]] = None,\n        recompute_existing_parameter_values: bool = False,\n    ) -> Attributes:\n        \"\"\"\n        Builds ParameterContainer object that holds ParameterNode objects with attribute name-value pairs and details.\n\n        Returns:\n            Attributes object, containing computed parameter values and parameter computation details metadata.\n        \"\"\"\n        fully_qualified_column_partition_metric_single_batch_parameter_builder_name: str = f\"{RAW_PARAMETER_KEY}{self._column_partition_metric_single_batch_parameter_builder_config.name}\"\n        # Obtain \"column.partition\" from \"rule state\" (i.e., variables and parameters); from instance variable otherwise.\n        column_partition_parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(\n            domain=domain,\n            parameter_reference=fully_qualified_column_partition_metric_single_batch_parameter_builder_name,\n            expected_return_type=None,\n            variables=variables,\n            parameters=parameters,\n        )\n        bins: MetricValue = column_partition_parameter_node[\n            FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY\n        ]\n\n        element: Any\n        if bins is None or all(pd.isnull(element) for element in bins):\n            raise ge_exceptions.ProfilerExecutionError(\n                message=f\"\"\"Partitioning values for {self.__class__.__name__} by \\\n{self._column_partition_metric_single_batch_parameter_builder_config.name} into bins encountered empty or non-existent \\\nelements.\n\"\"\"\n            )\n\n        if not np.issubdtype(bins.dtype, np.number):\n            raise ge_exceptions.ProfilerExecutionError(\n                message=f\"\"\"Partitioning values for {self.__class__.__name__} by \\\n{self._column_partition_metric_single_batch_parameter_builder_config.name} did not yield bins of supported data type.\n\"\"\"\n            )\n\n        # Only unique \"bins\" are necessary (hence, \"n_bins\" is potentially lowered to fit data distribution).\n        bins = sorted(set(bins))\n\n        column_values_nonnull_count_metric_single_batch_parameter_builder = MetricSingleBatchParameterBuilder(\n            name=\"column_values_nonnull_count_metric_single_batch_parameter_builder\",\n            metric_name=\"column_values.nonnull.count\",\n            metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n            metric_value_kwargs=None,\n            enforce_numeric_metric=False,\n            replace_nan_with_zero=False,\n            reduce_scalar_metric=False,\n            evaluation_parameter_builder_configs=None,\n            data_context=self.data_context,\n        )\n        column_values_nonnull_count_metric_single_batch_parameter_builder.build_parameters(\n            domain=domain,\n            variables=variables,\n            parameters=parameters,\n            batch_list=self.batch_list,\n            batch_request=self.batch_request,\n            recompute_existing_parameter_values=recompute_existing_parameter_values,\n        )\n        # Obtain \"column_values.nonnull.count\" from \"rule state\" (i.e., variables and parameters); from instance variable otherwise.\n        column_values_nonnull_count_parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(\n            domain=domain,\n            parameter_reference=column_values_nonnull_count_metric_single_batch_parameter_builder.raw_fully_qualified_parameter_name,\n            expected_return_type=None,\n            variables=variables,\n            parameters=parameters,\n        )\n\n        self.metric_name = \"column.histogram\"\n        self.metric_value_kwargs = {\n            \"bins\": tuple(bins),\n        }\n\n        # Compute metric value for one Batch object.\n        super().build_parameters(\n            domain=domain,\n            variables=variables,\n            parameters=parameters,\n            parameter_computation_impl=super()._build_parameters,\n            recompute_existing_parameter_values=recompute_existing_parameter_values,\n        )\n\n        # Retrieve metric values for one Batch object.\n        parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(\n            domain=domain,\n            parameter_reference=self.raw_fully_qualified_parameter_name,\n            expected_return_type=None,\n            variables=variables,\n            parameters=parameters,\n        )\n\n        weights: np.ndarray = np.asarray(\n            parameter_node[FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY]\n        ) / (\n            column_values_nonnull_count_parameter_node[\n                FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY\n            ]\n            + NP_EPSILON\n        )\n        tail_weights: float = (1.0 - sum(weights)) / 2.0\n\n        partition_object: dict = {\n            \"bins\": bins,\n            \"weights\": weights.tolist(),\n            \"tail_weights\": [tail_weights, tail_weights],\n        }\n        details: dict = parameter_node[FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY]\n\n        return Attributes(\n            {\n                FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY: partition_object,\n                FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY: details,\n            }\n        )\n", "path": "great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py"}], "after_files": [{"content": "from typing import Dict, List, Optional, Set\n\nimport numpy as np\n\nimport great_expectations.exceptions as ge_exceptions\nfrom great_expectations.rule_based_profiler.config import ParameterBuilderConfig\nfrom great_expectations.rule_based_profiler.domain import Domain\nfrom great_expectations.rule_based_profiler.helpers.util import (\n    NP_EPSILON,\n    get_parameter_value_and_validate_return_type,\n)\nfrom great_expectations.rule_based_profiler.metric_computation_result import MetricValue\nfrom great_expectations.rule_based_profiler.parameter_builder import (\n    MetricSingleBatchParameterBuilder,\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_VALUE_KEY,\n    RAW_PARAMETER_KEY,\n    ParameterContainer,\n    ParameterNode,\n)\nfrom great_expectations.types.attributes import Attributes\n\n\nclass HistogramSingleBatchParameterBuilder(MetricSingleBatchParameterBuilder):\n    \"\"\"\n    Compute histogram using specified metric for one Batch of data.\n    \"\"\"\n\n    exclude_field_names: Set[\n        str\n    ] = MetricSingleBatchParameterBuilder.exclude_field_names | {\n        \"column_partition_metric_single_batch_parameter_builder_config\",\n        \"metric_name\",\n        \"metric_domain_kwargs\",\n        \"metric_value_kwargs\",\n        \"enforce_numeric_metric\",\n        \"replace_nan_with_zero\",\n        \"reduce_scalar_metric\",\n    }\n\n    def __init__(\n        self,\n        name: str,\n        bins: str = \"uniform\",\n        n_bins: int = 10,\n        allow_relative_error: bool = False,\n        evaluation_parameter_builder_configs: Optional[\n            List[ParameterBuilderConfig]\n        ] = None,\n        data_context: Optional[\"BaseDataContext\"] = None,  # noqa: F821\n    ) -> None:\n        \"\"\"\n        Args:\n            name: the name of this parameter -- this is user-specified parameter name (from configuration);\n            it is not the fully-qualified parameter name; a fully-qualified parameter name must start with \"$parameter.\"\n            and may contain one or more subsequent parts (e.g., \"$parameter.<my_param_from_config>.<metric_name>\").\n            bins: Partitioning strategy (one of \"uniform\", \"ntile\", \"quantile\", \"percentile\", or \"auto\"); please refer\n            to \"ColumnPartition\" (great_expectations/expectations/metrics/column_aggregate_metrics/column_partition.py).\n            n_bins: Number of bins for histogram computation (ignored and recomputed if \"bins\" argument is \"auto\").\n            allow_relative_error: Used for partitionong strategy values that involve quantiles (all except \"uniform\").\n            evaluation_parameter_builder_configs: ParameterBuilder configurations, executing and making whose respective\n            ParameterBuilder objects' outputs available (as fully-qualified parameter names) is pre-requisite.\n            These \"ParameterBuilder\" configurations help build parameters needed for this \"ParameterBuilder\".\n            data_context: BaseDataContext associated with this ParameterBuilder\n        \"\"\"\n\n        self._column_partition_metric_single_batch_parameter_builder_config = (\n            ParameterBuilderConfig(\n                module_name=\"great_expectations.rule_based_profiler.parameter_builder\",\n                class_name=\"MetricSingleBatchParameterBuilder\",\n                name=\"column_partition_metric_single_batch_parameter_builder\",\n                metric_name=\"column.partition\",\n                metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n                metric_value_kwargs={\n                    \"bins\": bins,\n                    \"n_bins\": n_bins,\n                    \"allow_relative_error\": allow_relative_error,\n                },\n                enforce_numeric_metric=False,\n                replace_nan_with_zero=False,\n                reduce_scalar_metric=False,\n                evaluation_parameter_builder_configs=None,\n            )\n        )\n\n        if evaluation_parameter_builder_configs is None:\n            evaluation_parameter_builder_configs = [\n                self._column_partition_metric_single_batch_parameter_builder_config,\n            ]\n\n        super().__init__(\n            name=name,\n            metric_name=None,\n            metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n            metric_value_kwargs=None,\n            enforce_numeric_metric=False,\n            replace_nan_with_zero=False,\n            reduce_scalar_metric=False,\n            evaluation_parameter_builder_configs=evaluation_parameter_builder_configs,\n            data_context=data_context,\n        )\n\n    def _build_parameters(\n        self,\n        domain: Domain,\n        variables: Optional[ParameterContainer] = None,\n        parameters: Optional[Dict[str, ParameterContainer]] = None,\n        recompute_existing_parameter_values: bool = False,\n    ) -> Attributes:\n        \"\"\"\n        Builds ParameterContainer object that holds ParameterNode objects with attribute name-value pairs and details.\n\n        Returns:\n            Attributes object, containing computed parameter values and parameter computation details metadata.\n        \"\"\"\n        fully_qualified_column_partition_metric_single_batch_parameter_builder_name: str = f\"{RAW_PARAMETER_KEY}{self._column_partition_metric_single_batch_parameter_builder_config.name}\"\n        # Obtain \"column.partition\" from \"rule state\" (i.e., variables and parameters); from instance variable otherwise.\n        column_partition_parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(\n            domain=domain,\n            parameter_reference=fully_qualified_column_partition_metric_single_batch_parameter_builder_name,\n            expected_return_type=None,\n            variables=variables,\n            parameters=parameters,\n        )\n        bins: MetricValue = column_partition_parameter_node[\n            FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY\n        ]\n\n        if bins is None:\n            raise ge_exceptions.ProfilerExecutionError(\n                message=f\"\"\"Partitioning values for {self.__class__.__name__} by \\\n{self._column_partition_metric_single_batch_parameter_builder_config.name} into bins encountered empty or non-existent \\\nelements.\n\"\"\"\n            )\n\n        if not np.issubdtype(bins.dtype, np.number):\n            raise ge_exceptions.ProfilerExecutionError(\n                message=f\"\"\"Partitioning values for {self.__class__.__name__} by \\\n{self._column_partition_metric_single_batch_parameter_builder_config.name} did not yield bins of supported data type.\n\"\"\"\n            )\n\n        # Only unique \"bins\" are necessary (hence, \"n_bins\" is potentially lowered to fit data distribution).\n        bins = sorted(set(bins))\n\n        column_values_nonnull_count_metric_single_batch_parameter_builder = MetricSingleBatchParameterBuilder(\n            name=\"column_values_nonnull_count_metric_single_batch_parameter_builder\",\n            metric_name=\"column_values.nonnull.count\",\n            metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,\n            metric_value_kwargs=None,\n            enforce_numeric_metric=False,\n            replace_nan_with_zero=False,\n            reduce_scalar_metric=False,\n            evaluation_parameter_builder_configs=None,\n            data_context=self.data_context,\n        )\n        column_values_nonnull_count_metric_single_batch_parameter_builder.build_parameters(\n            domain=domain,\n            variables=variables,\n            parameters=parameters,\n            batch_list=self.batch_list,\n            batch_request=self.batch_request,\n            recompute_existing_parameter_values=recompute_existing_parameter_values,\n        )\n        # Obtain \"column_values.nonnull.count\" from \"rule state\" (i.e., variables and parameters); from instance variable otherwise.\n        column_values_nonnull_count_parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(\n            domain=domain,\n            parameter_reference=column_values_nonnull_count_metric_single_batch_parameter_builder.raw_fully_qualified_parameter_name,\n            expected_return_type=None,\n            variables=variables,\n            parameters=parameters,\n        )\n\n        self.metric_name = \"column.histogram\"\n        self.metric_value_kwargs = {\n            \"bins\": tuple(bins),\n        }\n\n        # Compute metric value for one Batch object.\n        super().build_parameters(\n            domain=domain,\n            variables=variables,\n            parameters=parameters,\n            parameter_computation_impl=super()._build_parameters,\n            recompute_existing_parameter_values=recompute_existing_parameter_values,\n        )\n\n        # Retrieve metric values for one Batch object.\n        parameter_node: ParameterNode = get_parameter_value_and_validate_return_type(\n            domain=domain,\n            parameter_reference=self.raw_fully_qualified_parameter_name,\n            expected_return_type=None,\n            variables=variables,\n            parameters=parameters,\n        )\n\n        weights: np.ndarray = np.asarray(\n            parameter_node[FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY]\n        ) / (\n            column_values_nonnull_count_parameter_node[\n                FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY\n            ]\n            + NP_EPSILON\n        )\n        tail_weights: float = (1.0 - sum(weights)) / 2.0\n\n        partition_object: dict = {\n            \"bins\": bins,\n            \"weights\": weights.tolist(),\n            \"tail_weights\": [tail_weights, tail_weights],\n        }\n        details: dict = parameter_node[FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY]\n\n        return Attributes(\n            {\n                FULLY_QUALIFIED_PARAMETER_NAME_VALUE_KEY: partition_object,\n                FULLY_QUALIFIED_PARAMETER_NAME_METADATA_KEY: details,\n            }\n        )\n", "path": "great_expectations/rule_based_profiler/parameter_builder/histogram_single_batch_parameter_builder.py"}]}