Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove flavour.has_drv.
  • Loading branch information
barneygale committed May 15, 2021
commit b4beecc71e1bb5c117e51e6022982b6c1bac56d8
14 changes: 7 additions & 7 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class _WindowsFlavour(_Flavour):
# Reference for Windows paths can be found at
# http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx

has_drv = True

def casefold(self, s):
return s.lower()

Expand All @@ -65,8 +63,6 @@ def casefold_parts(self, parts):


class _PosixFlavour(_Flavour):
has_drv = False

def casefold(self, s):
return s

Expand Down Expand Up @@ -737,9 +733,7 @@ def parents(self):
def is_absolute(self):
"""True if the path is absolute (has both a root and, if applicable,
a drive)."""
if not self._root:
return False
return not self._flavour.has_drv or bool(self._drv)
raise NotImplementedError

def is_reserved(self):
"""Return True if the path contains one of the special names reserved
Expand Down Expand Up @@ -805,6 +799,9 @@ def _splitroot(cls, part):
else:
return '', '', part

def is_absolute(self):
return bool(self._root)

def is_reserved(self):
return False

Expand Down Expand Up @@ -894,6 +891,9 @@ def _split_extended_path(cls, s, ext_prefix=_ext_namespace_prefix):
s = '\\' + s[3:]
return prefix, s

def is_absolute(self):
return bool(self._root) and bool(self._drv)

def is_reserved(self):
# NOTE: the rules for reserved names seem somewhat complicated
# (e.g. r"..\NUL" is reserved but not r"foo\NUL").
Expand Down