From c8001c748394ff1e6d2d6b41da81ae15e4bb4f05 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sun, 7 May 2017 18:03:40 -0700 Subject: [PATCH] tweak some None tests --- gramps/cli/plug/__init__.py | 4 ++-- gramps/plugins/drawreport/calendarreport.py | 5 +++-- gramps/plugins/lib/libsubstkeyword.py | 2 +- gramps/plugins/textreport/ancestorreport.py | 5 +++-- gramps/plugins/textreport/birthdayreport.py | 4 ++-- gramps/plugins/textreport/descendreport.py | 1 + 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gramps/cli/plug/__init__.py b/gramps/cli/plug/__init__.py index 52097625b..590512734 100644 --- a/gramps/cli/plug/__init__.py +++ b/gramps/cli/plug/__init__.py @@ -120,13 +120,13 @@ def _convert_str_to_match_type(str_val, type_val): # Search through characters between the brackets for char in str_val[1:-1]: - if (char == "'" or char == '"') and quote_type == None: + if (char == "'" or char == '"') and quote_type is None: # This character starts a string quote_type = char elif char == quote_type: # This character ends a string quote_type = None - elif quote_type == None and char == ",": + elif quote_type is None and char == ",": # This character ends an entry ret_val.append(entry.strip()) entry = "" diff --git a/gramps/plugins/drawreport/calendarreport.py b/gramps/plugins/drawreport/calendarreport.py index 75aaca96e..a4c2fa44e 100644 --- a/gramps/plugins/drawreport/calendarreport.py +++ b/gramps/plugins/drawreport/calendarreport.py @@ -107,10 +107,11 @@ class Calendar(Report): self.text3 = get_value('text3') self.filter_option = menu.get_option_by_name('filter') self.filter = self.filter_option.get_filter() + pid = get_value('pid') self.center_person = self.database.get_person_from_gramps_id(pid) - if (self.center_person == None) : - raise ReportError(_("Person %s is not in the Database") % pid ) + if self.center_person is None: + raise ReportError(_("Person %s is not in the Database") % pid) self.set_locale(get_value('trans')) diff --git a/gramps/plugins/lib/libsubstkeyword.py b/gramps/plugins/lib/libsubstkeyword.py index b3f9c6d9d..b7acdac10 100644 --- a/gramps/plugins/lib/libsubstkeyword.py +++ b/gramps/plugins/lib/libsubstkeyword.py @@ -629,7 +629,7 @@ class ConsumableString: def __get_a_char_of_text(self): """ Removes one char of TEXT from the string and returns it. """ if self.this == "\\": - if self.next == None: + if self.next is None: rtrn = "\\" else: rtrn = self.next diff --git a/gramps/plugins/textreport/ancestorreport.py b/gramps/plugins/textreport/ancestorreport.py index 2b7d3c733..8192fa73c 100644 --- a/gramps/plugins/textreport/ancestorreport.py +++ b/gramps/plugins/textreport/ancestorreport.py @@ -107,10 +107,11 @@ class AncestorReport(Report): self.max_generations = menu.get_option_by_name('maxgen').get_value() self.pgbrk = menu.get_option_by_name('pagebbg').get_value() self.opt_namebrk = menu.get_option_by_name('namebrk').get_value() + pid = menu.get_option_by_name('pid').get_value() self.center_person = self.database.get_person_from_gramps_id(pid) - if (self.center_person == None) : - raise ReportError(_("Person %s is not in the Database") % pid ) + if self.center_person is None: + raise ReportError(_("Person %s is not in the Database") % pid) stdoptions.run_name_format_option(self, menu) diff --git a/gramps/plugins/textreport/birthdayreport.py b/gramps/plugins/textreport/birthdayreport.py index fe41ae435..c7a7dfb80 100644 --- a/gramps/plugins/textreport/birthdayreport.py +++ b/gramps/plugins/textreport/birthdayreport.py @@ -107,8 +107,8 @@ class BirthdayReport(Report): stdoptions.run_name_format_option(self, menu) self.center_person = self.database.get_person_from_gramps_id(pid) - if (self.center_person == None) : - raise ReportError(_("Person %s is not in the Database") % pid ) + if self.center_person is None: + raise ReportError(_("Person %s is not in the Database") % pid) def get_name(self, person, maiden_name = None): """ diff --git a/gramps/plugins/textreport/descendreport.py b/gramps/plugins/textreport/descendreport.py index 5965846cd..a65f3779c 100644 --- a/gramps/plugins/textreport/descendreport.py +++ b/gramps/plugins/textreport/descendreport.py @@ -435,6 +435,7 @@ class DescendantReport(Report): self.database = CacheProxyDb(self.database) self.max_generations = menu.get_option_by_name('gen').get_value() + pid = menu.get_option_by_name('pid').get_value() self.center_person = self.database.get_person_from_gramps_id(pid) if self.center_person is None: