diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2023-01-05 06:31:02 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2023-01-05 12:55:16 -0500 |
commit | 4ea850a695e3ab8e42d400dc9dceaebea9246081 (patch) | |
tree | 0f047e4db3087212060eb54e95e4adf8760e6fb8 | |
parent | 097e13177ecc97638426a8e3a276ddeaae5422a1 (diff) | |
download | python-coveragepy-git-4ea850a695e3ab8e42d400dc9dceaebea9246081.tar.gz |
mypy: use __future__ uniformly in checked files
36 files changed, 73 insertions, 2 deletions
diff --git a/coverage/bytecode.py b/coverage/bytecode.py index 15bf755b..e9a908f7 100644 --- a/coverage/bytecode.py +++ b/coverage/bytecode.py @@ -3,6 +3,8 @@ """Bytecode manipulation for coverage.py""" +from __future__ import annotations + from types import CodeType from typing import Generator diff --git a/coverage/cmdline.py b/coverage/cmdline.py index b8ca2e7e..18a25fcc 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -3,6 +3,8 @@ """Command-line support for coverage.py.""" +from __future__ import annotations + import glob import optparse # pylint: disable=deprecated-module import os diff --git a/coverage/config.py b/coverage/config.py index 8ab68741..434a8d2a 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -4,6 +4,7 @@ """Config file for coverage.py""" from __future__ import annotations + import collections import configparser import copy diff --git a/coverage/context.py b/coverage/context.py index 3b8bc10f..20a5c92d 100644 --- a/coverage/context.py +++ b/coverage/context.py @@ -3,6 +3,8 @@ """Determine contexts for coverage.py""" +from __future__ import annotations + from types import FrameType from typing import cast, Callable, Optional, Sequence diff --git a/coverage/data.py b/coverage/data.py index baddaddd..8e987a33 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -10,6 +10,8 @@ imports working. """ +from __future__ import annotations + import glob import hashlib import os.path diff --git a/coverage/env.py b/coverage/env.py index c6c1ed13..5d69a234 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -3,6 +3,8 @@ """Determine facts about the environment.""" +from __future__ import annotations + import os import platform import sys diff --git a/coverage/execfile.py b/coverage/execfile.py index 93dffcd1..f0f4f171 100644 --- a/coverage/execfile.py +++ b/coverage/execfile.py @@ -3,6 +3,8 @@ """Execute files of Python code.""" +from __future__ import annotations + import importlib.machinery import importlib.util import inspect diff --git a/coverage/numbits.py b/coverage/numbits.py index 99d53878..26e5c272 100644 --- a/coverage/numbits.py +++ b/coverage/numbits.py @@ -13,13 +13,15 @@ in the blobs should be considered an implementation detail that might change in the future. Use these functions to work with those binary blobs of data. """ + +from __future__ import annotations + import json +import sqlite3 from itertools import zip_longest from typing import Iterable, List -import sqlite3 - def nums_to_numbits(nums: Iterable[int]) -> bytes: """Convert `nums` into a numbits. diff --git a/coverage/phystokens.py b/coverage/phystokens.py index a45242fd..4d1ee46e 100644 --- a/coverage/phystokens.py +++ b/coverage/phystokens.py @@ -3,6 +3,8 @@ """Better tokenizing for coverage.py.""" +from __future__ import annotations + import ast import io import keyword diff --git a/coverage/pytracer.py b/coverage/pytracer.py index 027e8e7e..94d2ecdc 100644 --- a/coverage/pytracer.py +++ b/coverage/pytracer.py @@ -3,6 +3,8 @@ """Raw data collector for coverage.py.""" +from __future__ import annotations + import atexit import dis import sys diff --git a/coverage/tomlconfig.py b/coverage/tomlconfig.py index 3b8ff347..139cb2c1 100644 --- a/coverage/tomlconfig.py +++ b/coverage/tomlconfig.py @@ -3,6 +3,8 @@ """TOML configuration support for coverage.py""" +from __future__ import annotations + import os import re diff --git a/coverage/version.py b/coverage/version.py index 1814eb41..bee051d5 100644 --- a/coverage/version.py +++ b/coverage/version.py @@ -4,6 +4,8 @@ """The version and URL for coverage.py""" # This file is exec'ed in setup.py, don't import anything! +from __future__ import annotations + # version_info: same semantics as sys.version_info. # _dev: the .devN suffix if any. version_info = (7, 0, 4, "alpha", 0) diff --git a/tests/conftest.py b/tests/conftest.py index d87c1289..9b10514b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,6 +7,8 @@ Pytest auto configuration. This module is run automatically by pytest, to define and enable fixtures. """ +from __future__ import annotations + import os import sys import sysconfig diff --git a/tests/coveragetest.py b/tests/coveragetest.py index 5025602b..9b3e3342 100644 --- a/tests/coveragetest.py +++ b/tests/coveragetest.py @@ -3,6 +3,8 @@ """Base test case class for coverage.py testing.""" +from __future__ import annotations + import contextlib import datetime import difflib diff --git a/tests/goldtest.py b/tests/goldtest.py index 16b40999..4d2be842 100644 --- a/tests/goldtest.py +++ b/tests/goldtest.py @@ -3,6 +3,8 @@ """A test base class for tests based on gold file comparison.""" +from __future__ import annotations + import difflib import filecmp import fnmatch diff --git a/tests/mixins.py b/tests/mixins.py index 97fd2a91..586dcac5 100644 --- a/tests/mixins.py +++ b/tests/mixins.py @@ -7,6 +7,8 @@ Test class mixins Some of these are transitional while working toward pure-pytest style. """ +from __future__ import annotations + import importlib import os import os.path diff --git a/tests/osinfo.py b/tests/osinfo.py index 57d11273..4d11ce73 100644 --- a/tests/osinfo.py +++ b/tests/osinfo.py @@ -3,6 +3,8 @@ """OS information for testing.""" +from __future__ import annotations + import sys diff --git a/tests/test_annotate.py b/tests/test_annotate.py index 99ce2694..257094f7 100644 --- a/tests/test_annotate.py +++ b/tests/test_annotate.py @@ -3,6 +3,8 @@ """Tests for annotation from coverage.py.""" +from __future__ import annotations + import coverage from tests.coveragetest import CoverageTest diff --git a/tests/test_api.py b/tests/test_api.py index d979c182..0eb73350 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -3,6 +3,8 @@ """Tests for coverage.py's API.""" +from __future__ import annotations + import fnmatch import glob import io diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 8232e1cf..d80a4637 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -3,6 +3,8 @@ """Tests for coverage.py's arc measurement.""" +from __future__ import annotations + import pytest from tests.coveragetest import CoverageTest diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index f20cfe74..13b6e73e 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -3,6 +3,8 @@ """Test cmdline.py for coverage.py.""" +from __future__ import annotations + import ast import pprint import re diff --git a/tests/test_collector.py b/tests/test_collector.py index 0d0c8dfe..d33cb263 100644 --- a/tests/test_collector.py +++ b/tests/test_collector.py @@ -3,6 +3,8 @@ """Tests of coverage/collector.py and other collectors.""" +from __future__ import annotations + import os.path import coverage diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index e6910dc8..c80136c4 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -3,6 +3,8 @@ """Tests for concurrency libraries.""" +from __future__ import annotations + import glob import multiprocessing import os diff --git a/tests/test_config.py b/tests/test_config.py index 08fdc113..d60a4eeb 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -3,6 +3,8 @@ """Test the config file handling for coverage.py""" +from __future__ import annotations + import sys from unittest import mock diff --git a/tests/test_context.py b/tests/test_context.py index d818c790..d04f911e 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -3,6 +3,8 @@ """Tests for context support.""" +from __future__ import annotations + import inspect import os.path diff --git a/tests/test_coverage.py b/tests/test_coverage.py index ee82123d..1992ebb8 100644 --- a/tests/test_coverage.py +++ b/tests/test_coverage.py @@ -3,6 +3,8 @@ """Tests for coverage.py.""" +from __future__ import annotations + import pytest import coverage diff --git a/tests/test_data.py b/tests/test_data.py index 56ef6dfc..8ed4f842 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -3,6 +3,8 @@ """Tests for coverage.data""" +from __future__ import annotations + import glob import os import os.path diff --git a/tests/test_debug.py b/tests/test_debug.py index 73217f1a..38b70f28 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -3,6 +3,8 @@ """Tests of coverage/debug.py""" +from __future__ import annotations + import ast import io import os diff --git a/tests/test_execfile.py b/tests/test_execfile.py index 229d8d95..0b6afa61 100644 --- a/tests/test_execfile.py +++ b/tests/test_execfile.py @@ -3,6 +3,8 @@ """Tests for coverage.execfile""" +from __future__ import annotations + import compileall import json import os diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py index 59335309..c36fa013 100644 --- a/tests/test_filereporter.py +++ b/tests/test_filereporter.py @@ -3,6 +3,8 @@ """Tests for FileReporters""" +from __future__ import annotations + import sys from coverage.plugin import FileReporter diff --git a/tests/test_files.py b/tests/test_files.py index ff02e0e9..e8a6eaca 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -3,6 +3,8 @@ """Tests for files.py""" +from __future__ import annotations + import itertools import os import os.path diff --git a/tests/test_html.py b/tests/test_html.py index 2475c873..5960962e 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -3,6 +3,8 @@ """Tests that HTML generation is awesome.""" +from __future__ import annotations + import collections import datetime import glob diff --git a/tests/test_misc.py b/tests/test_misc.py index 7d98a398..ba465cbd 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -3,6 +3,8 @@ """Tests of miscellaneous stuff.""" +from __future__ import annotations + import sys import pytest diff --git a/tests/test_python.py b/tests/test_python.py index 14dbebef..ee0268ff 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -3,6 +3,8 @@ """Tests of coverage/python.py""" +from __future__ import annotations + import pathlib import sys diff --git a/tests/test_summary.py b/tests/test_summary.py index 15c75348..3109e90f 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -3,6 +3,8 @@ """Test text-based summary reporting for coverage.py""" +from __future__ import annotations + import glob import io import math diff --git a/tests/test_xml.py b/tests/test_xml.py index 9461091d..a6a15281 100644 --- a/tests/test_xml.py +++ b/tests/test_xml.py @@ -3,6 +3,8 @@ """Tests for XML reports from coverage.py.""" +from __future__ import annotations + import os import os.path import re |