Skip to content

Commit afdafb6

Browse files
authored
Remove some unused functions. (python#18049)
This PR just removes some functions that are unused (from what I can tell).
1 parent 55b5aed commit afdafb6

File tree

6 files changed

+0
-66
lines changed

6 files changed

+0
-66
lines changed

mypy/traverser.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -958,9 +958,3 @@ def visit_assignment_stmt(self, stmt: AssignmentStmt) -> None:
958958

959959
def visit_yield_from_expr(self, expr: YieldFromExpr) -> None:
960960
self.yield_from_expressions.append((expr, self.in_assignment))
961-
962-
963-
def all_yield_from_expressions(node: Node) -> list[tuple[YieldFromExpr, bool]]:
964-
v = YieldFromCollector()
965-
node.accept(v)
966-
return v.yield_from_expressions

mypy/typeanal.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,15 +2276,6 @@ def set_any_tvars(
22762276
return t
22772277

22782278

2279-
def flatten_tvars(lists: list[list[T]]) -> list[T]:
2280-
result: list[T] = []
2281-
for lst in lists:
2282-
for item in lst:
2283-
if item not in result:
2284-
result.append(item)
2285-
return result
2286-
2287-
22882279
class DivergingAliasDetector(TrivialSyntheticTypeTranslator):
22892280
"""See docstring of detect_diverging_alias() for details."""
22902281

mypy/typevartuples.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
from mypy.types import (
88
AnyType,
99
Instance,
10-
ProperType,
1110
Type,
1211
TypeVarLikeType,
1312
TypeVarTupleType,
1413
UnpackType,
15-
get_proper_type,
1614
split_with_prefix_and_suffix,
1715
)
1816

@@ -27,14 +25,6 @@ def split_with_instance(
2725
)
2826

2927

30-
def extract_unpack(types: Sequence[Type]) -> ProperType | None:
31-
"""Given a list of types, extracts either a single type from an unpack, or returns None."""
32-
if len(types) == 1:
33-
if isinstance(types[0], UnpackType):
34-
return get_proper_type(types[0].type)
35-
return None
36-
37-
3828
def erased_vars(type_vars: Sequence[TypeVarLikeType], type_of_any: int) -> list[Type]:
3929
args: list[Type] = []
4030
for tv in type_vars:

mypyc/analysis/dataflow.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from abc import abstractmethod
66
from typing import Dict, Generic, Iterable, Iterator, Set, Tuple, TypeVar
77

8-
from mypyc.ir.func_ir import all_values
98
from mypyc.ir.ops import (
109
Assign,
1110
AssignMulti,
@@ -437,27 +436,6 @@ def visit_set_mem(self, op: SetMem) -> GenAndKill[Value]:
437436
return set(), set()
438437

439438

440-
def analyze_undefined_regs(
441-
blocks: list[BasicBlock], cfg: CFG, initial_defined: set[Value]
442-
) -> AnalysisResult[Value]:
443-
"""Calculate potentially undefined registers at each CFG location.
444-
445-
A register is undefined if there is some path from initial block
446-
where it has an undefined value.
447-
448-
Function arguments are assumed to be always defined.
449-
"""
450-
initial_undefined = set(all_values([], blocks)) - initial_defined
451-
return run_analysis(
452-
blocks=blocks,
453-
cfg=cfg,
454-
gen_and_kill=UndefinedVisitor(),
455-
initial=initial_undefined,
456-
backward=False,
457-
kind=MAYBE_ANALYSIS,
458-
)
459-
460-
461439
def non_trivial_sources(op: Op) -> set[Value]:
462440
result = set()
463441
for source in op.sources():

mypyc/codegen/emitmodule.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
use_vectorcall,
4848
)
4949
from mypyc.errors import Errors
50-
from mypyc.ir.class_ir import ClassIR
5150
from mypyc.ir.func_ir import FuncIR
5251
from mypyc.ir.module_ir import ModuleIR, ModuleIRs, deserialize_modules
5352
from mypyc.ir.ops import DeserMaps, LoadLiteral
@@ -1075,20 +1074,6 @@ def declare_type_vars(self, module: str, type_var_names: list[str], emitter: Emi
10751074
)
10761075

10771076

1078-
def sort_classes(classes: list[tuple[str, ClassIR]]) -> list[tuple[str, ClassIR]]:
1079-
mod_name = {ir: name for name, ir in classes}
1080-
irs = [ir for _, ir in classes]
1081-
deps: dict[ClassIR, set[ClassIR]] = {}
1082-
for ir in irs:
1083-
if ir not in deps:
1084-
deps[ir] = set()
1085-
if ir.base:
1086-
deps[ir].add(ir.base)
1087-
deps[ir].update(ir.traits)
1088-
sorted_irs = toposort(deps)
1089-
return [(mod_name[ir], ir) for ir in sorted_irs]
1090-
1091-
10921077
T = TypeVar("T")
10931078

10941079

mypyc/irbuild/function.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,10 +990,6 @@ def singledispatch_main_func_name(orig_name: str) -> str:
990990
return f"__mypyc_singledispatch_main_function_{orig_name}__"
991991

992992

993-
def get_registry_identifier(fitem: FuncDef) -> str:
994-
return f"__mypyc_singledispatch_registry_{fitem.fullname}__"
995-
996-
997993
def maybe_insert_into_registry_dict(builder: IRBuilder, fitem: FuncDef) -> None:
998994
line = fitem.line
999995
is_singledispatch_main_func = fitem in builder.singledispatch_impls

0 commit comments

Comments
 (0)