From 1958cb62f4de7492fb154323f3fdb7a0b6b51fa7 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 14 Jul 2023 20:18:54 +0200 Subject: [PATCH] Remove `--py2` argument (#15670) --- mypy/defaults.py | 2 -- mypy/main.py | 8 -------- mypy/test/helpers.py | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/mypy/defaults.py b/mypy/defaults.py index 2a881975a27c..1bd87de74bc9 100644 --- a/mypy/defaults.py +++ b/mypy/defaults.py @@ -3,8 +3,6 @@ import os from typing import Final -PYTHON2_VERSION: Final = (2, 7) - # Earliest fully supported Python 3.x version. Used as the default Python # version in tests. Mypy wheels should be built starting with this version, # and CI tests should be run on this version (and later versions). diff --git a/mypy/main.py b/mypy/main.py index f6e617e4d84f..6173fd6fc1a8 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -594,14 +594,6 @@ def add_invertible_flag( help="Type check code assuming it will be running on Python x.y", dest="special-opts:python_version", ) - platform_group.add_argument( - "-2", - "--py2", - dest="special-opts:python_version", - action="store_const", - const=defaults.PYTHON2_VERSION, - help="Use Python 2 mode (same as --python-version 2.7)", - ) platform_group.add_argument( "--platform", action="store", diff --git a/mypy/test/helpers.py b/mypy/test/helpers.py index d2c92614048a..d1850219e60a 100644 --- a/mypy/test/helpers.py +++ b/mypy/test/helpers.py @@ -345,7 +345,7 @@ def parse_options( options.force_union_syntax = True # Allow custom python version to override testfile_pyversion. - if all(flag.split("=")[0] not in ["--python-version", "-2", "--py2"] for flag in flag_list): + if all(flag.split("=")[0] != "--python-version" for flag in flag_list): options.python_version = testfile_pyversion(testcase.file) if testcase.config.getoption("--mypy-verbose"):