move ignore_this_device() into base class Infos

This commit is contained in:
Stefan Allius
2024-04-01 00:48:33 +02:00
parent db319f6aa3
commit f38fea3807
3 changed files with 16 additions and 31 deletions

View File

@@ -166,18 +166,3 @@ class InfosG3(Infos):
i += 1
def ignore_this_device(self, dep: dict) -> bool:
'''Checks the equation in the dep dict
returns 'False' only if the equation is valid;
'True' in any other case'''
if 'reg' in dep:
value = self.dev_value(dep['reg'])
if not value:
return True
if 'gte' in dep:
return not value >= dep['gte']
elif 'less_eq' in dep:
return not value <= dep['less_eq']
return True

View File

@@ -126,19 +126,3 @@ class InfosG3P(Infos):
self.tracer.log(level, f'{name} : {result}{unit}'
f' update: {update}')
def ignore_this_device(self, dep: dict) -> bool:
'''Checks the equation in the dep dict
returns 'False' only if the equation is valid;
'True' in any other case'''
if 'reg' in dep:
value = self.dev_value(dep['reg'])
if not value:
return True
if 'gte' in dep:
return not value >= dep['gte']
elif 'less_eq' in dep:
return not value <= dep['less_eq']
return True

View File

@@ -435,3 +435,19 @@ class Infos:
if isinstance(row, dict):
keys = row['name']
self.update_db(keys, False, value)
def ignore_this_device(self, dep: dict) -> bool:
'''Checks the equation in the dep dict
returns 'False' only if the equation is valid;
'True' in any other case'''
if 'reg' in dep:
value = self.dev_value(dep['reg'])
if not value:
return True
if 'gte' in dep:
return not value >= dep['gte']
elif 'less_eq' in dep:
return not value <= dep['less_eq']
return True