Skip to content

Commit a01ee99

Browse files
committed
Fix attribute error warning in type checking.
1 parent cdd21e3 commit a01ee99

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rubisco/lib/pathlib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import os
2424
import pathlib
2525
import sys
26+
from typing import TYPE_CHECKING
2627

2728
__all__ = ["Path"]
2829

@@ -41,7 +42,7 @@ def normpath(self) -> "Path":
4142

4243

4344
# In Python 3.11, parent's @classmethod will catch children.
44-
if sys.version_info < (3, 12):
45+
if sys.version_info < (3, 12) and not TYPE_CHECKING:
4546
# "Inject" the extended methods into the built-in pathlib.Path class.
4647
pathlib.Path.normpath = Path.normpath # type: ignore[method-required]
4748
Path = pathlib.Path # type: ignore[assignment]

0 commit comments

Comments
 (0)