Skip to content

Commit

Permalink
format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
andrueastman committed Sep 12, 2024
1 parent a56df61 commit e52fd69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

U = TypeVar("U", bound=Parsable)


class ParsableFactory(Parsable, Generic[U]):
"""Defines the factory for creating parsable objects.
"""
Expand Down
11 changes: 7 additions & 4 deletions packages/http/httpx/kiota_http/httpx_request_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ async def send_collection_async(
)
root_node = await self.get_root_parse_node(response, parent_span, parent_span)
if root_node:
result:List[ModelType] = root_node.get_collection_of_object_values(parsable_factory)
result: List[ModelType] = root_node.get_collection_of_object_values(
parsable_factory
)
parent_span.set_attribute(DESERIALIZED_MODEL_NAME_KEY, result.__class__.__name__)
_deserialized_span.end()
return result
Expand Down Expand Up @@ -282,7 +284,7 @@ async def send_collection_of_primitive_async(
values = root_node.get_collection_of_primitive_values(response_type)
parent_span.set_attribute(DESERIALIZED_MODEL_NAME_KEY, values.__class__.__name__)
_deserialized_span.end()
return values # type: ignore
return values # type: ignore
return None
finally:
parent_span.end()
Expand Down Expand Up @@ -322,7 +324,7 @@ async def send_primitive_async(
if self._should_return_none(response):
return None
if response_type == "bytes":
return response.content # type: ignore
return response.content # type: ignore
_deserialized_span = self._start_local_tracing_span("get_root_parse_node", parent_span)
root_node = await self.get_root_parse_node(response, parent_span, parent_span)
if not root_node:
Expand All @@ -341,7 +343,7 @@ async def send_primitive_async(
if value is not None:
parent_span.set_attribute(DESERIALIZED_MODEL_NAME_KEY, value.__class__.__name__)
_deserialized_span.end()
return value # type: ignore
return value # type: ignore

exc = TypeError(f"Error handling the response, unexpected type {response_type!r}")
parent_span.record_exception(exc)
Expand Down Expand Up @@ -484,6 +486,7 @@ async def throw_failed_responses(

if not root_node:
return None
error = None
if error_class:
error = root_node.get_object_value(error_class)
if isinstance(error, APIError):
Expand Down

0 comments on commit e52fd69

Please sign in to comment.