From 144729f9ee1d423db036114cefc6bb5218e5b730 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 19 Mar 2019 19:01:06 -0700 Subject: [PATCH] Automated rollback of commit 4c86091df59017b4e13b2927cb823c3b45e0d6fd PiperOrigin-RevId: 239317860 --- tensorflow/python/autograph/pyct/inspect_utils.py | 2 +- tensorflow/python/autograph/pyct/inspect_utils_test.py | 8 +------- .../python/autograph/pyct/testing/future_import_module.py | 6 ------ 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/tensorflow/python/autograph/pyct/inspect_utils.py b/tensorflow/python/autograph/pyct/inspect_utils.py index 855a690c4b2..f2b780d7fcd 100644 --- a/tensorflow/python/autograph/pyct/inspect_utils.py +++ b/tensorflow/python/autograph/pyct/inspect_utils.py @@ -298,7 +298,7 @@ def getfutureimports(entity): Returns: A tuple of future strings """ - if not (tf_inspect.isfunction(entity) or tf_inspect.ismethod(entity)): + if not tf_inspect.isfunction(entity): return tuple() return tuple(sorted(name for name, value in entity.__globals__.items() if getattr(value, '__module__', None) == '__future__')) diff --git a/tensorflow/python/autograph/pyct/inspect_utils_test.py b/tensorflow/python/autograph/pyct/inspect_utils_test.py index ab8e95e09c4..75b41d226f6 100644 --- a/tensorflow/python/autograph/pyct/inspect_utils_test.py +++ b/tensorflow/python/autograph/pyct/inspect_utils_test.py @@ -415,18 +415,12 @@ class InspectUtilsTest(test.TestCase): self.assertTrue(inspect_utils.isbuiltin(zip)) self.assertFalse(inspect_utils.isbuiltin(function_decorator)) - def test_getfutureimports_functions(self): + def test_getfutureimports_simple_case(self): expected_imports = ('absolute_import', 'division', 'print_function', 'with_statement') self.assertEqual(inspect_utils.getfutureimports(future_import_module.f), expected_imports) - def test_getfutureimports_methods(self): - expected_imports = ('absolute_import', 'division', 'print_function', - 'with_statement') - self.assertEqual(inspect_utils.getfutureimports(future_import_module.Foo.f), - expected_imports) - def test_super_wrapper_for_dynamic_attrs(self): a = object() diff --git a/tensorflow/python/autograph/pyct/testing/future_import_module.py b/tensorflow/python/autograph/pyct/testing/future_import_module.py index 95698a18268..a167322dbfe 100644 --- a/tensorflow/python/autograph/pyct/testing/future_import_module.py +++ b/tensorflow/python/autograph/pyct/testing/future_import_module.py @@ -24,9 +24,3 @@ from __future__ import with_statement def f(): print('foo') - - -class Foo(object): - - def f(self): - print('foo')