Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 4ec1c29

Browse files
committed
add submodule aliasing to bigtable_admin/__init__ to make code consistent
1 parent 9f89ff0 commit 4ec1c29

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

google/cloud/bigtable_admin/__init__.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,23 @@
1414
# limitations under the License.
1515
#
1616

17-
# There are no subpackages exported from google.cloud.bigtable_admin,
18-
# only an import alias for objects in google.cloud.bigtable.admin.
19-
# We maintain that surface here.
17+
import sys
18+
import importlib
19+
import pkgutil
2020

21-
from google.cloud.bigtable.admin import * # noqa: F401,F403
2221
import google.cloud.bigtable.admin
2322

24-
__all__ = google.cloud.bigtable.admin.__all__
23+
# Alias all subpackages of google.cloud.bigtable.admin to
24+
# corresponding subpackages of google.cloud.bigtable_admin_v2.
25+
26+
_NEW_PATH = "google.cloud.bigtable.admin"
27+
sys.modules[__name__] = google.cloud.bigtable.admin
28+
29+
# iterate and import all submodules to populate sys.modules
30+
for _, name, _ in pkgutil.walk_packages(
31+
path=google.cloud.bigtable.admin.__path__,
32+
prefix=_NEW_PATH + ".",
33+
):
34+
mod = importlib.import_module(name)
35+
alias = name.replace(_NEW_PATH, __name__, 1)
36+
sys.modules[alias] = mod

0 commit comments

Comments
 (0)