Compare commits
5 commits
3d882625d2
...
d5a248733a
Author | SHA1 | Date | |
---|---|---|---|
d5a248733a | |||
5decc51a36 | |||
41678ef3ed | |||
0492b30662 | |||
3063721b8d |
5 changed files with 388 additions and 376 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,3 +3,5 @@ site
|
||||||
.venv
|
.venv
|
||||||
.data
|
.data
|
||||||
__pycache__
|
__pycache__
|
||||||
|
.mypy_cache/
|
||||||
|
.ruff_cache/
|
||||||
|
|
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": "explicit"
|
"source.fixAll": "explicit"
|
||||||
},
|
},
|
||||||
|
@ -8,5 +7,15 @@
|
||||||
},
|
},
|
||||||
"[json]": {
|
"[json]": {
|
||||||
"editor.defaultFormatter": "vscode.json-language-features"
|
"editor.defaultFormatter": "vscode.json-language-features"
|
||||||
|
},
|
||||||
|
"[jsonc]": {
|
||||||
|
"editor.defaultFormatter": "vscode.json-language-features"
|
||||||
|
},
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.git": true,
|
||||||
|
"**/__pycache__": true,
|
||||||
|
"**/.ruff_cache": true,
|
||||||
|
"**/.mypy_cache": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ import aiohttp
|
||||||
|
|
||||||
async def get_status(host: str, port: int = 25565) -> tuple[bool, dict]:
|
async def get_status(host: str, port: int = 25565) -> tuple[bool, dict]:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(f'https://api.mcsrvstat.us/2/{host}:{port}') as response:
|
async with session.get(f"https://api.mcsrvstat.us/2/{host}:{port}") as response:
|
||||||
response = await response.json()
|
response = await response.json() # noqa: PLW2901
|
||||||
if response['online']:
|
if response["online"]:
|
||||||
return (True, response)
|
return (True, response)
|
||||||
return (False, response)
|
return (False, response)
|
||||||
|
|
|
@ -84,7 +84,7 @@ target-version = "py311"
|
||||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||||
# McCabe complexity (`C901`) by default.
|
# McCabe complexity (`C901`) by default.
|
||||||
select = ["I", "N", "F", "W", "E", "G", "INP", "T20", "PLC", "PLE", "PLW", "PLR"]
|
select = ["I", "N", "F", "W", "E", "G", "INP", "T20", "PLC", "PLE", "PLW", "PLR", "LOG"]
|
||||||
ignore = ["PLR0912", "PLR0915", "PLR2004"]
|
ignore = ["PLR0912", "PLR0915", "PLR2004"]
|
||||||
|
|
||||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||||
|
|
Loading…
Add table
Reference in a new issue