Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56949bc

Browse files
authored
Merge pull request python-telegram-bot#674 from python-telegram-bot/restructure-internal
Move a lot of files
2 parents 470ee86 + 512ca26 commit 56949bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+56
-61
lines changed

telegram/__init__.py

+52-56
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,20 @@
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919
"""A library that provides a Python interface to the Telegram Bot API"""
2020

21-
from sys import version_info
22-
import sys
23-
import os
24-
2521
from .base import TelegramObject
2622
from .user import User
2723
from .chat import Chat
2824
from .chatmember import ChatMember
29-
from .photosize import PhotoSize
30-
from .audio import Audio
31-
from .voice import Voice
32-
from .document import Document
33-
from .sticker import Sticker
34-
from .video import Video
35-
from .contact import Contact
36-
from .location import Location
37-
from .venue import Venue
25+
from .files.photosize import PhotoSize
26+
from .files.audio import Audio
27+
from .files.voice import Voice
28+
from .files.document import Document
29+
from .files.sticker import Sticker
30+
from .files.video import Video
31+
from .files.contact import Contact
32+
from .files.location import Location
33+
from .files.venue import Venue
34+
from .files.videonote import VideoNote
3835
from .chataction import ChatAction
3936
from .userprofilephotos import UserProfilePhotos
4037
from .keyboardbutton import KeyboardButton
@@ -43,56 +40,55 @@
4340
from .replykeyboardremove import ReplyKeyboardRemove, ReplyKeyboardHide
4441
from .forcereply import ForceReply
4542
from .error import TelegramError
46-
from .inputfile import InputFile
47-
from .file import File
43+
from .files.inputfile import InputFile
44+
from .files.file import File
4845
from .emoji import Emoji
4946
from .parsemode import ParseMode
5047
from .messageentity import MessageEntity
51-
from .animation import Animation
52-
from .game import Game
53-
from .shippingaddress import ShippingAddress
54-
from .orderinfo import OrderInfo
55-
from .successfulpayment import SuccessfulPayment
56-
from .invoice import Invoice
48+
from .games.animation import Animation
49+
from .games.game import Game
50+
from .payment.shippingaddress import ShippingAddress
51+
from .payment.orderinfo import OrderInfo
52+
from .payment.successfulpayment import SuccessfulPayment
53+
from .payment.invoice import Invoice
5754
from .message import Message
58-
from .inputmessagecontent import InputMessageContent
5955
from .callbackquery import CallbackQuery
6056
from .choseninlineresult import ChosenInlineResult
61-
from .inlinekeyboardbutton import InlineKeyboardButton
62-
from .inlinekeyboardmarkup import InlineKeyboardMarkup
63-
from .inlinequery import InlineQuery
64-
from .inlinequeryresult import InlineQueryResult
65-
from .inlinequeryresultarticle import InlineQueryResultArticle
66-
from .inlinequeryresultaudio import InlineQueryResultAudio
67-
from .inlinequeryresultcachedaudio import InlineQueryResultCachedAudio
68-
from .inlinequeryresultcacheddocument import InlineQueryResultCachedDocument
69-
from .inlinequeryresultcachedgif import InlineQueryResultCachedGif
70-
from .inlinequeryresultcachedmpeg4gif import InlineQueryResultCachedMpeg4Gif
71-
from .inlinequeryresultcachedphoto import InlineQueryResultCachedPhoto
72-
from .inlinequeryresultcachedsticker import InlineQueryResultCachedSticker
73-
from .inlinequeryresultcachedvideo import InlineQueryResultCachedVideo
74-
from .inlinequeryresultcachedvoice import InlineQueryResultCachedVoice
75-
from .inlinequeryresultcontact import InlineQueryResultContact
76-
from .inlinequeryresultdocument import InlineQueryResultDocument
77-
from .inlinequeryresultgif import InlineQueryResultGif
78-
from .inlinequeryresultlocation import InlineQueryResultLocation
79-
from .inlinequeryresultmpeg4gif import InlineQueryResultMpeg4Gif
80-
from .inlinequeryresultphoto import InlineQueryResultPhoto
81-
from .inlinequeryresultvenue import InlineQueryResultVenue
82-
from .inlinequeryresultvideo import InlineQueryResultVideo
83-
from .inlinequeryresultvoice import InlineQueryResultVoice
84-
from .inlinequeryresultgame import InlineQueryResultGame
85-
from .inputtextmessagecontent import InputTextMessageContent
86-
from .inputlocationmessagecontent import InputLocationMessageContent
87-
from .inputvenuemessagecontent import InputVenueMessageContent
88-
from .inputcontactmessagecontent import InputContactMessageContent
89-
from .labeledprice import LabeledPrice
90-
from .shippingoption import ShippingOption
91-
from .precheckoutquery import PreCheckoutQuery
92-
from .shippingquery import ShippingQuery
57+
from .inline.inlinekeyboardbutton import InlineKeyboardButton
58+
from .inline.inlinekeyboardmarkup import InlineKeyboardMarkup
59+
from .inline.inputmessagecontent import InputMessageContent
60+
from .inline.inlinequery import InlineQuery
61+
from .inline.inlinequeryresult import InlineQueryResult
62+
from .inline.inlinequeryresultarticle import InlineQueryResultArticle
63+
from .inline.inlinequeryresultaudio import InlineQueryResultAudio
64+
from .inline.inlinequeryresultcachedaudio import InlineQueryResultCachedAudio
65+
from .inline.inlinequeryresultcacheddocument import InlineQueryResultCachedDocument
66+
from .inline.inlinequeryresultcachedgif import InlineQueryResultCachedGif
67+
from .inline.inlinequeryresultcachedmpeg4gif import InlineQueryResultCachedMpeg4Gif
68+
from .inline.inlinequeryresultcachedphoto import InlineQueryResultCachedPhoto
69+
from .inline.inlinequeryresultcachedsticker import InlineQueryResultCachedSticker
70+
from .inline.inlinequeryresultcachedvideo import InlineQueryResultCachedVideo
71+
from .inline.inlinequeryresultcachedvoice import InlineQueryResultCachedVoice
72+
from .inline.inlinequeryresultcontact import InlineQueryResultContact
73+
from .inline.inlinequeryresultdocument import InlineQueryResultDocument
74+
from .inline.inlinequeryresultgif import InlineQueryResultGif
75+
from .inline.inlinequeryresultlocation import InlineQueryResultLocation
76+
from .inline.inlinequeryresultmpeg4gif import InlineQueryResultMpeg4Gif
77+
from .inline.inlinequeryresultphoto import InlineQueryResultPhoto
78+
from .inline.inlinequeryresultvenue import InlineQueryResultVenue
79+
from .inline.inlinequeryresultvideo import InlineQueryResultVideo
80+
from .inline.inlinequeryresultvoice import InlineQueryResultVoice
81+
from .inline.inlinequeryresultgame import InlineQueryResultGame
82+
from .inline.inputtextmessagecontent import InputTextMessageContent
83+
from .inline.inputlocationmessagecontent import InputLocationMessageContent
84+
from .inline.inputvenuemessagecontent import InputVenueMessageContent
85+
from .inline.inputcontactmessagecontent import InputContactMessageContent
86+
from .payment.labeledprice import LabeledPrice
87+
from .payment.shippingoption import ShippingOption
88+
from .payment.precheckoutquery import PreCheckoutQuery
89+
from .payment.shippingquery import ShippingQuery
9390
from .webhookinfo import WebhookInfo
94-
from .gamehighscore import GameHighScore
95-
from .videonote import VideoNote
91+
from .games.gamehighscore import GameHighScore
9692
from .update import Update
9793
from .bot import Bot
9894
from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS,

telegram/files/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

telegram/games/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

telegram/inline/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

telegram/message.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
from time import mktime
2424

2525
from telegram import (Audio, Contact, Document, Chat, Location, PhotoSize, Sticker, TelegramObject,
26-
User, Video, Voice, Venue, MessageEntity, Game, Invoice, SuccessfulPayment)
26+
User, Video, Voice, Venue, MessageEntity, Game, Invoice, SuccessfulPayment,
27+
VideoNote)
2728
from telegram.utils.deprecate import warn_deprecate_obj
2829
from telegram.utils.helpers import escape_html, escape_markdown
29-
from telegram.videonote import VideoNote
3030

3131

3232
class Message(TelegramObject):

telegram/payment/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/test_photo.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,15 @@ def test_send_photo_url_jpg_file(self):
127127
@flaky(3, 1)
128128
@timeout(10)
129129
def test_send_photo_bytesio_jpg_file(self):
130-
from telegram.inputfile import InputFile
131130
# raw image bytes
132131
raw_bytes = BytesIO(open(self.photo_bytes_jpg_no_standard, 'rb').read())
133-
inputfile = InputFile({"photo": raw_bytes})
132+
inputfile = telegram.InputFile({"photo": raw_bytes})
134133
self.assertEqual(inputfile.mimetype, 'application/octet-stream')
135134

136135
# raw image bytes with name info
137136
raw_bytes = BytesIO(open(self.photo_bytes_jpg_no_standard, 'rb').read())
138137
raw_bytes.name = self.photo_bytes_jpg_no_standard
139-
inputfile = InputFile({"photo": raw_bytes})
138+
inputfile = telegram.InputFile({"photo": raw_bytes})
140139
self.assertEqual(inputfile.mimetype, 'image/jpeg')
141140

142141
# send raw photo

0 commit comments

Comments
 (0)