GunnerLab / Stable-MCCE

Stable version of MCCE.
MIT License
8 stars 14 forks source link

Use context manager for all Open statements #256

Open CatChenal opened 9 months ago

CatChenal commented 9 months ago

In the python code base, all open statements lack a close statement. Using a context manager, i.e.

with open(<filename>) as f:
    #do something with f
...

takes care of the proper file closing.

CatChenal commented 9 months ago

I would like to attach a label (Good first issue).

newbooks commented 9 months ago

Don't worry about one liner open statements in the existing code. The file would be closed automatically if the open statement didn't create a file handler.

Junjun

On Fri, Sep 22, 2023 at 1:20 PM Cat Chenal @.***> wrote:

In the python code base, all open statements lack a close statement. Using a context manager, i.e.

with open() as f:

do something with f

...

takes care of the proper file closing.

— Reply to this email directly, view it on GitHub https://github.com/GunnerLab/Stable-MCCE/issues/256, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPRCWV3WLLD62OUT66WR6TX3XCG5ANCNFSM6AAAAAA5DM7HLY . You are receiving this because you are subscribed to this thread.Message ID: @.***>