Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Bumps ruff to 0.1.11 #229

Merged
merged 6 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
architecture: x64
- name: Run ruff
run: |
pip install ruff==0.1.9
pip install ruff==0.1.11
ruff --version
ruff check --diff .

Expand Down Expand Up @@ -65,6 +65,25 @@ jobs:
architecture: x64
- name: Run ruff
run: |
pip install ruff==0.1.9
pip install ruff==0.1.11
ruff --version
ruff format --check --diff .

precommit-hooks:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Run ruff
run: |
pip install pre-commit
pre-commit install
pre-commit --version
pre-commit run --all-files
22 changes: 13 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@ default_language_version:
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-yaml
exclude: .conda
- id: check-toml
- id: check-added-large-files
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: no-commit-to-branch
args: ['--branch', 'main']
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
exclude: .conda
- id: debug-statements
language_version: python3
- id: end-of-file-fixer
- id: no-commit-to-branch
args: ['--branch', 'main']
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.1.9'
rev: 'v0.1.11'
hooks:
- id: ruff
args:
Expand Down
2 changes: 1 addition & 1 deletion demo/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021-2023, François-Guillaume Fernandez.
# Copyright (C) 2021-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test = [
"pytest-pretty>=1.0.0,<2.0.0",
]
quality = [
"ruff==0.1.9",
"ruff==0.1.11",
"mypy==1.8.0",
"pre-commit>=3.0.0,<4.0.0",
]
Expand Down Expand Up @@ -78,7 +78,7 @@ dev = [
"pytest-xdist>=3.0.0,<4.0.0",
"pytest-pretty>=1.0.0,<2.0.0",
# style
"ruff==0.1.9",
"ruff==0.1.11",
"mypy==1.8.0",
"pre-commit>=3.0.0,<4.0.0",
# docs
Expand Down
2 changes: 1 addition & 1 deletion scripts/cam_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion scripts/eval_latency.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021-2023, François-Guillaume Fernandez.
# Copyright (C) 2021-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion scripts/eval_perf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022-2023, François-Guillaume Fernandez.
# Copyright (C) 2022-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion torchcam/methods/_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion torchcam/methods/activation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion torchcam/methods/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
2 changes: 1 addition & 1 deletion torchcam/methods/gradient.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
11 changes: 10 additions & 1 deletion torchcam/metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2022-2023, François-Guillaume Fernandez.
# Copyright (C) 2022-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down Expand Up @@ -57,6 +57,7 @@ def __init__(
cam_extractor: _CAM,
logits_fn: Union[Callable[[torch.Tensor], torch.Tensor], None] = None,
) -> None:
# This is a typa, I don't know how to rites
self.cam_extractor = cam_extractor
self.logits_fn = logits_fn
self.reset()
Expand All @@ -65,6 +66,14 @@ def _get_probs(self, input_tensor: torch.Tensor) -> torch.Tensor:
logits = self.cam_extractor.model(input_tensor)
return cast(torch.Tensor, logits if self.logits_fn is None else self.logits_fn(logits))

def my_function(self) -> str:
"""Returns a greeting message

Returns:
str: greeting message
"""
return "Hello"

def update(
self,
input_tensor: torch.Tensor,
Expand Down
2 changes: 1 addition & 1 deletion torchcam/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand Down
Loading