Skip to content

Commit

Permalink
apply black
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-agenta committed Sep 10, 2024
1 parent aa79ff7 commit 076f041
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 35 deletions.
36 changes: 22 additions & 14 deletions agenta-cli/agenta/client/backend/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ def __init__(
self._client_wrapper = SyncClientWrapper(
base_url=base_url,
api_key=api_key,
httpx_client=httpx_client
if httpx_client is not None
else httpx.Client(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.Client(timeout=_defaulted_timeout),
httpx_client=(
httpx_client
if httpx_client is not None
else (
httpx.Client(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.Client(timeout=_defaulted_timeout)
)
),
timeout=_defaulted_timeout,
)
self.observability = ObservabilityClient(client_wrapper=self._client_wrapper)
Expand Down Expand Up @@ -1603,13 +1607,17 @@ def __init__(
self._client_wrapper = AsyncClientWrapper(
base_url=base_url,
api_key=api_key,
httpx_client=httpx_client
if httpx_client is not None
else httpx.AsyncClient(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.AsyncClient(timeout=_defaulted_timeout),
httpx_client=(
httpx_client
if httpx_client is not None
else (
httpx.AsyncClient(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.AsyncClient(timeout=_defaulted_timeout)
)
),
timeout=_defaulted_timeout,
)
self.observability = AsyncObservabilityClient(
Expand Down
38 changes: 23 additions & 15 deletions agenta-cli/agenta/client/backend/core/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def get_request_body(
json_body = maybe_filter_request_body(json, request_options, omit)

# If you have an empty JSON body, you should just send None
return (
json_body if json_body != {} else None
), data_body if data_body != {} else None
return (json_body if json_body != {} else None), (
data_body if data_body != {} else None
)


class HttpClient:
Expand Down Expand Up @@ -246,9 +246,11 @@ def request(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None
),
timeout=timeout,
)

Expand Down Expand Up @@ -345,9 +347,11 @@ def stream(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None
),
timeout=timeout,
) as stream:
yield stream
Expand Down Expand Up @@ -447,9 +451,11 @@ async def request(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None
),
timeout=timeout,
)

Expand Down Expand Up @@ -545,9 +551,11 @@ async def stream(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if files is not None
else None
),
timeout=timeout,
) as stream:
yield stream
6 changes: 3 additions & 3 deletions agenta-cli/agenta/client/backend/core/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def _convert_typeddict(
if type_ is None:
converted_object[key] = value
else:
converted_object[
_alias_key(key, type_)
] = convert_and_respect_annotation_metadata(object_=value, annotation=type_)
converted_object[_alias_key(key, type_)] = (
convert_and_respect_annotation_metadata(object_=value, annotation=type_)
)
return converted_object


Expand Down
6 changes: 3 additions & 3 deletions agenta-cli/agenta/client/backend/types/evaluator_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class EvaluatorConfig(UniversalBaseModel):
id: str
name: str
evaluator_key: str
settings_values: typing.Optional[
typing.Dict[str, typing.Optional[typing.Any]]
] = None
settings_values: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = (
None
)
created_at: str
updated_at: str

Expand Down

0 comments on commit 076f041

Please sign in to comment.