mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
16 lines
545 B
Python
16 lines
545 B
Python
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
# pyre-strict
|
|
import libcst.nodes as libcst
|
|
|
|
|
|
def get_fully_qualified_name(node: libcst.BaseExpression) -> str:
|
|
if isinstance(node, libcst.Name):
|
|
return node.value
|
|
elif isinstance(node, libcst.Attribute):
|
|
return get_fully_qualified_name(node.value) + "." + node.attr.value
|
|
else:
|
|
raise Exception(f"Invalid node type {type(node)}!")
|