Skip to content

Commit

Permalink
linter: Use proper Python 3 I/O type for reading
Browse files Browse the repository at this point in the history
Co-authored-by: Adrien Vergé <adrienverge@gmail.com>
  • Loading branch information
DimitriPapadopoulos and adrienverge committed Oct 14, 2022
1 parent b8c85f0 commit 22ddf4c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion yamllint/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import re
import io

import yaml

Expand Down Expand Up @@ -227,7 +228,7 @@ def run(input, conf, filepath=None):

if isinstance(input, (bytes, str)):
return _run(input, conf, filepath)
elif hasattr(input, 'read'): # Python 2's file or Python 3's io.IOBase
elif isinstance(input, io.IOBase):
# We need to have everything in memory to parse correctly
content = input.read()
return _run(content, conf, filepath)
Expand Down

0 comments on commit 22ddf4c

Please sign in to comment.