import operator
import sys
import types
-from types import (
- WrapperDescriptorType,
- MethodWrapperType,
- MethodDescriptorType,
- GenericAlias,
-)
+from types import GenericAlias
import warnings
from _typing import (
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
-
-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
-
+ 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."""