Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace _compat.cached_property with functools.cached_property #6395

Closed
pavoljuhas opened this issue Jan 6, 2024 · 1 comment
Closed

Replace _compat.cached_property with functools.cached_property #6395

pavoljuhas opened this issue Jan 6, 2024 · 1 comment
Assignees
Labels
good first issue This issue can be resolved by someone who is not familiar with the codebase. A good starting issue. kind/health For CI/testing/release process/refactoring/technical debt items no QC knowledge needed Want to contribute to Cirq, but don't know quantum computing? This issue is for you. triage/discuss Needs decision / discussion, bring these up during Cirq Cynque

Comments

@pavoljuhas
Copy link
Collaborator

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

@pavoljuhas pavoljuhas added kind/health For CI/testing/release process/refactoring/technical debt items triage/discuss Needs decision / discussion, bring these up during Cirq Cynque no QC knowledge needed Want to contribute to Cirq, but don't know quantum computing? This issue is for you. good first issue This issue can be resolved by someone who is not familiar with the codebase. A good starting issue. labels Jan 6, 2024
@Josha91
Copy link
Contributor

Josha91 commented Jan 6, 2024

I opened a PR for this: #6398.

I closed the first one because it was committed with the wrong e-mail address (and making a dummy commit with the right e-mail still failed the CLA, so I figured opening a new PR was simpler).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue can be resolved by someone who is not familiar with the codebase. A good starting issue. kind/health For CI/testing/release process/refactoring/technical debt items no QC knowledge needed Want to contribute to Cirq, but don't know quantum computing? This issue is for you. triage/discuss Needs decision / discussion, bring these up during Cirq Cynque
Projects
None yet
Development

No branches or pull requests

2 participants