Skip to content

Commit 77437b1

Browse files
authored
Merge pull request numpy#28660 from jorenham/typing/accept-str-writers-in-savetxt
TYP: Accept objects that ``write()`` to ``str`` in ``savetxt``
2 parents 5098b5a + e55950e commit 77437b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

numpy/lib/_npyio_impl.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ _SCT_co = TypeVar("_SCT_co", bound=np.generic, default=Any, covariant=True)
3535
_FName: TypeAlias = StrPath | Iterable[str] | Iterable[bytes]
3636
_FNameRead: TypeAlias = StrPath | SupportsRead[str] | SupportsRead[bytes]
3737
_FNameWriteBytes: TypeAlias = StrPath | SupportsWrite[bytes]
38-
_FNameWrite: TypeAlias = _FNameWriteBytes | SupportsWrite[bytes]
38+
_FNameWrite: TypeAlias = _FNameWriteBytes | SupportsWrite[str]
3939

4040
@type_check_only
4141
class _SupportsReadSeek(SupportsRead[_T_co], Protocol[_T_co]):
@@ -160,7 +160,7 @@ def loadtxt(
160160
) -> NDArray[Any]: ...
161161

162162
def savetxt(
163-
fname: StrPath | _FNameWrite,
163+
fname: _FNameWrite,
164164
X: ArrayLike,
165165
fmt: str | Sequence[str] = "%.18e",
166166
delimiter: str = " ",

0 commit comments

Comments
 (0)