diff --git a/asv_bench/benchmarks/package.py b/asv_bench/benchmarks/package.py new file mode 100644 index 0000000000000..8ca33db361fa0 --- /dev/null +++ b/asv_bench/benchmarks/package.py @@ -0,0 +1,25 @@ +""" +Benchmarks for pandas at the package-level. +""" +import subprocess +import sys + +from pandas.compat import PY37 + + +class TimeImport: + def time_import(self): + if PY37: + # on py37+ we the "-X importtime" usage gives us a more precise + # measurement of the import time we actually care about, + # without the subprocess or interpreter overhead + cmd = [sys.executable, "-X", "importtime", "-c", "import pandas as pd"] + p = subprocess.run(cmd, stderr=subprocess.PIPE) + + line = p.stderr.splitlines()[-1] + field = line.split(b"|")[-2].strip() + total = int(field) # microseconds + return total + + cmd = [sys.executable, "-c", "import pandas as pd"] + subprocess.run(cmd, stderr=subprocess.PIPE) diff --git a/pandas/core/dtypes/dtypes.py b/pandas/core/dtypes/dtypes.py index ee1866e60644b..aa7e6801ba431 100644 --- a/pandas/core/dtypes/dtypes.py +++ b/pandas/core/dtypes/dtypes.py @@ -23,7 +23,7 @@ ordered_sentinel = object() # type: object -def register_extension_dtype(cls: Type[ExtensionDtype],) -> Type[ExtensionDtype]: +def register_extension_dtype(cls: Type[ExtensionDtype]) -> Type[ExtensionDtype]: """ Register an ExtensionType with pandas as class decorator. diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 627757aaa3741..0e07b9f5fe9f7 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -102,7 +102,7 @@ def _skip_if_no_scipy(): ) -def skip_if_installed(package: str,) -> Callable: +def skip_if_installed(package: str) -> Callable: """ Skip a test if a package is installed.