Skip to content

register_dataframe_accessor causes "Untyped class decorator obscures type of class; ignoring decorator" #906

Closed
@davetapley

Description

@davetapley

Describe the bug
Example from the docs causes:

Untyped class decorator obscures type of class; ignoring decoratorPylance[reportUntypedClassDecorator](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUntypedClassDecorator)

in VSCode.

To Reproduce

In VSCode:

@pd.api.extensions.register_dataframe_accessor("geo")
class GeoAccessor:
    ...

Please complete the following information:

  • OS: Ubuntu
  • OS Version 20.04
  • python version 3.11
  • version of type checker pyright v1.1.354
  • version of installed pandas-stubs v2.2.1.240316

Additional context

This fixes it, PR welcome?

from typing import Callable, TypeVar

T = TypeVar('T')  # return type

def register_dataframe_accessor(name: str) -> Callable[[T], T]: ...

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions