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

six: ensure_str / ensure_binary / ensure_text of a literal string #236

Closed
asottile opened this issue Jan 6, 2020 · 6 comments
Closed

six: ensure_str / ensure_binary / ensure_text of a literal string #236

asottile opened this issue Jan 6, 2020 · 6 comments

Comments

@asottile
Copy link
Owner

@asottile asottile commented Jan 6, 2020

while we generally can't fix the ensure_* variants, we can for string literals (as we're already doing for str('...') for example)

@asottile asottile changed the title six: ensure_str / ensure_bytes / ensure_text of a literal string six: ensure_str / ensure_binary / ensure_text of a literal string Jan 8, 2020
@asottile asottile closed this in #243 Jan 8, 2020
@thisch
Copy link

@thisch thisch commented Jan 22, 2020

Would it be possible to add support for ensure_* removal if pyupgrade could infer the type of the parameter passed to ensure_*?

@asottile
Copy link
Owner Author

@asottile asottile commented Jan 22, 2020

pyupgrade doesn't do any type inference beyond literals -- it's a hard problem

@thisch
Copy link

@thisch thisch commented Jan 22, 2020

too bad! Thx for the quick answer! And using a different library for that, e.g. pylint/mypy,.., that can infer types, is probably still hard, right?

@asottile
Copy link
Owner Author

@asottile asottile commented Jan 22, 2020

neither mypy nor pylint expose their type inference as a library -- plus they're both dog-slow

@thisch
Copy link

@thisch thisch commented Jan 22, 2020

Didn't know that they don't expose their type inference as a lib. IMO the fact that they are slow is not a disqualifier.

@asottile
Copy link
Owner Author

@asottile asottile commented Jan 22, 2020

ok well it is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.