Skip to content

Defaults for enum args become ... #176

Open
@Kile

Description

@Kile

With this Rust code

#[gen_stub_pyclass_enum]
#[pyclass(eq, eq_int)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum DayTime {
    Day,
    Night
}

#[gen_stub_pyfunction]
#[pyo3(signature = ( day_time = DayTime.Day ))]
fn some_function(day_time: DayTime) {
    // ...
}

some_function will get annotated as

def some_function(day_time:DayTime=...): ...

I understand for complex classes defaulting to ... makes sense, but especially for enums it would be very helpful to know the default enum value and it shouldn't be too hard to implement.

If you agree I am happy to look into it and make a PR, will take me a bit to get more familiar with the code though, would be happy for anyone to give me some leads.

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