chore: ruff format

This commit is contained in:
KingND 2024-09-08 13:57:48 -04:00
parent 69678574d4
commit f970454cb4
2 changed files with 17 additions and 26 deletions

View File

@ -68,10 +68,7 @@ class LookaheadAnalysisSubFunctions:
) )
print_rich_table( print_rich_table(
data, data, headers, summary="Lookahead Analysis", table_kwargs={"caption": caption}
headers,
summary="Lookahead Analysis",
table_kwargs={"caption": caption}
) )
return data return data
@ -247,12 +244,17 @@ class LookaheadAnalysisSubFunctions:
# report the results # report the results
if lookaheadAnalysis_instances: if lookaheadAnalysis_instances:
caption: Union[str, None] = None caption: Union[str, None] = None
if any([ if any(
any([ [
any(
[
indicator.startswith("&") indicator.startswith("&")
for indicator in inst.current_analysis.false_indicators for indicator in inst.current_analysis.false_indicators
]) for inst in lookaheadAnalysis_instances ]
]): )
for inst in lookaheadAnalysis_instances
]
):
caption = ( caption = (
"Any indicators in 'biased_indicators' which are used within " "Any indicators in 'biased_indicators' which are used within "
"set_freqai_targets() can be ignored." "set_freqai_targets() can be ignored."

View File

@ -154,14 +154,8 @@ def test_lookahead_helper_start(lookahead_conf, mocker) -> None:
["&indicator1", "&indicator2"], ["&indicator1", "&indicator2"],
IGNORE_BIASED_INDICATORS_CAPTION, IGNORE_BIASED_INDICATORS_CAPTION,
), ),
( (["indicator1", "indicator2"], None),
["indicator1", "indicator2"], ([], None),
None
),
(
[],
None
),
], ],
ids=( ids=(
"First of two biased indicators starts with '&'", "First of two biased indicators starts with '&'",
@ -172,10 +166,7 @@ def test_lookahead_helper_start(lookahead_conf, mocker) -> None:
), ),
) )
def test_lookahead_helper_start__caption_based_on_indicators( def test_lookahead_helper_start__caption_based_on_indicators(
indicators, indicators, expected_caption_text, lookahead_conf, mocker
expected_caption_text,
lookahead_conf,
mocker
): ):
"""Test that the table caption is only populated if a biased_indicator starts with '&'.""" """Test that the table caption is only populated if a biased_indicator starts with '&'."""
@ -196,9 +187,7 @@ def test_lookahead_helper_start__caption_based_on_indicators(
LookaheadAnalysisSubFunctions.start(lookahead_conf) LookaheadAnalysisSubFunctions.start(lookahead_conf)
text_table_mock.assert_called_once_with( text_table_mock.assert_called_once_with(
lookahead_conf, lookahead_conf, [lookahead_analysis], caption=expected_caption_text
[lookahead_analysis],
caption=expected_caption_text
) )
@ -300,7 +289,7 @@ def test_lookahead_helper_text_table_lookahead_analysis_instances__caption(
{ {
"name": "strategy_test_v3_with_lookahead_bias", "name": "strategy_test_v3_with_lookahead_bias",
"location": Path(lookahead_conf["strategy_path"], f"{lookahead_conf['strategy']}.py"), "location": Path(lookahead_conf["strategy_path"], f"{lookahead_conf['strategy']}.py"),
} },
) )
kwargs = {} kwargs = {}
if caption is not False: if caption is not False: