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
Close
Hashes for conditional_context-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c0eaae0d5be57c8b37dd8ce25aef96bd25a9b531a575b3ad0e3d443daa1b354 |
|
MD5 | 893b683e7e960b075e824226ea78c066 |
|
BLAKE2b-256 | b41840c39903c7451618f1ca25a495f8d5a1a041567fad109f5d033ea35632d6 |
Close
Hashes for conditional_context-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44504309b581b4db95b9e14d2aee88c0d2abee18923e961250fe8ea202d5518e |
|
MD5 | ddec728da1d8b46d816f0c841da3c588 |
|
BLAKE2b-256 | e5ee35d05309ddb570ee12217d456cede797928e0fea63cfa80d3868bfe53abe |