Skip to content

Commit

Permalink
Merge pull request #218 from gerlero/files
Browse files Browse the repository at this point in the history
Update FoamFile header writing logic
  • Loading branch information
gerlero authored Oct 6, 2024
2 parents d1656a5 + 8cb66c0 commit dcad2bc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions foamlib/_files/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,10 @@ def __setitem__(

try:
write_header = (
not self
and "FoamFile" not in self
and (not keywords or keywords[0] != "FoamFile")
not self and "FoamFile" not in self and keywords != ("FoamFile",)
)
except FileNotFoundError:
write_header = not keywords or keywords[0] != "FoamFile"
write_header = keywords != ("FoamFile",)

if write_header:
self["FoamFile"] = {}
Expand Down

0 comments on commit dcad2bc

Please sign in to comment.