Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit suggestions (#9137)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/adrienverge/yamllint.git: v1.33.0 →
v1.35.1](https://github.com/adrienverge/yamllint.git/compare/v1.33.0...v1.35.1)
- [github.com/PyCQA/flake8: 6.1.0 →
7.0.0](PyCQA/flake8@6.1.0...7.0.0)
- [github.com/astral-sh/ruff-pre-commit: v0.1.9 →
v0.3.5](astral-sh/ruff-pre-commit@v0.1.9...v0.3.5)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: rusty1s <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and rusty1s authored Apr 2, 2024
1 parent beb9f7d commit 24ec11d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ benchmark:
- any-glob-to-any-file: ["benchmark/**/*", "torch_geometric/profile/**/*"]

skip-changelog:
- head-branch: ['^skip']
- head-branch: ['^skip', '^pre-commit-ci']
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
)$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
rev: v1.35.1
hooks:
- id: yamllint
name: Lint yaml
Expand All @@ -47,14 +47,14 @@ repos:
name: Sort imports

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
name: Check PEP8
additional_dependencies: [Flake8-pyproject]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.3.5
hooks:
- id: ruff
name: Ruff formatting
Expand Down
12 changes: 7 additions & 5 deletions torch_geometric/datasets/pascal.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,12 @@ def hook(module: torch.nn.Module, x: Tensor, y: Tensor) -> None:

# Add a small offset to the bounding because some keypoints lay
# outside the bounding box intervals.
box = (min(float(pos[:, 0].min().floor()), box[0]) - 16,
min(float(pos[:, 1].min().floor()), box[1]) - 16,
max(float(pos[:, 0].max().ceil()), box[2]) + 16,
max(float(pos[:, 1].max().ceil()), box[3]) + 16)
box = (
min(int(pos[:, 0].min().floor()), box[0]) - 16,
min(int(pos[:, 1].min().floor()), box[1]) - 16,
max(int(pos[:, 0].max().ceil()), box[2]) + 16,
max(int(pos[:, 1].max().ceil()), box[3]) + 16,
)

# Rescale keypoints.
pos[:, 0] = (pos[:, 0] - box[0]) * 256.0 / (box[2] - box[0])
Expand All @@ -239,7 +241,7 @@ def hook(module: torch.nn.Module, x: Tensor, y: Tensor) -> None:
path = osp.join(image_path, f'{filename}.jpg')
with open(path, 'rb') as f:
img = Image.open(f).convert('RGB').crop(box)
img = img.resize((256, 256), resample=Image.BICUBIC)
img = img.resize((256, 256), resample=Image.Resampling.BICUBIC)

img = transform(img)

Expand Down
2 changes: 1 addition & 1 deletion torch_geometric/datasets/willow_object_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def hook(module: torch.nn.Module, x: Tensor, y: Tensor) -> None:
pos[:, 0] = pos[:, 0] * 256.0 / (img.size[0])
pos[:, 1] = pos[:, 1] * 256.0 / (img.size[1])

img = img.resize((256, 256), resample=Image.BICUBIC)
img = img.resize((256, 256), resample=Image.Resampling.BICUBIC)
img = transform(img)

data = Data(img=img, pos=pos, name=name)
Expand Down

0 comments on commit 24ec11d

Please sign in to comment.