From fb15f0f4e4885243d354a14997d09463594385bf Mon Sep 17 00:00:00 2001 From: Akira Baruah Date: Tue, 3 Oct 2017 12:03:18 -0700 Subject: Match upstream python-gflags-3.1.0 imports (fixes #3816) --- third_party/py/gflags/BUILD | 1 + third_party/py/gflags/gflags/__init__.py | 12 ++++++------ third_party/py/gflags/gflags/_helpers.py | 2 +- third_party/py/gflags/gflags/_helpers_test.py | 4 ++-- third_party/py/gflags/gflags/argument_parser.py | 2 +- third_party/py/gflags/gflags/exceptions.py | 2 +- third_party/py/gflags/gflags/flag.py | 6 +++--- third_party/py/gflags/gflags/flags_formatting_test.py | 2 +- .../py/gflags/gflags/flags_modules_for_testing/module_bar.py | 2 +- .../py/gflags/gflags/flags_modules_for_testing/module_foo.py | 2 +- third_party/py/gflags/gflags/flagvalues.py | 6 +++--- third_party/py/gflags/gflags/validators.py | 2 +- 12 files changed, 22 insertions(+), 21 deletions(-) (limited to 'third_party/py') diff --git a/third_party/py/gflags/BUILD b/third_party/py/gflags/BUILD index ef1a624458..35f06748e7 100644 --- a/third_party/py/gflags/BUILD +++ b/third_party/py/gflags/BUILD @@ -11,5 +11,6 @@ py_library( deps = ["//third_party/py/six"], srcs = glob(["**/*.py"]), srcs_version = "PY2AND3", + imports = ["."], visibility = ["//visibility:public"], ) diff --git a/third_party/py/gflags/gflags/__init__.py b/third_party/py/gflags/gflags/__init__.py index b0025eaa39..81f4f33437 100644 --- a/third_party/py/gflags/gflags/__init__.py +++ b/third_party/py/gflags/gflags/__init__.py @@ -57,13 +57,13 @@ import warnings import six -import _helpers -import argument_parser -import exceptions +from gflags import _helpers +from gflags import argument_parser +from gflags import exceptions # _flag alias is to avoid 'redefined outer name' warnings. -import flag as _flag -import flagvalues -import validators as gflags_validators +from gflags import flag as _flag +from gflags import flagvalues +from gflags import validators as gflags_validators # Add current module to disclaimed module ids. diff --git a/third_party/py/gflags/gflags/_helpers.py b/third_party/py/gflags/gflags/_helpers.py index f740506fdd..d46c4e6e63 100644 --- a/third_party/py/gflags/gflags/_helpers.py +++ b/third_party/py/gflags/gflags/_helpers.py @@ -47,7 +47,7 @@ except ImportError: termios = None # pylint: disable=g-import-not-at-top -import third_party.pep257 as pep257 +import gflags.third_party.pep257 as pep257 import six diff --git a/third_party/py/gflags/gflags/_helpers_test.py b/third_party/py/gflags/gflags/_helpers_test.py index 2a7c124837..0f2870a113 100644 --- a/third_party/py/gflags/gflags/_helpers_test.py +++ b/third_party/py/gflags/gflags/_helpers_test.py @@ -33,7 +33,7 @@ import sys import unittest -import _helpers +from gflags import _helpers from gflags.flags_modules_for_testing import module_bar from gflags.flags_modules_for_testing import module_foo @@ -104,7 +104,7 @@ class GetCallingModuleTest(unittest.TestCase): # all code resides in one of the imported modules: Python is a # really dynamic language, where we can dynamically construct some # code and execute it. - code = ('import _helpers\n' + code = ('from gflags import _helpers\n' 'module_name = _helpers.GetCallingModule()') exec(code) # pylint: disable=exec-used diff --git a/third_party/py/gflags/gflags/argument_parser.py b/third_party/py/gflags/gflags/argument_parser.py index 9f7262b231..8e3edaf494 100644 --- a/third_party/py/gflags/gflags/argument_parser.py +++ b/third_party/py/gflags/gflags/argument_parser.py @@ -40,7 +40,7 @@ import string import six -import _helpers +from gflags import _helpers class _ArgumentParserCache(type): diff --git a/third_party/py/gflags/gflags/exceptions.py b/third_party/py/gflags/gflags/exceptions.py index efaabb89fd..86ca1587df 100644 --- a/third_party/py/gflags/gflags/exceptions.py +++ b/third_party/py/gflags/gflags/exceptions.py @@ -36,7 +36,7 @@ flags package and use the aliases defined at the package level. import sys -import _helpers +from gflags import _helpers # TODO(vrusinov): use DISCLAIM_key_flags when it's moved out of __init__. diff --git a/third_party/py/gflags/gflags/flag.py b/third_party/py/gflags/gflags/flag.py index e176b5e35f..b0b2dd998c 100644 --- a/third_party/py/gflags/gflags/flag.py +++ b/third_party/py/gflags/gflags/flag.py @@ -37,9 +37,9 @@ from functools import total_ordering import six -import _helpers -import argument_parser -import exceptions +from gflags import _helpers +from gflags import argument_parser +from gflags import exceptions class _FlagMetaClass(type): diff --git a/third_party/py/gflags/gflags/flags_formatting_test.py b/third_party/py/gflags/gflags/flags_formatting_test.py index d2d585cb72..a2a925a802 100644 --- a/third_party/py/gflags/gflags/flags_formatting_test.py +++ b/third_party/py/gflags/gflags/flags_formatting_test.py @@ -2,7 +2,7 @@ import unittest import gflags -import _helpers +from gflags import _helpers FLAGS = gflags.FLAGS diff --git a/third_party/py/gflags/gflags/flags_modules_for_testing/module_bar.py b/third_party/py/gflags/gflags/flags_modules_for_testing/module_bar.py index 4dddd005bb..f703be8eb9 100644 --- a/third_party/py/gflags/gflags/flags_modules_for_testing/module_bar.py +++ b/third_party/py/gflags/gflags/flags_modules_for_testing/module_bar.py @@ -37,7 +37,7 @@ sure the unit tests for gflags.py involve more than one module. __author__ = 'salcianu@google.com (Alex Salcianu)' import gflags -import _helpers +from gflags import _helpers FLAGS = gflags.FLAGS diff --git a/third_party/py/gflags/gflags/flags_modules_for_testing/module_foo.py b/third_party/py/gflags/gflags/flags_modules_for_testing/module_foo.py index 34e464d297..f5f0998c06 100644 --- a/third_party/py/gflags/gflags/flags_modules_for_testing/module_foo.py +++ b/third_party/py/gflags/gflags/flags_modules_for_testing/module_foo.py @@ -37,7 +37,7 @@ for gflags.py involve more than one module. __author__ = 'salcianu@google.com (Alex Salcianu)' import gflags -import _helpers +from gflags import _helpers from gflags.flags_modules_for_testing import module_bar FLAGS = gflags.FLAGS diff --git a/third_party/py/gflags/gflags/flagvalues.py b/third_party/py/gflags/gflags/flagvalues.py index a47b40308f..f6c8f2632d 100644 --- a/third_party/py/gflags/gflags/flagvalues.py +++ b/third_party/py/gflags/gflags/flagvalues.py @@ -44,9 +44,9 @@ from xml.dom import minidom import six -import _helpers -import exceptions -import flag as _flag +from gflags import _helpers +from gflags import exceptions +from gflags import flag as _flag # Add flagvalues module to disclaimed module ids. _helpers.disclaim_module_ids.add(id(sys.modules[__name__])) diff --git a/third_party/py/gflags/gflags/validators.py b/third_party/py/gflags/gflags/validators.py index 79d10f92a5..3e32f7297f 100644 --- a/third_party/py/gflags/gflags/validators.py +++ b/third_party/py/gflags/gflags/validators.py @@ -39,7 +39,7 @@ See 'FLAGS VALIDATORS' in the flags module's docstring for a usage manual. __author__ = 'olexiy@google.com (Olexiy Oryeshko)' -import exceptions +from gflags import exceptions # TODO(yileiyang): Remove this. -- cgit v1.2.3