Skip to content

Commit 6131c81

Browse files
rbenesradekbenesinno
authored andcommitted
Imports arranged
1 parent 81da44b commit 6131c81

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

pandas/io/pytables.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
import copy
77
from datetime import date, tzinfo
8+
from distutils.version import LooseVersion
89
import itertools
910
import os
1011
import re
1112
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union
1213
import warnings
1314

1415
import numpy as np
16+
from tables import __version__ as tables_version
1517

1618
from pandas._config import config, get_option
1719

@@ -4145,12 +4147,8 @@ def write(
41454147
# set the table attributes
41464148
table.set_attrs()
41474149

4148-
if track_times is not None:
4149-
from tables import __version__ as tables_version
4150-
from distutils.version import LooseVersion
4151-
4152-
if LooseVersion(tables_version) >= LooseVersion("3.4.3"):
4153-
options["track_times"] = track_times
4150+
if LooseVersion(tables_version) >= LooseVersion("3.4.3"):
4151+
options["track_times"] = track_times
41544152

41554153
# create the table
41564154
table._handle.create_table(table.group, **options)

pandas/tests/io/pytables/test_store.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import datetime
22
from datetime import timedelta
33
from distutils.version import LooseVersion
4+
import hashlib
45
from io import BytesIO
56
import os
67
from pathlib import Path
78
import re
9+
import time
810
from warnings import catch_warnings, simplefilter
911

1012
import numpy as np
1113
import pytest
14+
import tables
1215

1316
from pandas.compat import is_platform_little_endian, is_platform_windows
1417
import pandas.util._test_decorators as td
@@ -301,10 +304,6 @@ def test_no_track_times(self, setup_path):
301304
# GH 32682
302305
# enables to set track_times (see `pytables` `create_table` documentation)
303306

304-
import hashlib
305-
import time
306-
import tables
307-
308307
def checksum(filename, hash_factory=hashlib.md5, chunk_num_blocks=128):
309308
h = hash_factory()
310309
with open(filename, "rb") as f:

0 commit comments

Comments
 (0)