add SLF lint

This commit is contained in:
Jörg Thalheim
2024-09-02 16:22:10 +02:00
parent f2460ecd7f
commit e1e39e9ae9
8 changed files with 19 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ def get_context() -> http.client.ssl.SSLContext:
# certfile="/home/kenji/.config/sunshine/credentials/cacert.pem",
# keyfile="/home/kenji/.config/sunshine/credentials/cakey.pem",
# )
return http.client.ssl._create_unverified_context()
return http.client.ssl._create_unverified_context() # noqa: SLF001
def pair(pin: str) -> str:
@@ -42,7 +42,9 @@ def pair(pin: str) -> str:
def restart() -> None:
# Define the connection
conn = http.client.HTTPSConnection(
"localhost", 47990, context=http.client.ssl._create_unverified_context()
"localhost",
47990,
context=http.client.ssl._create_unverified_context(), # noqa: SLF001
)
user_and_pass = base64.b64encode(b"sunshine:sunshine").decode("ascii")
headers = {

View File

@@ -19,16 +19,13 @@ class Config:
cls._instance = super().__new__(cls)
cls._instance.config = configparser.ConfigParser()
config = config_location or cls._instance.default_sunshine_config_file()
cls._instance._config_location = config
cls._instance.config_location = config
with open(config) as f:
config_string = f"[{PSEUDO_SECTION}]\n" + f.read()
print(config_string)
cls._instance.config.read_string(config_string)
return cls._instance
def config_location(self) -> str:
return self._config_location
def default_sunshine_config_dir(self) -> str:
return os.path.join(os.path.expanduser("~"), ".config", "sunshine")