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

Change OrderedDict to dict #2351

Merged
merged 4 commits into from Sep 9, 2019

Conversation

@cdeil
Copy link
Member

commented Sep 9, 2019

This PR changes all code in Gammapy from OrderedDict to dict, since we now require Python 3.6 or later and there dict is ordered. See #2349.

I noticed that there were a few init methods where we did self.meta = OrderedDict(meta) if meta else OrderedDict(). I changed those to self.meta = meta. Before always a copy was made, now the object is just stored, no copy. That's consistent with how Table or most other code in Astropy, Gammapy, ... works, to not make copies of things passed to __init__. All tests pass, but there could be users that relied on the copy being made. I don't think we should make copies, I just wanted to note that point if someone reports an issue after updating to v0.14.

Another cleanup I'm doing here is to use more dict literals, i.e. {...}. We still have a mix within Gammapy, but generally that's the preferred style (by me, but also by default by PyCharm and other style tools, they suggest to change to {...} where possible). It's a really minor style point, no need to completely clean up now.

@cdeil cdeil added the cleanup label Sep 9, 2019
@cdeil cdeil added this to the 0.14 milestone Sep 9, 2019
@cdeil cdeil self-assigned this Sep 9, 2019
@cdeil cdeil merged commit b481b1e into gammapy:master Sep 9, 2019
0 of 9 checks passed
0 of 9 checks passed
gammapy.gammapy (DevDocs) DevDocs failed
Details
gammapy.gammapy (Lint) Lint failed
Details
gammapy.gammapy (Test Python36) Test Python36 failed
Details
gammapy.gammapy (Test Windows36) Test Windows36 failed
Details
gammapy.gammapy (Test Windows37) Test Windows37 failed
Details
gammapy.gammapy
Details
Codacy/PR Quality Review Hang in there, Codacy is reviewing your Pull request.
Details
Scrutinizer Installing Code
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.