Description: Fix class comparisons for Python 3
Author: Stuart Prescott <stuart@debian.org>
Forwarded: https://github.com/schrodinger/pymol-open-source/pull/9
--- a/modules/chempy/hetatm.py
+++ b/modules/chempy/hetatm.py
@@ -16,6 +16,7 @@
 #
 #
 
+import chempy.models
 from chempy.neighbor import Neighbor
 from chempy.models import Connected
 from chempy import Bond
@@ -35,7 +36,7 @@
 
 #---------------------------------------------------------------------------------
 def assign_types(model, topology = None, forcefield = None ):
-    if str(model.__class__) != 'chempy.models.Indexed':
+    if not isinstance(model, chempy.models.Indexed):
         raise ValueError('model is not an "Indexed" model object')
     nAtom = model.nAtom
     if nAtom:
@@ -67,7 +68,7 @@
 
 #---------------------------------------------------------------------------------
 def add_bonds(model, topology = None, forcefield = None ):
-    if str(model.__class__) != 'chempy.models.Indexed':
+    if not isinstance(model, chempy.models.Indexed):
         raise ValueError('model is not an "Indexed" model object')
     nAtom = model.nAtom
     if nAtom:
@@ -108,7 +109,7 @@
                             
 #---------------------------------------------------------------------------------
 def add_hydrogens(model,topology=None,forcefield=None):  
-    if str(model.__class__) != 'chempy.models.Connected':
+    if not isinstance(model, chempy.models.Connected):
         raise ValueError('model is not a "Connected" model object')
     nAtom = model.nAtom
     if nAtom:
--- a/modules/chempy/protein.py
+++ b/modules/chempy/protein.py
@@ -22,6 +22,7 @@
 from . import protein_residues
 from . import protein_amber
 
+import chempy.models
 from chempy.neighbor import Neighbor
 from chempy.models import Connected
 from chempy import Bond,place,feedback
@@ -66,7 +67,7 @@
 '''
     if feedback['actions']:
         print(" "+str(__name__)+": assigning types...")
-    if str(model.__class__) != 'chempy.models.Indexed':
+    if not isinstance(model, chempy.models.Indexed):
         raise ValueError('model is not an "Indexed" model object')
     if model.nAtom:
         crd = model.get_coord_list()
@@ -164,7 +165,7 @@
     '''
     if feedback['actions']:
         print(" "+str(__name__)+": assigning types and bonds...")
-    if str(model.__class__) != 'chempy.models.Indexed':
+    if not isinstance(model, chempy.models.Indexed):
         raise ValueError('model is not an "Indexed" model object')
     if model.nAtom:
         crd = model.get_coord_list()
@@ -283,7 +284,7 @@
     # assumes no bonds between non-hetatms
     if feedback['actions']:
         print(" "+str(__name__)+": adding hydrogens...")
-    if str(model.__class__) != 'chempy.models.Connected':
+    if not isinstance(model, chempy.models.Connected):
         raise ValueError('model is not a "Connected" model object')
     if model.nAtom:
         if not model.index:
--- a/modules/chempy/place.py
+++ b/modules/chempy/place.py
@@ -21,6 +21,8 @@
 
 from chempy.cpv import *
 from chempy import feedback
+import chempy.models
+
 
 TET_TAN = 1.41
 TRI_TAN = 1.732
@@ -51,7 +53,7 @@
         print(" "+str(__name__)+": placing unknowns...")
     # this can be used to build hydrogens and would robably work for
     # acyclic carbons as well
-    if str(model.__class__) != 'chempy.models.Connected':
+    if not isinstance(model, chempy.models.Connected):
         raise ValueError('model is not a "Connected" model object')
     if model.nAtom:
         if not model.index:
--- a/modules/pymol/editing.py
+++ b/modules/pymol/editing.py
@@ -951,6 +951,8 @@
     single molecular object.
 
 '''
+        import pymol.wizard.dragging
+
         quiet = int(quiet)
         if (selection!=None) and (selection!=""):
             selection = selector.process(selection)
@@ -979,7 +981,7 @@
                 wiz = _self.get_wizard()
                 if (wiz == None):
                     _self.wizard("dragging",old_button_mode)
-                elif wiz.__class__ != 'pymol.wizard.dragging.Dragging':
+                elif not isinstance(wiz, pymol.wizard.dragging.Dragging):
                     _self.wizard("dragging",old_button_mode)
                 else:
                     wiz.recount()
