6f539ad2324ddccc18b6ac39e4a2f4aeb12173a2,tests/test_yapf_format.py,,_read_utf_8_file,#Any#,6

Before Change



def _read_utf_8_file(filename):
    if sys.version_info.major == 2:
        return unicode(open(filename, "rb").read(), "utf-8")
    else:
        return open(filename, encoding="utf-8").read()

After Change



def _read_utf_8_file(filename):
    if sys.version_info.major == 2:  //// Python 2 specific
        with open(filename, "rb") as f:
            return unicode(f.read(), "utf-8")
    else:
        with open(filename, encoding="utf-8") as f:
            return f.read()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: tensorlayer/tensorlayer
Commit Name: 6f539ad2324ddccc18b6ac39e4a2f4aeb12173a2
Time: 2018-04-17
Author: DEKHTIARJonathan@users.noreply.github.com
File Name: tests/test_yapf_format.py
Class Name:
Method Name: _read_utf_8_file


Project Name: SheffieldML/GPy
Commit Name: c6efa62e3684ef380523fcb6c02d881c55fd1e3e
Time: 2015-10-12
Author: ibinbei@gmail.com
File Name: setup.py
Class Name:
Method Name: read


Project Name: pyinstaller/pyinstaller
Commit Name: 5b2327e051d5243f80b9b9f39f6800bbc8749bed
Time: 2018-09-09
Author: contact@tiger-222.fr
File Name: setup.py
Class Name:
Method Name: read