Skip to content

Commit 55b46bb

Browse files
chore(internal): reformat imports (#92)
1 parent cc341f4 commit 55b46bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+344
-398
lines changed

pyproject.toml

+18-19
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ Repository = "https://github.com/orbcorp/orb-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 = ["orb", "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/orb/_client.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,12 @@
2020
ProxiesTypes,
2121
RequestOptions,
2222
)
23-
from ._utils import (
24-
is_given,
25-
is_mapping,
26-
get_async_library,
27-
)
23+
from ._utils import is_given, is_mapping, get_async_library
2824
from ._version import __version__
29-
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
25+
from ._streaming import Stream as Stream
26+
from ._streaming import AsyncStream as AsyncStream
3027
from ._exceptions import OrbError, APIStatusError
31-
from ._base_client import (
32-
DEFAULT_MAX_RETRIES,
33-
SyncAPIClient,
34-
AsyncAPIClient,
35-
)
28+
from ._base_client import DEFAULT_MAX_RETRIES, SyncAPIClient, AsyncAPIClient
3629

3730
__all__ = [
3831
"Timeout",

src/orb/_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/orb/_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/orb/_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/orb/_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/orb/_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/orb/resources/__init__.py

+48-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,54 @@
22

33
from .items import Items, AsyncItems, ItemsWithRawResponse, AsyncItemsWithRawResponse
44
from .plans import Plans, AsyncPlans, PlansWithRawResponse, AsyncPlansWithRawResponse
5-
from .events import Events, AsyncEvents, EventsWithRawResponse, AsyncEventsWithRawResponse
6-
from .prices import Prices, AsyncPrices, PricesWithRawResponse, AsyncPricesWithRawResponse
7-
from .coupons import Coupons, AsyncCoupons, CouponsWithRawResponse, AsyncCouponsWithRawResponse
8-
from .metrics import Metrics, AsyncMetrics, MetricsWithRawResponse, AsyncMetricsWithRawResponse
9-
from .invoices import Invoices, AsyncInvoices, InvoicesWithRawResponse, AsyncInvoicesWithRawResponse
10-
from .customers import Customers, AsyncCustomers, CustomersWithRawResponse, AsyncCustomersWithRawResponse
11-
from .top_level import TopLevel, AsyncTopLevel, TopLevelWithRawResponse, AsyncTopLevelWithRawResponse
12-
from .credit_notes import CreditNotes, AsyncCreditNotes, CreditNotesWithRawResponse, AsyncCreditNotesWithRawResponse
5+
from .events import (
6+
Events,
7+
AsyncEvents,
8+
EventsWithRawResponse,
9+
AsyncEventsWithRawResponse,
10+
)
11+
from .prices import (
12+
Prices,
13+
AsyncPrices,
14+
PricesWithRawResponse,
15+
AsyncPricesWithRawResponse,
16+
)
17+
from .coupons import (
18+
Coupons,
19+
AsyncCoupons,
20+
CouponsWithRawResponse,
21+
AsyncCouponsWithRawResponse,
22+
)
23+
from .metrics import (
24+
Metrics,
25+
AsyncMetrics,
26+
MetricsWithRawResponse,
27+
AsyncMetricsWithRawResponse,
28+
)
29+
from .invoices import (
30+
Invoices,
31+
AsyncInvoices,
32+
InvoicesWithRawResponse,
33+
AsyncInvoicesWithRawResponse,
34+
)
35+
from .customers import (
36+
Customers,
37+
AsyncCustomers,
38+
CustomersWithRawResponse,
39+
AsyncCustomersWithRawResponse,
40+
)
41+
from .top_level import (
42+
TopLevel,
43+
AsyncTopLevel,
44+
TopLevelWithRawResponse,
45+
AsyncTopLevelWithRawResponse,
46+
)
47+
from .credit_notes import (
48+
CreditNotes,
49+
AsyncCreditNotes,
50+
CreditNotesWithRawResponse,
51+
AsyncCreditNotesWithRawResponse,
52+
)
1353
from .subscriptions import (
1454
Subscriptions,
1555
AsyncSubscriptions,

src/orb/resources/coupons/__init__.py

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

3-
from .coupons import Coupons, AsyncCoupons, CouponsWithRawResponse, AsyncCouponsWithRawResponse
3+
from .coupons import (
4+
Coupons,
5+
AsyncCoupons,
6+
CouponsWithRawResponse,
7+
AsyncCouponsWithRawResponse,
8+
)
49
from .subscriptions import (
510
Subscriptions,
611
AsyncSubscriptions,

src/orb/resources/coupons/coupons.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
import httpx
88

99
from ...types import Coupon, coupon_list_params, coupon_create_params
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 ..._utils import maybe_transform
1812
from ..._resource import SyncAPIResource, AsyncAPIResource
1913
from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper
@@ -24,10 +18,7 @@
2418
SubscriptionsWithRawResponse,
2519
AsyncSubscriptionsWithRawResponse,
2620
)
27-
from ..._base_client import (
28-
AsyncPaginator,
29-
make_request_options,
30-
)
21+
from ..._base_client import AsyncPaginator, make_request_options
3122

3223
if TYPE_CHECKING:
3324
from ..._client import Orb, AsyncOrb

0 commit comments

Comments
 (0)