Skip to main content
izen 库
=====

> izen, 封装一些常用功能

## 功能列表

- [x] 配置文件
- [x] 加密解密
- [x] 常用装饰器
- [x] 常用辅助功能
- [x] mqtt通信
- [x] redis通信
- [x] 定期任务

### `icfg.py`

使用样例

```python
>>> import logzero
>>> from logzero import logger as log
>>> from izen.icfg import Conf, LFormatter

>>> pth_cfg = '/tmp/.code.cnf'
>>> cfg = Conf(
... pth=pth_cfg,
... dat={
... 'mg.host': '127.0.0.1',
... 'mg.port': 27027,
... 'mg.db': 'test_db',
... 'rds.host': '127.0.0.1',
... 'rds.port': 6379,
... 'rds.db': {
... 'val': 0,
... 'proto': str
... },
... }
... ).cfg

>>> if cfg.get('log.enabled', False):
... logzero.logfile(
... cfg.get('log.file_pth', '/tmp/.code.log'),
... maxBytes=cfg.get('log.file_size', 5) * 1000000,
... backupCount=cfg.get('log.file_backups', 3),
... loglevel=cfg.get('log.level', 10),
... )
...
>>> bagua = '🍺🍻♨️️😈☠'
>>> formatter = LFormatter(bagua)
>>> logzero.formatter(formatter)
>>>
>>> log.debug('hi')
🍺 D 180417 16:36:05 <stdin>:1 | hi
>>> log.info('hi')
🍻 I 180417 16:37:21 <stdin>:1 | hi
>>> log.warning('hi')
♨ W 180417 16:37:35 <stdin>:1 | hi
>>> log.error('hi')
️ E 180417 16:37:41 <stdin>:1 | hi
```

### 装饰器

i.e. `dec.catch`, 自动捕获函数内程序错误, 并保证其他函数可以正常运行

```python
>>> from izen import dec
>>>
>>>
>>> @dec.catch(True, ZeroDivisionError)
... def terr():
... print('divide by 0')
... print(1 / 0)
... print('i can not go here.')
...
>>>
>>> def t():
... terr()
... print('but i can go here.')
...
>>> t()
divide by 0
[E 180417 16:25:41 dec:457] <stdin>(1)>terr: has err(division by zero)
Traceback (most recent call last):
File "/Users/lihe/pan.weiyun/tinyc/smartwear/izen/izen/dec.py", line 452, in wrapper_
return fn(*args, **kwargs)
File "<stdin>", line 4, in terr
ZeroDivisionError: division by zero
but i can go here.
```



Metadata

Release files for izen 0.1.20181101

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

Source distribution (sdist)

Source distribution for izen 0.1.20181101
File Size Uploaded Provenance Actions
izen-0.1.20181101.tar.gz 39.1 kB Without provenance Details for izen-0.1.20181101.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for izen 0.1.20181101
File Interpreter ABI Platform Actions
izen-0.1.20181101-py3-none-any.whl Python 3 none any Details for izen-0.1.20181101-py3-none-any.whl

Total release size: 81.1 kB

Release files / izen-0.1.20181101.tar.gz

Download URL izen-0.1.20181101.tar.gz
Size 39.1 kB
Tags Source
SHA-256 checksum
How to use checksums
585ed11b6bd97071bb0a4a0942db036746191d7d5d7c6fd6946f0d13e752e1a6
BLAKE2b-256 checksum
How to use checksums
ae67dbb3485bc37860c9f9adfcc1ae9bfc60c769951b21f2dc544cb269858a4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release files / izen-0.1.20181101-py3-none-any.whl

Download URL izen-0.1.20181101-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e726a199805025e09578bc6f590e7f137d8365da290d0e7be8d510602c5f80d5
BLAKE2b-256 checksum
How to use checksums
f066a09f88cb924c52ebbd65df6eb9dce381267b9b2845f2e3f1debfdbbc73d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Security for izen 0.1.20181101

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