mirror of
https://github.com/kuhyx/testsAndMisc-archive.git
synced 2026-11-10 20:07:06 +01:00
fix: remove all pylint disable comments and enable all meta checks
This commit is contained in:
parent
3a477dd868
commit
134d606db0
@ -1,6 +1,6 @@
|
|||||||
"""Lichess API client for bot interactions."""
|
"""Lichess API client for bot interactions."""
|
||||||
|
|
||||||
from collections.abc import Generator # pylint: disable=import-error
|
from collections.abc import Generator
|
||||||
import contextlib
|
import contextlib
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
|
|||||||
@ -27,7 +27,7 @@ def get_and_increment_version() -> int:
|
|||||||
path = _version_file_path()
|
path = _version_file_path()
|
||||||
current = 0
|
current = 0
|
||||||
try:
|
try:
|
||||||
with Path(path).open() as f:
|
with Path(path).open(encoding="utf-8") as f:
|
||||||
raw = f.read().strip()
|
raw = f.read().strip()
|
||||||
if raw:
|
if raw:
|
||||||
current = int(raw)
|
current = int(raw)
|
||||||
@ -38,13 +38,13 @@ def get_and_increment_version() -> int:
|
|||||||
new_version = current + 1
|
new_version = current + 1
|
||||||
try:
|
try:
|
||||||
tmp_path = Path(path + ".tmp")
|
tmp_path = Path(path + ".tmp")
|
||||||
with tmp_path.open("w") as f:
|
with tmp_path.open("w", encoding="utf-8") as f:
|
||||||
f.write(str(new_version))
|
f.write(str(new_version))
|
||||||
tmp_path.replace(path)
|
tmp_path.replace(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
# As a fallback, try a direct write; failure is non-fatal to bot operation
|
# As a fallback, try a direct write; failure is non-fatal to bot operation
|
||||||
try:
|
try:
|
||||||
with Path(path).open("w") as f:
|
with Path(path).open("w", encoding="utf-8") as f:
|
||||||
f.write(str(new_version))
|
f.write(str(new_version))
|
||||||
except OSError:
|
except OSError:
|
||||||
_logger.debug("Could not persist bot version to %s", path)
|
_logger.debug("Could not persist bot version to %s", path)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
"""Mitmproxy addon to simulate connection failures."""
|
"""Mitmproxy addon to simulate connection failures."""
|
||||||
|
|
||||||
from mitmproxy import http # pylint: disable=import-error
|
from mitmproxy import http
|
||||||
|
|
||||||
|
|
||||||
def request(flow: http.HTTPFlow) -> None:
|
def request(flow: http.HTTPFlow) -> None:
|
||||||
|
|||||||
@ -6,14 +6,10 @@ from pathlib import Path
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# pylint: disable=import-error
|
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
# pylint: enable=import-error
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
REQUEST_TIMEOUT = 30 # seconds
|
REQUEST_TIMEOUT = 30 # seconds
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user