We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a7a582 commit 0411505Copy full SHA for 0411505
astroid/brain/brain_tensorflow.py
@@ -8,9 +8,15 @@
8
9
def _tensorflow_fail_hook(modname: str):
10
parts = modname.split(".", 1)
11
+ fallbacks = ("python", "_api.v2")
12
if parts[0] == "tensorflow":
- parts[0] = "tensorflow.python"
13
- return MANAGER.ast_from_module_name(".".join(parts))
+ for fallback in fallbacks:
14
+ if parts[1].startswith(fallbacks):
15
+ continue
16
+ try:
17
+ return MANAGER.ast_from_module_name(f"tensorflow.{fallback}.{parts[1]}")
18
+ except AstroidBuildingError:
19
20
raise AstroidBuildingError(modname=modname)
21
22
0 commit comments