Skip to content

Commit 81a6e2f

Browse files
chore(internal): reformat imports (#213)
1 parent ff189d8 commit 81a6e2f

34 files changed

+280
-277
lines changed

pyproject.toml

+19-18
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-
"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",
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",
5959
"dirty-equals>=0.6.0",
6060

6161
]
@@ -65,12 +65,10 @@ format = { chain = [
6565
"format:black",
6666
"format:docs",
6767
"format:ruff",
68-
"format:isort",
6968
]}
7069
"format:black" = "black ."
7170
"format:docs" = "python bin/blacken-docs.py README.md api.md"
7271
"format:ruff" = "ruff --fix ."
73-
"format:isort" = "isort ."
7472

7573
"check:ruff" = "ruff ."
7674

@@ -125,16 +123,13 @@ reportImplicitOverride = true
125123
reportImportCycles = false
126124
reportPrivateUsage = false
127125

128-
[tool.isort]
129-
profile = "black"
130-
length_sort = true
131-
extra_standard_library = ["typing_extensions"]
132-
133126
[tool.ruff]
134127
line-length = 120
135-
format = "grouped"
128+
output-format = "grouped"
136129
target-version = "py37"
137130
select = [
131+
# isort
132+
"I",
138133
# remove unused imports
139134
"F401",
140135
# bare except statements
@@ -152,6 +147,12 @@ unfixable = [
152147
]
153148
ignore-init-module-imports = true
154149

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"]
155156

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

requirements-dev.lock

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ httpcore==1.0.2
2525
httpx==0.25.2
2626
idna==3.4
2727
iniconfig==2.0.0
28-
isort==5.10.1
2928
mypy==1.7.1
3029
mypy-extensions==1.0.0
3130
nodeenv==1.8.0
@@ -43,7 +42,7 @@ pytest-asyncio==0.21.1
4342
python-dateutil==2.8.2
4443
pytz==2023.3.post1
4544
respx==0.20.2
46-
ruff==0.0.282
45+
ruff==0.1.7
4746
six==1.16.0
4847
sniffio==1.3.0
4948
time-machine==2.9.0

src/finch/_client.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
)
2525
from ._utils import is_given, get_async_library
2626
from ._version import __version__
27-
from ._streaming import Stream as Stream
28-
from ._streaming import AsyncStream as AsyncStream
27+
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2928
from ._exceptions import APIStatusError
3029
from ._base_client import (
3130
DEFAULT_LIMITS,

src/finch/_compat.py

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

4444
else:
4545
if PYDANTIC_V2:
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
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
5354
else:
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
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
6163

6264

6365
# refactored config

src/finch/_models.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,11 @@
3030
AnyMapping,
3131
HttpxRequestFiles,
3232
)
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
33+
from ._utils import is_list, is_given, is_mapping, parse_date, parse_datetime, strip_not_given
4334
from ._compat import (
35+
PYDANTIC_V2,
36+
ConfigDict,
37+
GenericModel as BaseGenericModel,
4438
get_args,
4539
is_union,
4640
parse_obj,

src/finch/_types.py

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

3124
import pydantic
3225
from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport

src/finch/_utils/__init__.py

+40-36
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
from ._proxy import LazyProxy as LazyProxy
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
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+
)

src/finch/_utils/_utils.py

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

2323
from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike
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
24+
from .._compat import is_union as _is_union, parse_date as parse_date, parse_datetime as parse_datetime
2725

2826
_T = TypeVar("_T")
2927
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])

src/finch/resources/__init__.py

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

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

src/finch/resources/account.py

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

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

1523
if TYPE_CHECKING:
1624
from .._client import Finch, AsyncFinch

src/finch/resources/hris/__init__.py

+5-30
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,11 @@
77
CompanyResourceWithRawResponse,
88
AsyncCompanyResourceWithRawResponse,
99
)
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-
)
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
4015
from .pay_statements import (
4116
PayStatements,
4217
AsyncPayStatements,

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

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

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-
)
3+
from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse
4+
from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse
155

166
__all__ = [
177
"Individuals",

0 commit comments

Comments
 (0)