From 8d9d071e2de95d131fd9411e15eb67cc15d47b0e Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 31 Mar 2025 09:35:40 -0700 Subject: [PATCH 1/3] typing: Remove an unused function Leftover from #105511 I believe. GitHub code search found no usages other than copies of typing.py and lists of stdlib functions. --- Lib/typing.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Lib/typing.py b/Lib/typing.py index e36da7e9f48b71..4b168079799bfc 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -363,18 +363,6 @@ def _deduplicate_unhashable(unhashable_params): new_unhashable.append(t) return new_unhashable -def _compare_args_orderless(first_args, second_args): - first_unhashable = _deduplicate_unhashable(first_args) - second_unhashable = _deduplicate_unhashable(second_args) - t = list(second_unhashable) - try: - for elem in first_unhashable: - t.remove(elem) - except ValueError: - return False - return not t - - def _flatten_literal_params(parameters): """Internal helper for Literal creation: flatten Literals among parameters.""" params = [] From 7c0dd9901a94d28aa41e6b4d0b108d7dcf78130a Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 31 Mar 2025 09:46:08 -0700 Subject: [PATCH 2/3] inline --- Lib/typing.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Lib/typing.py b/Lib/typing.py index 4b168079799bfc..1877121b5efa50 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -354,14 +354,11 @@ def _deduplicate(params, *, unhashable_fallback=False): if not unhashable_fallback: raise # Happens for cases like `Annotated[dict, {'x': IntValidator()}]` - return _deduplicate_unhashable(params) - -def _deduplicate_unhashable(unhashable_params): - new_unhashable = [] - for t in unhashable_params: - if t not in new_unhashable: - new_unhashable.append(t) - return new_unhashable + new_unhashable = [] + for t in params: + if t not in new_unhashable: + new_unhashable.append(t) + return new_unhashable def _flatten_literal_params(parameters): """Internal helper for Literal creation: flatten Literals among parameters.""" From a6885f7c66afdf39bd474a1eab02f5b3cadd95b8 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 31 Mar 2025 09:51:04 -0700 Subject: [PATCH 3/3] unused imports --- Lib/typing.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Lib/typing.py b/Lib/typing.py index 1877121b5efa50..f7528258f43453 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -29,12 +29,7 @@ import operator import sys import types -from types import ( - WrapperDescriptorType, - MethodWrapperType, - MethodDescriptorType, - GenericAlias, -) +from types import GenericAlias import warnings from _typing import (