Merge pull request #86 from tecknicaltom/various_python_issues
Various python issues
This commit is contained in:
commit
e67832d384
@ -108,7 +108,6 @@ class FilterList(object):
|
||||
the_file.close()
|
||||
except (IOError, OSError):
|
||||
print("IO/OSError in _filterlist.py")
|
||||
pass
|
||||
except SAXParseException:
|
||||
print("Parser error")
|
||||
|
||||
|
@ -55,5 +55,4 @@ class RegExpName(Rule):
|
||||
name.title, name.nick, name.famnick, name.call]:
|
||||
if self.match_substring(0, field):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
@ -57,5 +57,4 @@ class SearchName(Rule):
|
||||
name.title, name.nick, name.famnick, name.call]:
|
||||
if src and field.upper().find(src) != -1:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
@ -692,8 +692,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
|
||||
for attr in self.attribute_list:
|
||||
if int(attr.type) == AttributeType.NICKNAME:
|
||||
return attr.get_value()
|
||||
else:
|
||||
return ''
|
||||
return ''
|
||||
|
||||
def set_gender(self, gender) :
|
||||
"""
|
||||
@ -743,9 +742,9 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
|
||||
for self.birth_ref_index, ref in enumerate(self.event_ref_list):
|
||||
if event_ref.is_equal(ref):
|
||||
return # Note: self.birth_ref_index already set
|
||||
else:
|
||||
self.event_ref_list.append(event_ref)
|
||||
self.birth_ref_index = len(self.event_ref_list)-1
|
||||
|
||||
self.event_ref_list.append(event_ref)
|
||||
self.birth_ref_index = len(self.event_ref_list)-1
|
||||
|
||||
def set_death_ref(self, event_ref):
|
||||
"""
|
||||
@ -768,9 +767,9 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
|
||||
for self.death_ref_index, ref in enumerate(self.event_ref_list):
|
||||
if event_ref.is_equal(ref):
|
||||
return # Note: self.death_ref_index already set
|
||||
else:
|
||||
self.event_ref_list.append(event_ref)
|
||||
self.death_ref_index = len(self.event_ref_list)-1
|
||||
|
||||
self.event_ref_list.append(event_ref)
|
||||
self.death_ref_index = len(self.event_ref_list)-1
|
||||
|
||||
def get_birth_ref(self):
|
||||
"""
|
||||
|
@ -214,7 +214,7 @@ def available_updates():
|
||||
fp = urlopen_maybe_no_check_cert(URL)
|
||||
except Exception as err: # some error
|
||||
LOG.warning("Failed to open addon metadata for {lang} {url}: {err}".
|
||||
format(lang=lang, url=URL, err=err))
|
||||
format(lang=lang, url=URL, err=err))
|
||||
fp = None
|
||||
if fp and fp.getcode() == 200: # ok
|
||||
break
|
||||
|
@ -295,7 +295,7 @@ class CallbackManager(object):
|
||||
unconnect a signal from the database if it is already connected
|
||||
"""
|
||||
oldcall, oldconnectkey = self.__callbacks[signal]
|
||||
if not oldconnectkey is None:
|
||||
if oldconnectkey is not None:
|
||||
self.database.disconnect(oldconnectkey)
|
||||
|
||||
def add_db_signal(self, name, callback):
|
||||
|
@ -425,7 +425,6 @@ class ODSTab(TabbedDoc):
|
||||
errmsg = "%s\n%s" % (_("Could not create %s") % self.styles_xml, msg)
|
||||
raise ReportError(errmsg)
|
||||
except:
|
||||
pass
|
||||
raise ReportError(_("Could not create %s") % self.styles_xml)
|
||||
|
||||
self.f = open(self.styles_xml,"w")
|
||||
@ -460,7 +459,6 @@ class ODSTab(TabbedDoc):
|
||||
errmsg = "%s\n%s" % (_("Could not create %s") % self.manifest_xml, msg)
|
||||
raise ReportError(errmsg)
|
||||
except:
|
||||
pass
|
||||
raise ReportError(_("Could not create %s") % self.manifest_xml)
|
||||
|
||||
self.f = open(self.manifest_xml,"w")
|
||||
@ -476,7 +474,6 @@ class ODSTab(TabbedDoc):
|
||||
errmsg = "%s\n%s" % (_("Could not create %s") % self.meta_xml, msg)
|
||||
raise ReportError(errmsg)
|
||||
except:
|
||||
pass
|
||||
raise ReportError(_("Could not create %s") % self.meta_xml)
|
||||
|
||||
self.f = open(self.meta_xml,"w")
|
||||
@ -499,7 +496,6 @@ class ODSTab(TabbedDoc):
|
||||
errmsg = "%s\n%s" % (_("Could not create %s") % self.mimetype, msg)
|
||||
raise ReportError(errmsg)
|
||||
except:
|
||||
pass
|
||||
raise ReportError(_("Could not create %s") % self.mimetype)
|
||||
|
||||
self.f = open(self.mimetype,"w")
|
||||
|
@ -296,8 +296,8 @@ class RecentDocsMenu(object):
|
||||
mitem.show()
|
||||
new_menu.append(mitem)
|
||||
except RuntimeError:
|
||||
# ignore no longer existing files
|
||||
_LOG.info("Ignoring the RecentItem %s (%s)" % (title, filename))
|
||||
pass # ignore no longer existing files
|
||||
|
||||
count += 1
|
||||
buf.write(_RCT_BTM)
|
||||
|
@ -581,7 +581,7 @@ class EmbeddedList(ButtonTab):
|
||||
|
||||
self.tree.set_model(self.model)
|
||||
#reset previous select
|
||||
if not selectedpath is None:
|
||||
if selectedpath is not None:
|
||||
self.selection.select_path(selectedpath)
|
||||
#self.selection.select_path(node)
|
||||
self._set_label()
|
||||
|
@ -413,5 +413,5 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
@type prebuildpath: tree path
|
||||
"""
|
||||
self.tree.expand_all()
|
||||
if not prebuildpath is None:
|
||||
if prebuildpath is not None:
|
||||
self.selection.select_path(prebuildpath)
|
||||
|
@ -219,5 +219,5 @@ class NameEmbedList(GroupEmbeddedList):
|
||||
@type prebuildpath: tree path
|
||||
"""
|
||||
self.tree.expand_all()
|
||||
if not prebuildpath is None:
|
||||
if prebuildpath is not None:
|
||||
self.selection.select_path(prebuildpath)
|
||||
|
@ -214,5 +214,5 @@ class Glade(Gtk.Builder):
|
||||
return obj
|
||||
if hasattr(obj, 'get_children'):
|
||||
queue += obj.get_children()
|
||||
else:
|
||||
return None
|
||||
|
||||
return None
|
||||
|
@ -549,8 +549,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
|
||||
button = self.format_buttons[ix]
|
||||
if button.get_active():
|
||||
return ix
|
||||
else:
|
||||
return 0
|
||||
return 0
|
||||
|
||||
def suggest_filename(self):
|
||||
"""Prepare suggested filename and set it in the file chooser."""
|
||||
|
@ -1238,7 +1238,7 @@ class BaseReader(object):
|
||||
self.ifile.seek(0)
|
||||
|
||||
def readline(self):
|
||||
raise NotImplemented
|
||||
raise NotImplementedError()
|
||||
|
||||
def report_error(self, problem, line):
|
||||
line = line.rstrip('\n\r')
|
||||
|
@ -404,7 +404,6 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
|
||||
path = "%s%c%s" % ( config.get('geography.path'), os.sep, the_map )
|
||||
shutil.rmtree(path)
|
||||
pass
|
||||
|
||||
def add_specific_menu(self, menu, event, lat, lon):
|
||||
"""
|
||||
@ -1110,7 +1109,6 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
else:
|
||||
config.set("geography.lock", True)
|
||||
self.lock = config.get("geography.lock")
|
||||
pass
|
||||
|
||||
def config_crosshair(self, client, cnxn_id, entry, data):
|
||||
"""
|
||||
@ -1121,7 +1119,6 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
else:
|
||||
config.set("geography.show_cross", True)
|
||||
self.set_crosshair(config.get("geography.show_cross"))
|
||||
pass
|
||||
|
||||
def specific_options(self, configdialog):
|
||||
"""
|
||||
|
@ -234,7 +234,7 @@ class AllRelReport():
|
||||
relation[4], relation[2],
|
||||
only_birth = birth,
|
||||
in_law_a = inlawa, in_law_b = inlawb)
|
||||
if not skip_list_text is None:
|
||||
if skip_list_text is not None:
|
||||
if rel_str in skip_list_text:
|
||||
skip_list.append(count)
|
||||
else:
|
||||
|
@ -275,8 +275,8 @@ class SelectionPage(Gtk.Box):
|
||||
button = self.batch_op_buttons[index]
|
||||
if button.get_active():
|
||||
return index
|
||||
else:
|
||||
return 0
|
||||
|
||||
return 0
|
||||
|
||||
class SettingsPage(Gtk.Box):
|
||||
"""
|
||||
|
@ -3371,7 +3371,6 @@ class PlacePages(BasePage):
|
||||
for place_handle in self.report.obj_dict[Place]:
|
||||
step()
|
||||
self.PlacePage(self.report, title, place_handle)
|
||||
pass
|
||||
|
||||
def PlaceListPage(self, report, title, place_handles):
|
||||
self.dbase_ = report.database
|
||||
@ -6613,7 +6612,6 @@ class RepositoryPages(BasePage):
|
||||
def __init__(self, report):
|
||||
self.repos_dict = defaultdict(set)
|
||||
self.report = report
|
||||
pass
|
||||
|
||||
def display_pages(self, title):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user