Common tools of AI module for BNQ
Project description
打包和上传
使用以下命令来生成和上传分发包:
python setup.py sdist bdist_wheel
twine upload dist/*
类说明
1. NacConnect 类
用于连接 Nacos 服务,获取配置文件信息。
参数信息
server_addresses:地址namespace:命名空间username:用户名password:密码group:组合字典,包括group_name和data_idsconf_type:配置文件类型,非必需,值为json或yaml
示例
from bnq_py_core import NacConnect
test_data = {
'group': {'t-dev': ['project_name_1', 'project_name_2']},
'username': 'nacos',
'password': 'nacos',
'server_addresses': '127.0.0.1:8080',
'namespace': 't-dev'
}
conf_test = NacConnect(**test_data)
print(conf_test())
2. LoggingRecord 类
用于记录日志信息。
参数信息
max_bytes:日志文件最大大小,默认值 20Mbackup_count:日志备份最大数量,默认值为 10log_level:日志级别,默认值为INFOlog_dir:日志文件路径,默认在根目录下创建log文件夹
示例
import logging
from bnq_py_core import LoggingRecord
testLog = LoggingRecord(log_level=logging.DEBUG)
for i in range(10):
print(i, 'i')
print(testLog, "testLog")
testLog.debug(i)
testLog.info("中文测试")
testLog.error(i)
testLog.warning(i)
testLog.exception(i)
3. LoggingRecordTimeRotation 类
用于记录日志信息, 可根据设定时间自动轮转日志文件。
参数信息
max_bytes:日志文件最大大小,默认值 20Mbackup_count:日志备份最大数量,默认值为 10log_level:日志级别,默认值为INFOlog_dir:日志文件路径,默认在根目录下创建log文件夹
示例
import logging
from bnq_py_core import LoggingRecordTimeRotation
testLog = LoggingRecordTimeRotation(log_level=logging.DEBUG)
for i in range(10):
print(i, 'i')
print(testLog, "testLog")
testLog.debug(i)
testLog.info("中文测试")
testLog.error(i)
testLog.warning(i)
testLog.exception(i)
4. SingletonMeta 类
用于实现单例模式。
示例
from bnq_py_core import SingletonMeta
class TestClass(metaclass=SingletonMeta):
def __init__(self):
pass
5. CosConnect 类
用于连接腾讯云存储平台 COS。
参数信息
secret_id:腾讯云 secret_idsecret_key:腾讯云 secret_keyregion:腾讯云存储区域
示例
from bnq_py_core import CosConnect
test_data = {
'secret_id': 'AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'secret_key': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'region': 'ap-guangzhou'
}
cos_test = CosConnect(**test_data)
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
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
File details
Details for the file common-tools-ai-bnq-0.1.9.tar.gz.
File metadata
- Download URL: common-tools-ai-bnq-0.1.9.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9515bc43d91b91932d4897609e5623d815553edb27c255c2cb48cf772fd3e050
|
|
| MD5 |
ee1e51d635de47825d5cb22146a6a6c3
|
|
| BLAKE2b-256 |
dd4df93ab584d3f6d00e825a2593005c72ea59c1bf6f977cc0c9faad92a3a9ae
|
File details
Details for the file common_tools_ai_bnq-0.1.9-py3-none-any.whl.
File metadata
- Download URL: common_tools_ai_bnq-0.1.9-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
285f90785efa843874fe5426f05b86331e2e9c5ebf98d701e9f7b4d5e43bda72
|
|
| MD5 |
dacb57b63815d2f3fcea63cc12f88634
|
|
| BLAKE2b-256 |
efb82362e7c2d4e8f878d7fbc4a8f3a01ba02beecad2cf7f4a8b62a3716066d1
|