Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_python(self, ctype_object, *args, **kwargs):
if ctype_object.status_code == 0:
result = {
'more': Bool.to_python(
ctype_object.more, *args, **kwargs
),
'data': [],
}
if hasattr(ctype_object, 'fields'):
result['fields'] = StringArray.to_python(
ctype_object.fields, *args, **kwargs
)
else:
result['field_count'] = Int.to_python(
ctype_object.field_count, *args, **kwargs
)
if hasattr(ctype_object, 'cursor'):
result['cursor'] = Long.to_python(
ctype_object.cursor, *args, **kwargs
)
for row_item in ctype_object.data._fields_:
row_name = row_item[0]
row_object = getattr(ctype_object.data, row_name)
row = []
for col_item in row_object._fields_:
col_name = col_item[0]
col_object = getattr(row_object, col_name)
row.append(
AnyDataObject.to_python(col_object, *args, **kwargs)
)
def to_python(self, ctype_object, *args, **kwargs):
if not hasattr(ctype_object, 'status_code'):
result = {
'more': Bool.to_python(
ctype_object.more, *args, **kwargs
),
'data': [],
}
if hasattr(ctype_object, 'fields'):
result['fields'] = StringArray.to_python(
ctype_object.fields, *args, **kwargs
)
else:
result['field_count'] = Int.to_python(
ctype_object.field_count, *args, **kwargs
)
if hasattr(ctype_object, 'cursor'):
result['cursor'] = Long.to_python(
ctype_object.cursor, *args, **kwargs
)
for row_item in ctype_object.data._fields_:
row_name = row_item[0]
row_object = getattr(ctype_object.data, row_name)
row = []
for col_item in row_object._fields_:
col_name = col_item[0]
col_object = getattr(row_object, col_name)
row.append(
AnyDataObject.to_python(col_object, *args, **kwargs)
)
def to_python(self, ctype_object, *args, **kwargs):
if ctype_object.status_code == 0:
result = {
'more': Bool.to_python(
ctype_object.more, *args, **kwargs
),
'data': [],
}
if hasattr(ctype_object, 'fields'):
result['fields'] = StringArray.to_python(
ctype_object.fields, *args, **kwargs
)
else:
result['field_count'] = Int.to_python(
ctype_object.field_count, *args, **kwargs
)
if hasattr(ctype_object, 'cursor'):
result['cursor'] = Long.to_python(
ctype_object.cursor, *args, **kwargs
)
for row_item in ctype_object.data._fields_:
row_name = row_item[0]
row_object = getattr(ctype_object.data, row_name)
row = []
for col_item in row_object._fields_:
col_name = col_item[0]
col_object = getattr(row_object, col_name)
row.append(
AnyDataObject.to_python(col_object, *args, **kwargs)
)