Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Replaced OrderedDict with dict #1132

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

Merged
n2ygk merged 8 commits into django-json-api:main from sliverc:order
Feb 22, 2023
Merged

Replaced OrderedDict with dict #1132

n2ygk merged 8 commits into django-json-api:main from sliverc:order
Feb 22, 2023

Conversation

Copy link
Member

@sliverc sliverc commented Feb 21, 2023
edited
Loading

Fixes #1094

Description of the Change

As Python 3.7+ now ensures that dicts are ordered, there is no need to use OrderedDict anymore.

See in-depth explanation at #1094 (comment)

Using regular dicts also make the code more readable and easier debuggable.

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

@sliverc sliverc mentioned this pull request Feb 21, 2023
5 tasks
Copy link
Member Author

sliverc commented Feb 21, 2023

Removing OrderedDict is not an urgent task, however it makes the code more readable at a few instances. So I would love to remove it, but really want to avoid regressions. Codecov shows that there are a couple of code paths which I needed to change, which actually do not have any test coverage.

I would see three ways forward:

  1. wait till Convert all tests to pytest #468 is completed
  2. add test for those missing paths in this PR (could be cumbersome)
  3. Force merge it as test coverage actually does not change. We would have to be fairly confident, that the source changes are not breaking anything.

@n2ygk Any thoughts?

Copy link
Contributor

n2ygk commented Feb 21, 2023

Removing OrderedDict is not an urgent task, however it makes the code more readable at a few instances. So I would love to remove it, but really want to avoid regressions. Codecov shows that there are a couple of code paths which I needed to change, which actually do not have any test coverage.

I would see three ways forward:

  1. wait till Convert all tests to pytest #468 is completed
  2. add test for those missing paths in this PR (could be cumbersome)
  3. Force merge it as test coverage actually does not change. We would have to be fairly confident, that the source changes are not breaking anything.

@n2ygk Any thoughts?

@sliverc I think it will be pretty safe to replace OrderedDict and certainly improves readability, especially when it is invoked with a list of tuples vs. the much more readable dict syntax. A force merge in this case seems fine.

@sliverc sliverc requested a review from n2ygk February 22, 2023 16:00
@sliverc sliverc marked this pull request as ready for review February 22, 2023 16:00
Copy link
Member Author

sliverc commented Feb 22, 2023

Sounds good. I made the PR ready then for merging. I went through all changes again, but please have a close look whether everything looks good to you.

Copy link
Contributor

@n2ygk n2ygk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Nice cleanup, tightening up the loops while eliminating OrderedDict.

Copy link
Contributor

n2ygk commented Feb 22, 2023

Per our conversation doing a force merge to get around failed codecov target.

@n2ygk n2ygk merged commit ad5a793 into django-json-api:main Feb 22, 2023
@sliverc sliverc deleted the order branch February 22, 2023 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@n2ygk n2ygk n2ygk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /