Skip to content
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

Update Typing Comments to Python3 Syntax #25790

Closed
2 tasks
WillAyd opened this issue Mar 19, 2019 · 1 comment
Closed
2 tasks

Update Typing Comments to Python3 Syntax #25790

WillAyd opened this issue Mar 19, 2019 · 1 comment
Labels
good first issue Typing type annotations, mypy/pyright type checking
Milestone

Comments

@WillAyd
Copy link
Member

WillAyd commented Mar 19, 2019

This should be done after #25789

Not necessarily analyzing types yet, but I think it makes sense from a readability perspective to start switching over to Python3 syntax for types. A quick grep shows 70 of these in the code base:

pandas/core/dtypes/base.py:        # type: () -> Optional[List[str]]
pandas/core/dtypes/base.py:        # type: () -> bool
pandas/core/dtypes/base.py:        # type: () -> bool
pandas/core/dtypes/base.py:        # type: () -> Type
pandas/core/dtypes/base.py:        # type: () -> str
pandas/core/groupby/groupby.py:            # type: (np.ndarray) -> (np.ndarray, Type)
pandas/core/groupby/groupby.py:            # type: (np.ndarray, Type) -> np.ndarray
pandas/core/groupby/groupby.py:            # type: (np.ndarray) -> (np.ndarray, Optional[Type])
pandas/core/groupby/groupby.py:            # type: (np.ndarray, Optional[Type]) -> np.ndarray
pandas/core/internals/blocks.py:              periods,                  # type: int
pandas/core/internals/blocks.py:              axis=0,                   # type: libinternals.BlockPlacement
pandas/core/internals/blocks.py:              fill_value=None):         # type: Any
pandas/core/internals/blocks.py:        # type: (...) -> List[ExtensionBlock]
pandas/core/internals/managers.py:    # type: (List[Block]) -> Optional[Union[np.dtype, ExtensionDtype]]
pandas/core/common.py:    # type: (Any) -> bool
pandas/core/arrays/datetimes.py:    _dtype = None  # type: Union[np.dtype, DatetimeTZDtype]
pandas/core/arrays/datetimes.py:        # type: () -> Union[np.dtype, DatetimeTZDtype]
pandas/core/arrays/integer.py:        # type: () -> np.ndarray
pandas/core/arrays/integer.py:        # type: () -> np.ndarray
pandas/core/arrays/period.py:        # type: (Sequence[Optional[Period]], PeriodDtype, bool) -> PeriodArray
pandas/core/arrays/period.py:        # type: (Union[Period, NaTType]) -> int
pandas/core/arrays/period.py:        # type: (str) -> Period
pandas/core/arrays/period.py:            other,      # type: Union[ExtensionArray, np.ndarray[int]]
pandas/core/arrays/period.py:            op          # type: Callable[Any, Any]
pandas/core/arrays/period.py:        # type: (...) -> PeriodArray
pandas/core/arrays/period.py:    # type: (Sequence[Optional[Period]], Optional[Tick], bool) -> PeriodArray
pandas/core/arrays/sparse.py:        # type: (Union[str, np.dtype, 'ExtensionDtype', type], Any) -> None
pandas/core/arrays/sparse.py:    # type: (SparseArray) -> np.ndarray
pandas/core/arrays/sparse.py:    # type: (SparseArray, SparseArray, Callable, str) -> Any
pandas/core/arrays/sparse.py:        # type: (np.ndarray, SparseIndex, SparseDtype) -> 'SparseArray'
pandas/core/arrays/datetimelike.py:        # type: () -> Union[type, Tuple[type]]
pandas/core/arrays/datetimelike.py:        # type: (str) -> Union[Period, Timestamp, Timedelta, NaTType]
pandas/core/arrays/datetimelike.py:        # type: (Union[Period, Timestamp, Timedelta, NaTType]) -> int
pandas/core/arrays/datetimelike.py:        # type: (Union[Period, Timestamp, Timedelta, NaTType]) -> None
pandas/core/arrays/datetimelike.py:        # type: () -> np.ndarray
pandas/core/arrays/datetimelike.py:        # type: () -> int
pandas/core/arrays/datetimelike.py:            key,    # type: Union[int, Sequence[int], Sequence[bool], slice]
pandas/core/arrays/datetimelike.py:            value,  # type: Union[NaTType, Any, Sequence[Any]]
pandas/core/arrays/datetimelike.py:        # type: (...) -> None
pandas/core/arrays/array_.py:def array(data,         # type: Sequence[object]
pandas/core/arrays/array_.py:          dtype=None,   # type: Optional[Union[str, np.dtype, ExtensionDtype]]
pandas/core/arrays/array_.py:          copy=True,    # type: bool
pandas/core/arrays/array_.py:    # type: (...) -> ExtensionArray
pandas/core/arrays/base.py:        # type: (Union[int, np.ndarray], Any) -> None
pandas/core/arrays/base.py:        # type: () -> int
pandas/core/arrays/base.py:        # type: () -> ExtensionDtype
pandas/core/arrays/base.py:        # type: () -> Tuple[int, ...]
pandas/core/arrays/base.py:        # type: () -> int
pandas/core/arrays/base.py:        # type: () -> int
pandas/core/arrays/base.py:        # type: () -> Union[ExtensionArray, np.ndarray]
pandas/core/arrays/base.py:        # type: () -> np.ndarray
pandas/core/arrays/base.py:        # type: (int, object) -> ExtensionArray
pandas/core/arrays/base.py:        # type: () -> Tuple[np.ndarray, Any]
pandas/core/arrays/base.py:        # type: (int) -> Tuple[np.ndarray, ExtensionArray]
pandas/core/arrays/base.py:        # type: (Sequence[int], bool, Optional[Any]) -> ExtensionArray
pandas/core/arrays/base.py:        # type: (bool) -> ExtensionArray
pandas/core/arrays/base.py:        # type: (bool) -> Callable[[Any], Optional[str]]
pandas/core/arrays/base.py:        # type: () -> np.ndarray
pandas/core/arrays/base.py:        # type: (Sequence[ExtensionArray]) -> ExtensionArray
pandas/core/arrays/base.py:        # type: () -> np.ndarray
pandas/core/frame.py:                 key,           # type: Union[str, List[str]]
pandas/core/frame.py:                 ndim,          # type: int
pandas/core/frame.py:                 subset=None    # type: Union[Series, DataFrame, None]
pandas/core/frame.py:        # type: (...) -> Union[Series, DataFrame]
pandas/core/base.py:        # type: () -> ExtensionArray
pandas/core/base.py:        # type: () -> np.ndarray
pandas/core/indexes/period.py:    _data = None  # type: PeriodArray
pandas/core/indexes/datetimelike.py:    _data = None  # type: DatetimeLikeArrayMixin
pandas/core/indexes/datetimelike.py:        # type: () -> np.ndarray
pandas/core/indexes/base.py:        # type: () -> Union[ExtensionArray, Index, np.ndarray]

I think it makes sense to break this up into 2 PRs:

  • Everything in pandas/core/arrays
  • Everything else
@WillAyd WillAyd added Code Style Code style, linting, code_checks good first issue labels Mar 19, 2019
@WillAyd WillAyd added this to the Contributions Welcome milestone Mar 19, 2019
@WillAyd WillAyd added Typing type annotations, mypy/pyright type checking and removed Code Style Code style, linting, code_checks labels Mar 20, 2019
@gwrome
Copy link
Contributor

gwrome commented Mar 20, 2019

I’ll work on these.

gwrome added a commit to gwrome/pandas that referenced this issue Mar 20, 2019
gwrome added a commit to gwrome/pandas that referenced this issue Mar 20, 2019
gwrome added a commit to gwrome/pandas that referenced this issue Mar 22, 2019
gwrome added a commit to gwrome/pandas that referenced this issue Mar 22, 2019
gwrome added a commit to gwrome/pandas that referenced this issue Mar 28, 2019
gwrome added a commit to gwrome/pandas that referenced this issue Mar 28, 2019
gwrome added a commit to gwrome/pandas that referenced this issue Mar 28, 2019
@jreback jreback modified the milestones: Contributions Welcome, 0.25.0 Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

No branches or pull requests

3 participants