Private
Public Access
1
0

start py39

This commit is contained in:
Sander Roosendaal
2023-06-02 17:55:06 +02:00
parent 0d205bf8b4
commit 6ae85c26e7
5 changed files with 58 additions and 56 deletions

View File

@@ -70,7 +70,8 @@ from bokeh.palettes import Dark2_8 as palette
from bokeh.palettes import Set1_4 as palette2
from bokeh.models.glyphs import MultiLine
import itertools
from bokeh.plotting import figure, ColumnDataSource, Figure, curdoc
from bokeh.plotting import figure, ColumnDataSource, curdoc
from bokeh.models import CustomJS, Slider, TextInput, BoxAnnotation, Band
import arrow
@@ -250,7 +251,7 @@ def interactive_hr_piechart(df, rower, title, totalseconds=0):
TOOLS = 'save,hover'
z = figure(title="HR "+title, x_range=(-0.5, 1), plot_height=375,
z = figure(title="HR "+title, x_range=(-0.5, 1), height=375,
tools=TOOLS, toolbar_location=None, tooltips="@zone: @totaltime",
)
@@ -314,7 +315,7 @@ def interactive_workouttype_piechart(workouts):
except KeyError: # pragma: no cover
pass
p = figure(plot_height=350, title="Types", toolbar_location=None,
p = figure(height=350, title="Types", toolbar_location=None,
tools="hover,save", tooltips="@type: @totaltime", x_range=(-0.5, 1.0))
p.wedge(x=0, y=1, radius=0.4,
@@ -386,8 +387,8 @@ def interactive_boxchart(datadf, fieldname, extratitle='',
plot.xaxis.major_label_orientation = pi/4
plot.plot_width = 920
plot.plot_height = 600
plot.width = 920
plot.height = 600
slidertext = 'SPM: {:.0f}-{:.0f}, WpS: {:.0f}-{:.0f}'.format(
spmmin, spmmax, workmin, workmax
@@ -426,8 +427,8 @@ def interactive_planchart(data, startdate, enddate):
p = hv.render(bars)
p.plot_width = 550
p.plot_height = 350
p.width = 550
p.height = 350
p.y_range = yrange1
p.toolbar_location = 'above'
p.sizing_mode = 'stretch_both'
@@ -592,8 +593,8 @@ def interactive_activitychart(workouts, startdate, enddate, stack='type', toolba
d2=enddate.strftime("%Y-%m-%d"),
)
p.plot_width = 550
p.plot_height = 350
p.width = 550
p.height = 350
p.toolbar_location = toolbar_location
p.y_range.start = 0
p.sizing_mode = 'stretch_both'
@@ -793,8 +794,8 @@ def interactive_activitychart2(workouts, startdate, enddate, stack='type', toolb
else: # pragma: no cover
p.yaxis.axis_label = 'rScore'
p.plot_width = 550
p.plot_height = 350
p.width = 550
p.height = 350
p.toolbar_location = toolbar_location
p.sizing_mode = 'stretch_both'
p.y_range.start = 0
@@ -1089,8 +1090,8 @@ def interactive_forcecurve(theworkouts, workstrokesonly=True, plottype='scatter'
)
)
plot = Figure(tools=TOOLS,
toolbar_sticky=False, toolbar_location="above", plot_width=800, plot_height=600)
plot = figure(tools=TOOLS,
toolbar_sticky=False, toolbar_location="above", width=800, height=600)
plot.sizing_mode = 'stretch_both'
# add watermark
@@ -1683,8 +1684,8 @@ def goldmedalscorechart(user, startdate=None, enddate=None):
)
)
plot = Figure(tools=TOOLS, x_axis_type='datetime',
plot_width=900, plot_height=600,
plot = figure(tools=TOOLS, x_axis_type='datetime',
width=900, height=600,
toolbar_location='above',
toolbar_sticky=False)
@@ -1869,8 +1870,8 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
)
)
plot = Figure(tools=TOOLS, x_axis_type='datetime',
plot_width=900, plot_height=300,
plot = figure(tools=TOOLS, x_axis_type='datetime',
width=900, height=300,
toolbar_location="above",
toolbar_sticky=False)
@@ -1996,8 +1997,8 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
('Test', '@testduration'),
])
plot2 = Figure(tools=TOOLS2, x_axis_type='datetime',
plot_width=900, plot_height=150,
plot2 = figure(tools=TOOLS2, x_axis_type='datetime',
width=900, height=150,
toolbar_location=None,
toolbar_sticky=False)
@@ -2074,7 +2075,7 @@ def interactive_histoall(theworkouts, histoparam, includereststrokes,
histopwr = histopwr[histopwr > yaxminima[histoparam]]
histopwr = histopwr[histopwr < yaxmaxima[histoparam]]
plot = Figure(tools=TOOLS, plot_width=900,
plot = figure(tools=TOOLS, width=900,
toolbar_sticky=False,
toolbar_location="above"
)
@@ -3415,7 +3416,7 @@ def interactive_agegroupcpchart(age, normalized=False):
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(plot_width=900, x_axis_type=x_axis_type,
plot = figure(width=900, x_axis_type=x_axis_type,
tools=TOOLS)
plot.sizing_mode = 'stretch_both'
@@ -3550,8 +3551,8 @@ def interactive_otwcpchart(powerdf, promember=0, rowername="", r=None, cpfit='da
)
# making the plot
plot = Figure(tools=TOOLS, x_axis_type=x_axis_type,
plot_width=900,
plot = figure(tools=TOOLS, x_axis_type=x_axis_type,
width=900,
toolbar_location="above",
toolbar_sticky=False)
@@ -3694,7 +3695,7 @@ def interactive_agegroup_plot(df, distance=2000, duration=None,
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(tools=TOOLS, plot_width=900)
plot = figure(tools=TOOLS, width=900)
plot.sizing_mode = 'stretch_both'
plot.circle('age', 'power', source=source, fill_color='red', size=15,
legend_label='World Record')
@@ -3878,8 +3879,8 @@ def interactive_cpchart(rower, thedistances, thesecs, theavpower,
)
# making the plot
plot = Figure(tools=TOOLS, x_axis_type=x_axis_type,
plot_width=900,
plot = figure(tools=TOOLS, x_axis_type=x_axis_type,
width=900,
toolbar_location="above",
toolbar_sticky=False)
@@ -4007,7 +4008,7 @@ def interactive_windchart(id=0, promember=0):
f1 = row.csvfilename
# create interactive plot
plot = Figure(plot_width=400, plot_height=300)
plot = figure(width=400, height=300)
# get user
# u = User.objects.get(id=row.user.id)
@@ -4060,7 +4061,7 @@ def interactive_windchart(id=0, promember=0):
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
# making the plot
plot = Figure(tools=TOOLS, plot_width=400, height=500,
plot = figure(tools=TOOLS, width=400, height=500,
# toolbar_location="below",
toolbar_sticky=False,
)
@@ -4095,7 +4096,7 @@ def interactive_streamchart(id=0, promember=0):
f1 = row.csvfilename
# create interactive plot
plot = Figure(plot_width=400,
plot = figure(width=400,
)
# get user
# u = User.objects.get(id=row.user.id)
@@ -4129,7 +4130,7 @@ def interactive_streamchart(id=0, promember=0):
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
# making the plot
plot = Figure(tools=TOOLS, plot_width=400, height=500,
plot = figure(tools=TOOLS, width=400, height=500,
# toolbar_location="below",
toolbar_sticky=False,
)
@@ -4199,7 +4200,7 @@ def forcecurve_multi_interactive_chart(selected):
)
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,crosshair'
plot = Figure(plot_width=920,tools=TOOLS,
plot = figure(width=920,tools=TOOLS,
toolbar_location='above',
toolbar_sticky=False)
@@ -4301,7 +4302,7 @@ def instroke_multi_interactive_chart(selected, *args, **kwargs):
)
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,crosshair'
plot = Figure(plot_width=920,tools=TOOLS,
plot = figure(width=920,tools=TOOLS,
toolbar_location='above',
toolbar_sticky=False)
@@ -4399,7 +4400,7 @@ def instroke_interactive_chart(df,metric, workout, spm_min, spm_max,
pass
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,crosshair'
plot = Figure(plot_width=920,tools=TOOLS,
plot = figure(width=920,tools=TOOLS,
toolbar_location='above',
toolbar_sticky=False)
@@ -4561,9 +4562,9 @@ def interactive_chart(id=0, promember=0, intervaldata={}):
datadf
)
plot = Figure(x_axis_type="datetime", y_axis_type="datetime",
plot_width=400,
plot_height=400,
plot = figure(x_axis_type="datetime", y_axis_type="datetime",
width=400,
height=400,
toolbar_sticky=False,
tools=TOOLS)
@@ -4870,10 +4871,10 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='',
TOOLS = [SaveTool(), PanTool(), BoxZoomTool(), WheelZoomTool(),
ResetTool(), TapTool(), hover]
plot = Figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
plot = figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
tools=TOOLS,
toolbar_location="above",
toolbar_sticky=False, plot_width=920)
toolbar_sticky=False, width=920)
# add watermark
watermarkurl = "/static/img/logo7.png"
@@ -5107,7 +5108,7 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
else: # pragma: no cover
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,crosshair'
plot = Figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
plot = figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
tools=TOOLS,
toolbar_location="above",
toolbar_sticky=False)
@@ -5523,13 +5524,13 @@ def interactive_flexchart_stacked(id, r, xparam='time',
TOOLS = 'box_zoom,wheel_zoom,reset,tap,hover'
TOOLS2 = 'box_zoom,hover'
plot1 = Figure(x_axis_type=x_axis_type, y_axis_type=y1_axis_type, plot_width=920, plot_height=150,
plot1 = figure(x_axis_type=x_axis_type, y_axis_type=y1_axis_type, width=920, height=150,
tools=TOOLS, toolbar_location='above')
plot2 = Figure(x_axis_type=x_axis_type, y_axis_type=y2_axis_type, plot_width=920, plot_height=150,
plot2 = figure(x_axis_type=x_axis_type, y_axis_type=y2_axis_type, width=920, height=150,
tools=TOOLS2, toolbar_location=None)
plot3 = Figure(x_axis_type=x_axis_type, y_axis_type=y3_axis_type, plot_width=920, plot_height=150,
plot3 = figure(x_axis_type=x_axis_type, y_axis_type=y3_axis_type, width=920, height=150,
tools=TOOLS2, toolbar_location=None)
plot4 = Figure(x_axis_type=x_axis_type, y_axis_type=y4_axis_type, plot_width=920, plot_height=150,
plot4 = figure(x_axis_type=x_axis_type, y_axis_type=y4_axis_type, width=920, height=150,
tools=TOOLS2, toolbar_location=None)
plot1.xaxis.visible = False
@@ -5939,9 +5940,9 @@ def interactive_flex_chart2(id, r, promember=0,
else:
TOOLS = 'pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
plot = figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
tools=TOOLS, toolbar_location='above',
toolbar_sticky=False, plot_width=800, plot_height=600,
toolbar_sticky=False, width=800, height=600,
)
plot.sizing_mode = 'stretch_both'
@@ -6475,8 +6476,8 @@ def thumbnail_flex_chart(rowdata, id=0, promember=0,
rowdata
)
plot = Figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
plot_width=200, plot_height=150,
plot = figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
width=200, height=150,
)
@@ -6639,10 +6640,10 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
if xparam == 'time':
x_axis_type = 'datetime'
plot = Figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
plot = figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
tools=TOOLS,
toolbar_location="above",
plot_width=920, plot_height=500,
width=920, height=500,
toolbar_sticky=False)
# add watermark
@@ -6820,9 +6821,9 @@ def interactive_otw_advanced_pace_chart(id=0, promember=0):
rowdata
)
plot = Figure(x_axis_type="datetime", y_axis_type="datetime",
plot = figure(x_axis_type="datetime", y_axis_type="datetime",
tools=TOOLS,
plot_width=920,
width=920,
toolbar_sticky=False)
# add watermark
@@ -7221,8 +7222,8 @@ def interactive_zoneschart(rower, data, startdate, enddate, trainingzones='hr',
if yaxis == 'percentage':
p.yaxis.axis_label = 'Percentage'
p.plot_width = 550
p.plot_height = 350
p.width = 550
p.height = 350
p.toolbar_location = 'right'
p.y_range.start = 0
p.sizing_mode = 'stretch_both'

View File

@@ -727,7 +727,8 @@ def handle_sporttracks_sync(workoutid, url, headers, data, debug=False, **kwargs
@app.task
def handle_strava_sync(stravatoken, workoutid, filename, name, activity_type, description, debug=False, **kwargs):
def handle_strava_sync(stravatoken,
workoutid, filename, name, activity_type, description, debug=False, **kwargs):
client = stravalib.Client(access_token=stravatoken)
failed = False
try:
@@ -735,7 +736,7 @@ def handle_strava_sync(stravatoken, workoutid, filename, name, activity_type, de
try:
act = client.upload_activity(f, 'tcx.gz', name=name)
try:
res = act.wait(poll_interval=1.0, timeout=10)
res = act.wait(poll_interval=1.0, timeout=30)
except stravalib.exc.ActivityUploadFailed: # pragma: no cover
dologging('strava_fail.log', 'Strava upload failed for Workout {id} ActivityUploadFailed'.format(
id=workoutid))

View File

@@ -15,7 +15,6 @@ except NameError:
import pytest
from pandas.core.common import SettingWithCopyWarning
from rowers.courses import howfaris
import warnings

Binary file not shown.