mirror of
https://github.com/slgobinath/SafeEyes.git
synced 2025-01-06 01:26:56 +01:00
Merge pull request #657 from embar-/patch-1
Make SafeEyes compatible with Python 3.6 again
This commit is contained in:
commit
6da10e6ade
@ -24,6 +24,7 @@ import logging
|
|||||||
import random
|
import random
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import Optional, Union
|
||||||
|
|
||||||
from packaging.version import parse
|
from packaging.version import parse
|
||||||
|
|
||||||
@ -424,11 +425,11 @@ class TrayAction:
|
|||||||
@dataclass
|
@dataclass
|
||||||
class PluginDependency:
|
class PluginDependency:
|
||||||
message: str
|
message: str
|
||||||
link: str|None = None
|
link: Optional[str] = None
|
||||||
retryable: bool = False
|
retryable: bool = False
|
||||||
|
|
||||||
class RequiredPluginException(Exception):
|
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):
|
if isinstance(message, PluginDependency):
|
||||||
msg = message.message
|
msg = message.message
|
||||||
else:
|
else:
|
||||||
|
@ -55,7 +55,8 @@ def init(ctx, safeeyes_config, plugin_config):
|
|||||||
'total_resets': 0,
|
'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:
|
if 'no_of_breaks' in session:
|
||||||
# Ignore old format session.
|
# Ignore old format session.
|
||||||
session = defaults
|
session = defaults
|
||||||
|
Loading…
Reference in New Issue
Block a user