1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-10 14:26:56 +08:00

Fix typos and grammar errors in docstrings and comments (#1366)

* fix gramma error in doc strings

* fix typos in exchange.py

* fix typos and gramma errors

* fix typo and rename function param to avoid shading python keyword

* remove redundant parathesis; pass kwargs to parent class

* fix pyblack

* further correction

* assign -> be assigned to
This commit is contained in:
YQ Tsui
2022-11-20 14:15:59 +08:00
committed by GitHub
parent 0c4db8b0f8
commit cc01812c62
24 changed files with 77 additions and 72 deletions

View File

@@ -35,7 +35,7 @@ Simulation + DelayTrainer When your models don't have any temporal dependence,
different time segments (based on whether or not any new model is online).
========================= ===================================================================================
Here is some pseudo code the demonstrate the workflow of each situation
Here is some pseudo code that demonstrate the workflow of each situation
For simplicity
- Only one strategy is used in the strategy

View File

@@ -178,7 +178,7 @@ class SignalRecord(RecordTemp):
# The backend handler should be DataHandler
raw_label = dataset.prepare(**params)
except AttributeError as e:
# The data handler is initialize with `drop_raw=True`...
# The data handler is initialized with `drop_raw=True`...
# So raw_label is not available
logger.warning(f"Exception: {e}")
raw_label = None

View File

@@ -18,30 +18,30 @@ def experiment_exit_handler():
"""
Method for handling the experiment when any unusual program ending occurs.
The `atexit` handler should be put in the last, since, as long as the program ends, it will be called.
Thus, if any exception or user interuption occurs beforehead, we should handle them first. Once `R` is
Thus, if any exception or user interruption occurs beforehand, we should handle them first. Once `R` is
ended, another call of `R.end_exp` will not take effect.
Limitations:
- If pdb is used in the your program, excepthook will not be triggered when it ends. The status will be finished
- If pdb is used in your program, excepthook will not be triggered when it ends. The status will be finished
"""
sys.excepthook = experiment_exception_hook # handle uncaught exception
atexit.register(R.end_exp, recorder_status=Recorder.STATUS_FI) # will not take effect if experiment ends
def experiment_exception_hook(type, value, tb):
def experiment_exception_hook(exc_type, value, tb):
"""
End an experiment with status to be "FAILED". This exception tries to catch those uncaught exception
and end the experiment automatically.
Parameters
type: Exception type
exc_type: Exception type
value: Exception's value
tb: Exception's traceback
"""
logger.error(f"An exception has been raised[{type.__name__}: {value}].")
logger.error(f"An exception has been raised[{exc_type.__name__}: {value}].")
# Same as original format
traceback.print_tb(tb)
print(f"{type.__name__}: {value}")
print(f"{exc_type.__name__}: {value}")
R.end_exp(recorder_status=Recorder.STATUS_FA)