conditional-1.4
توضیحات
Conditionally enter a context manager
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | conditional-1.4 |
| نام | conditional |
| نسخه کتابخانه | 1.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Stefan H. Holek |
| ایمیل نویسنده | stefan@epy.co.at |
| آدرس صفحه اصلی | https://github.com/stefanholek/conditional |
| آدرس اینترنتی | https://pypi.org/project/conditional/ |
| مجوز | BSD-2-Clause |
===========
conditional
===========
-------------------------------------------------------------------
Conditionally enter a context manager
-------------------------------------------------------------------
Package Contents
================
conditional(condition, contextmanager)
Enter contextmanager only if condition is true.
Overview
========
The `conditional` context manager comes handy when you always want to
execute a with-block but only conditionally want to apply its context
manager.
If you find yourself writing code like this:
.. code-block:: python
if CONDITION:
with CONTEXTMANAGER():
BODY()
else:
BODY()
Consider replacing it with:
.. code-block:: python
with conditional(CONDITION, CONTEXTMANAGER()):
BODY()
Examples
========
Say we want to ignore signals when a pager application is in the
foreground, but not otherwise:
.. code-block:: python
from conditional import conditional
with conditional(has_pager(cmd), ignoresignals()):
os.system(cmd)
Documentation
=============
For further details please refer to the `API Documentation`_.
.. _`API Documentation`: https://conditional.readthedocs.io/en/stable/
Changelog
=========
1.4 - 2022-03-09
----------------
- Add Python 3.8-3.10 to tox.ini. Remove old Python versions.
[stefan]
- Replace deprecated ``python setup.py test`` in tox.ini.
[stefan]
- Remove deprecated ``test_suite`` and ``tests_require`` from setup.py.
[stefan]
- Move metadata to setup.cfg and add a pyproject.toml file.
[stefan]
- Include tests in sdist but not in wheel.
[stefan]
1.3 - 2019-01-28
----------------
- Add MANIFEST.in.
[stefan]
- Release as wheel.
[stefan]
1.2 - 2017-02-05
----------------
- Support Python 2.6-3.6 without 2to3.
[stefan]
- Add a LICENSE file.
[stefan]
1.1 - 2014-04-19
----------------
- Remove setuptools from install_requires because it isn't.
[stefan]
1.0 - 2012-05-16
----------------
- Initial release.
[stefan]
نیازمندی
| مقدار | نام |
|---|---|
| - | sphinx |
| - | sphinx-rtd-theme |
| - | flexmock |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7 | Python |
نحوه نصب
نصب پکیج whl conditional-1.4:
pip install conditional-1.4.whl
نصب پکیج tar.gz conditional-1.4:
pip install conditional-1.4.tar.gz