You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by al...@apache.org on 2019/01/30 01:33:53 UTC
[beam] branch master updated: Minor fixes for Python 3 compatibility
This is an automated email from the ASF dual-hosted git repository.
altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new b9f4e2d Minor fixes for Python 3 compatibility
new f1e1e83 Merge pull request #7589 from charlesccychen/fix-minor-py3
b9f4e2d is described below
commit b9f4e2da5ba7296a857013720ca7f92f145b3d20
Author: Charles Chen <cc...@google.com>
AuthorDate: Tue Jan 22 12:51:51 2019 -0800
Minor fixes for Python 3 compatibility
---
sdks/python/apache_beam/internal/gcp/json_value.py | 10 +++++-----
sdks/python/apache_beam/runners/worker/operations.py | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sdks/python/apache_beam/internal/gcp/json_value.py b/sdks/python/apache_beam/internal/gcp/json_value.py
index d4c4bfe..c02b639 100644
--- a/sdks/python/apache_beam/internal/gcp/json_value.py
+++ b/sdks/python/apache_beam/internal/gcp/json_value.py
@@ -43,7 +43,7 @@ def get_typed_value_descriptor(obj):
Converts a basic type into a @type/value dictionary.
Args:
- obj: A basestring, bool, int, or float to be converted.
+ obj: A bytes, unicode, bool, int, or float to be converted.
Returns:
A dictionary containing the keys ``@type`` and ``value`` with the value for
@@ -53,7 +53,7 @@ def get_typed_value_descriptor(obj):
~exceptions.TypeError: if the Python object has a type that is not
supported.
"""
- if isinstance(obj, (str, unicode)):
+ if isinstance(obj, (bytes, unicode)):
type_name = 'Text'
elif isinstance(obj, bool):
type_name = 'Boolean'
@@ -73,9 +73,9 @@ def to_json_value(obj, with_type=False):
Args:
obj: Python object to be converted. Can be :data:`None`.
- with_type: If true then the basic types (``string``, ``int``, ``float``,
- ``bool``) will be wrapped in ``@type:value`` dictionaries. Otherwise the
- straight value is encoded into a ``JsonValue``.
+ with_type: If true then the basic types (``bytes``, ``unicode``, ``int``,
+ ``float``, ``bool``) will be wrapped in ``@type:value`` dictionaries.
+ Otherwise the straight value is encoded into a ``JsonValue``.
Returns:
A ``JsonValue`` object using ``JsonValue``, ``JsonArray`` and ``JsonObject``
diff --git a/sdks/python/apache_beam/runners/worker/operations.py b/sdks/python/apache_beam/runners/worker/operations.py
index 0bbfd36..c1341f3 100644
--- a/sdks/python/apache_beam/runners/worker/operations.py
+++ b/sdks/python/apache_beam/runners/worker/operations.py
@@ -611,7 +611,7 @@ class PGBKOperation(Operation):
def flush(self, target):
limit = self.size - target
- for ix, (kw, vs) in enumerate(self.table.items()):
+ for ix, (kw, vs) in enumerate(list(self.table.items())):
if ix >= limit:
break
del self.table[kw]