← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1267300] [NEW] type() method should be replaced with isinstance() in nova/utils.py

 

Public bug reported:

In nova/utils.py, a func use the "type" method to determine the type. It's bertter to use the "isinstance" method instead.
The code is:
def convert_version_to_int(version):
    try:   
        if type(version) == str:            
            version = convert_version_to_tuple(version)        
       if type(version) == tuple:            
           return reduce(lambda x, y: (x * 1000) + y, version)    
    except Exception:         
           raise exception.NovaException(message="Hypervisor version invalid.")


.

** Affects: nova
     Importance: Undecided
     Assignee: lizheming (lizheming-li)
         Status: New

** Changed in: nova
     Assignee: (unassigned) => lizheming (lizheming-li)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1267300

Title:
  type() method should be replaced with isinstance() in nova/utils.py

Status in OpenStack Compute (Nova):
  New

Bug description:
  In nova/utils.py, a func use the "type" method to determine the type. It's bertter to use the "isinstance" method instead.
  The code is:
  def convert_version_to_int(version):
      try:   
          if type(version) == str:            
              version = convert_version_to_tuple(version)        
         if type(version) == tuple:            
             return reduce(lambda x, y: (x * 1000) + y, version)    
      except Exception:         
             raise exception.NovaException(message="Hypervisor version invalid.")



  .

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1267300/+subscriptions


Follow ups

References