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

copy translate_list_to_dict default argument #1382

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cadlagtrader
Copy link

@cadlagtrader cadlagtrader commented Jul 13, 2024

Fixes #1381

@@ -64,7 +64,7 @@ def translate_list_to_dict( # noqa: CCR001
for path in list_to_trans:
current_level = new_dict
parts = path.split("__")
def_val: Any = default
def_val: Any = copy.copy(default)
Copy link
Owner

Choose a reason for hiding this comment

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

I would go with deepcopy as it can be nested dict, list of dicts or some mutable custom object

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense. Updated and added test

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (81bb434) to head (ecd50e3).
Report is 9 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1382   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          206       206           
  Lines        14940     14944    +4     
=========================================
+ Hits         14940     14944    +4     
Files Coverage Δ
ormar/queryset/utils.py 100.00% <100.00%> (ø)
tests/test_utils/test_queryset_utils.py 100.00% <100.00%> (ø)

Copy link

codspeed-hq bot commented Jul 18, 2024

CodSpeed Performance Report

Merging #1382 will degrade performances by 23.83%

Comparing cadlagtrader:fix_listtodict_default (ecd50e3) with master (81bb434)

Summary

⚡ 4 improvements
❌ 1 regressions
✅ 79 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark master cadlagtrader:fix_listtodict_default Change
test_deleting_individually[10] 9.8 ms 8.7 ms +11.99%
test_first[1000] 3.1 ms 4.1 ms -23.83%
test_first[250] 3.5 ms 2.7 ms +29.06%
test_first[500] 3.1 ms 2.6 ms +15.87%
test_get_or_none[250] 3.6 ms 2.7 ms +32.68%

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

Successfully merging this pull request may close these issues.

Random error when prefetching models
2 participants