Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove str.encode and bytes.decode impls #536

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions pyanalyze/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -1751,15 +1724,13 @@ 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),
impl=_reveal_type_impl,
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:
Expand Down