@@ -829,34 +829,34 @@ def report_memory(i=0): # argument may go away
829829 pid = os .getpid ()
830830 if sys .platform == 'sunos5' :
831831 try :
832- a2 = Popen (str ( 'ps -p %d -o osz' ) % pid , shell = True ,
832+ a2 = Popen ('ps -p %d -o osz' % pid , shell = True ,
833833 stdout = PIPE ).stdout .readlines ()
834834 except OSError :
835835 raise NotImplementedError (
836836 "report_memory works on Sun OS only if "
837837 "the 'ps' program is found" )
838838 mem = int (a2 [- 1 ].strip ())
839- elif sys .platform . startswith ( 'linux' ) :
839+ elif sys .platform == 'linux' :
840840 try :
841- a2 = Popen (str ( 'ps -p %d -o rss,sz' ) % pid , shell = True ,
841+ a2 = Popen ('ps -p %d -o rss,sz' % pid , shell = True ,
842842 stdout = PIPE ).stdout .readlines ()
843843 except OSError :
844844 raise NotImplementedError (
845845 "report_memory works on Linux only if "
846846 "the 'ps' program is found" )
847847 mem = int (a2 [1 ].split ()[1 ])
848- elif sys .platform . startswith ( 'darwin' ) :
848+ elif sys .platform == 'darwin' :
849849 try :
850- a2 = Popen (str ( 'ps -p %d -o rss,vsz' ) % pid , shell = True ,
850+ a2 = Popen ('ps -p %d -o rss,vsz' % pid , shell = True ,
851851 stdout = PIPE ).stdout .readlines ()
852852 except OSError :
853853 raise NotImplementedError (
854854 "report_memory works on Mac OS only if "
855855 "the 'ps' program is found" )
856856 mem = int (a2 [1 ].split ()[0 ])
857- elif sys .platform . startswith ( 'win' ) :
857+ elif sys .platform == 'win32' :
858858 try :
859- a2 = Popen ([str ( "tasklist" ) , "/nh" , "/fi" , "pid eq %d" % pid ],
859+ a2 = Popen (["tasklist" , "/nh" , "/fi" , "pid eq %d" % pid ],
860860 stdout = PIPE ).stdout .read ()
861861 except OSError :
862862 raise NotImplementedError (
0 commit comments