Context manager that will skip the body on a condition.
Project description
Context manager that will skip the body on a condition.
All code is in conditional_context/__init__.py
from conditional_context import condition
print('start')
value = True
with condition(False):
value = False
print('here') # Will not print
print('end')
assert value
import conditional_context
class MyContext(conditional_context.ConditionalContext):
def should_skip(self):
return True
print('start')
value = True
with MyContext():
value = False
print('here') # Will not print
print('end')
assert value
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
Built Distribution
File details
Details for the file conditional_context-1.0.1.tar.gz
.
File metadata
- Download URL: conditional_context-1.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
4a1ceab6802206e877ad4dbeb62cabfce07674cb6d9f423b7189c3302b25b02a
|
|
MD5 |
066c0ccc850d04f28575bdb13ed4e5a8
|
|
BLAKE2b-256 |
5ce268c9d1d58b7df7acd39518bdb3c3d57767d5b36b1e49d342db437a87c0fa
|
File details
Details for the file conditional_context-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: conditional_context-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b7b9ead3694c07c0940e4197c2ab408c67857603b245fa0a02370810295a9a96
|
|
MD5 |
501f32b439cf22b5d9fa9dc70a0b5fdd
|
|
BLAKE2b-256 |
21f472442bf4ad20287a3157d48196a64206fe1ce50cb9546727600c088457b1
|