3 Commits

Author SHA1 Message Date
c9d6265b9c first comm 2024-10-02 12:52:51 +08:00
95667b454e first comm 2024-10-02 12:51:11 +08:00
cd548f595e first comm 2024-10-02 12:47:32 +08:00
3 changed files with 30 additions and 6 deletions

21
.github/workflows/pypi-publish.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Publish
on:
push:
tags:
- '*'
jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pdm-project/setup-pdm@v3
- name: Publish package distributions to PyPI
run: pdm publish

View File

@@ -1,6 +1,6 @@
[project]
name = "server-status-cv-py"
version = "0.1.0"
name = "server-status"
dynamic = ["version"]
description = "Server status client"
authors = [
{name = "snowykami", email = "snowykami@outlook.com"},
@@ -21,3 +21,8 @@ build-backend = "pdm.backend"
[tool.pdm]
distribution = true
[tool.pdm.version]
source = "scm"
tag_filter = "v*"
tag_regex = '^v(?:\D*)?(?P<version>([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|c|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$)$'

View File

@@ -106,17 +106,15 @@ class Api:
"""
self.headers.update(self.format(headers))
def format(self, obj: str | tuple[str, ...] | dict[str, Any]):
def format(self, obj: str | list[str] | dict[str, Any]) -> str | list[str] | dict[str, Any]:
if isinstance(obj, str):
obj = obj.format(**self.variables)
elif isinstance(obj, dict):
for key in obj:
obj[key] = self.format(obj[key])
elif isinstance(obj, (list, tuple)):
elif isinstance(obj, list):
for i in range(len(obj)):
obj[i] = self.format(obj[i])
else:
pass
return obj