Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Typing][B-54] Add type annotations for python/paddle/utils/cpp_extension/extension_utils.py #65819

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions python/paddle/utils/cpp_extension/extension_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import atexit
import collections
import glob
Expand Down Expand Up @@ -156,7 +158,7 @@ def bootstrap_context():
bdist_egg.write_stub = origin_write_stub


def load_op_meta_info_and_register_op(lib_filename):
def load_op_meta_info_and_register_op(lib_filename: str) -> list[str]:
core.load_op_meta_info_and_register_op(lib_filename)
return OpProtoHolder.instance().update_op_proto()

Expand Down Expand Up @@ -887,7 +889,7 @@ def is_cuda_file(path):
return items[-1] in cuda_suffix


def get_build_directory(verbose=False):
def get_build_directory(verbose: bool = False) -> str:
"""
Return paddle extension root directory to put shared library. It could be specified by
``export PADDLE_EXTENSION_DIR=XXX`` . If not set, ``~/.cache/paddle_extension`` will be used
Expand Down Expand Up @@ -928,7 +930,7 @@ def get_build_directory(verbose=False):
return root_extensions_directory


def parse_op_info(op_name):
def parse_op_info(op_name: str) -> tuple[list[str], list[str], list[str]]:
"""
Parse input names and outputs detail information from registered custom op
from OpInfoMap.
Expand Down