From b394ca50d18be482bfd43418f0d3176bcc99cd29 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 5 May 2022 18:19:24 -0700 Subject: [PATCH] remove str.encode and bytes.decode impls They only add allow_call, and calling these doesn't seem particularly useful. --- pyanalyze/implementation.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/pyanalyze/implementation.py b/pyanalyze/implementation.py index dfb11609..30474ada 100644 --- a/pyanalyze/implementation.py +++ b/pyanalyze/implementation.py @@ -1318,9 +1318,6 @@ def _bool_impl(ctx: CallContext) -> Value: _POS_ONLY = ParameterKind.POSITIONAL_ONLY -_ENCODING_PARAMETER = SigParameter( - "encoding", annotation=TypedValue(str), default=KnownValue("") -) T = TypeVar("T") K = TypeVar("K") @@ -1628,30 +1625,6 @@ def get_default_argspecs() -> Dict[object, Signature]: callable=collections.OrderedDict.items, impl=_dict_items_impl, ), - Signature.make( - [ - SigParameter("self", _POS_ONLY, annotation=TypedValue(bytes)), - _ENCODING_PARAMETER, - SigParameter( - "errors", annotation=TypedValue(str), default=KnownValue("") - ), - ], - TypedValue(str), - callable=bytes.decode, - allow_call=True, - ), - Signature.make( - [ - SigParameter("self", _POS_ONLY, annotation=TypedValue(str)), - _ENCODING_PARAMETER, - SigParameter( - "errors", annotation=TypedValue(str), default=KnownValue("") - ), - ], - TypedValue(bytes), - callable=str.encode, - allow_call=True, - ), Signature.make( [ SigParameter("self", _POS_ONLY, annotation=TypedValue(str)), @@ -1751,7 +1724,6 @@ def get_default_argspecs() -> Dict[object, Signature]: except AttributeError: pass else: - # Anticipating https://bugs.python.org/issue46414 sig = Signature.make( [SigParameter("value", _POS_ONLY, annotation=TypeVarValue(T))], TypeVarValue(T), @@ -1759,7 +1731,6 @@ def get_default_argspecs() -> Dict[object, Signature]: callable=reveal_type_func, ) signatures.append(sig) - # Anticipating that this will be added to the stdlib try: assert_type_func = getattr(mod, "assert_type") except AttributeError: