stype: fix ruff UP007 rule, typings

This commit is contained in:
Dowon
2024-02-29 20:30:44 +09:00
parent f21ac7b28f
commit 6dcad30b64
3 changed files with 7 additions and 6 deletions

View File

@@ -5,7 +5,6 @@ from dataclasses import dataclass
from functools import cached_property, partial
from typing import Any, Literal, NamedTuple, Optional
import pydantic
from pydantic import (
BaseModel,
Extra,
@@ -14,7 +13,6 @@ from pydantic import (
PositiveInt,
confloat,
conint,
constr,
validator,
)
@@ -34,11 +32,11 @@ class Arg(NamedTuple):
class ArgsList(UserList):
@cached_property
def attrs(self) -> tuple[str]:
def attrs(self) -> tuple[str, ...]:
return tuple(attr for attr, _ in self)
@cached_property
def names(self) -> tuple[str]:
def names(self) -> tuple[str, ...]:
return tuple(name for _, name in self)

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
from collections import OrderedDict
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional, Union
from typing import Optional
from huggingface_hub import hf_hub_download
from PIL import Image, ImageDraw

View File

@@ -36,7 +36,10 @@ select = [
"UP",
"W",
]
ignore = ["B008", "B905", "E501", "F401", "UP007"]
ignore = ["B008", "B905", "E501", "F401"]
[tool.ruff.lint.isort]
known-first-party = ["launch", "modules"]
[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true