Skip to content

Commit e59dc62

Browse files
committed
CLN: remove unnecessary empty lines
1 parent 65996e6 commit e59dc62

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

pandas/io/pytables.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -666,12 +666,10 @@ def open(self, mode: str = "a", **kwargs):
666666
tables = _tables()
667667

668668
if self._mode != mode:
669-
670669
# if we are changing a write mode to read, ok
671670
if self._mode in ["a", "w"] and mode in ["r", "r+"]:
672671
pass
673672
elif mode in ["w"]:
674-
675673
# this would truncate, raise here
676674
if self.is_open:
677675
raise PossibleDataLossError(
@@ -700,7 +698,6 @@ def open(self, mode: str = "a", **kwargs):
700698
raise
701699

702700
except ValueError as err:
703-
704701
# trap PyTables >= 3.1 FILE_OPEN_POLICY exception
705702
# to provide an updated message
706703
if "FILE_OPEN_POLICY" in str(err):
@@ -715,11 +712,9 @@ def open(self, mode: str = "a", **kwargs):
715712
"which allows\n"
716713
"files to be opened multiple times at once\n"
717714
)
718-
719715
raise err
720716

721717
except Exception as err:
722-
723718
# trying to read from a non-existent file causes an error which
724719
# is not part of IOError, make it one
725720
if self._mode == "r" and "Unable to open/create file" in str(err):
@@ -1646,7 +1641,6 @@ def error(t):
16461641
# infer the pt from the passed value
16471642
if pt is None:
16481643
if value is None:
1649-
16501644
_tables()
16511645
assert _table_mod is not None # for mypy
16521646
if getattr(group, "table", None) or isinstance(
@@ -1678,10 +1672,8 @@ def error(t):
16781672

16791673
# existing node (and must be a table)
16801674
if tt is None:
1681-
16821675
# if we are a writer, determine the tt
16831676
if value is not None:
1684-
16851677
if pt == "series_table":
16861678
index = getattr(value, "index", None)
16871679
if index is not None:
@@ -1886,11 +1878,9 @@ def __init__(
18861878
self.auto_close = auto_close
18871879

18881880
def __iter__(self):
1889-
18901881
# iterate
18911882
current = self.start
18921883
while current < self.stop:
1893-
18941884
stop = min(current + self.chunksize, self.stop)
18951885
value = self.func(None, None, self.coordinates[current:stop])
18961886
current = stop
@@ -1906,7 +1896,6 @@ def close(self):
19061896
self.store.close()
19071897

19081898
def get_result(self, coordinates: bool = False):
1909-
19101899
# return the actual iterator
19111900
if self.chunksize is not None:
19121901
if not isinstance(self.s, Table):
@@ -2105,7 +2094,6 @@ def maybe_set_size(self, min_itemsize=None):
21052094
with an integer size
21062095
"""
21072096
if _ensure_decoded(self.kind) == "string":
2108-
21092097
if isinstance(min_itemsize, dict):
21102098
min_itemsize = min_itemsize.get(self.name)
21112099

@@ -2163,7 +2151,6 @@ def update_info(self, info):
21632151

21642152
existing_value = idx.get(key)
21652153
if key in idx and value is not None and existing_value != value:
2166-
21672154
# frequency/name just warn
21682155
if key in ["freq", "index_name"]:
21692156
ws = attribute_conflict_doc % (key, existing_value, value)
@@ -2356,10 +2343,8 @@ def _get_atom(cls, values: ArrayLike) -> "Col":
23562343
atom = cls.get_atom_timedelta64(shape)
23572344
elif is_complex_dtype(dtype):
23582345
atom = _tables().ComplexCol(itemsize=itemsize, shape=shape[0])
2359-
23602346
elif is_string_dtype(dtype):
23612347
atom = cls.get_atom_string(shape, itemsize)
2362-
23632348
else:
23642349
atom = cls.get_atom_data(shape, kind=dtype.name)
23652350

@@ -2465,7 +2450,6 @@ def convert(self, values: np.ndarray, nan_rep, encoding: str, errors: str):
24652450

24662451
# reverse converts
24672452
if dtype == "datetime64":
2468-
24692453
# recreate with tz if indicated
24702454
converted = _set_tz(converted, tz, coerce=True)
24712455

@@ -2482,7 +2466,6 @@ def convert(self, values: np.ndarray, nan_rep, encoding: str, errors: str):
24822466
)
24832467

24842468
elif meta == "category":
2485-
24862469
# we have a categorical
24872470
categories = metadata
24882471
codes = converted.ravel()
@@ -2837,7 +2820,6 @@ def read_array(
28372820
ret = node[start:stop]
28382821

28392822
if dtype == "datetime64":
2840-
28412823
# reconstruct a timezone if indicated
28422824
tz = getattr(attrs, "tz", None)
28432825
ret = _set_tz(ret, tz, coerce=True)
@@ -3041,7 +3023,6 @@ def write_array(self, key: str, value: ArrayLike, items: Optional[Index] = None)
30413023
self.write_array_empty(key, value)
30423024

30433025
elif value.dtype.type == np.object_:
3044-
30453026
# infer the type, warn if we have a non-string type here (for
30463027
# performance)
30473028
inferred_type = lib.infer_dtype(value, skipna=False)
@@ -3725,7 +3706,6 @@ def validate_data_columns(self, data_columns, min_itemsize, non_index_axes):
37253706

37263707
# if min_itemsize is a dict, add the keys (exclude 'values')
37273708
if isinstance(min_itemsize, dict):
3728-
37293709
existing_data_columns = set(data_columns)
37303710
data_columns = list(data_columns) # ensure we do not modify
37313711
data_columns.extend(
@@ -4161,7 +4141,6 @@ def read_column(
41614141
# find the axes
41624142
for a in self.axes:
41634143
if column == a.name:
4164-
41654144
if not a.is_data_indexable:
41664145
raise ValueError(
41674146
f"column [{column}] can not be extracted individually; "
@@ -4287,9 +4266,7 @@ def write_data(self, chunksize: Optional[int], dropna: bool = False):
42874266
# if dropna==True, then drop ALL nan rows
42884267
masks = []
42894268
if dropna:
4290-
42914269
for a in self.values_axes:
4292-
42934270
# figure the mask: only do if we can successfully process this
42944271
# column, otherwise ignore the mask
42954272
mask = isna(a.data).all(axis=0)
@@ -4868,7 +4845,6 @@ def _unconvert_index(
48684845
def _maybe_convert_for_string_atom(
48694846
name: str, block, existing_col, min_itemsize, nan_rep, encoding, errors
48704847
):
4871-
48724848
if not block.is_object:
48734849
return block.values
48744850

@@ -4901,7 +4877,6 @@ def _maybe_convert_for_string_atom(
49014877
# we cannot serialize this data, so report an exception on a column
49024878
# by column basis
49034879
for i in range(len(block.shape[0])):
4904-
49054880
col = block.iget(i)
49064881
inferred_type = lib.infer_dtype(col, skipna=False)
49074882
if inferred_type != "string":

0 commit comments

Comments
 (0)