Skip to content

bpo-38681: Enhance 2to3 conversion for blank line#17096

Closed
samtatasurya wants to merge 8 commits intopython:mainfrom
samtatasurya:fix-issue-38681
Closed

bpo-38681: Enhance 2to3 conversion for blank line#17096
samtatasurya wants to merge 8 commits intopython:mainfrom
samtatasurya:fix-issue-38681

Conversation

@samtatasurya
Copy link

@samtatasurya samtatasurya commented Nov 9, 2019

Main changes

  1. Added a new helper function BlankLineOrPass, which replaces BlankLine in fix_future.py and fix_itertools_imports.py.
  2. Added optional keyword argument reformat to FixerTestCase.check function in test_fixers.py.

Example 1
Code to be converted:

try:
    from __future__ import with_statement
except ImportError:
    pass

Before enhancement:

 try:
-    from __future__ import with_statement
+    
 except ImportError:
     pass

After enhancement:

 try:
-    from __future__ import with_statement
+    pass
 except ImportError:
     pass

Example 2
Code to be converted:

if sys.version_info < (3, 0):
    from itertools import imap

Before enhancement:

 if sys.version_info < (3, 0):
-    from itertools import imap
+

After enhancement:

 if sys.version_info < (3, 0):
-    from itertools import imap
+    pass

https://bugs.python.org/issue38681

Samuel Tatasurya added 4 commits November 6, 2019 00:17
…d future and itertools_imports fixers to use BlankLineOrPass instead of BlankLine.
…d future and itertools_imports fixers to use BlankLineOrPass instead of BlankLine.
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@samtatasurya

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

Copy link
Member

@isidentical isidentical left a comment

Choose a reason for hiding this comment

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

Looks great

@isidentical isidentical requested a review from pablogsal March 8, 2020 05:37
@iritkatriel
Copy link
Member

iritkatriel commented Oct 20, 2021

The issue was closed under bpo-45544 .

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.

6 participants