Skip to content

Commit 25fa1e4

Browse files
Minor cleanups
- improve type annotation of the HDFStore.keys method - minor improvement in ValueError string - minor improvement in doc-string
1 parent 27aac41 commit 25fa1e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/io/pytables.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,15 @@ def __enter__(self):
580580
def __exit__(self, exc_type, exc_value, traceback):
581581
self.close()
582582

583-
def keys(self, kind="pandas") -> List[str]:
583+
def keys(self, kind: Optional[str] = "pandas") -> List[str]:
584584
"""
585585
Return a list of keys corresponding to objects stored in HDFStore.
586586
587587
Parameters
588588
----------
589589
kind : str, default 'pandas'
590590
When kind equals 'pandas' return pandas objects
591-
When kind equals 'table' return Tables
591+
When kind equals 'table' return Table objects
592592
Otherwise fail with a ValueError
593593
594594
Returns
@@ -608,7 +608,7 @@ def keys(self, kind="pandas") -> List[str]:
608608
return [
609609
n._v_pathname for n in self._handle.walk_nodes("/", classname="Table")
610610
]
611-
raise ValueError(f"kind should be either pandas' or 'table' but is {kind}")
611+
raise ValueError(f"`kind` should be either 'pandas' or 'table' but is [{kind}]")
612612

613613
def __iter__(self):
614614
return iter(self.keys())

0 commit comments

Comments
 (0)