E52B Simplified remove_empty by KleinerNull · Pull Request #8 · python-amazon-mws/python-amazon-mws · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

Conversation

8000
@KleinerNull
Copy link
Contributor

Instead of mutating a dict building a new one is better. Should be faster than using del and safe. Also casting a set of dict.keys is not necessary, keys in a dict are always unique.

Instead of mutating a dict building a new one is better. Should be faster than using del and safe. Also casting a set of dict.keys is not necessary, keys in a dict are always unique.
mws/mws.py Outdated
if not d[key]:
del d[key]
return d
return {k: v for k, v in d.items() if not v}
Copy link
Contributor

Choose a reason for hiding this comment

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

if v rather than if not v

@jameshiew
Copy link
Contributor

Nice, definitely a much simpler way of doing it, let's remove the not and good to merge 👍

@KleinerNull
Copy link
Contributor Author

Sry, my fault.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (develop@5cd744e). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop       #8   +/-   ##
==========================================
  Coverage           ?   47.31%           
==========================================
  Files              ?        4           
  Lines              ?      391           
  Branches           ?       23           
==========================================
  Hits               ?      185           
  Misses             ?      197           
  Partials           ?        9
Impacted Files Coverage Δ
mws/mws.py 50% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5cd744e...edb0ea7. Read the comment docs.

@james
8000
hiew jameshiew merged commit 669d519 into python-amazon-mws:develop Jun 15, 2017
@jameshiew
Copy link
Contributor

Cheers!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0