Skip to content

Commit

Permalink
🔥 feat:优化limiter一些细节&删除一些废弃的内容
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalyes committed Apr 28, 2023
1 parent 404b668 commit e439f45
Show file tree
Hide file tree
Showing 170 changed files with 6,098 additions and 25,080 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "03:00"
open-pull-requests-limit: 10
assignees:
- "kamalyes"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
24 changes: 24 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Dependabot auto-merge

on:
workflow_dispatch:
pull_request:
types:
- "opened"
- "synchronize"
- "reopened"

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge -b "[no ci]" --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Lint

on:
pull_request:
types:
- "opened"
- "synchronize"
push:
branches:
- "master"

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9" ]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/[email protected]

- name: Setup cache
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-py${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
run: |
poetry install -E all
- name: Lint
run: |
poetry run pre-commit run --all-files --show-diff-on-failure
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Build distribution
run: python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.5.2
uses: pypa/gh-action-pypi-publish@v1.8.5
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Dump GitHub context
Expand Down
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: local
hooks:
- id: black
language: python
name: black
pass_filenames: false
language_version: python3.9
entry: poetry run black custard examples

# - repo: local
# hooks:
# - id: ruff
# language: python
# name: ruff
# pass_filenames: false
# language_version: python3.9
# entry: poetry run ruff --fix --exit-non-zero-on-fix --show-fixes custard examples

# - repo: local
# hooks:
# - id: mypy
# language: python
# name: mypy
# pass_filenames: false
# entry: poetry run mypy custard examples --show-error-codes
62 changes: 48 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
{
"editor.insertSpaces": true,
"files.encoding": "utf8",
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"files.eol": "\n",
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"python.terminal.executeInFileDir": true,
"terminal.integrated.env.osx": {
"PYTHONPATH": "${workspaceFolder}"
},
"editor.fontSize": 18,
"editor.links": false,
"editor.tabSize": 4,
"prettier.endOfLine": "auto",
"window.zoomLevel": 0.01, // 窗口大小,字体大小等
"files.autoSave": "off",
/* "editor.formatOnSave": true,
"editor.formatOnPaste": true, */
"editor.formatOnType": true,
"editor.suggestSelection": "first",
"editor.detectIndentation": false,
Expand All @@ -32,8 +25,17 @@
"search.followSymlinks": false, //控制是否在搜索中跟踪符号链接。
"pythonTestExplorer.testFramework": "pytest",
"pythonTestExplorer.testplanEnabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "",
"python.formatting.provider": "yapf", //使用yapf作为Python代码格式化工具。
"python.formatting.yapfArgs": [
"--style=pep8", //格式化风格,PEP 8是Python社区推荐的Python代码风格指南
"{column_limit: 100}", //每行代码的最大长度,多出的就会换行
"{indent_width: 4}", //设置缩进使用4个空格
"{align_closing_bracket_with_visual_indent:true}", //是否将闭括号与视觉缩进对齐
"{allow_split_before_dict_value:true}", //在字典值前是否允许换行
"{continuation_indent_width:4}", //续行时使用的缩进宽度
"{split_arguments_when_comma_terminated:true}", //在逗号结尾时是否换行
"{split_before_expression_after_opening_paren:true}" //在左括号后是否换行
],
"files.exclude": {
// 不需要扫描的文件夹
"**/node_modules": true,
Expand All @@ -48,9 +50,6 @@
"strings": true
},
/*以下为代码格式化配置*/
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
},
Expand Down Expand Up @@ -86,6 +85,8 @@
"git.enableSmartCommit": true,
"cSpell.words": [
"ADDSLOTS",
"AESCTR",
"aioredis",
"allready",
"alot",
"axios",
Expand All @@ -102,21 +103,30 @@
"checkpid",
"clustercfg",
"CLUSTERDOWN",
"Codecov",
"conint",
"COUNTKEYSINSLOT",
"CROSSSLOT",
"dafunc",
"DBSIZE",
"DELSLOTS",
"dicttoxml",
"evalsha",
"execres",
"EXISTS",
"fastapi",
"fdir",
"firstlineno",
"FLUSHALL",
"fromdata",
"GEODIST",
"GEOHASH",
"GEOPOS",
"GEORADIUS",
"GEORADIUSBYMEMBER",
"GET",
"GETBIT",
"getframe",
"gethostbyaddr",
"GETKEYSINSLOT",
"GETRANGE",
Expand All @@ -125,6 +135,7 @@
"HEXISTS",
"HGET",
"HGETALL",
"hitfilter",
"HKEYS",
"HLEN",
"HMGET",
Expand All @@ -138,28 +149,37 @@
"LLEN",
"lpush",
"LRANGE",
"lxml",
"MASTERDOWN",
"MGET",
"mkdocs",
"MSETNX",
"mypy",
"nativestr",
"nodemanager",
"nslookup",
"numlines",
"NUMPAT",
"numsub",
"pageindex",
"pexpire",
"pfcount",
"pfmerge",
"PHPSESSID",
"PTTL",
"punsubscribe",
"pycache",
"pydantic",
"pypa",
"PYPI",
"pypinyin",
"pypoetry",
"pyproject",
"pytest",
"Qing",
"RANDOMKEY",
"randos",
"rediscluster",
"ratelimit",
"renamenx",
"RESETSTAT",
"rpoplpush",
Expand All @@ -168,6 +188,8 @@
"SCARD",
"SDIFF",
"sdiffstore",
"sessionmaker",
"setnx",
"setslot",
"SETUSER",
"shold",
Expand All @@ -179,21 +201,33 @@
"SLOWLOG",
"SMEMBERS",
"smove",
"snok",
"sohu",
"sqlalchemy",
"SRANDMEMBER",
"starlette",
"streambody",
"STRLEN",
"SUNION",
"sunionstore",
"tonumber",
"topdown",
"TRYAGAIN",
"TTL",
"unidecode",
"unpartial",
"unwatch",
"useragent",
"uvicorn",
"virtualenvs",
"websockets",
"xform",
"xprint",
"xwww",
"ZCARD",
"ZCOUNT",
"ziplist",
"ZRANGE",
"ZSCORE"
] // 启用智能提交
],
}
Loading

0 comments on commit e439f45

Please sign in to comment.