Skip to content

Commit

Permalink
Merge pull request #221 from Starry-OvO/develop
Browse files Browse the repository at this point in the history
Update 4.4.8
  • Loading branch information
lumina37 authored Aug 11, 2024
2 parents 1482098 + 5824f84 commit 1018eb9
Show file tree
Hide file tree
Showing 39 changed files with 87 additions and 159 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ColumnLimit: 120
Language: Cpp
AccessModifierOffset: -4
PointerAlignment: Left
IndentPPDirectives: AfterHash
RequiresExpressionIndentation: OuterScope
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

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

steps:
- name: Checkout develop
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
os: ["ubuntu-latest", "windows-latest", "macos-latest", "macos-13"]

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.19.2
uses: pypa/cibuildwheel@v2.20.0

- uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.venv/
.vscode/
.*/
!.github/
*_cache/
*.py[cd]
__pycache__

log/
dist/
build/
*build*/

.python-version
*.lock
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)

if (NOT SKBUILD_PROJECT_NAME)
set(SKBUILD_PROJECT_NAME "aiotieba")
endif ()

project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})

find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
Expand Down
3 changes: 2 additions & 1 deletion aiotieba/api/_classdef/container.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Generic, Iterator, SupportsIndex, TypeVar, overload
from collections.abc import Iterator
from typing import Generic, SupportsIndex, TypeVar, overload

TypeContainer = TypeVar('TypeContainer')

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_ats/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...enums import PrivLike, PrivReply
from ...exception import TbErrorExt
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_bawu_perm/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...enums import BawuPermType
from ...exception import TbErrorExt
Expand Down
4 changes: 2 additions & 2 deletions aiotieba/api/get_bawu_postlogs/_classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import bs4

from ...exception import TbErrorExt
from ...helper import default_datetime, removeprefix
from ...helper import default_datetime
from .._classdef import Containers
from .._classdef.contents import _IMAGEHASH_EXP

Expand Down Expand Up @@ -101,7 +101,7 @@ def from_tbdata(data_tag: bs4.element.Tag) -> Postlog:
pid = 0
text = f"{title}\n{text}"
else:
title = removeprefix(title, '回复:')
title = title.removeprefix('回复:')

if media_list_item := text_item.next_sibling:
medias = [Media_postlog.from_tbdata(tag) for tag in media_list_item.find_all('a')]
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_blacklist/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...enums import BlacklistType
from ...exception import TbErrorExt
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_blocks/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

import bs4

Expand Down
3 changes: 1 addition & 2 deletions aiotieba/api/get_comments/_classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from ...enums import Gender, PrivLike, PrivReply
from ...exception import TbErrorExt
from ...helper import removeprefix
from .._classdef import Containers, TypeMessage
from .._classdef.contents import (
_IMAGEHASH_EXP,
Expand Down Expand Up @@ -277,7 +276,7 @@ def from_tbdata(data_proto: TypeMessage) -> None:
contents.texts = contents.texts[2:]
if contents.texts:
first_text_frag = contents.texts[0]
first_text_frag.text = removeprefix(first_text_frag.text, ' :')
first_text_frag.text = first_text_frag.text.removeprefix(' :')

pid = data_proto.id
user = UserInfo_c.from_tbdata(data_proto.author)
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_fans/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_follow_forums/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_follows/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_forum/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_god_threads/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
3 changes: 1 addition & 2 deletions aiotieba/api/get_posts/_classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from ...enums import Gender, PrivLike, PrivReply
from ...exception import TbErrorExt
from ...helper import removeprefix
from .._classdef import Containers, TypeMessage, VirtualImage, VoteInfo
from .._classdef.contents import (
_IMAGEHASH_EXP,
Expand Down Expand Up @@ -471,7 +470,7 @@ def from_tbdata(data_proto: TypeMessage) -> Comment_p:
contents.texts = contents.texts[2:]
if contents.texts:
first_text_frag = contents.texts[0]
first_text_frag.text = removeprefix(first_text_frag.text, ' :')
first_text_frag.text = first_text_frag.text.removeprefix(' :')

contents = contents

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_rank_users/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

import bs4

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_recom_status/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_recovers/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_self_follow_forums/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_selfinfo_initNickname/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping


@dcs.dataclass
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_selfinfo_moindex/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...enums import Gender

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_statistics/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Sequence
from collections.abc import Sequence


@dcs.dataclass
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_uinfo_getUserInfo_web/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...exception import TbErrorExt

Expand Down
5 changes: 2 additions & 3 deletions aiotieba/api/get_uinfo_panel/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from __future__ import annotations

import dataclasses as dcs
from collections.abc import Mapping
from functools import cached_property
from typing import Mapping

from ...enums import Gender
from ...exception import TbErrorExt
from ...helper import removesuffix


def _tbnum2int(tb_num: str) -> int:
if isinstance(tb_num, str):
return int(float(removesuffix(tb_num, '万')) * 1e4)
return int(float(tb_num.removesuffix('万')) * 1e4)
else:
return tb_num

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_uinfo_user_json/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt

Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/get_unblock_appeals/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/login/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping


@dcs.dataclass
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/api/search_exact/_classdef.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import dataclasses as dcs
from typing import Mapping
from collections.abc import Mapping

from ...exception import TbErrorExt
from .._classdef import Containers
Expand Down
2 changes: 1 addition & 1 deletion aiotieba/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MAIN_VERSION = "12.66.1.0"
MAIN_VERSION = "12.66.1.1"
POST_VERSION = "12.35.1.0"

APP_SECURE_SCHEME = "https"
Expand Down
9 changes: 5 additions & 4 deletions aiotieba/core/account.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

import random

from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

from ..helper import randbytes_nosec
from ..helper.crypto import c3_aid, cuid_galaxy2


Expand Down Expand Up @@ -180,7 +181,7 @@ def android_id(self) -> str:
"""

if self._android_id is None:
self._android_id = randbytes_nosec(8).hex()
self._android_id = random.randbytes(8).hex()
return self._android_id

@android_id.setter
Expand Down Expand Up @@ -380,7 +381,7 @@ def aes_ecb_sec_key(self) -> bytes:
"""

if self._aes_ecb_sec_key is None:
self._aes_ecb_sec_key = randbytes_nosec(31)
self._aes_ecb_sec_key = random.randbytes(31)
return self._aes_ecb_sec_key

@aes_ecb_sec_key.setter
Expand Down Expand Up @@ -417,7 +418,7 @@ def aes_cbc_sec_key(self) -> bytes:
"""

if self._aes_cbc_sec_key is None:
self._aes_cbc_sec_key = randbytes_nosec(16)
self._aes_cbc_sec_key = random.randbytes(16)
return self._aes_cbc_sec_key

@aes_ecb_sec_key.setter
Expand Down
Loading

0 comments on commit 1018eb9

Please sign in to comment.