Skip to content

Commit f74e09a

Browse files
committed
ENH: Synchronize io/stata with pandas master
Sychronize and remvoe classes not part of the public API
1 parent 30a87ca commit f74e09a

File tree

1 file changed

+35
-57
lines changed

1 file changed

+35
-57
lines changed

pandas-stubs/io/stata.pyi

+35-57
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ from typing import (
66
Hashable,
77
Literal,
88
Sequence,
9+
overload,
910
)
1011

1112
import numpy as np
@@ -22,6 +23,7 @@ from pandas._typing import (
2223
WriteBuffer,
2324
)
2425

26+
@overload
2527
def read_stata(
2628
path: FilePath | ReadBuffer[bytes],
2729
convert_dates: bool = ...,
@@ -32,57 +34,46 @@ def read_stata(
3234
columns: list[HashableT] | None = ...,
3335
order_categoricals: bool = ...,
3436
chunksize: int | None = ...,
35-
iterator: bool = ...,
37+
iterator: Literal[False] = ...,
3638
compression: CompressionOptions = ...,
3739
storage_options: StorageOptions = ...,
38-
) -> DataFrame | StataReader: ...
39-
40-
stata_epoch: datetime.datetime = ...
41-
excessive_string_length_error: str
40+
) -> DataFrame: ...
41+
@overload
42+
def read_stata(
43+
path: FilePath | ReadBuffer[bytes],
44+
convert_dates: bool = ...,
45+
convert_categoricals: bool = ...,
46+
index_col: str | None = ...,
47+
convert_missing: bool = ...,
48+
preserve_dtypes: bool = ...,
49+
columns: list[HashableT] | None = ...,
50+
order_categoricals: bool = ...,
51+
chunksize: int | None = ...,
52+
*,
53+
iterator: Literal[True],
54+
compression: CompressionOptions,
55+
storage_options: StorageOptions,
56+
) -> StataReader: ...
57+
@overload
58+
def read_stata(
59+
path: FilePath | ReadBuffer[bytes],
60+
convert_dates: bool,
61+
convert_categoricals: bool,
62+
index_col: str | None,
63+
convert_missing: bool,
64+
preserve_dtypes: bool,
65+
columns: list[HashableT] | None,
66+
order_categoricals: bool,
67+
chunksize: int | None,
68+
iterator: Literal[True],
69+
compression: CompressionOptions = ...,
70+
storage_options: StorageOptions = ...,
71+
) -> StataReader: ...
4272

4373
class PossiblePrecisionLoss(Warning): ...
44-
45-
precision_loss_doc: str
46-
4774
class ValueLabelTypeMismatch(Warning): ...
48-
49-
value_label_mismatch_doc: str
50-
5175
class InvalidColumnName(Warning): ...
5276

53-
invalid_name_doc: str
54-
55-
class StataValueLabel:
56-
labname: Hashable = ...
57-
value_labels: list[tuple[float, str]] = ...
58-
text_len: int = ...
59-
off: npt.NDArray[np.int32] = ...
60-
val: npt.NDArray[np.int32] = ...
61-
txt: list[bytes] = ...
62-
n: int = ...
63-
len: int = ...
64-
def __init__(
65-
self, catarray: pd.Series, encoding: Literal["latin-1", "utf-8"] = ...
66-
) -> None: ...
67-
def generate_value_label(self, byteorder: str) -> bytes: ...
68-
69-
class StataMissingValue:
70-
MISSING_VALUES: dict[float, str] = ...
71-
bases: tuple[int, int, int] = ...
72-
float32_base: bytes = ...
73-
increment: int = ...
74-
int_value: int = ...
75-
float64_base: bytes = ...
76-
BASE_MISSING_VALUES: dict[str, int] = ...
77-
def __init__(self, value: float) -> None: ...
78-
def __eq__(self, other: object) -> bool: ...
79-
@property
80-
def string(self) -> str: ...
81-
@property
82-
def value(self) -> float: ...
83-
@classmethod
84-
def get_base_missing_value(cls, dtype): ...
85-
8677
class StataParser:
8778
DTYPE_MAP: dict[int, np.dtype] = ...
8879
DTYPE_MAP_XML: dict[int, np.dtype] = ...
@@ -160,19 +151,6 @@ class StataWriter(StataParser):
160151
) -> None: ...
161152
def write_file(self) -> None: ...
162153

163-
class StataStrLWriter:
164-
df: DataFrame = ...
165-
columns: Sequence[str] = ...
166-
def __init__(
167-
self,
168-
df: DataFrame,
169-
columns: Sequence[str],
170-
version: int = ...,
171-
byteorder: str | None = ...,
172-
) -> None: ...
173-
def generate_table(self) -> tuple[dict[str, tuple[int, int]], DataFrame]: ...
174-
def generate_blob(self, gso_table: dict[str, tuple[int, int]]) -> bytes: ...
175-
176154
class StataWriter117(StataWriter):
177155
def __init__(
178156
self,

0 commit comments

Comments
 (0)