LAHTeR / document_segmentation

Tool for segmenting and classifying document boundaries.
1 stars 1 forks source link

ruff-demo #56

Closed brucearctor closed 7 months ago

carschno commented 7 months ago

Closes #49

carschno commented 7 months ago

Now the GH action passes, but when I run ruff locally, it triggers an I001 error:

% poetry run ruff --select=I document_segmentation/model/page_sequence_tagger.py
warning: `ruff <path>` is deprecated. Use `ruff check <path>` instead.
document_segmentation/model/page_sequence_tagger.py:1:1: I001 [*] Import block is un-sorted or un-formatted
Found 1 error.
[*] 1 fixable with the `--fix` option.

I am on the right branch:

% git rev-parse --abbrev-ref HEAD
ruff-demo

And on the latest Ruff version:

% poetry run ruff --version
ruff 0.3.3

When I run ruff --fix locally, it applies the previous sorting again:

import csv
import logging
import sys
from typing import Any, Optional, TextIO

import torch
import torch.nn as nn
from torch import optim
from torcheval.metrics import (
    Metric,
    MulticlassAccuracy,
    MulticlassF1Score,
    MulticlassPrecision,
    MulticlassRecall,
)
from tqdm import tqdm

import wandb   # <---------------------------

from ..pagexml.datamodel.label import Label
from ..settings import PAGE_SEQUENCE_TAGGER_RNN_CONFIG
from .dataset import DocumentDataset, PageDataset
from .device_module import DeviceModule
from .page_embedding import PageEmbedding

I still cannot see the difference in the local call and the GH action call to ruff.

carschno commented 7 months ago

Related to https://github.com/ChartBoost/ruff-action/issues/20

carschno commented 7 months ago

Resolved as described in https://github.com/ChartBoost/ruff-action/issues/20#issuecomment-2012747916 with https://github.com/LAHTeR/document_segmentation/pull/55/commits/0f128429928eee70159855a142a9d83b015b7683