Skip to content

Incorrect signature for BMI initialize method #30

Open
@mcflugen

Description

@mcflugen

According to the BMI spec, the filename argument for the BMI initialize method must not be optional and must be a string. Right now BmiHeat.initialize accepts either None, a file-like object, or a string. I think this should be changed so that it only accepts a string that is a path to a configuration file.

i.e.

def initialize(self, filename: str):
    with open(filename) as file_obj:
        self._model = Heat.from_file_like(file_obj)
    ...

Actually, in looking at what's there now, I think there's also a bug. Heat.from_file_like must take a stream, not a string

i.e.

Heat.from_file_like(file_obj.read())

should be

Heat.from_file_like(file_obj)

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