Skip to content

Commit

Permalink
more lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Jul 5, 2023
1 parent 3c7bdbe commit e0edc65
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 36 deletions.
8 changes: 1 addition & 7 deletions scripts/make_width_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ def main() -> None:
f.write(f"""# Generated by {basename(__file__)}
# wcwidth {wcwidth.__version__}
# Unicode {wcwidth.list_versions()[-1]}
import sys
from typing import List, Tuple
if sys.version_info < (3, 8):
from typing_extensions import Final
else:
from typing import Final
from typing import Final, List, Tuple
WIDTH_TABLE: Final[List[Tuple[int, int, int]]] = [
""")
Expand Down
5 changes: 1 addition & 4 deletions src/black/_width_table.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Generated by make_width_table.py
# wcwidth 0.2.6
# Unicode 15.0.0
import sys
from typing import List, Tuple

from typing import Final
from typing import Final, List, Tuple

WIDTH_TABLE: Final[List[Tuple[int, int, int]]] = [
(0, 0, 0),
Expand Down
5 changes: 1 addition & 4 deletions src/black/brackets.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""Builds on top of nodes.py to track brackets."""

import sys
from dataclasses import dataclass, field
from typing import Dict, Iterable, List, Optional, Sequence, Set, Tuple, Union

from typing import Final
from typing import Dict, Final, Iterable, List, Optional, Sequence, Set, Tuple, Union

from black.nodes import (
BRACKET,
Expand Down
4 changes: 1 addition & 3 deletions src/black/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import sys
from dataclasses import dataclass
from functools import lru_cache
from typing import Iterator, List, Optional, Union

from typing import Final
from typing import Final, Iterator, List, Optional, Union

from black.nodes import (
CLOSING_BRACKETS,
Expand Down
5 changes: 1 addition & 4 deletions src/black/mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
chosen by the user.
"""

import sys
from dataclasses import dataclass, field
from enum import Enum, auto
from hashlib import sha256
from operator import attrgetter
from typing import Dict, Set
from typing import Dict, Final, Set
from warnings import warn

from typing import Final

from black.const import DEFAULT_LINE_LENGTH


Expand Down
4 changes: 1 addition & 3 deletions src/black/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"""

import sys
from typing import Generic, Iterator, List, Optional, Set, Tuple, TypeVar, Union

from typing import Final
from typing import Final, Generic, Iterator, List, Optional, Set, Tuple, TypeVar, Union

if sys.version_info >= (3, 10):
from typing import TypeGuard
Expand Down
4 changes: 1 addition & 3 deletions src/black/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"""
import ast
import sys
from typing import Any, Iterable, Iterator, List, Set, Tuple, Type

from typing import Final
from typing import Any, Final, Iterable, Iterator, List, Set, Tuple, Type

from black.mode import VERSION_TO_FEATURES, Feature, TargetVersion, supports_feature
from black.nodes import syms
Expand Down
7 changes: 2 additions & 5 deletions src/black/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
import re
import sys
from functools import lru_cache
from typing import List, Match, Pattern

from blib2to3.pytree import Leaf

from typing import Final
from typing import Final, List, Match, Pattern

from black._width_table import WIDTH_TABLE
from blib2to3.pytree import Leaf

STRING_PREFIX_CHARS: Final = "furbFURB" # All possible string prefix characters.
STRING_PREFIX_RE: Final = re.compile(
Expand Down
5 changes: 2 additions & 3 deletions src/black/trans.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
String transformers that can split and merge strings.
"""
import re
import sys
from abc import ABC, abstractmethod
from collections import defaultdict
from dataclasses import dataclass
Expand All @@ -12,9 +11,11 @@
ClassVar,
Collection,
Dict,
Final,
Iterable,
Iterator,
List,
Literal,
Optional,
Sequence,
Set,
Expand All @@ -23,8 +24,6 @@
Union,
)

from typing import Literal, Final

from mypy_extensions import trait

from black.comments import contains_pragma_comment
Expand Down

0 comments on commit e0edc65

Please sign in to comment.