Skip to content

Commit

Permalink
Merge pull request #84 from Starry-OvO/develop
Browse files Browse the repository at this point in the history
Update 3.0.0
  • Loading branch information
lumina37 authored Jan 16, 2023
2 parents 4fba4b5 + a1e5f72 commit 1a93a0d
Show file tree
Hide file tree
Showing 52 changed files with 783 additions and 4,660 deletions.
53 changes: 26 additions & 27 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,51 @@ name: CI

on:
schedule:
- cron: '42 6 * * *'
- cron: "42 6 * * *"
push:
branches: [ develop ]
branches: [develop]
paths:
- "aiotieba/**"
- "tests/**"
- ".github/workflows/CI*"
pull_request:
branches: [ develop ]
branches: [develop]
paths:
- "aiotieba/**"
- "tests/**"
- ".github/workflows/CI*"

jobs:
test:

name: Test
runs-on: ubuntu-latest

environment: develop

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.8", "3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: develop

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "tests/requirements.txt"

- name: Install dependencies
run: |
python -m pip install -U pip
pip install -r tests/requirements.txt
- name: Prepare config
run: gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.PASSPHRASE }} --output aiotieba.toml tests/aiotieba.toml.gpg

- name: Run tests
run: pytest tests
- name: Checkout
uses: actions/checkout@v3
with:
ref: develop

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "tests/requirements.txt"

- name: Install dependencies
run: |
python -m pip install -U pip
pip install -r tests/requirements.txt
- name: Prepare config
run: gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.PASSPHRASE }} --output aiotieba.toml tests/aiotieba.toml.gpg

- name: Run tests
run: pytest tests
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,3 @@ asyncio.run(main())

+ [另一个仍在活跃更新的贴吧管理器(有用户界面)](https://github.com/dog194/TiebaManager)
+ [贴吧protobuf定义文件合集](https://github.com/n0099/tbclient.protobuf)

## 客户名单

<details><summary>2023.01.13更新</summary>

| 吧名 | 关注用户数 | 最近29天日均访问量 | 日均主题帖数 | 日均回复数 |
| :------------: | :--------: | :----------------: | :----------: | :--------: |
| 抗压背锅 | 4,552,065 | 812,535 | 1,462 | 69,771 |
| 孙笑川 | 3,177,257 | 680,498 | 6,161 | 204,330 |
| lol半价 | 2,004,105 | 108,075 | 1,929 | 45,324 |
| 宫漫 | 1,483,281 | 42,341 | 152 | 2,335 |
| 逆水寒ol | 764,905 | 40,229 | 159 | 2,923 |
| 新孙笑川 | 540,857 | 43,600 | 300 | 15,474 |
| vtuber | 221,070 | 11,236 | 60 | 912 |
| asoul | 155,748 | 9,865 | 53 | 323 |
| 嘉然 | 59,506 | 11,010 | 79 | 1,110 |
| 向晚 | 30,771 | 6,374 | 43 | 555 |
| 贝拉 | 21,797 | 7,341 | 33 | 533 |
| 乃琳 | 17,347 | 3,442 | 18 | 231 |
| vtuber自由讨论 | 17,228 | 4,487 | 1 | 30 |

</details>
4 changes: 1 addition & 3 deletions aiotieba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import os

from . import _logging as LOG
from .__version__ import __version__
from ._logging import get_logger as LOG
from .client import Client
from .client._classdef.enums import ReqUInfo
from .client._classdef.user import UserInfo
Expand All @@ -33,8 +33,6 @@
TypeFragTiebaPlus,
UserInfo_home,
)
from .database import MySQLDB, SQLiteDB
from .reviewer import BaseReviewer, Ops, Punish, Reviewer

if os.name == 'posix':
import signal
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.10.3"
__version__ = "3.0.0"
92 changes: 7 additions & 85 deletions aiotieba/_logging.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
日志记录
提供与标准库logging签名一致的六个函数debug/info/warning/error/critical/log
允许使用set_logger更换日志记录器
允许使用set_formatter更换日志记录器
"""
Expand Down Expand Up @@ -66,6 +65,13 @@ def __init__(


def get_logger() -> TiebaLogger:
"""
获取日志记录器
Returns:
TiebaLogger
"""

global _LOGGER

if _LOGGER is None:
Expand Down Expand Up @@ -100,87 +106,3 @@ def set_formatter(formatter: logging.Formatter) -> None:
if _LOGGER is not None:
for hd in _LOGGER.handlers:
hd.setFormatter(formatter)


def debug(msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'DEBUG'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
"""

logger = get_logger()
logger.debug(msg, *args, **kwargs)


def info(msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'INFO'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
"""

logger = get_logger()
logger.info(msg, *args, **kwargs)


def warning(msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'WARNING'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
"""

logger = get_logger()
logger.warning(msg, *args, **kwargs)


def error(msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'ERROR'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.error("Houston, we have a %s", "major problem", exc_info=1)
"""

logger = get_logger()
logger.error(msg, *args, **kwargs)


def critical(msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'CRITICAL'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
"""

logger = get_logger()
logger.critical(msg, *args, **kwargs)


def log(level, msg, *args, **kwargs):
"""
Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
"""

logger = get_logger()
logger.log(level, msg, *args, **kwargs)
Loading

0 comments on commit 1a93a0d

Please sign in to comment.