Skip to content

Commit

Permalink
chore(internal): bump pyright / mypy version (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Oct 4, 2024
1 parent e704a5a commit 23f3053
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
mypy==1.10.1
mypy==1.11.2
mypy-extensions==1.0.0
# via mypy
nodeenv==1.8.0
Expand All @@ -103,7 +103,7 @@ pydantic-core==2.18.2
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.374
pyright==1.1.380
pytest==7.1.1
# via pytest-asyncio
pytest-asyncio==0.21.1
Expand Down
7 changes: 4 additions & 3 deletions src/anthropic/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,13 @@ def file_from_path(path: str) -> FileTypes:

def get_required_header(headers: HeadersLike, header: str) -> str:
lower_header = header.lower()
if isinstance(headers, Mapping):
for k, v in headers.items():
if is_mapping_t(headers):
# mypy doesn't understand the type narrowing here
for k, v in headers.items(): # type: ignore
if k.lower() == lower_header and isinstance(v, str):
return v

""" to deal with the case where the header looks like Stainless-Event-Id """
# to deal with the case where the header looks like Stainless-Event-Id
intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize())

for normalized_header in [header, lower_header, header.upper(), intercaps_header]:
Expand Down
3 changes: 2 additions & 1 deletion src/anthropic/lib/vertex/_auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any, cast

from .._extras import google_auth

Expand All @@ -21,6 +21,7 @@ def load_auth(*, project_id: str | None) -> tuple[Credentials, str]:
credentials, loaded_project_id = google_auth.default(
scopes=["https://www.googleapis.com/auth/cloud-platform"],
)
credentials = cast(Any, credentials)
credentials.refresh(Request())

if not project_id:
Expand Down

0 comments on commit 23f3053

Please sign in to comment.