Skip to content

Variable endpoints undefined when order is not ascending or descending #594

@malmans2

Description

@malmans2

Today I ran into this error:

UnboundLocalError: cannot access local variable 'endpoints' where it is not associated with a value

Sorry I don't have a minimal reproducible example yet. I'll try to make one ASAP.
Just posting in case others already know what's going on.

From what I can tell, this happens because the case where order not in ["ascending", "descending"] isn't covered.
See:

if order == "ascending":
endpoints = np.minimum(bounds[..., :, 0], bounds[..., :, 1])
last_endpoint = np.maximum(bounds[..., -1, 0], bounds[..., -1, 1])
elif order == "descending":
endpoints = np.maximum(bounds[..., :, 0], bounds[..., :, 1])
last_endpoint = np.minimum(bounds[..., -1, 0], bounds[..., -1, 1])

This seems to have been introduced with PR #579
Maybe @tomvothecoder has thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions