-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PBE-1321] support campaign endpoints #155
Conversation
stream_chat/base/client.py
Outdated
from typing import Any, Awaitable, Dict, Iterable, List, TypeVar, Union, Optional | ||
|
||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | ||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, UpdateSegmentData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, UpdateSegmentData | |
from stream_chat.types.segment import ( | |
SegmentType, | |
SegmentData, | |
QuerySegmentsOptions, | |
UpdateSegmentData, | |
) |
stream_chat/base/client.py
Outdated
@@ -920,7 +923,7 @@ def list_roles(self) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |||
|
|||
@abc.abstractmethod | |||
def create_segment( | |||
self, segment: Dict | |||
self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData | |
self, | |
segment_type: SegmentType, | |
segment_id: str, | |
segment_name: str, | |
data: SegmentData, |
stream_chat/client.py
Outdated
@@ -6,6 +6,9 @@ | |||
from urllib.parse import urlparse | |||
from urllib.request import Request, urlopen | |||
|
|||
from stream_chat.types.campaign import QueryCampaignsOptions, CampaignData | |||
from stream_chat.types.segment import SegmentType, QuerySegmentsOptions, UpdateSegmentData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
from stream_chat.types.segment import SegmentType, QuerySegmentsOptions, UpdateSegmentData | |
from stream_chat.types.segment import ( | |
SegmentType, | |
QuerySegmentsOptions, | |
UpdateSegmentData, | |
) |
stream_chat/client.py
Outdated
def create_segment(self, segment_type: SegmentType, segment_id: str, name: str, data: Dict) -> StreamResponse: | ||
return self.post("segments", data={"type": segment_type.value, "id": segment_id, "name": name, "data": data}) | ||
|
||
def query_segments(self, **params: Any) -> StreamResponse: | ||
return self.get("segments", params={"payload": json.dumps(params)}) | ||
def query_segments(self, filter_conditions: Dict, options: QuerySegmentsOptions) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def create_segment(self, segment_type: SegmentType, segment_id: str, name: str, data: Dict) -> StreamResponse: | |
return self.post("segments", data={"type": segment_type.value, "id": segment_id, "name": name, "data": data}) | |
def query_segments(self, **params: Any) -> StreamResponse: | |
return self.get("segments", params={"payload": json.dumps(params)}) | |
def query_segments(self, filter_conditions: Dict, options: QuerySegmentsOptions) -> StreamResponse: | |
def create_segment( | |
self, segment_type: SegmentType, segment_id: str, name: str, data: Dict | |
) -> StreamResponse: | |
return self.post( | |
"segments", | |
data={ | |
"type": segment_type.value, | |
"id": segment_id, | |
"name": name, | |
"data": data, | |
}, | |
) | |
def query_segments( | |
self, filter_conditions: Dict, options: QuerySegmentsOptions | |
) -> StreamResponse: |
stream_chat/client.py
Outdated
|
||
def update_segment(self, segment_id: str, data: Dict) -> StreamResponse: | ||
return self.put(f"segments/{segment_id}", data={"segment": data}) | ||
def update_segment(self, segment_id: str, data: UpdateSegmentData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def update_segment(self, segment_id: str, data: UpdateSegmentData) -> StreamResponse: | |
def update_segment( | |
self, segment_id: str, data: UpdateSegmentData | |
) -> StreamResponse: |
stream_chat/async_chat/client.py
Outdated
|
||
async def update_segment(self, segment_id: str, data: Dict) -> StreamResponse: | ||
return await self.put(f"segments/{segment_id}", data={"segment": data}) | ||
async def update_segment(self, segment_id: str, data: UpdateSegmentData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def update_segment(self, segment_id: str, data: UpdateSegmentData) -> StreamResponse: | |
async def update_segment( | |
self, segment_id: str, data: UpdateSegmentData | |
) -> StreamResponse: |
stream_chat/async_chat/client.py
Outdated
|
||
async def query_campaigns(self, **params: Any) -> StreamResponse: | ||
return await self.get("campaigns", params={"payload": json.dumps(params)}) | ||
async def query_campaigns(self, filter_conditions: Dict[str, Any], options: QueryCampaignsOptions = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def query_campaigns(self, filter_conditions: Dict[str, Any], options: QueryCampaignsOptions = None) -> StreamResponse: | |
async def query_campaigns( | |
self, filter_conditions: Dict[str, Any], options: QueryCampaignsOptions = None | |
) -> StreamResponse: |
stream_chat/async_chat/client.py
Outdated
|
||
async def update_campaign(self, campaign_id: str, data: Dict) -> StreamResponse: | ||
return await self.put(f"campaigns/{campaign_id}", data={"campaign": data}) | ||
async def update_campaign(self, campaign_id: str, params: CampaignData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def update_campaign(self, campaign_id: str, params: CampaignData) -> StreamResponse: | |
async def update_campaign( | |
self, campaign_id: str, params: CampaignData | |
) -> StreamResponse: |
stream_chat/types/base.py
Outdated
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
stream_chat/types/campaign.py
Outdated
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
stream_chat/async_chat/client.py
Outdated
@@ -16,6 +16,9 @@ | |||
) | |||
from urllib.parse import urlparse | |||
|
|||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | |||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, UpdateSegmentData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
@@ -16,6 +16,9 @@ | |||
) | |||
from urllib.parse import urlparse | |||
|
|||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | |||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, UpdateSegmentData | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
@@ -16,6 +16,9 @@ | |||
) | |||
from urllib.parse import urlparse | |||
|
|||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | |||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, UpdateSegmentData | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
@@ -16,6 +16,9 @@ | |||
) | |||
from urllib.parse import urlparse | |||
|
|||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | |||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, UpdateSegmentData | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
@@ -16,6 +16,9 @@ | |||
) | |||
from urllib.parse import urlparse | |||
|
|||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | |||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, UpdateSegmentData | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
stream_chat/types/campaign.py
Outdated
@@ -0,0 +1,29 @@ | |||
from typing import List, Optional, TypedDict, Dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
@@ -0,0 +1,29 @@ | |||
from typing import List, Optional, TypedDict, Dict | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
stream_chat/types/segment.py
Outdated
@@ -0,0 +1,22 @@ | |||
from enum import Enum | |||
from typing import TypedDict, Optional, Dict, List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
@@ -0,0 +1,22 @@ | |||
from enum import Enum | |||
from typing import TypedDict, Optional, Dict, List | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
stream_chat/client.py
Outdated
@@ -518,26 +521,28 @@ def delete_role(self, name: str) -> StreamResponse: | |||
def list_roles(self) -> StreamResponse: | |||
return self.get("roles") | |||
|
|||
def create_segment(self, segment: Dict) -> StreamResponse: | |||
return self.post("segments", data={"segment": segment}) | |||
def create_segment(self, segment_type: SegmentType, segment_id: str, name: str, data: Dict) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Argument 4 of "create_segment" is incompatible with supertype "StreamChatInterface"; supertype defines the argument type as "SegmentData" [override]
stream_chat/client.py
Outdated
@@ -518,26 +521,28 @@ def delete_role(self, name: str) -> StreamResponse: | |||
def list_roles(self) -> StreamResponse: | |||
return self.get("roles") | |||
|
|||
def create_segment(self, segment: Dict) -> StreamResponse: | |||
return self.post("segments", data={"segment": segment}) | |||
def create_segment(self, segment_type: SegmentType, segment_id: str, name: str, data: Dict) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
This violates the Liskov substitution principle
stream_chat/client.py
Outdated
@@ -518,26 +521,28 @@ def delete_role(self, name: str) -> StreamResponse: | |||
def list_roles(self) -> StreamResponse: | |||
return self.get("roles") | |||
|
|||
def create_segment(self, segment: Dict) -> StreamResponse: | |||
return self.post("segments", data={"segment": segment}) | |||
def create_segment(self, segment_type: SegmentType, segment_id: str, name: str, data: Dict) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
stream_chat/base/segment.py
Outdated
pass | ||
|
||
@abc.abstractmethod | ||
def update(self, data: UpdateSegmentData) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def update(self, data: UpdateSegmentData) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |
def update( | |
self, data: UpdateSegmentData | |
) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
stream_chat/campaign.py
Outdated
class Campaign(CampaignInterface): | ||
|
||
def create(self) -> StreamResponse: | ||
state = self.client.create_campaign(campaign_id=self.campaign_id, data=self.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
state = self.client.create_campaign(campaign_id=self.campaign_id, data=self.data) | |
state = self.client.create_campaign( | |
campaign_id=self.campaign_id, data=self.data | |
) |
stream_chat/segment.py
Outdated
segment_type=self.segment_type, | ||
segment_id=self.segment_id, | ||
segment_name=self.segment_name, | ||
data=self.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
data=self.data | |
data=self.data, |
stream_chat/segment.py
Outdated
}, | ||
options={ | ||
"limit": 1, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
} | |
}, |
stream_chat/segment.py
Outdated
return self.client.update_segment( | ||
segment_id=self.segment_id, | ||
data=data | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return self.client.update_segment( | |
segment_id=self.segment_id, | |
data=data | |
) | |
return self.client.update_segment(segment_id=self.segment_id, data=data) |
stream_chat/client.py
Outdated
|
||
def delete_segment(self, segment_id: str) -> StreamResponse: | ||
return self.delete(f"segments/{segment_id}") | ||
|
||
def create_campaign(self, campaign: Dict) -> StreamResponse: | ||
return self.post("campaigns", data={"campaign": campaign}) | ||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: | |
def campaign( | |
self, campaign_id: Optional[str] = None, data: CampaignData = None | |
) -> Campaign: |
stream_chat/client.py
Outdated
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: | ||
return Campaign(client=self, campaign_id=campaign_id, data=data) | ||
|
||
def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | |
def create_campaign( | |
self, campaign_id: Optional[str] = None, data: CampaignData = None | |
) -> StreamResponse: |
stream_chat/client.py
Outdated
def query_campaigns(self, filter_conditions: Dict[str, Any], | ||
options: QueryCampaignsOptions = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def query_campaigns(self, filter_conditions: Dict[str, Any], | |
options: QueryCampaignsOptions = None) -> StreamResponse: | |
def query_campaigns( | |
self, filter_conditions: Dict[str, Any], options: QueryCampaignsOptions = None | |
) -> StreamResponse: |
stream_chat/client.py
Outdated
def schedule_campaign( | ||
self, campaign_id: str, scheduled_for: int = None | ||
def start_campaign( | ||
self, campaign_id: str, scheduled_for: Optional[datetime.datetime] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
self, campaign_id: str, scheduled_for: Optional[datetime.datetime] = None | |
self, campaign_id: str, scheduled_for: Optional[datetime.datetime] = None |
stream_chat/types/stream_response.py
Outdated
@@ -65,3 +65,7 @@ def headers(self) -> Dict[str, Any]: | |||
def status_code(self) -> int: | |||
"""Returns the HTTP status code of the response.""" | |||
return self.__status_code | |||
|
|||
def is_ok(self) -> bool: | |||
"""Returns True if the status code is in the 200 range. """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
"""Returns True if the status code is in the 200 range. """ | |
"""Returns True if the status code is in the 200 range.""" |
stream_chat/base/campaign.py
Outdated
@@ -0,0 +1,42 @@ | |||
import abc | |||
from typing import Awaitable, Dict, List, Union, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/base/campaign.py
Outdated
@@ -0,0 +1,42 @@ | |||
import abc | |||
from typing import Awaitable, Dict, List, Union, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'typing.Dict' imported but unused
stream_chat/base/campaign.py
Outdated
@@ -0,0 +1,42 @@ | |||
import abc | |||
from typing import Awaitable, Dict, List, Union, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'typing.List' imported but unused
@@ -0,0 +1,42 @@ | |||
import abc | |||
from typing import Awaitable, Dict, List, Union, Optional | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
stream_chat/base/client.py
Outdated
@@ -918,9 +924,20 @@ def list_roles(self) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |||
""" | |||
pass | |||
|
|||
def segment(self, segment_type: SegmentType, segment_id: str, segment_name: str) -> TSegment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <27> reported by reviewdog 🐶
segment is an empty method in an abstract base class, but has no abstract decorator. Consider adding @AbstractMethod.
|
||
from stream_chat.base.client import StreamChatInterface | ||
from stream_chat.types.segment import SegmentType, SegmentData, UpdateSegmentData | ||
from stream_chat.types.stream_response import StreamResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
stream_chat/client.py
Outdated
@@ -2,16 +2,20 @@ | |||
import json | |||
import sys | |||
import warnings | |||
from typing import Any, Callable, Dict, Iterable, List, Union | |||
from typing import Any, Callable, Dict, Iterable, List, Union, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/client.py
Outdated
from stream_chat.campaign import Campaign | ||
from stream_chat.segment import Segment | ||
from stream_chat.types.campaign import QueryCampaignsOptions, CampaignData | ||
from stream_chat.types.segment import SegmentType, QuerySegmentsOptions, UpdateSegmentData, SegmentData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
assert "name" in created["campaign"] | ||
|
||
client.delete_segment(segment_id=segment_id) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
|
||
deleted = segment.delete() | ||
assert deleted.is_ok() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
mypy
stream_chat/client.py|551 col 28| Expected:
stream_chat/client.py|551 col 28| def getitem(self, str, /) -> str
stream_chat/client.py|551 col 28| Got:
stream_chat/client.py|551 col 28| def getitem(self, str, /) -> object
stream_chat/async_chat/client.py|556 col 5| Signature of "create_campaign" incompatible with supertype "StreamChatInterface" [override]
stream_chat/async_chat/client.py|556 col 5| Superclass:
stream_chat/async_chat/client.py|556 col 5| def create_campaign(self, campaign_id: str | None, data: CampaignData | None) -> StreamResponse | Awaitable[StreamResponse]
stream_chat/async_chat/client.py|556 col 5| Subclass:
stream_chat/async_chat/client.py|556 col 5| def create_campaign(self, params: CampaignData) -> Coroutine[Any, Any, StreamResponse]
stream_chat/base/client.py
Outdated
@@ -918,9 +924,20 @@ def list_roles(self) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |||
""" | |||
pass | |||
|
|||
def segment(self, segment_type: SegmentType, segment_id: str, segment_name: str) -> TSegment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
stream_chat/base/client.py
Outdated
@@ -954,9 +971,28 @@ | |||
""" | |||
pass | |||
|
|||
def campaign(self, campaign_id: Optional[str]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Function is missing a return type annotation [no-untyped-def]
stream_chat/segment.py
Outdated
data=self.data | ||
) | ||
|
||
if self.segment_id is None and state.is_ok() and "segment" in state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Item "Awaitable[StreamResponse]" of "StreamResponse | Awaitable[StreamResponse]" has no attribute "is_ok" [union-attr]
stream_chat/segment.py
Outdated
data=self.data | ||
) | ||
|
||
if self.segment_id is None and state.is_ok() and "segment" in state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Maybe you forgot to use "await"?
stream_chat/segment.py
Outdated
data=self.data | ||
) | ||
|
||
if self.segment_id is None and state.is_ok() and "segment" in state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Unsupported right operand type for in ("StreamResponse | Awaitable[StreamResponse]") [operator]
stream_chat/client.py
Outdated
return Segment(client=self, segment_type=segment_type, segment_id=segment_id, segment_name=segment_name, | ||
data=data) | ||
|
||
def create_segment(self, segment_type: SegmentType, segment_id: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def create_segment(self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData) -> StreamResponse | Awaitable[StreamResponse]
stream_chat/client.py
Outdated
return Segment(client=self, segment_type=segment_type, segment_id=segment_id, segment_name=segment_name, | ||
data=data) | ||
|
||
def create_segment(self, segment_type: SegmentType, segment_id: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Subclass:
stream_chat/client.py
Outdated
return Segment(client=self, segment_type=segment_type, segment_id=segment_id, segment_name=segment_name, | ||
data=data) | ||
|
||
def create_segment(self, segment_type: SegmentType, segment_id: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def create_segment(self, segment_type: SegmentType, segment_id: str | None = ..., segment_name: str | None = ..., data: dict[Any, Any] = ...) -> StreamResponse
stream_chat/client.py
Outdated
def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | ||
payload = {"id": campaign_id} | ||
if data is not None: | ||
payload.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Argument 1 to "update" of "MutableMapping" has incompatible type "CampaignData"; expected "SupportsKeysAndGetItem[str, str]" [arg-type]
stream_chat/client.py
Outdated
def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | ||
payload = {"id": campaign_id} | ||
if data is not None: | ||
payload.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Following member(s) of "CampaignData" have conflicts:
stream_chat/base/campaign.py
Outdated
pass | ||
|
||
@abc.abstractmethod | ||
def update(self, data: CampaignData) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def update(self, data: CampaignData) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |
def update( | |
self, data: CampaignData | |
) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
stream_chat/base/campaign.py
Outdated
pass | ||
|
||
@abc.abstractmethod | ||
def start(self, scheduled_for: Optional[Union[str, datetime.datetime]] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def start(self, scheduled_for: Optional[Union[str, datetime.datetime]] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |
def start( | |
self, scheduled_for: Optional[Union[str, datetime.datetime]] = None | |
) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
stream_chat/campaign.py
Outdated
return self.client.update_campaign(campaign_id=self.campaign_id, data=data) | ||
|
||
def delete(self, **options: Any) -> StreamResponse: | ||
return self.client.delete_campaign(campaign_id=self.campaign_id, options=options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return self.client.delete_campaign(campaign_id=self.campaign_id, options=options) | |
return self.client.delete_campaign( | |
campaign_id=self.campaign_id, options=options | |
) |
stream_chat/campaign.py
Outdated
def start(self, scheduled_for: Optional[Union[str, datetime.datetime]] = None) -> StreamResponse: | ||
return self.client.start_campaign(campaign_id=self.campaign_id, scheduled_for=scheduled_for) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def start(self, scheduled_for: Optional[Union[str, datetime.datetime]] = None) -> StreamResponse: | |
return self.client.start_campaign(campaign_id=self.campaign_id, scheduled_for=scheduled_for) | |
def start( | |
self, scheduled_for: Optional[Union[str, datetime.datetime]] = None | |
) -> StreamResponse: | |
return self.client.start_campaign( | |
campaign_id=self.campaign_id, scheduled_for=scheduled_for | |
) |
stream_chat/base/segment.py
Outdated
pass | ||
|
||
@abc.abstractmethod | ||
def update(self, data: SegmentData) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def update(self, data: SegmentData) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |
def update( | |
self, data: SegmentData | |
) -> Union[StreamResponse, Awaitable[StreamResponse]]: |
stream_chat/client.py
Outdated
def segment_target_exists( | ||
self, segment_id: str, target_id: str | ||
) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def segment_target_exists( | |
self, segment_id: str, target_id: str | |
) -> StreamResponse: | |
def segment_target_exists(self, segment_id: str, target_id: str) -> StreamResponse: |
stream_chat/client.py
Outdated
def add_segment_targets( | ||
self, segment_id: str, target_ids: List[str] | ||
) -> StreamResponse: | ||
return self.post(f"segments/{segment_id}/addtargets", data={"targets": target_ids}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return self.post(f"segments/{segment_id}/addtargets", data={"targets": target_ids}) | |
return self.post( | |
f"segments/{segment_id}/addtargets", data={"targets": target_ids} | |
) |
stream_chat/client.py
Outdated
return self.post(f"segments/{segment_id}/deletetargets", data={"targets": target_ids}) | ||
|
||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return self.post(f"segments/{segment_id}/deletetargets", data={"targets": target_ids}) | |
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: | |
return self.post( | |
f"segments/{segment_id}/deletetargets", data={"targets": target_ids} | |
) | |
def campaign( | |
self, campaign_id: Optional[str] = None, data: CampaignData = None | |
) -> Campaign: |
stream_chat/client.py
Outdated
def schedule_campaign( | ||
self, campaign_id: str, scheduled_for: int = None | ||
def start_campaign( | ||
self, campaign_id: str, scheduled_for: Optional[Union[str, datetime.datetime]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
self, campaign_id: str, scheduled_for: Optional[Union[str, datetime.datetime]] = None | |
self, | |
campaign_id: str, | |
scheduled_for: Optional[Union[str, datetime.datetime]] = None, |
stream_chat/client.py
Outdated
return self.post( | ||
f"campaigns/{campaign_id}/start", data=payload | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return self.post( | |
f"campaigns/{campaign_id}/start", data=payload | |
) | |
return self.post(f"campaigns/{campaign_id}/start", data=payload) |
stream_chat/async_chat/client.py
Outdated
@@ -16,6 +16,9 @@ | |||
) | |||
from urllib.parse import urlparse | |||
|
|||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | |||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/base/client.py
Outdated
from typing import Any, Awaitable, Dict, Iterable, List, TypeVar, Union, Optional | ||
|
||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | ||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/base/client.py
Outdated
@@ -918,18 +924,38 @@ def list_roles(self) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |||
""" | |||
pass | |||
|
|||
def segment(self, segment_type: SegmentType, data: Optional[SegmentData]) -> TSegment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <27> reported by reviewdog 🐶
segment is an empty method in an abstract base class, but has no abstract decorator. Consider adding @AbstractMethod.
stream_chat/base/segment.py
Outdated
@@ -0,0 +1,48 @@ | |||
import abc | |||
from typing import Optional, Awaitable, Union, List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/base/segment.py
Outdated
from typing import Optional, Awaitable, Union, List | ||
|
||
from stream_chat.base.client import StreamChatInterface | ||
from stream_chat.types.segment import SegmentType, SegmentData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/client.py
Outdated
from stream_chat.campaign import Campaign | ||
from stream_chat.segment import Segment | ||
from stream_chat.types.campaign import QueryCampaignsOptions, CampaignData | ||
from stream_chat.types.segment import SegmentType, QuerySegmentsOptions, SegmentData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/client.py
Outdated
def segment(self, segment_type: SegmentType, segment_id: Optional[str] = None, data: Optional[SegmentData] = None) -> Segment: | ||
return Segment(client=self, segment_type=segment_type, segment_id=segment_id, data=data) | ||
|
||
def create_segment(self, segment_type: SegmentType, segment_id: Optional[str]=None, data: Optional[SegmentData] = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [flake8] <252> reported by reviewdog 🐶
missing whitespace around parameter equals
stream_chat/client.py
Outdated
def segment(self, segment_type: SegmentType, segment_id: Optional[str] = None, data: Optional[SegmentData] = None) -> Segment: | ||
return Segment(client=self, segment_type=segment_type, segment_id=segment_id, data=data) | ||
|
||
def create_segment(self, segment_type: SegmentType, segment_id: Optional[str]=None, data: Optional[SegmentData] = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [flake8] <252> reported by reviewdog 🐶
missing whitespace around parameter equals
|
||
deleted = segment.delete() | ||
assert deleted.is_ok() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
mypy
stream_chat/async_chat/client.py|556 col 5| Superclass:
stream_chat/async_chat/client.py|556 col 5| def create_campaign(self, campaign_id: str | None, data: CampaignData | None) -> StreamResponse | Awaitable[StreamResponse]
stream_chat/async_chat/client.py|556 col 5| Subclass:
stream_chat/async_chat/client.py|556 col 5| def create_campaign(self, params: CampaignData) -> Coroutine[Any, Any, StreamResponse]
stream_chat/base/client.py
Outdated
@@ -918,18 +924,38 @@ def list_roles(self) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |||
""" | |||
pass | |||
|
|||
def segment(self, segment_type: SegmentType, data: Optional[SegmentData]) -> TSegment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
stream_chat/segment.py
Outdated
return state | ||
|
||
def get(self) -> StreamResponse: | ||
return self.client.get_segment(segment_id=self.segment_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/segment.py
Outdated
return self.client.delete_segment(segment_id=self.segment_id) | ||
|
||
def target_exists(self, target_id: str) -> StreamResponse: | ||
return self.client.segment_target_exists(segment_id=self.segment_id, target_id=target_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/segment.py
Outdated
return self.client.segment_target_exists(segment_id=self.segment_id, target_id=target_id) | ||
|
||
def add_targets(self, target_ids: list) -> StreamResponse: | ||
return self.client.add_segment_targets(segment_id=self.segment_id, target_ids=target_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/segment.py
Outdated
return self.client.add_segment_targets(segment_id=self.segment_id, target_ids=target_ids) | ||
|
||
def delete_targets(self, target_ids: list) -> StreamResponse: | ||
return self.client.delete_segment_targets(segment_id=self.segment_id, target_ids=target_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/async_chat/client.py
Outdated
@@ -537,35 +540,37 @@ | |||
async def list_roles(self) -> StreamResponse: | |||
return await self.get("roles") | |||
|
|||
async def create_segment(self, segment: Dict) -> StreamResponse: | |||
return await self.post("segments", data={"segment": segment}) | |||
async def create_segment(self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Superclass:
stream_chat/async_chat/client.py
Outdated
@@ -537,35 +540,37 @@ | |||
async def list_roles(self) -> StreamResponse: | |||
return await self.get("roles") | |||
|
|||
async def create_segment(self, segment: Dict) -> StreamResponse: | |||
return await self.post("segments", data={"segment": segment}) | |||
async def create_segment(self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def create_segment(self, segment_type: SegmentType, segment_id: str | None, data: SegmentData | None = ...) -> StreamResponse | Awaitable[StreamResponse]
stream_chat/async_chat/client.py
Outdated
@@ -537,35 +540,37 @@ | |||
async def list_roles(self) -> StreamResponse: | |||
return await self.get("roles") | |||
|
|||
async def create_segment(self, segment: Dict) -> StreamResponse: | |||
return await self.post("segments", data={"segment": segment}) | |||
async def create_segment(self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Subclass:
stream_chat/async_chat/client.py
Outdated
@@ -537,35 +540,37 @@ | |||
async def list_roles(self) -> StreamResponse: | |||
return await self.get("roles") | |||
|
|||
async def create_segment(self, segment: Dict) -> StreamResponse: | |||
return await self.post("segments", data={"segment": segment}) | |||
async def create_segment(self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def create_segment(self, segment_type: SegmentType, segment_id: str, segment_name: str, data: SegmentData) -> Coroutine[Any, Any, StreamResponse]
stream_chat/async_chat/client.py
Outdated
|
||
async def delete_segment(self, segment_id: str) -> StreamResponse: | ||
return await self.delete(f"segments/{segment_id}") | ||
|
||
async def create_campaign(self, campaign: Dict) -> StreamResponse: | ||
return await self.post("campaigns", data={"campaign": campaign}) | ||
async def create_campaign(self, params: CampaignData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Signature of "create_campaign" incompatible with supertype "StreamChatInterface" [override]
stream_chat/async_chat/campaign.py
Outdated
class Campaign(CampaignInterface): | ||
|
||
async def create(self) -> StreamResponse: | ||
state = await self.client.create_campaign(campaign_id=self.campaign_id, data=self.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
state = await self.client.create_campaign(campaign_id=self.campaign_id, data=self.data) | |
state = await self.client.create_campaign( | |
campaign_id=self.campaign_id, data=self.data | |
) |
stream_chat/async_chat/campaign.py
Outdated
return await self.client.get_campaign(campaign_id=self.campaign_id) | ||
|
||
async def update(self, data: CampaignData) -> StreamResponse: | ||
return await self.client.update_campaign(campaign_id=self.campaign_id, data=data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return await self.client.update_campaign(campaign_id=self.campaign_id, data=data) | |
return await self.client.update_campaign( | |
campaign_id=self.campaign_id, data=data | |
) |
stream_chat/async_chat/campaign.py
Outdated
return await self.client.update_campaign(campaign_id=self.campaign_id, data=data) | ||
|
||
async def delete(self, **options: Any) -> StreamResponse: | ||
return await self.client.delete_campaign(campaign_id=self.campaign_id, options=options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return await self.client.delete_campaign(campaign_id=self.campaign_id, options=options) | |
return await self.client.delete_campaign( | |
campaign_id=self.campaign_id, options=options | |
) |
stream_chat/async_chat/campaign.py
Outdated
async def start(self, scheduled_for: Optional[Union[str, datetime.datetime]] = None) -> StreamResponse: | ||
return await self.client.start_campaign(campaign_id=self.campaign_id, scheduled_for=scheduled_for) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def start(self, scheduled_for: Optional[Union[str, datetime.datetime]] = None) -> StreamResponse: | |
return await self.client.start_campaign(campaign_id=self.campaign_id, scheduled_for=scheduled_for) | |
async def start( | |
self, scheduled_for: Optional[Union[str, datetime.datetime]] = None | |
) -> StreamResponse: | |
return await self.client.start_campaign( | |
campaign_id=self.campaign_id, scheduled_for=scheduled_for | |
) |
stream_chat/async_chat/segment.py
Outdated
segment_type=self.segment_type, | ||
segment_id=self.segment_id, | ||
data=self.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
segment_type=self.segment_type, | |
segment_id=self.segment_id, | |
data=self.data | |
segment_type=self.segment_type, segment_id=self.segment_id, data=self.data |
stream_chat/async_chat/client.py
Outdated
|
||
async def update_campaign(self, campaign_id: str, data: Dict) -> StreamResponse: | ||
return await self.put(f"campaigns/{campaign_id}", data={"campaign": data}) | ||
async def update_campaign(self, campaign_id: str, data: CampaignData) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def update_campaign(self, campaign_id: str, data: CampaignData) -> StreamResponse: | |
async def update_campaign( | |
self, campaign_id: str, data: CampaignData | |
) -> StreamResponse: |
stream_chat/async_chat/client.py
Outdated
async def schedule_campaign( | ||
self, campaign_id: str, scheduled_for: int = None | ||
async def start_campaign( | ||
self, campaign_id: str, scheduled_for: Optional[Union[str, datetime.datetime]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
self, campaign_id: str, scheduled_for: Optional[Union[str, datetime.datetime]] = None | |
self, | |
campaign_id: str, | |
scheduled_for: Optional[Union[str, datetime.datetime]] = None, |
stream_chat/async_chat/client.py
Outdated
return await self.post( | ||
f"campaigns/{campaign_id}/start", data=payload | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return await self.post( | |
f"campaigns/{campaign_id}/start", data=payload | |
) | |
return await self.post(f"campaigns/{campaign_id}/start", data=payload) |
updated = await segment.update({ | ||
"name": "updated_name" | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
updated = await segment.update({ | |
"name": "updated_name" | |
}) | |
updated = await segment.update({"name": "updated_name"}) |
|
||
deleted = await segment.delete() | ||
assert deleted.is_ok() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
stream_chat/async_chat/client.py
Outdated
async def create_segment(self, segment: Dict) -> StreamResponse: | ||
return await self.post("segments", data={"segment": segment}) | ||
def segment(self, segment_type: SegmentType, segment_id: Optional[str] = None, | ||
data: Optional[SegmentData] = None) -> Segment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [flake8] <127> reported by reviewdog 🐶
continuation line over-indented for visual indent
stream_chat/async_chat/client.py
Outdated
return Segment(client=self, segment_type=segment_type, segment_id=segment_id, data=data) | ||
|
||
async def create_segment(self, segment_type: SegmentType, segment_id: Optional[str] = None, | ||
data: Optional[SegmentData] = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [flake8] <128> reported by reviewdog 🐶
continuation line under-indented for visual indent
stream_chat/async_chat/client.py
Outdated
async def query_campaigns(self, **params: Any) -> StreamResponse: | ||
return await self.get("campaigns", params={"payload": json.dumps(params)}) | ||
async def query_campaigns(self, filter_conditions: Dict[str, Any], | ||
options: QueryCampaignsOptions = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [flake8] <128> reported by reviewdog 🐶
continuation line under-indented for visual indent
stream_chat/base/campaign.py
Outdated
@@ -0,0 +1,43 @@ | |||
import abc | |||
import datetime | |||
from typing import Awaitable, Union, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
|
||
deleted = await segment.delete() | ||
assert deleted.is_ok() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
stream_chat/async_chat/segment.py
Outdated
class Segment(SegmentInterface): | ||
|
||
async def create(self) -> StreamResponse: | ||
state = await self.client.create_segment( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in "await" (actual type "StreamResponse | Awaitable[StreamResponse]", expected type "Awaitable[Any]") [misc]
stream_chat/async_chat/segment.py
Outdated
return state | ||
|
||
async def get(self) -> StreamResponse: | ||
return await self.client.get_segment(segment_id=self.segment_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in "await" (actual type "StreamResponse | Awaitable[StreamResponse]", expected type "Awaitable[Any]") [misc]
stream_chat/async_chat/segment.py
Outdated
return await self.client.get_segment(segment_id=self.segment_id) | ||
|
||
async def update(self, data: SegmentData) -> StreamResponse: | ||
return await self.client.update_segment( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in "await" (actual type "StreamResponse | Awaitable[StreamResponse]", expected type "Awaitable[Any]") [misc]
stream_chat/async_chat/segment.py
Outdated
) | ||
|
||
async def delete(self) -> StreamResponse: | ||
return await self.client.delete_segment(segment_id=self.segment_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in "await" (actual type "StreamResponse | Awaitable[StreamResponse]", expected type "Awaitable[Any]") [misc]
stream_chat/async_chat/segment.py
Outdated
return await self.client.delete_segment(segment_id=self.segment_id) | ||
|
||
async def target_exists(self, target_id: str) -> StreamResponse: | ||
return await self.client.segment_target_exists(segment_id=self.segment_id, target_id=target_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in "await" (actual type "StreamResponse | Awaitable[StreamResponse]", expected type "Awaitable[Any]") [misc]
stream_chat/async_chat/client.py
Outdated
async def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | ||
payload = {"id": campaign_id} | ||
if data is not None: | ||
payload.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Following member(s) of "CampaignData" have conflicts:
stream_chat/async_chat/client.py
Outdated
async def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | ||
payload = {"id": campaign_id} | ||
if data is not None: | ||
payload.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Expected:
stream_chat/async_chat/client.py
Outdated
async def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | ||
payload = {"id": campaign_id} | ||
if data is not None: | ||
payload.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def getitem(self, str, /) -> str
stream_chat/async_chat/client.py
Outdated
async def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | ||
payload = {"id": campaign_id} | ||
if data is not None: | ||
payload.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Got:
stream_chat/async_chat/client.py
Outdated
async def create_campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> StreamResponse: | ||
payload = {"id": campaign_id} | ||
if data is not None: | ||
payload.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def getitem(self, str, /) -> object
stream_chat/async_chat/client.py
Outdated
self, segment_id: str, target_ids: List[str] | ||
) -> StreamResponse: | ||
return await self.post(f"segments/{segment_id}/addtargets", data={"target_ids": target_ids}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
self, segment_id: str, target_ids: List[str] | |
) -> StreamResponse: | |
return await self.post(f"segments/{segment_id}/addtargets", data={"target_ids": target_ids}) | |
self, segment_id: str, target_ids: List[str] | |
) -> StreamResponse: | |
return await self.post( | |
f"segments/{segment_id}/addtargets", data={"target_ids": target_ids} | |
) |
stream_chat/async_chat/client.py
Outdated
self, segment_id: str, target_ids: List[str] | ||
) -> StreamResponse: | ||
return await self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | ||
|
||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
self, segment_id: str, target_ids: List[str] | |
) -> StreamResponse: | |
return await self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | |
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: | |
self, segment_id: str, target_ids: List[str] | |
) -> StreamResponse: | |
return await self.post( | |
f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids} | |
) | |
def campaign( | |
self, campaign_id: Optional[str] = None, data: CampaignData = None | |
) -> Campaign: |
stream_chat/client.py
Outdated
def add_segment_targets( | ||
self, segment_id: str, target_ids: List[str] | ||
) -> StreamResponse: | ||
return self.post(f"segments/{segment_id}/addtargets", data={"target_ids": target_ids}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return self.post(f"segments/{segment_id}/addtargets", data={"target_ids": target_ids}) | |
return self.post( | |
f"segments/{segment_id}/addtargets", data={"target_ids": target_ids} | |
) |
stream_chat/client.py
Outdated
return self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | ||
|
||
def update_campaign(self, campaign_id: str, data: Dict) -> StreamResponse: | ||
return self.put(f"campaigns/{campaign_id}", data={"campaign": data}) | ||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | |
def update_campaign(self, campaign_id: str, data: Dict) -> StreamResponse: | |
return self.put(f"campaigns/{campaign_id}", data={"campaign": data}) | |
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: | |
return self.post( | |
f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids} | |
) | |
def campaign( | |
self, campaign_id: Optional[str] = None, data: CampaignData = None | |
) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
black
stream_chat/client.py|529|
stream_chat/client.py|531|
stream_chat/client.py|537|
stream_chat/client.py|577|
stream_chat/client.py|604|
stream_chat/types/base.py|9 col 1|
stream_chat/types/base.py|21 col 1|
stream_chat/types/base.py|34 col 1|
stream_chat/types/campaign.py|15 col 1|
stream_chat/types/campaign.py|27 col 1|
stream_chat/types/campaign.py|51 col 1|
stream_chat/tests/test_segment.py|12|
stream_chat/tests/test_segment.py|29|
stream_chat/tests/test_segment.py|58|
stream_chat/tests/test_segment.py|66|
stream_chat/types/segment.py|15 col 1|
stream_chat/types/segment.py|28 col 1|
stream_chat/async_chat/campaign.py
Outdated
|
||
class Campaign(CampaignInterface): | ||
|
||
async def create(self, campaign_id: Optional[str] = None, data: Optional[CampaignData] = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def create(self, campaign_id: Optional[str] = None, data: Optional[CampaignData] = None) -> StreamResponse: | |
async def create( | |
self, campaign_id: Optional[str] = None, data: Optional[CampaignData] = None | |
) -> StreamResponse: |
stream_chat/async_chat/campaign.py
Outdated
return await self.client.update_campaign(campaign_id=self.campaign_id, data=data) | ||
|
||
async def delete(self, **options: Any) -> StreamResponse: | ||
return await self.client.delete_campaign(campaign_id=self.campaign_id, **options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
return await self.client.delete_campaign(campaign_id=self.campaign_id, **options) | |
return await self.client.delete_campaign( | |
campaign_id=self.campaign_id, **options | |
) |
stream_chat/async_chat/segment.py
Outdated
from typing import Optional | ||
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import SegmentData, SegmentDataWithId, QuerySegmentTargetsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
from stream_chat.types.segment import SegmentData, SegmentDataWithId, QuerySegmentTargetsOptions | |
from stream_chat.types.segment import ( | |
SegmentData, | |
SegmentDataWithId, | |
QuerySegmentTargetsOptions, | |
) |
stream_chat/async_chat/segment.py
Outdated
|
||
class Segment(SegmentInterface): | ||
|
||
async def create(self, segment_id: Optional[str] = None, data: Optional[SegmentData] = None) -> StreamResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def create(self, segment_id: Optional[str] = None, data: Optional[SegmentData] = None) -> StreamResponse: | |
async def create( | |
self, segment_id: Optional[str] = None, data: Optional[SegmentData] = None | |
) -> StreamResponse: |
stream_chat/async_chat/segment.py
Outdated
async def query_targets(self, options: QuerySegmentTargetsOptions) -> StreamResponse: | ||
return await self.client.query_segment_targets(segment_id=self.segment_id, options=options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
async def query_targets(self, options: QuerySegmentTargetsOptions) -> StreamResponse: | |
return await self.client.query_segment_targets(segment_id=self.segment_id, options=options) | |
async def query_targets( | |
self, options: QuerySegmentTargetsOptions | |
) -> StreamResponse: | |
return await self.client.query_segment_targets( | |
segment_id=self.segment_id, options=options | |
) |
updated = await segment.update({ | ||
"name": "updated_name", | ||
"description": "updated_description", | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
updated = await segment.update({ | |
"name": "updated_name", | |
"description": "updated_description", | |
}) | |
updated = await segment.update( | |
{ | |
"name": "updated_name", | |
"description": "updated_description", | |
} | |
) |
query_targets_1 = await segment.query_targets({ | ||
"limit": 3, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
query_targets_1 = await segment.query_targets({ | |
"limit": 3, | |
}) | |
query_targets_1 = await segment.query_targets( | |
{ | |
"limit": 3, | |
} | |
) |
query_targets_2 = await segment.query_targets({ | ||
"limit": 3, | ||
"next": query_targets_1["next"], | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
query_targets_2 = await segment.query_targets({ | |
"limit": 3, | |
"next": query_targets_1["next"], | |
}) | |
query_targets_2 = await segment.query_targets( | |
{ | |
"limit": 3, | |
"next": query_targets_1["next"], | |
} | |
) |
stream_chat/tests/test_campaign.py
Outdated
updated = campaign.update({ | ||
"message_template": { | ||
"text": "{Hello}", | ||
}, | ||
"segment_ids": [segment_id], | ||
"sender_id": sender_id, | ||
"name": "updated_name", | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
updated = campaign.update({ | |
"message_template": { | |
"text": "{Hello}", | |
}, | |
"segment_ids": [segment_id], | |
"sender_id": sender_id, | |
"name": "updated_name", | |
}) | |
updated = campaign.update( | |
{ | |
"message_template": { | |
"text": "{Hello}", | |
}, | |
"segment_ids": [segment_id], | |
"sender_id": sender_id, | |
"name": "updated_name", | |
} | |
) |
stream_chat/client.py
Outdated
from stream_chat.campaign import Campaign | ||
from stream_chat.segment import Segment | ||
from stream_chat.types.campaign import QueryCampaignsOptions, CampaignData | ||
from stream_chat.types.segment import SegmentType, QuerySegmentsOptions, SegmentData, QuerySegmentTargetsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
from stream_chat.types.segment import SegmentType, QuerySegmentsOptions, SegmentData, QuerySegmentTargetsOptions | |
from stream_chat.types.segment import ( | |
SegmentType, | |
QuerySegmentsOptions, | |
SegmentData, | |
QuerySegmentTargetsOptions, | |
) |
stream_chat/async_chat/client.py
Outdated
from stream_chat.async_chat.campaign import Campaign | ||
from stream_chat.async_chat.segment import Segment | ||
from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions | ||
from stream_chat.types.segment import SegmentType, SegmentData, QuerySegmentsOptions, QuerySegmentTargetsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/async_chat/segment.py
Outdated
from typing import Optional | ||
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import SegmentData, SegmentDataWithId, QuerySegmentTargetsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/async_chat/segment.py
Outdated
from typing import Optional | ||
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import SegmentData, SegmentDataWithId, QuerySegmentTargetsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'stream_chat.types.segment.SegmentDataWithId' imported but unused
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import SegmentData, SegmentDataWithId, QuerySegmentTargetsOptions | ||
from stream_chat.types.stream_response import StreamResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import SegmentData, SegmentDataWithId, QuerySegmentTargetsOptions | ||
from stream_chat.types.stream_response import StreamResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
stream_chat/client.py
Outdated
from stream_chat.campaign import Campaign | ||
from stream_chat.segment import Segment | ||
from stream_chat.types.campaign import QueryCampaignsOptions, CampaignData | ||
from stream_chat.types.segment import SegmentType, QuerySegmentsOptions, SegmentData, QuerySegmentTargetsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/segment.py
Outdated
from typing import Optional | ||
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import SegmentData, QuerySegmentTargetsOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import SegmentData, QuerySegmentTargetsOptions | ||
from stream_chat.types.stream_response import StreamResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
stream_chat/types/base.py
Outdated
@@ -0,0 +1,36 @@ | |||
from enum import IntEnum | |||
from typing import TypedDict, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/types/campaign.py
Outdated
@@ -0,0 +1,64 @@ | |||
import datetime | |||
from typing import List, Optional, TypedDict, Dict, Union |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
stream_chat/base/client.py
Outdated
@@ -918,18 +924,39 @@ def list_roles(self) -> Union[StreamResponse, Awaitable[StreamResponse]]: | |||
""" | |||
pass | |||
|
|||
def segment( | |||
self, segment_type: SegmentType, segment_id: Optional[str], data: Optional[SegmentData] | |||
) -> TSegment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
stream_chat/base/client.py
Outdated
|
||
def campaign( | ||
self, campaign_id: Optional[str], data: Optional[CampaignData] | ||
) -> TCampaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
stream_chat/segment.py
Outdated
return self.client.add_segment_targets(segment_id=self.segment_id, target_ids=target_ids) | ||
|
||
def query_targets(self, options: QuerySegmentTargetsOptions) -> StreamResponse: | ||
return self.client.query_segment_targets(segment_id=self.segment_id, options=options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/campaign.py
Outdated
return self.client.update_campaign(campaign_id=self.campaign_id, data=data) | ||
|
||
def delete(self, **options: Any) -> StreamResponse: | ||
return self.client.delete_campaign(campaign_id=self.campaign_id, **options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/async_chat/segment.py
Outdated
return await self.client.add_segment_targets(segment_id=self.segment_id, target_ids=target_ids) | ||
|
||
async def query_targets(self, options: QuerySegmentTargetsOptions) -> StreamResponse: | ||
return await self.client.query_segment_targets(segment_id=self.segment_id, options=options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in "await" (actual type "StreamResponse | Awaitable[StreamResponse]", expected type "Awaitable[Any]") [misc]
stream_chat/async_chat/client.py
Outdated
) -> StreamResponse: | ||
return await self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | ||
|
||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Signature of "campaign" incompatible with supertype "StreamChatInterface" [override]
stream_chat/async_chat/client.py
Outdated
) -> StreamResponse: | ||
return await self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | ||
|
||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Superclass:
stream_chat/async_chat/client.py
Outdated
) -> StreamResponse: | ||
return await self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | ||
|
||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def [TCampaign] campaign(self, campaign_id: str | None, data: CampaignData | None) -> TCampaign
stream_chat/async_chat/client.py
Outdated
) -> StreamResponse: | ||
return await self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | ||
|
||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Subclass:
stream_chat/async_chat/client.py
Outdated
) -> StreamResponse: | ||
return await self.post(f"segments/{segment_id}/deletetargets", data={"target_ids": target_ids}) | ||
|
||
def campaign(self, campaign_id: Optional[str] = None, data: CampaignData = None) -> Campaign: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def campaign(self, campaign_id: str | None = ..., data: CampaignData = ...) -> Campaign
stream_chat/async_chat/segment.py
Outdated
from typing import Optional | ||
|
||
from stream_chat.base.segment import SegmentInterface | ||
from stream_chat.types.segment import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'stream_chat.types.segment.SegmentDataWithId' imported but unused
from typing import Awaitable, List, Optional, Union | ||
|
||
from stream_chat.base.client import StreamChatInterface | ||
from stream_chat.types.segment import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'stream_chat.types.segment.SegmentDataWithId' imported but unused
stream_chat/segment.py
Outdated
return self.client.get_segment(segment_id=self.segment_id) | ||
|
||
def update(self, data: SegmentData) -> StreamResponse: | ||
return self.client.update_segment(segment_id=self.segment_id, data=data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/segment.py
Outdated
return self.client.delete_segment(segment_id=self.segment_id) | ||
|
||
def target_exists(self, target_id: str) -> StreamResponse: | ||
return self.client.segment_target_exists( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/segment.py
Outdated
) | ||
|
||
def add_targets(self, target_ids: list) -> StreamResponse: | ||
return self.client.add_segment_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/segment.py
Outdated
) | ||
|
||
def query_targets(self, options: QuerySegmentTargetsOptions) -> StreamResponse: | ||
return self.client.query_segment_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/segment.py
Outdated
) | ||
|
||
def delete_targets(self, target_ids: list) -> StreamResponse: | ||
return self.client.delete_segment_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible return value type (got "StreamResponse | Awaitable[StreamResponse]", expected "StreamResponse") [return-value]
stream_chat/async_chat/client.py
Outdated
) | ||
|
||
async def query_recipients(self, **params: Any) -> StreamResponse: | ||
return await self.get("recipients", params={"payload": json.dumps(params)}) | ||
def campaign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Signature of "campaign" incompatible with supertype "StreamChatInterface" [override]
stream_chat/async_chat/client.py
Outdated
) | ||
|
||
async def query_recipients(self, **params: Any) -> StreamResponse: | ||
return await self.get("recipients", params={"payload": json.dumps(params)}) | ||
def campaign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Superclass:
stream_chat/async_chat/client.py
Outdated
) | ||
|
||
async def query_recipients(self, **params: Any) -> StreamResponse: | ||
return await self.get("recipients", params={"payload": json.dumps(params)}) | ||
def campaign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def [TCampaign] campaign(self, campaign_id: str | None, data: CampaignData | None) -> TCampaign
stream_chat/async_chat/client.py
Outdated
) | ||
|
||
async def query_recipients(self, **params: Any) -> StreamResponse: | ||
return await self.get("recipients", params={"payload": json.dumps(params)}) | ||
def campaign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Subclass:
stream_chat/async_chat/client.py
Outdated
) | ||
|
||
async def query_recipients(self, **params: Any) -> StreamResponse: | ||
return await self.get("recipients", params={"payload": json.dumps(params)}) | ||
def campaign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def campaign(self, campaign_id: str | None = ..., data: CampaignData = ...) -> Campaign
stream_chat/base/client.py
Outdated
self, | ||
filter_conditions: Optional[Dict[str, Any]] = None, | ||
sort: Optional[List[SortParam]] = None, | ||
options: Optional[QueryCampaignsOptions] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
options: Optional[QueryCampaignsOptions] = None | |
options: Optional[QueryCampaignsOptions] = None, |
segment_id = created["segment"]["id"] | ||
|
||
target_ids = [str(uuid.uuid4()) for _ in range(10)] | ||
target_added = await client.add_segment_targets(segment_id=segment_id, target_ids=target_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
target_added = await client.add_segment_targets(segment_id=segment_id, target_ids=target_ids) | |
target_added = await client.add_segment_targets( | |
segment_id=segment_id, target_ids=target_ids | |
) |
target_added = await client.add_segment_targets(segment_id=segment_id, target_ids=target_ids) | ||
assert target_added.is_ok() | ||
|
||
query_segments = await client.query_segments(filter_conditions={"id": {"$eq": segment_id}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
query_segments = await client.query_segments(filter_conditions={"id": {"$eq": segment_id}}) | |
query_segments = await client.query_segments( | |
filter_conditions={"id": {"$eq": segment_id}} | |
) |
assert "segments" in query_segments | ||
assert len(query_segments["segments"]) == 1 | ||
|
||
target_deleted = await client.remove_segment_targets(segment_id=segment_id, target_ids=target_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
target_deleted = await client.remove_segment_targets(segment_id=segment_id, target_ids=target_ids) | |
target_deleted = await client.remove_segment_targets( | |
segment_id=segment_id, target_ids=target_ids | |
) |
assert target_deleted.is_ok() | ||
|
||
deleted = await client.delete_segment(segment_id=segment_id) | ||
assert deleted.is_ok() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
assert deleted.is_ok() | |
assert deleted.is_ok() |
stream_chat/client.py
Outdated
self, | ||
filter_conditions: Optional[Dict[str, Any]] = None, | ||
sort: Optional[List[SortParam]] = None, | ||
options: Optional[QuerySegmentsOptions] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
options: Optional[QuerySegmentsOptions] = None | |
options: Optional[QuerySegmentsOptions] = None, |
stream_chat/client.py
Outdated
self, | ||
filter_conditions: Optional[Dict[str, Any]] = None, | ||
sort: Optional[List[SortParam]] = None, | ||
options: Optional[QueryCampaignsOptions] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
options: Optional[QueryCampaignsOptions] = None | |
options: Optional[QueryCampaignsOptions] = None, |
stream_chat/tests/test_segment.py
Outdated
segment_id = created["segment"]["id"] | ||
|
||
target_ids = [str(uuid.uuid4()) for _ in range(10)] | ||
target_added = client.add_segment_targets(segment_id=segment_id, target_ids=target_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
target_added = client.add_segment_targets(segment_id=segment_id, target_ids=target_ids) | |
target_added = client.add_segment_targets( | |
segment_id=segment_id, target_ids=target_ids | |
) |
stream_chat/tests/test_segment.py
Outdated
target_added = client.add_segment_targets(segment_id=segment_id, target_ids=target_ids) | ||
assert target_added.is_ok() | ||
|
||
query_segments = client.query_segments(filter_conditions={"id": {"$eq": segment_id}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
query_segments = client.query_segments(filter_conditions={"id": {"$eq": segment_id}}) | |
query_segments = client.query_segments( | |
filter_conditions={"id": {"$eq": segment_id}} | |
) |
stream_chat/tests/test_segment.py
Outdated
assert "segments" in query_segments | ||
assert len(query_segments["segments"]) == 1 | ||
|
||
target_deleted = client.remove_segment_targets(segment_id=segment_id, target_ids=target_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
target_deleted = client.remove_segment_targets(segment_id=segment_id, target_ids=target_ids) | |
target_deleted = client.remove_segment_targets( | |
segment_id=segment_id, target_ids=target_ids | |
) |
stream_chat/async_chat/segment.py
Outdated
@@ -0,0 +1,66 @@ | |||
from typing import Dict, Optional, List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
@@ -0,0 +1,66 @@ | |||
from typing import Dict, Optional, List | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
stream_chat/segment.py
Outdated
@@ -0,0 +1,64 @@ | |||
from typing import Dict, Optional, List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <1> reported by reviewdog 🐶
isort found an import in the wrong position
@@ -0,0 +1,64 @@ | |||
from typing import Dict, Optional, List | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [flake8] <5> reported by reviewdog 🐶
isort found an unexpected missing import
assert target_deleted.is_ok() | ||
|
||
deleted = await client.delete_segment(segment_id=segment_id) | ||
assert deleted.is_ok() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline at end of file
stream_chat/types/campaign.py
Outdated
@@ -0,0 +1,70 @@ | |||
from typing import Dict, List, Optional, TypedDict | |||
|
|||
from stream_chat.types.base import Pager, SortParam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'stream_chat.types.base.SortParam' imported but unused
stream_chat/types/segment.py
Outdated
@@ -0,0 +1,40 @@ | |||
from enum import Enum | |||
from typing import Dict, List, Optional, TypedDict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'typing.List' imported but unused
stream_chat/types/segment.py
Outdated
from enum import Enum | ||
from typing import Dict, List, Optional, TypedDict | ||
|
||
from stream_chat.types.base import Pager, SortParam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[flake8] <401> reported by reviewdog 🐶
'stream_chat.types.base.SortParam' imported but unused
segment_id=self.segment_id, target_ids=target_ids | ||
) | ||
|
||
def query_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Signature of "query_targets" incompatible with supertype "SegmentInterface" [override]
segment_id=self.segment_id, target_ids=target_ids | ||
) | ||
|
||
def query_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Superclass:
segment_id=self.segment_id, target_ids=target_ids | ||
) | ||
|
||
def query_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def query_targets(self, filter_conditions: dict[Any, Any] | None = ..., options: QuerySegmentTargetsOptions | None = ...) -> StreamResponse | Awaitable[StreamResponse]
segment_id=self.segment_id, target_ids=target_ids | ||
) | ||
|
||
def query_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
Subclass:
segment_id=self.segment_id, target_ids=target_ids | ||
) | ||
|
||
def query_targets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [mypy] reported by reviewdog 🐶
def query_targets(self, filter_conditions: dict[Any, Any] | None = ..., sort: list[SortParam] | None = ..., options: QuerySegmentTargetsOptions | None = ...) -> StreamResponse
if filter_conditions is not None: | ||
payload["filter"] = filter_conditions | ||
if sort is not None: | ||
payload["sort"] = sort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "list[SortParam]", target has type "dict[str, Any]") [assignment]
stream_chat/client.py
Outdated
if filter_conditions is not None: | ||
payload["filter"] = filter_conditions | ||
if sort is not None: | ||
payload["sort"] = sort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "list[SortParam]", target has type "dict[str, Any]") [assignment]
stream_chat/async_chat/client.py
Outdated
if filter_conditions is not None: | ||
payload["filter"] = filter_conditions | ||
if sort is not None: | ||
payload["sort"] = sort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "list[SortParam]", target has type "dict[str, Any]") [assignment]
stream_chat/async_chat/client.py
Outdated
if filter_conditions is not None: | ||
payload["filter"] = filter_conditions | ||
if sort is not None: | ||
payload["sort"] = sort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "list[SortParam]", target has type "dict[str, Any]") [assignment]
stream_chat/async_chat/client.py
Outdated
if filter_conditions is not None: | ||
payload["filter"] = filter_conditions | ||
if sort is not None: | ||
payload["sort"] = sort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [mypy] reported by reviewdog 🐶
Incompatible types in assignment (expression has type "list[SortParam]", target has type "dict[str, Any]") [assignment]
Will recreate a PR |
Submit a pull request
CLA
Description of the pull request