Debian Codegraph @

tests/testdata/python3/data/fake_module_with_warnings.py

raw
1 '''
2 This is a mock of a module like Pandas, which can throw warnings for deprecated attributes
3 '''
4 import warnings
5
6
7 def __dir__():
8 # GH43028
9 # Int64Index etc. are deprecated, but we still want them to be available in the dir.
10 # Remove in Pandas 2.0, when we remove Int64Index etc. from the code base.
11 return list(globals().keys()) + ["Float64Index"]
12
13
14 def __getattr__(name):
15 if name == "Float64Index":
16 warnings.warn("This is what pandas would do", FutureWarning, stacklevel=2)
17 return 5
18 raise AttributeError(f"module 'pandas' has no attribute '{name}'")
19
20
21 __all__ = ["Float64Index"] # pylint: disable=E0603
22 __doc__ = ""