8000 Parameter types (#1078) · stripe/stripe-python@f41d521 · GitHub
[go: up one dir, main page]

Skip to content

Commit f41d521

Browse files
Parameter types (#1078)
1 parent b3a3da0 commit f41d521

File tree

104 files changed

+17259
-940
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+17259
-940
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ jobs:
9595

9696
- name: Typecheck with pyright
9797
run: make pyright
98+
# Pip won't install newer versions of pyright on python 3.6 (odd, because pyright is a node module)
99+
# so we skip running pyright, and do double duty on python 3.7 using the --pythonversion flag.
100+
if: matrix.python-version != '3.6'
101+
102+
- name: Typecheck with pyright
103+
run: make pyright PYRIGHT_ARGS="--pythonversion 3.6"
104+
if: matrix.python-version == '3.7'
98105

99106
- name: Test with pytest
100107
run: make ci-test

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ pyright: venv
3434
# we don't need to pass config-settings anyway because "editable_mode=compat" just
3535
# means to perform as these old versions of pip already do.
3636
pip install -e . --config-settings editable_mode=compat || pip install -e .
37-
@${VENV_NAME}/bin/pyright
37+
@${VENV_NAME}/bin/pyright --version
38+
@${VENV_NAME}/bin/pyright $(PYRIGHT_ARGS)
3839

3940
fmt: venv
4041
@${VENV_NAME}/bin/tox -e fmt

flake8_stripe/flake8_stripe.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class TypingImportsChecker:
2828
"TYPE_CHECKING",
2929
"Type",
3030
"TypedDict",
31+
"NotRequired",
3132
"Self",
33+
"Unpack",
3234
]
3335

3436
allowed_typing_imports = [
@@ -40,9 +42,10 @@ class TypingImportsChecker:
4042
"cast",
4143
"overload",
4244
"Dict",
45+
"Tuple",
4346
"List",
4447
"Generic",
45-
"Tuple",
48+
"Mapping",
4649
]
4750

4851
def __init__(self, tree: ast.AST):

stripe/api_resources/abstract/api_resource.py

Lines changed: 11 additions & 2 deletions
< 931D td data-grid-cell-id="diff-4656b48a9a21bc574de7c8bfb7e0aaa00241eb172da79110b30d6615685b64f3-6-12-1" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionNum-bgColor, var(--diffBlob-addition-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
from stripe import api_requestor, error, util
44
from stripe.stripe_object import StripeObject
55
from urllib.parse import quote_plus
6-
from typing import Any, ClassVar, Dict, Generic, Optional, TypeVar, cast
6+
from typing import (
7+
Any,
8+
ClassVar,
9+
Dict,
10+
Generic,
11+
Optional,
+
TypeVar,
13+
cast,
14+
Mapping,
15+
)
716

817
T = TypeVar("T", bound=StripeObject)
918

@@ -89,7 +98,7 @@ def _request_and_refresh(
8998
stripe_version: Optional[str] = None,
9099
stripe_account: Optional[str] = None,
91100
headers: Optional[Dict[str, str]] = None,
92-
params: Optional[Dict[str, Any]] = None,
101+
params: Optional[Mapping[str, Any]] = None,
93102
):
94103
obj = StripeObject._request(
95104
self,

0 commit comments

Comments
 (0)
0