Skip to content

Failure when function parameter default value repr isn't valid python #44

Closed
@virtuald

Description

@virtuald
[2020-09-03 01:39:32,372] {__init__.py:60} ERROR - Generated stubs signature is degraded to `(*args, **kwargs) -> Any` for
[2020-09-03 01:39:32,372] {__init__.py:65} ERROR - def __init__(self: wpilib.controller._controller.trajectory.TrapezoidProfile, constraints: wpilib.controller._controller.trajectory.TrapezoidProfile.Constraints, goal: wpilib.controller._controller.trajectory.TrapezoidProfile.State, initial: wpilib.controller._controller.trajectory.TrapezoidProfile.State = <wpilib.controller._controller.trajectory.TrapezoidProfile.State object at 0x7fc9b00663b0>) -> None: ...

If I'm understanding the implementation correctly, it looks like mypy's stubgen will set it to ...?

Tried it out, looks like I'm right:

class A:
    pass


def foo(x: int = 5):
    pass


def a(a: A = A()):
    pass

Resulting generated pyi

from typing import Any

class A: ...

def foo(x: int=...) -> Any: ...
def a(a: A=...) -> Any: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions