From 0fdb432635d35386f79d589a5d21ab486eac0d4c Mon Sep 17 00:00:00 2001 From: embar- Date: Sun, 13 Oct 2024 09:36:34 +0300 Subject: [PATCH 1/2] Replace "|" into "or" for Python 3.6 compatibility --- safeeyes/plugins/healthstats/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/safeeyes/plugins/healthstats/plugin.py b/safeeyes/plugins/healthstats/plugin.py index 126c1c8..d4def48 100644 --- a/safeeyes/plugins/healthstats/plugin.py +++ b/safeeyes/plugins/healthstats/plugin.py @@ -55,7 +55,7 @@ def init(ctx, safeeyes_config, plugin_config): 'total_resets': 0, } - session = context['session']['plugin'].get('healthstats', {}) | defaults + session = context['session']['plugin'].get('healthstats', {}) or defaults if 'no_of_breaks' in session: # Ignore old format session. session = defaults From a52eb0a0ed32b7eb685341aa11a9897871ee5ee9 Mon Sep 17 00:00:00 2001 From: embar- Date: Sun, 13 Oct 2024 09:46:36 +0300 Subject: [PATCH 2/2] Use Optional and Union instead of "|" for Python 3.6 compatibility --- safeeyes/model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/safeeyes/model.py b/safeeyes/model.py index 2f8f9b8..888a6bc 100644 --- a/safeeyes/model.py +++ b/safeeyes/model.py @@ -24,6 +24,7 @@ import logging import random from enum import Enum from dataclasses import dataclass +from typing import Optional, Union from packaging.version import parse @@ -424,11 +425,11 @@ class TrayAction: @dataclass class PluginDependency: message: str - link: str|None = None + link: Optional[str] = None retryable: bool = False class RequiredPluginException(Exception): - def __init__(self, plugin_id, plugin_name: str, message: str|PluginDependency): + def __init__(self, plugin_id, plugin_name: str, message: Union[str, PluginDependency]): if isinstance(message, PluginDependency): msg = message.message else: