@@ -6,6 +6,7 @@ from typing import (
6
6
Hashable ,
7
7
Literal ,
8
8
Sequence ,
9
+ overload ,
9
10
)
10
11
11
12
import numpy as np
@@ -22,6 +23,7 @@ from pandas._typing import (
22
23
WriteBuffer ,
23
24
)
24
25
26
+ @overload
25
27
def read_stata (
26
28
path : FilePath | ReadBuffer [bytes ],
27
29
convert_dates : bool = ...,
@@ -32,57 +34,46 @@ def read_stata(
32
34
columns : list [HashableT ] | None = ...,
33
35
order_categoricals : bool = ...,
34
36
chunksize : int | None = ...,
35
- iterator : bool = ...,
37
+ iterator : Literal [ False ] = ...,
36
38
compression : CompressionOptions = ...,
37
39
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 : ...
42
72
43
73
class PossiblePrecisionLoss (Warning ): ...
44
-
45
- precision_loss_doc : str
46
-
47
74
class ValueLabelTypeMismatch (Warning ): ...
48
-
49
- value_label_mismatch_doc : str
50
-
51
75
class InvalidColumnName (Warning ): ...
52
76
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
-
86
77
class StataParser :
87
78
DTYPE_MAP : dict [int , np .dtype ] = ...
88
79
DTYPE_MAP_XML : dict [int , np .dtype ] = ...
@@ -160,19 +151,6 @@ class StataWriter(StataParser):
160
151
) -> None : ...
161
152
def write_file (self ) -> None : ...
162
153
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
-
176
154
class StataWriter117 (StataWriter ):
177
155
def __init__ (
178
156
self ,
0 commit comments