Skip to content

Commit ed85356

Browse files
authored
Fix imports from updates in mode-streaming~=0.4.0 (#618)
* Fix imports from updates in mode-streaming * Require new version of mode-streaming
1 parent 11505bc commit ed85356

File tree

20 files changed

+50
-37
lines changed

20 files changed

+50
-37
lines changed

docs/userguide/testing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ first test ``foo`` with ``bar`` mocked, then in a different test do ``bar``:
129129
@pytest.mark.asyncio()
130130
async def test_foo(test_app):
131131
with patch(__name__ + '.bar') as mocked_bar:
132-
mocked_bar.send = mock_coro()
132+
mocked_bar.send = mock_coro()
133133
async with foo.test_context() as agent:
134134
await agent.put('hey')
135135
mocked_bar.send.assert_called_with('hey')
@@ -145,8 +145,8 @@ first test ``foo`` with ``bar`` mocked, then in a different test do ``bar``:
145145
async with bar.test_context() as agent:
146146
event = await agent.put('hey')
147147
assert agent.results[event.message.offset] == 'heyYOLO'
148-
149-
148+
149+
150150
You can put the `test_app` fixture into a [`conftest.py` file](https://docs.pytest.org/en/6.2.x/fixture.html#scope-sharing-fixtures-across-classes-modules-packages-or-session). If the fixture is not in the same file as the app's definition (which should be the case) you must import the app the fixture definition:
151151

152152
.. sourcecode:: python
@@ -155,9 +155,9 @@ You can put the `test_app` fixture into a [`conftest.py` file](https://docs.pyte
155155
@pytest.fixture(scope="function")
156156
def test_app(event_loop):
157157
"""passing in event_loop helps avoid 'attached to a different loop' error"""
158-
158+
159159
from example import app
160-
160+
161161
app.loop = event_loop
162162
app.finalize()
163163
app.conf.store = 'memory://'

faust/agents/manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"""Agent manager."""
22

33
import asyncio
4-
from collections import defaultdict
4+
from collections import OrderedDict, defaultdict
55
from typing import Any, Dict, List, Mapping, MutableMapping, MutableSet, Set
66
from weakref import WeakSet
77

88
from mode import Service
99
from mode.utils.collections import ManagedUserDict
10-
from mode.utils.compat import OrderedDict
1110
from mode.utils.locks import Event
1211

1312
from faust.types import AgentManagerT, AgentT, AppT

faust/app/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import sys
1313
import typing
1414
import warnings
15+
from contextlib import nullcontext
1516
from datetime import tzinfo
1617
from functools import wraps
1718
from itertools import chain
@@ -29,6 +30,7 @@
2930
Mapping,
3031
MutableMapping,
3132
MutableSequence,
33+
NoReturn,
3234
Optional,
3335
Pattern,
3436
Set,
@@ -44,14 +46,12 @@
4446
from mode import Seconds, Service, ServiceT, SupervisorStrategyT, want_seconds
4547
from mode.utils.aiter import aiter
4648
from mode.utils.collections import force_mapping
47-
from mode.utils.contexts import nullcontext
4849
from mode.utils.futures import stampede
4950
from mode.utils.imports import import_from_cwd, smart_import
5051
from mode.utils.logging import flight_recorder, get_logger
5152
from mode.utils.objects import cached_property, qualname, shortlabel
5253
from mode.utils.queues import FlowControlEvent, ThrowableQueue
5354
from mode.utils.types.trees import NodeT
54-
from mode.utils.typing import NoReturn
5555

5656
from faust import transport
5757
from faust.agents import AgentFun, AgentManager, AgentT, ReplyConsumer, SinkT

faust/assignor/copartitioned_assignor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
from itertools import cycle
44
from math import ceil, floor
5-
from typing import Iterable, Iterator, MutableMapping, Optional, Sequence, Set
6-
7-
from mode.utils.typing import Counter
5+
from typing import Counter, Iterable, Iterator, MutableMapping, Optional, Sequence, Set
86

97
from .client_assignment import CopartitionedAssignment
108

faust/cli/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
List,
2222
Mapping,
2323
MutableSequence,
24+
NoReturn,
2425
Optional,
2526
Sequence,
2627
Tuple,
@@ -36,7 +37,6 @@
3637
from mode.utils import text
3738
from mode.utils.compat import want_bytes
3839
from mode.utils.imports import import_from_cwd, symbol_by_name
39-
from mode.utils.typing import NoReturn
4040
from mode.worker import exiting
4141

4242
from faust.types import AppT, CodecArg, ModelT

faust/livecheck/case.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,29 @@
33
import traceback
44
import typing
55
from collections import deque
6-
from contextlib import ExitStack
6+
from contextlib import ExitStack, asynccontextmanager
77
from datetime import datetime, timedelta, timezone
88
from itertools import count
99
from random import uniform
1010
from statistics import median
1111
from time import monotonic
12-
from typing import Any, ClassVar, Dict, Iterable, Optional, Type, Union, cast
12+
from typing import (
13+
Any,
14+
AsyncGenerator,
15+
ClassVar,
16+
Counter,
17+
Deque,
18+
Dict,
19+
Iterable,
20+
Optional,
21+
Type,
22+
Union,
23+
cast,
24+
)
1325

1426
from aiohttp import ClientError, ClientTimeout
1527
from mode import Seconds, Service, want_seconds
16-
from mode.utils.contexts import asynccontextmanager
1728
from mode.utils.times import humanize_seconds
18-
from mode.utils.typing import AsyncGenerator, Counter, Deque
1929
from yarl import URL
2030

2131
from faust.utils import uuid

faust/livecheck/runners.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
import traceback
66
import typing
77
from time import monotonic
8-
from typing import Any, Dict, Iterable, List, Mapping, Optional, Tuple
8+
from typing import Any, Dict, Iterable, List, Mapping, NoReturn, Optional, Tuple
99

1010
from mode.utils.logging import CompositeLogger
1111
from mode.utils.times import humanize_seconds
12-
from mode.utils.typing import NoReturn
1312

1413
from faust.models import maybe_model
1514

faust/models/record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Record - Dictionary Model."""
22

3+
from collections import OrderedDict
34
from datetime import datetime
45
from decimal import Decimal
56
from itertools import chain
@@ -18,7 +19,6 @@
1819
cast,
1920
)
2021

21-
from mode.utils.compat import OrderedDict
2222
from mode.utils.objects import annotations, is_optional, remove_optional
2323
from mode.utils.text import pluralize
2424

faust/models/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Any,
2424
Callable,
2525
ClassVar,
26+
Counter,
2627
Dict,
2728
Iterator,
2829
List,
@@ -45,7 +46,6 @@
4546
is_union,
4647
qualname,
4748
)
48-
from mode.utils.typing import Counter
4949

5050
from faust.types.models import CoercionHandler, CoercionMapping, IsInstanceArgT, ModelT
5151
from faust.utils import codegen

faust/sensors/monitor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from typing import (
1111
Any,
1212
Callable,
13+
Counter,
14+
Deque,
1315
Dict,
1416
Mapping,
1517
MutableMapping,
@@ -21,7 +23,6 @@
2123

2224
from mode import Service, label
2325
from mode.utils.objects import KeywordReduce
24-
from mode.utils.typing import Counter, Deque
2526

2627
from faust import web
2728
from faust.types import AppT, CollectionT, EventT, StreamT

0 commit comments

Comments
 (0)