Skip to content

Commit ab24674

Browse files
committed
Fix open_file type hint ot generator
1 parent 7177a6a commit ab24674

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sonar/utilities.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"""
2525

2626
from typing import Any, TextIO, Union, Optional
27+
from collections.abc import Generator
2728
from http import HTTPStatus
2829
import sys
2930
import os
@@ -460,7 +461,7 @@ def is_api_v2(api: str) -> bool:
460461

461462

462463
@contextlib.contextmanager
463-
def open_file(file: Optional[str] = None, mode: str = "w") -> TextIO:
464+
def open_file(file: Optional[str] = None, mode: str = "w") -> Generator[TextIO, None, None]:
464465
"""Opens a file if not None or -, otherwise stdout"""
465466
if file and file != "-":
466467
log.debug("Opening file '%s' in directory '%s'", file, os.getcwd())

0 commit comments

Comments
 (0)