Skip to content

Commit

Permalink
Use stdlib functools.cached_property if available
Browse files Browse the repository at this point in the history
Python 3.8+ provides a functools.cached_property in the stdlib that is
thread-safe, i.e. equivalent to threaded_cached_property.  Use it
instead of adding third-party dependencies whenever available.
  • Loading branch information
mgorny authored and mvantellingen committed Nov 11, 2021
1 parent 4e16b77 commit 25701f0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

install_requires = [
"attrs>=17.2.0",
"cached-property>=1.3.0",
"cached-property>=1.3.0; python_version<'3.8'",
"isodate>=0.5.4",
"lxml>=4.6.0",
"platformdirs>=1.4.0",
Expand Down
6 changes: 5 additions & 1 deletion src/zeep/wsdl/attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

import base64

from cached_property import cached_property
try:
from functools import cached_property
except ImportError:
from cached_property import cached_property

from requests.structures import CaseInsensitiveDict


Expand Down
6 changes: 5 additions & 1 deletion src/zeep/xsd/elements/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
import typing
from collections import OrderedDict, defaultdict, deque

from cached_property import threaded_cached_property
try:
from functools import cached_property as threaded_cached_property
except ImportError:
from cached_property import threaded_cached_property

from lxml import etree

from zeep.exceptions import UnexpectedElementError, ValidationError
Expand Down
6 changes: 5 additions & 1 deletion src/zeep/xsd/types/any.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import logging
import typing

from cached_property import threaded_cached_property
try:
from functools import cached_property as threaded_cached_property
except ImportError:
from cached_property import threaded_cached_property

from lxml import etree

from zeep.utils import qname_attr
Expand Down
6 changes: 5 additions & 1 deletion src/zeep/xsd/types/complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from collections import OrderedDict, deque
from itertools import chain

from cached_property import threaded_cached_property
try:
from functools import cached_property as threaded_cached_property
except ImportError:
from cached_property import threaded_cached_property

from lxml import etree

from zeep.exceptions import UnexpectedElementError, XMLParseError
Expand Down

0 comments on commit 25701f0

Please sign in to comment.