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/rule_based_profiler/rule_based_profiler.py b/great_expectations/rule_based_profiler/rule_based_profiler.py
--- a/great_expectations/rule_based_profiler/rule_based_profiler.py
+++ b/great_expectations/rule_based_profiler/rule_based_profiler.py
@@ -1,9 +1,12 @@
 import copy
 import json
 import logging
+import sys
 import uuid
 from typing import Any, Dict, List, Optional, Set, Union
 
+from tqdm.auto import tqdm
+
 import great_expectations.exceptions as ge_exceptions
 from great_expectations.core.batch import (
     Batch,
@@ -228,6 +231,28 @@ def run(
             recompute_existing_parameter_values: If "True", recompute value if "fully_qualified_parameter_name" exists
             reconciliation_directives: directives for how each rule component should be overwritten
         """
+        # Check to see if the user has disabled progress bars
+        disable = False
+        if self._data_context:
+            progress_bars = self._data_context.progress_bars
+            # If progress_bars are not present, assume we want them enabled
+            if progress_bars is not None:
+                if "globally" in progress_bars:
+                    disable = not progress_bars["globally"]
+
+                if "rule_based_profiler" in progress_bars:
+                    disable = not progress_bars["rule_based_profiler"]
+
+        # noinspection PyProtectedMember,SpellCheckingInspection
+        progress_bar: tqdm = tqdm(
+            desc="Profiling Dataset",
+            disable=disable,
+        )
+        progress_bar.update(0)
+        progress_bar.refresh()
+        sys.stdout.write("\n")
+        sys.stdout.flush()
+
         effective_variables: Optional[
             ParameterContainer
         ] = self.reconcile_profiler_variables(
@@ -253,6 +278,7 @@ def run(
 
         rule_state: RuleState
         rule: Rule
+        domains_count: int = 0
         for rule in effective_rules:
             rule_state = rule.run(
                 variables=effective_variables,
@@ -264,6 +290,12 @@ def run(
             )
             self.rule_states.append(rule_state)
 
+            domains_count += len(rule_state.domains)
+            progress_bar.update(domains_count)
+            progress_bar.refresh()
+
+        progress_bar.close()
+
     def get_expectation_suite(
         self,
         expectation_suite: Optional[ExpectationSuite] = None,
diff --git a/great_expectations/validator/validator.py b/great_expectations/validator/validator.py
--- a/great_expectations/validator/validator.py
+++ b/great_expectations/validator/validator.py
@@ -1217,8 +1217,7 @@ def resolve_validation_graph(
 
         exception_info: ExceptionInfo
 
-        # noinspection SpellCheckingInspection
-        progress_bar = None
+        progress_bar: Optional[tqdm] = None
 
         done: bool = False
         while not done:
@@ -1248,6 +1247,7 @@ def resolve_validation_graph(
                     disable=disable,
                 )
                 progress_bar.update(0)
+                progress_bar.refresh()
 
             computable_metrics = set()
 
@@ -1271,6 +1271,7 @@ def resolve_validation_graph(
                     )
                 )
                 progress_bar.update(len(computable_metrics))
+                progress_bar.refresh()
             except MetricResolutionError as err:
                 if catch_exceptions:
                     exception_traceback = traceback.format_exc()


Test patch: