Skip to content

Commit

Permalink
style: Bumps ruff to 0.1.14 (#290)
Browse files Browse the repository at this point in the history
* chore: Bumps ruff to 0.1.14

* ci: Updates CI version of ruff

* style: Fixes lint & format
  • Loading branch information
frgfm authored Jan 28, 2024
1 parent d2158e6 commit 6af1a7f
Show file tree
Hide file tree
Showing 29 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/collect_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import locale
import os
import re
import subprocess
import subprocess # noqa S404
import sys
from pathlib import Path
from typing import NamedTuple
Expand Down
4 changes: 2 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.11
pip install ruff==0.1.14
ruff --version
ruff check --diff .
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
architecture: x64
- name: Run ruff
run: |
pip install ruff==0.1.11
pip install ruff==0.1.14
ruff --version
ruff format --check --diff .
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
args: ['--branch', 'main']
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.1.11'
rev: 'v0.1.14'
hooks:
- id: ruff
args:
Expand Down
2 changes: 1 addition & 1 deletion api/app/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from app.config import settings

__all__ = ["decode_image", "classify_image"]
__all__ = ["classify_image", "decode_image"]

logger = logging.getLogger("uvicorn.warning")

Expand Down
4 changes: 2 additions & 2 deletions holocron/models/checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

__all__ = [
"Checkpoint",
"TrainingRecipe",
"Metric",
"Dataset",
"Evaluation",
"LoadingMeta",
"Metric",
"PreProcessing",
"TrainingRecipe",
]


Expand Down
8 changes: 4 additions & 4 deletions holocron/models/classification/convnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"ConvNeXt",
"ConvNeXt_Atto_Checkpoint",
"convnext_atto",
"convnext_base",
"convnext_femto",
"convnext_pico",
"convnext_large",
"convnext_nano",
"convnext_tiny",
"convnext_pico",
"convnext_small",
"convnext_base",
"convnext_large",
"convnext_tiny",
"convnext_xl",
]

Expand Down
2 changes: 1 addition & 1 deletion holocron/models/classification/darknetv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from ..presets import IMAGENETTE
from ..utils import _checkpoint, _configure_model, conv_sequence

__all__ = ["DarknetV2", "Darknet19_Checkpoint", "darknet19"]
__all__ = ["Darknet19_Checkpoint", "DarknetV2", "darknet19"]


default_cfgs: Dict[str, Dict[str, Any]] = {
Expand Down
2 changes: 1 addition & 1 deletion holocron/models/classification/darknetv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from ..utils import _checkpoint, _configure_model, conv_sequence
from .resnet import _ResBlock

__all__ = ["DarknetV3", "Darknet53_Checkpoint", "darknet53"]
__all__ = ["Darknet53_Checkpoint", "DarknetV3", "darknet53"]


class ResBlock(_ResBlock):
Expand Down
2 changes: 1 addition & 1 deletion holocron/models/classification/darknetv4.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ..utils import _checkpoint, _configure_model, conv_sequence
from .darknetv3 import ResBlock

__all__ = ["DarknetV4", "CSPDarknet53_Checkpoint", "cspdarknet53", "CSPDarknet53_Mish_Checkpoint", "cspdarknet53_mish"]
__all__ = ["CSPDarknet53_Checkpoint", "CSPDarknet53_Mish_Checkpoint", "DarknetV4", "cspdarknet53", "cspdarknet53_mish"]


default_cfgs: Dict[str, Dict[str, Any]] = {
Expand Down
6 changes: 3 additions & 3 deletions holocron/models/classification/mobileone.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

__all__ = [
"MobileOne_S0_Checkpoint",
"mobileone_s0",
"MobileOne_S1_Checkpoint",
"mobileone_s1",
"MobileOne_S2_Checkpoint",
"mobileone_s2",
"MobileOne_S3_Checkpoint",
"mobileone_s0",
"mobileone_s1",
"mobileone_s2",
"mobileone_s3",
]

Expand Down
12 changes: 6 additions & 6 deletions holocron/models/classification/repvgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
from ..utils import _checkpoint, _configure_model, conv_sequence, fuse_conv_bn

__all__ = [
"RepVGG",
"RepBlock",
"RepVGG",
"RepVGG",
"RepVGG_A0_Checkpoint",
"repvgg_a0",
"RepVGG_A1_Checkpoint",
"repvgg_a1",
"RepVGG_A2_Checkpoint",
"repvgg_a2",
"RepVGG_B0_Checkpoint",
"repvgg_b0",
"RepVGG_B1_Checkpoint",
"repvgg_b1",
"RepVGG_B2_Checkpoint",
"repvgg_a0",
"repvgg_a1",
"repvgg_a2",
"repvgg_b0",
"repvgg_b1",
"repvgg_b2",
"repvgg_b3",
]
Expand Down
10 changes: 5 additions & 5 deletions holocron/models/classification/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
__all__ = [
"BasicBlock",
"Bottleneck",
"ResNeXt50_32x4d_Checkpoint",
"ResNet",
"ResNet18_Checkpoint",
"resnet18",
"ResNet34_Checkpoint",
"resnet34",
"ResNet50D_Checkpoint",
"ResNet50_Checkpoint",
"resnet18",
"resnet34",
"resnet50",
"resnet50d",
"resnet101",
"resnet152",
"ResNeXt50_32x4d_Checkpoint",
"resnext50_32x4d",
"resnext101_32x8d",
"ResNet50D_Checkpoint",
"resnet50d",
]


Expand Down
10 changes: 5 additions & 5 deletions holocron/models/classification/rexnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
from ..utils import _checkpoint, _configure_model, conv_sequence

__all__ = [
"SEBlock",
"ReXBlock",
"ReXNet",
"ReXNet1_0x_Checkpoint",
"rexnet1_0x",
"ReXNet1_3x_Checkpoint",
"rexnet1_3x",
"ReXNet1_5x_Checkpoint",
"rexnet1_5x",
"ReXNet2_0x_Checkpoint",
"rexnet2_0x",
"ReXNet2_2x_Checkpoint",
"SEBlock",
"rexnet1_0x",
"rexnet1_3x",
"rexnet1_5x",
"rexnet2_0x",
"rexnet2_2x",
]

Expand Down
2 changes: 1 addition & 1 deletion holocron/models/classification/sknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ..utils import _checkpoint, _configure_model, conv_sequence
from .resnet import ResNet, _ResBlock

__all__ = ["SoftAttentionLayer", "SKConv2d", "SKBottleneck", "SKNet50_Checkpoint", "sknet50", "sknet101", "sknet152"]
__all__ = ["SKBottleneck", "SKConv2d", "SKNet50_Checkpoint", "SoftAttentionLayer", "sknet50", "sknet101", "sknet152"]


default_cfgs: Dict[str, Dict[str, Any]] = {
Expand Down
2 changes: 1 addition & 1 deletion holocron/models/detection/yolov4.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ..classification.darknetv4 import default_cfgs as dark_cfgs
from ..utils import conv_sequence, load_pretrained_params

__all__ = ["YOLOv4", "yolov4", "PAN"]
__all__ = ["PAN", "YOLOv4", "yolov4"]


default_cfgs = {
Expand Down
2 changes: 1 addition & 1 deletion holocron/models/presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# 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.

__all__ = ["IMAGENET", "IMAGENETTE", "CIFAR10"]
__all__ = ["CIFAR10", "IMAGENET", "IMAGENETTE"]

from dataclasses import dataclass
from typing import List, Tuple
Expand Down
2 changes: 1 addition & 1 deletion holocron/models/segmentation/unet.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ..classification.rexnet import rexnet1_3x
from ..utils import conv_sequence, load_pretrained_params

__all__ = ["UNet", "unet", "DynamicUNet", "unet_tvvgg11", "unet_tvresnet34", "unet_rexnet13", "unet2"]
__all__ = ["DynamicUNet", "UNet", "unet", "unet2", "unet_rexnet13", "unet_tvresnet34", "unet_tvvgg11"]


default_cfgs: Dict[str, Dict[str, Any]] = {
Expand Down
2 changes: 1 addition & 1 deletion holocron/models/segmentation/unetpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..utils import conv_sequence, load_pretrained_params
from .unet import UpPath, down_path

__all__ = ["UNetp", "unetp", "UNetpp", "unetpp"]
__all__ = ["UNetp", "UNetpp", "unetp", "unetpp"]


default_cfgs: Dict[str, Dict[str, Any]] = {
Expand Down
2 changes: 1 addition & 1 deletion holocron/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .checkpoints import Checkpoint, Dataset, Evaluation, LoadingMeta, Metric, PreProcessing, TrainingRecipe
from .presets import IMAGENET, IMAGENETTE

__all__ = ["conv_sequence", "load_pretrained_params", "fuse_conv_bn", "model_from_hf_hub"]
__all__ = ["conv_sequence", "fuse_conv_bn", "load_pretrained_params", "model_from_hf_hub"]

M = TypeVar("M", bound=nn.Module)

Expand Down
16 changes: 8 additions & 8 deletions holocron/nn/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
from torch import Tensor

__all__ = [
"hard_mish",
"nl_relu",
"add2d",
"complement_cross_entropy",
"concat_downsample2d",
"dice_loss",
"dropblock2d",
"focal_loss",
"hard_mish",
"multilabel_cross_entropy",
"complement_cross_entropy",
"mutual_channel_loss",
"nl_relu",
"norm_conv2d",
"add2d",
"dropblock2d",
"z_pool",
"concat_downsample2d",
"dice_loss",
"poly_loss",
"z_pool",
]


Expand Down
2 changes: 1 addition & 1 deletion holocron/nn/modules/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .. import functional as F

__all__ = ["HardMish", "NLReLU", "FReLU"]
__all__ = ["FReLU", "HardMish", "NLReLU"]


class _Activation(nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion holocron/nn/modules/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from .. import functional as F

__all__ = ["NormConv2d", "Add2d", "SlimConv2d", "PyConv2d", "Involution2d"]
__all__ = ["Add2d", "Involution2d", "NormConv2d", "PyConv2d", "SlimConv2d"]


class _NormConvNd(_ConvNd):
Expand Down
4 changes: 2 additions & 2 deletions holocron/nn/modules/downsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
from .. import functional as F

__all__ = [
"SPP",
"BlurPool2d",
"ConcatDownsample2d",
"ConcatDownsample2dJit",
"GlobalAvgPool2d",
"GlobalMaxPool2d",
"BlurPool2d",
"SPP",
"ZPool",
]

Expand Down
6 changes: 3 additions & 3 deletions holocron/nn/modules/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
from .. import functional as F

__all__ = [
"ClassBalancedWrapper",
"ComplementCrossEntropy",
"DiceLoss",
"FocalLoss",
"MultiLabelCrossEntropy",
"ComplementCrossEntropy",
"ClassBalancedWrapper",
"MutualChannelLoss",
"DiceLoss",
"PolyLoss",
]

Expand Down
2 changes: 1 addition & 1 deletion holocron/ops/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from torch import Tensor
from torchvision.ops.boxes import box_area, box_iou

__all__ = ["box_giou", "diou_loss", "ciou_loss"]
__all__ = ["box_giou", "ciou_loss", "diou_loss"]


def _box_iou(boxes1: Tensor, boxes2: Tensor) -> Tuple[Tensor, Tensor]:
Expand Down
6 changes: 2 additions & 4 deletions holocron/trainer/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from .core import Trainer

__all__ = ["ClassificationTrainer", "BinaryClassificationTrainer"]
__all__ = ["BinaryClassificationTrainer", "ClassificationTrainer"]


class ClassificationTrainer(Trainer):
Expand Down Expand Up @@ -142,8 +142,7 @@ def plot_top_losses(
num_cols = 4
num_rows = int(math.ceil(num_samples / num_cols))
_, axes = plt.subplots(num_rows, num_cols, figsize=(20, 5))
idx = 0
for img, pred, prob, target, loss in zip(images, preds, probs, targets, losses):
for idx, (img, pred, prob, target, loss) in enumerate(zip(images, preds, probs, targets, losses)):
_row = int(idx / num_cols)
_col = idx - num_cols * _row
axes[_row][_col].imshow(img)
Expand All @@ -156,7 +155,6 @@ def plot_top_losses(
f"{loss:.3} / {classes[pred]} ({prob:.1%}) / {classes[target]}" # type: ignore[index]
)
axes[_row][_col].axis("off")
idx += 1

plt.show(**kwargs)

Expand Down
2 changes: 1 addition & 1 deletion holocron/transforms/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from torchvision.transforms import transforms as T
from torchvision.transforms.functional import pad, resize

__all__ = ["Resize", "RandomZoomOut"]
__all__ = ["RandomZoomOut", "Resize"]


class ResizeMethod(str, Enum):
Expand Down
2 changes: 1 addition & 1 deletion holocron/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Out = TypeVar("Out")


__all__ = ["parallel", "find_image_size"]
__all__ = ["find_image_size", "parallel"]


def parallel(
Expand Down
Loading

0 comments on commit 6af1a7f

Please sign in to comment.