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
/
ns3
/
ns3wrapper_debug.py
diff --git
a/src/nepi/resources/ns3/ns3wrapper_debug.py
b/src/nepi/resources/ns3/ns3wrapper_debug.py
index
7368448
..
332f63b
100644
(file)
--- a/
src/nepi/resources/ns3/ns3wrapper_debug.py
+++ b/
src/nepi/resources/ns3/ns3wrapper_debug.py
@@
-48,9
+48,8
@@
class NS3WrapperDebuger(object):
return self._script_path
def dump_to_script(self, command):
- f = open(self.script_path, "a")
- f.write("%s" % command)
- f.close()
+ with open(self.script_path, "a") as f:
+ f.write("%s" % command)
def dump_header(self):
if not self.enabled: