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

View File

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

View File

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