Skip to content

Commit

Permalink
chore(internal): enable lint rule (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Oct 13, 2023
1 parent 8b3e213 commit c5ee67d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
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/modern_treasury/_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/modern_treasury/_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/modern_treasury/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class APIError(ModernTreasuryError):
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/modern_treasury/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def next_page_info(self) -> Optional[PageInfo]:
return PageInfo(params={"after_cursor": cursor})

@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 @@ -56,7 +56,7 @@ def next_page_info(self) -> Optional[PageInfo]:
return PageInfo(params={"after_cursor": cursor})

@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

0 comments on commit c5ee67d

Please sign in to comment.