Changeset 1450


Ignore:
Timestamp:
Dec 13, 2013 6:19:51 PM (9 years ago)
Author:
jemian
Message:

better to use isinstance() here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hdf5_exchange/h5py_examples/src/h5toText/h5toText.py

    r520 r1450  
    66$Id$
    77'''
    8 
    9 
    10 ########### SVN repository information ###################
    11 # $Date$
    12 # $Author$
    13 # $Revision$
    14 # $URL$
    15 # $Id$
    16 ########### SVN repository information ###################
    178
    189
     
    6152            f = h5py.File(self.filename, 'r')
    6253            for value in f.itervalues():
    63                 if str(type(value)) in ("<class 'h5py.highlevel.Group'>"):
     54                if isinstance(value, h5py.Group):
    6455                    if 'NX_class' in value.attrs:
    6556                        v = value.attrs['NX_class']
     
    8172        print indentation + name + nxclass
    8273        self.showAttributes(obj, indentation)
    83         group_equivalents = ("<class 'h5py.highlevel.File'>", "<class 'h5py.highlevel.Group'>")
    8474        # show datasets (and links) first
    8575        for itemname in sorted(obj):
    8676            value = obj[itemname]
    87             if str(type(value)) not in group_equivalents:
     77            if not isinstance(value, h5py.Group):
    8878                self.showDataset(value, itemname, indentation = indentation+"  ")
    8979        # then show things that look like groups
    9080        for itemname in sorted(obj):
    9181            value = obj[itemname]
    92             if str(type(value)) in group_equivalents:
     82            if isinstance(value, h5py.Group):
    9383                self.showGroup(value, itemname, indentation = indentation+"  ")
    9484
     
    230220        mc.array_items_shown = limit
    231221        mc.report()
     222
     223
     224########### SVN repository information ###################
     225# $Date$
     226# $Author$
     227# $Revision$
     228# $URL$
     229# $Id$
     230########### SVN repository information ###################
Note: See TracChangeset for help on using the changeset viewer.