@@ -312,7 +312,7 @@ def read_hdf(path_or_buf, key=None, mode: str = "r", **kwargs):
312312 key : object, optional
313313 The group identifier in the store. Can be omitted if the HDF file
314314 contains a single pandas object.
315- mode : {'r', 'r+', 'a'}, optional
315+ mode : {'r', 'r+', 'a'}, default 'r'
316316 Mode to use when opening the file. Ignored if path_or_buf is a
317317 :class:`pandas.HDFStore`. Default is 'r'.
318318 where : list, optional
@@ -417,7 +417,7 @@ def read_hdf(path_or_buf, key=None, mode: str = "r", **kwargs):
417417 raise
418418
419419
420- def _is_metadata_of (group , parent_group ) -> bool :
420+ def _is_metadata_of (group : "Node" , parent_group : "Node" ) -> bool :
421421 """Check if a given group is a metadata group for a given parent_group."""
422422 if group ._v_depth <= parent_group ._v_depth :
423423 return False
@@ -932,9 +932,7 @@ def func(_start, _stop, _where):
932932 # retrieve the objs, _where is always passed as a set of
933933 # coordinates here
934934 objs = [
935- t .read (
936- where = _where , columns = columns , start = _start , stop = _stop , ** kwargs
937- )
935+ t .read (where = _where , columns = columns , start = _start , stop = _stop )
938936 for t in tbls
939937 ]
940938
@@ -957,7 +955,7 @@ def func(_start, _stop, _where):
957955
958956 return it .get_result (coordinates = True )
959957
960- def put (self , key : str , value , format = None , append = False , ** kwargs ):
958+ def put (self , key : str , value : FrameOrSeries , format = None , append = False , ** kwargs ):
961959 """
962960 Store object in HDFStore.
963961
@@ -986,8 +984,8 @@ def put(self, key: str, value, format=None, append=False, **kwargs):
986984 """
987985 if format is None :
988986 format = get_option ("io.hdf.default_format" ) or "fixed"
989- kwargs = self ._validate_format (format , kwargs )
990- self ._write_to_group (key , value , append = append , ** kwargs )
987+ format = self ._validate_format (format )
988+ self ._write_to_group (key , value , format = format , append = append , ** kwargs )
991989
992990 def remove (self , key : str , where = None , start = None , stop = None ):
993991 """
@@ -1046,7 +1044,7 @@ def remove(self, key: str, where=None, start=None, stop=None):
10461044 def append (
10471045 self ,
10481046 key : str ,
1049- value ,
1047+ value : FrameOrSeries ,
10501048 format = None ,
10511049 append = True ,
10521050 columns = None ,
@@ -1096,8 +1094,10 @@ def append(
10961094 dropna = get_option ("io.hdf.dropna_table" )
10971095 if format is None :
10981096 format = get_option ("io.hdf.default_format" ) or "table"
1099- kwargs = self ._validate_format (format , kwargs )
1100- self ._write_to_group (key , value , append = append , dropna = dropna , ** kwargs )
1097+ format = self ._validate_format (format )
1098+ self ._write_to_group (
1099+ key , value , format = format , append = append , dropna = dropna , ** kwargs
1100+ )
11011101
11021102 def append_to_multiple (
11031103 self ,
@@ -1418,17 +1418,16 @@ def _check_if_open(self):
14181418 if not self .is_open :
14191419 raise ClosedFileError (f"{ self ._path } file is not open!" )
14201420
1421- def _validate_format (self , format : str , kwargs : Dict [str , Any ]) -> Dict [str , Any ]:
1422- """ validate / deprecate formats; return the new kwargs """
1423- kwargs = kwargs .copy ()
1421+ def _validate_format (self , format : str ) -> str :
1422+ """ validate / deprecate formats """
14241423
14251424 # validate
14261425 try :
1427- kwargs [ " format" ] = _FORMAT_MAP [format .lower ()]
1426+ format = _FORMAT_MAP [format .lower ()]
14281427 except KeyError :
14291428 raise TypeError (f"invalid HDFStore format specified [{ format } ]" )
14301429
1431- return kwargs
1430+ return format
14321431
14331432 def _create_storer (
14341433 self ,
@@ -1532,7 +1531,7 @@ def error(t):
15321531 def _write_to_group (
15331532 self ,
15341533 key : str ,
1535- value ,
1534+ value : FrameOrSeries ,
15361535 format ,
15371536 axes = None ,
15381537 index = True ,
@@ -1615,10 +1614,10 @@ def _write_to_group(
16151614 if isinstance (s , Table ) and index :
16161615 s .create_index (columns = index )
16171616
1618- def _read_group (self , group : "Node" , ** kwargs ):
1617+ def _read_group (self , group : "Node" ):
16191618 s = self ._create_storer (group )
16201619 s .infer_axes ()
1621- return s .read (** kwargs )
1620+ return s .read ()
16221621
16231622
16241623class TableIterator :
@@ -2752,28 +2751,22 @@ def f(values, freq=None, tz=None):
27522751
27532752 return klass
27542753
2755- def validate_read (self , kwargs : Dict [ str , Any ]) -> Dict [ str , Any ] :
2754+ def validate_read (self , columns , where ) :
27562755 """
2757- remove table keywords from kwargs and return
27582756 raise if any keywords are passed which are not-None
27592757 """
2760- kwargs = copy .copy (kwargs )
2761-
2762- columns = kwargs .pop ("columns" , None )
27632758 if columns is not None :
27642759 raise TypeError (
27652760 "cannot pass a column specification when reading "
27662761 "a Fixed format store. this store must be "
27672762 "selected in its entirety"
27682763 )
2769- where = kwargs .pop ("where" , None )
27702764 if where is not None :
27712765 raise TypeError (
27722766 "cannot pass a where specification when reading "
27732767 "from a Fixed format store. this store must be "
27742768 "selected in its entirety"
27752769 )
2776- return kwargs
27772770
27782771 @property
27792772 def is_exists (self ) -> bool :
@@ -3085,7 +3078,7 @@ def read(
30853078 start : Optional [int ] = None ,
30863079 stop : Optional [int ] = None ,
30873080 ):
3088- self .validate_read ({ "where" : where , "columns" : columns } )
3081+ self .validate_read (columns , where )
30893082 index = self .read_index ("index" , start = start , stop = stop )
30903083 values = self .read_array ("values" , start = start , stop = stop )
30913084 return Series (values , index = index , name = self .name )
@@ -3142,7 +3135,7 @@ def read(
31423135 stop : Optional [int ] = None ,
31433136 ):
31443137 # start, stop applied to rows, so 0th axis only
3145- self .validate_read ({ " columns" : columns , " where" : where } )
3138+ self .validate_read (columns , where )
31463139 select_axis = self .obj_type ()._get_block_manager_axis (0 )
31473140
31483141 axes = []
0 commit comments