|
48 | 48 | ) |
49 | 49 | from pandas.compat._optional import import_optional_dependency |
50 | 50 | from pandas.compat.pickle_compat import patch_pickle |
51 | | -from pandas.errors import PerformanceWarning |
| 51 | +from pandas.errors import ( |
| 52 | + AttributeConflictWarning, |
| 53 | + ClosedFileError, |
| 54 | + IncompatibilityWarning, |
| 55 | + PerformanceWarning, |
| 56 | + PossibleDataLossError, |
| 57 | +) |
52 | 58 | from pandas.util._decorators import cache_readonly |
53 | 59 | from pandas.util._exceptions import find_stack_level |
54 | 60 |
|
@@ -169,43 +175,17 @@ def _ensure_term(where, scope_level: int): |
169 | 175 | return where if where is None or len(where) else None |
170 | 176 |
|
171 | 177 |
|
172 | | -class PossibleDataLossError(Exception): |
173 | | - pass |
174 | | - |
175 | | - |
176 | | -class ClosedFileError(Exception): |
177 | | - pass |
178 | | - |
179 | | - |
180 | | -class IncompatibilityWarning(Warning): |
181 | | - pass |
182 | | - |
183 | | - |
184 | 178 | incompatibility_doc = """ |
185 | 179 | where criteria is being ignored as this version [%s] is too old (or |
186 | 180 | not-defined), read the file in and write it out to a new file to upgrade (with |
187 | 181 | the copy_to method) |
188 | 182 | """ |
189 | 183 |
|
190 | | - |
191 | | -class AttributeConflictWarning(Warning): |
192 | | - pass |
193 | | - |
194 | | - |
195 | 184 | attribute_conflict_doc = """ |
196 | 185 | the [%s] attribute of the existing index is [%s] which conflicts with the new |
197 | 186 | [%s], resetting the attribute to None |
198 | 187 | """ |
199 | 188 |
|
200 | | - |
201 | | -class DuplicateWarning(Warning): |
202 | | - pass |
203 | | - |
204 | | - |
205 | | -duplicate_doc = """ |
206 | | -duplicate entries in table, taking most recently appended |
207 | | -""" |
208 | | - |
209 | 189 | performance_doc = """ |
210 | 190 | your performance may suffer as PyTables will pickle object types that it cannot |
211 | 191 | map directly to c-types [inferred_type->%s,key->%s] [items->%s] |
@@ -3550,7 +3530,7 @@ def get_attrs(self) -> None: |
3550 | 3530 | def validate_version(self, where=None) -> None: |
3551 | 3531 | """are we trying to operate on an old version?""" |
3552 | 3532 | if where is not None: |
3553 | | - if self.version[0] <= 0 and self.version[1] <= 10 and self.version[2] < 1: |
| 3533 | + if self.is_old_version: |
3554 | 3534 | ws = incompatibility_doc % ".".join([str(x) for x in self.version]) |
3555 | 3535 | warnings.warn(ws, IncompatibilityWarning) |
3556 | 3536 |
|
|
0 commit comments