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
=== modified file 'NEWS.txt'
--- NEWS.txt 2019-11-04 22:50:46 +0000
+++ NEWS.txt 2019-11-22 13:35:40 +0000
@@ -2,6 +2,11 @@
2NEWS for launchpadlib2NEWS for launchpadlib
3=====================3=====================
44
51.10.8
6======
7- Squash a deprecation warning on Python >= 3.7 in
8 launchpadlib.testing.launchpad.
9
51.10.7 (2019-05-22)101.10.7 (2019-05-22)
6===================11===================
7- Change 'dev' URLs from launchpad.dev to launchpad.test.12- Change 'dev' URLs from launchpad.dev to launchpad.test.
813
=== modified file 'src/launchpadlib/testing/launchpad.py'
--- src/launchpadlib/testing/launchpad.py 2014-07-14 20:29:51 +0000
+++ src/launchpadlib/testing/launchpad.py 2019-11-22 13:35:40 +0000
@@ -66,7 +66,10 @@
66"""66"""
6767
68from datetime import datetime68from datetime import datetime
69import collections69try:
70 from collections.abc import Callable
71except ImportError:
72 from collections import Callable
70import sys73import sys
71if sys.version_info[0] >= 3:74if sys.version_info[0] >= 3:
72 basestring = str75 basestring = str
@@ -205,7 +208,7 @@
205 result = self._children.get(name, _marker)208 result = self._children.get(name, _marker)
206 if result is _marker:209 if result is _marker:
207 result = self._values.get(name, _marker)210 result = self._values.get(name, _marker)
208 if isinstance(result, collections.Callable):211 if isinstance(result, Callable):
209 return self._wrap_method(name, result)212 return self._wrap_method(name, result)
210 if name in self.special_methods:213 if name in self.special_methods:
211 return lambda: True214 return lambda: True
@@ -280,7 +283,7 @@
280 attributes and methods.283 attributes and methods.
281 """284 """
282 for name, value in partial_object.items():285 for name, value in partial_object.items():
283 if isinstance(value, collections.Callable):286 if isinstance(value, Callable):
284 # Performs an integrity check.287 # Performs an integrity check.
285 self._get_method(resource_type, name)288 self._get_method(resource_type, name)
286 else:289 else:
@@ -306,7 +309,7 @@
306 if name == "entries":309 if name == "entries":
307 name, child_resource_type = (310 name, child_resource_type = (
308 self._check_entries(resource_type, value))311 self._check_entries(resource_type, value))
309 elif isinstance(value, collections.Callable):312 elif isinstance(value, Callable):
310 # Performs an integrity check.313 # Performs an integrity check.
311 self._get_method(resource_type, name)314 self._get_method(resource_type, name)
312 else:315 else:

Subscribers

People subscribed via source and target branches