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
/
netns
/
netnswrapper_debug.py
diff --git
a/src/nepi/resources/netns/netnswrapper_debug.py
b/src/nepi/resources/netns/netnswrapper_debug.py
index
17ae1f2
..
462b730
100644
(file)
--- a/
src/nepi/resources/netns/netnswrapper_debug.py
+++ b/
src/nepi/resources/netns/netnswrapper_debug.py
@@
-46,9
+46,8
@@
class NetNSWrapperDebuger(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: