Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b922266

Browse files
authored
Kill --quick-and-dirty (#6078)
It has been deprecated for two mypy releases. Users should really use dmypy instead. Closes #5728.
1 parent d2a9f9d commit b922266

9 files changed

Lines changed: 8 additions & 771 deletions

File tree

docs/source/command_line.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -451,23 +451,6 @@ beyond what incremental mode can offer, try running mypy in
451451
By default, mypy will ignore cache data generated by a different
452452
version of mypy. This flag disables that behavior.
453453

454-
.. _quick-mode:
455-
456-
``--quick-and-dirty``
457-
This flag enables a **deprecated**, unsafe variant of incremental mode.
458-
Quick mode is faster than regular incremental mode because it only
459-
re-checks modules that were modified since their cache file was
460-
last written: regular incremental mode also re-checks all modules
461-
that depend on one or more modules that were re-checked.
462-
463-
Quick mode is unsafe because it may miss problems caused by a change
464-
in a dependency. Quick mode updates the cache, but regular incremental
465-
mode ignores cache files written by quick mode.
466-
467-
We recommend that you try using the :ref:`mypy_daemon` before
468-
attempting to use this feature.
469-
Quick mode is deprecated and will soon be removed.
470-
471454
.. _advanced-flags:
472455

473456
Advanced flags

docs/source/config_file.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,6 @@ section of the command line docs.
369369
Makes mypy use incremental cache data even if it was generated by a
370370
different version of mypy. (By default, mypy will perform a version
371371
check and regenerate the cache if it was written by older versions of mypy.)
372-
373-
``quick_and_dirty`` (bool, default False)
374-
Enables :ref:`quick mode <quick-mode>`. **Deprecated.**
375372

376373

377374
Configuring error messages

docs/source/extending_mypy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ During different phases of analyzing the code (first in semantic analysis,
114114
and then in type checking) mypy calls plugin methods such as
115115
``get_type_analyze_hook()`` on user plugins. This particular method for example
116116
can return a callback that mypy will use to analyze unbound types with given
117-
full name. See full plugin hook methods list :ref:`below <plugin-hooks>`.
117+
full name. See full plugin hook methods list :ref:`below <plugin_hooks>`.
118118

119119
Mypy maintains a list of plugins it gets from the config file plus the default
120120
(built-in) plugin that is always enabled. Mypy calls a method once for each

mypy/build.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -898,9 +898,6 @@ def find_cache_meta(id: str, path: str, manager: BuildManager) -> Optional[Cache
898898
# Note that it's fine to mutilate cached_options since it's only used here.
899899
cached_options = m.options
900900
current_options = manager.options.clone_for_module(id).select_options_affecting_cache()
901-
if manager.options.quick_and_dirty:
902-
# In quick_and_dirty mode allow non-quick_and_dirty cache files.
903-
cached_options['quick_and_dirty'] = True
904901
if manager.options.skip_version_check:
905902
# When we're lax about version we're also lax about platform.
906903
cached_options['platform'] = current_options['platform']
@@ -1598,7 +1595,6 @@ def fix_cross_refs(self) -> None:
15981595
# We need to set quick_and_dirty when doing a fine grained
15991596
# cache load because we need to gracefully handle missing modules.
16001597
fixup_module(self.tree, self.manager.modules,
1601-
self.manager.options.quick_and_dirty or
16021598
self.options.use_fine_grained_cache)
16031599

16041600
def patch_dependency_parents(self) -> None:
@@ -1866,10 +1862,7 @@ def write_cache(self) -> None:
18661862
or self.options.cache_dir == os.devnull
18671863
or self.options.fine_grained_incremental):
18681864
return
1869-
if self.manager.options.quick_and_dirty:
1870-
is_errors = self.manager.errors.is_errors_for_file(self.path)
1871-
else:
1872-
is_errors = self.transitive_error
1865+
is_errors = self.transitive_error
18731866
if is_errors:
18741867
delete_cache(self.id, self.path, self.manager)
18751868
self.meta = None
@@ -2431,8 +2424,7 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
24312424
deps.update(graph[id].dependencies)
24322425
deps -= ascc
24332426
stale_deps = {id for id in deps if id in graph and not graph[id].is_interface_fresh()}
2434-
if not manager.options.quick_and_dirty:
2435-
fresh = fresh and not stale_deps
2427+
fresh = fresh and not stale_deps
24362428
undeps = set()
24372429
if fresh:
24382430
# Check if any dependencies that were suppressed according
@@ -2466,9 +2458,7 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
24662458
manager.trace(" %5s %.0f %s" % (key, graph[id].xmeta.data_mtime, id))
24672459
# If equal, give the benefit of the doubt, due to 1-sec time granularity
24682460
# (on some platforms).
2469-
if manager.options.quick_and_dirty and stale_deps:
2470-
fresh_msg = "fresh(ish)"
2471-
elif oldest_in_scc < newest_in_deps:
2461+
if oldest_in_scc < newest_in_deps:
24722462
fresh = False
24732463
fresh_msg = "out of date by %.0f seconds" % (newest_in_deps - oldest_in_scc)
24742464
else:
@@ -2608,19 +2598,7 @@ def process_stale_scc(graph: Graph, scc: List[str], manager: BuildManager) -> No
26082598
26092599
Exception: If quick_and_dirty is set, use the cache for fresh modules.
26102600
"""
2611-
if manager.options.quick_and_dirty:
2612-
fresh = [id for id in scc if graph[id].is_fresh()]
2613-
fresh_set = set(fresh) # To avoid running into O(N**2)
2614-
stale = [id for id in scc if id not in fresh_set]
2615-
if fresh:
2616-
manager.log(" Fresh ids: %s" % (", ".join(fresh)))
2617-
if stale:
2618-
manager.log(" Stale ids: %s" % (", ".join(stale)))
2619-
else:
2620-
fresh = []
2621-
stale = scc
2622-
for id in fresh:
2623-
graph[id].load_tree()
2601+
stale = scc
26242602
for id in stale:
26252603
# We may already have parsed the module, or not.
26262604
# If the former, parse_file() is a no-op.
@@ -2633,8 +2611,6 @@ def process_stale_scc(graph: Graph, scc: List[str], manager: BuildManager) -> No
26332611
typing_mod = graph['typing'].tree
26342612
assert typing_mod, "The typing module was not parsed"
26352613
manager.semantic_analyzer.add_builtin_aliases(typing_mod)
2636-
for id in fresh:
2637-
graph[id].fix_cross_refs()
26382614
for id in stale:
26392615
graph[id].semantic_analysis()
26402616
for id in stale:

mypy/dmypy_server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ def process_start_options(flags: List[str], allow_sources: bool) -> Options:
144144
"pass it to check/recheck instead")
145145
if not options.incremental:
146146
sys.exit("dmypy: start/restart should not disable incremental mode")
147-
if options.quick_and_dirty:
148-
sys.exit("dmypy: start/restart should not specify quick_and_dirty mode")
149147
# Our file change tracking can't yet handle changes to files that aren't
150148
# specified in the sources list.
151149
if options.follow_imports not in ('skip', 'error'):

mypy/main.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,6 @@ def add_invertible_flag(flag: str,
670670
parser.add_argument('--cache-map', nargs='+', dest='special-opts:cache_map',
671671
help=argparse.SUPPRESS)
672672

673-
# deprecated options
674-
parser.add_argument('--quick-and-dirty', action='store_true',
675-
help=argparse.SUPPRESS)
676-
677673
# options specifying code to check
678674
code_group = parser.add_argument_group(
679675
title="Running code",
@@ -719,11 +715,6 @@ def add_invertible_flag(flag: str,
719715
special_opts = argparse.Namespace()
720716
parser.parse_args(args, SplitNamespace(options, special_opts, 'special-opts:'))
721717

722-
# Process deprecated options
723-
if options.quick_and_dirty:
724-
print("Warning: --quick-and-dirty is deprecated. It will disappear in the next release.",
725-
file=sys.stderr)
726-
727718
# The python_version is either the default, which can be overridden via a config file,
728719
# or stored in special_opts and is passed via the command line.
729720
options.python_version = special_opts.python_version or options.python_version
@@ -781,10 +772,6 @@ def add_invertible_flag(flag: str,
781772

782773
process_cache_map(parser, special_opts, options)
783774

784-
# Let quick_and_dirty imply incremental.
785-
if options.quick_and_dirty:
786-
options.incremental = True
787-
788775
# Let logical_deps imply cache_fine_grained (otherwise the former is useless).
789776
if options.logical_deps:
790777
options.cache_fine_grained = True

mypy/options.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class BuildType:
5151
} # type: Final
5252

5353
OPTIONS_AFFECTING_CACHE = ((PER_MODULE_OPTIONS |
54-
{"quick_and_dirty", "platform", "bazel", "plugins"})
54+
{"platform", "bazel", "plugins"})
5555
- {"debug_cache"}) # type: Final
5656

5757

@@ -169,7 +169,6 @@ def __init__(self) -> None:
169169
self.cache_dir = defaults.CACHE_DIR
170170
self.sqlite_cache = False
171171
self.debug_cache = False
172-
self.quick_and_dirty = False
173172
self.skip_version_check = False
174173
self.fine_grained_incremental = False
175174
# Include fine-grained dependencies in written cache files

mypy/test/testcheck.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,8 @@ def verify_cache(self, module_data: List[Tuple[str, str, str]], a: List[str],
221221
# for those that had an error in themselves or one of their
222222
# dependencies.
223223
error_paths = self.find_error_message_paths(a)
224-
if manager.options.quick_and_dirty:
225-
busted_paths = error_paths
226-
else:
227-
busted_paths = {m.path for id, m in manager.modules.items()
228-
if graph[id].transitive_error}
224+
busted_paths = {m.path for id, m in manager.modules.items()
225+
if graph[id].transitive_error}
229226
modules = self.find_module_files(manager)
230227
modules.update({module_name: path for module_name, path, text in module_data})
231228
missing_paths = self.find_missing_cache_files(modules, manager)

0 commit comments

Comments
 (0)