-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT: move cached_property backport to compat module
Signed-off-by: Filipe Laíns <[email protected]>
- Loading branch information
Showing
2 changed files
with
10 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# SPDX-FileCopyrightText: 2021 Quansight, LLC | ||
# SPDX-FileCopyrightText: 2021 Filipe Laíns <[email protected]> | ||
|
||
import functools | ||
import os | ||
import pathlib | ||
import sys | ||
|
@@ -25,6 +26,12 @@ | |
from typing_extensions import get_args as typing_get_args | ||
|
||
|
||
if sys.version_info >= (3, 8): | ||
from functools import cached_property | ||
else: | ||
cached_property = lambda x: property(functools.lru_cache(maxsize=None)(x)) # noqa: E731 | ||
|
||
|
||
Path = Union[str, os.PathLike] | ||
|
||
|
||
|
@@ -38,6 +45,7 @@ def is_relative_to(path: pathlib.Path, other: Union[pathlib.Path, str]) -> bool: | |
|
||
|
||
__all__ = [ | ||
'cached_property', | ||
'is_relative_to', | ||
'typing_get_args', | ||
'Collection', | ||
|