Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
RohanArepally committed Sep 10, 2024
1 parent 2c118ce commit 87e3e88
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions aiochclient/_types.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ cdef class StrType:
self.container = container

cdef str _convert(self, str string):
string = decode(string.encode())
if self.container:
return remove_single_quotes(string)
return string
Expand Down Expand Up @@ -524,7 +525,7 @@ cdef class TupleType:

cdef tuple _convert(self, str string):
return tuple(
tp(decode(val.encode()))
tp(val)
for tp, val in zip(self.types, seq_parser(string[1:-1]))
)

Expand Down Expand Up @@ -554,7 +555,7 @@ cdef class MapType:
cdef dict _convert(self, str string):
key, value = string[1:-1].split(':', 1)
return {
self.key_type.p_type(decode(key.encode())): self.value_type.p_type(decode(value.encode()))
self.key_type.p_type(key): self.value_type.p_type(value)
}

cpdef dict p_type(self, string):
Expand All @@ -579,7 +580,7 @@ cdef class ArrayType:
)

cdef list _convert(self, str string):
return [self.type.p_type(decode(val.encode())) for val in seq_parser(string[1:-1])]
return [self.type.p_type(val) for val in seq_parser(string[1:-1])]

cpdef list p_type(self, str string):
return self._convert(string)
Expand Down Expand Up @@ -611,7 +612,7 @@ cdef class NestedType:
for val in seq_parser(string[1:-1]):
temp = []
for tp, elem in zip(self.types, seq_parser(val.strip("()"))):
temp.append(tp.p_type(decode(elem.encode())))
temp.append(tp.p_type(elem))
result.append(tuple(temp))
return result

Expand Down

0 comments on commit 87e3e88

Please sign in to comment.