') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Retry requests for Python API by Kully · Pull Request #964 · plotly/plotly.py · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions optional-requirements.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ scipy
jupyter
ipykernel

## deps for _county_choropleth.py figure factory
## deps for _county_choropleth.py figure factory ##
pyshp
geopandas
shapely
shapely
3 changes: 3 additions & 0 deletions plotly/api/v2/utils.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,7 @@
import requests
from requests.compat import json as _json
from requests.exceptions import RequestException
from retrying import retry

from plotly import config, exceptions, version, utils
from plotly.api.utils import basic_auth
Expand DownExpand Up@@ -111,6 +112,8 @@ def get_headers():
return headers


@retry(wait_random_min=100, wait_random_max=1000, wait_exponential_max=10000,
stop_max_delay=30000)
def request(method, url, **kwargs):
"""
Central place to make any api v2 api request.
Expand Down
80 changes: 40 additions & 40 deletions plotly/graph_objs/graph_objs.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -873,15 +873,16 @@ class Bar(PlotlyDict):
"""
Valid attributes for 'bar' at path [] under parents ():

['bardir', 'base', 'basesrc', 'constraintext', 'customdata',
'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo',
'hoverinfosrc', 'hoverlabel', 'hovertext', 'hovertextsrc', 'ids',
'idssrc', 'insidetextfont', 'legendgroup', 'marker', 'name', 'offset',
'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'r', 'rsrc',
'selected', 'selectedpoints', 'showlegend', 'stream', 't', 'text',
'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'tsrc',
'type', 'uid', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0',
'xaxis', 'xcalendar', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'ysrc']
['bardir', 'base', 'basesrc', 'cliponaxis', 'constraintext',
'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y',
'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertext', 'hovertextsrc',
'ids', 'idssrc', 'insidetextfont', 'legendgroup', 'marker', 'name',
'offset', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont',
'r', 'rsrc', 'selected', 'selectedpoints', 'showlegend', 'stream', 't',
'text', 'textfont', 'textposition', 'textpositionsrc', 'textsrc',
'tsrc', 'type', 'uid', 'unselected', 'visible', 'width', 'widthsrc',
'x', 'x0', 'xaxis', 'xcalendar', 'xsrc', 'y', 'y0', 'yaxis',
'ycalendar', 'ysrc']

Run `<bar-object>.help('attribute')` on any of the above.
'<bar-object>' is the object at []
Expand DownExpand Up@@ -1132,9 +1133,8 @@ class ErrorY(PlotlyDict):
Valid attributes for 'error_y' at path [] under parents ():

['array', 'arrayminus', 'arrayminussrc', 'arraysrc', 'color',
'copy_ystyle', 'copy_zstyle', 'opacity', 'symmetric', 'thickness',
'traceref', 'tracerefminus', 'type', 'value', 'valueminus', 'visible',
'width']
'copy_zstyle', 'opacity', 'symmetric', 'thickness', 'traceref',
'tracerefminus', 'type', 'value', 'valueminus', 'visible', 'width']

Run `<error_y-object>.help('attribute')` on any of the above.
'<error_y-object>' is the object at []
Expand All@@ -1148,9 +1148,8 @@ class ErrorZ(PlotlyDict):
Valid attributes for 'error_z' at path [] under parents ():

['array', 'arrayminus', 'arrayminussrc', 'arraysrc', 'color',
'copy_ystyle', 'copy_zstyle', 'opacity', 'symmetric', 'thickness',
'traceref', 'tracerefminus', 'type', 'value', 'valueminus', 'visible',
'width']
'opacity', 'symmetric', 'thickness', 'traceref', 'tracerefminus',
'type', 'value', 'valueminus', 'visible', 'width']

Run `<error_z-object>.help('attribute')` on any of the above.
'<error_z-object>' is the object at []
Expand DownExpand Up@@ -1459,7 +1458,7 @@ class Layout(PlotlyDict):
['angularaxis', 'annotations', 'autosize', 'bargap', 'bargroupgap',
'barmode', 'barnorm', 'boxgap', 'boxgroupgap', 'boxmode', 'calendar',
'colorway', 'datarevision', 'direction', 'dragmode', 'font', 'geo',
'height', 'hiddenlabels', 'hiddenlabelssrc', 'hidesources',
'grid', 'height', 'hiddenlabels', 'hiddenlabelssrc', 'hidesources',
'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend',
'mapbox', 'margin', 'orientation', 'paper_bgcolor', 'plot_bgcolor',
'polar', 'radialaxis', 'scene', 'separators', 'shapes', 'showlegend',
Expand DownExpand Up@@ -1934,18 +1933,19 @@ class XAxis(PlotlyDict):
"""
Valid attributes for 'xaxis' at path [] under parents ():

['anchor', 'autorange', 'autotick', 'backgroundcolor', 'calendar',
'categoryarray', 'categoryarraysrc', 'categoryorder', 'color',
'constrain', 'constraintoward', 'domain', 'dtick', 'exponentformat',
'fixedrange', 'gridcolor', 'gridwidth', 'hoverformat', 'layer',
'linecolor', 'linewidth', 'mirror', 'nticks', 'overlaying', 'position',
'range', 'rangemode', 'rangeselector', 'rangeslider', 'scaleanchor',
'scaleratio', 'separatethousands', 'showaxeslabels', 'showbackground',
'showexponent', 'showgrid', 'showline', 'showspikes', 'showticklabels',
'showtickprefix', 'showticksuffix', 'side', 'spikecolor', 'spikedash',
'spikemode', 'spikesides', 'spikesnap', 'spikethickness', 'tick0',
'tickangle', 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops',
'ticklen', 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
['anchor', 'automargin', 'autorange', 'autotick', 'backgroundcolor',
'calendar', 'categoryarray', 'categoryarraysrc', 'categoryorder',
'color', 'constrain', 'constraintoward', 'domain', 'dtick',
'exponentformat', 'fixedrange', 'gridcolor', 'gridwidth',
'hoverformat', 'layer', 'linecolor', 'linewidth', 'mirror', 'nticks',
'overlaying', 'position', 'range', 'rangemode', 'rangeselector',
'rangeslider', 'scaleanchor', 'scaleratio', 'separatethousands',
'showaxeslabels', 'showbackground', 'showexponent', 'showgrid',
'showline', 'showspikes', 'showticklabels', 'showtickprefix',
'showticksuffix', 'side', 'spikecolor', 'spikedash', 'spikemode',
'spikesides', 'spikesnap', 'spikethickness', 'tick0', 'tickangle',
'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', 'ticklen',
'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
'ticktextsrc', 'tickvals', 'tickvalssrc', 'tickwidth', 'title',
'titlefont', 'type', 'visible', 'zeroline', 'zerolinecolor',
'zerolinewidth']
Expand DownExpand Up@@ -1974,18 +1974,18 @@ class YAxis(PlotlyDict):
"""
Valid attributes for 'yaxis' at path [] under parents ():

['anchor', 'autorange', 'autotick', 'backgroundcolor', 'calendar',
'categoryarray', 'categoryarraysrc', 'categoryorder', 'color',
'constrain', 'constraintoward', 'domain', 'dtick', 'exponentformat',
'fixedrange', 'gridcolor', 'gridwidth', 'hoverformat', 'layer',
'linecolor', 'linewidth', 'mirror', 'nticks', 'overlaying', 'position',
'range', 'rangemode', 'scaleanchor', 'scaleratio', 'separatethousands',
'showaxeslabels', 'showbackground', 'showexponent', 'showgrid',
'showline', 'showspikes', 'showticklabels', 'showtickprefix',
'showticksuffix', 'side', 'spikecolor', 'spikedash', 'spikemode',
'spikesides', 'spikesnap', 'spikethickness', 'tick0', 'tickangle',
'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', 'ticklen',
'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
['anchor', 'automargin', 'autorange', 'autotick', 'backgroundcolor',
'calendar', 'categoryarray', 'categoryarraysrc', 'categoryorder',
'color', 'constrain', 'constraintoward', 'domain', 'dtick',
'exponentformat', 'fixedrange', 'gridcolor', 'gridwidth',
'hoverformat', 'layer', 'linecolor', 'linewidth', 'mirror', 'nticks',
'overlaying', 'position', 'range', 'rangemode', 'scaleanchor',
'scaleratio', 'separatethousands', 'showaxeslabels', 'showbackground',
'showexponent', 'showgrid', 'showline', 'showspikes', 'showticklabels',
'showtickprefix', 'showticksuffix', 'side', 'spikecolor', 'spikedash',
'spikemode', 'spikesides', 'spikesnap', 'spikethickness', 'tick0',
'tickangle', 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops',
'ticklen', 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
'ticktextsrc', 'tickvals', 'tickvalssrc', 'tickwidth', 'title',
'titlefont', 'type', 'visible', 'zeroline', 'zerolinecolor',
'zerolinewidth']
Expand Down
Loading