Skip to content

Commit

Permalink
Added @WillAyd typing suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
MomIsBestFriend committed Dec 24, 2019
1 parent 6f4865a commit 115d3ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
18 changes: 2 additions & 16 deletions pandas/io/formats/css.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 6 additions & 7 deletions pandas/io/formats/csvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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",
Expand All @@ -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
Expand Down

0 comments on commit 115d3ef

Please sign in to comment.