Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions lib/inputstreamhelper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@
"""Implements various Helper functions"""

from __future__ import absolute_import, division, unicode_literals

import os
import re
from time import time
import struct
from functools import total_ordering
from socket import timeout
from ssl import SSLError
import struct
from time import time
from typing import NamedTuple
from functools import total_ordering

try: # Python 3
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
except ImportError: # Python 2
from urllib2 import HTTPError, Request, URLError, urlopen
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

from . import config
from .kodiutils import (bg_progress_dialog, copy, delete, exists, get_setting, localize, log, mkdirs,
progress_dialog, set_setting, stat_file, translate_path, yesno_dialog)
from .kodiutils import (bg_progress_dialog, copy, delete, exists, get_setting,
localize, log, mkdirs, progress_dialog, set_setting,
stat_file, translate_path, yesno_dialog)
from .unicodes import compat_path, from_unicode, to_unicode


Expand Down Expand Up @@ -123,7 +121,7 @@ def http_head(url):
def http_download(url, message=None, checksum=None, hash_alg='sha1', dl_size=None, background=False): # pylint: disable=too-many-statements
"""Makes HTTP request and displays a progress dialog on download."""
if checksum:
from hashlib import sha1, md5
from hashlib import md5, sha1
if hash_alg == 'sha1':
calc_checksum = sha1()
elif hash_alg == 'md5':
Expand Down Expand Up @@ -324,7 +322,6 @@ def arch():
sys_arch = 'x86' # else, sys_arch = AMD64

elif 'armv' in sys_arch:
import re
arm_version = re.search(r'\d+', sys_arch.split('v')[1])
if arm_version:
sys_arch = 'armv' + arm_version.group()
Expand Down
Loading