Skip to content

Commit

Permalink
add per-file disallow_untyped_defs=False, and set it to True globally
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurnikov committed Sep 28, 2019
1 parent d27488d commit 79b0e15
Show file tree
Hide file tree
Showing 68 changed files with 177 additions and 0 deletions.
3 changes: 3 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Release time helpers, executed using nox.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import io
import subprocess

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ignore = W504
[mypy]
follow_imports = silent
ignore_missing_imports = True
disallow_untyped_defs = True

[mypy-pip/_vendor/*]
follow_imports = skip
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import codecs
import os
import re
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

import logging
import os
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/cli/autocompletion.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Logic that powers autocompletion installed by ``pip completion``.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import optparse
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/cli/command_context.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from contextlib import contextmanager

from pip._vendor.contextlib2 import ExitStack
Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/cli/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"""Base option parser setup"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import logging
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
PackageFinder machinery and all its vendored dependencies, etc.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import os
from functools import partial

Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
The main purpose of this module is to expose LinkCollector.collect_links().
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import cgi
import itertools
import logging
Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""
Package containing all pip commands
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import importlib
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/check.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import logging

from pip._internal.cli.base_command import Command
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/completion.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import sys
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/configuration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import logging
import os
import subprocess
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/debug.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import locale
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/download.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import logging
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/freeze.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import sys
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/hash.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import hashlib
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/help.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

from pip._internal.cli.base_command import Command
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# couple errors where we have to know req.name is str rather than
# Optional[str] for the InstallRequirement req.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/list.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import json
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/search.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import logging
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/show.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import logging
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/commands/uninstall.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

from pip._vendor.packaging.utils import canonicalize_name
Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/commands/wheel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import logging
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

import locale
import logging
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/distributions/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import abc

from pip._vendor.six import add_metaclass
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/distributions/installed.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from pip._internal.distributions.base import AbstractDistribution


Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/distributions/source/legacy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import logging

from pip._internal.build_env import BuildEnvironment
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/distributions/wheel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from pip._vendor import pkg_resources

from pip._internal.distributions.base import AbstractDistribution
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/download.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import cgi
Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"""Exceptions used throughout package"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

from itertools import chain, groupby, repeat
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/legacy_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

import logging
import sys
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Primary application entrypoint.
"""
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import locale
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/models/candidate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from pip._vendor.packaging.version import parse as parse_version

from pip._internal.utils.models import KeyBasedCompareMixin
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/models/format_control.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

from pip._vendor.packaging.utils import canonicalize_name

Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/models/link.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import os
import posixpath
import re
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/models/search_scope.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import itertools
import logging
import os
Expand Down
3 changes: 3 additions & 0 deletions src/pip/_internal/network/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
providing credentials in the context of network requests.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import logging

from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth
Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/network/cache.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"""HTTP cache implementation.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import os
from contextlib import contextmanager

Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/network/session.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""PipSession and supporting code, containing all pip-specific
network request configuration and behavior.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import email.utils
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/operations/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

import logging
from collections import namedtuple
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/operations/freeze.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/req/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/utils/appdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
This code was taken from https://github.com/ActiveState/appdirs and modified
to suit our purposes.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

from __future__ import absolute_import

import os
Expand Down
Loading

0 comments on commit 79b0e15

Please sign in to comment.