ranaroussi / quantstats

if statements can be merged PTC-W0048
Anti-pattern
Major
7 occurrences in this check
Consider merging collapsible if statements
1219    strategy_colname = kwargs.get("strategy_title", "Strategy")
1220    active = kwargs.get("active", "False")
1221
1222    if isinstance(returns, _pd.DataFrame):1223        if len(returns.columns) > 1:
1224            if isinstance(strategy_colname, str):
1225                strategy_colname = list(returns.columns)
Consider merging collapsible if statements
 668    strategy_title = kwargs.get("strategy_title", "Strategy")
 669    active = kwargs.get("active_returns", "False")
 670
 671    if isinstance(returns, _pd.DataFrame): 672        if len(returns.columns) > 1 and isinstance(strategy_title, str):
 673            strategy_title = list(returns.columns)
 674
Consider merging collapsible if statements
 517    strategy_title = kwargs.get("strategy_title", "Strategy")
 518    active = kwargs.get("active_returns", "False")
 519
 520    if isinstance(returns, _pd.DataFrame): 521        if len(returns.columns) > 1 and isinstance(strategy_title, str):
 522            strategy_title = list(returns.columns)
 523
Consider merging collapsible if statements
  86    returns = _utils._prepare_returns(returns)
  87
  88    strategy_title = kwargs.get("strategy_title", "Strategy")
  89    if isinstance(returns, _pd.DataFrame):  90        if len(returns.columns) > 1 and isinstance(strategy_title, str):
  91            strategy_title = list(returns.columns)
  92
Consider merging collapsible if statements
 678            color="gray",
 679        )
 680
 681    if hline is not None: 682        if not isinstance(hline, _pd.Series):
 683            if grayscale:
 684                hlcolor = "black"
Consider merging collapsible if statements
 345    # use a more precise date string for the x axis locations in the toolbar
 346    # ax.fmt_xdata = _mdates.DateFormatter('%Y-%m-%d')
 347
 348    if hline is not None: 349        if not isinstance(hline, _pd.Series):
 350            if grayscale:
 351                hlcolor = "black"
Consider merging collapsible if statements
 188    # rotate and align the tick labels so they look better
 189    fig.autofmt_xdate()
 190
 191    if hline is not None: 192        if not isinstance(hline, _pd.Series):
 193            if grayscale:
 194                hlcolor = "gray"