Skip to content

Commit

Permalink
Better inheritance for pathlib (#216)
Browse files Browse the repository at this point in the history
* Better inheritance for pathlib

* Remove unnecessary imports
  • Loading branch information
facelessuser committed May 5, 2024
1 parent 09675ed commit 24bf989
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions wcmatch/pathlib.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Pathlib implementation that uses our own glob."""
from __future__ import annotations
import ntpath
import posixpath
import pathlib
import os
from . import glob
Expand Down Expand Up @@ -227,28 +225,16 @@ def rglob( # type: ignore[override]
yield from self.glob(patterns, flags=flags | _EXTMATCHBASE, limit=limit, exclude=exclude)


if util.PY313:
class PurePosixPath(pathlib.PurePosixPath, PurePath):
"""Pure Posix path."""
class PurePosixPath(PurePath, pathlib.PurePosixPath):
"""Pure Posix path."""

__slots__ = ()

class PureWindowsPath(pathlib.PureWindowsPath, PurePath):
"""Pure Windows path."""

__slots__ = ()
else:
class PurePosixPath(PurePath): # type: ignore[no-redef]
"""Pure Posix path."""
__slots__ = ()

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

class PureWindowsPath(PurePath): # type: ignore[no-redef]
"""Pure Windows path."""
class PureWindowsPath(PurePath, pathlib.PureWindowsPath):
"""Pure Windows path."""

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


class PosixPath(Path, PurePosixPath):
Expand Down

0 comments on commit 24bf989

Please sign in to comment.