Skip to content

Commit

Permalink
Merge 748820b into 81905cd
Browse files Browse the repository at this point in the history
  • Loading branch information
xavdid-stripe committed May 13, 2024
2 parents 81905cd + 748820b commit 252c34b
Show file tree
Hide file tree
Showing 154 changed files with 691 additions and 812 deletions.
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# length, but can go over in some cases.
# W503 goes against PEP8 rules. It's disabled by default, but must be disabled
# explicitly when using `ignore`.
ignore = E501, W503
# E704 is disabled in the default configuration, but by specifying `ignore`, we wipe that out.
# ruff formatting creates code that violates it, so we have to disable it manually
ignore = E501, W503, E704
per-file-ignores =
*/__init__.py: IMP100, E402, F401
# we test various import patterns
Expand Down
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# .git-blame-ignore-revs
# mass formatted w/ ruff (2024-05-10)
c46b4b950ea77e9d18ab98885cda721b3de247c0
# (beta) mass formatted w/ ruff (2024-05-13)
11c92dc754cf1e93ed1910624c182aa244d3981c
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"ms-python.python",
"EditorConfig.editorconfig",
"ms-python.flake8",
"charliermarsh.ruff"
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Run the linter with:
make lint
```

The library uses [Black][black] for code formatting. Code must be formatted
The library uses [Ruff][ruff] for code formatting. Code must be formatted
with Black before PRs are submitted, otherwise CI will fail. Run the formatter
with:

Expand All @@ -391,7 +391,7 @@ make fmt
```

[api-keys]: https://dashboard.stripe.com/account/apikeys
[black]: https://github.com/ambv/black
[ruff]: https://github.com/astral-sh/ruff
[connect]: https://stripe.com/connect
[poetry]: https://github.com/sdispater/poetry
[stripe-mock]: https://github.com/stripe/stripe-mock
Expand Down
8 changes: 2 additions & 6 deletions examples/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def callback():
<p>Success! Account <code>{stripe_user_id}</code> is connected.</p>
<p>Click <a href="/deauthorize?stripe_user_id={stripe_user_id}">here</a> to
disconnect the account.</p>
""".format(
stripe_user_id=resp["stripe_user_id"]
)
""".format(stripe_user_id=resp["stripe_user_id"])


@app.route("/deauthorize")
Expand All @@ -49,9 +47,7 @@ def deauthorize():
return """
<p>Success! Account <code>{stripe_user_id}</code> is disconnected.</p>
<p>Click <a href="/">here</a> to restart the OAuth flow.</p>
""".format(
stripe_user_id=stripe_user_id
)
""".format(stripe_user_id=stripe_user_id)


if __name__ == "__main__":
Expand Down
33 changes: 9 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
[tool.black]
[tool.ruff]
# same as our black config
line-length = 79
target-version = [
"py35",
"py36",
"py37",
"py38",
"py39",
"py310",
# "py311", # black 21.12b0 doesn't
# "py312", # support these targets
]
exclude = '''
/(
\.eggs/
| \.git/
| \.tox/
| \.venv/
| _build/
| build/
| dist/
| venv/
)
'''
extend-exclude = ["build"]

[tool.ruff.format]
# currently the default value, but opt-out in the future
docstring-code-format = false

[tool.pyright]
include = [
"stripe",
"tests/test_generated_examples.py",
"tests/test_exports.py",
"tests/test_http_client.py"
"tests/test_http_client.py",
]
exclude = ["build", "**/__pycache__"]
reportMissingTypeArgument = true
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tox == 4.5.0
#Virtualenv 20.22.0 dropped support for all Python versions smaller or equal to Python 3.6.
virtualenv<20.22.0
pyright == 1.1.336
black == 22.8.0
ruff == 0.4.4
flake8
mypy == 1.7.0

Expand Down
1 change: 0 additions & 1 deletion stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,5 +584,4 @@ def __getattr__(name):
from stripe._webhook_endpoint_service import (
WebhookEndpointService as WebhookEndpointService,
)

# The end of the section generated from our OpenAPI spec
42 changes: 20 additions & 22 deletions stripe/_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -4179,7 +4179,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -4200,7 +4199,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down Expand Up @@ -4497,7 +4495,7 @@ def retrieve_capability(
cls,
account: str,
capability: str,
**params: Unpack["Account.RetrieveCapabilityParams"]
**params: Unpack["Account.RetrieveCapabilityParams"],
) -> "Capability":
"""
Retrieves information about the specified Account Capability.
Expand All @@ -4519,7 +4517,7 @@ async def retrieve_capability_async(
cls,
account: str,
capability: str,
**params: Unpack["Account.RetrieveCapabilityParams"]
**params: Unpack["Account.RetrieveCapabilityParams"],
) -> "Capability":
"""
Retrieves information about the specified Account Capability.
Expand All @@ -4541,7 +4539,7 @@ def modify_capability(
cls,
account: str,
capability: str,
**params: Unpack["Account.ModifyCapabilityParams"]
**params: Unpack["Account.ModifyCapabilityParams"],
) -> "Capability":
"""
Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
Expand All @@ -4563,7 +4561,7 @@ async def modify_capability_async(
cls,
account: str,
capability: str,
**params: Unpack["Account.ModifyCapabilityParams"]
**params: Unpack["Account.ModifyCapabilityParams"],
) -> "Capability":
"""
Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
Expand Down Expand Up @@ -4620,7 +4618,7 @@ async def list_capabilities_async(
def create_external_account(
cls,
account: str,
**params: Unpack["Account.CreateExternalAccountParams"]
**params: Unpack["Account.CreateExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Create an external account for a given account.
Expand All @@ -4640,7 +4638,7 @@ def create_external_account(
async def create_external_account_async(
cls,
account: str,
**params: Unpack["Account.CreateExternalAccountParams"]
**params: Unpack["Account.CreateExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Create an external account for a given account.
Expand All @@ -4661,7 +4659,7 @@ def retrieve_external_account(
cls,
account: str,
id: str,
**params: Unpack["Account.RetrieveExternalAccountParams"]
**params: Unpack["Account.RetrieveExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Retrieve a specified external account for a given account.
Expand All @@ -4682,7 +4680,7 @@ async def retrieve_external_account_async(
cls,
account: str,
id: str,
**params: Unpack["Account.RetrieveExternalAccountParams"]
**params: Unpack["Account.RetrieveExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Retrieve a specified external account for a given account.
Expand All @@ -4703,7 +4701,7 @@ def modify_external_account(
cls,
account: str,
id: str,
**params: Unpack["Account.ModifyExternalAccountParams"]
**params: Unpack["Account.ModifyExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Updates the metadata, account holder name, account holder type of a bank account belonging to
Expand Down Expand Up @@ -4731,7 +4729,7 @@ async def modify_external_account_async(
cls,
account: str,
id: str,
**params: Unpack["Account.ModifyExternalAccountParams"]
**params: Unpack["Account.ModifyExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Updates the metadata, account holder name, account holder type of a bank account belonging to
Expand Down Expand Up @@ -4759,7 +4757,7 @@ def delete_external_account(
cls,
account: str,
id: str,
**params: Unpack["Account.DeleteExternalAccountParams"]
**params: Unpack["Account.DeleteExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Delete a specified external account for a given account.
Expand All @@ -4780,7 +4778,7 @@ async def delete_external_account_async(
cls,
account: str,
id: str,
**params: Unpack["Account.DeleteExternalAccountParams"]
**params: Unpack["Account.DeleteExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Delete a specified external account for a given account.
Expand All @@ -4800,7 +4798,7 @@ async def delete_external_account_async(
def list_external_accounts(
cls,
account: str,
**params: Unpack["Account.ListExternalAccountsParams"]
**params: Unpack["Account.ListExternalAccountsParams"],
) -> ListObject[Union["BankAccount", "Card"]]:
"""
List external accounts for an account.
Expand All @@ -4820,7 +4818,7 @@ def list_external_accounts(
async def list_external_accounts_async(
cls,
account: str,
**params: Unpack["Account.ListExternalAccountsParams"]
**params: Unpack["Account.ListExternalAccountsParams"],
) -> ListObject[Union["BankAccount", "Card"]]:
"""
List external accounts for an account.
Expand Down Expand Up @@ -4917,7 +4915,7 @@ def retrieve_person(
cls,
account: str,
person: str,
**params: Unpack["Account.RetrievePersonParams"]
**params: Unpack["Account.RetrievePersonParams"],
) -> "Person":
"""
Retrieves an existing person.
Expand All @@ -4938,7 +4936,7 @@ async def retrieve_person_async(
cls,
account: str,
person: str,
**params: Unpack["Account.RetrievePersonParams"]
**params: Unpack["Account.RetrievePersonParams"],
) -> "Person":
"""
Retrieves an existing person.
Expand All @@ -4959,7 +4957,7 @@ def modify_person(
cls,
account: str,
person: str,
**params: Unpack["Account.ModifyPersonParams"]
**params: Unpack["Account.ModifyPersonParams"],
) -> "Person":
"""
Updates an existing person.
Expand All @@ -4980,7 +4978,7 @@ async def modify_person_async(
cls,
account: str,
person: str,
**params: Unpack["Account.ModifyPersonParams"]
**params: Unpack["Account.ModifyPersonParams"],
) -> "Person":
"""
Updates an existing person.
Expand All @@ -5001,7 +4999,7 @@ def delete_person(
cls,
account: str,
person: str,
**params: Unpack["Account.DeletePersonParams"]
**params: Unpack["Account.DeletePersonParams"],
) -> "Person":
"""
Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
Expand All @@ -5022,7 +5020,7 @@ async def delete_person_async(
cls,
account: str,
person: str,
**params: Unpack["Account.DeletePersonParams"]
**params: Unpack["Account.DeletePersonParams"],
) -> "Person":
"""
Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
Expand Down
2 changes: 0 additions & 2 deletions stripe/_account_notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -196,7 +195,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down
6 changes: 3 additions & 3 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,9 @@ def _args_for_request_with_retries(
generator = MultipartDataGenerator()
generator.add_params(params or {})
post_data = generator.get_post_data()
headers[
"Content-Type"
] = "multipart/form-data; boundary=%s" % (generator.boundary,)
headers["Content-Type"] = (
"multipart/form-data; boundary=%s" % (generator.boundary,)
)
else:
post_data = encoded_body
else:
Expand Down
2 changes: 0 additions & 2 deletions stripe/_apple_pay_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -238,7 +237,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down
Loading

0 comments on commit 252c34b

Please sign in to comment.