Skip to content

Commit d770a80

Browse files
authored
ENH: set __module__ on read_* functions in readers.py (#60265)
1 parent 177b952 commit d770a80

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pandas/io/parsers/readers.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
AbstractMethodError,
3333
ParserWarning,
3434
)
35-
from pandas.util._decorators import Appender
35+
from pandas.util._decorators import (
36+
Appender,
37+
set_module,
38+
)
3639
from pandas.util._exceptions import find_stack_level
3740
from pandas.util._validators import check_dtype_backend
3841

@@ -771,6 +774,7 @@ def read_csv(
771774
% "filepath_or_buffer",
772775
)
773776
)
777+
@set_module("pandas")
774778
def read_csv(
775779
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
776780
*,
@@ -906,6 +910,7 @@ def read_table(
906910
% "filepath_or_buffer",
907911
)
908912
)
913+
@set_module("pandas")
909914
def read_table(
910915
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
911916
*,
@@ -1023,6 +1028,7 @@ def read_fwf(
10231028
) -> DataFrame: ...
10241029

10251030

1031+
@set_module("pandas")
10261032
def read_fwf(
10271033
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
10281034
*,

pandas/tests/api/test_api.py

+3
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ def test_set_module():
417417
assert pd.Period.__module__ == "pandas"
418418
assert pd.Timestamp.__module__ == "pandas"
419419
assert pd.Timedelta.__module__ == "pandas"
420+
assert pd.read_csv.__module__ == "pandas"
421+
assert pd.read_table.__module__ == "pandas"
422+
assert pd.read_fwf.__module__ == "pandas"
420423
assert pd.Series.__module__ == "pandas"
421424
assert pd.date_range.__module__ == "pandas"
422425
assert pd.bdate_range.__module__ == "pandas"

0 commit comments

Comments
 (0)