Skip to content
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

Better inheritance for pathlib #216

Merged
merged 2 commits into from
May 5, 2024
Merged
Changes from all commits
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
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
Loading