Merge lp:~cjwatson/launchpadlib/py3-callable into lp:launchpadlib

Proposed by Colin Watson
Status: Merged
Merged at revision: 168
Proposed branch: lp:~cjwatson/launchpadlib/py3-callable
Merge into: lp:launchpadlib
Diff against target: 58 lines (+12/-4)
2 files modified
NEWS.txt (+5/-0)
src/launchpadlib/testing/launchpad.py (+7/-4)
To merge this branch: bzr merge lp:~cjwatson/launchpadlib/py3-callable
Reviewer Review Type Date Requested Status
Kristian Glass (community) Approve
LAZR Developers Pending
Review via email: mp+375893@code.launchpad.net

Commit message

Squash a deprecation warning on Python >= 3.7 in launchpadlib.testing.launchpad.

To post a comment you must log in.
Revision history for this message
Kristian Glass (doismellburning) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS.txt'
2--- NEWS.txt 2019-11-04 22:50:46 +0000
3+++ NEWS.txt 2019-11-22 13:35:40 +0000
4@@ -2,6 +2,11 @@
5 NEWS for launchpadlib
6 =====================
7
8+1.10.8
9+======
10+- Squash a deprecation warning on Python >= 3.7 in
11+ launchpadlib.testing.launchpad.
12+
13 1.10.7 (2019-05-22)
14 ===================
15 - Change 'dev' URLs from launchpad.dev to launchpad.test.
16
17=== modified file 'src/launchpadlib/testing/launchpad.py'
18--- src/launchpadlib/testing/launchpad.py 2014-07-14 20:29:51 +0000
19+++ src/launchpadlib/testing/launchpad.py 2019-11-22 13:35:40 +0000
20@@ -66,7 +66,10 @@
21 """
22
23 from datetime import datetime
24-import collections
25+try:
26+ from collections.abc import Callable
27+except ImportError:
28+ from collections import Callable
29 import sys
30 if sys.version_info[0] >= 3:
31 basestring = str
32@@ -205,7 +208,7 @@
33 result = self._children.get(name, _marker)
34 if result is _marker:
35 result = self._values.get(name, _marker)
36- if isinstance(result, collections.Callable):
37+ if isinstance(result, Callable):
38 return self._wrap_method(name, result)
39 if name in self.special_methods:
40 return lambda: True
41@@ -280,7 +283,7 @@
42 attributes and methods.
43 """
44 for name, value in partial_object.items():
45- if isinstance(value, collections.Callable):
46+ if isinstance(value, Callable):
47 # Performs an integrity check.
48 self._get_method(resource_type, name)
49 else:
50@@ -306,7 +309,7 @@
51 if name == "entries":
52 name, child_resource_type = (
53 self._check_entries(resource_type, value))
54- elif isinstance(value, collections.Callable):
55+ elif isinstance(value, Callable):
56 # Performs an integrity check.
57 self._get_method(resource_type, name)
58 else:

Subscribers

People subscribed via source and target branches