Skip to content

Commit 0e8bfcb

Browse files
authored
fix_pylint_w0719 (microsoft#1463)
* fix_pylint_w0719 * remove_fixme
1 parent e457ca8 commit 0e8bfcb

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

.github/workflows/test_qlib_from_source.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ jobs:
8686
# W1309: f-string-without-interpolation
8787
# E1102: not-callable
8888
# E1136: unsubscriptable-object
89-
# 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.
9089
# References for parameters: https://github.com/PyCQA/pylint/issues/4577#issuecomment-1000245962
9190
# We use sys.setrecursionlimit(2000) to make the recursion depth larger to ensure that pylint works properly (the default recursion depth is 1000).
9291
- name: Check Qlib with pylint
9392
run: |
94-
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)"
93+
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)"
9594
9695
# The following flake8 error codes were ignored:
9796
# E501 line too long

qlib/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def requests_with_retry(url, retry=5, **kwargs):
224224
except Exception as e:
225225
log.warning("exception encountered {}".format(e))
226226
continue
227-
raise Exception("ERROR: requests failed!")
227+
raise TimeoutError("ERROR: requests failed!")
228228

229229

230230
#################### Parse ####################

qlib/workflow/exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def delete_recorder(self, recorder_id=None, recorder_name=None):
333333
recorder = self._get_recorder(recorder_name=recorder_name)
334334
self._client.delete_run(recorder.id)
335335
except MlflowException as e:
336-
raise Exception(
336+
raise ValueError(
337337
f"Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct."
338338
) from e
339339

qlib/workflow/expm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def delete_exp(self, experiment_id=None, experiment_name=None):
415415
raise MlflowException("No valid experiment has been found.")
416416
self.client.delete_experiment(experiment.experiment_id)
417417
except MlflowException as e:
418-
raise Exception(
418+
raise ValueError(
419419
f"Error: {e}. Something went wrong when deleting experiment. Please check if the name/id of the experiment is correct."
420420
) from e
421421

qlib/workflow/recorder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def get_local_dir(self):
324324
raise RuntimeError("This recorder is not saved in the local file system.")
325325

326326
else:
327-
raise Exception(
327+
raise ValueError(
328328
"Please make sure the recorder has been created and started properly before getting artifact uri."
329329
)
330330

@@ -464,7 +464,7 @@ def get_artifact_uri(self):
464464
if self.artifact_uri is not None:
465465
return self.artifact_uri
466466
else:
467-
raise Exception(
467+
raise ValueError(
468468
"Please make sure the recorder has been created and started properly before getting artifact uri."
469469
)
470470

0 commit comments

Comments
 (0)