Skip to content

Commit 3914c34

Browse files
committed
refactor: use internal stgpytools
1 parent 1b1c40d commit 3914c34

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

vstools/stgpytools/types/file.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
from __future__ import annotations
22

33
import fnmatch
4+
import os
45
import shutil
6+
import sys
57
from os import PathLike, listdir, path, walk
68
from pathlib import Path
9+
from pathlib import PureWindowsPath, PurePosixPath
710
from typing import TYPE_CHECKING, Any, Callable, Iterable, Literal, TypeAlias, Union
811

912
__all__ = [
@@ -59,14 +62,13 @@
5962
class SPath(Path):
6063
"""Modified version of pathlib.Path"""
6164

65+
if sys.version_info[0] == 3 and sys.version_info[1] < 12:
66+
_flavour = PurePosixPath._flavour if os.name == 'posix' else PureWindowsPath._flavour # type:ignore # noqa
67+
6268
if TYPE_CHECKING:
6369
def __new__(cls, *args: SPathLike, **kwargs: Any) -> SPath:
6470
pass
6571

66-
else:
67-
def __new__(cls, *args: SPathLike, **kwargs: Any) -> Any:
68-
return super().__new__(cls, *args, **kwargs)
69-
7072
def format(self, *args: Any, **kwargs: Any) -> SPath:
7173
"""Format the path with the given arguments."""
7274

0 commit comments

Comments
 (0)