8000 [BE][Easy] replace `import pathlib` with `from pathlib import Path` by XuehaiPan · Pull Request #129426 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[BE][Easy] replace import pathlib with from pathlib import Path #129426

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

Closed
wants to merge 13 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Update
[ghstack-poisoned]
  • Loading branch information
XuehaiPan committed Jun 29, 2024
commit e1f79824c54dea963c48fb639af32bcf181962f5
6 changes: 3 additions & 3 deletions torch/utils/data/datapipes/gen_pyi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# mypy: allow-untyped-defs
import os
import pathlib
from collections import defaultdict
from pathlib import Path
from typing import Any, Dict, List, Set, Tuple, Union


Expand Down Expand Up @@ -211,7 +211,7 @@ def get_method_definitions(
# 3. Remove first argument after self (unless it is "*datapipes"), default args, and spaces
"""
if root == "":
root = str(Path(__file__).parent.resolve())
root = str(pathlib.Path(__file__).parent.resolve())
file_path = [file_path] if isinstance(file_path, str) else file_path
file_path = [os.path.join(root, path) for path in file_path]
file_paths = find_file_paths(
Expand Down Expand Up @@ -288,7 +288,7 @@ def main() -> None:
mapDP_method_to_special_output_type,
)

path = Path(__file__).parent.resolve()
path = pathlib.Path(__file__).parent.resolve()
replacements = [
("${IterDataPipeMethods}", iter_method_definitions, 4),
("${MapDataPipeMethods}", map_method_definitions, 4),
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0