Skip to main content

Protected classes.

Project description

Overview

Use the class Protected as a parent.

Installation

To install protectedclasses, you can use pip. Open your terminal and run:

pip install protectedclasses

Implementation

class Protected:
    def __setattr__(self, name, value):
        cls = type(self)
        if name.startswith("_"):
            super().__setattr__(name, value)
            return
        if isinstance(getattr(cls, name, None), property):
            super().__setattr__(name, value)
            return
        e = "%r object has no property %r"
        e %= (cls.__name__, name)
        raise AttributeError(e)

License

This project is licensed under the MIT License.

Credits

Thank you for using protectedclasses!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protectedclasses-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

protectedclasses-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file protectedclasses-1.0.0.tar.gz.

File metadata

  • Download URL: protectedclasses-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for protectedclasses-1.0.0.tar.gz
Algorithm Hash digest
SHA256 092288b1f5c394f6395e03117eefdd6a557ffeeb20e8578c39151460a32eaf58
MD5 17d33b03523aa493e352c58826f24b50
BLAKE2b-256 e12d333aabb60467f7adab852c9cc9273a7c7f472dca299541cb867d178c049e

See more details on using hashes here.

File details

Details for the file protectedclasses-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for protectedclasses-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c66a780a41a8a21c38c899197ff31136d7ba65e7fbe862677e49e493d7dd48f6
MD5 fb1e9c25f5ffba50ae30bf37c7e301b7
BLAKE2b-256 35ba88275ee5e84776b92a8cf24de1e41e5707e6ed30c0c8da1a6f8166007d3d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page