mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-16 22:43:18 +01:00
remove unused imports, use future for urllib imports
This commit is contained in:
parent
a686db2c6f
commit
e160355190
9 changed files with 7 additions and 15 deletions
|
@ -21,16 +21,18 @@
|
|||
"""This module contains a object that represents a Telegram InputFile."""
|
||||
|
||||
try:
|
||||
# python 3
|
||||
from email.generator import _make_boundary as choose_boundary
|
||||
from urllib.request import urlopen
|
||||
except ImportError:
|
||||
# python 2
|
||||
from mimetools import choose_boundary
|
||||
from urllib2 import urlopen
|
||||
|
||||
import imghdr
|
||||
import mimetypes
|
||||
import os
|
||||
import sys
|
||||
import imghdr
|
||||
|
||||
from future.moves.urllib.request import urlopen
|
||||
|
||||
from telegram import TelegramError
|
||||
|
||||
|
@ -81,6 +83,8 @@ class InputFile(object):
|
|||
if 'filename' in data:
|
||||
self.filename = self.data.pop('filename')
|
||||
elif hasattr(self.input_file, 'name'):
|
||||
# on py2.7, pylint fails to understand this properly
|
||||
# pylint: disable=E1101
|
||||
self.filename = os.path.basename(self.input_file.name)
|
||||
elif from_url:
|
||||
self.filename = os.path.basename(self.input_file.url) \
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
import os
|
||||
import sys
|
||||
import signal
|
||||
import traceback
|
||||
|
||||
from nose.tools import make_decorator
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
"""This module contains a object that represents Tests for Telegram Bot"""
|
||||
|
||||
import io
|
||||
import os
|
||||
from datetime import datetime
|
||||
import sys
|
||||
from flaky import flaky
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
"""This module contains a object that represents Tests for Telegram Chat"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
"""This module contains a object that represents Tests for Telegram Contact"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
"""This module contains a object that represents Tests for Telegram Emoji"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
|
|
|
@ -30,11 +30,6 @@ if sys.version_info[0:2] == (2, 6):
|
|||
else:
|
||||
import unittest
|
||||
|
||||
try:
|
||||
from urllib2 import urlopen, Request
|
||||
except ImportError:
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
from telegram.ext import JobQueue, Updater
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
"""This module contains a object that represents Tests for Telegram Location"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
"""This module contains a object that represents Tests for Telegram User"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
|
|
Loading…
Reference in a new issue