async and await are keywords in Python 3.7, so rename them. Bump revision.

This commit is contained in:
joerg 2018-12-27 15:04:42 +00:00
parent 1c6e96caaa
commit 2d14e7c4fb
4 changed files with 178 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.5 2015/04/05 22:07:31 hiramatsu Exp $
# $NetBSD: Makefile,v 1.6 2018/12/27 15:04:42 joerg Exp $
DISTNAME= dropbox-python-sdk-2.2.0
PKGNAME= ${PYPKGPREFIX}-dropbox-2.2.0
PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= https://www.dropbox.com/developers/downloads/sdks/core/python/
EXTRACT_SUFX= .zip

View file

@ -1,6 +1,8 @@
$NetBSD: distinfo,v 1.3 2015/11/04 00:35:30 agc Exp $
$NetBSD: distinfo,v 1.4 2018/12/27 15:04:42 joerg Exp $
SHA1 (dropbox-python-sdk-2.2.0.zip) = 16fc4f2c9e37f49a00cc23d1df4aea9c29ed83c0
RMD160 (dropbox-python-sdk-2.2.0.zip) = 84abbcc17b16ec0d2707e2ad45d94d9f80daf570
SHA512 (dropbox-python-sdk-2.2.0.zip) = 1b30d53c69cd2a79abbdca81956ddd90eae5180b98a4b62cf97590f3201e0b5a0a721909060578831809cdbfa2e31794229d530718ff55067c6545cde09f343e
Size (dropbox-python-sdk-2.2.0.zip) = 691948 bytes
SHA1 (patch-dropbox_datastore.py) = 005aa34cfb446b1df2bcc7e45efaa7e0de906f24
SHA1 (patch-tests_test__datastore.py) = 6f31e4312a7f5c9c0dc80abb4cbf21e7ea81112e

View file

@ -0,0 +1,124 @@
$NetBSD: patch-dropbox_datastore.py,v 1.1 2018/12/27 15:04:42 joerg Exp $
--- dropbox/datastore.py.orig 2018-12-25 21:56:18.018562969 +0000
+++ dropbox/datastore.py
@@ -266,7 +266,7 @@ class _DatastoreOperations(object):
resp = self._client.rest_client.POST(url, params, headers)
return self._check_conflict(resp)
- def await(self, token=None, cursors=None):
+ def send_await(self, token=None, cursors=None):
params = {}
if token:
params['list_datastores'] = json.dumps({'token': token})
@@ -407,7 +407,7 @@ class DatastoreManager(object):
resp = self._dsops.list_datastores()
return [_make_dsinfo(item) for item in resp['datastores']]
- def await(self, token=None, datastores=None):
+ def send_await(self, token=None, datastores=None):
"""Wait until certain changes occur.
This methods implements a flexible and efficient long-polling
@@ -419,11 +419,11 @@ class DatastoreManager(object):
token
An optional token that represents a hash of the list of
datastores, computed by the server. If this parameter is
- present and non-empty, ``await()`` will return when the
+ present and non-empty, ``send_await()`` will return when the
list of datastores has changed in a way that would cause a
different token to be computed, such as when a datastore
is created or deleted. The token should be obtained from
- the previous ``await()`` call; as a special case, the
+ the previous ``send_await()`` call; as a special case, the
value ``'.'`` forces the call to return immediately with a
fresh token (as does any outdated token).
@@ -434,7 +434,7 @@ class DatastoreManager(object):
interested in receiving updates. If this parameter is a
list of instances, the revision to compare is retrieved
from each instance using :meth:`Datastore.get_rev()`. If
- this parameter is present and non-empty, ``await()`` will
+ this parameter is present and non-empty, ``send_await()`` will
return whenever a new revision is available for any of
those datastores.
@@ -448,7 +448,7 @@ class DatastoreManager(object):
token
A new token, or the value of the ``token`` parameter if
there are no changes to the list of datastores. You
- should pass this to the next ``await()`` call.
+ should pass this to the next ``send_await()`` call.
dsinfo
The full list of :class:`DatastoreInfo` objects (as
@@ -465,7 +465,7 @@ class DatastoreManager(object):
not changed (and are still valid) will not be present.
Unlike :meth:`Datastore.load_deltas()` and
- :meth:`Datastore.await_deltas()`, ``await()`` does not apply
+ :meth:`Datastore.await_deltas()`, ``send_await()`` does not apply
the deltas returned in ``deltamap`` to the respective
datastores; that is the caller's responsibility. For
example::
@@ -485,7 +485,7 @@ class DatastoreManager(object):
else:
for ds in datastores:
cursors[ds._handle] = ds._rev
- resp = self._dsops.await(token=token, cursors=cursors)
+ resp = self._dsops.send_await(token=token, cursors=cursors)
dsinfos = None
deltamap = None
if 'list_datastores' in resp:
@@ -512,13 +512,13 @@ class DatastoreManager(object):
@staticmethod
def make_cursor_map(datastores, deltamap):
- """Utility to construct a ``datastores`` argument for :meth:`await()`.
+ """Utility to construct a ``datastores`` argument for :meth:`send_await()`.
Parameters
datastores
A list of :class:`Datastore` objects.
deltamap
- An data structure as returned by :meth:`await()` in its
+ An data structure as returned by :meth:`send_await()` in its
``deltamap`` return value. This may be None or it may be
a dict mapping :class:`Datastore` objects to values that
are either lists of deltas or ``None``.
@@ -526,7 +526,7 @@ class DatastoreManager(object):
Returns
A dict mapping :class:`Datastore` objects to revisions,
suitable to pass as the ``datastores`` parameter to
- :meth:`await()`. This will normally just map the datastores
+ :meth:`send_await()`. This will normally just map the datastores
from the ``datastores`` parameter to their current revision;
however, datastores that are deleted or invalid according to
``deltamap`` are excluded from the dict, and for datastores
@@ -534,7 +534,7 @@ class DatastoreManager(object):
is set to one higher than the revision of the last delta.
Using this function will reduce redundant server roundtrips in
- multi-threaded apps that call :meth:`await()` in a background
+ multi-threaded apps that call :meth:`send_await()` in a background
thread and then pass the received deltas to the main thread
through some kind of queue.
"""
@@ -1146,7 +1146,7 @@ class Datastore(object):
"""
if self._changes:
raise DatastoreError('Cannot call await_deltas() with pending changes')
- resp = self._manager._dsops.await(cursors={self._handle: self._rev})
+ resp = self._manager._dsops.send_await(cursors={self._handle: self._rev})
if 'get_deltas' not in resp:
return {}
subresp = resp['get_deltas']
@@ -1203,7 +1203,7 @@ class Datastore(object):
:meth:`await_deltas()` or :meth:`load_deltas()`.
The deltas should be received from the server. Under certain
- conditions (e.g. when :meth:`DatastoreManager.await()` is
+ conditions (e.g. when :meth:`DatastoreManager.send_await()` is
called in a background thread) it is possible that the server
sends a delta that has already been applied locally. Such
deltas are silently ignored.

View file

@ -0,0 +1,49 @@
$NetBSD: patch-tests_test__datastore.py,v 1.1 2018/12/27 15:04:42 joerg Exp $
--- tests/test_datastore.py.orig 2018-12-25 21:57:44.460130334 +0000
+++ tests/test_datastore.py
@@ -226,7 +226,7 @@ class TestDatastoreManager(unittest.Test
}
# invoke code
- token, dsinfos, deltamap = self.manager.await()
+ token, dsinfos, deltamap = self.manager.send_await()
# check code
self.assertEqual(token, 'notch')
@@ -241,7 +241,7 @@ class TestDatastoreManager(unittest.Test
}
# invoke code
- token, dsinfos, deltamap = self.manager.await('notch')
+ token, dsinfos, deltamap = self.manager.send_await('notch')
# check code
self.assertEqual(token, 'notch')
@@ -262,7 +262,7 @@ class TestDatastoreManager(unittest.Test
}
# invoke code
- token, dsinfos, deltamap = self.manager.await('notch', [ds])
+ token, dsinfos, deltamap = self.manager.send_await('notch', [ds])
# check code
self.assertEqual(token, 'notch')
@@ -286,7 +286,7 @@ class TestDatastoreManager(unittest.Test
}
# invoke code
- token, dsinfos, deltamap = self.manager.await('notch', {ds: 42})
+ token, dsinfos, deltamap = self.manager.send_await('notch', {ds: 42})
# check code
self.assertEqual(token, 'notch')
@@ -310,7 +310,7 @@ class TestDatastoreManager(unittest.Test
}
# invoke code
- token, dsinfos, deltamap = self.manager.await('notch', [ds])
+ token, dsinfos, deltamap = self.manager.send_await('notch', [ds])
# check code
self.assertEqual(token, 'notch')