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

Remove unnecessary conversions to list() and calls to dict.keys() #1243

Merged
merged 4 commits into from
Nov 17, 2020
Merged

Remove unnecessary conversions to list() and calls to dict.keys() #1243

merged 4 commits into from
Nov 17, 2020

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Nov 16, 2020

- What I did

After conversion to Python 3 using the 2to3 tool, all calls to dict.keys() and dict.values() were converted to lists. In the instances where the returned view objects from these calls are iterated over, there is no need to convert to a list, so I removed those.

Also, when iterating over the keys of a dictionary, one need not call dict.keys(), one can simply iterate over the dictionary as for key in dict:, so I cleaned those up as well.

Also remove some unnecessary parentheses.

@jleveque jleveque self-assigned this Nov 16, 2020
@jleveque jleveque mentioned this pull request Nov 16, 2020
2 tasks
@jleveque jleveque marked this pull request as ready for review November 17, 2020 02:20
Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comments

config/config_mgmt.py Outdated Show resolved Hide resolved
config/config_mgmt.py Outdated Show resolved Hide resolved
show/fgnhg.py Show resolved Hide resolved
show/fgnhg.py Show resolved Hide resolved
show/fgnhg.py Show resolved Hide resolved
show/fgnhg.py Show resolved Hide resolved
qiluo-msft
qiluo-msft previously approved these changes Nov 17, 2020
@jleveque jleveque merged commit d07ca5f into sonic-net:master Nov 17, 2020
@jleveque jleveque deleted the py3_cleanup branch November 17, 2020 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants