aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author苏向夜 <fu050409@163.com>2024-01-26 15:05:59 +0800
committer苏向夜 <fu050409@163.com>2024-01-26 15:05:59 +0800
commit06a746a2d425fe575fb84b89ba156e3e8af5e827 (patch)
tree634325daf1d2cadfdedcf5dcde249c0cfe64595e
parent0250c8373c8ea12c6d12cf399a15c57f8690b032 (diff)
parent8dd7d3fe24acdbb7f52aa245f5f44991f3a44f46 (diff)
downloadinfini-06a746a2d425fe575fb84b89ba156e3e8af5e827.tar.gz
infini-06a746a2d425fe575fb84b89ba156e3e8af5e827.zip
:sparkles: feat(output): add new Endswith router
-rw-r--r--.github/workflows/pages.yml46
-rw-r--r--.github/workflows/python-publish.yml73
-rw-r--r--.markdownlint.jsonc13
-rw-r--r--CHANGELOG.md82
-rw-r--r--pyproject.toml4
-rw-r--r--src/infini/router.py8
6 files changed, 22 insertions, 204 deletions
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
deleted file mode 100644
index 087819ba..00000000
--- a/.github/workflows/pages.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-name: build Pages
-on:
- push:
- branches:
- - master
- - main
- paths:
- - "*.md"
- - docs/**
- - .github/workflows/pages.yml
-
-permissions:
- contents: write
-jobs:
- deploy:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-python@v5
- with:
- python-version: 3.x
- - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- - uses: actions/cache@v4
- with:
- key: mkdocs-material-${{ env.cache_id }}
- path: .cache
- restore-keys: |
- mkdocs-material-
- - run: |
- cp CHANGELOG.md docs/changelog.md
- pip install -r docs/requirements.txt
- pdm install
-
- - name: Build Documentation
- run: |
- git config --local user.email "action@github.com"
- git config --local user.name "GitHub Action"
- git fetch origin gh-pages:gh-pages
- pdm run mike deploy --update-aliases dev
- git push origin gh-pages
-
- - name: Save build cache
- uses: actions/cache/save@v4
- with:
- key: mkdocs-material-${{ hashfiles('.cache/**') }}
- path: .cache
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
index da3e01b6..3a416ac4 100644
--- a/.github/workflows/python-publish.yml
+++ b/.github/workflows/python-publish.yml
@@ -1,74 +1,27 @@
+name: Release
+
on:
push:
tags:
- - "*"
+ - "v*"
workflow_dispatch:
jobs:
- release-pypi:
- name: release-pypi
+ build:
runs-on: ubuntu-latest
permissions:
id-token: write
- contents: write
-
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v3
- - uses: actions/setup-python@v5
+ - uses: pdm-project/setup-pdm@v3
+ name: Setup PDM
with:
- python-version: "3.11"
-
- - name: Check prerelease
- id: check_version
- run: |
- if [[ "${{ github.ref }}" =~ ^refs/tags/[0-9.]+$ ]]; then
- echo "PRERELEASE=false" >> $GITHUB_OUTPUT
- else
- echo "PRERELEASE=true" >> $GITHUB_OUTPUT
- fi
-
- - name: Build Release Docs
- run: |
- cp CHANGELOG.md docs/changelog.md
- pip install -r docs/requirements.txt
- pdm install
- git config --local user.email "action@github.com"
- git config --local user.name "GitHub Action"
- git fetch origin gh-pages:gh-pages
- tag="${{ github.ref_name }}"
- DOC_VERSION=${tag%.*}
- pdm run mike deploy --update-aliases "$DOC_VERSION" latest
- git push origin gh-pages
-
- - run: |
- pdm install
- pdm publish
- shell: bash
- env:
- PDM_PUBLISH_PASSWORD: ${{ secrets.PDM_PUBLISH_PASSWORD }}
- PDM_PUBLISH_USERNAME: ${{ secrets.PDM_PUBLISH_USERNAME }}
-
- # - name: Get Changelog
- # id: get-changelog
- # run: |
- # awk '/-{3,}/{flag=1;next}/Release/{if (flag==1)exit}flag' CHANGELOG.md > .changelog.md
+ python-version: 3.9
+ cache: true
- # - name: Create Release
- # uses: actions/create-release@main
- # env:
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- # with:
- # tag_name: ${{ github.ref }}
- # release_name: v${{ github.ref }}
- # body_path: .changelog.md
- # draft: false
- # prerelease: ${{ steps.check_version.outputs.PRERELEASE }}
+ - name: Install dependencies
+ run: pdm install
- # - name: Trigger Bucket Update
- # uses: benc-uk/workflow-dispatch@v1
- # with:
- # workflow: Excavator
- # repo: frostming/scoop-frostming
- # token: ${{ secrets.G_T }}
- # ref: master
+ - run: pdm publish
+ shell: bash \ No newline at end of file
diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc
deleted file mode 100644
index d8a288a2..00000000
--- a/.markdownlint.jsonc
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- // MD013/line-length - Line length
- "MD013": false,
-
- // MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
- "MD024": {
- // Only check sibling headings
- "siblings_only": true
- },
-
- // MD033/no-inline-html - Inline HTML
- "MD033": false
-}
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 65493321..00000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,82 +0,0 @@
----
-title: 变更日志
----
-
-# Changelog
-
-## Infini
-
-### [1.0.5](https://github.com/HydroRoll-Team/infini/compare/v1.0.4...v1.0.5) `<small>`December 18,2023`</small>`
-
-**BREAKING CHANGES**
-
-* Handler: 使用 `Handler` 代替 `Rule` ([`573a6`](https://github.com/HydroRoll-Team/infini/compare/7b219aa12949...540a3ee9bb81))。
-
-**FEATURES**
-
-* Handler: 实现泛型,实现 `self.stop()` `self.skip()` 方法 ([`573a6`](https://github.com/HydroRoll-Team/infini/compare/7b219aa12949...540a3ee9bb81))。
-
-**BUG FIX**
-
-* templates: 根据最新的 `Handler` 更新模板中的子类写法 ([`477c9`](https://github.com/HydroRoll-Team/HydroRollCore/commit/477c9ccfe4451920838705ab4aba81b2b41d0c50))。
-* Event: 修订消息事件生成模式 ([`dd278`](https://github.com/HydroRoll-Team/infini/commit/dd27866fc9763af6f5b03024296dd74148d91eb3)),修复path不存在的问题 ([`5d4c7`](https://github.com/HydroRoll-Team/infini/commit/5d4c76a003a0f93ca52abe7f3997757ba66a97de))。
-
-**CHORE**
-
-* Exceptions: 重定义三个异常基类 ([`68ab4a`](https://github.com/HydroRoll-Team/HydroRollCore/commit/68ab4a7d835e7ede363d3bc9fa2731a4a335f4a0))。
-
-### [1.0.4](https://github.com/HydroRoll-Team/infini/compare/v1.0.3...v1.0.4) `<small>`October 7,2023`</small>`
-
-**FEATURES**
-
-* Docs: 美化 `style`。
-* Deps: 添加 `reportlab` 依赖,用于以后的 `pdf` 生成。
-
-### [1.0.3](https://github.com/HydroRoll-Team/infini/compare/v1.0.2...v1.0.3) `<small>`October 7,2023`</small>`
-
-**NO CHARGES**
-
-### [1.0.2](https://github.com/HydroRoll-Team/infini/compare/v1.0.1...v1.0.2) `<small>`October 7,2023`</small>`
-
-**FEATURES**
-
-* Docs: 优化 `css` 细节。
-
-### [1.0.1](https://github.com/HydroRoll-Team/infini/compare/v0.1.2...v1.0.1) `<small>`October 7,2023`</small>`
-
-**BUG FIX**
-
-* Docs: 修复 `Dev` 与 `latest` 分支的错别字。
-
-### [0.1.2](https://github.com/HydroRoll-Team/infini/compare/v0.1.1...v0.1.2) `<small>`October 7,2023`</small>`
-
-> 同步版本所做的测试。
-
-### [0.1.1](https://github.com/HydroRoll-Team/infini/compare/v0.1.0...v0.1.1) `<small>`October 7,2023`</small>`
-
-**BUG FIX**
-
-* CLI: 添加命令行参数解析。
-
-### [0.1.0-rc1](https://github.com/HydroRoll-Team/infini/compare/v0.1.0...v0.1.0-rc1) `<small>`October 7,2023`</small>`
-
-**CHORE**
-
-* README: 更新主页介绍的安装指南。
-
-### [0.1.0](https://github.com/HydroRoll-Team/infini/commits/v0.0.1..v0.1.0) `<small>`October 7,2023 `</small>`
-
-**FEATURES**
-
-* CLI: 添加两个命令行名称 `infini` 与 `HRC`。
-
-### [0.0.1](https://github.com/HydroRoll-Team/infini/commits/v0.0.1) `<small>`July 4,2023`</small>`
-
-**FEATURES**
-
-* __init__: 添加命令行参数解析。
-* Rule: 添加 Rule 基类,实现读取指定文件夹下的 python 脚本或 python 包
-
-**BREAKING CHANGE**
-
-* infini: 添加命令行Path。
diff --git a/pyproject.toml b/pyproject.toml
index 84422ed8..9ae7d7b1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -3,6 +3,10 @@ name = "infini"
version = "2.0.0-alpha.1"
description = "Infini 核心标准文本输入输出模块"
authors = [
+<<<<<<< HEAD
+=======
+ { name = "简律纯", email = "leader@hydroroll.team" },
+>>>>>>> 8dd7d3fe24acdbb7f52aa245f5f44991f3a44f46
{ name = "苏向夜", email = "fu050409@163.com" },
{ name = "简律纯", email = "i@jyunko.cn" },
]
diff --git a/src/infini/router.py b/src/infini/router.py
index a520a456..1174721e 100644
--- a/src/infini/router.py
+++ b/src/infini/router.py
@@ -1,6 +1,3 @@
-from infini.typing import overload
-
-
class Router:
sign: str
@@ -19,3 +16,8 @@ class StartswithRouter(Router):
class ContainsRouter(Router):
def match(self, input: str) -> bool:
return self.sign in input.strip()
+
+
+class Endswith(Router):
+ def match(self, input: str) -> bool:
+ return input.strip().endswith(self.sign)