Skip to content

Commit a62b8a4

Browse files
committed
Make None defaults Optional and pin utf-8 in to_file
1 parent 6276d1d commit a62b8a4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

petab/v1/models/bngl_model.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class BnglModel(Model):
259259
def __init__(
260260
self,
261261
model: BnglEntities,
262-
model_id: str = None,
262+
model_id: str | None = None,
263263
rel_path: Path | str | None = None,
264264
base_path: str | Path | None = None,
265265
):
@@ -280,7 +280,9 @@ def __init__(
280280

281281
@staticmethod
282282
def from_file(
283-
filepath_or_buffer, model_id: str = None, base_path: str | Path = None
283+
filepath_or_buffer,
284+
model_id: str | None = None,
285+
base_path: str | Path | None = None,
284286
) -> BnglModel:
285287
path = Path(_generate_path(filepath_or_buffer, base_path))
286288
text = path.read_text(encoding="utf-8", errors="replace")
@@ -293,7 +295,7 @@ def from_file(
293295

294296
def to_file(self, filename: str | Path | None = None) -> None:
295297
target = filename or _generate_path(self.rel_path, self.base_path)
296-
with open(target, "w") as f:
298+
with open(target, "w", encoding="utf-8") as f:
297299
f.write(self.model.text)
298300

299301
@property

0 commit comments

Comments
 (0)