Merge pull request #24 from michelp/main
allow single hyphen to represent stdin for filename.
This commit is contained in:
commit
4521e0d594
@ -24,6 +24,7 @@ See below for the contents of the returned :class:`ParsedData`.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
import inspect
|
import inspect
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
@ -327,7 +328,11 @@ def parse_file(
|
|||||||
if encoding is None:
|
if encoding is None:
|
||||||
encoding = "utf-8-sig"
|
encoding = "utf-8-sig"
|
||||||
|
|
||||||
with open(filename, encoding=encoding) as fp:
|
if filename == "-":
|
||||||
content = fp.read()
|
content = sys.stdin.read()
|
||||||
|
else:
|
||||||
|
|
||||||
|
with open(filename, encoding=encoding) as fp:
|
||||||
|
content = fp.read()
|
||||||
|
|
||||||
return parse_string(content, filename=filename, options=options)
|
return parse_string(content, filename=filename, options=options)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user