Skip to content

Commit b1126c2

Browse files
committed
Accept suggestions from new toolchain
1 parent 776fef6 commit b1126c2

20 files changed

+29
-53
lines changed

nmr/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
from typing import List, Optional
2+
from typing import Optional
33

44
import typer
55
from typer import Argument, Option, Typer
@@ -51,7 +51,7 @@ def nmr_main(
5151
"-l",
5252
help="If true, display the input as a label to the output",
5353
),
54-
output_type: Optional[str] = Option(
54+
output_type: str | None = Option(
5555
None,
5656
"--output-type",
5757
"-t",
@@ -65,10 +65,10 @@ def nmr_main(
6565
help="If True, don't catch exceptions, allow the program to terminate",
6666
),
6767
random_count: int = Option(0, "--random-count", "-r", help="Print random names"),
68-
word_count: Optional[int] = Option(
68+
word_count: int | None = Option(
6969
None, "--word-count", "-c", help="How many words from the word file to use"
7070
),
71-
word_file: Optional[Path] = Option(
71+
word_file: Path | None = Option(
7272
None,
7373
"--word-file",
7474
"-f",

nmr/_main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from __future__ import annotations
22

3-
import itertools
43
import random
54
import shlex
65
import sys
76
from functools import cached_property
87
from pathlib import Path
9-
from typing import Any, Iterable, NoReturn, Sequence
8+
from typing import Any, NoReturn
9+
from collections.abc import Iterable
1010

1111
import dtyper
1212

@@ -83,7 +83,7 @@ def _type_class(self) -> type[TypeNamer[Any]] | None:
8383
return None
8484

8585
def rnd(self) -> None: # TODO re-enable
86-
for i in range(self.random_count):
86+
for _ in range(self.random_count):
8787
r = int(10 ** random.uniform(0, 50))
8888
print(f"{r}:", *self.nmr.encode_to_name(r))
8989

nmr/category.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
from __future__ import annotations
22

3-
import dataclasses as dc
43
from enum import IntEnum, auto
5-
from functools import lru_cache
6-
from typing import cast
7-
8-
from typing_extensions import Self
94

105
DEFAULT_RADIX = 8
116

nmr/nmr.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
from __future__ import annotations
22

3-
import bisect
4-
from collections import Counter
5-
from collections.abc import Iterator, Sequence
6-
from os import PathLike
7-
from pathlib import Path
8-
from typing import Any
3+
from collections.abc import Sequence
94

105
from . import types
116
from .words import Words

nmr/pack_numbers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import bisect
21
import dataclasses as dc
32
import math
4-
from typing import Sequence
3+
from collections.abc import Sequence
54

65
"""
76
A module for packing n numbers into a single number

nmr/radixes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def encode(self, *digits: int) -> int:
66
total, *digit = digits
77
assert len(digit) == len(self.radixes)
88

9-
for d, r in zip(digit, self.radixes):
9+
for d, r in zip(digit, self.radixes, strict=False):
1010
total = r * total + d
1111
return total
1212

nmr/type_namer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _make(cls, s: int | str) -> DataType:
5353
return cast(DataType, data_type(s))
5454

5555
def __init__(self) -> None:
56-
assert False, "Cannot construct an instance of TypeNamer"
56+
raise NotImplementedError
5757

5858

5959
def get_class(prefix: str) -> type[TypeNamer[Any]]:

nmr/types/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, cast
3+
from typing import cast
44

55
from ..category import Category, make_category
66
from ..type_namer import TypeNamer

nmr/types/chess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def index_to_type(n: int) -> chess.Board:
3535
fields = (
3636
"/".join(index_to_row(r) for r in board),
3737
SIDES[side],
38-
"".join(c for b, c in zip(castle, CASTLES) if b) or "-",
38+
"".join(c for b, c in zip(castle, CASTLES, strict=False) if b) or "-",
3939
index_to_en_passant(ep),
4040
str(half_move),
4141
str(move),

nmr/types/fraction.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

33
import fractions
4-
import math
5-
from typing import Any
64

75
from ..category import Math
86
from ..pack_numbers import Packer

0 commit comments

Comments
 (0)