Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
"""


from __future__ import absolute_import

import sys


Expand Down
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

"""Python Dataflow error classes."""

from __future__ import absolute_import


class BeamError(Exception):
"""Base class for all Beam errors."""
Expand Down
7 changes: 5 additions & 2 deletions sdks/python/apache_beam/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
import os
import shutil
import tempfile
from builtins import object
from builtins import zip

from future.utils import with_metaclass

from apache_beam import pvalue
from apache_beam.internal import pickler
Expand Down Expand Up @@ -880,15 +884,14 @@ def is_side_input(tag):
return result


class PTransformOverride(object):
class PTransformOverride(with_metaclass(abc.ABCMeta, object)):
"""For internal use only; no backwards-compatibility guarantees.

Gives a matcher and replacements for matching PTransforms.

TODO: Update this to support cases where input and/our output types are
different.
"""
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
def matches(self, applied_ptransform):
Expand Down
4 changes: 4 additions & 0 deletions sdks/python/apache_beam/pipeline_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@

"""Unit tests for the Pipeline class."""

from __future__ import absolute_import

import copy
import logging
import platform
import unittest
from builtins import object
from builtins import range
from collections import defaultdict

import mock
Expand Down
11 changes: 8 additions & 3 deletions sdks/python/apache_beam/pvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

import collections
import itertools

from six import string_types
from builtins import hex
from builtins import object

from apache_beam import coders
from apache_beam import typehints
Expand All @@ -38,6 +38,11 @@
from apache_beam.portability import python_urns
from apache_beam.portability.api import beam_runner_api_pb2

try:
unicode # pylint: disable=unicode-builtin
except NameError:
unicode = str

__all__ = [
'PCollection',
'TaggedOutput',
Expand Down Expand Up @@ -261,7 +266,7 @@ class TaggedOutput(object):
"""

def __init__(self, tag, value):
if not isinstance(tag, string_types):
if not isinstance(tag, (str, unicode)):
raise TypeError(
'Attempting to create a TaggedOutput with non-string tag %s' % tag)
self.tag = tag
Expand Down
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/pvalue_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

"""Unit tests for the PValue and PCollection classes."""

from __future__ import absolute_import

import unittest

from apache_beam.pvalue import AsSingleton
Expand Down
5 changes: 5 additions & 0 deletions sdks/python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ deps =
flake8==3.5.0
modules =
apache_beam/coders
apache_beam/error
apache_beam/pipeline
apache_beam/pipeline_test
apache_beam/pvalue
apache_beam/pvalue_test
commands =
python --version
pip --version
Expand Down