1
1
"""
2
2
Read SAS sas7bdat or xport files.
3
3
"""
4
-
5
4
from abc import ABCMeta , abstractmethod
5
+ from typing import TYPE_CHECKING , Optional , Union , overload
6
+
7
+ from pandas ._typing import FilePathOrBuffer , Label
6
8
7
9
from pandas .io .common import stringify_path
8
10
11
+ if TYPE_CHECKING :
12
+ from pandas import DataFrame # noqa: F401
13
+
9
14
10
15
# TODO(PY38): replace with Protocol in Python 3.8
11
16
class ReaderBase (metaclass = ABCMeta ):
@@ -22,14 +27,38 @@ def close(self):
22
27
pass
23
28
24
29
30
+ @overload
31
+ def read_sas (
32
+ filepath_or_buffer : FilePathOrBuffer ,
33
+ format : Optional [str ] = ...,
34
+ index : Optional [Label ] = ...,
35
+ encoding : Optional [str ] = ...,
36
+ chunksize : int = ...,
37
+ iterator : bool = ...,
38
+ ) -> ReaderBase :
39
+ ...
40
+
41
+
42
+ @overload
43
+ def read_sas (
44
+ filepath_or_buffer : FilePathOrBuffer ,
45
+ format : Optional [str ] = ...,
46
+ index : Optional [Label ] = ...,
47
+ encoding : Optional [str ] = ...,
48
+ chunksize : None = ...,
49
+ iterator : bool = ...,
50
+ ) -> Union ["DataFrame" , ReaderBase ]:
51
+ ...
52
+
53
+
25
54
def read_sas (
26
- filepath_or_buffer ,
27
- format = None ,
28
- index = None ,
29
- encoding = None ,
30
- chunksize = None ,
31
- iterator = False ,
32
- ):
55
+ filepath_or_buffer : FilePathOrBuffer ,
56
+ format : Optional [ str ] = None ,
57
+ index : Optional [ Label ] = None ,
58
+ encoding : Optional [ str ] = None ,
59
+ chunksize : Optional [ int ] = None ,
60
+ iterator : bool = False ,
61
+ ) -> Union [ "DataFrame" , ReaderBase ] :
33
62
"""
34
63
Read SAS files stored as either XPORT or SAS7BDAT format files.
35
64
0 commit comments