Improve a few mypy type annotations

This commit is contained in:
Anthony Sottile 2019-02-16 18:36:14 -08:00
parent 684ffb3306
commit c71fadb18c
3 changed files with 8 additions and 7 deletions

View file

@ -5,7 +5,7 @@ import logging
import signal import signal
import sys import sys
import tokenize import tokenize
from typing import List, Optional from typing import List, Optional, Tuple
try: try:
import multiprocessing import multiprocessing
@ -247,7 +247,7 @@ class Manager(object):
LOG.info("Checking %d files", len(self.checkers)) LOG.info("Checking %d files", len(self.checkers))
def report(self): def report(self):
# type: () -> (int, int) # type: () -> Tuple[int, int]
"""Report all of the errors found in the managed file checkers. """Report all of the errors found in the managed file checkers.
This iterates over each of the checkers and reports the errors sorted This iterates over each of the checkers and reports the errors sorted

View file

@ -4,7 +4,7 @@ from __future__ import print_function
import logging import logging
import sys import sys
import time import time
from typing import List, Optional, Sequence from typing import List, Optional
import flake8 import flake8
from flake8 import checker from flake8 import checker
@ -99,6 +99,7 @@ class Application(object):
self.parsed_diff = {} self.parsed_diff = {}
def parse_preliminary_options_and_args(self, argv=None): def parse_preliminary_options_and_args(self, argv=None):
# type: (Optional[List[str]]) -> None
"""Get preliminary options and args from CLI, pre-plugin-loading. """Get preliminary options and args from CLI, pre-plugin-loading.
We need to know the values of a few standard options and args now, so We need to know the values of a few standard options and args now, so
@ -347,7 +348,7 @@ class Application(object):
self.formatter.show_statistics(self.guide.stats) self.formatter.show_statistics(self.guide.stats)
def initialize(self, argv): def initialize(self, argv):
# type: (Sequence[str]) -> None # type: (Optional[List[str]]) -> None
"""Initialize the application to be run. """Initialize the application to be run.
This finds the plugins, registers their options, and parses the This finds the plugins, registers their options, and parses the

View file

@ -8,8 +8,8 @@ import platform
import re import re
import sys import sys
import tokenize import tokenize
from typing import Callable, Dict, Generator, List, Pattern, Sequence, Tuple from typing import Callable, Dict, Generator, List, Pattern, Sequence, Set
from typing import Union from typing import Tuple, Union
from flake8 import exceptions from flake8 import exceptions
@ -217,7 +217,7 @@ def stdin_get_value():
def parse_unified_diff(diff=None): def parse_unified_diff(diff=None):
# type: (str) -> List[str] # type: (str) -> Dict[str, Set[int]]
"""Parse the unified diff passed on stdin. """Parse the unified diff passed on stdin.
:returns: :returns: