Issue #0002175: Change type() expressions to isinstance() expressions.
Patch from Gerald Britton <gerald.britton@gmail.com> svn: r10762
This commit is contained in:
@@ -353,7 +353,7 @@ class CommandLineReport:
|
||||
self.options_help[self.show][1])
|
||||
print " Available values are:"
|
||||
vals = self.options_help[self.show][2]
|
||||
if type(vals) in [list,tuple]:
|
||||
if isinstance(vals, (list, tuple)):
|
||||
if self.options_help[self.show][3]:
|
||||
for num in range(len(vals)):
|
||||
print " %d\t%s" % (num,vals[num])
|
||||
|
@@ -805,10 +805,10 @@ class GraphvizReportDialog(ReportDialog):
|
||||
name, translated_name)
|
||||
|
||||
def init_options(self, option_class):
|
||||
if type(option_class) == ClassType:
|
||||
if isinstance(option_class, ClassType):
|
||||
self.options = option_class(self.raw_name,
|
||||
self.dbstate.get_database())
|
||||
elif type(option_class) == InstanceType:
|
||||
elif isinstance(option_class, InstanceType):
|
||||
self.options = option_class
|
||||
|
||||
################################
|
||||
|
@@ -96,9 +96,9 @@ class ReportDialog(ManagedWindow.ManagedWindow):
|
||||
self.init_interface()
|
||||
|
||||
def init_options(self, option_class):
|
||||
if type(option_class) == ClassType:
|
||||
if isinstance(option_class, ClassType):
|
||||
self.options = option_class(self.raw_name, self.db)
|
||||
elif type(option_class) == InstanceType:
|
||||
elif isinstance(option_class, InstanceType):
|
||||
self.options = option_class
|
||||
|
||||
self.options.load_previous_values()
|
||||
|
@@ -1528,7 +1528,7 @@ def estimate_age_on_date(db, person, ddata=_TODAY):
|
||||
#-------------------------------------------------------------------------
|
||||
def roman(num):
|
||||
""" Integer to Roman numeral converter for 0 < num < 4000 """
|
||||
if type(num) != int:
|
||||
if not isinstance(num, int):
|
||||
return "?"
|
||||
if not 0 < num < 4000:
|
||||
return "?"
|
||||
|
Reference in New Issue
Block a user