Skip to content

Commit

Permalink
refactor: fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Oct 3, 2024
1 parent afee6ed commit e28594a
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 30 deletions.
6 changes: 2 additions & 4 deletions coverage/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
import os
import sys

from types import FrameType
from typing import (
cast, Any, Callable, Dict, List, Set, TypeVar,
)
from collections.abc import Mapping
from types import FrameType
from typing import cast, Any, Callable, TypeVar

from coverage import env
from coverage.config import CoverageConfig
Expand Down
5 changes: 1 addition & 4 deletions coverage/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import warnings

from types import FrameType
from typing import (
cast,
Any, Callable, IO, List,
)
from typing import cast, Any, Callable, IO
from collections.abc import Iterable, Iterator

from coverage import env
Expand Down
1 change: 0 additions & 1 deletion coverage/execfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from types import CodeType, ModuleType
from typing import Any

from coverage import env
from coverage.exceptions import CoverageException, _ExceptionDuringRun, NoCode, NoSource
from coverage.files import canonical_filename, python_reported_file
from coverage.misc import isolate_module
Expand Down
6 changes: 5 additions & 1 deletion coverage/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ def flat_rootname(filename: str) -> str:
"""
dirname, basename = ntpath.split(filename)
if dirname:
fp = hashlib.new("sha3_256", dirname.encode("UTF-8"), usedforsecurity=False).hexdigest()[:16]
fp = hashlib.new(
"sha3_256",
dirname.encode("UTF-8"),
usedforsecurity=False,
).hexdigest()[:16]
prefix = f"z_{fp}_"
else:
prefix = ""
Expand Down
2 changes: 1 addition & 1 deletion coverage/jsonreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import json
import sys

from typing import Any, Dict, IO, TYPE_CHECKING
from collections.abc import Iterable
from typing import Any, IO, TYPE_CHECKING

from coverage import __version__
from coverage.report_core import get_analysis_to_report
Expand Down
7 changes: 2 additions & 5 deletions coverage/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
import token
import tokenize

from collections.abc import Iterable, Sequence
from dataclasses import dataclass
from types import CodeType
from typing import (
cast, Any, Callable, Dict, List, Optional, Protocol,
Set, Tuple,
)
from collections.abc import Iterable, Sequence
from typing import cast, Callable, Optional, Protocol

from coverage import env
from coverage.bytecode import code_objects
Expand Down
2 changes: 1 addition & 1 deletion coverage/pytracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import threading

from types import FrameType, ModuleType
from typing import Any, Callable, Set, cast
from typing import Any, Callable, cast

from coverage import env
from coverage.types import (
Expand Down
3 changes: 1 addition & 2 deletions coverage/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import collections
import dataclasses

from collections.abc import Container
from collections.abc import Container, Iterable
from typing import TYPE_CHECKING
from collections.abc import Iterable

from coverage.exceptions import ConfigError
from coverage.misc import nice_pair
Expand Down
2 changes: 1 addition & 1 deletion coverage/sqlitedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import re
import sqlite3

from typing import cast, Any, Tuple
from typing import cast, Any
from collections.abc import Iterable, Iterator

from coverage.debug import auto_repr, clipped_repr, exc_one_line
Expand Down
1 change: 0 additions & 1 deletion coverage/sysmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from typing import (
Any,
Callable,
Set,
TYPE_CHECKING,
cast,
)
Expand Down
2 changes: 1 addition & 1 deletion coverage/templite.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import re

from typing import (
Any, Callable, Dict, NoReturn, cast,
Any, Callable, NoReturn, cast,
)


Expand Down
6 changes: 3 additions & 3 deletions coverage/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import os
import pathlib

from collections.abc import Iterable, Mapping
from types import FrameType, ModuleType
from typing import (
Any, Callable, Dict, List, Optional, Protocol,
Set, Tuple, Type, Union, TYPE_CHECKING,
Any, Callable, Optional, Protocol,
Union, TYPE_CHECKING,
)
from collections.abc import Iterable, Mapping

if TYPE_CHECKING:
from coverage.plugin import FileTracer
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ disable = [
"missing-timeout",
"too-many-lines",
"use-implicit-booleaness-not-comparison",
"too-many-positional-arguments",
# Formatting stuff
"superfluous-parens",
# Messages that are noisy for now, eventually maybe we'll turn them on:
Expand Down
1 change: 0 additions & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from collections.abc import Iterable, Iterator

import flaky
import pytest

from coverage import env
from coverage.debug import DebugControl
Expand Down
2 changes: 1 addition & 1 deletion tests/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import os.path
import sys

from typing import Any, Callable, Tuple, cast
from collections.abc import Iterable, Iterator
from typing import Any, Callable, cast

import pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/plugin_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from __future__ import annotations

from typing import Any, List, cast
from typing import Any, cast

import coverage
from coverage.plugin_support import Plugins
Expand Down
1 change: 0 additions & 1 deletion tests/test_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import pytest

import coverage
from coverage import env
from coverage.plugin import CodeRegion
from coverage.regions import code_regions

Expand Down
2 changes: 1 addition & 1 deletion tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import sys

from typing import List, cast
from typing import cast

import pytest

Expand Down

0 comments on commit e28594a

Please sign in to comment.