Skip to content

Commit b0bf8f9

Browse files
committed
Wrap cached_property import in try/except for Python 3.7.
1 parent 83dcba0 commit b0bf8f9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

numpydoc/docscrape.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@
88
from warnings import warn
99
from collections import namedtuple
1010
from collections.abc import Callable, Mapping
11-
from functools import cached_property
1211
import copy
1312
import sys
1413

1514

15+
# TODO: Remove try-except when support for Python 3.7 is dropped
16+
try:
17+
from functools import cached_property
18+
except ImportError: # cached_property added in Python 3.8
19+
cached_property = None
20+
21+
1622
def strip_blank_lines(l):
1723
"Remove leading and trailing blank lines from a list of lines"
1824
while l and not l[0].strip():

0 commit comments

Comments
 (0)