File SafeEyes-Python3.6-compatibility.patch of Package safeeyes
Date: Sat, 19 Oct 2024 09:36:34 +0300
Subject: [PATCH 1/2] Replace "|" for Python 3.6 compatibility according PEP 584 recommendations
---
safeeyes/plugins/healthstats/plugin.py | 2 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/safeeyes/plugins/healthstats/plugin.py b/safeeyes/plugins/healthstats/plugin.py
--- a/safeeyes/plugins/healthstats/plugin.py
+++ b/safeeyes/plugins/healthstats/plugin.py
@@ -55,7 +55,8 @@ def init(ctx, safeeyes_config, plugin_config):
'total_resets': 0,
}
- session = context['session']['plugin'].get('healthstats', {}) | defaults
+ session = context['session']['plugin'].get('healthstats', {}).copy()
+ session.update(defaults)
if 'no_of_breaks' in session:
# Ignore old format session.
session = defaults
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
--- a/safeeyes/model.py
+++ b/safeeyes/model.py
@@ -24,6 +24,7 @@
import random
from enum import Enum
from dataclasses import dataclass
+from typing import Optional, Union
from packaging.version import parse
@@ -424,10 +425,10 @@ def build(cls, name, icon_path, icon_id, action):
@dataclass
class PluginDependency:
message: str
- link: str|None = None
+ link: Optional[str] = None
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: