Skip to content

Commit a65d870

Browse files
committed
Remove unrelated changes
1 parent c32f604 commit a65d870

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

mypy/expandtype.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,10 @@ def visit_type_alias_type(self, t: TypeAliasType) -> Type:
526526
return t.copy_modified(args=self.expand_types(t.args))
527527

528528
def expand_types(self, types: Iterable[Type]) -> list[Type]:
529-
return [t.accept(self) for t in types]
529+
a: list[Type] = []
530+
for t in types:
531+
a.append(t.accept(self))
532+
return a
530533

531534
def visit_type_list(self, t: TypeList) -> Type:
532535
return t

mypy/server/update.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@
161161
from mypy.server.deps import get_dependencies_of_target, merge_dependencies
162162
from mypy.server.target import trigger_to_target
163163
from mypy.server.trigger import WILDCARD_TAG, make_trigger
164-
from mypy.typeanal import remove_dups
165164
from mypy.typestate import type_state
166165
from mypy.util import module_prefix, split_target
167166

@@ -245,7 +244,7 @@ def update(
245244

246245
self.triggered = []
247246
self.updated_modules = []
248-
changed_modules = remove_dups(changed_modules + self.stale)
247+
changed_modules = dedupe_modules(changed_modules + self.stale)
249248
initial_set = {id for id, _ in changed_modules}
250249
self.manager.log_fine_grained(
251250
"==== update %s ====" % ", ".join(repr(id) for id, _ in changed_modules)
@@ -260,7 +259,7 @@ def update(
260259
# Handle blocking errors first. We'll exit as soon as we find a
261260
# module that still has blocking errors.
262261
self.manager.log_fine_grained(f"existing blocker: {self.blocking_error[0]}")
263-
changed_modules = remove_dups([self.blocking_error] + changed_modules)
262+
changed_modules = dedupe_modules([self.blocking_error] + changed_modules)
264263
blocking_error = self.blocking_error[0]
265264
self.blocking_error = None
266265

@@ -295,7 +294,7 @@ def update(
295294
self.previous_targets_with_errors,
296295
self.processed_targets,
297296
)
298-
changed_modules = remove_dups(changed_modules)
297+
changed_modules = dedupe_modules(changed_modules)
299298
if not changed_modules:
300299
# Preserve state needed for the next update.
301300
self.previous_targets_with_errors = self.manager.errors.targets()
@@ -370,7 +369,7 @@ def update_one(
370369
result = self.update_module(next_id, next_path, next_id in removed_set, followed)
371370
remaining, (next_id, next_path), blocker_messages = result
372371
changed_modules = [(id, path) for id, path in changed_modules if id != next_id]
373-
changed_modules = remove_dups(remaining + changed_modules)
372+
changed_modules = dedupe_modules(remaining + changed_modules)
374373
t1 = time.time()
375374

376375
self.manager.log_fine_grained(
@@ -727,6 +726,16 @@ def delete_module(module_id: str, path: str, graph: Graph, manager: BuildManager
727726
manager.missing_modules.add(module_id)
728727

729728

729+
def dedupe_modules(modules: list[tuple[str, str]]) -> list[tuple[str, str]]:
730+
seen: set[str] = set()
731+
result = []
732+
for id, path in modules:
733+
if id not in seen:
734+
seen.add(id)
735+
result.append((id, path))
736+
return result
737+
738+
730739
def get_module_to_path_map(graph: Graph) -> dict[str, str]:
731740
return {module: node.xpath for module, node in graph.items()}
732741

mypy/suggestions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def suggest_callsites(self, function: str) -> str:
278278
callsites, _ = self.get_callsites(node)
279279

280280
return "\n".join(
281-
dict.fromkeys(
281+
dedup(
282282
[
283283
f"{path}:{line}: {self.format_args(arg_kinds, arg_names, arg_types)}"
284284
for path, line, arg_kinds, _, arg_names, arg_types in callsites

mypy/typeanal.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,13 @@ def remove_dups(tvars: list[T]) -> list[T]:
18281828
if len(tvars) <= 1:
18291829
return tvars
18301830
# Get unique elements in order of appearance
1831-
return list(dict.fromkeys(tvars))
1831+
all_tvars: set[T] = set()
1832+
new_tvars: list[T] = []
1833+
for t in tvars:
1834+
if t not in all_tvars:
1835+
new_tvars.append(t)
1836+
all_tvars.add(t)
1837+
return new_tvars
18321838

18331839

18341840
def flatten_tvars(lists: list[list[T]]) -> list[T]:

0 commit comments

Comments
 (0)