Skip to content

KeyError in SCHEDOPTIONS from missing keys in dictionary on older files #7

@sayer122

Description

@sayer122

Hi,
I was testing this package on some older xer files and have come across a few key errors in schemas/schedoptions.py
I see that it uses: data["max_multiple_longest_path"]
This is currently throwing a key error for me: KeyError: 'max_multiple_longest_path'
This does not account for scenarios where this key might be missing. Would it be possible to update this to use .get() instead to allow it to handle files where it does not contain these keys?
e.g. updating this:

        self.max_multiple_longest_path: int | None = optional_int(
            data["max_multiple_longest_path"]
        )

to this:

        self.max_multiple_longest_path: int | None = optional_int(
            data.get("max_multiple_longest_path")
        )

I've seen it happen for a few different keys in the schedoptions schema. I'll make a PR with the proposed fixes but would love to hear your feedback and whether you think this could cause any issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions