Skip to content

Commit

Permalink
chore: auto update by pre-commit hooks (#208)
Browse files Browse the repository at this point in the history
* chore: auto update by pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.5](astral-sh/ruff-pre-commit@v0.2.2...v0.3.5)

* style: auto fix by pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Apr 2, 2024
1 parent c2d12af commit dbcc7ad
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:
autoupdate_commit_msg: "chore: auto update by pre-commit hooks"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.5
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
6 changes: 2 additions & 4 deletions nonebot_plugin_datastore/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
from pydantic import root_validator

@overload
def model_validator(*, mode: Literal["before"]):
...
def model_validator(*, mode: Literal["before"]): ...

@overload
def model_validator(*, mode: Literal["after"]):
...
def model_validator(*, mode: Literal["after"]): ...

def model_validator(*, mode: Literal["before", "after"]):
return root_validator(pre=mode == "before", allow_reuse=True)
9 changes: 5 additions & 4 deletions nonebot_plugin_datastore/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" 配置 """
"""配置"""

from pathlib import Path
from typing import Any

Expand Down Expand Up @@ -46,9 +47,9 @@ def set_defaults(cls, values: dict):

# 设置默认数据库连接字符串
if not values.get("datastore_database_url"):
values[
"datastore_database_url"
] = f"sqlite+aiosqlite:///{values['datastore_data_dir'] / 'data.db'}"
values["datastore_database_url"] = (
f"sqlite+aiosqlite:///{values['datastore_data_dir'] / 'data.db'}"
)

return values

Expand Down
3 changes: 2 additions & 1 deletion nonebot_plugin_datastore/db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" 数据库 """
"""数据库"""

from collections.abc import AsyncGenerator
from pathlib import Path
from typing import TYPE_CHECKING, Callable
Expand Down
1 change: 1 addition & 0 deletions nonebot_plugin_datastore/migrations/0f8d23241fd7_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-03-01 14:18:54.876322
"""

import sqlalchemy as sa
from alembic import op

Expand Down
3 changes: 2 additions & 1 deletion nonebot_plugin_datastore/plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" 插件数据 """
"""插件数据"""

import json
import pickle
from pathlib import Path
Expand Down
6 changes: 2 additions & 4 deletions nonebot_plugin_datastore/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ async def _set(self, key: str, value: Any) -> None:
raise NotImplementedError

@overload
async def get(self, __key: str) -> Union[Any, None]:
...
async def get(self, __key: str) -> Union[Any, None]: ...

@overload
async def get(self, __key: str, __default: T) -> T:
...
async def get(self, __key: str, __default: T) -> T: ...

async def get(self, key, default=None):
"""获得配置
Expand Down
3 changes: 2 additions & 1 deletion nonebot_plugin_datastore/script/command.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
""" 直接将 Alembic 的代码抄过来,然后改成异步
"""直接将 Alembic 的代码抄过来,然后改成异步
version: 1.9.2
"""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions tests/example/plugin1/migrations/bef062d23d1f_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-01-14 18:03:01.886658
"""

import sqlalchemy as sa
from alembic import op

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-01-14 18:03:01.886658
"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions tests/registry/plugin1/migrations/ff18b81ee1ca_init_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-02-26 16:29:31.412836
"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions tests/registry/plugin2/migrations/a1219e33400e_init_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-02-26 16:29:31.475062
"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions tests/registry/plugin3/migrations/548b56a0ceca_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-07-26 14:02:29.829043
"""

import sqlalchemy as sa
from alembic import op

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-07-26 16:29:04.779418
"""

import sqlalchemy as sa
from alembic import op

Expand Down

0 comments on commit dbcc7ad

Please sign in to comment.