Skip to content

Commit bf0186c

Browse files
committed
Linter
1 parent 2e88bbc commit bf0186c

7 files changed

Lines changed: 12 additions & 37 deletions

File tree

examples/general/api_tokens.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ def list_api_tokens(account_id: int) -> list[ApiToken]:
1515

1616

1717
def get_api_token(account_id: int, api_token_id: int) -> ApiToken:
18-
return api_tokens_api.get_by_id(
19-
account_id=account_id, api_token_id=api_token_id
20-
)
18+
return api_tokens_api.get_by_id(account_id=account_id, api_token_id=api_token_id)
2119

2220

2321
def create_api_token(account_id: int) -> ApiTokenWithToken:
@@ -39,15 +37,11 @@ def create_api_token(account_id: int) -> ApiTokenWithToken:
3937

4038
def reset_api_token(account_id: int, api_token_id: int) -> ApiTokenWithToken:
4139
# The reset response includes the new full token value once — store it securely.
42-
return api_tokens_api.reset(
43-
account_id=account_id, api_token_id=api_token_id
44-
)
40+
return api_tokens_api.reset(account_id=account_id, api_token_id=api_token_id)
4541

4642

4743
def delete_api_token(account_id: int, api_token_id: int) -> DeletedObject:
48-
return api_tokens_api.delete(
49-
account_id=account_id, api_token_id=api_token_id
50-
)
44+
return api_tokens_api.delete(account_id=account_id, api_token_id=api_token_id)
5145

5246

5347
if __name__ == "__main__":

mailtrap/api/organizations.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ def __init__(self, client: HttpClient, organization_id: str) -> None:
99

1010
@property
1111
def sub_accounts(self) -> SubAccountsApi:
12-
return SubAccountsApi(
13-
organization_id=self._organization_id, client=self._client
14-
)
12+
return SubAccountsApi(organization_id=self._organization_id, client=self._client)

mailtrap/api/resources/api_tokens.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def reset(self, account_id: int, api_token_id: int) -> ApiTokenWithToken:
5050
permissions. The full new token value is returned once — store it
5151
securely. Only tokens that have not already been reset can be reset.
5252
"""
53-
response = self._client.post(
54-
f"{self._api_path(account_id, api_token_id)}/reset"
55-
)
53+
response = self._client.post(f"{self._api_path(account_id, api_token_id)}/reset")
5654
return ApiTokenWithToken(**response)
5755

5856
@staticmethod

mailtrap/api/resources/webhooks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ def create(self, webhook_params: CreateWebhookParams) -> WebhookWithSecret:
4141
)
4242
return WebhookCreateResponse(**response).data
4343

44-
def update(
45-
self, webhook_id: int, webhook_params: UpdateWebhookParams
46-
) -> Webhook:
44+
def update(self, webhook_id: int, webhook_params: UpdateWebhookParams) -> Webhook:
4745
"""
4846
Update an existing webhook. Only the fields supplied in
4947
`webhook_params` are sent to the API.

tests/unit/api/general/test_api_tokens.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ def test_create_should_raise_api_errors(
193193
)
194194

195195
with pytest.raises(APIError) as exc_info:
196-
client.create(
197-
ACCOUNT_ID, CreateApiTokenParams(name="My API Token")
198-
)
196+
client.create(ACCOUNT_ID, CreateApiTokenParams(name="My API Token"))
199197

200198
assert expected_error_message in str(exc_info.value)
201199

@@ -270,9 +268,7 @@ def test_delete_should_raise_api_errors(
270268
assert expected_error_message in str(exc_info.value)
271269

272270
@responses.activate
273-
def test_delete_should_return_deleted_object(
274-
self, client: ApiTokensApi
275-
) -> None:
271+
def test_delete_should_return_deleted_object(self, client: ApiTokensApi) -> None:
276272
responses.delete(
277273
f"{BASE_API_TOKENS_URL}/{API_TOKEN_ID}",
278274
status=204,

tests/unit/api/organizations/test_sub_accounts.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ def test_create_should_raise_api_errors(
124124
response_json: dict,
125125
expected_error_message: str,
126126
) -> None:
127-
responses.post(
128-
BASE_SUB_ACCOUNTS_URL, status=status_code, json=response_json
129-
)
127+
responses.post(BASE_SUB_ACCOUNTS_URL, status=status_code, json=response_json)
130128

131129
with pytest.raises(APIError) as exc_info:
132130
client.create(CreateSubAccountParams(name="New Team Account"))
@@ -143,9 +141,7 @@ def test_create_should_return_sub_account_and_wrap_body_under_account_key(
143141
status=200,
144142
)
145143

146-
sub_account = client.create(
147-
CreateSubAccountParams(name="New Team Account")
148-
)
144+
sub_account = client.create(CreateSubAccountParams(name="New Team Account"))
149145

150146
assert isinstance(sub_account, SubAccount)
151147
assert sub_account.id == 12347

tests/unit/api/webhooks/test_webhooks.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ def test_create_should_return_webhook_with_signing_secret(
228228
) -> None:
229229
responses.post(
230230
BASE_WEBHOOKS_URL,
231-
json={
232-
"data": {**sample_webhook_dict, "signing_secret": "a1b2c3d4"}
233-
},
231+
json={"data": {**sample_webhook_dict, "signing_secret": "a1b2c3d4"}},
234232
status=200,
235233
)
236234

@@ -270,10 +268,7 @@ def test_update_should_send_only_supplied_fields(
270268
assert isinstance(webhook, Webhook)
271269
assert webhook.active is False
272270

273-
assert (
274-
responses.calls[0].request.body
275-
== b'{"webhook": {"active": false}}'
276-
)
271+
assert responses.calls[0].request.body == b'{"webhook": {"active": false}}'
277272

278273
@pytest.mark.parametrize(
279274
"status_code,response_json,expected_error_message",

0 commit comments

Comments
 (0)