diff --git a/gramps/gen/filters/_filterlist.py b/gramps/gen/filters/_filterlist.py index 34975738e..39a4da301 100644 --- a/gramps/gen/filters/_filterlist.py +++ b/gramps/gen/filters/_filterlist.py @@ -27,7 +27,7 @@ #------------------------------------------------------------------------- from xml.sax import make_parser, SAXParseException import os -import collections +from collections import abc #------------------------------------------------------------------------- # @@ -78,7 +78,7 @@ class FilterList: plugin_filters = [] try: for plug in plugins: - if isinstance(plug, collections.Callable): + if isinstance(plug, abc.Callable): plug = plug(namespace) if plug: if isinstance(plug, (list, tuple)): diff --git a/gramps/gen/updatecallback.py b/gramps/gen/updatecallback.py index 9042e69b7..e7917f13d 100644 --- a/gramps/gen/updatecallback.py +++ b/gramps/gen/updatecallback.py @@ -32,7 +32,7 @@ other Gramps baggage. # #------------------------------------------------------------------------- import time -import collections +from collections import abc import logging _LOG = logging.getLogger(".gen") @@ -54,7 +54,7 @@ class UpdateCallback: :param interval: number of seconds at most between the updates :type interval: int """ - if isinstance(callback, collections.Callable): + if isinstance(callback, abc.Callable): # callback is really callable self.update = self.update_real self.callback = callback diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index a65f25c93..7c0efad13 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -31,7 +31,7 @@ import random import os from xml.sax.saxutils import escape -import collections +from collections import abc #------------------------------------------------------------------------- # @@ -201,7 +201,7 @@ class ConfigureDialog(ManagedWindow): """ This method builds the notebook pages in the panel """ - if isinstance(configure_page_funcs, collections.Callable): + if isinstance(configure_page_funcs, abc.Callable): pages = configure_page_funcs() else: pages = configure_page_funcs diff --git a/gramps/gui/makefilter.py b/gramps/gui/makefilter.py index 74a21c88f..5048f605e 100644 --- a/gramps/gui/makefilter.py +++ b/gramps/gui/makefilter.py @@ -25,7 +25,7 @@ from gramps.gen.filters import (rules, FilterList, GenericFilterFactory, reload_custom_filters) from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -import collections +from collections import abc def make_filter(dbstate, uistate, objclass, gramps_ids, title=None): """ @@ -39,7 +39,7 @@ def make_filter(dbstate, uistate, objclass, gramps_ids, title=None): filter = FilterClass() if title is None: title = _("Filter %s from Clipboard") % objclass - if isinstance(title, collections.Callable): + if isinstance(title, abc.Callable): title = title() filter.set_name(title) struct_time = time.localtime() diff --git a/gramps/gui/plug/quick/_quickreports.py b/gramps/gui/plug/quick/_quickreports.py index 25a35dcb2..d2d541fd3 100644 --- a/gramps/gui/plug/quick/_quickreports.py +++ b/gramps/gui/plug/quick/_quickreports.py @@ -39,7 +39,7 @@ from io import StringIO # #------------------------------------------------------------------------ import logging -import collections +from collections import abc log = logging.getLogger(".quickreports") #------------------------------------------------------------------------- @@ -105,9 +105,9 @@ def create_web_connect_menu(dbstate, uistate, nav_group, handle, prefix): pmgr = GuiPluginManager.get_instance() plugins = pmgr.process_plugin_data('WebConnect') try: - connections = [plug(nav_group) if isinstance(plug, collections.Callable) else plug - for plug in plugins] - except: + connections = [plug(nav_group) if isinstance(plug, abc.Callable) else + plug for plug in plugins] + except BaseException: import traceback traceback.print_exc() connections = [] diff --git a/gramps/plugins/export/exportcsv.py b/gramps/plugins/export/exportcsv.py index 42896862e..183e05c14 100644 --- a/gramps/plugins/export/exportcsv.py +++ b/gramps/plugins/export/exportcsv.py @@ -43,7 +43,7 @@ import codecs # #------------------------------------------------------------------------ import logging -import collections +from collections import abc LOG = logging.getLogger(".ExportCSV") #------------------------------------------------------------------------- @@ -173,7 +173,7 @@ class CSVWriter: self.option_box = option_box self.filename = filename self.user = user - if isinstance(self.user.callback, collections.Callable): # callback is really callable + if isinstance(self.user.callback, abc.Callable): # is really callable self.update = self.update_real else: self.update = self.update_empty diff --git a/gramps/plugins/export/exportftree.py b/gramps/plugins/export/exportftree.py index daea27cac..a42133892 100644 --- a/gramps/plugins/export/exportftree.py +++ b/gramps/plugins/export/exportftree.py @@ -34,7 +34,7 @@ # #------------------------------------------------------------------------ import logging -import collections +from collections import abc log = logging.getLogger(".WriteFtree") #------------------------------------------------------------------------- @@ -73,7 +73,7 @@ class FtreeWriter: self.user = user self.option_box = option_box # is callback is really callable? - if isinstance(self.user.callback, collections.Callable): + if isinstance(self.user.callback, abc.Callable): self.update = self.update_real else: self.update = self.update_empty diff --git a/gramps/plugins/export/exportgeneweb.py b/gramps/plugins/export/exportgeneweb.py index e557c13be..c69d9056a 100644 --- a/gramps/plugins/export/exportgeneweb.py +++ b/gramps/plugins/export/exportgeneweb.py @@ -37,7 +37,7 @@ import os # #------------------------------------------------------------------------ import logging -import collections +from collections import abc log = logging.getLogger(".WriteGeneWeb") #------------------------------------------------------------------------- @@ -60,7 +60,7 @@ class GeneWebWriter: self.filename = filename self.user = user self.option_box = option_box - if isinstance(self.user.callback, collections.Callable): # callback is really callable + if isinstance(self.user.callback, abc.Callable): # is really callable self.update = self.update_real else: self.update = self.update_empty diff --git a/gramps/plugins/export/exportvcalendar.py b/gramps/plugins/export/exportvcalendar.py index d4bec393d..c80fb3d46 100644 --- a/gramps/plugins/export/exportvcalendar.py +++ b/gramps/plugins/export/exportvcalendar.py @@ -38,7 +38,7 @@ from time import localtime # #------------------------------------------------------------------------ import logging -import collections +from collections import abc log = logging.getLogger(".ExportVCal") #------------------------------------------------------------------------- @@ -61,7 +61,7 @@ class CalendarWriter: self.filename = filename self.user = user self.option_box = option_box - if isinstance(self.user.callback, collections.Callable): # callback is really callable + if isinstance(self.user.callback, abc.Callable): # is really callable self.update = self.update_real else: self.update = self.update_empty diff --git a/gramps/plugins/export/exportvcard.py b/gramps/plugins/export/exportvcard.py index dcffed9cc..ee62ea30b 100644 --- a/gramps/plugins/export/exportvcard.py +++ b/gramps/plugins/export/exportvcard.py @@ -38,7 +38,7 @@ from textwrap import TextWrapper # #------------------------------------------------------------------------ import logging -import collections +from collections import abc log = logging.getLogger(".ExportVCard") #------------------------------------------------------------------------- @@ -109,7 +109,7 @@ class VCardWriter: self.user = user self.filehandle = None self.option_box = option_box - if isinstance(self.user.callback, collections.Callable): # callback is really callable + if isinstance(self.user.callback, abc.Callable): # is really callable self.update = self.update_real else: self.update = self.update_empty diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index bfba05633..7d533c66a 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -38,7 +38,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext import re import logging -import collections +from collections import abc LOG = logging.getLogger(".ImportXML") #------------------------------------------------------------------------- @@ -737,7 +737,7 @@ class GrampsParser(UpdateCallback): if (orig_handle in self.import_handles and target in self.import_handles[orig_handle]): handle = self.import_handles[handle][target][HANDLE] - if not isinstance(prim_obj, collections.Callable): + if not isinstance(prim_obj, abc.Callable): # This method is called by a start_ method. get_raw_obj_data = {"person": self.db.get_raw_person_data, "family": self.db.get_raw_family_data, @@ -780,7 +780,8 @@ class GrampsParser(UpdateCallback): while has_handle_func(handle): handle = create_id() self.import_handles[orig_handle] = {target: [handle, False]} - if isinstance(prim_obj, collections.Callable): # method is called by a reference + # method is called by a reference + if isinstance(prim_obj, abc.Callable): prim_obj = prim_obj() else: self.import_handles[orig_handle][target][INSTANTIATED] = True @@ -874,7 +875,7 @@ class GrampsParser(UpdateCallback): handle = create_id() while has_handle_func(handle): handle = create_id() - if isinstance(prim_obj, collections.Callable): + if isinstance(prim_obj, abc.Callable): prim_obj = prim_obj() prim_obj.set_handle(handle) prim_obj.set_gramps_id(gramps_id)