Skip to content

Commit c86cba6

Browse files
committed
attempt to copy prettier from spatialdata
1 parent 5871bd2 commit c86cba6

File tree

5 files changed

+11
-25
lines changed

5 files changed

+11
-25
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,19 @@ minimum_pre_commit_version: 2.16.0
88
ci:
99
skip: []
1010
repos:
11-
- repo: https://github.com/psf/black
12-
rev: 24.10.0
13-
hooks:
14-
- id: black
1511
- repo: https://github.com/rbubley/mirrors-prettier
1612
rev: v3.5.1
1713
hooks:
1814
- id: prettier
19-
- repo: https://github.com/asottile/blacken-docs
20-
rev: 1.19.1
21-
hooks:
22-
- id: blacken-docs
2315
- repo: https://github.com/pre-commit/mirrors-mypy
24-
rev: v1.14.1
16+
rev: v1.15.0
2517
hooks:
2618
- id: mypy
2719
additional_dependencies: [numpy, types-requests]
2820
exclude: tests/|docs/
2921
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.9.3
22+
rev: v0.9.6
3123
hooks:
3224
- id: ruff
3325
args: [--fix, --exit-non-zero-on-fix]
26+
- id: ruff-format

docs/extensions/typed_returns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def _process_return(lines: Iterable[str]) -> Generator[str, None, None]:
1313
for line in lines:
1414
if m := re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line):
15-
yield f'-{m["param"]} (:class:`~{m["type"]}`)'
15+
yield f"-{m['param']} (:class:`~{m['type']}`)"
1616
else:
1717
yield line
1818

src/spatialdata_plot/pl/basic.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def render_shapes(
290290
norm=norm,
291291
na_color=params_dict[element]["na_color"], # type: ignore[arg-type]
292292
)
293-
sdata.plotting_tree[f"{n_steps+1}_render_shapes"] = ShapesRenderParams(
293+
sdata.plotting_tree[f"{n_steps + 1}_render_shapes"] = ShapesRenderParams(
294294
element=element,
295295
color=param_values["color"],
296296
col_for_color=param_values["col_for_color"],
@@ -433,7 +433,7 @@ def render_points(
433433
norm=norm,
434434
na_color=param_values["na_color"], # type: ignore[arg-type]
435435
)
436-
sdata.plotting_tree[f"{n_steps+1}_render_points"] = PointsRenderParams(
436+
sdata.plotting_tree[f"{n_steps + 1}_render_points"] = PointsRenderParams(
437437
element=element,
438438
color=param_values["color"],
439439
col_for_color=param_values["col_for_color"],
@@ -538,7 +538,6 @@ def render_images(
538538
n_steps = len(sdata.plotting_tree.keys())
539539

540540
for element, param_values in params_dict.items():
541-
542541
cmap_params: list[CmapParams] | CmapParams
543542
if isinstance(cmap, list):
544543
cmap_params = [
@@ -557,7 +556,7 @@ def render_images(
557556
na_color=param_values["na_color"],
558557
**kwargs,
559558
)
560-
sdata.plotting_tree[f"{n_steps+1}_render_images"] = ImageRenderParams(
559+
sdata.plotting_tree[f"{n_steps + 1}_render_images"] = ImageRenderParams(
561560
element=element,
562561
channel=param_values["channel"],
563562
cmap_params=cmap_params,
@@ -683,7 +682,7 @@ def render_labels(
683682
norm=norm,
684683
na_color=param_values["na_color"], # type: ignore[arg-type]
685684
)
686-
sdata.plotting_tree[f"{n_steps+1}_render_labels"] = LabelsRenderParams(
685+
sdata.plotting_tree[f"{n_steps + 1}_render_labels"] = LabelsRenderParams(
687686
element=element,
688687
color=param_values["color"],
689688
groups=param_values["groups"],

src/spatialdata_plot/pl/render.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ def _render_images(
730730
legend_params: LegendParams,
731731
rasterize: bool,
732732
) -> None:
733-
734733
sdata_filt = sdata.filter_by_coordinate_system(
735734
coordinate_system=coordinate_system,
736735
filter_tables=False,

src/spatialdata_plot/pl/utils.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ def _get_centroid_of_pathpatch(pathpatch: mpatches.PathPatch) -> tuple[float, fl
305305

306306

307307
def _scale_pathpatch_around_centroid(pathpatch: mpatches.PathPatch, scale_factor: float) -> None:
308-
309308
centroid = _get_centroid_of_pathpatch(pathpatch)
310309
vertices = pathpatch.get_path().vertices
311310
scaled_vertices = np.array([centroid + (vertex - centroid) * scale_factor for vertex in vertices])
@@ -677,7 +676,7 @@ def _get_colors_for_categorical_obs(
677676
palette = default_102
678677
else:
679678
palette = ["grey" for _ in range(len_cat)]
680-
logger.info("input has more than 103 categories. Uniform " "'grey' color will be used for all categories.")
679+
logger.info("input has more than 103 categories. Uniform 'grey' color will be used for all categories.")
681680
else:
682681
# raise error when user didn't provide the right number of colors in palette
683682
if isinstance(palette, list) and len(palette) != len(categories):
@@ -1654,7 +1653,7 @@ def _ensure_table_and_layer_exist_in_sdata(
16541653
if table_layer in sdata.tables[tname].layers:
16551654
if found_table:
16561655
raise ValueError(
1657-
"Trying to guess 'table_name' based on 'table_layer', " "but found multiple matches."
1656+
"Trying to guess 'table_name' based on 'table_layer', but found multiple matches."
16581657
)
16591658
found_table = True
16601659

@@ -1727,7 +1726,6 @@ def _validate_label_render_params(
17271726

17281727
element_params: dict[str, dict[str, Any]] = {}
17291728
for el in param_dict["element"]:
1730-
17311729
# ensure that the element exists in the SpatialData object
17321730
_ = param_dict["sdata"][el]
17331731

@@ -1788,7 +1786,6 @@ def _validate_points_render_params(
17881786

17891787
element_params: dict[str, dict[str, Any]] = {}
17901788
for el in param_dict["element"]:
1791-
17921789
# ensure that the element exists in the SpatialData object
17931790
_ = param_dict["sdata"][el]
17941791

@@ -1859,7 +1856,6 @@ def _validate_shape_render_params(
18591856

18601857
element_params: dict[str, dict[str, Any]] = {}
18611858
for el in param_dict["element"]:
1862-
18631859
# ensure that the element exists in the SpatialData object
18641860
_ = param_dict["sdata"][el]
18651861

@@ -1896,7 +1892,6 @@ def _validate_shape_render_params(
18961892
def _validate_col_for_column_table(
18971893
sdata: SpatialData, element_name: str, col_for_color: str | None, table_name: str | None, labels: bool = False
18981894
) -> tuple[str | None, str | None]:
1899-
19001895
if not labels and col_for_color in sdata[element_name].columns:
19011896
table_name = None
19021897
elif table_name is not None:
@@ -2204,7 +2199,7 @@ def _datashader_aggregate_with_function(
22042199

22052200

22062201
def _datshader_get_how_kw_for_spread(
2207-
reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None
2202+
reduction: Literal["sum", "mean", "any", "count", "std", "var", "max", "min"] | None,
22082203
) -> str:
22092204
# Get the best input for the how argument of ds.tf.spread(), needed for numerical values
22102205
reduction = reduction or "sum"

0 commit comments

Comments
 (0)