mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-04 04:10:20 +03:00
Add return type _string_to_tmp_file helper
This commit is contained in:
parent
5e84e5b41c
commit
8c27fcfd1b
|
@ -1,4 +1,4 @@
|
||||||
from typing import Iterable, List, Tuple
|
from typing import IO, Generator, Iterable, List, TextIO, Tuple
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -55,7 +55,7 @@ def test_plain_text_reader(min_length, max_length):
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def _string_to_tmp_file(s: str):
|
def _string_to_tmp_file(s: str) -> Generator[IO, None, None]:
|
||||||
with tempfile.NamedTemporaryFile(suffix=".txt") as f:
|
with tempfile.NamedTemporaryFile(suffix=".txt") as f:
|
||||||
f.write(s.encode("utf-8"))
|
f.write(s.encode("utf-8"))
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user