ruff UP006 (use list instead of List for type annotation)

This commit is contained in:
The MMGen Project 2026-08-07 09:37:48 +00:00
commit c807ae8212
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 11 additions and 12 deletions

View file

@ -21,7 +21,7 @@ from hashlib import sha256
from dataclasses import dataclass
from pure_protobuf.annotations import Field
from pure_protobuf.message import BaseMessage
from typing import Annotated, List, Optional
from typing import Annotated, Optional
from enum import IntEnum
class SignMode(IntEnum):
@ -52,7 +52,7 @@ class ModeInfo(BaseMessage):
@dataclass
class Multi(BaseMessage):
bitarray: Annotated[bytes, Field(1)]
modeInfos: Annotated[List[bytes], Field(2)]
modeInfos: Annotated[list[bytes], Field(2)]
single: Annotated[Optional[Single], Field(1)] = None
multi: Annotated[Optional[Multi], Field(2)] = None
@ -74,14 +74,14 @@ class Coin(BaseMessage):
@dataclass
class Fee(BaseMessage):
amount: Annotated[Optional[List[Coin]], Field(1)] = None # = field(default_factory=list)
amount: Annotated[Optional[list[Coin]], Field(1)] = None # = field(default_factory=list)
gasLimit: Annotated[Optional[int], Field(2)] = None
payer: Annotated[Optional[str], Field(3)] = None
granter: Annotated[Optional[str], Field(4)] = None
@dataclass
class AuthInfo(BaseMessage):
signerInfos: Annotated[List[SignerInfo], Field(1)]
signerInfos: Annotated[list[SignerInfo], Field(1)]
fee: Annotated[Optional[Fee], Field(2)] = None
tip: Annotated[Optional[int], Field(3)] = None
@ -93,7 +93,7 @@ class AuthInfo(BaseMessage):
class RawTx(BaseMessage): # TxRaw (cosmjs)
bodyBytes: Annotated[bytes, Field(1)]
authInfoBytes: Annotated[bytes, Field(2)]
signatures: Annotated[List[bytes], Field(3)]
signatures: Annotated[list[bytes], Field(3)]
# SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT
@dataclass
@ -120,7 +120,7 @@ class TxMsg(BaseMessage):
class Tx(BaseMessage):
body: Annotated[bytes, Field(1)]
authInfo: Annotated[bytes, Field(2)]
signatures: Annotated[List[bytes], Field(3)]
signatures: Annotated[list[bytes], Field(3)]
@property
def raw(self):

View file

@ -17,7 +17,7 @@ proto.rune.tx.protobuf: transaction serialization for THORChain protocol
from decimal import Decimal
from collections import namedtuple
from dataclasses import dataclass #, field
from typing import Annotated, List, Optional
from typing import Annotated, Optional
from pure_protobuf.annotations import Field
from pure_protobuf.message import BaseMessage
@ -107,7 +107,7 @@ class Messages:
class Body(BaseMessage):
fromAddress: Annotated[bytes, Field(1)]
toAddress: Annotated[bytes, Field(2)]
amount: Annotated[List[Coin], Field(3)]
amount: Annotated[list[Coin], Field(3)]
id: Annotated[str, Field(1)] # '/types.MsgSend'
body: Annotated[Body, Field(2)]
@ -123,7 +123,7 @@ class Messages:
# }
@dataclass
class Body(BaseMessage):
coins: Annotated[List[CoinWithAsset], Field(1)]
coins: Annotated[list[CoinWithAsset], Field(1)]
memo: Annotated[str, Field(2)]
signer: Annotated[bytes, Field(3)]
@ -138,7 +138,7 @@ class RuneTxMsg(TxMsg):
@dataclass
class RuneTxBody(BaseMessage):
messages: Annotated[List[RuneTxMsg], Field(1)]
messages: Annotated[list[RuneTxMsg], Field(1)]
memo: Annotated[Optional[str], Field(2)] = None
timeoutHeight: Annotated[Optional[int], Field(3)] = None
extensionOptions: Annotated[Optional[bytes], Field(4)] = None
@ -148,7 +148,7 @@ class RuneTxBody(BaseMessage):
class RuneTx(Tx):
body: Annotated[RuneTxBody, Field(1)]
authInfo: Annotated[AuthInfo, Field(2)]
signatures: Annotated[List[bytes], Field(3)]
signatures: Annotated[list[bytes], Field(3)]
def amt_to_base_unit(amt, *, decimals):
return int(Decimal(amt) * (Decimal(10) ** decimals))

View file

@ -36,7 +36,6 @@ ignore = [
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM114", # Combine `if` branches using logical `or` operator
"SIM905", # Consider using a list literal instead of `str.split`
"UP006", # Use `list` instead of `List` for type annotation
"UP022", # Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE`
"UP030", # Use implicit references for positional format fields
"UP031", # Use format specifiers instead of percent format