Merge pull request #24 from michelp/main

allow single hyphen to represent stdin for filename.
This commit is contained in:
Dustin Spicuzza 2021-11-07 23:17:09 -05:00 committed by GitHub
commit 4521e0d594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@ See below for the contents of the returned :class:`ParsedData`.
"""
import sys
import inspect
import typing
@ -327,6 +328,10 @@ def parse_file(
if encoding is None:
encoding = "utf-8-sig"
if filename == "-":
content = sys.stdin.read()
else:
with open(filename, encoding=encoding) as fp:
content = fp.read()