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

Replace usage of map unsupported on Python 3 #5062

Merged
merged 1 commit into from Nov 8, 2019
Merged

Conversation

amercader
Copy link
Member

@amercader amercader commented Nov 8, 2019

In Python 3, map returns a map object not a list. Replaced the occurrences I could find with list comprehensions.

In Python 3, map returns a map object not a list. Replaced the
occurrences I could find with list comprehensions.
@amercader
Copy link
Member Author

@cclauss do you know if there's a flake8 test to catch this type of code?

@davidread davidread merged commit 66effbd into master Nov 8, 2019
@cclauss
Copy link
Contributor

cclauss commented Nov 8, 2019

You did the right thing... manually convert to list comprehensions (or generators where applicable).

I do not think flake8 will help you detect these instances but you can try:

  • python-modernize --fix=map . # add -w to write the changes
  • pip install flake8-comprehensions # adds new rules to flake8 on when to use comprehensions

davidread pushed a commit that referenced this pull request Nov 8, 2019
Used automated tool:

    python-modernize --fix=map .

As suggested: #5062 (comment)
And did a little manual tidying.
@davidread davidread mentioned this pull request Nov 8, 2019
5 tasks
@amercader
Copy link
Member Author

Thanks for the pointers @cclauss !

@davidread davidread deleted the replace-usage-of-map branch November 9, 2019 09:14
@cclauss
Copy link
Contributor

cclauss commented Nov 9, 2019

Always happy to help ckan.

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.

None yet

3 participants