Skip to content

Commit 22f8d9e

Browse files
Minor cleanups
- improve type annotation of the HDFStore.keys method - minor improvement in ValueError string - minor improvement in doc-string
1 parent b42bcbf commit 22f8d9e

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
@@ -590,15 +590,15 @@ def __enter__(self):
590590
def __exit__(self, exc_type, exc_value, traceback):
591591
self.close()
592592

593-
def keys(self, kind="pandas") -> List[str]:
593+
def keys(self, kind: Optional[str] = "pandas") -> List[str]:
594594
"""
595595
Return a list of keys corresponding to objects stored in HDFStore.
596596
597597
Parameters
598598
----------
599599
kind : str, default 'pandas'
600600
When kind equals 'pandas' return pandas objects
601-
When kind equals 'table' return Tables
601+
When kind equals 'table' return Table objects
602602
Otherwise fail with a ValueError
603603
604604
Returns
@@ -618,7 +618,7 @@ def keys(self, kind="pandas") -> List[str]:
618618
return [
619619
n._v_pathname for n in self._handle.walk_nodes("/", classname="Table")
620620
]
621-
raise ValueError(f"kind should be either pandas' or 'table' but is {kind}")
621+
raise ValueError(f"`kind` should be either 'pandas' or 'table' but is [{kind}]")
622622

623623
def __iter__(self):
624624
return iter(self.keys())

0 commit comments

Comments
 (0)