Remove union operator from more dataclass fields

This commit is contained in:
Andrew Ferrazzutti 2022-03-09 02:28:01 -05:00
parent 8c2775056d
commit e28694c987
4 changed files with 13 additions and 7 deletions

View File

@ -13,6 +13,8 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Optional
from attr import dataclass
from mautrix.types import SerializableAttrs
@ -23,9 +25,9 @@ from .mention import MentionStruct
@dataclass(kw_only=True)
class Attachment(SerializableAttrs):
shout: bool | None = None
mentions: list[MentionStruct] | None = None
urls: list[str] | None = None
shout: Optional[bool] = None
mentions: Optional[list[MentionStruct]] = None
urls: Optional[list[str]] = None
@dataclass

View File

@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Generic, TypeVar
from typing import Generic, TypeVar, Optional
from attr import dataclass
@ -48,7 +48,7 @@ class ChannelInfo(Channel):
newChatCountInvalid: bool
lastChatLogId: Long
lastSeenLogId: Long
lastChatLog: Chatlog | None = None
lastChatLog: Optional[Chatlog] = None
metaMap: ChannelMetaMap
displayUserList: list[DisplayUserInfo]
pushAlert: bool

View File

@ -13,6 +13,8 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Optional
from attr import dataclass
from mautrix.types import JSON
@ -25,7 +27,7 @@ from . import OpenTokenComponent, OpenLink
@dataclass(kw_only=True)
class OpenChannelInfo(ChannelInfo, OpenChannel, OpenTokenComponent):
directChannel: bool
openLink: OpenLink | None = None
openLink: Optional[OpenLink] = None
@dataclass

View File

@ -13,6 +13,8 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Optional
from attr import dataclass
from mautrix.types import SerializableAttrs
@ -28,7 +30,7 @@ class ChannelUser(SerializableAttrs):
@dataclass(kw_only=True)
class PartialOpenLinkComponent(SerializableAttrs):
"""Substitute for Partial<OpenLinkComponent>"""
linkId: Long | None = None
linkId: Optional[Long] = None
@dataclass