Skip to content

Commit 150e06f

Browse files
committed
Fix: DeprecationWarning: Using or importing the ABCs from 'collections'
instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
1 parent 581f874 commit 150e06f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

roundup/instance.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
except ImportError:
3434
import __builtin__ as builtins
3535

36-
import collections
36+
try:
37+
from collections.abc import Callable
38+
except ImportError:
39+
from collections import Callable
40+
3741
import os
3842
import sys
3943
import warnings
@@ -134,14 +138,14 @@ def open(self, name=None):
134138
if self.optimize:
135139
# execute preloaded schema object
136140
self._exec(self.schema, env)
137-
if isinstance(self.schema_hook, collections.Callable):
141+
if isinstance(self.schema_hook, Callable):
138142
self.schema_hook(**env)
139143
# use preloaded detectors
140144
detectors = self.detectors
141145
else:
142146
# execute the schema file
143147
self._execfile('schema.py', env)
144-
if isinstance(self.schema_hook, collections.Callable):
148+
if isinstance(self.schema_hook, Callable):
145149
self.schema_hook(**env)
146150
# reload extensions and detectors
147151
for extension in self.get_extensions('extensions'):

0 commit comments

Comments
 (0)