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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fish_util-1.0.37-py3-none-any.whl
(522.9 kB
view details)
File details
Details for the file fish_util-1.0.37.tar.gz.
File metadata
- Download URL: fish_util-1.0.37.tar.gz
- Upload date:
- Size: 492.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
664d3382dd512cab6df38313e5a13f3b5f12b62e5704229e85b39394aa32b663
|
|
| MD5 |
57fe67d2b8eeef17a9a292c876b9ac1a
|
|
| BLAKE2b-256 |
0d1ba479eb31b77107318c63f5057102aa4ae6c820314d3948429cacd8009c47
|
File details
Details for the file fish_util-1.0.37-py3-none-any.whl.
File metadata
- Download URL: fish_util-1.0.37-py3-none-any.whl
- Upload date:
- Size: 522.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd8f7a90c241c00557fa6d967c15746c2f526c0bbea027ade7c86a613080352e
|
|
| MD5 |
d25f2c5be17fcf2044b684182c0910df
|
|
| BLAKE2b-256 |
4cb202065e90e04cf9fb78ccd5feec826851149de97f515fb33a64e1a7c88cf4
|