Skip to content

Replace _compat.cached_property with functools.cached_property #6395

Closed
@pavoljuhas

Description

Description of the issue

cirq uses an internal version of cached_property defined here to support earlier versions of Python.

try:
from functools import cached_property # pylint: disable=unused-import
except ImportError:
from backports.cached_property import cached_property # type: ignore[no-redef]

As of #6167 we require Python 3.9 which is guaranteed to have functools.cached_property.

We can therefore replace all instances of _compat.cached_property with functools.cached_property and remove the cached_property definition from the _compat.py.

Cirq version

1.4.0 at d33b1a7

Metadata

Assignees

Labels

good first issueThis issue can be resolved by someone who is not familiar with the codebase. A good starting issue.kind/healthFor CI/testing/release process/refactoring/technical debt itemsno QC knowledge neededWant to contribute to Cirq, but don't know quantum computing? This issue is for you.triage/discussNeeds decision / discussion, bring these up during Cirq Cynque

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions