Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4a1a814

Browse files
committed
fix: corrections based on code review from @emilykl
- Run `ruff format --check .` instead of `ruff format .` in Circle CI. - Use `base_type is list` instead of `base_type == list`. - Remove commented-out lines of code. - Remove unnecessary parentheses around some strings. - Be more consistent about (re-)naming test functions that had duplicated names. - Use `noqa: F401` to suppress `ruff check` complaint about unused import.
1 parent eb95abc commit 4a1a814

File tree

8 files changed

+12
-19
lines changed

8 files changed

+12
-19
lines changed

‎.circleci/config.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
name: Check handwritten code with ruff
157157
command: |
158158
source .venv/bin/activate
159-
ruff format .
159+
ruff format --check .
160160
161161
test_core_py:
162162
parameters:

‎codegen/compatibility.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def build_deprecation_message(class_name, base_type, new):
136136

137137
replacemens_str = "\n - ".join(replacements)
138138

139-
if isinstance(base_type, list):
139+
if base_typeislist:
140140
return f"""\
141141
plotly.graph_objs.{class_name} is deprecated.
142142
Please replace it with a list or tuple of instances of the following types

‎plotly/figure_factory/_ternary_contour.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@ def _compute_grid(coordinates, values, interp_mode="ilr"):
219219
grid_z = scipy_interp.griddata(
220220
coord_points[:2].T, values, (grid_x, grid_y), method="cubic"
221221
)
222-
# grid_z_other = scipy_interp.griddata(
223-
# coord_points[:2].T, values, (grid_x, grid_y), method="nearest"
224-
# )
225-
# mask_nan = np.isnan(grid_z)
226-
# grid_z[mask_nan] = grid_z_other[mask_nan]
227222
return grid_z, gr_x, gr_y
228223

229224

@@ -439,7 +434,7 @@ def _contour_trace(
439434
else:
440435
colors = [linecolor] * ncontours
441436

442-
# Retrieve all contours
437+
# Retrieve all contours
443438
all_contours, all_values, all_areas, all_colors = _extract_contours(
444439
z, values, colors
445440
)

‎plotly/io/_orca.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def mathjax(self):
604604
"""
605605
return self._props.get(
606606
"mathjax",
607-
("https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"),
607+
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js",
608608
)
609609

610610
@mathjax.setter

‎tests/test_core/test_graph_objs/test_figure_properties.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@ def test_property_assignment_dots(self):
8080
self.figure["frames[0].layout.yaxis.title.text"] = "f2"
8181
self.assertEqual(self.figure["frames.0.layout.yaxis.title.text"], "f2")
8282

83-
def test_access_invalid_attr_1(self):
83+
def test_access_invalid_attr(self):
8484
with pytest.raises(AttributeError):
8585
self.figure.bogus
8686

87-
def test_access_invalid_item_1(self):
87+
def test_access_invalid_item(self):
8888
with pytest.raises(KeyError):
8989
self.figure["bogus"]
9090

91-
def test_assign_invalid_attr_2(self):
91+
def test_assign_invalid_attr(self):
9292
with pytest.raises(AttributeError):
9393
self.figure.bogus = "val"
9494

95-
def test_access_invalid_item_2(self):
95+
def test_assign_invalid_item(self):
9696
with pytest.raises(KeyError):
9797
self.figure["bogus"] = "val"
9898

‎tests/test_core/test_offline/test_offline.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def test_including_plotlyjs_directory_div(self):
239239

240240
def test_including_plotlyjs_path_html(self):
241241
for include_plotlyjs in [
242-
("https://cdnjs.cloudflare.com/ajax/libs/plotly.js/1.40.1/plotly.min.js"),
242+
"https://cdnjs.cloudflare.com/ajax/libs/plotly.js/1.40.1/plotly.min.js",
243243
"subpath/to/plotly.min.js",
244244
"something.js",
245245
]:
@@ -259,7 +259,7 @@ def test_including_plotlyjs_path_html(self):
259259

260260
def test_including_plotlyjs_path_div(self):
261261
for include_plotlyjs in [
262-
("https://cdnjs.cloudflare.com/ajax/libs/plotly.js/1.40.1/plotly.min.js"),
262+
"https://cdnjs.cloudflare.com/ajax/libs/plotly.js/1.40.1/plotly.min.js",
263263
"subpath/to/plotly.min.js",
264264
"something.js",
265265
]:

‎tests/test_io/test_renderers.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,7 @@ def webbrowser_absent_import(name, globals, locals, fromlist, level):
386386
with mock.patch("builtins.__import__", webbrowser_absent_import):
387387
# 1: check whether importing webbrowser actually results in an ImportError
388388
with pytest.raises(ImportError):
389-
import webbrowser as wb
390-
391-
assert wb
389+
import webbrowser # noqa: F401
392390

393391
# 2: check whether the _repr_html_ can handle it regardless
394392
fig1._repr_html_()

‎tests/test_plotly_utils/validators/test_string_validator.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_rejection_values(val, validator_values):
8585
with pytest.raises(ValueError) as validation_failure:
8686
validator_values.validate_coerce(val)
8787

88-
assert "Invalid value".format() in str(validation_failure.value)
88+
assert "Invalid value" in str(validation_failure.value)
8989
assert "['foo', 'BAR', '']" in str(validation_failure.value)
9090

9191

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /