Skip to content

TYP: Make temporary variables in pandas/__init__.py private #46698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@
__docformat__ = "restructuredtext"

# Let users know if they're missing any of our hard dependencies
hard_dependencies = ("numpy", "pytz", "dateutil")
missing_dependencies = []
_hard_dependencies = ("numpy", "pytz", "dateutil")
_missing_dependencies = []

for dependency in hard_dependencies:
for _dependency in _hard_dependencies:
try:
__import__(dependency)
except ImportError as e:
missing_dependencies.append(f"{dependency}: {e}")
__import__(_dependency)
except ImportError as _e:
_missing_dependencies.append(f"{_dependency}: {_e}")

if missing_dependencies:
if _missing_dependencies:
raise ImportError(
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
"Unable to import required dependencies:\n" + "\n".join(_missing_dependencies)
)
del hard_dependencies, dependency, missing_dependencies
del _hard_dependencies, _dependency, _missing_dependencies

# numpy compat
from pandas.compat import is_numpy_dev as _is_numpy_dev

try:
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
except ImportError as err: # pragma: no cover
module = err.name
except ImportError as _err: # pragma: no cover
_module = _err.name
raise ImportError(
f"C extension: {module} not built. If you want to import "
f"C extension: {_module} not built. If you want to import "
"pandas from the source directory, you may need to run "
"'python setup.py build_ext --force' to build the C extensions first."
) from err
) from _err
else:
del _tslib, _lib, _hashtable

Expand Down