Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(internal): reformat imports #216

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ Repository = "https://github.com/Finch-API/finch-api-python"
[tool.rye]
managed = true
dev-dependencies = [
# version pins are in requirements-dev.lock
"pyright",
"mypy",
"black",
"respx",
"pytest",
"pytest-asyncio",
"ruff",
"time-machine",
"nox",
"pyright==1.1.332",
"mypy==1.7.1",
"black==23.3.0",
"respx==0.20.2",
"pytest==7.1.1",
"pytest-asyncio==0.21.1",
"ruff==0.0.282",
"isort==5.10.1",
"time-machine==2.9.0",
"nox==2023.4.22",
"dirty-equals>=0.6.0",

]
Expand All @@ -65,10 +65,12 @@ format = { chain = [
"format:black",
"format:docs",
"format:ruff",
"format:isort",
]}
"format:black" = "black ."
"format:docs" = "python bin/blacken-docs.py README.md api.md"
"format:ruff" = "ruff --fix ."
"format:isort" = "isort ."

"check:ruff" = "ruff ."

Expand Down Expand Up @@ -123,13 +125,16 @@ reportImplicitOverride = true
reportImportCycles = false
reportPrivateUsage = false

[tool.isort]
profile = "black"
length_sort = true
extra_standard_library = ["typing_extensions"]

[tool.ruff]
line-length = 120
output-format = "grouped"
format = "grouped"
target-version = "py37"
select = [
# isort
"I",
# remove unused imports
"F401",
# bare except statements
Expand All @@ -147,12 +152,6 @@ unfixable = [
]
ignore-init-module-imports = true

[tool.ruff.lint.isort]
length-sort = true
length-sort-straight = true
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
known-first-party = ["finch", "tests"]

[tool.ruff.per-file-ignores]
"bin/**.py" = ["T201", "T203"]
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ httpcore==1.0.2
httpx==0.25.2
idna==3.4
iniconfig==2.0.0
isort==5.10.1
mypy==1.7.1
mypy-extensions==1.0.0
nodeenv==1.8.0
Expand All @@ -42,7 +43,7 @@ pytest-asyncio==0.21.1
python-dateutil==2.8.2
pytz==2023.3.post1
respx==0.20.2
ruff==0.1.7
ruff==0.0.282
six==1.16.0
sniffio==1.3.0
time-machine==2.9.0
Expand Down
8 changes: 3 additions & 5 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
AsyncTransport,
RequestOptions,
)
from ._utils import (
is_given,
get_async_library,
)
from ._utils import is_given, get_async_library
from ._version import __version__
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._streaming import Stream as Stream
from ._streaming import AsyncStream as AsyncStream
from ._exceptions import APIStatusError
from ._base_client import (
DEFAULT_LIMITS,
Expand Down
30 changes: 14 additions & 16 deletions src/finch/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,21 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001

else:
if PYDANTIC_V2:
from pydantic.v1.typing import (
get_args as get_args,
is_union as is_union,
get_origin as get_origin,
is_typeddict as is_typeddict,
is_literal_type as is_literal_type,
)
from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
from pydantic.v1.typing import get_args as get_args
from pydantic.v1.typing import is_union as is_union
from pydantic.v1.typing import get_origin as get_origin
from pydantic.v1.typing import is_typeddict as is_typeddict
from pydantic.v1.typing import is_literal_type as is_literal_type
from pydantic.v1.datetime_parse import parse_date as parse_date
from pydantic.v1.datetime_parse import parse_datetime as parse_datetime
else:
from pydantic.typing import (
get_args as get_args,
is_union as is_union,
get_origin as get_origin,
is_typeddict as is_typeddict,
is_literal_type as is_literal_type,
)
from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
from pydantic.typing import get_args as get_args
from pydantic.typing import is_union as is_union
from pydantic.typing import get_origin as get_origin
from pydantic.typing import is_typeddict as is_typeddict
from pydantic.typing import is_literal_type as is_literal_type
from pydantic.datetime_parse import parse_date as parse_date
from pydantic.datetime_parse import parse_datetime as parse_datetime


# refactored config
Expand Down
14 changes: 10 additions & 4 deletions src/finch/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@
AnyMapping,
HttpxRequestFiles,
)
from ._utils import is_list, is_given, is_mapping, parse_date, parse_datetime, strip_not_given
from ._utils import (
is_list,
is_given,
is_mapping,
parse_date,
parse_datetime,
strip_not_given,
)
from ._compat import PYDANTIC_V2, ConfigDict
from ._compat import GenericModel as BaseGenericModel
from ._compat import (
PYDANTIC_V2,
ConfigDict,
GenericModel as BaseGenericModel,
get_args,
is_union,
parse_obj,
Expand Down
9 changes: 8 additions & 1 deletion src/finch/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
Sequence,
AsyncIterator,
)
from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
from typing_extensions import (
Literal,
Protocol,
TypeAlias,
TypedDict,
override,
runtime_checkable,
)

import pydantic
from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport
Expand Down
76 changes: 36 additions & 40 deletions src/finch/_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
from ._proxy import LazyProxy as LazyProxy
from ._utils import (
flatten as flatten,
is_dict as is_dict,
is_list as is_list,
is_given as is_given,
is_tuple as is_tuple,
is_mapping as is_mapping,
is_tuple_t as is_tuple_t,
parse_date as parse_date,
is_sequence as is_sequence,
coerce_float as coerce_float,
is_list_type as is_list_type,
is_mapping_t as is_mapping_t,
removeprefix as removeprefix,
removesuffix as removesuffix,
extract_files as extract_files,
is_sequence_t as is_sequence_t,
is_union_type as is_union_type,
required_args as required_args,
coerce_boolean as coerce_boolean,
coerce_integer as coerce_integer,
file_from_path as file_from_path,
parse_datetime as parse_datetime,
strip_not_given as strip_not_given,
deepcopy_minimal as deepcopy_minimal,
extract_type_arg as extract_type_arg,
is_required_type as is_required_type,
get_async_library as get_async_library,
is_annotated_type as is_annotated_type,
maybe_coerce_float as maybe_coerce_float,
get_required_header as get_required_header,
maybe_coerce_boolean as maybe_coerce_boolean,
maybe_coerce_integer as maybe_coerce_integer,
strip_annotated_type as strip_annotated_type,
)
from ._transform import (
PropertyInfo as PropertyInfo,
transform as transform,
maybe_transform as maybe_transform,
)
from ._utils import flatten as flatten
from ._utils import is_dict as is_dict
from ._utils import is_list as is_list
from ._utils import is_given as is_given
from ._utils import is_tuple as is_tuple
from ._utils import is_mapping as is_mapping
from ._utils import is_tuple_t as is_tuple_t
from ._utils import parse_date as parse_date
from ._utils import is_sequence as is_sequence
from ._utils import coerce_float as coerce_float
from ._utils import is_list_type as is_list_type
from ._utils import is_mapping_t as is_mapping_t
from ._utils import removeprefix as removeprefix
from ._utils import removesuffix as removesuffix
from ._utils import extract_files as extract_files
from ._utils import is_sequence_t as is_sequence_t
from ._utils import is_union_type as is_union_type
from ._utils import required_args as required_args
from ._utils import coerce_boolean as coerce_boolean
from ._utils import coerce_integer as coerce_integer
from ._utils import file_from_path as file_from_path
from ._utils import parse_datetime as parse_datetime
from ._utils import strip_not_given as strip_not_given
from ._utils import deepcopy_minimal as deepcopy_minimal
from ._utils import extract_type_arg as extract_type_arg
from ._utils import is_required_type as is_required_type
from ._utils import get_async_library as get_async_library
from ._utils import is_annotated_type as is_annotated_type
from ._utils import maybe_coerce_float as maybe_coerce_float
from ._utils import get_required_header as get_required_header
from ._utils import maybe_coerce_boolean as maybe_coerce_boolean
from ._utils import maybe_coerce_integer as maybe_coerce_integer
from ._utils import strip_annotated_type as strip_annotated_type
from ._transform import PropertyInfo as PropertyInfo
from ._transform import transform as transform
from ._transform import maybe_transform as maybe_transform
4 changes: 3 additions & 1 deletion src/finch/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import sniffio

from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike
from .._compat import is_union as _is_union, parse_date as parse_date, parse_datetime as parse_datetime
from .._compat import is_union as _is_union
from .._compat import parse_date as parse_date
from .._compat import parse_datetime as parse_datetime

_T = TypeVar("_T")
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
Expand Down
14 changes: 12 additions & 2 deletions src/finch/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@

from .hris import HRIS, AsyncHRIS, HRISWithRawResponse, AsyncHRISWithRawResponse
from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse
from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse
from .account import (
Account,
AsyncAccount,
AccountWithRawResponse,
AsyncAccountWithRawResponse,
)
from .webhooks import Webhooks, AsyncWebhooks
from .providers import Providers, AsyncProviders, ProvidersWithRawResponse, AsyncProvidersWithRawResponse
from .providers import (
Providers,
AsyncProviders,
ProvidersWithRawResponse,
AsyncProvidersWithRawResponse,
)
from .request_forwarding import (
RequestForwarding,
AsyncRequestForwarding,
Expand Down
12 changes: 2 additions & 10 deletions src/finch/resources/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@
import httpx

from ..types import Introspection, DisconnectResponse
from .._types import (
NOT_GIVEN,
Body,
Query,
Headers,
NotGiven,
)
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from .._base_client import (
make_request_options,
)
from .._base_client import make_request_options

if TYPE_CHECKING:
from .._client import Finch, AsyncFinch
Expand Down
35 changes: 30 additions & 5 deletions src/finch/resources/hris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,36 @@
CompanyResourceWithRawResponse,
AsyncCompanyResourceWithRawResponse,
)
from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse
from .payments import Payments, AsyncPayments, PaymentsWithRawResponse, AsyncPaymentsWithRawResponse
from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse
from .employments import Employments, AsyncEmployments, EmploymentsWithRawResponse, AsyncEmploymentsWithRawResponse
from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse
from .benefits import (
Benefits,
AsyncBenefits,
BenefitsWithRawResponse,
AsyncBenefitsWithRawResponse,
)
from .payments import (
Payments,
AsyncPayments,
PaymentsWithRawResponse,
AsyncPaymentsWithRawResponse,
)
from .directory import (
Directory,
AsyncDirectory,
DirectoryWithRawResponse,
AsyncDirectoryWithRawResponse,
)
from .employments import (
Employments,
AsyncEmployments,
EmploymentsWithRawResponse,
AsyncEmploymentsWithRawResponse,
)
from .individuals import (
Individuals,
AsyncIndividuals,
IndividualsWithRawResponse,
AsyncIndividualsWithRawResponse,
)
from .pay_statements import (
PayStatements,
AsyncPayStatements,
Expand Down
14 changes: 12 additions & 2 deletions src/finch/resources/hris/benefits/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# File generated from our OpenAPI spec by Stainless.

from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse
from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse
from .benefits import (
Benefits,
AsyncBenefits,
BenefitsWithRawResponse,
AsyncBenefitsWithRawResponse,
)
from .individuals import (
Individuals,
AsyncIndividuals,
IndividualsWithRawResponse,
AsyncIndividualsWithRawResponse,
)

__all__ = [
"Individuals",
Expand Down
Loading