git://git.onelab.eu
/
nepi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
systematic use of context managers for dealing with files instead of open()/close...
[nepi.git]
/
src
/
nepi
/
resources
/
omf
/
application.py
diff --git
a/src/nepi/resources/omf/application.py
b/src/nepi/resources/omf/application.py
index
8384024
..
8afb7c1
100644
(file)
--- a/
src/nepi/resources/omf/application.py
+++ b/
src/nepi/resources/omf/application.py
@@
-286,13
+286,11
@@
class OMFApplication(OMFResource):
if attr == TraceAttr.ALL:
try:
- f = open(trace_path ,'r')
+ with open(trace_path ,'r') as f:
+ return f.read()
except IOError:
print("File with traces has not been found")
return False
- out = f.read()
- f.close()
- return out
def do_start(self):