From 8c27fcfd1bda5963c3a17697abde338e0f5e1ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danie=CC=88l=20de=20Kok?= Date: Thu, 19 Jan 2023 11:35:59 +0100 Subject: [PATCH] Add return type _string_to_tmp_file helper --- spacy/tests/training/test_corpus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/tests/training/test_corpus.py b/spacy/tests/training/test_corpus.py index 1d90f9ca2..065075047 100644 --- a/spacy/tests/training/test_corpus.py +++ b/spacy/tests/training/test_corpus.py @@ -1,4 +1,4 @@ -from typing import Iterable, List, Tuple +from typing import IO, Generator, Iterable, List, TextIO, Tuple from contextlib import contextmanager from pathlib import Path import pytest @@ -55,7 +55,7 @@ def test_plain_text_reader(min_length, max_length): @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: f.write(s.encode("utf-8")) f.seek(0)