add SLF lint
This commit is contained in:
@@ -50,7 +50,7 @@ class ImplFunc(GObject.Object, Generic[P, B]):
|
||||
msg = "Method 'async_run' must be implemented"
|
||||
raise NotImplementedError(msg)
|
||||
|
||||
def _async_run(self, data: Any) -> bool:
|
||||
def internal_async_run(self, data: Any) -> bool:
|
||||
result = GLib.SOURCE_REMOVE
|
||||
try:
|
||||
result = self.async_run(**data)
|
||||
|
||||
@@ -118,7 +118,7 @@ class WebExecutor(GObject.Object):
|
||||
# from_dict really takes Anything and returns an instance of the type/class
|
||||
reconciled_arguments[k] = from_dict(arg_class, v)
|
||||
|
||||
GLib.idle_add(fn_instance._async_run, reconciled_arguments)
|
||||
GLib.idle_add(fn_instance.internal_async_run, reconciled_arguments)
|
||||
|
||||
def on_result(self, source: ImplFunc, data: GResult) -> None:
|
||||
result = dataclass_to_dict(data.result)
|
||||
|
||||
@@ -83,8 +83,8 @@ def add_common_flags(parser: argparse.ArgumentParser) -> None:
|
||||
|
||||
def register_common_flags(parser: argparse.ArgumentParser) -> None:
|
||||
has_subparsers = False
|
||||
for action in parser._actions:
|
||||
if isinstance(action, argparse._SubParsersAction):
|
||||
for action in parser._actions: # noqa: SLF001
|
||||
if isinstance(action, argparse._SubParsersAction): # noqa: SLF001
|
||||
for _choice, child_parser in action.choices.items():
|
||||
has_subparsers = True
|
||||
register_common_flags(child_parser)
|
||||
|
||||
@@ -174,12 +174,12 @@ def get_subcommands(
|
||||
positional_options: list[Option] = []
|
||||
subcommands: list[Subcommand] = []
|
||||
|
||||
for action in parser._actions:
|
||||
if isinstance(action, argparse._HelpAction):
|
||||
for action in parser._actions: # noqa: SLF001
|
||||
if isinstance(action, argparse._HelpAction): # noqa: SLF001
|
||||
# Pseudoaction that holds the help message
|
||||
continue
|
||||
|
||||
if isinstance(action, argparse._SubParsersAction):
|
||||
if isinstance(action, argparse._SubParsersAction): # noqa: SLF001
|
||||
continue # Subparsers handled separately
|
||||
|
||||
option_strings = ", ".join(action.option_strings)
|
||||
@@ -204,8 +204,8 @@ def get_subcommands(
|
||||
)
|
||||
)
|
||||
|
||||
for action in parser._actions:
|
||||
if isinstance(action, argparse._SubParsersAction):
|
||||
for action in parser._actions: # noqa: SLF001
|
||||
if isinstance(action, argparse._SubParsersAction): # noqa: SLF001
|
||||
subparsers: dict[str, argparse.ArgumentParser] = action.choices
|
||||
|
||||
for name, subparser in subparsers.items():
|
||||
@@ -252,8 +252,8 @@ def collect_commands() -> list[Category]:
|
||||
|
||||
result: list[Category] = []
|
||||
|
||||
for action in parser._actions:
|
||||
if isinstance(action, argparse._SubParsersAction):
|
||||
for action in parser._actions: # noqa: SLF001
|
||||
if isinstance(action, argparse._SubParsersAction): # noqa: SLF001
|
||||
subparsers: dict[str, argparse.ArgumentParser] = action.choices
|
||||
for name, subparser in subparsers.items():
|
||||
if str(subparser.description).startswith("WIP"):
|
||||
|
||||
@@ -64,11 +64,11 @@ class JoinList:
|
||||
cls._instance = cls.__new__(cls)
|
||||
cls.list_store = Gio.ListStore.new(JoinValue)
|
||||
|
||||
ClanStore.use().register_on_deep_change(cls._instance._rerender_join_list)
|
||||
ClanStore.use().register_on_deep_change(cls._instance.rerender_join_list)
|
||||
|
||||
return cls._instance
|
||||
|
||||
def _rerender_join_list(
|
||||
def rerender_join_list(
|
||||
self, source: GKVStore, position: int, removed: int, added: int
|
||||
) -> None:
|
||||
self.list_store.items_changed(
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ lint.select = [
|
||||
"RET",
|
||||
"RSE",
|
||||
"RUF",
|
||||
"SLF",
|
||||
"T10",
|
||||
"TID",
|
||||
"U",
|
||||
|
||||
Reference in New Issue
Block a user