Skip to content
25 changes: 25 additions & 0 deletions asv_bench/benchmarks/package.py
Original file line number Diff line number Diff line change
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment for this as 3.7 actually does the timing, where for < 3.7 asv is doing the timing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment added + green


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)
2 changes: 1 addition & 1 deletion pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion pandas/util/_test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down