Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 373d3d8

Browse files
committed
Merge branch 'master' of https://github.com/plotly/plotly.py into bump_pjs_1330
2 parents 64e6e49 + 3b32a3d commit 373d3d8

File tree

19 files changed

+112
-119
lines changed

19 files changed

+112
-119
lines changed

plotly/colors.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def validate_colors(colors):
224224
colors_list = colors
225225

226226
# Validate colors in colors_list
227-
for each_color in colors_list:
227+
for j, each_color in enumerate(colors_list):
228228
if 'rgb' in each_color:
229229
each_color = color_parser(
230230
each_color, unlabel_rgb
@@ -401,10 +401,10 @@ def validate_scale_values(scale):
401401
)
402402

403403
if not all(x < y for x, y in zip(scale, scale[1:])):
404-
raise exceptions.PlotlyError(
405-
"'scale' must be a list that contains a strictly increasing "
406-
"sequence of numbers."
407-
)
404+
raise exceptions.PlotlyError(
405+
"'scale' must be a list that contains a strictly increasing "
406+
"sequence of numbers."
407+
)
408408

409409

410410
def make_colorscale(colors, scale=None):
@@ -553,7 +553,7 @@ def label_rgb(colors):
553553
"""
554554
Takes tuple (a, b, c) and returns an rgb color 'rgb(a, b, c)'
555555
"""
556-
return 'rgb(%s, %s, %s)' % (colors[0], colors[1], colors[2])
556+
return ('rgb(%s, %s, %s)' % (colors[0], colors[1], colors[2]))
557557

558558

559559
def unlabel_rgb(colors):

plotly/dashboard_objs/dashboard_objs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def _container(box_1=None, box_2=None, size=MASTER_HEIGHT,
6262
}
6363
return container
6464

65-
6665
dashboard_html = ("""
6766
<!DOCTYPE HTML>
6867
<html>
@@ -274,7 +273,7 @@ def _set_container_sizes(self):
274273
self['layout']['sizeUnit'] = 'px'
275274

276275
for path in all_paths:
277-
if path:
276+
if len(path) != 0:
278277
if self._path_to_box(path)['type'] == 'split':
279278
self._path_to_box(path)['size'] = 50
280279
self._path_to_box(path)['sizeUnit'] = '%'

plotly/figure_factory/_annotated_heatmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def get_text_color(self):
180180
max_col = map(int,
181181
self.colorscale[-1][1].strip('rgb()').split(','))
182182
elif '#' in self.colorscale[0][1]:
183-
min_col = utils.hex_to_rgb(self.colorscale[0][1])
184-
max_col = utils.hex_to_rgb(self.colorscale[-1][1])
183+
min_col = utils.hex_to_rgb(self.colorscale[0][1])
184+
max_col = utils.hex_to_rgb(self.colorscale[-1][1])
185185
else:
186186
min_col = [255, 255, 255]
187187
max_col = [255, 255, 255]

plotly/figure_factory/_dendrogram.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ def __init__(self, X, orientation='bottom', labels=None, colorscale=None,
124124
distfun = scs.distance.pdist
125125

126126
(dd_traces, xvals, yvals,
127-
ordered_labels, leaves) = self.get_dendrogram_traces(X, colorscale,
128-
distfun,
129-
linkagefun,
130-
hovertext)
127+
ordered_labels, leaves) = self.get_dendrogram_traces(X, colorscale,
128+
distfun,
129+
linkagefun,
130+
hovertext)
131131

132132
self.labels = ordered_labels
133133
self.leaves = leaves
@@ -193,14 +193,14 @@ def set_axis_layout(self, axis_key):
193193
194194
"""
195195
axis_defaults = {
196-
'type': 'linear',
197-
'ticks': 'outside',
198-
'mirror': 'allticks',
199-
'rangemode': 'tozero',
200-
'showticklabels': True,
201-
'zeroline': False,
202-
'showgrid': False,
203-
'showline': True,
196+
'type': 'linear',
197+
'ticks': 'outside',
198+
'mirror': 'allticks',
199+
'rangemode': 'tozero',
200+
'showticklabels': True,
201+
'zeroline': False,
202+
'showgrid': False,
203+
'showline': True,
204204
}
205205

206206
if len(self.labels) != 0:

plotly/figure_factory/_facet_grid.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ def _add_shapes_to_fig(fig, annot_rect_color, flipped_rows=False,
149149
for key in fig['layout'].keys():
150150
if 'axis' in key and fig['layout'][key]['domain'] != [0.0, 1.0]:
151151
shape = {
152-
'fillcolor': annot_rect_color,
153-
'layer': 'below',
154-
'line': {'color': annot_rect_color, 'width': 1},
155-
'type': 'rect',
156-
'xref': 'paper',
157-
'yref': 'paper'
152+
'fillcolor': annot_rect_color,
153+
'layer': 'below',
154+
'line': {'color': annot_rect_color, 'width': 1},
155+
'type': 'rect',
156+
'xref': 'paper',
157+
'yref': 'paper'
158158
}
159159

160160
if 'xaxis' in key:
@@ -1052,7 +1052,7 @@ def create_facet_grid(df, x=None, y=None, facet_row=None, facet_col=None,
10521052
min_ranges = []
10531053
max_ranges = []
10541054
for trace in fig['data']:
1055-
if trace[x_y] is not None and trace[x_y]:
1055+
if trace[x_y] is not None and len(trace[x_y]) > 0:
10561056
min_ranges.append(min(trace[x_y]))
10571057
max_ranges.append(max(trace[x_y]))
10581058
while None in min_ranges:

plotly/figure_factory/_scatterplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ def scatterplot(dataframe, headers, diag, size, height, width, title,
206206

207207

208208
def scatterplot_dict(dataframe, headers, diag, size,
209-
height, width, title, index, index_vals,
210-
endpts, colormap, colormap_type, **kwargs):
209+
height, width, title, index, index_vals,
210+
endpts, colormap, colormap_type, **kwargs):
211211
"""
212212
Refer to FigureFactory.create_scatterplotmatrix() for docstring
213213

plotly/figure_factory/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,10 @@ def validate_scale_values(scale):
421421
)
422422

423423
if not all(x < y for x, y in zip(scale, scale[1:])):
424-
raise exceptions.PlotlyError(
425-
"'scale' must be a list that contains a strictly increasing "
426-
"sequence of numbers."
427-
)
424+
raise exceptions.PlotlyError(
425+
"'scale' must be a list that contains a strictly increasing "
426+
"sequence of numbers."
427+
)
428428

429429

430430
def validate_colorscale(colorscale):

plotly/graph_objs/graph_objs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def get_ordered(self, **kwargs):
310310
def to_string(self, level=0, indent=4, eol='\n',
311311
pretty=True, max_chars=80):
312312
"""Get formatted string by calling `to_string` on children items."""
313-
if not self:
313+
if not len(self):
314314
return "{name}()".format(name=self._get_class_name())
315315
string = "{name}([{eol}{indent}".format(
316316
name=self._get_class_name(),
@@ -691,7 +691,7 @@ def to_string(self, level=0, indent=4, eol='\n',
691691
print(obj.to_string())
692692
693693
"""
694-
if not self:
694+
if not len(self):
695695
return "{name}()".format(name=self._get_class_name())
696696
string = "{name}(".format(name=self._get_class_name())
697697
if self._name in graph_reference.TRACE_NAMES:
@@ -759,7 +759,7 @@ def force_clean(self, **kwargs):
759759
except AttributeError:
760760
pass
761761
if isinstance(self[key], (dict, list)):
762-
if not self[key]:
762+
if len(self[key]) == 0:
763763
del self[key] # clears empty collections!
764764
elif self[key] is None:
765765
del self[key]

plotly/graph_reference.py

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -72,55 +72,55 @@ def get_graph_reference():
7272

7373
# TODO: Patch in frames info until it hits streambed. See #659
7474
graph_reference['frames'] = {
75-
"items": {
76-
"frames_entry": {
77-
"baseframe": {
78-
"description": "The name of the frame into which this "
79-
"frame's properties are merged before "
80-
"applying. This is used to unify "
81-
"properties and avoid needing to specify "
82-
"the same values for the same properties "
83-
"in multiple frames.",
84-
"role": "info",
85-
"valType": "string"
86-
},
87-
"data": {
88-
"description": "A list of traces this frame modifies. "
89-
"The format is identical to the normal "
90-
"trace definition.",
91-
"role": "object",
92-
"valType": "any"
93-
},
94-
"group": {
95-
"description": "An identifier that specifies the group "
96-
"to which the frame belongs, used by "
97-
"animate to select a subset of frames.",
98-
"role": "info",
99-
"valType": "string"
100-
},
101-
"layout": {
102-
"role": "object",
103-
"description": "Layout properties which this frame "
104-
"modifies. The format is identical to "
105-
"the normal layout definition.",
106-
"valType": "any"
107-
},
108-
"name": {
109-
"description": "A label by which to identify the frame",
110-
"role": "info",
111-
"valType": "string"
112-
},
113-
"role": "object",
114-
"traces": {
115-
"description": "A list of trace indices that identify "
116-
"the respective traces in the data "
117-
"attribute",
118-
"role": "info",
119-
"valType": "info_array"
120-
}
121-
}
122-
},
123-
"role": "object"
75+
"items": {
76+
"frames_entry": {
77+
"baseframe": {
78+
"description": "The name of the frame into which this "
79+
"frame's properties are merged before "
80+
"applying. This is used to unify "
81+
"properties and avoid needing to specify "
82+
"the same values for the same properties "
83+
"in multiple frames.",
84+
"role": "info",
85+
"valType": "string"
86+
},
87+
"data": {
88+
"description": "A list of traces this frame modifies. "
89+
"The format is identical to the normal "
90+
"trace definition.",
91+
"role": "object",
92+
"valType": "any"
93+
},
94+
"group": {
95+
"description": "An identifier that specifies the group "
96+
"to which the frame belongs, used by "
97+
"animate to select a subset of frames.",
98+
"role": "info",
99+
"valType": "string"
100+
},
101+
"layout": {
102+
"role": "object",
103+
"description": "Layout properties which this frame "
104+
"modifies. The format is identical to "
105+
"the normal layout definition.",
106+
"valType": "any"
107+
},
108+
"name": {
109+
"description": "A label by which to identify the frame",
110+
"role": "info",
111+
"valType": "string"
112+
},
113+
"role": "object",
114+
"traces": {
115+
"description": "A list of trace indices that identify "
116+
"the respective traces in the data "
117+
"attribute",
118+
"role": "info",
119+
"valType": "info_array"
120+
}
121+
}
122+
},
123+
"role": "object"
124124
}
125125

126126
return graph_reference
@@ -223,7 +223,7 @@ def get_attributes_dicts(object_name, parent_object_names=()):
223223
# We return a dict mapping paths to attributes. We also add in additional
224224
# attributes if defined.
225225
attributes_dicts = {path: utils.get_by_path(GRAPH_REFERENCE, path)
226-
for path in attribute_paths}
226+
for path in attribute_paths}
227227
attributes_dicts['additional_attributes'] = additional_attributes
228228

229229
return attributes_dicts

plotly/grid_objs/grid_objs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __init__(self, columns_or_json, fid=None):
207207
ordered_columns.append(Column(
208208
columns_or_json['cols'][column_name]['data'],
209209
column_name)
210-
)
210+
)
211211
self._columns = ordered_columns
212212

213213
# fill in column_ids

plotly/matplotlylib/mpltools.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ def convert_path_array(path_array):
292292
else:
293293
return symbols
294294

295-
296295
def convert_linewidth_array(width_array):
297296
if len(width_array) == 1:
298297
return width_array[0]
@@ -309,7 +308,7 @@ def convert_size_array(size_array):
309308

310309

311310
def get_markerstyle_from_collection(props):
312-
markerstyle = dict(
311+
markerstyle=dict(
313312
alpha=None,
314313
facecolor=convert_rgba_array(props['styles']['facecolor']),
315314
marker=convert_path_array(props['paths']),
@@ -340,7 +339,6 @@ def get_rect_ymax(data):
340339
"""Find maximum y value from four (x,y) vertices."""
341340
return max(data[0][1], data[1][1], data[2][1], data[3][1])
342341

343-
344342
def get_spine_visible(ax, spine_key):
345343
"""Return some spine parameters for the spine, `spine_key`."""
346344
spine = ax.spines[spine_key]
@@ -395,7 +393,6 @@ def make_bar(**props):
395393
'zorder': props['style']['zorder']
396394
}
397395

398-
399396
def prep_ticks(ax, index, ax_type, props):
400397
"""Prepare axis obj belonging to axes obj.
401398
@@ -447,10 +444,10 @@ def prep_ticks(ax, index, ax_type, props):
447444
if base == 10:
448445
if ax_type == 'x':
449446
axis_dict['range'] = [math.log10(props['xlim'][0]),
450-
math.log10(props['xlim'][1])]
447+
math.log10(props['xlim'][1])]
451448
elif ax_type == 'y':
452449
axis_dict['range'] = [math.log10(props['ylim'][0]),
453-
math.log10(props['ylim'][1])]
450+
math.log10(props['ylim'][1])]
454451
else:
455452
axis_dict = dict(range=None, type='linear')
456453
warnings.warn("Converted non-base10 {0}-axis log scale to 'linear'"

0 commit comments

Comments
 (0)