Commit c361acdb authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

[CLIENT] Small refactoring

parent 482a9278
Pipeline #81192 passed with stages
in 9 minutes and 38 seconds
......@@ -392,8 +392,7 @@ def get_schema_type(schema, name=None, sub_schema=None, name_prefix=''):
def SchemaEnum(n, items):
enum_name = f'{type_name}.{cpp_2_python_name(n)}'
return EnumParam(enum_name, {e.upper(): e for e in items})
enums = {n: SchemaEnum(n, p['enum'])
for n, p in schema_items if HasEnum(p)}
enums = {n: SchemaEnum(n, p['enum']) for n, p in schema_items if HasEnum(p)}
HasType = lambda p: '$ref' in p or 'properties' in p
def SchemaType(n, p):
......@@ -401,8 +400,7 @@ def get_schema_type(schema, name=None, sub_schema=None, name_prefix=''):
sub_schema = p if 'properties' in p else None
prefix = f'{type_name}.'
return get_schema_type(schema, name, sub_schema, prefix)
types = {n: SchemaType(n, p)
for n, p in schema_items if HasType(p)}
types = {n: SchemaType(n, p) for n, p in schema_items if HasType(p)}
HasArray = lambda p: 'items' in p
def ComplexItem(p):
......@@ -562,7 +560,7 @@ class Detector:
def checkConnection(self):
try:
self.ping()
if not self.__attrs:
if not self.__attrs:
self._initAttrs()
return True
except:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment