You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by dh...@apache.org on 2016/07/07 16:49:50 UTC
[1/2] incubator-beam git commit: Enable linter rules no-self-argument,
reimported, ungrouped-imports
Repository: incubator-beam
Updated Branches:
refs/heads/python-sdk 253497655 -> 6b06e3e22
Enable linter rules no-self-argument, reimported, ungrouped-imports
And run lint on python/sdks folder to include setup.py.
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/2b14fe5d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/2b14fe5d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/2b14fe5d
Branch: refs/heads/python-sdk
Commit: 2b14fe5dd4d289599bc902a39392a7956a4d59c9
Parents: 2534976
Author: Ahmet Altay <al...@google.com>
Authored: Wed Jul 6 12:41:19 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Thu Jul 7 09:49:36 2016 -0700
----------------------------------------------------------------------
sdks/python/.pylintrc | 3 ---
sdks/python/apache_beam/examples/snippets/snippets.py | 1 +
sdks/python/apache_beam/examples/snippets/snippets_test.py | 7 ++++---
sdks/python/apache_beam/transforms/combiners_test.py | 9 ++++-----
sdks/python/apache_beam/transforms/trigger.py | 3 ++-
sdks/python/run_pylint.sh | 2 +-
sdks/python/setup.py | 5 ++---
7 files changed, 14 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2b14fe5d/sdks/python/.pylintrc
----------------------------------------------------------------------
diff --git a/sdks/python/.pylintrc b/sdks/python/.pylintrc
index c138f1a..c69fd2b 100644
--- a/sdks/python/.pylintrc
+++ b/sdks/python/.pylintrc
@@ -101,7 +101,6 @@ disable =
multiple-statements,
no-member,
no-name-in-module,
- no-self-argument,
no-self-use,
no-value-for-parameter,
not-callable,
@@ -112,14 +111,12 @@ disable =
redefined-outer-name,
redefined-variable-type,
redundant-keyword-arg,
- reimported,
relative-import,
similarities,
simplifiable-if-statement,
super-init-not-called,
undefined-variable,
unexpected-keyword-arg,
- ungrouped-imports,
unidiomatic-typecheck,
unnecessary-lambda,
unneeded-not,
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2b14fe5d/sdks/python/apache_beam/examples/snippets/snippets.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/snippets/snippets.py b/sdks/python/apache_beam/examples/snippets/snippets.py
index f5bbc66..d84deea 100644
--- a/sdks/python/apache_beam/examples/snippets/snippets.py
+++ b/sdks/python/apache_beam/examples/snippets/snippets.py
@@ -39,6 +39,7 @@ import apache_beam as beam
# pylint:disable=invalid-name
# pylint:disable=expression-not-assigned
# pylint:disable=redefined-outer-name
+# pylint:disable=reimported
# pylint:disable=unused-variable
# pylint:disable=wrong-import-order, wrong-import-position
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2b14fe5d/sdks/python/apache_beam/examples/snippets/snippets_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/snippets/snippets_test.py b/sdks/python/apache_beam/examples/snippets/snippets_test.py
index 87ce266..6e1045f 100644
--- a/sdks/python/apache_beam/examples/snippets/snippets_test.py
+++ b/sdks/python/apache_beam/examples/snippets/snippets_test.py
@@ -26,10 +26,11 @@ import apache_beam as beam
from apache_beam import io
from apache_beam import pvalue
from apache_beam import typehints
-from apache_beam.examples.snippets import snippets
from apache_beam.io import fileio
from apache_beam.utils.options import TypeOptions
+from apache_beam.examples.snippets import snippets
+# pylint: disable=expression-not-assigned
# Monky-patch to use native sink for file path re-writing.
io.TextFileSink = fileio.NativeTextFileSink
@@ -226,6 +227,7 @@ class TypeHintsTest(unittest.TestCase):
def test_bad_types(self):
p = beam.Pipeline('DirectPipelineRunner', argv=sys.argv)
+ evens = None # pylint: disable=unused-variable
# [START type_hints_missing_define_numbers]
numbers = p | beam.Create(['1', '2', '3'])
@@ -236,7 +238,7 @@ class TypeHintsTest(unittest.TestCase):
evens = numbers | beam.Filter(lambda x: x % 2 == 0)
# [END type_hints_missing_apply]
- # Now suppose numers was defined as [snippet above].
+ # Now suppose numbers was defined as [snippet above].
# When running this pipeline, you'd get a runtime error,
# possibly on a remote machine, possibly very late.
@@ -298,7 +300,6 @@ class TypeHintsTest(unittest.TestCase):
# [END type_hints_runtime_on]
def test_deterministic_key(self):
- p = beam.Pipeline('DirectPipelineRunner', argv=sys.argv)
lines = ['banana,fruit,3', 'kiwi,fruit,2', 'kiwi,fruit,2', 'zucchini,veg,3']
# [START type_hints_deterministic_key]
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2b14fe5d/sdks/python/apache_beam/transforms/combiners_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/combiners_test.py b/sdks/python/apache_beam/transforms/combiners_test.py
index 10682b4..a747112 100644
--- a/sdks/python/apache_beam/transforms/combiners_test.py
+++ b/sdks/python/apache_beam/transforms/combiners_test.py
@@ -21,7 +21,6 @@ import unittest
import apache_beam as beam
from apache_beam.pipeline import Pipeline
-from apache_beam.transforms import combiners
import apache_beam.transforms.combiners as combine
from apache_beam.transforms.core import CombineGlobally
from apache_beam.transforms.core import Create
@@ -101,16 +100,16 @@ class CombineTest(unittest.TestCase):
pipeline = Pipeline('DirectPipelineRunner')
pcoll = pipeline | Create('start', [6, 3, 1, 1, 9, 1, 5, 2, 0, 6])
- result_top = pcoll | beam.CombineGlobally('top', combiners.Largest(5))
- result_bot = pcoll | beam.CombineGlobally('bot', combiners.Smallest(4))
+ result_top = pcoll | beam.CombineGlobally('top', combine.Largest(5))
+ result_bot = pcoll | beam.CombineGlobally('bot', combine.Smallest(4))
assert_that(result_top, equal_to([[9, 6, 6, 5, 3]]), label='assert:top')
assert_that(result_bot, equal_to([[0, 1, 1, 1]]), label='assert:bot')
pcoll = pipeline | Create(
'start-perkey', [('a', x) for x in [6, 3, 1, 1, 9, 1, 5, 2, 0, 6]])
- result_ktop = pcoll | beam.CombinePerKey('top-perkey', combiners.Largest(5))
+ result_ktop = pcoll | beam.CombinePerKey('top-perkey', combine.Largest(5))
result_kbot = pcoll | beam.CombinePerKey(
- 'bot-perkey', combiners.Smallest(4))
+ 'bot-perkey', combine.Smallest(4))
assert_that(result_ktop, equal_to([('a', [9, 6, 6, 5, 3])]), label='k:top')
assert_that(result_kbot, equal_to([('a', [0, 1, 1, 1])]), label='k:bot')
pipeline.run()
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2b14fe5d/sdks/python/apache_beam/transforms/trigger.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/trigger.py b/sdks/python/apache_beam/transforms/trigger.py
index 788277c..587384a 100644
--- a/sdks/python/apache_beam/transforms/trigger.py
+++ b/sdks/python/apache_beam/transforms/trigger.py
@@ -800,11 +800,12 @@ class GeneralTriggerDriver(TriggerDriver):
class TriggerMergeContext(WindowFn.MergeContext):
- def merge(_, to_be_merged, merge_result):
+ def merge(_, to_be_merged, merge_result): # pylint: disable=no-self-argument
for window in to_be_merged:
if window != merge_result:
merged_away[window] = merge_result
state.merge(to_be_merged, merge_result)
+ # using the outer self argument.
self.trigger_fn.on_merge(
to_be_merged, merge_result, state.at(merge_result))
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2b14fe5d/sdks/python/run_pylint.sh
----------------------------------------------------------------------
diff --git a/sdks/python/run_pylint.sh b/sdks/python/run_pylint.sh
index 8cc7fef..6114034 100755
--- a/sdks/python/run_pylint.sh
+++ b/sdks/python/run_pylint.sh
@@ -37,7 +37,7 @@ git fetch
# Use diff-filter to exclude deleted files. (i.e. Do not try to lint files that
# does not exist any more.) Filter the output to .py files only. Rewrite the
# paths relative to the sdks/python folder.
-CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB origin/$BASE_BRANCH apache_beam \
+CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB origin/$BASE_BRANCH . \
| { grep ".py$" || true; } \
| sed 's/sdks\/python\///g')
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2b14fe5d/sdks/python/setup.py
----------------------------------------------------------------------
diff --git a/sdks/python/setup.py b/sdks/python/setup.py
index 029226e..789d976 100644
--- a/sdks/python/setup.py
+++ b/sdks/python/setup.py
@@ -19,7 +19,6 @@
import os
import platform
-import re
import setuptools
@@ -29,7 +28,7 @@ if platform.system() == 'Windows':
cythonize = lambda *args, **kwargs: []
else:
try:
- # pylint: disable=g-statement-before-imports,g-import-not-at-top
+ # pylint: disable=wrong-import-position
from Cython.Build import cythonize
except ImportError:
cythonize = lambda *args, **kwargs: []
@@ -93,4 +92,4 @@ setuptools.setup(
],
license='Apache 2.0',
keywords='apache beam',
- )
\ No newline at end of file
+ )
[2/2] incubator-beam git commit: Closes #593
Posted by dh...@apache.org.
Closes #593
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/6b06e3e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/6b06e3e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/6b06e3e2
Branch: refs/heads/python-sdk
Commit: 6b06e3e220cb25b4aa4fe4ab3647e19d0c257f2a
Parents: 2534976 2b14fe5
Author: Dan Halperin <dh...@google.com>
Authored: Thu Jul 7 09:49:43 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Thu Jul 7 09:49:43 2016 -0700
----------------------------------------------------------------------
sdks/python/.pylintrc | 3 ---
sdks/python/apache_beam/examples/snippets/snippets.py | 1 +
sdks/python/apache_beam/examples/snippets/snippets_test.py | 7 ++++---
sdks/python/apache_beam/transforms/combiners_test.py | 9 ++++-----
sdks/python/apache_beam/transforms/trigger.py | 3 ++-
sdks/python/run_pylint.sh | 2 +-
sdks/python/setup.py | 5 ++---
7 files changed, 14 insertions(+), 16 deletions(-)
----------------------------------------------------------------------