Skip to content

Commit 14c8df0

Browse files
chore(internal): reformat imports (#216)
1 parent 9adf490 commit 14c8df0

34 files changed

+284
-286
lines changed

pyproject.toml

+18-19
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ Repository = "https://github.com/Finch-API/finch-api-python"
4646
[tool.rye]
4747
managed = true
4848
dev-dependencies = [
49-
# version pins are in requirements-dev.lock
50-
"pyright",
51-
"mypy",
52-
"black",
53-
"respx",
54-
"pytest",
55-
"pytest-asyncio",
56-
"ruff",
57-
"time-machine",
58-
"nox",
49+
"pyright==1.1.332",
50+
"mypy==1.7.1",
51+
"black==23.3.0",
52+
"respx==0.20.2",
53+
"pytest==7.1.1",
54+
"pytest-asyncio==0.21.1",
55+
"ruff==0.0.282",
56+
"isort==5.10.1",
57+
"time-machine==2.9.0",
58+
"nox==2023.4.22",
5959
"dirty-equals>=0.6.0",
6060

6161
]
@@ -65,10 +65,12 @@ format = { chain = [
6565
"format:black",
6666
"format:docs",
6767
"format:ruff",
68+
"format:isort",
6869
]}
6970
"format:black" = "black ."
7071
"format:docs" = "python bin/blacken-docs.py README.md api.md"
7172
"format:ruff" = "ruff --fix ."
73+
"format:isort" = "isort ."
7274

7375
"check:ruff" = "ruff ."
7476

@@ -123,13 +125,16 @@ reportImplicitOverride = true
123125
reportImportCycles = false
124126
reportPrivateUsage = false
125127

128+
[tool.isort]
129+
profile = "black"
130+
length_sort = true
131+
extra_standard_library = ["typing_extensions"]
132+
126133
[tool.ruff]
127134
line-length = 120
128-
output-format = "grouped"
135+
format = "grouped"
129136
target-version = "py37"
130137
select = [
131-
# isort
132-
"I",
133138
# remove unused imports
134139
"F401",
135140
# bare except statements
@@ -147,12 +152,6 @@ unfixable = [
147152
]
148153
ignore-init-module-imports = true
149154

150-
[tool.ruff.lint.isort]
151-
length-sort = true
152-
length-sort-straight = true
153-
combine-as-imports = true
154-
extra-standard-library = ["typing_extensions"]
155-
known-first-party = ["finch", "tests"]
156155

157156
[tool.ruff.per-file-ignores]
158157
"bin/**.py" = ["T201", "T203"]

requirements-dev.lock

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ httpcore==1.0.2
2525
httpx==0.25.2
2626
idna==3.4
2727
iniconfig==2.0.0
28+
isort==5.10.1
2829
mypy==1.7.1
2930
mypy-extensions==1.0.0
3031
nodeenv==1.8.0
@@ -42,7 +43,7 @@ pytest-asyncio==0.21.1
4243
python-dateutil==2.8.2
4344
pytz==2023.3.post1
4445
respx==0.20.2
45-
ruff==0.1.7
46+
ruff==0.0.282
4647
six==1.16.0
4748
sniffio==1.3.0
4849
time-machine==2.9.0

src/finch/_client.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
AsyncTransport,
2323
RequestOptions,
2424
)
25-
from ._utils import (
26-
is_given,
27-
get_async_library,
28-
)
25+
from ._utils import is_given, get_async_library
2926
from ._version import __version__
30-
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
27+
from ._streaming import Stream as Stream
28+
from ._streaming import AsyncStream as AsyncStream
3129
from ._exceptions import APIStatusError
3230
from ._base_client import (
3331
DEFAULT_LIMITS,

src/finch/_compat.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,21 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001
4343

4444
else:
4545
if PYDANTIC_V2:
46-
from pydantic.v1.typing import (
47-
get_args as get_args,
48-
is_union as is_union,
49-
get_origin as get_origin,
50-
is_typeddict as is_typeddict,
51-
is_literal_type as is_literal_type,
52-
)
53-
from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
46+
from pydantic.v1.typing import get_args as get_args
47+
from pydantic.v1.typing import is_union as is_union
48+
from pydantic.v1.typing import get_origin as get_origin
49+
from pydantic.v1.typing import is_typeddict as is_typeddict
50+
from pydantic.v1.typing import is_literal_type as is_literal_type
51+
from pydantic.v1.datetime_parse import parse_date as parse_date
52+
from pydantic.v1.datetime_parse import parse_datetime as parse_datetime
5453
else:
55-
from pydantic.typing import (
56-
get_args as get_args,
57-
is_union as is_union,
58-
get_origin as get_origin,
59-
is_typeddict as is_typeddict,
60-
is_literal_type as is_literal_type,
61-
)
62-
from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
54+
from pydantic.typing import get_args as get_args
55+
from pydantic.typing import is_union as is_union
56+
from pydantic.typing import get_origin as get_origin
57+
from pydantic.typing import is_typeddict as is_typeddict
58+
from pydantic.typing import is_literal_type as is_literal_type
59+
from pydantic.datetime_parse import parse_date as parse_date
60+
from pydantic.datetime_parse import parse_datetime as parse_datetime
6361

6462

6563
# refactored config

src/finch/_models.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@
3030
AnyMapping,
3131
HttpxRequestFiles,
3232
)
33-
from ._utils import is_list, is_given, is_mapping, parse_date, parse_datetime, strip_not_given
33+
from ._utils import (
34+
is_list,
35+
is_given,
36+
is_mapping,
37+
parse_date,
38+
parse_datetime,
39+
strip_not_given,
40+
)
41+
from ._compat import PYDANTIC_V2, ConfigDict
42+
from ._compat import GenericModel as BaseGenericModel
3443
from ._compat import (
35-
PYDANTIC_V2,
36-
ConfigDict,
37-
GenericModel as BaseGenericModel,
3844
get_args,
3945
is_union,
4046
parse_obj,

src/finch/_types.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@
1919
Sequence,
2020
AsyncIterator,
2121
)
22-
from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
22+
from typing_extensions import (
23+
Literal,
24+
Protocol,
25+
TypeAlias,
26+
TypedDict,
27+
override,
28+
runtime_checkable,
29+
)
2330

2431
import pydantic
2532
from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport

src/finch/_utils/__init__.py

+36-40
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
from ._proxy import LazyProxy as LazyProxy
2-
from ._utils import (
3-
flatten as flatten,
4-
is_dict as is_dict,
5-
is_list as is_list,
6-
is_given as is_given,
7-
is_tuple as is_tuple,
8-
is_mapping as is_mapping,
9-
is_tuple_t as is_tuple_t,
10-
parse_date as parse_date,
11-
is_sequence as is_sequence,
12-
coerce_float as coerce_float,
13-
is_list_type as is_list_type,
14-
is_mapping_t as is_mapping_t,
15-
removeprefix as removeprefix,
16-
removesuffix as removesuffix,
17-
extract_files as extract_files,
18-
is_sequence_t as is_sequence_t,
19-
is_union_type as is_union_type,
20-
required_args as required_args,
21-
coerce_boolean as coerce_boolean,
22-
coerce_integer as coerce_integer,
23-
file_from_path as file_from_path,
24-
parse_datetime as parse_datetime,
25-
strip_not_given as strip_not_given,
26-
deepcopy_minimal as deepcopy_minimal,
27-
extract_type_arg as extract_type_arg,
28-
is_required_type as is_required_type,
29-
get_async_library as get_async_library,
30-
is_annotated_type as is_annotated_type,
31-
maybe_coerce_float as maybe_coerce_float,
32-
get_required_header as get_required_header,
33-
maybe_coerce_boolean as maybe_coerce_boolean,
34-
maybe_coerce_integer as maybe_coerce_integer,
35-
strip_annotated_type as strip_annotated_type,
36-
)
37-
from ._transform import (
38-
PropertyInfo as PropertyInfo,
39-
transform as transform,
40-
maybe_transform as maybe_transform,
41-
)
2+
from ._utils import flatten as flatten
3+
from ._utils import is_dict as is_dict
4+
from ._utils import is_list as is_list
5+
from ._utils import is_given as is_given
6+
from ._utils import is_tuple as is_tuple
7+
from ._utils import is_mapping as is_mapping
8+
from ._utils import is_tuple_t as is_tuple_t
9+
from ._utils import parse_date as parse_date
10+
from ._utils import is_sequence as is_sequence
11+
from ._utils import coerce_float as coerce_float
12+
from ._utils import is_list_type as is_list_type
13+
from ._utils import is_mapping_t as is_mapping_t
14+
from ._utils import removeprefix as removeprefix
15+
from ._utils import removesuffix as removesuffix
16+
from ._utils import extract_files as extract_files
17+
from ._utils import is_sequence_t as is_sequence_t
18+
from ._utils import is_union_type as is_union_type
19+
from ._utils import required_args as required_args
20+
from ._utils import coerce_boolean as coerce_boolean
21+
from ._utils import coerce_integer as coerce_integer
22+
from ._utils import file_from_path as file_from_path
23+
from ._utils import parse_datetime as parse_datetime
24+
from ._utils import strip_not_given as strip_not_given
25+
from ._utils import deepcopy_minimal as deepcopy_minimal
26+
from ._utils import extract_type_arg as extract_type_arg
27+
from ._utils import is_required_type as is_required_type
28+
from ._utils import get_async_library as get_async_library
29+
from ._utils import is_annotated_type as is_annotated_type
30+
from ._utils import maybe_coerce_float as maybe_coerce_float
31+
from ._utils import get_required_header as get_required_header
32+
from ._utils import maybe_coerce_boolean as maybe_coerce_boolean
33+
from ._utils import maybe_coerce_integer as maybe_coerce_integer
34+
from ._utils import strip_annotated_type as strip_annotated_type
35+
from ._transform import PropertyInfo as PropertyInfo
36+
from ._transform import transform as transform
37+
from ._transform import maybe_transform as maybe_transform

src/finch/_utils/_utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
import sniffio
2222

2323
from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike
24-
from .._compat import is_union as _is_union, parse_date as parse_date, parse_datetime as parse_datetime
24+
from .._compat import is_union as _is_union
25+
from .._compat import parse_date as parse_date
26+
from .._compat import parse_datetime as parse_datetime
2527

2628
_T = TypeVar("_T")
2729
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])

src/finch/resources/__init__.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22

33
from .hris import HRIS, AsyncHRIS, HRISWithRawResponse, AsyncHRISWithRawResponse
44
from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse
5-
from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse
5+
from .account import (
6+
Account,
7+
AsyncAccount,
8+
AccountWithRawResponse,
9+
AsyncAccountWithRawResponse,
10+
)
611
from .webhooks import Webhooks, AsyncWebhooks
7-
from .providers import Providers, AsyncProviders, ProvidersWithRawResponse, AsyncProvidersWithRawResponse
12+
from .providers import (
13+
Providers,
14+
AsyncProviders,
15+
ProvidersWithRawResponse,
16+
AsyncProvidersWithRawResponse,
17+
)
818
from .request_forwarding import (
919
RequestForwarding,
1020
AsyncRequestForwarding,

src/finch/resources/account.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,10 @@
77
import httpx
88

99
from ..types import Introspection, DisconnectResponse
10-
from .._types import (
11-
NOT_GIVEN,
12-
Body,
13-
Query,
14-
Headers,
15-
NotGiven,
16-
)
10+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1711
from .._resource import SyncAPIResource, AsyncAPIResource
1812
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
19-
from .._base_client import (
20-
make_request_options,
21-
)
13+
from .._base_client import make_request_options
2214

2315
if TYPE_CHECKING:
2416
from .._client import Finch, AsyncFinch

src/finch/resources/hris/__init__.py

+30-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,36 @@
77
CompanyResourceWithRawResponse,
88
AsyncCompanyResourceWithRawResponse,
99
)
10-
from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse
11-
from .payments import Payments, AsyncPayments, PaymentsWithRawResponse, AsyncPaymentsWithRawResponse
12-
from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse
13-
from .employments import Employments, AsyncEmployments, EmploymentsWithRawResponse, AsyncEmploymentsWithRawResponse
14-
from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse
10+
from .benefits import (
11+
Benefits,
12+
AsyncBenefits,
13+
BenefitsWithRawResponse,
14+
AsyncBenefitsWithRawResponse,
15+
)
16+
from .payments import (
17+
Payments,
18+
AsyncPayments,
19+
PaymentsWithRawResponse,
20+
AsyncPaymentsWithRawResponse,
21+
)
22+
from .directory import (
23+
Directory,
24+
AsyncDirectory,
25+
DirectoryWithRawResponse,
26+
AsyncDirectoryWithRawResponse,
27+
)
28+
from .employments import (
29+
Employments,
30+
AsyncEmployments,
31+
EmploymentsWithRawResponse,
32+
AsyncEmploymentsWithRawResponse,
33+
)
34+
from .individuals import (
35+
Individuals,
36+
AsyncIndividuals,
37+
IndividualsWithRawResponse,
38+
AsyncIndividualsWithRawResponse,
39+
)
1540
from .pay_statements import (
1641
PayStatements,
1742
AsyncPayStatements,

src/finch/resources/hris/benefits/__init__.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# File generated from our OpenAPI spec by Stainless.
22

3-
from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse
4-
from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse
3+
from .benefits import (
4+
Benefits,
5+
AsyncBenefits,
6+
BenefitsWithRawResponse,
7+
AsyncBenefitsWithRawResponse,
8+
)
9+
from .individuals import (
10+
Individuals,
11+
AsyncIndividuals,
12+
IndividualsWithRawResponse,
13+
AsyncIndividualsWithRawResponse,
14+
)
515

616
__all__ = [
717
"Individuals",

0 commit comments

Comments
 (0)