mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert "[BE][Easy] replace import pathlib
with from pathlib import Path
(#129426)"
This reverts commit 6d75604ef135925e8c85363c2f4a5e0b6f7fef28. Reverted https://github.com/pytorch/pytorch/pull/129426 on behalf of https://github.com/XuehaiPan due to recognize `Path` as new exported API ([comment](https://github.com/pytorch/pytorch/pull/129426#issuecomment-2198371625))
This commit is contained in:
@ -2,8 +2,8 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, cast
|
||||
|
||||
import yaml
|
||||
@ -19,7 +19,7 @@ TAGS_PATH = "aten/src/ATen/native/tags.yaml"
|
||||
|
||||
|
||||
def generate_code(
|
||||
gen_dir: Path,
|
||||
gen_dir: pathlib.Path,
|
||||
native_functions_path: str | None = None,
|
||||
tags_path: str | None = None,
|
||||
install_dir: str | None = None,
|
||||
@ -41,7 +41,7 @@ def generate_code(
|
||||
autograd_gen_dir = os.path.join(install_dir, "autograd", "generated")
|
||||
for d in (autograd_gen_dir, python_install_dir):
|
||||
os.makedirs(d, exist_ok=True)
|
||||
autograd_dir = os.fspath(Path(__file__).parent.parent / "autograd")
|
||||
autograd_dir = os.fspath(pathlib.Path(__file__).parent.parent / "autograd")
|
||||
|
||||
if subset == "pybindings" or not subset:
|
||||
gen_autograd_python(
|
||||
@ -133,8 +133,8 @@ def main() -> None:
|
||||
parser.add_argument("--tags-path")
|
||||
parser.add_argument(
|
||||
"--gen-dir",
|
||||
type=Path,
|
||||
default=Path("."),
|
||||
type=pathlib.Path,
|
||||
default=pathlib.Path("."),
|
||||
help="Root directory where to install files. Defaults to the current working directory.",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
Reference in New Issue
Block a user