summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Levin <romanlevin@users.noreply.github.com>2018-12-04 15:02:11 +0100
committerAlex Grönholm <alex.gronholm@nextday.fi>2018-12-04 16:02:11 +0200
commit108d10c55ec9143ec180db2a06169df911c50bce (patch)
treed7b3378389a8a9692b728bcc6aee12909386e80d
parentabff5f7b3a1099ce5b444ab02708a393e595c425 (diff)
downloadapscheduler-108d10c55ec9143ec180db2a06169df911c50bce.tar.gz
Import Iterable, Mapping from collections.abc (#347)
This fixes the DeprecationWarnings about importing ABCs directly from the collections module.
-rw-r--r--apscheduler/job.py5
-rw-r--r--apscheduler/schedulers/base.py6
2 files changed, 9 insertions, 2 deletions
diff --git a/apscheduler/job.py b/apscheduler/job.py
index 4e24bec..5ea410c 100644
--- a/apscheduler/job.py
+++ b/apscheduler/job.py
@@ -1,4 +1,3 @@
-from collections import Iterable, Mapping
from inspect import ismethod, isclass
from uuid import uuid4
@@ -9,6 +8,10 @@ from apscheduler.util import (
ref_to_obj, obj_to_ref, datetime_repr, repr_escape, get_callable_name, check_callable_args,
convert_to_datetime)
+try:
+ from collections.abc import Iterable, Mapping
+except ImportError:
+ from collections import Iterable, Mapping
class Job(object):
"""
diff --git a/apscheduler/schedulers/base.py b/apscheduler/schedulers/base.py
index 8f910a6..c80f4c6 100644
--- a/apscheduler/schedulers/base.py
+++ b/apscheduler/schedulers/base.py
@@ -1,7 +1,6 @@
from __future__ import print_function
from abc import ABCMeta, abstractmethod
-from collections import MutableMapping
from threading import RLock
from datetime import datetime, timedelta
from logging import getLogger
@@ -27,6 +26,11 @@ from apscheduler.events import (
EVENT_JOB_ADDED, EVENT_EXECUTOR_ADDED, EVENT_EXECUTOR_REMOVED, EVENT_ALL_JOBS_REMOVED,
EVENT_JOB_SUBMITTED, EVENT_JOB_MAX_INSTANCES, EVENT_SCHEDULER_RESUMED, EVENT_SCHEDULER_PAUSED)
+try:
+ from collections.abc import MutableMapping
+except ImportError:
+ from collections import MutableMapping
+
#: constant indicating a scheduler's stopped state
STATE_STOPPED = 0
#: constant indicating a scheduler's running state (started and processing jobs)