Skip to content

Commit 4ea850a

Browse files
committed
mypy: use __future__ uniformly in checked files
1 parent 097e131 commit 4ea850a

36 files changed

+73
-2
lines changed

coverage/bytecode.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Bytecode manipulation for coverage.py"""
55

6+
from __future__ import annotations
7+
68
from types import CodeType
79
from typing import Generator
810

coverage/cmdline.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Command-line support for coverage.py."""
55

6+
from __future__ import annotations
7+
68
import glob
79
import optparse # pylint: disable=deprecated-module
810
import os

coverage/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""Config file for coverage.py"""
55

66
from __future__ import annotations
7+
78
import collections
89
import configparser
910
import copy

coverage/context.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Determine contexts for coverage.py"""
55

6+
from __future__ import annotations
7+
68
from types import FrameType
79
from typing import cast, Callable, Optional, Sequence
810

coverage/data.py

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
1111
"""
1212

13+
from __future__ import annotations
14+
1315
import glob
1416
import hashlib
1517
import os.path

coverage/env.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Determine facts about the environment."""
55

6+
from __future__ import annotations
7+
68
import os
79
import platform
810
import sys

coverage/execfile.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Execute files of Python code."""
55

6+
from __future__ import annotations
7+
68
import importlib.machinery
79
import importlib.util
810
import inspect

coverage/numbits.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
the future. Use these functions to work with those binary blobs of data.
1414
1515
"""
16+
17+
from __future__ import annotations
18+
1619
import json
20+
import sqlite3
1721

1822
from itertools import zip_longest
1923
from typing import Iterable, List
2024

21-
import sqlite3
22-
2325

2426
def nums_to_numbits(nums: Iterable[int]) -> bytes:
2527
"""Convert `nums` into a numbits.

coverage/phystokens.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Better tokenizing for coverage.py."""
55

6+
from __future__ import annotations
7+
68
import ast
79
import io
810
import keyword

coverage/pytracer.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Raw data collector for coverage.py."""
55

6+
from __future__ import annotations
7+
68
import atexit
79
import dis
810
import sys

coverage/tomlconfig.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""TOML configuration support for coverage.py"""
55

6+
from __future__ import annotations
7+
68
import os
79
import re
810

coverage/version.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"""The version and URL for coverage.py"""
55
# This file is exec'ed in setup.py, don't import anything!
66

7+
from __future__ import annotations
8+
79
# version_info: same semantics as sys.version_info.
810
# _dev: the .devN suffix if any.
911
version_info = (7, 0, 4, "alpha", 0)

tests/conftest.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
This module is run automatically by pytest, to define and enable fixtures.
88
"""
99

10+
from __future__ import annotations
11+
1012
import os
1113
import sys
1214
import sysconfig

tests/coveragetest.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Base test case class for coverage.py testing."""
55

6+
from __future__ import annotations
7+
68
import contextlib
79
import datetime
810
import difflib

tests/goldtest.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""A test base class for tests based on gold file comparison."""
55

6+
from __future__ import annotations
7+
68
import difflib
79
import filecmp
810
import fnmatch

tests/mixins.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
Some of these are transitional while working toward pure-pytest style.
88
"""
99

10+
from __future__ import annotations
11+
1012
import importlib
1113
import os
1214
import os.path

tests/osinfo.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""OS information for testing."""
55

6+
from __future__ import annotations
7+
68
import sys
79

810

tests/test_annotate.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for annotation from coverage.py."""
55

6+
from __future__ import annotations
7+
68
import coverage
79

810
from tests.coveragetest import CoverageTest

tests/test_api.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for coverage.py's API."""
55

6+
from __future__ import annotations
7+
68
import fnmatch
79
import glob
810
import io

tests/test_arcs.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for coverage.py's arc measurement."""
55

6+
from __future__ import annotations
7+
68
import pytest
79

810
from tests.coveragetest import CoverageTest

tests/test_cmdline.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Test cmdline.py for coverage.py."""
55

6+
from __future__ import annotations
7+
68
import ast
79
import pprint
810
import re

tests/test_collector.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests of coverage/collector.py and other collectors."""
55

6+
from __future__ import annotations
7+
68
import os.path
79

810
import coverage

tests/test_concurrency.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for concurrency libraries."""
55

6+
from __future__ import annotations
7+
68
import glob
79
import multiprocessing
810
import os

tests/test_config.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Test the config file handling for coverage.py"""
55

6+
from __future__ import annotations
7+
68
import sys
79

810
from unittest import mock

tests/test_context.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for context support."""
55

6+
from __future__ import annotations
7+
68
import inspect
79
import os.path
810

tests/test_coverage.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for coverage.py."""
55

6+
from __future__ import annotations
7+
68
import pytest
79

810
import coverage

tests/test_data.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for coverage.data"""
55

6+
from __future__ import annotations
7+
68
import glob
79
import os
810
import os.path

tests/test_debug.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests of coverage/debug.py"""
55

6+
from __future__ import annotations
7+
68
import ast
79
import io
810
import os

tests/test_execfile.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for coverage.execfile"""
55

6+
from __future__ import annotations
7+
68
import compileall
79
import json
810
import os

tests/test_filereporter.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for FileReporters"""
55

6+
from __future__ import annotations
7+
68
import sys
79

810
from coverage.plugin import FileReporter

tests/test_files.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for files.py"""
55

6+
from __future__ import annotations
7+
68
import itertools
79
import os
810
import os.path

tests/test_html.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests that HTML generation is awesome."""
55

6+
from __future__ import annotations
7+
68
import collections
79
import datetime
810
import glob

tests/test_misc.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests of miscellaneous stuff."""
55

6+
from __future__ import annotations
7+
68
import sys
79

810
import pytest

tests/test_python.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests of coverage/python.py"""
55

6+
from __future__ import annotations
7+
68
import pathlib
79
import sys
810

tests/test_summary.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Test text-based summary reporting for coverage.py"""
55

6+
from __future__ import annotations
7+
68
import glob
79
import io
810
import math

tests/test_xml.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
"""Tests for XML reports from coverage.py."""
55

6+
from __future__ import annotations
7+
68
import os
79
import os.path
810
import re

0 commit comments

Comments
 (0)