ROCm / ROC-smi

ROC System Management Interface
https://github.com/RadeonOpenCompute/ROC-smi/blob/master/README.md
178 stars 55 forks source link

Fix python3.8 SyntaxWarning: "is" with a literal. Did you mean "=="? #88

Closed jedbrown closed 4 years ago

jedbrown commented 4 years ago

is shouldn't be used in this context due to surprising results such as

>>> foo = 'abcd'[:3]
>>> foo is 'abc'
False

Cc: @moes1

$ ./rocm_smi.py                                                                                                                                                 
./rocm_smi.py:816: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  if clocktype is 'freq':                                                                      
./rocm_smi.py:901: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  if component is 'driver':                                                                    
./rocm_smi.py:923: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  if (retiredType is 'all' or \                                                                                                                                                                
./rocm_smi.py:924: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  retiredType is 'retired' and pgType is 'R' or \                                              
./rocm_smi.py:924: SyntaxWarning: "is" with a literal. Did you mean "=="?                                                                                                                      
  retiredType is 'retired' and pgType is 'R' or \                                                                                                                                              
./rocm_smi.py:925: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  retiredType is 'pending' and pgType is 'P' or \                                              
./rocm_smi.py:925: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  retiredType is 'pending' and pgType is 'P' or \                                              
./rocm_smi.py:926: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  retiredType is 'unreservable' and pgType is 'F'):                                            
./rocm_smi.py:926: SyntaxWarning: "is" with a literal. Did you mean "=="?                      
  retiredType is 'unreservable' and pgType is 'F'):                                            
./rocm_smi.py:1501: SyntaxWarning: "is" with a literal. Did you mean "=="?                                                                                                                     
  if component is 'driver':                                                                                                                                                                    
./rocm_smi.py:1938: SyntaxWarning: "is" with a literal. Did you mean "=="?                     
  if ptype is 'R':                                                                             
./rocm_smi.py:1940: SyntaxWarning: "is" with a literal. Did you mean "=="?                                                                                                                     
  elif ptype is 'P':                                                                           
./rocm_smi.py:2395: SyntaxWarning: "is" with a literal. Did you mean "=="?                     
  if clkType is 'sclk':                                                                        
./rocm_smi.py:2397: SyntaxWarning: "is" with a literal. Did you mean "=="?                                                                                                                     
  elif clkType is 'mclk':                                                                      

========================ROCm System Management Interface========================
================================================================================
GPU  Temp   AvgPwr  SCLK    MCLK    Fan     Perf  PwrCap  VRAM%  GPU%  
1    28.0c  26.0W   809Mhz  351Mhz  21.96%  auto  250.0W    0%   0%    
================================================================================
==============================End of ROCm SMI Log ==============================
moes1 commented 4 years ago

@JustinTArthur It looks like you approved a very similar set of changes before in: https://github.com/RadeonOpenCompute/ROC-smi/pull/80

Do you know if there a reason we didn't incorporate those changes?

moes1 commented 4 years ago

CC @kentrussell ?

kentrussell commented 4 years ago

We ended up missing the 3.5 cutoff due to some critical bugs. I'm trying to get the fix for this issue (IE my poor choice in operators) into 3.6 Basically everything is high priority, and since we didn't have Python3.8 on the test machines in automation, it got bumped down in priority. Either way I've brought it internally and it's undergoing testing. I'll close off both of these PRs once it's released publicly. Sorry for the delay

kentrussell commented 4 years ago

Fixed in 3.6