mirror of
https://github.com/snowykami/server-status-client.git
synced 2024-11-29 16:55:25 +08:00
✨ first comm
This commit is contained in:
parent
a7ad3035b8
commit
cd548f595e
21
.github/workflows/pypi-publish.yml
vendored
Normal file
21
.github/workflows/pypi-publish.yml
vendored
Normal 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
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "server-status-cv-py"
|
name = "server-status"
|
||||||
version = "0.1.0"
|
dynamic = ["version"]
|
||||||
description = "Server status client"
|
description = "Server status client"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "snowykami", email = "snowykami@outlook.com"},
|
{name = "snowykami", email = "snowykami@outlook.com"},
|
||||||
@ -21,3 +21,8 @@ build-backend = "pdm.backend"
|
|||||||
|
|
||||||
[tool.pdm]
|
[tool.pdm]
|
||||||
distribution = true
|
distribution = true
|
||||||
|
|
||||||
|
[tool.pdm.version]
|
||||||
|
source = "scm"
|
||||||
|
tag_filter = "test/*"
|
||||||
|
tag_regex = '^test/(?:\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]*))?$)$'
|
@ -106,17 +106,15 @@ class Api:
|
|||||||
"""
|
"""
|
||||||
self.headers.update(self.format(headers))
|
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):
|
if isinstance(obj, str):
|
||||||
obj = obj.format(**self.variables)
|
obj = obj.format(**self.variables)
|
||||||
elif isinstance(obj, dict):
|
elif isinstance(obj, dict):
|
||||||
for key in obj:
|
for key in obj:
|
||||||
obj[key] = self.format(obj[key])
|
obj[key] = self.format(obj[key])
|
||||||
elif isinstance(obj, (list, tuple)):
|
elif isinstance(obj, list):
|
||||||
for i in range(len(obj)):
|
for i in range(len(obj)):
|
||||||
obj[i] = self.format(obj[i])
|
obj[i] = self.format(obj[i])
|
||||||
else:
|
|
||||||
pass
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user