Skip to main content

open-close-mixin

About

Easy pluggable Mixin (and decorators) for objects that may benefit from open-close dynamics.

Installing

You can simply install it using pip as follows:

$ pip install open-close-mixin

Usage

You may import an OpenCloseMixin along some other decorators from the package root and use them further on to create your own class with open and close dynamics!

>>> from open_close_mixin import OpenCloseMixin, always

>>> class Foo(OpenCloseMixin):
>>>     # only while open, that's default behaviour
>>>     def run_when_open(self):
>>>         print("The instance is open so I was able to run")
>>> 
>>>     @always
>>>     def run_always(self):
>>>         print("I am ALWAYS able to run, whether the instance is open or not")
>>> 
>>> f = Foo()
>>> f.open()
>>> f.run_always()
I am ALWAYS able to run, whether the instance is open or not
>>> 
>>> f.run_when_open()
The instance is open so I was able to run
>>> 
>>> f.close()
>>> f.run_always()
I am ALWAYS able to run, whether the instance is open or not
>>> 
>>> f.run_when_open()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alberto/Projects/personal/open-close-mixin/open_close_mixin/decorators.py", line 27, in wrapper
    raise exception from None
ValueError: The instance is not open and the method "Foo.run_when_open" cannot run under such condition.

Metadata

Release files for open-close-mixin 1.1.3

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

Built distribution (wheel)

Table of built distributions (wheels) for open-close-mixin 1.1.3
File Interpreter ABI Platform Actions
open_close_mixin-1.1.3-py3-none-any.whl Python 3 none any Details for open_close_mixin-1.1.3-py3-none-any.whl

Release files / open_close_mixin-1.1.3-py3-none-any.whl

Download URL open_close_mixin-1.1.3-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b146ddaf5a570211a106dfdcce8bdffaf7cd29933d17ae4794cefc5c509b291
BLAKE2b-256 checksum
How to use checksums
f9c06db32859705f5abde1dff02bbb9177c3a6df3b0110533d0f8757492f1816
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Security for open-close-mixin 1.1.3

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.

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