From 5f2df9f97ba4876b8abbde0264cbd170a38ade31 Mon Sep 17 00:00:00 2001 From: harupy <17039389+harupy@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:16:43 +0900 Subject: [PATCH 1/2] Use latest version of black Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> --- requirements/lint-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/lint-requirements.txt b/requirements/lint-requirements.txt index a710f4d62925c..c10f6019a7bf2 100644 --- a/requirements/lint-requirements.txt +++ b/requirements/lint-requirements.txt @@ -1,3 +1,3 @@ pylint==2.11.1 rstcheck==3.2 -black==21.10b0 +black==22.3.0 From 885d068050445a1239dae9241b34c09ad9a86c94 Mon Sep 17 00:00:00 2001 From: harupy <17039389+harupy@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:26:51 +0900 Subject: [PATCH 2/2] run black Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> --- examples/statsmodels/train.py | 2 +- mlflow/pytorch/_pytorch_autolog.py | 1 - mlflow/store/db/utils.py | 2 +- tests/examples/test_examples.py | 2 +- tests/generate_ui_test_data.py | 2 +- tests/pylint_plugins/utils.py | 2 +- tests/statsmodels/model_fixtures.py | 4 ++-- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/statsmodels/train.py b/examples/statsmodels/train.py index 528efc77142d6..319d01260924e 100644 --- a/examples/statsmodels/train.py +++ b/examples/statsmodels/train.py @@ -28,7 +28,7 @@ def main(): np.random.seed(9876789) nsamples = 100 x = np.linspace(0, 10, 100) - X = np.column_stack((x, x ** 2)) + X = np.column_stack((x, x**2)) beta = np.array([1, 0.1, 10]) e = np.random.normal(size=nsamples) X = sm.add_constant(X) diff --git a/mlflow/pytorch/_pytorch_autolog.py b/mlflow/pytorch/_pytorch_autolog.py index df04bbd84e556..05293b50907bb 100644 --- a/mlflow/pytorch/_pytorch_autolog.py +++ b/mlflow/pytorch/_pytorch_autolog.py @@ -273,7 +273,6 @@ def on_test_end(self, trainer, pl_module): def _get_step_metrics(trainer): return trainer.callback_metrics - else: def _get_step_metrics(trainer): diff --git a/mlflow/store/db/utils.py b/mlflow/store/db/utils.py index 8c26958e5991a..5e62aa40c7258 100644 --- a/mlflow/store/db/utils.py +++ b/mlflow/store/db/utils.py @@ -161,7 +161,7 @@ def create_sqlalchemy_engine_with_retry(db_uri): return engine except Exception as e: if attempts < MAX_RETRY_COUNT: - sleep_duration = 0.1 * ((2 ** attempts) - 1) + sleep_duration = 0.1 * ((2**attempts) - 1) _logger.warning( "SQLAlchemy engine could not be created. The following exception is caught.\n" "%s\nOperation will be retried in %.1f seconds", diff --git a/tests/examples/test_examples.py b/tests/examples/test_examples.py index 5bfcd6d5f9d07..7337a87a82bd9 100644 --- a/tests/examples/test_examples.py +++ b/tests/examples/test_examples.py @@ -34,7 +34,7 @@ def remove_conda_env(env_name): def get_free_disk_space(): # https://stackoverflow.com/a/48929832/6943581 - return shutil.disk_usage("/")[-1] / (2 ** 30) + return shutil.disk_usage("/")[-1] / (2**30) def is_conda_yaml(path): diff --git a/tests/generate_ui_test_data.py b/tests/generate_ui_test_data.py index 7c10ba77693ce..14146b97f24c2 100644 --- a/tests/generate_ui_test_data.py +++ b/tests/generate_ui_test_data.py @@ -72,7 +72,7 @@ def rand_str(max_len=40): parameters = { "this is a pretty long parameter name": "NA10921-test_file_2018-08-10.txt", } - metrics = {"grower": [i ** 1.2 for i in range(10)]} + metrics = {"grower": [i**1.2 for i in range(10)]} log_params(parameters) log_metrics(metrics) diff --git a/tests/pylint_plugins/utils.py b/tests/pylint_plugins/utils.py index df9df062689d5..6636bc0899111 100644 --- a/tests/pylint_plugins/utils.py +++ b/tests/pylint_plugins/utils.py @@ -8,4 +8,4 @@ def get_pylint_msg_ids(): res = subprocess.run(["pylint", "--list-msgs"], stdout=subprocess.PIPE, check=True) stdout = res.stdout.decode("utf-8") letters = "".join(MSG_TYPES.keys()) - return set(re.findall(fr"\(([{letters}][0-9]{{4}})\)", stdout)) + return set(re.findall(rf"\(([{letters}][0-9]{{4}})\)", stdout)) diff --git a/tests/statsmodels/model_fixtures.py b/tests/statsmodels/model_fixtures.py index b75c90b95763d..01761d55c1857 100644 --- a/tests/statsmodels/model_fixtures.py +++ b/tests/statsmodels/model_fixtures.py @@ -21,7 +21,7 @@ def ols_model(**kwargs): np.random.seed(9876789) nsamples = 100 x = np.linspace(0, 10, 100) - X = np.column_stack((x, x ** 2)) + X = np.column_stack((x, x**2)) beta = np.array([1, 0.1, 10]) e = np.random.normal(size=nsamples) X = sm.add_constant(X) @@ -65,7 +65,7 @@ def gls_model(): res_fit = sm.OLS(ols_resid[1:], ols_resid[:-1]).fit() rho = res_fit.params order = toeplitz(np.arange(16)) - sigma = rho ** order + sigma = rho**order gls = sm.GLS(data.endog, data.exog, sigma=sigma) model = gls.fit()