From 40c663f4be579ea1451ae489055e9d1b381f33d6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:47:17 +0000 Subject: [PATCH 1/7] chore(internal): update deps (#572) --- mypy.ini | 2 +- requirements-dev.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 9bbce80a..1421450a 100644 --- a/mypy.ini +++ b/mypy.ini @@ -41,7 +41,7 @@ cache_fine_grained = True # ``` # Changing this codegen to make mypy happy would increase complexity # and would not be worth it. -disable_error_code = func-returns-value +disable_error_code = func-returns-value,overload-cannot-match # https://github.com/python/mypy/issues/12162 [mypy.overrides] diff --git a/requirements-dev.lock b/requirements-dev.lock index e07de0a7..e92095ce 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -48,7 +48,7 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.13.0 +mypy==1.14.1 mypy-extensions==1.0.0 # via mypy nest-asyncio==1.6.0 @@ -68,7 +68,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.390 +pyright==1.1.391 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 From 24ccfc8732a8c6e9819b37a9d30651fe1ab565fd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:43:34 +0000 Subject: [PATCH 2/7] chore(internal): bump pyright dependency (#574) --- requirements-dev.lock | 2 +- src/finch/_legacy_response.py | 12 ++++++++++-- src/finch/_response.py | 8 +++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index e92095ce..feacfcaf 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -68,7 +68,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.391 +pyright==1.1.392.post0 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 diff --git a/src/finch/_legacy_response.py b/src/finch/_legacy_response.py index ad595b48..80205937 100644 --- a/src/finch/_legacy_response.py +++ b/src/finch/_legacy_response.py @@ -262,7 +262,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if origin == LegacyAPIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") - if inspect.isclass(origin) and issubclass(origin, httpx.Response): + if inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) and issubclass(origin, httpx.Response): # Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response # and pass that class to our request functions. We cannot change the variance to be either # covariant or contravariant as that makes our usage of ResponseT illegal. We could construct @@ -272,7 +274,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") return cast(R, response) - if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): raise TypeError("Pydantic models must subclass our base model type, e.g. `from finch import BaseModel`") if ( diff --git a/src/finch/_response.py b/src/finch/_response.py index c1d11a9c..4f332557 100644 --- a/src/finch/_response.py +++ b/src/finch/_response.py @@ -214,7 +214,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") return cast(R, response) - if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): raise TypeError("Pydantic models must subclass our base model type, e.g. `from finch import BaseModel`") if ( From ae1b97a538f2eb075a8ff1f38ab8ab2e9ec0e2b6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:07:46 +0000 Subject: [PATCH 3/7] docs(raw responses): fix duplicate `the` (#575) --- src/finch/resources/access_tokens.py | 4 ++-- src/finch/resources/account.py | 4 ++-- src/finch/resources/connect/connect.py | 4 ++-- src/finch/resources/connect/sessions.py | 4 ++-- src/finch/resources/hris/benefits/benefits.py | 4 ++-- src/finch/resources/hris/benefits/individuals.py | 4 ++-- src/finch/resources/hris/company.py | 4 ++-- src/finch/resources/hris/directory.py | 4 ++-- src/finch/resources/hris/documents.py | 4 ++-- src/finch/resources/hris/employments.py | 4 ++-- src/finch/resources/hris/hris.py | 4 ++-- src/finch/resources/hris/individuals.py | 4 ++-- src/finch/resources/hris/pay_statements.py | 4 ++-- src/finch/resources/hris/payments.py | 4 ++-- src/finch/resources/jobs/automated.py | 4 ++-- src/finch/resources/jobs/jobs.py | 4 ++-- src/finch/resources/jobs/manual.py | 4 ++-- src/finch/resources/payroll/pay_groups.py | 4 ++-- src/finch/resources/payroll/payroll.py | 4 ++-- src/finch/resources/providers.py | 4 ++-- src/finch/resources/request_forwarding.py | 4 ++-- src/finch/resources/sandbox/company.py | 4 ++-- src/finch/resources/sandbox/connections/accounts.py | 4 ++-- src/finch/resources/sandbox/connections/connections.py | 4 ++-- src/finch/resources/sandbox/directory.py | 4 ++-- src/finch/resources/sandbox/employment.py | 4 ++-- src/finch/resources/sandbox/individual.py | 4 ++-- src/finch/resources/sandbox/jobs/configuration.py | 4 ++-- src/finch/resources/sandbox/jobs/jobs.py | 4 ++-- src/finch/resources/sandbox/payment.py | 4 ++-- src/finch/resources/sandbox/sandbox.py | 4 ++-- 31 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/finch/resources/access_tokens.py b/src/finch/resources/access_tokens.py index 6e442cff..7806ed89 100644 --- a/src/finch/resources/access_tokens.py +++ b/src/finch/resources/access_tokens.py @@ -21,7 +21,7 @@ class AccessTokens(SyncAPIResource): @cached_property def with_raw_response(self) -> AccessTokensWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -99,7 +99,7 @@ class AsyncAccessTokens(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAccessTokensWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/account.py b/src/finch/resources/account.py index 4f65a979..7e5658fb 100644 --- a/src/finch/resources/account.py +++ b/src/finch/resources/account.py @@ -20,7 +20,7 @@ class Account(SyncAPIResource): @cached_property def with_raw_response(self) -> AccountWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -79,7 +79,7 @@ class AsyncAccount(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAccountWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/connect/connect.py b/src/finch/resources/connect/connect.py index a6909d8a..dec0dd15 100644 --- a/src/finch/resources/connect/connect.py +++ b/src/finch/resources/connect/connect.py @@ -24,7 +24,7 @@ def sessions(self) -> Sessions: @cached_property def with_raw_response(self) -> ConnectWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def sessions(self) -> AsyncSessions: @cached_property def with_raw_response(self) -> AsyncConnectWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/connect/sessions.py b/src/finch/resources/connect/sessions.py index 1a4f3893..e878e2e5 100644 --- a/src/finch/resources/connect/sessions.py +++ b/src/finch/resources/connect/sessions.py @@ -28,7 +28,7 @@ class Sessions(SyncAPIResource): @cached_property def with_raw_response(self) -> SessionsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -166,7 +166,7 @@ class AsyncSessions(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSessionsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/benefits/benefits.py b/src/finch/resources/hris/benefits/benefits.py index 3305930f..724d9439 100644 --- a/src/finch/resources/hris/benefits/benefits.py +++ b/src/finch/resources/hris/benefits/benefits.py @@ -44,7 +44,7 @@ def individuals(self) -> Individuals: @cached_property def with_raw_response(self) -> BenefitsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -228,7 +228,7 @@ def individuals(self) -> AsyncIndividuals: @cached_property def with_raw_response(self) -> AsyncBenefitsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/benefits/individuals.py b/src/finch/resources/hris/benefits/individuals.py index 3545ee98..19ab83a7 100644 --- a/src/finch/resources/hris/benefits/individuals.py +++ b/src/finch/resources/hris/benefits/individuals.py @@ -31,7 +31,7 @@ class Individuals(SyncAPIResource): @cached_property def with_raw_response(self) -> IndividualsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -214,7 +214,7 @@ class AsyncIndividuals(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncIndividualsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/company.py b/src/finch/resources/hris/company.py index d1eb8491..e98ddb52 100644 --- a/src/finch/resources/hris/company.py +++ b/src/finch/resources/hris/company.py @@ -19,7 +19,7 @@ class CompanyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> CompanyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -59,7 +59,7 @@ class AsyncCompanyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCompanyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/directory.py b/src/finch/resources/hris/directory.py index 94a4451c..aa60f2f3 100644 --- a/src/finch/resources/hris/directory.py +++ b/src/finch/resources/hris/directory.py @@ -24,7 +24,7 @@ class Directory(SyncAPIResource): @cached_property def with_raw_response(self) -> DirectoryWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -130,7 +130,7 @@ class AsyncDirectory(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncDirectoryWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/documents.py b/src/finch/resources/hris/documents.py index 8ce6892c..4413f816 100644 --- a/src/finch/resources/hris/documents.py +++ b/src/finch/resources/hris/documents.py @@ -28,7 +28,7 @@ class Documents(SyncAPIResource): @cached_property def with_raw_response(self) -> DocumentsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -147,7 +147,7 @@ class AsyncDocuments(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncDocumentsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/employments.py b/src/finch/resources/hris/employments.py index 1a562194..14bdd1ad 100644 --- a/src/finch/resources/hris/employments.py +++ b/src/finch/resources/hris/employments.py @@ -24,7 +24,7 @@ class Employments(SyncAPIResource): @cached_property def with_raw_response(self) -> EmploymentsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -81,7 +81,7 @@ class AsyncEmployments(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncEmploymentsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/hris.py b/src/finch/resources/hris/hris.py index 32b91c31..79d9eee4 100644 --- a/src/finch/resources/hris/hris.py +++ b/src/finch/resources/hris/hris.py @@ -108,7 +108,7 @@ def benefits(self) -> Benefits: @cached_property def with_raw_response(self) -> HRISWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -161,7 +161,7 @@ def benefits(self) -> AsyncBenefits: @cached_property def with_raw_response(self) -> AsyncHRISWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/individuals.py b/src/finch/resources/hris/individuals.py index 7bf9b26b..1d5e4aae 100644 --- a/src/finch/resources/hris/individuals.py +++ b/src/finch/resources/hris/individuals.py @@ -24,7 +24,7 @@ class Individuals(SyncAPIResource): @cached_property def with_raw_response(self) -> IndividualsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -86,7 +86,7 @@ class AsyncIndividuals(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncIndividualsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/pay_statements.py b/src/finch/resources/hris/pay_statements.py index 818f4655..a4d919b5 100644 --- a/src/finch/resources/hris/pay_statements.py +++ b/src/finch/resources/hris/pay_statements.py @@ -24,7 +24,7 @@ class PayStatements(SyncAPIResource): @cached_property def with_raw_response(self) -> PayStatementsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -86,7 +86,7 @@ class AsyncPayStatements(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPayStatementsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/hris/payments.py b/src/finch/resources/hris/payments.py index 9f7667eb..f9e2010b 100644 --- a/src/finch/resources/hris/payments.py +++ b/src/finch/resources/hris/payments.py @@ -25,7 +25,7 @@ class Payments(SyncAPIResource): @cached_property def with_raw_response(self) -> PaymentsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -95,7 +95,7 @@ class AsyncPayments(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPaymentsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/jobs/automated.py b/src/finch/resources/jobs/automated.py index 669221d6..e3ccb1b2 100644 --- a/src/finch/resources/jobs/automated.py +++ b/src/finch/resources/jobs/automated.py @@ -29,7 +29,7 @@ class Automated(SyncAPIResource): @cached_property def with_raw_response(self) -> AutomatedWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -246,7 +246,7 @@ class AsyncAutomated(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAutomatedWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/jobs/jobs.py b/src/finch/resources/jobs/jobs.py index d6da244e..b108253c 100644 --- a/src/finch/resources/jobs/jobs.py +++ b/src/finch/resources/jobs/jobs.py @@ -36,7 +36,7 @@ def manual(self) -> Manual: @cached_property def with_raw_response(self) -> JobsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -65,7 +65,7 @@ def manual(self) -> AsyncManual: @cached_property def with_raw_response(self) -> AsyncJobsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/jobs/manual.py b/src/finch/resources/jobs/manual.py index bdc08576..3adee82b 100644 --- a/src/finch/resources/jobs/manual.py +++ b/src/finch/resources/jobs/manual.py @@ -19,7 +19,7 @@ class Manual(SyncAPIResource): @cached_property def with_raw_response(self) -> ManualWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -75,7 +75,7 @@ class AsyncManual(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncManualWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/payroll/pay_groups.py b/src/finch/resources/payroll/pay_groups.py index 5673be66..bcd7854f 100644 --- a/src/finch/resources/payroll/pay_groups.py +++ b/src/finch/resources/payroll/pay_groups.py @@ -25,7 +25,7 @@ class PayGroups(SyncAPIResource): @cached_property def with_raw_response(self) -> PayGroupsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -122,7 +122,7 @@ class AsyncPayGroups(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPayGroupsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/payroll/payroll.py b/src/finch/resources/payroll/payroll.py index d84fb628..ad2f510d 100644 --- a/src/finch/resources/payroll/payroll.py +++ b/src/finch/resources/payroll/payroll.py @@ -24,7 +24,7 @@ def pay_groups(self) -> PayGroups: @cached_property def with_raw_response(self) -> PayrollWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def pay_groups(self) -> AsyncPayGroups: @cached_property def with_raw_response(self) -> AsyncPayrollWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/providers.py b/src/finch/resources/providers.py index bb26ce7d..76fc8852 100644 --- a/src/finch/resources/providers.py +++ b/src/finch/resources/providers.py @@ -20,7 +20,7 @@ class Providers(SyncAPIResource): @cached_property def with_raw_response(self) -> ProvidersWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -61,7 +61,7 @@ class AsyncProviders(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncProvidersWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/request_forwarding.py b/src/finch/resources/request_forwarding.py index 578f1f70..bd015f56 100644 --- a/src/finch/resources/request_forwarding.py +++ b/src/finch/resources/request_forwarding.py @@ -26,7 +26,7 @@ class RequestForwarding(SyncAPIResource): @cached_property def with_raw_response(self) -> RequestForwardingWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -113,7 +113,7 @@ class AsyncRequestForwarding(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRequestForwardingWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/company.py b/src/finch/resources/sandbox/company.py index 12302429..b48d3d1d 100644 --- a/src/finch/resources/sandbox/company.py +++ b/src/finch/resources/sandbox/company.py @@ -27,7 +27,7 @@ class Company(SyncAPIResource): @cached_property def with_raw_response(self) -> CompanyWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -113,7 +113,7 @@ class AsyncCompany(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncCompanyWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/connections/accounts.py b/src/finch/resources/sandbox/connections/accounts.py index 8a1d088f..8ecae4ef 100644 --- a/src/finch/resources/sandbox/connections/accounts.py +++ b/src/finch/resources/sandbox/connections/accounts.py @@ -29,7 +29,7 @@ class Accounts(SyncAPIResource): @cached_property def with_raw_response(self) -> AccountsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -132,7 +132,7 @@ class AsyncAccounts(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAccountsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/connections/connections.py b/src/finch/resources/sandbox/connections/connections.py index dbd2c146..1da2f617 100644 --- a/src/finch/resources/sandbox/connections/connections.py +++ b/src/finch/resources/sandbox/connections/connections.py @@ -39,7 +39,7 @@ def accounts(self) -> Accounts: @cached_property def with_raw_response(self) -> ConnectionsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -113,7 +113,7 @@ def accounts(self) -> AsyncAccounts: @cached_property def with_raw_response(self) -> AsyncConnectionsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/directory.py b/src/finch/resources/sandbox/directory.py index 0c3a1501..6d2d4cb1 100644 --- a/src/finch/resources/sandbox/directory.py +++ b/src/finch/resources/sandbox/directory.py @@ -26,7 +26,7 @@ class Directory(SyncAPIResource): @cached_property def with_raw_response(self) -> DirectoryWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -82,7 +82,7 @@ class AsyncDirectory(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncDirectoryWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/employment.py b/src/finch/resources/sandbox/employment.py index 7a79c759..de6d01b8 100644 --- a/src/finch/resources/sandbox/employment.py +++ b/src/finch/resources/sandbox/employment.py @@ -29,7 +29,7 @@ class Employment(SyncAPIResource): @cached_property def with_raw_response(self) -> EmploymentWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -161,7 +161,7 @@ class AsyncEmployment(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncEmploymentWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/individual.py b/src/finch/resources/sandbox/individual.py index a6825c69..a2729ea6 100644 --- a/src/finch/resources/sandbox/individual.py +++ b/src/finch/resources/sandbox/individual.py @@ -28,7 +28,7 @@ class Individual(SyncAPIResource): @cached_property def with_raw_response(self) -> IndividualWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -146,7 +146,7 @@ class AsyncIndividual(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncIndividualWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/jobs/configuration.py b/src/finch/resources/sandbox/jobs/configuration.py index 6f2b1dd6..49616843 100644 --- a/src/finch/resources/sandbox/jobs/configuration.py +++ b/src/finch/resources/sandbox/jobs/configuration.py @@ -27,7 +27,7 @@ class Configuration(SyncAPIResource): @cached_property def with_raw_response(self) -> ConfigurationWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -106,7 +106,7 @@ class AsyncConfiguration(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncConfigurationWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/jobs/jobs.py b/src/finch/resources/sandbox/jobs/jobs.py index 2a94fa45..93c0d185 100644 --- a/src/finch/resources/sandbox/jobs/jobs.py +++ b/src/finch/resources/sandbox/jobs/jobs.py @@ -38,7 +38,7 @@ def configuration(self) -> Configuration: @cached_property def with_raw_response(self) -> JobsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -98,7 +98,7 @@ def configuration(self) -> AsyncConfiguration: @cached_property def with_raw_response(self) -> AsyncJobsWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/payment.py b/src/finch/resources/sandbox/payment.py index 6cd96253..ed6b1917 100644 --- a/src/finch/resources/sandbox/payment.py +++ b/src/finch/resources/sandbox/payment.py @@ -26,7 +26,7 @@ class Payment(SyncAPIResource): @cached_property def with_raw_response(self) -> PaymentWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -88,7 +88,7 @@ class AsyncPayment(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPaymentWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers diff --git a/src/finch/resources/sandbox/sandbox.py b/src/finch/resources/sandbox/sandbox.py index 10dfc5ae..cadeff1d 100644 --- a/src/finch/resources/sandbox/sandbox.py +++ b/src/finch/resources/sandbox/sandbox.py @@ -96,7 +96,7 @@ def jobs(self) -> Jobs: @cached_property def with_raw_response(self) -> SandboxWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers @@ -145,7 +145,7 @@ def jobs(self) -> AsyncJobs: @cached_property def with_raw_response(self) -> AsyncSandboxWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers From 6b6b36cf740f3d403b8f874f9d6b6b56c9942fe4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 10:19:37 +0000 Subject: [PATCH 4/7] fix(tests): make test_get_platform less flaky (#576) --- tests/test_client.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 8ff4db44..52d6f178 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,6 +6,7 @@ import os import sys import json +import time import asyncio import inspect import subprocess @@ -1869,10 +1870,20 @@ async def test_main() -> None: [sys.executable, "-c", test_code], text=True, ) as process: - try: - process.wait(2) - if process.returncode: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") - except subprocess.TimeoutExpired as e: - process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") from e + timeout = 10 # seconds + + start_time = time.monotonic() + while True: + return_code = process.poll() + if return_code is not None: + if return_code != 0: + raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") + + # success + break + + if time.monotonic() - start_time > timeout: + process.kill() + raise AssertionError("calling get_platform using asyncify resulted in a hung process") + + time.sleep(0.1) From 54f644aacd018a5bbc7a76e530f4fe5ceec8d874 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:09:14 +0000 Subject: [PATCH 5/7] chore(internal): avoid pytest-asyncio deprecation warning (#577) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ede07c4a..666fb254 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,6 +129,7 @@ testpaths = ["tests"] addopts = "--tb=short" xfail_strict = true asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" filterwarnings = [ "error" ] From ed9a105b2ac4ee283a191fdecf26105ed4aa62ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:00:17 +0000 Subject: [PATCH 6/7] chore(internal): minor style changes (#578) --- src/finch/_legacy_response.py | 4 ++-- src/finch/_response.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/finch/_legacy_response.py b/src/finch/_legacy_response.py index 80205937..5f1c724a 100644 --- a/src/finch/_legacy_response.py +++ b/src/finch/_legacy_response.py @@ -198,6 +198,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to and is_annotated_type(cast_to): cast_to = extract_type_arg(cast_to, 0) + origin = get_origin(cast_to) or cast_to + if self._stream: if to: if not is_stream_class_type(to): @@ -254,8 +256,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, HttpxBinaryResponseContent): return cast(R, cast_to(response)) # type: ignore diff --git a/src/finch/_response.py b/src/finch/_response.py index 4f332557..a1ed6798 100644 --- a/src/finch/_response.py +++ b/src/finch/_response.py @@ -136,6 +136,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to and is_annotated_type(cast_to): cast_to = extract_type_arg(cast_to, 0) + origin = get_origin(cast_to) or cast_to + if self._is_sse_stream: if to: if not is_stream_class_type(to): @@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - origin = get_origin(cast_to) or cast_to - # handle the legacy binary response case if inspect.isclass(cast_to) and cast_to.__name__ == "HttpxBinaryResponseContent": return cast(R, cast_to(response)) # type: ignore From 93393dd0c8f09a3d8cb963b0b0604bce1b5e42ed Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:00:44 +0000 Subject: [PATCH 7/7] release: 1.13.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ pyproject.toml | 2 +- src/finch/_version.py | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 690002df..c4bf1b6c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.13.2" + ".": "1.13.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 336b9074..8a3f5f5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 1.13.3 (2025-01-21) + +Full Changelog: [v1.13.2...v1.13.3](https://github.com/Finch-API/finch-api-python/compare/v1.13.2...v1.13.3) + +### Bug Fixes + +* **tests:** make test_get_platform less flaky ([#576](https://github.com/Finch-API/finch-api-python/issues/576)) ([6b6b36c](https://github.com/Finch-API/finch-api-python/commit/6b6b36cf740f3d403b8f874f9d6b6b56c9942fe4)) + + +### Chores + +* **internal:** avoid pytest-asyncio deprecation warning ([#577](https://github.com/Finch-API/finch-api-python/issues/577)) ([54f644a](https://github.com/Finch-API/finch-api-python/commit/54f644aacd018a5bbc7a76e530f4fe5ceec8d874)) +* **internal:** bump pyright dependency ([#574](https://github.com/Finch-API/finch-api-python/issues/574)) ([24ccfc8](https://github.com/Finch-API/finch-api-python/commit/24ccfc8732a8c6e9819b37a9d30651fe1ab565fd)) +* **internal:** minor style changes ([#578](https://github.com/Finch-API/finch-api-python/issues/578)) ([ed9a105](https://github.com/Finch-API/finch-api-python/commit/ed9a105b2ac4ee283a191fdecf26105ed4aa62ad)) +* **internal:** update deps ([#572](https://github.com/Finch-API/finch-api-python/issues/572)) ([40c663f](https://github.com/Finch-API/finch-api-python/commit/40c663f4be579ea1451ae489055e9d1b381f33d6)) + + +### Documentation + +* **raw responses:** fix duplicate `the` ([#575](https://github.com/Finch-API/finch-api-python/issues/575)) ([ae1b97a](https://github.com/Finch-API/finch-api-python/commit/ae1b97a538f2eb075a8ff1f38ab8ab2e9ec0e2b6)) + ## 1.13.2 (2025-01-10) Full Changelog: [v1.13.1...v1.13.2](https://github.com/Finch-API/finch-api-python/compare/v1.13.1...v1.13.2) diff --git a/pyproject.toml b/pyproject.toml index 666fb254..62f04176 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "1.13.2" +version = "1.13.3" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/finch/_version.py b/src/finch/_version.py index ab1e4b35..58d395a6 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "finch" -__version__ = "1.13.2" # x-release-please-version +__version__ = "1.13.3" # x-release-please-version