Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(internal): enable lint rule #132

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ select = [
"F401",
# bare except statements
"E722",
# unused arguments
"ARG",
# print statements
"T201",
"T203",
Expand Down
13 changes: 10 additions & 3 deletions src/finch/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,10 @@ def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers:

return headers

def _prepare_request(self, request: httpx.Request) -> None:
def _prepare_request(
self,
request: httpx.Request, # noqa: ARG002
) -> None:
"""This method is used as a callback for mutating the `Request` object
after it has been constructed.

Expand Down Expand Up @@ -509,7 +512,7 @@ def _process_response(
self,
*,
cast_to: Type[ResponseT],
options: FinalRequestOptions,
options: FinalRequestOptions, # noqa: ARG002
response: httpx.Response,
) -> ResponseT:
if cast_to is NoneType:
Expand Down Expand Up @@ -616,7 +619,11 @@ def default_headers(self) -> dict[str, str | Omit]:
**self._custom_headers,
}

def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
def _validate_headers(
self,
headers: Headers, # noqa: ARG002
custom_headers: Headers, # noqa: ARG002
) -> None:
"""Validate the given default headers and custom headers.

Does nothing by default.
Expand Down
14 changes: 7 additions & 7 deletions src/finch/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
# v1 re-exports
if TYPE_CHECKING:

def parse_date(value: date | StrBytesIntFloat) -> date:
def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001
...

def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: # noqa: ARG001
...

def get_args(t: type[Any]) -> tuple[Any, ...]:
def get_args(t: type[Any]) -> tuple[Any, ...]: # noqa: ARG001
...

def is_union(tp: type[Any] | None) -> bool:
def is_union(tp: type[Any] | None) -> bool: # noqa: ARG001
...

def get_origin(t: type[Any]) -> type[Any] | None:
def get_origin(t: type[Any]) -> type[Any] | None: # noqa: ARG001
...

def is_literal_type(type_: type[Any]) -> bool:
def is_literal_type(type_: type[Any]) -> bool: # noqa: ARG001
...

def is_typeddict(type_: type[Any]) -> bool:
def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001
...

else:
Expand Down
2 changes: 1 addition & 1 deletion src/finch/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class APIError(FinchError):
If there was no response associated with this error then it will be `None`.
"""

def __init__(self, message: str, request: httpx.Request, *, body: object | None) -> None:
def __init__(self, message: str, request: httpx.Request, *, body: object | None) -> None: # noqa: ARG002
super().__init__(message)
self.request = request
self.message = message
Expand Down
4 changes: 2 additions & 2 deletions src/finch/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def next_page_info(self) -> None:
return None

@classmethod
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT:
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
return cls.construct(
**{
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
Expand All @@ -58,7 +58,7 @@ def next_page_info(self) -> None:
return None

@classmethod
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT:
def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
return cls.construct(
**{
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ class Model(BaseModel):
def test_type_compat() -> None:
# our model type can be assigned to Pydantic's model type

def takes_pydantic(model: pydantic.BaseModel) -> None:
def takes_pydantic(model: pydantic.BaseModel) -> None: # noqa: ARG001
...

class OurModel(BaseModel):
Expand Down