File tree 1 file changed +2
-16
lines changed
1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change 3
3
import ast
4
4
import contextlib
5
5
import logging
6
- import sys
7
6
import tokenize
8
7
from typing import Any
9
8
from typing import Dict
@@ -352,13 +351,9 @@ def read_lines(self):
352
351
lines = self .read_lines_from_filename ()
353
352
return lines
354
353
355
- def _readlines_py2 (self ):
356
- # type: () -> List[str]
357
- with open (self .filename ) as fd :
358
- return fd .readlines ()
359
-
360
- def _readlines_py3 (self ):
354
+ def read_lines_from_filename (self ):
361
355
# type: () -> List[str]
356
+ """Read the lines for a file."""
362
357
try :
363
358
with tokenize .open (self .filename ) as fd :
364
359
return fd .readlines ()
@@ -368,15 +363,6 @@ def _readlines_py3(self):
368
363
with open (self .filename , encoding = "latin-1" ) as fd :
369
364
return fd .readlines ()
370
365
371
- def read_lines_from_filename (self ):
372
- # type: () -> List[str]
373
- """Read the lines for a file."""
374
- if (2 , 6 ) <= sys .version_info < (3 , 0 ):
375
- readlines = self ._readlines_py2
376
- elif (3 , 0 ) <= sys .version_info < (4 , 0 ):
377
- readlines = self ._readlines_py3
378
- return readlines ()
379
-
380
366
def read_lines_from_stdin (self ):
381
367
# type: () -> List[str]
382
368
"""Read the lines from standard in."""
You can’t perform that action at this time.
0 commit comments