Show More
@@ -7,6 +7,7 b' Much of the code is taken from the tokenize module in Python 3.2.' | |||
|
7 | 7 | |
|
8 | 8 | import io |
|
9 | 9 | from io import TextIOWrapper, BytesIO |
|
10 | from pathlib import Path | |
|
10 | 11 | import re |
|
11 | 12 | from tokenize import open, detect_encoding |
|
12 | 13 | |
@@ -72,7 +73,8 b' def read_py_file(filename, skip_encoding_cookie=True):' | |||
|
72 | 73 | ------- |
|
73 | 74 | A unicode string containing the contents of the file. |
|
74 | 75 | """ |
|
75 | with open(filename) as f: # the open function defined in this module. | |
|
76 | filepath = Path(filename) | |
|
77 | with open(filepath) as f: # the open function defined in this module. | |
|
76 | 78 | if skip_encoding_cookie: |
|
77 | 79 | return "".join(strip_encoding_cookie(f)) |
|
78 | 80 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now