Fix PythonDeprecationWarning for collections.abc
This commit is contained in:
parent
c82ec4c65b
commit
0213e65ff0
@ -27,7 +27,7 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from xml.sax import make_parser, SAXParseException
|
from xml.sax import make_parser, SAXParseException
|
||||||
import os
|
import os
|
||||||
import collections
|
from collections import abc
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -78,7 +78,7 @@ class FilterList:
|
|||||||
plugin_filters = []
|
plugin_filters = []
|
||||||
try:
|
try:
|
||||||
for plug in plugins:
|
for plug in plugins:
|
||||||
if isinstance(plug, collections.Callable):
|
if isinstance(plug, abc.Callable):
|
||||||
plug = plug(namespace)
|
plug = plug(namespace)
|
||||||
if plug:
|
if plug:
|
||||||
if isinstance(plug, (list, tuple)):
|
if isinstance(plug, (list, tuple)):
|
||||||
|
@ -32,7 +32,7 @@ other Gramps baggage.
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import time
|
import time
|
||||||
import collections
|
from collections import abc
|
||||||
import logging
|
import logging
|
||||||
_LOG = logging.getLogger(".gen")
|
_LOG = logging.getLogger(".gen")
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class UpdateCallback:
|
|||||||
:param interval: number of seconds at most between the updates
|
:param interval: number of seconds at most between the updates
|
||||||
:type interval: int
|
:type interval: int
|
||||||
"""
|
"""
|
||||||
if isinstance(callback, collections.Callable):
|
if isinstance(callback, abc.Callable):
|
||||||
# callback is really callable
|
# callback is really callable
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
import random
|
import random
|
||||||
import os
|
import os
|
||||||
from xml.sax.saxutils import escape
|
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
|
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()
|
pages = configure_page_funcs()
|
||||||
else:
|
else:
|
||||||
pages = configure_page_funcs
|
pages = configure_page_funcs
|
||||||
|
@ -25,7 +25,7 @@ from gramps.gen.filters import (rules, FilterList, GenericFilterFactory,
|
|||||||
reload_custom_filters)
|
reload_custom_filters)
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.sgettext
|
_ = glocale.translation.sgettext
|
||||||
import collections
|
from collections import abc
|
||||||
|
|
||||||
def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
|
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()
|
filter = FilterClass()
|
||||||
if title is None:
|
if title is None:
|
||||||
title = _("Filter %s from Clipboard") % objclass
|
title = _("Filter %s from Clipboard") % objclass
|
||||||
if isinstance(title, collections.Callable):
|
if isinstance(title, abc.Callable):
|
||||||
title = title()
|
title = title()
|
||||||
filter.set_name(title)
|
filter.set_name(title)
|
||||||
struct_time = time.localtime()
|
struct_time = time.localtime()
|
||||||
|
@ -39,7 +39,7 @@ from io import StringIO
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
import collections
|
from collections import abc
|
||||||
log = logging.getLogger(".quickreports")
|
log = logging.getLogger(".quickreports")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -105,9 +105,9 @@ def create_web_connect_menu(dbstate, uistate, nav_group, handle, prefix):
|
|||||||
pmgr = GuiPluginManager.get_instance()
|
pmgr = GuiPluginManager.get_instance()
|
||||||
plugins = pmgr.process_plugin_data('WebConnect')
|
plugins = pmgr.process_plugin_data('WebConnect')
|
||||||
try:
|
try:
|
||||||
connections = [plug(nav_group) if isinstance(plug, collections.Callable) else plug
|
connections = [plug(nav_group) if isinstance(plug, abc.Callable) else
|
||||||
for plug in plugins]
|
plug for plug in plugins]
|
||||||
except:
|
except BaseException:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
connections = []
|
connections = []
|
||||||
|
@ -43,7 +43,7 @@ import codecs
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
import collections
|
from collections import abc
|
||||||
LOG = logging.getLogger(".ExportCSV")
|
LOG = logging.getLogger(".ExportCSV")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -173,7 +173,7 @@ class CSVWriter:
|
|||||||
self.option_box = option_box
|
self.option_box = option_box
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.user = user
|
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
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
import collections
|
from collections import abc
|
||||||
log = logging.getLogger(".WriteFtree")
|
log = logging.getLogger(".WriteFtree")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -73,7 +73,7 @@ class FtreeWriter:
|
|||||||
self.user = user
|
self.user = user
|
||||||
self.option_box = option_box
|
self.option_box = option_box
|
||||||
# is callback is really callable?
|
# is callback is really callable?
|
||||||
if isinstance(self.user.callback, collections.Callable):
|
if isinstance(self.user.callback, abc.Callable):
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -37,7 +37,7 @@ import os
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
import collections
|
from collections import abc
|
||||||
log = logging.getLogger(".WriteGeneWeb")
|
log = logging.getLogger(".WriteGeneWeb")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -60,7 +60,7 @@ class GeneWebWriter:
|
|||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.user = user
|
self.user = user
|
||||||
self.option_box = option_box
|
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
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -38,7 +38,7 @@ from time import localtime
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
import collections
|
from collections import abc
|
||||||
log = logging.getLogger(".ExportVCal")
|
log = logging.getLogger(".ExportVCal")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -61,7 +61,7 @@ class CalendarWriter:
|
|||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.user = user
|
self.user = user
|
||||||
self.option_box = option_box
|
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
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -38,7 +38,7 @@ from textwrap import TextWrapper
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
import collections
|
from collections import abc
|
||||||
log = logging.getLogger(".ExportVCard")
|
log = logging.getLogger(".ExportVCard")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -109,7 +109,7 @@ class VCardWriter:
|
|||||||
self.user = user
|
self.user = user
|
||||||
self.filehandle = None
|
self.filehandle = None
|
||||||
self.option_box = option_box
|
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
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -38,7 +38,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
|
|||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
import collections
|
from collections import abc
|
||||||
LOG = logging.getLogger(".ImportXML")
|
LOG = logging.getLogger(".ImportXML")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -737,7 +737,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
if (orig_handle in self.import_handles and
|
if (orig_handle in self.import_handles and
|
||||||
target in self.import_handles[orig_handle]):
|
target in self.import_handles[orig_handle]):
|
||||||
handle = self.import_handles[handle][target][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_<primary_object> method.
|
# This method is called by a start_<primary_object> method.
|
||||||
get_raw_obj_data = {"person": self.db.get_raw_person_data,
|
get_raw_obj_data = {"person": self.db.get_raw_person_data,
|
||||||
"family": self.db.get_raw_family_data,
|
"family": self.db.get_raw_family_data,
|
||||||
@ -780,7 +780,8 @@ class GrampsParser(UpdateCallback):
|
|||||||
while has_handle_func(handle):
|
while has_handle_func(handle):
|
||||||
handle = create_id()
|
handle = create_id()
|
||||||
self.import_handles[orig_handle] = {target: [handle, False]}
|
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()
|
prim_obj = prim_obj()
|
||||||
else:
|
else:
|
||||||
self.import_handles[orig_handle][target][INSTANTIATED] = True
|
self.import_handles[orig_handle][target][INSTANTIATED] = True
|
||||||
@ -874,7 +875,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
handle = create_id()
|
handle = create_id()
|
||||||
while has_handle_func(handle):
|
while has_handle_func(handle):
|
||||||
handle = create_id()
|
handle = create_id()
|
||||||
if isinstance(prim_obj, collections.Callable):
|
if isinstance(prim_obj, abc.Callable):
|
||||||
prim_obj = prim_obj()
|
prim_obj = prim_obj()
|
||||||
prim_obj.set_handle(handle)
|
prim_obj.set_handle(handle)
|
||||||
prim_obj.set_gramps_id(gramps_id)
|
prim_obj.set_gramps_id(gramps_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user