Skip to content

Commit 43343fb

Browse files
committed
Reformat with ufmt again
Sorts headers, does other things.
1 parent 88c48d8 commit 43343fb

File tree

8 files changed

+34
-28
lines changed

8 files changed

+34
-28
lines changed

ib_async/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131
Warrant,
3232
)
3333
from .flexreport import FlexError, FlexReport
34-
from .ib import IB, StartupFetch, StartupFetchNONE, StartupFetchALL
34+
from .ib import IB, StartupFetch, StartupFetchALL, StartupFetchNONE
3535
from .ibcontroller import IBC, Watchdog
3636
from .objects import (
3737
AccountValue,
3838
BarData,
3939
BarDataList,
4040
CommissionReport,
4141
ConnectionStats,
42-
DOMLevel,
4342
DepthMktDataDescription,
4443
Dividends,
44+
DOMLevel,
4545
Execution,
4646
ExecutionFilter,
4747
FamilyCode,

ib_async/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
import struct
88
import time
99
from collections import deque
10-
from typing import Deque, List, Optional, Callable, Any
10+
from typing import Any, Callable, Deque, List, Optional
1111

1212
from eventkit import Event
1313

1414
from .connection import Connection
1515
from .contract import Contract
1616
from .decoder import Decoder
1717
from .objects import ConnectionStats, WshEventData
18-
from .util import UNSET_DOUBLE, UNSET_INTEGER, dataclassAsTuple, getLoop, run
18+
from .util import dataclassAsTuple, getLoop, run, UNSET_DOUBLE, UNSET_INTEGER
1919

2020

2121
class Client:

ib_async/decoder.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
TickAttribLast,
3333
)
3434
from .order import Order, OrderComboLeg, OrderCondition, OrderState
35-
from .util import UNSET_DOUBLE, ZoneInfo, parseIBDatetime
35+
from .util import parseIBDatetime, UNSET_DOUBLE, ZoneInfo
3636
from .wrapper import Wrapper
3737

3838

@@ -152,13 +152,19 @@ def handler(fields):
152152
if method:
153153
try:
154154
args = [
155-
field
156-
if typ is str
157-
else int(field or 0)
158-
if typ is int
159-
else float(field or 0)
160-
if typ is float
161-
else bool(int(field or 0))
155+
(
156+
field
157+
if typ is str
158+
else (
159+
int(field or 0)
160+
if typ is int
161+
else (
162+
float(field or 0)
163+
if typ is float
164+
else bool(int(field or 0))
165+
)
166+
)
167+
)
162168
for (typ, field) in zip(types, fields[skip:])
163169
]
164170
method(*args)

ib_async/ib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import datetime
66
import logging
77
import time
8+
from enum import auto, Flag
89
from typing import Any, Awaitable, Dict, Iterator, List, Optional, Union
910

1011
from eventkit import Event
11-
from enum import Flag, auto
1212

1313
import ib_async.util as util
1414
from ib_async.client import Client

ib_async/ibcontroller.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ async def startAsync(self):
144144

145145
# create shell command
146146
cmd = [
147-
f"{self.ibcPath}\\scripts\\StartIBC.bat"
148-
if self._isWindows
149-
else f"{self.ibcPath}/scripts/ibcstart.sh"
147+
(
148+
f"{self.ibcPath}\\scripts\\StartIBC.bat"
149+
if self._isWindows
150+
else f"{self.ibcPath}/scripts/ibcstart.sh"
151+
)
150152
]
151153
for k, v in util.dataclassAsDict(self).items():
152154
arg = args[k][self._isWindows]

ib_async/order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from .contract import Contract, TagValue
1414
from .objects import Fill, SoftDollarTier, TradeLogEntry
15-
from .util import UNSET_DOUBLE, UNSET_INTEGER, dataclassNonDefaults
15+
from .util import dataclassNonDefaults, UNSET_DOUBLE, UNSET_INTEGER
1616

1717

1818
@dataclass

ib_async/ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
from ib_async.contract import Contract
1010
from ib_async.objects import (
11-
DOMLevel,
1211
Dividends,
12+
DOMLevel,
1313
FundamentalRatios,
1414
IBDefaults,
1515
MktDepthData,

ib_async/wrapper.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
from datetime import datetime, timezone
1111
from typing import (
1212
Any,
13+
cast,
1314
Dict,
15+
Final,
1416
List,
1517
Optional,
1618
Set,
17-
TYPE_CHECKING,
1819
Tuple,
19-
Union,
20-
cast,
21-
Final,
20+
TYPE_CHECKING,
2221
TypeAlias,
22+
Union,
2323
)
2424

2525
from ib_async.contract import (
@@ -34,9 +34,9 @@
3434
BarData,
3535
BarDataList,
3636
CommissionReport,
37-
DOMLevel,
3837
DepthMktDataDescription,
3938
Dividends,
39+
DOMLevel,
4040
Execution,
4141
FamilyCode,
4242
Fill,
@@ -75,13 +75,13 @@
7575
from ib_async.order import Order, OrderState, OrderStatus, Trade
7676
from ib_async.ticker import Ticker
7777
from ib_async.util import (
78-
UNSET_DOUBLE,
79-
UNSET_INTEGER,
8078
dataclassAsDict,
8179
dataclassUpdate,
8280
getLoop,
8381
globalErrorEvent,
8482
parseIBDatetime,
83+
UNSET_DOUBLE,
84+
UNSET_INTEGER,
8585
)
8686

8787
if TYPE_CHECKING:
@@ -1131,9 +1131,7 @@ def tickString(self, reqId: int, tickType: int, value: str):
11311131
elif tickType == 47:
11321132
# https://web.archive.org/web/20200725010343/https://interactivebrokers.github.io/tws-api/fundamental_ratios_tags.html
11331133
d = dict(
1134-
t.split("=") # type: ignore
1135-
for t in value.split(";")
1136-
if t
1134+
t.split("=") for t in value.split(";") if t # type: ignore
11371135
) # type: ignore
11381136
for k, v in d.items():
11391137
with suppress(ValueError):

0 commit comments

Comments
 (0)