Skip to content

Commit

Permalink
DEV: Use ruff in CI (#1609)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma authored Feb 5, 2023
1 parent d2c3e1b commit d9d78da
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/github-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ jobs:
- name: Install pypdf
run: |
pip install .
- name: Test with flake8
- name: Test with ruff
run: |
flake8 .
ruff .
package:
name: Build & verify package
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ repos:
additional_dependencies: [black==22.1.0]
exclude: "docs/user/robustness.md"
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.237'
hooks:
- id: ruff
Expand Down
11 changes: 5 additions & 6 deletions pypdf/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,7 @@ def rotation(self) -> int:
valid values. This property does not affect ``/Contents``.
"""
rotate_obj = self.get(PG.ROTATE, 0)
return (
rotate_obj if isinstance(rotate_obj, int) else rotate_obj.get_object()
)
return rotate_obj if isinstance(rotate_obj, int) else rotate_obj.get_object()

@rotation.setter
def rotation(self, r: Union[int, float]) -> None:
Expand Down Expand Up @@ -651,8 +649,8 @@ def compute_unique_key(base_key: str) -> Tuple[str, bool]:
new_res[newname] = page2res.raw_get(key)
lst = sorted(new_res.items())
new_res.clear()
for l in lst:
new_res[l[0]] = l[1]
for el in lst:
new_res[el[0]] = el[1]
return new_res, rename_res

@staticmethod
Expand Down Expand Up @@ -1263,7 +1261,8 @@ def mergeRotatedScaledPage(
"""
deprecation_with_replacement(
"page.mergeRotatedScaledPage(page2, rotation, scale, expand)",
"page.merge_transformed_page(page2, Transformation().rotate(rotation).scale(scale)); page.merge_page(page2, expand)",
"page.merge_transformed_page(page2, Transformation()"
".rotate(rotation).scale(scale)); page.merge_page(page2, expand)",
"3.0.0",
)
op = Transformation().rotate(rotation).scale(scale, scale)
Expand Down
2 changes: 2 additions & 0 deletions requirements/ci-3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pytest==7.2.0
# pytest-benchmark
pytest-benchmark==4.0.0
# via -r requirements/ci.in
ruff==0.0.241
# via -r requirements/ci.in
typeguard==2.13.3
# via -r requirements/ci.in
types-dataclasses==0.6.6
Expand Down
4 changes: 2 additions & 2 deletions requirements/ci.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ flake8-bugbear
flake8-print
mypy
pillow
pycryptodome
pytest
pytest-benchmark
pycryptodome
typeguard
types-Pillow
types-dataclasses
types-Pillow

0 comments on commit d9d78da

Please sign in to comment.