Skip to content

Commit 24bf989

Browse files
authored
Better inheritance for pathlib (#216)
* Better inheritance for pathlib * Remove unnecessary imports
1 parent 09675ed commit 24bf989

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

wcmatch/pathlib.py

+6-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Pathlib implementation that uses our own glob."""
22
from __future__ import annotations
3-
import ntpath
4-
import posixpath
53
import pathlib
64
import os
75
from . import glob
@@ -227,28 +225,16 @@ def rglob( # type: ignore[override]
227225
yield from self.glob(patterns, flags=flags | _EXTMATCHBASE, limit=limit, exclude=exclude)
228226

229227

230-
if util.PY313:
231-
class PurePosixPath(pathlib.PurePosixPath, PurePath):
232-
"""Pure Posix path."""
228+
class PurePosixPath(PurePath, pathlib.PurePosixPath):
229+
"""Pure Posix path."""
233230

234-
__slots__ = ()
235-
236-
class PureWindowsPath(pathlib.PureWindowsPath, PurePath):
237-
"""Pure Windows path."""
238-
239-
__slots__ = ()
240-
else:
241-
class PurePosixPath(PurePath): # type: ignore[no-redef]
242-
"""Pure Posix path."""
231+
__slots__ = ()
243232

244-
_flavour = pathlib._posix_flavour if not util.PY312 else posixpath # type: ignore[attr-defined]
245-
__slots__ = ()
246233

247-
class PureWindowsPath(PurePath): # type: ignore[no-redef]
248-
"""Pure Windows path."""
234+
class PureWindowsPath(PurePath, pathlib.PureWindowsPath):
235+
"""Pure Windows path."""
249236

250-
_flavour = pathlib._windows_flavour if not util.PY312 else ntpath # type: ignore[attr-defined]
251-
__slots__ = ()
237+
__slots__ = ()
252238

253239

254240
class PosixPath(Path, PurePosixPath):

0 commit comments

Comments
 (0)