Skip to content

Commit f1517c8

Browse files
author
Kevin Sheppard
committed
CLN: Fix merge issues
1 parent ae6f7fd commit f1517c8

File tree

4 files changed

+15
-82
lines changed

4 files changed

+15
-82
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ from pandas._typing import (
5252
AxisType,
5353
ColspaceArgType,
5454
CompressionOptions,
55-
CSVQuoting,
5655
Dtype,
5756
DtypeNp,
5857
FilePath,
@@ -1918,55 +1917,6 @@ class DataFrame(NDFrame, OpsMixin):
19181917
self, excel: _bool = ..., sep: _str | None = ..., **kwargs
19191918
) -> None: ...
19201919
@overload
1921-
def to_csv(
1922-
self,
1923-
path_or_buf: FilePathOrBuffer | None,
1924-
sep: _str = ...,
1925-
na_rep: _str = ...,
1926-
float_format: _str | None = ...,
1927-
columns: Sequence[Hashable] | None = ...,
1928-
header: _bool | list[_str] = ...,
1929-
index: _bool = ...,
1930-
index_label: _bool | _str | Sequence[Hashable] | None = ...,
1931-
mode: _str = ...,
1932-
encoding: _str | None = ...,
1933-
compression: _str | Mapping[_str, _str] = ...,
1934-
quoting: CSVQuoting = ...,
1935-
quotechar: _str = ...,
1936-
line_terminator: _str | None = ...,
1937-
chunksize: int | None = ...,
1938-
date_format: _str | None = ...,
1939-
doublequote: _bool = ...,
1940-
escapechar: _str | None = ...,
1941-
decimal: _str = ...,
1942-
errors: _str = ...,
1943-
storage_options: dict[_str, Any] | None = ...,
1944-
) -> None: ...
1945-
@overload
1946-
def to_csv(
1947-
self,
1948-
sep: _str = ...,
1949-
na_rep: _str = ...,
1950-
float_format: _str | None = ...,
1951-
columns: Sequence[Hashable] | None = ...,
1952-
header: _bool | list[_str] = ...,
1953-
index: _bool = ...,
1954-
index_label: _bool | _str | Sequence[Hashable] | None = ...,
1955-
mode: _str = ...,
1956-
encoding: _str | None = ...,
1957-
compression: _str | Mapping[_str, _str] = ...,
1958-
quoting: CSVQuoting = ...,
1959-
quotechar: _str = ...,
1960-
line_terminator: _str | None = ...,
1961-
chunksize: int | None = ...,
1962-
date_format: _str | None = ...,
1963-
doublequote: _bool = ...,
1964-
escapechar: _str | None = ...,
1965-
decimal: _str = ...,
1966-
errors: _str = ...,
1967-
storage_options: dict[_str, Any] | None = ...,
1968-
) -> _str: ...
1969-
@overload
19701920
def to_json(
19711921
self,
19721922
path_or_buf: FilePathOrBuffer | None,

pandas-stubs/core/generic.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ from pandas._typing import (
2222
ArrayLike,
2323
Axis,
2424
CompressionOptions,
25+
CSVQuoting,
2526
Dtype,
2627
DtypeArg,
2728
FilePath,
@@ -234,15 +235,15 @@ class NDFrame(PandasObject, indexing.IndexingMixin):
234235
path_or_buf: FilePathOrBuffer,
235236
sep: _str = ...,
236237
na_rep: _str = ...,
237-
float_format: _str | Callable | None = ...,
238+
float_format: _str | Callable[[object], _str] | None = ...,
238239
columns: list[HashableT] | None = ...,
239240
header: _bool | list[_str] = ...,
240241
index: _bool = ...,
241242
index_label: Literal[False] | _str | list[HashableT] | None = ...,
242243
mode: FileWriteMode = ...,
243244
encoding: _str | None = ...,
244245
compression: CompressionOptions = ...,
245-
quoting: Literal[0, 1, 2, 3] | None = ...,
246+
quoting: CSVQuoting = ...,
246247
quotechar: _str = ...,
247248
line_terminator: _str | None = ...,
248249
chunksize: int | None = ...,
@@ -259,15 +260,15 @@ class NDFrame(PandasObject, indexing.IndexingMixin):
259260
path_or_buf: None = ...,
260261
sep: _str = ...,
261262
na_rep: _str = ...,
262-
float_format: _str | Callable | None = ...,
263+
float_format: _str | Callable[[object], _str] | None = ...,
263264
columns: list[HashableT] | None = ...,
264265
header: _bool | list[_str] = ...,
265266
index: _bool = ...,
266267
index_label: Literal[False] | _str | list[HashableT] | None = ...,
267268
mode: FileWriteMode = ...,
268269
encoding: _str | None = ...,
269270
compression: CompressionOptions = ...,
270-
quoting: Literal[0, 1, 2, 3] | None = ...,
271+
quoting: CSVQuoting = ...,
271272
quotechar: _str = ...,
272273
line_terminator: _str | None = ...,
273274
chunksize: int | None = ...,

pandas-stubs/io/common.pyi

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,3 @@ class IOHandles(Generic[AnyStr]):
1515
def __enter__(self) -> IOHandles[AnyStr]: ...
1616
def __exit__(self, *args: object) -> None: ...
1717
def __init__(self, handle, compression, created_handles, is_wrapped) -> None: ...
18-
19-
from typing import (
20-
IO,
21-
AnyStr,
22-
Generic,
23-
)
24-
25-
from pandas._typing import CompressionDict
26-
27-
class IOHandles(Generic[AnyStr]):
28-
handle: IO[AnyStr]
29-
compression: CompressionDict
30-
created_handles: list[IO[AnyStr]]
31-
is_wrapped: bool
32-
def close(self) -> None: ...
33-
def __enter__(self) -> IOHandles[AnyStr]: ...
34-
def __exit__(self, *args: object) -> None: ...
35-
def __init__(self, handle, compression, created_handles, is_wrapped) -> None: ...

tests/test_io.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,15 @@ def test_read_csv():
377377
def test_read_csv_iterator():
378378
with ensure_clean() as path:
379379
check(assert_type(DF.to_csv(path), None), type(None))
380+
tfr = read_csv(path, iterator=True)
381+
check(assert_type(tfr, TextFileReader), TextFileReader)
382+
tfr.close()
383+
tfr2 = read_csv(pathlib.Path(path), chunksize=1)
380384
check(
381-
assert_type(read_csv(path, iterator=True), TextFileReader), TextFileReader
382-
)
383-
check(
384-
assert_type(read_csv(pathlib.Path(path), chunksize=1), TextFileReader),
385+
assert_type(tfr2, TextFileReader),
385386
TextFileReader,
386387
)
388+
tfr2.close()
387389

388390

389391
def test_types_read_csv() -> None:
@@ -439,12 +441,10 @@ def test_read_table():
439441
def test_read_table_iterator():
440442
with ensure_clean() as path:
441443
check(assert_type(DF.to_csv(path, sep="\t"), None), type(None))
442-
check(
443-
assert_type(read_table(path, iterator=True), TextFileReader), TextFileReader
444-
)
445-
check(
446-
assert_type(read_table(path, chunksize=1), TextFileReader), TextFileReader
447-
)
444+
tfr = read_table(path, iterator=True)
445+
check(assert_type(tfr, TextFileReader), TextFileReader)
446+
tfr2 = read_table(path, chunksize=1)
447+
check(assert_type(tfr2, TextFileReader), TextFileReader)
448448

449449

450450
def btest_read_fwf():

0 commit comments

Comments
 (0)