@@ -112,8 +112,7 @@ class _read_shared(TypedDict, Generic[HashableT], total=False):
112112 skipfooter : int
113113 nrows : int | None
114114 na_values : (
115- Hashable | Iterable [Hashable ] | Mapping [Hashable ,
116- Iterable [Hashable ]] | None
115+ Hashable | Iterable [Hashable ] | Mapping [Hashable , Iterable [Hashable ]] | None
117116 )
118117 keep_default_na : bool
119118 na_filter : bool
@@ -578,10 +577,7 @@ class _Fwf_Defaults(TypedDict):
578577 widths : None
579578
580579
581- _fwf_defaults : _Fwf_Defaults = {
582- "colspecs" : "infer" ,
583- "infer_nrows" : 100 ,
584- "widths" : None }
580+ _fwf_defaults : _Fwf_Defaults = {"colspecs" : "infer" , "infer_nrows" : 100 , "widths" : None }
585581_c_unsupported = {"skipfooter" }
586582_python_unsupported = {"low_memory" , "float_precision" }
587583_pyarrow_unsupported = {
@@ -612,10 +608,7 @@ def validate_integer(name: str, val: float, min_val: int = ...) -> int: ...
612608
613609
614610@overload
615- def validate_integer (
616- name : str ,
617- val : int | None ,
618- min_val : int = ...) -> int | None : ...
611+ def validate_integer (name : str , val : int | None , min_val : int = ...) -> int | None : ...
619612
620613
621614def validate_integer (
@@ -669,9 +662,7 @@ def _validate_names(names: Sequence[Hashable] | None) -> None:
669662 if len (names ) != len (set (names )):
670663 raise ValueError ("Duplicate names are not allowed." )
671664 if not (
672- is_list_like (
673- names , allow_sets = False ) or isinstance (
674- names , abc .KeysView )
665+ is_list_like (names , allow_sets = False ) or isinstance (names , abc .KeysView )
675666 ):
676667 raise ValueError ("Names should be an ordered collection." )
677668
@@ -790,8 +781,7 @@ def read_csv(
790781 nrows : int | None = None ,
791782 # NA and Missing Data Handling
792783 na_values : (
793- Hashable | Iterable [Hashable ] | Mapping [Hashable ,
794- Iterable [Hashable ]] | None
784+ Hashable | Iterable [Hashable ] | Mapping [Hashable , Iterable [Hashable ]] | None
795785 ) = None ,
796786 keep_default_na : bool = True ,
797787 na_filter : bool = True ,
@@ -1370,8 +1360,7 @@ def read_table(
13701360 nrows : int | None = None ,
13711361 # NA and Missing Data Handling
13721362 na_values : (
1373- Hashable | Iterable [Hashable ] | Mapping [Hashable ,
1374- Iterable [Hashable ]] | None
1363+ Hashable | Iterable [Hashable ] | Mapping [Hashable , Iterable [Hashable ]] | None
13751364 ) = None ,
13761365 keep_default_na : bool = True ,
13771366 na_filter : bool = True ,
@@ -1985,8 +1974,7 @@ def read_fwf(
19851974 if colspecs is None and widths is None :
19861975 raise ValueError ("Must specify either colspecs or widths" )
19871976 if colspecs not in (None , "infer" ) and widths is not None :
1988- raise ValueError (
1989- "You must specify only one of 'widths' and 'colspecs'" )
1977+ raise ValueError ("You must specify only one of 'widths' and 'colspecs'" )
19901978
19911979 # Compute 'colspecs' from 'widths', if specified.
19921980 if widths is not None :
@@ -2016,11 +2004,9 @@ def read_fwf(
20162004 assert index_col is not lib .no_default
20172005
20182006 len_index = len (index_col )
2019- if kwds .get ("usecols" ) is None and len (
2020- names ) + len_index != len (colspecs ):
2007+ if kwds .get ("usecols" ) is None and len (names ) + len_index != len (colspecs ):
20212008 # If usecols is used colspec may be longer than names
2022- raise ValueError (
2023- "Length of colspecs must match length of names" )
2009+ raise ValueError ("Length of colspecs must match length of names" )
20242010
20252011 check_dtype_backend (kwds .setdefault ("dtype_backend" , lib .no_default ))
20262012 return _read (
@@ -2112,8 +2098,7 @@ def _get_options_with_defaults(self, engine: CSVEngine) -> dict[str, Any]:
21122098 and value != getattr (value , "value" , default )
21132099 ):
21142100 raise ValueError (
2115- f"The {
2116- argname !r} option is not supported with the 'pyarrow' engine"
2101+ f"The { argname !r} option is not supported with the 'pyarrow' engine"
21172102 )
21182103 options [argname ] = value
21192104
@@ -2129,8 +2114,7 @@ def _get_options_with_defaults(self, engine: CSVEngine) -> dict[str, Any]:
21292114 pass
21302115 else :
21312116 raise ValueError (
2132- f"The {
2133- argname !r} option is not supported with the "
2117+ f"The { argname !r} option is not supported with the "
21342118 f"{ engine !r} engine"
21352119 )
21362120 else :
@@ -2231,8 +2215,7 @@ def _clean_options(
22312215
22322216 if "python" in engine :
22332217 for arg in _python_unsupported :
2234- if fallback_reason and result [arg ] != _c_parser_defaults .get (
2235- arg ):
2218+ if fallback_reason and result [arg ] != _c_parser_defaults .get (arg ):
22362219 raise ValueError (
22372220 "Falling back to the 'python' engine because "
22382221 f"{ fallback_reason } , but this causes { arg !r} to be "
@@ -2331,8 +2314,7 @@ def _make_engine(
23312314
23322315 if engine not in mapping :
23332316 raise ValueError (
2334- f"Unknown engine: { engine } (valid options are {
2335- mapping .keys ()} )"
2317+ f"Unknown engine: { engine } (valid options are { mapping .keys ()} )"
23362318 )
23372319 if not isinstance (f , list ):
23382320 # open file here
@@ -2436,8 +2418,7 @@ def read(self, nrows: int | None = None) -> DataFrame:
24362418 if pandas_dtype (dtype [k ]) in (np .str_ , np .object_ )
24372419 else None
24382420 )
2439- new_col_dict [k ] = Series (
2440- v , index = index , dtype = d , copy = False )
2421+ new_col_dict [k ] = Series (v , index = index , dtype = d , copy = False )
24412422 else :
24422423 new_col_dict = col_dict
24432424
@@ -2528,8 +2509,7 @@ def TextParser(*args, **kwds) -> TextFileReader:
25282509 return TextFileReader (* args , ** kwds )
25292510
25302511
2531- def _clean_na_values (na_values , keep_default_na : bool = True ,
2532- floatify : bool = True ):
2512+ def _clean_na_values (na_values , keep_default_na : bool = True , floatify : bool = True ):
25332513 na_fvalues : set | dict
25342514 if na_values is None :
25352515 if keep_default_na :
@@ -2669,8 +2649,7 @@ def _refine_defaults_read(
26692649 )
26702650
26712651 if delimiter and (sep is not lib .no_default ):
2672- raise ValueError (
2673- "Specified a sep and a delimiter; you can only specify one." )
2652+ raise ValueError ("Specified a sep and a delimiter; you can only specify one." )
26742653
26752654 kwds ["names" ] = None if names is lib .no_default else names
26762655
@@ -2711,8 +2690,7 @@ def _refine_defaults_read(
27112690 )
27122691 kwds ["on_bad_lines" ] = on_bad_lines
27132692 else :
2714- raise ValueError (
2715- f"Argument { on_bad_lines } is invalid for on_bad_lines" )
2693+ raise ValueError (f"Argument { on_bad_lines } is invalid for on_bad_lines" )
27162694
27172695 check_dtype_backend (dtype_backend )
27182696
0 commit comments