1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-16 01:06:56 +08:00

fix_pylint_w0719 (#1463)

* fix_pylint_w0719

* remove_fixme
This commit is contained in:
Linlang
2023-03-17 19:25:49 +08:00
committed by GitHub
parent e457ca8511
commit 0e8bfcb5d3
5 changed files with 6 additions and 7 deletions

View File

@@ -86,12 +86,11 @@ jobs:
# W1309: f-string-without-interpolation # W1309: f-string-without-interpolation
# E1102: not-callable # E1102: not-callable
# E1136: unsubscriptable-object # E1136: unsubscriptable-object
# FIXME: Due to the version change of Pylint, some code will cause W0719 error after PR 1417. W0719 is temporarily disabled in PR 1417 and should be fixed.
# References for parameters: https://github.com/PyCQA/pylint/issues/4577#issuecomment-1000245962 # References for parameters: https://github.com/PyCQA/pylint/issues/4577#issuecomment-1000245962
# We use sys.setrecursionlimit(2000) to make the recursion depth larger to ensure that pylint works properly (the default recursion depth is 1000). # We use sys.setrecursionlimit(2000) to make the recursion depth larger to ensure that pylint works properly (the default recursion depth is 1000).
- name: Check Qlib with pylint - name: Check Qlib with pylint
run: | run: |
pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136,W0719 --const-rgx='[a-z_][a-z0-9_]{2,30}$' qlib --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)" pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136 --const-rgx='[a-z_][a-z0-9_]{2,30}$' qlib --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)"
# The following flake8 error codes were ignored: # The following flake8 error codes were ignored:
# E501 line too long # E501 line too long

View File

@@ -224,7 +224,7 @@ def requests_with_retry(url, retry=5, **kwargs):
except Exception as e: except Exception as e:
log.warning("exception encountered {}".format(e)) log.warning("exception encountered {}".format(e))
continue continue
raise Exception("ERROR: requests failed!") raise TimeoutError("ERROR: requests failed!")
#################### Parse #################### #################### Parse ####################

View File

@@ -333,7 +333,7 @@ class MLflowExperiment(Experiment):
recorder = self._get_recorder(recorder_name=recorder_name) recorder = self._get_recorder(recorder_name=recorder_name)
self._client.delete_run(recorder.id) self._client.delete_run(recorder.id)
except MlflowException as e: except MlflowException as e:
raise Exception( raise ValueError(
f"Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct." f"Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct."
) from e ) from e

View File

@@ -415,7 +415,7 @@ class MLflowExpManager(ExpManager):
raise MlflowException("No valid experiment has been found.") raise MlflowException("No valid experiment has been found.")
self.client.delete_experiment(experiment.experiment_id) self.client.delete_experiment(experiment.experiment_id)
except MlflowException as e: except MlflowException as e:
raise Exception( raise ValueError(
f"Error: {e}. Something went wrong when deleting experiment. Please check if the name/id of the experiment is correct." f"Error: {e}. Something went wrong when deleting experiment. Please check if the name/id of the experiment is correct."
) from e ) from e

View File

@@ -324,7 +324,7 @@ class MLflowRecorder(Recorder):
raise RuntimeError("This recorder is not saved in the local file system.") raise RuntimeError("This recorder is not saved in the local file system.")
else: else:
raise Exception( raise ValueError(
"Please make sure the recorder has been created and started properly before getting artifact uri." "Please make sure the recorder has been created and started properly before getting artifact uri."
) )
@@ -464,7 +464,7 @@ class MLflowRecorder(Recorder):
if self.artifact_uri is not None: if self.artifact_uri is not None:
return self.artifact_uri return self.artifact_uri
else: else:
raise Exception( raise ValueError(
"Please make sure the recorder has been created and started properly before getting artifact uri." "Please make sure the recorder has been created and started properly before getting artifact uri."
) )