Skip to content

Commit 6b389f6

Browse files
committed
CI: Fix mypy issues after bokeh>=3.7dev0 typing changes
bokeh/bokeh#14289 (comment)
1 parent 2074135 commit 6b389f6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

backtesting/_plotting.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def plot(*, results: pd.Series,
219219
equity_data = equity_data.reset_index(drop=True)
220220
index = df.index
221221

222-
new_bokeh_figure = partial(
222+
new_bokeh_figure = partial( # type: ignore[call-arg]
223223
_figure,
224224
x_axis_type='linear',
225225
width=plot_width,
@@ -230,11 +230,11 @@ def plot(*, results: pd.Series,
230230

231231
pad = (index[-1] - index[0]) / 20
232232

233-
_kwargs = dict(x_range=Range1d(index[0], index[-1],
233+
_kwargs = dict(x_range=Range1d(index[0], index[-1], # type: ignore[call-arg]
234234
min_interval=10,
235235
bounds=(index[0] - pad,
236236
index[-1] + pad))) if index.size > 1 else {}
237-
fig_ohlc = new_bokeh_figure(**_kwargs)
237+
fig_ohlc = new_bokeh_figure(**_kwargs) # type: ignore[arg-type]
238238
figs_above_ohlc, figs_below_ohlc = [], []
239239

240240
source = ColumnDataSource(df)
@@ -255,7 +255,7 @@ def plot(*, results: pd.Series,
255255
trades_cmap = factor_cmap('returns_positive', colors_darker, ['0', '1'])
256256

257257
if is_datetime_index:
258-
fig_ohlc.xaxis.formatter = CustomJSTickFormatter(
258+
fig_ohlc.xaxis.formatter = CustomJSTickFormatter( # type: ignore[attr-defined]
259259
args=dict(axis=fig_ohlc.xaxis[0],
260260
formatter=DatetimeTickFormatter(days='%a, %d %b',
261261
months='%m/%Y'),
@@ -649,7 +649,7 @@ def __eq__(self, other):
649649
if plot_volume:
650650
custom_js_args.update(volume_range=fig_volume.y_range)
651651

652-
fig_ohlc.x_range.js_on_change('end', CustomJS(args=custom_js_args, # type: ignore
652+
fig_ohlc.x_range.js_on_change('end', CustomJS(args=custom_js_args,
653653
code=_AUTOSCALE_JS_CALLBACK))
654654

655655
plots = figs_above_ohlc + [fig_ohlc] + figs_below_ohlc
@@ -674,7 +674,7 @@ def __eq__(self, other):
674674

675675
f.add_tools(linked_crosshair)
676676
wheelzoom_tool = next(wz for wz in f.tools if isinstance(wz, WheelZoomTool))
677-
wheelzoom_tool.maintain_focus = False # type: ignore
677+
wheelzoom_tool.maintain_focus = False
678678

679679
kwargs = {}
680680
if plot_width is None:
@@ -720,7 +720,7 @@ def plot_heatmaps(heatmap: pd.Series, agg: Union[Callable, str], ncols: int,
720720
df[name1] = df[name1].astype('str')
721721
df[name2] = df[name2].astype('str')
722722

723-
fig = _figure(x_range=level1,
723+
fig = _figure(x_range=level1, # type: ignore[call-arg]
724724
y_range=level2,
725725
x_axis_label=name1,
726726
y_axis_label=name2,
@@ -730,10 +730,10 @@ def plot_heatmaps(heatmap: pd.Series, agg: Union[Callable, str], ncols: int,
730730
tooltips=[(name1, '@' + name1),
731731
(name2, '@' + name2),
732732
('Value', '@_Value{0.[000]}')])
733-
fig.grid.grid_line_color = None
734-
fig.axis.axis_line_color = None
735-
fig.axis.major_tick_line_color = None
736-
fig.axis.major_label_standoff = 0
733+
fig.grid.grid_line_color = None # type: ignore[attr-defined]
734+
fig.axis.axis_line_color = None # type: ignore[attr-defined]
735+
fig.axis.major_tick_line_color = None # type: ignore[attr-defined]
736+
fig.axis.major_label_standoff = 0 # type: ignore[attr-defined]
737737

738738
fig.rect(x=name1,
739739
y=name2,

backtesting/backtesting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def _format_name(name: str) -> str:
167167
raise ValueError(
168168
'Indicators must return (optionally a tuple of) numpy.arrays of same '
169169
f'length as `data` (data shape: {self._data.Close.shape}; indicator "{name}" '
170-
f'shape: {getattr(value, "shape" , "")}, returned value: {value})')
170+
f'shape: {getattr(value, "shape", "")}, returned value: {value})')
171171

172172
if plot and overlay is None and np.issubdtype(value.dtype, np.number):
173173
x = value / self._data.Close

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy