Skip to content

Commit 525208d

Browse files
bowiechenmeta-codesync[bot]
authored andcommitted
use black==25.11.0 in detectron2
Summary: Pull Request resolved: #5499 X-link: https://github.com/fairinternal/detectron2/pull/608 Keep this repo in sync with what we're using internally. Reviewed By: wat3rBro Differential Revision: D87014208 fbshipit-source-id: 2b91503a030a56ded6258a2c132789f91a631414
1 parent a99f10c commit 525208d

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

.github/workflows/workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jobs:
2222
run: |
2323
python -m pip install --upgrade pip
2424
python -m pip install flake8==6.1.0 isort==4.3.21
25-
python -m pip install black==24.4.2
25+
python -m pip install black==25.11.0
2626
flake8 --version
2727
- name: Lint
2828
run: |
2929
echo "Running isort"
3030
isort -c -sp .
3131
echo "Running black"
32-
black -l 100 --check .
32+
black -l 100 --diff .
3333
echo "Running flake8"
3434
flake8 .
3535

detectron2/structures/masks.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ def nonempty(self) -> torch.Tensor:
164164

165165
@staticmethod
166166
def from_polygon_masks(
167-
polygon_masks: Union["PolygonMasks", List[List[np.ndarray]]], height: int, width: int
167+
polygon_masks: Union["PolygonMasks", List[List[np.ndarray]]],
168+
height: int,
169+
width: int,
168170
) -> "BitMasks":
169171
"""
170172
Args:
@@ -292,7 +294,7 @@ def _make_array(t: Union[torch.Tensor, np.ndarray]) -> np.ndarray:
292294
return np.asarray(t).astype("float64")
293295

294296
def process_polygons(
295-
polygons_per_instance: List[Union[torch.Tensor, np.ndarray]]
297+
polygons_per_instance: List[Union[torch.Tensor, np.ndarray]],
296298
) -> List[np.ndarray]:
297299
if not isinstance(polygons_per_instance, list):
298300
raise ValueError(
@@ -521,7 +523,10 @@ def to_bitmasks(self, boxes: torch.Tensor, height, width, threshold=0.5):
521523
"""
522524
Args: see documentation of :func:`paste_masks_in_image`.
523525
"""
524-
from detectron2.layers.mask_ops import paste_masks_in_image, _paste_masks_tensor_shape
526+
from detectron2.layers.mask_ops import (
527+
paste_masks_in_image,
528+
_paste_masks_tensor_shape,
529+
)
525530

526531
if torch.jit.is_tracing():
527532
if isinstance(height, torch.Tensor):

detectron2/utils/develop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) Facebook, Inc. and its affiliates.
2-
""" Utilities for developers only.
2+
"""Utilities for developers only.
33
These are not visible to users (not automatically imported). And should not
44
appeared in docs."""
55
# adapted from https://github.com/tensorpack/tensorpack/blob/master/tensorpack/utils/develop.py

dev/linter.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
cd "$(dirname "${BASH_SOURCE[0]}")/.."
66

77
{
8-
black --version | grep -E "24\." > /dev/null
8+
black --version | grep -E "25\." > /dev/null
99
} || {
10-
echo "Linter requires 'black==24.*' !"
10+
echo "Linter requires 'black==25.*' !"
1111
exit 1
1212
}
1313

0 commit comments

Comments
 (0)