Conversation
…thout needing past.builtins
Member
Author
|
Anyone care about this? There no real code changes here, so if no one objects, I'll merge Friday. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a bit of a "spring cleaning" PR.
I've come to realize that our python usage has very few bits that require the future module, so I'm inclined to remove it as a dependency. Here are the places where we are currently using
futureand my proposed (via this PR) changes:basestring: I found a cute way to define basestring that works in both 2 and 3:basestring = ("".__class__, u"".__class__, b"".__class__). This capturesstr,unicodeandbytesproperly on both. I put this in utilities.py and import from there when we want it.exec_: Turns out the python 3 version ofexecworks just fine in python 2.7. I think thefuture.exec_workaround must have been for python 2.6, which we don't support anymore. So I just switched exec_ -> exec, and it works fine.iteritems,itervalues,iterkeys: These have only ever been an efficiency difference between python 2 and 3, and a minuscule one for all of our uses. So I just switched them all to the regularitems,values,keys.range,zip: Similarly, the difference was just (slight) efficiency. Just use the regular ones in both now.object: I'm pretty sure this was already not needed. I thinkobjectin 2.7 is already the python 3 version.int: Our usage didn't care about the differences in functionality here, so I just use the nativeintin both and it's fine.input: In python 2, this was calledraw_input. Easy to handle with a try/except NameError. Just used in galsim_download_cosmos.py.super: Python 2 doesn't have the no-argument version. It's a little bit of extra typing, but I converted our uses of that to the more verbose one that works in both 2 and 3. This was only being used in errors.py.