mlflow: Fix `use-set-literal` lint errors

Fix use-set-literal lint errors by following the instructions below (example PR: #6534):

https://github.com/mlflow/mlflow/blob/1b89add428da0a4453e7523a20d13f04f6291f37/pylint_plugins/set_checker.py#L12-L41

What needs to be fixed?

set applied on list or tuple literal need to be converted to set literal:

# Bad
set([1, 2, 3])
set((1, 2, 3))

# Good
{1, 2, 3}

Files

File Assignee PR
mlflow/azure/client.py @Monkero #6544
mlflow/entities/lifecycle_stage.py @Monkero #6544
mlflow/entities/run_status.py @Monkero #6544
mlflow/server/handlers.py @dsgibbons #6542
mlflow/tracking/fluent.py @dsgibbons #6542
mlflow/utils/autologging_utils/safety.py @dsgibbons #6542
tests/autologging/test_autologging_behaviors_unit.py @dsgibbons #6543
tests/entities/test_run_info.py @dsgibbons #6543
tests/entities/test_run_status.py @dsgibbons #6543
tests/lightgbm/test_lightgbm_autolog.py @iamthen0ise #6560
tests/models/test_model_input_examples.py @iamthen0ise #6560
tests/projects/test_project_spec.py @iamthen0ise #6560
tests/pyfunc/test_model_export_with_loader_module_and_data_path.py @dsgibbons #6584
tests/store/artifact/test_databricks_artifact_repo.py @dsgibbons #6584
tests/store/artifact/test_ftp_artifact_repo.py @dsgibbons #6584
~tests/tensorflow/test_tensorflow2_autolog.py~ - -
tests/utils/test_requirements_utils.py @dsgibbons #6584
tests/xgboost/test_xgboost_autolog.py @dsgibbons #6584
mlflow/utils/search_utils.py @harupy #6534
tests/entities/model_registry/test_model_version.py @harupy #6534
tests/entities/model_registry/test_registered_model.py @harupy #6534
tests/store/tracking/test_sqlalchemy_store.py @harupy #6534
tests/tracking/test_model_registry.py @harupy #6534

If you’re interested in working on this issue, ping me with the file you would like to work on. Please fix only 1 ~ 3 items per pull request.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@dsgibbons @iamthen0ise @Monkero Thanks for working on this issue! We have more good-first issues. Please let me know if you’re interested in working on them 😃

@dsgibbons Thanks! When you file a PR, can you remove the IGNORED_FILES variable?

diff --git a/pylint_plugins/set_checker.py b/pylint_plugins/set_checker.py
index 0a7f1d483..b646ef37e 100644
--- a/pylint_plugins/set_checker.py
+++ b/pylint_plugins/set_checker.py
@@ -5,30 +5,6 @@ from pylint.interfaces import IAstroidChecker
 from pylint.checkers import BaseChecker
 
 
-IGNORED_FILES = set(
-    map(
-        os.path.abspath,
-        [
-            ##### Instructions #####
-            # 1. Select the file you would like to work on.
-            # 2. Remove the file from the list.
-            # 3. Run `pylint <the file>`.
-            # 4. Fix lint errors.
-            # 5. File a PR.
-            "tests/lightgbm/test_lightgbm_autolog.py",
-            "tests/models/test_model_input_examples.py",
-            "tests/projects/test_project_spec.py",
-            "tests/pyfunc/test_model_export_with_loader_module_and_data_path.py",
-            "tests/store/artifact/test_databricks_artifact_repo.py",
-            "tests/store/artifact/test_ftp_artifact_repo.py",
-            "tests/tensorflow/test_tensorflow2_autolog.py",
-            "tests/utils/test_requirements_utils.py",
-            "tests/xgboost/test_xgboost_autolog.py",
-        ],
-    )
-)
-
-
 class SetChecker(BaseChecker):
     __implements__ = IAstroidChecker
 
@@ -45,8 +21,6 @@ class SetChecker(BaseChecker):
     priority = -1
 
     def visit_call(self, node: astroid.Call):
-        if node.root().file in IGNORED_FILES:
-            return
         if (
             node.func.as_string() == "set"
             and node.args

mlflow/utils/search_utils.py is contained within pylint_plugins/set_checker.py but is not included in the table above. mlflow/utils/search_utils.py still uses set() instead of {}.

I forgot to include the items I fixed in #6534. Updated the table.

@harupy Would you mind saving the number of items you will fix for first-time contributors?

@dsgibbons Thanks for the help! I’ve updated the description. You can fix 1 ~ 3 items per pull request.