From e12a81ebb6bf2660a63a5314d31b9dd192a3e899 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 10 Mar 2018 10:50:51 +0100 Subject: [PATCH] Attempt to fix cyclic imports --- pyrogram/client/types/animation.py | 5 +-- pyrogram/client/types/chat.py | 7 ++--- pyrogram/client/types/chat_member.py | 5 +-- pyrogram/client/types/document.py | 5 +-- pyrogram/client/types/game.py | 5 +-- pyrogram/client/types/message.py | 41 ++++++++++++------------- pyrogram/client/types/message_entity.py | 5 +-- pyrogram/client/types/sticker.py | 7 ++--- pyrogram/client/types/update.py | 11 +++---- pyrogram/client/types/venue.py | 5 +-- pyrogram/client/types/video.py | 5 +-- pyrogram/client/types/video_note.py | 5 +-- 12 files changed, 35 insertions(+), 71 deletions(-) diff --git a/pyrogram/client/types/animation.py b/pyrogram/client/types/animation.py index a3693396..ea04beaf 100644 --- a/pyrogram/client/types/animation.py +++ b/pyrogram/client/types/animation.py @@ -1,10 +1,7 @@ -from . import PhotoSize - - class Animation: def __init__(self, file_id: str, - thumb: PhotoSize = None, + thumb: "PhotoSize" = None, file_name: str = None, mime_type: str = None, file_size: int = None): diff --git a/pyrogram/client/types/chat.py b/pyrogram/client/types/chat.py index 78853bf4..6a09215d 100644 --- a/pyrogram/client/types/chat.py +++ b/pyrogram/client/types/chat.py @@ -1,6 +1,3 @@ -from . import Message, ChatPhoto - - class Chat: def __init__(self, id: int, @@ -10,10 +7,10 @@ class Chat: first_name: str = None, last_name: str = None, all_members_are_administrators: bool = None, - photo: ChatPhoto = None, + photo: "ChatPhoto" = None, description: str = None, invite_link: str = None, - pinned_message: Message = None, + pinned_message: "Message" = None, sticker_set_name: str = None, can_set_sticker_set: bool = None): self.id = id diff --git a/pyrogram/client/types/chat_member.py b/pyrogram/client/types/chat_member.py index e8e4d9be..2497e10b 100644 --- a/pyrogram/client/types/chat_member.py +++ b/pyrogram/client/types/chat_member.py @@ -1,9 +1,6 @@ -from . import User - - class ChatMember: def __init__(self, - user: User, + user: "User", status: str, until_date: int = None, can_be_edited: bool = None, diff --git a/pyrogram/client/types/document.py b/pyrogram/client/types/document.py index cc74c4e7..49a9c79d 100644 --- a/pyrogram/client/types/document.py +++ b/pyrogram/client/types/document.py @@ -1,10 +1,7 @@ -from . import PhotoSize - - class Document: def __init__(self, file_id: str, - thumb: PhotoSize = None, + thumb: "PhotoSize" = None, file_name: str = None, mime_type: str = None, file_size: int = None): diff --git a/pyrogram/client/types/game.py b/pyrogram/client/types/game.py index 387af3f4..905d9ef5 100644 --- a/pyrogram/client/types/game.py +++ b/pyrogram/client/types/game.py @@ -1,6 +1,3 @@ -from . import Animation - - class Game: def __init__(self, title: str, @@ -8,7 +5,7 @@ class Game: photo: list, text: str = None, text_entities: list = None, - animation: Animation = None): + animation: "Animation" = None): self.title = title self.description = description self.photo = photo diff --git a/pyrogram/client/types/message.py b/pyrogram/client/types/message.py index 02cfe74c..0f7a9167 100644 --- a/pyrogram/client/types/message.py +++ b/pyrogram/client/types/message.py @@ -1,14 +1,11 @@ -from . import User, Chat, Audio - - class Message: def __init__(self, message_id: int, date: int, - chat: Chat, - from_user: User = None, - forward_from: User = None, - forward_from_chat: Chat = None, + chat: "Chat", + from_user: "User" = None, + forward_from: "User" = None, + forward_from_chat: "Chat" = None, forward_from_message_id: int = None, forward_signature: str = None, forward_date: int = None, @@ -19,20 +16,20 @@ class Message: text: str = None, entities: list = None, caption_entities: list = None, - audio: Audio = None, - document=None, - game=None, - photo=None, - sticker=None, - video=None, - voice=None, - video_note=None, + audio: "Audio" = None, + document: "Document" = None, + game: "Game" = None, + photo: list = None, + sticker: "Sticker" = None, + video: "Video" = None, + voice: "Voice" = None, + video_note: "VideoNote" = None, caption: str = None, - contact=None, - location=None, - venue=None, + contact: "Contact" = None, + location: "Location" = None, + venue: "Venue" = None, new_chat_members: list = None, - left_chat_member: User = None, + left_chat_member: "User" = None, new_chat_title: str = None, new_chat_photo: list = None, delete_chat_photo: bool = None, @@ -42,9 +39,9 @@ class Message: migrate_to_chat_id: int = None, migrate_from_chat_id: int = None, pinned_message: "Message" = None, - invoice=None, - successful_payment=None, - connected_website=None): + invoice: "Invoice" = None, + successful_payment: "SuccessfulPayment" = None, + connected_website: str = None): self.message_id = message_id self.date = date self.chat = chat diff --git a/pyrogram/client/types/message_entity.py b/pyrogram/client/types/message_entity.py index bdc686c0..97541ef3 100644 --- a/pyrogram/client/types/message_entity.py +++ b/pyrogram/client/types/message_entity.py @@ -1,13 +1,10 @@ -from . import User - - class MessageEntity: def __init__(self, type: str, offset: int, length: int, url: str = None, - user: User = None): + user: "User" = None): self.type = type self.offset = offset self.length = length diff --git a/pyrogram/client/types/sticker.py b/pyrogram/client/types/sticker.py index 1e87fd84..fd3910de 100644 --- a/pyrogram/client/types/sticker.py +++ b/pyrogram/client/types/sticker.py @@ -1,15 +1,12 @@ -from . import PhotoSize, MaskPosition - - class Sticker: def __init__(self, file_id: str, width: int, height: int, - thumb: PhotoSize = None, + thumb: "PhotoSize" = None, emoji: str = None, set_name: str = None, - mask_position: MaskPosition = None, + mask_position: "MaskPosition" = None, file_size: int = None): self.file_id = file_id self.width = width diff --git a/pyrogram/client/types/update.py b/pyrogram/client/types/update.py index f367afc3..cde53690 100644 --- a/pyrogram/client/types/update.py +++ b/pyrogram/client/types/update.py @@ -1,6 +1,3 @@ -from . import Message - - class Update: """This object represents an incoming update. At most one of the optional parameters can be present in any given update. @@ -18,10 +15,10 @@ class Update: """ def __init__(self, - message: Message = None, - edited_message: Message = None, - channel_post: Message = None, - edited_channel_post: Message = None): + message: "Message" = None, + edited_message: "Message" = None, + channel_post: "Message" = None, + edited_channel_post: "Message" = None): self.message = message self.edited_message = edited_message self.channel_post = channel_post diff --git a/pyrogram/client/types/venue.py b/pyrogram/client/types/venue.py index f1c058fd..2b07f132 100644 --- a/pyrogram/client/types/venue.py +++ b/pyrogram/client/types/venue.py @@ -1,9 +1,6 @@ -from . import Location - - class Venue: def __init__(self, - location: Location, + location: "Location", title: str, address: str, foursquare_id: str = None): diff --git a/pyrogram/client/types/video.py b/pyrogram/client/types/video.py index 37d0a8c8..87731593 100644 --- a/pyrogram/client/types/video.py +++ b/pyrogram/client/types/video.py @@ -1,13 +1,10 @@ -from . import PhotoSize - - class Video: def __init__(self, file_id: str, width: int, height: int, duration: int, - thumb: PhotoSize = None, + thumb: "PhotoSize" = None, mime_type: str = None, file_size: int = None): self.file_id = file_id diff --git a/pyrogram/client/types/video_note.py b/pyrogram/client/types/video_note.py index 3969c2d9..5969624d 100644 --- a/pyrogram/client/types/video_note.py +++ b/pyrogram/client/types/video_note.py @@ -1,12 +1,9 @@ -from . import PhotoSize - - class VideoNote: def __init__(self, file_id: str, length: int, duration: int, - thumb: PhotoSize = None, + thumb: "PhotoSize" = None, file_size: int = None): self.file_id = file_id self.length = length