Package: python3-urlgrabber
Architecture: all
Depends: ${python3:Depends},
- python3-six,
python3-pycurl
Description: image creator for Linux distributions
The tool createrep is used to ppfarm test
BuildRequires: python3-six
BuildRequires: python3-setuptools
Requires: python3-pycurl
-Requires: python3-six
Provides: urlgrabber = %{version}-%{release}
%description
# Boston, MA 02111-1307 USA
import time, os, errno, sys
-import six
from urlgrabber.grabber import \
_readlines, URLGrabberOptions, _loads, \
PyCurlFileObject, URLGrabError, _to_utf8
def write(fmt, *arg):
buf = fmt % arg
- if six.PY3:
- buf = buf.encode()
+ buf = buf.encode()
try:
os.write(1, buf)
except OSError as e:
lines = _readlines(0)
if not lines: break
for line in lines:
- if not isinstance(line, six.string_types):
+ if not isinstance(line, st):
line = line.decode('utf-8')
cnt += 1
opts = URLGrabberOptions()
import types
import unittest
-from six import class_types, string_types
-
try:
cmp
except NameError:
tests = []
for name in dir(module):
obj = getattr(module, name)
- if (isinstance(obj, class_types) and
+ if (isinstance(obj, type) and
issubclass(obj, TestCase) and
not obj in [TestCase, FunctionTestCase]):
tests.append(self.loadTestsFromTestCase(obj))
import unittest
if isinstance(obj, types.ModuleType):
return self.loadTestsFromModule(obj)
- elif (isinstance(obj, class_types) and
+ elif (isinstance(obj, type) and
issubclass(obj, unittest.TestCase)):
return self.loadTestsFromTestCase(obj)
elif isinstance(obj, types.UnboundMethodType):
"""
def __init__(self, module='__main__', defaultTest=None,
argv=None, testRunner=None, testLoader=defaultTestLoader):
- if isinstance(module, string_types):
+ if isinstance(module, str):
self.module = __import__(module)
for part in module.split('.')[1:]:
self.module = getattr(self.module, part)
import tempfile, random, os
import socket
from io import BytesIO
-from six import string_types
if sys.version_info >= (3,):
# We do an explicit version check here because because python2
self.assertEqual(self.kwargs, {'bar': 'baz'})
self.assertTrue(isinstance(self.obj, CallbackObject))
url = self.obj.url
- if not isinstance(url, string_types):
+ if not isinstance(url, str):
url = url.decode('utf8')
self.assertEqual(url, ref_404)
self.assertTrue(isinstance(self.obj.exception, URLGrabError))
self.assertEqual(self.kwargs, {'bar': 'baz'})
self.assertTrue(isinstance(self.obj, CallbackObject))
url = self.obj.url
- if not isinstance(url, string_types):
+ if not isinstance(url, str):
url = url.decode()
self.assertEqual(url, short_ref_http)
else:
from cStringIO import StringIO
-from six import text_type, string_types
-
from .byterange import range_tuple_normalize, range_tuple_to_header, RangeError
try:
def _bytes_repr(s):
"A wrapper to avoid the b'' that python3 insists on when printing bytes"
- if isinstance(s, string_types):
+ if isinstance(s, str):
return s
else:
return repr(s)[2:-1]
def _urlunquote_convert(s):
- if not isinstance(s, text_type):
+ if not isinstance(s, str):
s = s.decode('utf8')
return urlunquote(s)
def _to_utf8(obj, errors='replace'):
'''convert 'unicode' to an encoded utf-8 byte string '''
# stolen from yum.i18n
- if isinstance(obj, text_type):
+ if isinstance(obj, str):
obj = obj.encode('utf-8', errors)
return obj
return str(e)
except UnicodeEncodeError:
# always use byte strings
- return text_type(e).encode('utf8')
+ return str(e).encode('utf8')
########################################################################
# END UTILITY FUNCTIONS
"""
(scheme, host, path, parm, query, frag) = parts
newpath = urlquote(path, safe='/$')
- if not isinstance(path, text_type) and isinstance(newpath, text_type):
+ if not isinstance(path, str) and isinstance(newpath, str):
newpath = newpath.encode('utf8')
return (scheme, host, newpath, parm, query, frag)
else -> 1
"""
(scheme, host, path, parm, query, frag) = parts
- if not isinstance(path, text_type):
+ if not isinstance(path, str):
path = path.decode('utf8')
if ' ' in path:
return 1
def _build_range(self):
reget_length = 0
rt = None
- if self.opts.reget and isinstance(self.filename, string_types):
+ if self.opts.reget and isinstance(self.filename, str):
# we have reget turned on and we're dumping to a file
try:
s = os.stat(self.filename)
if self._complete:
return
_was_filename = False
- if isinstance(self.filename, string_types) and self.filename:
+ if isinstance(self.filename, str) and self.filename:
_was_filename = True
self._prog_reportname = str(self.filename)
self._prog_basename = os.path.basename(self.filename)
if v is False: return 'False'
if isinstance(v, numbers.Number):
return str(v)
- if isinstance(v, (str, text_type, bytes)):
+ if isinstance(v, (str, str, bytes)):
# standarize to str on both py2 to py3
if sys.version_info < (3,):
- if isinstance(v, text_type):
+ if isinstance(v, str):
v = v.encode('utf8')
else:
if isinstance(v, bytes):
except ImportError:
import urlparse
-from six import string_types
-
from .grabber import URLGrabError, CallbackObject, DEBUG, _to_utf8
from .grabber import _run_callback, _do_raise
from .grabber import exception2msg
def _parse_mirrors(self, mirrors):
parsed_mirrors = []
for m in mirrors:
- if isinstance(m, string_types):
+ if isinstance(m, str):
m = {'mirror': _to_utf8(m)}
parsed_mirrors.append(m)
return parsed_mirrors
else:
import thread
-from six import integer_types, string_types
-
# Code from http://mail.python.org/pipermail/python-list/2000-May/033365.html
def terminal_width(fd=1):
""" Get the real terminal width """
try:
format = "%-30.30s %6.6s %s"
fn = meter.text or meter.basename
- if isinstance(message, string_types):
+ if isinstance(message, str):
message = message.splitlines()
if not message: message = ['']
out = '%-79s' % (format % (fn, 'FAILED', message[0] or ''))
depth = depth + 1
number = number / step
- if isinstance(number, integer_types):
+ if isinstance(number, int):
# it's an int or a long, which means it didn't get divided,
# which means it's already short enough
format = '%i%s%s'