Skip to content

Commit dc70c10

Browse files
committed
fix formatting, linting
1 parent d74102b commit dc70c10

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ omit =
2727
docs/modules/ROOT/examples/logging/tutorial005.py
2828
docs/modules/ROOT/examples/followable/tutorial001.py
2929
src/corva/__init__.py
30+
src/version.py
3031

3132
[isort]
3233
profile = black

src/corva/handlers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,9 @@ def _merge_events(
576576
Only "scheduled" and "stream" type of apps can be processed here.
577577
If somehow any other type is passed - raise an exception
578578
"""
579-
if not isinstance(aws_event, list): # if aws_event is not a list - there is nothing to merge, so do nothing.
579+
if not isinstance(
580+
aws_event, list
581+
): # if aws_event is not a list - there is nothing to merge, so do nothing.
580582
return aws_event
581583

582584
if data_transformation_type is RawScheduledEvent:

src/corva/models/merge/merge.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from typing import Optional
2+
13
from corva.models.base import CorvaBaseEvent
24
from corva.models.merge.enums import EventType, RerunMode, SourceType
3-
from typing import Optional
45

56

67
class PartialRerunMergeEvent(CorvaBaseEvent):
@@ -31,15 +32,15 @@ class PartialRerunMergeEvent(CorvaBaseEvent):
3132
rerun_mode: Optional[RerunMode]
3233
start: Optional[int]
3334
end: Optional[int]
34-
asset_id: Optional[int]
35-
rerun_asset_id: Optional[int]
36-
app_stream_id: Optional[int]
37-
rerun_app_stream_id: Optional[int]
35+
asset_id: int
36+
rerun_asset_id: int
37+
app_stream_id: int
38+
rerun_app_stream_id: int
3839
version: Optional[int]
3940
app_id: Optional[int]
4041
app_key: Optional[str]
41-
app_connection_id: Optional[int]
42-
rerun_app_connection_id: Optional[int]
42+
app_connection_id: int
43+
rerun_app_connection_id: int
4344
source_type: Optional[SourceType]
4445
log_type: Optional[str]
4546
run_until: Optional[int]

src/corva/models/merge/raw.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ class RawPartialMergeEventData(pydantic.BaseModel):
1313
rerun_mode: Optional[RerunMode]
1414
start: Optional[int]
1515
end: Optional[int]
16-
asset_id: Optional[int]
17-
rerun_asset_id: Optional[int]
18-
app_stream_id: Optional[int]
19-
rerun_app_stream_id: Optional[int]
16+
asset_id: int
17+
rerun_asset_id: int
18+
app_stream_id: int
19+
rerun_app_stream_id: int
2020
version: Optional[int] = pydantic.Field(
2121
..., le=1, ge=1
2222
) # Currently handler supports only 1-st version of this event.
2323
app_id: Optional[int]
2424
app_key: Optional[str]
25-
app_connection_id: Optional[int]
26-
rerun_app_connection_id: Optional[int]
25+
app_connection_id: int
26+
rerun_app_connection_id: int
2727
source_type: Optional[SourceType]
2828
log_type: Optional[str]
2929
run_until: Optional[int]

tests/unit/test_partial_rerun_merge_app.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
def test_merge_event_handler_called_from_stream_app_on_unexpected_event_type_raises_exc(
36-
context,
36+
context,
3737
):
3838
"""Partial merge app must raise Pydantic validation exception
3939
while processing event of unexpected type.
@@ -55,7 +55,7 @@ def partial_rerun_merge_app(event, api, asset_cache, rerun_asset_cache):
5555

5656

5757
def test_merge_event_handler_called_from_stream_app_returns_expected_cache_values(
58-
context,
58+
context,
5959
):
6060
"""Partial merge app must provide functional(working) cache objects
6161
for asset and rerun asset.
@@ -124,8 +124,9 @@ def partial_rerun_merge_app(event, api, asset_cache, rerun_asset_cache):
124124

125125

126126
def test_event_parsing_not_failing_on_missing_field(context):
127-
"""When calling scheduled event with merge event handler defined,
128-
partial merge handler should be called only.
127+
"""
128+
When field is missing we're still able to parse the event and invoke correct
129+
function
129130
"""
130131

131132
@corva.scheduled(merge_events=True)
@@ -136,15 +137,15 @@ def scheduled_app(event, api, cache):
136137
def partial_rerun_merge_app(event, api, asset_cache, rerun_asset_cache):
137138
return True
138139

139-
event_with_missing_parameter = deepcopy(RAW_EVENT)
140+
event_with_missing_parameter: dict = deepcopy(RAW_EVENT)
140141
event_with_missing_parameter["data"]["end"] = None
141142
partial_merge_app_response = scheduled_app(event_with_missing_parameter, context)[0]
142143
assert partial_merge_app_response is True
143144

144145

145146
def test_merge_events_parameter_ignored_for_partial_rerun_merge(context):
146-
"""When calling scheduled event with merge event handler defined,
147-
partial merge handler should be called only.
147+
"""
148+
merge_events parameter is ignored when incoming aws_event is not a list
148149
"""
149150

150151
@corva.scheduled(merge_events=True)
@@ -157,3 +158,7 @@ def partial_rerun_merge_app(event, api, asset_cache, rerun_asset_cache):
157158

158159
partial_merge_app_response = scheduled_app(RAW_EVENT, context)[0]
159160
assert partial_merge_app_response is True
161+
162+
163+
def test_partial_rerun_decorator_can_be_called_directly(context):
164+
corva.partial_rerun_merge()

0 commit comments

Comments
 (0)