Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Nov 8, 2023
1 parent b22d8e7 commit f1a140d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions rfpye/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,17 @@ def getattrs(obj: Any, attrs: Iterable = None, as_tuple=False) -> L:
def cached(f):
version_list = platform.python_version().split(".")
major_version = int(version_list[0])
minor_version = int(version_list[1])

if major_version < 3:
raise NotImplementedError(
"There is no cache attribute implemented for python < 3"
)
minor_version = int(version_list[1])

if minor_version >= 8:
return functools.cached_property(f)
elif minor_version >= 2:
return property(functools.lru_cache()(f))
else:
if minor_version >= 8:
return functools.cached_property(f)
elif minor_version >= 2:
return property(functools.lru_cache()(f))
else:
raise NotImplementedError(
"There is no cache attribute implemented for python < 3.2"
)
raise NotImplementedError(
"There is no cache attribute implemented for python < 3.2"
)

0 comments on commit f1a140d

Please sign in to comment.