Skip to content

TYP: clean for PY3.8 (Literal) #42385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Dict,
Hashable,
List,
Literal,
Mapping,
Optional,
Sequence,
Expand All @@ -37,7 +38,6 @@
# https://mypy.readthedocs.io/en/latest/common_issues.html#import-cycles
if TYPE_CHECKING:
from typing import (
Literal,
TypedDict,
final,
)
Expand Down Expand Up @@ -200,10 +200,7 @@
]

# Arguments for fillna()
if TYPE_CHECKING:
FillnaOptions = Literal["backfill", "bfill", "ffill", "pad"]
else:
FillnaOptions = str
FillnaOptions = Literal["backfill", "bfill", "ffill", "pad"]

# internals
Manager = Union[
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Literal,
Union,
cast,
)
Expand Down Expand Up @@ -79,7 +80,6 @@
from pandas.core.indexers import validate_indices

if TYPE_CHECKING:
from typing import Literal

from pandas import (
Categorical,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Any,
Callable,
Iterator,
Literal,
Sequence,
TypeVar,
cast,
Expand Down Expand Up @@ -72,7 +73,6 @@
)

if TYPE_CHECKING:
from typing import Literal

class ExtensionArraySupportsAnyAll("ExtensionArray"):
def any(self, *, skipna: bool = True) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
TYPE_CHECKING,
Any,
Callable,
Literal,
Sequence,
TypeVar,
Union,
Expand Down Expand Up @@ -121,7 +122,6 @@
from pandas.tseries import frequencies

if TYPE_CHECKING:
from typing import Literal

from pandas.core.arrays import (
DatetimeArray,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
)
from typing import (
TYPE_CHECKING,
Literal,
cast,
overload,
)
Expand Down Expand Up @@ -81,7 +82,6 @@
)

if TYPE_CHECKING:
from typing import Literal

from pandas import DataFrame
from pandas.core.arrays import (
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Any,
Generic,
Hashable,
Literal,
TypeVar,
cast,
)
Expand Down Expand Up @@ -64,7 +65,6 @@
import pandas.core.nanops as nanops

if TYPE_CHECKING:
from typing import Literal

from pandas import Categorical

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import (
TYPE_CHECKING,
Any,
Literal,
Sized,
TypeVar,
cast,
Expand Down Expand Up @@ -93,7 +94,6 @@
)

if TYPE_CHECKING:
from typing import Literal

from pandas.core.arrays import (
DatetimeArray,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Hashable,
Iterable,
Iterator,
Literal,
Sequence,
cast,
overload,
Expand Down Expand Up @@ -207,7 +208,6 @@
import pandas.plotting

if TYPE_CHECKING:
from typing import Literal

from pandas._typing import (
TimedeltaConvertibleTypes,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
AnyStr,
Callable,
Hashable,
Literal,
Mapping,
Sequence,
cast,
Expand Down Expand Up @@ -154,7 +155,6 @@
from pandas.io.formats.printing import pprint_thing

if TYPE_CHECKING:
from typing import Literal

from pandas._libs.tslibs import BaseOffset
from pandas._typing import RandomState
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class providing the base-class of operations.
Iterable,
Iterator,
List,
Literal,
Mapping,
Sequence,
TypeVar,
Expand Down Expand Up @@ -109,7 +110,6 @@ class providing the base-class of operations.
)

if TYPE_CHECKING:
from typing import Literal

from pandas._typing import RandomState

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Any,
Callable,
Hashable,
Literal,
Sequence,
TypeVar,
cast,
Expand Down Expand Up @@ -159,7 +160,6 @@
)

if TYPE_CHECKING:
from typing import Literal

from pandas import (
CategoricalIndex,
Expand Down
5 changes: 1 addition & 4 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from datetime import timedelta
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Callable,
Hashable,
Literal,
no_type_check,
)

Expand Down Expand Up @@ -88,9 +88,6 @@
Tick,
)

if TYPE_CHECKING:
from typing import Literal

_shared_docs_kwargs: dict[str, str] = {}


Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Callable,
Hashable,
Iterable,
Literal,
Sequence,
Union,
cast,
Expand Down Expand Up @@ -140,7 +141,6 @@
import pandas.plotting

if TYPE_CHECKING:
from typing import Literal

from pandas._typing import (
TimedeltaConvertibleTypes,
Expand Down