Fishyer's Python Util Library
Project description
我的Python工具库
github地址:fishyer/fish_util pypi地址:fish_util
介绍
这是我自己编写的一些Python工具库,包括:
- log_util
- decorator_util:包括trace_exception、trace_time、trace_args、trace_retry、trace_validate等装饰器
- file_util
- yaml_util
- json_util
- redis_util
- mysql_util
- mongo_util
- oss_util
- date_util
- string_util
- re_util
- collections_util
- function_util
安装
pip install fish_util
使用示例
from fish_util.src.log_util import logger
import fish_util.src.decorator_util as decorator_util
logger.debug("This is a debug message")
logger.info("This is an info message")
logger.warning("This is a warning message")
logger.error("This is an error message")
@decorator_util.trace_exception
@decorator_util.trace_time
@decorator_util.trace_args
@decorator_util.trace_retry(max_attempts=2, delay=1)
@decorator_util.trace_validate(
lambda username: len(username) > 0, lambda password: len(password) > 0
)
def login(username, password):
if username == "admin" and password == "123456":
return True
else:
return False
def main():
print(__file__)
print(login("admin", "123456"))
print(login("", "123456"))
if __name__ == "__main__":
main()
输出结果
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fish_util-1.0.37.tar.gz
(492.7 kB
view hashes)
Built Distribution
fish_util-1.0.37-py3-none-any.whl
(522.9 kB
view hashes)
Close
Hashes for fish_util-1.0.37-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd8f7a90c241c00557fa6d967c15746c2f526c0bbea027ade7c86a613080352e |
|
MD5 | d25f2c5be17fcf2044b684182c0910df |
|
BLAKE2b-256 | 4cb202065e90e04cf9fb78ccd5feec826851149de97f515fb33a64e1a7c88cf4 |