Skip to content

Commit

Permalink
commit(deps): bump astral-sh/setup-uv from 4 to 5 (#4)
Browse files Browse the repository at this point in the history
* commit(deps): bump astral-sh/setup-uv from 4 to 5

Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 4 to 5.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](astral-sh/setup-uv@v4...v5)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and pre-commit-ci[bot] authored Jan 1, 2025
1 parent 1d3984e commit 4f0a271
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/new_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
5 changes: 1 addition & 4 deletions ejemplo.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ def list_unused_files(tracked_files, project_directory):
# Format the output as the required JSON structure
output = []
for file_name, functions in function_calls.items():
modules = [
{"function": func_name, "count": count}
for func_name, count in functions.items()
]
modules = [{"function": func_name, "count": count} for func_name, count in functions.items()]
output.append({"file": file_name, "modules": modules})

# Print the JSON string
Expand Down
22 changes: 8 additions & 14 deletions khipu_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from khipu_tools._predict import Predict as Predict
from khipu_tools._payments import Payments as Payments
from khipu_tools._banks import Banks as Banks
from khipu_tools._http_client import (
new_default_http_client as new_default_http_client,
)
from khipu_tools._api_resource import APIResource as APIResource
from khipu_tools._khipu_client import KhipuClient as KhipuClient
from typing import Optional

from typing import Literal
Expand Down Expand Up @@ -44,17 +52,3 @@ def set_app_info(


# Infrastructure types
from khipu_tools._khipu_client import KhipuClient as KhipuClient
from khipu_tools._api_resource import APIResource as APIResource


from khipu_tools._http_client import (
new_default_http_client as new_default_http_client,
)


from khipu_tools._banks import Banks as Banks

from khipu_tools._payments import Payments as Payments

from khipu_tools._predict import Predict as Predict
11 changes: 3 additions & 8 deletions khipu_tools/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ def _replace_options(self, options: Optional[RequestOptions]) -> "_APIRequestor"
]:
if key in options and options[key] is not None:
new_options[key] = options[key]
return _APIRequestor(
options=RequestorOptions(**new_options), client=self._client
)
return _APIRequestor(options=RequestorOptions(**new_options), client=self._client)

@property
def api_key(self):
Expand Down Expand Up @@ -147,9 +145,7 @@ def request(

return obj

def request_headers(
self, method: HttpVerb, api_mode: ApiMode, options: RequestOptions
):
def request_headers(self, method: HttpVerb, api_mode: ApiMode, options: RequestOptions):
user_agent = f"khipu_tools/{khipu_tools.VERSION}"
if khipu_tools.app_info:
user_agent += " " + self._format_app_info(khipu_tools.app_info)
Expand Down Expand Up @@ -317,8 +313,7 @@ def _interpret_response(
)
except Exception:
raise error.APIError(
f"Invalid response body from API: {rcode} -- "
f"HTTP response was: {rbody})",
f"Invalid response body from API: {rcode} -- " f"HTTP response was: {rbody})",
cast(bytes, rbody),
rcode,
cast(bytes, rbody),
Expand Down
4 changes: 1 addition & 3 deletions khipu_tools/_banks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def get(cls) -> KhipuObject["Banks"]:
cls.class_url(),
)
if not isinstance(result, KhipuObject):
raise TypeError(
"Expected KhipuObject object from API, got %s" % (type(result).__name__)
)
raise TypeError("Expected KhipuObject object from API, got %s" % (type(result).__name__))

return result
4 changes: 1 addition & 3 deletions khipu_tools/_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ def _json_encode_date_callback(value):
return value


def _api_encode(
data, api_mode: Optional[str]
) -> Generator[tuple[str, Any], None, None]:
def _api_encode(data, api_mode: Optional[str]) -> Generator[tuple[str, Any], None, None]:
for key, value in data.items():
if value is None:
continue
Expand Down
5 changes: 1 addition & 4 deletions khipu_tools/_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ def __init__(
try:
body = cast(bytes, http_body).decode("utf-8")
except BaseException:
body = (
"<Could not decode body as utf-8. "
"Please report to mariofix@proton.me>"
)
body = "<Could not decode body as utf-8. " "Please report to mariofix@proton.me>"
elif isinstance(http_body, str):
body = http_body

Expand Down
16 changes: 4 additions & 12 deletions khipu_tools/_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def _should_retry(
):
return False

def _retry_after_header(
self, response: Optional[tuple[Any, Any, Mapping[str, str]]] = None
):
def _retry_after_header(self, response: Optional[tuple[Any, Any, Mapping[str, str]]] = None):
return None

def _sleep_time_seconds(
Expand Down Expand Up @@ -173,9 +171,7 @@ def request(
headers: Optional[Mapping[str, str]],
post_data=None,
) -> tuple[bytes, int, Mapping[str, str]]:
return self._request_internal(
method, url, headers, post_data, is_streaming=False
)
return self._request_internal(method, url, headers, post_data, is_streaming=False)

def request_stream(
self,
Expand All @@ -184,9 +180,7 @@ def request_stream(
headers: Optional[Mapping[str, str]],
post_data=None,
) -> tuple[Any, int, Mapping[str, str]]:
return self._request_internal(
method, url, headers, post_data, is_streaming=True
)
return self._request_internal(method, url, headers, post_data, is_streaming=True)

@overload
def _request_internal(
Expand Down Expand Up @@ -332,9 +326,7 @@ async def request_async(
) -> tuple[bytes, int, Mapping[str, str]]:
self.raise_async_client_import_error()

async def request_stream_async(
self, method: str, url: str, headers: Mapping[str, str], post_data=None
):
async def request_stream_async(self, method: str, url: str, headers: Mapping[str, str], post_data=None):
self.raise_async_client_import_error()

async def close_async(self):
Expand Down
7 changes: 2 additions & 5 deletions khipu_tools/_khipu_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@


@overload
def _compute_diff(
current: dict[str, Any], previous: Optional[dict[str, Any]]
) -> dict[str, Any]: ...
def _compute_diff(current: dict[str, Any], previous: Optional[dict[str, Any]]) -> dict[str, Any]: ...


@overload
Expand Down Expand Up @@ -176,8 +174,7 @@ def __getitem__(self, k: str) -> Any:
"It was then wiped when refreshing the object with "
"the result returned by Stripe's API, probably as a "
"result of a save(). The attributes currently "
"available on this object are: %s"
% (k, k, ", ".join(list(self.keys())))
"available on this object are: %s" % (k, k, ", ".join(list(self.keys())))
)
else:
raise err
Expand Down
13 changes: 3 additions & 10 deletions khipu_tools/_list_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class ListObject(KhipuObject, Generic[T]):
def _get_url_for_list(self) -> str:
url = self.get("url")
if not isinstance(url, str):
raise ValueError(
'Cannot call .list on a list object without a string "url" property'
)
raise ValueError('Cannot call .list on a list object without a string "url" property')
return url

def list(self, **params: Mapping[str, Any]) -> Self:
Expand Down Expand Up @@ -96,10 +94,7 @@ def auto_paging_iter(self) -> Iterator[T]:
page = self

while True:
if (
"ending_before" in self._retrieve_params
and "starting_after" not in self._retrieve_params
):
if "ending_before" in self._retrieve_params and "starting_after" not in self._retrieve_params:
yield from reversed(page)
page = page.previous_page()
else:
Expand Down Expand Up @@ -147,9 +142,7 @@ def next_page(self, **params: Unpack[RequestOptions]) -> Self:
**self._get_filters_for_next_page(params),
)

def _get_filters_for_previous_page(
self, params: RequestOptions
) -> Mapping[str, Any]:
def _get_filters_for_previous_page(self, params: RequestOptions) -> Mapping[str, Any]:
first_id = getattr(self.data[0], "id")
if not first_id:
raise ValueError("Unexpected: element in .data of list object had no id")
Expand Down
4 changes: 1 addition & 3 deletions khipu_tools/_listable_api_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ def list(cls, **params) -> ListObject[T]:
)

if not isinstance(result, ListObject):
raise TypeError(
f"Expected list object from API, got {type(result).__name__}"
)
raise TypeError(f"Expected list object from API, got {type(result).__name__}")

return result
12 changes: 3 additions & 9 deletions khipu_tools/_payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ class PaymentInfo(RequestOptions):
"""Ignorar este campo."""

@classmethod
def create(
cls, **params: Unpack["Payments.PaymentParams"]
) -> KhipuObject["Payments.PaymentCreateResponse"]:
def create(cls, **params: Unpack["Payments.PaymentParams"]) -> KhipuObject["Payments.PaymentCreateResponse"]:
"""
Crea un pago en Khipu y obtiene las URLs para redirección al usuario para que complete el pago.
"""
Expand All @@ -187,9 +185,7 @@ def create(
params=params,
)
if not isinstance(result, KhipuObject):
raise TypeError(
"Expected KhipuObject object from API, got %s" % (type(result).__name__)
)
raise TypeError("Expected KhipuObject object from API, got %s" % (type(result).__name__))

return result

Expand All @@ -203,9 +199,7 @@ def get(cls, **params: Unpack["Payments.PaymentInfo"]) -> KhipuObject["Payments"
f"{cls.class_url()}/{params['payment_id']}",
)
if not isinstance(result, KhipuObject):
raise TypeError(
"Expected KhipuObject object from API, got %s" % (type(result).__name__)
)
raise TypeError("Expected KhipuObject object from API, got %s" % (type(result).__name__))

return result

Expand Down
4 changes: 1 addition & 3 deletions khipu_tools/_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def get(cls, **params: Unpack["Predict.PredictParams"]) -> KhipuObject["Predict"
params=params,
)
if not isinstance(result, KhipuObject):
raise TypeError(
"Expected KhipuObject object from API, got %s" % (type(result).__name__)
)
raise TypeError("Expected KhipuObject object from API, got %s" % (type(result).__name__))

return result
5 changes: 1 addition & 4 deletions khipu_tools/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,7 @@ def _convert_to_khipu_object(
if (
params is not None
and hasattr(obj, "object")
and (
(getattr(obj, "object") == "list")
or (getattr(obj, "object") == "search_result")
)
and ((getattr(obj, "object") == "list") or (getattr(obj, "object") == "search_result"))
):
obj._retrieve_params = params

Expand Down

0 comments on commit 4f0a271

Please sign in to comment.