remove unused imports, use future for urllib imports

This commit is contained in:
Noam Meltzer 2016-04-25 18:25:10 +03:00
parent a686db2c6f
commit e160355190
9 changed files with 7 additions and 15 deletions

View file

@ -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) \

View file

@ -22,7 +22,6 @@
import os
import sys
import signal
import traceback
from nose.tools import make_decorator

View file

@ -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

View file

@ -19,7 +19,6 @@
"""This module contains a object that represents Tests for Telegram Chat"""
import os
import unittest
import sys
sys.path.append('.')

View file

@ -19,7 +19,6 @@
"""This module contains a object that represents Tests for Telegram Contact"""
import os
import unittest
import sys
sys.path.append('.')

View file

@ -19,7 +19,6 @@
"""This module contains a object that represents Tests for Telegram Emoji"""
import os
import unittest
import sys
sys.path.append('.')

View file

@ -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

View file

@ -19,7 +19,6 @@
"""This module contains a object that represents Tests for Telegram Location"""
import os
import unittest
import sys
sys.path.append('.')

View file

@ -19,7 +19,6 @@
"""This module contains a object that represents Tests for Telegram User"""
import os
import unittest
import sys
sys.path.append('.')