1
- #!/usr/bin/env python2
1
+ #!/usr/bin/env python
2
2
3
3
### This program is free software; you can redistribute it and/or
4
4
### modify it under the terms of the GNU General Public License
@@ -151,7 +151,7 @@ class Options:
151
151
152
152
elif opt in ['--all-plugins' ]:
153
153
### Make list unique in a fancy fast way
154
- plugins = {}.fromkeys (allplugins ).keys ()
154
+ plugins = list ( {}.fromkeys (allplugins ).keys () )
155
155
plugins .sort ()
156
156
self .plugins += plugins
157
157
elif opt in ['--bits' ]:
@@ -1837,7 +1837,7 @@ def set_theme():
1837
1837
def ticks ():
1838
1838
"Return the number of 'ticks' since bootup"
1839
1839
try :
1840
- for line in open ('/proc/uptime' , 'r' , 0 ).readlines ():
1840
+ for line in open ('/proc/uptime' , 'r' ).readlines ():
1841
1841
l = line .split ()
1842
1842
if len (l ) < 2 : continue
1843
1843
return float (l [0 ])
@@ -2555,12 +2555,12 @@ def main():
2555
2555
### Prepare CSV output file (unbuffered)
2556
2556
if op .output :
2557
2557
if not os .path .exists (op .output ):
2558
- outputfile = open (op .output , 'w' , 0 )
2558
+ outputfile = open (op .output , 'w' )
2559
2559
outputfile .write ('"Dstat %s CSV output"\n ' % VERSION )
2560
2560
header = (
'"Author:","Dag Wieers <[email protected] >"' ,
'' ,
'' ,
'' ,
'"URL:"' ,
'"http://dag.wieers.com/home-made/dstat/"\n ' )
2561
2561
outputfile .write (char ['sep' ].join (header ))
2562
2562
else :
2563
- outputfile = open (op .output , 'a' , 0 )
2563
+ outputfile = open (op .output , 'a' )
2564
2564
outputfile .write ('\n \n ' )
2565
2565
2566
2566
header = ('"Host:"' ,'"%s"' % hostname ,'' ,'' ,'' ,'"User:"' ,'"%s"\n ' % user )
@@ -2571,7 +2571,7 @@ def main():
2571
2571
### Create pidfile
2572
2572
if op .pidfile :
2573
2573
try :
2574
- pidfile = open (op .pidfile , 'w' , 0 )
2574
+ pidfile = open (op .pidfile , 'w' )
2575
2575
pidfile .write (str (os .getpid ()))
2576
2576
pidfile .close ()
2577
2577
except Exception as e :
0 commit comments