Skip to content

Commit c0050e0

Browse files
jbrockmendeljreback
authored andcommitted
REF: make Fixed.version a property (#29765)
1 parent f4d1a84 commit c0050e0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pandas/io/pytables.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import re
1111
import time
12-
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Union
12+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union
1313
import warnings
1414

1515
import numpy as np
@@ -2558,21 +2558,22 @@ def __init__(self, parent, group, encoding=None, errors="strict", **kwargs):
25582558
self.group = group
25592559
self.encoding = _ensure_encoding(encoding)
25602560
self.errors = errors
2561-
self.set_version()
25622561

25632562
@property
25642563
def is_old_version(self) -> bool:
25652564
return self.version[0] <= 0 and self.version[1] <= 10 and self.version[2] < 1
25662565

2567-
def set_version(self):
2566+
@property
2567+
def version(self) -> Tuple[int, int, int]:
25682568
""" compute and set our version """
25692569
version = _ensure_decoded(getattr(self.group._v_attrs, "pandas_version", None))
25702570
try:
2571-
self.version = tuple(int(x) for x in version.split("."))
2572-
if len(self.version) == 2:
2573-
self.version = self.version + (0,)
2571+
version = tuple(int(x) for x in version.split("."))
2572+
if len(version) == 2:
2573+
version = version + (0,)
25742574
except AttributeError:
2575-
self.version = (0, 0, 0)
2575+
version = (0, 0, 0)
2576+
return version
25762577

25772578
@property
25782579
def pandas_type(self):
@@ -2598,7 +2599,6 @@ def set_object_info(self):
25982599
""" set my pandas type & version """
25992600
self.attrs.pandas_type = str(self.pandas_kind)
26002601
self.attrs.pandas_version = str(_version)
2601-
self.set_version()
26022602

26032603
def copy(self):
26042604
new_self = copy.copy(self)

0 commit comments

Comments
 (0)