Skip to content

Commit 385e684

Browse files
committed
Address review feedback
1 parent 95ec78d commit 385e684

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/pathlib/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import os
1212
import posixpath
1313
import sys
14-
import warnings
1514
from errno import *
1615
from glob import _StringGlobber, _no_recurse_symlinks
1716
from itertools import chain
@@ -522,19 +521,21 @@ def is_absolute(self):
522521
def is_reserved(self):
523522
"""Return True if the path contains one of the special names reserved
524523
by the system, if any."""
524+
import warnings
525525
msg = ("pathlib.PurePath.is_reserved() is deprecated and scheduled "
526526
"for removal in Python 3.15. Use os.path.isreserved() to "
527527
"detect reserved paths on Windows.")
528-
warnings.warn(msg, DeprecationWarning, stacklevel=2)
528+
warnings._deprecated("pathlib.PurePath.is_reserved", msg, remove=(3, 15))
529529
if self.parser is ntpath:
530530
return self.parser.isreserved(self)
531531
return False
532532

533533
def as_uri(self):
534534
"""Return the path as a URI."""
535+
import warnings
535536
msg = ("pathlib.PurePath.as_uri() is deprecated and scheduled "
536537
"for removal in Python 3.19. Use pathlib.Path.as_uri().")
537-
warnings.warn(msg, DeprecationWarning, stacklevel=2)
538+
warnings._deprecated("pathlib.PurePath.as_uri", msg, remove=(3, 19))
538539
if not self.is_absolute():
539540
raise ValueError("relative path can't be expressed as a file URI")
540541

0 commit comments

Comments
 (0)