Skip to main content

weakProperty

just a property, but it automatically got weakref

source code :

def weakProperty(func):
    attr_name = f"_weak_{func.__name__}"
    @property
    def wrapper(self):
        ref = getattr(self, attr_name, None)
        return None if ref is None else ref()

    @wrapper.setter
    def wrapper(self, value):
        if value is None:
            setattr(self, attr_name, None)
        else:
            setattr(self, attr_name, weakref.ref(value))

    @wrapper.deleter
    def wrapper(self):
        setattr(self, attr_name, None)

    return wrapper

usage

same as @property

Metadata

Release files for weakProperty 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weakProperty 0.1.0
File Size Uploaded Provenance Actions
weakproperty-0.1.0.tar.gz 2.3 kB Without provenance Details for weakproperty-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for weakProperty 0.1.0
File Interpreter ABI Platform Actions
weakproperty-0.1.0-py3-none-any.whl Python 3 none any Details for weakproperty-0.1.0-py3-none-any.whl

Total release size: 5.1 kB

Release files / weakproperty-0.1.0.tar.gz

Download URL weakproperty-0.1.0.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
34e3c186d0e2e8aa9e881a7404b82cc99583891e2673049a099dbce9b66a7b03
BLAKE2b-256 checksum
How to use checksums
fc2c769904d23b8c732e2ac2229c10baa431f7ba17ab2b41d213919dbd9cff81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / weakproperty-0.1.0-py3-none-any.whl

Download URL weakproperty-0.1.0-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
926b5e8232d18b926275606dcc178d2db6d3fc21389cf7cb854ad518ff25b3c0
BLAKE2b-256 checksum
How to use checksums
f2dce825ffe16f67b0982ade51b260a21b904eeedc54198610eaf7c18f471cbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Security for weakProperty 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page