Skip to content

Commit 82a7085

Browse files
chore(internal): replace isort with ruff (#245)
1 parent b7b0145 commit 82a7085

37 files changed

+285
-292
lines changed

pyproject.toml

+9-7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ dev-dependencies = [
5353
"pytest",
5454
"pytest-asyncio",
5555
"ruff",
56-
"isort",
5756
"time-machine",
5857
"nox",
5958
"dirty-equals>=0.6.0",
@@ -66,7 +65,6 @@ format = { chain = [
6665
"format:ruff",
6766
"format:docs",
6867
"fix:ruff",
69-
"format:isort",
7068
]}
7169
"format:black" = "black ."
7270
"format:docs" = "python bin/ruffen-docs.py README.md api.md"
@@ -127,16 +125,13 @@ reportImplicitOverride = true
127125
reportImportCycles = false
128126
reportPrivateUsage = false
129127

130-
[tool.isort]
131-
profile = "black"
132-
length_sort = true
133-
extra_standard_library = ["typing_extensions"]
134-
135128
[tool.ruff]
136129
line-length = 120
137130
output-format = "grouped"
138131
target-version = "py37"
139132
select = [
133+
# isort
134+
"I",
140135
# bugbear rules
141136
"B",
142137
# remove unused imports
@@ -163,6 +158,13 @@ ignore-init-module-imports = true
163158
[tool.ruff.format]
164159
docstring-code-format = true
165160

161+
[tool.ruff.lint.isort]
162+
length-sort = true
163+
length-sort-straight = true
164+
combine-as-imports = true
165+
extra-standard-library = ["typing_extensions"]
166+
known-first-party = ["finch", "tests"]
167+
166168
[tool.ruff.per-file-ignores]
167169
"bin/**.py" = ["T201", "T203"]
168170
"tests/**.py" = ["T201", "T203"]

requirements-dev.lock

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ httpx==0.25.2
2424
idna==3.4
2525
importlib-metadata==7.0.0
2626
iniconfig==2.0.0
27-
isort==5.10.1
2827
mypy==1.7.1
2928
mypy-extensions==1.0.0
3029
nodeenv==1.8.0

src/finch/__init__.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,7 @@
33
from . import types
44
from ._types import NoneType, Transport, ProxiesTypes
55
from ._utils import file_from_path
6-
from ._client import (
7-
Finch,
8-
Client,
9-
Stream,
10-
Timeout,
11-
Transport,
12-
AsyncFinch,
13-
AsyncClient,
14-
AsyncStream,
15-
RequestOptions,
16-
)
6+
from ._client import Finch, Client, Stream, Timeout, Transport, AsyncFinch, AsyncClient, AsyncStream, RequestOptions
177
from ._version import __title__, __version__
188
from ._exceptions import (
199
APIError,

src/finch/_client.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
AsyncTransport,
2222
RequestOptions,
2323
)
24-
from ._utils import is_given, get_async_library
24+
from ._utils import (
25+
is_given,
26+
get_async_library,
27+
)
2528
from ._version import __version__
26-
from ._streaming import Stream as Stream
27-
from ._streaming import AsyncStream as AsyncStream
29+
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2830
from ._exceptions import APIStatusError
2931
from ._base_client import (
3032
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 httpx
3225
import pydantic

src/finch/_utils/__init__.py

+44-39
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
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_mapping_t as is_mapping_t
13-
from ._utils import removeprefix as removeprefix
14-
from ._utils import removesuffix as removesuffix
15-
from ._utils import extract_files as extract_files
16-
from ._utils import is_sequence_t as is_sequence_t
17-
from ._utils import required_args as required_args
18-
from ._utils import coerce_boolean as coerce_boolean
19-
from ._utils import coerce_integer as coerce_integer
20-
from ._utils import file_from_path as file_from_path
21-
from ._utils import parse_datetime as parse_datetime
22-
from ._utils import strip_not_given as strip_not_given
23-
from ._utils import deepcopy_minimal as deepcopy_minimal
24-
from ._utils import get_async_library as get_async_library
25-
from ._utils import maybe_coerce_float as maybe_coerce_float
26-
from ._utils import get_required_header as get_required_header
27-
from ._utils import maybe_coerce_boolean as maybe_coerce_boolean
28-
from ._utils import maybe_coerce_integer as maybe_coerce_integer
29-
from ._typing import is_list_type as is_list_type
30-
from ._typing import is_union_type as is_union_type
31-
from ._typing import extract_type_arg as extract_type_arg
32-
from ._typing import is_required_type as is_required_type
33-
from ._typing import is_annotated_type as is_annotated_type
34-
from ._typing import strip_annotated_type as strip_annotated_type
35-
from ._typing import extract_type_var_from_base as extract_type_var_from_base
36-
from ._streams import consume_sync_iterator as consume_sync_iterator
37-
from ._streams import consume_async_iterator as consume_async_iterator
38-
from ._transform import PropertyInfo as PropertyInfo
39-
from ._transform import transform as transform
40-
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_mapping_t as is_mapping_t,
14+
removeprefix as removeprefix,
15+
removesuffix as removesuffix,
16+
extract_files as extract_files,
17+
is_sequence_t as is_sequence_t,
18+
required_args as required_args,
19+
coerce_boolean as coerce_boolean,
20+
coerce_integer as coerce_integer,
21+
file_from_path as file_from_path,
22+
parse_datetime as parse_datetime,
23+
strip_not_given as strip_not_given,
24+
deepcopy_minimal as deepcopy_minimal,
25+
get_async_library as get_async_library,
26+
maybe_coerce_float as maybe_coerce_float,
27+
get_required_header as get_required_header,
28+
maybe_coerce_boolean as maybe_coerce_boolean,
29+
maybe_coerce_integer as maybe_coerce_integer,
30+
)
31+
from ._typing import (
32+
is_list_type as is_list_type,
33+
is_union_type as is_union_type,
34+
extract_type_arg as extract_type_arg,
35+
is_required_type as is_required_type,
36+
is_annotated_type as is_annotated_type,
37+
strip_annotated_type as strip_annotated_type,
38+
extract_type_var_from_base as extract_type_var_from_base,
39+
)
40+
from ._streams import consume_sync_iterator as consume_sync_iterator, consume_async_iterator as consume_async_iterator
41+
from ._transform import (
42+
PropertyInfo as PropertyInfo,
43+
transform as transform,
44+
maybe_transform as maybe_transform,
45+
)

src/finch/_utils/_transform.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
import pydantic
88

9-
from ._utils import is_list, is_mapping
9+
from ._utils import (
10+
is_list,
11+
is_mapping,
12+
)
1013
from ._typing import (
1114
is_list_type,
1215
is_union_type,

src/finch/_utils/_utils.py

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

2323
from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike
24-
from .._compat import parse_date as parse_date
25-
from .._compat import parse_datetime as parse_datetime
24+
from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
2625

2726
_T = TypeVar("_T")
2827
_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)