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
|
||||
.data
|
||||
__pycache__
|
||||
.mypy_cache/
|
||||
.ruff_cache/
|
||||
|
|
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"[python]": {
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": "explicit"
|
||||
},
|
||||
|
@ -8,5 +7,15 @@
|
|||
},
|
||||
"[json]": {
|
||||
"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 with aiohttp.ClientSession() as session:
|
||||
async with session.get(f'https://api.mcsrvstat.us/2/{host}:{port}') as response:
|
||||
response = await response.json()
|
||||
if response['online']:
|
||||
async with session.get(f"https://api.mcsrvstat.us/2/{host}:{port}") as response:
|
||||
response = await response.json() # noqa: PLW2901
|
||||
if response["online"]:
|
||||
return (True, response)
|
||||
return (False, response)
|
||||
|
|
|
@ -84,7 +84,7 @@ target-version = "py311"
|
|||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||
# 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"]
|
||||
|
||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||
|
|
Loading…
Add table
Reference in a new issue