diff --git a/pandas/io/formats/css.py b/pandas/io/formats/css.py index 334daab3083c0..b40d2a57b8106 100644 --- a/pandas/io/formats/css.py +++ b/pandas/io/formats/css.py @@ -15,25 +15,13 @@ class CSSWarning(UserWarning): def _side_expander(prop_fmt: str): - """ - Parameters - ---------- - prop_fmt : str - """ - def expand(self, prop, value: str): - """ - Parameters - ---------- - prop - value : str - """ tokens = value.split() try: mapping = self.SIDE_SHORTHANDS[len(tokens)] except KeyError: warnings.warn( - f"Could not expand {prop}: {value}", CSSWarning, + f'Could not expand "{prop}: {value}"', CSSWarning, ) return for key, idx in zip(self.SIDES, mapping): @@ -187,9 +175,7 @@ def __call__(self, declarations_str, inherited=None): def size_to_pt(self, in_val, em_pt=None, conversions=UNIT_RATIOS): def _error(): - warnings.warn( - f"Unhandled size: {repr(in_val)}", CSSWarning, - ) + warnings.warn(f"Unhandled size: {repr(in_val)}", CSSWarning) return self.size_to_pt("1!!default", conversions=conversions) try: diff --git a/pandas/io/formats/csvs.py b/pandas/io/formats/csvs.py index 9c6fb46d04db0..153de2b60d093 100644 --- a/pandas/io/formats/csvs.py +++ b/pandas/io/formats/csvs.py @@ -5,13 +5,14 @@ import csv as csvlib from io import StringIO import os -from typing import List, Optional, Sequence, Union +from typing import Hashable, List, Optional, Sequence, Union import warnings from zipfile import ZipFile import numpy as np from pandas._libs import writers as libwriters +from pandas._typing import FilePathOrBuffer from pandas.core.dtypes.generic import ( ABCDatetimeIndex, @@ -21,8 +22,6 @@ ) from pandas.core.dtypes.missing import notna -from pandas._typing import FilePathOrBuffer - from pandas.io.common import ( get_compression_method, get_filepath_or_buffer, @@ -38,11 +37,11 @@ def __init__( path_or_buf: Optional[FilePathOrBuffer[str]] = None, sep: str = ",", na_rep: str = "", - float_format=None, + float_format: Optional[str] = None, cols=None, - header: Union[bool, Sequence[str]] = True, + header: Union[bool, Sequence[Hashable]] = True, index: bool = True, - index_label=None, + index_label: Optional[Union[bool, Hashable, Sequence[Hashable]]] = None, mode: str = "w", encoding: Optional[str] = None, compression="infer", @@ -52,7 +51,7 @@ def __init__( quotechar: Optional[str] = '"', date_format: Optional[str] = None, doublequote: bool = True, - escapechar=None, + escapechar: Optional[str] = None, decimal: Optional[str] = ".", ): self.obj = obj